xunge/DecIR huggingface dataset:
void b_delay(unsigned long nbr) {
  asm volatile("call 0x00100048" : : "a"(nbr));
}


x86 assembly (clang, -O0):
<b_delay>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
call   100048 <completed.0+0xfc028>
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_delay>:
mov    %rdi,%rax
call   100048 <completed.0+0xfc028>
ret

LLVM IR (-O0):
define void @b_delay(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
ret void
}

LLVM IR (-O2):
define void @b_delay(i64 %0) {
tail call void asm sideeffect "call 0x00100048", "{ax},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret void
}
/* Variables and functions */
double pow(double, int);
double h_albsize(double H) {
  return (3600 * ((.707 * 1500 * pow(2.51, (18 - H) / 2) / (1.4959787e11)) *
                  180. / 3.141592653589793));
}


x86 assembly (clang, -O0):
<h_albsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xf13(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xefe(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  0xee6(%rip),%xmm0
call   1030 <pow@plt>
movsd  0xed1(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xebd(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xea9(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe95(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe81(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h_albsize>:
push   %rax
movsd  0xee7(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xee3(%rip),%xmm1
cvttsd2si %xmm1,%edi
movsd  0xedf(%rip),%xmm0
call   1030 <pow@plt>
mulsd  0xeda(%rip),%xmm0
divsd  0xeda(%rip),%xmm0
mulsd  0xeda(%rip),%xmm0
divsd  0xeda(%rip),%xmm0
mulsd  0xeda(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @h_albsize(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double 1.800000e+01, %3
%5 = fdiv double %4, 2.000000e+00
%6 = fptosi double %5 to i32
%7 = call double @pow(double 2.510000e+00, i32 %6)
%8 = fmul double 1.060500e+03, %7
%9 = fdiv double %8, 0x42416A5D2BD80000
%10 = fmul double %9, 1.800000e+02
%11 = fdiv double %10, 0x400921FB54442D18
%12 = fmul double 3.600000e+03, %11
ret double %12
}

LLVM IR (-O2):
define double @h_albsize(double %0) {
%2 = fsub double 1.800000e+01, %0
%3 = fmul double %2, 5.000000e-01
%4 = fptosi double %3 to i32
%5 = tail call double @pow(double 2.510000e+00, i32 %4)
%6 = fmul double %5, 1.060500e+03
%7 = fdiv double %6, 0x42416A5D2BD80000
%8 = fmul double %7, 1.800000e+02
%9 = fdiv double %8, 0x400921FB54442D18
%10 = fmul double %9, 3.600000e+03
ret double %10
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ fprintf__simple_string();
int /*<<< orphan*/ snprintf__overflow();
int /*<<< orphan*/ snprintf__two_formatters();
int main(void) {
  snprintf__two_formatters();
  snprintf__overflow();
  fprintf__simple_string();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <snprintf__two_formatters@plt>
mov    $0x0,%al
call   1030 <snprintf__overflow@plt>
mov    $0x0,%al
call   1040 <fprintf__simple_string@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <snprintf__two_formatters@plt>
xor    %eax,%eax
call   1030 <snprintf__overflow@plt>
xor    %eax,%eax
call   1040 <fprintf__simple_string@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @snprintf__two_formatters()
%3 = call i32 (...) @snprintf__overflow()
%4 = call i32 (...) @fprintf__simple_string()
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @snprintf__two_formatters()
%2 = tail call i32 (...) @snprintf__overflow()
%3 = tail call i32 (...) @fprintf__simple_string()
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
int function(int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @function(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ err(char *, char *);
int /*<<< orphan*/ *fopen(char *, char *);
FILE *myfopen(char *s, char *t) {
  FILE *f = fopen(s, t);
  if (NULL == f)
    err("Error opening %s.\n", s);
  return f;
}


x86 assembly (clang, -O0):
<myfopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    115d <myfopen+0x3d>
mov    -0x8(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1030 <err@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myfopen>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <myfopen+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1030 <err@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"Error opening %s.\0A\00"
define noalias i32* @myfopen(i8* %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @err(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %2
ret i32* %3
}
void *pointerOffset(void *pt, unsigned long long offset) {
  char *s = pt;
  return s + offset;
}


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

x86 assembly (clang, -O2):
<pointerOffset>:
lea    (%rdi,%rsi,1),%rax
ret

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

LLVM IR (-O2):
define i8* @pointerOffset(i8* readnone %0, i64 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 %1
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int open(char const *, int);
int /*<<< orphan*/ perror(char *);
int _open(const char *path, int flags) {
  int fd;
  fd = open(path, flags);
  if (fd == -1) {
    perror("open");
    exit(1);
  }
  return fd;
}


x86 assembly (clang, -O0):
<_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <open@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    116e <_open+0x3e>
lea    0xea1(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_open>:
push   %rax
call   1030 <open@plt>
cmp    $0xffffffff,%eax
je     113d <_open+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"open\00"
define i32 @_open(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @open(i8* %0, i32 %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret i32 %3
}
void generic_pipe_buf_map(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<generic_pipe_buf_map>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<generic_pipe_buf_map>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.generic_pipe_buf_map = [21 x i8] c"generic_pipe_buf_map\00"
define void @generic_pipe_buf_map() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.generic_pipe_buf_map, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.generic_pipe_buf_map = [21 x i8] c"generic_pipe_buf_map\00"
define void @generic_pipe_buf_map() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.generic_pipe_buf_map, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_hello(void) { printf("Hello\n"); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"Hello\0A\00"
define void @print_hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"Hello\00"
define void @print_hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int padcon_get_dobldobl_solution(int idx, int verbose) {
  int fail;
  int pars[2];
  double *c;
  pars[0] = 1;
  pars[1] = idx;
  fail = _ada_use_c2phc4c(863, pars, &verbose, c, 0);
  if (pars[0] != 0)
    fail = pars[0];
  return fail;
}


x86 assembly (clang, -O0):
<padcon_get_dobldobl_solution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    -0x14(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    $0x35f,%edi
lea    -0x8(%rbp),%rdx
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1157 <padcon_get_dobldobl_solution+0x47>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<padcon_get_dobldobl_solution>:
sub    $0x18,%rsp
mov    %esi,0x14(%rsp)
movl   $0x1,0xc(%rsp)
mov    %edi,0x10(%rsp)
lea    0xc(%rsp),%rsi
lea    0x14(%rsp),%rdx
mov    $0x35f,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
cmovne %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @padcon_get_dobldobl_solution(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [2 x i32]
%7 = alloca double*
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 1, i32* %8
%9 = load i32, i32* %3
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 %9, i32* %10
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%12 = load double*, double** %7
%13 = call i32 @_ada_use_c2phc4c(i32 863, i32* %11, i32* %4, double* %12, i32 0)
store i32 %13, i32* %5
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%15 = load i32, i32* %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%19 = load i32, i32* %18
store i32 %19, i32* %5
br label %20
20: ; preds = %17, %2
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
define i32 @padcon_get_dobldobl_solution(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca [2 x i32]
store i32 %1, i32* %3
%5 = bitcast [2 x i32]* %4 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 1, i32* %6
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 %0, i32* %7
%8 = call i32 @_ada_use_c2phc4c(i32 863, i32* %6, i32* %3, double* undef, i32 0)
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i32 %8, i32 %9
ret i32 %11
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
int compare(const void *a, const void *b) {
  uint64_t ai = *((uint64_t *)a);
  uint64_t bi = *((uint64_t *)b);
  if (ai < bi)
    return -1;
  else if (ai > bi)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    113c <compare+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <compare+0x5d>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    1156 <compare+0x56>
movl   $0x1,-0x4(%rbp)
jmp    115d <compare+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp slt i64 %4, %6
%8 = icmp sgt i64 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
void PWMIntEnable(unsigned long ulBase, unsigned long ulChannel,
                  unsigned long ulIntType) {
  ;
  ;
  ;
  if (ulIntType == 0x00000001) {
    (*((volatile unsigned long *)(ulBase + 0x0000000C))) |= 0x00000001;
  } else {
    (*((volatile unsigned long *)(ulBase + 0x0000000C))) |=
        (0x00000002 << ulChannel);
  }
}


x86 assembly (clang, -O0):
<PWMIntEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x1,-0x18(%rbp)
jne    1130 <PWMIntEnable+0x30>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rcx
or     $0x1,%rcx
mov    %rcx,0xc(%rax)
jmp    114f <PWMIntEnable+0x4f>
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x2,%eax
shl    %cl,%eax
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMIntEnable>:
mov    %rsi,%rcx
mov    $0x2,%eax
shl    %cl,%eax
cmp    $0x1,%rdx
cltq
cmove  %rdx,%rax
or     %rax,0xc(%rdi)
ret

LLVM IR (-O0):
define void @PWMIntEnable(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, 1
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = load i64, i64* %4
%11 = add i64 %10, 12
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = or i64 %13, 1
store volatile i64 %14, i64* %12
br label %25
15: ; preds = %3
%16 = load i64, i64* %5
%17 = trunc i64 %16 to i32
%18 = shl i32 2, %17
%19 = sext i32 %18 to i64
%20 = load i64, i64* %4
%21 = add i64 %20, 12
%22 = inttoptr i64 %21 to i64*
%23 = load volatile i64, i64* %22
%24 = or i64 %23, %19
store volatile i64 %24, i64* %22
br label %25
25: ; preds = %15, %9
ret void
}

LLVM IR (-O2):
define void @PWMIntEnable(i64 %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %2, 1
%5 = trunc i64 %1 to i32
%6 = shl i32 2, %5
%7 = sext i32 %6 to i64
%8 = select i1 %4, i64 1, i64 %7
%9 = add i64 %0, 12
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
%12 = or i64 %11, %8
store volatile i64 %12, i64* %10
ret void
}
/* Variables and functions */
float nsvg__vmag(float, float);
float nsvg__vecrat(float ux, float uy, float vx, float vy) {
  return (ux * vx + uy * vy) / (nsvg__vmag(ux, uy) * nsvg__vmag(vx, vy));
}


x86 assembly (clang, -O0):
<nsvg__vecrat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <nsvg__vmag@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1030 <nsvg__vmag@plt>
movss  -0x18(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x14(%rbp),%xmm0
mulss  %xmm2,%xmm1
divss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nsvg__vecrat>:
sub    $0x18,%rsp
movss  %xmm3,0x10(%rsp)
movss  %xmm2,0xc(%rsp)
movaps %xmm1,%xmm4
mulss  %xmm3,%xmm4
movaps %xmm0,%xmm3
mulss  %xmm2,%xmm3
addss  %xmm4,%xmm3
movss  %xmm3,0x14(%rsp)
call   1030 <nsvg__vmag@plt>
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1030 <nsvg__vmag@plt>
mulss  0x8(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @nsvg__vecrat(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %7
%11 = load float, float* %6
%12 = load float, float* %8
%13 = fmul float %11, %12
%14 = call float @llvm.fmuladd.f32(float %9, float %10, float %13)
%15 = load float, float* %5
%16 = load float, float* %6
%17 = call float @nsvg__vmag(float %15, float %16)
%18 = load float, float* %7
%19 = load float, float* %8
%20 = call float @nsvg__vmag(float %18, float %19)
%21 = fmul float %17, %20
%22 = fdiv float %14, %21
ret float %22
}

LLVM IR (-O2):
define float @nsvg__vecrat(float %0, float %1, float %2, float %3) {
%5 = fmul float %1, %3
%6 = tail call float @llvm.fmuladd.f32(float %0, float %2, float %5)
%7 = tail call float @nsvg__vmag(float %0, float %1)
%8 = tail call float @nsvg__vmag(float %2, float %3)
%9 = fmul float %7, %8
%10 = fdiv float %6, %9
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int useboot(void *boot) { abort(); }


x86 assembly (clang, -O0):
<useboot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<useboot>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @useboot(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define i32 @useboot(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ write(char *, char *, char *);
void function_notes(char *notes) { write("csv-task.csv", "%s,", notes); }


x86 assembly (clang, -O0):
<function_notes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_notes>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeec(%rip),%rsi
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"csv-task.csv\00"
@.str.1 = [4 x i8] c"%s,\00"
define void @function_notes(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @write(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"csv-task.csv\00"
@.str.1 = [4 x i8] c"%s,\00"
define void @function_notes(i8* %0) {
%2 = tail call i32 @write(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void rsleep(int ms) { usleep(ms * 10000); }


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

x86 assembly (clang, -O2):
<rsleep>:
imul   $0x2710,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @rsleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 10000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @rsleep(i32 %0) {
%2 = mul nsw i32 %0, 10000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
void do_count() {}


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

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

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

LLVM IR (-O2):
define void @do_count() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ responseCode;

/* Variables and functions */
int /*<<< orphan*/ send(int, int *, int, int /*<<< orphan*/);
void handle_quit(int fd) {
  int responseCode = 1;
  send(fd, &responseCode, sizeof(responseCode), 0);
}


x86 assembly (clang, -O0):
<handle_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_quit>:
push   %rax
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @handle_quit(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = call i32 @send(i32 %0, i32* %2, i32 4, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int read(int, void *, int);
int dev_read(int fd, void *data, int count) {
  int ret = 0;
  if ((ret = read(fd, data, count)) != count) {
    perror("read failed!");
    ret = -1;
    exit(0);
  }
  return ret;
}


x86 assembly (clang, -O0):
<dev_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <read@plt>
mov    %eax,-0x18(%rbp)
cmp    -0x14(%rbp),%eax
je     117e <dev_read+0x4e>
lea    0xe95(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x18(%rbp)
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dev_read>:
push   %rbx
mov    %edx,%ebx
call   1030 <read@plt>
cmp    %ebx,%eax
jne    1140 <dev_read+0x10>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xeb9(%rip),%rdi
call   1040 <perror@plt>
xor    %edi,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"read failed!\00"
define i32 @dev_read(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i32 %2)
%5 = icmp eq i32 %4, %2
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %3
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void proc(int n) { printf("%i\n", n); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define void @proc(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
void pcm8_stop(void) {}


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

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

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

LLVM IR (-O2):
define void @pcm8_stop() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void sfence() {
  db(0x0F);
  db(0xAE);
  db(0xF8);
}


x86 assembly (clang, -O0):
<sfence>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%edi
call   1030 <db@plt>
mov    $0xae,%edi
call   1030 <db@plt>
mov    $0xf8,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sfence>:
push   %rax
mov    $0xf,%edi
call   1030 <db@plt>
mov    $0xae,%edi
call   1030 <db@plt>
mov    $0xf8,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @sfence() {
%1 = call i32 @db(i32 15)
%2 = call i32 @db(i32 174)
%3 = call i32 @db(i32 248)
ret void
}

LLVM IR (-O2):
define void @sfence() {
%1 = tail call i32 @db(i32 15)
%2 = tail call i32 @db(i32 174)
%3 = tail call i32 @db(i32 248)
ret void
}
double float_trunc(double d) {
  union {
    double d;
    unsigned long long ull;
  } parts;
  parts.d = d;
  parts.ull &= ~0xffffull;
  return parts.d;
}


x86 assembly (clang, -O0):
<float_trunc>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0xffffffffffff0000,%rax
mov    %rax,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_trunc>:
movsd  0xef8(%rip),%xmm1
andps  %xmm1,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { double }
define double @float_trunc(double %0) {
%2 = alloca double
%3 = alloca %union.anon
store double %0, double* %2
%4 = load double, double* %2
%5 = bitcast %union.anon* %3 to double*
store double %4, double* %5
%6 = bitcast %union.anon* %3 to i64*
%7 = load i64, i64* %6
%8 = and i64 %7, -65536
store i64 %8, i64* %6
%9 = bitcast %union.anon* %3 to double*
%10 = load double, double* %9
ret double %10
}

LLVM IR (-O2):
define double @float_trunc(double %0) {
%2 = bitcast double %0 to i64
%3 = and i64 %2, -65536
%4 = bitcast i64 %3 to double
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ clear_scrn();
int /*<<< orphan*/ remove_cursor();
void vga_init() {
  clear_scrn();
  remove_cursor();
}


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

x86 assembly (clang, -O2):
<vga_init>:
push   %rax
xor    %eax,%eax
call   1030 <clear_scrn@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <remove_cursor@plt>

LLVM IR (-O0):
define void @vga_init() {
%1 = call i32 (...) @clear_scrn()
%2 = call i32 (...) @remove_cursor()
ret void
}

LLVM IR (-O2):
define void @vga_init() {
%1 = tail call i32 (...) @clear_scrn()
%2 = tail call i32 (...) @remove_cursor()
ret void
}
/* Variables and functions */
int mkdir(char *, int);
int ptbl_mkdir(char *cp_dirpath) { return mkdir(cp_dirpath, 0777); }


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

x86 assembly (clang, -O2):
<ptbl_mkdir>:
mov    $0x1ff,%esi
jmp    1030 <mkdir@plt>

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

LLVM IR (-O2):
define i32 @ptbl_mkdir(i8* nocapture %0) {
%2 = tail call i32 @mkdir(i8* %0, i32 511)
ret i32 %2
}
void strcpy2(char *s, char *t) {
  while ((*s++ = *t++) != '\0')
    ;
}


x86 assembly (clang, -O0):
<strcpy2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     113f <strcpy2+0x3f>
jmp    110c <strcpy2+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy2>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strcpy2+0x10>
ret

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

LLVM IR (-O2):
define void @strcpy2(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ movi_write_bl1(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  if (argc < 3)
    movi_write_bl1(NULL, NULL);
  else
    movi_write_bl1(argv[1], argv[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1141 <main+0x31>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1030 <movi_write_bl1@plt>
jmp    1156 <main+0x46>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <movi_write_bl1@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jg     111c <main+0xc>
xor    %edi,%edi
xor    %esi,%esi
jmp    1124 <main+0x14>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1030 <movi_write_bl1@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @movi_write_bl1(i8* null, i8* null)
br label %12
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 @movi_write_bl1(i8* %8, i8* %10)
br label %12
12: ; preds = %6, %4
ret i32 0
}
void ph_handleTransferProgress(char *data) {}


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

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

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

LLVM IR (-O2):
define void @ph_handleTransferProgress(i8* nocapture %0) {
ret void
}
void RandomFunc(unsigned short input[1], unsigned short output[1]) {
  unsigned short state[1];
  {
    state[0UL] = (input[0UL] | 51238316UL) >> (unsigned short)3;
    if (!((state[0UL] >> (unsigned short)3) & (unsigned short)1)) {
      state[0UL] <<=
          ((state[0UL] >> (unsigned short)1) & (unsigned short)7) | 1UL;
    }
    output[0UL] = state[0UL] | 454761159UL;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
or     $0x30dd5ac,%rax
shr    $0x3,%rax
mov    %ax,-0x12(%rbp)
movzwl -0x12(%rbp),%eax
sar    $0x3,%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    114f <RandomFunc+0x4f>
movzwl -0x12(%rbp),%eax
sar    $0x1,%eax
and    $0x7,%eax
movslq %eax,%rcx
or     $0x1,%rcx
movzwl -0x12(%rbp),%eax
shl    %cl,%eax
mov    %ax,-0x12(%rbp)
movzwl -0x12(%rbp),%eax
or     $0x1b1b1ac7,%rax
mov    %ax,%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
movzwl (%rdi),%eax
mov    %eax,%edx
shr    $0x3,%edx
or     $0xffffbab5,%edx
mov    %edx,%ecx
shr    %cl
and    $0x6,%cl
or     $0x1,%cl
xor    %edi,%edi
test   $0x40,%al
movzbl %cl,%ecx
cmovne %edi,%ecx
shl    %cl,%edx
or     $0x1ac7,%edx
mov    %dx,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i16* %0, i16* %1) {
%3 = alloca i16*
%4 = alloca i16*
%5 = alloca [1 x i16]
store i16* %0, i16** %3
store i16* %1, i16** %4
%6 = load i16*, i16** %3
%7 = getelementptr inbounds i16, i16* %6, i64 0
%8 = load i16, i16* %7
%9 = zext i16 %8 to i64
%10 = or i64 %9, 51238316
%11 = lshr i64 %10, 3
%12 = trunc i64 %11 to i16
%13 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
store i16 %12, i16* %13
%14 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
%15 = load i16, i16* %14
%16 = zext i16 %15 to i32
%17 = ashr i32 %16, 3
%18 = and i32 %17, 1
%19 = icmp ne i32 %18, 0
br i1 %19, label %34, label %20
20: ; preds = %2
%21 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
%22 = load i16, i16* %21
%23 = zext i16 %22 to i32
%24 = ashr i32 %23, 1
%25 = and i32 %24, 7
%26 = sext i32 %25 to i64
%27 = or i64 %26, 1
%28 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
%29 = load i16, i16* %28
%30 = zext i16 %29 to i32
%31 = trunc i64 %27 to i32
%32 = shl i32 %30, %31
%33 = trunc i32 %32 to i16
store i16 %33, i16* %28
br label %34
34: ; preds = %20, %2
%35 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
%36 = load i16, i16* %35
%37 = zext i16 %36 to i64
%38 = or i64 %37, 454761159
%39 = trunc i64 %38 to i16
%40 = load i16*, i16** %4
%41 = getelementptr inbounds i16, i16* %40, i64 0
store i16 %39, i16* %41
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i16* nocapture %0, i16* nocapture writeonly %1) {
%3 = load i16, i16* %0
%4 = lshr i16 %3, 3
%5 = or i16 %4, -17739
%6 = and i16 %3, 64
%7 = icmp eq i16 %6, 0
%8 = lshr i16 %5, 1
%9 = and i16 %8, 6
%10 = or i16 %9, 1
%11 = select i1 %7, i16 %10, i16 0
%12 = shl i16 %5, %11
%13 = or i16 %12, 6855
store i16 %13, i16* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_cpu_times();
int main() {
  print_cpu_times();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @print_cpu_times()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @print_cpu_times()
ret i32 0
}
/* Variables and functions */
size_t INT_MAX;
void *av_mallocz(size_t);
void *av_mallocz_array(size_t nmemb, size_t size) {
  if (!size || nmemb >= INT_MAX / size)
    return NULL;
  return av_mallocz(nmemb * size);
}


x86 assembly (clang, -O0):
<av_mallocz_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1155 <av_mallocz_array+0x45>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jb     1162 <av_mallocz_array+0x52>
movq   $0x0,-0x8(%rbp)
jmp    1174 <av_mallocz_array+0x64>
mov    -0x10(%rbp),%rdi
imul   -0x18(%rbp),%rdi
call   1030 <av_mallocz@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_mallocz_array>:
test   %rsi,%rsi
je     114a <av_mallocz_array+0x3a>
mov    0x2ecc(%rip),%rax
mov    (%rax),%rax
mov    %rax,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1141 <av_mallocz_array+0x31>
xor    %edx,%edx
div    %rsi
cmp    %rdi,%rax
jbe    114a <av_mallocz_array+0x3a>
imul   %rdi,%rsi
mov    %rsi,%rdi
jmp    1030 <av_mallocz@plt>
xor    %edx,%edx
div    %esi
cmp    %rdi,%rax
ja     1135 <av_mallocz_array+0x25>
xor    %eax,%eax
ret

LLVM IR (-O0):
@INT_MAX = global i64 0
define i8* @av_mallocz_array(i64 %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i64, i64* %4
%10 = load i64, i64* @INT_MAX
%11 = load i64, i64* %5
%12 = udiv i64 %10, %11
%13 = icmp uge i64 %9, %12
br i1 %13, label %14, label %15
14: ; preds = %8, %2
store i8* null, i8** %3
br label %20
15: ; preds = %8
%16 = load i64, i64* %4
%17 = load i64, i64* %5
%18 = mul i64 %16, %17
%19 = call i8* @av_mallocz(i64 %18)
store i8* %19, i8** %3
br label %20
20: ; preds = %15, %14
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
@INT_MAX = global i64 0
define i8* @av_mallocz_array(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = load i64, i64* @INT_MAX
%6 = udiv i64 %5, %1
%7 = icmp ugt i64 %6, %0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = mul i64 %1, %0
%10 = tail call i8* @av_mallocz(i64 %9)
br label %11
11: ; preds = %2, %4, %8
%12 = phi i8* [ %10, %8 ], [ null, %4 ], [ null, %2 ]
ret i8* %12
}
void TFTDotWrite(int x, int y, unsigned int color) {
  if (!(y <= (272 - 1) && x <= (480 - 1)))
    return;
  volatile unsigned int *ptr = (volatile unsigned int *)0x5FA00000;
  ptr[y * ((480 - 1) + 1) + x] = color;
  return;
}


x86 assembly (clang, -O0):
<TFTDotWrite>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x10f,-0x8(%rbp)
jg     1127 <TFTDotWrite+0x27>
cmpl   $0x1df,-0x4(%rbp)
jle    112c <TFTDotWrite+0x2c>
jmp    114c <TFTDotWrite+0x4c>
mov    $0x5fa00000,%eax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rax
imul   $0x1e0,-0x8(%rbp),%ecx
add    -0x4(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TFTDotWrite>:
cmp    $0x1df,%edi
jg     1121 <TFTDotWrite+0x21>
cmp    $0x10f,%esi
jg     1121 <TFTDotWrite+0x21>
imul   $0x1e0,%esi,%eax
add    %edi,%eax
cltq
mov    %edx,0x5fa00000(,%rax,4)
ret

LLVM IR (-O0):
define void @TFTDotWrite(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 = icmp sle i32 %8, 271
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32, i32* %4
%12 = icmp sle i32 %11, 479
br i1 %12, label %14, label %13
13: ; preds = %10, %3
br label %23
14: ; preds = %10
store i32* inttoptr (i64 1604321280 to i32*), i32** %7
%15 = load i32, i32* %6
%16 = load i32*, i32** %7
%17 = load i32, i32* %5
%18 = mul nsw i32 %17, 480
%19 = load i32, i32* %4
%20 = add nsw i32 %18, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %16, i64 %21
store volatile i32 %15, i32* %22
br label %23
23: ; preds = %14, %13
ret void
}

LLVM IR (-O2):
define void @TFTDotWrite(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, 272
%5 = icmp slt i32 %0, 480
%6 = and i1 %5, %4
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = mul nsw i32 %1, 480
%9 = add nsw i32 %8, %0
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* inttoptr (i64 1604321280 to i32*), i64 %10
store volatile i32 %2, i32* %11
br label %12
12: ; preds = %3, %7
ret void
}
int devcons_close(struct Fd *fd) {
  (void)(fd);
  return 0;
}


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

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

LLVM IR (-O0):
%struct.Fd = type opaque
define i32 @devcons_close(%struct.Fd* %0) {
%2 = alloca %struct.Fd*
store %struct.Fd* %0, %struct.Fd** %2
%3 = load %struct.Fd*, %struct.Fd** %2
ret i32 0
}

LLVM IR (-O2):
%struct.Fd = type opaque
define i32 @devcons_close(%struct.Fd* nocapture readnone %0) {
ret i32 0
}
double calcGeomMeanAnomalySun(double t) {
  return 357.52911 + t * (35999.05029 - 0.0001537 * t);
}


x86 assembly (clang, -O0):
<calcGeomMeanAnomalySun>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xeed(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xee9(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec9(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcGeomMeanAnomalySun>:
movsd  0xef8(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef4(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define double @calcGeomMeanAnomalySun(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = call double @llvm.fmuladd.f64(double -1.537000e-04, double %4, double 0x40E193E19BF9C62A)
%6 = call double @llvm.fmuladd.f64(double %3, double %5, double 0x407658773C0C1FC9)
ret double %6
}

LLVM IR (-O2):
define double @calcGeomMeanAnomalySun(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double -1.537000e-04, double 0x40E193E19BF9C62A)
%3 = tail call double @llvm.fmuladd.f64(double %0, double %2, double 0x407658773C0C1FC9)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_ok() { printf("[OK]\n"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"[OK]\0A\00"
define void @print_ok() {
%1 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [5 x i8] c"[OK]\00"
define void @print_ok() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}
int mmi_msm_clock_init(struct clock_init_data *data) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.clock_init_data = type opaque
define i32 @mmi_msm_clock_init(%struct.clock_init_data* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ sm_get_current_seconds();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int sm_random(int max) {
  static int x = 0;
  if (!x) {
    srand(sm_get_current_seconds());
    x = 1;
  }
  return (rand() % max);
}


x86 assembly (clang, -O0):
<sm_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,0x2efa(%rip)
jne    1160 <sm_random+0x30>
mov    $0x0,%al
call   1040 <sm_get_current_seconds@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x1,0x2edc(%rip)
mov    $0x0,%al
call   1050 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sm_random>:
push   %rbx
mov    %edi,%ebx
cmpb   $0x0,0x2f02(%rip)
jne    1151 <sm_random+0x21>
xor    %eax,%eax
call   1040 <sm_get_current_seconds@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movb   $0x1,0x2eeb(%rip)
xor    %eax,%eax
call   1050 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@sm_random.x = internal global i32 0
define i32 @sm_random(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @sm_random.x
%4 = icmp ne i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = call i32 (...) @sm_get_current_seconds()
%7 = call i32 @srand(i32 %6)
store i32 1, i32* @sm_random.x
br label %8
8: ; preds = %5, %1
%9 = call i32 (...) @rand()
%10 = load i32, i32* %2
%11 = srem i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
@sm_random.x = internal unnamed_addr global i1 false
define i32 @sm_random(i32 %0) {
%2 = load i1, i1* @sm_random.x
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 (...) @sm_get_current_seconds()
%5 = tail call i32 @srand(i32 %4)
store i1 true, i1* @sm_random.x
br label %6
6: ; preds = %3, %1
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, %0
ret i32 %8
}