Search code examples
assemblyx86att

x86 assembly: How does the 'subl' command work in AT&T syntax


%edx has a value of 0x3, and %eax has a value of 0x100. Then we have the instruction: subl %edx, %eax What's the result value of %eax?


Solution

  • You have

    movl $3, %edx
    movl $0x100, %eax
    

    as input values. The instruction

    subl %edx, %eax
    

    just subtracts 3(dec) in EDX from 100(hex) in EAX resulting in 100h-3h=0FDh.