xunge/DecIR huggingface dataset:
/* Variables and functions */
int rand_num(unsigned int *);
float gpr_mutate_value(float value, float percent, unsigned int *random_seed) {
  return value *
         (100 +
          (percent * (((rand_num(random_seed) % 20000) / 10000.0f) - 1.0f))) /
         100.0f;
}


x86 assembly (clang, -O0):
<gpr_mutate_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <rand_num@plt>
movss  -0x18(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
mov    $0x4e20,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm2
movss  0xea7(%rip),%xmm3
divss  %xmm3,%xmm2
movss  0xe97(%rip),%xmm3
subss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movss  0xe83(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  0xe73(%rip),%xmm1
divss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpr_mutate_value>:
push   %rax
movss  %xmm1,(%rsp)
movss  %xmm0,0x4(%rsp)
call   1030 <rand_num@plt>
cltq
imul   $0x68db8bad,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2d,%rcx
add    %edx,%ecx
imul   $0x4e20,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0xeb2(%rip),%xmm0
addss  0xeae(%rip),%xmm0
mulss  (%rsp),%xmm0
movss  0xea5(%rip),%xmm1
addss  %xmm1,%xmm0
mulss  0x4(%rsp),%xmm0
divss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @gpr_mutate_value(float %0, float %1, i32* %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca i32*
store float %0, float* %4
store float %1, float* %5
store i32* %2, i32** %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load i32*, i32** %6
%10 = call i32 @rand_num(i32* %9)
%11 = srem i32 %10, 20000
%12 = sitofp i32 %11 to float
%13 = fdiv float %12, 1.000000e+04
%14 = fsub float %13, 1.000000e+00
%15 = call float @llvm.fmuladd.f32(float %8, float %14, float 1.000000e+02)
%16 = fmul float %7, %15
%17 = fdiv float %16, 1.000000e+02
ret float %17
}

LLVM IR (-O2):
define float @gpr_mutate_value(float %0, float %1, i32* %2) {
%4 = tail call i32 @rand_num(i32* %2)
%5 = srem i32 %4, 20000
%6 = sitofp i32 %5 to float
%7 = fdiv float %6, 1.000000e+04
%8 = fadd float %7, -1.000000e+00
%9 = tail call float @llvm.fmuladd.f32(float %1, float %8, float 1.000000e+02)
%10 = fmul float %9, %0
%11 = fdiv float %10, 1.000000e+02
ret float %11
}
void f(int (*func)(int)) { func(5); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x5,%edi
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %rdi,%rax
mov    $0x5,%edi
jmp    *%rax

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

LLVM IR (-O2):
define void @f(i32 (i32)* nocapture %0) {
%2 = tail call i32 %0(i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ callrts(char *);
void convSint2long(void) { callrts("l_int2long_s"); }


x86 assembly (clang, -O0):
<convSint2long>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <callrts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<convSint2long>:
lea    0xee9(%rip),%rdi
jmp    1030 <callrts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"l_int2long_s\00"
define void @convSint2long() {
%1 = call i32 @callrts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"l_int2long_s\00"
define void @convSint2long() {
%1 = tail call i32 @callrts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ungetch(char);
void ungets(char s[]) {
  while (*s != '\0') {
    ungetch(*s);
    s++;
  }
}


x86 assembly (clang, -O0):
<ungets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <ungets+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ungetch@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <ungets+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ungets>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <ungets+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <ungetch@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <ungets+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ungets(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @ungetch(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
void futex_wait(int *addr, int val) {
  register long r10 __asm__("%r10") = 0;
  long res;
  __asm volatile("syscall"
                 : "=a"(res)
                 : "0"(202), "D"(addr), "S"(0), "d"(val), "r"(r10)
                 : "r11", "rcx", "memory");
}


x86 assembly (clang, -O0):
<futex_wait>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%r10
mov    $0xca,%eax
xor    %esi,%esi
syscall
mov    %rax,-0x20(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<futex_wait>:
mov    %esi,%edx
mov    $0xca,%eax
xor    %esi,%esi
xor    %r10d,%r10d
syscall
ret

LLVM IR (-O0):
define void @futex_wait(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i32* %0, i32** %3
store i32 %1, i32* %4
store i64 0, i64* %5
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
%9 = load i64, i64* %5
%10 = call i64 asm sideeffect "syscall", "={ax},0,{di},{si},{dx},{r10},~{r11},~{rcx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 202, i32* %7, i32 0, i32 %8, i64 %9)
store i64 %10, i64* %6
ret void
}

LLVM IR (-O2):
define void @futex_wait(i32* %0, i32 %1) {
%3 = tail call i64 asm sideeffect "syscall", "={ax},0,{di},{si},{dx},{r10},~{r11},~{rcx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 202, i32* %0, i32 0, i32 %1, i64 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isupper(int);
void t_isupper_0x26() {
  Assert_real((isupper(38) == 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_isupper.c",
              195, ("isupper should be 0 for &"));
}


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

x86 assembly (clang, -O2):
<t_isupper_0x26>:
push   %rax
mov    $0x26,%edi
call   1030 <isupper@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xc3,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 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_isupper.c\00"
@.str.1 = [26 x i8] c"isupper should be 0 for &\00"
define void @t_isupper_0x26() {
%1 = call i64 @isupper(i32 38)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 195, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 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_isupper.c\00"
@.str.1 = [26 x i8] c"isupper should be 0 for &\00"
define void @t_isupper_0x26() {
%1 = tail call i64 @isupper(i32 38)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 195, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
long long test(unsigned int sec, unsigned long long nsecs) {
  return (long long)(long)sec * 1000000000L + (long long)(unsigned long)nsecs;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
imul   $0x3b9aca00,%rax,%rax
add    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
mov    %edi,%eax
imul   $0x3b9aca00,%rax,%rax
add    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @test(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = zext i32 %5 to i64
%7 = mul nsw i64 %6, 1000000000
%8 = load i64, i64* %4
%9 = add nsw i64 %7, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @test(i32 %0, i64 %1) {
%3 = zext i32 %0 to i64
%4 = mul nuw nsw i64 %3, 1000000000
%5 = add nsw i64 %4, %1
ret i64 %5
}
/* Variables and functions */
int EOF;
int getch();
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ ungetch(int);
int main(void) {
  int c;
  c = '*';
  ungetch(c);
  while ((c = getch()) != EOF)
    putchar(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2a,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <ungetch@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%eax
je     1174 <main+0x44>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    114e <main+0x1e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2a,%edi
call   1040 <ungetch@plt>
xor    %eax,%eax
call   1050 <getch@plt>
mov    0x2e9f(%rip),%rbx
cmp    (%rbx),%eax
je     1162 <main+0x32>
nopl   (%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getch@plt>
cmp    (%rbx),%eax
jne    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 42, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @ungetch(i32 %3)
br label %5
5: ; preds = %9, %0
%6 = call i32 (...) @getch()
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %2
%11 = call i32 @putchar(i32 %10)
br label %5
12: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 @ungetch(i32 42)
%2 = tail call i32 (...) @getch()
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %11, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %8, %5 ], [ %2, %0 ]
%7 = tail call i32 @putchar(i32 %6)
%8 = tail call i32 (...) @getch()
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %5
11: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int, int, int, float);
void print_list_entry(unsigned int snd_addr, unsigned int rcv_addr, int jitt,
                      int loss, float srtt) {
  printf("\n%18u%18u%11d%11d%11.2f", snd_addr, rcv_addr, jitt, loss, srtt);
}


x86 assembly (clang, -O0):
<print_list_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
movss  -0x14(%rbp),%xmm0
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_list_entry>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
lea    0xee0(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\0A%18u%18u%11d%11d%11.2f\00"
define void @print_list_entry(i32 %0, i32 %1, i32 %2, i32 %3, float %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store float %4, float* %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load float, float* %10
%16 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12, i32 %13, i32 %14, float %15)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0A%18u%18u%11d%11d%11.2f\00"
define void @print_list_entry(i32 %0, i32 %1, i32 %2, i32 %3, float %4) {
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3, float %4)
ret void
}
int test_option_a(int x) { return !!x; }


x86 assembly (clang, -O0):
<test_option_a>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_option_a>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

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

LLVM IR (-O2):
define i32 @test_option_a(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int g(int, int /*<<< orphan*/);
int f(int a, int b) {
  if (b == 0) {
    return g(a, 0);
  } else {
    return f(1 + a, b - 1);
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114a <f+0x2a>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1040 <g@plt>
mov    %eax,-0x4(%rbp)
jmp    115e <f+0x3e>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <f@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
add    %esi,%edi
xor    %esi,%esi
jmp    1030 <g@plt>

LLVM IR (-O0):
define i32 @f(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %4
%10 = call i32 @g(i32 %9, i32 0)
store i32 %10, i32* %3
br label %17
11: ; preds = %2
%12 = load i32, i32* %4
%13 = add nsw i32 1, %12
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = call i32 @f(i32 %13, i32 %15)
store i32 %16, i32* %3
br label %17
17: ; preds = %11, %8
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = add i32 %1, %0
%4 = tail call i32 @g(i32 %3, i32 0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ my_putchar(char);
int output(char *s) {
  while (*s) {
    my_putchar(*s);
    s++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <output+0x36>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <my_putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <output+0xc>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <output+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <my_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <output+0x10>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @output(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = call i32 @my_putchar(i8 signext %9)
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
br label %3
13: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @output(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @my_putchar(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret i32 0
}
/* Variables and functions */
int INT_MAX;
int /*<<< orphan*/ this_comparison_is_true();
void bla3le(int var) {
  if (var - 10 <= INT_MAX - 10)
    this_comparison_is_true();
}


x86 assembly (clang, -O0):
<bla3le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0xa,%eax
mov    0x2ec0(%rip),%rcx
mov    (%rcx),%ecx
sub    $0xa,%ecx
cmp    %ecx,%eax
jg     113c <bla3le+0x2c>
mov    $0x0,%al
call   1030 <this_comparison_is_true@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bla3le>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
jge    111c <bla3le+0xc>
ret
xor    %eax,%eax
jmp    1030 <this_comparison_is_true@plt>

LLVM IR (-O0):
@INT_MAX = global i32 0
define void @bla3le(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 10
%5 = load i32, i32* @INT_MAX
%6 = sub nsw i32 %5, 10
%7 = icmp sle i32 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @this_comparison_is_true()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define void @bla3le(i32 %0) {
%2 = load i32, i32* @INT_MAX
%3 = icmp slt i32 %2, %0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @this_comparison_is_true()
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ appendCODE(int /*<<< orphan*/);
int /*<<< orphan*/ makeCODEcheckcast(char *, int /*<<< orphan*/ *);
void code_checkcast(char *arg) { appendCODE(makeCODEcheckcast(arg, NULL)); }


x86 assembly (clang, -O0):
<code_checkcast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <makeCODEcheckcast@plt>
mov    %eax,%edi
call   1030 <appendCODE@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<code_checkcast>:
push   %rax
xor    %esi,%esi
call   1040 <makeCODEcheckcast@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <appendCODE@plt>

LLVM IR (-O0):
define void @code_checkcast(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @makeCODEcheckcast(i8* %3, i32* null)
%5 = call i32 @appendCODE(i32 %4)
ret void
}

LLVM IR (-O2):
define void @code_checkcast(i8* %0) {
%2 = tail call i32 @makeCODEcheckcast(i8* %0, i32* null)
%3 = tail call i32 @appendCODE(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int count_representation_combinations_(int *, int, int, int /*<<< orphan*/ *);
void count_representation_combinations_test(void) {
  int values[] = {1, 2, 3, 4};
  assert(count_representation_combinations_(values, 3, 5, NULL) == 6);
}


x86 assembly (clang, -O0):
<count_representation_combinations_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
mov    $0x5,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1040 <count_representation_combinations_@plt>
cmp    $0x6,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_representation_combinations_test>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
mov    $0x5,%edx
xor    %ecx,%ecx
call   1040 <count_representation_combinations_@plt>
xor    %edi,%edi
cmp    $0x6,%eax
sete   %dil
call   1030 <assert@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.count_representation_combinations_test.values = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
define void @count_representation_combinations_test() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @count_representation_combinations_(i32* %3, i32 3, i32 5, i32* null)
%5 = icmp eq i32 %4, 6
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
ret void
}

LLVM IR (-O2):
@__const.count_representation_combinations_test.values = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
define void @count_representation_combinations_test() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @count_representation_combinations_(i32* %3, i32 3, i32 5, i32* null)
%5 = icmp eq i32 %4, 6
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  unsigned char u = 255;
  signed char *p;
  p = (signed char *)&u;
  assert(*p == -1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0xff,-0x1(%rbp)
lea    -0x1(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i8
%2 = alloca i8*
store i8 -1, i8* %1
store i8* %1, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, -1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ not_implemented_error();
void primitive_unimplemented_impl(void) { not_implemented_error(); }


x86 assembly (clang, -O0):
<primitive_unimplemented_impl>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <not_implemented_error@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<primitive_unimplemented_impl>:
xor    %eax,%eax
jmp    1030 <not_implemented_error@plt>

LLVM IR (-O0):
define void @primitive_unimplemented_impl() {
%1 = call i32 (...) @not_implemented_error()
ret void
}

LLVM IR (-O2):
define void @primitive_unimplemented_impl() {
%1 = tail call i32 (...) @not_implemented_error()
ret void
}
/* Variables and functions */
scalar_t__ func();
int main() {
  int sum = 0;
  sum += func();
  sum += func();
  sum += func();
  return sum;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <func@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <func@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <func@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <func@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1030 <func@plt>
mov    %rax,%rbx
add    %r14d,%ebx
xor    %eax,%eax
call   1030 <func@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i64 (...) @func()
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = add nsw i64 %5, %3
%7 = trunc i64 %6 to i32
store i32 %7, i32* %2
%8 = call i64 (...) @func()
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = add nsw i64 %10, %8
%12 = trunc i64 %11 to i32
store i32 %12, i32* %2
%13 = call i64 (...) @func()
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = add nsw i64 %15, %13
%17 = trunc i64 %16 to i32
store i32 %17, i32* %2
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @func()
%2 = tail call i64 (...) @func()
%3 = add i64 %2, %1
%4 = tail call i64 (...) @func()
%5 = add i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Type definitions */
struct timeval {
  double tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double gettime(void) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return tv.tv_sec + 1e-6 * tv.tv_usec;
}


x86 assembly (clang, -O0):
<gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xec9(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdl 0x10(%rsp),%xmm0
mulsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, i32 }
define double @gettime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load i32, i32* %5
%7 = sitofp i32 %6 to double
%8 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %7, double %4)
ret double %8
}

LLVM IR (-O2):
%struct.timeval = type { double, i32 }
define double @gettime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = tail call double @llvm.fmuladd.f64(double %8, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %9
}
int fun578() { return 578; }


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

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

LLVM IR (-O0):
define i32 @fun578() {
ret i32 578
}

LLVM IR (-O2):
define i32 @fun578() {
ret i32 578
}
int recent_seqno(int ourseqno, int gotseqno) {
  int i;
  for (i = 0; i < 4; i++, ourseqno--) {
    if (ourseqno < 0)
      ourseqno = 7;
    if (gotseqno == ourseqno)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<recent_seqno>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1160 <recent_seqno+0x60>
cmpl   $0x0,-0x8(%rbp)
jge    112c <recent_seqno+0x2c>
movl   $0x7,-0x8(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1144 <recent_seqno+0x44>
movl   $0x1,-0x4(%rbp)
jmp    1167 <recent_seqno+0x67>
jmp    1149 <recent_seqno+0x49>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <recent_seqno+0x11>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<recent_seqno>:
test   %edi,%edi
mov    $0x7,%ecx
cmovs  %ecx,%edi
mov    $0x1,%eax
cmp    %esi,%edi
je     1139 <recent_seqno+0x39>
sub    $0x1,%edi
cmovb  %ecx,%edi
cmp    %esi,%edi
je     1139 <recent_seqno+0x39>
sub    $0x1,%edi
mov    $0x7,%ecx
cmovb  %ecx,%edi
cmp    %esi,%edi
je     1139 <recent_seqno+0x39>
sub    $0x1,%edi
cmovb  %ecx,%edi
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @recent_seqno(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 0
%4 = select i1 %3, i32 7, i32 %0
%5 = icmp eq i32 %4, %1
br i1 %5, label %22, label %6
6: ; preds = %2
%7 = add nsw i32 %4, -1
%8 = icmp eq i32 %4, 0
%9 = select i1 %8, i32 7, i32 %7
%10 = icmp eq i32 %9, %1
br i1 %10, label %22, label %11
11: ; preds = %6
%12 = add nsw i32 %9, -1
%13 = icmp eq i32 %9, 0
%14 = select i1 %13, i32 7, i32 %12
%15 = icmp eq i32 %14, %1
br i1 %15, label %22, label %16
16: ; preds = %11
%17 = add nsw i32 %14, -1
%18 = icmp eq i32 %14, 0
%19 = select i1 %18, i32 7, i32 %17
%20 = icmp eq i32 %19, %1
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %16, %11, %6, %2
%23 = phi i32 [ 1, %2 ], [ 1, %6 ], [ 1, %11 ], [ %21, %16 ]
ret i32 %23
}
/* Variables and functions */
int /*<<< orphan*/ add(int, int);
void run_movdbz_program(void) {
  add(4, 8);
  add(100, 1);
  add(0, 0);
  add(1000, 1000);
}


x86 assembly (clang, -O0):
<run_movdbz_program>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
mov    $0x8,%esi
call   1030 <add@plt>
mov    $0x64,%edi
mov    $0x1,%esi
call   1030 <add@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1030 <add@plt>
mov    $0x3e8,%esi
mov    %esi,%edi
call   1030 <add@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_movdbz_program>:
push   %rax
mov    $0x4,%edi
mov    $0x8,%esi
call   1030 <add@plt>
mov    $0x64,%edi
mov    $0x1,%esi
call   1030 <add@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <add@plt>
mov    $0x3e8,%edi
mov    $0x3e8,%esi
pop    %rax
jmp    1030 <add@plt>

LLVM IR (-O0):
define void @run_movdbz_program() {
%1 = call i32 @add(i32 4, i32 8)
%2 = call i32 @add(i32 100, i32 1)
%3 = call i32 @add(i32 0, i32 0)
%4 = call i32 @add(i32 1000, i32 1000)
ret void
}

LLVM IR (-O2):
define void @run_movdbz_program() {
%1 = tail call i32 @add(i32 4, i32 8)
%2 = tail call i32 @add(i32 100, i32 1)
%3 = tail call i32 @add(i32 0, i32 0)
%4 = tail call i32 @add(i32 1000, i32 1000)
ret void
}
/* Type definitions */
struct sockaddr {
  scalar_t__ sa_data;
};
struct ether_addr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ iw_ether_ntop(struct ether_addr const *, char *);
char *iw_saether_ntop(const struct sockaddr *sap, char *bufp) {
  iw_ether_ntop((const struct ether_addr *)sap->sa_data, bufp);
  return bufp;
}


x86 assembly (clang, -O0):
<iw_saether_ntop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <iw_ether_ntop@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iw_saether_ntop>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%rdi
call   1030 <iw_ether_ntop@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i64 }
%struct.ether_addr = type { i32 }
define i8* @iw_saether_ntop(%struct.sockaddr* %0, i8* %1) {
%3 = alloca %struct.sockaddr*
%4 = alloca i8*
store %struct.sockaddr* %0, %struct.sockaddr** %3
store i8* %1, i8** %4
%5 = load %struct.sockaddr*, %struct.sockaddr** %3
%6 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = inttoptr i64 %7 to %struct.ether_addr*
%9 = load i8*, i8** %4
%10 = call i32 @iw_ether_ntop(%struct.ether_addr* %8, i8* %9)
%11 = load i8*, i8** %4
ret i8* %11
}

LLVM IR (-O2):
%struct.sockaddr = type { i64 }
%struct.ether_addr = type { i32 }
define i8* @iw_saether_ntop(%struct.sockaddr* nocapture %0, i8* returned %1) {
%3 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %0, i64 0, i32 0
%4 = load i64, i64* %3
%5 = inttoptr i64 %4 to %struct.ether_addr*
%6 = tail call i32 @iw_ether_ntop(%struct.ether_addr* %5, i8* %1)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ encode(char *, int, char *, int *);
int main() {
  char base255[300];
  char base256[300];
  int base255_sz;
  int base256_sz;
  base256[0] = 121;
  base256[1] = 122;
  base256[2] = 142;
  base256[3] = 212;
  base256_sz = 4;
  encode(base256, base256_sz, base255, &base255_sz);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x79,-0x260(%rbp)
movb   $0x7a,-0x25f(%rbp)
movb   $0x8e,-0x25e(%rbp)
movb   $0xd4,-0x25d(%rbp)
movl   $0x4,-0x268(%rbp)
lea    -0x260(%rbp),%rdi
mov    -0x268(%rbp),%esi
lea    -0x130(%rbp),%rdx
lea    -0x264(%rbp),%rcx
call   1030 <encode@plt>
xor    %eax,%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x278,%rsp
movl   $0xd48e7a79,0x10(%rsp)
d4
lea    0x10(%rsp),%rdi
lea    0x140(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    $0x4,%esi
call   1030 <encode@plt>
xor    %eax,%eax
add    $0x278,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [300 x i8]
%3 = alloca [300 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
store i8 121, i8* %6
%7 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 1
store i8 122, i8* %7
%8 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 2
store i8 -114, i8* %8
%9 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 3
store i8 -44, i8* %9
store i32 4, i32* %5
%10 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%11 = load i32, i32* %5
%12 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%13 = call i32 @encode(i8* %10, i32 %11, i8* %12, i32* %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [300 x i8]
%2 = alloca [300 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [300 x i8], [300 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
store i8 121, i8* %5
%7 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 1
store i8 122, i8* %7
%8 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 2
store i8 -114, i8* %8
%9 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 3
store i8 -44, i8* %9
%10 = call i32 @encode(i8* %5, i32 4, i8* %4, i32* %3)
ret i32 0
}
int u_getkey(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @u_getkey() {
ret i32 0
}

LLVM IR (-O2):
define i32 @u_getkey() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("Course: EG1302A - Spring 2014 \n");
  printf("Name: Badr Basager \n");
  printf("Date Created: %d/%d/%d \n", 1, 28, 2014);
  printf("Assignment: Assignment 05 \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Course: EG1302A - Spring 2014 \0A\00"
@.str.1 = [21 x i8] c"Name: Badr Basager \0A\00"
@.str.2 = [25 x i8] c"Date Created: %d/%d/%d \0A\00"
@.str.3 = [28 x i8] c"Assignment: Assignment 05 \0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [25 x i8] c"Date Created: %d/%d/%d \0A\00"
@str = [31 x i8] c"Course: EG1302A - Spring 2014 \00"
@str.4 = [20 x i8] c"Name: Badr Basager \00"
@str.5 = [27 x i8] c"Assignment: Assignment 05 \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ write_1();
void write_1x(int count) {
  for (int i = 0; i < count; i++) {
    write_1();
  }
}


x86 assembly (clang, -O0):
<write_1x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1143 <write_1x+0x33>
mov    $0x0,%al
call   1030 <write_1@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <write_1x+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_1x>:
push   %rbx
test   %edi,%edi
jle    112c <write_1x+0x1c>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <write_1@plt>
add    $0xffffffff,%ebx
jne    1120 <write_1x+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @write_1x(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %4, %1
ret void
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 (...) @write_1()
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %3, label %4
}
int main() {
  int *nums = malloc(sizeof(int) * 5);
  char *chars = malloc(sizeof(char) * 5);
  memset(nums, 0, sizeof(int) * 5);
  memset(chars, 'A', sizeof(char) * 5);
  printf("%i\n", nums[0]);
  printf("%c\n", chars[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x14,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x5,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
mov    -0x18(%rbp),%rdi
mov    $0x41,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i8* @malloc(i64 20)
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %2
%6 = call i8* @malloc(i64 5)
store i8* %6, i8** %3
%7 = load i32*, i32** %2
%8 = bitcast i32* %7 to i8*
%9 = load i8*, i8** %3
%10 = load i32*, i32** %2
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 65)
ret i32 0
}
/* Variables and functions */
int cos(int /*<<< orphan*/);
int /*<<< orphan*/ rad(int);
int degToClockX(int degree, int r) { return r * cos(rad(degree)); }


x86 assembly (clang, -O0):
<degToClockX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <rad@plt>
mov    %eax,%edi
call   1030 <cos@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
imul   %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<degToClockX>:
push   %rbx
mov    %esi,%ebx
call   1040 <rad@plt>
mov    %eax,%edi
call   1030 <cos@plt>
imul   %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @degToClockX(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @rad(i32 %6)
%8 = call i32 @cos(i32 %7)
%9 = mul nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @degToClockX(i32 %0, i32 %1) {
%3 = tail call i32 @rad(i32 %0)
%4 = tail call i32 @cos(i32 %3)
%5 = mul nsw i32 %4, %1
ret i32 %5
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int comp(void *base, ssize_t nmemb, ssize_t size,
         int (*compare)(const void *a, const void *b, void *context),
         void *context, ssize_t a, ssize_t b) {
  void *ap;
  void *bp;
  (void)nmemb;
  ap = ((char *)base) + (a * size);
  bp = ((char *)base) + (b * size);
  return compare(ap, bp, context);
}


x86 assembly (clang, -O0):
<comp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x10(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rbp),%ecx
imul   -0x10(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   *%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comp>:
imul   %edx,%r9d
movslq %r9d,%rax
add    %rdi,%rax
imul   0x8(%rsp),%edx
movslq %edx,%rsi
add    %rdi,%rsi
mov    %rax,%rdi
mov    %r8,%rdx
jmp    *%rcx

LLVM IR (-O0):
define i32 @comp(i8* %0, i32 %1, i32 %2, i32 (i8*, i8*, i8*)* %3, i8* %4, i32 %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32 (i8*, i8*, i8*)*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 (i8*, i8*, i8*)* %3, i32 (i8*, i8*, i8*)** %11
store i8* %4, i8** %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%17 = load i32, i32* %9
%18 = load i8*, i8** %8
%19 = load i32, i32* %13
%20 = load i32, i32* %10
%21 = mul nsw i32 %19, %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %18, i64 %22
store i8* %23, i8** %15
%24 = load i8*, i8** %8
%25 = load i32, i32* %14
%26 = load i32, i32* %10
%27 = mul nsw i32 %25, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %24, i64 %28
store i8* %29, i8** %16
%30 = load i32 (i8*, i8*, i8*)*, i32 (i8*, i8*, i8*)** %11
%31 = load i8*, i8** %15
%32 = load i8*, i8** %16
%33 = load i8*, i8** %12
%34 = call i32 %30(i8* %31, i8* %32, i8* %33)
ret i32 %34
}

LLVM IR (-O2):
define i32 @comp(i8* %0, i32 %1, i32 %2, i32 (i8*, i8*, i8*)* nocapture %3, i8* %4, i32 %5, i32 %6) {
%8 = mul nsw i32 %5, %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = mul nsw i32 %6, %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = tail call i32 %3(i8* %10, i8* %13, i8* %4)
ret i32 %14
}
int swap2(int a, int b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}


x86 assembly (clang, -O0):
<swap2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <swap2+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <swap2+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap2>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @swap2(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void relmem(void *mem) { free(mem); }


x86 assembly (clang, -O0):
<relmem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relmem>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @relmem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @relmem(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}