Skip to content

Instantly share code, notes, and snippets.

Created October 3, 2017 09:17
Show Gist options
  • Save anonymous/0089131a5e8a9466eb19f2d64cf08b96 to your computer and use it in GitHub Desktop.
Save anonymous/0089131a5e8a9466eb19f2d64cf08b96 to your computer and use it in GitHub Desktop.
#include <cstdio>
void loop_up() {
for (int i = 0; i < 42; ++i) {
printf("Hello");
}
}
void loop_down() {
for (int i = 42; i; --i) {
printf("Hello");
}
}
/*
.LC0:
.string "Hello"
loop_up():
push rbx
mov ebx, 42
.L2:
xor eax, eax
mov edi, OFFSET FLAT:.LC0
call printf
sub ebx, 1
jne .L2
pop rbx
ret
loop_down():
push rbx
mov ebx, 42
.L7:
xor eax, eax
mov edi, OFFSET FLAT:.LC0
call printf
sub ebx, 1
jne .L7
pop rbx
ret
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment