xunge/DecIR huggingface dataset:
int isLucky(int n) {
  static int counter = 2;
  int next_position = n;
  if (counter > n)
    return (1);
  if (n % counter == 0)
    return (0);
  next_position -= next_position / counter;
  counter++;
  return isLucky(next_position);
}


x86 assembly (clang, -O0):
<isLucky>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    0x2f01(%rip),%eax
cmp    -0x8(%rbp),%eax
jle    113c <isLucky+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1189 <isLucky+0x79>
mov    -0x8(%rbp),%eax
cltd
idivl  0x2ee2(%rip)
cmp    $0x0,%edx
jne    115b <isLucky+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    1189 <isLucky+0x79>
mov    -0xc(%rbp),%eax
cltd
idivl  0x2ec3(%rip)
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    0x2eb3(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eaa(%rip)
mov    -0xc(%rbp),%edi
call   1030 <isLucky@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLucky>:
mov    0x2f1a(%rip),%esi
mov    $0x1,%ecx
cmp    %edi,%esi
jg     112a <isLucky+0x2a>
nop
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     112d <isLucky+0x2d>
sub    %eax,%edi
lea    0x1(%rsi),%eax
mov    %eax,0x2efc(%rip)
cmp    %edi,%esi
mov    %eax,%esi
jl     1110 <isLucky+0x10>
mov    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@isLucky.counter = internal unnamed_addr global i32 2
define i32 @isLucky(i32 %0) {
%2 = load i32, i32* @isLucky.counter
%3 = icmp sgt i32 %2, %0
br i1 %3, label %14, label %4
4: ; preds = %1, %10
%5 = phi i32 [ %11, %10 ], [ %0, %1 ]
%6 = phi i32 [ %12, %10 ], [ %2, %1 ]
%7 = srem i32 %5, %6
%8 = sdiv i32 %5, %6
%9 = icmp eq i32 %7, 0
br i1 %9, label %14, label %10
10: ; preds = %4
%11 = sub nsw i32 %5, %8
%12 = add nsw i32 %6, 1
store i32 %12, i32* @isLucky.counter
%13 = icmp slt i32 %6, %11
br i1 %13, label %4, label %14
14: ; preds = %10, %4, %1
%15 = phi i32 [ 1, %1 ], [ 0, %4 ], [ 1, %10 ]
ret i32 %15
}
void foo337(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo337(i32 %0) {
ret void
}
int test_imm_DCuint8_mem(unsigned char *val) {
  return ((*val) & (-0xDC << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_DCuint8_mem>:
testb  $0x24,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_DCuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 36
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int mainD() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @mainD() {
ret i32 0
}
void rt_sendrecvscanline(void *voidhandle) { ; }


x86 assembly (clang, -O0):
<rt_sendrecvscanline>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @rt_sendrecvscanline(i8* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ SyscallReturnIsSandboxed();
int /*<<< orphan*/ printf(char *);
int main(void) {
  if (SyscallReturnIsSandboxed()) {
    printf("PASSED\n");
    return 0;
  } else {
    printf("FAILED\n");
    return 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <SyscallReturnIsSandboxed@plt>
cmp    $0x0,%rax
je     1158 <main+0x38>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    116b <main+0x4b>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <SyscallReturnIsSandboxed@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
lea    0xec9(%rip),%rax
lea    0xec9(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@str = [7 x i8] c"FAILED\00"
@str.2 = [7 x i8] c"PASSED\00"
define i32 @main() {
%1 = tail call i64 (...) @SyscallReturnIsSandboxed()
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.2, i64 0, i64 0)
%4 = zext i1 %2 to i32
%5 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret i32 %4
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
double drand48(void) { return (((double)(rand())) / ((double)RAND_MAX)); }


x86 assembly (clang, -O0):
<drand48>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drand48>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @drand48() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @drand48() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
/* Variables and functions */
int exp(double);
double f(double x) {
  if (x == 0)
    x = 0.00000001;
  return 1000000 * exp(x) + (435000 / x) * (exp(x) - 1) - 1564000;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1142 <f+0x32>
jp     1142 <f+0x32>
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
imul   $0xf4240,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xead(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
sub    $0x1,%eax
cvtsi2sd %eax,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe70(%rip),%xmm1
subsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
sub    $0x28,%rsp
xorpd  %xmm2,%xmm2
cmpeqsd %xmm0,%xmm2
movsd  0xedb(%rip),%xmm1
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
movapd %xmm2,%xmm0
call   1030 <exp@plt>
imul   $0xf4240,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xead(%rip),%xmm1
movapd 0x10(%rsp),%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
call   1030 <exp@plt>
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
addsd  0xe84(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oeq double %3, 0.000000e+00
br i1 %4, label %5, label %6
5: ; preds = %1
store double 1.000000e-08, double* %2
br label %6
6: ; preds = %5, %1
%7 = load double, double* %2
%8 = call i32 @exp(double %7)
%9 = mul nsw i32 1000000, %8
%10 = sitofp i32 %9 to double
%11 = load double, double* %2
%12 = fdiv double 4.350000e+05, %11
%13 = load double, double* %2
%14 = call i32 @exp(double %13)
%15 = sub nsw i32 %14, 1
%16 = sitofp i32 %15 to double
%17 = call double @llvm.fmuladd.f64(double %12, double %16, double %10)
%18 = fsub double %17, 1.564000e+06
ret double %18
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = fcmp oeq double %0, 0.000000e+00
%3 = select i1 %2, double 1.000000e-08, double %0
%4 = tail call i32 @exp(double %3)
%5 = mul nsw i32 %4, 1000000
%6 = sitofp i32 %5 to double
%7 = fdiv double 4.350000e+05, %3
%8 = tail call i32 @exp(double %3)
%9 = add nsw i32 %8, -1
%10 = sitofp i32 %9 to double
%11 = tail call double @llvm.fmuladd.f64(double %7, double %10, double %6)
%12 = fadd double %11, -1.564000e+06
ret double %12
}
/* Variables and functions */
unsigned char gf_alog(scalar_t__);
scalar_t__ gf_log(unsigned char);
unsigned char gf_mulinv(unsigned char x) {
  return (x > 0) ? gf_alog(255 - gf_log(x)) : 0;
}


x86 assembly (clang, -O0):
<gf_mulinv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jle    115c <gf_mulinv+0x3c>
movzbl -0x1(%rbp),%edi
call   1040 <gf_log@plt>
mov    $0xff,%edi
sub    %rax,%rdi
call   1030 <gf_alog@plt>
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <gf_mulinv+0x46>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <gf_mulinv+0x46>
mov    -0x8(%rbp),%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf_mulinv>:
test   %edi,%edi
je     113c <gf_mulinv+0x1c>
push   %rax
movzbl %dil,%edi
call   1040 <gf_log@plt>
mov    $0xff,%edi
sub    %rax,%rdi
pop    %rax
jmp    1030 <gf_alog@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define zeroext i8 @gf_mulinv(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @gf_log(i8 zeroext %7)
%9 = sub nsw i64 255, %8
%10 = call zeroext i8 @gf_alog(i64 %9)
%11 = zext i8 %10 to i32
br label %13
12: ; preds = %1
br label %13
13: ; preds = %12, %6
%14 = phi i32 [ %11, %6 ], [ 0, %12 ]
%15 = trunc i32 %14 to i8
ret i8 %15
}

LLVM IR (-O2):
define zeroext i8 @gf_mulinv(i8 zeroext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i64 @gf_log(i8 zeroext %0)
%5 = sub nsw i64 255, %4
%6 = tail call zeroext i8 @gf_alog(i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8 [ %6, %3 ], [ 0, %1 ]
ret i8 %8
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
int main(void) {
  fprintf(stdout, "Hello World!\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [14 x i8] c"Hello World!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stdout
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [14 x i8] c"Hello World!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exec(char *, char **);
int main() {
  char *argv[] = {"init", 0};
  exec("/init", argv);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cea(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2ce7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1030 <exec@plt>
jmp    1145 <main+0x35>

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0x2cf5(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeda(%rip),%rdi
mov    %rsp,%rsi
call   1030 <exec@plt>
xchg   %ax,%ax
jmp    1130 <main+0x20>

LLVM IR (-O0):
@.str = [5 x i8] c"init\00"
@__const.main.argv = [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* null]
@.str.1 = [6 x i8] c"/init\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8*]
store i32 0, i32* %1
%3 = bitcast [2 x i8*]* %2 to i8*
%4 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%5 = call i32 @exec(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %4)
br label %6
6: ; preds = %0, %6
br label %6
}

LLVM IR (-O2):
@.str = [5 x i8] c"init\00"
@__const.main.argv = [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* null]
@.str.1 = [6 x i8] c"/init\00"
define i32 @main() {
%1 = alloca [2 x i8*]
%2 = bitcast [2 x i8*]* %1 to i8*
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%4 = call i32 @exec(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3)
br label %5
5: ; preds = %5, %0
br label %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void byte_order(FILE *f) {
  union {
    struct {
      unsigned char field1;
      unsigned char field2;
    } bytes;
    unsigned int value;
  } tmp;
  tmp.value = 0;
  tmp.bytes.field1 = 1;
  if (tmp.value == 1) {
    fprintf(f, "#define MACH_BYTE_ORDER_LSB_FIRST\n");
  } else {
    fprintf(f, "#define MACH_BYTE_ORDER_MSB_FIRST\n");
  }
}


x86 assembly (clang, -O0):
<byte_order>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movb   $0x1,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    1146 <byte_order+0x36>
mov    -0x8(%rbp),%rdi
lea    0xec4(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1156 <byte_order+0x46>
mov    -0x8(%rbp),%rdi
lea    0xed2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i32 }
%struct.anon = type { i8, i8 }
@.str = [35 x i8] c"#define MACH_BYTE_ORDER_LSB_FIRST\0A\00"
@.str.1 = [35 x i8] c"#define MACH_BYTE_ORDER_MSB_FIRST\0A\00"
define void @byte_order(i32* %0) {
%2 = alloca i32*
%3 = alloca %union.anon
store i32* %0, i32** %2
%4 = bitcast %union.anon* %3 to i32*
store i32 0, i32* %4
%5 = bitcast %union.anon* %3 to %struct.anon*
%6 = getelementptr inbounds %struct.anon, %struct.anon* %5, i32 0, i32 0
store i8 1, i8* %6
%7 = bitcast %union.anon* %3 to i32*
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32*, i32** %2
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %16
13: ; preds = %1
%14 = load i32*, i32** %2
%15 = call i32 @fprintf(i32* %14, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %13, %10
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"#define MACH_BYTE_ORDER_LSB_FIRST\0A\00"
define void @byte_order(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i64 34, i64 1, i32* %0)
ret void
}
int convert_char_to_int(char to_convert) { return to_convert - 48; }


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

x86 assembly (clang, -O2):
<convert_char_to_int>:
lea    -0x30(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @convert_char_to_int(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 48
ret i32 %5
}

LLVM IR (-O2):
define i32 @convert_char_to_int(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ i2cWrite(int, int, int);
int /*<<< orphan*/ usleep(int);
void ms5611_reset(void) {
  i2cWrite(0x77, 0x1E, 1);
  usleep(2800);
}


x86 assembly (clang, -O0):
<ms5611_reset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x77,%edi
mov    $0x1e,%esi
mov    $0x1,%edx
call   1030 <i2cWrite@plt>
mov    $0xaf0,%edi
call   1040 <usleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ms5611_reset>:
push   %rax
mov    $0x77,%edi
mov    $0x1e,%esi
mov    $0x1,%edx
call   1030 <i2cWrite@plt>
mov    $0xaf0,%edi
pop    %rax
jmp    1040 <usleep@plt>

LLVM IR (-O0):
define void @ms5611_reset() {
%1 = call i32 @i2cWrite(i32 119, i32 30, i32 1)
%2 = call i32 @usleep(i32 2800)
ret void
}

LLVM IR (-O2):
define void @ms5611_reset() {
%1 = tail call i32 @i2cWrite(i32 119, i32 30, i32 1)
%2 = tail call i32 @usleep(i32 2800)
ret void
}
void VecSubtract3fv(float v[3], const float a[3], float b0, float b1,
                    float b2) {
  v[0] = a[0] - b0;
  v[1] = a[1] - b1;
  v[2] = a[2] - b2;
}


x86 assembly (clang, -O0):
<VecSubtract3fv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
movss  %xmm2,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
subss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
subss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
subss  -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<VecSubtract3fv>:
movss  (%rsi),%xmm3
subss  %xmm0,%xmm3
movss  %xmm3,(%rdi)
movss  0x4(%rsi),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,0x4(%rdi)
movss  0x8(%rsi),%xmm0
subss  %xmm2,%xmm0
movss  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define void @VecSubtract3fv(float* %0, float* %1, float %2, float %3, float %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float* %0, float** %6
store float* %1, float** %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%11 = load float*, float** %7
%12 = getelementptr inbounds float, float* %11, i64 0
%13 = load float, float* %12
%14 = load float, float* %8
%15 = fsub float %13, %14
%16 = load float*, float** %6
%17 = getelementptr inbounds float, float* %16, i64 0
store float %15, float* %17
%18 = load float*, float** %7
%19 = getelementptr inbounds float, float* %18, i64 1
%20 = load float, float* %19
%21 = load float, float* %9
%22 = fsub float %20, %21
%23 = load float*, float** %6
%24 = getelementptr inbounds float, float* %23, i64 1
store float %22, float* %24
%25 = load float*, float** %7
%26 = getelementptr inbounds float, float* %25, i64 2
%27 = load float, float* %26
%28 = load float, float* %10
%29 = fsub float %27, %28
%30 = load float*, float** %6
%31 = getelementptr inbounds float, float* %30, i64 2
store float %29, float* %31
ret void
}

LLVM IR (-O2):
define void @VecSubtract3fv(float* nocapture writeonly %0, float* nocapture %1, float %2, float %3, float %4) {
%6 = load float, float* %1
%7 = fsub float %6, %2
store float %7, float* %0
%8 = getelementptr inbounds float, float* %1, i64 1
%9 = load float, float* %8
%10 = fsub float %9, %3
%11 = getelementptr inbounds float, float* %0, i64 1
store float %10, float* %11
%12 = getelementptr inbounds float, float* %1, i64 2
%13 = load float, float* %12
%14 = fsub float %13, %4
%15 = getelementptr inbounds float, float* %0, i64 2
store float %14, float* %15
ret void
}
void print_tile(int tile) {}


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

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

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

LLVM IR (-O2):
define void @print_tile(i32 %0) {
ret void
}
/* Variables and functions */
char *getenv(char *);
char *get_tmp_dir(void) {
  char *tmp;
  tmp = getenv("TMP");
  if (tmp)
    return tmp;
  else
    return "/tmp";
}


x86 assembly (clang, -O0):
<get_tmp_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1140 <get_tmp_dir+0x30>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114b <get_tmp_dir+0x3b>
lea    0xebd(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_tmp_dir>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xedd(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"TMP\00"
@.str.1 = [5 x i8] c"/tmp\00"
define i8* @get_tmp_dir() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
%3 = select i1 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %1
ret i8* %3
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double GetTime() {
  struct timeval tim;
  gettimeofday(&tim, NULL);
  return tim.tv_sec + (tim.tv_usec / 1000000.0);
}


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

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

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @GetTime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load double, double* %5
%7 = fdiv double %6, 1.000000e+06
%8 = fadd double %4, %7
ret double %8
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @GetTime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = fdiv double %7, 1.000000e+06
%9 = fadd double %5, %8
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void Usage(const char *proc) { printf("Usage : %s [IP] [PORT] \n", proc); }


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

x86 assembly (clang, -O2):
<Usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Usage : %s [IP] [PORT] \0A\00"
define void @Usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Usage : %s [IP] [PORT] \0A\00"
define void @Usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
float simplex_noise_2d(int /*<<< orphan*/);
int /*<<< orphan*/ vec2f(float, float);
float call_snoise2(float x, float y) { return simplex_noise_2d(vec2f(x, y)); }


x86 assembly (clang, -O0):
<call_snoise2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <vec2f@plt>
mov    %eax,%edi
call   1040 <simplex_noise_2d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_snoise2>:
push   %rax
call   1030 <vec2f@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <simplex_noise_2d@plt>

LLVM IR (-O0):
define float @call_snoise2(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 = load float, float* %4
%7 = call i32 @vec2f(float %5, float %6)
%8 = call float @simplex_noise_2d(i32 %7)
ret float %8
}

LLVM IR (-O2):
define float @call_snoise2(float %0, float %1) {
%3 = tail call i32 @vec2f(float %0, float %1)
%4 = tail call float @simplex_noise_2d(i32 %3)
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ expand(char *, char *);
int getline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
main() {
  int len;
  char line[1000];
  char expanded[1000];
  while ((len = getline(line, 1000)) > 0) {
    expand(line, expanded);
    printf("%s", expanded);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <getline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    118a <main+0x5a>
lea    -0x3f0(%rbp),%rdi
lea    -0x7e0(%rbp),%rsi
call   1040 <expand@plt>
lea    -0x7e0(%rbp),%rsi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x7e0,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1050 <getline@plt>
test   %eax,%eax
jle    1187 <main+0x57>
mov    %rsp,%r14
lea    0x3f0(%rsp),%rbx
lea    0xea1(%rip),%r15
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <expand@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x3e8,%esi
call   1050 <getline@plt>
test   %eax,%eax
jg     1160 <main+0x30>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = call i32 @getline(i8* %3, i32 1000)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %0, %7
%8 = call i32 @expand(i8* %3, i8* %4)
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%10 = call i32 @getline(i8* %3, i32 1000)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %7, label %12
12: ; preds = %7, %0
ret i32 0
}
/* Variables and functions */
unsigned long __clear_user(void *, unsigned long);
unsigned long clear_user(void *to, unsigned long n) {
  if ((1))
    n = __clear_user(to, n);
  return n;
}


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

x86 assembly (clang, -O2):
<clear_user>:
jmp    1030 <__clear_user@plt>

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

LLVM IR (-O2):
define i64 @clear_user(i8* %0, i64 %1) {
%3 = tail call i64 @__clear_user(i8* %0, i64 %1)
ret i64 %3
}
double average(double a, double b, unsigned int r_a, unsigned int r_b) {
  return (a * r_a + b * r_b) / (r_a + r_b);
}


x86 assembly (clang, -O0):
<average>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
mov    %ecx,%eax
cvtsi2sd %rcx,%xmm2
movsd  -0x10(%rbp),%xmm1
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
mov    %edx,%ecx
cvtsi2sd %rdx,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    %ecx,%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<average>:
mov    %edi,%eax
cvtsi2sd %rax,%xmm2
mov    %esi,%eax
cvtsi2sd %rax,%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
add    %edi,%esi
xorps  %xmm1,%xmm1
cvtsi2sd %rsi,%xmm1
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @average(double %0, double %1, i32 %2, i32 %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load double, double* %5
%10 = load i32, i32* %7
%11 = uitofp i32 %10 to double
%12 = load double, double* %6
%13 = load i32, i32* %8
%14 = uitofp i32 %13 to double
%15 = fmul double %12, %14
%16 = call double @llvm.fmuladd.f64(double %9, double %11, double %15)
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = add i32 %17, %18
%20 = uitofp i32 %19 to double
%21 = fdiv double %16, %20
ret double %21
}

LLVM IR (-O2):
define double @average(double %0, double %1, i32 %2, i32 %3) {
%5 = uitofp i32 %2 to double
%6 = uitofp i32 %3 to double
%7 = fmul double %6, %1
%8 = tail call double @llvm.fmuladd.f64(double %0, double %5, double %7)
%9 = add i32 %3, %2
%10 = uitofp i32 %9 to double
%11 = fdiv double %8, %10
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
void memset_good1() {
  int arr[10];
  memset(arr, 0, 40);
}


x86 assembly (clang, -O0):
<memset_good1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset_good1>:
sub    $0x28,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @memset_good1() {
%1 = alloca [10 x i32]
%2 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%3 = call i32 @memset(i32* %2, i32 0, i32 40)
ret void
}

LLVM IR (-O2):
define void @memset_good1() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @memset(i32* %3, i32 0, i32 40)
ret void
}
int iscntrl(int c) { return (c <= 0x1f && c == 0x7f); }


x86 assembly (clang, -O0):
<iscntrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1f,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jg     1120 <iscntrl+0x20>
cmpl   $0x7f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @iscntrl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 31
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 127
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @iscntrl(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void helloworld_external() {
  int a = 2;
  float b = 0.1;
  printf("a+2=%d\n", a + 2);
}


x86 assembly (clang, -O0):
<helloworld_external>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
movss  0xed9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%esi
add    $0x2,%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<helloworld_external>:
lea    0xee9(%rip),%rdi
mov    $0x4,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"a+2=%d\0A\00"
define void @helloworld_external() {
%1 = alloca i32
%2 = alloca float
store i32 2, i32* %1
store float 0x3FB99999A0000000, float* %2
%3 = load i32, i32* %1
%4 = add nsw i32 %3, 2
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"a+2=%d\0A\00"
define void @helloworld_external() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void timerStart(struct timeval *ti) { gettimeofday(ti, NULL); }


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

x86 assembly (clang, -O2):
<timerStart>:
xor    %esi,%esi
jmp    1030 <gettimeofday@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
define void @timerStart(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define void @timerStart(%struct.timeval* nocapture %0) {
%2 = tail call i32 @gettimeofday(%struct.timeval* %0, i32* null)
ret void
}
void SXNET_add_id_asc(void) {}


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

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

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

LLVM IR (-O2):
define void @SXNET_add_id_asc() {
ret void
}
void list_free_keys(char **keys) {
  int counter = 0;
  while (keys[counter]) {
    free(keys[counter]);
    counter++;
  }
  free(keys);
}


x86 assembly (clang, -O0):
<list_free_keys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1155 <list_free_keys+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <list_free_keys+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_free_keys>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <list_free_keys+0x31>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <list_free_keys+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @list_free_keys(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %9, %4 ], [ %2, %1 ]
tail call void @free(i8* %6)
%7 = add nuw nsw i64 %5, 1
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = bitcast i8** %0 to i8*
tail call void @free(i8* %12)
ret void
}
double dadd(double x, double y) { return x + y; }


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

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

LLVM IR (-O0):
define double @dadd(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 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @dadd(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ test_parser_sourcefile(char *, char *);
int /*<<< orphan*/ test_parser_verify_entity(int /*<<< orphan*/, char *,
                                             char *);
void test_cmake_comment_entities() {
  test_parser_verify_entity(test_parser_sourcefile("cmake", " #comment"),
                            "comment", "#comment");
}


x86 assembly (clang, -O0):
<test_cmake_comment_entities>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed4(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
mov    %eax,%edi
lea    0xec8(%rip),%rsi
lea    0xec0(%rip),%rdx
call   1040 <test_parser_verify_entity@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_cmake_comment_entities>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
lea    0xecd(%rip),%rsi
lea    0xec5(%rip),%rdx
mov    %eax,%edi
pop    %rax
jmp    1040 <test_parser_verify_entity@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"cmake\00"
@.str.1 = [10 x i8] c" #comment\00"
@.str.2 = [8 x i8] c"comment\00"
@.str.3 = [9 x i8] c"#comment\00"
define void @test_cmake_comment_entities() {
%1 = call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test_parser_verify_entity(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"cmake\00"
@.str.1 = [10 x i8] c" #comment\00"
@.str.2 = [8 x i8] c"comment\00"
@.str.3 = [9 x i8] c"#comment\00"
define void @test_cmake_comment_entities() {
%1 = tail call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test_parser_verify_entity(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret void
}
unsigned long long int summation(unsigned int n) {
  int results = 0;
  for (unsigned int i = 1; i <= n; ++i) {
    results += i;
  }
  return results;
}


x86 assembly (clang, -O0):
<summation>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
ja     1138 <summation+0x38>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <summation+0x15>
movslq -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<summation>:
test   %edi,%edi
je     111a <summation+0x1a>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,2),%eax
add    $0xffffffff,%eax
cltq
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @summation(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = shl i32 %0, 1
%5 = add i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
%14 = sext i32 %13 to i64
br label %15
15: ; preds = %3, %1
%16 = phi i64 [ 0, %1 ], [ %14, %3 ]
ret i64 %16
}
void sleep(int time) {
  int i, j;
  int a = 0;
  int b = 3;
  for (i = 0; i < 0x00005000; i++) {
    for (j = 0; j < time; j++) {
      a += b;
      b += a;
    }
    b += a;
  }
  a += b;
}


x86 assembly (clang, -O0):
<sleep>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5000,-0x8(%rbp)
jge    1173 <sleep+0x73>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115c <sleep+0x5c>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1130 <sleep+0x30>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111c <sleep+0x1c>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @sleep(i32 %0) {
ret void
}