xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned long);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *malloc_nofail(size_t size) {
  void *ptr = malloc(size);
  if (!ptr) {
    fprintf(stderr, "malloc: failed to allocate %lu bytes\n",
            (unsigned long)size);
    exit(1);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<malloc_nofail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1177 <malloc_nofail+0x47>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc_nofail>:
push   %rbx
mov    %rdi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1140 <malloc_nofail+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"malloc: failed to allocate %lu bytes\0A\00"
define i8* @malloc_nofail(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i64, i64* %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"malloc: failed to allocate %lu bytes\0A\00"
define noalias i8* @malloc_nofail(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i64 %0)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn8() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn8");
  return result;
}


x86 assembly (clang, -O0):
<fn8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn8>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"fn8\00"
define i8* @fn8() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [4 x i8] c"fn8\00"
define i8* @fn8() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void grpcsharp_batch_context_destroy() {
  fprintf(stderr, "Should never reach here");
  abort();
}


x86 assembly (clang, -O0):
<grpcsharp_batch_context_destroy>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<grpcsharp_batch_context_destroy>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Should never reach here\00"
define void @grpcsharp_batch_context_destroy() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Should never reach here\00"
define void @grpcsharp_batch_context_destroy() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @abort()
unreachable
}
int sec_hash(unsigned char *d_buf, unsigned int d_len, unsigned char *h_buf,
             unsigned int h_len) {
  if (h_len == (20)) {
    return -1;
  } else if (h_len == (32)) {
    return -1;
  }
  return -1;
}


x86 assembly (clang, -O0):
<sec_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpl   $0x14,-0x24(%rbp)
jne    1128 <sec_hash+0x28>
movl   $0xffffffff,-0x4(%rbp)
jmp    114a <sec_hash+0x4a>
cmpl   $0x20,-0x24(%rbp)
jne    113e <sec_hash+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    114a <sec_hash+0x4a>
jmp    1143 <sec_hash+0x43>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @sec_hash(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 20
br i1 %11, label %12, label %13
12: ; preds = %4
store i32 -1, i32* %5
br label %19
13: ; preds = %4
%14 = load i32, i32* %9
%15 = icmp eq i32 %14, 32
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 -1, i32* %5
br label %19
17: ; preds = %13
br label %18
18: ; preds = %17
store i32 -1, i32* %5
br label %19
19: ; preds = %18, %16, %12
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
define i32 @sec_hash(i8* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i32 %3) {
ret i32 -1
}
void vga_clear(char color) {
  asm volatile("mov   %%al, %%ah\n"
               "mov   $0, %%di\n"
               "push  %%ax\n"
               "shl   $16, %%eax\n"
               "pop   %%ax\n"
               "mov   $16000, %%cx\n"
               "rep\n"
               "stosl\n"
               :
               : "a"(color)
               : "cx", "di");
}


x86 assembly (clang, -O0):
<vga_clear>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
mov    %al,%ah
mov    $0x0,%di
push   %ax
shl    $0x10,%eax
pop    %ax
mov    $0x3e80,%cx
rep stos %eax,%es:(%rdi)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vga_clear>:
mov    %edi,%eax
mov    %al,%ah
mov    $0x0,%di
push   %ax
shl    $0x10,%eax
pop    %ax
mov    $0x3e80,%cx
rep stos %eax,%es:(%rdi)
ret

LLVM IR (-O0):
define void @vga_clear(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
ret void
}

LLVM IR (-O2):
define void @vga_clear(i8 signext %0) {
tail call void asm sideeffect "mov %al, %ah\0Amov $$0, %di\0Apush %ax\0Ashl $$16, %eax\0Apop %ax\0Amov $$16000, %cx\0Arep\0Astosl\0A", "{ax},~{cx},~{di},~{dirflag},~{fpsr},~{flags}"(i8 %0)
ret void
}
/* Variables and functions */
int fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102(
    char const *);
int fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102(
    const char *text) {
  int pos = 0;
  pos =
      fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102(
          text);
  if (pos != -1)
    return pos;
  return -1;
}


x86 assembly (clang, -O0):
<fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     1144 <fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102>:
jmp    1030 <fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102@plt>

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

LLVM IR (-O2):
define i32 @fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102(i8* %0) {
%2 = tail call i32 @fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_79_ch_110_ch_101_ch_79_ch_102(i8* %0)
ret i32 %2
}
int fun336() { return 336; }


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

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

LLVM IR (-O0):
define i32 @fun336() {
ret i32 336
}

LLVM IR (-O2):
define i32 @fun336() {
ret i32 336
}
/* Type definitions */
struct b6_sref {
  int dummy;
};
struct b6_deque {
  int dummy;
};

/* Variables and functions */
struct b6_sref *b6_deque_del(struct b6_deque *, int /*<<< orphan*/);
int /*<<< orphan*/ b6_deque_last(struct b6_deque *);
struct b6_sref *b6_deque_del_last(struct b6_deque *deque) {
  return b6_deque_del(deque, b6_deque_last(deque));
}


x86 assembly (clang, -O0):
<b6_deque_del_last>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <b6_deque_last@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <b6_deque_del@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b6_deque_del_last>:
push   %rbx
mov    %rdi,%rbx
call   1030 <b6_deque_last@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <b6_deque_del@plt>

LLVM IR (-O0):
%struct.b6_sref = type { i32 }
%struct.b6_deque = type { i32 }
define %struct.b6_sref* @b6_deque_del_last(%struct.b6_deque* %0) {
%2 = alloca %struct.b6_deque*
store %struct.b6_deque* %0, %struct.b6_deque** %2
%3 = load %struct.b6_deque*, %struct.b6_deque** %2
%4 = load %struct.b6_deque*, %struct.b6_deque** %2
%5 = call i32 @b6_deque_last(%struct.b6_deque* %4)
%6 = call %struct.b6_sref* @b6_deque_del(%struct.b6_deque* %3, i32 %5)
ret %struct.b6_sref* %6
}

LLVM IR (-O2):
%struct.b6_sref = type { i32 }
%struct.b6_deque = type { i32 }
define %struct.b6_sref* @b6_deque_del_last(%struct.b6_deque* %0) {
%2 = tail call i32 @b6_deque_last(%struct.b6_deque* %0)
%3 = tail call %struct.b6_sref* @b6_deque_del(%struct.b6_deque* %0, i32 %2)
ret %struct.b6_sref* %3
}
/* Variables and functions */
float pow(int, int);
float func4(float x) {
  float s;
  s = pow((1 + x), 2);
  return s;
}


x86 assembly (clang, -O0):
<func4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func4>:
addss  0xee8(%rip),%xmm0
cvttss2si %xmm0,%edi
mov    $0x2,%esi
jmp    1030 <pow@plt>

LLVM IR (-O0):
define float @func4(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fadd float 1.000000e+00, %4
%6 = fptosi float %5 to i32
%7 = call float @pow(i32 %6, i32 2)
store float %7, float* %3
%8 = load float, float* %3
ret float %8
}

LLVM IR (-O2):
define float @func4(float %0) {
%2 = fadd float %0, 1.000000e+00
%3 = fptosi float %2 to i32
%4 = tail call float @pow(i32 %3, i32 2)
ret float %4
}
void foo813() {}


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

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

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

LLVM IR (-O2):
define void @foo813() {
ret void
}
void g_strfreev(char **dir) {
  int i = 0;
  while (dir[i]) {
    free(dir[i]);
    i++;
  }
  free(dir);
}


x86 assembly (clang, -O0):
<g_strfreev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1155 <g_strfreev+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <g_strfreev+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_strfreev>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <g_strfreev+0x31>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <g_strfreev+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @g_strfreev(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %9, %4 ], [ %2, %1 ]
tail call void @free(i8* %6)
%7 = add nuw nsw i64 %5, 1
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = bitcast i8** %0 to i8*
tail call void @free(i8* %12)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ csum(void *, size_t);
uint16_t calc_csum(void *addr, size_t len,
                   int ccsum __attribute__((__unused__))) {
  return csum(addr, len >> 1);
}


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

x86 assembly (clang, -O2):
<calc_csum>:
shr    %rsi
jmp    1030 <csum@plt>

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

LLVM IR (-O2):
define i32 @calc_csum(i8* %0, i64 %1, i32 %2) {
%4 = lshr i64 %1, 1
%5 = tail call i32 @csum(i8* %0, i64 %4)
ret i32 %5
}
unsigned int submask_zip(int a, int b, int c, int d) {
  unsigned int re = 0;
  re = re | (unsigned int)a;
  re = re << 8;
  re = re | (unsigned int)b;
  re = re << 8;
  re = re | (unsigned int)c;
  re = re << 8;
  re = re | (unsigned int)d;
  return re;
}


x86 assembly (clang, -O0):
<submask_zip>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<submask_zip>:
mov    %esi,%eax
shl    $0x10,%edi
shl    $0x8,%eax
or     %edi,%eax
or     %edx,%eax
shl    $0x8,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @submask_zip(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
%10 = load i32, i32* %9
%11 = load i32, i32* %5
%12 = or i32 %10, %11
store i32 %12, i32* %9
%13 = load i32, i32* %9
%14 = shl i32 %13, 8
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = load i32, i32* %6
%17 = or i32 %15, %16
store i32 %17, i32* %9
%18 = load i32, i32* %9
%19 = shl i32 %18, 8
store i32 %19, i32* %9
%20 = load i32, i32* %9
%21 = load i32, i32* %7
%22 = or i32 %20, %21
store i32 %22, i32* %9
%23 = load i32, i32* %9
%24 = shl i32 %23, 8
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = load i32, i32* %8
%27 = or i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %9
ret i32 %28
}

LLVM IR (-O2):
define i32 @submask_zip(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %0, 16
%6 = shl i32 %1, 8
%7 = or i32 %6, %5
%8 = or i32 %7, %2
%9 = shl i32 %8, 8
%10 = or i32 %9, %3
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() { printf("USAGE : test press_count\n"); }


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"USAGE : test press_count\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [25 x i8] c"USAGE : test press_count\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, unsigned int);
void f3(int size) {
  char src[10];
  if (size < 0)
    memset(src, 0, (unsigned)size);
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1133 <f3+0x23>
lea    -0xe(%rbp),%rdi
mov    -0x4(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
test   %edi,%edi
js     1115 <f3+0x5>
ret
sub    $0x18,%rsp
mov    %edi,%edx
lea    0xe(%rsp),%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @f3(i32 %0) {
%2 = alloca i32
%3 = alloca [10 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* %2
%9 = call i32 @memset(i8* %7, i32 0, i32 %8)
br label %10
10: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @f3(i32 %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = icmp slt i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @memset(i8* %3, i32 0, i32 %0)
br label %7
7: ; preds = %5, %1
ret void
}
const char *btostr(unsigned val) { return val != 0 ? "true" : "false"; }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i8* @btostr(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Type definitions */
struct mat4 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mat4_rotation_quaternion(float *, float *);
__attribute__((always_)) struct mat4 *
psmat4_rotation_quaternion(struct mat4 *result, struct mat4 *q) {
  mat4_rotation_quaternion((float *)result, (float *)q);
  return result;
}


x86 assembly (clang, -O0):
<psmat4_rotation_quaternion>:
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 <mat4_rotation_quaternion@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.mat4 = type { i32 }
define %struct.mat4* @psmat4_rotation_quaternion(%struct.mat4* %0, %struct.mat4* %1) {
%3 = alloca %struct.mat4*
%4 = alloca %struct.mat4*
store %struct.mat4* %0, %struct.mat4** %3
store %struct.mat4* %1, %struct.mat4** %4
%5 = load %struct.mat4*, %struct.mat4** %3
%6 = bitcast %struct.mat4* %5 to float*
%7 = load %struct.mat4*, %struct.mat4** %4
%8 = bitcast %struct.mat4* %7 to float*
%9 = call i32 @mat4_rotation_quaternion(float* %6, float* %8)
%10 = load %struct.mat4*, %struct.mat4** %3
ret %struct.mat4* %10
}

LLVM IR (-O2):
%struct.mat4 = type { i32 }
define %struct.mat4* @psmat4_rotation_quaternion(%struct.mat4* returned %0, %struct.mat4* %1) {
%3 = bitcast %struct.mat4* %0 to float*
%4 = bitcast %struct.mat4* %1 to float*
%5 = tail call i32 @mat4_rotation_quaternion(float* %3, float* %4)
ret %struct.mat4* %0
}
void foo_1_1_2_1_1_1_2_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_1_2_1_1_1_2_2_1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ logInputProblem(char *, unsigned char *, int);
void logIgnoredByte(unsigned char byte) {
  logInputProblem("Ignored Byte", &byte, 1);
}


x86 assembly (clang, -O0):
<logIgnoredByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <logInputProblem@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logIgnoredByte>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0xee3(%rip),%rdi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <logInputProblem@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Ignored Byte\00"
define void @logIgnoredByte(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @logInputProblem(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %2, i32 1)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Ignored Byte\00"
define void @logIgnoredByte(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @logInputProblem(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %2, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f();
void g(void) { f(); }


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

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

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

LLVM IR (-O2):
define void @g() {
%1 = tail call i32 (...) @f()
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, char *, char *);
int main(int argc, char **argv) {
  char first[11] = "Ventsislav";
  char last[8] = "Nikolov";
  printf("%s %s\n", first, last);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x1b(%rbp)
mov    0xed0(%rip),%ax
mov    %ax,-0x13(%rbp)
mov    0xec8(%rip),%al
mov    %al,-0x11(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x23(%rbp)
lea    -0x1b(%rbp),%rsi
lea    -0x23(%rbp),%rdx
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x6c736973746e6556,%rax
69 73 6c
mov    %rax,(%rsp)
movl   $0x76616c,0x7(%rsp)
movabs $0x766f6c6f6b694e,%rax
mov    %rax,0x10(%rsp)
lea    0xecb(%rip),%rdi
mov    %rsp,%rsi
lea    0x10(%rsp),%rdx
call   1030 <printf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.first = [11 x i8] c"Ventsislav\00"
@__const.main.last = [8 x i8] c"Nikolov\00"
@.str = [7 x i8] c"%s %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [11 x i8]
%7 = alloca [8 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [11 x i8]* %6 to i8*
%9 = bitcast [8 x i8]* %7 to i8*
%10 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11)
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}

LLVM IR (-O2):
@__const.main.first = [11 x i8] c"Ventsislav\00"
@.str = [7 x i8] c"%s %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [11 x i8]
%4 = alloca i64
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%6 = bitcast i64* %4 to i8*
store i64 33336558768318798, i64* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}
unsigned char outb(unsigned char val, int port) {
  *((unsigned char *)(((unsigned long)0x80000000) + port)) = (val);
  return (val);
}


x86 assembly (clang, -O0):
<outb>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x1(%rbp),%cl
movslq -0x8(%rbp),%rax
movabs $0x80000000,%rdx
add    %rdx,%rax
mov    %cl,(%rax)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<outb>:
mov    %edi,%eax
movslq %esi,%rcx
mov    $0x80000000,%edx
mov    %al,(%rcx,%rdx,1)
ret

LLVM IR (-O0):
define zeroext i8 @outb(i8 zeroext %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 = sext i32 %6 to i64
%8 = add i64 2147483648, %7
%9 = inttoptr i64 %8 to i8*
store i8 %5, i8* %9
%10 = load i8, i8* %3
ret i8 %10
}

LLVM IR (-O2):
define zeroext i8 @outb(i8 returned zeroext %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = add nsw i64 %3, 2147483648
%5 = inttoptr i64 %4 to i8*
store i8 %0, i8* %5
ret i8 %0
}
extern void *memmove(void *dest, const void *src, int n) {
  if (dest < src)
    __asm__("cld\n\t"
            "rep\n\t"
            "movsb" ::"c"(n),
            "S"(src), "D"(dest));
  else
    __asm__("std\n\t"
            "rep\n\t"
            "movsb" ::"c"(n),
            "S"(src + n - 1), "D"(dest + n - 1));
  return dest;
}


x86 assembly (clang, -O0):
<memmove>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1130 <memmove+0x30>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdi
cld
rep movsb %ds:(%rsi),%es:(%rdi)
jmp    1154 <memmove+0x54>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
add    $0xffffffffffffffff,%rsi
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
add    $0xffffffffffffffff,%rdi
std
rep movsb %ds:(%rsi),%es:(%rdi)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memmove>:
mov    %rdi,%rax
cmp    %rsi,%rdi
jae    1111 <memmove+0x11>
mov    %edx,%ecx
mov    %rax,%rdi
cld
rep movsb %ds:(%rsi),%es:(%rdi)
ret
movslq %edx,%rcx
add    %rcx,%rsi
add    $0xffffffffffffffff,%rsi
lea    (%rax,%rcx,1),%rdi
add    $0xffffffffffffffff,%rdi
std
rep movsb %ds:(%rsi),%es:(%rdi)
ret

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

LLVM IR (-O2):
define i8* @memmove(i8* returned %0, i8* %1, i32 %2) {
%4 = icmp ult i8* %0, %1
br i1 %4, label %5, label %6
5: ; preds = %3
tail call void asm sideeffect "cld\0A\09rep\0A\09movsb", "{cx},{si},{di},~{dirflag},~{fpsr},~{flags}"(i32 %2, i8* %1, i8* %0)
br label %12
6: ; preds = %3
%7 = sext i32 %2 to i64
%8 = getelementptr i8, i8* %1, i64 %7
%9 = getelementptr i8, i8* %8, i64 -1
%10 = getelementptr i8, i8* %0, i64 %7
%11 = getelementptr i8, i8* %10, i64 -1
tail call void asm sideeffect "std\0A\09rep\0A\09movsb", "{cx},{si},{di},~{dirflag},~{fpsr},~{flags}"(i32 %2, i8* %9, i8* %11)
br label %12
12: ; preds = %6, %5
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void version() {
  printf("hq9plus version %s\nCopyright (C) 2011 Hiromu Yakura\n", "1.0.0");
}


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

x86 assembly (clang, -O2):
<version>:
lea    0xee9(%rip),%rdi
lea    0xf17(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"hq9plus version %s\0ACopyright (C) 2011 Hiromu Yakura\0A\00"
@.str.1 = [6 x i8] c"1.0.0\00"
define void @version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [53 x i8] c"hq9plus version %s\0ACopyright (C) 2011 Hiromu Yakura\0A\00"
@.str.1 = [6 x i8] c"1.0.0\00"
define void @version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nsc_assert(int);
void cr_canseesocket(void) {
  nsc_assert(0 && "This function is unimplemented.");
  ;
}


x86 assembly (clang, -O0):
<cr_canseesocket>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cr_canseesocket>:
xor    %edi,%edi
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
define void @cr_canseesocket() {
%1 = call i32 @nsc_assert(i32 0)
ret void
}

LLVM IR (-O2):
define void @cr_canseesocket() {
%1 = tail call i32 @nsc_assert(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cfg_set(char *);
set_cfg_flag(void) { cfg_set("flag=1"); }


x86 assembly (clang, -O0):
<set_cfg_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <cfg_set@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"flag=1\00"
define i32 @set_cfg_flag() {
%1 = alloca i32
%2 = call i32 @cfg_set(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [7 x i8] c"flag=1\00"
define i32 @set_cfg_flag() {
%1 = tail call i32 @cfg_set(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int *malloc(int);
int *copy_array(int *array, int size) {
  int i;
  int *copy = malloc(sizeof(int) * size);
  for (i = 0; i < size; i++) {
    copy[i] = array[i];
  }
  return copy;
}


x86 assembly (clang, -O0):
<copy_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1169 <copy_array+0x59>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1139 <copy_array+0x29>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_array>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
lea    0x0(,%rbx,4),%edi
call   1040 <malloc@plt>
mov    %rax,%r15
test   %ebx,%ebx
jle    114e <copy_array+0x2e>
mov    %ebx,%edx
shl    $0x2,%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <memcpy@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define noalias i32* @copy_array(i32* nocapture %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i32* @malloc(i32 %3)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %0 to i8*
%9 = zext i32 %1 to i64
%10 = shl nuw nsw i64 %9, 2
br label %11
11: ; preds = %6, %2
ret i32* %4
}
/* Variables and functions */
size_t ft_sizemax(size_t n1, size_t n2) { return ((n1 > n2) ? n1 : n2); }


x86 assembly (clang, -O0):
<ft_sizemax>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1127 <ft_sizemax+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <ft_sizemax+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_sizemax>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmova  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @ft_sizemax(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 = icmp ugt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @ft_sizemax(i64 %0, i64 %1) {
%3 = icmp ugt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_unpacklo_epi16(int /*<<< orphan*/ const,
                                      int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_unpacklo_epi8(int /*<<< orphan*/ const,
                                     int /*<<< orphan*/ const);
__m128i transpose_8bit_4x4(const __m128i *const in) {
  const __m128i a0 = _mm_unpacklo_epi8(in[0], in[1]);
  const __m128i a1 = _mm_unpacklo_epi8(in[2], in[3]);
  return _mm_unpacklo_epi16(a0, a1);
}


x86 assembly (clang, -O0):
<transpose_8bit_4x4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <_mm_unpacklo_epi16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transpose_8bit_4x4>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%edi
mov    0x4(%rbx),%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%edi
mov    0xc(%rbx),%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <_mm_unpacklo_epi16@plt>

LLVM IR (-O0):
define i32 @transpose_8bit_4x4(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = call i32 @_mm_unpacklo_epi8(i32 %7, i32 %10)
store i32 %11, i32* %3
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = load i32*, i32** %2
%16 = getelementptr inbounds i32, i32* %15, i64 3
%17 = load i32, i32* %16
%18 = call i32 @_mm_unpacklo_epi8(i32 %14, i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @_mm_unpacklo_epi16(i32 %19, i32 %20)
ret i32 %21
}

LLVM IR (-O2):
define i32 @transpose_8bit_4x4(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = tail call i32 @_mm_unpacklo_epi8(i32 %2, i32 %4)
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = load i32, i32* %6
%8 = getelementptr inbounds i32, i32* %0, i64 3
%9 = load i32, i32* %8
%10 = tail call i32 @_mm_unpacklo_epi8(i32 %7, i32 %9)
%11 = tail call i32 @_mm_unpacklo_epi16(i32 %5, i32 %10)
ret i32 %11
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
void minipack_pack_bin32(void *ptr, uint32_t length, size_t *sz) {
  *sz = 5;
  *((uint8_t *)ptr) = 0xC6;
  *((uint32_t *)(ptr + 1)) = htonl(length);
}


x86 assembly (clang, -O0):
<minipack_pack_bin32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x5,(%rax)
mov    -0x8(%rbp),%rax
movl   $0xc6,(%rax)
mov    -0xc(%rbp),%edi
call   1030 <htonl@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_pack_bin32>:
push   %rbx
mov    %rdi,%rbx
movq   $0x5,(%rdx)
movl   $0xc6,(%rdi)
mov    %esi,%edi
call   1030 <htonl@plt>
mov    %eax,0x1(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @minipack_pack_bin32(i8* %0, i32 %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64* %2, i64** %6
%7 = load i64*, i64** %6
store i64 5, i64* %7
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
store i32 198, i32* %9
%10 = load i32, i32* %5
%11 = call i32 @htonl(i32 %10)
%12 = load i8*, i8** %4
%13 = getelementptr i8, i8* %12, i64 1
%14 = bitcast i8* %13 to i32*
store i32 %11, i32* %14
ret void
}

LLVM IR (-O2):
define void @minipack_pack_bin32(i8* nocapture writeonly %0, i32 %1, i64* nocapture writeonly %2) {
store i64 5, i64* %2
%4 = bitcast i8* %0 to i32*
store i32 198, i32* %4
%5 = tail call i32 @htonl(i32 %1)
%6 = getelementptr i8, i8* %0, i64 1
%7 = bitcast i8* %6 to i32*
store i32 %5, i32* %7
ret void
}
void flush_icache_range(unsigned start, unsigned end) {}


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

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

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

LLVM IR (-O2):
define void @flush_icache_range(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
struct netaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ netcmp4(struct netaddr const *);
int netcmp6(const struct netaddr *x) { return (!netcmp4(x)); }


x86 assembly (clang, -O0):
<netcmp6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <netcmp4@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<netcmp6>:
push   %rax
call   1030 <netcmp4@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.netaddr = type { i32 }
define i32 @netcmp6(%struct.netaddr* %0) {
%2 = alloca %struct.netaddr*
store %struct.netaddr* %0, %struct.netaddr** %2
%3 = load %struct.netaddr*, %struct.netaddr** %2
%4 = call i32 @netcmp4(%struct.netaddr* %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.netaddr = type { i32 }
define i32 @netcmp6(%struct.netaddr* %0) {
%2 = tail call i32 @netcmp4(%struct.netaddr* %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int calc_double_int(int given) { return given * 2; }


x86 assembly (clang, -O0):
<calc_double_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @calc_double_int(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
void glViewport(int a, int b, int width, int height) {}


x86 assembly (clang, -O0):
<glViewport>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @glViewport(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
define void @glViewport(i32 %0, i32 %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parseFile(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  char *file = argv[1];
  if (argc != 1) {
    parseFile(file);
  } else {
    printf("wrong numbah hoe");
  }
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     115a <main+0x3a>
mov    -0x18(%rbp),%rdi
call   1040 <parseFile@plt>
jmp    1166 <main+0x46>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jne    1134 <main+0x14>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
jmp    113d <main+0x1d>
mov    0x8(%rsi),%rdi
call   1040 <parseFile@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"wrong numbah hoe\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @parseFile(i8* %6)
br label %10
8: ; preds = %2
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %4
ret i32 0
}