xunge/DecIR huggingface dataset:
float DotProduct(float *arA, float *arB) {
  return arA[0] * arB[0] + arA[1] * arB[1] + arA[2] * arB[2];
}


x86 assembly (clang, -O0):
<DotProduct>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<DotProduct>:
movss  0x4(%rdi),%xmm0
mulss  0x4(%rsi),%xmm0
movss  (%rdi),%xmm1
mulss  (%rsi),%xmm1
addss  %xmm0,%xmm1
movss  0x8(%rdi),%xmm0
mulss  0x8(%rsi),%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @DotProduct(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 0
%10 = load float, float* %9
%11 = load float*, float** %3
%12 = getelementptr inbounds float, float* %11, i64 1
%13 = load float, float* %12
%14 = load float*, float** %4
%15 = getelementptr inbounds float, float* %14, i64 1
%16 = load float, float* %15
%17 = fmul float %13, %16
%18 = call float @llvm.fmuladd.f32(float %7, float %10, float %17)
%19 = load float*, float** %3
%20 = getelementptr inbounds float, float* %19, i64 2
%21 = load float, float* %20
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 2
%24 = load float, float* %23
%25 = call float @llvm.fmuladd.f32(float %21, float %24, float %18)
ret float %25
}

LLVM IR (-O2):
define float @DotProduct(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = getelementptr inbounds float, float* %0, i64 1
%6 = load float, float* %5
%7 = getelementptr inbounds float, float* %1, i64 1
%8 = load float, float* %7
%9 = fmul float %6, %8
%10 = tail call float @llvm.fmuladd.f32(float %3, float %4, float %9)
%11 = getelementptr inbounds float, float* %0, i64 2
%12 = load float, float* %11
%13 = getelementptr inbounds float, float* %1, i64 2
%14 = load float, float* %13
%15 = tail call float @llvm.fmuladd.f32(float %12, float %14, float %10)
ret float %15
}
/* Variables and functions */
double bogenmass(double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double input = 0;
  double output = 0;
  printf("Geben Sie den Winkel ein\n");
  scanf("%lf", &input);
  output = bogenmass(input);
  printf("Der Winkel im Bogenma§: %f\n", output);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
call   1030 <bogenmass@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe96(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movq   $0x0,(%rsp)
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
movsd  (%rsp),%xmm0
call   1040 <bogenmass@plt>
lea    0xe8f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Geben Sie den Winkel ein\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [29 x i8] c"Der Winkel im Bogenma\C2\A7: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%6 = load double, double* %2
%7 = call double @bogenmass(double %6)
store double %7, double* %3
%8 = load double, double* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [29 x i8] c"Der Winkel im Bogenma\C2\A7: %f\0A\00"
@str = [25 x i8] c"Geben Sie den Winkel ein\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = call double @bogenmass(double %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), double %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void timeout(int sig) {
  (void)sig;
  fprintf(stderr, "timed out\n");
  exit(142);
}


x86 assembly (clang, -O0):
<timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x8e,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<timeout>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x8e,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"timed out\0A\00"
define void @timeout(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @exit(i32 142)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"timed out\0A\00"
define void @timeout(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 142)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ LibFunction();
int main() { LibFunction(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <LibFunction@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @LibFunction()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @LibFunction()
ret i32 0
}
int clearBit(int x, int i) { return (x & (~(1 << (i - 1)))); }


x86 assembly (clang, -O0):
<clearBit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearBit>:
mov    %edi,%eax
add    $0xff,%sil
btr    %esi,%eax
ret

LLVM IR (-O0):
define i32 @clearBit(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 = sub nsw i32 %6, 1
%8 = shl i32 1, %7
%9 = xor i32 %8, -1
%10 = and i32 %5, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @clearBit(i32 %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = shl nuw i32 1, %3
%5 = xor i32 %4, -1
%6 = and i32 %5, %0
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ __chk_fail();
char *__getcwd(char *, size_t);
char *__getcwd_chk(char *buf, size_t size, size_t buflen) {
  if (size > buflen)
    __chk_fail();
  return __getcwd(buf, size);
}


x86 assembly (clang, -O0):
<__getcwd_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1149 <__getcwd_chk+0x29>
mov    $0x0,%al
call   1030 <__chk_fail@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <__getcwd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__getcwd_chk>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
cmp    %rdx,%rsi
jbe    1136 <__getcwd_chk+0x16>
xor    %eax,%eax
call   1030 <__chk_fail@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <__getcwd@plt>

LLVM IR (-O0):
define i8* @__getcwd_chk(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %5
%8 = load i64, i64* %6
%9 = icmp ugt i64 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 (...) @__chk_fail()
br label %12
12: ; preds = %10, %3
%13 = load i8*, i8** %4
%14 = load i64, i64* %5
%15 = call i8* @__getcwd(i8* %13, i64 %14)
ret i8* %15
}

LLVM IR (-O2):
define i8* @__getcwd_chk(i8* %0, i64 %1, i64 %2) {
%4 = icmp ugt i64 %1, %2
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (...) @__chk_fail()
br label %7
7: ; preds = %5, %3
%8 = tail call i8* @__getcwd(i8* %0, i64 %1)
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ printf(char *);
int main(void) {
  foo();
  printf("hello\n");
  foo();
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @foo()
ret i32 0
}
int x_del_fword(c)
int c;
{
  x_delete(x_fword(), 0);
  return 0;
}


x86 assembly (clang, -O0):
<x_del_fword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <x_fword@plt>
mov    %eax,%edi
xor    %esi,%esi
mov    $0x0,%al
call   1040 <x_delete@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_del_fword>:
push   %rax
xor    %eax,%eax
call   1030 <x_fword@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <x_delete@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @x_del_fword(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @x_fword()
%4 = call i32 (i32, i32, ...) bitcast (i32 (...)* @x_delete to i32 (i32, i32, ...)*)(i32 %3, i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @x_del_fword(i32 %0) {
%2 = tail call i32 (...) @x_fword()
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @x_delete to i32 (i32, i32, ...)*)(i32 %2, i32 0)
ret i32 0
}
/* Type definitions */
typedef int time_t;
struct timeval {
  int tv_sec;
};

/* Variables and functions */
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
time_t time(time_t *t) {
  struct timeval tt;
  if (gettimeofday(&tt, NULL) < 0)
    return (-1);
  if (t)
    *t = (time_t)tt.tv_sec;
  return (tt.tv_sec);
}


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
jge    113f <time+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1159 <time+0x49>
cmpq   $0x0,-0x10(%rbp)
je     1153 <time+0x43>
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %rax,%rax
js     1136 <time+0x26>
mov    0x8(%rsp),%eax
test   %rbx,%rbx
je     113b <time+0x2b>
mov    %eax,(%rbx)
jmp    113b <time+0x2b>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @time(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca %struct.timeval
store i32* %0, i32** %3
%5 = call i64 @gettimeofday(%struct.timeval* %4, i32* null)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %18
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%13 = load i32, i32* %12
%14 = load i32*, i32** %3
store i32 %13, i32* %14
br label %15
15: ; preds = %11, %8
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%17 = load i32, i32* %16
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %7
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @time(i32* writeonly %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i64 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = icmp slt i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = icmp eq i32* %0, null
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%9 = load i32, i32* %8
br i1 %7, label %11, label %10
10: ; preds = %6
store i32 %9, i32* %0
br label %11
11: ; preds = %6, %10, %1
%12 = phi i32 [ -1, %1 ], [ %9, %10 ], [ %9, %6 ]
ret i32 %12
}
void mf_write_header_chunk(format, ntracks, division) int format, ntracks,
    division;
{
  unsigned long ident, length;
  void write16bit(), write32bit();
  ident = 0x4d546864;
  length = 6;
  write32bit(ident);
  write32bit(length);
  write16bit(format);
  write16bit(ntracks);
  write16bit(division);
}


x86 assembly (clang, -O0):
<mf_write_header_chunk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movq   $0x4d546864,-0x18(%rbp)
4d
movq   $0x6,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <write32bit@plt>
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1040 <write32bit@plt>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <write16bit@plt>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <write16bit@plt>
mov    -0xc(%rbp),%edi
mov    $0x0,%al
call   1030 <write16bit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mf_write_header_chunk>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
mov    $0x4d546864,%edi
xor    %eax,%eax
call   1040 <write32bit@plt>
mov    $0x6,%edi
xor    %eax,%eax
call   1040 <write32bit@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <write16bit@plt>
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <write16bit@plt>
mov    %r14d,%edi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <write16bit@plt>

LLVM IR (-O0):
define void @mf_write_header_chunk(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i64 1297377380, i64* %7
store i64 6, i64* %8
%9 = load i64, i64* %7
%10 = load i64, i64* %8
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
ret void
}

LLVM IR (-O2):
define void @mf_write_header_chunk(i32 %0, i32 %1, i32 %2) {
tail call void (i64, ...) bitcast (void (...)* @write32bit to void (i64, ...)*)(i64 1297377380)
tail call void (i64, ...) bitcast (void (...)* @write32bit to void (i64, ...)*)(i64 6)
tail call void (i32, ...) bitcast (void (...)* @write16bit to void (i32, ...)*)(i32 %0)
tail call void (i32, ...) bitcast (void (...)* @write16bit to void (i32, ...)*)(i32 %1)
tail call void (i32, ...) bitcast (void (...)* @write16bit to void (i32, ...)*)(i32 %2)
ret void
}
/* Type definitions */
struct flock {
  int dummy;
};

/* Variables and functions */
int fcntl(int, int, struct flock *);
int /*<<< orphan*/ perror(char *);
int xfcntlx(int fd, int cmd, struct flock *lock) {
  int status = fcntl(fd, cmd, lock);
  if (status < 1)
    perror("xfcntlx");
  return status;
}


x86 assembly (clang, -O0):
<xfcntlx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <fcntl@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jge    115a <xfcntlx+0x3a>
lea    0xeab(%rip),%rdi
call   1040 <perror@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfcntlx>:
push   %rbx
call   1030 <fcntl@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1130 <xfcntlx+0x10>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xec9(%rip),%rdi
call   1040 <perror@plt>
jmp    112c <xfcntlx+0xc>

LLVM IR (-O0):
%struct.flock = type { i32 }
@.str = [8 x i8] c"xfcntlx\00"
define i32 @xfcntlx(i32 %0, i32 %1, %struct.flock* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.flock*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.flock* %2, %struct.flock** %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load %struct.flock*, %struct.flock** %6
%11 = call i32 @fcntl(i32 %8, i32 %9, %struct.flock* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %3
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
%struct.flock = type { i32 }
@.str = [8 x i8] c"xfcntlx\00"
define i32 @xfcntlx(i32 %0, i32 %1, %struct.flock* %2) {
%4 = tail call i32 @fcntl(i32 %0, i32 %1, %struct.flock* %2)
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fun();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  int ret = 0;
  fun();
  printf("RETURNED %d\n", ret);
  if (ret != 1) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <fun@plt>
mov    -0x14(%rbp),%esi
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x1,-0x14(%rbp)
je     1169 <main+0x49>
movl   $0x1,-0x4(%rbp)
jmp    1170 <main+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"RETURNED %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @fun()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 1
}
char noichar(char c) { return c; }


x86 assembly (clang, -O0):
<noichar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<noichar>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define signext i8 @noichar(i8 returned signext %0) {
ret i8 %0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t clearBit_fun_uint32_t(uint32_t x, uint32_t i) { return x & ~(1 << i); }


x86 assembly (clang, -O0):
<clearBit_fun_uint32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearBit_fun_uint32_t>:
mov    %edi,%eax
btr    %esi,%eax
ret

LLVM IR (-O0):
define i32 @clearBit_fun_uint32_t(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 = shl i32 1, %6
%8 = xor i32 %7, -1
%9 = and i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @clearBit_fun_uint32_t(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, -1
%5 = and i32 %4, %0
ret i32 %5
}
int big_endian() {
  long one = 1;
  return !(*((char *)(&one)));
}


x86 assembly (clang, -O0):
<big_endian>:
push   %rbp
mov    %rsp,%rbp
movq   $0x1,-0x8(%rbp)
cmpb   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @big_endian() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, long, void *,
                           char const *, char const *, int);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *debug_malloc(size_t size, const char *file, int line,
                   const char *function) {
  void *ptr = malloc(size);
  fprintf(stderr, "malloc(%ld) returned 0x%p (%s:%s:%d)\n", (long)size, ptr,
          file, function, line);
  return ptr;
}


x86 assembly (clang, -O0):
<debug_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    -0x14(%rbp),%eax
lea    0xe99(%rip),%rsi
mov    %eax,(%rsp)
call   1030 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_malloc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %edx,%r12d
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <malloc@plt>
mov    %rax,%rbp
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    %r12d,(%rsp)
lea    0xeac(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r15,%r8
mov    %r14,%r9
call   1030 <fprintf@plt>
mov    %rbp,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"malloc(%ld) returned 0x%p (%s:%s:%d)\0A\00"
define i8* @debug_malloc(i64 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i64 %0, i64* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i64, i64* %5
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %9
%12 = load i32, i32* @stderr
%13 = load i64, i64* %5
%14 = load i8*, i8** %9
%15 = load i8*, i8** %6
%16 = load i8*, i8** %8
%17 = load i32, i32* %7
%18 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i64 %13, i8* %14, i8* %15, i8* %16, i32 %17)
%19 = load i8*, i8** %9
ret i8* %19
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"malloc(%ld) returned 0x%p (%s:%s:%d)\0A\00"
define i8* @debug_malloc(i64 %0, i8* %1, i32 %2, i8* %3) {
%5 = tail call i8* @malloc(i64 %0)
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i64 %0, i8* %5, i8* %1, i8* %3, i32 %2)
ret i8* %5
}
extern int __get_rf_mode() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @__get_rf_mode() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ getuid();
int /*<<< orphan*/ seteuid(int /*<<< orphan*/);
void drop_privileges() { (void)seteuid(getuid()); }


x86 assembly (clang, -O0):
<drop_privileges>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %eax,%edi
call   1040 <seteuid@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<drop_privileges>:
push   %rax
xor    %eax,%eax
call   1030 <getuid@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <seteuid@plt>

LLVM IR (-O0):
define void @drop_privileges() {
%1 = call i32 (...) @getuid()
%2 = call i32 @seteuid(i32 %1)
ret void
}

LLVM IR (-O2):
define void @drop_privileges() {
%1 = tail call i32 (...) @getuid()
%2 = tail call i32 @seteuid(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GLUT_BITMAP_9_BY_15;
int /*<<< orphan*/ glRasterPos2f(int, int);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, char);
void output(int x, int y, char *msg) {
  glRasterPos2f(x, y);
  while (*msg) {
    glutBitmapCharacter(GLUT_BITMAP_9_BY_15, *msg);
    msg++;
  }
}


x86 assembly (clang, -O0):
<output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <glRasterPos2f@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1170 <output+0x50>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113d <output+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
call   1040 <glRasterPos2f@plt>
mov    (%rbx),%al
test   %al,%al
je     1156 <output+0x36>
add    $0x1,%rbx
mov    0x2eab(%rip),%r14
nopl   (%rax)
mov    (%r14),%edi
movsbl %al,%esi
call   1030 <glutBitmapCharacter@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <output+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@GLUT_BITMAP_9_BY_15 = global i32 0
define void @output(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call i32 @glRasterPos2f(i32 %7, i32 %8)
br label %10
10: ; preds = %14, %3
%11 = load i8*, i8** %6
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i32, i32* @GLUT_BITMAP_9_BY_15
%16 = load i8*, i8** %6
%17 = load i8, i8* %16
%18 = call i32 @glutBitmapCharacter(i32 %15, i8 signext %17)
%19 = load i8*, i8** %6
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %6
br label %10
21: ; preds = %10
ret void
}

LLVM IR (-O2):
@GLUT_BITMAP_9_BY_15 = global i32 0
define void @output(i32 %0, i32 %1, i8* nocapture %2) {
%4 = tail call i32 @glRasterPos2f(i32 %0, i32 %1)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %3, %7
%8 = phi i8 [ %13, %7 ], [ %5, %3 ]
%9 = phi i8* [ %12, %7 ], [ %2, %3 ]
%10 = load i32, i32* @GLUT_BITMAP_9_BY_15
%11 = tail call i32 @glutBitmapCharacter(i32 %10, i8 signext %8)
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %7
15: ; preds = %7, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int G3_f(char *s) {
  debug("G3_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<G3_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<G3_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf04(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"G3_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @G3_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [45 x i8] c"G3_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @G3_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
void decode(int *xp, int *yp, int *zp) {
  int x = *xp;
  int y = *yp;
  int z = *zp;
  *xp = z;
  *yp = x;
  *zp = y;
}


x86 assembly (clang, -O0):
<decode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode>:
mov    (%rdi),%r8d
mov    (%rsi),%ecx
mov    (%rdx),%eax
mov    %eax,(%rdi)
mov    %r8d,(%rsi)
mov    %ecx,(%rdx)
ret

LLVM IR (-O0):
define void @decode(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
store i32 %11, i32* %7
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
store i32 %13, i32* %8
%14 = load i32*, i32** %6
%15 = load i32, i32* %14
store i32 %15, i32* %9
%16 = load i32, i32* %9
%17 = load i32*, i32** %4
store i32 %16, i32* %17
%18 = load i32, i32* %7
%19 = load i32*, i32** %5
store i32 %18, i32* %19
%20 = load i32, i32* %8
%21 = load i32*, i32** %6
store i32 %20, i32* %21
ret void
}

LLVM IR (-O2):
define void @decode(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %1
%6 = load i32, i32* %2
store i32 %6, i32* %0
store i32 %4, i32* %1
store i32 %5, i32* %2
ret void
}
int rijndaelStartOfCode(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @rijndaelStartOfCode() {
ret i32 1
}

LLVM IR (-O2):
define i32 @rijndaelStartOfCode() {
ret i32 1
}
double drand(void) {
  return ({
    extern __typeof__(drand) module_api_drand;
    &module_api_drand;
  })();
}


x86 assembly (clang, -O0):
<drand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ed1(%rip),%rax
mov    %rax,-0x8(%rbp)
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drand>:
jmp    1030 <module_api_drand@plt>

LLVM IR (-O0):
define double @drand() {
%1 = alloca double ()*
store double ()* @module_api_drand, double ()** %1
%2 = load double ()*, double ()** %1
%3 = call double %2()
ret double %3
}

LLVM IR (-O2):
define double @drand() {
%1 = tail call double @module_api_drand()
ret double %1
}
/* Variables and functions */
int /*<<< orphan*/ analyze_this();
int main() { analyze_this(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <analyze_this@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @analyze_this()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @analyze_this()
ret i32 0
}
int main() { return 1 > 1; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void syslog(int level, const char *fmt0, ...) {}


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

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

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

LLVM IR (-O2):
define void @syslog(i32 %0, i8* nocapture %1, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *, char const *);
const char *check_arg(int argc, char *argv[], const char *command,
                      int needed_arg_index) {
  if (argc < needed_arg_index + 1) {
    error("%s requires an argument\n", command);
  }
  return argv[needed_arg_index];
}


x86 assembly (clang, -O0):
<check_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1147 <check_arg+0x37>
mov    -0x18(%rbp),%rsi
lea    0xebe(%rip),%rdi
call   1030 <error@plt>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_arg>:
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %rsi,%r14
cmp    %edi,%ecx
jl     112c <check_arg+0x1c>
lea    0xedc(%rip),%rdi
mov    %rdx,%rsi
call   1030 <error@plt>
movslq %ebx,%rax
mov    (%r14,%rax,8),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"%s requires an argument\0A\00"
define i8* @check_arg(i32 %0, i8** %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %8
%11 = add nsw i32 %10, 1
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %16
13: ; preds = %4
%14 = load i8*, i8** %7
%15 = call i32 @error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %13, %4
%17 = load i8**, i8*** %6
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
ret i8* %21
}

LLVM IR (-O2):
@.str = [25 x i8] c"%s requires an argument\0A\00"
define i8* @check_arg(i32 %0, i8** nocapture %1, i8* %2, i32 %3) {
%5 = icmp slt i32 %3, %0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %8
8: ; preds = %6, %4
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cReadByte(int, unsigned char *);
unsigned char CheckId_OV7649(void) {
  unsigned char temp1;
  unsigned char temp2;
  VIM_SIF_I2cReadByte(0x0a, &temp1);
  VIM_SIF_I2cReadByte(0x0b, &temp2);
  if ((temp1 == 0x76) && (temp2 == 0x48))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<CheckId_OV7649>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    $0xb,%edi
lea    -0x3(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
cmp    $0x76,%eax
jne    1157 <CheckId_OV7649+0x47>
movzbl -0x3(%rbp),%eax
cmp    $0x48,%eax
jne    1157 <CheckId_OV7649+0x47>
movb   $0x1,-0x1(%rbp)
jmp    115b <CheckId_OV7649+0x4b>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckId_OV7649>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0xa,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
lea    0x6(%rsp),%rsi
mov    $0xb,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    0x7(%rsp),%al
xor    $0x76,%al
mov    0x6(%rsp),%cl
xor    $0x48,%cl
or     %al,%cl
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @CheckId_OV7649() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = call i32 @VIM_SIF_I2cReadByte(i32 10, i8* %2)
%5 = call i32 @VIM_SIF_I2cReadByte(i32 11, i8* %3)
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = icmp eq i32 %7, 118
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %11, 72
br i1 %12, label %13, label %14
13: ; preds = %9
store i8 1, i8* %1
br label %15
14: ; preds = %9, %0
store i8 0, i8* %1
br label %15
15: ; preds = %14, %13
%16 = load i8, i8* %1
ret i8 %16
}

LLVM IR (-O2):
define zeroext i8 @CheckId_OV7649() {
%1 = alloca i8
%2 = alloca i8
%3 = call i32 @VIM_SIF_I2cReadByte(i32 10, i8* %1)
%4 = call i32 @VIM_SIF_I2cReadByte(i32 11, i8* %2)
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 118
%7 = load i8, i8* %2
%8 = icmp eq i8 %7, 72
%9 = select i1 %6, i1 %8, i1 false
%10 = zext i1 %9 to i8
ret i8 %10
}
int resta(int a, int b) { return a - b; }


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

x86 assembly (clang, -O2):
<resta>:
mov    %edi,%eax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @resta(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @resta(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
int Heap_initialize() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @Heap_initialize() {
ret i32 0
}
/* Variables and functions */
double log(double);
double letlog2(double f) { return f > 0 ? log(f) / log(2.0) : 0.0; }


x86 assembly (clang, -O0):
<letlog2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1161 <letlog2+0x51>
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xeba(%rip),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    116e <letlog2+0x5e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    116e <letlog2+0x5e>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<letlog2>:
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    1134 <letlog2+0x24>
push   %rax
movapd %xmm1,%xmm0
call   1030 <log@plt>
divsd  0xed0(%rip),%xmm0
add    $0x8,%rsp
ret

LLVM IR (-O0):
define double @letlog2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0.000000e+00
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load double, double* %2
%7 = call double @log(double %6)
%8 = call double @log(double 2.000000e+00)
%9 = fdiv double %7, %8
br label %11
10: ; preds = %1
br label %11
11: ; preds = %10, %5
%12 = phi double [ %9, %5 ], [ 0.000000e+00, %10 ]
ret double %12
}

LLVM IR (-O2):
define double @letlog2(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call double @log(double %0)
%5 = fdiv double %4, 0x3FE62E42FEFA39EF
br label %6
6: ; preds = %1, %3
%7 = phi double [ %5, %3 ], [ 0.000000e+00, %1 ]
ret double %7
}
void RTSemMutexIsOwned(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSemMutexIsOwned() {
ret void
}
/* Variables and functions */
int f5(int *);
int f6(int *p) { return f5(p); }


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

x86 assembly (clang, -O2):
<f6>:
jmp    1030 <f5@plt>

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

LLVM IR (-O2):
define i32 @f6(i32* %0) {
%2 = tail call i32 @f5(i32* %0)
ret i32 %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ usleep(int);
extern void delay_ms(uint32_t milliseconds) { usleep(milliseconds * 1000); }


x86 assembly (clang, -O0):
<delay_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x3e8,-0x4(%rbp),%edi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay_ms>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

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

LLVM IR (-O2):
define void @delay_ms(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Variables and functions */
int main();
int xmain(void) { return main(); }


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

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

LLVM IR (-O0):
define i32 @xmain() {
%1 = call i32 (...) @main()
ret i32 %1
}

LLVM IR (-O2):
define i32 @xmain() {
%1 = tail call i32 (...) @main()
ret i32 %1
}
int Section3Minutes(int *seconds) { return *seconds % 3600 / 60; }


x86 assembly (clang, -O0):
<Section3Minutes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<Section3Minutes>:
movslq (%rdi),%rax
imul   $0xffffffff91a2b3c5,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0xb,%ecx
add    %edx,%ecx
imul   $0xe10,%ecx,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0xffff8889,%ecx,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
movzwl %cx,%eax
movswl %ax,%ecx
shr    $0xf,%eax
sar    $0x5,%ecx
add    %eax,%ecx
movswl %cx,%eax
ret

LLVM IR (-O0):
define i32 @Section3Minutes(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = srem i32 %4, 3600
%6 = sdiv i32 %5, 60
ret i32 %6
}

LLVM IR (-O2):
define i32 @Section3Minutes(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = srem i32 %2, 3600
%4 = trunc i32 %3 to i16
%5 = sdiv i16 %4, 60
%6 = sext i16 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void EPIPSRAMConfigRegRead(uint32_t ui32Base, uint32_t ui32CS) {
  uint32_t ui32Offset;
  ;
  ;
  if (ui32CS < 2) {
    ui32Offset = 0x00000010 + (ui32CS << 2);
  } else {
    ui32Offset = 0x00000308 + ((ui32CS - 2) << 2);
  }
  (*((volatile uint32_t *)(ui32Base + ui32Offset))) |= 0x00020000;
}


x86 assembly (clang, -O0):
<EPIPSRAMConfigRegRead>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1125 <EPIPSRAMConfigRegRead+0x25>
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
add    $0x10,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <EPIPSRAMConfigRegRead+0x36>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
shl    $0x2,%eax
add    $0x308,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
cltq
mov    (%rax),%ecx
or     $0x20000,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EPIPSRAMConfigRegRead>:
cmp    $0x2,%esi
lea    0x10(%rdi,%rsi,4),%eax
lea    0x300(%rdi,%rsi,4),%ecx
cmovl  %eax,%ecx
movslq %ecx,%rax
orl    $0x20000,(%rax)
ret

LLVM IR (-O0):
define void @EPIPSRAMConfigRegRead(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %4
%10 = shl i32 %9, 2
%11 = add nsw i32 16, %10
store i32 %11, i32* %5
br label %17
12: ; preds = %2
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 2
%15 = shl i32 %14, 2
%16 = add nsw i32 776, %15
store i32 %16, i32* %5
br label %17
17: ; preds = %12, %8
%18 = load i32, i32* %3
%19 = load i32, i32* %5
%20 = add nsw i32 %18, %19
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load volatile i32, i32* %22
%24 = or i32 %23, 131072
store volatile i32 %24, i32* %22
ret void
}

LLVM IR (-O2):
define void @EPIPSRAMConfigRegRead(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 2
%4 = shl i32 %1, 2
%5 = select i1 %3, i32 16, i32 768
%6 = add i32 %4, %0
%7 = add i32 %6, %5
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
%11 = or i32 %10, 131072
store volatile i32 %11, i32* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ a();
int /*<<< orphan*/ e();
void c() {
  a();
  e();
}


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

x86 assembly (clang, -O2):
<c>:
push   %rax
xor    %eax,%eax
call   1040 <a@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <e@plt>

LLVM IR (-O0):
define void @c() {
%1 = call i32 (...) @a()
%2 = call i32 (...) @e()
ret void
}

LLVM IR (-O2):
define void @c() {
%1 = tail call i32 (...) @a()
%2 = tail call i32 (...) @e()
ret void
}
/* Variables and functions */
int fib(int *, int *);
int main(void) {
  int foos[3];
  int bars[3];
  return fib(foos, bars);
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xc(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <fib@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca [3 x i32]
store i32 0, i32* %1
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%6 = call i32 @fib(i32* %4, i32* %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %1 to i8*
%4 = bitcast [3 x i32]* %2 to i8*
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%7 = call i32 @fib(i32* %5, i32* %6)
ret i32 %7
}