Skip to content

Instantly share code, notes, and snippets.

@antonijn
Created August 30, 2014 12:11
Show Gist options
  • Save antonijn/27c93d64977248502e61 to your computer and use it in GitHub Desktop.
Save antonijn/27c93d64977248502e61 to your computer and use it in GitHub Desktop.
struct foo {
int i;
};
int main(void)
{
struct foo bar;
int i;
for (i = 0; i < 10; i++)
continue;
while (1) {
if (i == 0) break;
i--;
}
}
%0:
%1 = (ptr (struct foo)) alloca (struct foo)
%2 = (ptr int) alloca int
store int 0, (ptr int) %2
jmp block %3
%3:
%4 = int load (ptr int) %2
%5 = _Bool cmp lt int %4, int 10
split _Bool %5, block %6, block %13
%6:
jmp block %10
%8:
jmp block %10
%10:
%11 = int load (ptr int) %2
%12 = int add int %11, int 1
store int %12, (ptr int) %2
jmp block %3
%13:
jmp block %15
%15:
%16 = _Bool cmp neq int 1, int 0
split _Bool %16, block %17, block %27
%17:
%18 = int load (ptr int) %2
%19 = _Bool cmp eq int %18, int 0
split _Bool %19, block %20, block %24
%20:
jmp block %27
%22:
jmp block %24
%24:
%25 = int load (ptr int) %2
%26 = int sub int %25, int 1
store int %26, (ptr int) %2
jmp block %15
%27:
leave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment