Created
June 14, 2020 11:08
-
-
Save a2ikm/04299c9d37c5b45edd1801825eec3041 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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