xunge/DecIR huggingface dataset:
double GPS_Math_Metres_To_Feet(double v) { return v / 0.3048; }


x86 assembly (clang, -O0):
<GPS_Math_Metres_To_Feet>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @GPS_Math_Metres_To_Feet(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 3.048000e-01
ret double %4
}

LLVM IR (-O2):
define double @GPS_Math_Metres_To_Feet(double %0) {
%2 = fdiv double %0, 3.048000e-01
ret double %2
}
/* Variables and functions */
int read_serial_byte();
unsigned int read_serial_long(void) {
  unsigned int result = 0;
  for (int i = 0; i < 4; i++)
    result = (result >> 8) | (read_serial_byte() << 24);
  return result;
}


x86 assembly (clang, -O0):
<read_serial_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    115b <read_serial_long+0x4b>
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <read_serial_byte@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <read_serial_long+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_serial_long>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <read_serial_byte@plt>
mov    %eax,%ebx
shl    $0x18,%ebx
xor    %eax,%eax
call   1030 <read_serial_byte@plt>
mov    %eax,%ebp
shld   $0x18,%ebx,%ebp
xor    %eax,%eax
call   1030 <read_serial_byte@plt>
mov    %eax,%ebx
shld   $0x18,%ebp,%ebx
xor    %eax,%eax
call   1030 <read_serial_byte@plt>
shld   $0x18,%ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @read_serial_long() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %12, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 4
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = load i32, i32* %1
%8 = lshr i32 %7, 8
%9 = call i32 (...) @read_serial_byte()
%10 = shl i32 %9, 24
%11 = or i32 %8, %10
store i32 %11, i32* %1
br label %12
12: ; preds = %6
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %3
15: ; preds = %3
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
define i32 @read_serial_long() {
%1 = tail call i32 (...) @read_serial_byte()
%2 = shl i32 %1, 24
%3 = tail call i32 (...) @read_serial_byte()
%4 = tail call i32 @llvm.fshl.i32(i32 %3, i32 %2, i32 24)
%5 = tail call i32 (...) @read_serial_byte()
%6 = tail call i32 @llvm.fshl.i32(i32 %5, i32 %4, i32 24)
%7 = tail call i32 (...) @read_serial_byte()
%8 = tail call i32 @llvm.fshl.i32(i32 %7, i32 %6, i32 24)
ret i32 %8
}
void DBGFR3LogModifyFlags(void) {}


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

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

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

