xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int fork();
int /*<<< orphan*/ wait(int *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
int main() {
  int pid = fork();
  if (pid > 0) {
    int status;
    wait(&status);
    write(STDOUT_FILENO, "World!\n", 7);
  } else {
    write(STDOUT_FILENO, "Hello ", 6);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <fork@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    117b <main+0x4b>
lea    -0xc(%rbp),%rdi
call   1040 <wait@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
mov    $0x7,%edx
call   1030 <write@plt>
jmp    1195 <main+0x65>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
mov    $0x6,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <fork@plt>
test   %eax,%eax
jle    115d <main+0x2d>
lea    0x4(%rsp),%rdi
call   1040 <wait@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
mov    $0x7,%edx
jmp    1172 <main+0x42>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
mov    $0x6,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
@.str = [8 x i8] c"World!\0A\00"
@.str.1 = [7 x i8] c"Hello \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @fork()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i32 @wait(i32* %3)
%9 = load i32, i32* @STDOUT_FILENO
%10 = call i32 @write(i32 %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
br label %14
11: ; preds = %0
%12 = load i32, i32* @STDOUT_FILENO
%13 = call i32 @write(i32 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
br label %14
14: ; preds = %11, %7
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
@.str = [8 x i8] c"World!\0A\00"
@.str.1 = [7 x i8] c"Hello \00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 (...) @fork()
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = bitcast i32* %1 to i8*
%6 = call i32 @wait(i32* %1)
%7 = load i32, i32* @STDOUT_FILENO
%8 = call i32 @write(i32 %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
br label %12
9: ; preds = %0
%10 = load i32, i32* @STDOUT_FILENO
%11 = tail call i32 @write(i32 %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
br label %12
12: ; preds = %9, %4
ret i32 0
}
void test54_PrintImpl_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @test54_PrintImpl_targetInit__I() {
ret void
}
void fiq_glue_resume(void) {}


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

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

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

LLVM IR (-O2):
define void @fiq_glue_resume() {
ret void
}
/* Type definitions */
struct vec2i {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
float vec2i_angle(int /*<<< orphan*/ *);
__attribute__((always_)) float psvec2i_angle(struct vec2i *a) {
  return vec2i_angle((int32_t *)a);
}


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

x86 assembly (clang, -O2):
<psvec2i_angle>:
jmp    1030 <vec2i_angle@plt>

LLVM IR (-O0):
%struct.vec2i = type { i32 }
define float @psvec2i_angle(%struct.vec2i* %0) {
%2 = alloca %struct.vec2i*
store %struct.vec2i* %0, %struct.vec2i** %2
%3 = load %struct.vec2i*, %struct.vec2i** %2
%4 = bitcast %struct.vec2i* %3 to i32*
%5 = call float @vec2i_angle(i32* %4)
ret float %5
}

LLVM IR (-O2):
%struct.vec2i = type { i32 }
define float @psvec2i_angle(%struct.vec2i* %0) {
%2 = getelementptr %struct.vec2i, %struct.vec2i* %0, i64 0, i32 0
%3 = tail call float @vec2i_angle(i32* %2)
ret float %3
}
/* Variables and functions */
size_t strlen(char const *);
const char *file_base(const char *filename) {
  size_t i = strlen(filename);
  while (i && filename[i - 1] != '/')
    --i;
  return &filename[i];
}


x86 assembly (clang, -O0):
<file_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1152 <file_base+0x42>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1162 <file_base+0x52>
jmp    1173 <file_base+0x63>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1129 <file_base+0x19>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_base>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
nopl   0x0(%rax)
mov    %rax,%rcx
sub    $0x1,%rax
jb     1130 <file_base+0x20>
cmpb   $0x2f,-0x1(%rbx,%rcx,1)
jne    1120 <file_base+0x10>
add    %rcx,%rbx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @file_base(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
br label %3
3: ; preds = %6, %1
%4 = phi i64 [ %2, %1 ], [ %7, %6 ]
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = add i64 %4, -1
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 47
br i1 %10, label %11, label %3
11: ; preds = %3, %6
%12 = getelementptr inbounds i8, i8* %0, i64 %4
ret i8* %12
}
int isprime(long int n) {
  long int i, j;
  int r = 1;
  for (i = 2; i * i <= n; i += 2)
    if (n % i == 0)
      r = 0;
  return r;
}


x86 assembly (clang, -O0):
<isprime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x1c(%rbp)
movq   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     115b <isprime+0x5b>
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
jne    1145 <isprime+0x45>
movl   $0x0,-0x1c(%rbp)
jmp    114a <isprime+0x4a>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <isprime+0x17>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isprime>:
mov    $0x1,%esi
cmp    $0x4,%rdi
jge    1111 <isprime+0x11>
mov    $0x1,%eax
ret
mov    $0x2,%ecx
jmp    1132 <isprime+0x32>
nopl   0x0(%rax,%rax,1)
add    $0x2,%rcx
mov    %rcx,%rdx
imul   %rcx,%rdx
mov    %eax,%esi
cmp    %rdi,%rdx
jg     1161 <isprime+0x61>
mov    %rdi,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1150 <isprime+0x50>
mov    %rdi,%rax
cqto
idiv   %rcx
jmp    1156 <isprime+0x56>
nopl   0x0(%rax,%rax,1)
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
xor    %eax,%eax
test   %rdx,%rdx
je     1120 <isprime+0x20>
mov    %esi,%eax
jmp    1120 <isprime+0x20>
ret

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

LLVM IR (-O2):
define i32 @isprime(i64 %0) {
%2 = icmp slt i64 %0, 4
br i1 %2, label %12, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 1, %1 ]
%5 = phi i64 [ %9, %3 ], [ 2, %1 ]
%6 = srem i64 %0, %5
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i32 0, i32 %4
%9 = add nuw nsw i64 %5, 2
%10 = mul nsw i64 %9, %9
%11 = icmp sgt i64 %10, %0
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ 1, %1 ], [ %8, %3 ]
ret i32 %13
}
void gtk_button_box_set_layout() {}


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

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

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

LLVM IR (-O2):
define void @gtk_button_box_set_layout() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outOfMemory();
char *strdup(char const *);
char *safe_strdup(const char *orig) {
  char *result = strdup(orig);
  if (result == NULL)
    outOfMemory();
  return result;
}


x86 assembly (clang, -O0):
<safe_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <safe_strdup+0x2b>
mov    $0x0,%al
call   1030 <outOfMemory@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_strdup>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <safe_strdup+0x15>
xor    %eax,%eax
call   1030 <outOfMemory@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @safe_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @outOfMemory()
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define noalias i8* @safe_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @outOfMemory()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
int foo(int sec) {
  printf("sleep for %d\n", sec);
  sleep(sec);
  return sec;
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <sleep@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"sleep for %d\0A\00"
define i32 @foo(i32 returned %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @sleep(i32 %0)
ret i32 %0
}
/* Type definitions */
struct event_timer_heap {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct event_timer_heap *);
void event_timer_heap_free(struct event_timer_heap *heap) {
  if (heap != NULL)
    free(heap);
}


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

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

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

LLVM IR (-O2):
%struct.event_timer_heap = type { i32 }
define void @event_timer_heap_free(%struct.event_timer_heap* %0) {
%2 = icmp eq %struct.event_timer_heap* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.event_timer_heap* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
scalar_t__ send_command_to_variable_server(int, char *);
int set_sync(int socket) {
  if (send_command_to_variable_server(socket, "trick.var_sync(1)") < 0) {
    return -1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<set_sync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xedb(%rip),%rsi
call   1030 <send_command_to_variable_server@plt>
cmp    $0x0,%rax
jge    1140 <set_sync+0x30>
movl   $0xffffffff,-0x4(%rbp)
jmp    1147 <set_sync+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_sync>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <send_command_to_variable_server@plt>
sar    $0x3f,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"trick.var_sync(1)\00"
define i32 @set_sync(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @send_command_to_variable_server(i32 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = icmp slt 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 = [18 x i8] c"trick.var_sync(1)\00"
define i32 @set_sync(i32 %0) {
%2 = tail call i64 @send_command_to_variable_server(i32 %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = ashr i64 %2, 63
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint;

/* Variables and functions */
int ones(int);
uint lowbits(uint x, uint k) { return x & ones(k); }


x86 assembly (clang, -O0):
<lowbits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <ones@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
and    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowbits>:
push   %rbx
mov    %edi,%ebx
mov    %esi,%edi
call   1030 <ones@plt>
and    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @lowbits(i32 %0, i32 %1) {
%3 = tail call i32 @ones(i32 %1)
%4 = and i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ turn_off_light();
void timer_fired() { turn_off_light(); }


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

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

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

LLVM IR (-O2):
define void @timer_fired() {
%1 = tail call i32 (...) @turn_off_light()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ read_image_file(int /*<<< orphan*/ *);
int read_image(const char *image_path) {
  FILE *f = fopen(image_path, "rb");
  if (!f) {
    return 1;
  }
  read_image_file(f);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<read_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1167 <read_image+0x37>
movl   $0x1,-0x4(%rbp)
jmp    1180 <read_image+0x50>
mov    -0x18(%rbp),%rdi
call   1050 <read_image_file@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_image>:
push   %rbx
lea    0xec8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1159 <read_image+0x29>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <read_image_file@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define i32 @read_image(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 1, i32* %2
br label %15
10: ; preds = %1
%11 = load i32*, i32** %4
%12 = call i32 @read_image_file(i32* %11)
%13 = load i32*, i32** %4
%14 = call i32 @fclose(i32* %13)
store i32 0, i32* %2
br label %15
15: ; preds = %10, %9
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define i32 @read_image(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @read_image_file(i32* %2)
%6 = tail call i32 @fclose(i32* %2)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ 0, %4 ], [ 1, %1 ]
ret i32 %8
}
/* Variables and functions */
int d20(int);
int d21(int a) { return d20(d20(a)); }


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

x86 assembly (clang, -O2):
<d21>:
push   %rax
call   1030 <d20@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <d20@plt>

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

LLVM IR (-O2):
define i32 @d21(i32 %0) {
%2 = tail call i32 @d20(i32 %0)
%3 = tail call i32 @d20(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int i = 2000;
  printf("%10i\n%-8.5i\n", i, i);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"%10i\0A%-8.5i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 2000, i32 2000)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gen(char *);
void cgmul(void) { gen("imul\tcx"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"imul\09cx\00"
define void @cgmul() {
%1 = call i32 @gen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"imul\09cx\00"
define void @cgmul() {
%1 = tail call i32 @gen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char const *, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
FILE *__simplePNG__sfopen(char const *name, char const *mode) {
  FILE *file = NULL;
  file = fopen(name, mode);
  if (file == NULL) {
    fprintf(stderr, "Unable to open file '%s' in mode '%s'.\n", name, mode);
    exit(2);
  }
  return file;
}


x86 assembly (clang, -O0):
<__simplePNG__sfopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118b <__simplePNG__sfopen+0x5b>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe84(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__simplePNG__sfopen>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <fopen@plt>
test   %rax,%rax
je     114c <__simplePNG__sfopen+0x1c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"Unable to open file '%s' in mode '%s'.\0A\00"
define i32* @__simplePNG__sfopen(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32* null, i32** %5
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %6, i8* %7)
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = call i32 @exit(i32 2)
unreachable
17: ; preds = %2
%18 = load i32*, i32** %5
ret i32* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"Unable to open file '%s' in mode '%s'.\0A\00"
define noalias i32* @__simplePNG__sfopen(i8* %0, i8* %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%8 = tail call i32 @exit(i32 2)
unreachable
9: ; preds = %2
ret i32* %3
}
double deg2rad(double degrees) {
  return (3.1415926535897932384626433832795028841971 / 180.0) * degrees;
}


x86 assembly (clang, -O0):
<deg2rad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @deg2rad(double %0) {
%2 = fmul double %0, 0x3F91DF46A2529D39
ret double %2
}
/* Variables and functions */
int CheckINCHIKey(char const *);
int cdecl_CheckINCHIKey(const char *szINCHIKey) {
  return CheckINCHIKey(szINCHIKey);
}


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

x86 assembly (clang, -O2):
<cdecl_CheckINCHIKey>:
jmp    1030 <CheckINCHIKey@plt>

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

LLVM IR (-O2):
define i32 @cdecl_CheckINCHIKey(i8* %0) {
%2 = tail call i32 @CheckINCHIKey(i8* %0)
ret i32 %2
}
int test_imm_12uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x12 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_12uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 18
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ CleanInputBar();
int /*<<< orphan*/ PrintfStatusBar();
void signalRedraw() {
  PrintfStatusBar();
  CleanInputBar();
}


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

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

LLVM IR (-O0):
define void @signalRedraw() {
%1 = call i32 (...) @PrintfStatusBar()
%2 = call i32 (...) @CleanInputBar()
ret void
}

LLVM IR (-O2):
define void @signalRedraw() {
%1 = tail call i32 (...) @PrintfStatusBar()
%2 = tail call i32 (...) @CleanInputBar()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void m_free(void *p) { free(p); }


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

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

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

LLVM IR (-O2):
define void @m_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ blinkdash();
int /*<<< orphan*/ blinkdot();
int /*<<< orphan*/ sleep(double);
int blinkA() {
  blinkdot();
  blinkdash();
  sleep(1.5);
  return 0;
}


x86 assembly (clang, -O0):
<blinkA>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <blinkdot@plt>
mov    $0x0,%al
call   1040 <blinkdash@plt>
movsd  0xeb6(%rip),%xmm0
call   1050 <sleep@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<blinkA>:
push   %rax
xor    %eax,%eax
call   1030 <blinkdot@plt>
xor    %eax,%eax
call   1040 <blinkdash@plt>
movsd  0xeb9(%rip),%xmm0
call   1050 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @blinkA() {
%1 = call i32 (...) @blinkdot()
%2 = call i32 (...) @blinkdash()
%3 = call i32 @sleep(double 1.500000e+00)
ret i32 0
}

LLVM IR (-O2):
define i32 @blinkA() {
%1 = tail call i32 (...) @blinkdot()
%2 = tail call i32 (...) @blinkdash()
%3 = tail call i32 @sleep(double 1.500000e+00)
ret i32 0
}
long int longint_ignoring_shortint(long int x, short int y) { return x; }


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

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

LLVM IR (-O0):
define i64 @longint_ignoring_shortint(i64 %0, i16 signext %1) {
%3 = alloca i64
%4 = alloca i16
store i64 %0, i64* %3
store i16 %1, i16* %4
%5 = load i64, i64* %3
ret i64 %5
}

LLVM IR (-O2):
define i64 @longint_ignoring_shortint(i64 returned %0, i16 signext %1) {
ret i64 %0
}
/* Variables and functions */
double gettime();
double HRTime_Time() { return (gettime()); }


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

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

LLVM IR (-O0):
define double @HRTime_Time() {
%1 = call double (...) @gettime()
ret double %1
}

LLVM IR (-O2):
define double @HRTime_Time() {
%1 = tail call double (...) @gettime()
ret double %1
}
/* Variables and functions */
int strcmp(char const *, char const *);
int cstring_cmp(const void *a, const void *b) {
  const char **ia = (const char **)a;
  const char **ib = (const char **)b;
  return strcmp(*ia, *ib);
}


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

x86 assembly (clang, -O2):
<cstring_cmp>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @cstring_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %12, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @cstring_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ idt_init();
int /*<<< orphan*/ put_str(char *);
void init_all() {
  put_str("init_all\n");
  idt_init();
}


x86 assembly (clang, -O0):
<init_all>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <put_str@plt>
mov    $0x0,%al
call   1030 <idt_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_all>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <put_str@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <idt_init@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"init_all\0A\00"
define void @init_all() {
%1 = tail call i32 @put_str(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @idt_init()
ret void
}
int newgap(int gap) {
  gap = (gap * 10) / 13;
  if (gap < 1)
    return 1;
  return (gap == 9 || gap == 10) ? 11 : gap;
}


x86 assembly (clang, -O0):
<newgap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
imul   $0xa,-0x8(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    112c <newgap+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1159 <newgap+0x59>
cmpl   $0x9,-0x8(%rbp)
je     1140 <newgap+0x40>
cmpl   $0xa,-0x8(%rbp)
jne    114d <newgap+0x4d>
mov    $0xb,%eax
mov    %eax,-0xc(%rbp)
jmp    1153 <newgap+0x53>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<newgap>:
add    %edi,%edi
lea    (%rdi,%rdi,4),%ecx
mov    $0x1,%eax
cmp    $0xd,%ecx
jl     1129 <newgap+0x29>
lea    -0x75(%rcx),%edx
mov    $0xb,%eax
cmp    $0x1a,%edx
jb     1129 <newgap+0x29>
mov    %ecx,%eax
imul   $0x4ec4ec4f,%rax,%rax
shr    $0x22,%rax
ret

LLVM IR (-O0):
define i32 @newgap(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 10
%6 = sdiv i32 %5, 13
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 1, i32* %2
br label %21
10: ; preds = %1
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 9
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %17
16: ; preds = %13, %10
br label %19
17: ; preds = %13
%18 = load i32, i32* %3
br label %19
19: ; preds = %17, %16
%20 = phi i32 [ 11, %16 ], [ %18, %17 ]
store i32 %20, i32* %2
br label %21
21: ; preds = %19, %9
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @newgap(i32 %0) {
%2 = mul nsw i32 %0, 10
%3 = icmp slt i32 %2, 13
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = udiv i32 %2, 13
%6 = add nsw i32 %2, -117
%7 = icmp ult i32 %6, 26
%8 = select i1 %7, i32 11, i32 %5
br label %9
9: ; preds = %1, %4
%10 = phi i32 [ %8, %4 ], [ 1, %1 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void show_io(char *io_pipe_array[]) {
  printf("Input file: %s\n", io_pipe_array[0]);
  printf("Output file: %s\n", io_pipe_array[1]);
}


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

x86 assembly (clang, -O2):
<show_io>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rsi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%rsi
lea    0xee2(%rip),%rdi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Input file: %s\0A\00"
@.str.1 = [17 x i8] c"Output file: %s\0A\00"
define void @show_io(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8**, i8*** %2
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Input file: %s\0A\00"
@.str.1 = [17 x i8] c"Output file: %s\0A\00"
define void @show_io(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = getelementptr inbounds i8*, i8** %0, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret void
}
void av_hwdevice_ctx_create() {}


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

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

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

LLVM IR (-O2):
define void @av_hwdevice_ctx_create() {
ret void
}
/* Variables and functions */
double cos(int);
double vx_x(double x, double y, int T) {
  return (-0.5 * T * 3.141592 * cos(T * 3.141592 * x));
}


x86 assembly (clang, -O0):
<vx_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xed6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xec2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xeac(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vx_x>:
push   %rax
cvtsi2sd %edi,%xmm1
movsd  0xee3(%rip),%xmm3
mulsd  %xmm1,%xmm3
movsd  0xedf(%rip),%xmm2
mulsd  %xmm2,%xmm3
movsd  %xmm3,(%rsp)
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <cos@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @vx_x(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i32
store double %0, double* %4
store double %1, double* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = fmul double -5.000000e-01, %8
%10 = fmul double %9, 0x400921FAFC8B007A
%11 = load i32, i32* %6
%12 = sitofp i32 %11 to double
%13 = fmul double %12, 0x400921FAFC8B007A
%14 = load double, double* %4
%15 = fmul double %13, %14
%16 = fptosi double %15 to i32
%17 = call double @cos(i32 %16)
%18 = fmul double %10, %17
ret double %18
}

LLVM IR (-O2):
define double @vx_x(double %0, double %1, i32 %2) {
%4 = sitofp i32 %2 to double
%5 = fmul double %4, -5.000000e-01
%6 = fmul double %5, 0x400921FAFC8B007A
%7 = fmul double %4, 0x400921FAFC8B007A
%8 = fmul double %7, %0
%9 = fptosi double %8 to i32
%10 = tail call double @cos(i32 %9)
%11 = fmul double %6, %10
ret double %11
}
int FnCompare_int(const void *v1, const void *v2) {
  const int *i1 = v1;
  const int *i2 = v2;
  if (*i1 < *i2)
    return (-1);
  else if (*i1 > *i2)
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<FnCompare_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    113a <FnCompare_int+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <FnCompare_int+0x5f>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jle    1158 <FnCompare_int+0x58>
movl   $0x1,-0x4(%rbp)
jmp    115f <FnCompare_int+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FnCompare_int>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @FnCompare_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
%8 = icmp sgt i32 %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
void arith_lex_reset() {}


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

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

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

LLVM IR (-O2):
define void @arith_lex_reset() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
void help(void) {
  printf("Welcome to IIDX COPULA Enabler!\n");
  printf("By KcLKcL\n\n");
  printf("This tool will auto-magically patch your COPULA dll to "
         "enable\ncertain features and hacks!\n\n");
  printf("bm2dx.dll not found, put this on the same directory as bm2dx.dll, "
         "and make sure bm2dx.dll is not read-only.");
  getchar();
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
call   1030 <printf@plt>
lea    0xf3a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xf34(%rip),%rdi
call   1030 <puts@plt>
lea    0xf48(%rip),%rdi
call   1030 <puts@plt>
lea    0xf47(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <getchar@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Welcome to IIDX COPULA Enabler!\0A\00"
@.str.1 = [12 x i8] c"By KcLKcL\0A\0A\00"
@.str.2 = [92 x i8] c"This tool will auto-magically patch your COPULA dll to enable\0Acertain features and hacks!\0A\0A\00"
@.str.3 = [108 x i8] c"bm2dx.dll not found, put this on the same directory as bm2dx.dll, and make sure bm2dx.dll is not read-only.\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@.str.3 = [108 x i8] c"bm2dx.dll not found, put this on the same directory as bm2dx.dll, and make sure bm2dx.dll is not read-only.\00"
@str = [32 x i8] c"Welcome to IIDX COPULA Enabler!\00"
@str.4 = [11 x i8] c"By KcLKcL\0A\00"
@str.5 = [91 x i8] c"This tool will auto-magically patch your COPULA dll to enable\0Acertain features and hacks!\0A\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([108 x i8], [108 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 (...) @getchar()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void handler(int sig) { printf("signal no(%d) Received\n", sig); }


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

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

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

LLVM IR (-O2):
@.str = [24 x i8] c"signal no(%d) Received\0A\00"
define void @handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
unsigned long int rand() {
  static unsigned long int lfsr = 0x14b6bc3c;
  static int period = 0;
  lfsr = (lfsr >> 1) ^ (unsigned long int)((0 - (lfsr & 1u)) & 0xd0000001u);
  ++period;
  return lfsr;
}


x86 assembly (clang, -O0):
<rand>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f15(%rip),%rax
shr    $0x1,%rax
mov    0x2f0a(%rip),%rdx
and    $0x1,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
movabs $0xd0000001,%rdx
and    %rdx,%rcx
xor    %rcx,%rax
mov    %rax,0x2eea(%rip)
mov    0x2ef0(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ee7(%rip)
mov    0x2ed4(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand>:
mov    0x2f19(%rip),%rax
mov    %rax,%rcx
shr    %rcx
and    $0x1,%eax
neg    %eax
and    $0xd0000001,%eax
xor    %rcx,%rax
mov    %rax,0x2eff(%rip)
addl   $0x1,0x2f04(%rip)
ret

LLVM IR (-O0):
@rand.lfsr = internal global i64 347520060
@rand.period = internal global i32 0
define i64 @rand() {
%1 = load i64, i64* @rand.lfsr
%2 = lshr i64 %1, 1
%3 = load i64, i64* @rand.lfsr
%4 = and i64 %3, 1
%5 = sub i64 0, %4
%6 = and i64 %5, 3489660929
%7 = xor i64 %2, %6
store i64 %7, i64* @rand.lfsr
%8 = load i32, i32* @rand.period
%9 = add nsw i32 %8, 1
store i32 %9, i32* @rand.period
%10 = load i64, i64* @rand.lfsr
ret i64 %10
}

LLVM IR (-O2):
@rand.lfsr = internal unnamed_addr global i64 347520060
@rand.period = internal unnamed_addr global i32 0
define i64 @rand() {
%1 = load i64, i64* @rand.lfsr
%2 = lshr i64 %1, 1
%3 = and i64 %1, 1
%4 = sub nsw i64 0, %3
%5 = and i64 %4, 3489660929
%6 = xor i64 %5, %2
store i64 %6, i64* @rand.lfsr
%7 = load i32, i32* @rand.period
%8 = add nsw i32 %7, 1
store i32 %8, i32* @rand.period
ret i64 %6
}
int foo(int a, int b) { return a + b; }


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

x86 assembly (clang, -O2):
<foo>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
unsigned long long __andn_u64(unsigned long, unsigned long);
unsigned long long test__andn_u64(unsigned long __X, unsigned long __Y) {
  return __andn_u64(__X, __Y);
}


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

x86 assembly (clang, -O2):
<test__andn_u64>:
jmp    1030 <__andn_u64@plt>

LLVM IR (-O0):
define i64 @test__andn_u64(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i64 @__andn_u64(i64 %5, i64 %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @test__andn_u64(i64 %0, i64 %1) {
%3 = tail call i64 @__andn_u64(i64 %0, i64 %1)
ret i64 %3
}
int SCFreeEx(void **buffer) {
  (*buffer);
  *buffer = 0;
  return 1;
}


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

x86 assembly (clang, -O2):
<SCFreeEx>:
movq   $0x0,(%rdi)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @SCFreeEx(i8** nocapture writeonly %0) {
store i8* null, i8** %0
ret i32 1
}