xunge/DecIR huggingface dataset:
/* Variables and functions */
long lround(double);
double pow(double, unsigned long);
double sqrt(double);
long int fib(unsigned long int n) {
  return lround(
      (pow(0.5 + 0.5 * sqrt(5.0), n) - pow(0.5 - 0.5 * sqrt(5.0), n)) /
      sqrt(5.0));
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  0xebc(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  0xebf(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rdi
call   1040 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe91(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  0xe8c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe88(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rdi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe52(%rip),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1030 <lround@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  0xed0(%rip),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xec5(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <pow@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0xeb3(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
jmp    1030 <lround@plt>

LLVM IR (-O0):
define i64 @fib(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call double @sqrt(double 5.000000e+00)
%4 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %3, double 5.000000e-01)
%5 = load i64, i64* %2
%6 = call double @pow(double %4, i64 %5)
%7 = call double @sqrt(double 5.000000e+00)
%8 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %7, double 5.000000e-01)
%9 = load i64, i64* %2
%10 = call double @pow(double %8, i64 %9)
%11 = fsub double %6, %10
%12 = call double @sqrt(double 5.000000e+00)
%13 = fdiv double %11, %12
%14 = call i64 @lround(double %13)
ret i64 %14
}

LLVM IR (-O2):
define i64 @fib(i64 %0) {
%2 = tail call double @pow(double 0x3FF9E3779B97F4A8, i64 %0)
%3 = tail call double @pow(double 0xBFE3C6EF372FE950, i64 %0)
%4 = fsub double %2, %3
%5 = fdiv double %4, 0x4001E3779B97F4A8
%6 = tail call i64 @lround(double %5)
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned long,
                           char const *, int, char const *);
int /*<<< orphan*/ stderr;
void *_mc_out_of_memory(void *ptr, size_t size, const char *filename,
                        const char *function, int line) {
  ((void)ptr);
  fprintf(stderr,
          "[mclib] out of memory! cannot allocate %lu bytes, %s:%i(%s).\n",
          (unsigned long)size, filename, line, function);
  exit(1);
  return NULL;
}


x86 assembly (clang, -O0):
<_mc_out_of_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x20(%rbp),%r9
lea    0xea4(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<_mc_out_of_memory>:
push   %rax
mov    %rcx,%r9
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [62 x i8] c"[mclib] out of memory! cannot allocate %lu bytes, %s:%i(%s).\0A\00"
define i8* @_mc_out_of_memory(i8* %0, i64 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = load i32, i32* @stderr
%13 = load i64, i64* %7
%14 = load i8*, i8** %8
%15 = load i32, i32* %10
%16 = load i8*, i8** %9
%17 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i64 %13, i8* %14, i32 %15, i8* %16)
%18 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [62 x i8] c"[mclib] out of memory! cannot allocate %lu bytes, %s:%i(%s).\0A\00"
define noalias i8* @_mc_out_of_memory(i8* nocapture readnone %0, i64 %1, i8* %2, i8* %3, i32 %4) {
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i64 %1, i8* %2, i32 %4, i8* %3)
%8 = tail call i32 @exit(i32 1)
unreachable
}
int mtov(int mask) {
  int i;
  for (i = 0; i < 10; i++) {
    if ((mask >> i) == 0)
      return (i);
  }
  return (-1);
}


x86 assembly (clang, -O0):
<mtov>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1147 <mtov+0x47>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
cmp    $0x0,%eax
jne    1134 <mtov+0x34>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114e <mtov+0x4e>
jmp    1139 <mtov+0x39>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <mtov+0xe>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtov>:
test   %edi,%edi
je     1110 <mtov+0x10>
cmp    $0x1,%edi
jne    1113 <mtov+0x13>
mov    $0x1,%eax
jmp    115f <mtov+0x5f>
mov    %edi,%eax
ret
mov    $0x2,%eax
cmp    $0x4,%edi
jb     115f <mtov+0x5f>
mov    $0x3,%eax
cmp    $0x8,%edi
jb     115f <mtov+0x5f>
mov    $0x4,%eax
cmp    $0x10,%edi
jb     115f <mtov+0x5f>
mov    $0x5,%eax
cmp    $0x20,%edi
jb     115f <mtov+0x5f>
mov    $0x6,%eax
cmp    $0x40,%edi
jb     115f <mtov+0x5f>
mov    $0x7,%eax
cmp    $0x80,%edi
jb     115f <mtov+0x5f>
mov    $0x8,%eax
cmp    $0x100,%edi
jae    1160 <mtov+0x60>
ret
cmp    $0x200,%edi
mov    $0x9,%ecx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @mtov(i32 %0) {
switch i32 %0, label %2 [
i32 0, label %20
i32 1, label %19
]
2: ; preds = %1
%3 = icmp ult i32 %0, 4
br i1 %3, label %20, label %4
4: ; preds = %2
%5 = icmp ult i32 %0, 8
br i1 %5, label %20, label %6
6: ; preds = %4
%7 = icmp ult i32 %0, 16
br i1 %7, label %20, label %8
8: ; preds = %6
%9 = icmp ult i32 %0, 32
br i1 %9, label %20, label %10
10: ; preds = %8
%11 = icmp ult i32 %0, 64
br i1 %11, label %20, label %12
12: ; preds = %10
%13 = icmp ult i32 %0, 128
br i1 %13, label %20, label %14
14: ; preds = %12
%15 = icmp ult i32 %0, 256
br i1 %15, label %20, label %16
16: ; preds = %14
%17 = icmp ult i32 %0, 512
%18 = select i1 %17, i32 9, i32 -1
br label %20
19: ; preds = %1
br label %20
20: ; preds = %16, %1, %19, %14, %12, %10, %8, %6, %4, %2
%21 = phi i32 [ %0, %1 ], [ 2, %2 ], [ 3, %4 ], [ 4, %6 ], [ 5, %8 ], [ 6, %10 ], [ 7, %12 ], [ 8, %14 ], [ 1, %19 ], [ %18, %16 ]
ret i32 %21
}
void ProcessInterProverRuleSelectionError(nn) int nn;
{
  printf("       InterProver format error %d\n", nn);
  AbortedMsg();
  Kill_bplatform_and_exit(1, 0);
}


x86 assembly (clang, -O0):
<ProcessInterProverRuleSelectionError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <AbortedMsg@plt>
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <Kill_bplatform_and_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ProcessInterProverRuleSelectionError>:
push   %rax
mov    %edi,%esi
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <AbortedMsg@plt>
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
pop    %rcx
jmp    1030 <Kill_bplatform_and_exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c" InterProver format error %d\0A\00"
define void @ProcessInterProverRuleSelectionError(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @AbortedMsg()
%6 = call i32 (i32, i32, ...) bitcast (i32 (...)* @Kill_bplatform_and_exit to i32 (i32, i32, ...)*)(i32 1, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c" InterProver format error %d\0A\00"
define void @ProcessInterProverRuleSelectionError(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 (...) @AbortedMsg()
%4 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @Kill_bplatform_and_exit to i32 (i32, i32, ...)*)(i32 1, i32 0)
ret void
}
void ThrowOnBadRange(unsigned long ulValue, unsigned long ulMin,
                     unsigned long ulMax) {
  if (ulValue < ulMin || ulValue > ulMax) {
    int *p = 0;
    (*p) = 1;
  }
}


x86 assembly (clang, -O0):
<ThrowOnBadRange>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     112c <ThrowOnBadRange+0x2c>
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    113e <ThrowOnBadRange+0x3e>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ThrowOnBadRange(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32*
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %4
%9 = load i64, i64* %5
%10 = icmp ult i64 %8, %9
br i1 %10, label %15, label %11
11: ; preds = %3
%12 = load i64, i64* %4
%13 = load i64, i64* %6
%14 = icmp ugt i64 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %11, %3
store i32* null, i32** %7
%16 = load i32*, i32** %7
store i32 1, i32* %16
br label %17
17: ; preds = %15, %11
ret void
}

LLVM IR (-O2):
define void @ThrowOnBadRange(i64 %0, i64 %1, i64 %2) {
%4 = icmp uge i64 %0, %1
%5 = icmp ule i64 %0, %2
tail call void @llvm.assume(i1 %4)
tail call void @llvm.assume(i1 %5)
ret void
}
int compare_long(const void *a, const void *b) {
  long *arg1 = (long *)a;
  long *arg2 = (long *)b;
  if (*arg1 == *arg2)
    return 0;
  return *arg1 < *arg2 ? -1 : 1;
}


x86 assembly (clang, -O0):
<compare_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%rax
jne    113c <compare_long+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    115d <compare_long+0x5d>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    %rsi,%rdx
cmovl  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_long>:
mov    (%rdi),%rax
xor    %ecx,%ecx
xor    %edx,%edx
cmp    (%rsi),%rax
setge  %dl
lea    -0x1(%rdx,%rdx,1),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare_long(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = bitcast i8* %1 to i64*
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp eq i64 %5, %6
%8 = icmp slt i64 %5, %6
%9 = select i1 %8, i32 -1, i32 1
%10 = select i1 %7, i32 0, i32 %9
ret i32 %10
}
long double sinl(long double x) {
  __asm__ __volatile__("fldt %0;"
                       "fsin;"
                       "fstpt %0"
                       : "+m"(x));
  return x;
}


x86 assembly (clang, -O0):
<sinl>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fsin
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinl>:
fldt   0x8(%rsp)
fstpt  -0x18(%rsp)
fldt   -0x18(%rsp)
fsin
fstpt  -0x18(%rsp)
fldt   -0x18(%rsp)
ret

LLVM IR (-O0):
define x86_fp80 @sinl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
ret x86_fp80 %3
}

LLVM IR (-O2):
define x86_fp80 @sinl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
ret x86_fp80 %3
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, scalar_t__);
scalar_t__ waitpid(int, int *, int /*<<< orphan*/);
void *procmgr_collector(void *arg) {
  int status = 0;
  pid_t pid = 0;
  while (1) {
    pid = waitpid(-1, &status, 0);
    if (pid > 0) {
      printf("process %d exit\r\n", pid);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<procmgr_collector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0xffffffff,%edi
lea    -0xc(%rbp),%rsi
xor    %edx,%edx
call   1040 <waitpid@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jle    116a <procmgr_collector+0x4a>
mov    -0x18(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    113b <procmgr_collector+0x1b>

x86 assembly (clang, -O2):
<procmgr_collector>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rbx
lea    0xec8(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    $0xffffffff,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <waitpid@plt>
test   %rax,%rax
jle    1140 <procmgr_collector+0x20>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
jmp    1140 <procmgr_collector+0x20>

LLVM IR (-O0):
@.str = [18 x i8] c"process %d exit\0D\0A\00"
define i8* @procmgr_collector(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i64
store i8* %0, i8** %2
store i32 0, i32* %3
store i64 0, i64* %4
br label %5
5: ; preds = %1, %12
%6 = call i64 @waitpid(i32 -1, i32* %3, i32 0)
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i64, i64* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %10)
br label %12
12: ; preds = %9, %5
br label %5
}

LLVM IR (-O2):
@.str = [18 x i8] c"process %d exit\0D\0A\00"
define noalias i8* @procmgr_collector(i8* nocapture readnone %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
br label %4
4: ; preds = %9, %1
%5 = call i64 @waitpid(i32 -1, i32* %2, i32 0)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %5)
br label %9
9: ; preds = %7, %4
br label %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
void read_line(FILE *file, char line[256]) {
  if (fgets(line, 256, file) == NULL) {
    assert(0);
  }
}


x86 assembly (clang, -O0):
<read_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
cmp    $0x0,%rax
jne    1153 <read_line+0x33>
xor    %edi,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_line>:
push   %rax
mov    %rdi,%rdx
mov    %rsi,%rdi
mov    $0x100,%esi
call   1030 <fgets@plt>
test   %rax,%rax
je     1138 <read_line+0x18>
pop    %rax
ret
xor    %edi,%edi
pop    %rax
jmp    1040 <assert@plt>

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

LLVM IR (-O2):
define void @read_line(i32* nocapture %0, i8* %1) {
%3 = tail call i32* @fgets(i8* %1, i32 256, i32* %0)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @assert(i32 0)
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
void swap_double(void *a, void *b, const size_t size) {
  register double tmp;
  register size_t s = size;
  if (a == b)
    return;
  tmp = *(double *)a;
  *(double *)a = *(double *)b;
  *(double *)b = tmp;
}


x86 assembly (clang, -O0):
<swap_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    112b <swap_double+0x2b>
jmp    1155 <swap_double+0x55>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_double>:
cmp    %rsi,%rdi
je     1115 <swap_double+0x15>
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movsd  %xmm1,(%rdi)
movsd  %xmm0,(%rsi)
ret

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

LLVM IR (-O2):
define void @swap_double(i8* %0, i8* %1, i64 %2) {
%4 = icmp eq i8* %0, %1
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = bitcast i8* %0 to double*
%7 = load double, double* %6
%8 = bitcast i8* %1 to double*
%9 = load double, double* %8
store double %9, double* %6
store double %7, double* %8
br label %10
10: ; preds = %3, %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fscanf(FILE *_stream, const char *_format, ...) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @fscanf(i32* nocapture readnone %0, i8* nocapture readnone %1, ...) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ display_clear();
int /*<<< orphan*/ display_printf(int /*<<< orphan*/, int /*<<< orphan*/,
                                  char *);
int /*<<< orphan*/ draw_screen(int);
int /*<<< orphan*/ msleep(int);
int selection_list(int /*<<< orphan*/);
int options(int menu_size) {
  display_clear();
  msleep(10);
  int result;
  display_printf(0, 0, "A Accept | B down | C up\n");
  result = selection_list(draw_screen(menu_size));
  display_clear();
  return result;
}


x86 assembly (clang, -O0):
<options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <display_clear@plt>
mov    $0xa,%edi
call   1030 <msleep@plt>
xor    %esi,%esi
lea    0xe8b(%rip),%rdx
mov    %esi,%edi
call   1040 <display_printf@plt>
mov    -0x4(%rbp),%edi
call   1060 <draw_screen@plt>
mov    %eax,%edi
call   1070 <selection_list@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <display_clear@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<options>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <display_clear@plt>
mov    $0xa,%edi
call   1030 <msleep@plt>
lea    0xe95(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <display_printf@plt>
mov    %ebx,%edi
call   1060 <draw_screen@plt>
mov    %eax,%edi
call   1070 <selection_list@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <display_clear@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"A Accept | B down | C up\0A\00"
define i32 @options(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @display_clear()
%5 = call i32 @msleep(i32 10)
%6 = call i32 @display_printf(i32 0, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = call i32 @draw_screen(i32 %7)
%9 = call i32 @selection_list(i32 %8)
store i32 %9, i32* %3
%10 = call i32 (...) @display_clear()
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [26 x i8] c"A Accept | B down | C up\0A\00"
define i32 @options(i32 %0) {
%2 = tail call i32 (...) @display_clear()
%3 = tail call i32 @msleep(i32 10)
%4 = tail call i32 @display_printf(i32 0, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @draw_screen(i32 %0)
%6 = tail call i32 @selection_list(i32 %5)
%7 = tail call i32 (...) @display_clear()
ret i32 %6
}
/* Variables and functions */
int media(int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int vet[5] = {4, 2, 1, 6, 7};
  printf("%d", media(vet));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <media@plt>
mov    %eax,%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <media@plt>
lea    0xecc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.vet = [5 x i32] [i32 4, i32 2, i32 1, i32 6, i32 7]
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @media(i32* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.vet = [5 x i32] [i32 4, i32 2, i32 1, i32 6, i32 7]
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @media(i32* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
void foo11() {}


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

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

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

LLVM IR (-O2):
define void @foo11() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Lcd_Cmd(int);
void Lcd_Shift_Left() {
  Lcd_Cmd(0x01);
  Lcd_Cmd(0x08);
}


x86 assembly (clang, -O0):
<Lcd_Shift_Left>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <Lcd_Cmd@plt>
mov    $0x8,%edi
call   1030 <Lcd_Cmd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lcd_Shift_Left>:
push   %rax
mov    $0x1,%edi
call   1030 <Lcd_Cmd@plt>
mov    $0x8,%edi
pop    %rax
jmp    1030 <Lcd_Cmd@plt>

LLVM IR (-O0):
define void @Lcd_Shift_Left() {
%1 = call i32 @Lcd_Cmd(i32 1)
%2 = call i32 @Lcd_Cmd(i32 8)
ret void
}

LLVM IR (-O2):
define void @Lcd_Shift_Left() {
%1 = tail call i32 @Lcd_Cmd(i32 1)
%2 = tail call i32 @Lcd_Cmd(i32 8)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int sendfile(int, int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int main() {
  off_t o = 0;
  int ret = sendfile(1, 0, &o, 100);
  if (ret < 0)
    perror("sendfile()");
  printf("sendfile returned %d\n", ret);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x1,%edi
xor    %esi,%esi
lea    -0x8(%rbp),%rdx
mov    $0x64,%ecx
call   1040 <sendfile@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1174 <main+0x44>
lea    0xe91(%rip),%rdi
call   1050 <perror@plt>
mov    -0xc(%rbp),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rdx
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x64,%ecx
call   1040 <sendfile@plt>
mov    %eax,%ebx
test   %eax,%eax
js     116f <main+0x3f>
lea    0xeab(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe8a(%rip),%rdi
call   1050 <perror@plt>
jmp    1159 <main+0x29>

LLVM IR (-O0):
@.str = [11 x i8] c"sendfile()\00"
@.str.1 = [22 x i8] c"sendfile returned %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 @sendfile(i32 1, i32 0, i32* %2, i32 100)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"sendfile()\00"
@.str.1 = [22 x i8] c"sendfile returned %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @sendfile(i32 1, i32 0, i32* %1, i32 100)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
int aa_opt_is_free(int lb, int ub) { return !lb && !ub; }


x86 assembly (clang, -O0):
<aa_opt_is_free>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jne    1125 <aa_opt_is_free+0x25>
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<aa_opt_is_free>:
xor    %eax,%eax
or     %esi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @aa_opt_is_free(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 = icmp ne i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br label %11
11: ; preds = %7, %2
%12 = phi i1 [ false, %2 ], [ %10, %7 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @aa_opt_is_free(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t SysCtlNMIStatus(void) {
  return ((*((volatile unsigned long *)(0x400FE064))));
}


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

x86 assembly (clang, -O2):
<SysCtlNMIStatus>:
mov    0x400fe064,%rax
40
ret

LLVM IR (-O0):
define i64 @SysCtlNMIStatus() {
%1 = load volatile i64, i64* inttoptr (i64 1074782308 to i64*)
ret i64 %1
}

LLVM IR (-O2):
define i64 @SysCtlNMIStatus() {
%1 = load volatile i64, i64* inttoptr (i64 1074782308 to i64*)
ret i64 %1
}
void av_fifo_grow() {}


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

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

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

LLVM IR (-O2):
define void @av_fifo_grow() {
ret void
}
double divid(double a, double b) { return a / b; }


x86 assembly (clang, -O0):
<divid>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<divid>:
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @divid(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @divid(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr,
                "Usage: %s\n"
                "\t%s -p <port> [-P <proto>]\n"
                "\t%s -n <name> [-P <proto>]\n",
                getprogname(), getprogname(), getprogname());
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    %rax,%r8
lea    0xe8a(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ea5(%rip),%rax
mov    (%rax),%r14d
xor    %eax,%eax
call   1030 <getprogname@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <getprogname@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xea0(%rip),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %rax,%r8
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [65 x i8] c"Usage: %s\0A\09%s -p <port> [-P <proto>]\0A\09%s -n <name> [-P <proto>]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i8* (...) @getprogname()
%4 = call i8* (...) @getprogname()
%5 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [65 x i8] c"Usage: %s\0A\09%s -p <port> [-P <proto>]\0A\09%s -n <name> [-P <proto>]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i8* (...) @getprogname()
%4 = tail call i8* (...) @getprogname()
%5 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i8* %4)
%6 = tail call i32 @exit(i32 1)
unreachable
}
void XESetFlushGC() {}


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

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

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

LLVM IR (-O2):
define void @XESetFlushGC() {
ret void
}
/* Variables and functions */
char *realloc(int /*<<< orphan*/, int /*<<< orphan*/);
void reallocSizeZero5() { char *r = realloc(0, 0); }


x86 assembly (clang, -O0):
<reallocSizeZero5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %esi,%esi
mov    %esi,%edi
call   1030 <realloc@plt>
mov    %rax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocSizeZero5>:
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define void @reallocSizeZero5() {
%1 = alloca i8*
%2 = call i8* @realloc(i32 0, i32 0)
store i8* %2, i8** %1
ret void
}

LLVM IR (-O2):
define void @reallocSizeZero5() {
%1 = tail call i8* @realloc(i32 0, i32 0)
ret void
}
void log2mem_atomic_spinlock(volatile int *v) {
  while (__sync_lock_test_and_set(v, 1)) {
  }
}


x86 assembly (clang, -O0):
<log2mem_atomic_spinlock>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x1,%eax
xchg   %eax,(%rcx)
cmp    $0x0,%eax
je     1121 <log2mem_atomic_spinlock+0x21>
jmp    1108 <log2mem_atomic_spinlock+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2mem_atomic_spinlock>:
mov    $0x1,%eax
xchg   %eax,(%rdi)
test   %eax,%eax
jne    1100 <log2mem_atomic_spinlock>
ret

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

LLVM IR (-O2):
define void @log2mem_atomic_spinlock(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = atomicrmw xchg i32* %0, i32 1 seq_cst
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %2
5: ; preds = %2
ret void
}
void RTEnvDupEx(void) {}


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

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

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

LLVM IR (-O2):
define void @RTEnvDupEx() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ svga_read_common(int /*<<< orphan*/, int, void *);
uint8_t svga_read_linear(uint32_t addr, void *p) {
  return svga_read_common(addr, 1, p);
}


x86 assembly (clang, -O0):
<svga_read_linear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    $0x1,%esi
call   1030 <svga_read_common@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svga_read_linear>:
mov    %rsi,%rdx
mov    $0x1,%esi
jmp    1030 <svga_read_common@plt>

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

LLVM IR (-O2):
define i32 @svga_read_linear(i32 %0, i8* %1) {
%3 = tail call i32 @svga_read_common(i32 %0, i32 1, i8* %1)
ret i32 %3
}
/* Variables and functions */
double cos(double);
double Dcos(double x) { return cos(x); }


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

x86 assembly (clang, -O2):
<Dcos>:
jmp    1030 <cos@plt>

LLVM IR (-O0):
define double @Dcos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @cos(double %3)
ret double %4
}

LLVM IR (-O2):
define double @Dcos(double %0) {
%2 = tail call double @cos(double %0)
ret double %2
}
void mainscreen() { ; }


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

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

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

LLVM IR (-O2):
define void @mainscreen() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int8_t implicitConversion(uint32_t argc) {
  fprintf(stderr, "TEST\n");
  return argc;
}


x86 assembly (clang, -O0):
<implicitConversion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<implicitConversion>:
push   %rbx
mov    %edi,%ebx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"TEST\0A\00"
define i32 @implicitConversion(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"TEST\0A\00"
define i32 @implicitConversion(i32 returned %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 %0
}
void gtk_file_chooser_set_current_folder_uri() {}


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

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

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

LLVM IR (-O2):
define void @gtk_file_chooser_set_current_folder_uri() {
ret void
}
int MsgSend(int coid, const void *smsg, int sbytes, void *rmsg, int rbytes) {
  return 0;
}


x86 assembly (clang, -O0):
<MsgSend>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @MsgSend(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
ret i32 0
}

LLVM IR (-O2):
define i32 @MsgSend(i32 %0, i8* nocapture readnone %1, i32 %2, i8* nocapture readnone %3, i32 %4) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int64_t double_to_int(double val) { return (int64_t)val; }


x86 assembly (clang, -O0):
<double_to_int>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_to_int>:
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @double_to_int(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @double_to_int(double %0) {
%2 = fptosi double %0 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ mprintstrln(char *);
void reboot(void) {
  mprintstrln(("System reboot has been requested, but it is not implemented."));
}


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

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

LLVM IR (-O0):
@.str = [61 x i8] c"System reboot has been requested, but it is not implemented.\00"
define void @reboot() {
%1 = call i32 @mprintstrln(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c"System reboot has been requested, but it is not implemented.\00"
define void @reboot() {
%1 = tail call i32 @mprintstrln(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
ret void
}
int schedee_priority_set(struct schedee *s, int new_priority) { return 0; }


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

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

LLVM IR (-O0):
%struct.schedee = type opaque
define i32 @schedee_priority_set(%struct.schedee* %0, i32 %1) {
%3 = alloca %struct.schedee*
%4 = alloca i32
store %struct.schedee* %0, %struct.schedee** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct.schedee = type opaque
define i32 @schedee_priority_set(%struct.schedee* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
float CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, float);
float stopClock(float startTime) {
  float endTime = (float)clock() / CLOCKS_PER_SEC;
  float elapsed = endTime - startTime;
  printf("Time elapsed: %fs\n", elapsed);
  return elapsed;
}


x86 assembly (clang, -O0):
<stopClock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
cvtsi2ss %rax,%xmm0
mov    0x2ea8(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stopClock>:
push   %rax
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1030 <clock@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mov    0x2eab(%rip),%rax
divss  (%rax),%xmm0
subss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str = [19 x i8] c"Time elapsed: %fs\0A\00"
define float @stopClock(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = call i64 (...) @clock()
%6 = sitofp i64 %5 to float
%7 = load float, float* @CLOCKS_PER_SEC
%8 = fdiv float %6, %7
store float %8, float* %3
%9 = load float, float* %3
%10 = load float, float* %2
%11 = fsub float %9, %10
store float %11, float* %4
%12 = load float, float* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), float %12)
%14 = load float, float* %4
ret float %14
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str = [19 x i8] c"Time elapsed: %fs\0A\00"
define float @stopClock(float %0) {
%2 = tail call i64 (...) @clock()
%3 = sitofp i64 %2 to float
%4 = load float, float* @CLOCKS_PER_SEC
%5 = fdiv float %3, %4
%6 = fsub float %5, %0
%7 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), float %6)
ret float %6
}
/* Variables and functions */
int readl(void *);
int /*<<< orphan*/ writel(int, void *);
void imx_uart_putc(void *base, int c) {
  if (!(readl(base + 0x80) & (1 << 0)))
    return;
  while (!(readl(base + 0x98) & (1 << 3)))
    ;
  writel(c, base + 0x40);
}


x86 assembly (clang, -O0):
<imx_uart_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x80,%rdi
call   1030 <readl@plt>
and    $0x1,%eax
cmp    $0x0,%eax
jne    1150 <imx_uart_putc+0x30>
jmp    1192 <imx_uart_putc+0x72>
jmp    1155 <imx_uart_putc+0x35>
mov    -0x8(%rbp),%rdi
add    $0x98,%rdi
call   1030 <readl@plt>
and    $0x8,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    117d <imx_uart_putc+0x5d>
jmp    1182 <imx_uart_putc+0x62>
jmp    1155 <imx_uart_putc+0x35>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
add    $0x40,%rsi
call   1040 <writel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imx_uart_putc>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
add    $0x80,%rdi
call   1030 <readl@plt>
test   $0x1,%al
jne    113f <imx_uart_putc+0x1f>
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0x98(%rbx),%rbp
cs nopw 0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1030 <readl@plt>
test   $0x8,%al
je     1150 <imx_uart_putc+0x30>
add    $0x40,%rbx
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <writel@plt>

LLVM IR (-O0):
define void @imx_uart_putc(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 = getelementptr i8, i8* %5, i64 128
%7 = call i32 @readl(i8* %6)
%8 = and i32 %7, 1
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %2
br label %25
11: ; preds = %2
br label %12
12: ; preds = %19, %11
%13 = load i8*, i8** %3
%14 = getelementptr i8, i8* %13, i64 152
%15 = call i32 @readl(i8* %14)
%16 = and i32 %15, 8
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
br i1 %18, label %19, label %20
19: ; preds = %12
br label %12
20: ; preds = %12
%21 = load i32, i32* %4
%22 = load i8*, i8** %3
%23 = getelementptr i8, i8* %22, i64 64
%24 = call i32 @writel(i32 %21, i8* %23)
br label %25
25: ; preds = %20, %10
ret void
}

LLVM IR (-O2):
define void @imx_uart_putc(i8* %0, i32 %1) {
%3 = getelementptr i8, i8* %0, i64 128
%4 = tail call i32 @readl(i8* %3)
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %2
%8 = getelementptr i8, i8* %0, i64 152
br label %9
9: ; preds = %7, %9
%10 = tail call i32 @readl(i8* %8)
%11 = and i32 %10, 8
%12 = icmp eq i32 %11, 0
br i1 %12, label %9, label %13
13: ; preds = %9
%14 = getelementptr i8, i8* %0, i64 64
%15 = tail call i32 @writel(i32 %1, i8* %14)
br label %16
16: ; preds = %2, %13
ret void
}