xunge/DecIR huggingface dataset:
/* Variables and functions */
int array_count(void *);
void *get_array_addr(int /*<<< orphan*/);
void *get_origin_addr(void *);
int /*<<< orphan*/ realloc(void *, size_t);
int /*<<< orphan*/ set_count(void *, int);
void *increase(void *array) {
  int count = array_count(array) + 1;
  set_count(array, count);
  size_t size = count * sizeof(void *) + sizeof(int);
  void *origin = get_origin_addr(array);
  array = get_array_addr(realloc(origin, size));
  return array;
}


x86 assembly (clang, -O0):
<increase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <array_count@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1070 <set_count@plt>
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <get_origin_addr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <realloc@plt>
mov    %eax,%edi
call   1060 <get_array_addr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<increase>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <array_count@plt>
mov    %eax,%r14d
lea    0x1(%r14),%esi
mov    %rbx,%rdi
call   1070 <set_count@plt>
movslq %r14d,%rax
lea    0xc(,%rax,8),%r14
mov    %rbx,%rdi
call   1050 <get_origin_addr@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <realloc@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <get_array_addr@plt>

LLVM IR (-O0):
define i8* @increase(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @array_count(i8* %6)
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = call i32 @set_count(i8* %9, i32 %10)
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 8
%15 = add i64 %14, 4
store i64 %15, i64* %4
%16 = load i8*, i8** %2
%17 = call i8* @get_origin_addr(i8* %16)
store i8* %17, i8** %5
%18 = load i8*, i8** %5
%19 = load i64, i64* %4
%20 = call i32 @realloc(i8* %18, i64 %19)
%21 = call i8* @get_array_addr(i32 %20)
store i8* %21, i8** %2
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
define i8* @increase(i8* %0) {
%2 = tail call i32 @array_count(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i32 @set_count(i8* %0, i32 %3)
%5 = sext i32 %3 to i64
%6 = shl nsw i64 %5, 3
%7 = or i64 %6, 4
%8 = tail call i8* @get_origin_addr(i8* %0)
%9 = tail call i32 @realloc(i8* %8, i64 %7)
%10 = tail call i8* @get_array_addr(i32 %9)
ret i8* %10
}
float map(float value, float istart, float istop, float ostart, float ostop) {
  return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));
}


x86 assembly (clang, -O0):
<map>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
subss  -0x8(%rbp),%xmm2
movss  -0xc(%rbp),%xmm3
subss  -0x8(%rbp),%xmm3
divss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<map>:
subss  %xmm3,%xmm4
subss  %xmm1,%xmm0
subss  %xmm1,%xmm2
divss  %xmm2,%xmm0
mulss  %xmm4,%xmm0
addss  %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @map(float %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%11 = load float, float* %9
%12 = load float, float* %10
%13 = load float, float* %9
%14 = fsub float %12, %13
%15 = load float, float* %6
%16 = load float, float* %7
%17 = fsub float %15, %16
%18 = load float, float* %8
%19 = load float, float* %7
%20 = fsub float %18, %19
%21 = fdiv float %17, %20
%22 = call float @llvm.fmuladd.f32(float %14, float %21, float %11)
ret float %22
}

LLVM IR (-O2):
define float @map(float %0, float %1, float %2, float %3, float %4) {
%6 = fsub float %4, %3
%7 = fsub float %0, %1
%8 = fsub float %2, %1
%9 = fdiv float %7, %8
%10 = tail call float @llvm.fmuladd.f32(float %6, float %9, float %3)
ret float %10
}
/* Variables and functions */
int _exist(int *, int /*<<< orphan*/, int, int);
bool exist(int *n, int size, int target) {
  if (target >= n[0] && target <= n[size - 1])
    return _exist(n, 0, size - 1, target);
  return false;
}


