xunge/DecIR huggingface dataset:
/* Variables and functions */
int *malloc(int);
int *new_int(int v) {
  int *p = malloc(sizeof *p);
  *p = v;
  return p;
}


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

x86 assembly (clang, -O2):
<new_int>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %ebx,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i32* @new_int(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i32* @malloc(i32 4)
store i32* %4, i32** %3
%5 = load i32, i32* %2
%6 = load i32*, i32** %3
store i32 %5, i32* %6
%7 = load i32*, i32** %3
ret i32* %7
}

LLVM IR (-O2):
define noalias i32* @new_int(i32 %0) {
%2 = tail call i32* @malloc(i32 4)
store i32 %0, i32* %2
ret i32* %2
}
__attribute__((always_)) int create_proc_profile(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @create_proc_profile() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *get_simple_uid(char *);
int /*<<< orphan*/ write(char *, char *, char *);
void function_uname(char *uname) {
  char *uid = get_simple_uid(uname);
  write("ganttproject.gan", " id=\"%s\"", uid);
  write("ganttproject.gan", " name=\"%s\"", uname);
  free(uid);
}


x86 assembly (clang, -O0):
<function_uname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <get_simple_uid@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
lea    0xeac(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <write@plt>
mov    -0x8(%rbp),%rdx
lea    0xe95(%rip),%rdi
lea    0xea8(%rip),%rsi
call   1040 <write@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_uname>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <get_simple_uid@plt>
mov    %rax,%rbx
lea    0xeb9(%rip),%r15
lea    0xec3(%rip),%rsi
mov    %r15,%rdi
mov    %rax,%rdx
call   1040 <write@plt>
lea    0xeba(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
call   1040 <write@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"ganttproject.gan\00"
@.str.1 = [9 x i8] c" id=\22%s\22\00"
@.str.2 = [11 x i8] c" name=\22%s\22\00"
define void @function_uname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @get_simple_uid(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @write(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %2
%9 = call i32 @write(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %3
%11 = call i32 @free(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"ganttproject.gan\00"
@.str.1 = [9 x i8] c" id=\22%s\22\00"
@.str.2 = [11 x i8] c" name=\22%s\22\00"
define void @function_uname(i8* %0) {
%2 = tail call i8* @get_simple_uid(i8* %0)
%3 = tail call i32 @write(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%4 = tail call i32 @write(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%5 = tail call i32 @free(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void dy_stack_print_element(int *x) { printf("%d\n", *x); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @dy_stack_print_element(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ errno;
scalar_t__ rmdir(char *);
int /*<<< orphan*/ send_errno(int /*<<< orphan*/);
int /*<<< orphan*/ send_success();
void do_rmdir(int argc, char **argv) {
  assert(argc == 1);
  if (rmdir(argv[0]) == 0) {
    send_success();
  } else {
    send_errno(errno);
  }
}


x86 assembly (clang, -O0):
<do_rmdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <rmdir@plt>
cmp    $0x0,%rax
jne    1182 <do_rmdir+0x42>
mov    $0x0,%al
call   1050 <send_success@plt>
jmp    1190 <do_rmdir+0x50>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
call   1060 <send_errno@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_rmdir>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x1,%edi
sete   %al
mov    %eax,%edi
call   1040 <assert@plt>
mov    (%rbx),%rdi
call   1030 <rmdir@plt>
test   %rax,%rax
je     116f <do_rmdir+0x2f>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
pop    %rbx
jmp    1060 <send_errno@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <send_success@plt>

LLVM IR (-O0):
@errno = global i32 0
define void @do_rmdir(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i64 @rmdir(i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (...) @send_success()
br label %19
16: ; preds = %2
%17 = load i32, i32* @errno
%18 = call i32 @send_errno(i32 %17)
br label %19
19: ; preds = %16, %14
ret void
}

LLVM IR (-O2):
@errno = global i32 0
define void @do_rmdir(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = load i8*, i8** %1
%7 = tail call i64 @rmdir(i8* %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (...) @send_success()
br label %14
11: ; preds = %2
%12 = load i32, i32* @errno
%13 = tail call i32 @send_errno(i32 %12)
br label %14
14: ; preds = %11, %9
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
int is_main(const char *str) {
  if (strcmp(str, "main") == 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1142 <is_main+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1149 <is_main+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_main>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"main\00"
define i32 @is_main(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [5 x i8] c"main\00"
define i32 @is_main(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_ENUMERATED;

/* Variables and functions */
int /*<<< orphan*/ ASN1_ENUMERATED_it;
int ASN1_item_i2d(int /*<<< orphan*/ *, unsigned char **, int /*<<< orphan*/ *);
int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out) {
  return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ENUMERATED_it);
}


x86 assembly (clang, -O0):
<i2d_ASN1_ENUMERATED>:
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    0x2eb1(%rip),%rdx
call   1030 <ASN1_item_i2d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2d_ASN1_ENUMERATED>:
mov    0x2ec9(%rip),%rdx
jmp    1030 <ASN1_item_i2d@plt>

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

LLVM IR (-O2):
@ASN1_ENUMERATED_it = global i32 0
define i32 @i2d_ASN1_ENUMERATED(i32* %0, i8** %1) {
%3 = tail call i32 @ASN1_item_i2d(i32* %0, i8** %1, i32* @ASN1_ENUMERATED_it)
ret i32 %3
}
/* Variables and functions */
int get_user_flag(int);
int get_carry(void) { return get_user_flag(((100) + 6)); }


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

x86 assembly (clang, -O2):
<get_carry>:
mov    $0x6a,%edi
jmp    1030 <get_user_flag@plt>

LLVM IR (-O0):
define i32 @get_carry() {
%1 = call i32 @get_user_flag(i32 106)
ret i32 %1
}

LLVM IR (-O2):
define i32 @get_carry() {
%1 = tail call i32 @get_user_flag(i32 106)
ret i32 %1
}
void gtk_ruler_draw_pos() {}


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

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

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

LLVM IR (-O2):
define void @gtk_ruler_draw_pos() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Msp430TimerCapComP__6__Control__enableEvents();
void Msp430AlarmC__2__Msp430TimerControl__enableEvents(void) {
  Msp430TimerCapComP__6__Control__enableEvents();
}


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

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

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

LLVM IR (-O2):
define void @Msp430AlarmC__2__Msp430TimerControl__enableEvents() {
%1 = tail call i32 (...) @Msp430TimerCapComP__6__Control__enableEvents()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear_RnB();
int /*<<< orphan*/ deselect_chip();
int /*<<< orphan*/ select_chip();
int /*<<< orphan*/ send_cmd(int);
int /*<<< orphan*/ wait_RnB();
void nand_rest() {
  select_chip();
  clear_RnB();
  send_cmd(0xff);
  wait_RnB();
  deselect_chip();
}


x86 assembly (clang, -O0):
<nand_rest>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <select_chip@plt>
mov    $0x0,%al
call   1060 <clear_RnB@plt>
mov    $0xff,%edi
call   1070 <send_cmd@plt>
mov    $0x0,%al
call   1050 <wait_RnB@plt>
mov    $0x0,%al
call   1030 <deselect_chip@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nand_rest>:
push   %rax
xor    %eax,%eax
call   1040 <select_chip@plt>
xor    %eax,%eax
call   1060 <clear_RnB@plt>
mov    $0xff,%edi
call   1070 <send_cmd@plt>
xor    %eax,%eax
call   1050 <wait_RnB@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <deselect_chip@plt>

LLVM IR (-O0):
define void @nand_rest() {
%1 = call i32 (...) @select_chip()
%2 = call i32 (...) @clear_RnB()
%3 = call i32 @send_cmd(i32 255)
%4 = call i32 (...) @wait_RnB()
%5 = call i32 (...) @deselect_chip()
ret void
}

LLVM IR (-O2):
define void @nand_rest() {
%1 = tail call i32 (...) @select_chip()
%2 = tail call i32 (...) @clear_RnB()
%3 = tail call i32 @send_cmd(i32 255)
%4 = tail call i32 (...) @wait_RnB()
%5 = tail call i32 (...) @deselect_chip()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
int var_put_u32(int /*<<< orphan*/ *, int /*<<< orphan*/ const *, int);
int var_put_s32(uint8_t *cp, const uint8_t *endp, int32_t i) {
  return var_put_u32(cp, endp, ((uint32_t)i << 1) ^ (i >> 31));
}


x86 assembly (clang, -O0):
<var_put_s32>:
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
shl    $0x1,%edx
mov    -0x14(%rbp),%eax
sar    $0x1f,%eax
xor    %eax,%edx
call   1030 <var_put_u32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<var_put_s32>:
lea    (%rdx,%rdx,1),%eax
sar    $0x1f,%edx
xor    %eax,%edx
jmp    1030 <var_put_u32@plt>

LLVM IR (-O0):
define i32 @var_put_s32(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 = shl i32 %9, 1
%11 = load i32, i32* %6
%12 = ashr i32 %11, 31
%13 = xor i32 %10, %12
%14 = call i32 @var_put_u32(i32* %7, i32* %8, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @var_put_s32(i32* %0, i32* %1, i32 %2) {
%4 = shl i32 %2, 1
%5 = ashr i32 %2, 31
%6 = xor i32 %4, %5
%7 = tail call i32 @var_put_u32(i32* %0, i32* %1, i32 %6)
ret i32 %7
}
int ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg) {
  if (*v < lo) {
    *v = dflt;
  } else if (*v > hi) {
    *v = hi;
  }
  return *v;
}


x86 assembly (clang, -O0):
<ipdn_bound_var>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0x10(%rbp),%eax
jge    1132 <ipdn_bound_var+0x32>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
jmp    114f <ipdn_bound_var+0x4f>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
jle    114a <ipdn_bound_var+0x4a>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
jmp    114f <ipdn_bound_var+0x4f>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipdn_bound_var>:
mov    (%rdi),%eax
cmp    %edx,%eax
jl     110c <ipdn_bound_var+0xc>
mov    %ecx,%esi
cmp    %ecx,%eax
jle    1110 <ipdn_bound_var+0x10>
mov    %esi,(%rdi)
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @ipdn_bound_var(i32* nocapture %0, i32 %1, i32 %2, i32 %3, i8* nocapture readnone %4) {
%6 = load i32, i32* %0
%7 = icmp slt i32 %6, %2
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = icmp sgt i32 %6, %3
br i1 %9, label %10, label %12
10: ; preds = %8, %5
%11 = phi i32 [ %1, %5 ], [ %3, %8 ]
store i32 %11, i32* %0
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %6, %8 ], [ %11, %10 ]
ret i32 %13
}
void RTAvloHCPhysGetBestFit(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvloHCPhysGetBestFit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EACCES;
int /*<<< orphan*/ errno;
int pipe(int _fildes[2]) {
  errno = EACCES;
  return -1;
}


x86 assembly (clang, -O0):
<pipe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec0(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pipe>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
@EACCES = global i32 0
@errno = global i32 0
define i32 @pipe(i32* nocapture readnone %0) {
%2 = load i32, i32* @EACCES
store i32 %2, i32* @errno
ret i32 -1
}
unsigned int inthash(unsigned int key) {
  key += (key << 12);
  key ^= (key >> 22);
  key += (key << 4);
  key ^= (key >> 9);
  key += (key << 10);
  key ^= (key >> 2);
  key += (key << 7);
  key ^= (key >> 12);
  return key;
}


x86 assembly (clang, -O0):
<inthash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xc,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x16,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x9,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xa,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x7,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0xc,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inthash>:
mov    %edi,%eax
shl    $0xc,%eax
add    %edi,%eax
mov    %eax,%ecx
shr    $0x16,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shl    $0x4,%eax
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x9,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shl    $0xa,%eax
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x2,%ecx
xor    %eax,%ecx
mov    %ecx,%edx
shl    $0x7,%edx
add    %ecx,%edx
mov    %edx,%eax
shr    $0xc,%eax
xor    %edx,%eax
ret

LLVM IR (-O0):
define i32 @inthash(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 12
%5 = load i32, i32* %2
%6 = add i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = lshr i32 %7, 22
%9 = load i32, i32* %2
%10 = xor i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = shl i32 %11, 4
%13 = load i32, i32* %2
%14 = add i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = lshr i32 %15, 9
%17 = load i32, i32* %2
%18 = xor i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = shl i32 %19, 10
%21 = load i32, i32* %2
%22 = add i32 %21, %20
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = lshr i32 %23, 2
%25 = load i32, i32* %2
%26 = xor i32 %25, %24
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = shl i32 %27, 7
%29 = load i32, i32* %2
%30 = add i32 %29, %28
store i32 %30, i32* %2
%31 = load i32, i32* %2
%32 = lshr i32 %31, 12
%33 = load i32, i32* %2
%34 = xor i32 %33, %32
store i32 %34, i32* %2
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @inthash(i32 %0) {
%2 = mul i32 %0, 4097
%3 = lshr i32 %2, 22
%4 = xor i32 %3, %2
%5 = mul i32 %4, 17
%6 = lshr i32 %5, 9
%7 = xor i32 %6, %5
%8 = mul i32 %7, 1025
%9 = lshr i32 %8, 2
%10 = xor i32 %9, %8
%11 = mul i32 %10, 129
%12 = lshr i32 %11, 12
%13 = xor i32 %12, %11
ret i32 %13
}
void ctl_refresh(void) {}


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

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

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

LLVM IR (-O2):
define void @ctl_refresh() {
ret void
}
/* Variables and functions */
int getc(void *);
int f_getchar(void *data) { return getc(data); }


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

x86 assembly (clang, -O2):
<f_getchar>:
jmp    1030 <getc@plt>

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

LLVM IR (-O2):
define i32 @f_getchar(i8* nocapture %0) {
%2 = tail call i32 @getc(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ CE_High();
int /*<<< orphan*/ CE_Low();
unsigned char Get_Byte();
int /*<<< orphan*/ Send_Byte(unsigned char);
unsigned char Read_ID(unsigned char ID_addr) {
  unsigned char byte;
  CE_Low();
  Send_Byte(0x90);
  Send_Byte(0x00);
  Send_Byte(0x00);
  Send_Byte(ID_addr);
  byte = Get_Byte();
  CE_High();
  return byte;
}


x86 assembly (clang, -O0):
<Read_ID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1060 <CE_Low@plt>
mov    $0x90,%edi
call   1040 <Send_Byte@plt>
xor    %edi,%edi
call   1040 <Send_Byte@plt>
xor    %edi,%edi
call   1040 <Send_Byte@plt>
movzbl -0x1(%rbp),%edi
call   1040 <Send_Byte@plt>
mov    $0x0,%al
call   1030 <Get_Byte@plt>
mov    %al,-0x2(%rbp)
mov    $0x0,%al
call   1050 <CE_High@plt>
movzbl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Read_ID>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1060 <CE_Low@plt>
mov    $0x90,%edi
call   1040 <Send_Byte@plt>
xor    %edi,%edi
call   1040 <Send_Byte@plt>
xor    %edi,%edi
call   1040 <Send_Byte@plt>
mov    %ebx,%edi
call   1040 <Send_Byte@plt>
xor    %eax,%eax
call   1030 <Get_Byte@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <CE_High@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @Read_ID(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = call i32 (...) @CE_Low()
%5 = call i32 @Send_Byte(i8 zeroext -112)
%6 = call i32 @Send_Byte(i8 zeroext 0)
%7 = call i32 @Send_Byte(i8 zeroext 0)
%8 = load i8, i8* %2
%9 = call i32 @Send_Byte(i8 zeroext %8)
%10 = call zeroext i8 (...) @Get_Byte()
store i8 %10, i8* %3
%11 = call i32 (...) @CE_High()
%12 = load i8, i8* %3
ret i8 %12
}

LLVM IR (-O2):
define zeroext i8 @Read_ID(i8 zeroext %0) {
%2 = tail call i32 (...) @CE_Low()
%3 = tail call i32 @Send_Byte(i8 zeroext -112)
%4 = tail call i32 @Send_Byte(i8 zeroext 0)
%5 = tail call i32 @Send_Byte(i8 zeroext 0)
%6 = tail call i32 @Send_Byte(i8 zeroext %0)
%7 = tail call zeroext i8 (...) @Get_Byte()
%8 = tail call i32 (...) @CE_High()
ret i8 %7
}
long long gll4(long long j, unsigned short *b, long long i) { return j + b[i]; }


x86 assembly (clang, -O0):
<gll4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
movzwl (%rcx,%rdx,2),%ecx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gll4>:
movzwl (%rsi,%rdx,2),%eax
add    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @gll4(i64 %0, i16* nocapture %1, i64 %2) {
%4 = getelementptr inbounds i16, i16* %1, i64 %2
%5 = load i16, i16* %4
%6 = zext i16 %5 to i64
%7 = add nsw i64 %6, %0
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
void z_runtime_error(const char *func, const char *error) {
  fprintf(stderr, "zymogen runtime error: %s in func %s -- aborting\n", error,
          func);
  abort();
}


x86 assembly (clang, -O0):
<z_runtime_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xeb8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<z_runtime_error>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rcx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"zymogen runtime error: %s in func %s -- aborting\0A\00"
define void @z_runtime_error(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%9 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"zymogen runtime error: %s in func %s -- aborting\0A\00"
define void @z_runtime_error(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
%5 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
size_t xsnprintf(char *, size_t, char *, char const *);
size_t xstrlcpy(char *restrict dst, const char *restrict src, size_t size) {
  return xsnprintf(dst, size, "%s", src);
}


x86 assembly (clang, -O0):
<xstrlcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rcx
lea    0xec9(%rip),%rdx
call   1030 <xsnprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrlcpy>:
mov    %rsi,%rcx
lea    0xee6(%rip),%rax
mov    %rdx,%rsi
mov    %rax,%rdx
jmp    1030 <xsnprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i64 @xstrlcpy(i8* noalias %0, i8* noalias %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %6
%9 = load i8*, i8** %5
%10 = call i64 @xsnprintf(i8* %7, i64 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i64 %10
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i64 @xstrlcpy(i8* noalias %0, i8* noalias %1, i64 %2) {
%4 = tail call i64 @xsnprintf(i8* %0, i64 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ ERR_print_errors_fp(int /*<<< orphan*/);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void ensure(int r) {
  if (!r) {
    fprintf(stderr, "Open SSL error\n");
    ERR_print_errors_fp(stderr);
    assert(0);
  }
}


x86 assembly (clang, -O0):
<ensure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    116f <ensure+0x3f>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <ERR_print_errors_fp@plt>
xor    %edi,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ensure>:
test   %edi,%edi
je     1135 <ensure+0x5>
ret
push   %rbx
mov    0x2ea3(%rip),%rbx
mov    (%rbx),%edi
lea    0xeba(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <ERR_print_errors_fp@plt>
xor    %edi,%edi
pop    %rbx
jmp    1030 <assert@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Open SSL error\0A\00"
define void @ensure(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = call i32 @ERR_print_errors_fp(i32 %8)
%10 = call i32 @assert(i32 0)
br label %11
11: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Open SSL error\0A\00"
define void @ensure(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 @ERR_print_errors_fp(i32 %6)
%8 = tail call i32 @assert(i32 0)
br label %9
9: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void caml_gr_create_image() { exit(1); }


x86 assembly (clang, -O0):
<caml_gr_create_image>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<caml_gr_create_image>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @caml_gr_create_image() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @caml_gr_create_image() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
void XCheckMaskEvent() {}


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

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

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

LLVM IR (-O2):
define void @XCheckMaskEvent() {
ret void
}
int glmMaxIndex3d(double a, double b, double c, int i1, int i2, int i3) {
  if (a > b) {
    if (a > c)
      return i1;
    else
      return i3;
  } else {
    if (b > c)
      return i2;
    else
      return i3;
  }
}


x86 assembly (clang, -O0):
<glmMaxIndex3d>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %edi,-0x24(%rbp)
mov    %esi,-0x28(%rbp)
mov    %edx,-0x2c(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1152 <glmMaxIndex3d+0x52>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1147 <glmMaxIndex3d+0x47>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <glmMaxIndex3d+0x73>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <glmMaxIndex3d+0x73>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    116d <glmMaxIndex3d+0x6d>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <glmMaxIndex3d+0x73>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmMaxIndex3d>:
ucomisd %xmm2,%xmm0
cmovbe %edx,%edi
ucomisd %xmm2,%xmm1
mov    %esi,%eax
cmovbe %edx,%eax
ucomisd %xmm1,%xmm0
cmova  %edi,%eax
ret

LLVM IR (-O0):
define i32 @glmMaxIndex3d(double %0, double %1, double %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%14 = load double, double* %8
%15 = load double, double* %9
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %25
17: ; preds = %6
%18 = load double, double* %8
%19 = load double, double* %10
%20 = fcmp ogt double %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = load i32, i32* %11
store i32 %22, i32* %7
br label %33
23: ; preds = %17
%24 = load i32, i32* %13
store i32 %24, i32* %7
br label %33
25: ; preds = %6
%26 = load double, double* %9
%27 = load double, double* %10
%28 = fcmp ogt double %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load i32, i32* %12
store i32 %30, i32* %7
br label %33
31: ; preds = %25
%32 = load i32, i32* %13
store i32 %32, i32* %7
br label %33
33: ; preds = %31, %29, %23, %21
%34 = load i32, i32* %7
ret i32 %34
}

LLVM IR (-O2):
define i32 @glmMaxIndex3d(double %0, double %1, double %2, i32 %3, i32 %4, i32 %5) {
%7 = fcmp ogt double %0, %1
%8 = fcmp ogt double %0, %2
%9 = select i1 %8, i32 %3, i32 %5
%10 = fcmp ogt double %1, %2
%11 = select i1 %10, i32 %4, i32 %5
%12 = select i1 %7, i32 %9, i32 %11
ret i32 %12
}
/* Variables and functions */
int foo2b(int);
int foo3(int);
int foo4(int n) { return foo3(n) + foo2b(n); }


x86 assembly (clang, -O0):
<foo4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <foo3@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <foo2b@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo4>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <foo3@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <foo2b@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @foo4(i32 %0) {
%2 = tail call i32 @foo3(i32 %0)
%3 = tail call i32 @foo2b(i32 %0)
%4 = add nsw i32 %3, %2
ret i32 %4
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *, int);
int main() {
  int y = 100;
  int *p;
  p = (int *)malloc(sizeof(int));
  *p = 10;
  y = y / (*p);
  printf("%s:%d\n", "y", (y));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xa,(%rax)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    0xe9b(%rip),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
movl   $0xa,(%rax)
lea    0xec8(%rip),%rdi
lea    0xec8(%rip),%rsi
mov    $0xa,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%s:%d\0A\00"
@.str.1 = [2 x i8] c"y\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i32*
store i32 10, i32* %2
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 10)
ret i32 0
}
int t(char *a) {
  static char p[100];
  if (a)
    return t(p);
  else
    return 0;
}


x86 assembly (clang, -O0):
<t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113b <t+0x2b>
lea    0x2f12(%rip),%rdi
call   1030 <t@plt>
mov    %eax,-0x4(%rbp)
jmp    1142 <t+0x32>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t>:
test   %rdi,%rdi
je     1112 <t+0x12>
cs nopw 0x0(%rax,%rax,1)
nop
jmp    1110 <t+0x10>
xor    %eax,%eax
ret

LLVM IR (-O0):
@t.p = internal global [100 x i8] zeroinitializer
define i32 @t(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @t(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @t.p, i64 0, i64 0))
store i32 %7, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %6
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @t(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %4, label %3
3: ; preds = %1, %3
br label %3
4: ; preds = %1
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
uint32_t hton32(uint32_t n) { return htonl(n); }


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

x86 assembly (clang, -O2):
<hton32>:
jmp    1030 <htonl@plt>

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

LLVM IR (-O2):
define i32 @hton32(i32 %0) {
%2 = tail call i32 @htonl(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int f(int);
int g(int);
main() {
  if (f(3) != 3 * sizeof(short))
    abort();
  if (g(3) != 3 * sizeof(short) + sizeof(long) * 4)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
call   1040 <f@plt>
cltq
cmp    $0x6,%rax
je     115c <main+0x2c>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x3,%edi
call   1050 <g@plt>
cltq
cmp    $0x26,%rax
je     1179 <main+0x49>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
call   1040 <f@plt>
cmp    $0x6,%eax
jne    1153 <main+0x23>
mov    $0x3,%edi
call   1050 <g@plt>
cmp    $0x26,%eax
jne    1153 <main+0x23>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 3)
%3 = sext i32 %2 to i64
%4 = icmp ne i64 %3, 6
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %0
%8 = call i32 @g(i32 3)
%9 = sext i32 %8 to i64
%10 = icmp ne i64 %9, 38
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 3)
%2 = icmp eq i32 %1, 6
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @g(i32 3)
%7 = icmp eq i32 %6, 38
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
ret i32 0
}
double milesToKm(double miles) { return miles / 0.62137; }


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

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

LLVM IR (-O0):
define double @milesToKm(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 0x3FE3E2435696E58A
ret double %4
}

LLVM IR (-O2):
define double @milesToKm(double %0) {
%2 = fdiv double %0, 0x3FE3E2435696E58A
ret double %2
}
/* Variables and functions */
void stats_set(size_t sz, size_t overwritten_sz) {}


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

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

LLVM IR (-O0):
define void @stats_set(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
ret void
}

LLVM IR (-O2):
define void @stats_set(i64 %0, i64 %1) {
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t signum_fun_uint64_t(uint64_t a) { return (a > 0); }


x86 assembly (clang, -O0):
<signum_fun_uint64_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signum_fun_uint64_t>:
xor    %eax,%eax
test   %edi,%edi
setg   %al
ret

LLVM IR (-O0):
define i32 @signum_fun_uint64_t(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @signum_fun_uint64_t(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ calloc(int, int);
int main() {
  int *x = (int *)calloc(1, sizeof(int));
  assert(x != NULL);
  *x = 5;
  assert(*x == 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x5,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1040 <assert@plt>
movl   $0x5,(%rbx)
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i64 @calloc(i32 1, i32 4)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = icmp ne i32* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32*, i32** %2
store i32 5, i32* %9
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 5
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @calloc(i32 1, i32 4)
%2 = inttoptr i64 %1 to i32*
%3 = icmp ne i64 %1, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
store i32 5, i32* %2
%6 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hoc_pushx(int);
int /*<<< orphan*/ hoc_ret();
hoc_Setcolor() {
  hoc_ret();
  hoc_pushx(0.);
}


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

x86 assembly (clang, -O2):
<hoc_Setcolor>:
push   %rax
xor    %eax,%eax
call   1030 <hoc_ret@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <hoc_pushx@plt>

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

LLVM IR (-O2):
define i32 @hoc_Setcolor() {
%1 = tail call i32 (...) @hoc_ret()
%2 = tail call i32 @hoc_pushx(i32 0)
ret i32 undef
}
/* Type definitions */
typedef scalar_t__ ulong;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void check_order(ulong *data, ulong N) {
  --N;
  for (; N > 0; --N, ++data)
    assert(data[0] <= data[1]);
}


x86 assembly (clang, -O0):
<check_order>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    1170 <check_order+0x60>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
cmp    0x8(%rcx),%rax
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    112c <check_order+0x1c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_order>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%rsi
jl     1150 <check_order+0x40>
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%r14
add    $0x8,%rbx
nopl   0x0(%rax,%rax,1)
mov    -0x8(%rbx),%rax
xor    %edi,%edi
cmp    (%rbx),%rax
setle  %dil
call   1030 <assert@plt>
add    $0xffffffffffffffff,%r14
add    $0x8,%rbx
cmp    $0x2,%r14
ja     1130 <check_order+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @check_order(i64* nocapture %0, i64 %1) {
%3 = icmp sgt i64 %1, 1
br i1 %3, label %4, label %15
4: ; preds = %2, %4
%5 = phi i64 [ %7, %4 ], [ %1, %2 ]
%6 = phi i64* [ %9, %4 ], [ %0, %2 ]
%7 = add nsw i64 %5, -1
%8 = load i64, i64* %6
%9 = getelementptr inbounds i64, i64* %6, i64 1
%10 = load i64, i64* %9
%11 = icmp sle i64 %8, %10
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = icmp ugt i64 %5, 2
br i1 %14, label %4, label %15
15: ; preds = %4, %2
ret void
}