xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ return_struct_c5();
int /*<<< orphan*/ take_struct_c5(int /*<<< orphan*/);
void test_struct_c5() { take_struct_c5(return_struct_c5()); }


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

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

LLVM IR (-O0):
define void @test_struct_c5() {
%1 = call i32 (...) @return_struct_c5()
%2 = call i32 @take_struct_c5(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_c5() {
%1 = tail call i32 (...) @return_struct_c5()
%2 = tail call i32 @take_struct_c5(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_string(char *);
int /*<<< orphan*/ hex2int(int /*<<< orphan*/, int);
char *long2str(char *, int /*<<< orphan*/);
char *machex2int(char *arg) {
  return long2str(arg, hex2int(get_string(arg), -1));
}


x86 assembly (clang, -O0):
<machex2int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_string@plt>
mov    %eax,%edi
mov    $0xffffffff,%esi
call   1040 <hex2int@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1050 <long2str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<machex2int>:
push   %rbx
mov    %rdi,%rbx
call   1030 <get_string@plt>
mov    %eax,%edi
mov    $0xffffffff,%esi
call   1040 <hex2int@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1050 <long2str@plt>

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

LLVM IR (-O2):
define i8* @machex2int(i8* %0) {
%2 = tail call i32 @get_string(i8* %0)
%3 = tail call i32 @hex2int(i32 %2, i32 -1)
%4 = tail call i8* @long2str(i8* %0, i32 %3)
ret i8* %4
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ usleep(int);
void thinking() {
  int s = rand() % 1133;
  usleep(s);
}


x86 assembly (clang, -O0):
<thinking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x46d,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thinking>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rdi
imul   $0x39d7c7f7,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x28,%rax
add    %ecx,%eax
imul   $0x46d,%eax,%eax
sub    %eax,%edi
pop    %rax
jmp    1040 <usleep@plt>

LLVM IR (-O0):
define void @thinking() {
%1 = alloca i32
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 1133
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @thinking() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 1133
%3 = tail call i32 @usleep(i32 %2)
ret void
}
int function_b(int n) { return n <= 0 ? 1 : function_b(n - 2) + 1; }


x86 assembly (clang, -O0):
<function_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1132 <function_b+0x22>
mov    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1143 <function_b+0x33>
mov    -0x4(%rbp),%edi
sub    $0x2,%edi
call   1030 <function_b@plt>
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_b>:
test   %edi,%edi
jle    111c <function_b+0x1c>
cmp    $0x2,%edi
mov    $0x2,%eax
cmovl  %edi,%eax
neg    %eax
add    %edi,%eax
add    $0x1,%eax
shr    %eax
add    $0x2,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @function_b(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = add nuw i32 %0, 1
%5 = call i32 @llvm.smin.i32(i32 %0, i32 2)
%6 = sub nuw i32 %4, %5
%7 = lshr i32 %6, 1
%8 = add nuw nsw i32 %7, 2
br label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %8, %3 ]
ret i32 %10
}
int pe_as_lit_id_map_chareq(char a, char b) {
  return (a & ~('a' - 'A')) == (b & ~('a' - 'A'));
}


x86 assembly (clang, -O0):
<pe_as_lit_id_map_chareq>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xffffffdf,%eax
movsbl -0x2(%rbp),%ecx
and    $0xffffffdf,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pe_as_lit_id_map_chareq>:
xor    %esi,%edi
xor    %eax,%eax
test   $0xdf,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @pe_as_lit_id_map_chareq(i8 signext %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 = sext i8 %5 to i32
%7 = and i32 %6, -33
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
%10 = and i32 %9, -33
%11 = icmp eq i32 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @pe_as_lit_id_map_chareq(i8 signext %0, i8 signext %1) {
%3 = xor i8 %1, %0
%4 = and i8 %3, -33
%5 = icmp eq i8 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int divides(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d", divides(1, 2));
  printf("%d", divides(4, 2));
  printf("%d", divides(1, 1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <divides@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x4,%edi
mov    $0x2,%esi
call   1040 <divides@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1040 <divides@plt>
mov    %eax,%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <divides@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x4,%edi
mov    $0x2,%esi
call   1040 <divides@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <divides@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @divides(i32 1, i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @divides(i32 4, i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @divides(i32 1, i32 1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
int test_imm_71uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x71 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_71uint64_midword_mem>:
testb  $0x71,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_71uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 7405568
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int execute_utime() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_utime() {
ret i32 0
}
/* Type definitions */
typedef char GLubyte;
typedef scalar_t__ GLenum;

/* Variables and functions */
scalar_t__ GL_NO_ERROR;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char const *);
scalar_t__ glGetError();
char *gluErrorString(scalar_t__);
int /*<<< orphan*/ stderr;
void handleGLerrors(char *guiltyfunction) {
  GLenum errcode;
  const GLubyte *errstring;
  errcode = glGetError();
  if (GL_NO_ERROR != errcode) {
    errstring = gluErrorString(errcode);
    fprintf(stderr, "GL error in %s: %s\n", guiltyfunction, errstring);
  }
}


x86 assembly (clang, -O0):
<handleGLerrors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <glGetError@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
je     1185 <handleGLerrors+0x55>
mov    -0x10(%rbp),%rdi
call   1050 <gluErrorString@plt>
mov    %rax,-0x18(%rbp)
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe80(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleGLerrors>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <glGetError@plt>
mov    0x2ea6(%rip),%rcx
cmp    %rax,(%rcx)
jne    1149 <handleGLerrors+0x19>
pop    %rbx
ret
mov    %rax,%rdi
call   1050 <gluErrorString@plt>
mov    0x2e80(%rip),%rcx
mov    (%rcx),%edi
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@GL_NO_ERROR = global i64 0
@stderr = global i32 0
@.str = [20 x i8] c"GL error in %s: %s\0A\00"
define void @handleGLerrors(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i64 (...) @glGetError()
store i64 %5, i64* %3
%6 = load i64, i64* @GL_NO_ERROR
%7 = load i64, i64* %3
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = load i64, i64* %3
%11 = call i8* @gluErrorString(i64 %10)
store i8* %11, i8** %4
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %2
%14 = load i8*, i8** %4
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
br label %16
16: ; preds = %9, %1
ret void
}

LLVM IR (-O2):
@GL_NO_ERROR = global i64 0
@stderr = global i32 0
@.str = [20 x i8] c"GL error in %s: %s\0A\00"
define void @handleGLerrors(i8* %0) {
%2 = tail call i64 (...) @glGetError()
%3 = load i64, i64* @GL_NO_ERROR
%4 = icmp eq i64 %3, %2
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = tail call i8* @gluErrorString(i64 %2)
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %6)
br label %9
9: ; preds = %5, %1
ret void
}
/* Variables and functions */
char rand();
void randomize_buffer(char *buf, long long size) {
  int i;
  for (i = 0; i < size; i++) {
    buf[i] = rand();
  }
}


x86 assembly (clang, -O0):
<randomize_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1157 <randomize_buffer+0x47>
mov    $0x0,%al
call   1030 <rand@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <randomize_buffer+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomize_buffer>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
jle    1144 <randomize_buffer+0x34>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <randomize_buffer+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @randomize_buffer(i8* nocapture writeonly %0, i64 %1) {
%3 = icmp sgt i64 %1, 0
br i1 %3, label %4, label %10
4: ; preds = %2, %4
%5 = phi i64 [ %8, %4 ], [ 0, %2 ]
%6 = tail call signext i8 (...) @rand()
%7 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %6, i8* %7
%8 = add nuw nsw i64 %5, 1
%9 = icmp eq i64 %8, %1
br i1 %9, label %10, label %4
10: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ comp_by_name(char *);
int /*<<< orphan*/ load_comp(int /*<<< orphan*/);
void load(char *ptr) { load_comp(comp_by_name(ptr)); }


x86 assembly (clang, -O0):
<load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <comp_by_name@plt>
mov    %eax,%edi
call   1030 <load_comp@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @load(i8* %0) {
%2 = tail call i32 @comp_by_name(i8* %0)
%3 = tail call i32 @load_comp(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void print_log(const char *message) {
  if (1) {
    printf("-- %s\n", message);
  }
}


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"-- %s\0A\00"
define void @print_log(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int write(int, char const *, int /*<<< orphan*/);
int puts(const char *str) { return write(1, str, strlen(str)); }


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define i32 @puts(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @write(i32 1, i8* %0, i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ mpz_ptr;

/* Variables and functions */
int /*<<< orphan*/ mpz_mod(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mul_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
void gmp_mul_ui(mpz_ptr out, int in, mpz_ptr order) {
  mpz_mul_ui(out, out, in);
  mpz_mod(out, out, order);
}


x86 assembly (clang, -O0):
<gmp_mul_ui>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1040 <mpz_mul_ui@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <mpz_mod@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gmp_mul_ui>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%edx
mov    %edi,%ebp
mov    %edi,%esi
call   1040 <mpz_mul_ui@plt>
mov    %ebp,%edi
mov    %ebp,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <mpz_mod@plt>

LLVM IR (-O0):
define void @gmp_mul_ui(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* %4
%9 = load i32, i32* %5
%10 = call i32 @mpz_mul_ui(i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* %4
%12 = load i32, i32* %4
%13 = load i32, i32* %6
%14 = call i32 @mpz_mod(i32 %11, i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
define void @gmp_mul_ui(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @mpz_mul_ui(i32 %0, i32 %0, i32 %1)
%5 = tail call i32 @mpz_mod(i32 %0, i32 %0, i32 %2)
ret void
}
void ExtBus_Handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<ExtBus_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <ExtBus_Handler+0x9>
jmp    1109 <ExtBus_Handler+0x9>

x86 assembly (clang, -O2):
<ExtBus_Handler>:
jmp    1100 <ExtBus_Handler>

LLVM IR (-O0):
define void @ExtBus_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @ExtBus_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
void setPosition(float *a, int x, int y, int rows, int cols) {
  rows = rows;
  a[y * cols + x] = 255.0f;
}


x86 assembly (clang, -O0):
<setPosition>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movss  0xecc(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setPosition>:
imul   %r8d,%edx
add    %esi,%edx
movslq %edx,%rax
movl   $0x437f0000,(%rdi,%rax,4)
ret

LLVM IR (-O0):
define void @setPosition(float* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store float* %0, float** %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* %9
store i32 %11, i32* %9
%12 = load float*, float** %6
%13 = load i32, i32* %8
%14 = load i32, i32* %10
%15 = mul nsw i32 %13, %14
%16 = load i32, i32* %7
%17 = add nsw i32 %15, %16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds float, float* %12, i64 %18
store float 2.550000e+02, float* %19
ret void
}

LLVM IR (-O2):
define void @setPosition(float* nocapture writeonly %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = mul nsw i32 %4, %2
%7 = add nsw i32 %6, %1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds float, float* %0, i64 %8
store float 2.550000e+02, float* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _SC_NPROCESSORS_ONLN;
unsigned char sysconf(int /*<<< orphan*/);
unsigned char tp_info_hardwareconcurrency() {
  return sysconf(_SC_NPROCESSORS_ONLN);
}


x86 assembly (clang, -O0):
<tp_info_hardwareconcurrency>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@_SC_NPROCESSORS_ONLN = global i32 0
define zeroext i8 @tp_info_hardwareconcurrency() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = call zeroext i8 @sysconf(i32 %1)
ret i8 %2
}

LLVM IR (-O2):
@_SC_NPROCESSORS_ONLN = global i32 0
define zeroext i8 @tp_info_hardwareconcurrency() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = tail call zeroext i8 @sysconf(i32 %1)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_help() {
  printf("ReconOS v3 sort demo application.\n"
         "Sorts a buffer full of data with a variable number of sw and hw "
         "threads.\n"
         "\n"
         "Usage:\n"
         "\tsort_demo <-h|--help>\n"
         "\tsort_demo <num_hw_threads> <num_sw_threads> <num_of_blocks>\n"
         "\n"
         "Size of a block in bytes: %i\n",
         4096 * 2);
}


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

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

LLVM IR (-O0):
@.str = [230 x i8] c"ReconOS v3 sort demo application.\0ASorts a buffer full of data with a variable number of sw and hw threads.\0A\0AUsage:\0A\09sort_demo <-h|--help>\0A\09sort_demo <num_hw_threads> <num_sw_threads> <num_of_blocks>\0A\0ASize of a block in bytes: %i\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([230 x i8], [230 x i8]* @.str, i64 0, i64 0), i32 8192)
ret void
}

LLVM IR (-O2):
@.str = [230 x i8] c"ReconOS v3 sort demo application.\0ASorts a buffer full of data with a variable number of sw and hw threads.\0A\0AUsage:\0A\09sort_demo <-h|--help>\0A\09sort_demo <num_hw_threads> <num_sw_threads> <num_of_blocks>\0A\0ASize of a block in bytes: %i\0A\00"
define void @print_help() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([230 x i8], [230 x i8]* @.str, i64 0, i64 0), i32 8192)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bbm_write(void *, int, int /*<<< orphan*/);
scalar_t__ fc8080_channel_deselect(void *, unsigned char, unsigned char);
int fc8080_audio_deselect(void *handle, unsigned char subch_id,
                          unsigned char buf_id) {
  if (fc8080_channel_deselect(handle, subch_id, buf_id) != 0)
    return 1;
  bbm_write(handle, 0x0910 + buf_id, 0);
  return 0;
}


x86 assembly (clang, -O0):
<fc8080_audio_deselect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x11(%rbp),%al
movzbl %al,%esi
movzbl -0x12(%rbp),%edx
call   1040 <fc8080_channel_deselect@plt>
cmp    $0x0,%rax
je     1160 <fc8080_audio_deselect+0x40>
movl   $0x1,-0x4(%rbp)
jmp    117c <fc8080_audio_deselect+0x5c>
mov    -0x10(%rbp),%rdi
movzbl -0x12(%rbp),%esi
add    $0x910,%esi
xor    %edx,%edx
call   1030 <bbm_write@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fc8080_audio_deselect>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rdi,%r14
call   1040 <fc8080_channel_deselect@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    114e <fc8080_audio_deselect+0x2e>
movzbl %bpl,%esi
add    $0x910,%esi
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %edx,%edx
call   1030 <bbm_write@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fc8080_audio_deselect(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %5
store i8 %1, i8* %6
store i8 %2, i8* %7
%8 = load i8*, i8** %5
%9 = load i8, i8* %6
%10 = load i8, i8* %7
%11 = call i64 @fc8080_channel_deselect(i8* %8, i8 zeroext %9, i8 zeroext %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 1, i32* %4
br label %20
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = load i8, i8* %7
%17 = zext i8 %16 to i32
%18 = add nsw i32 2320, %17
%19 = call i32 @bbm_write(i8* %15, i32 %18, i32 0)
store i32 0, i32* %4
br label %20
20: ; preds = %14, %13
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
define i32 @fc8080_audio_deselect(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = tail call i64 @fc8080_channel_deselect(i8* %0, i8 zeroext %1, i8 zeroext %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = zext i8 %2 to i32
%8 = add nuw nsw i32 %7, 2320
%9 = tail call i32 @bbm_write(i8* %0, i32 %8, i32 0)
br label %10
10: ; preds = %3, %6
%11 = phi i32 [ 0, %6 ], [ 1, %3 ]
ret i32 %11
}
void closePidFiltering(int filter_id) { ; }


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

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

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

LLVM IR (-O2):
define void @closePidFiltering(i32 %0) {
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void main() {
  int32_t a;
  a = 8 >> 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x2,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
void bad_input(const char *arg) {
  printf("usage: %s -h <host> -p <port> "
         "-usr <username> -psw <password>\n",
         arg);
  exit(0);
}


x86 assembly (clang, -O0):
<bad_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<bad_input>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"usage: %s -h <host> -p <port> -usr <username> -psw <password>\0A\00"
define void @bad_input(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [63 x i8] c"usage: %s -h <host> -p <port> -usr <username> -psw <password>\0A\00"
define void @bad_input(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
pid_t octave_getpgrp_wrapper(void) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @octave_getpgrp_wrapper() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void MyMayFree(char *p) {
  if (NULL != p) {
    free(p);
  }
}


x86 assembly (clang, -O0):
<MyMayFree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     1131 <MyMayFree+0x21>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @MyMayFree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* null, %3
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 @MyMayFree(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 */
struct XCSF {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ action_param_defaults_neural(struct XCSF *);
int /*<<< orphan*/ action_param_set_type(struct XCSF *, int);
void action_param_defaults(struct XCSF *xcsf) {
  action_param_set_type(xcsf, (1));
  action_param_defaults_neural(xcsf);
}


x86 assembly (clang, -O0):
<action_param_defaults>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <action_param_set_type@plt>
mov    -0x8(%rbp),%rdi
call   1040 <action_param_defaults_neural@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<action_param_defaults>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%esi
call   1030 <action_param_set_type@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <action_param_defaults_neural@plt>

LLVM IR (-O0):
%struct.XCSF = type { i32 }
define void @action_param_defaults(%struct.XCSF* %0) {
%2 = alloca %struct.XCSF*
store %struct.XCSF* %0, %struct.XCSF** %2
%3 = load %struct.XCSF*, %struct.XCSF** %2
%4 = call i32 @action_param_set_type(%struct.XCSF* %3, i32 1)
%5 = load %struct.XCSF*, %struct.XCSF** %2
%6 = call i32 @action_param_defaults_neural(%struct.XCSF* %5)
ret void
}

LLVM IR (-O2):
%struct.XCSF = type { i32 }
define void @action_param_defaults(%struct.XCSF* %0) {
%2 = tail call i32 @action_param_set_type(%struct.XCSF* %0, i32 1)
%3 = tail call i32 @action_param_defaults_neural(%struct.XCSF* %0)
ret void
}
/* Variables and functions */
void *null_function(void) { return NULL; }


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

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

LLVM IR (-O0):
define i8* @null_function() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @null_function() {
ret i8* null
}
/* Variables and functions */
char *sqlite3_malloc(int);
void memleak_sqlite3_malloc() {
  char *buf = sqlite3_malloc(10);
  if (buf) {
    buf[0] = 0;
  }
}


x86 assembly (clang, -O0):
<memleak_sqlite3_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
call   1030 <sqlite3_malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <memleak_sqlite3_malloc+0x28>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memleak_sqlite3_malloc>:
push   %rax
mov    $0xa,%edi
call   1030 <sqlite3_malloc@plt>
test   %rax,%rax
je     1123 <memleak_sqlite3_malloc+0x13>
movb   $0x0,(%rax)
pop    %rax
ret

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

LLVM IR (-O2):
define void @memleak_sqlite3_malloc() {
%1 = tail call i8* @sqlite3_malloc(i32 10)
%2 = icmp eq i8* %1, null
br i1 %2, label %4, label %3
3: ; preds = %0
store i8 0, i8* %1
br label %4
4: ; preds = %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ f();
main() {
  if (f() != 0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <f@plt>
cmp    $0x0,%rax
je     1147 <main+0x27>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <f@plt>
test   %rax,%rax
jne    1131 <main+0x11>
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 i64 (...) @f()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @f()
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ window;
};
typedef TYPE_1__ XLeaveWindowEvent;

/* Variables and functions */
unsigned long get_XLeaveWindowEvent_window(void *_p) {
  return (unsigned long)((XLeaveWindowEvent *)_p)->window;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XLeaveWindowEvent_window(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XLeaveWindowEvent_window(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void FileFound() { fprintf(stderr, "\nFile Found. Reading data..."); }


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"\0AFile Found. Reading data...\00"
define void @FileFound() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"\0AFile Found. Reading data...\00"
define void @FileFound() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double pow(double, int);
double stretching(double x) {
  double alpha = 2;
  double beta = 2;
  return alpha * x + (3 - 2 * alpha - beta) * x * x +
         (alpha - 2 + beta) * pow(x, 3.);
}


x86 assembly (clang, -O0):
<stretching>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xece(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
addsd  %xmm3,%xmm3
movsd  0xeb6(%rip),%xmm1
subsd  %xmm3,%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe81(%rip),%xmm1
subsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stretching>:
push   %rax
movsd  0xee7(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
addsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
mov    $0x3,%edi
call   1030 <pow@plt>
addsd  %xmm0,%xmm0
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @stretching(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
store double 2.000000e+00, double* %3
store double 2.000000e+00, double* %4
%5 = load double, double* %3
%6 = load double, double* %2
%7 = load double, double* %3
%8 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %7, double 3.000000e+00)
%9 = load double, double* %4
%10 = fsub double %8, %9
%11 = load double, double* %2
%12 = fmul double %10, %11
%13 = load double, double* %2
%14 = fmul double %12, %13
%15 = call double @llvm.fmuladd.f64(double %5, double %6, double %14)
%16 = load double, double* %3
%17 = fsub double %16, 2.000000e+00
%18 = load double, double* %4
%19 = fadd double %17, %18
%20 = load double, double* %2
%21 = call double @pow(double %20, i32 3)
%22 = call double @llvm.fmuladd.f64(double %19, double %21, double %15)
ret double %22
}

LLVM IR (-O2):
define double @stretching(double %0) {
%2 = fmul double %0, -3.000000e+00
%3 = fmul double %2, %0
%4 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double %3)
%5 = tail call double @pow(double %0, i32 3)
%6 = tail call double @llvm.fmuladd.f64(double %5, double 2.000000e+00, double %4)
ret double %6
}
int get_range_size(int range_begin, int range_end) {
  return range_end - range_begin;
}


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

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

LLVM IR (-O0):
define i32 @get_range_size(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_range_size(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
ret i32 %3
}
void dump_string(char *prefix, char *id, char *value, int len) {
  if (len == 0)
    return;
  if (prefix)
    printf("%s%s=%.*s\n", prefix, id, len, value);
  else
    printf("%s=%.*s\n", id, len, value);
}


x86 assembly (clang, -O0):
<dump_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1136 <dump_string+0x26>
jmp    117c <dump_string+0x6c>
cmpq   $0x0,-0x8(%rbp)
je     1163 <dump_string+0x53>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117c <dump_string+0x6c>
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_string>:
test   %ecx,%ecx
je     1130 <dump_string+0x20>
mov    %rdx,%r8
mov    %rsi,%rdx
mov    %rdi,%rsi
test   %rdi,%rdi
je     1131 <dump_string+0x21>
lea    0xed7(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
ret
lea    0xeca(%rip),%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
mov    %r8,%rcx
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"%s%s=%.*s\0A\00"
@.str.1 = [9 x i8] c"%s=%.*s\0A\00"
define void @dump_string(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %12, label %6
6: ; preds = %4
%7 = icmp eq i8* %0, null
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %3, i8* %2)
br label %12
10: ; preds = %6
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %3, i8* %2)
br label %12
12: ; preds = %4, %10, %8
ret void
}
int cmp_int(const void *a, const void *b) { return (*(int *)a - *(int *)b); }


x86 assembly (clang, -O0):
<cmp_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_int>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @cmp_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmp_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
long rand();
long random_long() { return rand(); }


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

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

LLVM IR (-O0):
define i64 @random_long() {
%1 = call i64 (...) @rand()
ret i64 %1
}

LLVM IR (-O2):
define i64 @random_long() {
%1 = tail call i64 (...) @rand()
ret i64 %1
}
int notpass(float *p) {
  int sum = 0;
  int i;
  for (i = 0; i < 5; i++) {
    if (*p++ < 60)
      sum++;
  }
  if (sum == 2)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<notpass>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jge    115c <notpass+0x5c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movss  0xec9(%rip),%xmm0
ucomiss (%rax),%xmm0
jbe    1149 <notpass+0x49>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <notpass+0x4e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1116 <notpass+0x16>
cmpl   $0x2,-0x14(%rbp)
jne    1172 <notpass+0x72>
movl   $0x1,-0x4(%rbp)
jmp    1179 <notpass+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<notpass>:
movups (%rdi),%xmm0
movss  0xef5(%rip),%xmm1
xor    %eax,%eax
ucomiss 0x10(%rdi),%xmm1
seta   %al
cmpltps 0xef4(%rip),%xmm0
01
movmskps %xmm0,%ecx
mov    %ecx,%edx
shr    %dl
and    $0x5,%dl
sub    %dl,%cl
mov    %ecx,%edx
and    $0x33,%dl
shr    $0x2,%cl
and    $0x33,%cl
add    %dl,%cl
mov    %ecx,%edx
shr    $0x4,%dl
add    %cl,%dl
and    $0xf,%dl
movzbl %dl,%ecx
add    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @notpass(float* %0) {
%2 = alloca i32
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
store float* %0, float** %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %1
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load float*, float** %3
%11 = getelementptr inbounds float, float* %10, i32 1
store float* %11, float** %3
%12 = load float, float* %10
%13 = fcmp olt float %12, 6.000000e+01
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %17
17: ; preds = %14, %9
br label %18
18: ; preds = %17
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 1, i32* %2
br label %26
25: ; preds = %21
store i32 0, i32* %2
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @notpass(float* nocapture %0) {
%2 = bitcast float* %0 to <4 x float>*
%3 = load <4 x float>, <4 x float>* %2
%4 = fcmp olt <4 x float> %3, <float 6.000000e+01, float 6.000000e+01, float 6.000000e+01, float 6.000000e+01>
%5 = getelementptr inbounds float, float* %0, i64 4
%6 = load float, float* %5
%7 = fcmp olt float %6, 6.000000e+01
%8 = zext i1 %7 to i32
%9 = bitcast <4 x i1> %4 to i4
%10 = call i4 @llvm.ctpop.i4(i4 %9)
%11 = zext i4 %10 to i32
%12 = add nuw nsw i32 %11, %8
%13 = icmp eq i32 %12, 2
%14 = zext i1 %13 to i32
ret i32 %14
}
int power(int base, int exp) {
  int pwr;
  if (exp == 0)
    return 1;
  pwr = power(base, exp / 2);
  if (exp % 2 == 0) {
    return pwr * pwr;
  } else {
    return base * pwr * pwr;
  }
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1134 <power+0x24>
movl   $0x1,-0x4(%rbp)
jmp    117d <power+0x6d>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
call   1030 <power@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116f <power+0x5f>
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117d <power+0x6d>
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
test   %esi,%esi
je     1142 <power+0x32>
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
shr    $0x1f,%esi
add    %ebp,%esi
sar    %esi
call   1030 <power@plt>
mov    %eax,%ecx
imul   %eax,%ecx
test   $0x1,%bpl
mov    $0x1,%eax
cmovne %ebx,%eax
imul   %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @power(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = sdiv i32 %1, 2
%6 = tail call i32 @power(i32 %0, i32 %5)
%7 = and i32 %1, 1
%8 = icmp eq i32 %7, 0
%9 = mul i32 %6, %6
%10 = select i1 %8, i32 1, i32 %0
%11 = mul i32 %9, %10
br label %12
12: ; preds = %4, %2
%13 = phi i32 [ 1, %2 ], [ %11, %4 ]
ret i32 %13
}