x86 assembly (clang, -O0):
<exist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jl     1166 <exist+0x56>
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jg     1166 <exist+0x56>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
mov    -0x18(%rbp),%ecx
xor    %esi,%esi
call   1030 <_exist@plt>
mov    %eax,-0x4(%rbp)
jmp    116d <exist+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exist>:
mov    %edx,%ecx
cmp    %edx,(%rdi)
jg     1121 <exist+0x11>
mov    %esi,%edx
movslq %esi,%rax
cmp    %ecx,-0x4(%rdi,%rax,4)
jge    1124 <exist+0x14>
xor    %eax,%eax
ret
add    $0xffffffff,%edx
xor    %esi,%esi
jmp    1030 <_exist@plt>

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

LLVM IR (-O2):
define i32 @exist(i32* %0, i32 %1, i32 %2) {
%4 = load i32, i32* %0
%5 = icmp sgt i32 %4, %2
br i1 %5, label %14, label %6
6: ; preds = %3
%7 = add nsw i32 %1, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp slt i32 %10, %2
br i1 %11, label %14, label %12
12: ; preds = %6
%13 = tail call i32 @_exist(i32* %0, i32 0, i32 %7, i32 %2)
br label %14
14: ; preds = %3, %6, %12
%15 = phi i32 [ %13, %12 ], [ 0, %6 ], [ 0, %3 ]
ret i32 %15
}
/* Type definitions */
typedef void *uint8_t;
typedef int uint32_t;
typedef int int8_t;

/* Variables and functions */
void GPIO_set_pull(uint8_t pdir, uint8_t pin) {
  intptr_t addr;
  ;
  int8_t clk = pin - 32;
  if (clk < 0) {
    addr = 0x00200098;
    clk = pin;
  } else {
    addr = 0x0020009C;
  }
  (*((volatile uint32_t *)(0x00200094))) = pdir;
  (*((volatile uint32_t *)(addr))) = (1 << clk);
}


x86 assembly (clang, -O0):
<GPIO_set_pull>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffe0,%rax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1135 <GPIO_set_pull+0x35>
movq   $0x200098,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x1c(%rbp)
jmp    113d <GPIO_set_pull+0x3d>
movq   $0x20009c,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%ecx
mov    $0x200094,%eax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIO_set_pull>:
xor    %eax,%eax
mov    %esi,%ecx
add    $0xffffffe0,%ecx
setns  %al
mov    %edi,0x200094
cmovs  %esi,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,0x200098(,%rax,4)
ret

LLVM IR (-O0):
define void @GPIO_set_pull(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = getelementptr i8, i8* %7, i64 -32
%9 = ptrtoint i8* %8 to i32
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
store i64 2097304, i64* %5
%13 = load i8*, i8** %4
%14 = ptrtoint i8* %13 to i32
store i32 %14, i32* %6
br label %16
15: ; preds = %2
store i64 2097308, i64* %5
br label %16
16: ; preds = %15, %12
%17 = load i8*, i8** %3
%18 = ptrtoint i8* %17 to i32
store volatile i32 %18, i32* inttoptr (i64 2097300 to i32*)
%19 = load i32, i32* %6
%20 = shl i32 1, %19
%21 = load i64, i64* %5
%22 = inttoptr i64 %21 to i32*
store volatile i32 %20, i32* %22
ret void
}

