xunge/DecIR huggingface dataset:
/* Variables and functions */
double partial_lattice_background_plaquette_action_sf(int, double, double,
                                                      double);
double partial_lattice_lo_effective_plaquette_action_sf(int t, double beta,
                                                        double ct, double eta) {
  double partial_eff_lo;
  double partial_plaq_back;
  partial_plaq_back =
      partial_lattice_background_plaquette_action_sf(t, beta, ct, eta);
  partial_eff_lo = (6. / beta) * partial_plaq_back;
  return partial_eff_lo;
}


x86 assembly (clang, -O0):
<partial_lattice_lo_effective_plaquette_action_sf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1030 <partial_lattice_background_plaquette_action_sf@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xeb2(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<partial_lattice_lo_effective_plaquette_action_sf>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <partial_lattice_background_plaquette_action_sf@plt>
movsd  0xedd(%rip),%xmm1
divsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @partial_lattice_lo_effective_plaquette_action_sf(i32 %0, double %1, double %2, double %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%11 = load i32, i32* %5
%12 = load double, double* %6
%13 = load double, double* %7
%14 = load double, double* %8
%15 = call double @partial_lattice_background_plaquette_action_sf(i32 %11, double %12, double %13, double %14)
store double %15, double* %10
%16 = load double, double* %6
%17 = fdiv double 6.000000e+00, %16
%18 = load double, double* %10
%19 = fmul double %17, %18
store double %19, double* %9
%20 = load double, double* %9
ret double %20
}

LLVM IR (-O2):
define double @partial_lattice_lo_effective_plaquette_action_sf(i32 %0, double %1, double %2, double %3) {
%5 = tail call double @partial_lattice_background_plaquette_action_sf(i32 %0, double %1, double %2, double %3)
%6 = fdiv double 6.000000e+00, %1
%7 = fmul double %6, %5
ret double %7
}
void __dummy___() {}


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

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

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

LLVM IR (-O2):
define void @__dummy___() {
ret void
}
void insw(unsigned short port, void *addr, unsigned long count) {
  __asm__ __volatile__("rep ; ins"
                       "w"
                       : "=D"(addr), "=c"(count)
                       : "d"(port), "0"(addr), "1"(count));
}


x86 assembly (clang, -O0):
<insw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
rep insw (%dx),%es:(%rdi)
mov    %rdi,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<insw>:
mov    %rdx,%rcx
mov    %edi,%edx
mov    %rsi,%rdi
rep insw (%dx),%es:(%rdi)
ret

LLVM IR (-O0):
define void @insw(i16 zeroext %0, i8* %1, i64 %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i64
store i16 %0, i16* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i16, i16* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call { i8*, i64 } asm sideeffect "rep ; insw", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i16 %7, i8* %8, i64 %9)
%11 = extractvalue { i8*, i64 } %10, 0
%12 = extractvalue { i8*, i64 } %10, 1
store i8* %11, i8** %5
store i64 %12, i64* %6
ret void
}

LLVM IR (-O2):
define void @insw(i16 zeroext %0, i8* %1, i64 %2) {
%4 = tail call { i8*, i64 } asm sideeffect "rep ; insw", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i16 %0, i8* %1, i64 %2)
ret void
}
int j(int n) { return n + 23; }


