xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned long sort_nibbles(unsigned long);
void nibble_sort_parnell(unsigned long *buf) {
  for (int i = 0; i < 1024; i++) {
    buf[i] = sort_nibbles(buf[i]);
  }
}


x86 assembly (clang, -O0):
<nibble_sort_parnell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x400,-0xc(%rbp)
jge    115e <nibble_sort_parnell+0x4e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <sort_nibbles@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <nibble_sort_parnell+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nibble_sort_parnell>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
call   1030 <sort_nibbles@plt>
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    $0x400,%rbx
jne    1120 <nibble_sort_parnell+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @nibble_sort_parnell(i64* %0) {
%2 = alloca i64*
%3 = alloca i32
store i64* %0, i64** %2
store i32 0, i32* %3
br label %4
4: ; preds = %18, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 1024
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = load i64*, i64** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i64, i64* %8, i64 %10
%12 = load i64, i64* %11
%13 = call i64 @sort_nibbles(i64 %12)
%14 = load i64*, i64** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i64, i64* %14, i64 %16
store i64 %13, i64* %17
br label %18
18: ; preds = %7
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %4
21: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @nibble_sort_parnell(i64* nocapture %0) {
br label %3
2: ; preds = %3
ret void
3: ; preds = %1, %3
%4 = phi i64 [ 0, %1 ], [ %8, %3 ]
%5 = getelementptr inbounds i64, i64* %0, i64 %4
%6 = load i64, i64* %5
%7 = tail call i64 @sort_nibbles(i64 %6)
store i64 %7, i64* %5
%8 = add nuw nsw i64 %4, 1
%9 = icmp eq i64 %8, 1024
br i1 %9, label %2, label %3
}
int allClear(char *b, int count) {
  int i;
  for (i = 0; i < count; ++i)
    if (b[i])
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<allClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    114f <allClear+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     113c <allClear+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1156 <allClear+0x56>
jmp    1141 <allClear+0x41>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <allClear+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<allClear>:
mov    $0x1,%eax
test   %esi,%esi
jle    111f <allClear+0x1f>
mov    %esi,%ecx
xor    %edx,%edx
nopl   (%rax)
cmpb   $0x0,(%rdi,%rdx,1)
jne    1120 <allClear+0x20>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1110 <allClear+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @allClear(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %20, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = icmp ne i8 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 0, i32* %3
br label %24
19: ; preds = %11
br label %20
20: ; preds = %19
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %7
23: ; preds = %7
store i32 1, i32* %3
br label %24
24: ; preds = %23, %18
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @allClear(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %13, %5
br i1 %7, label %14, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %13, %6 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
%13 = add nuw nsw i64 %9, 1
br i1 %12, label %6, label %14
14: ; preds = %8, %6, %2
%15 = phi i32 [ 1, %2 ], [ 1, %6 ], [ 0, %8 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ chk_dup_short_key_init();
int /*<<< orphan*/ chk_dup_short_key_main(int /*<<< orphan*/);
int /*<<< orphan*/ get_ls_menu_main();
int /*<<< orphan*/ get_ls_menu_move_crsr();
int /*<<< orphan*/ get_ls_menu_sel_obj();
void chk_dup_short_key(void) {
  chk_dup_short_key_init();
  chk_dup_short_key_main(get_ls_menu_move_crsr());
  chk_dup_short_key_main(get_ls_menu_main());
  chk_dup_short_key_main(get_ls_menu_sel_obj());
}


x86 assembly (clang, -O0):
<chk_dup_short_key>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <chk_dup_short_key_init@plt>
mov    $0x0,%al
call   1040 <get_ls_menu_move_crsr@plt>
mov    %eax,%edi
call   1060 <chk_dup_short_key_main@plt>
mov    $0x0,%al
call   1070 <get_ls_menu_main@plt>
mov    %eax,%edi
call   1060 <chk_dup_short_key_main@plt>
mov    $0x0,%al
call   1030 <get_ls_menu_sel_obj@plt>
mov    %eax,%edi
call   1060 <chk_dup_short_key_main@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<chk_dup_short_key>:
push   %rax
xor    %eax,%eax
call   1050 <chk_dup_short_key_init@plt>
xor    %eax,%eax
call   1040 <get_ls_menu_move_crsr@plt>
mov    %eax,%edi
call   1060 <chk_dup_short_key_main@plt>
xor    %eax,%eax
call   1070 <get_ls_menu_main@plt>
mov    %eax,%edi
call   1060 <chk_dup_short_key_main@plt>
xor    %eax,%eax
call   1030 <get_ls_menu_sel_obj@plt>
mov    %eax,%edi
pop    %rax
jmp    1060 <chk_dup_short_key_main@plt>

LLVM IR (-O0):
define void @chk_dup_short_key() {
%1 = call i32 (...) @chk_dup_short_key_init()
%2 = call i32 (...) @get_ls_menu_move_crsr()
%3 = call i32 @chk_dup_short_key_main(i32 %2)
%4 = call i32 (...) @get_ls_menu_main()
%5 = call i32 @chk_dup_short_key_main(i32 %4)
%6 = call i32 (...) @get_ls_menu_sel_obj()
%7 = call i32 @chk_dup_short_key_main(i32 %6)
ret void
}

LLVM IR (-O2):
define void @chk_dup_short_key() {
%1 = tail call i32 (...) @chk_dup_short_key_init()
%2 = tail call i32 (...) @get_ls_menu_move_crsr()
%3 = tail call i32 @chk_dup_short_key_main(i32 %2)
%4 = tail call i32 (...) @get_ls_menu_main()
%5 = tail call i32 @chk_dup_short_key_main(i32 %4)
%6 = tail call i32 (...) @get_ls_menu_sel_obj()
%7 = tail call i32 @chk_dup_short_key_main(i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0xb6() {
  Assert_real((isodigit(182) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isodigit.c",
              915, ("isodigit should be 0 for 0xb6"));
}


x86 assembly (clang, -O0):
<t_isodigit_0xb6>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb6,%edi
call   1040 <isodigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x393,%edx
lea    0xf5c(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isodigit_0xb6>:
push   %rax
mov    $0xb6,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x393,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0xb6\00"
define void @t_isodigit_0xb6() {
%1 = call i64 @isodigit(i32 182)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 915, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0xb6\00"
define void @t_isodigit_0xb6() {
%1 = tail call i64 @isodigit(i32 182)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 915, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void or_m32_imm32(unsigned int *m32, unsigned int imm32) {
  put8(0x81);
  put8(0x0D);
  put32((unsigned int)(m32));
  put32(imm32);
}


x86 assembly (clang, -O0):
<or_m32_imm32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x81,%edi
call   1030 <put8@plt>
mov    $0xd,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1040 <put32@plt>
mov    -0xc(%rbp),%edi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<or_m32_imm32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x81,%edi
call   1030 <put8@plt>
mov    $0xd,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
call   1040 <put32@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @or_m32_imm32(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = call i32 @put8(i32 129)
%6 = call i32 @put8(i32 13)
%7 = load i32*, i32** %3
%8 = ptrtoint i32* %7 to i32
%9 = call i32 @put32(i32 %8)
%10 = load i32, i32* %4
%11 = call i32 @put32(i32 %10)
ret void
}

LLVM IR (-O2):
define void @or_m32_imm32(i32* %0, i32 %1) {
%3 = tail call i32 @put8(i32 129)
%4 = tail call i32 @put8(i32 13)
%5 = ptrtoint i32* %0 to i64
%6 = trunc i64 %5 to i32
%7 = tail call i32 @put32(i32 %6)
%8 = tail call i32 @put32(i32 %1)
ret void
}
int num_length(int num) {
  int len = 0;
  while (num / 10 > 0)
    ++len;
  return ++len;
}


x86 assembly (clang, -O0):
<num_length>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
jle    1130 <num_length+0x30>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <num_length+0xe>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_length>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @num_length(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %2
%6 = sdiv i32 %5, 10
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
br label %4
11: ; preds = %4
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @num_length(i32 %0) {
ret i32 1
}
/* Variables and functions */
int isPowerOfThree(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  for (int i = 0; i < 100; i++) {
    if (isPowerOfThree(i) == true) {
      printf("%d is power of three\n", i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1173 <main+0x53>
mov    -0x8(%rbp),%edi
call   1030 <isPowerOfThree@plt>
cmp    $0x1,%eax
jne    1160 <main+0x40>
mov    -0x8(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
jmp    1165 <main+0x45>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
jmp    1138 <main+0x18>
nop
add    $0x1,%ebx
cmp    $0x64,%ebx
je     1150 <main+0x30>
mov    %ebx,%edi
call   1030 <isPowerOfThree@plt>
cmp    $0x1,%eax
jne    1130 <main+0x10>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
jmp    1130 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [22 x i8] c"%d is power of three\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %14, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @isPowerOfThree(i32 %7)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %6
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %3
17: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"%d is power of three\0A\00"
define i32 @main() {
br label %2
1: ; preds = %8
ret i32 0
2: ; preds = %0, %8
%3 = phi i32 [ 0, %0 ], [ %9, %8 ]
%4 = tail call i32 @isPowerOfThree(i32 %3)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %8
8: ; preds = %2, %6
%9 = add nuw nsw i32 %3, 1
%10 = icmp eq i32 %9, 100
br i1 %10, label %1, label %2
}
void f(int x, int y) {}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
ret

LLVM IR (-O0):
define void @f(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @f(i32 %0, i32 %1) {
ret void
}
int test4u(unsigned int x) { return x / 10U != 0; }


x86 assembly (clang, -O0):
<test4u>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4u>:
xor    %eax,%eax
cmp    $0xa,%edi
setae  %al
ret

LLVM IR (-O0):
define i32 @test4u(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = udiv i32 %3, 10
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @test4u(i32 %0) {
%2 = icmp ugt i32 %0, 9
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct DynArr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ addDynArr(struct DynArr *, char);
void heapAdd(struct DynArr *heap, char newValue) { addDynArr(heap, newValue); }


x86 assembly (clang, -O0):
<heapAdd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <addDynArr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heapAdd>:
jmp    1030 <addDynArr@plt>

LLVM IR (-O0):
%struct.DynArr = type { i32 }
define void @heapAdd(%struct.DynArr* %0, i8 signext %1) {
%3 = alloca %struct.DynArr*
%4 = alloca i8
store %struct.DynArr* %0, %struct.DynArr** %3
store i8 %1, i8* %4
%5 = load %struct.DynArr*, %struct.DynArr** %3
%6 = load i8, i8* %4
%7 = call i32 @addDynArr(%struct.DynArr* %5, i8 signext %6)
ret void
}

LLVM IR (-O2):
%struct.DynArr = type { i32 }
define void @heapAdd(%struct.DynArr* %0, i8 signext %1) {
%3 = tail call i32 @addDynArr(%struct.DynArr* %0, i8 signext %1)
ret void
}
int pvr_get_objbuf_posn() {
  return (*((volatile unsigned long *)((0xA05F8000 + 0x138))));
}


x86 assembly (clang, -O0):
<pvr_get_objbuf_posn>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa05f8138,%eax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pvr_get_objbuf_posn>:
mov    $0xa05f8138,%eax
mov    (%rax),%rax
ret

LLVM IR (-O0):
define i32 @pvr_get_objbuf_posn() {
%1 = load volatile i64, i64* inttoptr (i64 2690613560 to i64*)
%2 = trunc i64 %1 to i32
ret i32 %2
}

LLVM IR (-O2):
define i32 @pvr_get_objbuf_posn() {
%1 = load volatile i64, i64* inttoptr (i64 2690613560 to i64*)
%2 = trunc i64 %1 to i32
ret i32 %2
}
void output_buf(char c, void *buf) { *((char *)buf) = c; }


x86 assembly (clang, -O0):
<output_buf>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_buf>:
mov    %dil,(%rsi)
ret

LLVM IR (-O0):
define void @output_buf(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
store i8 %0, i8* %3
store i8* %1, i8** %4
%5 = load i8, i8* %3
%6 = load i8*, i8** %4
store i8 %5, i8* %6
ret void
}

LLVM IR (-O2):
define void @output_buf(i8 signext %0, i8* nocapture writeonly %1) {
store i8 %0, i8* %1
ret void
}
int diags() {
  static int n = 1;
  static int d = 1;
  static int i = 0;
  n = n + 2 * d;
  if (i == 3) {
    d++;
    i = 0;
  } else {
    i++;
  }
  return n;
}


x86 assembly (clang, -O0):
<diags>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
mov    0x2f14(%rip),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,0x2f05(%rip)
cmpl   $0x3,0x2f0a(%rip)
jne    1146 <diags+0x46>
mov    0x2ef6(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eed(%rip)
movl   $0x0,0x2eeb(%rip)
jmp    1155 <diags+0x55>
mov    0x2ee0(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ed7(%rip)
mov    0x2ec5(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<diags>:
mov    0x2f1e(%rip),%ecx
lea    (%rcx,%rcx,1),%eax
add    0x2f11(%rip),%eax
mov    %eax,0x2f0b(%rip)
mov    0x2f11(%rip),%edx
cmp    $0x3,%edx
jne    1132 <diags+0x32>
add    $0x1,%ecx
mov    %ecx,0x2efb(%rip)
xor    %edx,%edx
mov    %edx,0x2efb(%rip)
ret
add    $0x1,%edx
mov    %edx,0x2ef1(%rip)
ret

LLVM IR (-O0):
@diags.n = internal global i32 1
@diags.d = internal global i32 1
@diags.i = internal global i32 0
define i32 @diags() {
%1 = load i32, i32* @diags.n
%2 = load i32, i32* @diags.d
%3 = mul nsw i32 2, %2
%4 = add nsw i32 %1, %3
store i32 %4, i32* @diags.n
%5 = load i32, i32* @diags.i
%6 = icmp eq i32 %5, 3
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* @diags.d
%9 = add nsw i32 %8, 1
store i32 %9, i32* @diags.d
store i32 0, i32* @diags.i
br label %13
10: ; preds = %0
%11 = load i32, i32* @diags.i
%12 = add nsw i32 %11, 1
store i32 %12, i32* @diags.i
br label %13
13: ; preds = %10, %7
%14 = load i32, i32* @diags.n
ret i32 %14
}

LLVM IR (-O2):
@diags.n = internal unnamed_addr global i32 1
@diags.d = internal unnamed_addr global i32 1
@diags.i = internal unnamed_addr global i32 0
define i32 @diags() {
%1 = load i32, i32* @diags.n
%2 = load i32, i32* @diags.d
%3 = shl nsw i32 %2, 1
%4 = add nsw i32 %3, %1
store i32 %4, i32* @diags.n
%5 = load i32, i32* @diags.i
%6 = icmp eq i32 %5, 3
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = add nsw i32 %2, 1
store i32 %8, i32* @diags.d
br label %11
9: ; preds = %0
%10 = add nsw i32 %5, 1
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ %10, %9 ], [ 0, %7 ]
store i32 %12, i32* @diags.i
ret i32 %4
}
double radToDeg(const double angleRad) {
  return (180.0 * angleRad / 3.141592653589793238462643);
}


x86 assembly (clang, -O0):
<radToDeg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<radToDeg>:
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @radToDeg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 1.800000e+02, %3
%5 = fdiv double %4, 0x400921FB54442D18
ret double %5
}

LLVM IR (-O2):
define double @radToDeg(double %0) {
%2 = fmul double %0, 1.800000e+02
%3 = fdiv double %2, 0x400921FB54442D18
ret double %3
}
int main(int argc, char *argv[]) {
  char str[21];
  while (~scanf("%s", str)) {
    sort(str);
    puts(str);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rsi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
xor    $0xffffffff,%eax
cmp    $0x0,%eax
je     117f <main+0x4f>
lea    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1040 <sort@plt>
lea    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0xffffffff,%eax
je     1186 <main+0x56>
mov    %rsp,%rbx
lea    0xea9(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <sort@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0xffffffff,%eax
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [21 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %12, %2
%8 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = xor i32 %9, -1
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @sort to i32 (i8*, ...)*)(i8* %13)
%15 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %15)
br label %7
17: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [21 x i8]
%4 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %12, label %7
7: ; preds = %2, %7
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @sort to i32 (i8*, ...)*)(i8* %4)
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %4)
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %7
12: ; preds = %7, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) { printf("Premier programme nsy103!\n"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Premier programme nsy103!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [26 x i8] c"Premier programme nsy103!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
ret i32 0
}
char const *_Locale_time_name(const void *__DUMMY_PAR1, char *__DUMMY_PAR) {
  return 0;
}


x86 assembly (clang, -O0):
<_Locale_time_name>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Locale_time_name>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @_Locale_time_name(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @_Locale_time_name(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
void printWriteback(unsigned int Address) {}


x86 assembly (clang, -O0):
<printWriteback>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<printWriteback>:
ret

LLVM IR (-O0):
define void @printWriteback(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @printWriteback(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
void safeExit(int ret) {
  endwin();
  exit(ret);
}


x86 assembly (clang, -O0):
<safeExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <endwin@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<safeExit>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <endwin@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @safeExit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @endwin()
%4 = load i32, i32* %2
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
define void @safeExit(i32 %0) {
%2 = tail call i32 (...) @endwin()
%3 = tail call i32 @exit(i32 %0)
unreachable
}
int compara(void *dado1, void *dado2) {
  int *num1, *num2;
  num1 = (int *)dado1;
  num2 = (int *)dado2;
  if (*num1 < *num2) {
    return -1;
  }
  if (*num1 > *num2) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<compara>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    113a <compara+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <compara+0x5f>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jle    1158 <compara+0x58>
movl   $0x1,-0x4(%rbp)
jmp    115f <compara+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compara>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compara(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %6
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %7
%12 = load i32*, i32** %6
%13 = load i32, i32* %12
%14 = load i32*, i32** %7
%15 = load i32, i32* %14
%16 = icmp slt i32 %13, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %26
18: ; preds = %2
%19 = load i32*, i32** %6
%20 = load i32, i32* %19
%21 = load i32*, i32** %7
%22 = load i32, i32* %21
%23 = icmp sgt i32 %20, %22
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 1, i32* %3
br label %26
25: ; preds = %18
store i32 0, i32* %3
br label %26
26: ; preds = %25, %24, %17
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @compara(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
%8 = icmp sgt i32 %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void print_usage(FILE *out, char *arg0) {
  fprintf(out,
          "Usage: %s [...] print [OPTS]\n"
          "\n"
          "Options:\n",
          arg0);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Usage: %s [...] print [OPTS]\0A\0AOptions:\0A\00"
define void @print_usage(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = load i8*, i8** %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Usage: %s [...] print [OPTS]\0A\0AOptions:\0A\00"
define void @print_usage(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
int test_imm_C0uint8_mem(unsigned char *val) {
  return ((*val) & (0xC0 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C0uint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xc0,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C0uint8_mem>:
cmpb   $0x40,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C0uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 192
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_C0uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp ult i8 %2, 64
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void strip_nl(char *s) {
  while (*s) {
    if (*s == '\n') {
      *s = 0;
      break;
    }
    ++s;
  }
}


x86 assembly (clang, -O0):
<strip_nl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <strip_nl+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1131 <strip_nl+0x31>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    1142 <strip_nl+0x42>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <strip_nl+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strip_nl>:
movzbl (%rdi),%eax
test   %al,%al
je     1114 <strip_nl+0x14>
cmp    $0xa,%al
je     1111 <strip_nl+0x11>
add    $0x1,%rdi
jmp    1100 <strip_nl>
movb   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @strip_nl(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %14, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 10
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = load i8*, i8** %2
store i8 0, i8* %13
br label %17
14: ; preds = %7
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %2
br label %3
17: ; preds = %12, %3
ret void
}

LLVM IR (-O2):
define void @strip_nl(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 10, label %5
]
5: ; preds = %2
store i8 0, i8* %3
br label %8
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2, %5
ret void
}
int testOperatorPrecondition(register int *parameters, register int schema) {
  return (1);
}


x86 assembly (clang, -O0):
<testOperatorPrecondition>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<testOperatorPrecondition>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @testOperatorPrecondition(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
ret i32 1
}

LLVM IR (-O2):
define i32 @testOperatorPrecondition(i32* nocapture readnone %0, i32 %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void p_alloc_free(void *p) {
  if (p)
    free(p);
}


x86 assembly (clang, -O0):
<p_alloc_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <p_alloc_free+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_alloc_free>:
test   %rdi,%rdi
je     111a <p_alloc_free+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @p_alloc_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @p_alloc_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
int fun944() { return 944; }


x86 assembly (clang, -O0):
<fun944>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3b0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun944>:
mov    $0x3b0,%eax
ret

LLVM IR (-O0):
define i32 @fun944() {
ret i32 944
}

LLVM IR (-O2):
define i32 @fun944() {
ret i32 944
}
char *rchr(char *str, char ch, int len) {
  register char *p = str + len;
  while (p > str)
    if (*--p == ch)
      return p;
  return 0;
}


x86 assembly (clang, -O0):
<rchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    115f <rchr+0x5f>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
movsbl -0x1(%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    115a <rchr+0x5a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1167 <rchr+0x67>
jmp    1120 <rchr+0x20>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rchr>:
movslq %edx,%rcx
add    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmp    %rdi,%rcx
jbe    1123 <rchr+0x23>
lea    -0x1(%rcx),%rax
cmp    %sil,-0x1(%rcx)
mov    %rax,%rcx
jne    1110 <rchr+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @rchr(i8* %0, i8 signext %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8 %1, i8* %6
store i32 %2, i32* %7
%9 = load i8*, i8** %5
%10 = load i32, i32* %7
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
store i8* %12, i8** %8
br label %13
13: ; preds = %27, %3
%14 = load i8*, i8** %8
%15 = load i8*, i8** %5
%16 = icmp ugt i8* %14, %15
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i8*, i8** %8
%19 = getelementptr inbounds i8, i8* %18, i32 -1
store i8* %19, i8** %8
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i8, i8* %6
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %21, %23
br i1 %24, label %25, label %27
25: ; preds = %17
%26 = load i8*, i8** %8
store i8* %26, i8** %4
br label %29
27: ; preds = %17
br label %13
28: ; preds = %13
store i8* null, i8** %4
br label %29
29: ; preds = %28, %25
%30 = load i8*, i8** %4
ret i8* %30
}

LLVM IR (-O2):
define i8* @rchr(i8* %0, i8 signext %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
br label %6
6: ; preds = %9, %3
%7 = phi i8* [ %5, %3 ], [ %10, %9 ]
%8 = icmp ugt i8* %7, %0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %7, i64 -1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, %1
br i1 %12, label %13, label %6
13: ; preds = %6, %9
%14 = phi i8* [ %10, %9 ], [ null, %6 ]
ret i8* %14
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void DeleteOutputString(char *str) {
  if (!str)
    return;
  free((void *)str);
}


x86 assembly (clang, -O0):
<DeleteOutputString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <DeleteOutputString+0x1c>
jmp    1135 <DeleteOutputString+0x25>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DeleteOutputString>:
test   %rdi,%rdi
je     111a <DeleteOutputString+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @DeleteOutputString(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @free(i8* %7)
br label %9
9: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @DeleteOutputString(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %1, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void print_usage(FILE *s) {
  fprintf(s, "\n"
             "Usage: <prog> [+RTS <rtsopts> -RTS] <args>\n\n"
             "Options:\n\n"
             "  -?    Print this message and exits.\n"
             "  -s    Summary GC statistics.\n"
             "  -H    Initial heap size. Egs: -H4M, -H500K, -H1G\n"
             "  -K    Sets the maximum stack size. Egs: -K8M\n"
             "\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0xdf,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [224 x i8] c"\0AUsage: <prog> [+RTS <rtsopts> -RTS] <args>\0A\0AOptions:\0A\0A -? Print this message and exits.\0A -s Summary GC statistics.\0A -H Initial heap size. Egs: -H4M, -H500K, -H1G\0A -K Sets the maximum stack size. Egs: -K8M\0A\0A\00"
define void @print_usage(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([224 x i8], [224 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [224 x i8] c"\0AUsage: <prog> [+RTS <rtsopts> -RTS] <args>\0A\0AOptions:\0A\0A -? Print this message and exits.\0A -s Summary GC statistics.\0A -H Initial heap size. Egs: -H4M, -H500K, -H1G\0A -K Sets the maximum stack size. Egs: -K8M\0A\0A\00"
define void @print_usage(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([224 x i8], [224 x i8]* @.str, i64 0, i64 0), i64 223, i64 1, i32* %0)
ret void
}
/* Variables and functions */
scalar_t__ write_com_4bit(int);
void lcd_home_2() {
  write_com_4bit(0x0080 | 0x40);
  while (write_com_4bit(0x0100) != 0)
    ;
}


x86 assembly (clang, -O0):
<lcd_home_2>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc0,%edi
call   1030 <write_com_4bit@plt>
mov    $0x100,%edi
call   1030 <write_com_4bit@plt>
cmp    $0x0,%rax
je     1137 <lcd_home_2+0x27>
jmp    111e <lcd_home_2+0xe>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_home_2>:
push   %rax
mov    $0xc0,%edi
call   1030 <write_com_4bit@plt>
nopl   0x0(%rax,%rax,1)
mov    $0x100,%edi
call   1030 <write_com_4bit@plt>
test   %rax,%rax
jne    1120 <lcd_home_2+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @lcd_home_2() {
%1 = call i64 @write_com_4bit(i32 192)
br label %2
2: ; preds = %5, %0
%3 = call i64 @write_com_4bit(i32 256)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %2
br label %2
6: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @lcd_home_2() {
%1 = tail call i64 @write_com_4bit(i32 192)
br label %2
2: ; preds = %2, %0
%3 = tail call i64 @write_com_4bit(i32 256)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %2
5: ; preds = %2
ret void
}
void INT_Excep_SSI0_SSITXI0(void) {}


x86 assembly (clang, -O0):
<INT_Excep_SSI0_SSITXI0>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<INT_Excep_SSI0_SSITXI0>:
ret

LLVM IR (-O0):
define void @INT_Excep_SSI0_SSITXI0() {
ret void
}

LLVM IR (-O2):
define void @INT_Excep_SSI0_SSITXI0() {
ret void
}
/* Variables and functions */
char *strtok(char *, char *);
char *nameFilter(char *file_name) {
  char *p_name = strtok(file_name, "/");
  while (p_name != NULL) {
    file_name = p_name;
    p_name = strtok(NULL, "/");
  }
  return file_name;
}


x86 assembly (clang, -O0):
<nameFilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115c <nameFilter+0x4c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xeb2(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x10(%rbp)
jmp    1130 <nameFilter+0x20>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nameFilter>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee2(%rip),%rsi
call   1030 <strtok@plt>
test   %rax,%rax
je     1142 <nameFilter+0x32>
lea    0xed1(%rip),%r14
nop
mov    %rax,%rbx
xor    %edi,%edi
mov    %r14,%rsi
call   1030 <strtok@plt>
test   %rax,%rax
jne    1130 <nameFilter+0x20>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
define i8* @nameFilter(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %3
br label %6
6: ; preds = %9, %1
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i8*, i8** %3
store i8* %10, i8** %2
%11 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %11, i8** %3
br label %6
12: ; preds = %6
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
define i8* @nameFilter(i8* %0) {
%2 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %6, %4 ], [ %2, %1 ]
%6 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %4
8: ; preds = %4, %1
%9 = phi i8* [ %0, %1 ], [ %5, %4 ]
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("3 2 1\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"3 2 1\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [6 x i8] c"3 2 1\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}
unsigned xrop3_251_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~S;
  stk2 = T | stk3;
  stk1 = D | stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_251_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_251_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
lea    (%rcx,%rsi,1),%edx
not    %edx
or     %eax,%edx
not    %eax
or     %eax,%ecx
or     $0xff,%ecx
and    %ecx,%edx
and    %esi,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_251_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = xor i32 %23, -1
store i32 %24, i32* %10
%25 = load i32, i32* %7
%26 = load i32, i32* %10
%27 = or i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %5
%29 = load i32, i32* %9
%30 = or i32 %28, %29
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = load i32, i32* %6
%33 = and i32 %31, %32
%34 = load i32, i32* %8
%35 = load i32, i32* %7
%36 = xor i32 %35, -1
%37 = and i32 %34, %36
%38 = or i32 %33, %37
%39 = load i32, i32* %7
%40 = load i32, i32* %6
%41 = xor i32 %40, -1
%42 = and i32 %39, %41
%43 = load i32, i32* %5
%44 = and i32 %42, %43
%45 = or i32 %38, %44
ret i32 %45
}

LLVM IR (-O2):
define i32 @xrop3_251_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = or i32 %6, %5
%8 = xor i32 %4, -1
%9 = or i32 %6, %8
%10 = or i32 %9, 255
%11 = xor i32 %7, -1
%12 = or i32 %4, %11
%13 = and i32 %10, %12
%14 = and i32 %8, %5
%15 = or i32 %13, %14
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  int x;
  printf("hello world\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"hello world\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"hello world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int main(void) {
  int a = 4;
  int b = 1;
  b = b >> a;
  return b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* %2
%6 = ashr i32 %4, %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}