y = &x # assume that x is stored on the stack frame at offset -8 from the base pointer mov %rbp %rax sub $-8 %rax mov -8(%rbp) %rax RAM(0xEF) = 4 rbp=0xEF mov %rbp %rax rax=0xEF RAM(0xEF) = 4 rbp=0xEF mov (%rbp) %rax rax=4 # x = 8 # RAM(0xEF) = 4 # RAM(0xE7) = 5 # this is the location where x is allocated # rbp=0xEF mov -8(%rbp) %rax # rax=5 # &x # RAM(0xEF) = 4 # this is my base pointer rbp # RAM(0xE7) = 5 # this is allocated to x # rbp=0xEF mov %rbp %rax # rax=0xEF sub $8 %rax # rax=0xE7 # *y = 8; # RAM(0xEF) = 4 # this is my base pointer rbp # RAM(0xE7) = 5 # this is allocated to x # rbp=0xEF # rax=0xE7 # address of x is in y already mov $8 (%rax) # rax=0xE7 # address of x is in y already # RAM(0xE7) = 8 # this is allocated to x # x = 8 # RAM(0xEF) = 4 # RAM(0xE7) = 5 # this is the location where x is allocated # rbp=0xEF mov $8 -8(%rbp) # rax=5 x = 0 if (x && printf("hello\n")) { }