xunge/DecIR huggingface dataset:
/* Variables and functions */
int write(int, void const *, size_t);
int outside_write(int fd, const void *buf, size_t count) {
  return write(fd, buf, count);
}


x86 assembly (clang, -O0):
<outside_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outside_write>:
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define i32 @outside_write(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ opt_dblog();
extern int db_tid_log(char *op, char *date, char *time, char *name, char *cwd,
                      char *result) {
  if (!opt_dblog())
    return 0;
  return 0;
}


x86 assembly (clang, -O0):
<db_tid_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    $0x0,%al
call   1030 <opt_dblog@plt>
cmp    $0x0,%eax
jne    114c <db_tid_log+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1153 <db_tid_log+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @db_tid_log(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* nocapture readnone %4, i8* nocapture readnone %5) {
%7 = tail call i32 (...) @opt_dblog()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void reject() {
  printf("Rejected\n");
  exit(1);
}


x86 assembly (clang, -O0):
<reject>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<reject>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Rejected\0A\00"
define void @reject() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [9 x i8] c"Rejected\00"
define void @reject() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
int test_imm_6Bint8_reg(signed char val) {
  return ((val) & (0x6B << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Bint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x6b,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_6Bint8_reg(i8 signext %0) {
%2 = and i8 %0, 107
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
unsigned help() {
  puts("Options:\n"
       "	-e				Set exec file\n"
       "	--stack			Define stack size\n"
       "	-d / --debug	Set debug mode\n"
       "	-h / --help		Show 'help'\n"
       "	--about			Show 'about'\n");
  return 1;
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [139 x i8] c"Options:\0A\09-e\09\09\09\09Set exec file\0A\09--stack\09\09\09Define stack size\0A\09-d / --debug\09Set debug mode\0A\09-h / --help\09\09Show 'help'\0A\09--about\09\09\09Show 'about'\0A\00"
define i32 @help() {
%1 = call i32 @puts(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [139 x i8] c"Options:\0A\09-e\09\09\09\09Set exec file\0A\09--stack\09\09\09Define stack size\0A\09-d / --debug\09Set debug mode\0A\09-h / --help\09\09Show 'help'\0A\09--about\09\09\09Show 'about'\0A\00"
define i32 @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
ret i32 1
}
void sys_poll_midi(void) {}


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

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

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

LLVM IR (-O2):
define void @sys_poll_midi() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void leaf_var(char *name) { printf("Var: %s\n", name); }


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

x86 assembly (clang, -O2):
<leaf_var>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"Var: %s\0A\00"
define void @leaf_var(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int main() {
  signed long long int li;
  signed int i;
  li = 0;
  i = 0x00000001;
  li = i;
  li = 0;
  i = 0xFFFFFFFF;
  li = i;
  li = 0;
  i = 0x80000000;
  li = i;
  li = 0;
  i = 0x7FFFFFFF;
  li = i;
  li = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x80000000,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x7fffffff,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %2
store i32 1, i32* %3
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
store i64 %5, i64* %2
store i64 0, i64* %2
store i32 -1, i32* %3
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
store i64 %7, i64* %2
store i64 0, i64* %2
store i32 -2147483648, i32* %3
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
store i64 %9, i64* %2
store i64 0, i64* %2
store i32 2147483647, i32* %3
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
store i64 %11, i64* %2
store i64 0, i64* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  short descent;
};
struct TYPE_4__ {
  TYPE_1__ max_bounds;
};
typedef TYPE_2__ XFontStruct;

/* Variables and functions */
void set_XFontStruct_max_bounds_descent(void *_p, short _v) {
  ((XFontStruct *)_p)->max_bounds.descent = (short)_v;
}


x86 assembly (clang, -O0):
<set_XFontStruct_max_bounds_descent>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XFontStruct_max_bounds_descent>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i16 }
define void @set_XFontStruct_max_bounds_descent(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i16 %5, i16* %9
ret void
}

LLVM IR (-O2):
define void @set_XFontStruct_max_bounds_descent(i8* nocapture writeonly %0, i16 signext %1) {
%3 = bitcast i8* %0 to i16*
store i16 %1, i16* %3
ret void
}
float raw_linear_derivative_at(float y) { return 1.0; }


x86 assembly (clang, -O0):
<raw_linear_derivative_at>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_linear_derivative_at>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @raw_linear_derivative_at(float %0) {
%2 = alloca float
store float %0, float* %2
ret float 1.000000e+00
}

LLVM IR (-O2):
define float @raw_linear_derivative_at(float %0) {
ret float 1.000000e+00
}
/* Variables and functions */
size_t strlen(unsigned char const *);
int utf8_to_ucs4_buf(int *, unsigned char const *, size_t);
int utf8_to_ucs4_str(int *out, const unsigned char *in) {
  size_t in_size = strlen(in);
  int out_size = utf8_to_ucs4_buf(out, in, in_size);
  if (out_size >= 0)
    out[out_size] = 0;
  return out_size;
}


x86 assembly (clang, -O0):
<utf8_to_ucs4_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <utf8_to_ucs4_buf@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     116a <utf8_to_ucs4_str+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_to_ucs4_str>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <utf8_to_ucs4_buf@plt>
test   %eax,%eax
js     114e <utf8_to_ucs4_str+0x2e>
mov    %eax,%ecx
movl   $0x0,(%r14,%rcx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @utf8_to_ucs4_str(i32* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i32 @utf8_to_ucs4_buf(i32* %0, i8* %1, i64 %3)
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = zext i32 %4 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
store i32 0, i32* %8
br label %9
9: ; preds = %6, %2
ret i32 %4
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
uint32_t extract_unsigned_bits(uint32_t word, uint32_t low_bit, uint32_t size) {
  return (word >> low_bit) & ((1u << size) - 1);
}


x86 assembly (clang, -O0):
<extract_unsigned_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_unsigned_bits>:
mov    %esi,%ecx
shr    %cl,%edi
mov    $0xffffffff,%eax
mov    %edx,%ecx
shl    %cl,%eax
not    %eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @extract_unsigned_bits(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = lshr i32 %7, %8
%10 = load i32, i32* %6
%11 = shl i32 1, %10
%12 = sub i32 %11, 1
%13 = and i32 %9, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @extract_unsigned_bits(i32 %0, i32 %1, i32 %2) {
%4 = lshr i32 %0, %1
%5 = shl nsw i32 -1, %2
%6 = xor i32 %5, -1
%7 = and i32 %4, %6
ret i32 %7
}
/* Type definitions */
struct can_frame {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ print_frame(struct can_frame *);
int /*<<< orphan*/ printf(char *);
void print_compare(struct can_frame *exp, struct can_frame *rec) {
  printf("expected: ");
  print_frame(exp);
  printf("received: ");
  print_frame(rec);
}


x86 assembly (clang, -O0):
<print_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <print_frame@plt>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <print_frame@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_compare>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <print_frame@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <print_frame@plt>

LLVM IR (-O0):
%struct.can_frame = type { i32 }
@.str = [11 x i8] c"expected: \00"
@.str.1 = [11 x i8] c"received: \00"
define void @print_compare(%struct.can_frame* %0, %struct.can_frame* %1) {
%3 = alloca %struct.can_frame*
%4 = alloca %struct.can_frame*
store %struct.can_frame* %0, %struct.can_frame** %3
store %struct.can_frame* %1, %struct.can_frame** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = load %struct.can_frame*, %struct.can_frame** %3
%7 = call i32 @print_frame(%struct.can_frame* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%9 = load %struct.can_frame*, %struct.can_frame** %4
%10 = call i32 @print_frame(%struct.can_frame* %9)
ret void
}

LLVM IR (-O2):
%struct.can_frame = type { i32 }
@.str = [11 x i8] c"expected: \00"
@.str.1 = [11 x i8] c"received: \00"
define void @print_compare(%struct.can_frame* %0, %struct.can_frame* %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @print_frame(%struct.can_frame* %0)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @print_frame(%struct.can_frame* %1)
ret void
}
int get_array_elem(int *stuff, int num) { return stuff[num]; }


x86 assembly (clang, -O0):
<get_array_elem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_array_elem>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @get_array_elem(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_array_elem(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
int vmdsock_init(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @vmdsock_init() {
ret i32 0
}

LLVM IR (-O2):
define i32 @vmdsock_init() {
ret i32 0
}
int __attribute__((noipa)) odirured_one() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @odirured_one() {
ret i32 1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
scalar_t__ random();
uint32_t ws_random_mask(void) {
  if (sizeof(long) >= 4) {
    return (uint32_t)random();
  } else if (sizeof(long) == 2) {
    return (uint32_t)random() << 16 | (uint32_t)random();
  }
}


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

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

LLVM IR (-O0):
define i32 @ws_random_mask() {
%1 = call i64 (...) @random()
%2 = trunc i64 %1 to i32
ret i32 %2
}

LLVM IR (-O2):
define i32 @ws_random_mask() {
%1 = tail call i64 (...) @random()
%2 = trunc i64 %1 to i32
ret i32 %2
}
/* Variables and functions */
int strcmp(void const *const, void const *const);
int string_cmp_key(const void *const key1, const void *const key2) {
  return strcmp(key1, key2);
}


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

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

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

LLVM IR (-O2):
define i32 @string_cmp_key(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ printf(char *);
FILE *getFile(const char *path) {
  FILE *file = NULL;
  if (!(file = fopen(path, "r"))) {
    printf("Couldn't open file\n");
    exit(1);
  }
  return file;
}


x86 assembly (clang, -O0):
<getFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1178 <getFile+0x48>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFile>:
push   %rax
lea    0xec8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1144 <getFile+0x14>
pop    %rcx
ret
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [20 x i8] c"Couldn't open file\0A\00"
define i32* @getFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
store i32* null, i32** %3
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = icmp ne i32* %5, null
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %1
%11 = load i32*, i32** %3
ret i32* %11
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@str = [19 x i8] c"Couldn't open file\00"
define noalias i32* @getFile(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i32* %2
}
void CmpDestroy(void *arg) { (void)arg; }


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

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

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

LLVM IR (-O2):
define void @CmpDestroy(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void h264avcc_spsh_set_length(uint8_t *p, uint16_t val) {
  p[0] = val >> 8;
  p[1] = val & 0xff;
}


x86 assembly (clang, -O0):
<h264avcc_spsh_set_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<h264avcc_spsh_set_length>:
movzbl %sil,%eax
sar    $0x8,%esi
mov    %esi,(%rdi)
mov    %eax,0x4(%rdi)
ret

LLVM IR (-O0):
define void @h264avcc_spsh_set_length(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 = ashr i32 %5, 8
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %6, i32* %8
%9 = load i32, i32* %4
%10 = and i32 %9, 255
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 1
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
define void @h264avcc_spsh_set_length(i32* nocapture writeonly %0, i32 %1) {
%3 = ashr i32 %1, 8
store i32 %3, i32* %0
%4 = and i32 %1, 255
%5 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %4, i32* %5
ret void
}
int foo(int (*f)(int)) { return f(1); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %rdi,%rax
mov    $0x1,%edi
jmp    *%rax

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

LLVM IR (-O2):
define i32 @foo(i32 (i32)* nocapture %0) {
%2 = tail call i32 %0(i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ put_byte(int, int);
int /*<<< orphan*/ put_word(int, int);
int /*<<< orphan*/ write_ndless3x_loader(int /*<<< orphan*/, int);
__attribute__((always_)) void patch_NCAS_3_9_0_46x_extra(void) {
  write_ndless3x_loader(0, 2);
  put_byte(0x1008870B, 0xEA);
  put_word(0x10111788, 0x00000000);
  put_word(0x1013C764, 0xE12FFF1E);
}


x86 assembly (clang, -O0):
<patch_NCAS_3_9_0_46x_extra>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x2,%esi
call   1040 <write_ndless3x_loader@plt>
mov    $0x1008870b,%edi
mov    $0xea,%esi
call   1030 <put_byte@plt>
mov    $0x10111788,%edi
xor    %esi,%esi
call   1050 <put_word@plt>
mov    $0x1013c764,%edi
mov    $0xe12fff1e,%esi
call   1050 <put_word@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<patch_NCAS_3_9_0_46x_extra>:
push   %rax
xor    %edi,%edi
mov    $0x2,%esi
call   1040 <write_ndless3x_loader@plt>
mov    $0x1008870b,%edi
mov    $0xea,%esi
call   1030 <put_byte@plt>
mov    $0x10111788,%edi
xor    %esi,%esi
call   1050 <put_word@plt>
mov    $0x1013c764,%edi
mov    $0xe12fff1e,%esi
pop    %rax
jmp    1050 <put_word@plt>

LLVM IR (-O0):
define void @patch_NCAS_3_9_0_46x_extra() {
%1 = call i32 @write_ndless3x_loader(i32 0, i32 2)
%2 = call i32 @put_byte(i32 268994315, i32 234)
%3 = call i32 @put_word(i32 269555592, i32 0)
%4 = call i32 @put_word(i32 269731684, i32 -516948194)
ret void
}

LLVM IR (-O2):
define void @patch_NCAS_3_9_0_46x_extra() {
%1 = tail call i32 @write_ndless3x_loader(i32 0, i32 2)
%2 = tail call i32 @put_byte(i32 268994315, i32 234)
%3 = tail call i32 @put_word(i32 269555592, i32 0)
%4 = tail call i32 @put_word(i32 269731684, i32 -516948194)
ret void
}
/* Variables and functions */
scalar_t__ floor(double);
long double floorl(long double x) { return (long double)floor((double)x); }


x86 assembly (clang, -O0):
<floorl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <floor@plt>
mov    %rax,-0x18(%rbp)
fildll -0x18(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floorl>:
sub    $0x18,%rsp
fldt   0x20(%rsp)
fstpl  0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <floor@plt>
mov    %rax,0x10(%rsp)
fildll 0x10(%rsp)
add    $0x18,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @floorl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fptrunc x86_fp80 %3 to double
%5 = call i64 @floor(double %4)
%6 = sitofp i64 %5 to x86_fp80
ret x86_fp80 %6
}

LLVM IR (-O2):
define x86_fp80 @floorl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call i64 @floor(double %2)
%4 = sitofp i64 %3 to x86_fp80
ret x86_fp80 %4
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t zig_addw_u32(uint32_t lhs, uint32_t rhs, uint32_t max) {
  uint32_t thresh = max - rhs;
  if (lhs > thresh) {
    return lhs - thresh - 1;
  } else {
    return lhs + rhs;
  }
}


x86 assembly (clang, -O0):
<zig_addw_u32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    113f <zig_addw_u32+0x3f>
mov    -0x10(%rbp),%rax
sub    -0x28(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    114b <zig_addw_u32+0x4b>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zig_addw_u32>:
sub    %rsi,%rdx
cmp    %rdi,%rdx
not    %rdx
cmovge %rsi,%rdx
lea    (%rdx,%rdi,1),%rax
ret

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

LLVM IR (-O2):
define i64 @zig_addw_u32(i64 %0, i64 %1, i64 %2) {
%4 = sub nsw i64 %2, %1
%5 = icmp slt i64 %4, %0
%6 = xor i64 %4, -1
%7 = select i1 %5, i64 %6, i64 %1
%8 = add i64 %7, %0
ret i64 %8
}
double sum2(double a, double b) { return a + b; }


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

x86 assembly (clang, -O2):
<sum2>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @sum2(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 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @sum2(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
int min(int one, int second) { return one <= second ? one : second; }


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1121 <min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %edi,%eax
cmp    %esi,%edi
cmovg  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ sendNextWaypoint();
void sendingTimer(int t) { sendNextWaypoint(); }


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

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

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

LLVM IR (-O2):
define void @sendingTimer(i32 %0) {
%2 = tail call i32 (...) @sendNextWaypoint()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, b, c;
  scanf("%d", &a);
  b = a * a;
  c = a * a * a;
  printf("\n%d", b);
  printf("\n%d", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ebx
mov    %ebx,%esi
imul   %ebx,%esi
imul   %esi,%ebx
lea    0xeb8(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = mul nsw i32 %6, %7
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = mul nsw i32 %9, %10
%12 = load i32, i32* %2
%13 = mul nsw i32 %11, %12
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %4
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = mul nsw i32 %4, %4
%6 = mul nsw i32 %5, %4
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Type definitions */
typedef int uint64_t;
typedef unsigned long uint32_t;

/* Variables and functions */
uint64_t TimerLoadGet64(uint32_t ui32Base) {
  uint32_t ui32High1, ui32High2, ui32Low;
  ;
  do {
    ui32High1 = (*((volatile unsigned long *)(ui32Base + 0x0000002C)));
    ui32Low = (*((volatile unsigned long *)(ui32Base + 0x00000028)));
    ui32High2 = (*((volatile unsigned long *)(ui32Base + 0x0000002C)));
  } while (ui32High1 != ui32High2);
  return (((uint64_t)ui32High1 << 32) | (uint64_t)ui32Low);
}


x86 assembly (clang, -O0):
<TimerLoadGet64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1108 <TimerLoadGet64+0x8>
mov    -0x10(%rbp),%rax
mov    $0x20,%ecx
shl    %cl,%eax
mov    -0x20(%rbp),%rcx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerLoadGet64>:
mov    0x2c(%rdi),%rax
mov    0x28(%rdi),%rcx
cmp    0x2c(%rdi),%rax
jne    1100 <TimerLoadGet64>
ret

LLVM IR (-O0):
define i32 @TimerLoadGet64(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %2
br label %6
6: ; preds = %19, %1
%7 = load i64, i64* %2
%8 = add i64 %7, 44
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
store i64 %10, i64* %3
%11 = load i64, i64* %2
%12 = add i64 %11, 40
%13 = inttoptr i64 %12 to i64*
%14 = load volatile i64, i64* %13
store i64 %14, i64* %5
%15 = load i64, i64* %2
%16 = add i64 %15, 44
%17 = inttoptr i64 %16 to i64*
%18 = load volatile i64, i64* %17
store i64 %18, i64* %4
br label %19
19: ; preds = %6
%20 = load i64, i64* %3
%21 = load i64, i64* %4
%22 = icmp ne i64 %20, %21
br i1 %22, label %6, label %23
23: ; preds = %19
%24 = load i64, i64* %3
%25 = trunc i64 %24 to i32
%26 = shl i32 %25, 32
%27 = load i64, i64* %5
%28 = trunc i64 %27 to i32
%29 = or i32 %26, %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @TimerLoadGet64(i64 %0) {
%2 = add i64 %0, 44
%3 = inttoptr i64 %2 to i64*
%4 = add i64 %0, 40
%5 = inttoptr i64 %4 to i64*
br label %6
6: ; preds = %6, %1
%7 = load volatile i64, i64* %3
%8 = load volatile i64, i64* %5
%9 = load volatile i64, i64* %3
%10 = icmp eq i64 %7, %9
br i1 %10, label %11, label %6
11: ; preds = %6
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ usleep(unsigned int);
unsigned int catweasel_usleep(unsigned int _useconds) {
  (void)usleep(_useconds);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @catweasel_usleep(i32 %0) {
%2 = tail call i32 @usleep(i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ die(char *, char *, unsigned int, char const *,
                       unsigned int);
void *malloc(size_t);
void *checked_malloc(size_t size, char *filename, unsigned int line,
                     const char *func) {
  void *p = malloc(size);
  if (!p)
    die("%s:%u: %s: OUT OF MEMORY malloc(%u)\n", filename, line, func,
        (unsigned)size);
  return p;
}


x86 assembly (clang, -O0):
<checked_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116d <checked_malloc+0x4d>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %eax,%r8d
lea    0xe98(%rip),%rdi
call   1040 <die@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_malloc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %edx,%r15d
mov    %rsi,%r12
mov    %rdi,%rbx
call   1030 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1159 <checked_malloc+0x39>
lea    0xeb8(%rip),%rdi
mov    %r12,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
mov    %ebx,%r8d
call   1040 <die@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [37 x i8] c"%s:%u: %s: OUT OF MEMORY malloc(%u)\0A\00"
define noalias i8* @checked_malloc(i64 %0, i8* %1, i32 %2, i8* %3) {
%5 = tail call i8* @malloc(i64 %0)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = trunc i64 %0 to i32
%9 = tail call i32 @die(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2, i8* %3, i32 %8)
br label %10
10: ; preds = %7, %4
ret i8* %5
}
void INI_Construct_ffnc_ctx() {}


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

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

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

LLVM IR (-O2):
define void @INI_Construct_ffnc_ctx() {
ret void
}
int ti_sub_start(double const *options) {
  (void)options;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @ti_sub_start(double* nocapture readnone %0) {
ret i32 0
}
void initVirtualMemory() {}


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

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

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

LLVM IR (-O2):
define void @initVirtualMemory() {
ret void
}
/* Variables and functions */
bool add_and_test(float a, float b) {
  if ((a == 0.0) || (b == 0.0)) {
    return 0;
  }
  return ((a + b) == a);
}


x86 assembly (clang, -O0):
<add_and_test>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    112f <add_and_test+0x2f>
jp     112f <add_and_test+0x2f>
jmp    114b <add_and_test+0x4b>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1157 <add_and_test+0x57>
jp     1157 <add_and_test+0x57>
movl   $0x0,-0x4(%rbp)
jmp    1175 <add_and_test+0x75>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_and_test>:
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
setp   %al
setne  %cl
or     %al,%cl
ucomiss %xmm2,%xmm1
setp   %al
setne  %dl
or     %al,%dl
addss  %xmm0,%xmm1
ucomiss %xmm0,%xmm1
setnp  %sil
sete   %al
and    %sil,%al
and    %cl,%dl
and    %al,%dl
movzbl %dl,%eax
ret

LLVM IR (-O0):
define i32 @add_and_test(float %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = fpext float %6 to double
%8 = fcmp oeq double %7, 0.000000e+00
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load float, float* %5
%11 = fpext float %10 to double
%12 = fcmp oeq double %11, 0.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %9, %2
store i32 0, i32* %3
br label %21
14: ; preds = %9
%15 = load float, float* %4
%16 = load float, float* %5
%17 = fadd float %15, %16
%18 = load float, float* %4
%19 = fcmp oeq float %17, %18
%20 = zext i1 %19 to i32
store i32 %20, i32* %3
br label %21
21: ; preds = %14, %13
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @add_and_test(float %0, float %1) {
%3 = fcmp une float %0, 0.000000e+00
%4 = fcmp une float %1, 0.000000e+00
%5 = fadd float %0, %1
%6 = fcmp oeq float %5, %0
%7 = and i1 %3, %4
%8 = and i1 %7, %6
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
void set_word(void *p, void *vp) { memcpy(p, vp, 4); }


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

x86 assembly (clang, -O2):
<set_word>:
mov    $0x4,%edx
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @set_word(i8* %0, i8* %1) {
%3 = tail call i32 @memcpy(i8* %0, i8* %1, i32 4)
ret void
}
/* Variables and functions */
int compare_array(int const *, int const *, int *);
void gc_main(const int *g, const int *e, int *o) {
  o[0] = compare_array(g, e, o);
}


x86 assembly (clang, -O0):
<gc_main>:
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    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <compare_array@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gc_main>:
push   %rbx
mov    %rdx,%rbx
call   1030 <compare_array@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @gc_main(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = load i32*, i32** %5
%9 = load i32*, i32** %6
%10 = call i32 @compare_array(i32* %7, i32* %8, i32* %9)
%11 = load i32*, i32** %6
%12 = getelementptr inbounds i32, i32* %11, i64 0
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
define void @gc_main(i32* %0, i32* %1, i32* %2) {
%4 = tail call i32 @compare_array(i32* %0, i32* %1, i32* %2)
store i32 %4, i32* %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
void write_half(FILE *f, int word) {
  fputc(word & 0377, f);
  fputc((word >> 8) & 0377, f);
  fputc((word >> 16) & 0377, f);
  fputc((word >> 24) & 0377, f);
}


x86 assembly (clang, -O0):
<write_half>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <fputc@plt>
mov    -0xc(%rbp),%edi
sar    $0x8,%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <fputc@plt>
mov    -0xc(%rbp),%edi
sar    $0x10,%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <fputc@plt>
mov    -0xc(%rbp),%edi
sar    $0x18,%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_half>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movzbl %bl,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
movzbl %bh,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
shr    $0x18,%ebx
mov    %ebx,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fputc@plt>

LLVM IR (-O0):
define void @write_half(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 = and i32 %5, 255
%7 = load i32*, i32** %3
%8 = call i32 @fputc(i32 %6, i32* %7)
%9 = load i32, i32* %4
%10 = ashr i32 %9, 8
%11 = and i32 %10, 255
%12 = load i32*, i32** %3
%13 = call i32 @fputc(i32 %11, i32* %12)
%14 = load i32, i32* %4
%15 = ashr i32 %14, 16
%16 = and i32 %15, 255
%17 = load i32*, i32** %3
%18 = call i32 @fputc(i32 %16, i32* %17)
%19 = load i32, i32* %4
%20 = ashr i32 %19, 24
%21 = and i32 %20, 255
%22 = load i32*, i32** %3
%23 = call i32 @fputc(i32 %21, i32* %22)
ret void
}

LLVM IR (-O2):
define void @write_half(i32* nocapture %0, i32 %1) {
%3 = and i32 %1, 255
%4 = tail call i32 @fputc(i32 %3, i32* %0)
%5 = lshr i32 %1, 8
%6 = and i32 %5, 255
%7 = tail call i32 @fputc(i32 %6, i32* %0)
%8 = lshr i32 %1, 16
%9 = and i32 %8, 255
%10 = tail call i32 @fputc(i32 %9, i32* %0)
%11 = lshr i32 %1, 24
%12 = tail call i32 @fputc(i32 %11, i32* %0)
ret void
}
/* Type definitions */
struct wl_registry {
  int dummy;
};
struct wl_proxy {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_destroy(struct wl_proxy *);
void wl_registry_destroy(struct wl_registry *wl_registry) {
  wl_proxy_destroy((struct wl_proxy *)wl_registry);
}


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

x86 assembly (clang, -O2):
<wl_registry_destroy>:
jmp    1030 <wl_proxy_destroy@plt>

LLVM IR (-O0):
%struct.wl_registry = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_registry_destroy(%struct.wl_registry* %0) {
%2 = alloca %struct.wl_registry*
store %struct.wl_registry* %0, %struct.wl_registry** %2
%3 = load %struct.wl_registry*, %struct.wl_registry** %2
%4 = bitcast %struct.wl_registry* %3 to %struct.wl_proxy*
%5 = call i32 @wl_proxy_destroy(%struct.wl_proxy* %4)
ret void
}

LLVM IR (-O2):
%struct.wl_registry = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_registry_destroy(%struct.wl_registry* %0) {
%2 = bitcast %struct.wl_registry* %0 to %struct.wl_proxy*
%3 = tail call i32 @wl_proxy_destroy(%struct.wl_proxy* %2)
ret void
}