Q: What does the mov instruction do in AT&T syntax?
A: Copies data from the source to the destination.
Ex. mov %rax, %rbx copies the value in %rax into %rbx.
Q: How do you load from memory into a register in AT&T syntax?
A: Put the address in parentheses.
Ex. mov (%rbx), %al loads 1 byte from the address in %rbx into %al.
Q: How do you move an immediate value into a register in AT&T syntax?
A: Use $ before the immediate.
Ex. mov $123, %eax puts 123 into %eax.
Q: What does the lea instruction do in AT&T syntax?
A: Computes an address and loads it into a register (no memory access).
Ex. lea 8(%rbp), %rax puts the address %rbp+8 into %rax.
Q: What does add do in AT&T syntax?
A: Adds the source to the destination and stores the result in the destination.
Ex. add %rbx, %rax → %rax = %rax + %rbx.
Q: What does sub do in AT&T syntax?
A: Subtracts the source from the destination and stores the result in the destination.
Ex. sub $16, %rsp → %rsp = %rsp - 16.
Q: What does inc do?
A: Increments (adds 1) to the operand.
Ex. inc %rcx → %rcx = %rcx + 1.
Q: What does cqto do?
A: Sign-extends %rax into %rdx for division.
Q: What does imul do?
A: Signed multiply.
Ex. imul %rbx, %rax → %rax = %rax * %rbx.
Q: What does idiv do?
A: Signed divide (rdx:rax) / src. Quotient in %rax, remainder in %rdx.
Ex. idiv %rbx.
Q: What does and do?
A: Bitwise AND of source and destination.
Ex. and %rbx, %rax → %rax = %rax & %rbx.
Q: What does or do?
A: Bitwise OR of source and destination.
Ex. or $1, %rax sets the least significant bit of %rax.
Q: What does xor (or xorl) do?
A: Bitwise XOR. Common trick: xorl %eax, %eax sets %eax to zero.
Q: What does not do?
A: Bitwise NOT (inverts bits).
Ex. not %rax.
Q: What does shl do?
A: Logical left shift.
Ex. shl $2, %rax → %rax «= 2.
Q: What does shr do?
A: Logical right shift (fills with zeros).
Ex. shr $1, %rax → %rax»_space;= 1.
Q: What does jmp do?
A: Unconditional jump to a label.
Ex. jmp my_label.
Q: What does cmp do?
A: Compares source and destination (dest - src) and sets flags, but does not store a result.
Ex. cmp $10, %rax.
Q: What does je do?
A: Jump if equal (ZF = 1).
Q: What does jne do?
A: Jump if not equal (ZF = 0).
Q: What does jg do?
A: Jump if greater (signed) → ZF=0 and SF=OF.
Q: What does jge do?
A: Jump if greater or equal (signed) → SF=OF.
Q: What does jl do?
A: Jump if less (signed) → SF≠OF.
Q: What does jle do?
A: Jump if less or equal (signed) → ZF=1 or SF≠OF.