This is the assembly code from my bomb lap question, I am stuck in phase2; The bomb lab require us to find out the correct input based on assembly code or it will exploded.
From <+20> I know that %rbp -0x30(48) == 0 or it will call <+32> and explode the bomb; so %rbp = 48(DEC)
After that(+26) %rbp - 0x2c(44) must equal 1 or it will explode the bomb... But since %rbp = 48, the bomb will explode anywhere so I am confuse now...
I think I misunderstand the compl , je/jne or how to calculate these things...
-0x30(%ebp)
doesn't mean to use the value %ebp - 0x30
. It's a memory address to read from. The instruction (cmpl
) has an l
suffix, so it's dealing with a 4 byte quantity. So what's actually happening is that it reads a 4 byte number from the address %ebp - 0x30
and checks whether it's zero.
(The $
prefix means it's an immediate value, not an address. This is why 0x0
is taken literally and not dereferenced.)