Skip to content

Instantly share code, notes, and snippets.

@germ
Created August 6, 2020 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save germ/4a57f35636b96a4797cdfe9b359490ea to your computer and use it in GitHub Desktop.
Save germ/4a57f35636b96a4797cdfe9b359490ea to your computer and use it in GitHub Desktop.
int main(int argc, char *argv[]) {
if (argc == 1) return 0x0F;
if (argc == 2) return 0xFF;
return 0x00;
}
.file "a.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl %edi, -4(%rbp)
movq %rsi, -16(%rbp)
cmpl $1, -4(%rbp)
jne .L2
movl $15, %eax
jmp .L3
.L2:
cmpl $2, -4(%rbp)
jne .L4
movl $255, %eax
jmp .L3
.L4:
movl $0, %eax
.L3:
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 10.1.0"
.section .note.GNU-stack,"",@progbits
int main(int argc, char *argv[]) {
if (argc == 1) return 0x0F;
else if (argc == 2) return 0xFF;
return 0x00;
}
.file "b.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl %edi, -4(%rbp)
movq %rsi, -16(%rbp)
cmpl $1, -4(%rbp)
jne .L2
movl $15, %eax
jmp .L3
.L2:
cmpl $2, -4(%rbp)
jne .L4
movl $255, %eax
jmp .L3
.L4:
movl $0, %eax
.L3:
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 10.1.0"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment