xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ primeNum(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x;
  printf("Please input an integer:\n");
  scanf("%d", &x);
  primeNum(x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <primeNum@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <primeNum@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please input an integer:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @primeNum(i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [25 x i8] c"Please input an integer:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%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 ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @primeNum(i32 %5)
ret i32 0
}
void NOP() {}


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

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

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

LLVM IR (-O2):
define void @NOP() {
ret void
}
/* Variables and functions */
int rand();
int rand_offset() { return (rand() & 0xff) - 128; }


x86 assembly (clang, -O0):
<rand_offset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
sub    $0x80,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_offset>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
movzbl %al,%eax
add    $0xffffff80,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rand_offset() {
%1 = call i32 (...) @rand()
%2 = and i32 %1, 255
%3 = sub nsw i32 %2, 128
ret i32 %3
}

LLVM IR (-O2):
define i32 @rand_offset() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 255
%3 = add nsw i32 %2, -128
ret i32 %3
}
double geom_dot2d(const double a[2], const double b[2]) {
  return a[0] * b[0] + a[1] * b[1];
}


x86 assembly (clang, -O0):
<geom_dot2d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_dot2d>:
movsd  0x8(%rdi),%xmm1
mulsd  0x8(%rsi),%xmm1
movsd  (%rdi),%xmm0
mulsd  (%rsi),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @geom_dot2d(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 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = fmul double %13, %16
%18 = call double @llvm.fmuladd.f64(double %7, double %10, double %17)
ret double %18
}

LLVM IR (-O2):
define double @geom_dot2d(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %9)
ret double %10
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  int dummy;
};

/* Variables and functions */
int gettimeofday(struct timeval *, struct timezone *);
int ooGetTimeOfDay(struct timeval *tv, struct timezone *tz) {
  return gettimeofday(tv, tz);
}


