xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ write(int, char const *, int);
void ft_putstr_fd(char const *s, int fd) {
  int i;
  i = 0;
  while (s && s[i])
    i++;
  if (s)
    write(fd, s, i);
}


x86 assembly (clang, -O0):
<ft_putstr_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     114b <ft_putstr_fd+0x3b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115b <ft_putstr_fd+0x4b>
jmp    1169 <ft_putstr_fd+0x59>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <ft_putstr_fd+0x16>
cmpq   $0x0,-0x8(%rbp)
je     1183 <ft_putstr_fd+0x73>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr_fd>:
test   %rdi,%rdi
je     1137 <ft_putstr_fd+0x27>
mov    %rdi,%rax
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rax,%rdx,1)
lea    0x1(%rdx),%rdx
jne    1120 <ft_putstr_fd+0x10>
add    $0xffffffff,%edx
mov    %esi,%edi
mov    %rax,%rsi
jmp    1030 <write@plt>
ret

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

LLVM IR (-O2):
define void @ft_putstr_fd(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %9, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = add nuw i64 %5, 1
br i1 %8, label %10, label %4
10: ; preds = %4
%11 = trunc i64 %5 to i32
%12 = tail call i32 @write(i32 %1, i8* %0, i32 %11)
br label %13
13: ; preds = %2, %10
ret void
}
/* Variables and functions */
int random(int);
int skiprand(int seed, int n) {
  for (; n; n--)
    seed = random(seed);
  return seed;
}


x86 assembly (clang, -O0):
<skiprand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1141 <skiprand+0x31>
mov    -0x4(%rbp),%edi
call   1030 <random@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    111e <skiprand+0xe>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skiprand>:
push   %rbx
mov    %edi,%eax
test   %esi,%esi
je     112c <skiprand+0x1c>
mov    %esi,%ebx
nopl   0x0(%rax)
mov    %eax,%edi
call   1030 <random@plt>
add    $0xffffffff,%ebx
jne    1120 <skiprand+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @skiprand(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %10, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ %1, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = tail call i32 @random(i32 %6)
%8 = add nsw i32 %5, -1
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %4, %2
%11 = phi i32 [ %0, %2 ], [ %7, %4 ]
ret i32 %11
}
/* Variables and functions */
int g();
int i(void) {
  int ret = 2;
  return ret + g();
}


