xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ quit(char *);
int read(int, void *, size_t);
ssize_t _read(int fd, void *buf, size_t count) {
  ssize_t s;
  if ((s = read(fd, buf, count)) == -1)
    quit("read() failed");
  return s;
}


x86 assembly (clang, -O0):
<_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <read@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
jne    115b <_read+0x3b>
lea    0xeaa(%rip),%rdi
call   1030 <quit@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_read>:
push   %rbx
call   1040 <read@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1139 <_read+0x19>
lea    0xecc(%rip),%rdi
call   1030 <quit@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"read() failed\00"
define i32 @_read(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @quit(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 %4
}
void start_timer(int x) {}


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

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

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

LLVM IR (-O2):
define void @start_timer(i32 %0) {
ret void
}
unsigned long clearBit_fun_ulong(unsigned long x, unsigned i) {
  return x & ~(1 << i);
}


x86 assembly (clang, -O0):
<clearBit_fun_ulong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearBit_fun_ulong>:
mov    %esi,%ecx
mov    $0xfffffffe,%eax
rol    %cl,%eax
cltq
and    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @clearBit_fun_ulong(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = shl i32 1, %6
%8 = xor i32 %7, -1
%9 = sext i32 %8 to i64
%10 = and i64 %5, %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @clearBit_fun_ulong(i64 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, -1
%5 = sext i32 %4 to i64
%6 = and i64 %5, %0
ret i64 %6
}
void paravirt_arch_exit_mmap(struct mm_struct *mm) {}


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

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

LLVM IR (-O0):
%struct.mm_struct = type opaque
define void @paravirt_arch_exit_mmap(%struct.mm_struct* %0) {
%2 = alloca %struct.mm_struct*
store %struct.mm_struct* %0, %struct.mm_struct** %2
ret void
}

LLVM IR (-O2):
%struct.mm_struct = type opaque
define void @paravirt_arch_exit_mmap(%struct.mm_struct* nocapture %0) {
ret void
}
int compare_uint(const void *i1, const void *i2) {
  unsigned int a, b;
  a = (long)i1;
  b = (long)i2;
  return (a > b) - (a < b);
}


x86 assembly (clang, -O0):
<compare_uint>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x14(%rbp),%ecx
cmp    -0x18(%rbp),%ecx
setb   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_uint>:
xor    %eax,%eax
cmp    %esi,%edi
seta   %al
sbb    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @compare_uint(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = ptrtoint i8* %7 to i64
%9 = trunc i64 %8 to i32
store i32 %9, i32* %5
%10 = load i8*, i8** %4
%11 = ptrtoint i8* %10 to i64
%12 = trunc i64 %11 to i32
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = icmp ugt i32 %13, %14
%16 = zext i1 %15 to i32
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = icmp ult i32 %17, %18
%20 = zext i1 %19 to i32
%21 = sub nsw i32 %16, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @compare_uint(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = ptrtoint i8* %1 to i64
%6 = trunc i64 %5 to i32
%7 = icmp ugt i32 %4, %6
%8 = zext i1 %7 to i32
%9 = icmp ult i32 %4, %6
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ lcd_cls();
void lcd_init(void) { lcd_cls(); }


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

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

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

LLVM IR (-O2):
define void @lcd_init() {
%1 = tail call i32 (...) @lcd_cls()
ret void
}
int Laborday(int monthStartDOW) {
  if (monthStartDOW == 0) {
    return 2;
  } else if (monthStartDOW == 1) {
    return 1;
  } else {
    return ((6 - monthStartDOW) + 3);
  }
}


x86 assembly (clang, -O0):
<Laborday>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <Laborday+0x1d>
movl   $0x2,-0x4(%rbp)
jmp    1141 <Laborday+0x41>
cmpl   $0x1,-0x8(%rbp)
jne    1133 <Laborday+0x33>
movl   $0x1,-0x4(%rbp)
jmp    1141 <Laborday+0x41>
mov    $0x6,%eax
sub    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Laborday>:
test   %edi,%edi
je     110f <Laborday+0xf>
cmp    $0x1,%edi
jne    1115 <Laborday+0x15>
mov    $0x1,%eax
ret
mov    $0x2,%eax
ret
mov    $0x9,%eax
sub    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @Laborday(i32 %0) {
switch i32 %0, label %3 [
i32 0, label %5
i32 1, label %2
]
2: ; preds = %1
br label %5
3: ; preds = %1
%4 = sub i32 9, %0
br label %5
5: ; preds = %1, %3, %2
%6 = phi i32 [ 1, %2 ], [ %4, %3 ], [ 2, %1 ]
ret i32 %6
}
/* Variables and functions */
double modf(double, double *);
int round(double);
bool is_fraction_a_half(double value) {
  double frac;
  double integral;
  frac = modf(value, &integral);
  if (round(frac * 10) / 10 != 0.5 && round(frac * 10) / 10 != -0.5)
    return false;
  return true;
}


x86 assembly (clang, -O0):
<is_fraction_a_half>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    -0x20(%rbp),%rdi
call   1030 <modf@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xec0(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <round@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  0xe9a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    117b <is_fraction_a_half+0x5b>
jp     117b <is_fraction_a_half+0x5b>
jmp    11c2 <is_fraction_a_half+0xa2>
movsd  0xe85(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <round@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  0xe6f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11b6 <is_fraction_a_half+0x96>
jp     11b6 <is_fraction_a_half+0x96>
jmp    11c2 <is_fraction_a_half+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    11c9 <is_fraction_a_half+0xa9>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_fraction_a_half>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rdi
call   1030 <modf@plt>
mulsd  0xeca(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <round@plt>
movsd  0x8(%rsp),%xmm0
call   1040 <round@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @is_fraction_a_half(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = call double @modf(double %6, double* %5)
store double %7, double* %4
%8 = load double, double* %4
%9 = fmul double %8, 1.000000e+01
%10 = call i32 @round(double %9)
%11 = sdiv i32 %10, 10
%12 = sitofp i32 %11 to double
%13 = fcmp une double %12, 5.000000e-01
br i1 %13, label %14, label %22
14: ; preds = %1
%15 = load double, double* %4
%16 = fmul double %15, 1.000000e+01
%17 = call i32 @round(double %16)
%18 = sdiv i32 %17, 10
%19 = sitofp i32 %18 to double
%20 = fcmp une double %19, -5.000000e-01
br i1 %20, label %21, label %22
21: ; preds = %14
store i32 0, i32* %2
br label %23
22: ; preds = %14, %1
store i32 1, i32* %2
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @is_fraction_a_half(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = call double @modf(double %0, double* %2)
%5 = fmul double %4, 1.000000e+01
%6 = tail call i32 @round(double %5)
%7 = tail call i32 @round(double %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void http_free(void *buf) { free(buf); }


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

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

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

LLVM IR (-O2):
define void @http_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put_back(int);
void do_mode_latch(int incode) { put_back(incode); }


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

x86 assembly (clang, -O2):
<do_mode_latch>:
jmp    1030 <put_back@plt>

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

LLVM IR (-O2):
define void @do_mode_latch(i32 %0) {
%2 = tail call i32 @put_back(i32 %0)
ret void
}
double ln_get_light_time(double dist) { return dist * 0.005775183; }


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

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

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

LLVM IR (-O2):
define double @ln_get_light_time(double %0) {
%2 = fmul double %0, 0x3F77A7B7E1D08C6C
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int next_digits_factorial_num(int);
void next_digits_factorial_num_test(void) {
  assert(next_digits_factorial_num(169) == 363601);
}


x86 assembly (clang, -O0):
<next_digits_factorial_num_test>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa9,%edi
call   1040 <next_digits_factorial_num@plt>
cmp    $0x58c51,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_digits_factorial_num_test>:
push   %rax
mov    $0xa9,%edi
call   1040 <next_digits_factorial_num@plt>
xor    %edi,%edi
cmp    $0x58c51,%eax
sete   %dil
pop    %rax
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @next_digits_factorial_num_test() {
%1 = call i32 @next_digits_factorial_num(i32 169)
%2 = icmp eq i32 %1, 363601
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
ret void
}

LLVM IR (-O2):
define void @next_digits_factorial_num_test() {
%1 = tail call i32 @next_digits_factorial_num(i32 169)
%2 = icmp eq i32 %1, 363601
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int /*<<< orphan*/ mqsort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ print_array(int *, int);
int main(void) {
  int data[] = {1, 2, 3};
  int len = sizeof(data) / sizeof(int);
  print_array(data, len);
  mqsort(data, 0, len - 1);
  print_array(data, len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x3,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <print_array@plt>
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <mqsort@plt>
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <print_array@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0xedd(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xeca(%rip),%rax
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <print_array@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <mqsort@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <print_array@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.data = [3 x i32] [i32 1, i32 2, i32 3]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [3 x i32]* %2 to i8*
store i32 3, i32* %3
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @print_array(i32* %5, i32 %6)
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = call i32 @mqsort(i32* %8, i32 0, i32 %10)
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = call i32 @print_array(i32* %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@__const.main.data = [3 x i32] [i32 1, i32 2, i32 3]
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @print_array(i32* %3, i32 3)
%5 = call i32 @mqsort(i32* %3, i32 0, i32 2)
%6 = call i32 @print_array(i32* %3, i32 3)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t mvhd_to_be32(uint32_t val) {
  uint32_t ret = 0;
  uint8_t *tmp = (uint8_t *)&ret;
  tmp[0] = (val & 0xff000000) >> 24;
  tmp[1] = (val & 0x00ff0000) >> 16;
  tmp[2] = (val & 0x0000ff00) >> 8;
  tmp[3] = (val & 0x000000ff) >> 0;
  return ret;
}


x86 assembly (clang, -O0):
<mvhd_to_be32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x10,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
sar    $0x0,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mvhd_to_be32>:
mov    %edi,%eax
shr    $0x18,%eax
ret

LLVM IR (-O0):
define i32 @mvhd_to_be32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %2
store i32 0, i32* %3
store i32* %3, i32** %4
%5 = load i32, i32* %2
%6 = and i32 %5, -16777216
%7 = lshr i32 %6, 24
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %2
%11 = and i32 %10, 16711680
%12 = ashr i32 %11, 16
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32 %12, i32* %14
%15 = load i32, i32* %2
%16 = and i32 %15, 65280
%17 = ashr i32 %16, 8
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 2
store i32 %17, i32* %19
%20 = load i32, i32* %2
%21 = and i32 %20, 255
%22 = ashr i32 %21, 0
%23 = load i32*, i32** %4
%24 = getelementptr inbounds i32, i32* %23, i64 3
store i32 %22, i32* %24
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @mvhd_to_be32(i32 %0) {
%2 = lshr i32 %0, 24
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void mmio_write_32(uintptr_t addr, uint32_t value) {
  *(volatile uint32_t *)addr = value;
}


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

x86 assembly (clang, -O2):
<mmio_write_32>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @mmio_write_32(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i64, i64* %3
%7 = inttoptr i64 %6 to i32*
store volatile i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @mmio_write_32(i64 %0, i32 %1) {
%3 = inttoptr i64 %0 to i32*
store volatile i32 %1, i32* %3
ret void
}
void trimLine(char line[]) {
  int i = 0;
  while (line[i] != '\0') {
    if (line[i] == '\r' || line[i] == '\n') {
      line[i] = '\0';
      break;
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<trimLine>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     116d <trimLine+0x6d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
je     114e <trimLine+0x4e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    115f <trimLine+0x5f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    116d <trimLine+0x6d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <trimLine+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<trimLine>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rax,1),%ecx
test   %cl,%cl
je     112e <trimLine+0x2e>
cmp    $0xd,%cl
je     1128 <trimLine+0x28>
cmp    $0xa,%cl
je     1128 <trimLine+0x28>
add    $0x1,%rax
jmp    1110 <trimLine+0x10>
mov    %eax,%eax
movb   $0x0,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @trimLine(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %33, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %36
12: ; preds = %4
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 13
br i1 %19, label %28, label %20
20: ; preds = %12
%21 = load i8*, i8** %2
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 10
br i1 %27, label %28, label %33
28: ; preds = %20, %12
%29 = load i8*, i8** %2
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 0, i8* %32
br label %36
33: ; preds = %20
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %4
36: ; preds = %28, %4
ret void
}

LLVM IR (-O2):
define void @trimLine(i8* nocapture %0) {
br label %2
2: ; preds = %9, %1
%3 = phi i64 [ %10, %9 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %9 [
i8 0, label %11
i8 13, label %6
i8 10, label %6
]
6: ; preds = %2, %2
%7 = and i64 %3, 4294967295
%8 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 0, i8* %8
br label %11
9: ; preds = %2
%10 = add nuw i64 %3, 1
br label %2
11: ; preds = %2, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ srand(int);
void yuiRandInitSeed(int s) { srand(s); }


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

x86 assembly (clang, -O2):
<yuiRandInitSeed>:
jmp    1030 <srand@plt>

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

LLVM IR (-O2):
define void @yuiRandInitSeed(i32 %0) {
%2 = tail call i32 @srand(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isgraph(int);
void t_isgraph_0x7d() {
  Assert_real((isgraph(125)),
              "/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_isgraph.c",
              630, ("isgraph should be 1 for }"));
}


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

x86 assembly (clang, -O2):
<t_isgraph_0x7d>:
push   %rax
mov    $0x7d,%edi
call   1040 <isgraph@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x276,%edx
pop    %rax
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_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for }\00"
define void @t_isgraph_0x7d() {
%1 = call i32 @isgraph(i32 125)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 630, 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_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for }\00"
define void @t_isgraph_0x7d() {
%1 = tail call i32 @isgraph(i32 125)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 630, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int fun531() { return 531; }


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

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

LLVM IR (-O0):
define i32 @fun531() {
ret i32 531
}

LLVM IR (-O2):
define i32 @fun531() {
ret i32 531
}
/* Type definitions */
typedef int /*<<< orphan*/ XRectangle;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XRectangle(void *_p) {
  if (_p == NULL)
    abort();
  free((XRectangle *)_p);
}


x86 assembly (clang, -O0):
<free_XRectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XRectangle+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XRectangle>:
test   %rdi,%rdi
je     112a <free_XRectangle+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define void @free_XRectangle(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = call i32 @free(i32* %9)
ret void
}

LLVM IR (-O2):
define void @free_XRectangle(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
double GetTCelsiusFromTKelvin(double T_K) { return T_K - 273.15; }


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

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

LLVM IR (-O0):
define double @GetTCelsiusFromTKelvin(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 2.731500e+02
ret double %4
}

LLVM IR (-O2):
define double @GetTCelsiusFromTKelvin(double %0) {
%2 = fadd double %0, -2.731500e+02
ret double %2
}
/* Variables and functions */
int bar();
int /*<<< orphan*/ printf(char *);
int foo() {
  printf("This is foo()!\n");
  return 12 + bar();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <bar@plt>
add    $0xc,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <bar@plt>
add    $0xc,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"This is foo()!\0A\00"
define i32 @foo() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @bar()
%3 = add nsw i32 12, %2
ret i32 %3
}

LLVM IR (-O2):
@str = [15 x i8] c"This is foo()!\00"
define i32 @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @bar()
%3 = add nsw i32 %2, 12
ret i32 %3
}
/* Variables and functions */
char *alloc(int);
char *put_line(char *line, int len) {
  int i = 0;
  char *ptr_0;
  if (len < 100) {
    ptr_0 = alloc(len);
    while (*(ptr_0 + i) = *(line + i))
      i++;
  }
  return ptr_0;
}


x86 assembly (clang, -O0):
<put_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x64,-0xc(%rbp)
jge    116d <put_line+0x5d>
mov    -0xc(%rbp),%edi
call   1030 <alloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x18(%rbp),%rcx
movslq -0x10(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
cmp    $0x0,%al
je     1168 <put_line+0x58>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113c <put_line+0x2c>
jmp    116d <put_line+0x5d>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_line>:
cmp    $0x63,%esi
jg     1140 <put_line+0x30>
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <alloc@plt>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rbx,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1130 <put_line+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @put_line(i8* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 100
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = tail call i8* @alloc(i32 %1)
br label %6
6: ; preds = %6, %4
%7 = phi i64 [ %12, %6 ], [ 0, %4 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 %9, i8* %10
%11 = icmp eq i8 %9, 0
%12 = add nuw i64 %7, 1
br i1 %11, label %13, label %6
13: ; preds = %6, %2
%14 = phi i8* [ undef, %2 ], [ %5, %6 ]
ret i8* %14
}
/* Variables and functions */
int /*<<< orphan*/ P(int, int);
int /*<<< orphan*/ V(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int semget(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
void mainss4() {
  int semid = semget(0XA, 0, 0);
  while (1) {
    P(semid, 1);
    printf("A\n");
    sleep(1);
    V(semid, 0);
  }
}


x86 assembly (clang, -O0):
<mainss4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <semget@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1040 <P@plt>
lea    0xe83(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1050 <V@plt>
jmp    1169 <mainss4+0x19>

x86 assembly (clang, -O2):
<mainss4>:
push   %r14
push   %rbx
push   %rax
mov    $0xa,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <semget@plt>
mov    %eax,%ebx
lea    0xe95(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    $0x1,%esi
call   1050 <P@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1060 <V@plt>
jmp    1170 <mainss4+0x20>

LLVM IR (-O0):
@.str = [3 x i8] c"A\0A\00"
define void @mainss4() {
%1 = alloca i32
%2 = call i32 @semget(i32 10, i32 0, i32 0)
store i32 %2, i32* %1
br label %3
3: ; preds = %0, %3
%4 = load i32, i32* %1
%5 = call i32 @P(i32 %4, i32 1)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @sleep(i32 1)
%8 = load i32, i32* %1
%9 = call i32 @V(i32 %8, i32 0)
br label %3
}

LLVM IR (-O2):
@str = [2 x i8] c"A\00"
define void @mainss4() {
%1 = tail call i32 @semget(i32 10, i32 0, i32 0)
br label %2
2: ; preds = %2, %0
%3 = tail call i32 @P(i32 %1, i32 1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @V(i32 %1, i32 0)
br label %2
}
f(int i) {
  (void)(0x3 == ((i & ~0xc) | 0x3));
  (void)(0x3 == (i & ~0xc) | 0x3);
  (void)(5 >= 2 & 3);
}


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

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

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, -13
%6 = or i32 %5, 3
%7 = icmp eq i32 3, %6
%8 = zext i1 %7 to i32
%9 = load i32, i32* %3
%10 = and i32 %9, -13
%11 = icmp eq i32 3, %10
%12 = zext i1 %11 to i32
%13 = or i32 %12, 3
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void consomer(int elem) { printf("Je consome %d\n", elem); }


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

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

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

LLVM IR (-O2):
@.str = [15 x i8] c"Je consome %d\0A\00"
define void @consomer(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cgldlab(int);
int /*<<< orphan*/ gentext();
int /*<<< orphan*/ load();
int /*<<< orphan*/ spill();
void genldlab(int id) {
  gentext();
  spill();
  cgldlab(id);
  load();
}


x86 assembly (clang, -O0):
<genldlab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <gentext@plt>
mov    $0x0,%al
call   1040 <spill@plt>
mov    -0x4(%rbp),%edi
call   1030 <cgldlab@plt>
mov    $0x0,%al
call   1060 <load@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genldlab>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <gentext@plt>
xor    %eax,%eax
call   1040 <spill@plt>
mov    %ebx,%edi
call   1030 <cgldlab@plt>
xor    %eax,%eax
pop    %rbx
jmp    1060 <load@plt>

LLVM IR (-O0):
define void @genldlab(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @gentext()
%4 = call i32 (...) @spill()
%5 = load i32, i32* %2
%6 = call i32 @cgldlab(i32 %5)
%7 = call i32 (...) @load()
ret void
}

LLVM IR (-O2):
define void @genldlab(i32 %0) {
%2 = tail call i32 (...) @gentext()
%3 = tail call i32 (...) @spill()
%4 = tail call i32 @cgldlab(i32 %0)
%5 = tail call i32 (...) @load()
ret void
}
/* Type definitions */
struct PdSocket {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int pd_socket_int_option(struct PdSocket *, int /*<<< orphan*/,
                         int /*<<< orphan*/, int);
int pd_socket_reuse_addr(struct PdSocket *sock, int on) {
  return pd_socket_int_option(sock, SOL_SOCKET, SO_REUSEADDR, on);
}


x86 assembly (clang, -O0):
<pd_socket_reuse_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ebe(%rip),%rax
mov    (%rax),%esi
mov    0x2ea5(%rip),%rax
mov    (%rax),%edx
mov    -0xc(%rbp),%ecx
call   1030 <pd_socket_int_option@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pd_socket_reuse_addr>:
mov    %esi,%ecx
mov    0x2ecf(%rip),%rax
mov    (%rax),%esi
mov    0x2eb6(%rip),%rax
mov    (%rax),%edx
jmp    1030 <pd_socket_int_option@plt>

LLVM IR (-O0):
%struct.PdSocket = type { i32 }
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @pd_socket_reuse_addr(%struct.PdSocket* %0, i32 %1) {
%3 = alloca %struct.PdSocket*
%4 = alloca i32
store %struct.PdSocket* %0, %struct.PdSocket** %3
store i32 %1, i32* %4
%5 = load %struct.PdSocket*, %struct.PdSocket** %3
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_REUSEADDR
%8 = load i32, i32* %4
%9 = call i32 @pd_socket_int_option(%struct.PdSocket* %5, i32 %6, i32 %7, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.PdSocket = type { i32 }
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @pd_socket_reuse_addr(%struct.PdSocket* %0, i32 %1) {
%3 = load i32, i32* @SOL_SOCKET
%4 = load i32, i32* @SO_REUSEADDR
%5 = tail call i32 @pd_socket_int_option(%struct.PdSocket* %0, i32 %3, i32 %4, i32 %1)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ mtarch_asm_yield();
void mtarch_yield(void) { mtarch_asm_yield(); }


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

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

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

LLVM IR (-O2):
define void @mtarch_yield() {
%1 = tail call i32 (...) @mtarch_asm_yield()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(void) {
  close(1);
  printf("U are running Linux Memory Management Stress Tests.\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1040 <close@plt>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <close@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"U are running Linux Memory Management Stress Tests.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @close(i32 1)
%3 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [52 x i8] c"U are running Linux Memory Management Stress Tests.\00"
define i32 @main() {
%1 = tail call i32 @close(i32 1)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ recurse();
int main(int argc, char **argv) { recurse(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <recurse@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @recurse()
ret i32 0
}
/* Type definitions */
struct timeval {
  double tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
double GetTime() {
  struct timeval thistime;
  gettimeofday(&thistime, 0);
  return (thistime.tv_sec + thistime.tv_usec * 1e-6);
}


x86 assembly (clang, -O0):
<GetTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xecb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetTime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdl 0x10(%rsp),%xmm0
mulsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, i32 }
define double @GetTime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load i32, i32* %5
%7 = sitofp i32 %6 to double
%8 = call double @llvm.fmuladd.f64(double %7, double 0x3EB0C6F7A0B5ED8D, double %4)
ret double %8
}

LLVM IR (-O2):
%struct.timeval = type { double, i32 }
define double @GetTime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = call double @llvm.fmuladd.f64(double %8, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %9
}
/* Variables and functions */
int _tfslink(char *, char *);
int /*<<< orphan*/ monLock();
int /*<<< orphan*/ monUnlock();
int mon_tfslink(char *src, char *target) {
  int ret;
  monLock();
  ret = _tfslink(src, target);
  monUnlock();
  return (ret);
}


x86 assembly (clang, -O0):
<mon_tfslink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <monLock@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <_tfslink@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <monUnlock@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mon_tfslink>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <monLock@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <_tfslink@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <monUnlock@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @mon_tfslink(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i32 (...) @monLock()
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @_tfslink(i8* %7, i8* %8)
store i32 %9, i32* %5
%10 = call i32 (...) @monUnlock()
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @mon_tfslink(i8* %0, i8* %1) {
%3 = tail call i32 (...) @monLock()
%4 = tail call i32 @_tfslink(i8* %0, i8* %1)
%5 = tail call i32 (...) @monUnlock()
ret i32 %4
}
void handleError(char theSSR) {
  (*(volatile char *)(0x05FFFECC)) &= ~(0x20 | 0x08 | 0x10);
}


x86 assembly (clang, -O0):
<handleError>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x5fffecc,%eax
mov    (%rax),%al
movsbl %al,%eax
and    $0xffffffc7,%eax
mov    %al,%cl
mov    $0x5fffecc,%eax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleError>:
andb   $0xc7,0x5fffecc
c7
ret

LLVM IR (-O0):
define void @handleError(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load volatile i8, i8* inttoptr (i64 100662988 to i8*)
%4 = sext i8 %3 to i32
%5 = and i32 %4, -57
%6 = trunc i32 %5 to i8
store volatile i8 %6, i8* inttoptr (i64 100662988 to i8*)
ret void
}

LLVM IR (-O2):
define void @handleError(i8 signext %0) {
%2 = load volatile i8, i8* inttoptr (i64 100662988 to i8*)
%3 = and i8 %2, -57
store volatile i8 %3, i8* inttoptr (i64 100662988 to i8*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, float);
int /*<<< orphan*/ stdout;
main() {
  int x;
  float y;
  x = 4000000000;
  y = x;
  fprintf(stdout, "%d\n", x);
  fprintf(stdout, "%f\n", y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xee6b2800,-0x4(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
cvtsi2ssl -0x4(%rbp),%xmm0
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
movss  -0x8(%rbp),%xmm0
lea    0xeac(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xee3(%rip),%rsi
movss  0xed7(%rip),%xmm0
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed1(%rip),%rsi
movss  0xec1(%rip),%xmm0
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 -294967296, i32* %1
%3 = load i32, i32* %1
%4 = sitofp i32 %3 to float
store float %4, float* %2
%5 = load i32, i32* @stdout
%6 = load i32, i32* %1
%7 = sitofp i32 %6 to float
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %7)
%9 = load i32, i32* @stdout
%10 = load float, float* %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %10)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float 0xC1B194D800000000)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float 0xC1B194D800000000)
ret i32 0
}
char *BUFTOA(p)
register char *p;
{
  register long l = 0;
  register int i;
  for (i = 4; i > 0; i--) {
    l = (l << 8) | (*p++ & 0377);
  }
  return (char *)l;
}


x86 assembly (clang, -O0):
<BUFTOA>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1159 <BUFTOA+0x59>
mov    -0x10(%rbp),%rax
shl    $0x8,%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
and    $0xff,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <BUFTOA+0x17>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BUFTOA>:
mov    (%rdi),%eax
shl    $0x20,%rax
bswap  %rax
ret

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

LLVM IR (-O2):
define i8* @BUFTOA(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %0
%4 = zext i8 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %2
%7 = zext i8 %6 to i64
%8 = shl nuw nsw i64 %4, 16
%9 = shl nuw nsw i64 %7, 8
%10 = or i64 %8, %9
%11 = getelementptr inbounds i8, i8* %0, i64 3
%12 = load i8, i8* %5
%13 = zext i8 %12 to i64
%14 = or i64 %10, %13
%15 = shl nuw nsw i64 %14, 8
%16 = load i8, i8* %11
%17 = zext i8 %16 to i64
%18 = or i64 %15, %17
%19 = inttoptr i64 %18 to i8*
ret i8* %19
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void memory_error(void) {
  fprintf(stderr, "INTERNAL ERROR: memory allocation failure.\n");
  abort();
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"INTERNAL ERROR: memory allocation failure.\0A\00"
define void @memory_error() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"INTERNAL ERROR: memory allocation failure.\0A\00"
define void @memory_error() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @abort()
unreachable
}