LLVM IR (-O2):
define void @GPIO_set_pull(i8* %0, i8* %1) {
%3 = getelementptr i8, i8* %1, i64 -32
%4 = ptrtoint i8* %3 to i64
%5 = trunc i64 %4 to i32
%6 = icmp slt i32 %5, 0
%7 = ptrtoint i8* %1 to i64
%8 = trunc i64 %7 to i32
%9 = select i1 %6, i32* inttoptr (i64 2097304 to i32*), i32* inttoptr (i64 2097308 to i32*)
%10 = select i1 %6, i32 %8, i32 %5
%11 = ptrtoint i8* %0 to i64
%12 = trunc i64 %11 to i32
store volatile i32 %12, i32* inttoptr (i64 2097300 to i32*)
%13 = shl nuw i32 1, %10
store volatile i32 %13, i32* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ defineStartAndEnd(int *, int *, int);
int wordsNumber(int, int);
double wordsDensity(int offset, int limit) {
  int offend;
  int num = wordsNumber(offset, limit);
  defineStartAndEnd(&offset, &offend, limit);
  return (double)num / (offend - offset);
}


x86 assembly (clang, -O0):
<wordsDensity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <wordsNumber@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edx
lea    -0x4(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <defineStartAndEnd@plt>
cvtsi2sdl -0x10(%rbp),%xmm0
mov    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wordsDensity>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,(%rsp)
call   1040 <wordsNumber@plt>
mov    %eax,%ebp
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
mov    %ebx,%edx
call   1030 <defineStartAndEnd@plt>
cvtsi2sd %ebp,%xmm0
mov    0x4(%rsp),%eax
sub    (%rsp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @wordsDensity(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @wordsNumber(i32 %7, i32 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %4
%11 = call i32 @defineStartAndEnd(i32* %3, i32* %5, i32 %10)
%12 = load i32, i32* %6
%13 = sitofp i32 %12 to double
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = sub nsw i32 %14, %15
%17 = sitofp i32 %16 to double
%18 = fdiv double %13, %17
ret double %18
}

LLVM IR (-O2):
define double @wordsDensity(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = bitcast i32* %4 to i8*
%6 = tail call i32 @wordsNumber(i32 %0, i32 %1)
%7 = call i32 @defineStartAndEnd(i32* %3, i32* %4, i32 %1)
%8 = sitofp i32 %6 to double
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = sub nsw i32 %9, %10
%12 = sitofp i32 %11 to double
%13 = fdiv double %8, %12
ret double %13
}
void ff_hevc_put_hevc_bi_qpel_v4_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_qpel_v4_12_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SleepC(int);
int main(int argc, char const *argv[]) {
  SleepC(3);
  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    $0x3,%edi
call   1030 <SleepC@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @SleepC(i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void LL_error_and_exit_verbose(const char *file, const char *function, int line,
                               char *message) {
  printf("ERROR IN FILE: %s, FUNCTION: %s, LINE: %d\n", file, function, line);
  printf("%s\n", message);
  printf("EXITING\n");
  exit(1);
}


x86 assembly (clang, -O0):
<LL_error_and_exit_verbose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<LL_error_and_exit_verbose>:
push   %rbx
mov    %rcx,%rbx
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"ERROR IN FILE: %s, FUNCTION: %s, LINE: %d\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [9 x i8] c"EXITING\0A\00"
define void @LL_error_and_exit_verbose(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i32 %11)
%13 = load i8*, i8** %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [43 x i8] c"ERROR IN FILE: %s, FUNCTION: %s, LINE: %d\0A\00"
@str = [8 x i8] c"EXITING\00"
define void @LL_error_and_exit_verbose(i8* %0, i8* %1, i32 %2, i8* nocapture %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %2)
%6 = tail call i32 @puts(i8* dereferenceable(1) %3)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct srcu_struct {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ BUG();
int init_srcu_struct(struct srcu_struct *sp) {
  BUG();
  return 0;
}


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

x86 assembly (clang, -O2):
<init_srcu_struct>:
push   %rax
xor    %eax,%eax
call   1030 <BUG@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.srcu_struct = type { i32 }
define i32 @init_srcu_struct(%struct.srcu_struct* %0) {
%2 = alloca %struct.srcu_struct*
store %struct.srcu_struct* %0, %struct.srcu_struct** %2
%3 = call i32 (...) @BUG()
ret i32 0
}

LLVM IR (-O2):
%struct.srcu_struct = type { i32 }
define i32 @init_srcu_struct(%struct.srcu_struct* nocapture readnone %0) {
%2 = tail call i32 (...) @BUG()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ foo2();
void foo1() { foo2(); }


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

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

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

LLVM IR (-O2):
define void @foo1() {
%1 = tail call i32 (...) @foo2()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glad_glPauseTransformFeedback();
void glPauseTransformFeedback() { glad_glPauseTransformFeedback(); }


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

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

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

LLVM IR (-O2):
define void @glPauseTransformFeedback() {
%1 = tail call i32 (...) @glad_glPauseTransformFeedback()
ret void
}
int test_imm_00int64_highword_reg(long long val) {
  return ((val >> 32) & (0x00 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
mov    $0xffffffd8,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_00int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 0
%6 = icmp ne i64 %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_00int64_highword_reg(i64 %0) {
ret i32 -40
}
/* Type definitions */
struct utmpx {
  int dummy;
};
struct utmp {
  int dummy;
};

/* Variables and functions */
scalar_t__ __getutid(struct utmp const *);
struct utmpx *__getutxid(const struct utmpx *id) {
  return (struct utmpx *)__getutid((const struct utmp *)id);
}


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

x86 assembly (clang, -O2):
<__getutxid>:
jmp    1030 <__getutid@plt>

LLVM IR (-O0):
%struct.utmpx = type { i32 }
%struct.utmp = type { i32 }
define %struct.utmpx* @__getutxid(%struct.utmpx* %0) {
%2 = alloca %struct.utmpx*
store %struct.utmpx* %0, %struct.utmpx** %2
%3 = load %struct.utmpx*, %struct.utmpx** %2
%4 = bitcast %struct.utmpx* %3 to %struct.utmp*
%5 = call i64 @__getutid(%struct.utmp* %4)
%6 = inttoptr i64 %5 to %struct.utmpx*
ret %struct.utmpx* %6
}

LLVM IR (-O2):
%struct.utmpx = type { i32 }
%struct.utmp = type { i32 }
define %struct.utmpx* @__getutxid(%struct.utmpx* %0) {
%2 = bitcast %struct.utmpx* %0 to %struct.utmp*
%3 = tail call i64 @__getutid(%struct.utmp* %2)
%4 = inttoptr i64 %3 to %struct.utmpx*
ret %struct.utmpx* %4
}
/* Variables and functions */
int /*<<< orphan*/ SIGVTALRM;
int /*<<< orphan*/ sig_handler_fake(int /*<<< orphan*/);
void pthread_yield() { sig_handler_fake(SIGVTALRM); }


x86 assembly (clang, -O0):
<pthread_yield>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <sig_handler_fake@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_yield>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <sig_handler_fake@plt>

LLVM IR (-O0):
@SIGVTALRM = global i32 0
define void @pthread_yield() {
%1 = load i32, i32* @SIGVTALRM
%2 = call i32 @sig_handler_fake(i32 %1)
ret void
}

LLVM IR (-O2):
@SIGVTALRM = global i32 0
define void @pthread_yield() {
%1 = load i32, i32* @SIGVTALRM
%2 = tail call i32 @sig_handler_fake(i32 %1)
ret void
}
/* Variables and functions */
int test_ft_atoi();
int test_ft_strcpy();
int test_ft_strdup();
int test_ft_strlen();
int test_ft_strncpy();
int tests_str() {
  do {
    int r = test_ft_strlen();
    if (0 && r)
      return (r);
  } while (0);
  do {
    int r = test_ft_strdup();
    if (0 && r)
      return (r);
  } while (0);
  do {
    int r = test_ft_strcpy();
    if (0 && r)
      return (r);
  } while (0);
  do {
    int r = test_ft_strncpy();
    if (0 && r)
      return (r);
  } while (0);
  do {
    int r = test_ft_atoi();
    if (0 && r)
      return (r);
  } while (0);
  return (0);
}


x86 assembly (clang, -O0):
<tests_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1070 <test_ft_strlen@plt>
mov    %eax,-0x4(%rbp)
jmp    1167 <tests_str+0x17>
mov    $0x0,%al
call   1030 <test_ft_strdup@plt>
mov    %eax,-0x8(%rbp)
jmp    1176 <tests_str+0x26>
mov    $0x0,%al
call   1050 <test_ft_strcpy@plt>
mov    %eax,-0xc(%rbp)
jmp    1185 <tests_str+0x35>
mov    $0x0,%al
call   1040 <test_ft_strncpy@plt>
mov    %eax,-0x10(%rbp)
jmp    1194 <tests_str+0x44>
mov    $0x0,%al
call   1060 <test_ft_atoi@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tests_str>:
push   %rax
xor    %eax,%eax
call   1070 <test_ft_strlen@plt>
xor    %eax,%eax
call   1030 <test_ft_strdup@plt>
xor    %eax,%eax
call   1050 <test_ft_strcpy@plt>
xor    %eax,%eax
call   1040 <test_ft_strncpy@plt>
xor    %eax,%eax
call   1060 <test_ft_atoi@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @tests_str() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
br label %6
6: ; preds = %0
%7 = call i32 (...) @test_ft_strlen()
store i32 %7, i32* %1
br label %8
8: ; preds = %6
br label %9
9: ; preds = %8
%10 = call i32 (...) @test_ft_strdup()
store i32 %10, i32* %2
br label %11
11: ; preds = %9
br label %12
12: ; preds = %11
%13 = call i32 (...) @test_ft_strcpy()
store i32 %13, i32* %3
br label %14
14: ; preds = %12
br label %15
15: ; preds = %14
%16 = call i32 (...) @test_ft_strncpy()
store i32 %16, i32* %4
br label %17
17: ; preds = %15
br label %18
18: ; preds = %17
%19 = call i32 (...) @test_ft_atoi()
store i32 %19, i32* %5
br label %20
20: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
define i32 @tests_str() {
%1 = tail call i32 (...) @test_ft_strlen()
%2 = tail call i32 (...) @test_ft_strdup()
%3 = tail call i32 (...) @test_ft_strcpy()
%4 = tail call i32 (...) @test_ft_strncpy()
%5 = tail call i32 (...) @test_ft_atoi()
ret i32 0
}
void repeat_seq(int a, long int *seq) {
  long int m = a;
  while (seq[m] == 0) {
    seq[m] += 1;
    m *= a;
    m %= 10;
  }
}


x86 assembly (clang, -O0):
<repeat_seq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    115e <repeat_seq+0x5e>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
add    $0x1,%rdx
mov    %rdx,(%rax,%rcx,8)
movslq -0x4(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x18(%rbp)
jmp    1113 <repeat_seq+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<repeat_seq>:
movslq %edi,%rdi
cmpq   $0x0,(%rsi,%rdi,8)
jne    1151 <repeat_seq+0x51>
movabs $0x6666666666666667,%r8
66 66 66
mov    %rdi,%rcx
nopw   0x0(%rax,%rax,1)
movq   $0x1,(%rsi,%rcx,8)
imul   %rdi,%rcx
mov    %rcx,%rax
imul   %r8
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
add    %rdx,%rdx
lea    (%rdx,%rdx,4),%rax
sub    %rax,%rcx
cmpq   $0x0,(%rsi,%rcx,8)
je     1120 <repeat_seq+0x20>
ret

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

LLVM IR (-O2):
define void @repeat_seq(i32 %0, i64* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i64, i64* %1, i64 %3
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %2, %7
%8 = phi i64* [ %12, %7 ], [ %4, %2 ]
%9 = phi i64 [ %11, %7 ], [ %3, %2 ]
store i64 1, i64* %8
%10 = mul nsw i64 %9, %3
%11 = srem i64 %10, 10
%12 = getelementptr inbounds i64, i64* %1, i64 %11
%13 = load i64, i64* %12
%14 = icmp eq i64 %13, 0
br i1 %14, label %7, label %15
15: ; preds = %7, %2
ret void
}
/* Type definitions */
struct __test_metadata {
  int dummy;
};
struct __fixture_variant_metadata {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ epoll11(struct __test_metadata *);
void wrapper_epoll11(struct __test_metadata *_metadata,
                     struct __fixture_variant_metadata *variant) {
  epoll11(_metadata);
}


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

x86 assembly (clang, -O2):
<wrapper_epoll11>:
jmp    1030 <epoll11@plt>

LLVM IR (-O0):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_epoll11(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* %1) {
%3 = alloca %struct.__test_metadata*
%4 = alloca %struct.__fixture_variant_metadata*
store %struct.__test_metadata* %0, %struct.__test_metadata** %3
store %struct.__fixture_variant_metadata* %1, %struct.__fixture_variant_metadata** %4
%5 = load %struct.__test_metadata*, %struct.__test_metadata** %3
%6 = call i32 @epoll11(%struct.__test_metadata* %5)
ret void
}

LLVM IR (-O2):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_epoll11(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* nocapture readnone %1) {
%3 = tail call i32 @epoll11(%struct.__test_metadata* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, double *);
int main(void) {
  double celsius;
  scanf("%lf", &celsius);
  printf("%lf\n", ((9.0 / 5.0) * celsius) + 32.0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb0(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
mulsd  0xec3(%rip),%xmm0
addsd  0xec3(%rip),%xmm0
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%4 = load double, double* %2
%5 = call double @llvm.fmuladd.f64(double 1.800000e+00, double %4, double 3.200000e+01)
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load double, double* %1
%5 = call double @llvm.fmuladd.f64(double %4, double 1.800000e+00, double 3.200000e+01)
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ redecl4();
void use122() { redecl4(); }


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

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

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

LLVM IR (-O2):
define void @use122() {
%1 = tail call i32 (...) @redecl4()
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t maj(uint64_t h1, uint64_t h2, uint64_t h3) {
  return (h1 & h2) ^ (h3 & (h1 ^ h2));
}


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

x86 assembly (clang, -O2):
<maj>:
mov    %esi,%eax
and    %edi,%eax
xor    %edi,%esi
and    %edx,%esi
xor    %esi,%eax
ret

LLVM IR (-O0):
define i32 @maj(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 = and i32 %7, %8
%10 = load i32, i32* %6
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = xor i32 %11, %12
%14 = and i32 %10, %13
%15 = xor i32 %9, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @maj(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %1, %0
%5 = xor i32 %1, %0
%6 = and i32 %5, %2
%7 = xor i32 %6, %4
ret i32 %7
}
/* Variables and functions */
int strcmp(char *, char *);
int strcompare(void *str1, void *str2) {
  return strcmp((char *)str1, (char *)str2);
}


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

x86 assembly (clang, -O2):
<strcompare>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @strcompare(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
void protocol_irc_endclient(struct client *c) {}


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

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

LLVM IR (-O0):
%struct.client = type opaque
define void @protocol_irc_endclient(%struct.client* %0) {
%2 = alloca %struct.client*
store %struct.client* %0, %struct.client** %2
ret void
}

LLVM IR (-O2):
%struct.client = type opaque
define void @protocol_irc_endclient(%struct.client* nocapture %0) {
ret void
}
int fun423() { return 423; }


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

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

LLVM IR (-O0):
define i32 @fun423() {
ret i32 423
}

LLVM IR (-O2):
define i32 @fun423() {
ret i32 423
}
void GB_SECOND_f_FP32(float *z, const float *x, const float *y) { (*z) = (*y); }


x86 assembly (clang, -O0):
<GB_SECOND_f_FP32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GB_SECOND_f_FP32>:
movss  (%rdx),%xmm0
movss  %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @GB_SECOND_f_FP32(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 = load float, float* %7
%9 = load float*, float** %4
store float %8, float* %9
ret void
}

LLVM IR (-O2):
define void @GB_SECOND_f_FP32(float* nocapture writeonly %0, float* nocapture readnone %1, float* nocapture %2) {
%4 = load float, float* %2
store float %4, float* %0
ret void
}
/* Variables and functions */
int const rand();
int /*<<< orphan*/ srand(int const);
int getRandomNum(const int hi) {
  int number = rand() % hi;
  srand(rand());
  return number;
}


x86 assembly (clang, -O0):
<getRandomNum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandomNum>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%ebx
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getRandomNum(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @rand()
%5 = load i32, i32* %2
%6 = srem i32 %4, %5
store i32 %6, i32* %3
%7 = call i32 (...) @rand()
%8 = call i32 @srand(i32 %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @getRandomNum(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
%4 = tail call i32 (...) @rand()
%5 = tail call i32 @srand(i32 %4)
ret i32 %3
}
int main(void) {
  int a;
  a = 3;
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void vuln(char *buff) {
  char tmp[8] = {'\0'};
  strcpy(tmp, buff);
  printf("-> %s\n", tmp);
}


x86 assembly (clang, -O0):
<vuln>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x10(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vuln>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rsi
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xebb(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"-> %s\0A\00"
define void @vuln(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}
void f_c(char *a) {}


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

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

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

LLVM IR (-O2):
define void @f_c(i8* nocapture %0) {
ret void
}
unsigned xrop3_27_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = T ^ S;
  stk2 = D & stk3;
  stk1 = S ^ stk2;
  stk1 = ~stk1;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_27_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_27_1_0>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
xor    %edi,%esi
or     %esi,%eax
not    %eax
or     %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @xrop3_27_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = xor i8 %1, %0
%6 = zext i8 %5 to i32
%7 = or i32 %4, %6
%8 = xor i32 %7, -1
%9 = or i32 %8, %3
ret i32 %9
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int int_cmp(const void *litem, const void *ritem) {
  uint32_t *lint = (uint32_t *)litem;
  uint32_t *rint = (uint32_t *)ritem;
  return *lint - *rint;
}


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

x86 assembly (clang, -O2):
<int_cmp>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

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

LLVM IR (-O2):
define i32 @int_cmp(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 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int sweep_set_dobldobl_start(int n, double *c) {
  int fail, ptos[2];
  ptos[0] = 1;
  ptos[1] = 0;
  fail = _ada_use_c2phc4c(618, ptos, &n, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<sweep_set_dobldobl_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x1c(%rbp),%rsi
mov    -0x10(%rbp),%rcx
mov    $0x26a,%edi
lea    -0x4(%rbp),%rdx
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sweep_set_dobldobl_start>:
sub    $0x18,%rsp
mov    %rsi,%rcx
mov    %edi,0xc(%rsp)
movq   $0x1,0x10(%rsp)
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    $0x26a,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @sweep_set_dobldobl_start(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca [2 x i32]
store i32 %0, i32* %3
store double* %1, double** %4
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 1, i32* %7
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 0, i32* %8
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%10 = load double*, double** %4
%11 = call i32 @_ada_use_c2phc4c(i32 618, i32* %9, i32* %3, double* %10, i32 0)
store i32 %11, i32* %5
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @sweep_set_dobldobl_start(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca [2 x i32]
store i32 %0, i32* %3
%5 = bitcast [2 x i32]* %4 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 1, i32* %6
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 0, i32* %7
%8 = call i32 @_ada_use_c2phc4c(i32 618, i32* %6, i32* %3, double* %1, i32 0)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char, unsigned char);
void uart1_putc(unsigned char data) {
  printf("uart1_putc(%X := %c)\n", data, data);
}


x86 assembly (clang, -O0):
<uart1_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
lea    0xed8(%rip),%rdi
movzbl %al,%esi
movzbl -0x1(%rbp),%edx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart1_putc>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
mov    %edx,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [22 x i8] c"uart1_putc(%X := %c)\0A\00"
define void @uart1_putc(i8 zeroext %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8 zeroext %0, i8 zeroext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f();
int /*<<< orphan*/ lock();
int rand();
int main() {
  lock();
  if (rand() % 2 == 0) {
    f();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <lock@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1165 <main+0x35>
mov    $0x0,%al
call   1040 <f@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <lock@plt>
xor    %eax,%eax
call   1050 <rand@plt>
test   $0x1,%al
jne    114a <main+0x1a>
xor    %eax,%eax
call   1040 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @lock()
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @f()
br label %8
8: ; preds = %6, %0
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @lock()
%2 = tail call i32 (...) @rand()
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 (...) @f()
br label %7
7: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int inb(int);
int idewait(int checkerr) {
  int in;
  while (((in = inb(0x1f7)) & (0x80 | 0x40)) != 0x40)
    ;
  if (checkerr && (in & (0x20 | 0x01)) != 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<idewait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x1f7,%edi
call   1030 <inb@plt>
mov    %eax,-0xc(%rbp)
and    $0xc0,%eax
cmp    $0x40,%eax
je     113b <idewait+0x2b>
jmp    111b <idewait+0xb>
cmpl   $0x0,-0x8(%rbp)
je     1160 <idewait+0x50>
mov    -0xc(%rbp),%eax
and    $0x21,%eax
cmp    $0x0,%eax
je     1160 <idewait+0x50>
movl   $0xffffffff,-0x4(%rbp)
jmp    1167 <idewait+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idewait>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1f7,%edi
call   1030 <inb@plt>
mov    %eax,%ecx
and    $0xc0,%ecx
cmp    $0x40,%ecx
jne    1120 <idewait+0x10>
test   %ebx,%ebx
setne  %cl
test   $0x21,%al
setne  %al
and    %cl,%al
movzbl %al,%eax
neg    %eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @idewait(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
br label %5
5: ; preds = %9, %1
%6 = call i32 @inb(i32 503)
store i32 %6, i32* %4
%7 = and i32 %6, 192
%8 = icmp ne i32 %7, 64
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* %4
%15 = and i32 %14, 33
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 -1, i32* %2
br label %19
18: ; preds = %13, %10
store i32 0, i32* %2
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @idewait(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @inb(i32 503)
%4 = and i32 %3, 192
%5 = icmp eq i32 %4, 64
br i1 %5, label %6, label %2
6: ; preds = %2
%7 = icmp ne i32 %0, 0
%8 = and i32 %3, 33
%9 = icmp ne i32 %8, 0
%10 = select i1 %7, i1 %9, i1 false
%11 = sext i1 %10 to i32
ret i32 %11
}
short int kernel__Float___60d_61d(double self, double p0) {
  short int var;
  short int var1;
  var1 = self <= p0;
  var = var1;
  goto RET_LABEL;
RET_LABEL:;
  return var;
}


x86 assembly (clang, -O0):
<kernel__Float___60d_61d>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
mov    %ax,-0x14(%rbp)
mov    -0x14(%rbp),%ax
mov    %ax,-0x12(%rbp)
movswl -0x12(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel__Float___60d_61d>:
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setae  %al
ret

LLVM IR (-O0):
define signext i16 @kernel__Float___60d_61d(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i16
%6 = alloca i16
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fcmp ole double %7, %8
%10 = zext i1 %9 to i32
%11 = trunc i32 %10 to i16
store i16 %11, i16* %6
%12 = load i16, i16* %6
store i16 %12, i16* %5
br label %13
13: ; preds = %2
%14 = load i16, i16* %5
ret i16 %14
}

LLVM IR (-O2):
define signext i16 @kernel__Float___60d_61d(double %0, double %1) {
%3 = fcmp ole double %0, %1
%4 = zext i1 %3 to i16
ret i16 %4
}