I am working on counting the number of assembly instructions in a disassembled code (add,sub,jmp, etc.). I also have to consider conditions that might cause loops/jumps requiring me to repeatedly count a set of instructions. Therefore, I have to record the values of registers, so when I encounter a condition like "jne", I'll know whether the code jumped or if I can just continue parsing the disassembled code.
I am currently confused on the initial values of registers like (edx, eax, rbp, rsp, etc.). I used objdump to dump all the assembly code, and I can see that in my disassembled <main> function, the first line of assembly code is:
push rbp
mov rbp, rsp
sub rsp, 0xdb0
I have no idea where rbp is initialized. When I did a control F for "rbp", I see the first thing that pops up is the "rex.WRX push rbp" instruction. Does this initialize rbp to 0?
I am also confused on where the assembly code starts from. I originally thought it started from <main>, but I also see other functions like <start> and <init>.
Any clarifications would be appreciated!