xunge/DecIR huggingface dataset:
int cycle(int n) {
  int length = 0;
  while (n != 1) {
    if (n % 2 == 1) {
      n = n * 3 + 1;
      length++;
    } else {
      n /= 2;
      length++;
    }
  }
  return length + 1;
}


x86 assembly (clang, -O0):
<cycle>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
je     1160 <cycle+0x60>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1144 <cycle+0x44>
imul   $0x3,-0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115b <cycle+0x5b>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <cycle+0xe>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cycle>:
mov    $0x1,%eax
cmp    $0x1,%edi
jne    110b <cycle+0xb>
ret
mov    $0x1,%eax
jmp    112c <cycle+0x2c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
sar    %ecx
mov    %ecx,%edi
add    $0x1,%eax
cmp    $0x1,%edi
je     110a <cycle+0xa>
mov    %edi,%ecx
shr    $0x1f,%ecx
add    %edi,%ecx
mov    %ecx,%edx
and    $0xfffffffe,%edx
mov    %edi,%esi
sub    %edx,%esi
cmp    $0x1,%esi
jne    1120 <cycle+0x20>
lea    (%rdi,%rdi,2),%edi
add    $0x1,%edi
jmp    1124 <cycle+0x24>

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

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


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

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

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

LLVM IR (-O2):
define void @CycleEnd() {
ret void
}
void osfinish(void) {}


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

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

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

LLVM IR (-O2):
define void @osfinish() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ window_restore();
void window_quit() {
  window_restore();
  exit(0);
}


