Aside: this test code would have been a bit easier to debug if it had used decimal bases. That is, replace
int a[] = {10,20,30};
int r = 1 * a[i++] + 2 * a[i++] + 3 * a[i++];
with int a[] = {1,2,3};
int r = 1 * a[i++] + 10 * a[i++] + 100 * a[i++];
Then if your program outputs r = 111, it's obvious that it's doing a[0] + 10*a[0] + 100*a[0]
and if it outputs 321, it's obvious that it's doing a[0] + 10*a[1] + 100*a[2]
No disassembly required.