Skip to content

Instantly share code, notes, and snippets.

@a2ikm

a2ikm/main.c

Created Jun 14, 2020
Embed
What would you like to do?
#include <stdio.h>
int main(int argc, char **argv) {
for (int i = 0; i < 4; i++) {
int j = i;
printf("&i = %p, &j = %p\n", &i, &j);
}
return 0;
}
.file "main.c"
.intel_syntax noprefix
.text
.section .rodata
.LC0:
.string "&i = %p, &j = %p\n"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
push rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mov rbp, rsp
.cfi_def_cfa_register 6
sub rsp, 32
mov DWORD PTR -20[rbp], edi
mov QWORD PTR -32[rbp], rsi
mov DWORD PTR -4[rbp], 0
jmp .L2
.L3:
mov eax, DWORD PTR -4[rbp]
mov DWORD PTR -8[rbp], eax
lea rdx, -8[rbp]
lea rax, -4[rbp]
mov rsi, rax
lea rdi, .LC0[rip]
mov eax, 0
call printf@PLT
mov eax, DWORD PTR -4[rbp]
add eax, 1
mov DWORD PTR -4[rbp], eax
.L2:
mov eax, DWORD PTR -4[rbp]
cmp eax, 3
jle .L3
mov eax, 0
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.