x86 assembly (clang, -O0):
<window_quit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <window_restore@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<window_quit>:
push   %rax
xor    %eax,%eax
call   1030 <window_restore@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @window_quit() {
%1 = call i32 (...) @window_restore()
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @window_quit() {
%1 = tail call i32 (...) @window_restore()
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int SIZE_MAX;
void *another_calloc(int, int);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ free(void *);
int main(int argc, char *argv[]) {
  void *p;
  p = another_calloc(0x1234, 1);
  assert(p != NULL);
  free(p);
  p = another_calloc(SIZE_MAX, 2);
  assert(p == NULL);
  free(p);
  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    $0x1234,%edi
mov    $0x1,%esi
call   1040 <another_calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
mov    $0x2,%esi
call   1040 <another_calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1234,%edi
mov    $0x1,%esi
call   1040 <another_calloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    $0x2,%esi
call   1040 <another_calloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@SIZE_MAX = global i32 0
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 = call i8* @another_calloc(i32 4660, i32 1)
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = icmp ne i8* %8, null
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i8*, i8** %6
%13 = call i32 @free(i8* %12)
%14 = load i32, i32* @SIZE_MAX
%15 = call i8* @another_calloc(i32 %14, i32 2)
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = icmp eq i8* %16, null
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i8*, i8** %6
%21 = call i32 @free(i8* %20)
ret i32 0
}

LLVM IR (-O2):
@SIZE_MAX = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @another_calloc(i32 4660, i32 1)
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @free(i8* %3)
%8 = load i32, i32* @SIZE_MAX
%9 = tail call i8* @another_calloc(i32 %8, i32 2)
%10 = icmp eq i8* %9, null
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @free(i8* %9)
ret i32 0
}
/* Variables and functions */
char *calloc(scalar_t__, int);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *string_new(const char *s) {
  char *retVal = calloc(strlen(s) + 1, sizeof(char));
  strcpy(retVal, s);
  return retVal;
}


x86 assembly (clang, -O0):
<string_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_new>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @string_new(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @calloc(i64 %6, i32 1)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @string_new(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @calloc(i64 %3, i32 1)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Type definitions */
typedef scalar_t__ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ towupper(scalar_t__);
wchar_t *_wcsupr_s(wchar_t *str) {
  for (wchar_t *p = str; *p; p++)
    towupper(*p);
  return str;
}


x86 assembly (clang, -O0):
<_wcsupr_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     114f <_wcsupr_s+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <towupper@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <_wcsupr_s+0x14>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i64* @_wcsupr_s(i64* %0) {
%2 = alloca i64*
%3 = alloca i64*
store i64* %0, i64** %2
%4 = load i64*, i64** %2
store i64* %4, i64** %3
br label %5
5: ; preds = %13, %1
%6 = load i64*, i64** %3
%7 = load i64, i64* %6
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = load i64*, i64** %3
%11 = load i64, i64* %10
%12 = call i32 @towupper(i64 %11)
br label %13
13: ; preds = %9
%14 = load i64*, i64** %3
%15 = getelementptr inbounds i64, i64* %14, i32 1
store i64* %15, i64** %3
br label %5
16: ; preds = %5
%17 = load i64*, i64** %2
ret i64* %17
}

LLVM IR (-O2):
define i64* @_wcsupr_s(i64* returned %0) {
%2 = load i64, i64* %0
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %1
ret i64* %0
5: ; preds = %1, %5
%6 = phi i64 [ %10, %5 ], [ %2, %1 ]
%7 = phi i64* [ %9, %5 ], [ %0, %1 ]
%8 = tail call i32 @towupper(i64 %6)
%9 = getelementptr inbounds i64, i64* %7, i64 1
%10 = load i64, i64* %9
%11 = icmp eq i64 %10, 0
br i1 %11, label %4, label %5
}
void a_store(volatile int *p, int x) {
  __asm__("mov %1, %0 ; lock ; orl $0,(%%rsp)" : "=m"(*p) : "r"(x) : "memory");
}


x86 assembly (clang, -O0):
<a_store>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,(%rax)
lock orl $0x0,(%rsp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_store>:
mov    %esi,(%rdi)
lock orl $0x0,(%rsp)
ret

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

LLVM IR (-O2):
define void @a_store(i32* %0, i32 %1) {
tail call void asm "mov $1, $0 ; lock ; orl $$0,(%rsp)", "=*m,r,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vec4d_normalize_new(double *, double const *);
void quatd_normalize_new(double dest[4], const double src[4]) {
  vec4d_normalize_new(dest, src);
}


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

x86 assembly (clang, -O2):
<quatd_normalize_new>:
jmp    1030 <vec4d_normalize_new@plt>

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

LLVM IR (-O2):
define void @quatd_normalize_new(double* %0, double* %1) {
%3 = tail call i32 @vec4d_normalize_new(double* %0, double* %1)
ret void
}
void foo_2_2_2_1_2_2_1_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_2_1_2_2_1_1_2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isascii(int);
void t_isascii_0x53() {
  Assert_real((isascii(83)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isascii.c",
              420, ("isascii should be 1 for S"));
}


x86 assembly (clang, -O0):
<t_isascii_0x53>:
push   %rbp
mov    %rsp,%rbp
mov    $0x53,%edi
call   1030 <isascii@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x1a4,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isascii_0x53>:
lea    0xee9(%rip),%rsi
lea    0xf8a(%rip),%rcx
mov    $0x1,%edi
mov    $0x1a4,%edx
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [26 x i8] c"isascii should be 1 for S\00"
define void @t_isascii_0x53() {
%1 = call i32 @isascii(i32 83)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 420, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [26 x i8] c"isascii should be 1 for S\00"
define void @t_isascii_0x53() {
%1 = tail call i32 @Assert_real(i32 1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 420, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int /*<<< orphan*/);
__attribute__((no, noclone)) unsigned int f33(unsigned int x, unsigned int y) {
  unsigned int r = x + y;
  if (r > y)
    foo(0);
  return r;
}


x86 assembly (clang, -O0):
<f33>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jbe    113a <f33+0x2a>
xor    %edi,%edi
call   1030 <foo@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f33>:
push   %rbx
mov    %edi,%ebx
add    %esi,%ebx
cmp    %esi,%ebx
jbe    1120 <f33+0x10>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @f33(i32 %0, i32 %1) {
%3 = add i32 %1, %0
%4 = icmp ugt i32 %3, %1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @foo(i32 0)
br label %7
7: ; preds = %5, %2
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ GLubyte;

/* Variables and functions */
int /*<<< orphan*/ glIndexubv(int /*<<< orphan*/ *);
void Indexubv(GLubyte c[1]) { glIndexubv(c); }


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

x86 assembly (clang, -O2):
<Indexubv>:
jmp    1030 <glIndexubv@plt>

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

LLVM IR (-O2):
define void @Indexubv(i32* %0) {
%2 = tail call i32 @glIndexubv(i32* %0)
ret void
}
rd_string(addr, len) char *addr;
long len;
{ OUTREAD(3, addr, len); }


x86 assembly (clang, -O0):
<rd_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x3,%edi
mov    $0x0,%al
call   1030 <OUTREAD@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rd_string>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x3,%edi
xor    %eax,%eax
jmp    1030 <OUTREAD@plt>

LLVM IR (-O0):
define i32 @rd_string(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%6 = load i8*, i8** %4
%7 = load i64, i64* %5
%8 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @OUTREAD to i32 (i32, i8*, i64, ...)*)(i32 3, i8* %6, i64 %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @rd_string(i8* %0, i64 %1) {
%3 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @OUTREAD to i32 (i32, i8*, i64, ...)*)(i32 3, i8* %0, i64 %1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ die(char *, int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
void *malloc(size_t);
void *alloc(size_t size) {
  void *res;
  res = malloc(size);
  if (!res)
    die("failed to allocate memory", errno, NULL);
  return res;
}


x86 assembly (clang, -O0):
<alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115d <alloc+0x3d>
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
lea    0xeac(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1145 <alloc+0x25>
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
lea    0xec2(%rip),%rdi
xor    %edx,%edx
call   1040 <die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"failed to allocate memory\00"
@errno = global i32 0
define i8* @alloc(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 %11, label %8
8: ; preds = %1
%9 = load i32, i32* @errno
%10 = call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %9, i32* null)
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [26 x i8] c"failed to allocate memory\00"
@errno = global i32 0
define noalias i8* @alloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @errno
%6 = tail call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %5, i32* null)
br label %7
7: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ read_at_ble8(void const *, size_t);
uint8_t read_at_le8(const void *src, size_t offset) {
  return read_at_ble8(src, offset);
}


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

x86 assembly (clang, -O2):
<read_at_le8>:
jmp    1030 <read_at_ble8@plt>

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

LLVM IR (-O2):
define i32 @read_at_le8(i8* %0, i64 %1) {
%3 = tail call i32 @read_at_ble8(i8* %0, i64 %1)
ret i32 %3
}
int test_imm_EDuint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0xED << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_EDuint64_highword_reg>:
movabs $0xed00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_EDuint64_highword_reg(i64 %0) {
%2 = and i64 %0, 1017907249152
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
float sqrt(float);
float smithG_GGX(float NdotV, float alphaG) {
  float a = alphaG * alphaG;
  float b = NdotV * NdotV;
  return 1 / (NdotV + sqrt(a + b - a * b));
}


x86 assembly (clang, -O0):
<smithG_GGX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm1
addss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  -0x14(%rbp),%xmm1
addss  %xmm0,%xmm1
movss  0xe77(%rip),%xmm0
divss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smithG_GGX>:
push   %rax
movaps %xmm0,%xmm3
mulss  %xmm1,%xmm1
movaps %xmm0,%xmm2
mulss  %xmm0,%xmm2
movaps %xmm2,%xmm0
addss  %xmm1,%xmm0
mulss  %xmm1,%xmm2
subss  %xmm2,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     113c <smithG_GGX+0x2c>
sqrtss %xmm0,%xmm0
jmp    114d <smithG_GGX+0x3d>
movss  %xmm3,0x4(%rsp)
call   1030 <sqrt@plt>
movss  0x4(%rsp),%xmm3
addss  %xmm3,%xmm0
movss  0xea7(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @smithG_GGX(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %3
store float %1, float* %4
%7 = load float, float* %4
%8 = load float, float* %4
%9 = fmul float %7, %8
store float %9, float* %5
%10 = load float, float* %3
%11 = load float, float* %3
%12 = fmul float %10, %11
store float %12, float* %6
%13 = load float, float* %3
%14 = load float, float* %5
%15 = load float, float* %6
%16 = fadd float %14, %15
%17 = load float, float* %5
%18 = load float, float* %6
%19 = fneg float %17
%20 = call float @llvm.fmuladd.f32(float %19, float %18, float %16)
%21 = call float @sqrt(float %20)
%22 = fadd float %13, %21
%23 = fdiv float 1.000000e+00, %22
ret float %23
}

LLVM IR (-O2):
define float @smithG_GGX(float %0, float %1) {
%3 = fmul float %1, %1
%4 = fmul float %0, %0
%5 = fadd float %4, %3
%6 = fneg float %3
%7 = tail call float @llvm.fmuladd.f32(float %6, float %4, float %5)
%8 = tail call float @sqrt(float %7)
%9 = fadd float %8, %0
%10 = fdiv float 1.000000e+00, %9
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ t();
int q() { t(); }


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

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

LLVM IR (-O0):
define i32 @q() {
%1 = alloca i32
%2 = call i32 (...) @t()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @q() {
%1 = tail call i32 (...) @t()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ utf8_cont(char const);
size_t utf8_char_prev(const char *s, size_t len, size_t point) {
  for (;;) {
    if (point == 0)
      return point;
    point--;
    if (!utf8_cont(s[point]))
      return point;
  }
}


x86 assembly (clang, -O0):
<utf8_char_prev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    113c <utf8_char_prev+0x2c>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1174 <utf8_char_prev+0x64>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <utf8_cont@plt>
cmp    $0x0,%eax
jne    116f <utf8_char_prev+0x5f>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1174 <utf8_char_prev+0x64>
jmp    1124 <utf8_char_prev+0x14>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_char_prev>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rdx,%rbx
nopw   0x0(%rax,%rax,1)
sub    $0x1,%rbx
jb     113a <utf8_char_prev+0x2a>
movsbl -0x1(%r14,%rdx,1),%edi
call   1030 <utf8_cont@plt>
mov    %rbx,%rdx
test   %eax,%eax
jne    1120 <utf8_char_prev+0x10>
jmp    113c <utf8_char_prev+0x2c>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @utf8_char_prev(i8* nocapture %0, i64 %1, i64 %2) {
br label %4
4: ; preds = %7, %3
%5 = phi i64 [ %2, %3 ], [ %8, %7 ]
%6 = icmp eq i64 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = add i64 %5, -1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = tail call i32 @utf8_cont(i8 signext %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %7, %4
%14 = phi i64 [ 0, %4 ], [ %8, %7 ]
ret i64 %14
}
int i386_cannot_store_register(int regno) { return (regno >= 16); }


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

x86 assembly (clang, -O2):
<i386_cannot_store_register>:
xor    %eax,%eax
cmp    $0x10,%edi
setge  %al
ret

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

LLVM IR (-O2):
define i32 @i386_cannot_store_register(i32 %0) {
%2 = icmp sgt i32 %0, 15
%3 = zext i1 %2 to i32
ret i32 %3
}
unsigned long crb_get_env(unsigned long id, char *buf, unsigned long length) {
  return 0xc000000000000000ul;
}


x86 assembly (clang, -O0):
<crb_get_env>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movabs $0xc000000000000000,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<crb_get_env>:
movabs $0xc000000000000000,%rax
ret

LLVM IR (-O0):
define i64 @crb_get_env(i64 %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
store i64 %0, i64* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
ret i64 -4611686018427387904
}

LLVM IR (-O2):
define i64 @crb_get_env(i64 %0, i8* nocapture readnone %1, i64 %2) {
ret i64 -4611686018427387904
}
/* Variables and functions */
int /*<<< orphan*/ build_heap(int *, int);
int /*<<< orphan*/ heapExtract(int *, int *);
void heapsort(int heap[], int heap_size) {
  build_heap(heap, heap_size);
  while (heap_size > 0)
    heapExtract(heap, &heap_size);
}


x86 assembly (clang, -O0):
<heapsort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <build_heap@plt>
cmpl   $0x0,-0xc(%rbp)
jle    1157 <heapsort+0x37>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <heapExtract@plt>
jmp    113b <heapsort+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heapsort>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %esi,0xc(%rsp)
call   1030 <build_heap@plt>
test   %ebp,%ebp
jle    1152 <heapsort+0x32>
lea    0xc(%rsp),%r14
nop
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <heapExtract@plt>
cmpl   $0x0,0xc(%rsp)
jg     1140 <heapsort+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @heapsort(i32* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = tail call i32 @build_heap(i32* %0, i32 %1)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %10
6: ; preds = %2, %6
%7 = call i32 @heapExtract(i32* %0, i32* %3)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %6, label %10
10: ; preds = %6, %2
ret void
}
void ProtectMemory(void *addr, int length, int prot) {}


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

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

LLVM IR (-O0):
define void @ProtectMemory(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @ProtectMemory(i8* nocapture %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
unsigned long pthread_self();
unsigned long int os_thread_self(void) { return pthread_self(); }


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

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

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

LLVM IR (-O2):
define i64 @os_thread_self() {
%1 = tail call i64 (...) @pthread_self()
ret i64 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ m205_reset();
int /*<<< orphan*/ mmc3init(int /*<<< orphan*/ *, int /*<<< orphan*/,
                            int /*<<< orphan*/ *, int /*<<< orphan*/,
                            int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void m205_init(uint8_t *prgROMin, uint32_t prgROMsizeIn, uint8_t *prgRAMin,
               uint32_t prgRAMsizeIn, uint8_t *chrROMin,
               uint32_t chrROMsizeIn) {
  mmc3init(prgROMin, prgROMsizeIn, prgRAMin, prgRAMsizeIn, chrROMin,
           chrROMsizeIn);
  m205_reset();
  printf("Mapper 205 (Mapper 4 Game Select) inited\n");
}


x86 assembly (clang, -O0):
<m205_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x2c(%rbp),%r9d
call   1030 <mmc3init@plt>
mov    $0x0,%al
call   1050 <m205_reset@plt>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m205_init>:
push   %rax
call   1030 <mmc3init@plt>
xor    %eax,%eax
call   1050 <m205_reset@plt>
lea    0xebc(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Mapper 205 (Mapper 4 Game Select) inited\0A\00"
define void @m205_init(i32* %0, i32 %1, i32* %2, i32 %3, i32* %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32* %2, i32** %9
store i32 %3, i32* %10
store i32* %4, i32** %11
store i32 %5, i32* %12
%13 = load i32*, i32** %7
%14 = load i32, i32* %8
%15 = load i32*, i32** %9
%16 = load i32, i32* %10
%17 = load i32*, i32** %11
%18 = load i32, i32* %12
%19 = call i32 @mmc3init(i32* %13, i32 %14, i32* %15, i32 %16, i32* %17, i32 %18)
%20 = call i32 (...) @m205_reset()
%21 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [41 x i8] c"Mapper 205 (Mapper 4 Game Select) inited\00"
define void @m205_init(i32* %0, i32 %1, i32* %2, i32 %3, i32* %4, i32 %5) {
%7 = tail call i32 @mmc3init(i32* %0, i32 %1, i32* %2, i32 %3, i32* %4, i32 %5)
%8 = tail call i32 (...) @m205_reset()
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
ret void
}
void clean() {}


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

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

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

LLVM IR (-O2):
define void @clean() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int a, b, c;
  a = 12;
  b = 10;
  c = a | b;
  printf("%d", c);
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 14)
ret i32 0
}
int test_imm_76uint8_mem(unsigned char *val) {
  return ((*val) & (0x76 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_76uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 118
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void __disable_interrupt(void) {}


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

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

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

LLVM IR (-O2):
define void @__disable_interrupt() {
ret void
}
/* Variables and functions */
int ap_cmd_get_int(int, int, int *);
int ap_get_playlist_length(int session, int *length) {
  return (ap_cmd_get_int(session, 0xcc2a, length));
}


x86 assembly (clang, -O0):
<ap_get_playlist_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    $0xcc2a,%esi
call   1030 <ap_cmd_get_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ap_get_playlist_length>:
mov    %rsi,%rdx
mov    $0xcc2a,%esi
jmp    1030 <ap_cmd_get_int@plt>

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

LLVM IR (-O2):
define i32 @ap_get_playlist_length(i32 %0, i32* %1) {
%3 = tail call i32 @ap_cmd_get_int(i32 %0, i32 52266, i32* %1)
ret i32 %3
}
int strcopy(const char *y, char *x) {
  int i = 0;
  while ((*x++ = *y++) != '\0')
    i = i + 1;
  *x = '\0';
  return (i + 1);
}


x86 assembly (clang, -O0):
<strcopy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     114f <strcopy+0x4f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <strcopy+0x13>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcopy>:
mov    (%rdi),%al
mov    %al,(%rsi)
test   %al,%al
je     1126 <strcopy+0x26>
mov    $0x1,%eax
nopl   (%rax)
movzbl (%rdi,%rax,1),%ecx
mov    %cl,(%rsi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strcopy+0x10>
add    %rax,%rsi
movb   $0x0,(%rsi)
ret
add    $0x1,%rsi
mov    $0x1,%eax
movb   $0x0,(%rsi)
ret

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

LLVM IR (-O2):
define i32 @strcopy(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %3, i8* %1
%5 = icmp eq i8 %3, 0
br i1 %5, label %15, label %6
6: ; preds = %2, %6
%7 = phi i8* [ %13, %6 ], [ %4, %2 ]
%8 = phi i32 [ %11, %6 ], [ 1, %2 ]
%9 = phi i8* [ %10, %6 ], [ %0, %2 ]
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = add i32 %8, 1
%12 = load i8, i8* %10
%13 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %12, i8* %7
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %6
15: ; preds = %6, %2
%16 = phi i32 [ 1, %2 ], [ %11, %6 ]
%17 = phi i8* [ %4, %2 ], [ %13, %6 ]
store i8 0, i8* %17
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void show_char(void *value) {
  char data = *((char *)value);
  putchar(data);
}


x86 assembly (clang, -O0):
<show_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_char>:
movsbl (%rdi),%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @show_char(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @putchar(i8 signext %2)
ret void
}
const char *TA_GetVersionTime(void) { return "22:59:09"; }


x86 assembly (clang, -O0):
<TA_GetVersionTime>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TA_GetVersionTime>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"22:59:09\00"
define i8* @TA_GetVersionTime() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [9 x i8] c"22:59:09\00"
define i8* @TA_GetVersionTime() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int SIZE_MAX;
size_t hz_map_next_bucket_count(size_t current_count) {
  if (current_count > (size_t)(SIZE_MAX / 2)) {
    return SIZE_MAX;
  } else if (current_count == 0) {
    return 8;
  } else {
    return (size_t)(current_count * 2);
  }
}


x86 assembly (clang, -O0):
<hz_map_next_bucket_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
jbe    1146 <hz_map_next_bucket_count+0x46>
mov    0x2e9e(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    116a <hz_map_next_bucket_count+0x6a>
cmpq   $0x0,-0x10(%rbp)
jne    115e <hz_map_next_bucket_count+0x5e>
movq   $0x8,-0x8(%rbp)
jmp    116a <hz_map_next_bucket_count+0x6a>
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hz_map_next_bucket_count>:
mov    0x2ed1(%rip),%rax
movslq (%rax),%rcx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
lea    (%rdi,%rdi,1),%rsi
test   %rdi,%rdi
mov    $0x8,%eax
cmovne %rsi,%rax
movslq %edx,%rdx
cmp    %rdi,%rdx
cmovb  %rcx,%rax
ret

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

LLVM IR (-O2):
@SIZE_MAX = global i32 0
define i64 @hz_map_next_bucket_count(i64 %0) {
%2 = load i32, i32* @SIZE_MAX
%3 = sdiv i32 %2, 2
%4 = sext i32 %3 to i64
%5 = icmp ult i64 %4, %0
%6 = sext i32 %2 to i64
%7 = icmp eq i64 %0, 0
%8 = shl i64 %0, 1
%9 = select i1 %7, i64 8, i64 %8
%10 = select i1 %5, i64 %6, i64 %9
ret i64 %10
}
void CycleStart(void) {}


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

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

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

LLVM IR (-O2):
define void @CycleStart() {
ret void
}
void throwException(char *message) {}


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

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

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

LLVM IR (-O2):
define void @throwException(i8* nocapture %0) {
ret void
}
void *vabsptr(void *ptr) { return (void *)((unsigned int)ptr | 0x04000000); }


x86 assembly (clang, -O0):
<vabsptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
or     $0x4000000,%eax
mov    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vabsptr>:
mov    %rdi,%rax
or     $0x4000000,%eax
ret

LLVM IR (-O0):
define i8* @vabsptr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = or i32 %4, 67108864
%6 = zext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
define i8* @vabsptr(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = and i64 %2, 4227858431
%4 = or i64 %3, 67108864
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
int check_for_comment(char *str) {
  if (str[0] == '/' && str[1] == '/') {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_for_comment>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1135 <check_for_comment+0x35>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
jne    1135 <check_for_comment+0x35>
movl   $0x1,-0x4(%rbp)
jmp    113c <check_for_comment+0x3c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_for_comment>:
cmpb   $0x2f,(%rdi)
jne    1110 <check_for_comment+0x10>
mov    $0x1,%eax
cmpb   $0x2f,0x1(%rdi)
je     1112 <check_for_comment+0x12>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @check_for_comment(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 47
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 47
br i1 %7, label %9, label %8
8: ; preds = %4, %1
br label %9
9: ; preds = %4, %8
%10 = phi i32 [ 0, %8 ], [ 1, %4 ]
ret i32 %10
}
/* Variables and functions */
int strcmp(char const *, char const *);
int strcoll(const char *s1, const char *s2) { return (strcmp(s1, s2)); }


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

x86 assembly (clang, -O2):
<strcoll>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @strcoll(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 i32 @strcmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @strcoll(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}