x86 assembly (clang, -O0):
<j>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x17,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<j>:
lea    0x17(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @j(i32 %0) {
%2 = add nsw i32 %0, 23
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void _free(void *p) { free(p); }


x86 assembly (clang, -O0):
<_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):
<_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @_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 @_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int DI_Get_Irq_Status();
int di_get_status(void) {
  int ret;
  ret = DI_Get_Irq_Status();
  return ret;
}


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

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

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

LLVM IR (-O2):
define i32 @di_get_status() {
%1 = tail call i32 (...) @DI_Get_Irq_Status()
ret i32 %1
}
int test_imm_E8uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xE8 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_E8uint64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 232
%5 = icmp ne i64 %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_E8uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 232
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() { fprintf(stderr, "asort: usage: asort [-v] args\n"); }


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"asort: usage: asort [-v] args\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"asort: usage: asort [-v] args\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *, int /*<<< orphan*/);
int read_dobldobl_target_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(231, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<read_dobldobl_target_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xe7,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_dobldobl_target_system>:
mov    $0xe7,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @read_dobldobl_target_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 231, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @read_dobldobl_target_system() {
%1 = tail call i32 @_ada_use_c2phc(i32 231, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int ccache_item_set_string(void *p, char *buffer) {
  char **pp = (char **)p;
  *pp = (char *)malloc(strlen(buffer) * sizeof(char *));
  strcpy(*pp, buffer);
  return 1;
}


x86 assembly (clang, -O0):
<ccache_item_set_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ccache_item_set_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8**
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i8**
store i8** %7, i8*** %5
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 8
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8*
%15 = load i8**, i8*** %5
store i8* %14, i8** %15
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
%18 = load i8*, i8** %4
%19 = call i32 @strcpy(i8* %17, i8* %18)
ret i32 1
}

LLVM IR (-O2):
define i32 @ccache_item_set_string(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
%4 = tail call i32 @strlen(i8* %1)
%5 = shl i32 %4, 3
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = tail call i32 @strcpy(i8* %7, i8* %1)
ret i32 1
}
/* Variables and functions */
double sigmoid(double);
double sigmoidd(double x) {
  double s = sigmoid(x);
  return s * (1.0 - s);
}


x86 assembly (clang, -O0):
<sigmoidd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sigmoid@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigmoidd>:
push   %rax
call   1030 <sigmoid@plt>
movsd  0xee2(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sigmoidd(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @sigmoid(double %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = load double, double* %3
%8 = fsub double 1.000000e+00, %7
%9 = fmul double %6, %8
ret double %9
}

LLVM IR (-O2):
define double @sigmoidd(double %0) {
%2 = tail call double @sigmoid(double %0)
%3 = fsub double 1.000000e+00, %2
%4 = fmul double %2, %3
ret double %4
}
void deallocate2D_float(float **arr2D, int rows) {
  int i;
  for (i = 0; i < rows; i++) {
    free(arr2D[i]);
  }
  free(arr2D);
}


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

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

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

LLVM IR (-O2):
define void @deallocate2D_float(float** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds float*, float** %0, i64 %7
%9 = bitcast float** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast float** %0 to i8*
tail call void @free(i8* %14)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void Payoneerf() {
  printf("This module is on development process.Please try again later.");
}


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

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

LLVM IR (-O0):
@.str = [62 x i8] c"This module is on development process.Please try again later.\00"
define void @Payoneerf() {
%1 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [62 x i8] c"This module is on development process.Please try again later.\00"
define void @Payoneerf() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned char f72(unsigned char x, unsigned long int y) {
  return (x << y) + (x >> ((-y) & (8 - 1)));
}


x86 assembly (clang, -O0):
<f72>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
mov    -0x10(%rbp),%rcx
shl    %cl,%eax
movzbl -0x1(%rbp),%edx
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    $0x7,%rcx
sar    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f72>:
mov    %rsi,%rcx
mov    %edi,%eax
shl    %cl,%eax
neg    %cl
and    $0x7,%cl
shr    %cl,%edi
add    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @f72(i8 zeroext %0, i64 %1) {
%3 = alloca i8
%4 = alloca i64
store i8 %0, i8* %3
store i64 %1, i64* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = shl i32 %6, %8
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = load i64, i64* %4
%13 = sub i64 0, %12
%14 = and i64 %13, 7
%15 = trunc i64 %14 to i32
%16 = ashr i32 %11, %15
%17 = add nsw i32 %9, %16
%18 = trunc i32 %17 to i8
ret i8 %18
}

LLVM IR (-O2):
define zeroext i8 @f72(i8 zeroext %0, i64 %1) {
%3 = zext i8 %0 to i32
%4 = trunc i64 %1 to i32
%5 = shl i32 %3, %4
%6 = sub i32 0, %4
%7 = and i32 %6, 7
%8 = lshr i32 %3, %7
%9 = add nsw i32 %8, %5
%10 = trunc i32 %9 to i8
ret i8 %10
}
void g_signal_connect_data() {}


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

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

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

LLVM IR (-O2):
define void @g_signal_connect_data() {
ret void
}
/* Type definitions */
struct pdp10_memory {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read_raw_at(int /*<<< orphan*/ *, struct pdp10_memory *,
                               int /*<<< orphan*/);
void read_raw(FILE *f, struct pdp10_memory *memory, int cpu_model) {
  printf("Raw format\n");
  read_raw_at(f, memory, 0);
}


x86 assembly (clang, -O0):
<read_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1040 <read_raw_at@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_raw>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <read_raw_at@plt>

LLVM IR (-O0):
%struct.pdp10_memory = type { i32 }
@.str = [12 x i8] c"Raw format\0A\00"
define void @read_raw(i32* %0, %struct.pdp10_memory* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca %struct.pdp10_memory*
%6 = alloca i32
store i32* %0, i32** %4
store %struct.pdp10_memory* %1, %struct.pdp10_memory** %5
store i32 %2, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%8 = load i32*, i32** %4
%9 = load %struct.pdp10_memory*, %struct.pdp10_memory** %5
%10 = call i32 @read_raw_at(i32* %8, %struct.pdp10_memory* %9, i32 0)
ret void
}

LLVM IR (-O2):
%struct.pdp10_memory = type { i32 }
@str = [11 x i8] c"Raw format\00"
define void @read_raw(i32* %0, %struct.pdp10_memory* %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @read_raw_at(i32* %0, %struct.pdp10_memory* %1, i32 0)
ret void
}
long BG_StringHashValue_Lwr(const char *fname) {
  int i = 0;
  long hash = 0;
  while (fname[i] != '\0') {
    hash += (long)(fname[i]) * (i + 119);
    i++;
  }
  if (hash == -1) {
    hash = 0;
  }
  return hash;
}


x86 assembly (clang, -O0):
<BG_StringHashValue_Lwr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115c <BG_StringHashValue_Lwr+0x5c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbq (%rax,%rcx,1),%rax
mov    -0xc(%rbp),%ecx
add    $0x77,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <BG_StringHashValue_Lwr+0x17>
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    116f <BG_StringHashValue_Lwr+0x6f>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BG_StringHashValue_Lwr>:
mov    (%rdi),%dl
test   %dl,%dl
je     1133 <BG_StringHashValue_Lwr+0x33>
mov    $0x77,%eax
xor    %ecx,%ecx
nopl   (%rax)
movsbq %dl,%rdx
imul   %rax,%rdx
add    %rdx,%rcx
movzbl -0x76(%rdi,%rax,1),%edx
add    $0x1,%rax
test   %dl,%dl
jne    1110 <BG_StringHashValue_Lwr+0x10>
xor    %eax,%eax
cmp    $0xffffffffffffffff,%rcx
cmovne %rcx,%rax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @BG_StringHashValue_Lwr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %12, %4 ], [ 0, %1 ]
%6 = phi i8 [ %14, %4 ], [ %2, %1 ]
%7 = phi i64 [ %11, %4 ], [ 0, %1 ]
%8 = sext i8 %6 to i64
%9 = add nuw nsw i64 %5, 119
%10 = mul nsw i64 %9, %8
%11 = add nsw i64 %10, %7
%12 = add nuw nsw i64 %5, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %4
%17 = icmp eq i64 %11, -1
%18 = select i1 %17, i64 0, i64 %11
br label %19
19: ; preds = %16, %1
%20 = phi i64 [ 0, %1 ], [ %18, %16 ]
ret i64 %20
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
void die(char *p, char *s) {
  fprintf(stderr, "%s: ", p);
  perror(s);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeac(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rdx
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [5 x i8] c"%s: \00"
define void @die(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %4
%9 = call i32 @perror(i8* %8)
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"%s: \00"
define void @die(i8* %0, i8* nocapture %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 @perror(i8* %1)
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int compare(void const *, void const *);
int reverse(const void *_a, const void *_b) { return -1 * compare(_a, _b); }


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <compare@plt>
imul   $0xffffffff,%eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rax
call   1030 <compare@plt>
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @reverse(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @compare(i8* %5, i8* %6)
%8 = mul nsw i32 -1, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @reverse(i8* %0, i8* %1) {
%3 = tail call i32 @compare(i8* %0, i8* %1)
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Sleep(unsigned int);
void Parrot_usleep(unsigned int microseconds) { Sleep(microseconds / 1000); }


x86 assembly (clang, -O0):
<Parrot_usleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
call   1030 <Sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Parrot_usleep>:
mov    %edi,%eax
imul   $0x10624dd3,%rax,%rdi
shr    $0x26,%rdi
jmp    1030 <Sleep@plt>

LLVM IR (-O0):
define void @Parrot_usleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = udiv i32 %3, 1000
%5 = call i32 @Sleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @Parrot_usleep(i32 %0) {
%2 = udiv i32 %0, 1000
%3 = tail call i32 @Sleep(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lock();
int /*<<< orphan*/ unlock();
int main(void) {
  int old;
  int new;
  int undet;
  {
    {
      while (1) {
      while_0_continue:;
        {
          lock();
          old = new;
        }
        if (undet) {
          {
            unlock();
            new = new + 1;
          }
        } else {
        }
        if (new != old) {
        } else {
          goto while_0_break;
        }
      }
    while_0_break:;
    }
    return (0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
jmp    1134 <main+0x14>
mov    $0x0,%al
call   1040 <lock@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1160 <main+0x40>
mov    $0x0,%al
call   1030 <unlock@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <main+0x45>
jmp    1165 <main+0x45>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1176 <main+0x56>
jmp    117b <main+0x5b>
jmp    1180 <main+0x60>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @lock()
ret i32 0
}
/* Variables and functions */
int invert(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int);
int main() { printf("%d\n", invert(256, 0, 4)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x100,%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <invert@plt>
mov    %eax,%esi
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x100,%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <invert@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @invert(i32 256, i32 0, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void cmd_quit(int argc, const char **argv) { exit(EXIT_SUCCESS); }


x86 assembly (clang, -O0):
<cmd_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<cmd_quit>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define void @cmd_quit(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @EXIT_SUCCESS
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define void @cmd_quit(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *current_utc_timestamp(char *out) {
  time_t now;
  struct tm *tm;
  now = time(NULL);
  tm = gmtime(&now);
  if (!strftime(out, 50, "%Y/%m/%d %H:%M:%S", tm)) {
    return NULL;
  }
  return out;
}


x86 assembly (clang, -O0):
<current_utc_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <gmtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x32,%esi
lea    0xe97(%rip),%rdx
call   1040 <strftime@plt>
cmp    $0x0,%eax
jne    1184 <current_utc_timestamp+0x54>
movq   $0x0,-0x8(%rbp)
jmp    118c <current_utc_timestamp+0x5c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<current_utc_timestamp>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %r14d,%r14d
xor    %edi,%edi
call   1030 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1050 <gmtime@plt>
lea    0xeaa(%rip),%rdx
mov    %rbx,%rdi
mov    $0x32,%esi
mov    %rax,%rcx
call   1040 <strftime@plt>
test   %eax,%eax
cmove  %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y/%m/%d %H:%M:%S\00"
define i8* @current_utc_timestamp(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.tm*
store i8* %0, i8** %3
%6 = call i32 @time(i32* null)
store i32 %6, i32* %4
%7 = call %struct.tm* @gmtime(i32* %4)
store %struct.tm* %7, %struct.tm** %5
%8 = load i8*, i8** %3
%9 = load %struct.tm*, %struct.tm** %5
%10 = call i32 @strftime(i8* %8, i32 50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %1
store i8* null, i8** %2
br label %15
13: ; preds = %1
%14 = load i8*, i8** %3
store i8* %14, i8** %2
br label %15
15: ; preds = %13, %12
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y/%m/%d %H:%M:%S\00"
define i8* @current_utc_timestamp(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @time(i32* null)
store i32 %4, i32* %2
%5 = call %struct.tm* @gmtime(i32* %2)
%6 = call i32 @strftime(i8* %0, i32 50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* null, i8* %0
ret i8* %8
}
int ADD_mod32(int ip1, int ip2) {
  return ((((((ip1 & 0x1f) + (ip2 & 0x1f))) % 32)) & 0x1f);
}


x86 assembly (clang, -O0):
<ADD_mod32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1f,%eax
mov    -0x8(%rbp),%ecx
and    $0x1f,%ecx
add    %ecx,%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
and    $0x1f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADD_mod32>:
lea    (%rdi,%rsi,1),%eax
and    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @ADD_mod32(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 = and i32 %5, 31
%7 = load i32, i32* %4
%8 = and i32 %7, 31
%9 = add nsw i32 %6, %8
%10 = srem i32 %9, 32
%11 = and i32 %10, 31
ret i32 %11
}

LLVM IR (-O2):
define i32 @ADD_mod32(i32 %0, i32 %1) {
%3 = add i32 %1, %0
%4 = and i32 %3, 31
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int, int);
void mergeSort(int array[], int lo, int hi) {
  int mid = (lo + hi) / 2;
  if (mid > lo) {
    mergeSort(array, lo, mid);
    mergeSort(array, mid, hi);
    merge(array, lo, mid, hi);
  }
}


x86 assembly (clang, -O0):
<mergeSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    117f <mergeSort+0x5f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebx
lea    (%r14,%rbx,1),%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
cmp    %esi,%ebp
jle    116f <mergeSort+0x4f>
mov    %rdi,%r15
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <mergeSort@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <mergeSort@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <merge@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @mergeSort(i32* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, %1
%5 = sdiv i32 %4, 2
%6 = icmp sgt i32 %5, %1
br i1 %6, label %8, label %7
7: ; preds = %3, %8
ret void
8: ; preds = %3
tail call void @mergeSort(i32* %0, i32 %1, i32 %5)
tail call void @mergeSort(i32* %0, i32 %5, i32 %2)
%9 = tail call i32 @merge(i32* %0, i32 %1, i32 %5, i32 %2)
br label %7
}
/* Variables and functions */
char *aligned_alloc(int, size_t);
char *memcpy(char *, char const *, size_t);
int strnlen(char const *, size_t);
char *strndup(const char *string, size_t maxlen) {
  size_t n = strnlen(string, maxlen) + 1;
  char *r = aligned_alloc(1, n * sizeof(char));
  return r == NULL ? NULL : memcpy(r, string, n * sizeof(char));
}


x86 assembly (clang, -O0):
<strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strnlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
shl    $0x0,%rsi
mov    $0x1,%edi
call   1050 <aligned_alloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1182 <strndup+0x52>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    119b <strndup+0x6b>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
shl    $0x0,%rdx
call   1040 <memcpy@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strnlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    $0x1,%edi
mov    %r15,%rsi
call   1050 <aligned_alloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1166 <strndup+0x36>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = call i32 @strnlen(i8* %7, i64 %8)
%10 = add nsw i32 %9, 1
%11 = sext i32 %10 to i64
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = mul i64 %12, 1
%14 = call i8* @aligned_alloc(i32 1, i64 %13)
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %2
br label %24
18: ; preds = %2
%19 = load i8*, i8** %6
%20 = load i8*, i8** %3
%21 = load i64, i64* %5
%22 = mul i64 %21, 1
%23 = call i8* @memcpy(i8* %19, i8* %20, i64 %22)
br label %24
24: ; preds = %18, %17
%25 = phi i8* [ null, %17 ], [ %23, %18 ]
ret i8* %25
}

LLVM IR (-O2):
define noalias i8* @strndup(i8* %0, i64 %1) {
%3 = tail call i32 @strnlen(i8* %0, i64 %1)
%4 = add nsw i32 %3, 1
%5 = sext i32 %4 to i64
%6 = tail call align 1 i8* @aligned_alloc(i32 1, i64 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %6, i8* align 1 %0, i64 %5, i1 false)
br label %9
9: ; preds = %2, %8
ret i8* %6
}
int test_10(int a, int b) { return (a < 0) != (b < 0) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edx
cmpl   $0x0,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%esi
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    %esi,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_10>:
xor    %esi,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_10(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 = icmp slt i32 %5, 0
%7 = zext i1 %6 to i32
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
%10 = zext i1 %9 to i32
%11 = icmp ne i32 %7, %10
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 -20, i32 -40
ret i32 %13
}

LLVM IR (-O2):
define i32 @test_10(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = icmp sgt i32 %3, -1
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ write(int, char *, int);
main() {
  char b[2];
  while (read(0, b, 2) == 2)
    write(1, b + 1, 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x6(%rbp),%rsi
xor    %edi,%edi
mov    $0x2,%edx
call   1040 <read@plt>
cmp    $0x2,%eax
jne    1161 <main+0x41>
lea    -0x6(%rbp),%rsi
add    $0x1,%rsi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0x6(%rsp),%rsi
xor    %edi,%edi
mov    $0x2,%edx
call   1040 <read@plt>
cmp    $0x2,%eax
jne    1176 <main+0x56>
lea    0x7(%rsp),%r14
lea    0x6(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1040 <read@plt>
cmp    $0x2,%eax
je     1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [2 x i8]
%2 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%3 = call i32 @read(i32 0, i8* %2, i32 2)
%4 = icmp eq i32 %3, 2
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 1
br label %7
7: ; preds = %5, %7
%8 = call i32 @write(i32 1, i8* %6, i32 1)
%9 = call i32 @read(i32 0, i8* %2, i32 2)
%10 = icmp eq i32 %9, 2
br i1 %10, label %7, label %11
11: ; preds = %7, %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void vfatal(char *legend, va_list argp) {
  vfprintf(stderr, legend, argp);
  fprintf(stderr, "\n");
  exit(1);
}


x86 assembly (clang, -O0):
<vfatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <vfprintf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<vfatal>:
push   %rbx
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ea3(%rip),%rbx
mov    (%rbx),%edi
call   1040 <vfprintf@plt>
mov    (%rbx),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @vfatal(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @vfprintf(i32 %5, i8* %6, i32 %7)
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @vfatal(i8* %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @vfprintf(i32 %3, i8* %0, i32 %1)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
}
void swapf(float *x, float *y) {
  float t;
  t = *x;
  *x = *y;
  *y = t;
}


x86 assembly (clang, -O0):
<swapf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x14(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapf>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
movss  %xmm1,(%rdi)
movss  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define void @swapf(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%6 = load float*, float** %3
%7 = load float, float* %6
store float %7, float* %5
%8 = load float*, float** %4
%9 = load float, float* %8
%10 = load float*, float** %3
store float %9, float* %10
%11 = load float, float* %5
%12 = load float*, float** %4
store float %11, float* %12
ret void
}

LLVM IR (-O2):
define void @swapf(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
store float %4, float* %0
store float %3, float* %1
ret void
}
long long longlong_ignoring_unsignedlong(long long x, unsigned long y) {
  return x;
}


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

x86 assembly (clang, -O2):
<longlong_ignoring_unsignedlong>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @longlong_ignoring_unsignedlong(i64 returned %0, i64 %1) {
ret i64 %0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_version(void) {
  fprintf(stderr,
          "fstest (Torpman's Test Tools) 0.1\n"
          "Copyright (C) 2012 Peter R. Torpman (peter@torpman.se)\n"
          "This is free software.  \nYou may redistribute copies of it under "
          "the terms of the GNU General Public License \n"
          "<http://www.gnu.org/licenses/gpl.html>.\n"
          "There is NO WARRANTY, to the extent permitted by law.\n");
}


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_version>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [294 x i8] c"fstest (Torpman's Test Tools) 0.1\0ACopyright (C) 2012 Peter R. Torpman (peter@torpman.se)\0AThis is free software. \0AYou may redistribute copies of it under the terms of the GNU General Public License \0A<http://www.gnu.org/licenses/gpl.html>.\0AThere is NO WARRANTY, to the extent permitted by law.\0A\00"
define void @print_version() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([294 x i8], [294 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [294 x i8] c"fstest (Torpman's Test Tools) 0.1\0ACopyright (C) 2012 Peter R. Torpman (peter@torpman.se)\0AThis is free software. \0AYou may redistribute copies of it under the terms of the GNU General Public License \0A<http://www.gnu.org/licenses/gpl.html>.\0AThere is NO WARRANTY, to the extent permitted by law.\0A\00"
define void @print_version() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([294 x i8], [294 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t asri1(int32_t x) { return x >> 1; }


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

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

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

LLVM IR (-O2):
define i32 @asri1(i32 %0) {
%2 = ashr i32 %0, 1
ret i32 %2
}