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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stdout;
void __create_print_1(void *cc, void *k, void *v) {
  fprintf(stdout, "(%u,%u)\n", *(uint32_t *)k, *(uint32_t *)v);
  if (cc) {
    (*(size_t *)cc)++;
  }
}


x86 assembly (clang, -O0):
<__create_print_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
cmpq   $0x0,-0x8(%rbp)
je     115e <__create_print_1+0x4e>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__create_print_1>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%eax
mov    (%rdx),%ecx
lea    0xed8(%rip),%rsi
mov    %eax,%edx
call   1030 <fprintf@plt>
test   %rbx,%rbx
je     1138 <__create_print_1+0x28>
addq   $0x1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [9 x i8] c"(%u,%u)\0A\00"
define void @__create_print_1(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* @stdout
%8 = load i8*, i8** %5
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = load i8*, i8** %6
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
%14 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %13)
%15 = load i8*, i8** %4
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %22
17: ; preds = %3
%18 = load i8*, i8** %4
%19 = bitcast i8* %18 to i64*
%20 = load i64, i64* %19
%21 = add i64 %20, 1
store i64 %21, i64* %19
br label %22
22: ; preds = %17, %3
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [9 x i8] c"(%u,%u)\0A\00"
define void @__create_print_1(i8* %0, i8* nocapture %1, i8* nocapture %2) {
%4 = load i32, i32* @stdout
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = bitcast i8* %2 to i32*
%8 = load i32, i32* %7
%9 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8)
%10 = icmp eq i8* %0, null
br i1 %10, label %15, label %11
11: ; preds = %3
%12 = bitcast i8* %0 to i64*
%13 = load i64, i64* %12
%14 = add i64 %13, 1
store i64 %14, i64* %12
br label %15
15: ; preds = %11, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128;

/* Variables and functions */
int /*<<< orphan*/ _mm_sqrt_ps(int /*<<< orphan*/);
__m128 test_mm_sqrt_ps(__m128 x) { return _mm_sqrt_ps(x); }


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

x86 assembly (clang, -O2):
<test_mm_sqrt_ps>:
jmp    1030 <_mm_sqrt_ps@plt>

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

