All pastes #205360 Raw Edit

Untitled

public text v1 · immutable
#205360 ·published 2006-10-16 19:12 UTC
rendered paste body
0x08048354 <main+0>:    push   ebp
0x08048355 <main+1>:    mov    ebp,esp
0x08048357 <main+3>:    sub    esp,0x18
0x0804835a <main+6>:    and    esp,0xfffffff0
0x0804835d <main+9>:    mov    eax,0x0
0x08048362 <main+14>:   sub    esp,eax

0x08048364 <main+16>:   mov    DWORD PTR [ebp-4],0x1
puts the value 0x1 (1) into "DWORD PTR [ebp-4]" which is our first variable also known as a

0x0804836b <main+23>:   mov    DWORD PTR [ebp-8],0x1
puts the value 0x1 (1) into "DWORD PTR [ebp-b]" which is our second variable also known as b

0x08048372 <main+30>:   mov    eax,DWORD PTR [ebp-8]
moves the value of DWORD PTR [ebp-8](b) into eax the value is also known as 1

0x08048375 <main+33>:   add    eax,DWORD PTR [ebp-4]
adds the value of DWORD PTR [ebp-4](a) into eax, eax now has a total value of 2

0x08048378 <main+36>:   mov    DWORD PTR [ebp-12],eax
moves the value of eax (which is 2) into DWORD PTR [ebp-12] which is our third variable also known as c
c now contains the value 2

0x0804837b <main+39>:   leave  
0x0804837c <main+40>:   ret    
0x0804837d <main+41>:   nop    
0x0804837e <main+42>:   nop    
0x0804837f <main+43>:   nop  

real code:

#include <stdio.h>

main()
{
int a; //DWORD PTR [ebp-4]
int b; //DWORD PTR [ebp-8]
int c; //DWORD PTR [ebp-12]

a=1; //mov    DWORD PTR [ebp-4],0x1
b=1; //mov    DWORD PTR [ebp-8],0x1




//mov    eax,DWORD PTR [ebp-8]
//add    eax,DWORD PTR [ebp-4]

c = a+b; //mov    DWORD PTR [ebp-12],eax





}