xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  printf("Digite um número inteiro: \n");
  scanf("%d", &num);
  printf("Número = %d", num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xec6(%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    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xec6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Digite um n\C3\BAmero inteiro: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"N\C3\BAmero = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 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 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"N\C3\BAmero = %d\00"
@str = [28 x i8] c"Digite um n\C3\BAmero inteiro: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ emitln(char *);
int /*<<< orphan*/ factor();
int /*<<< orphan*/ match(char);
void multiply() {
  match('*');
  factor();
  emitln("pop\t%ebx");
  emitln("mul\t%ebx");
}


x86 assembly (clang, -O0):
<multiply>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2a,%edi
call   1040 <match@plt>
mov    $0x0,%al
call   1050 <factor@plt>
lea    0xeb4(%rip),%rdi
call   1030 <emitln@plt>
lea    0xeb1(%rip),%rdi
call   1030 <emitln@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply>:
push   %rax
mov    $0x2a,%edi
call   1040 <match@plt>
xor    %eax,%eax
call   1050 <factor@plt>
lea    0xeb7(%rip),%rdi
call   1030 <emitln@plt>
lea    0xeb4(%rip),%rdi
pop    %rax
jmp    1030 <emitln@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"pop\09%ebx\00"
@.str.1 = [9 x i8] c"mul\09%ebx\00"
define void @multiply() {
%1 = call i32 @match(i8 signext 42)
%2 = call i32 (...) @factor()
%3 = call i32 @emitln(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @emitln(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"pop\09%ebx\00"
@.str.1 = [9 x i8] c"mul\09%ebx\00"
define void @multiply() {
%1 = tail call i32 @match(i8 signext 42)
%2 = tail call i32 (...) @factor()
%3 = tail call i32 @emitln(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @emitln(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void free(char *addr) { return; }


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

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

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

LLVM IR (-O2):
define void @free(i8* nocapture %0) {
ret void
}
int ffs(int x) {
  int r;
  asm("bsfl %1,%0\n\t"
      "jnz 1f\n\t"
      "movl $-1,%0\n"
      "1:"
      : "=r"(r)
      : "rm"(x));
  return r + 1;
}


x86 assembly (clang, -O0):
<ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
bsf    -0xc(%rbp),%eax
jne    111c <ffs+0x1c>
mov    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs>:
mov    %edi,-0x4(%rsp)
bsf    -0x4(%rsp),%eax
jne    1110 <ffs+0x10>
mov    $0xffffffff,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ffs(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 asm "bsfl $1,$0\0A\09jnz 1f\0A\09movl $$-1,$0\0A1:", "=r,rm,~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
ret i32 %7
}

LLVM IR (-O2):
define i32 @ffs(i32 %0) {
%2 = tail call i32 asm "bsfl $1,$0\0A\09jnz 1f\0A\09movl $$-1,$0\0A1:", "=r,rm,~{dirflag},~{fpsr},~{flags}"(i32 %0)
%3 = add nsw i32 %2, 1
ret i32 %3
}
int blk_mq_debugfs_register_sched_hctx(struct request_queue *q,
                                       struct blk_mq_hw_ctx *hctx) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.request_queue = type opaque
%struct.blk_mq_hw_ctx = type opaque
define i32 @blk_mq_debugfs_register_sched_hctx(%struct.request_queue* %0, %struct.blk_mq_hw_ctx* %1) {
%3 = alloca %struct.request_queue*
%4 = alloca %struct.blk_mq_hw_ctx*
store %struct.request_queue* %0, %struct.request_queue** %3
store %struct.blk_mq_hw_ctx* %1, %struct.blk_mq_hw_ctx** %4
ret i32 0
}

LLVM IR (-O2):
%struct.request_queue = type opaque
%struct.blk_mq_hw_ctx = type opaque
define i32 @blk_mq_debugfs_register_sched_hctx(%struct.request_queue* nocapture readnone %0, %struct.blk_mq_hw_ctx* nocapture readnone %1) {
ret i32 0
}
void Material_DirtyTechniqueSetOverrides() {}


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

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

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

LLVM IR (-O2):
define void @Material_DirtyTechniqueSetOverrides() {
ret void
}
void eglTerminate(void) { return; }


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

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

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

LLVM IR (-O2):
define void @eglTerminate() {
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
size_t strlen(char *);
char *exmul(char *s, char *t) {
  size_t ls = strlen(s);
  size_t lt = strlen(t);
  int lu = (int)(ls + lt + 1);
  char *u = (char *)malloc(sizeof(char) * lu);
  if (lt > 1) {
  }
}


x86 assembly (clang, -O0):
<exmul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x1,-0x28(%rbp)
jbe    117c <exmul+0x5c>
jmp    117c <exmul+0x5c>
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exmul>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <strlen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    (%rax,%r14,1),%edi
add    $0x1,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <malloc@plt>

LLVM IR (-O0):
define i8* @exmul(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%10 = load i8*, i8** %4
%11 = call i64 @strlen(i8* %10)
store i64 %11, i64* %6
%12 = load i8*, i8** %5
%13 = call i64 @strlen(i8* %12)
store i64 %13, i64* %7
%14 = load i64, i64* %6
%15 = load i64, i64* %7
%16 = add i64 %14, %15
%17 = add i64 %16, 1
%18 = trunc i64 %17 to i32
store i32 %18, i32* %8
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = mul i64 1, %20
%22 = trunc i64 %21 to i32
%23 = call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to i8*
store i8* %24, i8** %9
%25 = load i64, i64* %7
%26 = icmp ugt i64 %25, 1
br i1 %26, label %27, label %28
27: ; preds = %2
br label %28
28: ; preds = %27, %2
%29 = load i8*, i8** %3
ret i8* %29
}

LLVM IR (-O2):
define noalias i8* @exmul(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %4, %3
%6 = trunc i64 %5 to i32
%7 = add i32 %6, 1
%8 = tail call i64 @malloc(i32 %7)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int hash(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char *word;
  word = (char *)malloc(200);
  scanf("%s", word);
  int a = hash(word);
  printf("%d", a);
  free(word);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc8,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <hash@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe70(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xc8,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe9b(%rip),%rdi
mov    %rax,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1040 <hash@plt>
lea    0xe87(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 @malloc(i32 200)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %2
%9 = call i32 @hash(i8* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i8*, i8** %2
%13 = call i32 @free(i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 200)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @hash(i8* %2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @free(i8* %2)
ret i32 0
}
int fun732() { return 732; }


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

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

LLVM IR (-O0):
define i32 @fun732() {
ret i32 732
}

LLVM IR (-O2):
define i32 @fun732() {
ret i32 732
}
int h2(int key) { return (1 + (key % 8494)); }


x86 assembly (clang, -O0):
<h2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x212e,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<h2>:
movslq %edi,%rax
imul   $0x3db97995,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2b,%rcx
add    %edx,%ecx
imul   $0x212e,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @h2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 8494
%5 = add nsw i32 1, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @h2(i32 %0) {
%2 = srem i32 %0, 8494
%3 = add nsw i32 %2, 1
ret i32 %3
}
void lib3ds_quat_identity(float c[4]) {
  c[0] = c[1] = c[2] = 0.0f;
  c[3] = 1.0f;
}


x86 assembly (clang, -O0):
<lib3ds_quat_identity>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0xec9(%rip),%xmm0
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib3ds_quat_identity>:
movaps 0xef9(%rip),%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @lib3ds_quat_identity(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 2
store float 0.000000e+00, float* %4
%5 = load float*, float** %2
%6 = getelementptr inbounds float, float* %5, i64 1
store float 0.000000e+00, float* %6
%7 = load float*, float** %2
%8 = getelementptr inbounds float, float* %7, i64 0
store float 0.000000e+00, float* %8
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 3
store float 1.000000e+00, float* %10
ret void
}

LLVM IR (-O2):
define void @lib3ds_quat_identity(float* nocapture writeonly %0) {
%2 = bitcast float* %0 to <4 x float>*
store <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>, <4 x float>* %2
ret void
}
/* Variables and functions */
int __infer_nondet_int();
int tolower(int x) { return __infer_nondet_int(); }


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

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

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

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = tail call i32 (...) @__infer_nondet_int()
ret i32 %2
}
void __attribute__((weak)) dma1_channel3_isr() { debug_handler(__FUNCTION__); }


x86 assembly (clang, -O0):
<dma1_channel3_isr>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <debug_handler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dma1_channel3_isr>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <debug_handler@plt>

LLVM IR (-O0):
@__FUNCTION__.dma1_channel3_isr = [18 x i8] c"dma1_channel3_isr\00"
define weak void @dma1_channel3_isr() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__FUNCTION__.dma1_channel3_isr, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__FUNCTION__.dma1_channel3_isr = [18 x i8] c"dma1_channel3_isr\00"
define weak void @dma1_channel3_isr() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__FUNCTION__.dma1_channel3_isr, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char const *);
int /*<<< orphan*/ stderr;
void die(const char *msg) {
  fprintf(stderr, msg);
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct sysinfo {
  int freeram;
  int mem_unit;
};

/* Variables and functions */
int /*<<< orphan*/ sysinfo(struct sysinfo *);
long unsigned freeram(void) {
  struct sysinfo si;
  sysinfo(&si);
  return ((si.freeram / 1024) * si.mem_unit);
}


x86 assembly (clang, -O0):
<freeram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <sysinfo@plt>
mov    -0x8(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
imul   -0x4(%rbp),%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeram>:
push   %rax
mov    %rsp,%rdi
call   1030 <sysinfo@plt>
mov    (%rsp),%eax
lea    0x3ff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0xa,%ecx
movslq 0x4(%rsp),%rdx
movslq %ecx,%rax
imul   %rdx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sysinfo = type { i32, i32 }
define i64 @freeram() {
%1 = alloca %struct.sysinfo
%2 = call i32 @sysinfo(%struct.sysinfo* %1)
%3 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = sdiv i32 %4, 1024
%6 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = mul nsw i32 %5, %7
%9 = sext i32 %8 to i64
ret i64 %9
}

LLVM IR (-O2):
%struct.sysinfo = type { i32, i32 }
define i64 @freeram() {
%1 = alloca %struct.sysinfo
%2 = bitcast %struct.sysinfo* %1 to i8*
%3 = call i32 @sysinfo(%struct.sysinfo* %1)
%4 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = sdiv i32 %5, 1024
%7 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = mul nsw i32 %6, %8
%10 = sext i32 %9 to i64
ret i64 %10
}
int linear_search(int a[], int n, int val) {
  int index = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] == val)
      return i;
  }
  return -1;
}


x86 assembly (clang, -O0):
<linear_search>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115a <linear_search+0x5a>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1147 <linear_search+0x47>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1161 <linear_search+0x61>
jmp    114c <linear_search+0x4c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    111c <linear_search+0x1c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<linear_search>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <linear_search+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edx,(%rdi,%rcx,4)
je     111f <linear_search+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <linear_search+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @linear_search(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
int BPQSerialClrCTS(unsigned int hDevice) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @BPQSerialClrCTS(i32 %0) {
ret i32 0
}
/* Variables and functions */
double sqrt(double);
double dist2d_c(double x1, double y1, double x2, double y2) {
  return sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}


x86 assembly (clang, -O0):
<dist2d_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm3
subsd  -0x20(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist2d_c>:
subsd  %xmm2,%xmm0
subsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1133 <dist2d_c+0x23>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define double @dist2d_c(double %0, double %1, double %2, double %3) {
%5 = fsub double %0, %2
%6 = fsub double %1, %3
%7 = fmul double %6, %6
%8 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %7)
%9 = tail call double @sqrt(double %8)
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
void report_init_error(char *msg) {
  write(1, "0", 1);
  write(1, msg, strlen(msg));
  close(1);
  exit(0);
}


x86 assembly (clang, -O0):
<report_init_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edx
lea    0xea8(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edi
call   1050 <close@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<report_init_error>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1050 <close@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
define void @report_init_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = call i32 @write(i32 1, i8* %4, i32 %6)
%8 = call i32 @close(i32 1)
%9 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
define void @report_init_error(i8* %0) {
%2 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @write(i32 1, i8* %0, i32 %3)
%5 = tail call i32 @close(i32 1)
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ test_many_clients();
int main(void) {
  setvbuf(stdout, NULL, _IONBF, 0);
  test_many_clients();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1030 <setvbuf@plt>
mov    $0x0,%al
call   1040 <test_many_clients@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1030 <setvbuf@plt>
xor    %eax,%eax
call   1040 <test_many_clients@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@_IONBF = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stdout
%3 = load i32, i32* @_IONBF
%4 = call i32 @setvbuf(i32 %2, i32* null, i32 %3, i32 0)
%5 = call i32 (...) @test_many_clients()
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@_IONBF = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = load i32, i32* @_IONBF
%3 = tail call i32 @setvbuf(i32 %1, i32* null, i32 %2, i32 0)
%4 = tail call i32 (...) @test_many_clients()
ret i32 0
}
int isPrime(int num) {
  int tnum, limit;
  if ((num & 0x1) == 0)
    return 0;
  tnum = 3;
  limit = num;
  while (tnum < limit) {
    if ((num % tnum) == 0) {
      return 0;
    }
    limit = num / tnum;
    tnum = tnum + 2;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1122 <isPrime+0x22>
movl   $0x0,-0x4(%rbp)
jmp    1176 <isPrime+0x76>
movl   $0x3,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    116f <isPrime+0x6f>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1157 <isPrime+0x57>
movl   $0x0,-0x4(%rbp)
jmp    1176 <isPrime+0x76>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    112f <isPrime+0x2f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
xor    %ecx,%ecx
test   $0x1,%dil
je     1135 <isPrime+0x35>
cmp    $0x4,%edi
jl     1130 <isPrime+0x30>
mov    $0x3,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1135 <isPrime+0x35>
add    $0x2,%esi
cmp    %eax,%esi
jl     1120 <isPrime+0x20>
mov    $0x1,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @isPrime(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = icmp sgt i32 %0, 3
br i1 %5, label %6, label %14
6: ; preds = %4, %11
%7 = phi i32 [ %12, %11 ], [ 3, %4 ]
%8 = srem i32 %0, %7
%9 = sdiv i32 %0, %7
%10 = icmp eq i32 %8, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = add nuw nsw i32 %7, 2
%13 = icmp slt i32 %12, %9
br i1 %13, label %6, label %14
14: ; preds = %6, %11, %4, %1
%15 = phi i32 [ 0, %1 ], [ 1, %4 ], [ 0, %6 ], [ 1, %11 ]
ret i32 %15
}
/* Variables and functions */
int add(int, int);
int compute(int (*)(int, int), int, int);
int mult(int, int);
int main() {
  int a = mult(add(2, 4), 8);
  int b = compute(mult, compute(add, 2, 4), 8);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
mov    $0x4,%esi
call   1040 <add@plt>
mov    %eax,%edi
mov    $0x8,%esi
call   1048 <mult@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e84(%rip),%rdi
mov    $0x2,%esi
mov    $0x4,%edx
call   1030 <compute@plt>
mov    %eax,%esi
mov    0x2e7c(%rip),%rdi
mov    $0x8,%edx
call   1030 <compute@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x2,%edi
mov    $0x4,%esi
call   1040 <add@plt>
mov    0x2e9e(%rip),%rbx
mov    %eax,%edi
mov    $0x8,%esi
call   1048 <mult@plt>
mov    0x2e9b(%rip),%r14
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x4,%edx
call   1030 <compute@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x8,%edx
call   1030 <compute@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @add(i32 2, i32 4)
%5 = call i32 @mult(i32 %4, i32 8)
store i32 %5, i32* %2
%6 = call i32 @compute(i32 (i32, i32)* @add, i32 2, i32 4)
%7 = call i32 @compute(i32 (i32, i32)* @mult, i32 %6, i32 8)
store i32 %7, i32* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @add(i32 2, i32 4)
%2 = tail call i32 @mult(i32 %1, i32 8)
%3 = tail call i32 @compute(i32 (i32, i32)* @add, i32 2, i32 4)
%4 = tail call i32 @compute(i32 (i32, i32)* @mult, i32 %3, i32 8)
ret i32 0
}
int test_imm_B9int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0xB9 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_B9int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 794568949760
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t f5(uint32_t x, uint32_t y, uint32_t z) { return x ^ (y | ~z); }


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
or     %edx,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f5>:
mov    %edx,%eax
not    %eax
or     %esi,%eax
xor    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @f5(i32 %0, i32 %1, i32 %2) {
%4 = xor i32 %2, -1
%5 = or i32 %4, %1
%6 = xor i32 %5, %0
ret i32 %6
}
/* Variables and functions */
scalar_t__ malloc(int);
void strong_update_malloc_Good() {
  int a[10];
  int *x = (int *)malloc(sizeof(int));
  *x = 10;
  *x = 0;
  a[*x] = 0;
}


x86 assembly (clang, -O0):
<strong_update_malloc_Good>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movl   $0xa,(%rax)
mov    -0x38(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x38(%rbp),%rax
movslq (%rax),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strong_update_malloc_Good>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>
movl   $0x0,(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @strong_update_malloc_Good() {
%1 = alloca [10 x i32]
%2 = alloca i32*
%3 = call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %2
%5 = load i32*, i32** %2
store i32 10, i32* %5
%6 = load i32*, i32** %2
store i32 0, i32* %6
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %9
store i32 0, i32* %10
ret void
}

LLVM IR (-O2):
define void @strong_update_malloc_Good() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i32*
store i32 0, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ echo(char *);
init() { echo("Program starting."); }


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <echo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"Program starting.\00"
define i32 @init() {
%1 = alloca i32
%2 = call i32 @echo(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [18 x i8] c"Program starting.\00"
define i32 @init() {
%1 = tail call i32 @echo(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_in_wchstr(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_in_wchstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    115a <cmd_in_wchstr+0x2a>
jmp    1170 <cmd_in_wchstr+0x40>
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xe95(%rip),%rdi
call   1050 <report_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_in_wchstr>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_in_wchstr+0x12>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xead(%rip),%rdi
pop    %rax
jmp    1050 <report_error@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_in_wchstr(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_in_wchstr(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
FILE *init_log_file(char *file_name) {
  FILE *fp;
  fp = fopen(file_name, "w+");
  return fp;
}


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

x86 assembly (clang, -O2):
<init_log_file>:
lea    0xee9(%rip),%rsi
jmp    1030 <fopen@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"w+\00"
define i32* @init_log_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
ret i32* %6
}

LLVM IR (-O2):
@.str = [3 x i8] c"w+\00"
define noalias i32* @init_log_file(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32* %2
}
int ft_eight_queens_puzzle(void) { return (92); }


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

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

LLVM IR (-O0):
define i32 @ft_eight_queens_puzzle() {
ret i32 92
}

LLVM IR (-O2):
define i32 @ft_eight_queens_puzzle() {
ret i32 92
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *malloc(size_t);
void *__hashmap_alloc(size_t size) {
  void *ptr;
  ptr = malloc(size);
  assert(ptr != NULL);
  if (ptr)
    return ptr;
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<__hashmap_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
je     1170 <__hashmap_alloc+0x40>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<__hashmap_alloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1030 <assert@plt>
test   %rbx,%rbx
je     1151 <__hashmap_alloc+0x21>
mov    %rbx,%rax
pop    %rbx
ret
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define i8* @__hashmap_alloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
14: ; preds = %1
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define noalias i8* @__hashmap_alloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp ne i8* %2, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
br i1 %3, label %6, label %7
6: ; preds = %1
ret i8* %2
7: ; preds = %1
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_p434_to_bytes(uintptr_t, uintptr_t);
void fiat_p434_to_bytes(uint8_t out1[55], const uint64_t arg1[7]) {
  internal_fiat_p434_to_bytes((uintptr_t)out1, (uintptr_t)arg1);
}


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

x86 assembly (clang, -O2):
<fiat_p434_to_bytes>:
jmp    1030 <internal_fiat_p434_to_bytes@plt>

LLVM IR (-O0):
define void @fiat_p434_to_bytes(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = ptrtoint i32* %5 to i64
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = call i32 @internal_fiat_p434_to_bytes(i64 %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @fiat_p434_to_bytes(i32* %0, i32* %1) {
%3 = ptrtoint i32* %0 to i64
%4 = ptrtoint i32* %1 to i64
%5 = tail call i32 @internal_fiat_p434_to_bytes(i64 %3, i64 %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void close_scene_file(FILE *scene_file) {
  ((void)0);
  if (EOF == fclose(scene_file)) {
    fprintf(stderr, "Error: Something went horribly wrong.\n");
    fprintf(stderr, "Error: The scene file could not be closed.\n");
  }
}


x86 assembly (clang, -O0):
<close_scene_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
jne    117d <close_scene_file+0x5d>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xeaf(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_scene_file>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%rbx
call   1030 <fclose@plt>
cmp    %rax,%rbx
jne    1159 <close_scene_file+0x39>
mov    0x2e9c(%rip),%rbx
mov    (%rbx),%edi
lea    0xebb(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed4(%rip),%rsi
pop    %rbx
jmp    1040 <fprintf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i64 0
@stderr = global i32 0
@.str = [39 x i8] c"Error: Something went horribly wrong.\0A\00"
@.str.1 = [44 x i8] c"Error: The scene file could not be closed.\0A\00"
define void @close_scene_file(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i64, i64* @EOF
%4 = load i32*, i32** %2
%5 = call i64 @fclose(i32* %4)
%6 = icmp eq i64 %3, %5
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
@EOF = global i64 0
@stderr = global i32 0
@.str = [39 x i8] c"Error: Something went horribly wrong.\0A\00"
@.str.1 = [44 x i8] c"Error: The scene file could not be closed.\0A\00"
define void @close_scene_file(i32* nocapture %0) {
%2 = load i64, i64* @EOF
%3 = tail call i64 @fclose(i32* %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %5, %1
ret void
}
void USBPHYPowerOn(unsigned long ulBase) {
  (*((volatile unsigned char *)(ulBase + 0x00000001))) &= ~0x00000001;
}


x86 assembly (clang, -O0):
<USBPHYPowerOn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
movzbl %cl,%ecx
and    $0xfffffffe,%ecx
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBPHYPowerOn>:
andb   $0xfe,0x1(%rdi)
ret

LLVM IR (-O0):
define void @USBPHYPowerOn(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 1
%5 = inttoptr i64 %4 to i8*
%6 = load volatile i8, i8* %5
%7 = zext i8 %6 to i32
%8 = and i32 %7, -2
%9 = trunc i32 %8 to i8
store volatile i8 %9, i8* %5
ret void
}

LLVM IR (-O2):
define void @USBPHYPowerOn(i64 %0) {
%2 = add i64 %0, 1
%3 = inttoptr i64 %2 to i8*
%4 = load volatile i8, i8* %3
%5 = and i8 %4, -2
store volatile i8 %5, i8* %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ *create_win(int, int, int, int);
WINDOW *create_wboard() { return create_win(30, 32, 3, 3 + 32); }


x86 assembly (clang, -O0):
<create_wboard>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1e,%edi
mov    $0x20,%esi
mov    $0x3,%edx
mov    $0x23,%ecx
call   1030 <create_win@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_wboard>:
mov    $0x1e,%edi
mov    $0x20,%esi
mov    $0x3,%edx
mov    $0x23,%ecx
jmp    1030 <create_win@plt>

LLVM IR (-O0):
define i32* @create_wboard() {
%1 = call i32* @create_win(i32 30, i32 32, i32 3, i32 35)
ret i32* %1
}

LLVM IR (-O2):
define i32* @create_wboard() {
%1 = tail call i32* @create_win(i32 30, i32 32, i32 3, i32 35)
ret i32* %1
}
void RTFileGetSize(void) {}


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

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

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

LLVM IR (-O2):
define void @RTFileGetSize() {
ret void
}
/* Variables and functions */
int clz(int);
int createRefCost(int ref) {
  if (ref == 0)
    return 0;
  int bins;
  bins = 16 - clz(ref);
  return ((bins << 1) - 1);
}


x86 assembly (clang, -O0):
<createRefCost>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <createRefCost+0x21>
movl   $0x0,-0x4(%rbp)
jmp    1151 <createRefCost+0x41>
mov    -0x8(%rbp),%edi
call   1030 <clz@plt>
mov    %eax,%ecx
mov    $0x10,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createRefCost>:
test   %edi,%edi
je     112a <createRefCost+0x1a>
push   %rax
call   1030 <clz@plt>
mov    %eax,%ecx
add    %eax,%ecx
mov    $0x1f,%eax
sub    %ecx,%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @createRefCost(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @clz(i32 %0)
%5 = mul i32 %4, -2
%6 = add i32 %5, 31
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}