x86 assembly (clang, -O0):
<i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <g@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i>:
push   %rax
xor    %eax,%eax
call   1030 <g@plt>
add    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @i() {
%1 = alloca i32
store i32 2, i32* %1
%2 = load i32, i32* %1
%3 = call i32 (...) @g()
%4 = add nsw i32 %2, %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @i() {
%1 = tail call i32 (...) @g()
%2 = add nsw i32 %1, 2
ret i32 %2
}
int main(void) {
  int i, n = 0;
  for (i = 0; i < 10; i = i + 1) {
    n = n + i;
  }
  return n;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    113a <main+0x3a>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 45
}
/* Variables and functions */
int test_dec_from_file(int, char const **);
int test_dec_from_mem_simple(int, char const **);
int main(int argc, const char *argv[]) {
  if (1)
    return test_dec_from_mem_simple(argc, argv);
  else
    return test_dec_from_file(argc, argv);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_dec_from_mem_simple@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <test_dec_from_mem_simple@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @test_dec_from_mem_simple(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
unsigned long hash_long(unsigned long, unsigned int);
unsigned long hash_ptr(void *ptr, unsigned int bits) {
  return hash_long((unsigned long)ptr, bits);
}


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

x86 assembly (clang, -O2):
<hash_ptr>:
jmp    1030 <hash_long@plt>

LLVM IR (-O0):
define i64 @hash_ptr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
%7 = load i32, i32* %4
%8 = call i64 @hash_long(i64 %6, i32 %7)
ret i64 %8
}

LLVM IR (-O2):
define i64 @hash_ptr(i8* %0, i32 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = tail call i64 @hash_long(i64 %3, i32 %1)
ret i64 %4
}
float calc_relative_bearing(float desired_bearing, float current_heading) {
  float diff = desired_bearing - current_heading;
  if (diff > 180.0) {
    return (diff - 360.0);
  } else if (diff < -180.0) {
    return (diff + 360.0);
  }
  return diff;
}


x86 assembly (clang, -O0):
<calc_relative_bearing>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    115b <calc_relative_bearing+0x5b>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec7(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a8 <calc_relative_bearing+0xa8>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe9c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1199 <calc_relative_bearing+0x99>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe89(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a8 <calc_relative_bearing+0xa8>
jmp    119e <calc_relative_bearing+0x9e>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_relative_bearing>:
subss  %xmm1,%xmm0
ucomiss 0xef5(%rip),%xmm0
jbe    1116 <calc_relative_bearing+0x16>
addss  0xef7(%rip),%xmm0
ret
movss  0xee6(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    112b <calc_relative_bearing+0x2b>
addss  0xedd(%rip),%xmm0
ret

LLVM IR (-O0):
define float @calc_relative_bearing(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fsub float %7, %8
store float %9, float* %6
%10 = load float, float* %6
%11 = fpext float %10 to double
%12 = fcmp ogt double %11, 1.800000e+02
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load float, float* %6
%15 = fpext float %14 to double
%16 = fsub double %15, 3.600000e+02
%17 = fptrunc double %16 to float
store float %17, float* %3
br label %30
18: ; preds = %2
%19 = load float, float* %6
%20 = fpext float %19 to double
%21 = fcmp olt double %20, -1.800000e+02
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = load float, float* %6
%24 = fpext float %23 to double
%25 = fadd double %24, 3.600000e+02
%26 = fptrunc double %25 to float
store float %26, float* %3
br label %30
27: ; preds = %18
br label %28
28: ; preds = %27
%29 = load float, float* %6
store float %29, float* %3
br label %30
30: ; preds = %28, %22, %13
%31 = load float, float* %3
ret float %31
}

LLVM IR (-O2):
define float @calc_relative_bearing(float %0, float %1) {
%3 = fsub float %0, %1
%4 = fcmp ogt float %3, 1.800000e+02
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = fadd float %3, -3.600000e+02
br label %11
7: ; preds = %2
%8 = fcmp olt float %3, -1.800000e+02
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = fadd float %3, 3.600000e+02
br label %11
11: ; preds = %7, %9, %5
%12 = phi float [ %6, %5 ], [ %10, %9 ], [ %3, %7 ]
ret float %12
}
/* Variables and functions */
int /*<<< orphan*/ assert(size_t);
void *malloc(size_t);
int /*<<< orphan*/ skt_fatal(char *);
void *skt_malloc(size_t size) {
  assert(size);
  void *mem = malloc(size);
  if (!mem)
    skt_fatal("out of memory");
  return mem;
}


x86 assembly (clang, -O0):
<skt_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1169 <skt_malloc+0x39>
lea    0xe9c(%rip),%rdi
call   1030 <skt_fatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skt_malloc>:
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1155 <skt_malloc+0x25>
lea    0xeb0(%rip),%rdi
call   1030 <skt_fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @skt_malloc(i64 %0) {
%2 = tail call i32 @assert(i64 %0)
%3 = tail call i8* @malloc(i64 %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @skt_fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret i8* %3
}
unsigned int btl_mem(unsigned char *base, int bitno) {
  unsigned char res;
  __asm__ __volatile__("btl\t%2, %0\n\t"
                       "setc\t%1"
                       : "=m"(*base), "=q"(res)
                       : "r"(bitno)
                       : "cc", "memory");
  return res;
}


x86 assembly (clang, -O0):
<btl_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
bt     %ecx,(%rax)
setb   %al
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<btl_mem>:
bt     %esi,(%rdi)
setb   %al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @btl_mem(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i8 asm sideeffect "btl\09$2, $0\0A\09setc\09$1", "=*m,=q,r,~{cc},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* elementtype(i8) %6, i32 %7)
store i8 %8, i8* %5
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @btl_mem(i8* %0, i32 %1) {
%3 = tail call i8 asm sideeffect "btl\09$2, $0\0A\09setc\09$1", "=*m,=q,r,~{cc},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* elementtype(i8) %0, i32 %1)
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ outstr(char *);
void outhiaccum() { outstr("A"); }


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

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

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

LLVM IR (-O2):
@.str = [2 x i8] c"A\00"
define void @outhiaccum() {
%1 = tail call i32 @outstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
char *strerror(int errnum) {
  extern char *sys_errlist[];
  extern int sys_nerr;
  if (errnum > 0 && errnum <= sys_nerr)
    return sys_errlist[errnum];
  return "Unknown system error";
}


x86 assembly (clang, -O0):
<strerror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    113b <strerror+0x3b>
mov    -0xc(%rbp),%eax
mov    0x2ecd(%rip),%rcx
cmp    (%rcx),%eax
jg     113b <strerror+0x3b>
movslq -0xc(%rbp),%rcx
mov    0x2eca(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    1146 <strerror+0x46>
lea    0xebe(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strerror>:
lea    0xef9(%rip),%rax
test   %edi,%edi
jle    1123 <strerror+0x23>
mov    0x2ed6(%rip),%rcx
cmp    %edi,(%rcx)
jl     1123 <strerror+0x23>
mov    %edi,%eax
mov    0x2ed9(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret

LLVM IR (-O0):
@sys_nerr = external global i32
@sys_errlist = external global [0 x i8*]
@.str = [21 x i8] c"Unknown system error\00"
define i8* @strerror(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i32, i32* %3
%8 = load i32, i32* @sys_nerr
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [0 x i8*], [0 x i8*]* @sys_errlist, i64 0, i64 %12
%14 = load i8*, i8** %13
store i8* %14, i8** %2
br label %16
15: ; preds = %6, %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
16: ; preds = %15, %10
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@sys_nerr = external global i32
@sys_errlist = external global [0 x i8*]
@.str = [21 x i8] c"Unknown system error\00"
define i8* @strerror(i32 %0) {
%2 = icmp slt i32 %0, 1
%3 = load i32, i32* @sys_nerr
%4 = icmp slt i32 %3, %0
%5 = select i1 %2, i1 true, i1 %4
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = zext i32 %0 to i64
%8 = getelementptr inbounds [0 x i8*], [0 x i8*]* @sys_errlist, i64 0, i64 %7
%9 = load i8*, i8** %8
br label %10
10: ; preds = %1, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %11
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long *feedback;
};
typedef TYPE_1__ XIMText;

/* Variables and functions */
void set_XIMText_feedback(void *_p, void *_v) {
  ((XIMText *)_p)->feedback = (unsigned long *)_v;
}


x86 assembly (clang, -O0):
<set_XIMText_feedback>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XIMText_feedback>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64* }
define void @set_XIMText_feedback(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i64*
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.TYPE_2__*
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
store i64* %6, i64** %9
ret void
}

LLVM IR (-O2):
define void @set_XIMText_feedback(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int, int);
int main() {
  foo(2, 2);
  foo(2, 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%esi
mov    %esi,%edi
call   1030 <foo@plt>
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 2, i32 2)
%3 = call i32 @foo(i32 2, i32 3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 2, i32 2)
%2 = tail call i32 @foo(i32 2, i32 3)
ret i32 0
}
double f4_sum_double_post_int(double v, int v0) {
  return (double)v0 + ((double)(v));
}


x86 assembly (clang, -O0):
<f4_sum_double_post_int>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4_sum_double_post_int>:
cvtsi2sd %edi,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f4_sum_double_post_int(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sitofp i32 %5 to double
%7 = load double, double* %3
%8 = fadd double %6, %7
ret double %8
}

LLVM IR (-O2):
define double @f4_sum_double_post_int(double %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = fadd double %3, %0
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int /*<<< orphan*/);
bool sgio_capable(const char *path) {
  const char *devsg = "/dev/sg";
  return strncmp(path, devsg, strlen(devsg)) == 0;
}


x86 assembly (clang, -O0):
<sgio_capable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgio_capable>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"/dev/sg\00"
define i32 @sgio_capable(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = call i64 @strncmp(i8* %4, i8* %5, i32 %7)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@.str = [8 x i8] c"/dev/sg\00"
define i32 @sgio_capable(i8* %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int stat(char *, void *);
int lisp_stat(char *path, void *buf) { return stat(path, buf); }


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

x86 assembly (clang, -O2):
<lisp_stat>:
jmp    1030 <stat@plt>

LLVM IR (-O0):
define i32 @lisp_stat(i8* %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
%7 = call i32 @stat(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @lisp_stat(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @stat(i8* %0, i8* %1)
ret i32 %3
}
int board_flash_get_datafs_size() { return 256 * 1024; }


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

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

LLVM IR (-O0):
define i32 @board_flash_get_datafs_size() {
ret i32 262144
}

LLVM IR (-O2):
define i32 @board_flash_get_datafs_size() {
ret i32 262144
}
/* Variables and functions */
int /*<<< orphan*/ g(int);
int /*<<< orphan*/ proc1();
void f(int param1) {
  int local0;
  proc1();
  if (param1 > 1) {
    local0 = param1 - 1;
    g(local0);
  }
  return;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <proc1@plt>
cmpl   $0x1,-0x4(%rbp)
jle    114d <f+0x2d>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <g@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <proc1@plt>
cmp    $0x2,%ebx
jl     113a <f+0x1a>
add    $0xffffffff,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <g@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @f(i32 %0) {
%2 = tail call i32 (...) @proc1()
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = add nsw i32 %0, -1
%6 = tail call i32 @g(i32 %5)
br label %7
7: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ perror(char *);
void *realloc(void *, size_t);
void *safe_realloc(void *orig, size_t n) {
  void *ptr = realloc(orig, n);
  if (ptr == NULL) {
    perror("Memory allocation failed");
    abort();
  }
  return ptr;
}


x86 assembly (clang, -O0):
<safe_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116f <safe_realloc+0x3f>
lea    0xe9d(%rip),%rdi
call   1050 <perror@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_realloc>:
push   %rax
call   1040 <realloc@plt>
test   %rax,%rax
je     113d <safe_realloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1050 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Memory allocation failed\00"
define i8* @safe_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %2
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
@.str = [25 x i8] c"Memory allocation failed\00"
define noalias i8* @safe_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %2
ret i8* %3
}
/* Variables and functions */
char *iupStrGetSmallMem();
int /*<<< orphan*/ sprintf(char *, char *, float);
char *iupStrReturnFloat(float f) {
  char *str = iupStrGetSmallMem();
  sprintf(str, "%.9f", f);
  return str;
}


x86 assembly (clang, -O0):
<iupStrReturnFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <iupStrGetSmallMem@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movss  -0x4(%rbp),%xmm0
lea    0xeb8(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iupStrReturnFloat>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1030 <iupStrGetSmallMem@plt>
mov    %rax,%rbx
lea    0xec4(%rip),%rsi
mov    %rax,%rdi
movss  0xc(%rsp),%xmm0
call   1040 <sprintf@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.9f\00"
define i8* @iupStrReturnFloat(float %0) {
%2 = alloca float
%3 = alloca i8*
store float %0, float* %2
%4 = call i8* (...) @iupStrGetSmallMem()
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load float, float* %2
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float %6)
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.9f\00"
define i8* @iupStrReturnFloat(float %0) {
%2 = tail call i8* (...) @iupStrGetSmallMem()
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float %0)
ret i8* %2
}
/* Type definitions */
struct memorycontainer {
  int dummy;
};

/* Variables and functions */
struct memorycontainer *
createUnaryGeneralMathsExpression(struct memorycontainer *, int);
struct memorycontainer *
createSinExpression(struct memorycontainer *expression) {
  return createUnaryGeneralMathsExpression(expression, 0x0001);
}


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

x86 assembly (clang, -O2):
<createSinExpression>:
mov    $0x1,%esi
jmp    1030 <createUnaryGeneralMathsExpression@plt>

LLVM IR (-O0):
%struct.memorycontainer = type { i32 }
define %struct.memorycontainer* @createSinExpression(%struct.memorycontainer* %0) {
%2 = alloca %struct.memorycontainer*
store %struct.memorycontainer* %0, %struct.memorycontainer** %2
%3 = load %struct.memorycontainer*, %struct.memorycontainer** %2
%4 = call %struct.memorycontainer* @createUnaryGeneralMathsExpression(%struct.memorycontainer* %3, i32 1)
ret %struct.memorycontainer* %4
}

LLVM IR (-O2):
%struct.memorycontainer = type { i32 }
define %struct.memorycontainer* @createSinExpression(%struct.memorycontainer* %0) {
%2 = tail call %struct.memorycontainer* @createUnaryGeneralMathsExpression(%struct.memorycontainer* %0, i32 1)
ret %struct.memorycontainer* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ RSA;

/* Variables and functions */
int /*<<< orphan*/ RSA_PKCS1_PADDING;
int RSA_private_decrypt(int, unsigned char *, unsigned char *,
                        int /*<<< orphan*/ *, int /*<<< orphan*/);
int private_decrypt(unsigned char *enc_data, int data_len, RSA *rsa,
                    unsigned char *decrypted) {
  int result = RSA_private_decrypt(data_len, enc_data, decrypted, rsa,
                                   RSA_PKCS1_PADDING);
  return result;
}


x86 assembly (clang, -O0):
<private_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    0x2e9b(%rip),%rax
mov    (%rax),%r8d
call   1030 <RSA_private_decrypt@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<private_decrypt>:
mov    %rdx,%rax
mov    %rdi,%rdx
mov    0x2ebb(%rip),%rdi
mov    (%rdi),%r8d
mov    %esi,%edi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %rax,%rcx
jmp    1030 <RSA_private_decrypt@plt>

LLVM IR (-O0):
@RSA_PKCS1_PADDING = global i32 0
define i32 @private_decrypt(i8* %0, i32 %1, i32* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%10 = load i32, i32* %6
%11 = load i8*, i8** %5
%12 = load i8*, i8** %8
%13 = load i32*, i32** %7
%14 = load i32, i32* @RSA_PKCS1_PADDING
%15 = call i32 @RSA_private_decrypt(i32 %10, i8* %11, i8* %12, i32* %13, i32 %14)
store i32 %15, i32* %9
%16 = load i32, i32* %9
ret i32 %16
}

LLVM IR (-O2):
@RSA_PKCS1_PADDING = global i32 0
define i32 @private_decrypt(i8* %0, i32 %1, i32* %2, i8* %3) {
%5 = load i32, i32* @RSA_PKCS1_PADDING
%6 = tail call i32 @RSA_private_decrypt(i32 %1, i8* %0, i8* %3, i32* %2, i32 %5)
ret i32 %6
}
void GrOffScreen8BPPPixelDraw(void *pvDisplayData, int lX, int lY,
                              unsigned int ulValue) {
  unsigned char *pucData;
  ;
  pucData = (unsigned char *)pvDisplayData;
  pucData += (*(unsigned short *)(pucData + 1) * lY) + lX + 6 + (256 * 3);
  *pucData = ulValue;
}


x86 assembly (clang, -O0):
<GrOffScreen8BPPPixelDraw>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movzwl 0x1(%rax),%ecx
imul   -0x10(%rbp),%ecx
add    -0xc(%rbp),%ecx
add    $0x6,%ecx
add    $0x300,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GrOffScreen8BPPPixelDraw>:
movzwl 0x1(%rdi),%eax
imul   %edx,%eax
add    %esi,%eax
add    $0x306,%eax
cltq
mov    %cl,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @GrOffScreen8BPPPixelDraw(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
store i8* %10, i8** %9
%11 = load i8*, i8** %9
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = bitcast i8* %12 to i16*
%14 = load i16, i16* %13
%15 = zext i16 %14 to i32
%16 = load i32, i32* %7
%17 = mul nsw i32 %15, %16
%18 = load i32, i32* %6
%19 = add nsw i32 %17, %18
%20 = add nsw i32 %19, 6
%21 = add nsw i32 %20, 768
%22 = load i8*, i8** %9
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds i8, i8* %22, i64 %23
store i8* %24, i8** %9
%25 = load i32, i32* %8
%26 = trunc i32 %25 to i8
%27 = load i8*, i8** %9
store i8 %26, i8* %27
ret void
}

LLVM IR (-O2):
define void @GrOffScreen8BPPPixelDraw(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = bitcast i8* %5 to i16*
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
%9 = mul nsw i32 %8, %2
%10 = add i32 %1, 774
%11 = add i32 %10, %9
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = trunc i32 %3 to i8
store i8 %14, i8* %13
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CE_High();
int /*<<< orphan*/ CE_Low();
int /*<<< orphan*/ Send_Byte(int);
void WREN() {
  CE_Low();
  Send_Byte(0x06);
  CE_High();
}


x86 assembly (clang, -O0):
<WREN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <CE_Low@plt>
mov    $0x6,%edi
call   1030 <Send_Byte@plt>
mov    $0x0,%al
call   1040 <CE_High@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<WREN>:
push   %rax
xor    %eax,%eax
call   1050 <CE_Low@plt>
mov    $0x6,%edi
call   1030 <Send_Byte@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <CE_High@plt>

LLVM IR (-O0):
define void @WREN() {
%1 = call i32 (...) @CE_Low()
%2 = call i32 @Send_Byte(i32 6)
%3 = call i32 (...) @CE_High()
ret void
}

LLVM IR (-O2):
define void @WREN() {
%1 = tail call i32 (...) @CE_Low()
%2 = tail call i32 @Send_Byte(i32 6)
%3 = tail call i32 (...) @CE_High()
ret void
}
int open_fail(const char *pathname, int flags) {
  do {
    debug_printf("***** %s:%s() called. Something is probably wrong! Maybe "
                 "you forgot to call vfs_init().\n",
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/BarrelfishOS/barrelfish/"
                 "refs/heads/master/lib/libc/sys/barrelfish/posix_syscalls.c",
                 __FUNCTION__);
    return -1;
  } while (0);
}


x86 assembly (clang, -O0):
<open_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
lea    0xf2c(%rip),%rsi
lea    0xfd2(%rip),%rdx
mov    $0x0,%al
call   1030 <debug_printf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_fail>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xf3a(%rip),%rsi
lea    0xfe0(%rip),%rdx
xor    %eax,%eax
call   1030 <debug_printf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [89 x i8] c"***** %s:%s() called. Something is probably wrong! Maybe you forgot to call vfs_init().\0A\00"
@.str.1 = [173 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BarrelfishOS/barrelfish/refs/heads/master/lib/libc/sys/barrelfish/posix_syscalls.c\00"
@__FUNCTION__.open_fail = [10 x i8] c"open_fail\00"
define i32 @open_fail(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %2
%6 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @debug_printf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__FUNCTION__.open_fail, i64 0, i64 0))
br label %7
7: ; preds = %5
ret i32 -1
}

LLVM IR (-O2):
@.str = [89 x i8] c"***** %s:%s() called. Something is probably wrong! Maybe you forgot to call vfs_init().\0A\00"
@.str.1 = [173 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BarrelfishOS/barrelfish/refs/heads/master/lib/libc/sys/barrelfish/posix_syscalls.c\00"
@__FUNCTION__.open_fail = [10 x i8] c"open_fail\00"
define i32 @open_fail(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @debug_printf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__FUNCTION__.open_fail, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
scalar_t__ palloc(size_t);
char *c_palloc(size_t size) { return (char *)palloc(size * sizeof(char)); }


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

x86 assembly (clang, -O2):
<c_palloc>:
jmp    1030 <palloc@plt>

LLVM IR (-O0):
define i8* @c_palloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 %3, 1
%5 = call i64 @palloc(i64 %4)
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
define i8* @c_palloc(i64 %0) {
%2 = tail call i64 @palloc(i64 %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
/* Variables and functions */
void *mxml_get_sibling(void *);
void *cfg_timer_a_get_next_reg(void *reg) {
  void *next_reg = ((void *)0);
  if (((void *)0) != reg) {
    next_reg = mxml_get_sibling(reg);
  }
  return next_reg;
}


x86 assembly (clang, -O0):
<cfg_timer_a_get_next_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     113d <cfg_timer_a_get_next_reg+0x2d>
mov    -0x8(%rbp),%rdi
call   1030 <mxml_get_sibling@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @cfg_timer_a_get_next_reg(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @mxml_get_sibling(i8* %0)
br label %5
5: ; preds = %3, %1
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
int min(int a, int b) { return (a >= b) ? b : a; }


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

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

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

LLVM IR (-O2):
define i32 @min(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*/ printf(char *);
void print_spaces(int num) {
  while (num--)
    printf(" ");
}


x86 assembly (clang, -O0):
<print_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1140 <print_spaces+0x30>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
jmp    111b <print_spaces+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_spaces>:
push   %rbx
test   %edi,%edi
je     112f <print_spaces+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <print_spaces+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define void @print_spaces(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
store i32 %5, i32* %2
%6 = icmp ne i32 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @print_spaces(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = tail call i32 @putchar(i32 32)
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
double band_wrapper(double *arg_list) {
  return (double)((int)arg_list[0] && (int)arg_list[1]);
}


x86 assembly (clang, -O0):
<band_wrapper>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cvttsd2si (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1130 <band_wrapper+0x30>
mov    -0x8(%rbp),%rax
cvttsd2si 0x8(%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<band_wrapper>:
cvttsd2si (%rdi),%eax
test   %eax,%eax
je     1111 <band_wrapper+0x11>
cvttsd2si 0x8(%rdi),%eax
test   %eax,%eax
jne    1115 <band_wrapper+0x15>
xorps  %xmm0,%xmm0
ret
movsd  0xee3(%rip),%xmm0
ret

LLVM IR (-O0):
define double @band_wrapper(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = fptosi double %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 1
%11 = load double, double* %10
%12 = fptosi double %11 to i32
%13 = icmp ne i32 %12, 0
br label %14
14: ; preds = %8, %1
%15 = phi i1 [ false, %1 ], [ %13, %8 ]
%16 = zext i1 %15 to i32
%17 = sitofp i32 %16 to double
ret double %17
}

LLVM IR (-O2):
define double @band_wrapper(double* nocapture %0) {
%2 = load double, double* %0
%3 = fptosi double %2 to i32
%4 = icmp eq i32 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = fptosi double %7 to i32
%9 = icmp ne i32 %8, 0
%10 = uitofp i1 %9 to double
br label %11
11: ; preds = %5, %1
%12 = phi double [ 0.000000e+00, %1 ], [ %10, %5 ]
ret double %12
}
/* Variables and functions */
size_t strlen(char const *);
size_t strlen_safe(const char *s) { return s ? strlen(s) : 0; }


x86 assembly (clang, -O0):
<strlen_safe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1139 <strlen_safe+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
jmp    1144 <strlen_safe+0x34>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1144 <strlen_safe+0x34>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @strlen_safe(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 i64 @strlen(i8* %6)
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi i64 [ %7, %5 ], [ 0, %8 ]
ret i64 %10
}

LLVM IR (-O2):
define i64 @strlen_safe(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i64 [ %4, %3 ], [ 0, %1 ]
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ clock_init();
int /*<<< orphan*/ data_init();
int /*<<< orphan*/ inhibit();
int /*<<< orphan*/ wait_ms(int);
void ps2_host_init(void) {
  clock_init();
  data_init();
  wait_ms(2500);
  inhibit();
}


x86 assembly (clang, -O0):
<ps2_host_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <clock_init@plt>
mov    $0x0,%al
call   1050 <data_init@plt>
mov    $0x9c4,%edi
call   1060 <wait_ms@plt>
mov    $0x0,%al
call   1030 <inhibit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ps2_host_init>:
push   %rax
xor    %eax,%eax
call   1040 <clock_init@plt>
xor    %eax,%eax
call   1050 <data_init@plt>
mov    $0x9c4,%edi
call   1060 <wait_ms@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <inhibit@plt>

LLVM IR (-O0):
define void @ps2_host_init() {
%1 = call i32 (...) @clock_init()
%2 = call i32 (...) @data_init()
%3 = call i32 @wait_ms(i32 2500)
%4 = call i32 (...) @inhibit()
ret void
}

LLVM IR (-O2):
define void @ps2_host_init() {
%1 = tail call i32 (...) @clock_init()
%2 = tail call i32 (...) @data_init()
%3 = tail call i32 @wait_ms(i32 2500)
%4 = tail call i32 (...) @inhibit()
ret void
}