x86 assembly (clang, -O0):
<ooGetTimeOfDay>:
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 <gettimeofday@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ooGetTimeOfDay>:
jmp    1030 <gettimeofday@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define i32 @ooGetTimeOfDay(%struct.timeval* %0, %struct.timezone* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timezone*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timezone* %1, %struct.timezone** %4
%5 = load %struct.timeval*, %struct.timeval** %3
%6 = load %struct.timezone*, %struct.timezone** %4
%7 = call i32 @gettimeofday(%struct.timeval* %5, %struct.timezone* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define i32 @ooGetTimeOfDay(%struct.timeval* nocapture %0, %struct.timezone* nocapture %1) {
%3 = tail call i32 @gettimeofday(%struct.timeval* %0, %struct.timezone* %1)
ret i32 %3
}
/* Variables and functions */
double cos1(double);
double sin1(double);
double tan1(double sita) { return sin1(sita) / cos1(sita); }


x86 assembly (clang, -O0):
<tan1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin1@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos1@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tan1>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <sin1@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos1@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @tan1(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @sin1(double %3)
%5 = load double, double* %2
%6 = call double @cos1(double %5)
%7 = fdiv double %4, %6
ret double %7
}

LLVM IR (-O2):
define double @tan1(double %0) {
%2 = tail call double @sin1(double %0)
%3 = tail call double @cos1(double %0)
%4 = fdiv double %2, %3
ret double %4
}
AR0I1(r0, r1, x0, x1, p0, p1) double r0, r1;
double *p0, *p1;
{
  if ((p0[10000000]) <= 33)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<AR0I1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movsd  0xed8(%rip),%xmm0
ucomisd 0x4c4b400(%rax),%xmm0
04
jb     1142 <AR0I1+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1149 <AR0I1+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AR0I1>:
movsd  0xef8(%rip),%xmm0
xor    %eax,%eax
ucomisd 0x4c4b400(%rdx),%xmm0
04
setae  %al
ret

LLVM IR (-O0):
define i32 @AR0I1(double %0, double %1, i32 %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
store double %0, double* %8
store double %1, double* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
%14 = load double*, double** %12
%15 = getelementptr inbounds double, double* %14, i64 10000000
%16 = load double, double* %15
%17 = fcmp ole double %16, 3.300000e+01
br i1 %17, label %18, label %19
18: ; preds = %6
store i32 1, i32* %7
br label %20
19: ; preds = %6
store i32 0, i32* %7
br label %20
20: ; preds = %19, %18
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
define i32 @AR0I1(double %0, double %1, i32 %2, i32 %3, double* nocapture %4, double* nocapture readnone %5) {
%7 = getelementptr inbounds double, double* %4, i64 10000000
%8 = load double, double* %7
%9 = fcmp ole double %8, 3.300000e+01
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int pow(int, int);
int FxB_Expandable_capacity(int capacity) {
  int exponent = 1;
  while (capacity > 1) {
    exponent++;
    capacity = capacity >> 1;
  }
  return pow(2, exponent + 1);
}


x86 assembly (clang, -O0):
<FxB_Expandable_capacity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1143 <FxB_Expandable_capacity+0x33>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1122 <FxB_Expandable_capacity+0x12>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    $0x2,%edi
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FxB_Expandable_capacity>:
mov    $0x2,%esi
cmp    $0x2,%edi
jl     113c <FxB_Expandable_capacity+0x2c>
mov    $0x2,%esi
mov    %edi,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
shr    %eax
add    $0x1,%esi
cmp    $0x3,%edi
mov    %eax,%edi
ja     1130 <FxB_Expandable_capacity+0x20>
mov    $0x2,%edi
jmp    1030 <pow@plt>

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

LLVM IR (-O2):
define i32 @FxB_Expandable_capacity(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 2, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i32 %5, 3
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 2, %1 ], [ %7, %3 ]
%11 = tail call i32 @pow(i32 2, i32 %10)
ret i32 %11
}
int trmIndex(int row, int col) {
  return (row) > (col) ? ((row) + 1) * (row) / 2 + (col)
                       : ((col) + 1) * (col) / 2 + (row);
}


x86 assembly (clang, -O0):
<trmIndex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1133 <trmIndex+0x33>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
imul   -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    114b <trmIndex+0x4b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
imul   -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trmIndex>:
cmp    %esi,%edi
mov    %esi,%eax
cmovg  %edi,%eax
cmovg  %esi,%edi
lea    0x1(%rax),%ecx
imul   %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @trmIndex(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
%5 = select i1 %3, i32 %1, i32 %0
%6 = add nsw i32 %4, 1
%7 = mul nsw i32 %6, %4
%8 = sdiv i32 %7, 2
%9 = add nsw i32 %8, %5
ret i32 %9
}
/* Variables and functions */
int io_in8(int);
int controller_ready(void) {
  int retries = 10000;
  while (--retries && (io_in8(0x1f7) & 0xc0) != 0x40)
    ;
  return (retries);
}


x86 assembly (clang, -O0):
<controller_ready>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2710,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
je     114e <controller_ready+0x3e>
mov    $0x1f7,%edi
call   1030 <io_in8@plt>
and    $0xc0,%eax
cmp    $0x40,%eax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    115e <controller_ready+0x4e>
jmp    1163 <controller_ready+0x53>
jmp    111f <controller_ready+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<controller_ready>:
push   %rbp
push   %rbx
push   %rax
mov    $0x270f,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%ebx
sub    $0x1,%ebp
jb     113b <controller_ready+0x2b>
mov    $0x1f7,%edi
call   1030 <io_in8@plt>
and    $0xc0,%eax
cmp    $0x40,%eax
jne    1120 <controller_ready+0x10>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @controller_ready() {
%1 = alloca i32
store i32 10000, i32* %1
br label %2
2: ; preds = %12, %0
%3 = load i32, i32* %1
%4 = add nsw i32 %3, -1
store i32 %4, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = call i32 @io_in8(i32 503)
%8 = and i32 %7, 192
%9 = icmp ne i32 %8, 64
br label %10
10: ; preds = %6, %2
%11 = phi i1 [ false, %2 ], [ %9, %6 ]
br i1 %11, label %12, label %13
12: ; preds = %10
br label %2
13: ; preds = %10
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
define i32 @controller_ready() {
br label %1
1: ; preds = %5, %0
%2 = phi i32 [ 10000, %0 ], [ %3, %5 ]
%3 = add nsw i32 %2, -1
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = tail call i32 @io_in8(i32 503)
%7 = and i32 %6, 192
%8 = icmp eq i32 %7, 64
br i1 %8, label %9, label %1
9: ; preds = %1, %5
ret i32 %3
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int64_t PtsAdd(int64_t Pts1, int64_t Pts2) {
  return (Pts1 + Pts2) & 0x00000001FFFFFFFFLL;
}


x86 assembly (clang, -O0):
<PtsAdd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
cltq
movabs $0x1ffffffff,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PtsAdd>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @PtsAdd(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 = add nsw i32 %5, %6
%8 = sext i32 %7 to i64
%9 = and i64 %8, 8589934591
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @PtsAdd(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
int getcpu(int *cpu, int *node) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @getcpu(i32* nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 -1
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EBADF;
int /*<<< orphan*/ errno;
int fstat(int fd, struct stat *buf) {
  (void)fd;
  (void)buf;
  errno = EBADF;
  return -1;
}


x86 assembly (clang, -O0):
<fstat>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec5(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fstat>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@EBADF = global i32 0
@errno = global i32 0
define i32 @fstat(i32 %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca %struct.stat*
store i32 %0, i32* %3
store %struct.stat* %1, %struct.stat** %4
%5 = load i32, i32* %3
%6 = load %struct.stat*, %struct.stat** %4
%7 = load i32, i32* @EBADF
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@EBADF = global i32 0
@errno = global i32 0
define i32 @fstat(i32 %0, %struct.stat* nocapture readnone %1) {
%3 = load i32, i32* @EBADF
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
long lrand48();
int gen_signed_number(int range) {
  int temp;
  long tmp;
  int __cil_tmp4;
  int __cil_tmp5;
  long __cil_tmp6;
  long __cil_tmp7;
  int __cil_tmp8;
  {
    {
      tmp = lrand48();
      __cil_tmp4 = 2 * range;
      __cil_tmp5 = __cil_tmp4 - 1;
      __cil_tmp6 = (long)__cil_tmp5;
      __cil_tmp7 = tmp % __cil_tmp6;
      temp = (int)__cil_tmp7;
    }
    {
      __cil_tmp8 = range - 1;
      return (temp - __cil_tmp8);
    }
  }
}


x86 assembly (clang, -O0):
<gen_signed_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <lrand48@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cqto
idivq  -0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_signed_number>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <lrand48@plt>
lea    (%rbx,%rbx,1),%ecx
add    $0xffffffff,%ecx
movslq %ecx,%rsi
mov    %rax,%rdx
or     %rsi,%rdx
shr    $0x20,%rdx
je     1139 <gen_signed_number+0x29>
cqto
idiv   %rsi
mov    %rdx,%rax
jmp    113f <gen_signed_number+0x2f>
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
sub    %ebx,%eax
add    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @gen_signed_number(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
store i32 %0, i32* %2
%10 = call i64 (...) @lrand48()
store i64 %10, i64* %4
%11 = load i32, i32* %2
%12 = mul nsw i32 2, %11
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = sub nsw i32 %13, 1
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
store i64 %16, i64* %7
%17 = load i64, i64* %4
%18 = load i64, i64* %7
%19 = srem i64 %17, %18
store i64 %19, i64* %8
%20 = load i64, i64* %8
%21 = trunc i64 %20 to i32
store i32 %21, i32* %3
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 1
store i32 %23, i32* %9
%24 = load i32, i32* %3
%25 = load i32, i32* %9
%26 = sub nsw i32 %24, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @gen_signed_number(i32 %0) {
%2 = tail call i64 (...) @lrand48()
%3 = shl nsw i32 %0, 1
%4 = add nsw i32 %3, -1
%5 = sext i32 %4 to i64
%6 = srem i64 %2, %5
%7 = trunc i64 %6 to i32
%8 = sub i32 1, %0
%9 = add i32 %8, %7
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ foo();
void testTortureExecute(void) {
  foo();
  return;
}


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

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

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

LLVM IR (-O2):
define void @testTortureExecute() {
%1 = tail call i32 (...) @foo()
ret void
}
unsigned long long int l_mulu(unsigned long int op1, unsigned long int op2) {
  unsigned long int a, b, c, d;
  a = op1 >> 16;
  b = op1 & 0xffff;
  c = op2 >> 16;
  d = op2 & 0xffff;
  unsigned long long int res;
  res = (unsigned long long int)(a * c) << 32;
  res += ((unsigned long long int)(a * d) << 16);
  res += ((unsigned long long int)(b * c) << 16);
  res += (unsigned long long int)(b * d);
  return res;
}


x86 assembly (clang, -O0):
<l_mulu>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
and    $0xffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
imul   -0x28(%rbp),%rax
shl    $0x20,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
imul   -0x30(%rbp),%rax
shl    $0x10,%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
imul   -0x28(%rbp),%rax
shl    $0x10,%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
imul   -0x30(%rbp),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_mulu>:
movzwl %di,%ecx
mov    %rdi,%rax
shr    $0x10,%rax
imul   %rsi,%rcx
imul   %rsi,%rax
shl    $0x10,%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @l_mulu(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%10 = load i64, i64* %3
%11 = lshr i64 %10, 16
store i64 %11, i64* %5
%12 = load i64, i64* %3
%13 = and i64 %12, 65535
store i64 %13, i64* %6
%14 = load i64, i64* %4
%15 = lshr i64 %14, 16
store i64 %15, i64* %7
%16 = load i64, i64* %4
%17 = and i64 %16, 65535
store i64 %17, i64* %8
%18 = load i64, i64* %5
%19 = load i64, i64* %7
%20 = mul i64 %18, %19
%21 = shl i64 %20, 32
store i64 %21, i64* %9
%22 = load i64, i64* %5
%23 = load i64, i64* %8
%24 = mul i64 %22, %23
%25 = shl i64 %24, 16
%26 = load i64, i64* %9
%27 = add i64 %26, %25
store i64 %27, i64* %9
%28 = load i64, i64* %6
%29 = load i64, i64* %7
%30 = mul i64 %28, %29
%31 = shl i64 %30, 16
%32 = load i64, i64* %9
%33 = add i64 %32, %31
store i64 %33, i64* %9
%34 = load i64, i64* %6
%35 = load i64, i64* %8
%36 = mul i64 %34, %35
%37 = load i64, i64* %9
%38 = add i64 %37, %36
store i64 %38, i64* %9
%39 = load i64, i64* %9
ret i64 %39
}

LLVM IR (-O2):
define i64 @l_mulu(i64 %0, i64 %1) {
%3 = lshr i64 %0, 16
%4 = and i64 %0, 65535
%5 = shl i64 %1, 16
%6 = mul i64 %4, %1
%7 = mul i64 %5, %3
%8 = add i64 %7, %6
ret i64 %8
}
int(a)(int x) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @a(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void news_received(const char *news) {
  printf("news received:\n");
  printf("%s\n", news);
}


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

x86 assembly (clang, -O2):
<news_received>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [15 x i8] c"news received:\00"
define void @news_received(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret void
}
void Set640x480_60(void) {
  *((volatile unsigned long *)(0x97000000 + 0x008)) =
      ((96 - 1) << 24) | ((48 - 1) << 16) | (640 - 1);
  *((volatile unsigned long *)(0x97000000 + 0x00c)) =
      ((2 - 1) << 24) | ((31 - 1) << 16) | (480 - 1);
  *((volatile unsigned long *)(0x97000000 + 0x010)) =
      ((800 - 1) << 16) | (525 - 1);
  *((volatile unsigned long *)(0xB8000000 + 0x018)) = (640 << 16) | 480;
}


x86 assembly (clang, -O0):
<Set640x480_60>:
push   %rbp
mov    %rsp,%rbp
mov    $0x97000008,%eax
movq   $0x5f2f027f,(%rax)
mov    $0x9700000c,%eax
movq   $0x11e01df,(%rax)
mov    $0x97000010,%eax
movq   $0x31f020c,(%rax)
mov    $0xb8000018,%eax
movq   $0x28001e0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Set640x480_60>:
mov    $0x97000008,%eax
movq   $0x5f2f027f,(%rax)
movq   $0x11e01df,0x4(%rax)
01
movq   $0x31f020c,0x8(%rax)
03
movq   $0x28001e0,0x21000010(%rax)
e0 01 80 02
ret

LLVM IR (-O0):
define void @Set640x480_60() {
store volatile i64 1596916351, i64* inttoptr (i64 2533359624 to i64*)
store volatile i64 18743775, i64* inttoptr (i64 2533359628 to i64*)
store volatile i64 52363788, i64* inttoptr (i64 2533359632 to i64*)
store volatile i64 41943520, i64* inttoptr (i64 3087007768 to i64*)
ret void
}

LLVM IR (-O2):
define void @Set640x480_60() {
store volatile i64 1596916351, i64* inttoptr (i64 2533359624 to i64*)
store volatile i64 18743775, i64* inttoptr (i64 2533359628 to i64*)
store volatile i64 52363788, i64* inttoptr (i64 2533359632 to i64*)
store volatile i64 41943520, i64* inttoptr (i64 3087007768 to i64*)
ret void
}
/* Variables and functions */
unsigned long setbits(unsigned long dst, size_t at, size_t size,
                      unsigned long src) {
  unsigned long mask = ~(~0UL << size);
  src &= mask;
  src <<= at + 1 - size;
  mask = ~(mask << (at + 1 - size));
  dst &= mask;
  return dst | src;
}


x86 assembly (clang, -O0):
<setbits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
and    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
add    $0x1,%rcx
sub    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
shl    %cl,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    $0x1,%rcx
sub    -0x18(%rbp),%rcx
shl    %cl,%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
or     -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setbits>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
not    %rax
and    %rax,%r8
sub    %ecx,%esi
lea    0x1(%rsi),%ecx
shl    %cl,%r8
shl    %cl,%rax
not    %rax
and    %rdi,%rax
or     %r8,%rax
ret

LLVM IR (-O0):
define i64 @setbits(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%10 = load i64, i64* %7
%11 = shl i64 -1, %10
%12 = xor i64 %11, -1
store i64 %12, i64* %9
%13 = load i64, i64* %9
%14 = load i64, i64* %8
%15 = and i64 %14, %13
store i64 %15, i64* %8
%16 = load i64, i64* %6
%17 = add i64 %16, 1
%18 = load i64, i64* %7
%19 = sub i64 %17, %18
%20 = load i64, i64* %8
%21 = shl i64 %20, %19
store i64 %21, i64* %8
%22 = load i64, i64* %9
%23 = load i64, i64* %6
%24 = add i64 %23, 1
%25 = load i64, i64* %7
%26 = sub i64 %24, %25
%27 = shl i64 %22, %26
%28 = xor i64 %27, -1
store i64 %28, i64* %9
%29 = load i64, i64* %9
%30 = load i64, i64* %5
%31 = and i64 %30, %29
store i64 %31, i64* %5
%32 = load i64, i64* %5
%33 = load i64, i64* %8
%34 = or i64 %32, %33
ret i64 %34
}

LLVM IR (-O2):
define i64 @setbits(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = shl nsw i64 -1, %2
%6 = xor i64 %5, -1
%7 = and i64 %6, %3
%8 = add i64 %1, 1
%9 = sub i64 %8, %2
%10 = shl i64 %7, %9
%11 = shl i64 %6, %9
%12 = xor i64 %11, -1
%13 = and i64 %12, %0
%14 = or i64 %13, %10
ret i64 %14
}
void clear_full_rows(int *board) {}


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

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

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

LLVM IR (-O2):
define void @clear_full_rows(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int bbm_write(void *, unsigned short, unsigned char);
signed int bbm_com_write(void *handle, unsigned short addr,
                         unsigned char data) {
  signed int res;
  res = bbm_write(handle, addr, data);
  return res;
}


x86 assembly (clang, -O0):
<bbm_com_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %si,%cx
mov    %rdi,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
movzwl %ax,%esi
movzbl -0xb(%rbp),%edx
call   1030 <bbm_write@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbm_com_write>:
jmp    1030 <bbm_write@plt>

LLVM IR (-O0):
define i32 @bbm_com_write(i8* %0, i16 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i8
%7 = alloca i32
store i8* %0, i8** %4
store i16 %1, i16* %5
store i8 %2, i8* %6
%8 = load i8*, i8** %4
%9 = load i16, i16* %5
%10 = load i8, i8* %6
%11 = call i32 @bbm_write(i8* %8, i16 zeroext %9, i8 zeroext %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
ret i32 %12
}

LLVM IR (-O2):
define i32 @bbm_com_write(i8* %0, i16 zeroext %1, i8 zeroext %2) {
%4 = tail call i32 @bbm_write(i8* %0, i16 zeroext %1, i8 zeroext %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ emit(char *);
void airlock_enter(void) {
  emit("pop eax\n");
  emit("pop ebx\n");
  emit("mov edi,[__io_cycle_counter]\n");
  emit("mov ebp,[__io_fetchbase]\n");
  emit("mov esi,[__io_fetchbased_pc]\n");
}


x86 assembly (clang, -O0):
<airlock_enter>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <emit@plt>
lea    0xee2(%rip),%rdi
call   1030 <emit@plt>
lea    0xedf(%rip),%rdi
call   1030 <emit@plt>
lea    0xef1(%rip),%rdi
call   1030 <emit@plt>
lea    0xeff(%rip),%rdi
call   1030 <emit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<airlock_enter>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <emit@plt>
lea    0xee5(%rip),%rdi
call   1030 <emit@plt>
lea    0xee2(%rip),%rdi
call   1030 <emit@plt>
lea    0xef4(%rip),%rdi
call   1030 <emit@plt>
lea    0xf02(%rip),%rdi
pop    %rax
jmp    1030 <emit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"pop eax\0A\00"
@.str.1 = [9 x i8] c"pop ebx\0A\00"
@.str.2 = [30 x i8] c"mov edi,[__io_cycle_counter]\0A\00"
@.str.3 = [26 x i8] c"mov ebp,[__io_fetchbase]\0A\00"
@.str.4 = [30 x i8] c"mov esi,[__io_fetchbased_pc]\0A\00"
define void @airlock_enter() {
%1 = call i32 @emit(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @emit(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @emit(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @emit(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @emit(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"pop eax\0A\00"
@.str.1 = [9 x i8] c"pop ebx\0A\00"
@.str.2 = [30 x i8] c"mov edi,[__io_cycle_counter]\0A\00"
@.str.3 = [26 x i8] c"mov ebp,[__io_fetchbase]\0A\00"
@.str.4 = [30 x i8] c"mov esi,[__io_fetchbased_pc]\0A\00"
define void @airlock_enter() {
%1 = tail call i32 @emit(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @emit(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @emit(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @emit(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @emit(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ context_done();
void scope_done() { context_done(); }


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

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

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

LLVM IR (-O2):
define void @scope_done() {
%1 = tail call i32 (...) @context_done()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int /*<<< orphan*/);
int /*<<< orphan*/ g(int);
int /*<<< orphan*/ h(int);
int main(int i) {
  f(0);
  if (1) {
    g(2);
  } else {
    g(3);
  }
  h(4);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
call   1040 <f@plt>
mov    $0x2,%edi
call   1050 <g@plt>
mov    $0x4,%edi
call   1030 <h@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <f@plt>
mov    $0x2,%edi
call   1050 <g@plt>
mov    $0x4,%edi
call   1030 <h@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0) {
%2 = tail call i32 @f(i32 0)
%3 = tail call i32 @g(i32 2)
%4 = tail call i32 @h(i32 4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XGetErrorText() {
  printf("XGetErrorText called\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [21 x i8] c"XGetErrorText called\00"
define i32 @XGetErrorText() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int constructor(char **path, int test) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @constructor(i8** nocapture readnone %0, i32 %1) {
ret i32 0
}
void nested_loop_with_label() {
  int i, j = 0;
  char a[10];
  for (i = 0; i < 10; i++) {
  outer_loop:
    a[j] = 'a';
    for (j = 0; j <= 10; j++) {
      if (j >= 10)
        goto outer_loop;
    }
  }
}


x86 assembly (clang, -O0):
<nested_loop_with_label>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1170 <nested_loop_with_label+0x70>
jmp    1121 <nested_loop_with_label+0x21>
movslq -0x8(%rbp),%rax
movb   $0x61,-0x12(%rbp,%rax,1)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     115d <nested_loop_with_label+0x5d>
cmpl   $0xa,-0x8(%rbp)
jl     114a <nested_loop_with_label+0x4a>
jmp    1121 <nested_loop_with_label+0x21>
jmp    114f <nested_loop_with_label+0x4f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1131 <nested_loop_with_label+0x31>
jmp    1162 <nested_loop_with_label+0x62>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <nested_loop_with_label+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @nested_loop_with_label() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i8]
store i32 0, i32* %2
store i32 0, i32* %1
br label %4
4: ; preds = %24, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %27
7: ; preds = %4
br label %8
8: ; preds = %18, %7
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %10
store i8 97, i8* %11
store i32 0, i32* %2
br label %12
12: ; preds = %20, %8
%13 = load i32, i32* %2
%14 = icmp sle i32 %13, 10
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sge i32 %16, 10
br i1 %17, label %18, label %19
18: ; preds = %15
br label %8
19: ; preds = %15
br label %20
20: ; preds = %19
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %12
23: ; preds = %12
br label %24
24: ; preds = %23
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
br label %4
27: ; preds = %4
ret void
}

LLVM IR (-O2):
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t op_id(uint32_t a, uint32_t b) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @op_id(i32 %0, i32 %1) {
ret i32 0
}
void abe_unlock_execution(void) {}


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

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

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

LLVM IR (-O2):
define void @abe_unlock_execution() {
ret void
}
int test_imm_82int16_reg(short val) {
  return ((val) & (0x82 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_82int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x82,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_82int16_reg>:
test   $0x82,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_82int16_reg(i16 signext %0) {
%2 = and i16 %0, 130
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ arm_mpy_op();
int /*<<< orphan*/ arm_mpy_umlal(int /*<<< orphan*/);
void arm_umlal() { arm_mpy_umlal(arm_mpy_op()); }


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

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

LLVM IR (-O0):
define void @arm_umlal() {
%1 = call i32 (...) @arm_mpy_op()
%2 = call i32 @arm_mpy_umlal(i32 %1)
ret void
}

LLVM IR (-O2):
define void @arm_umlal() {
%1 = tail call i32 (...) @arm_mpy_op()
%2 = tail call i32 @arm_mpy_umlal(i32 %1)
ret void
}
int my_compare(char *a, char *b) { return *a - *b; }


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

x86 assembly (clang, -O2):
<my_compare>:
movsbl (%rdi),%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @my_compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @my_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int win_gravity;
};
typedef TYPE_1__ XSetWindowAttributes;

/* Variables and functions */
void set_XSetWindowAttributes_win_gravity(void *_p, int _v) {
  ((XSetWindowAttributes *)_p)->win_gravity = (int)_v;
}


x86 assembly (clang, -O0):
<set_XSetWindowAttributes_win_gravity>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XSetWindowAttributes_win_gravity>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @set_XSetWindowAttributes_win_gravity(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
int getmax(int a, int b) {
  int rest;
  do {
    rest = a % b;
    a = b;
    b = rest;
  } while (rest != 0);
  return a;
}


x86 assembly (clang, -O0):
<getmax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    110a <getmax+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmax>:
mov    %esi,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %edi,%eax
mov    %edx,%edi
cltd
idiv   %edi
test   %edx,%edx
jne    1110 <getmax+0x10>
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @getmax(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %1, %2 ], [ %6, %3 ]
%5 = phi i32 [ %0, %2 ], [ %4, %3 ]
%6 = srem i32 %5, %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3
ret i32 %4
}
double test_fmax(double x, double y) { return __builtin_fmax(x, y); }


x86 assembly (clang, -O0):
<test_fmax>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm3
movsd  -0x10(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
maxsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fmax>:
movapd %xmm0,%xmm2
cmpunordsd %xmm0,%xmm2
movapd %xmm2,%xmm3
andpd  %xmm1,%xmm3
maxsd  %xmm0,%xmm1
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @test_fmax(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 = call double @llvm.maxnum.f64(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @test_fmax(double %0, double %1) {
%3 = tail call double @llvm.maxnum.f64(double %0, double %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int socket(int, int, int);
int createSock(int domain, int type, int protocol) {
  int sockID;
  sockID = socket(domain, type, protocol);
  if (sockID < 0) {
    perror("Error opening socket\n");
    exit(1);
  }
  return sockID;
}


x86 assembly (clang, -O0):
<createSock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <socket@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1172 <createSock+0x42>
lea    0xe9d(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createSock>:
push   %rax
call   1050 <socket@plt>
test   %eax,%eax
js     113c <createSock+0xc>
pop    %rcx
ret
lea    0xebd(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [22 x i8] c"Error opening socket\0A\00"
define i32 @createSock(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @socket(i32 %0, i32 %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ RegWriteA_LC898122AF(int, int);
void GyOutSignalCont(void) { RegWriteA_LC898122AF(0x0280, 0x04); }


x86 assembly (clang, -O0):
<GyOutSignalCont>:
push   %rbp
mov    %rsp,%rbp
mov    $0x280,%edi
mov    $0x4,%esi
call   1030 <RegWriteA_LC898122AF@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GyOutSignalCont>:
mov    $0x280,%edi
mov    $0x4,%esi
jmp    1030 <RegWriteA_LC898122AF@plt>

LLVM IR (-O0):
define void @GyOutSignalCont() {
%1 = call i32 @RegWriteA_LC898122AF(i32 640, i32 4)
ret void
}

LLVM IR (-O2):
define void @GyOutSignalCont() {
%1 = tail call i32 @RegWriteA_LC898122AF(i32 640, i32 4)
ret void
}