LLVM IR (-O2):
define i32 @test_mm_sqrt_ps(i32 %0) {
%2 = tail call i32 @_mm_sqrt_ps(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ CounterToLocalTimeC__0__Counter__overflow();
int /*<<< orphan*/ TransformAlarmC__0__Counter__overflow();
void TransformCounterC__0__Counter__overflow(void) {
  TransformAlarmC__0__Counter__overflow();
  CounterToLocalTimeC__0__Counter__overflow();
}


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

x86 assembly (clang, -O2):
<TransformCounterC__0__Counter__overflow>:
push   %rax
xor    %eax,%eax
call   1040 <TransformAlarmC__0__Counter__overflow@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <CounterToLocalTimeC__0__Counter__overflow@plt>

LLVM IR (-O0):
define void @TransformCounterC__0__Counter__overflow() {
%1 = call i32 (...) @TransformAlarmC__0__Counter__overflow()
%2 = call i32 (...) @CounterToLocalTimeC__0__Counter__overflow()
ret void
}

LLVM IR (-O2):
define void @TransformCounterC__0__Counter__overflow() {
%1 = tail call i32 (...) @TransformAlarmC__0__Counter__overflow()
%2 = tail call i32 (...) @CounterToLocalTimeC__0__Counter__overflow()
ret void
}
/* Variables and functions */
int RAND_MAX;
int rand();
int rndm(int strt, int end) {
  return (int)((end - strt) * ((float)(rand() & 127) / (RAND_MAX & 127))) +
         strt;
}


x86 assembly (clang, -O0):
<rndm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movss  -0xc(%rbp),%xmm0
and    $0x7f,%eax
cvtsi2ss %eax,%xmm1
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
and    $0x7f,%eax
cvtsi2ss %eax,%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rndm>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
sub    %edi,%esi
cvtsi2ss %esi,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
and    $0x7f,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
and    $0x7f,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
mulss  0xc(%rsp),%xmm0
cvttss2si %xmm0,%eax
add    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @rndm(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = sub nsw i32 %5, %6
%8 = sitofp i32 %7 to float
%9 = call i32 (...) @rand()
%10 = and i32 %9, 127
%11 = sitofp i32 %10 to float
%12 = load i32, i32* @RAND_MAX
%13 = and i32 %12, 127
%14 = sitofp i32 %13 to float
%15 = fdiv float %11, %14
%16 = fmul float %8, %15
%17 = fptosi float %16 to i32
%18 = load i32, i32* %3
%19 = add nsw i32 %17, %18
ret i32 %19
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @rndm(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = sitofp i32 %3 to float
%5 = tail call i32 (...) @rand()
%6 = and i32 %5, 127
%7 = sitofp i32 %6 to float
%8 = load i32, i32* @RAND_MAX
%9 = and i32 %8, 127
%10 = sitofp i32 %9 to float
%11 = fdiv float %7, %10
%12 = fmul float %11, %4
%13 = fptosi float %12 to i32
%14 = add nsw i32 %13, %0
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ code;

/* Variables and functions */
int /*<<< orphan*/ __console_write(char const *, int);
void console_red() {
  static const char code[] = {0x1b, '[', '3', '1', ';', '0', '1', 'm'};
  __console_write(code, sizeof(code));
}


x86 assembly (clang, -O0):
<console_red>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x8,%esi
call   1030 <__console_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_red>:
lea    0xee9(%rip),%rdi
mov    $0x8,%esi
jmp    1030 <__console_write@plt>

LLVM IR (-O0):
@console_red.code = internal constant [8 x i8] c"\1B[31;01m"
define void @console_red() {
%1 = call i32 @__console_write(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @console_red.code, i64 0, i64 0), i32 8)
ret void
}

LLVM IR (-O2):
@console_red.code = internal constant [8 x i8] c"\1B[31;01m"
define void @console_red() {
%1 = tail call i32 @__console_write(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @console_red.code, i64 0, i64 0), i32 8)
ret void
}
/* Variables and functions */
int a_cas(int volatile *, int, int);
int a_fetch_or(volatile int *p, int v) {
  int old;
  do
    old = *p;
  while (a_cas(p, old, old | v) != old);
  return old;
}


x86 assembly (clang, -O0):
<a_fetch_or>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
or     -0xc(%rbp),%edx
call   1030 <a_cas@plt>
cmp    -0x10(%rbp),%eax
jne    111f <a_fetch_or+0xf>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_fetch_or>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%ebp
mov    %ebp,%edx
or     %r14d,%edx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <a_cas@plt>
cmp    %ebp,%eax
jne    1120 <a_fetch_or+0x10>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @a_fetch_or(i32* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = load volatile i32, i32* %0
%5 = or i32 %4, %1
%6 = tail call i32 @a_cas(i32* %0, i32 %4, i32 %5)
%7 = icmp eq i32 %6, %4
br i1 %7, label %8, label %3
8: ; preds = %3
ret i32 %4
}
void key_interrupt_init(void) {
  (*(volatile unsigned long *)0x7F008830) &=
      ~((0x3 << (0 * 2)) + (0x3 << (1 * 2)) + (0x3 << (2 * 2)) +
        (0x3 << (3 * 2)));
  (*(volatile unsigned long *)0x7F008830) |=
      ((2 << (0 * 2)) + (2 << (1 * 2)) + (2 << (2 * 2)) + (2 << (3 * 2)));
}


x86 assembly (clang, -O0):
<key_interrupt_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f008830,%eax
mov    (%rax),%rcx
and    $0xffffffffffffff00,%rcx
mov    $0x7f008830,%eax
mov    %rcx,(%rax)
mov    $0x7f008830,%eax
mov    (%rax),%rcx
or     $0xaa,%rcx
mov    $0x7f008830,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<key_interrupt_init>:
andq   $0xffffffffffffff00,0x7f008830
orq    $0xaa,0x7f008830
ret

LLVM IR (-O0):
define void @key_interrupt_init() {
%1 = load volatile i64, i64* inttoptr (i64 2130741296 to i64*)
%2 = and i64 %1, -256
store volatile i64 %2, i64* inttoptr (i64 2130741296 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 2130741296 to i64*)
%4 = or i64 %3, 170
store volatile i64 %4, i64* inttoptr (i64 2130741296 to i64*)
ret void
}

LLVM IR (-O2):
define void @key_interrupt_init() {
%1 = load volatile i64, i64* inttoptr (i64 2130741296 to i64*)
%2 = and i64 %1, -256
store volatile i64 %2, i64* inttoptr (i64 2130741296 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 2130741296 to i64*)
%4 = or i64 %3, 170
store volatile i64 %4, i64* inttoptr (i64 2130741296 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ OpticalFlowHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void OpticalFlowRequestUpdate() { UAVObjRequestUpdate(OpticalFlowHandle()); }


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

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

LLVM IR (-O0):
define void @OpticalFlowRequestUpdate() {
%1 = call i32 (...) @OpticalFlowHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @OpticalFlowRequestUpdate() {
%1 = tail call i32 (...) @OpticalFlowHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void module2_hello() { printf("module2_hello()\n"); }


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

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

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

LLVM IR (-O2):
@str = [16 x i8] c"module2_hello()\00"
define void @module2_hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
main() {
  int x[][2][3] = {

      1, 2, 3, 1, 2, 3,

      1, 2, 3, 1, 2, 3,
  };
  if (x[1][1][2] != 3)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
cmpl   $0x3,-0x14(%rbp)
je     1155 <main+0x35>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.x = [2 x [2 x [3 x i32]]] [[2 x [3 x i32]] [[3 x i32] [i32 1, i32 2, i32 3], [3 x i32] [i32 1, i32 2, i32 3]], [2 x [3 x i32]] [[3 x i32] [i32 1, i32 2, i32 3], [3 x i32] [i32 1, i32 2, i32 3]]]
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [2 x [3 x i32]]]
store i32 0, i32* %1
%3 = bitcast [2 x [2 x [3 x i32]]]* %2 to i8*
%4 = getelementptr inbounds [2 x [2 x [3 x i32]]], [2 x [2 x [3 x i32]]]* %2, i64 0, i64 1
%5 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %4, i64 0, i64 1
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 2
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int bitmap_size(int nr_bits) {
  int nr_long, nr_bytes;
  nr_long = (nr_bits + (sizeof(unsigned long) * 8) - 1) >>
            (sizeof(unsigned long) == 4 ? 5 : 6);
  nr_bytes = nr_long * sizeof(unsigned long);
  return nr_bytes;
}


x86 assembly (clang, -O0):
<bitmap_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
add    $0x40,%rax
sub    $0x1,%rax
shr    $0x6,%rax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_size>:
movslq %edi,%rcx
shl    $0x1a,%rcx
mov    $0xfc000000,%eax
add    %rcx,%rax
shr    $0x1d,%rax
and    $0xfffffff8,%eax
ret

LLVM IR (-O0):
define i32 @bitmap_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = add i64 %6, 64
%8 = sub i64 %7, 1
%9 = lshr i64 %8, 6
%10 = trunc i64 %9 to i32
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 8
%14 = trunc i64 %13 to i32
store i32 %14, i32* %4
%15 = load i32, i32* %4
ret i32 %15
}

LLVM IR (-O2):
define i32 @bitmap_size(i32 %0) {
%2 = sext i32 %0 to i64
%3 = shl nsw i64 %2, 26
%4 = add nsw i64 %3, 4227858432
%5 = ashr i64 %4, 29
%6 = trunc i64 %5 to i32
%7 = and i32 %6, -8
ret i32 %7
}
char *graphicsname(void) {
  static char name[] = "X11";
  return name;
}


x86 assembly (clang, -O0):
<graphicsname>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f15(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<graphicsname>:
lea    0x2f19(%rip),%rax
ret

LLVM IR (-O0):
@graphicsname.name = internal global [4 x i8] c"X11\00"
define i8* @graphicsname() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @graphicsname.name, i64 0, i64 0)
}

LLVM IR (-O2):
@graphicsname.name = internal global [4 x i8] c"X11\00"
define i8* @graphicsname() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @graphicsname.name, i64 0, i64 0)
}
/* Variables and functions */
double sqrt(int /*<<< orphan*/);
int /*<<< orphan*/ variance_mean(double *, double, int);
double standard_dev_mean(double *data, double mean, int n) {
  return sqrt(variance_mean(data, mean, n));
}


x86 assembly (clang, -O0):
<standard_dev_mean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%esi
call   1030 <variance_mean@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_dev_mean>:
push   %rax
call   1030 <variance_mean@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrt@plt>

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

LLVM IR (-O2):
define double @standard_dev_mean(double* %0, double %1, i32 %2) {
%4 = tail call i32 @variance_mean(double* %0, double %1, i32 %2)
%5 = tail call double @sqrt(i32 %4)
ret double %5
}
int test_imm_2Aint16_mem(short *val) {
  return ((*val) & (-0x2A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_2Aint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffffd6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_2Aint16_mem>:
movzwl (%rdi),%eax
test   $0xffd6,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_2Aint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -42
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int pthread_mutex_lock(int /*<<< orphan*/ *);
void mutex_lock(pthread_mutex_t *mutex) {
  int err = pthread_mutex_lock(mutex);
  if (err != 0) {
    perror("pthread_mutex_lock");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<mutex_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <pthread_mutex_lock@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116c <mutex_lock+0x3c>
lea    0xea7(%rip),%rdi
call   1030 <perror@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mutex_lock>:
push   %rax
call   1050 <pthread_mutex_lock@plt>
test   %eax,%eax
jne    113c <mutex_lock+0xc>
pop    %rax
ret
lea    0xebd(%rip),%rdi
call   1030 <perror@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"pthread_mutex_lock\00"
@EXIT_FAILURE = global i32 0
define void @mutex_lock(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @pthread_mutex_lock(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"pthread_mutex_lock\00"
@EXIT_FAILURE = global i32 0
define void @mutex_lock(i32* %0) {
%2 = tail call i32 @pthread_mutex_lock(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret void
}
/* Type definitions */
struct fields_buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct fields_buffer *);
void fields_buffer_free(void *source) {
  struct fields_buffer *self = source;
  free(self);
}


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

x86 assembly (clang, -O2):
<fields_buffer_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.fields_buffer = type { i32 }
define void @fields_buffer_free(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.fields_buffer*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.fields_buffer*
store %struct.fields_buffer* %5, %struct.fields_buffer** %3
%6 = load %struct.fields_buffer*, %struct.fields_buffer** %3
%7 = call i32 @free(%struct.fields_buffer* %6)
ret void
}

LLVM IR (-O2):
%struct.fields_buffer = type { i32 }
define void @fields_buffer_free(i8* nocapture %0) {
%2 = bitcast i8* %0 to %struct.fields_buffer*
%3 = tail call i32 @free(%struct.fields_buffer* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void cbc_print(unsigned char *str, int len) {
  int i;
  for (i = 0; i < len; i++)
    printf("%.02x", str[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<cbc_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <cbc_print+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <cbc_print+0x16>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbc_print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1158 <cbc_print+0x38>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <cbc_print+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%.02x\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @cbc_print(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.02x\00"
define void @cbc_print(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
float ceilf(float);
__attribute__((__weak__, __always___)) float softboundcets_ceilf(float x) {
  return ceilf(x);
}


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

x86 assembly (clang, -O2):
<softboundcets_ceilf>:
jmp    1030 <ceilf@plt>

LLVM IR (-O0):
define weak float @softboundcets_ceilf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @llvm.ceil.f32(float %3)
ret float %4
}

LLVM IR (-O2):
define weak float @softboundcets_ceilf(float %0) {
%2 = tail call float @llvm.ceil.f32(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void count_overload1(int p1) { printf("One param: %d\n", p1); }


x86 assembly (clang, -O0):
<count_overload1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [15 x i8] c"One param: %d\0A\00"
define void @count_overload1(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int countDigits(unsigned long n) {
  if (n == 0) {
    return 1;
  }
  int count = 0;
  while (n != 0) {
    count++;
    n /= 10;
  }
  return count;
}


x86 assembly (clang, -O0):
<countDigits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <countDigits+0x1f>
movl   $0x1,-0x4(%rbp)
jmp    1157 <countDigits+0x57>
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1151 <countDigits+0x51>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
jmp    1126 <countDigits+0x26>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<countDigits>:
test   %rdi,%rdi
je     1139 <countDigits+0x39>
xor    %ecx,%ecx
movabs $0xcccccccccccccccd,%rsi
cc cc cc
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ecx
mov    %rdi,%rax
mul    %rsi
shr    $0x3,%rdx
cmp    $0x9,%rdi
mov    %rdx,%rdi
ja     1120 <countDigits+0x20>
mov    %ecx,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @countDigits(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i64 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = udiv i64 %5, 10
%8 = icmp ult i64 %5, 10
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %6, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "set xx:xx:xx:xx:xx - where xx is between 0 - 255\n"
                  "get  - display mac address\n"
                  "help - display this message\n");
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [105 x i8] c"set xx:xx:xx:xx:xx - where xx is between 0 - 255\0Aget - display mac address\0Ahelp - display this message\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [105 x i8] c"set xx:xx:xx:xx:xx - where xx is between 0 - 255\0Aget - display mac address\0Ahelp - display this message\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ handle_error(char *);
void args_print_usage() {
  handle_error("Usage: ./cpareia -p project_file [-t max_threads]\n");
}


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

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

LLVM IR (-O0):
@.str = [51 x i8] c"Usage: ./cpareia -p project_file [-t max_threads]\0A\00"
define void @args_print_usage() {
%1 = call i32 @handle_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"Usage: ./cpareia -p project_file [-t max_threads]\0A\00"
define void @args_print_usage() {
%1 = tail call i32 @handle_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
ret void
}
void __mp_memorymap(int s) {}


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

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

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

LLVM IR (-O2):
define void @__mp_memorymap(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
extern int isnetok(char const *ifname) {
  static char baidu[] = "baidu.com";
  (void)ifname;
  (void)baidu;
  sleep(100);
  return 1;
}


x86 assembly (clang, -O0):
<isnetok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x64,%edi
call   1030 <sleep@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnetok>:
push   %rax
mov    $0x64,%edi
call   1030 <sleep@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@isnetok.baidu = internal global [10 x i8] c"baidu.com\00"
define i32 @isnetok(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sleep(i32 100)
ret i32 1
}

LLVM IR (-O2):
define i32 @isnetok(i8* nocapture readnone %0) {
%2 = tail call i32 @sleep(i32 100)
ret i32 1
}
void mntput(struct vfsmount *mnt) {
  if (mnt) {
  }
}


x86 assembly (clang, -O0):
<mntput>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1118 <mntput+0x18>
jmp    1118 <mntput+0x18>
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.vfsmount = type opaque
define void @mntput(%struct.vfsmount* %0) {
%2 = alloca %struct.vfsmount*
store %struct.vfsmount* %0, %struct.vfsmount** %2
%3 = load %struct.vfsmount*, %struct.vfsmount** %2
%4 = icmp ne %struct.vfsmount* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %6
6: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
%struct.vfsmount = type opaque
define void @mntput(%struct.vfsmount* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  volatile unsigned long x = 0x280000000L;
  volatile unsigned long y = 0x280000000L;
  printf("%d\n", x < y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0x280000000,%rax
mov    %rax,-0x10(%rbp)
movabs $0x280000000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmp    %rcx,%rax
setb   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x280000000,%rax
mov    %rax,0x10(%rsp)
mov    %rax,0x8(%rsp)
mov    0x10(%rsp),%rax
xor    %esi,%esi
cmp    0x8(%rsp),%rax
setb   %sil
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store volatile i64 10737418240, i64* %2
store volatile i64 10737418240, i64* %3
%4 = load volatile i64, i64* %2
%5 = load volatile i64, i64* %3
%6 = icmp ult i64 %4, %5
%7 = zext i1 %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
store volatile i64 10737418240, i64* %1
%4 = bitcast i64* %2 to i8*
store volatile i64 10737418240, i64* %2
%5 = load volatile i64, i64* %1
%6 = load volatile i64, i64* %2
%7 = icmp ult i64 %5, %6
%8 = zext i1 %7 to i32
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ log_func(int, char *);
int /*<<< orphan*/ vsnprintf(char *, int, char const *, int /*<<< orphan*/);
void sw_log(int log_level, const char *fmt, va_list ap) {
  char buf[4096];
  vsnprintf(buf, sizeof(buf), fmt, ap);
  log_func(log_level, buf);
}


x86 assembly (clang, -O0):
<sw_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x1020(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0x1000,%esi
call   1030 <vsnprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x1020(%rbp),%rsi
call   1040 <log_func@plt>
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sw_log>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x1000,%esi
call   1030 <vsnprintf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <log_func@plt>
add    $0x1008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @sw_log(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [4096 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @vsnprintf(i8* %8, i32 4096, i8* %9, i32 %10)
%12 = load i32, i32* %4
%13 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%14 = call i32 @log_func(i32 %12, i8* %13)
ret void
}

LLVM IR (-O2):
define void @sw_log(i32 %0, i8* nocapture %1, i32 %2) {
%4 = alloca [4096 x i8]
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%6 = call i32 @vsnprintf(i8* %5, i32 4096, i8* %1, i32 %2)
%7 = call i32 @log_func(i32 %0, i8* %5)
ret void
}
/* Type definitions */
typedef double uint64_t;

/* Variables and functions */
uint64_t get_microsecond_from_tsc(uint64_t count, double cpu_frequency) {
  return count / cpu_frequency;
}


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

x86 assembly (clang, -O2):
<get_microsecond_from_tsc>:
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @get_microsecond_from_tsc(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 = load double, double* %4
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @get_microsecond_from_tsc(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
/* Variables and functions */
int mktemp_internal(char *, int /*<<< orphan*/, int);
int mkstemp(char *path) { return (mktemp_internal(path, 0, 1)); }


x86 assembly (clang, -O0):
<mkstemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <mktemp_internal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkstemp>:
xor    %esi,%esi
mov    $0x1,%edx
jmp    1030 <mktemp_internal@plt>

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

LLVM IR (-O2):
define i32 @mkstemp(i8* %0) {
%2 = tail call i32 @mktemp_internal(i8* %0, i32 0, i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_array(int *array, int length) {
  int i;
  for (i = 0; i < length; i++)
    printf("%d ", array[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print_array+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_array+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print_array+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_array+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_array(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
void byteorder_swap_pointer_32_copy(unsigned char *src, unsigned char *dst) {
  dst[3] = src[0];
  dst[2] = src[1];
  dst[1] = src[2];
  dst[0] = src[3];
}


x86 assembly (clang, -O0):
<byteorder_swap_pointer_32_copy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<byteorder_swap_pointer_32_copy>:
mov    (%rdi),%al
mov    %al,0x3(%rsi)
mov    0x1(%rdi),%al
mov    %al,0x2(%rsi)
mov    0x2(%rdi),%al
mov    %al,0x1(%rsi)
mov    0x3(%rdi),%al
mov    %al,(%rsi)
ret

LLVM IR (-O0):
define void @byteorder_swap_pointer_32_copy(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 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 3
store i8 %7, i8* %9
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 2
store i8 %12, i8* %14
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 1
store i8 %17, i8* %19
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 3
%22 = load i8, i8* %21
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 0
store i8 %22, i8* %24
ret void
}

LLVM IR (-O2):
define void @byteorder_swap_pointer_32_copy(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %3, i8* %4
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %6, i8* %7
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %9, i8* %10
%11 = getelementptr inbounds i8, i8* %0, i64 3
%12 = load i8, i8* %11
store i8 %12, i8* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int create_socket(void) {
  int sock;
  if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
    return -1;
  return sock;
}


x86 assembly (clang, -O0):
<create_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
call   1030 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    1150 <create_socket+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    1156 <create_socket+0x46>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_socket>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    0x2ebe(%rip),%rax
mov    (%rax),%edx
call   1030 <socket@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
cmovs  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
define i32 @create_socket() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @PF_INET
%4 = load i32, i32* @SOCK_STREAM
%5 = load i32, i32* @IPPROTO_TCP
%6 = call i32 @socket(i32 %3, i32 %4, i32 %5)
store i32 %6, i32* %2
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 -1, i32* %1
br label %11
9: ; preds = %0
%10 = load i32, i32* %2
store i32 %10, i32* %1
br label %11
11: ; preds = %9, %8
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
define i32 @create_socket() {
%1 = load i32, i32* @PF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = load i32, i32* @IPPROTO_TCP
%4 = tail call i32 @socket(i32 %1, i32 %2, i32 %3)
%5 = icmp sgt i32 %4, -1
%6 = select i1 %5, i32 %4, i32 -1
ret i32 %6
}
/* Variables and functions */
char rot13_char(char);
int strlen(char *);
void rot13_string(char *s) {
  int len = strlen(s);
  int i;
  for (i = 0; i < len; i++)
    s[i] = rot13_char(s[i]);
}


x86 assembly (clang, -O0):
<rot13_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1177 <rot13_string+0x57>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <rot13_char@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113f <rot13_string+0x1f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot13_string>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1030 <strlen@plt>
test   %eax,%eax
jle    1157 <rot13_string+0x37>
mov    %eax,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1040 <rot13_char@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <rot13_string+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @rot13_string(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call signext i8 @rot13_char(i8 signext %9)
store i8 %10, i8* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %1
ret void
}