xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned short permute(unsigned short, int *, int, int);
unsigned short pTen(unsigned short seed) {
  unsigned short postPTen;
  int pTenBox[10] = {3, 5, 2, 7, 4, 10, 1, 9, 8, 6};
  postPTen = permute(seed, pTenBox, 10, 10);
  return postPTen;
}


x86 assembly (clang, -O0):
<pTen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
mov    -0x2(%rbp),%ax
lea    -0x30(%rbp),%rsi
mov    $0xa,%ecx
movzwl %ax,%edi
mov    %ecx,%edx
call   1030 <permute@plt>
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pTen>:
sub    $0x28,%rsp
mov    0xf05(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0xa,%edx
mov    $0xa,%ecx
call   1030 <permute@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.pTen.pTenBox = [10 x i32] [i32 3, i32 5, i32 2, i32 7, i32 4, i32 10, i32 1, i32 9, i32 8, i32 6]
define zeroext i16 @pTen(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
%4 = alloca [10 x i32]
store i16 %0, i16* %2
%5 = bitcast [10 x i32]* %4 to i8*
%6 = load i16, i16* %2
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%8 = call zeroext i16 @permute(i16 zeroext %6, i32* %7, i32 10, i32 10)
store i16 %8, i16* %3
%9 = load i16, i16* %3
ret i16 %9
}

LLVM IR (-O2):
@__const.pTen.pTenBox = [10 x i32] [i32 3, i32 5, i32 2, i32 7, i32 4, i32 10, i32 1, i32 9, i32 8, i32 6]
define zeroext i16 @pTen(i16 zeroext %0) {
%2 = alloca [10 x i32]
%3 = bitcast [10 x i32]* %2 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%5 = call zeroext i16 @permute(i16 zeroext %0, i32* %4, i32 10, i32 10)
ret i16 %5
}
void RTThreadUserSignal(void) {}


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

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

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

LLVM IR (-O2):
define void @RTThreadUserSignal() {
ret void
}
void main(void) {
  int a[10];
  int x[10];
  int y;
  int z;
  int w;
  x[3] = y + z;
  x[y] = y = z + 5;
  x[y + z + w];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    -0x64(%rbp),%eax
add    -0x68(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x68(%rbp),%ecx
add    $0x5,%ecx
mov    %ecx,-0x64(%rbp)
movslq -0x64(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 3
store i32 %8, i32* %9
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 5
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
store i32 %11, i32* %14
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = add nsw i32 %15, %16
%18 = load i32, i32* %5
%19 = add nsw i32 %17, %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %20
%22 = load i32, i32* %21
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RegWriteA_LC898122AF(int, int);
void AfDrvSw(unsigned char UcDrvSw) {
  if (UcDrvSw == 0x01) {
    RegWriteA_LC898122AF(0x0081, 0x20);
    RegWriteA_LC898122AF(0x00A0, 0x80);
  } else {
    RegWriteA_LC898122AF(0x00A0, 0x00);
  }
}


x86 assembly (clang, -O0):
<AfDrvSw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    114e <AfDrvSw+0x3e>
mov    $0x81,%edi
mov    $0x20,%esi
call   1030 <RegWriteA_LC898122AF@plt>
mov    $0xa0,%edi
mov    $0x80,%esi
call   1030 <RegWriteA_LC898122AF@plt>
jmp    115a <AfDrvSw+0x4a>
mov    $0xa0,%edi
xor    %esi,%esi
call   1030 <RegWriteA_LC898122AF@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AfDrvSw>:
xor    %esi,%esi
cmp    $0x1,%dil
jne    1131 <AfDrvSw+0x21>
push   %rax
mov    $0x81,%edi
mov    $0x20,%esi
call   1030 <RegWriteA_LC898122AF@plt>
mov    $0x80,%esi
add    $0x8,%rsp
mov    $0xa0,%edi
jmp    1030 <RegWriteA_LC898122AF@plt>

LLVM IR (-O0):
define void @AfDrvSw(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @RegWriteA_LC898122AF(i32 129, i32 32)
%8 = call i32 @RegWriteA_LC898122AF(i32 160, i32 128)
br label %11
9: ; preds = %1
%10 = call i32 @RegWriteA_LC898122AF(i32 160, i32 0)
br label %11
11: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
define void @AfDrvSw(i8 zeroext %0) {
%2 = icmp eq i8 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @RegWriteA_LC898122AF(i32 129, i32 32)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ 128, %3 ], [ 0, %1 ]
%7 = tail call i32 @RegWriteA_LC898122AF(i32 160, i32 %6)
ret void
}
void decode1(long *xp, long *yp, long *zp) {
  long tempx = *xp;
  long tempy = *yp;
  long tempz = *zp;
  *yp = tempx;
  *zp = tempy;
  *xp = tempz;
}


x86 assembly (clang, -O0):
<decode1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode1>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
mov    (%rdx),%r8
mov    %rax,(%rsi)
mov    %rcx,(%rdx)
mov    %r8,(%rdi)
ret

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

LLVM IR (-O2):
define void @decode1(i64* nocapture %0, i64* nocapture %1, i64* nocapture %2) {
%4 = load i64, i64* %0
%5 = load i64, i64* %1
%6 = load i64, i64* %2
store i64 %4, i64* %1
store i64 %5, i64* %2
store i64 %6, i64* %0
ret void
}
/* Variables and functions */
int check(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int main() {
  char exp[100];
  int valid;
  printf("Enter expression: ");
  gets(exp);
  valid = check(exp);
  if (valid == 1)
    printf("Valid expression\n");
  else
    printf("Invalid expression\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x70(%rbp),%rdi
call   1050 <check@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0x1,-0x74(%rbp)
jne    117e <main+0x4e>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    118a <main+0x5a>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1060 <check@plt>
cmp    $0x1,%eax
lea    0xeb8(%rip),%rax
lea    0xe9e(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter expression: \00"
@.str.1 = [18 x i8] c"Valid expression\0A\00"
@.str.2 = [20 x i8] c"Invalid expression\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @check(i8* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %15
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter expression: \00"
@str = [19 x i8] c"Invalid expression\00"
@str.3 = [17 x i8] c"Valid expression\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @check(i8* %2)
%6 = icmp eq i32 %5, 1
%7 = select i1 %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}
/* Variables and functions */
double pow(double, double);
double db2lin(double db) { return pow(10.0, 0.05 * db); }


x86 assembly (clang, -O0):
<db2lin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xece(%rip),%xmm0
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db2lin>:
movapd %xmm0,%xmm1
mulsd  0xee4(%rip),%xmm1
movsd  0xee4(%rip),%xmm0
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @db2lin(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 5.000000e-02, %3
%5 = call double @pow(double 1.000000e+01, double %4)
ret double %5
}

LLVM IR (-O2):
define double @db2lin(double %0) {
%2 = fmul double %0, 5.000000e-02
%3 = tail call double @pow(double 1.000000e+01, double %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int do_it();
int main(int argc, char **argv) {
  assert(do_it() == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <do_it@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <do_it@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @do_it()
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @do_it()
%4 = icmp eq i32 %3, 1
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
ret i32 0
}
/* Variables and functions */
double sin(double);
double sqrt(int);
double __YGLambertNormal(double lat, double a, double e) {
  return a / sqrt(1 - e * e * sin(lat) * sin(lat));
}


x86 assembly (clang, -O0):
<__YGLambertNormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe60(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__YGLambertNormal>:
sub    $0x28,%rsp
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe98(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movsd  0x20(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @__YGLambertNormal(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %5
%8 = load double, double* %6
%9 = load double, double* %6
%10 = fmul double %8, %9
%11 = load double, double* %4
%12 = call double @sin(double %11)
%13 = fmul double %10, %12
%14 = load double, double* %4
%15 = call double @sin(double %14)
%16 = fneg double %13
%17 = call double @llvm.fmuladd.f64(double %16, double %15, double 1.000000e+00)
%18 = fptosi double %17 to i32
%19 = call double @sqrt(i32 %18)
%20 = fdiv double %7, %19
ret double %20
}

LLVM IR (-O2):
define double @__YGLambertNormal(double %0, double %1, double %2) {
%4 = tail call double @sin(double %0)
%5 = tail call double @sin(double %0)
%6 = fneg double %2
%7 = fmul double %6, %2
%8 = fmul double %7, %4
%9 = tail call double @llvm.fmuladd.f64(double %8, double %5, double 1.000000e+00)
%10 = fptosi double %9 to i32
%11 = tail call double @sqrt(i32 %10)
%12 = fdiv double %1, %11
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ dso1();
int /*<<< orphan*/ dso2();
int main() {
  dso1();
  dso2();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @dso1()
%2 = tail call i32 (...) @dso2()
ret i32 0
}
/* Variables and functions */
scalar_t__ snowflakes(int *, int);
scalar_t__ snowflakes_brute(int *, int);
int test_mountain() {
  int array[] = {0, 1, 2, 3, 4, 5, 4, 3, 2, 1};
  return 0 == snowflakes_brute(array, 10) && 0 == snowflakes(array, 10);
}


x86 assembly (clang, -O0):
<test_mountain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <snowflakes_brute@plt>
mov    %rax,%rdx
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %rdx,%rcx
mov    %al,-0x31(%rbp)
jne    118a <test_mountain+0x5a>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1050 <snowflakes@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mountain>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1030 <snowflakes_brute@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1163 <test_mountain+0x43>
add    $0x28,%rsp
ret
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <snowflakes@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test_mountain.array = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 4, i32 3, i32 2, i32 1]
define i32 @test_mountain() {
%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 i64 @snowflakes_brute(i32* %3, i32 10)
%5 = icmp eq i64 0, %4
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%8 = call i64 @snowflakes(i32* %7, i32 10)
%9 = icmp eq i64 0, %8
br label %10
10: ; preds = %6, %0
%11 = phi i1 [ false, %0 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@__const.test_mountain.array = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 4, i32 3, i32 2, i32 1]
define i32 @test_mountain() {
%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 i64 @snowflakes_brute(i32* %3, i32 10)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i64 @snowflakes(i32* %3, i32 10)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %0
%11 = phi i32 [ 0, %0 ], [ %9, %6 ]
ret i32 %11
}
void jack_init_time() {}


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

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

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

LLVM IR (-O2):
define void @jack_init_time() {
ret void
}
void input_p_to_x() {}


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

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

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

LLVM IR (-O2):
define void @input_p_to_x() {
ret void
}
/* Type definitions */
struct vec4 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ vec4_scale(float *, float *, float);
__attribute__((always_)) struct vec4 *
psvec4_scale(struct vec4 *result, struct vec4 *a, float scalar) {
  vec4_scale((float *)result, (float *)a, scalar);
  return result;
}


x86 assembly (clang, -O0):
<psvec4_scale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movss  -0x14(%rbp),%xmm0
call   1030 <vec4_scale@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psvec4_scale>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec4_scale@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec4 = type { i32 }
define %struct.vec4* @psvec4_scale(%struct.vec4* %0, %struct.vec4* %1, float %2) {
%4 = alloca %struct.vec4*
%5 = alloca %struct.vec4*
%6 = alloca float
store %struct.vec4* %0, %struct.vec4** %4
store %struct.vec4* %1, %struct.vec4** %5
store float %2, float* %6
%7 = load %struct.vec4*, %struct.vec4** %4
%8 = bitcast %struct.vec4* %7 to float*
%9 = load %struct.vec4*, %struct.vec4** %5
%10 = bitcast %struct.vec4* %9 to float*
%11 = load float, float* %6
%12 = call i32 @vec4_scale(float* %8, float* %10, float %11)
%13 = load %struct.vec4*, %struct.vec4** %4
ret %struct.vec4* %13
}

LLVM IR (-O2):
%struct.vec4 = type { i32 }
define %struct.vec4* @psvec4_scale(%struct.vec4* returned %0, %struct.vec4* %1, float %2) {
%4 = bitcast %struct.vec4* %0 to float*
%5 = bitcast %struct.vec4* %1 to float*
%6 = tail call i32 @vec4_scale(float* %4, float* %5, float %2)
ret %struct.vec4* %0
}
void ARGBToRAWRow_C() {}


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

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

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

LLVM IR (-O2):
define void @ARGBToRAWRow_C() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *pname) {
  printf("usage:\n  %s <ncores> <nterm> <philosophers> <bites>\n\n      "
         "where:\n    <ncores> is the number of cpu cores to use,\n    <nterm> "
         "is the number of terminals to use,\n",
         pname);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"usage:\0A %s <ncores> <nterm> <philosophers> <bites>\0A\0A where:\0A <ncores> is the number of cpu cores to use,\0A <nterm> is the number of terminals to use,\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 ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [162 x i8] c"usage:\0A %s <ncores> <nterm> <philosophers> <bites>\0A\0A where:\0A <ncores> is the number of cpu cores to use,\0A <nterm> is the number of terminals to use,\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void sg_init_one(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<sg_init_one>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_init_one>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.sg_init_one = [12 x i8] c"sg_init_one\00"
define void @sg_init_one() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.sg_init_one, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.sg_init_one = [12 x i8] c"sg_init_one\00"
define void @sg_init_one() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.sg_init_one, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ vfork();
int /*<<< orphan*/ wait4(int /*<<< orphan*/, int *, int /*<<< orphan*/,
                         int /*<<< orphan*/ *);
int main() {
  pid_t child;
  int status;
  child = vfork();
  if (!child) {
    int i = 0xfffff;
    while (i > 0)
      i--;
    _exit(0);
  }
  wait4(child, &status, WNOHANG, NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
call   1050 <vfork@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1177 <main+0x47>
movl   $0xfffff,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1170 <main+0x40>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1158 <main+0x28>
xor    %edi,%edi
call   1030 <_exit@plt>
mov    -0x8(%rbp),%edi
mov    0x2e67(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
call   1040 <wait4@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
call   1050 <vfork@plt>
test   %eax,%eax
je     115f <main+0x2f>
mov    %eax,%edi
mov    0x2ea1(%rip),%rax
mov    (%rax),%edx
xor    %ebx,%ebx
mov    %ebx,%ecx
lea    0xc(%rsp),%rsi
call   1040 <wait4@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@WNOHANG = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @vfork()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %0
store i32 1048575, i32* %4
br label %9
9: ; preds = %12, %8
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %4
%14 = add nsw i32 %13, -1
store i32 %14, i32* %4
br label %9
15: ; preds = %9
%16 = call i32 @_exit(i32 0)
unreachable
17: ; preds = %0
%18 = load i32, i32* %2
%19 = load i32, i32* @WNOHANG
%20 = call i32 @wait4(i32 %18, i32* %3, i32 %19, i32* null)
ret i32 0
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @vfork()
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @_exit(i32 0)
unreachable
7: ; preds = %0
%8 = load i32, i32* @WNOHANG
%9 = call i32 @wait4(i32 %3, i32* %1, i32 %8, i32* null)
ret i32 0
}
/* Variables and functions */
char *_read_string_len(char **, int *);
char *_read_string(char **pptr) {
  int len = 0;
  return _read_string_len(pptr, &len);
}


x86 assembly (clang, -O0):
<_read_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <_read_string_len@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_read_string>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <_read_string_len@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @_read_string(i8** %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i8* @_read_string_len(i8** %0, i32* %2)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void *malloc(int);
int /*<<< orphan*/ my_str(char *);
void *xmalloc(int n) {
  void *p;
  if ((p = malloc(n)) == ((void *)0)) {
    my_str("Virtual memory exhausted.\n");
    exit(1);
  }
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1167 <xmalloc+0x37>
lea    0xea8(%rip),%rdi
call   1040 <my_str@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
call   1030 <malloc@plt>
test   %rax,%rax
je     113d <xmalloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <my_str@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Virtual memory exhausted.\0A\00"
define i8* @xmalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 @my_str(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [27 x i8] c"Virtual memory exhausted.\0A\00"
define noalias i8* @xmalloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @my_str(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i8* %2
}
void *val_dup(void *privdata, const void *val) {
  int len = strlen(val);
  char *copy = malloc(len + 1);
  memcpy(copy, val, len);
  copy[len] = '\0';
  return copy;
}


x86 assembly (clang, -O0):
<val_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<val_dup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
add    $0x1,%eax
movslq %eax,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
movslq %r15d,%r15
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @val_dup(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = call i8* @malloc(i64 %12)
store i8* %13, i8** %6
%14 = load i8*, i8** %6
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = load i8*, i8** %6
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 0, i8* %21
%22 = load i8*, i8** %6
ret i8* %22
}

LLVM IR (-O2):
define noalias i8* @val_dup(i8* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = shl i64 %3, 32
%5 = add i64 %4, 4294967296
%6 = ashr exact i64 %5, 32
%7 = tail call i8* @malloc(i64 %6)
%8 = ashr exact i64 %4, 32
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %7, i8* align 1 %1, i64 %8, i1 false)
%9 = getelementptr inbounds i8, i8* %7, i64 %8
store i8 0, i8* %9
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ Func(int /*<<< orphan*/);
int /*<<< orphan*/ Func64(int /*<<< orphan*/);
int test() {
  Func(0);
  Func64(0);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <Func@plt>
xor    %edi,%edi
call   1040 <Func64@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
xor    %edi,%edi
call   1030 <Func@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <Func64@plt>

LLVM IR (-O0):
define i32 @test() {
%1 = alloca i32
%2 = call i32 @Func(i32 0)
%3 = call i32 @Func64(i32 0)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @test() {
%1 = tail call i32 @Func(i32 0)
%2 = tail call i32 @Func64(i32 0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void massert_start() {
  printf("\n\n"
         "|------------------------------------------------|\n"
         "|========== Welcome To MTest Framework ==========|\n"
         "|------------------------------------------------|\n\n");
}


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

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

LLVM IR (-O0):
@.str = [157 x i8] c"\0A\0A|------------------------------------------------|\0A|========== Welcome To MTest Framework ==========|\0A|------------------------------------------------|\0A\0A\00"
define void @massert_start() {
%1 = call i32 @printf(i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [156 x i8] c"\0A\0A|------------------------------------------------|\0A|========== Welcome To MTest Framework ==========|\0A|------------------------------------------------|\0A\00"
define void @massert_start() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([156 x i8], [156 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dlclose(void *);
int /*<<< orphan*/ unregister_from_module_same_observed(void *);
int /*<<< orphan*/ unregister_loaders_from_module(void *);
void cleanup_module(void *module) {
  unregister_loaders_from_module(module);
  unregister_from_module_same_observed(module);
  dlclose(module);
}


x86 assembly (clang, -O0):
<cleanup_module>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <unregister_loaders_from_module@plt>
mov    -0x8(%rbp),%rdi
call   1040 <unregister_from_module_same_observed@plt>
mov    -0x8(%rbp),%rdi
call   1050 <dlclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup_module>:
push   %rbx
mov    %rdi,%rbx
call   1030 <unregister_loaders_from_module@plt>
mov    %rbx,%rdi
call   1040 <unregister_from_module_same_observed@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <dlclose@plt>

LLVM IR (-O0):
define void @cleanup_module(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @unregister_loaders_from_module(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @unregister_from_module_same_observed(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @dlclose(i8* %7)
ret void
}

LLVM IR (-O2):
define void @cleanup_module(i8* %0) {
%2 = tail call i32 @unregister_loaders_from_module(i8* %0)
%3 = tail call i32 @unregister_from_module_same_observed(i8* %0)
%4 = tail call i32 @dlclose(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char t = 50;
  char *z1 = &t;
  void *z2 = z1;
  unsigned int *pi = z2;
  printf("pi = %u\n", *pi);
  if ((char)*pi == 50) {
    printf("UNSAFE\n");
    goto ERROR;
  }
  printf("SAFE\n");
  return (0);
ERROR:
  return (-1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x32,-0x5(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
movsbl %al,%eax
cmp    $0x32,%eax
jne    1174 <main+0x64>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118e <main+0x7e>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1195 <main+0x85>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"pi = %u\0A\00"
@.str.1 = [8 x i8] c"UNSAFE\0A\00"
@.str.2 = [6 x i8] c"SAFE\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i32 0, i32* %1
store i8 50, i8* %2
store i8* %2, i8** %3
%6 = load i8*, i8** %3
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = trunc i32 %13 to i8
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 50
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %21
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %22
21: ; preds = %17
store i32 -1, i32* %1
br label %22
22: ; preds = %21, %19
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [9 x i8] c"pi = %u\0A\00"
@str = [7 x i8] c"UNSAFE\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 50)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 -1
}
unsigned hash_num(char *s, int size) {
  unsigned hashval = 0;
  while (*s) {
    hashval = *s++ + 31 * hashval;
  }
  return hashval % size;
}


x86 assembly (clang, -O0):
<hash_num>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113f <hash_num+0x3f>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
imul   $0x1f,-0x10(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <hash_num+0x12>
mov    -0x10(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_num>:
mov    (%rdi),%cl
test   %cl,%cl
je     1129 <hash_num+0x29>
add    $0x1,%rdi
xor    %edx,%edx
mov    %edx,%eax
xchg   %ax,%ax
movsbl %cl,%ecx
shl    $0x5,%eax
sub    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %eax,%edx
test   %cl,%cl
jne    1110 <hash_num+0x10>
jmp    112b <hash_num+0x2b>
xor    %eax,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @hash_num(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %12, %5 ], [ 0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = sext i8 %6 to i32
%11 = mul i32 %7, 31
%12 = add i32 %11, %10
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %12, %5 ]
%17 = urem i32 %16, %1
ret i32 %17
}
/* Type definitions */
typedef scalar_t__ int64_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ maddu(scalar_t__, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ maddu1(scalar_t__, int /*<<< orphan*/, int /*<<< orphan*/);
int64_t maddu_variants(int64_t a, int32_t rs, int32_t rt) {
  int64_t rd = maddu(a, rs, rt);
  int64_t rd1 = maddu1(a, rs, rt);
  assert(rd == rd1);
  return rd;
}


x86 assembly (clang, -O0):
<maddu_variants>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <maddu@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <maddu1@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maddu_variants>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1050 <maddu@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <maddu1@plt>
xor    %edi,%edi
cmp    %rax,%r15
sete   %dil
call   1040 <assert@plt>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i64 @maddu_variants(i64 %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i64, i64* %4
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i64 @maddu(i64 %9, i32 %10, i32 %11)
store i64 %12, i64* %7
%13 = load i64, i64* %4
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = call i64 @maddu1(i64 %13, i32 %14, i32 %15)
store i64 %16, i64* %8
%17 = load i64, i64* %7
%18 = load i64, i64* %8
%19 = icmp eq i64 %17, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i64, i64* %7
ret i64 %22
}

LLVM IR (-O2):
define i64 @maddu_variants(i64 %0, i32 %1, i32 %2) {
%4 = tail call i64 @maddu(i64 %0, i32 %1, i32 %2)
%5 = tail call i64 @maddu1(i64 %0, i32 %1, i32 %2)
%6 = icmp eq i64 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ SCR_ShutdownFonts();
void SCR_ShutDownConsoleMedia(void) { SCR_ShutdownFonts(); }


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

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

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

LLVM IR (-O2):
define void @SCR_ShutDownConsoleMedia() {
%1 = tail call i32 (...) @SCR_ShutdownFonts()
ret void
}
/* Variables and functions */
int inb(int);
void uart_wait_until_sent(void) {
  while (!(inb(1016 + 0x05) & 0x40))
    ;
}


x86 assembly (clang, -O0):
<uart_wait_until_sent>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <uart_wait_until_sent+0x9>
mov    $0x3fd,%edi
call   1030 <inb@plt>
and    $0x40,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113b <uart_wait_until_sent+0x2b>
jmp    1140 <uart_wait_until_sent+0x30>
jmp    1119 <uart_wait_until_sent+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_wait_until_sent>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x3fd,%edi
call   1030 <inb@plt>
test   $0x40,%al
je     1120 <uart_wait_until_sent+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @uart_wait_until_sent() {
br label %1
1: ; preds = %6, %0
%2 = call i32 @inb(i32 1021)
%3 = and i32 %2, 64
%4 = icmp ne i32 %3, 0
%5 = xor i1 %4, true
br i1 %5, label %6, label %7
6: ; preds = %1
br label %1
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @uart_wait_until_sent() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @inb(i32 1021)
%3 = and i32 %2, 64
%4 = icmp eq i32 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
ret void
}
float atanf(float x) { return 0.0; }


x86 assembly (clang, -O0):
<atanf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<atanf>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @atanf(float %0) {
%2 = alloca float
store float %0, float* %2
ret float 0.000000e+00
}

LLVM IR (-O2):
define float @atanf(float %0) {
ret float 0.000000e+00
}
int test_imm_99int64_lowword_reg(long long val) {
  return ((val) & (0x99 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_99int64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0x99,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_99int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 153
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ XSelectionClearEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XSelectionClearEvent(void *_p) {
  if (_p == NULL)
    abort();
  free((XSelectionClearEvent *)_p);
}


x86 assembly (clang, -O0):
<free_XSelectionClearEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XSelectionClearEvent+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XSelectionClearEvent>:
test   %rdi,%rdi
je     112a <free_XSelectionClearEvent+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define void @free_XSelectionClearEvent(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = call i32 @free(i32* %9)
ret void
}

LLVM IR (-O2):
define void @free_XSelectionClearEvent(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
/* Variables and functions */
char *strchr(char *, char);
char *bracket_end(char *p) {
  return (*p == 0) ? NULL : strchr((*p == '^') ? p + 2 : p + 1, ']');
}


x86 assembly (clang, -O0):
<bracket_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1137 <bracket_end+0x27>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1176 <bracket_end+0x66>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5e,%eax
jne    1158 <bracket_end+0x48>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    1164 <bracket_end+0x54>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x5d,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bracket_end>:
mov    (%rdi),%al
test   %al,%al
je     112e <bracket_end+0x1e>
xor    %ecx,%ecx
cmp    $0x5e,%al
sete   %cl
add    %rcx,%rdi
add    $0x1,%rdi
mov    $0x5d,%esi
jmp    1030 <strchr@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @bracket_end(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
br label %22
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 94
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 2
br label %19
16: ; preds = %8
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i64 1
br label %19
19: ; preds = %16, %13
%20 = phi i8* [ %15, %13 ], [ %18, %16 ]
%21 = call i8* @strchr(i8* %20, i8 signext 93)
br label %22
22: ; preds = %19, %7
%23 = phi i8* [ null, %7 ], [ %21, %19 ]
ret i8* %23
}

LLVM IR (-O2):
define i8* @bracket_end(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = icmp eq i8 %2, 94
%6 = select i1 %5, i64 2, i64 1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = tail call i8* @strchr(i8* %7, i8 signext 93)
br label %9
9: ; preds = %1, %4
%10 = phi i8* [ %8, %4 ], [ null, %1 ]
ret i8* %10
}
float itof(int i) { return i; }


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

x86 assembly (clang, -O2):
<itof>:
cvtsi2ss %edi,%xmm0
ret

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

LLVM IR (-O2):
define float @itof(i32 %0) {
%2 = sitofp i32 %0 to float
ret float %2
}