xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dsnansumors(int, float *, int);
int main() {
  float x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 0.0 / 0.0, 0.0 / 0.0};
  int64_t N = 5;
  int64_t stride = 2;
  double v = stdlib_strided_dsnansumors(N, x, stride);
  printf("sum: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0x5,-0x34(%rbp)
movl   $0x2,-0x38(%rbp)
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%edx
call   1050 <stdlib_strided_dsnansumors@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
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,%rsi
mov    $0x5,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_dsnansumors@plt>
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [10 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00, float 0x7FF8000000000000, float 0x7FF8000000000000]
@.str = [10 x i8] c"sum: %lf\0A\00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [10 x float]* %1 to i8*
store i32 5, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dsnansumors(i32 %6, float* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [10 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00, float 0x7FF8000000000000, float 0x7FF8000000000000]
@.str = [10 x i8] c"sum: %lf\0A\00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = bitcast [10 x float]* %1 to i8*
%3 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dsnansumors(i32 5, float* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
int IntComparator(const void *el1, const void *el2) {
  int *int1ptr, *int2ptr;
  int1ptr = (int *)el1;
  int2ptr = (int *)el2;
  if (*int1ptr > *int2ptr)
    return 1;
  if (*int1ptr < *int2ptr)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<IntComparator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jle    113a <IntComparator+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    115f <IntComparator+0x5f>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    1158 <IntComparator+0x58>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <IntComparator+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IntComparator>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @IntComparator(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
%8 = icmp slt i32 %5, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef scalar_t__ cl_kernel;
typedef int /*<<< orphan*/ cl_int;

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, unsigned int *);
cl_int clRetainKernel(cl_kernel kernel) {
  unsigned int sys_args[1];
  sys_args[0] = (unsigned int)kernel;
  return (cl_int)syscall(325, 1038, sys_args);
}


x86 assembly (clang, -O0):
<clRetainKernel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdx
mov    $0x145,%edi
mov    $0x40e,%esi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clRetainKernel>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    $0x145,%edi
mov    $0x40e,%esi
call   1030 <syscall@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @clRetainKernel(i64 %0) {
%2 = alloca i64
%3 = alloca [1 x i32]
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = trunc i64 %4 to i32
%6 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
store i32 %5, i32* %6
%7 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
%8 = call i32 @syscall(i32 325, i32 1038, i32* %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @clRetainKernel(i64 %0) {
%2 = alloca [1 x i32]
%3 = bitcast [1 x i32]* %2 to i8*
%4 = trunc i64 %0 to i32
%5 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
store i32 %4, i32* %5
%6 = call i32 @syscall(i32 325, i32 1038, i32* %5)
ret i32 %6
}
void mpx(m, buf, len) char *m, *buf;
int len;
{
  printf("%s", m);
  print_hex_string(buf, len);
}


x86 assembly (clang, -O0):
<mpx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x0,%al
call   1040 <print_hex_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpx>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <print_hex_string@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @mpx(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @print_hex_string to i32 (i8*, i32, ...)*)(i8* %9, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @mpx(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @print_hex_string to i32 (i8*, i32, ...)*)(i8* %1, i32 %2)
ret void
}
/* Variables and functions */
char *U_WMRCORENONE_set(char *);
char *U_WMR82_set(void) { return U_WMRCORENONE_set("U_WMR82"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR82\00"
define i8* @U_WMR82_set() {
%1 = call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR82\00"
define i8* @U_WMR82_set() {
%1 = tail call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
size_t uint8PackSize(const uint8_t *data) { return sizeof(*data); }


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

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

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

LLVM IR (-O2):
define i64 @uint8PackSize(i32* nocapture readnone %0) {
ret i64 4
}
void av_base64_encode() {}


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

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

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

LLVM IR (-O2):
define void @av_base64_encode() {
ret void
}
void test_v4sf(float *__restrict__ p, float *__restrict q) {
  p[0] = p[0] - q[0];
  p[1] = p[1] + q[1];
  p[2] = p[2] - q[2];
  p[3] = p[3] + q[3];
}


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

x86 assembly (clang, -O2):
<test_v4sf>:
movups (%rdi),%xmm0
movups (%rsi),%xmm1
movaps %xmm0,%xmm2
subps  %xmm1,%xmm2
addps  %xmm1,%xmm0
shufps $0xd8,%xmm0,%xmm2
shufps $0xd8,%xmm2,%xmm2
movups %xmm2,(%rdi)
ret

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

LLVM IR (-O2):
define void @test_v4sf(float* noalias nocapture %0, float* noalias nocapture %1) {
%3 = bitcast float* %0 to <4 x float>*
%4 = load <4 x float>, <4 x float>* %3
%5 = bitcast float* %1 to <4 x float>*
%6 = load <4 x float>, <4 x float>* %5
%7 = fsub <4 x float> %4, %6
%8 = fadd <4 x float> %4, %6
%9 = shufflevector <4 x float> %7, <4 x float> %8, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
%10 = bitcast float* %0 to <4 x float>*
store <4 x float> %9, <4 x float>* %10
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  sleep(10000000);
  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    $0x989680,%edi
call   1030 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x989680,%edi
call   1030 <sleep@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 @sleep(i32 10000000)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sleep(i32 10000000)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void dewhitt17() { printf("dewhitt17 likes steak and potatoes.\n"); }


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"dewhitt17 likes steak and potatoes.\0A\00"
define void @dewhitt17() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"dewhitt17 likes steak and potatoes.\00"
define void @dewhitt17() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret void
}
void NV12ToARGBRow_C() {}


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

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

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

LLVM IR (-O2):
define void @NV12ToARGBRow_C() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ err(int /*<<< orphan*/, char *);
void usage() { err(EX_USAGE, "listen [-p port] [-l limit]\n"); }


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <err@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <err@plt>

LLVM IR (-O0):
@EX_USAGE = global i32 0
@.str = [29 x i8] c"listen [-p port] [-l limit]\0A\00"
define void @usage() {
%1 = load i32, i32* @EX_USAGE
%2 = call i32 @err(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@EX_USAGE = global i32 0
@.str = [29 x i8] c"listen [-p port] [-l limit]\0A\00"
define void @usage() {
%1 = load i32, i32* @EX_USAGE
%2 = tail call i32 @err(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rrpge_m_free(void *);
void rrpge_delete(void *obj) { rrpge_m_free(obj); }


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

x86 assembly (clang, -O2):
<rrpge_delete>:
jmp    1030 <rrpge_m_free@plt>

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

LLVM IR (-O2):
define void @rrpge_delete(i8* %0) {
%2 = tail call i32 @rrpge_m_free(i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ sqrt(float);
float sqrtf(float value) { return (float)sqrt(value); }


x86 assembly (clang, -O0):
<sqrtf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sqrt@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrtf>:
push   %rax
call   1030 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @sqrtf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @sqrt(float %3)
%5 = sitofp i64 %4 to float
ret float %5
}

LLVM IR (-O2):
define float @sqrtf(float %0) {
%2 = tail call i64 @sqrt(float %0)
%3 = sitofp i64 %2 to float
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int qualityPoints(int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  printf("Enter the student's average: ");
  scanf("%d", &n);
  printf("The quality points of the students = %d\n", qualityPoints(n));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
call   1050 <qualityPoints@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Enter the student's average: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [41 x i8] c"The quality points of the students = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 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 @qualityPoints(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Enter the student's average: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [41 x i8] c"The quality points of the students = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 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 @qualityPoints(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
int C$_Chdir(const char *dirname) {
  int val = chdir(dirname);
  if (val == -1) {
    perror("ca$h: ERROR chdir");
  }
  return val;
}


x86 assembly (clang, -O0):
<C$_Chdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <chdir@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1152 <C$_Chdir+0x32>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1040 <perror@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C$_Chdir>:
push   %rbx
xor    %eax,%eax
call   1030 <chdir@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    113d <C$_Chdir+0x1d>
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1040 <perror@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"ca$h: ERROR chdir\00"
define i32 @"C$_Chdir"(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @chdir to i32 (i8*, ...)*)(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [18 x i8] c"ca$h: ERROR chdir\00"
define i32 @"C$_Chdir"(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @chdir to i32 (i8*, ...)*)(i8* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello2() { printf("test/sysinclude hello2()!\n"); }


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

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

LLVM IR (-O0):
@.str = [27 x i8] c"test/sysinclude hello2()!\0A\00"
define void @hello2() {
%1 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [26 x i8] c"test/sysinclude hello2()!\00"
define void @hello2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
ret void
}
int solve(int n, int num[]) { return 0; }


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

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

LLVM IR (-O0):
define i32 @solve(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 @solve(i32 %0, i32* nocapture readnone %1) {
ret i32 0
}
int DRV_CODEC_OPEN(const char *devname, int flags, int mode) { return 0; }


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

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

LLVM IR (-O0):
define i32 @DRV_CODEC_OPEN(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @DRV_CODEC_OPEN(i8* nocapture readnone %0, i32 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ delay_ms(int);
void MRF24J40_wake(void) {
  (*((volatile unsigned long *)0xE0028004)) = 1 << 31;
  delay_ms(2);
  (*((volatile unsigned long *)0xE002800C)) = 1 << 31;
}


x86 assembly (clang, -O0):
<MRF24J40_wake>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe0028004,%eax
movq   $0xffffffff80000000,(%rax)
mov    $0x2,%edi
call   1030 <delay_ms@plt>
mov    $0xe002800c,%eax
movq   $0xffffffff80000000,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<MRF24J40_wake>:
push   %rbx
mov    $0xe0028004,%ebx
movq   $0xffffffff80000000,(%rbx)
mov    $0x2,%edi
call   1030 <delay_ms@plt>
movq   $0xffffffff80000000,0x8(%rbx)
80
pop    %rbx
ret

LLVM IR (-O0):
define void @MRF24J40_wake() {
store volatile i64 -2147483648, i64* inttoptr (i64 3758260228 to i64*)
%1 = call i32 @delay_ms(i32 2)
store volatile i64 -2147483648, i64* inttoptr (i64 3758260236 to i64*)
ret void
}

LLVM IR (-O2):
define void @MRF24J40_wake() {
store volatile i64 -2147483648, i64* inttoptr (i64 3758260228 to i64*)
%1 = tail call i32 @delay_ms(i32 2)
store volatile i64 -2147483648, i64* inttoptr (i64 3758260236 to i64*)
ret void
}
/* Variables and functions */
unsigned long long cpu_clock();
unsigned long long click() { return cpu_clock(); }


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

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

LLVM IR (-O0):
define i64 @click() {
%1 = call i64 (...) @cpu_clock()
ret i64 %1
}

LLVM IR (-O2):
define i64 @click() {
%1 = tail call i64 (...) @cpu_clock()
ret i64 %1
}
int find_device_by_sysfs(void) {
  int rc = -1;
  return rc;
}


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

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

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

LLVM IR (-O2):
define i32 @find_device_by_sysfs() {
ret i32 -1
}
float JakaSrednia(float x, int y) {
  float z;
  z = x / y;
  return z;
}


x86 assembly (clang, -O0):
<JakaSrednia>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @JakaSrednia(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca float
store float %0, float* %3
store i32 %1, i32* %4
%6 = load float, float* %3
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to float
%9 = fdiv float %6, %8
store float %9, float* %5
%10 = load float, float* %5
ret float %10
}

LLVM IR (-O2):
define float @JakaSrednia(float %0, i32 %1) {
%3 = sitofp i32 %1 to float
%4 = fdiv float %0, %3
ret float %4
}
float z_lerp(float const a, float const b, float const t) {
  return (1.0f - t) * a + t * b;
}


x86 assembly (clang, -O0):
<z_lerp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  0xee5(%rip),%xmm0
subss  -0xc(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<z_lerp>:
movss  0xef8(%rip),%xmm3
subss  %xmm2,%xmm3
mulss  %xmm2,%xmm1
mulss  %xmm3,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @z_lerp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %6
%8 = fsub float 1.000000e+00, %7
%9 = load float, float* %4
%10 = load float, float* %6
%11 = load float, float* %5
%12 = fmul float %10, %11
%13 = call float @llvm.fmuladd.f32(float %8, float %9, float %12)
ret float %13
}

LLVM IR (-O2):
define float @z_lerp(float %0, float %1, float %2) {
%4 = fsub float 1.000000e+00, %2
%5 = fmul float %1, %2
%6 = tail call float @llvm.fmuladd.f32(float %4, float %0, float %5)
ret float %6
}
int test_imm_6Eint16_reg(short val) {
  return ((val) & (0x6E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_6Eint16_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, 110
%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_6Eint16_reg(i16 signext %0) {
%2 = and i16 %0, 110
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void rop3_90_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  stk1 = *D ^ T;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_90_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xa(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_90_0_1>:
mov    (%rdi),%al
mov    %eax,%ecx
xor    %dl,%cl
and    %sil,%cl
and    %dl,%sil
not    %sil
and    %al,%sil
or     %cl,%sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_90_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = load i8, i8* %6
%12 = zext i8 %11 to i32
%13 = xor i32 %10, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %7
%15 = load i8, i8* %7
%16 = zext i8 %15 to i32
%17 = load i8, i8* %5
%18 = zext i8 %17 to i32
%19 = and i32 %16, %18
%20 = load i8, i8* %7
%21 = zext i8 %20 to i32
%22 = load i8, i8* %6
%23 = zext i8 %22 to i32
%24 = xor i32 %23, -1
%25 = and i32 %21, %24
%26 = or i32 %19, %25
%27 = load i8, i8* %6
%28 = zext i8 %27 to i32
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = xor i32 %30, -1
%32 = and i32 %28, %31
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = and i32 %32, %35
%37 = or i32 %26, %36
%38 = trunc i32 %37 to i8
%39 = load i8*, i8** %4
store i8 %38, i8* %39
ret void
}

LLVM IR (-O2):
define void @rop3_90_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %4, %2
%6 = and i8 %5, %1
%7 = and i8 %1, %2
%8 = xor i8 %7, -1
%9 = and i8 %4, %8
%10 = or i8 %9, %6
store i8 %10, i8* %0
ret void
}
unsigned char cast_short_uchar_fast(short int x) { return (unsigned char)x; }


x86 assembly (clang, -O0):
<cast_short_uchar_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i8 @cast_short_uchar_fast(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = trunc i16 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define zeroext i8 @cast_short_uchar_fast(i16 signext %0) {
%2 = trunc i16 %0 to i8
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ HwSparkyHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void HwSparkyUpdated() { UAVObjUpdated(HwSparkyHandle()); }


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

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

LLVM IR (-O0):
define void @HwSparkyUpdated() {
%1 = call i32 (...) @HwSparkyHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @HwSparkyUpdated() {
%1 = tail call i32 (...) @HwSparkyHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
/* Variables and functions */
char *U_EMR_CORE5(int);
char *U_EMRFLATTENPATH_set(void) { return (U_EMR_CORE5(65)); }


x86 assembly (clang, -O0):
<U_EMRFLATTENPATH_set>:
push   %rbp
mov    %rsp,%rbp
mov    $0x41,%edi
call   1030 <U_EMR_CORE5@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_EMRFLATTENPATH_set>:
mov    $0x41,%edi
jmp    1030 <U_EMR_CORE5@plt>

LLVM IR (-O0):
define i8* @U_EMRFLATTENPATH_set() {
%1 = call i8* @U_EMR_CORE5(i32 65)
ret i8* %1
}

LLVM IR (-O2):
define i8* @U_EMRFLATTENPATH_set() {
%1 = tail call i8* @U_EMR_CORE5(i32 65)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  void uppercase(char source[]);
  char text[] = "hello world!";
  uppercase(text);
  printf("%s", text);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xec3(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x11(%rbp),%rdi
call   1040 <uppercase@plt>
lea    -0x11(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x21646c726f7720,%rax
mov    %rax,0x5(%rsp)
movabs $0x6f77206f6c6c6568,%rax
20 77 6f
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <uppercase@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.main.text = [13 x i8] c"hello world!\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ CodeGenerate(int, char **);
int /*<<< orphan*/ InitializeCode(int, char **);
int /*<<< orphan*/ InitializeTextModule();
int /*<<< orphan*/ InitializeTreeModule();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
main(int argc, char *argv[]) {
  InitializeTextModule();
  InitializeTreeModule();
  InitializeCode(argc, argv);
  CodeGenerate(argc, argv);
  exit(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   1060 <InitializeTextModule@plt>
mov    $0x0,%al
call   1050 <InitializeTreeModule@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <InitializeCode@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <CodeGenerate@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1060 <InitializeTextModule@plt>
xor    %eax,%eax
call   1050 <InitializeTreeModule@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <InitializeCode@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <CodeGenerate@plt>
xor    %edi,%edi
call   1070 <exit@plt>

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 (...) @InitializeTextModule()
%7 = call i32 (...) @InitializeTreeModule()
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @InitializeCode(i32 %8, i8** %9)
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @CodeGenerate(i32 %11, i8** %12)
%14 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @InitializeTextModule()
%4 = tail call i32 (...) @InitializeTreeModule()
%5 = tail call i32 @InitializeCode(i32 %0, i8** %1)
%6 = tail call i32 @CodeGenerate(i32 %0, i8** %1)
%7 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int function();
int main() { return function(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @function()
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
WINDOW *create_newwin(int height, int width, int starty, int startx) {
  WINDOW *local_win = newwin(height, width, starty, startx);
  (void)box(local_win, 0, 0);
  (void)wrefresh(local_win);
  return local_win;
}


x86 assembly (clang, -O0):
<create_newwin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <newwin@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <box@plt>
mov    -0x18(%rbp),%rdi
call   1030 <wrefresh@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_newwin>:
push   %rbx
call   1040 <newwin@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <box@plt>
mov    %rbx,%rdi
call   1030 <wrefresh@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i32* @create_newwin(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32* @newwin(i32 %10, i32 %11, i32 %12, i32 %13)
store i32* %14, i32** %9
%15 = load i32*, i32** %9
%16 = call i32 @box(i32* %15, i32 0, i32 0)
%17 = load i32*, i32** %9
%18 = call i32 @wrefresh(i32* %17)
%19 = load i32*, i32** %9
ret i32* %19
}

LLVM IR (-O2):
define i32* @create_newwin(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32* @newwin(i32 %0, i32 %1, i32 %2, i32 %3)
%6 = tail call i32 @box(i32* %5, i32 0, i32 0)
%7 = tail call i32 @wrefresh(i32* %5)
ret i32* %5
}
const char *pathcon_nm6_name_in(int i) {
  switch (i) {
  case 0:
    return "i0";
  case 1:
    return "i1";
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<pathcon_nm6_name_in>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     112b <pathcon_nm6_name_in+0x2b>
jmp    111a <pathcon_nm6_name_in+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     113b <pathcon_nm6_name_in+0x3b>
jmp    114b <pathcon_nm6_name_in+0x4b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <pathcon_nm6_name_in+0x53>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <pathcon_nm6_name_in+0x53>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathcon_nm6_name_in>:
xor    %ecx,%ecx
cmp    $0x1,%edi
lea    0xef7(%rip),%rax
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee7(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"i0\00"
@.str.1 = [3 x i8] c"i1\00"
define i8* @pathcon_nm6_name_in(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* null, i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"i0\00"
@.str.1 = [3 x i8] c"i1\00"
define i8* @pathcon_nm6_name_in(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* null
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
int tamMB(unsigned int nbloques) {
  int tam_mb = nbloques;
  if ((tam_mb % (1024 * 8)) > 0) {
    tam_mb = tam_mb / (1024 * 8);
    tam_mb++;
  } else {
    tam_mb = tam_mb / (1024 * 8);
    if (nbloques == 0) {
      tam_mb++;
    }
  }
  return (tam_mb);
}


x86 assembly (clang, -O0):
<tamMB>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2000,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jle    113d <tamMB+0x3d>
mov    -0x8(%rbp),%eax
mov    $0x2000,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1163 <tamMB+0x63>
mov    -0x8(%rbp),%eax
mov    $0x2000,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    115e <tamMB+0x5e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1163 <tamMB+0x63>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tamMB>:
lea    0x1fff(%rdi),%ecx
test   %edi,%edi
cmovns %edi,%ecx
sete   %al
sar    $0xd,%ecx
test   $0x80001fff,%edi
setg   %dl
or     %al,%dl
movzbl %dl,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @tamMB(i32 %0) {
%2 = and i32 %0, -2147475457
%3 = sdiv i32 %0, 8192
%4 = icmp eq i32 %0, 0
%5 = icmp sgt i32 %2, 0
%6 = or i1 %5, %4
%7 = zext i1 %6 to i32
%8 = add nsw i32 %3, %7
ret i32 %8
}
long long scm_page_count(long long d) { return (1LL << (2 * d + 3)) - 2; }


x86 assembly (clang, -O0):
<scm_page_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
shl    $0x1,%rcx
add    $0x3,%rcx
mov    $0x1,%eax
shl    %cl,%rax
sub    $0x2,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scm_page_count>:
lea    (%rdi,%rdi,1),%ecx
add    $0x3,%cl
mov    $0x1,%eax
shl    %cl,%rax
add    $0xfffffffffffffffe,%rax
ret

LLVM IR (-O0):
define i64 @scm_page_count(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul nsw i64 2, %3
%5 = add nsw i64 %4, 3
%6 = shl i64 1, %5
%7 = sub nsw i64 %6, 2
ret i64 %7
}

LLVM IR (-O2):
define i64 @scm_page_count(i64 %0) {
%2 = shl nsw i64 %0, 1
%3 = add nsw i64 %2, 3
%4 = shl nuw i64 1, %3
%5 = add nsw i64 %4, -2
ret i64 %5
}
void GameLevelUp() {}


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

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

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

LLVM IR (-O2):
define void @GameLevelUp() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  printf("Enter number:\n");
  scanf("%d", &a);
  if (a % 2 == 0) {
    printf("Number is even \n");
  } else {
    printf("Number is odd \n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1170 <main+0x50>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <main+0x5c>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
testb  $0x1,0x4(%rsp)
lea    0xed6(%rip),%rax
lea    0xec0(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter number:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"Number is even \0A\00"
@.str.3 = [16 x i8] c"Number is odd \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 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 = srem i32 %5, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [14 x i8] c"Enter number:\00"
@str.4 = [15 x i8] c"Number is odd \00"
@str.5 = [16 x i8] c"Number is even \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 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 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0)
%9 = call i32 @puts(i8* dereferenceable(1) %8)
ret i32 0
}
/* Variables and functions */
char *getenv(char *);
const char *GetTempDir(void) {
  const char *ret = getenv("TEST_TMPDIR");
  if (ret == NULL || ret[0] == '\0')
    ret = "/tmp";
  return ret;
}


x86 assembly (clang, -O0):
<GetTempDir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1143 <GetTempDir+0x33>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    114e <GetTempDir+0x3e>
lea    0xec2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetTempDir>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1129 <GetTempDir+0x19>
cmpb   $0x0,(%rax)
je     1129 <GetTempDir+0x19>
pop    %rcx
ret
lea    0xedc(%rip),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"TEST_TMPDIR\00"
@.str.1 = [5 x i8] c"/tmp\00"
define i8* @GetTempDir() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %3, %0
br label %7
7: ; preds = %6, %3
%8 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %6 ], [ %1, %3 ]
ret i8* %8
}