xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ alarm(int);
int /*<<< orphan*/ opd_print_stats();
int /*<<< orphan*/ sfile_sync_files();
void opd_alarm(void) {
  sfile_sync_files();
  opd_print_stats();
  alarm(60 * 10);
}


x86 assembly (clang, -O0):
<opd_alarm>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <sfile_sync_files@plt>
mov    $0x0,%al
call   1040 <opd_print_stats@plt>
mov    $0x258,%edi
call   1030 <alarm@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<opd_alarm>:
push   %rax
xor    %eax,%eax
call   1050 <sfile_sync_files@plt>
xor    %eax,%eax
call   1040 <opd_print_stats@plt>
mov    $0x258,%edi
pop    %rax
jmp    1030 <alarm@plt>

LLVM IR (-O0):
define void @opd_alarm() {
%1 = call i32 (...) @sfile_sync_files()
%2 = call i32 (...) @opd_print_stats()
%3 = call i32 @alarm(i32 600)
ret void
}

LLVM IR (-O2):
define void @opd_alarm() {
%1 = tail call i32 (...) @sfile_sync_files()
%2 = tail call i32 (...) @opd_print_stats()
%3 = tail call i32 @alarm(i32 600)
ret void
}
/* Variables and functions */
char *alloca(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
__attribute__((always_)) char *strdupa(const char *s) {
  char *d = alloca(strlen(s) + 1);
  if (s && d)
    strcpy(d, s);
  return d;
}


x86 assembly (clang, -O0):
<strdupa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <alloca@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1178 <strdupa+0x48>
cmpq   $0x0,-0x10(%rbp)
je     1178 <strdupa+0x48>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdupa>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <alloca@plt>
mov    %rax,%rbx
test   %r14,%r14
je     115d <strdupa+0x2d>
test   %rbx,%rbx
je     115d <strdupa+0x2d>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strdupa(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @alloca(i64 %3)
%5 = icmp ne i8* %0, null
%6 = icmp ne i8* %4, null
%7 = select i1 %5, i1 %6, i1 false
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = tail call i32 @strcpy(i8* %4, i8* %0)
br label %10
10: ; preds = %8, %1
ret i8* %4
}
void foo_1_2_1_1_2_2_1_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_1_1_2_2_1_2_1() {
ret void
}
/* Variables and functions */
float expf(float);
float __ocl_exp_float(float src) { return expf(src); }


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

x86 assembly (clang, -O2):
<__ocl_exp_float>:
jmp    1030 <expf@plt>

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

LLVM IR (-O2):
define float @__ocl_exp_float(float %0) {
%2 = tail call float @expf(float %0)
ret float %2
}
int test_imm_01uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x01 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_01uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 1
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ caller_bf6();
int /*<<< orphan*/ caller_bf7();
int main() {
  caller_bf6();
  caller_bf7();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <caller_bf6@plt>
xor    %eax,%eax
call   1040 <caller_bf7@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @caller_bf6()
%2 = tail call i32 (...) @caller_bf7()
ret i32 0
}
void uart_init(void) { (*(volatile unsigned char *)(0x7f38)) |= (0x80 | 0x01); }


x86 assembly (clang, -O0):
<uart_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f38,%eax
mov    (%rax),%al
movzbl %al,%eax
or     $0x81,%eax
mov    %al,%cl
mov    $0x7f38,%eax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_init>:
orb    $0x81,0x7f38
81
ret

LLVM IR (-O0):
define void @uart_init() {
%1 = load volatile i8, i8* inttoptr (i64 32568 to i8*)
%2 = zext i8 %1 to i32
%3 = or i32 %2, 129
%4 = trunc i32 %3 to i8
store volatile i8 %4, i8* inttoptr (i64 32568 to i8*)
ret void
}

LLVM IR (-O2):
define void @uart_init() {
%1 = load volatile i8, i8* inttoptr (i64 32568 to i8*)
%2 = or i8 %1, -127
store volatile i8 %2, i8* inttoptr (i64 32568 to i8*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, char *, int);
int main(void) {
  int i, *i_ptr;
  i_ptr = malloc(1 * sizeof(int));
  printf("%s = %d\n", "i", (i));
  printf("%s = %d\n", "*i_ptr", (*i_ptr));
  free(i_ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edx
lea    0xea9(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe90(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xeb8(%rip),%r14
lea    0xeba(%rip),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    (%rbx),%edx
lea    0xeab(%rip),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%s = %d\0A\00"
@.str.1 = [2 x i8] c"i\00"
@.str.2 = [7 x i8] c"*i_ptr\00"
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 undef)
%3 = load i32, i32* %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%5 = tail call i32 @free(i32* %1)
ret i32 0
}
void get_stepping_info(int *chip, int *major, int *minor) {
  *chip = 0x7;
  *major = 0x5;
  *minor = 0x0;
}


x86 assembly (clang, -O0):
<get_stepping_info>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x7,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_stepping_info>:
movl   $0x7,(%rdi)
movl   $0x5,(%rsi)
movl   $0x0,(%rdx)
ret

LLVM IR (-O0):
define void @get_stepping_info(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
store i32 7, i32* %7
%8 = load i32*, i32** %5
store i32 5, i32* %8
%9 = load i32*, i32** %6
store i32 0, i32* %9
ret void
}

LLVM IR (-O2):
define void @get_stepping_info(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
store i32 7, i32* %0
store i32 5, i32* %1
store i32 0, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __NR_gettid;
long syscall(int /*<<< orphan*/);
long int __gettid() { return syscall(__NR_gettid); }


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

x86 assembly (clang, -O2):
<__gettid>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_gettid = global i32 0
define i64 @__gettid() {
%1 = load i32, i32* @__NR_gettid
%2 = call i64 @syscall(i32 %1)
ret i64 %2
}

LLVM IR (-O2):
@__NR_gettid = global i32 0
define i64 @__gettid() {
%1 = load i32, i32* @__NR_gettid
%2 = tail call i64 @syscall(i32 %1)
ret i64 %2
}
/* Type definitions */
struct ac_buffer {
  int dummy;
};
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int _buffer_write_array(struct ac_buffer *, int /*<<< orphan*/ *, int, int);
int buffer_write_int64_array(struct ac_buffer *buffer, int64_t *value,
                             int size) {
  return _buffer_write_array(buffer, value, size, sizeof(int64_t));
}


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

x86 assembly (clang, -O2):
<buffer_write_int64_array>:
mov    $0x4,%ecx
jmp    1030 <_buffer_write_array@plt>

LLVM IR (-O0):
%struct.ac_buffer = type { i32 }
define i32 @buffer_write_int64_array(%struct.ac_buffer* %0, i32* %1, i32 %2) {
%4 = alloca %struct.ac_buffer*
%5 = alloca i32*
%6 = alloca i32
store %struct.ac_buffer* %0, %struct.ac_buffer** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load %struct.ac_buffer*, %struct.ac_buffer** %4
%8 = load i32*, i32** %5
%9 = load i32, i32* %6
%10 = call i32 @_buffer_write_array(%struct.ac_buffer* %7, i32* %8, i32 %9, i32 4)
ret i32 %10
}

LLVM IR (-O2):
%struct.ac_buffer = type { i32 }
define i32 @buffer_write_int64_array(%struct.ac_buffer* %0, i32* %1, i32 %2) {
%4 = tail call i32 @_buffer_write_array(%struct.ac_buffer* %0, i32* %1, i32 %2, i32 4)
ret i32 %4
}
/* Variables and functions */
scalar_t__ COND_GE();
int /*<<< orphan*/ EA_AY_DI_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_sge_8_di(void) {
  m68ki_write_8(EA_AY_DI_8(), COND_GE() ? 0xff : 0);
}


x86 assembly (clang, -O0):
<m68k_op_sge_8_di>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <EA_AY_DI_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <COND_GE@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_sge_8_di>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <EA_AY_DI_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <COND_GE@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_sge_8_di() {
%1 = call i32 (...) @EA_AY_DI_8()
%2 = call i64 (...) @COND_GE()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_sge_8_di() {
%1 = tail call i32 (...) @EA_AY_DI_8()
%2 = tail call i64 (...) @COND_GE()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
/* Type definitions */
struct bplus_tree {
  int dummy;
};

/* Variables and functions */
int bplus_tree_search(struct bplus_tree *, int);
int bplus_tree_get(struct bplus_tree *tree, int key) {
  int data = bplus_tree_search(tree, key);
  if (data) {
    return data;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<bplus_tree_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <bplus_tree_search@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1143 <bplus_tree_get+0x33>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114a <bplus_tree_get+0x3a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bplus_tree_get>:
push   %rax
call   1030 <bplus_tree_search@plt>
cmp    $0x1,%eax
sbb    %ecx,%ecx
or     %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.bplus_tree = type { i32 }
define i32 @bplus_tree_get(%struct.bplus_tree* %0, i32 %1) {
%3 = tail call i32 @bplus_tree_search(%struct.bplus_tree* %0, i32 %1)
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -1, i32 %3
ret i32 %5
}
/* Variables and functions */
void *malloc(size_t);
void *hack_alloc_(size_t size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<hack_alloc_>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @hack_alloc_(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @malloc(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define noalias i8* @hack_alloc_(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
void cpuid(unsigned func, unsigned *eax, unsigned *ebx, unsigned *ecx,
           unsigned *edx) {
  __asm__ volatile("cpuid"
                   : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
                   : "a"(func));
}


x86 assembly (clang, -O0):
<cpuid>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
cpuid
mov    %eax,%r9d
mov    -0x40(%rbp),%rax
mov    %ecx,%esi
mov    -0x38(%rbp),%rcx
mov    %r9d,(%r8)
mov    %ebx,(%rdi)
mov    %esi,(%rcx)
mov    %edx,(%rax)
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid>:
push   %rbx
mov    %rcx,%r9
mov    %rdx,%r10
mov    %edi,%eax
cpuid
mov    %eax,(%rsi)
mov    %ebx,(%r10)
mov    %ecx,(%r9)
mov    %edx,(%r8)
pop    %rbx
ret

LLVM IR (-O0):
define void @cpuid(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i32*, i32** %7
%12 = load i32*, i32** %8
%13 = load i32*, i32** %9
%14 = load i32*, i32** %10
%15 = load i32, i32* %6
%16 = call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %15)
%17 = extractvalue { i32, i32, i32, i32 } %16, 0
%18 = extractvalue { i32, i32, i32, i32 } %16, 1
%19 = extractvalue { i32, i32, i32, i32 } %16, 2
%20 = extractvalue { i32, i32, i32, i32 } %16, 3
store i32 %17, i32* %11
store i32 %18, i32* %12
store i32 %19, i32* %13
store i32 %20, i32* %14
ret void
}

LLVM IR (-O2):
define void @cpuid(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = tail call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %0)
%7 = extractvalue { i32, i32, i32, i32 } %6, 0
%8 = extractvalue { i32, i32, i32, i32 } %6, 1
%9 = extractvalue { i32, i32, i32, i32 } %6, 2
%10 = extractvalue { i32, i32, i32, i32 } %6, 3
store i32 %7, i32* %1
store i32 %8, i32* %2
store i32 %9, i32* %3
store i32 %10, i32* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  printf("Age in year: 18\n");
  printf("Age in day: %d\n", 18 * 365);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x19aa,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
mov    $0x19aa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Age in year: 18\0A\00"
@.str.1 = [16 x i8] c"Age in day: %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 6570)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"Age in day: %d\0A\00"
@str = [16 x i8] c"Age in year: 18\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 6570)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char buffer[64];
  puts("Attack me and read the flag :)");
  if (argc > 1)
    strcpy(buffer, argv[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x1,-0x8(%rbp)
jle    115d <main+0x3d>
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x2,%ebp
jl     1148 <main+0x28>
mov    0x8(%rbx),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Attack me and read the flag :)\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [64 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strcpy(i8* %11, i8* %14)
br label %16
16: ; preds = %10, %2
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [31 x i8] c"Attack me and read the flag :)\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @strcpy(i8* %4, i8* %9)
br label %11
11: ; preds = %7, %2
ret i32 0
}
int is_little_endian(void) {
  short test = 1;
  return *(char *)&test;
}


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

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

LLVM IR (-O0):
define i32 @is_little_endian() {
%1 = alloca i16
store i16 1, i16* %1
%2 = bitcast i16* %1 to i8*
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @is_little_endian() {
ret i32 1
}
/* Variables and functions */
bool ira_object_conflict_iter_cond() {}


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

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

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

LLVM IR (-O2):
define i32 @ira_object_conflict_iter_cond() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ werase(int /*<<< orphan*/ *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void del_dialog(WINDOW *win) {
  werase(win);
  wrefresh(win);
  delwin(win);
}


x86 assembly (clang, -O0):
<del_dialog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <werase@plt>
mov    -0x8(%rbp),%rdi
call   1030 <wrefresh@plt>
mov    -0x8(%rbp),%rdi
call   1040 <delwin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<del_dialog>:
push   %rbx
mov    %rdi,%rbx
call   1050 <werase@plt>
mov    %rbx,%rdi
call   1030 <wrefresh@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <delwin@plt>

LLVM IR (-O0):
define void @del_dialog(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @werase(i32* %3)
%5 = load i32*, i32** %2
%6 = call i32 @wrefresh(i32* %5)
%7 = load i32*, i32** %2
%8 = call i32 @delwin(i32* %7)
ret void
}

LLVM IR (-O2):
define void @del_dialog(i32* %0) {
%2 = tail call i32 @werase(i32* %0)
%3 = tail call i32 @wrefresh(i32* %0)
%4 = tail call i32 @delwin(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int x;
  srand(time(NULL));
  x = rand() % 6 + 1;
  printf("Congratulations, you rolled a %d\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Congratulations, you rolled a %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 6
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"Congratulations, you rolled a %d\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 6
%5 = add nsw i32 %4, 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
unsigned int beword16(const unsigned char *c) { return c[0] * 256 + c[1]; }


x86 assembly (clang, -O0):
<beword16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<beword16>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @beword16(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = mul nsw i32 %6, 256
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = add nsw i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @beword16(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
scalar_t__ ec_atomic_cas64(scalar_t__ *, scalar_t__, scalar_t__);
uint64_t ec_atomic_inc64(uint64_t *mem) {
  register uint64_t last;
  do {
    last = *mem;
  } while (ec_atomic_cas64(mem, last + 1, last) != last);
  return ++last;
}


x86 assembly (clang, -O0):
<ec_atomic_inc64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
mov    -0x10(%rbp),%rdx
call   1030 <ec_atomic_cas64@plt>
cmp    -0x10(%rbp),%rax
jne    111c <ec_atomic_inc64+0xc>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ec_atomic_inc64>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
nopl   0x0(%rax,%rax,1)
mov    (%r14),%rbx
lea    0x1(%rbx),%r15
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <ec_atomic_cas64@plt>
cmp    %rbx,%rax
jne    1120 <ec_atomic_inc64+0x10>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @ec_atomic_inc64(i64* %0) {
br label %2
2: ; preds = %2, %1
%3 = load i64, i64* %0
%4 = add nsw i64 %3, 1
%5 = tail call i64 @ec_atomic_cas64(i64* %0, i64 %4, i64 %3)
%6 = icmp eq i64 %5, %3
br i1 %6, label %7, label %2
7: ; preds = %2
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void SlimList_Release(char *serializedResults) {
  if (serializedResults)
    free(serializedResults);
}


x86 assembly (clang, -O0):
<SlimList_Release>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <SlimList_Release+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SlimList_Release>:
test   %rdi,%rdi
je     111a <SlimList_Release+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @SlimList_Release(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ processQueue(int /*<<< orphan*/);
void xautolock_processQueue() { processQueue((time_t)30); }


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

x86 assembly (clang, -O2):
<xautolock_processQueue>:
mov    $0x1e,%edi
jmp    1030 <processQueue@plt>

LLVM IR (-O0):
define void @xautolock_processQueue() {
%1 = call i32 @processQueue(i32 30)
ret void
}

LLVM IR (-O2):
define void @xautolock_processQueue() {
%1 = tail call i32 @processQueue(i32 30)
ret void
}
void free(void *ptr) {
  if (!ptr)
    return;
}


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

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

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

LLVM IR (-O2):
define void @free(i8* nocapture %0) {
ret void
}
void i2a_ACCESS_DESCRIPTION(void) {}


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

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

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

LLVM IR (-O2):
define void @i2a_ACCESS_DESCRIPTION() {
ret void
}
void printchar(char **str, char c) {
  if (str) {
    **str = c;
    ++(*str);
  }
}


x86 assembly (clang, -O0):
<printchar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1133 <printchar+0x33>
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<printchar>:
test   %rdi,%rdi
je     110f <printchar+0xf>
mov    (%rdi),%rax
mov    %sil,(%rax)
addq   $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @printchar(i8** %0, i8 signext %1) {
%3 = icmp eq i8** %0, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8*, i8** %0
store i8 %1, i8* %5
%6 = load i8*, i8** %0
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %7, i8** %0
br label %8
8: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef scalar_t__ time_t;

/* Variables and functions */
int fib(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  time_t st = time(NULL);
  int i = 36;
  int f;
  printf("start\n");
  f = fib(i);
  printf("fib(%i) in %i seconds: %i\n", i, (int)(time(NULL) - st), f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %rax,-0x8(%rbp)
movl   $0x24,-0xc(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1050 <fib@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    -0x14(%rbp),%esi
sub    -0x8(%rbp),%rax
mov    %eax,%edx
mov    -0x10(%rbp),%ecx
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,%rbx
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x24,%edi
call   1060 <fib@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1050 <time@plt>
sub    %ebx,%eax
lea    0xe8b(%rip),%rdi
mov    $0x24,%esi
mov    %eax,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"start\0A\00"
@.str.1 = [27 x i8] c"fib(%i) in %i seconds: %i\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca i32
%4 = call i64 @time(i32* null)
store i64 %4, i64* %1
store i32 36, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %2
%7 = call i32 @fib(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = call i64 @time(i32* null)
%10 = load i64, i64* %1
%11 = sub nsw i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"fib(%i) in %i seconds: %i\0A\00"
@str = [6 x i8] c"start\00"
define i32 @main() {
%1 = tail call i64 @time(i32* null)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @fib(i32 36)
%4 = tail call i64 @time(i32* null)
%5 = sub nsw i64 %4, %1
%6 = trunc i64 %5 to i32
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 36, i32 %6, i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
void bus_stop_logger(void) { closelog(); }


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

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

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

LLVM IR (-O2):
define void @bus_stop_logger() {
%1 = tail call i32 (...) @closelog()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ VIM_HIF_SetReg8(int, unsigned char);
void VIM_IPP_SetEffectUVoffset(unsigned char bUoffset, unsigned char bVoffset) {
  VIM_HIF_SetReg8((0x1c00 + 0x052), bUoffset);
  VIM_HIF_SetReg8((0x1c00 + 0x053), bVoffset);
}


x86 assembly (clang, -O0):
<VIM_IPP_SetEffectUVoffset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    $0x1c52,%edi
movzbl -0x1(%rbp),%esi
call   1030 <VIM_HIF_SetReg8@plt>
mov    $0x1c53,%edi
movzbl -0x2(%rbp),%esi
call   1030 <VIM_HIF_SetReg8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VIM_IPP_SetEffectUVoffset>:
push   %rbx
mov    %esi,%ebx
mov    %edi,%esi
mov    $0x1c52,%edi
call   1030 <VIM_HIF_SetReg8@plt>
mov    $0x1c53,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <VIM_HIF_SetReg8@plt>

LLVM IR (-O0):
define void @VIM_IPP_SetEffectUVoffset(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = call i32 @VIM_HIF_SetReg8(i32 7250, i8 zeroext %5)
%7 = load i8, i8* %4
%8 = call i32 @VIM_HIF_SetReg8(i32 7251, i8 zeroext %7)
ret void
}

LLVM IR (-O2):
define void @VIM_IPP_SetEffectUVoffset(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call i32 @VIM_HIF_SetReg8(i32 7250, i8 zeroext %0)
%4 = tail call i32 @VIM_HIF_SetReg8(i32 7251, i8 zeroext %1)
ret void
}
/* Variables and functions */
const char *get_descriptor_type(bool exec_bit) {
  return (exec_bit) ? "code" : "data";
}


x86 assembly (clang, -O0):
<get_descriptor_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xef4(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_descriptor_type>:
test   %edi,%edi
lea    0xefc(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"code\00"
@.str.1 = [5 x i8] c"data\00"
define i8* @get_descriptor_type(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [5 x i8] c"code\00"
@.str.1 = [5 x i8] c"data\00"
define i8* @get_descriptor_type(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t addip0(uint32_t x) { return x + 0; }


x86 assembly (clang, -O0):
<addip0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x0,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addip0>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @addip0(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 0
ret i64 %4
}

LLVM IR (-O2):
define i64 @addip0(i64 returned %0) {
ret i64 %0
}
void rop3_80_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~*D;
  stk1 = T & stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_80_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_80_1_0>:
mov    (%rdi),%al
mov    %eax,%ecx
or     %sil,%cl
not    %cl
and    %dl,%cl
and    %sil,%al
or     %cl,%al
mov    %al,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_80_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %4, %1
%6 = xor i8 %5, -1
%7 = and i8 %6, %2
%8 = and i8 %4, %1
%9 = or i8 %7, %8
store i8 %9, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Olá mundo\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"Ol\C3\A1 mundo\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"Ol\C3\A1 mundo\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int sumOfNumbersInString(const char *str) {
  int sum = 0;
  int i = 0;
  while (str[i] != '\0') {
    sum += str[i] - '0';
    i++;
  }
  return sum;
}


x86 assembly (clang, -O0):
<sumOfNumbersInString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114e <sumOfNumbersInString+0x4e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <sumOfNumbersInString+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumOfNumbersInString>:
mov    (%rdi),%cl
test   %cl,%cl
je     1124 <sumOfNumbersInString+0x24>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
add    %ecx,%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <sumOfNumbersInString+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @sumOfNumbersInString(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %11, %4 ], [ 0, %1 ]
%6 = phi i8 [ %13, %4 ], [ %2, %1 ]
%7 = phi i32 [ %10, %4 ], [ 0, %1 ]
%8 = sext i8 %6 to i32
%9 = add i32 %7, -48
%10 = add i32 %9, %8
%11 = add nuw nsw i64 %5, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %16
}
unsigned int BKDRHash(char *str) {
  unsigned int seed = 131;
  unsigned int hash = 0;
  while (*str)
    hash = hash * seed + (*str++);
  return (hash & 0x7FFFFFFF);
}


x86 assembly (clang, -O0):
<BKDRHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x83,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <BKDRHash+0x46>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <BKDRHash+0x16>
mov    -0x10(%rbp),%eax
and    $0x7fffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BKDRHash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <BKDRHash+0x2c>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
imul   $0x83,%eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <BKDRHash+0x10>
and    $0x7fffffff,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @BKDRHash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 131, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %9, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = mul i32 %10, %11
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %2
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = add i32 %12, %16
store i32 %17, i32* %4
br label %5
18: ; preds = %5
%19 = load i32, i32* %4
%20 = and i32 %19, 2147483647
ret i32 %20
}

LLVM IR (-O2):
define i32 @BKDRHash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul i32 %6, 131
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = add i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %11, 2147483647
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}