0

so I have this piece of assembly code that I'm learning to analyse:

0x0000000000401512 <+0>:     sub    $0x8,%rsp
0x0000000000401516 <+4>:     cmp    $0x4,%rdi
0x000000000040151a <+8>:     jne    0x40153d <Arithmetic+43>
0x000000000040151c <+10>:    not    %r8
0x000000000040151f <+13>:    and    %r8,%rsi
0x0000000000401522 <+16>:    xor    $0xe1,%sil
0x0000000000401526 <+20>:    mov    $0x165,%ecx
0x000000000040152b <+25>:    sub    %rsi,%rcx
0x000000000040152e <+28>:    cmp    $0x62,%rcx
0x0000000000401532 <+32>:    sete   %al
0x0000000000401535 <+35>:    movzbl %al,%eax
0x0000000000401538 <+38>:    cmp    %rdx,%rcx
0x000000000040153b <+41>:    je     0x401549 <Arithmetic+55>
0x000000000040153d <+43>:    callq  0x401e14 <failed>
0x0000000000401542 <+48>:    mov    $0xffffffffaa4bcb16,%rax
0x0000000000401549 <+55>:    add    $0x8,%rsp
0x000000000040154d <+59>:    retq   

I understand the purpose of all registers in here except for %sil and %ecx. What is their purpose in the code?

Thanks a lot for reading this.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
  • 2
    %sil is the register that contains the lower 8 bits of %rsi, %ecx is register that contains the lower 32 bits of %rcx. You can find the registers here https://www.tortall.net/projects/yasm/manual/html/arch-x86-registers.html – Michael Petch Oct 20 '22 at 04:54

0 Answers0