I am having trouble deciphering this given Assembly code:
1 unknown5:
2 pxor %xmm0, %xmm0
3 movl $0, %eax
4 jmp .L13
5 .L14:
6 movss (%rdx,%rax,4), %xmm1
7 mulss (%rsi,%rax,4), %xmm1
8 addss %xmm1, %xmm0
9 addq $1, %rax
10 .L13:
11 cmpq %rdi, %rax
12 jb .L14
13 rep ret
What I think is going on:
- 1: function named unknown5()
- 2: sets the floating point return register to 0
- 3: sets the 32-bit return register to 0
- 4: jumps to 10:
- 11: if %rdi > %rax, go to 5:, else go to 13:
- 6: %xmm1 = %rdx+%rax+4
- 7: %xmm1 *= %rsi+%rax+4
- 8: %xmm0 += %xmm1
- 9: %rax += 1
- 13: return %eax, %rax, or %xmm0??
What I have no clue of is what the possible parameters are of the function, nor what each register is representing. I know %rdi, %rsi, and %rdx are first, second, and third parameters (that might be floating point pointers due to single precision operations?), and %xmm0, %xmm1 are first and second floating point parameters (OR local variables?). I also know %rax is the 64-bit return register, but am unsure why it is used here as such. Could someone please elaborate and correct my comprehension? Thank you.