I am having difficulty with reverse engineering this assembly code to deduce the values of the array's dimensions.
I am given
struct vec3 {
long z;
int x;
unsigned short y;
};
struct vec3 array1[2][A];
struct vec3 array2[8][B];
int arrayfunc(int i1, int j1, int i2, int j2){
return array1[i1][j1].x + array1[i1][j1].y - array2[i2][j2].y;
}
This is the C code provided and the types of the member data x,y,z were unknown but this is what I deduced them to be.
arrayfunc:
leaq array1(%rip), %rax
movslq %ecx, %rcx
movslq %edx, %r10
movslq %r9d, %r9
leaq (%rcx,%rcx,2), %rdx
movslq %r8d, %r8
movq %rax, %rcx
addq %r10, %rdx
salq $4, %rdx
movzwl 12(%rax,%rdx), %eax
addl 8(%rcx,%rdx), %eax
leaq (%r9,%r8,2), %rdx
leaq array2(%rip), %rcx
salq $4, %rdx
movzwl 12(%rcx,%rdx), %edx
subl %edx, %eax
ret
The issue here is that I am not sure how I can find the values of A and B from the assembly code.
Any and all help is always appreciated :)
Thanks :))