xunge/DecIR huggingface dataset:
/* Type definitions */
struct vec3i {
  int dummy;
};
struct mat3 {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec3i_multiply_mat3(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *, float *);
__attribute__((always_)) struct vec3i *
psvec3i_multiply_mat3(struct vec3i *result, struct vec3i *a, struct mat3 *m) {
  vec3i_multiply_mat3((int32_t *)result, (int32_t *)a, (float *)m);
  return result;
}


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

x86 assembly (clang, -O2):
<psvec3i_multiply_mat3>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec3i_multiply_mat3@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec3i = type { i32 }
%struct.mat3 = type { i32 }
define %struct.vec3i* @psvec3i_multiply_mat3(%struct.vec3i* %0, %struct.vec3i* %1, %struct.mat3* %2) {
%4 = alloca %struct.vec3i*
%5 = alloca %struct.vec3i*
%6 = alloca %struct.mat3*
store %struct.vec3i* %0, %struct.vec3i** %4
store %struct.vec3i* %1, %struct.vec3i** %5
store %struct.mat3* %2, %struct.mat3** %6
%7 = load %struct.vec3i*, %struct.vec3i** %4
%8 = bitcast %struct.vec3i* %7 to i32*
%9 = load %struct.vec3i*, %struct.vec3i** %5
%10 = bitcast %struct.vec3i* %9 to i32*
%11 = load %struct.mat3*, %struct.mat3** %6
%12 = bitcast %struct.mat3* %11 to float*
%13 = call i32 @vec3i_multiply_mat3(i32* %8, i32* %10, float* %12)
%14 = load %struct.vec3i*, %struct.vec3i** %4
ret %struct.vec3i* %14
}

LLVM IR (-O2):
%struct.vec3i = type { i32 }
%struct.mat3 = type { i32 }
define %struct.vec3i* @psvec3i_multiply_mat3(%struct.vec3i* returned %0, %struct.vec3i* %1, %struct.mat3* %2) {
%4 = getelementptr %struct.vec3i, %struct.vec3i* %0, i64 0, i32 0
%5 = getelementptr %struct.vec3i, %struct.vec3i* %1, i64 0, i32 0
%6 = bitcast %struct.mat3* %2 to float*
%7 = tail call i32 @vec3i_multiply_mat3(i32* %4, i32* %5, float* %6)
ret %struct.vec3i* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ XErrorEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ quit(int);
int error_handler(Display *dpy, XErrorEvent *evp) {
  quit(1);
  return (0);
}


x86 assembly (clang, -O0):
<error_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1030 <quit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_handler>:
push   %rax
mov    $0x1,%edi
call   1030 <quit@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @error_handler(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = tail call i32 @quit(i32 1)
ret i32 0
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int solcon_write_next_solution(int *k, int n, int m, double *sol) {
  int b[2], fail;
  b[0] = n;
  b[1] = m;
  fail = _ada_use_c2phc(136, k, b, sol);
  return fail;
}


x86 assembly (clang, -O0):
<solcon_write_next_solution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x88,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solcon_write_next_solution>:
push   %rax
mov    %rdi,%rax
mov    %esi,(%rsp)
mov    %edx,0x4(%rsp)
mov    %rsp,%rdx
mov    $0x88,%edi
mov    %rax,%rsi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @solcon_write_next_solution(i32* %0, i32 %1, i32 %2, double* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
%9 = alloca [2 x i32]
%10 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store double* %3, double** %8
%11 = load i32, i32* %6
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 %11, i32* %12
%13 = load i32, i32* %7
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
store i32 %13, i32* %14
%15 = load i32*, i32** %5
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%17 = load double*, double** %8
%18 = call i32 @_ada_use_c2phc(i32 136, i32* %15, i32* %16, double* %17)
store i32 %18, i32* %10
%19 = load i32, i32* %10
ret i32 %19
}

LLVM IR (-O2):
define i32 @solcon_write_next_solution(i32* %0, i32 %1, i32 %2, double* %3) {
%5 = alloca [2 x i32]
%6 = bitcast [2 x i32]* %5 to i8*
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 %1, i32* %7
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
store i32 %2, i32* %8
%9 = call i32 @_ada_use_c2phc(i32 136, i32* %0, i32* %7, double* %3)
ret i32 %9
}
void Matrix_Free(int **matrix, int rows) {
  int i;
  for (i = 0; i < rows; i++) {
    free(matrix[i]);
  }
  free(matrix);
}


x86 assembly (clang, -O0):
<Matrix_Free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <Matrix_Free+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <Matrix_Free+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Matrix_Free>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <Matrix_Free+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <Matrix_Free+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @Matrix_Free(i32** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32*, i32** %0, i64 %7
%9 = bitcast i32** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast i32** %0 to i8*
tail call void @free(i8* %14)
ret void
}
/* Type definitions */
struct spqueue_t {
  int dummy;
};
struct pqueue_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ spqueue_pop(struct spqueue_t *);
void pqueue_pop(struct pqueue_t *pqueue) {
  spqueue_pop((struct spqueue_t *)pqueue);
}


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

x86 assembly (clang, -O2):
<pqueue_pop>:
jmp    1030 <spqueue_pop@plt>

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

LLVM IR (-O2):
%struct.pqueue_t = type { i32 }
%struct.spqueue_t = type { i32 }
define void @pqueue_pop(%struct.pqueue_t* %0) {
%2 = bitcast %struct.pqueue_t* %0 to %struct.spqueue_t*
%3 = tail call i32 @spqueue_pop(%struct.spqueue_t* %2)
ret void
}
void sig_hand(int signo) {}


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

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

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

LLVM IR (-O2):
define void @sig_hand(i32 %0) {
ret void
}
/* Variables and functions */
int system(char *);
int main(void) { return system("xcbm2.exe -sounddev dummy"); }


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"xcbm2.exe -sounddev dummy\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}

LLVM IR (-O2):
@.str = [26 x i8] c"xcbm2.exe -sounddev dummy\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void _set_ica(unsigned char *u) { u[1] |= (1 << 3); }


x86 assembly (clang, -O0):
<_set_ica>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%ecx
or     $0x8,%ecx
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_set_ica>:
orb    $0x8,0x1(%rdi)
ret

LLVM IR (-O0):
define void @_set_ica(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = or i32 %6, 8
%8 = trunc i32 %7 to i8
store i8 %8, i8* %4
ret void
}

LLVM IR (-O2):
define void @_set_ica(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = or i8 %3, 8
store i8 %4, i8* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void set_pmu_sleep_clk_default() {
  mbus_remote_register_write(0x7, 0x19,
                             ((1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x7, 0x19,
                             ((1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x7, 0x15,
                             ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) |
                              (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(100 * 10);
}


x86 assembly (clang, -O0):
<set_pmu_sleep_clk_default>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7,%edi
mov    $0x19,%esi
mov    $0x2202,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x7,%edi
mov    $0x19,%esi
mov    $0x2202,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x7,%edi
mov    $0x15,%esi
mov    $0xe204,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x3e8,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pmu_sleep_clk_default>:
push   %rax
mov    $0x7,%edi
mov    $0x19,%esi
mov    $0x2202,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x7,%edi
mov    $0x19,%esi
mov    $0x2202,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x7,%edi
mov    $0x15,%esi
mov    $0xe204,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x3e8,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @set_pmu_sleep_clk_default() {
%1 = call i32 @mbus_remote_register_write(i32 7, i32 25, i32 8706)
%2 = call i32 @delay(i32 100)
%3 = call i32 @mbus_remote_register_write(i32 7, i32 25, i32 8706)
%4 = call i32 @delay(i32 100)
%5 = call i32 @mbus_remote_register_write(i32 7, i32 21, i32 57860)
%6 = call i32 @delay(i32 1000)
ret void
}

LLVM IR (-O2):
define void @set_pmu_sleep_clk_default() {
%1 = tail call i32 @mbus_remote_register_write(i32 7, i32 25, i32 8706)
%2 = tail call i32 @delay(i32 100)
%3 = tail call i32 @mbus_remote_register_write(i32 7, i32 25, i32 8706)
%4 = tail call i32 @delay(i32 100)
%5 = tail call i32 @mbus_remote_register_write(i32 7, i32 21, i32 57860)
%6 = tail call i32 @delay(i32 1000)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execlp(char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ increment_rank();
int /*<<< orphan*/ whoami(char *);
int main(int argc, char **argv) {
  increment_rank();
  whoami("bar");
  execlp("baz", "baz", argv[1], NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <increment_rank@plt>
lea    0xeac(%rip),%rdi
call   1030 <whoami@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe9c(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1050 <execlp@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
call   1040 <increment_rank@plt>
lea    0xebe(%rip),%rdi
call   1030 <whoami@plt>
mov    0x8(%rbx),%rdx
lea    0xeb2(%rip),%rdi
mov    %rdi,%rsi
xor    %ecx,%ecx
call   1050 <execlp@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"bar\00"
@.str.1 = [4 x i8] c"baz\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @increment_rank()
%7 = call i32 @whoami(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @execlp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10, i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"bar\00"
@.str.1 = [4 x i8] c"baz\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @increment_rank()
%4 = tail call i32 @whoami(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @execlp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32* null)
ret i32 0
}
unsigned long hash_sdbm(char *str) {
  unsigned long hash = 0;
  unsigned long c;
  while ((c = *str++) != '\0') {
    hash = c + (hash << 6) + (hash << 16) - hash;
  }
  return hash;
}


x86 assembly (clang, -O0):
<hash_sdbm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbq (%rax),%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1158 <hash_sdbm+0x58>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
shl    $0x10,%rcx
add    %rcx,%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <hash_sdbm+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_sdbm>:
mov    (%rdi),%cl
test   %cl,%cl
je     112a <hash_sdbm+0x2a>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbq %cl,%rcx
imul   $0x1003f,%rax,%rax
add    %rcx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_sdbm+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @hash_sdbm(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 0, %1 ]
%8 = sext i8 %5 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = mul i64 %7, 65599
%11 = add i64 %10, %8
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 0, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void kernel_main(void) {
  puts("-- DK: Donkey Kernel --\n");
  puts("Thus begins the infinite loop\n");
  while (1) {
  }
}


x86 assembly (clang, -O0):
<kernel_main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
jmp    112c <kernel_main+0x1c>

x86 assembly (clang, -O2):
<kernel_main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef5(%rip),%rdi
call   1030 <puts@plt>
nopl   0x0(%rax)
jmp    1130 <kernel_main+0x20>

LLVM IR (-O0):
@.str = [25 x i8] c"-- DK: Donkey Kernel --\0A\00"
@.str.1 = [31 x i8] c"Thus begins the infinite loop\0A\00"
define void @kernel_main() {
%1 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %3
3: ; preds = %0, %3
br label %3
}

LLVM IR (-O2):
@.str = [25 x i8] c"-- DK: Donkey Kernel --\0A\00"
@.str.1 = [31 x i8] c"Thus begins the infinite loop\0A\00"
define void @kernel_main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %3
3: ; preds = %0, %3
br label %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ RB_XMLDB_Generate_String(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void RB_XMLDB_Generate_BeginSection(FILE *dest_doc, int depth, char *name) {
  (depth = depth);
  ;
  fprintf(dest_doc, "%s", "<section>\n<title>");
  RB_XMLDB_Generate_String(dest_doc, name);
  fprintf(dest_doc, "%s", "</title>\n");
}


x86 assembly (clang, -O0):
<RB_XMLDB_Generate_BeginSection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xebc(%rip),%rsi
lea    0xeb8(%rip),%rdx
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <RB_XMLDB_Generate_String@plt>
mov    -0x8(%rbp),%rdi
lea    0xe98(%rip),%rsi
lea    0xea6(%rip),%rdx
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RB_XMLDB_Generate_BeginSection>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <RB_XMLDB_Generate_String@plt>
lea    0xebd(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [18 x i8] c"<section>\0A<title>\00"
@.str.2 = [10 x i8] c"</title>\0A\00"
define void @RB_XMLDB_Generate_BeginSection(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32*, i32** %4
%11 = load i8*, i8** %6
%12 = call i32 @RB_XMLDB_Generate_String(i32* %10, i8* %11)
%13 = load i32*, i32** %4
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"<section>\0A<title>\00"
@.str.2 = [10 x i8] c"</title>\0A\00"
define void @RB_XMLDB_Generate_BeginSection(i32* %0, i32 %1, i8* %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i64 17, i64 1, i32* %0)
%5 = tail call i32 @RB_XMLDB_Generate_String(i32* %0, i8* %2)
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i64 9, i64 1, i32* %0)
ret void
}
unsigned mul(unsigned a, unsigned b) {
  unsigned ret = 0;
  while (a != 0) {
    if (a & 1)
      ret ^= b;
    a >>= 1;
    b <<= 1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<mul>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114a <mul+0x4a>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1133 <mul+0x33>
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <mul+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mul>:
xor    %eax,%eax
test   %edi,%edi
je     1126 <mul+0x26>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
neg    %edx
and    %esi,%edx
xor    %edx,%eax
shr    %ecx
add    %esi,%esi
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <mul+0x10>
ret

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

LLVM IR (-O2):
define i32 @mul(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %15, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 0, %2 ]
%6 = phi i32 [ %13, %4 ], [ %1, %2 ]
%7 = phi i32 [ %12, %4 ], [ %0, %2 ]
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 0, i32 %6
%11 = xor i32 %10, %5
%12 = lshr i32 %7, 1
%13 = shl i32 %6, 1
%14 = icmp ult i32 %7, 2
br i1 %14, label %15, label %4
15: ; preds = %4, %2
%16 = phi i32 [ 0, %2 ], [ %11, %4 ]
ret i32 %16
}
void forward(int n) {
  int i, a, b;
  i = 0;
  a = 0;
  b = 0;
  while (i < n) {
    if (a) {
      a = a + 1;
      b = b + 2;
    } else {
      a = a + 2;
      b = b + 1;
    }
    i = i + 1;
  }
}


x86 assembly (clang, -O0):
<forward>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1169 <forward+0x69>
cmpl   $0x0,-0xc(%rbp)
je     1149 <forward+0x49>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
jmp    115b <forward+0x5b>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111c <forward+0x1c>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @forward(i32 %0) {
ret void
}
int list_is_head(struct list *head, struct list *iterator) {
  return iterator == head;
}


x86 assembly (clang, -O0):
<list_is_head>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_is_head>:
xor    %eax,%eax
cmp    %rdi,%rsi
sete   %al
ret

LLVM IR (-O0):
%struct.list = type opaque
define i32 @list_is_head(%struct.list* %0, %struct.list* %1) {
%3 = alloca %struct.list*
%4 = alloca %struct.list*
store %struct.list* %0, %struct.list** %3
store %struct.list* %1, %struct.list** %4
%5 = load %struct.list*, %struct.list** %4
%6 = load %struct.list*, %struct.list** %3
%7 = icmp eq %struct.list* %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
%struct.list = type opaque
define i32 @list_is_head(%struct.list* readnone %0, %struct.list* readnone %1) {
%3 = icmp eq %struct.list* %1, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
int I_NoAppServicesOverlayEventFilter(unsigned int event) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @I_NoAppServicesOverlayEventFilter(i32 %0) {
ret i32 0
}
/* Variables and functions */
long f(long volatile);
int main(int argc, char *argv[]) {
  volatile long a, b;
  a = 1;
  b = 2;
  a = f(a);
  b = f(b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movq   $0x2,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <f@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <f@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movq   $0x1,0x10(%rsp)
movq   $0x2,0x8(%rsp)
mov    0x10(%rsp),%rdi
call   1030 <f@plt>
mov    %rax,0x10(%rsp)
mov    0x8(%rsp),%rdi
call   1030 <f@plt>
mov    %rax,0x8(%rsp)
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %3 to i8*
%6 = bitcast i64* %4 to i8*
store volatile i64 1, i64* %3
store volatile i64 2, i64* %4
%7 = load volatile i64, i64* %3
%8 = tail call i64 @f(i64 %7)
store volatile i64 %8, i64* %3
%9 = load volatile i64, i64* %4
%10 = tail call i64 @f(i64 %9)
store volatile i64 %10, i64* %4
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, short *);
short getMainMenuInput(void) {
  printf("\n1. Calculate Time Until Successful brute force attack\n"
         "2. Calculate Password Length\n"
         "0. Quit\n\n");
  short input;
  printf("Enter a menu option: ");
  scanf("%hi", &input);
  return input;
}


x86 assembly (clang, -O0):
<getMainMenuInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xf23(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2d(%rip),%rdi
lea    -0x2(%rbp),%rsi
call   1040 <scanf@plt>
movswl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMainMenuInput>:
push   %rax
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1050 <scanf@plt>
movzwl 0x6(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [94 x i8] c"\0A1. Calculate Time Until Successful brute force attack\0A2. Calculate Password Length\0A0. Quit\0A\0A\00"
@.str.1 = [22 x i8] c"Enter a menu option: \00"
@.str.2 = [4 x i8] c"%hi\00"
define signext i16 @getMainMenuInput() {
%1 = alloca i16
%2 = call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i16* %1)
%5 = load i16, i16* %1
ret i16 %5
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"Enter a menu option: \00"
@.str.2 = [4 x i8] c"%hi\00"
@str = [93 x i8] c"\0A1. Calculate Time Until Successful brute force attack\0A2. Calculate Password Length\0A0. Quit\0A\00"
define signext i16 @getMainMenuInput() {
%1 = alloca i16
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str, i64 0, i64 0))
%3 = bitcast i16* %1 to i8*
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i16* %1)
%6 = load i16, i16* %1
ret i16 %6
}
/* Variables and functions */
int /*<<< orphan*/ ext();
void n0() { ext(); }


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

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

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

LLVM IR (-O2):
define void @n0() {
%1 = tail call i32 (...) @ext()
ret void
}
void WideTimer2A_Handler(void) {
  while (1) {
  }
}


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

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

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

LLVM IR (-O2):
define void @WideTimer2A_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
int test_imm_F2uint8_reg(unsigned char val) {
  return ((val) & (-0xF2 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_F2uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 14
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int blx_checkheader(char *header) {
  short *signature = (short *)header;
  return ((signature[0] == 0x4) && (signature[1] == 0x66)) ||
         ((signature[0] == 0x400) && (signature[1] == 0x6600));
}


x86 assembly (clang, -O0):
<blx_checkheader>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movswl (%rax),%eax
cmp    $0x4,%eax
jne    1136 <blx_checkheader+0x36>
mov    -0x10(%rbp),%rax
movswl 0x2(%rax),%ecx
mov    $0x1,%al
cmp    $0x66,%ecx
mov    %al,-0x11(%rbp)
je     1167 <blx_checkheader+0x67>
mov    -0x10(%rbp),%rax
movswl (%rax),%ecx
xor    %eax,%eax
cmp    $0x400,%ecx
mov    %al,-0x12(%rbp)
jne    1161 <blx_checkheader+0x61>
mov    -0x10(%rbp),%rax
movswl 0x2(%rax),%eax
cmp    $0x6600,%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<blx_checkheader>:
movzwl (%rdi),%ecx
cmp    $0x4,%cx
je     111c <blx_checkheader+0x1c>
xor    %eax,%eax
movzwl %cx,%ecx
cmp    $0x400,%ecx
jne    1129 <blx_checkheader+0x29>
mov    $0x6600,%cx
jmp    1120 <blx_checkheader+0x20>
mov    $0x66,%cx
xor    %eax,%eax
cmp    %cx,0x2(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @blx_checkheader(i8* %0) {
%2 = alloca i8*
%3 = alloca i16*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i16*
store i16* %5, i16** %3
%6 = load i16*, i16** %3
%7 = getelementptr inbounds i16, i16* %6, i64 0
%8 = load i16, i16* %7
%9 = sext i16 %8 to i32
%10 = icmp eq i32 %9, 4
br i1 %10, label %11, label %17
11: ; preds = %1
%12 = load i16*, i16** %3
%13 = getelementptr inbounds i16, i16* %12, i64 1
%14 = load i16, i16* %13
%15 = sext i16 %14 to i32
%16 = icmp eq i32 %15, 102
br i1 %16, label %31, label %17
17: ; preds = %11, %1
%18 = load i16*, i16** %3
%19 = getelementptr inbounds i16, i16* %18, i64 0
%20 = load i16, i16* %19
%21 = sext i16 %20 to i32
%22 = icmp eq i32 %21, 1024
br i1 %22, label %23, label %29
23: ; preds = %17
%24 = load i16*, i16** %3
%25 = getelementptr inbounds i16, i16* %24, i64 1
%26 = load i16, i16* %25
%27 = sext i16 %26 to i32
%28 = icmp eq i32 %27, 26112
br label %29
29: ; preds = %23, %17
%30 = phi i1 [ false, %17 ], [ %28, %23 ]
br label %31
31: ; preds = %29, %11
%32 = phi i1 [ true, %11 ], [ %30, %29 ]
%33 = zext i1 %32 to i32
ret i32 %33
}

LLVM IR (-O2):
define i32 @blx_checkheader(i8* nocapture %0) {
%2 = bitcast i8* %0 to i16*
%3 = load i16, i16* %2
switch i16 %3, label %12 [
i16 4, label %5
i16 1024, label %4
]
4: ; preds = %1
br label %5
5: ; preds = %1, %4
%6 = phi i16 [ 26112, %4 ], [ 102, %1 ]
%7 = getelementptr inbounds i8, i8* %0, i64 2
%8 = bitcast i8* %7 to i16*
%9 = load i16, i16* %8
%10 = icmp eq i16 %9, %6
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %5, %1
%13 = phi i32 [ 0, %1 ], [ %11, %5 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int32_t _le_32_s(int32_t s) {
  int32_t ret = s;
  return ret;
}


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

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

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

LLVM IR (-O2):
define i32 @_le_32_s(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
scalar_t__ malloc(int);
int64_t *_new_int64(int64_t i) {
  int64_t *p = (int64_t *)malloc(sizeof(int64_t));
  p[0] = i;
  return p;
}


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

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

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

LLVM IR (-O2):
define i32* @_new_int64(i32 %0) {
%2 = tail call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32 %0, i32* %3
ret i32* %3
}
/* Variables and functions */
int /*<<< orphan*/ smb___free(unsigned char *);
void bf_delete(unsigned char *data, int num_bools) {
  (void)num_bools;
  smb___free(data);
}


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

x86 assembly (clang, -O2):
<bf_delete>:
jmp    1030 <smb___free@plt>

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

LLVM IR (-O2):
define void @bf_delete(i8* %0, i32 %1) {
%3 = tail call i32 @smb___free(i8* %0)
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ si_addr;
};
typedef TYPE_1__ siginfo_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void segfault(int signal, siginfo_t *si, void *arg) {
  printf("caught segfault %p\n", si->si_addr);
  exit(0);
}


x86 assembly (clang, -O0):
<segfault>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@.str = [20 x i8] c"caught segfault %p\0A\00"
define void @segfault(i32 %0, %struct.TYPE_3__* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_3__*
%6 = alloca i8*
store i32 %0, i32* %4
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %5
store i8* %2, i8** %6
%7 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
@.str = [20 x i8] c"caught segfault %p\0A\00"
define void @segfault(i32 %0, %struct.TYPE_3__* nocapture %1, i8* nocapture readnone %2) {
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ __asid_setup(int, int, int, int);
extern void r3000_asid_setup(void) {
  __asid_setup(0x40, 0xfc0, 0xf000, 0x1000);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x40,%edi
mov    $0xfc0,%esi
mov    $0xf000,%edx
mov    $0x1000,%ecx
call   1030 <__asid_setup@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0x40,%edi
mov    $0xfc0,%esi
mov    $0xf000,%edx
mov    $0x1000,%ecx
jmp    1030 <__asid_setup@plt>

LLVM IR (-O0):
define void @r3000_asid_setup() {
%1 = call i32 @__asid_setup(i32 64, i32 4032, i32 61440, i32 4096)
ret void
}

LLVM IR (-O2):
define void @r3000_asid_setup() {
%1 = tail call i32 @__asid_setup(i32 64, i32 4032, i32 61440, i32 4096)
ret void
}
/* Variables and functions */
int gpi_exif_get_lilend(unsigned char *, int);
int gpi_getvalue(unsigned char *data, int tagind) {
  return (gpi_exif_get_lilend(data + tagind * 12 + 10, 4));
}


x86 assembly (clang, -O0):
<gpi_getvalue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
imul   $0xc,-0xc(%rbp),%eax
cltq
add    %rax,%rdi
add    $0xa,%rdi
mov    $0x4,%esi
call   1030 <gpi_exif_get_lilend@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpi_getvalue>:
shl    $0x2,%esi
lea    (%rsi,%rsi,2),%eax
cltq
add    %rax,%rdi
add    $0xa,%rdi
mov    $0x4,%esi
jmp    1030 <gpi_exif_get_lilend@plt>

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

LLVM IR (-O2):
define i32 @gpi_getvalue(i8* %0, i32 %1) {
%3 = mul nsw i32 %1, 12
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = getelementptr inbounds i8, i8* %5, i64 10
%7 = tail call i32 @gpi_exif_get_lilend(i8* %6, i32 4)
ret i32 %7
}
unsigned int cpuid_ebx(unsigned int op) {
  unsigned int eax, ebx;
  __asm__("mov %%ebx, %%edi;"
          "cpuid;"
          "mov %%ebx, %%esi;"
          "mov %%edi, %%ebx;"
          : "=a"(eax), "=S"(ebx)
          : "0"(op)
          : "ecx", "edx", "edi");
  return ebx;
}


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

x86 assembly (clang, -O2):
<cpuid_ebx>:
mov    %edi,%eax
mov    %ebx,%edi
cpuid
mov    %ebx,%esi
mov    %edi,%ebx
mov    %esi,%eax
ret

LLVM IR (-O0):
define i32 @cpuid_ebx(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call { i32, i32 } asm "mov %ebx, %edi;cpuid;mov %ebx, %esi;mov %edi, %ebx;", "={ax},={si},0,~{ecx},~{edx},~{edi},~{dirflag},~{fpsr},~{flags}"(i32 %5)
%7 = extractvalue { i32, i32 } %6, 0
%8 = extractvalue { i32, i32 } %6, 1
store i32 %7, i32* %3
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @cpuid_ebx(i32 %0) {
%2 = tail call { i32, i32 } asm "mov %ebx, %edi;cpuid;mov %ebx, %esi;mov %edi, %ebx;", "={ax},={si},0,~{ecx},~{edx},~{edi},~{dirflag},~{fpsr},~{flags}"(i32 %0)
%3 = extractvalue { i32, i32 } %2, 1
ret i32 %3
}
/* Variables and functions */
int random();
void rinit_vector(int *v, unsigned int length) {
  unsigned int i;
  for (i = 0; i < length; i++) {
    v[i] = random();
  }
}


x86 assembly (clang, -O0):
<rinit_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1153 <rinit_vector+0x43>
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <rinit_vector+0x16>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @rinit_vector(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = tail call i32 (...) @random()
%9 = getelementptr inbounds i32, i32* %0, i64 %7
store i32 %8, i32* %9
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
/* Variables and functions */
char *strcpy(char *, char const *);
char *jdns_strcpy(char *dst, const char *src) { return strcpy(dst, src); }


x86 assembly (clang, -O0):
<jdns_strcpy>:
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 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jdns_strcpy>:
jmp    1030 <strcpy@plt>

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

LLVM IR (-O2):
define i8* @jdns_strcpy(i8* returned %0, i8* nocapture %1) {
%3 = tail call i8* @strcpy(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}
/* Variables and functions */
char *modifyNickMode(int, void *);
char *voiceCmd(void *args) { return modifyNickMode(3, args); }


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

x86 assembly (clang, -O2):
<voiceCmd>:
mov    %rdi,%rsi
mov    $0x3,%edi
jmp    1030 <modifyNickMode@plt>

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

LLVM IR (-O2):
define i8* @voiceCmd(i8* %0) {
%2 = tail call i8* @modifyNickMode(i32 3, i8* %0)
ret i8* %2
}
/* Variables and functions */
unsigned int _rdpid_u32();
unsigned int read_rdpid32(void) { return _rdpid_u32(); }


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

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

LLVM IR (-O0):
define i32 @read_rdpid32() {
%1 = call i32 (...) @_rdpid_u32()
ret i32 %1
}

LLVM IR (-O2):
define i32 @read_rdpid32() {
%1 = tail call i32 (...) @_rdpid_u32()
ret i32 %1
}