xunge/DecIR huggingface dataset:
/* Variables and functions */
int COLOR_PAIR(int);
int get_color_pair(int pair) { return COLOR_PAIR(pair); }


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

x86 assembly (clang, -O2):
<get_color_pair>:
jmp    1030 <COLOR_PAIR@plt>

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

LLVM IR (-O2):
define i32 @get_color_pair(i32 %0) {
%2 = tail call i32 @COLOR_PAIR(i32 %0)
ret i32 %2
}
int test5(int x) {
  int y = 0x80000000;
  return x + y;
}


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x80000000,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5>:
mov    %edi,%eax
or     $0x80000000,%eax
ret

LLVM IR (-O0):
define i32 @test5(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 -2147483648, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = add nsw i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @test5(i32 %0) {
%2 = or i32 %0, -2147483648
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ junk();
illname() {
  error("illegal symbol name");
  junk();
}


x86 assembly (clang, -O0):
<illname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <error@plt>
mov    $0x0,%al
call   1030 <junk@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<illname>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <error@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <junk@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"illegal symbol name\00"
define i32 @illname() {
%1 = alloca i32
%2 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @junk()
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [20 x i8] c"illegal symbol name\00"
define i32 @illname() {
%1 = tail call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @junk()
ret i32 undef
}
void test_common_args_ptrlen(char *ptr) {}


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

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

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

LLVM IR (-O2):
define void @test_common_args_ptrlen(i8* nocapture %0) {
ret void
}
unsigned long long rdmsr(unsigned index) {
  unsigned long long value;
  asm volatile("rdmsr" : "=A"(value) : "c"(index));
  return value;
}


x86 assembly (clang, -O0):
<rdmsr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
rdmsr
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdmsr>:
mov    %edi,%ecx
rdmsr
ret

LLVM IR (-O0):
define i64 @rdmsr(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 asm sideeffect "rdmsr", "=A,{cx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @rdmsr(i32 %0) {
%2 = tail call i64 asm sideeffect "rdmsr", "=A,{cx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i64 %2
}
void cpu_relax(void) { asm("pause" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @cpu_relax() {
tail call void asm sideeffect "pause", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
double multiply(double a, double b, double c) { return a * b * c; }


x86 assembly (clang, -O0):
<multiply>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply>:
mulsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @multiply(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fmul double %7, %8
%10 = load double, double* %6
%11 = fmul double %9, %10
ret double %11
}

LLVM IR (-O2):
define double @multiply(double %0, double %1, double %2) {
%4 = fmul double %0, %1
%5 = fmul double %4, %2
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ __get_cpuid(int, unsigned int *, unsigned int *,
                               unsigned int *, unsigned int *);
int /*<<< orphan*/ do_test();
int main() {
  unsigned int eax, ebx, ecx, edx;
  if (!__get_cpuid(1, &eax, &ebx, &ecx, &edx))
    return 0;
  if ((ecx & ((1 << 28) | (1 << 25))) == ((1 << 28) | (1 << 25))) {
    do_test();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <__get_cpuid@plt>
cmp    $0x0,%eax
jne    115e <main+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    117f <main+0x5f>
mov    -0x10(%rbp),%eax
and    $0x12000000,%eax
cmp    $0x12000000,%eax
jne    1178 <main+0x58>
mov    $0x0,%al
call   1040 <do_test@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    $0x1,%edi
call   1030 <__get_cpuid@plt>
test   %eax,%eax
je     115a <main+0x3a>
mov    0x8(%rsp),%eax
not    %eax
test   $0x12000000,%eax
jne    115a <main+0x3a>
xor    %eax,%eax
call   1040 <do_test@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @__get_cpuid(i32 1, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = icmp eq i32 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %0
%12 = load i32, i32* %3
%13 = and i32 %12, 301989888
%14 = icmp eq i32 %13, 301989888
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 (...) @do_test()
br label %17
17: ; preds = %11, %15, %0
ret i32 0
}
void menu_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @menu_exit() {
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int celcon_retrieve_mixed_cell(int n, int r, int i, int labels[],
                               double *normal) {
  int fail;
  fail = _ada_use_c2phc(95, &i, labels, normal);
  return fail;
}


x86 assembly (clang, -O0):
<celcon_retrieve_mixed_cell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x5f,%edi
lea    -0xc(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<celcon_retrieve_mixed_cell>:
push   %rax
mov    %edx,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x5f,%edi
mov    %rcx,%rdx
mov    %r8,%rcx
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @celcon_retrieve_mixed_cell(i32 %0, i32 %1, i32 %2, i32* %3, double* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca double*
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store double* %4, double** %10
%12 = load i32*, i32** %9
%13 = load double*, double** %10
%14 = call i32 @_ada_use_c2phc(i32 95, i32* %8, i32* %12, double* %13)
store i32 %14, i32* %11
%15 = load i32, i32* %11
ret i32 %15
}

LLVM IR (-O2):
define i32 @celcon_retrieve_mixed_cell(i32 %0, i32 %1, i32 %2, i32* %3, double* %4) {
%6 = alloca i32
store i32 %2, i32* %6
%7 = call i32 @_ada_use_c2phc(i32 95, i32* %6, i32* %3, double* %4)
ret i32 %7
}
/* Type definitions */
struct cec_msg {
  int len;
  int /*<<< orphan*/ *msg;
};
typedef int /*<<< orphan*/ __u8;

/* Variables and functions */
int /*<<< orphan*/ CEC_MSG_DECK_STATUS;
void cec_msg_deck_status(struct cec_msg *msg, __u8 deck_info) {
  msg->len = 3;
  msg->msg[1] = CEC_MSG_DECK_STATUS;
  msg->msg[2] = deck_info;
}


x86 assembly (clang, -O0):
<cec_msg_deck_status>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x3,(%rax)
mov    0x2ecc(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_deck_status>:
movl   $0x3,(%rdi)
mov    0x2edb(%rip),%rax
mov    (%rax),%eax
mov    0x8(%rdi),%rcx
mov    %eax,0x4(%rcx)
mov    %esi,0x8(%rcx)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_DECK_STATUS = global i32 0
define void @cec_msg_deck_status(%struct.cec_msg* %0, i32 %1) {
%3 = alloca %struct.cec_msg*
%4 = alloca i32
store %struct.cec_msg* %0, %struct.cec_msg** %3
store i32 %1, i32* %4
%5 = load %struct.cec_msg*, %struct.cec_msg** %3
%6 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %5, i32 0, i32 0
store i32 3, i32* %6
%7 = load i32, i32* @CEC_MSG_DECK_STATUS
%8 = load %struct.cec_msg*, %struct.cec_msg** %3
%9 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %8, i32 0, i32 1
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 %7, i32* %11
%12 = load i32, i32* %4
%13 = load %struct.cec_msg*, %struct.cec_msg** %3
%14 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %13, i32 0, i32 1
%15 = load i32*, i32** %14
%16 = getelementptr inbounds i32, i32* %15, i64 2
store i32 %12, i32* %16
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_DECK_STATUS = global i32 0
define void @cec_msg_deck_status(%struct.cec_msg* nocapture %0, i32 %1) {
%3 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
store i32 3, i32* %3
%4 = load i32, i32* @CEC_MSG_DECK_STATUS
%5 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 1
%6 = load i32*, i32** %5
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %4, i32* %7
%8 = getelementptr inbounds i32, i32* %6, i64 2
store i32 %1, i32* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  printf("total cells: %d\n", ((1 << 16) / 48) / 16);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x55,%esi
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    $0x55,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"total cells: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 85)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"total cells: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 85)
ret i32 0
}
main() {
  struct {
    int x : 4, y : 4;
  } a = {.y = 1};
  return *(char *)&a;
}


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

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

LLVM IR (-O0):
%struct.anon = type { i8, [3 x i8] }
@__const.main.a = %struct.anon { i8 16, [3 x i8] undef }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.anon
store i32 0, i32* %1
%3 = bitcast %struct.anon* %2 to i8*
%4 = bitcast %struct.anon* %2 to i8*
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @main() {
ret i32 16
}
int do_953() { return 953; }


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

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

LLVM IR (-O0):
define i32 @do_953() {
ret i32 953
}

LLVM IR (-O2):
define i32 @do_953() {
ret i32 953
}
unsigned int tegra_throttle_governor_speed(unsigned int requested_speed) {
  return requested_speed;
}


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

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

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

LLVM IR (-O2):
define i32 @tegra_throttle_governor_speed(i32 returned %0) {
ret i32 %0
}
void NupAndDownFast(void) {
  do {
    *((unsigned int *)0xC000A040) &= ~(1 << 0);
    asm volatile("nop");
  } while (0);
  do {
    asm volatile("nop");
    *((unsigned int *)0xC000A040) |= (1 << 0);
  } while (0);
}


x86 assembly (clang, -O0):
<NupAndDownFast>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <NupAndDownFast+0x9>
mov    $0xc000a040,%eax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    $0xc000a040,%eax
mov    %ecx,(%rax)
nop
jmp    1120 <NupAndDownFast+0x20>
nop
mov    $0xc000a040,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0xc000a040,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<NupAndDownFast>:
mov    $0xc000a040,%eax
andb   $0xfe,(%rax)
nop
nop
orb    $0x1,(%rax)
ret

LLVM IR (-O0):
define void @NupAndDownFast() {
br label %1
1: ; preds = %0
%2 = load i32, i32* inttoptr (i64 3221266496 to i32*)
%3 = and i32 %2, -2
store i32 %3, i32* inttoptr (i64 3221266496 to i32*)
br label %4
4: ; preds = %1
br label %5
5: ; preds = %4
%6 = load i32, i32* inttoptr (i64 3221266496 to i32*)
%7 = or i32 %6, 1
store i32 %7, i32* inttoptr (i64 3221266496 to i32*)
br label %8
8: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @NupAndDownFast() {
%1 = load i32, i32* inttoptr (i64 3221266496 to i32*)
%2 = and i32 %1, -2
store i32 %2, i32* inttoptr (i64 3221266496 to i32*)
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
%3 = load i32, i32* inttoptr (i64 3221266496 to i32*)
%4 = or i32 %3, 1
store i32 %4, i32* inttoptr (i64 3221266496 to i32*)
ret void
}
/* Variables and functions */
int validate_repository_url(const char *url) {
  if (url == NULL) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<validate_repository_url>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <validate_repository_url+0x1f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1126 <validate_repository_url+0x26>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_repository_url>:
cmp    $0x1,%rdi
sbb    %eax,%eax
ret

LLVM IR (-O0):
define i32 @validate_repository_url(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 -1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @validate_repository_url(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ARRAY_NELEMS(char *);
char *strerror_l(int, char *, int /*<<< orphan*/);
char *strerror(int errnum) {
  static char strerr[32];
  return strerror_l(errnum, strerr, ARRAY_NELEMS(strerr));
}


x86 assembly (clang, -O0):
<strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0x2f08(%rip),%rdi
call   1030 <ARRAY_NELEMS@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%edx
lea    0x2ef7(%rip),%rsi
call   1040 <strerror_l@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strerror>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x2f13(%rip),%r14
mov    %r14,%rdi
call   1030 <ARRAY_NELEMS@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strerror_l@plt>

LLVM IR (-O0):
@strerror.strerr = internal global [32 x i8] zeroinitializer
define i8* @strerror(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @ARRAY_NELEMS(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strerror.strerr, i64 0, i64 0))
%5 = call i8* @strerror_l(i32 %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strerror.strerr, i64 0, i64 0), i32 %4)
ret i8* %5
}

LLVM IR (-O2):
@strerror.strerr = internal global [32 x i8] zeroinitializer
define i8* @strerror(i32 %0) {
%2 = tail call i32 @ARRAY_NELEMS(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strerror.strerr, i64 0, i64 0))
%3 = tail call i8* @strerror_l(i32 %0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strerror.strerr, i64 0, i64 0), i32 %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void f2() { abort(); }


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

x86 assembly (clang, -O2):
<f2>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @f2() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @f2() {
%1 = tail call i32 (...) @abort()
unreachable
}
unsigned int _fmix32(unsigned int h) {
  h ^= h >> 16;
  h *= 0x85ebca6b;
  h ^= h >> 13;
  h *= 0xc2b2ae35;
  h ^= h >> 16;
  return h;
}


x86 assembly (clang, -O0):
<_fmix32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
imul   $0x85ebca6b,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0xd,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
imul   $0xc2b2ae35,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fmix32>:
mov    %edi,%eax
shr    $0x10,%eax
xor    %edi,%eax
imul   $0x85ebca6b,%eax,%eax
mov    %eax,%ecx
shr    $0xd,%ecx
xor    %eax,%ecx
imul   $0xc2b2ae35,%ecx,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @_fmix32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 16
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = mul i32 %7, -2048144789
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = lshr i32 %9, 13
%11 = load i32, i32* %2
%12 = xor i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = mul i32 %13, -1028477387
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = lshr i32 %15, 16
%17 = load i32, i32* %2
%18 = xor i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @_fmix32(i32 %0) {
%2 = lshr i32 %0, 16
%3 = xor i32 %2, %0
%4 = mul i32 %3, -2048144789
%5 = lshr i32 %4, 13
%6 = xor i32 %5, %4
%7 = mul i32 %6, -1028477387
%8 = lshr i32 %7, 16
%9 = xor i32 %8, %7
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ bubble_sort(int *, int);
int /*<<< orphan*/ print_arr(int *, int);
int main() {
  int arr[10] = {8, 4, 6, 9, 0, -1, 5, -7, 10, -3};
  print_arr(arr, 10);
  bubble_sort(arr, 10);
  print_arr(arr, 10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <print_arr@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1050 <bubble_sort@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <print_arr@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <print_arr@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <bubble_sort@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <print_arr@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [10 x i32] [i32 8, i32 4, i32 6, i32 9, i32 0, i32 -1, i32 5, i32 -7, i32 10, i32 -3]
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @print_arr(i32* %3, i32 10)
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = call i32 @bubble_sort(i32* %5, i32 10)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%8 = call i32 @print_arr(i32* %7, i32 10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [10 x i32] [i32 8, i32 4, i32 6, i32 9, i32 0, i32 -1, i32 5, i32 -7, i32 10, i32 -3]
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @print_arr(i32* %3, i32 10)
%5 = call i32 @bubble_sort(i32* %3, i32 10)
%6 = call i32 @print_arr(i32* %3, i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ MaskPlanes(int);
void EnableAllPlanes(void) { MaskPlanes(0xF); }


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

x86 assembly (clang, -O2):
<EnableAllPlanes>:
mov    $0xf,%edi
jmp    1030 <MaskPlanes@plt>

LLVM IR (-O0):
define void @EnableAllPlanes() {
%1 = call i32 @MaskPlanes(i32 15)
ret void
}

LLVM IR (-O2):
define void @EnableAllPlanes() {
%1 = tail call i32 @MaskPlanes(i32 15)
ret void
}
bar() { return 1; }


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

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

LLVM IR (-O0):
define i32 @bar() {
ret i32 1
}

LLVM IR (-O2):
define i32 @bar() {
ret i32 1
}
/* Type definitions */
struct menuentry {
  int dummy;
};
struct menu {
  int dummy;
};

/* Variables and functions */
struct menuentry *menuentry_newwithvalue(struct menu *, char *, char, int,
                                         int /*<<< orphan*/ *);
struct menuentry *menuentry_new(struct menu *pmenu, char *text, char key,
                                int flags) {
  return menuentry_newwithvalue(pmenu, text, key, flags, NULL);
}


x86 assembly (clang, -O0):
<menuentry_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x11(%rbp),%al
mov    -0x18(%rbp),%ecx
xor    %edx,%edx
mov    %edx,%r8d
movsbl %al,%edx
call   1030 <menuentry_newwithvalue@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menuentry_new>:
xor    %r8d,%r8d
jmp    1030 <menuentry_newwithvalue@plt>

LLVM IR (-O0):
%struct.menuentry = type { i32 }
%struct.menu = type { i32 }
define %struct.menuentry* @menuentry_new(%struct.menu* %0, i8* %1, i8 signext %2, i32 %3) {
%5 = alloca %struct.menu*
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i32
store %struct.menu* %0, %struct.menu** %5
store i8* %1, i8** %6
store i8 %2, i8* %7
store i32 %3, i32* %8
%9 = load %struct.menu*, %struct.menu** %5
%10 = load i8*, i8** %6
%11 = load i8, i8* %7
%12 = load i32, i32* %8
%13 = call %struct.menuentry* @menuentry_newwithvalue(%struct.menu* %9, i8* %10, i8 signext %11, i32 %12, i32* null)
ret %struct.menuentry* %13
}

LLVM IR (-O2):
%struct.menuentry = type { i32 }
%struct.menu = type { i32 }
define %struct.menuentry* @menuentry_new(%struct.menu* %0, i8* %1, i8 signext %2, i32 %3) {
%5 = tail call %struct.menuentry* @menuentry_newwithvalue(%struct.menu* %0, i8* %1, i8 signext %2, i32 %3, i32* null)
ret %struct.menuentry* %5
}
/* Variables and functions */
double g(double);
double f(double a, double b) { return g(g(a) + g(b)); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <g@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <g@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm0
call   1030 <g@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
call   1030 <g@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <g@plt>
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
jmp    1030 <g@plt>

LLVM IR (-O0):
define double @f(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call double @g(double %5)
%7 = load double, double* %4
%8 = call double @g(double %7)
%9 = fadd double %6, %8
%10 = call double @g(double %9)
ret double %10
}

LLVM IR (-O2):
define double @f(double %0, double %1) {
%3 = tail call double @g(double %0)
%4 = tail call double @g(double %1)
%5 = fadd double %3, %4
%6 = tail call double @g(double %5)
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ _clear_error_stack();
int _set_cache_permissions(unsigned long);
int set_cache_permissions(unsigned long flags) {
  { _clear_error_stack(); };
  return (_set_cache_permissions(flags));
}


x86 assembly (clang, -O0):
<set_cache_permissions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <_clear_error_stack@plt>
mov    -0x8(%rbp),%rdi
call   1030 <_set_cache_permissions@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_cache_permissions>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <_clear_error_stack@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <_set_cache_permissions@plt>

LLVM IR (-O0):
define i32 @set_cache_permissions(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 (...) @_clear_error_stack()
%4 = load i64, i64* %2
%5 = call i32 @_set_cache_permissions(i64 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @set_cache_permissions(i64 %0) {
%2 = tail call i32 (...) @_clear_error_stack()
%3 = tail call i32 @_set_cache_permissions(i64 %0)
ret i32 %3
}
void XConvertSelection() {}


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

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

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

LLVM IR (-O2):
define void @XConvertSelection() {
ret void
}
/* Variables and functions */
scalar_t__ _gettemp(char *, int *, int, int /*<<< orphan*/);
char *mkdtemp(char *path) {
  return (_gettemp(path, (int *)NULL, 1, 0) ? path : (char *)NULL);
}


x86 assembly (clang, -O0):
<mkdtemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <_gettemp@plt>
cmp    $0x0,%rax
je     1147 <mkdtemp+0x37>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1152 <mkdtemp+0x42>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1152 <mkdtemp+0x42>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkdtemp>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <_gettemp@plt>
test   %rax,%rax
cmovne %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @mkdtemp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @_gettemp(i8* %3, i32* null, i32 1, i32 0)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i8*, i8** %2
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %6
%10 = phi i8* [ %7, %6 ], [ null, %8 ]
ret i8* %10
}

LLVM IR (-O2):
define i8* @mkdtemp(i8* %0) {
%2 = tail call i64 @_gettemp(i8* %0, i32* null, i32 1, i32 0)
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8* null, i8* %0
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getLastError();
void *loadSymbol(void *, char const *);
int /*<<< orphan*/ stderr;
void checkLoading(void *handle, void *funcPtr, const char *libKey) {
  funcPtr = loadSymbol(handle, libKey);
  char *err = getLastError();
  if (err != NULL) {
    fprintf(stderr, "\033[31m%s\033[00m\n", err);
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<checkLoading>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <loadSymbol@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <getLastError@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     119e <checkLoading+0x5e>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe71(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkLoading>:
push   %rax
mov    %rdx,%rsi
call   1030 <loadSymbol@plt>
xor    %eax,%eax
call   1060 <getLastError@plt>
test   %rax,%rax
jne    1157 <checkLoading+0x17>
pop    %rax
ret
mov    0x2e82(%rip),%rcx
mov    (%rcx),%edi
lea    0xe99(%rip),%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"\1B[31m%s\1B[00m\0A\00"
define void @checkLoading(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %6
%10 = call i8* @loadSymbol(i8* %8, i8* %9)
store i8* %10, i8** %5
%11 = call i8* (...) @getLastError()
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %19
14: ; preds = %3
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %7
%17 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %3
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"\1B[31m%s\1B[00m\0A\00"
define void @checkLoading(i8* %0, i8* nocapture readnone %1, i8* %2) {
%4 = tail call i8* @loadSymbol(i8* %0, i8* %2)
%5 = tail call i8* (...) @getLastError()
%6 = icmp eq i8* %5, null
br i1 %6, label %11, label %7
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %5)
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %3
ret void
}
/* Variables and functions */
char *greeter_allocate(char *, char const *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
char *greeter_sayhello(const char *name) {
  char *str = greeter_allocate("Hello, %s!", name);
  sprintf(str, "Hello, %s!", name);
  return str;
}


x86 assembly (clang, -O0):
<greeter_sayhello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <greeter_allocate@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeb1(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<greeter_sayhello>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xed1(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <greeter_allocate@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Hello, %s!\00"
define i8* @greeter_sayhello(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @greeter_allocate(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i8*, i8** %2
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
@.str = [11 x i8] c"Hello, %s!\00"
define i8* @greeter_sayhello(i8* %0) {
%2 = tail call i8* @greeter_allocate(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ milli_delay(int);
int /*<<< orphan*/ printf_A(char *, int);
void TestA() {
  int i = 0;
  while (1) {
    for (i = 0; i < 100; i++) {
      printf_A("%x ", i);
      milli_delay(1000);
    }
  }
}


x86 assembly (clang, -O0):
<TestA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    1167 <TestA+0x47>
mov    -0x4(%rbp),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf_A@plt>
mov    $0x3e8,%edi
call   1040 <milli_delay@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1136 <TestA+0x16>
jmp    112f <TestA+0xf>

x86 assembly (clang, -O2):
<TestA>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rbx
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <printf_A@plt>
mov    $0x3e8,%edi
call   1040 <milli_delay@plt>
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    1140 <TestA+0x20>
jmp    1130 <TestA+0x10>

LLVM IR (-O0):
@.str = [4 x i8] c"%x \00"
define void @TestA() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %13
store i32 0, i32* %1
br label %3
3: ; preds = %10, %2
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %1
%8 = call i32 @printf_A(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @milli_delay(i32 1000)
br label %10
10: ; preds = %6
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %3
13: ; preds = %3
br label %2
}

LLVM IR (-O2):
@.str = [4 x i8] c"%x \00"
define void @TestA() {
br label %1
1: ; preds = %2, %0
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 0, %1 ], [ %6, %2 ]
%4 = tail call i32 @printf_A(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @milli_delay(i32 1000)
%6 = add nuw nsw i32 %3, 1
%7 = icmp eq i32 %6, 100
br i1 %7, label %1, label %2
}
unsigned int test_eq_uint(unsigned int a, unsigned int b) {
  if (a != b)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<test_eq_uint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1122 <test_eq_uint+0x22>
movl   $0x1,-0x4(%rbp)
jmp    1129 <test_eq_uint+0x29>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_eq_uint>:
xor    %eax,%eax
cmp    %esi,%edi
setne  %al
ret

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

LLVM IR (-O2):
define i32 @test_eq_uint(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
main() {
  double base = 11.5, altura = 3.0, area = 0.0;
  area = base * altura / 2;
  printf("Area = %g\n", area);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  0xef0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xeb4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Area = %g\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
store double 1.150000e+01, double* %1
store double 3.000000e+00, double* %2
store double 0.000000e+00, double* %3
%4 = load double, double* %1
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = fdiv double %6, 2.000000e+00
store double %7, double* %3
%8 = load double, double* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Area = %g\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double 1.725000e+01)
ret i32 0
}
/* Variables and functions */
int rand();
int random_int(int max) { return (rand() % max) + 1; }


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

x86 assembly (clang, -O2):
<random_int>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
lea    0x1(%rdx),%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @random_int(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
%4 = add nsw i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ test_material();
int /*<<< orphan*/ test_simple();
int /*<<< orphan*/ test_teapot();
int /*<<< orphan*/ test_teddy();
int main(void) {
  test_material();
  ;
  test_simple();
  ;
  test_teapot();
  ;
  test_teddy();
  ;
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_material@plt>
xor    %eax,%eax
call   1060 <test_simple@plt>
xor    %eax,%eax
call   1050 <test_teapot@plt>
xor    %eax,%eax
call   1040 <test_teddy@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_material()
%3 = call i32 (...) @test_simple()
%4 = call i32 (...) @test_teapot()
%5 = call i32 (...) @test_teddy()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_material()
%2 = tail call i32 (...) @test_simple()
%3 = tail call i32 (...) @test_teapot()
%4 = tail call i32 (...) @test_teddy()
ret i32 0
}
void RTTestValueF(void) {}


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

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

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

LLVM IR (-O2):
define void @RTTestValueF() {
ret void
}
int gdc_req_cmd(int cmd, void *param) {
  unsigned int *syscall_bc = (unsigned int *)0x8c0000bc;
  int (*syscall)() = (int (*)())(*syscall_bc);
  return syscall((cmd), (param), 0, (0));
  ;
}


x86 assembly (clang, -O0):
<gdc_req_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x8c0000bc,%eax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%r8
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
mov    $0x0,%al
call   *%r8
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdc_req_cmd>:
mov    $0x8c0000bc,%eax
mov    (%rax),%r8d
xor    %edx,%edx
xor    %ecx,%ecx
xor    %eax,%eax
jmp    *%r8

LLVM IR (-O0):
define i32 @gdc_req_cmd(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32 (...)*
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32* inttoptr (i64 2348810428 to i32*), i32** %5
%7 = load i32*, i32** %5
%8 = load i32, i32* %7
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i32 (...)*
store i32 (...)* %10, i32 (...)** %6
%11 = load i32 (...)*, i32 (...)** %6
%12 = load i32, i32* %3
%13 = load i8*, i8** %4
%14 = bitcast i32 (...)* %11 to i32 (i32, i8*, i32, i32, ...)*
%15 = call i32 (i32, i8*, i32, i32, ...) %14(i32 %12, i8* %13, i32 0, i32 0)
ret i32 %15
}

LLVM IR (-O2):
define i32 @gdc_req_cmd(i32 %0, i8* %1) {
%3 = load i32, i32* inttoptr (i64 2348810428 to i32*)
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32 (i32, i8*, i32, i32, ...)*
%6 = tail call i32 (i32, i8*, i32, i32, ...) %5(i32 %0, i8* %1, i32 0, i32 0)
ret i32 %6
}
/* Variables and functions */
void *fz_malloc(unsigned int);
void *zmalloc(void *opaque, unsigned int items, unsigned int size) {
  return fz_malloc(items * size);
}


x86 assembly (clang, -O0):
<zmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
imul   -0x10(%rbp),%edi
call   1030 <fz_malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zmalloc>:
mov    %esi,%edi
imul   %edx,%edi
jmp    1030 <fz_malloc@plt>

LLVM IR (-O0):
define i8* @zmalloc(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = mul i32 %7, %8
%10 = call i8* @fz_malloc(i32 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @zmalloc(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = mul i32 %2, %1
%5 = tail call i8* @fz_malloc(i32 %4)
ret i8* %5
}
void NV21ToYUV24() {}


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

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

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

LLVM IR (-O2):
define void @NV21ToYUV24() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ stdin;
int vfscanf(int /*<<< orphan*/, char const *, int /*<<< orphan*/);
int vscanf(const char *fmt, va_list ap) { return vfscanf(stdin, fmt, ap); }


x86 assembly (clang, -O0):
<vscanf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <vfscanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vscanf>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ecc(%rip),%rax
mov    (%rax),%edi
jmp    1030 <vfscanf@plt>

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

LLVM IR (-O2):
@stdin = global i32 0
define i32 @vscanf(i8* %0, i32 %1) {
%3 = load i32, i32* @stdin
%4 = tail call i32 @vfscanf(i32 %3, i8* %0, i32 %1)
ret i32 %4
}
/* Variables and functions */
bool sancus_get_frf(double v, double a, double b, double *out) {
  if ((v >= a) && (v <= b)) {
    if (out != NULL)
      *out = (double)v;
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<sancus_get_frf>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     115f <sancus_get_frf+0x5f>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     115f <sancus_get_frf+0x5f>
cmpq   $0x0,-0x28(%rbp)
je     1153 <sancus_get_frf+0x53>
movsd  -0x10(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1166 <sancus_get_frf+0x66>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sancus_get_frf>:
xor    %eax,%eax
ucomisd %xmm1,%xmm0
jb     111c <sancus_get_frf+0x1c>
ucomisd %xmm0,%xmm2
jb     111c <sancus_get_frf+0x1c>
mov    $0x1,%eax
test   %rdi,%rdi
je     111c <sancus_get_frf+0x1c>
movsd  %xmm0,(%rdi)
ret

LLVM IR (-O0):
define i32 @sancus_get_frf(double %0, double %1, double %2, double* %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double*
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double* %3, double** %9
%10 = load double, double* %6
%11 = load double, double* %7
%12 = fcmp oge double %10, %11
br i1 %12, label %13, label %24
13: ; preds = %4
%14 = load double, double* %6
%15 = load double, double* %8
%16 = fcmp ole double %14, %15
br i1 %16, label %17, label %24
17: ; preds = %13
%18 = load double*, double** %9
%19 = icmp ne double* %18, null
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load double, double* %6
%22 = load double*, double** %9
store double %21, double* %22
br label %23
23: ; preds = %20, %17
store i32 1, i32* %5
br label %25
24: ; preds = %13, %4
store i32 0, i32* %5
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %5
ret i32 %26
}

LLVM IR (-O2):
define i32 @sancus_get_frf(double %0, double %1, double %2, double* writeonly %3) {
%5 = fcmp ult double %0, %1
%6 = fcmp ugt double %0, %2
%7 = or i1 %5, %6
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = icmp eq double* %3, null
br i1 %9, label %11, label %10
10: ; preds = %8
store double %0, double* %3
br label %11
11: ; preds = %4, %8, %10
%12 = phi i32 [ 1, %10 ], [ 1, %8 ], [ 0, %4 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void vmir_vm_ret64(void *ret, uint64_t v) { *(uint64_t *)ret = v; }


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

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

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

LLVM IR (-O2):
define void @vmir_vm_ret64(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}