LLVM IR (-O2):
define void @DBGFR3LogModifyFlags() {
ret void
}
/* Variables and functions */
int __VERIFIER_nondet_bool();
int /*<<< orphan*/ free(int *);
int *malloc(int);
int main() {
  bool selector = __VERIFIER_nondet_bool();
  int *ptr;
  if (!selector) {
    if (selector) {
      *ptr = 666;
    }
    ptr = malloc(sizeof(int));
    free(ptr);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_bool@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    117e <main+0x4e>
cmpl   $0x0,-0x8(%rbp)
je     1167 <main+0x37>
mov    -0x10(%rbp),%rax
movl   $0x29a,(%rax)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_bool@plt>
test   %eax,%eax
jne    114e <main+0x1e>
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32 (...) @__VERIFIER_nondet_bool()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = load i32*, i32** %3
store i32 666, i32* %11
br label %12
12: ; preds = %10, %7
%13 = call i32* @malloc(i32 4)
store i32* %13, i32** %3
%14 = load i32*, i32** %3
%15 = call i32 @free(i32* %14)
br label %16
16: ; preds = %12, %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_bool()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32* @malloc(i32 4)
%5 = tail call i32 @free(i32* %4)
br label %6
6: ; preds = %3, %0
ret i32 0
}
struct Foo *get_foo(void) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.Foo = type opaque
define %struct.Foo* @get_foo() {
ret %struct.Foo* null
}

LLVM IR (-O2):
%struct.Foo = type opaque
define noalias %struct.Foo* @get_foo() {
ret %struct.Foo* null
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void fatal(char *s) { fprintf(stderr, "Error: %s\n", s); }


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fatal>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
define void @fatal(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct zip {
  int dummy;
};

/* Variables and functions */
int _zip_unchange(struct zip *, int, int /*<<< orphan*/);
int zip_unchange(struct zip *za, int idx) { return _zip_unchange(za, idx, 0); }


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

x86 assembly (clang, -O2):
<zip_unchange>:
xor    %edx,%edx
jmp    1030 <_zip_unchange@plt>

LLVM IR (-O0):
%struct.zip = type { i32 }
define i32 @zip_unchange(%struct.zip* %0, i32 %1) {
%3 = alloca %struct.zip*
%4 = alloca i32
store %struct.zip* %0, %struct.zip** %3
store i32 %1, i32* %4
%5 = load %struct.zip*, %struct.zip** %3
%6 = load i32, i32* %4
%7 = call i32 @_zip_unchange(%struct.zip* %5, i32 %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
%struct.zip = type { i32 }
define i32 @zip_unchange(%struct.zip* %0, i32 %1) {
%3 = tail call i32 @_zip_unchange(%struct.zip* %0, i32 %1, i32 0)
ret i32 %3
}
extern int fib(int n) { return n <= 1 ? 1 : fib(n - 2) + fib(n - 1); }


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

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmp    $0x2,%edi
jl     1145 <fib+0x35>
mov    %edi,%ebx
add    $0x1,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x3(%rbx),%edi
call   1030 <fib@plt>
add    %eax,%ebp
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
ja     1130 <fib+0x20>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -2
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %4, -1
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 3
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i32 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %14
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void ux00ddr_enablereadleveling(size_t ahbregaddr) {
  (*(volatile uint32_t *)((181 << 2) + (ahbregaddr))) |= (1 << 24);
  (*(volatile uint32_t *)((260 << 2) + (ahbregaddr))) |= (1 << 16);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x2d4,%rax
mov    (%rax),%ecx
or     $0x1000000,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x410,%rax
mov    (%rax),%ecx
or     $0x10000,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
orl    $0x1000000,0x2d4(%rdi)
orl    $0x10000,0x410(%rdi)
ret

LLVM IR (-O0):
define void @ux00ddr_enablereadleveling(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 724, %3
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = or i32 %6, 16777216
store volatile i32 %7, i32* %5
%8 = load i64, i64* %2
%9 = add i64 1040, %8
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = or i32 %11, 65536
store volatile i32 %12, i32* %10
ret void
}

LLVM IR (-O2):
define void @ux00ddr_enablereadleveling(i64 %0) {
%2 = add i64 %0, 724
%3 = inttoptr i64 %2 to i32*
%4 = load volatile i32, i32* %3
%5 = or i32 %4, 16777216
store volatile i32 %5, i32* %3
%6 = add i64 %0, 1040
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = or i32 %8, 65536
store volatile i32 %9, i32* %7
ret void
}
char const *vl_get_version_string() { return "0.9.9"; }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"0.9.9\00"
define i8* @vl_get_version_string() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"0.9.9\00"
define i8* @vl_get_version_string() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", 15 + 37);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x34,%esi
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    $0x34,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 52)
ret i32 0
}
int copy() { return 42; }


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

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

LLVM IR (-O0):
define i32 @copy() {
ret i32 42
}

LLVM IR (-O2):
define i32 @copy() {
ret i32 42
}
/* Variables and functions */
int inc(int);
int /*<<< orphan*/ stop_light();
main() {
  int i;
  while (i < 36) {
    stop_light();
    i = inc(i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x24,-0x8(%rbp)
jge    1150 <main+0x30>
mov    $0x0,%al
call   1030 <stop_light@plt>
mov    -0x8(%rbp),%edi
call   1040 <inc@plt>
mov    %eax,-0x8(%rbp)
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 36
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = call i32 (...) @stop_light()
%8 = load i32, i32* %2
%9 = call i32 @inc(i32 %8)
store i32 %9, i32* %2
br label %3
10: ; preds = %3
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
char *calloc(int, int);
int rand();
int /*<<< orphan*/ sprintf(char *, char *, unsigned int, unsigned int);
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ time(int /*<<< orphan*/);
char *random_cache_dir() {
  unsigned t = (unsigned)time(0);
  srand(t);
  unsigned r = (unsigned)(rand() % 999);
  char *cache_dir = calloc(18, sizeof(char));
  sprintf(cache_dir, ".out%d%d/", t, r);
  return cache_dir;
}


x86 assembly (clang, -O0):
<random_cache_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x3e7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    $0x12,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe60(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_cache_dir>:
push   %rbp
push   %r14
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%r14d
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rbx
imul   $0xffffffff83340521,%rbx,%rax
shr    $0x20,%rax
add    %ebx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x9,%eax
add    %ecx,%eax
imul   $0x3e7,%eax,%eax
sub    %eax,%ebx
mov    $0x12,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbp
lea    0xe59(%rip),%rsi
mov    %rax,%rdi
mov    %r14d,%edx
mov    %ebx,%ecx
call   1060 <sprintf@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c".out%d%d/\00"
define i8* @random_cache_dir() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = call i32 @time(i32 0)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @srand(i32 %5)
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 999
store i32 %8, i32* %2
%9 = call i8* @calloc(i32 18, i32 1)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [10 x i8] c".out%d%d/\00"
define noalias i8* @random_cache_dir() {
%1 = tail call i32 @time(i32 0)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 999
%5 = tail call dereferenceable_or_null(18) i8* @calloc(i32 18, i32 1)
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %4)
ret i8* %5
}
unsigned int rice_size(unsigned int val, unsigned int nbits) {
  val -= (1);
  unsigned int w, size;
  size = nbits;
  for (w = (val >> nbits); w > 0; w--) {
    size++;
  }
  size++;
  return size;
}


x86 assembly (clang, -O0):
<rice_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jbe    1145 <rice_size+0x45>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <rice_size+0x24>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rice_size>:
mov    %esi,%ecx
add    $0xffffffff,%edi
shr    %cl,%edi
lea    (%rdi,%rcx,1),%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @rice_size(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* %3
%8 = sub i32 %7, 1
store i32 %8, i32* %3
%9 = load i32, i32* %4
store i32 %9, i32* %6
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = lshr i32 %10, %11
store i32 %12, i32* %5
br label %13
13: ; preds = %19, %2
%14 = load i32, i32* %5
%15 = icmp ugt i32 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i32, i32* %6
%18 = add i32 %17, 1
store i32 %18, i32* %6
br label %19
19: ; preds = %16
%20 = load i32, i32* %5
%21 = add i32 %20, -1
store i32 %21, i32* %5
br label %13
22: ; preds = %13
%23 = load i32, i32* %6
%24 = add i32 %23, 1
store i32 %24, i32* %6
%25 = load i32, i32* %6
ret i32 %25
}

LLVM IR (-O2):
define i32 @rice_size(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = lshr i32 %3, %1
%5 = add i32 %4, %1
%6 = add i32 %5, 1
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int fileTest(char *name) {
  int fd = open(name, O_RDWR);
  if (fd >= 0) {
    close(fd);
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<fileTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     115f <fileTest+0x3f>
mov    -0x14(%rbp),%edi
call   1030 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    1166 <fileTest+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileTest>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
test   %eax,%eax
js     1141 <fileTest+0x21>
mov    %eax,%edi
call   1030 <close@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@O_RDWR = global i32 0
define i32 @fileTest(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i32, i32* @O_RDWR
%7 = call i32 @open(i8* %5, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32, i32* %4
%12 = call i32 @close(i32 %11)
store i32 1, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@O_RDWR = global i32 0
define i32 @fileTest(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @close(i32 %3)
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ 1, %5 ], [ 0, %1 ]
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
scalar_t__ time(int /*<<< orphan*/ *);
long time_get_sec(void) {
  time_t t;
  return (long)time(&t);
}


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

x86 assembly (clang, -O2):
<time_get_sec>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <time@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i64 @time_get_sec() {
%1 = alloca i32
%2 = call i64 @time(i32* %1)
ret i64 %2
}

LLVM IR (-O2):
define i64 @time_get_sec() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @time(i32* %1)
ret i64 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int get_dumpsize(FILE *file) {
  int size = 0;
  fseek(file, 0, SEEK_END);
  size = ftell(file);
  fseek(file, 0, SEEK_SET);
  return size;
}


x86 assembly (clang, -O0):
<get_dumpsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_dumpsize>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %eax,%ebp
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @get_dumpsize(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = load i32, i32* @SEEK_END
%6 = call i32 @fseek(i32* %4, i32 0, i32 %5)
%7 = load i32*, i32** %2
%8 = call i32 @ftell(i32* %7)
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %9, i32 0, i32 %10)
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @get_dumpsize(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32* %0, i32 0, i32 %2)
%4 = tail call i32 @ftell(i32* %0)
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @fseek(i32* %0, i32 0, i32 %5)
ret i32 %4
}
int test_imm_2Duint32_reg(unsigned int val) {
  return ((val) & (0x2D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_2Duint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x2d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_2Duint32_reg(i32 %0) {
%2 = and i32 %0, 45
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void Init_sound() {}


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

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

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

LLVM IR (-O2):
define void @Init_sound() {
ret void
}
int ffs(int x) {
  int r;
  __asm__("bsfl %1,%0\n\t"
          "jnz 1f\n\t"
          "movl $-1,%0\n"
          "1:"
          : "=r"(r)
          : "rm"(x));
  return r + 1;
}


x86 assembly (clang, -O0):
<ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
bsf    -0xc(%rbp),%eax
jne    111c <ffs+0x1c>
mov    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs>:
mov    %edi,-0x4(%rsp)
bsf    -0x4(%rsp),%eax
jne    1110 <ffs+0x10>
mov    $0xffffffff,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ffs(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 asm "bsfl $1,$0\0A\09jnz 1f\0A\09movl $$-1,$0\0A1:", "=r,rm,~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
ret i32 %7
}

LLVM IR (-O2):
define i32 @ffs(i32 %0) {
%2 = tail call i32 asm "bsfl $1,$0\0A\09jnz 1f\0A\09movl $$-1,$0\0A1:", "=r,rm,~{dirflag},~{fpsr},~{flags}"(i32 %0)
%3 = add nsw i32 %2, 1
ret i32 %3
}
/* Variables and functions */
char *strstr(char *, char *);
char *find_crlf(char *p) {
  if ((p = strstr(p, "\r\n\r\n")) != NULL)
    p += 4;
  return (p);
}


x86 assembly (clang, -O0):
<find_crlf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     1146 <find_crlf+0x36>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_crlf>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strstr@plt>
lea    0x4(%rax),%rcx
test   %rax,%rax
cmovne %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\0D\0A\0D\0A\00"
define i8* @find_crlf(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @strstr(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 4
store i8* %8, i8** %2
br label %9
9: ; preds = %6, %1
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [5 x i8] c"\0D\0A\0D\0A\00"
define i8* @find_crlf(i8* %0) {
%2 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 4
%5 = select i1 %3, i8* null, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ bef_pop();
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
int ins_ptc() {
  putchar(bef_pop());
  return 1;
}


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

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

LLVM IR (-O0):
define i32 @ins_ptc() {
%1 = call i32 (...) @bef_pop()
%2 = call i32 @putchar(i32 %1)
ret i32 1
}

LLVM IR (-O2):
define i32 @ins_ptc() {
%1 = tail call i32 (...) @bef_pop()
%2 = tail call i32 @putchar(i32 %1)
ret i32 1
}
/* Variables and functions */
#define KEY_REFRESH 128
int /*<<< orphan*/ curscr;
int /*<<< orphan*/ redrawwin(int /*<<< orphan*/);
int wgetch(int /*<<< orphan*/);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/);
void pollkey(void) {
  int key;
  key = wgetch(curscr);
  switch (key) {
  case 12:
  case 18:
  case KEY_REFRESH:
    redrawwin(curscr);
    wrefresh(curscr);
  }
}


x86 assembly (clang, -O0):
<pollkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1050 <wgetch@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0xc,%eax
je     1181 <pollkey+0x51>
jmp    115d <pollkey+0x2d>
mov    -0x8(%rbp),%eax
sub    $0x12,%eax
je     1181 <pollkey+0x51>
jmp    116e <pollkey+0x3e>
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
jne    119d <pollkey+0x6d>
jmp    1181 <pollkey+0x51>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1040 <redrawwin@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
call   1030 <wrefresh@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pollkey>:
push   %rbx
mov    0x2ea0(%rip),%rbx
mov    (%rbx),%edi
call   1050 <wgetch@plt>
cmp    $0xc,%eax
je     1150 <pollkey+0x20>
cmp    $0x80,%eax
je     1150 <pollkey+0x20>
cmp    $0x12,%eax
jne    115f <pollkey+0x2f>
mov    (%rbx),%edi
call   1040 <redrawwin@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1030 <wrefresh@plt>
pop    %rbx
ret

LLVM IR (-O0):
@curscr = global i32 0
define void @pollkey() {
%1 = alloca i32
%2 = load i32, i32* @curscr
%3 = call i32 @wgetch(i32 %2)
store i32 %3, i32* %1
%4 = load i32, i32* %1
switch i32 %4, label %10 [
i32 12, label %5
i32 18, label %5
i32 128, label %5
]
5: ; preds = %0, %0, %0
%6 = load i32, i32* @curscr
%7 = call i32 @redrawwin(i32 %6)
%8 = load i32, i32* @curscr
%9 = call i32 @wrefresh(i32 %8)
br label %10
10: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@curscr = global i32 0
define void @pollkey() {
%1 = load i32, i32* @curscr
%2 = tail call i32 @wgetch(i32 %1)
switch i32 %2, label %8 [
i32 12, label %3
i32 18, label %3
i32 128, label %3
]
3: ; preds = %0, %0, %0
%4 = load i32, i32* @curscr
%5 = tail call i32 @redrawwin(i32 %4)
%6 = load i32, i32* @curscr
%7 = tail call i32 @wrefresh(i32 %6)
br label %8
8: ; preds = %3, %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ fprint_op(int /*<<< orphan*/, int /*<<< orphan*/ *,
                             int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void print_op(uint8_t *IR, int32_t current_PC) {
  fprint_op(stdout, IR, current_PC);
}


x86 assembly (clang, -O0):
<print_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <fprint_op@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_op>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fprint_op@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @print_op(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stdout
%6 = load i32*, i32** %3
%7 = load i32, i32* %4
%8 = call i32 @fprint_op(i32 %5, i32* %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @print_op(i32* %0, i32 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprint_op(i32 %3, i32* %0, i32 %1)
ret void
}
int isLeapYear(int year) {
  if ((year % 4 == 0 && year % 100 != 0) ||
      (year % 100 == 0 && year % 400 == 0))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isLeapYear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    112f <isLeapYear+0x2f>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1157 <isLeapYear+0x57>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1163 <isLeapYear+0x63>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1163 <isLeapYear+0x63>
movl   $0x1,-0x4(%rbp)
jmp    116a <isLeapYear+0x6a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLeapYear>:
movslq %edi,%rcx
imul   $0x51eb851f,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
mov    %rdx,%rax
sar    $0x25,%rax
add    %esi,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ecx
test   $0x3,%dil
jne    112f <isLeapYear+0x2f>
mov    $0x1,%eax
test   %ecx,%ecx
je     112f <isLeapYear+0x2f>
ret
sar    $0x27,%rdx
add    %esi,%edx
imul   $0x190,%edx,%eax
sub    %eax,%edi
xor    %eax,%eax
or     %edi,%ecx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @isLeapYear(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp ne i32 %2, 0
%4 = srem i32 %0, 100
%5 = icmp eq i32 %4, 0
%6 = or i1 %3, %5
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = srem i32 %0, 400
%9 = or i32 %4, %8
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %7, %1
%13 = phi i32 [ 1, %1 ], [ %11, %7 ]
ret i32 %13
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
const char *sas_quiesce_reason_to_text(uint8_t reason) {
  switch (reason) {
  case (0x01):
    return "STARTED";
  case (0x02):
    return "COMPLETED";
  }
  return "UNKNOWN";
}


x86 assembly (clang, -O0):
<sas_quiesce_reason_to_text>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     112c <sas_quiesce_reason_to_text+0x2c>
jmp    111b <sas_quiesce_reason_to_text+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     113c <sas_quiesce_reason_to_text+0x3c>
jmp    114c <sas_quiesce_reason_to_text+0x4c>
lea    0xecd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1157 <sas_quiesce_reason_to_text+0x57>
lea    0xec5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1157 <sas_quiesce_reason_to_text+0x57>
lea    0xebf(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sas_quiesce_reason_to_text>:
cmp    $0x2,%edi
lea    0xefe(%rip),%rax
lea    0xf01(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x1,%edi
lea    0xee1(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"STARTED\00"
@.str.1 = [10 x i8] c"COMPLETED\00"
@.str.2 = [8 x i8] c"UNKNOWN\00"
define i8* @sas_quiesce_reason_to_text(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 1, label %5
i32 2, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [8 x i8] c"STARTED\00"
@.str.1 = [10 x i8] c"COMPLETED\00"
@.str.2 = [8 x i8] c"UNKNOWN\00"
define i8* @sas_quiesce_reason_to_text(i32 %0) {
%2 = icmp eq i32 %0, 2
%3 = select i1 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%4 = icmp eq i32 %0, 1
%5 = select i1 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
/* Variables and functions */
scalar_t__ declare_arrayNnomemset(int, int, int, int);
double **declare_double_nomemset(int first, int second) {
  return (double **)declare_arrayNnomemset(2, sizeof(double), first, second);
}


x86 assembly (clang, -O0):
<declare_double_nomemset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    $0x2,%edi
mov    $0x8,%esi
call   1030 <declare_arrayNnomemset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<declare_double_nomemset>:
mov    %esi,%ecx
mov    %edi,%edx
mov    $0x2,%edi
mov    $0x8,%esi
jmp    1030 <declare_arrayNnomemset@plt>

LLVM IR (-O0):
define double** @declare_double_nomemset(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 i64 @declare_arrayNnomemset(i32 2, i32 8, i32 %5, i32 %6)
%8 = inttoptr i64 %7 to double**
ret double** %8
}

LLVM IR (-O2):
define double** @declare_double_nomemset(i32 %0, i32 %1) {
%3 = tail call i64 @declare_arrayNnomemset(i32 2, i32 8, i32 %0, i32 %1)
%4 = inttoptr i64 %3 to double**
ret double** %4
}
unsigned long strhash(const char *s) {
  int c;
  unsigned long hash = 5381;
  while ((c = *s++)) {
    hash = ((hash << 5) + hash) ^ c;
  }
  return hash;
}


x86 assembly (clang, -O0):
<strhash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     114a <strhash+0x4a>
mov    -0x18(%rbp),%rax
shl    $0x5,%rax
add    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
xor    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <strhash+0x10>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strhash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112d <strhash+0x2d>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movsbq %cl,%rax
xor    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <strhash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i64 @strhash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = mul i64 %6, 33
%10 = sext i8 %5 to i64
%11 = xor i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ cosf(float);
float sinf(float);
float sincosf_sinf(float x) {
  (void)cosf(x);
  return sinf(x);
}


x86 assembly (clang, -O0):
<sincosf_sinf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <cosf@plt>
movss  -0x4(%rbp),%xmm0
call   1030 <sinf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sincosf_sinf>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1040 <cosf@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
jmp    1030 <sinf@plt>

LLVM IR (-O0):
define float @sincosf_sinf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @cosf(float %3)
%5 = load float, float* %2
%6 = call float @sinf(float %5)
ret float %6
}

LLVM IR (-O2):
define float @sincosf_sinf(float %0) {
%2 = tail call i32 @cosf(float %0)
%3 = tail call float @sinf(float %0)
ret float %3
}
/* Variables and functions */
char *strerror(int);
int /*<<< orphan*/ strncpy(char *, char *, int);
void ems1Serr(char *errstr, int errlen, int *errnum) {
  char *strerr;
  if (*errnum >= 0) {
    strerr = strerror(*errnum);
    strncpy(errstr, strerr, errlen);
    errstr[errlen - 1] = '\0';
  } else {
    *errstr = '\0';
  }
  return;
}


x86 assembly (clang, -O0):
<ems1Serr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jl     1175 <ems1Serr+0x55>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    117c <ems1Serr+0x5c>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ems1Serr>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdx),%edi
test   %edi,%edi
js     114a <ems1Serr+0x2a>
mov    %esi,%ebp
call   1040 <strerror@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %ebp,%edx
call   1030 <strncpy@plt>
movslq %ebp,%rax
add    %rax,%rbx
add    $0xffffffffffffffff,%rbx
movb   $0x0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @ems1Serr(i8* %0, i32 %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = tail call i8* @strerror(i32 %4)
%8 = tail call i32 @strncpy(i8* %0, i8* %7, i32 %1)
%9 = add nsw i32 %1, -1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
br label %12
12: ; preds = %3, %6
%13 = phi i8* [ %11, %6 ], [ %0, %3 ]
store i8 0, i8* %13
ret void
}
unsigned char to_bcd(unsigned char orig) {
  orig = orig % 100;
  return ((orig % 0xa) & 0x0f) + (((orig / 0xa) << 4) & 0xf0);
}


x86 assembly (clang, -O0):
<to_bcd>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
and    $0xf,%edx
mov    %edx,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
shl    $0x4,%ecx
and    $0xf0,%ecx
add    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_bcd>:
lea    (%rdi,%rdi,4),%eax
lea    (%rdi,%rax,8),%eax
shr    $0xc,%eax
imul   $0x64,%eax,%eax
sub    %al,%dil
movzbl %dil,%ecx
imul   $0xcd,%ecx,%eax
shr    $0xb,%eax
lea    (%rax,%rax,1),%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%cl
shl    $0x4,%al
or     %cl,%al
ret

LLVM IR (-O0):
define zeroext i8 @to_bcd(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = srem i32 %4, 100
%6 = trunc i32 %5 to i8
store i8 %6, i8* %2
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = srem i32 %8, 10
%10 = and i32 %9, 15
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = sdiv i32 %12, 10
%14 = shl i32 %13, 4
%15 = and i32 %14, 240
%16 = add nsw i32 %10, %15
%17 = trunc i32 %16 to i8
ret i8 %17
}

LLVM IR (-O2):
define zeroext i8 @to_bcd(i8 zeroext %0) {
%2 = urem i8 %0, 100
%3 = urem i8 %2, 10
%4 = udiv i8 %2, 10
%5 = shl nuw i8 %4, 4
%6 = or i8 %5, %3
ret i8 %6
}
void init_realjoy(void) {}


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

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

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

LLVM IR (-O2):
define void @init_realjoy() {
ret void
}
/* Variables and functions */
char *strdup(char *);
char *btjpg_strdup(char *str) {
  char *s1;
  s1 = strdup(str);
  return (s1);
}


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

x86 assembly (clang, -O2):
<btjpg_strdup>:
jmp    1030 <strdup@plt>

LLVM IR (-O0):
define i8* @btjpg_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @btjpg_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}
/* Variables and functions */
int from_gps(int);
int ch_i_prompt(int ch) { return (from_gps((ch << 2) + 0x86)); }


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

x86 assembly (clang, -O2):
<ch_i_prompt>:
lea    0x86(,%rdi,4),%edi
jmp    1030 <from_gps@plt>

LLVM IR (-O0):
define i32 @ch_i_prompt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 2
%5 = add nsw i32 %4, 134
%6 = call i32 @from_gps(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @ch_i_prompt(i32 %0) {
%2 = shl i32 %0, 2
%3 = add nsw i32 %2, 134
%4 = tail call i32 @from_gps(i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int randChar(char *);
int randInt(int);
int T() {
  printf("%c", randChar("0123456789"));
  if (randInt(10) < 7)
    T();
}


x86 assembly (clang, -O0):
<T>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
call   1050 <randChar@plt>
mov    %eax,%esi
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1060 <randInt@plt>
cmp    $0x7,%eax
jge    117a <T+0x3a>
call   1030 <T@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<T>:
push   %r14
push   %rbx
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <randChar@plt>
lea    0xeb9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xa,%edi
call   1050 <randInt@plt>
cmp    $0x6,%eax
jg     1191 <T+0x61>
lea    0xe9f(%rip),%r14
lea    0xe95(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <randChar@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xa,%edi
call   1050 <randInt@plt>
cmp    $0x7,%eax
jl     1170 <T+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [11 x i8] c"0123456789\00"
define i32 @T() {
%1 = alloca i32
%2 = call i32 @randChar(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @randInt(i32 10)
%5 = icmp slt i32 %4, 7
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @T()
br label %8
8: ; preds = %6, %0
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [11 x i8] c"0123456789\00"
define i32 @T() {
%1 = tail call i32 @randChar(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @randInt(i32 10)
%4 = icmp slt i32 %3, 7
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = tail call i32 @randChar(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 @randInt(i32 10)
%9 = icmp slt i32 %8, 7
br i1 %9, label %5, label %10
10: ; preds = %5, %0
ret i32 undef
}