xunge/DecIR huggingface dataset:
float u2f(unsigned u) {
  union {
    unsigned u;
    float f;
  } v;
  v.u = u;
  return v.f;
}


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

x86 assembly (clang, -O2):
<u2f>:
movd   %edi,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define float @u2f(i32 %0) {
%2 = alloca i32
%3 = alloca %union.anon
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = bitcast %union.anon* %3 to i32*
store i32 %4, i32* %5
%6 = bitcast %union.anon* %3 to float*
%7 = load float, float* %6
ret float %7
}

LLVM IR (-O2):
define float @u2f(i32 %0) {
%2 = bitcast i32 %0 to float
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ umask(int);
void umask_f_(void) { umask(18); }


x86 assembly (clang, -O0):
<umask_f_>:
push   %rbp
mov    %rsp,%rbp
mov    $0x12,%edi
call   1030 <umask@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<umask_f_>:
mov    $0x12,%edi
jmp    1030 <umask@plt>

LLVM IR (-O0):
define void @umask_f_() {
%1 = call i32 @umask(i32 18)
ret void
}

LLVM IR (-O2):
define void @umask_f_() {
%1 = tail call i32 @umask(i32 18)
ret void
}
/* Variables and functions */
double atan(double);
double Datan(double x) { return atan(x); }


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

x86 assembly (clang, -O2):
<Datan>:
jmp    1030 <atan@plt>

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

LLVM IR (-O2):
define double @Datan(double %0) {
%2 = tail call double @atan(double %0)
ret double %2
}
int minimum(int x, int y) {
  if (x < y)
    return x;
  else
    return y;
}


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

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

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

LLVM IR (-O2):
define i32 @minimum(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void PrintHelp(void) { printf("Usage: ifj05 <file_name>\n"); }


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"Usage: ifj05 <file_name>\0A\00"
define void @PrintHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [25 x i8] c"Usage: ifj05 <file_name>\00"
define void @PrintHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __NR_unshare;
int syscall(int /*<<< orphan*/, int);
int unshare(int flags) { return syscall(__NR_unshare, flags); }


x86 assembly (clang, -O0):
<unshare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unshare>:
mov    %edi,%esi
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_unshare = global i32 0
define i32 @unshare(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @__NR_unshare
%4 = load i32, i32* %2
%5 = call i32 @syscall(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@__NR_unshare = global i32 0
define i32 @unshare(i32 %0) {
%2 = load i32, i32* @__NR_unshare
%3 = tail call i32 @syscall(i32 %2, i32 %0)
ret i32 %3
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ stat(char const *, struct stat *);
int _pu_path_is_dir(const char *pathname) {
  struct stat statbuf;
  if (stat(pathname, &statbuf) < 0)
    return 0;
  return S_ISDIR(statbuf.st_mode) != 0;
}


x86 assembly (clang, -O0):
<_pu_path_is_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
jge    114f <_pu_path_is_dir+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1166 <_pu_path_is_dir+0x46>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_pu_path_is_dir>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %rax,%rax
js     1143 <_pu_path_is_dir+0x23>
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @_pu_path_is_dir(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i64 @S_ISDIR(i32 %8)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %1, %6
%13 = phi i32 [ %11, %6 ], [ 0, %1 ]
ret i32 %13
}
/* Variables and functions */
double EvalAngCor_alpha0_3minus_0plus_15097_L3(double);
double funcAngCor_alpha0_3minus_0plus_15097_L3(double *x, double *par) {
  double result;
  result = par[0] * EvalAngCor_alpha0_3minus_0plus_15097_L3(x[0]);
  return result;
}


x86 assembly (clang, -O0):
<funcAngCor_alpha0_3minus_0plus_15097_L3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <EvalAngCor_alpha0_3minus_0plus_15097_L3@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<funcAngCor_alpha0_3minus_0plus_15097_L3>:
push   %rax
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rsp)
movsd  (%rdi),%xmm0
call   1030 <EvalAngCor_alpha0_3minus_0plus_15097_L3@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @funcAngCor_alpha0_3minus_0plus_15097_L3(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %4
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = call double @EvalAngCor_alpha0_3minus_0plus_15097_L3(double %11)
%13 = fmul double %8, %12
store double %13, double* %5
%14 = load double, double* %5
ret double %14
}

LLVM IR (-O2):
define double @funcAngCor_alpha0_3minus_0plus_15097_L3(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = load double, double* %0
%5 = tail call double @EvalAngCor_alpha0_3minus_0plus_15097_L3(double %4)
%6 = fmul double %3, %5
ret double %6
}
int ft_unsignedlen(unsigned long long n, int base) {
  int len;
  len = 0;
  if (n == 0)
    return (1);
  while (n != 0) {
    n /= base;
    len++;
  }
  return (len);
}


x86 assembly (clang, -O0):
<ft_unsignedlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1129 <ft_unsignedlen+0x29>
movl   $0x1,-0x4(%rbp)
jmp    115e <ft_unsignedlen+0x5e>
jmp    112e <ft_unsignedlen+0x2e>
cmpq   $0x0,-0x10(%rbp)
je     1158 <ft_unsignedlen+0x58>
movslq -0x14(%rbp),%rcx
mov    -0x10(%rbp),%rax
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112e <ft_unsignedlen+0x2e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_unsignedlen>:
test   %rdi,%rdi
je     113a <ft_unsignedlen+0x3a>
movslq %esi,%r8
xor    %ecx,%ecx
jmp    1123 <ft_unsignedlen+0x23>
nopl   0x0(%rax)
mov    %rdi,%rax
xor    %edx,%edx
div    %r8
add    $0x1,%ecx
cmp    %r8,%rdi
mov    %rax,%rdi
jb     1137 <ft_unsignedlen+0x37>
mov    %rdi,%rax
or     %r8,%rax
shr    $0x20,%rax
jne    1110 <ft_unsignedlen+0x10>
mov    %edi,%eax
xor    %edx,%edx
div    %esi
jmp    1118 <ft_unsignedlen+0x18>
mov    %ecx,%eax
ret
mov    $0x1,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_unsignedlen(i64 %0, i32 %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = sext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ 0, %4 ], [ %10, %6 ]
%8 = phi i64 [ %0, %4 ], [ %9, %6 ]
%9 = udiv i64 %8, %5
%10 = add nuw nsw i32 %7, 1
%11 = icmp ult i64 %8, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = phi i32 [ 1, %2 ], [ %10, %6 ]
ret i32 %13
}
/* Type definitions */
struct bits {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ abort();
chk(struct bits *p) {
  char v = 0x3 & *(char *)p;
  if (v != 3)
    abort();
}


x86 assembly (clang, -O0):
<chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0x3,%eax
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x3,%eax
je     113d <chk+0x2d>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chk>:
push   %rax
mov    (%rdi),%al
not    %al
test   $0x3,%al
jne    111b <chk+0xb>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.bits = type { i32 }
define i32 @chk(%struct.bits* %0) {
%2 = alloca i32
%3 = alloca %struct.bits*
%4 = alloca i8
store %struct.bits* %0, %struct.bits** %3
%5 = load %struct.bits*, %struct.bits** %3
%6 = bitcast %struct.bits* %5 to i8*
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = and i32 3, %8
%10 = trunc i32 %9 to i8
store i8 %10, i8* %4
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %1
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
%struct.bits = type { i32 }
define i32 @chk(%struct.bits* nocapture %0) {
%2 = bitcast %struct.bits* %0 to i8*
%3 = load i8, i8* %2
%4 = and i8 %3, 3
%5 = icmp eq i8 %4, 3
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ make_manipulation();
int main(void) {
  make_manipulation();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @make_manipulation()
ret i32 0
}
adrreg0adrx1(r0, r1, x0, x1, p0, p1) unsigned int r0, r1;
unsigned int *p0, *p1;
{
  if ((p0[10000000]) <= (((unsigned int *)11111111)[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adrreg0adrx1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2625a00(%rax),%eax
movslq -0x14(%rbp),%rdx
mov    $0xa98ac7,%ecx
cmp    (%rcx,%rdx,4),%eax
ja     1140 <adrreg0adrx1+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1147 <adrreg0adrx1+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0adrx1>:
mov    0x2625a00(%r8),%edx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    0xa98ac7(,%rcx,4),%edx
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @adrreg0adrx1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32* nocapture readnone %5) {
%7 = getelementptr inbounds i32, i32* %4, i64 10000000
%8 = load i32, i32* %7
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i32, i32* inttoptr (i64 11111111 to i32*), i64 %9
%11 = load i32, i32* %10
%12 = icmp ule i32 %8, %11
%13 = zext i1 %12 to i32
ret i32 %13
}
void widget_icon_set(struct widget *widget, const char *key, char *value) {}


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

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

LLVM IR (-O0):
%struct.widget = type opaque
define void @widget_icon_set(%struct.widget* %0, i8* %1, i8* %2) {
%4 = alloca %struct.widget*
%5 = alloca i8*
%6 = alloca i8*
store %struct.widget* %0, %struct.widget** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
ret void
}

LLVM IR (-O2):
%struct.widget = type opaque
define void @widget_icon_set(%struct.widget* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
ret void
}
void JoyStick(void) {}


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

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

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

LLVM IR (-O2):
define void @JoyStick() {
ret void
}
void test_26_0(char *mem) { __atomic_fetch_sub(mem, 1, 4); }


x86 assembly (clang, -O0):
<test_26_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
movb   $0x1,-0x9(%rbp)
mov    -0x9(%rbp),%al
neg    %al
lock xadd %al,(%rcx)
mov    %al,-0xa(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_26_0>:
lock subb $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @test_26_0(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8 1, i8* %3
%6 = load i8, i8* %3
%7 = atomicrmw sub i8* %5, i8 %6 acq_rel
store i8 %7, i8* %4
%8 = load i8, i8* %4
ret void
}

LLVM IR (-O2):
define void @test_26_0(i8* nocapture %0) {
%2 = atomicrmw sub i8* %0, i8 1 acq_rel
ret void
}
double pow(double base, double exp) {
  double ret = base;
  int i;
  for (i = 0; i < exp; i++)
    ret *= ret;
  return ret;
}


x86 assembly (clang, -O0):
<pow>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1150 <pow+0x50>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111f <pow+0x1f>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow>:
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jbe    1124 <pow+0x24>
mov    $0x1,%eax
nop
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
mulsd  %xmm0,%xmm0
add    $0x1,%eax
ucomisd %xmm2,%xmm1
ja     1110 <pow+0x10>
ret

LLVM IR (-O0):
define double @pow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
store double %7, double* %5
store i32 0, i32* %6
br label %8
8: ; preds = %17, %2
%9 = load i32, i32* %6
%10 = sitofp i32 %9 to double
%11 = load double, double* %4
%12 = fcmp olt double %10, %11
br i1 %12, label %13, label %20
13: ; preds = %8
%14 = load double, double* %5
%15 = load double, double* %5
%16 = fmul double %15, %14
store double %16, double* %5
br label %17
17: ; preds = %13
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %8
20: ; preds = %8
%21 = load double, double* %5
ret double %21
}

LLVM IR (-O2):
define double @pow(double %0, double %1) {
%3 = fcmp ogt double %1, 0.000000e+00
br i1 %3, label %4, label %11
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ 0, %2 ]
%6 = phi double [ %7, %4 ], [ %0, %2 ]
%7 = fmul double %6, %6
%8 = add nuw nsw i32 %5, 1
%9 = sitofp i32 %8 to double
%10 = fcmp olt double %9, %1
br i1 %10, label %4, label %11
11: ; preds = %4, %2
%12 = phi double [ %0, %2 ], [ %7, %4 ]
ret double %12
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
char *kegs_malloc_str(char *in_str) {
  char *str;
  int len;
  len = strlen(in_str) + 1;
  str = malloc(len);
  memcpy(str, in_str, len);
  return str;
}


x86 assembly (clang, -O0):
<kegs_malloc_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kegs_malloc_str>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @kegs_malloc_str(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = load i32, i32* %4
%13 = call i32 @memcpy(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @kegs_malloc_str(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %3)
ret i8* %4
}
int execute_madvise() { return 0; }


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

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

LLVM IR (-O0):
define i32 @execute_madvise() {
ret i32 0
}

LLVM IR (-O2):
define i32 @execute_madvise() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ a();
int /*<<< orphan*/ printf(char *);
void b(void) {
  a();
  printf("b");
}


x86 assembly (clang, -O0):
<b>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <a@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<b>:
push   %rax
xor    %eax,%eax
call   1040 <a@plt>
mov    $0x62,%edi
pop    %rax
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @b() {
%1 = tail call i32 (...) @a()
%2 = tail call i32 @putchar(i32 98)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(long *);
void am_free_longs(long *larr, int size) { free(larr); }


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

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

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

LLVM IR (-O2):
define void @am_free_longs(i64* nocapture %0, i32 %1) {
%3 = tail call i32 @free(i64* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GLCD_GoTo(unsigned char, unsigned char);
void GLCD_TextGoTo(unsigned char x, unsigned char y) { GLCD_GoTo(x * 6, y); }


x86 assembly (clang, -O0):
<GLCD_TextGoTo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
imul   $0x6,%eax,%eax
movzbl %al,%edi
movzbl -0x2(%rbp),%esi
call   1030 <GLCD_GoTo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GLCD_TextGoTo>:
add    %edi,%edi
lea    (%rdi,%rdi,2),%eax
movzbl %al,%edi
jmp    1030 <GLCD_GoTo@plt>

LLVM IR (-O0):
define void @GLCD_TextGoTo(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = mul nsw i32 %6, 6
%8 = trunc i32 %7 to i8
%9 = load i8, i8* %4
%10 = call i32 @GLCD_GoTo(i8 zeroext %8, i8 zeroext %9)
ret void
}

LLVM IR (-O2):
define void @GLCD_TextGoTo(i8 zeroext %0, i8 zeroext %1) {
%3 = mul i8 %0, 6
%4 = tail call i32 @GLCD_GoTo(i8 zeroext %3, i8 zeroext %1)
ret void
}
float add1_float_float(float x) { return x + 1; }


x86 assembly (clang, -O0):
<add1_float_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @add1_float_float(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fadd float %3, 1.000000e+00
ret float %4
}

LLVM IR (-O2):
define float @add1_float_float(float %0) {
%2 = fadd float %0, 1.000000e+00
ret float %2
}
int roi_set_stream_response_size(char *buff, unsigned char c) {
  buff[1] = c;
  return 0;
}


x86 assembly (clang, -O0):
<roi_set_stream_response_size>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roi_set_stream_response_size>:
mov    %sil,0x1(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @roi_set_stream_response_size(i8* nocapture writeonly %0, i8 zeroext %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %1, i8* %3
ret i32 0
}
void system_sleep_ms(unsigned ms) {}


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

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

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

LLVM IR (-O2):
define void @system_sleep_ms(i32 %0) {
ret void
}
/* Variables and functions */
int __reboot(int, char const *);
int reboot_np(int howto, const char *msg) {
  int res = __reboot(howto, msg);
  return res;
}


x86 assembly (clang, -O0):
<reboot_np>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <__reboot@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reboot_np>:
jmp    1030 <__reboot@plt>

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

LLVM IR (-O2):
define i32 @reboot_np(i32 %0, i8* %1) {
%3 = tail call i32 @__reboot(i32 %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
short clamp(int, int /*<<< orphan*/, int);
__attribute__((no)) short foo(int N) {
  short value = clamp(N, 0, 16);
  return value;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <clamp@plt>
mov    %ax,-0x6(%rbp)
movswl -0x6(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %esi,%esi
mov    $0x10,%edx
jmp    1030 <clamp@plt>

LLVM IR (-O0):
define signext i16 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i16
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call signext i16 @clamp(i32 %4, i32 0, i32 16)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define signext i16 @foo(i32 %0) {
%2 = tail call signext i16 @clamp(i32 %0, i32 0, i32 16)
ret i16 %2
}
long long signed_range(long long min, long long max) {
  extern long long random_signed_value(void);
  long long val = random_signed_value();
  if (val < min || max < val)
    val = min;
  return val;
}


x86 assembly (clang, -O0):
<signed_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
call   1030 <random_signed_value@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jl     1145 <signed_range+0x35>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    114d <signed_range+0x3d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signed_range>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <random_signed_value@plt>
cmp    %r14,%rax
mov    %rax,%rcx
cmovg  %rbx,%rcx
cmp    %rbx,%rax
cmovl  %rbx,%rcx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @signed_range(i64 %0, i64 %1) {
%3 = tail call i64 @random_signed_value()
%4 = icmp slt i64 %3, %0
%5 = icmp sgt i64 %3, %1
%6 = or i1 %4, %5
%7 = select i1 %6, i64 %0, i64 %3
ret i64 %7
}
/* Variables and functions */
int SetEnvironmentVariable(char const *, int /*<<< orphan*/);
int unsetenv(const char *a) { return SetEnvironmentVariable(a, 0); }


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

x86 assembly (clang, -O2):
<unsetenv>:
xor    %esi,%esi
jmp    1030 <SetEnvironmentVariable@plt>

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

LLVM IR (-O2):
define i32 @unsetenv(i8* %0) {
%2 = tail call i32 @SetEnvironmentVariable(i8* %0, i32 0)
ret i32 %2
}
int execute_nanosleep() { return 0; }


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

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

LLVM IR (-O0):
define i32 @execute_nanosleep() {
ret i32 0
}

LLVM IR (-O2):
define i32 @execute_nanosleep() {
ret i32 0
}
void metil_mpi_init(int argc, char **argv) {}


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

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

LLVM IR (-O0):
define void @metil_mpi_init(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret void
}

LLVM IR (-O2):
define void @metil_mpi_init(i32 %0, i8** nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memmove(char *, char const *, size_t);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, size_t);
size_t strnlen(char const *, size_t);
char *strnmove(char *whither, const char *whence, size_t maxlen) {
  size_t n = strnlen(whence, maxlen);
  memmove(whither, whence, n);
  memset(whither + n, 0, maxlen - n);
  return whither;
}


x86 assembly (clang, -O0):
<strnmove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strnlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <memmove@plt>
mov    -0x8(%rbp),%rdi
add    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
sub    -0x20(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnmove>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <strnlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1050 <memmove@plt>
lea    (%r15,%rbx,1),%rdi
sub    %rbx,%r12
xor    %esi,%esi
mov    %r12,%rdx
call   1030 <memset@plt>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strnmove(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i64 @strnlen(i8* %8, i64 %9)
store i64 %10, i64* %7
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = load i64, i64* %7
%14 = call i32 @memmove(i8* %11, i8* %12, i64 %13)
%15 = load i8*, i8** %4
%16 = load i64, i64* %7
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i64, i64* %6
%19 = load i64, i64* %7
%20 = sub i64 %18, %19
%21 = call i32 @memset(i8* %17, i32 0, i64 %20)
%22 = load i8*, i8** %4
ret i8* %22
}

LLVM IR (-O2):
define i8* @strnmove(i8* returned %0, i8* %1, i64 %2) {
%4 = tail call i64 @strnlen(i8* %1, i64 %2)
%5 = tail call i32 @memmove(i8* %0, i8* %1, i64 %4)
%6 = getelementptr inbounds i8, i8* %0, i64 %4
%7 = sub i64 %2, %4
%8 = tail call i32 @memset(i8* %6, i32 0, i64 %7)
ret i8* %0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void wbe16(uint8_t *p, uint16_t v) {
  p[0] = v >> 8;
  p[1] = v & 0xff;
}


x86 assembly (clang, -O0):
<wbe16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<wbe16>:
movzbl %sil,%eax
sar    $0x8,%esi
mov    %esi,(%rdi)
mov    %eax,0x4(%rdi)
ret

LLVM IR (-O0):
define void @wbe16(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 8
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %6, i32* %8
%9 = load i32, i32* %4
%10 = and i32 %9, 255
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 1
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
define void @wbe16(i32* nocapture writeonly %0, i32 %1) {
%3 = ashr i32 %1, 8
store i32 %3, i32* %0
%4 = and i32 %1, 255
%5 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %4, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, unsigned long, char **,
                           double);
int profile_wrapper_printf(void *args) {
  char buf[256];
  sprintf(buf, "%s %ld %p %f\n", "bidon", (unsigned long)&buf, &buf, 3.1416);
  return 0;
}


x86 assembly (clang, -O0):
<profile_wrapper_printf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
lea    -0x110(%rbp),%rcx
lea    -0x110(%rbp),%r8
lea    0xecd(%rip),%rsi
lea    0xed4(%rip),%rdx
movsd  0xeb6(%rip),%xmm0
call   1030 <sprintf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<profile_wrapper_printf>:
sub    $0x108,%rsp
lea    0xeea(%rip),%rsi
lea    0xef1(%rip),%rdx
mov    %rsp,%rcx
movsd  0xed0(%rip),%xmm0
mov    %rcx,%rdi
mov    %rcx,%r8
call   1030 <sprintf@plt>
xor    %eax,%eax
add    $0x108,%rsp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%s %ld %p %f\0A\00"
@.str.1 = [6 x i8] c"bidon\00"
define i32 @profile_wrapper_printf(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = ptrtoint [256 x i8]* %3 to i64
%6 = bitcast [256 x i8]* %3 to i8**
%7 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %5, i8** %6, double 3.141600e+00)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s %ld %p %f\0A\00"
@.str.1 = [6 x i8] c"bidon\00"
define i32 @profile_wrapper_printf(i8* nocapture readnone %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = ptrtoint [256 x i8]* %2 to i64
%5 = bitcast [256 x i8]* %2 to i8**
%6 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %4, i8** %5, double 3.141600e+00)
ret i32 0
}
unsigned long pointerHashFunction(const void *pointer) {
  return ((unsigned long)pointer) >> 4;
}


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

x86 assembly (clang, -O2):
<pointerHashFunction>:
mov    %rdi,%rax
shr    $0x4,%rax
ret

LLVM IR (-O0):
define i64 @pointerHashFunction(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = lshr i64 %4, 4
ret i64 %5
}

LLVM IR (-O2):
define i64 @pointerHashFunction(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = lshr i64 %2, 4
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ shellsort(int *, int);
int main(void) {
  int v[] = {5, 1, 0, 9, 8, 2, 7, 2, 4, 2, 5, 1, 0, 9, 8, 2, 7, 2, 4, 2};
  shellsort(v, 20);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x50(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x50,%edx
call   1030 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    $0x14,%esi
call   1040 <shellsort@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
movaps 0xf25(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xf09(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeed(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x14,%esi
call   1030 <shellsort@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@__const.main.v = [20 x i32] [i32 5, i32 1, i32 0, i32 9, i32 8, i32 2, i32 7, i32 2, i32 4, i32 2, i32 5, i32 1, i32 0, i32 9, i32 8, i32 2, i32 7, i32 2, i32 4, i32 2]
define i32 @main() {
%1 = alloca [20 x i32]
%2 = bitcast [20 x i32]* %1 to i8*
%3 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%4 = call i32 @shellsort(i32* %3, i32 20)
ret i32 0
}

LLVM IR (-O2):
@__const.main.v = [20 x i32] [i32 5, i32 1, i32 0, i32 9, i32 8, i32 2, i32 7, i32 2, i32 4, i32 2, i32 5, i32 1, i32 0, i32 9, i32 8, i32 2, i32 7, i32 2, i32 4, i32 2]
define i32 @main() {
%1 = alloca [20 x i32]
%2 = bitcast [20 x i32]* %1 to i8*
%3 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%4 = call i32 @shellsort(i32* %3, i32 20)
ret i32 0
}
/* Type definitions */
typedef union OutputStreamInfo {
  int dummy;
} OutputStreamInfo;

/* Variables and functions */
int /*<<< orphan*/ putchar(unsigned char);
void PlatformPutc(unsigned char OutCh, union OutputStreamInfo *Stream) {
  putchar(OutCh);
}


x86 assembly (clang, -O0):
<PlatformPutc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PlatformPutc>:
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%union.OutputStreamInfo = type { i32 }
define void @PlatformPutc(i8 zeroext %0, %union.OutputStreamInfo* %1) {
%3 = alloca i8
%4 = alloca %union.OutputStreamInfo*
store i8 %0, i8* %3
store %union.OutputStreamInfo* %1, %union.OutputStreamInfo** %4
%5 = load i8, i8* %3
%6 = call i32 @putchar(i8 zeroext %5)
ret void
}

LLVM IR (-O2):
%union.OutputStreamInfo = type { i32 }
define void @PlatformPutc(i8 zeroext %0, %union.OutputStreamInfo* nocapture readnone %1) {
%3 = tail call i32 @putchar(i8 zeroext %0)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int int32_t;

/* Variables and functions */
int32_t get_32bitLE(uint8_t *p) {
  return (p[0]) | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
}


x86 assembly (clang, -O0):
<get_32bitLE>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0xc(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_32bitLE>:
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%edx
shl    $0x8,%ecx
or     (%rdi),%ecx
shl    $0x10,%edx
mov    0xc(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @get_32bitLE(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %7
%9 = shl i32 %8, 8
%10 = or i32 %5, %9
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 2
%13 = load i32, i32* %12
%14 = shl i32 %13, 16
%15 = or i32 %10, %14
%16 = load i32*, i32** %2
%17 = getelementptr inbounds i32, i32* %16, i64 3
%18 = load i32, i32* %17
%19 = shl i32 %18, 24
%20 = or i32 %15, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @get_32bitLE(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
%6 = or i32 %5, %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = shl i32 %8, 16
%10 = or i32 %6, %9
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %11
%13 = shl i32 %12, 24
%14 = or i32 %10, %13
ret i32 %14
}
int choose_ppc(int log2_page_size, int max) {
  const int max_meta = (1 << log2_page_size) - 16 - 4;
  int total_meta = 132;
  int ppc = 1;
  while (ppc < max) {
    total_meta <<= 1;
    total_meta += 132;
    if (total_meta > max_meta)
      break;
    ppc++;
  }
  return ppc;
}


x86 assembly (clang, -O0):
<choose_ppc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x10,%eax
sub    $0x4,%eax
mov    %eax,-0xc(%rbp)
movl   $0x84,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    116a <choose_ppc+0x6a>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x84,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    115c <choose_ppc+0x5c>
jmp    116a <choose_ppc+0x6a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <choose_ppc+0x2b>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<choose_ppc>:
mov    %edi,%ecx
mov    $0x1,%eax
mov    $0x1,%edx
shl    %cl,%edx
cmp    $0x2,%esi
jl     1135 <choose_ppc+0x35>
add    $0xffffffec,%edx
mov    $0x84,%ecx
mov    $0x1,%eax
add    %ecx,%ecx
add    $0x84,%ecx
cmp    %edx,%ecx
jg     1135 <choose_ppc+0x35>
add    $0x1,%eax
cmp    %eax,%esi
jne    1120 <choose_ppc+0x20>
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @choose_ppc(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %0
%4 = add nsw i32 %3, -20
%5 = icmp sgt i32 %1, 1
br i1 %5, label %6, label %15
6: ; preds = %2, %12
%7 = phi i32 [ %13, %12 ], [ 1, %2 ]
%8 = phi i32 [ %10, %12 ], [ 132, %2 ]
%9 = shl i32 %8, 1
%10 = add nsw i32 %9, 132
%11 = icmp sgt i32 %10, %4
br i1 %11, label %15, label %12
12: ; preds = %6
%13 = add nuw nsw i32 %7, 1
%14 = icmp eq i32 %13, %1
br i1 %14, label %15, label %6
15: ; preds = %12, %6, %2
%16 = phi i32 [ 1, %2 ], [ %7, %6 ], [ %1, %12 ]
ret i32 %16
}
int main() {
  int array[1000];
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf30,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
add    $0xf30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i32]
store i32 0, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ seekdir(int /*<<< orphan*/ *, int /*<<< orphan*/);
void rewinddir(DIR *dir) { seekdir(dir, 0); }


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

x86 assembly (clang, -O2):
<rewinddir>:
xor    %esi,%esi
jmp    1030 <seekdir@plt>

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

LLVM IR (-O2):
define void @rewinddir(i32* %0) {
%2 = tail call i32 @seekdir(i32* %0, i32 0)
ret void
}
/* Variables and functions */
double effective_sample_size(double const *, int const);
double ln_argmin_asymptotic_parametrised(double, double);
double weighted_log_std(double const *, double const *, int const);
double ln_argmin_asymptotic(const double *data, const double *weight,
                            const int n) {
  double Sigma = weighted_log_std(data, weight, n);
  double neff = effective_sample_size(weight, n);
  return ln_argmin_asymptotic_parametrised(Sigma, neff);
}


x86 assembly (clang, -O0):
<ln_argmin_asymptotic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <weighted_log_std@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <effective_sample_size@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1040 <ln_argmin_asymptotic_parametrised@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_argmin_asymptotic>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1030 <weighted_log_std@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <effective_sample_size@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <ln_argmin_asymptotic_parametrised@plt>

LLVM IR (-O0):
define double @ln_argmin_asymptotic(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%9 = load double*, double** %4
%10 = load double*, double** %5
%11 = load i32, i32* %6
%12 = call double @weighted_log_std(double* %9, double* %10, i32 %11)
store double %12, double* %7
%13 = load double*, double** %5
%14 = load i32, i32* %6
%15 = call double @effective_sample_size(double* %13, i32 %14)
store double %15, double* %8
%16 = load double, double* %7
%17 = load double, double* %8
%18 = call double @ln_argmin_asymptotic_parametrised(double %16, double %17)
ret double %18
}

LLVM IR (-O2):
define double @ln_argmin_asymptotic(double* %0, double* %1, i32 %2) {
%4 = tail call double @weighted_log_std(double* %0, double* %1, i32 %2)
%5 = tail call double @effective_sample_size(double* %1, i32 %2)
%6 = tail call double @ln_argmin_asymptotic_parametrised(double %4, double %5)
ret double %6
}