Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Last active December 17, 2015 15:39
Show Gist options
  • Save alexcrichton/5632961 to your computer and use it in GitHub Desktop.
Save alexcrichton/5632961 to your computer and use it in GitHub Desktop.
.globl __c0_main
__c0_main:
L__c0_main_bb_0:
sub $8, %rsp // %rsp
mov $1, %edx
mov $2, %r9d
mov $0, %r10d
L__c0_main_bb_1:
cmp $3, %r10d // l
jge L__c0_main_bb_3
L__c0_main_bb_2:
add $1, %r10d // %r10d
xchg %r9, %rdx
jmp L__c0_main_bb_1
L__c0_main_bb_3:
mov %edx, %eax
add %r9d, %eax // %edx
add $8, %rsp // %rsp
ret // %t8
int main() {
int a = 1;
int b = 2;
for (int i = 0; i < 3; i++) {
int t = a;
a = b;
b = t;
}
return a + b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment