xunge/DecIR huggingface dataset:
int fun660() { return 660; }


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

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

LLVM IR (-O0):
define i32 @fun660() {
ret i32 660
}

LLVM IR (-O2):
define i32 @fun660() {
ret i32 660
}
/* Variables and functions */
char *tng_compress_pos(double *, int const, int const, double const, int const,
                       int *, int *);
char *tng_compress_pos_find_algo(double *pos, const int natoms,
                                 const int nframes,
                                 const double desired_precision,
                                 const int speed, int *algo, int *nitems) {
  algo[0] = -1;
  algo[1] = -1;
  algo[2] = -1;
  algo[3] = -1;
  return tng_compress_pos(pos, natoms, nframes, desired_precision, speed, algo,
                          nitems);
}


x86 assembly (clang, -O0):
<tng_compress_pos_find_algo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x28(%rbp),%rax
movl   $0xffffffff,0x4(%rax)
mov    -0x28(%rbp),%rax
movl   $0xffffffff,0x8(%rax)
mov    -0x28(%rbp),%rax
movl   $0xffffffff,0xc(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movsd  -0x18(%rbp),%xmm0
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <tng_compress_pos@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tng_compress_pos_find_algo>:
pcmpeqd %xmm1,%xmm1
movdqu %xmm1,(%r8)
jmp    1030 <tng_compress_pos@plt>

LLVM IR (-O0):
define i8* @tng_compress_pos_find_algo(double* %0, i32 %1, i32 %2, double %3, i32 %4, i32* %5, i32* %6) {
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32*
store double* %0, double** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store double %3, double* %11
store i32 %4, i32* %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%15 = load i32*, i32** %13
%16 = getelementptr inbounds i32, i32* %15, i64 0
store i32 -1, i32* %16
%17 = load i32*, i32** %13
%18 = getelementptr inbounds i32, i32* %17, i64 1
store i32 -1, i32* %18
%19 = load i32*, i32** %13
%20 = getelementptr inbounds i32, i32* %19, i64 2
store i32 -1, i32* %20
%21 = load i32*, i32** %13
%22 = getelementptr inbounds i32, i32* %21, i64 3
store i32 -1, i32* %22
%23 = load double*, double** %8
%24 = load i32, i32* %9
%25 = load i32, i32* %10
%26 = load double, double* %11
%27 = load i32, i32* %12
%28 = load i32*, i32** %13
%29 = load i32*, i32** %14
%30 = call i8* @tng_compress_pos(double* %23, i32 %24, i32 %25, double %26, i32 %27, i32* %28, i32* %29)
ret i8* %30
}

LLVM IR (-O2):
define i8* @tng_compress_pos_find_algo(double* %0, i32 %1, i32 %2, double %3, i32 %4, i32* %5, i32* %6) {
%8 = bitcast i32* %5 to i8*
%9 = tail call i8* @tng_compress_pos(double* %0, i32 %1, i32 %2, double %3, i32 %4, i32* %5, i32* %6)
ret i8* %9
}
long syscall(long syscall_number, long arg1, long arg2, long arg3, long arg4,
             long arg5, long arg6) {
  long ret;
  asm volatile("movq %1, %%rax\n\t"
               "movq %2, %%rdi\n\t"
               "movq %3, %%rsi\n\t"
               "movq %4, %%rdx\n\t"
               "movq %5, %%rcx\n\t"
               "movq %6, %%r8\n\t"
               "movq %7, %%r9\n\t"
               "syscall"
               : "=a"(ret)
               : "g"(syscall_number), "g"(arg1), "g"(arg2), "g"(arg3),
                 "g"(arg4), "g"(arg5), "g"(arg6));
  return ret;
}


x86 assembly (clang, -O0):
<syscall>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%r9
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    0x10(%rbp),%rax
mov    %r9,-0x40(%rbp)
mov    %r8,-0x48(%rbp)
mov    %rdi,-0x50(%rbp)
mov    %rsi,-0x58(%rbp)
mov    %rdx,-0x60(%rbp)
mov    %rcx,-0x68(%rbp)
mov    %rax,-0x70(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%r8
mov    -0x70(%rbp),%r9
syscall
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall>:
mov    0x8(%rsp),%rax
mov    %rsi,-0x10(%rsp)
mov    %rdi,-0x8(%rsp)
mov    %rdx,-0x18(%rsp)
mov    %rcx,-0x20(%rsp)
mov    %r8,-0x28(%rsp)
mov    %r9,-0x30(%rsp)
mov    %rax,-0x38(%rsp)
mov    -0x8(%rsp),%rax
mov    -0x10(%rsp),%rdi
mov    -0x18(%rsp),%rsi
mov    -0x20(%rsp),%rdx
mov    -0x28(%rsp),%rcx
mov    -0x30(%rsp),%r8
mov    -0x38(%rsp),%r9
syscall
ret

LLVM IR (-O0):
define i64 @syscall(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6) {
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
store i64 %0, i64* %8
store i64 %1, i64* %9
store i64 %2, i64* %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store i64 %5, i64* %13
store i64 %6, i64* %14
%16 = load i64, i64* %8
%17 = load i64, i64* %9
%18 = load i64, i64* %10
%19 = load i64, i64* %11
%20 = load i64, i64* %12
%21 = load i64, i64* %13
%22 = load i64, i64* %14
%23 = call i64 asm sideeffect "movq $1, %rax\0A\09movq $2, %rdi\0A\09movq $3, %rsi\0A\09movq $4, %rdx\0A\09movq $5, %rcx\0A\09movq $6, %r8\0A\09movq $7, %r9\0A\09syscall", "={ax},imr,imr,imr,imr,imr,imr,imr,~{dirflag},~{fpsr},~{flags}"(i64 %16, i64 %17, i64 %18, i64 %19, i64 %20, i64 %21, i64 %22)
store i64 %23, i64* %15
%24 = load i64, i64* %15
ret i64 %24
}

LLVM IR (-O2):
define i64 @syscall(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6) {
%8 = tail call i64 asm sideeffect "movq $1, %rax\0A\09movq $2, %rdi\0A\09movq $3, %rsi\0A\09movq $4, %rdx\0A\09movq $5, %rcx\0A\09movq $6, %r8\0A\09movq $7, %r9\0A\09syscall", "={ax},imr,imr,imr,imr,imr,imr,imr,~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6)
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ GL_TRIANGLES;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glColor4f(double, double, double, double);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex3f(double, double, double);
void drawLeftTriangle(void) {
  glBegin(GL_TRIANGLES);
  glColor4f(1.0, 1.0, 0.0, 0.75);
  glVertex3f(0.1, 0.9, 0.0);
  glVertex3f(0.1, 0.1, 0.0);
  glVertex3f(0.7, 0.5, 0.0);
  glEnd();
}


x86 assembly (clang, -O0):
<drawLeftTriangle>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
movsd  0xec6(%rip),%xmm1
xorps  %xmm2,%xmm2
movsd  0xec3(%rip),%xmm3
movaps %xmm1,%xmm0
call   1030 <glColor4f@plt>
movsd  0xe9b(%rip),%xmm0
movsd  0xe9b(%rip),%xmm1
xorps  %xmm2,%xmm2
call   1040 <glVertex3f@plt>
movsd  0xe83(%rip),%xmm1
xorps  %xmm2,%xmm2
movaps %xmm1,%xmm0
call   1040 <glVertex3f@plt>
movsd  0xe60(%rip),%xmm0
movsd  0xe60(%rip),%xmm1
xorps  %xmm2,%xmm2
call   1040 <glVertex3f@plt>
mov    $0x0,%al
call   1050 <glEnd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawLeftTriangle>:
push   %rax
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
movsd  0xea9(%rip),%xmm0
movsd  0xea9(%rip),%xmm3
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm1
call   1030 <glColor4f@plt>
movsd  0xe9e(%rip),%xmm0
movsd  0xe9e(%rip),%xmm1
xorps  %xmm2,%xmm2
call   1040 <glVertex3f@plt>
xorps  %xmm2,%xmm2
movsd  0xe83(%rip),%xmm0
movaps %xmm0,%xmm1
call   1040 <glVertex3f@plt>
movsd  0xe83(%rip),%xmm0
movsd  0xe83(%rip),%xmm1
xorps  %xmm2,%xmm2
call   1040 <glVertex3f@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glEnd@plt>

LLVM IR (-O0):
@GL_TRIANGLES = global i32 0
define void @drawLeftTriangle() {
%1 = load i32, i32* @GL_TRIANGLES
%2 = call i32 @glBegin(i32 %1)
%3 = call i32 @glColor4f(double 1.000000e+00, double 1.000000e+00, double 0.000000e+00, double 7.500000e-01)
%4 = call i32 @glVertex3f(double 1.000000e-01, double 9.000000e-01, double 0.000000e+00)
%5 = call i32 @glVertex3f(double 1.000000e-01, double 1.000000e-01, double 0.000000e+00)
%6 = call i32 @glVertex3f(double 0x3FE6666666666666, double 5.000000e-01, double 0.000000e+00)
%7 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_TRIANGLES = global i32 0
define void @drawLeftTriangle() {
%1 = load i32, i32* @GL_TRIANGLES
%2 = tail call i32 @glBegin(i32 %1)
%3 = tail call i32 @glColor4f(double 1.000000e+00, double 1.000000e+00, double 0.000000e+00, double 7.500000e-01)
%4 = tail call i32 @glVertex3f(double 1.000000e-01, double 9.000000e-01, double 0.000000e+00)
%5 = tail call i32 @glVertex3f(double 1.000000e-01, double 1.000000e-01, double 0.000000e+00)
%6 = tail call i32 @glVertex3f(double 0x3FE6666666666666, double 5.000000e-01, double 0.000000e+00)
%7 = tail call i32 (...) @glEnd()
ret void
}
/* Variables and functions */
int fabs(float);
float f_cond(float cond, float t, float f) { return fabs(cond) > 1e-5 ? t : f; }


x86 assembly (clang, -O0):
<f_cond>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xec3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1156 <f_cond+0x46>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1160 <f_cond+0x50>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_cond>:
push   %rax
movss  %xmm2,(%rsp)
movss  %xmm1,0x4(%rsp)
call   1030 <fabs@plt>
movss  0x4(%rsp),%xmm0
test   %eax,%eax
jg     1130 <f_cond+0x20>
movss  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @f_cond(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = call i32 @fabs(float %7)
%9 = sitofp i32 %8 to double
%10 = fcmp ogt double %9, 1.000000e-05
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load float, float* %5
br label %15
13: ; preds = %3
%14 = load float, float* %6
br label %15
15: ; preds = %13, %11
%16 = phi float [ %12, %11 ], [ %14, %13 ]
ret float %16
}

LLVM IR (-O2):
define float @f_cond(float %0, float %1, float %2) {
%4 = tail call i32 @fabs(float %0)
%5 = icmp sgt i32 %4, 0
%6 = select i1 %5, float %1, float %2
ret float %6
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("Hello world form process ID %d.\n", getpid());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [33 x i8] c"Hello world form process ID %d.\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
int syscall3(int eax, int ebx, int ecx) {
  int result;
  asm("int $0x80" : "=a"(result) : "a"(eax), "b"(ebx), "c"(ecx));
  return result;
}


x86 assembly (clang, -O0):
<syscall3>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ebx
mov    -0x14(%rbp),%ecx
int    $0x80
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall3>:
push   %rbx
mov    %edx,%ecx
mov    %esi,%ebx
mov    %edi,%eax
int    $0x80
pop    %rbx
ret

LLVM IR (-O0):
define i32 @syscall3(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* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 asm "int $$0x80", "={ax},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 %8, i32 %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
ret i32 %12
}

LLVM IR (-O2):
define i32 @syscall3(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 asm "int $$0x80", "={ax},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
uint64_t sqrt_newton(uint64_t x, uint64_t y) {
  uint64_t r;
  do {
    r = y;
    y = (y + x / y) >> 1;
  } while (y < r);
  return r;
}


x86 assembly (clang, -O0):
<sqrt_newton>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    %rcx,%rax
sar    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jl     110c <sqrt_newton+0xc>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrt_newton>:
mov    %rsi,%rax
jmp    1123 <sqrt_newton+0x23>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rdi,%rax
cqto
idiv   %rcx
add    %rcx,%rax
sar    %rax
cmp    %rcx,%rax
jge    113a <sqrt_newton+0x3a>
mov    %rax,%rcx
mov    %rdi,%rax
or     %rcx,%rax
shr    $0x20,%rax
jne    1110 <sqrt_newton+0x10>
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
jmp    1118 <sqrt_newton+0x18>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @sqrt_newton(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
br label %6
6: ; preds = %14, %2
%7 = load i64, i64* %4
store i64 %7, i64* %5
%8 = load i64, i64* %4
%9 = load i64, i64* %3
%10 = load i64, i64* %4
%11 = sdiv i64 %9, %10
%12 = add nsw i64 %8, %11
%13 = ashr i64 %12, 1
store i64 %13, i64* %4
br label %14
14: ; preds = %6
%15 = load i64, i64* %4
%16 = load i64, i64* %5
%17 = icmp slt i64 %15, %16
br i1 %17, label %6, label %18
18: ; preds = %14
%19 = load i64, i64* %5
ret i64 %19
}

LLVM IR (-O2):
define i64 @sqrt_newton(i64 %0, i64 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %1, %2 ], [ %7, %3 ]
%5 = sdiv i64 %0, %4
%6 = add nsw i64 %5, %4
%7 = ashr i64 %6, 1
%8 = icmp slt i64 %7, %4
br i1 %8, label %3, label %9
9: ; preds = %3
ret i64 %4
}
int test_imm_5Duint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x5D << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_5Duint64_highword_reg(i64 %0) {
%2 = and i64 %0, 399431958528
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int max(int i, int j) { return i < j ? j : i; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <max+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <max+0x27>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
char *__asctime(struct tm const *, char *);
char *asctime_r(const struct tm *tm, char *buf) { return __asctime(tm, buf); }


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

x86 assembly (clang, -O2):
<asctime_r>:
jmp    1030 <__asctime@plt>

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

LLVM IR (-O2):
%struct.tm = type { i32 }
define i8* @asctime_r(%struct.tm* %0, i8* %1) {
%3 = tail call i8* @__asctime(%struct.tm* %0, i8* %1)
ret i8* %3
}
/* Variables and functions */
int rand();
void self_assignement() {
  int a;
  a = rand();
  a = a;
  return;
}


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

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

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

LLVM IR (-O2):
define void @self_assignement() {
%1 = tail call i32 (...) @rand()
ret void
}
int ATnT_syntax(void) { asm("mov $17, %eax"); }


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

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

LLVM IR (-O0):
define i32 @ATnT_syntax() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @ATnT_syntax() {
tail call void asm sideeffect "mov $$17, %eax", "~{dirflag},~{fpsr},~{flags}"()
ret i32 undef
}
/* Variables and functions */
scalar_t__ strncpy(char *, char const *, size_t);
char *r_strncpy(char *dest, const char *src, size_t n) {
  return (char *)strncpy(dest, src, n);
}


x86 assembly (clang, -O0):
<r_strncpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_strncpy>:
jmp    1030 <strncpy@plt>

LLVM IR (-O0):
define i8* @r_strncpy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i64 @strncpy(i8* %7, i8* %8, i64 %9)
%11 = inttoptr i64 %10 to i8*
ret i8* %11
}

LLVM IR (-O2):
define i8* @r_strncpy(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @strncpy(i8* %0, i8* %1, i64 %2)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Type definitions */
struct typ {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ definition_const(struct typ const *);
int /*<<< orphan*/ node_fun_first_vararg(int /*<<< orphan*/);
int /*<<< orphan*/ typ_is_function(struct typ const *);
ssize_t typ_function_first_vararg(const struct typ *t) {
  assert(typ_is_function(t));
  return node_fun_first_vararg(definition_const(t));
}


x86 assembly (clang, -O0):
<typ_function_first_vararg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <typ_is_function@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1060 <definition_const@plt>
mov    %eax,%edi
call   1040 <node_fun_first_vararg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<typ_function_first_vararg>:
push   %rbx
mov    %rdi,%rbx
call   1030 <typ_is_function@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1060 <definition_const@plt>
mov    %eax,%edi
pop    %rbx
jmp    1040 <node_fun_first_vararg@plt>

LLVM IR (-O0):
%struct.typ = type { i32 }
define i32 @typ_function_first_vararg(%struct.typ* %0) {
%2 = alloca %struct.typ*
store %struct.typ* %0, %struct.typ** %2
%3 = load %struct.typ*, %struct.typ** %2
%4 = call i32 @typ_is_function(%struct.typ* %3)
%5 = call i32 @assert(i32 %4)
%6 = load %struct.typ*, %struct.typ** %2
%7 = call i32 @definition_const(%struct.typ* %6)
%8 = call i32 @node_fun_first_vararg(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.typ = type { i32 }
define i32 @typ_function_first_vararg(%struct.typ* %0) {
%2 = tail call i32 @typ_is_function(%struct.typ* %0)
%3 = tail call i32 @assert(i32 %2)
%4 = tail call i32 @definition_const(%struct.typ* %0)
%5 = tail call i32 @node_fun_first_vararg(i32 %4)
ret i32 %5
}
int greater_than_zero(int number) {}


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

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

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

LLVM IR (-O2):
define i32 @greater_than_zero(i32 %0) {
ret i32 undef
}
unsigned int hash(const char *str) {
  unsigned int h = 0;
  const unsigned char *p;
  for (p = (const unsigned char *)str; *p != '\0'; p++)
    h = 65599 * h + *p;
  return h;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     114b <hash+0x4b>
imul   $0x1003f,-0xc(%rbp),%eax
mov    -0x18(%rbp),%rcx
movzbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <hash+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <hash+0x27>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movzbl %cl,%ecx
imul   $0x1003f,%eax,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %11, %4 ], [ %0, %1 ]
%7 = phi i32 [ %10, %4 ], [ 0, %1 ]
%8 = zext i8 %5 to i32
%9 = mul i32 %7, 65599
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  if (argc != 2)
    return 1;
  fputs(argv[1], stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     113c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1159 <main+0x49>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x2,%edi
jne    1133 <main+0x23>
push   %rax
mov    0x8(%rsi),%rdi
mov    0x2eba(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i32, i32* @stdout
%8 = tail call i32 @fputs(i8* %6, i32 %7)
br label %9
9: ; preds = %2, %4
%10 = phi i32 [ 0, %4 ], [ 1, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void USBWakeUp_RMP_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @USBWakeUp_RMP_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @USBWakeUp_RMP_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
double nCr(long, long);
double pow(int, long);
double loiBinomiale(long n, long k, double p) {
  double proba = 0;
  proba = nCr(n, k) * pow(p, k) * pow(1 - p, n - k);
  return proba;
}


x86 assembly (clang, -O0):
<loiBinomiale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <nCr@plt>
movsd  %xmm0,-0x30(%rbp)
cvttsd2si -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe8a(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
mov    -0x8(%rbp),%rsi
sub    -0x10(%rbp),%rsi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loiBinomiale>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <nCr@plt>
movsd  %xmm0,0x8(%rsp)
cvttsd2si 0x10(%rsp),%edi
mov    %r14,%rsi
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xea0(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
sub    %r14,%rbx
mov    %rbx,%rsi
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @loiBinomiale(i64 %0, i64 %1, double %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca double
%7 = alloca double
store i64 %0, i64* %4
store i64 %1, i64* %5
store double %2, double* %6
store double 0.000000e+00, double* %7
%8 = load i64, i64* %4
%9 = load i64, i64* %5
%10 = call double @nCr(i64 %8, i64 %9)
%11 = load double, double* %6
%12 = fptosi double %11 to i32
%13 = load i64, i64* %5
%14 = call double @pow(i32 %12, i64 %13)
%15 = fmul double %10, %14
%16 = load double, double* %6
%17 = fsub double 1.000000e+00, %16
%18 = fptosi double %17 to i32
%19 = load i64, i64* %4
%20 = load i64, i64* %5
%21 = sub nsw i64 %19, %20
%22 = call double @pow(i32 %18, i64 %21)
%23 = fmul double %15, %22
store double %23, double* %7
%24 = load double, double* %7
ret double %24
}

LLVM IR (-O2):
define double @loiBinomiale(i64 %0, i64 %1, double %2) {
%4 = tail call double @nCr(i64 %0, i64 %1)
%5 = fptosi double %2 to i32
%6 = tail call double @pow(i32 %5, i64 %1)
%7 = fmul double %4, %6
%8 = fsub double 1.000000e+00, %2
%9 = fptosi double %8 to i32
%10 = sub nsw i64 %0, %1
%11 = tail call double @pow(i32 %9, i64 %10)
%12 = fmul double %7, %11
ret double %12
}
/* Variables and functions */
char *medusaReceiveDataInternal(int, int *, int /*<<< orphan*/, int, int);
char *medusaReceiveRawDelay(int socket, int *nBufferSize, int nReceiveDelay1,
                            int nReceiveDelay2) {
  return medusaReceiveDataInternal(socket, nBufferSize, 0, nReceiveDelay1,
                                   nReceiveDelay2);
}


x86 assembly (clang, -O0):
<medusaReceiveRawDelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %edx,%edx
call   1030 <medusaReceiveDataInternal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<medusaReceiveRawDelay>:
mov    %ecx,%r8d
mov    %edx,%ecx
xor    %edx,%edx
jmp    1030 <medusaReceiveDataInternal@plt>

LLVM IR (-O0):
define i8* @medusaReceiveRawDelay(i32 %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32*, i32** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i8* @medusaReceiveDataInternal(i32 %9, i32* %10, i32 0, i32 %11, i32 %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @medusaReceiveRawDelay(i32 %0, i32* %1, i32 %2, i32 %3) {
%5 = tail call i8* @medusaReceiveDataInternal(i32 %0, i32* %1, i32 0, i32 %2, i32 %3)
ret i8* %5
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int y;
};
typedef TYPE_1__ XCreateWindowEvent;

/* Variables and functions */
void set_XCreateWindowEvent_y(void *_p, int _v) {
  ((XCreateWindowEvent *)_p)->y = (int)_v;
}


x86 assembly (clang, -O0):
<set_XCreateWindowEvent_y>:
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):
<set_XCreateWindowEvent_y>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XCreateWindowEvent_y(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XCreateWindowEvent_y(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errexit(char *);
int /*<<< orphan*/ putstr(char *);
int /*<<< orphan*/ stderr_out();
void version_msg() {
  stderr_out();
  putstr("ld86 version: ");
  errexit("0.16.21");
}


x86 assembly (clang, -O0):
<version_msg>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <stderr_out@plt>
lea    0xebe(%rip),%rdi
call   1050 <putstr@plt>
lea    0xec1(%rip),%rdi
call   1040 <errexit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<version_msg>:
push   %rax
xor    %eax,%eax
call   1030 <stderr_out@plt>
lea    0xec1(%rip),%rdi
call   1050 <putstr@plt>
lea    0xec4(%rip),%rdi
pop    %rax
jmp    1040 <errexit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"ld86 version: \00"
@.str.1 = [8 x i8] c"0.16.21\00"
define void @version_msg() {
%1 = call i32 (...) @stderr_out()
%2 = call i32 @putstr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @errexit(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"ld86 version: \00"
@.str.1 = [8 x i8] c"0.16.21\00"
define void @version_msg() {
%1 = tail call i32 (...) @stderr_out()
%2 = tail call i32 @putstr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @errexit(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int i2c_smbus_write_byte(int, int);
int ci20I2CWrite(int fd, int data) { return i2c_smbus_write_byte(fd, data); }


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

x86 assembly (clang, -O2):
<ci20I2CWrite>:
jmp    1030 <i2c_smbus_write_byte@plt>

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

LLVM IR (-O2):
define i32 @ci20I2CWrite(i32 %0, i32 %1) {
%3 = tail call i32 @i2c_smbus_write_byte(i32 %0, i32 %1)
ret i32 %3
}
void lcd44780_wait(void) {
  int i, j;
  for (i = 0; i < 400; i++)
    for (j = 0; j < 10000; j++)
      ;
}


x86 assembly (clang, -O0):
<lcd44780_wait>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x190,-0x4(%rbp)
jge    1152 <lcd44780_wait+0x52>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    113f <lcd44780_wait+0x3f>
jmp    1131 <lcd44780_wait+0x31>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <lcd44780_wait+0x1f>
jmp    1144 <lcd44780_wait+0x44>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <lcd44780_wait+0xb>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @lcd44780_wait() {
ret void
}
void olfiles_() {}


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

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

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

LLVM IR (-O2):
define void @olfiles_() {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ display;
};
typedef TYPE_1__ XConfigureEvent;

/* Variables and functions */
void *get_XConfigureEvent_display(void *_p) {
  return (void *)((XConfigureEvent *)_p)->display;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i8* @get_XConfigureEvent_display(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
define i8* @get_XConfigureEvent_display(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRCORE_N16_swap(char *, int, int);
void U_WMRSELECTCLIPREGION_swap(char *record, int torev) {
  U_WMRCORE_N16_swap(record, 1, torev);
}


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

x86 assembly (clang, -O2):
<U_WMRSELECTCLIPREGION_swap>:
mov    %esi,%edx
mov    $0x1,%esi
jmp    1030 <U_WMRCORE_N16_swap@plt>

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

LLVM IR (-O2):
define void @U_WMRSELECTCLIPREGION_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRCORE_N16_swap(i8* %0, i32 1, i32 %1)
ret void
}
int is_dir(file)
register char *file;
{
  while (*file++ != '\0')
    ;
  return (*(file - 2) == '/');
}


x86 assembly (clang, -O0):
<is_dir>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1128 <is_dir+0x28>
jmp    1108 <is_dir+0x8>
mov    -0x8(%rbp),%rax
movsbl -0x2(%rax),%eax
cmp    $0x2f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_dir>:
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1100 <is_dir>
xor    %eax,%eax
cmpb   $0x2f,-0x2(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_dir(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %3, i64 -1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 47
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ blank_statusbar_refresh();
void do_early_abort(void) { blank_statusbar_refresh(); }


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

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

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

LLVM IR (-O2):
define void @do_early_abort() {
%1 = tail call i32 (...) @blank_statusbar_refresh()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear32(int, int);
int /*<<< orphan*/ gecko_enable(int /*<<< orphan*/);
int /*<<< orphan*/ set32(int, int);
int /*<<< orphan*/ udelay(int);
void powerpc_hang(void) {
  do {
  } while (0);
  gecko_enable(0);
  clear32((0xd800000 + 0x194), 0x30);
  udelay(100);
  set32((0xd800000 + 0x194), 0x20);
  udelay(100);
}


x86 assembly (clang, -O0):
<powerpc_hang>:
push   %rbp
mov    %rsp,%rbp
jmp    1149 <powerpc_hang+0x9>
jmp    114e <powerpc_hang+0xe>
xor    %edi,%edi
call   1040 <gecko_enable@plt>
mov    $0xd800194,%edi
mov    $0x30,%esi
call   1060 <clear32@plt>
mov    $0x64,%edi
call   1050 <udelay@plt>
mov    $0xd800194,%edi
mov    $0x20,%esi
call   1030 <set32@plt>
mov    $0x64,%edi
call   1050 <udelay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<powerpc_hang>:
push   %rax
xor    %edi,%edi
call   1040 <gecko_enable@plt>
mov    $0xd800194,%edi
mov    $0x30,%esi
call   1060 <clear32@plt>
mov    $0x64,%edi
call   1050 <udelay@plt>
mov    $0xd800194,%edi
mov    $0x20,%esi
call   1030 <set32@plt>
mov    $0x64,%edi
pop    %rax
jmp    1050 <udelay@plt>

LLVM IR (-O0):
define void @powerpc_hang() {
br label %1
1: ; preds = %0
br label %2
2: ; preds = %1
%3 = call i32 @gecko_enable(i32 0)
%4 = call i32 @clear32(i32 226492820, i32 48)
%5 = call i32 @udelay(i32 100)
%6 = call i32 @set32(i32 226492820, i32 32)
%7 = call i32 @udelay(i32 100)
ret void
}

LLVM IR (-O2):
define void @powerpc_hang() {
%1 = tail call i32 @gecko_enable(i32 0)
%2 = tail call i32 @clear32(i32 226492820, i32 48)
%3 = tail call i32 @udelay(i32 100)
%4 = tail call i32 @set32(i32 226492820, i32 32)
%5 = tail call i32 @udelay(i32 100)
ret void
}
/* Variables and functions */
char *malloc(int);
char *my_strcpy(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char a[1000];
  char *b;
  b = malloc(sizeof(char) * 1000);
  scanf("%s", a);
  b = my_strcpy(a, b);
  printf("%s", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3e8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x3f8(%rbp)
lea    -0x3f0(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
mov    -0x3f8(%rbp),%rsi
call   1030 <my_strcpy@plt>
mov    %rax,-0x3f8(%rbp)
mov    -0x3f8(%rbp),%rsi
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x3f0,%rsp
mov    $0x3e8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xea0(%rip),%r14
mov    %rsp,%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <my_strcpy@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = tail call dereferenceable_or_null(1000) i8* @malloc(i32 1000)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i8* @my_strcpy(i8* %2, i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int16_t tms_get_type(uint8_t *msg, int32_t n) {
  int16_t rv = (int16_t)msg[3];
  return (rv);
}


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

x86 assembly (clang, -O2):
<tms_get_type>:
mov    0xc(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @tms_get_type(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 3
%8 = load i32, i32* %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @tms_get_type(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 3
%4 = load i32, i32* %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ init_mt19937ar();
__attribute__((constructor)) void lock_constructor() { init_mt19937ar(); }


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

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

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @lock_constructor, i8* null }]
define void @lock_constructor() {
%1 = call i32 (...) @init_mt19937ar()
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @lock_constructor, i8* null }]
define void @lock_constructor() {
%1 = tail call i32 (...) @init_mt19937ar()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void bug(int n) {
  printf("Please tell jim@rand.org that fatal bug %d happened.\n", n);
  exit(1);
}


x86 assembly (clang, -O0):
<bug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<bug>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"Please tell jim@rand.org that fatal bug %d happened.\0A\00"
define void @bug(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [54 x i8] c"Please tell jim@rand.org that fatal bug %d happened.\0A\00"
define void @bug(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef size_t uint64_t;

/* Variables and functions */
size_t UINT64_C(int);
uint64_t lo(uint64_t u, size_t nbits) {
  return u & ((UINT64_C(1) << (nbits)) - 1);
}


x86 assembly (clang, -O0):
<lo>:
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    $0x1,%edi
call   1030 <UINT64_C@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    %cl,%rdx
mov    %rdx,%rcx
sub    $0x1,%rcx
and    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lo>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x1,%edi
call   1030 <UINT64_C@plt>
mov    %ebx,%ecx
shl    %cl,%rax
add    $0xffffffffffffffff,%rax
and    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @lo(i64 %0, i64 %1) {
%3 = tail call i64 @UINT64_C(i32 1)
%4 = shl i64 %3, %1
%5 = add i64 %4, -1
%6 = and i64 %5, %0
ret i64 %6
}