xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ sprintf(char **, char *, char const *, char const *);
const char *concat(const char *str1, const char *str2) {
  char *result;
  sprintf(&result, "%s%s", str1, str2);
  return result;
}


x86 assembly (clang, -O0):
<concat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    -0x18(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concat>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xee2(%rip),%rsi
mov    %rsp,%rdi
call   1030 <sprintf@plt>
mov    (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
define i8* @concat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @sprintf(i8** %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = load i8*, i8** %3
ret i8* %6
}
/* Variables and functions */
double itof(char *);
int /*<<< orphan*/ printf(char *, double);
int main() {
  char *s = "-123.54";
  printf("%f\n", itof(s));
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"-123.54\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = call double @itof(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"-123.54\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call double @itof(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %1)
ret i32 0
}
/* Type definitions */
typedef unsigned long uint32_t;
typedef int int32_t;

/* Variables and functions */
int32_t SSIDataGetNonBlocking(uint32_t ui32Base, uint32_t *pui32Data) {
  ;
  if ((*((volatile unsigned long *)(ui32Base + 0x0000000C))) & 0x00000004) {
    *pui32Data = (*((volatile unsigned long *)(ui32Base + 0x00000008)));
    return (1);
  } else {
    return (0);
  }
}


x86 assembly (clang, -O0):
<SSIDataGetNonBlocking>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%rax
and    $0x4,%rax
cmp    $0x0,%rax
je     113d <SSIDataGetNonBlocking+0x3d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1144 <SSIDataGetNonBlocking+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIDataGetNonBlocking>:
xor    %eax,%eax
testq  $0x4,0xc(%rdi)
je     1118 <SSIDataGetNonBlocking+0x18>
mov    0x8(%rdi),%rax
mov    %rax,(%rsi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @SSIDataGetNonBlocking(i64 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64*
store i64 %0, i64* %4
store i64* %1, i64** %5
%6 = load i64, i64* %4
%7 = add i64 %6, 12
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, 4
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i64, i64* %4
%14 = add i64 %13, 8
%15 = inttoptr i64 %14 to i64*
%16 = load volatile i64, i64* %15
%17 = load i64*, i64** %5
store i64 %16, i64* %17
store i32 1, i32* %3
br label %19
18: ; preds = %2
store i32 0, i32* %3
br label %19
19: ; preds = %18, %12
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @SSIDataGetNonBlocking(i64 %0, i64* nocapture writeonly %1) {
%3 = add i64 %0, 12
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = and i64 %5, 4
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = add i64 %0, 8
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
store i64 %11, i64* %1
br label %12
12: ; preds = %2, %8
%13 = phi i32 [ 1, %8 ], [ 0, %2 ]
ret i32 %13
}
/* Variables and functions */
scalar_t__ random();
double rand01() {
  double randnum;
  randnum = (double)random();
  randnum /= (double)((unsigned long)0xffffffff) + 1;
  return randnum;
}


x86 assembly (clang, -O0):
<rand01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <random@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeca(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand01>:
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
cvtsi2sd %rax,%xmm0
mulsd  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rand01() {
%1 = alloca double
%2 = call i64 (...) @random()
%3 = sitofp i64 %2 to double
store double %3, double* %1
%4 = load double, double* %1
%5 = fdiv double %4, 0x41F0000000000000
store double %5, double* %1
%6 = load double, double* %1
ret double %6
}

LLVM IR (-O2):
define double @rand01() {
%1 = tail call i64 (...) @random()
%2 = sitofp i64 %1 to double
%3 = fmul double %2, 0x3DF0000000000000
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ path_basename(char *);
scalar_t__ strrchr(int /*<<< orphan*/, char);
char *path_remove_extension(char *path) {
  char *last = (char *)strrchr(path_basename(path), '.');
  if (*last)
    *last = '\0';
  return last;
}


x86 assembly (clang, -O0):
<path_remove_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <path_basename@plt>
mov    %eax,%edi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1159 <path_remove_extension+0x39>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_remove_extension>:
push   %rax
call   1030 <path_basename@plt>
mov    %eax,%edi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
cmpb   $0x0,(%rax)
je     113a <path_remove_extension+0x1a>
movb   $0x0,(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define i8* @path_remove_extension(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @path_basename(i8* %4)
%6 = call i64 @strrchr(i32 %5, i8 signext 46)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load i8*, i8** %3
store i8 0, i8* %12
br label %13
13: ; preds = %11, %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @path_remove_extension(i8* %0) {
%2 = tail call i32 @path_basename(i8* %0)
%3 = tail call i64 @strrchr(i32 %2, i8 signext 46)
%4 = inttoptr i64 %3 to i8*
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i8 0, i8* %4
br label %8
8: ; preds = %7, %1
ret i8* %4
}
void gdk_window_lower() {}


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

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

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

LLVM IR (-O2):
define void @gdk_window_lower() {
ret void
}
foo(int x, int y) { return x * y; }


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

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
int is_pmem_file(struct file *file) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.file = type opaque
define i32 @is_pmem_file(%struct.file* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int spcspxe(char const *, double, double, double, char *, char *, int *,
            double *, double *, int);
int spcspx(const char ctypeS[9], double crvalS, double restfrq, double restwav,
           char *ptype, char *xtype, int *restreq, double *crvalX,
           double *dXdS) {
  return spcspxe(ctypeS, crvalS, restfrq, restwav, ptype, xtype, restreq,
                 crvalX, dXdS, 0x0);
}


x86 assembly (clang, -O0):
<spcspx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x48(%rbp),%r9
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1030 <spcspxe@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spcspx>:
push   %rax
movl   $0x0,(%rsp)
call   1030 <spcspxe@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @spcspx(i8* %0, double %1, double %2, double %3, i8* %4, i8* %5, i32* %6, double* %7, double* %8) {
%10 = tail call i32 @spcspxe(i8* %0, double %1, double %2, double %3, i8* %4, i8* %5, i32* %6, double* %7, double* %8, i32 0)
ret i32 %10
}
/* Type definitions */
typedef int int64_t;
typedef int int32_t;

/* Variables and functions */
int sdiv64(int, int);
int32_t smod64(int64_t n, int64_t d) { return n - d * sdiv64(n, d); }


x86 assembly (clang, -O0):
<smod64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <sdiv64@plt>
mov    -0x10(%rbp),%ecx
mov    %eax,%edx
mov    -0xc(%rbp),%eax
imul   %edx,%ecx
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smod64>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <sdiv64@plt>
imul   %ebx,%eax
sub    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @smod64(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @sdiv64(i32 %7, i32 %8)
%10 = mul nsw i32 %6, %9
%11 = sub nsw i32 %5, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @smod64(i32 %0, i32 %1) {
%3 = tail call i32 @sdiv64(i32 %0, i32 %1)
%4 = mul nsw i32 %3, %1
%5 = sub nsw i32 %0, %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int readl(int /*<<< orphan*/);
int /*<<< orphan*/ writel(int, int /*<<< orphan*/);
void icodec_mapped_reg_set(uint32_t xreg, int xmask, int xval) {
  int val = readl(xreg);
  val &= ~(xmask);
  val |= xval;
  writel(val, xreg);
}


x86 assembly (clang, -O0):
<icodec_mapped_reg_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <readl@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <writel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<icodec_mapped_reg_set>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
call   1030 <readl@plt>
not    %ebp
and    %eax,%ebp
or     %r14d,%ebp
mov    %ebp,%edi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <writel@plt>

LLVM IR (-O0):
define void @icodec_mapped_reg_set(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = call i32 @readl(i32 %8)
store i32 %9, i32* %7
%10 = load i32, i32* %5
%11 = xor i32 %10, -1
%12 = load i32, i32* %7
%13 = and i32 %12, %11
store i32 %13, i32* %7
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = or i32 %15, %14
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = load i32, i32* %4
%19 = call i32 @writel(i32 %17, i32 %18)
ret void
}

LLVM IR (-O2):
define void @icodec_mapped_reg_set(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @readl(i32 %0)
%5 = xor i32 %1, -1
%6 = and i32 %4, %5
%7 = or i32 %6, %2
%8 = tail call i32 @writel(i32 %7, i32 %0)
ret void
}
int test2u(unsigned char x) { return x / 100 != 3; }


x86 assembly (clang, -O0):
<test2u>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x3,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test2u(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = sdiv i32 %4, 100
%6 = icmp ne i32 %5, 3
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @test2u(i8 zeroext %0) {
ret i32 1
}
void nseel_asm_sub(void) { __asm__("fsubr\n"); }


x86 assembly (clang, -O0):
<nseel_asm_sub>:
push   %rbp
mov    %rsp,%rbp
fsubrp %st,%st(1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nseel_asm_sub>:
fsubrp %st,%st(1)
ret

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

LLVM IR (-O2):
define void @nseel_asm_sub() {
tail call void asm sideeffect "fsubr\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
void *yac_allocator_raw_alloc(unsigned long, int);
unsigned long yac_allocator_real_size(unsigned long);
void *yac_allocator_alloc(unsigned long size, int seg) {
  unsigned long real_size = yac_allocator_real_size(size);
  if (!real_size) {
    return (void *)0;
  }
  return yac_allocator_raw_alloc(real_size, seg);
}


x86 assembly (clang, -O0):
<yac_allocator_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <yac_allocator_real_size@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1154 <yac_allocator_alloc+0x34>
movq   $0x0,-0x8(%rbp)
jmp    1164 <yac_allocator_alloc+0x44>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <yac_allocator_raw_alloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yac_allocator_alloc>:
push   %rbx
mov    %esi,%ebx
call   1040 <yac_allocator_real_size@plt>
test   %rax,%rax
je     1138 <yac_allocator_alloc+0x18>
mov    %rax,%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <yac_allocator_raw_alloc@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @yac_allocator_alloc(i64 %0, i32 %1) {
%3 = tail call i64 @yac_allocator_real_size(i64 %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i8* @yac_allocator_raw_alloc(i64 %3, i32 %1)
br label %7
7: ; preds = %2, %5
%8 = phi i8* [ %6, %5 ], [ null, %2 ]
ret i8* %8
}
int my_function() { return 3; }


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

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

LLVM IR (-O0):
define i32 @my_function() {
ret i32 3
}

LLVM IR (-O2):
define i32 @my_function() {
ret i32 3
}
void log_write(char *pBuf) {}


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

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

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

LLVM IR (-O2):
define void @log_write(i8* nocapture %0) {
ret void
}
int s3c64xx_pm_late_initcall(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @s3c64xx_pm_late_initcall() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void version() {
  printf("sbfi - simple brainfuck interpreter\n");
  printf("(c) 2015 Bernd Busse v0.3\n");
}


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

x86 assembly (clang, -O2):
<version>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf00(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"sbfi - simple brainfuck interpreter\0A\00"
@.str.1 = [27 x i8] c"(c) 2015 Bernd Busse v0.3\0A\00"
define void @version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"sbfi - simple brainfuck interpreter\00"
@str.2 = [26 x i8] c"(c) 2015 Bernd Busse v0.3\00"
define void @version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
struct jhlist_node_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ INIT_HLIST_NODE(struct jhlist_node_s *);
int /*<<< orphan*/ __hlist_del(struct jhlist_node_s *);
int /*<<< orphan*/ hlist_unhashed(struct jhlist_node_s *);
void hlist_del_init(struct jhlist_node_s *n) {
  if (!hlist_unhashed(n)) {
    __hlist_del(n);
    INIT_HLIST_NODE(n);
  }
}


x86 assembly (clang, -O0):
<hlist_del_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <hlist_unhashed@plt>
cmp    $0x0,%eax
jne    1160 <hlist_del_init+0x30>
mov    -0x8(%rbp),%rdi
call   1050 <__hlist_del@plt>
mov    -0x8(%rbp),%rdi
call   1040 <INIT_HLIST_NODE@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hlist_del_init>:
push   %rbx
mov    %rdi,%rbx
call   1030 <hlist_unhashed@plt>
test   %eax,%eax
je     113f <hlist_del_init+0xf>
pop    %rbx
ret
mov    %rbx,%rdi
call   1050 <__hlist_del@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <INIT_HLIST_NODE@plt>

LLVM IR (-O0):
%struct.jhlist_node_s = type { i32 }
define void @hlist_del_init(%struct.jhlist_node_s* %0) {
%2 = alloca %struct.jhlist_node_s*
store %struct.jhlist_node_s* %0, %struct.jhlist_node_s** %2
%3 = load %struct.jhlist_node_s*, %struct.jhlist_node_s** %2
%4 = call i32 @hlist_unhashed(%struct.jhlist_node_s* %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = load %struct.jhlist_node_s*, %struct.jhlist_node_s** %2
%8 = call i32 @__hlist_del(%struct.jhlist_node_s* %7)
%9 = load %struct.jhlist_node_s*, %struct.jhlist_node_s** %2
%10 = call i32 @INIT_HLIST_NODE(%struct.jhlist_node_s* %9)
br label %11
11: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
%struct.jhlist_node_s = type { i32 }
define void @hlist_del_init(%struct.jhlist_node_s* %0) {
%2 = tail call i32 @hlist_unhashed(%struct.jhlist_node_s* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @__hlist_del(%struct.jhlist_node_s* %0)
%6 = tail call i32 @INIT_HLIST_NODE(%struct.jhlist_node_s* %0)
br label %7
7: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init_debug_axes();
int /*<<< orphan*/ init_debug_grid();
void init_debug(void) {
  init_debug_axes();
  init_debug_grid();
  return;
}


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

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

LLVM IR (-O0):
define void @init_debug() {
%1 = call i32 (...) @init_debug_axes()
%2 = call i32 (...) @init_debug_grid()
ret void
}

LLVM IR (-O2):
define void @init_debug() {
%1 = tail call i32 (...) @init_debug_axes()
%2 = tail call i32 (...) @init_debug_grid()
ret void
}
const char *zlibVersion() { return "1.2.4"; }


x86 assembly (clang, -O0):
<zlibVersion>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zlibVersion>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"1.2.4\00"
define i8* @zlibVersion() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"1.2.4\00"
define i8* @zlibVersion() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct timespec {
  int /*<<< orphan*/ tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ futimens(int /*<<< orphan*/, struct timespec *);
int main(void) {
  struct timespec foo[2] = {{.tv_sec = 0, .tv_nsec = 0},
                            {.tv_sec = 0, .tv_nsec = 0}};
  futimens(0, foo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
lea    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1040 <futimens@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
xor    %edi,%edi
call   1030 <futimens@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x %struct.timespec]
store i32 0, i32* %1
%3 = bitcast [2 x %struct.timespec]* %2 to i8*
%4 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %2, i64 0, i64 0
%5 = call i32 @futimens(i32 0, %struct.timespec* %4)
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
define i32 @main() {
%1 = alloca [2 x %struct.timespec]
%2 = bitcast [2 x %struct.timespec]* %1 to i8*
%3 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %1, i64 0, i64 0
%4 = call i32 @futimens(i32 0, %struct.timespec* %3)
ret i32 0
}
void SAI1_IRQHandler() {}


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

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

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

LLVM IR (-O2):
define void @SAI1_IRQHandler() {
ret void
}
const char *FilterName(void *arg) {
  (void)arg;
  return "TestFilter";
}


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

x86 assembly (clang, -O2):
<FilterName>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"TestFilter\00"
define i8* @FilterName(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [11 x i8] c"TestFilter\00"
define i8* @FilterName(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}
double lerp(double t, double a, double b) { return a + t * (b - a); }


x86 assembly (clang, -O0):
<lerp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
subsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lerp>:
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @lerp(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %5
%8 = load double, double* %4
%9 = load double, double* %6
%10 = load double, double* %5
%11 = fsub double %9, %10
%12 = call double @llvm.fmuladd.f64(double %8, double %11, double %7)
ret double %12
}

LLVM IR (-O2):
define double @lerp(double %0, double %1, double %2) {
%4 = fsub double %2, %1
%5 = tail call double @llvm.fmuladd.f64(double %0, double %4, double %1)
ret double %5
}
void foo440(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo440(i32 %0) {
ret void
}
int ft_isprint(int c) { return (0x20 <= c && c <= 0x7E); }


x86 assembly (clang, -O0):
<ft_isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    $0x20,%ecx
cmp    -0x4(%rbp),%ecx
mov    %al,-0x5(%rbp)
jg     1124 <ft_isprint+0x24>
cmpl   $0x7e,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isprint>:
add    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x5f,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isprint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 32, %3
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 126
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @ft_isprint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
__attribute__((always_)) unsigned long pages_to_mb(unsigned long npg) {
  return npg >> (20 - 12);
}


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

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

LLVM IR (-O0):
define i64 @pages_to_mb(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 8
ret i64 %4
}

LLVM IR (-O2):
define i64 @pages_to_mb(i64 %0) {
%2 = lshr i64 %0, 8
ret i64 %2
}
unsigned int gcc_current_sp(void) {
  register unsigned sp asm("sp");
  return sp;
}


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

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

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

LLVM IR (-O2):
define i32 @gcc_current_sp() {
ret i32 undef
}
void _exit(int code) {
  while (1) {
    ;
  }
}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <_exit+0x7>

x86 assembly (clang, -O2):
<_exit>:
jmp    1100 <_exit>

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1, %3
br label %3
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
br label %2
2: ; preds = %1, %2
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ menu(int);
int /*<<< orphan*/ startpump(char *);
int main() {
  startpump("For assistance, call (800) BAD-PUMP");
  menu(1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <startpump@plt>
mov    $0x1,%edi
call   1030 <menu@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <startpump@plt>
mov    $0x1,%edi
call   1030 <menu@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"For assistance, call (800) BAD-PUMP\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @startpump(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @menu(i32 1)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"For assistance, call (800) BAD-PUMP\00"
define i32 @main() {
%1 = tail call i32 @startpump(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @menu(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gpio_output(int, int, int /*<<< orphan*/);
void led_off(void) { gpio_output(9, 10, 0); }


x86 assembly (clang, -O0):
<led_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9,%edi
mov    $0xa,%esi
xor    %edx,%edx
call   1030 <gpio_output@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_off>:
mov    $0x9,%edi
mov    $0xa,%esi
xor    %edx,%edx
jmp    1030 <gpio_output@plt>

LLVM IR (-O0):
define void @led_off() {
%1 = call i32 @gpio_output(i32 9, i32 10, i32 0)
ret void
}

LLVM IR (-O2):
define void @led_off() {
%1 = tail call i32 @gpio_output(i32 9, i32 10, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_p256_mul(uintptr_t, uintptr_t, uintptr_t);
void fiat_p256_mul(uint32_t out1[8], const uint32_t arg1[8],
                   const uint32_t arg2[8]) {
  internal_fiat_p256_mul((uintptr_t)out1, (uintptr_t)arg1, (uintptr_t)arg2);
}


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

x86 assembly (clang, -O2):
<fiat_p256_mul>:
jmp    1030 <internal_fiat_p256_mul@plt>

LLVM IR (-O0):
define void @fiat_p256_mul(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = load i32*, i32** %5
%10 = ptrtoint i32* %9 to i64
%11 = load i32*, i32** %6
%12 = ptrtoint i32* %11 to i64
%13 = call i32 @internal_fiat_p256_mul(i64 %8, i64 %10, i64 %12)
ret void
}

LLVM IR (-O2):
define void @fiat_p256_mul(i32* %0, i32* %1, i32* %2) {
%4 = ptrtoint i32* %0 to i64
%5 = ptrtoint i32* %1 to i64
%6 = ptrtoint i32* %2 to i64
%7 = tail call i32 @internal_fiat_p256_mul(i64 %4, i64 %5, i64 %6)
ret void
}
int DRV_NVBACKUP_WRITE(unsigned char *pRamAddr, unsigned int len) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @DRV_NVBACKUP_WRITE(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
unsigned long add_ul(unsigned long a, unsigned long b) { return a + b; }


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

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

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

LLVM IR (-O2):
define i64 @add_ul(i64 %0, i64 %1) {
%3 = add i64 %1, %0
ret i64 %3
}
int dbl_cmp(const void *a, const void *b) {
  const double *da = (const double *)a;
  const double *db = (const double *)b;
  if (*da > *db)
    return 1;
  else if (*da < *db)
    return -1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<dbl_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    113e <dbl_cmp+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    116b <dbl_cmp+0x6b>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1164 <dbl_cmp+0x64>
movl   $0xffffffff,-0x4(%rbp)
jmp    116b <dbl_cmp+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbl_cmp>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
neg    %ecx
ucomisd %xmm1,%xmm0
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @dbl_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = bitcast i8* %1 to double*
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ogt double %5, %6
%8 = fcmp olt double %5, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
int test_imm_3Dint8_mem(signed char *val) {
  return ((*val) & (-0x3D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_3Dint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xffffffc3,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_3Dint8_mem>:
testb  $0xc3,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_3Dint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -61
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double lte_double(double a, double b) { return a <= b; }


x86 assembly (clang, -O0):
<lte_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lte_double>:
cmplesd %xmm1,%xmm0
movsd  0xef3(%rip),%xmm1
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @lte_double(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ole double %5, %6
%8 = zext i1 %7 to i32
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @lte_double(double %0, double %1) {
%3 = fcmp ole double %0, %1
%4 = uitofp i1 %3 to double
ret double %4
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int dobldobl_trace_sum_difference(int n, int *f, double *d) {
  int fail;
  fail = _ada_use_c2phc(647, &n, f, d);
  return fail;
}


x86 assembly (clang, -O0):
<dobldobl_trace_sum_difference>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x287,%edi
lea    -0x4(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dobldobl_trace_sum_difference>:
push   %rax
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x287,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @dobldobl_trace_sum_difference(i32 %0, i32* %1, double* %2) {
%4 = alloca i32
store i32 %0, i32* %4
%5 = call i32 @_ada_use_c2phc(i32 647, i32* %4, i32* %1, double* %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setJump2();
void setJump() {
  printf("Entered setJump()\n");
  setJump2();
  printf("Exiting setJump()\n");
}


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

x86 assembly (clang, -O2):
<setJump>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <setJump2@plt>
lea    0xed7(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [18 x i8] c"Entered setJump()\00"
@str.2 = [18 x i8] c"Exiting setJump()\00"
define void @setJump() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @setJump2()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
main() { f(1); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @f(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printArr(int *arr, int n) {
  int i;
  for (i = 0; i < n; i++) {
    printf("%d ", arr[i]);
  }
}


x86 assembly (clang, -O0):
<printArr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <printArr+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArr+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <printArr+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <printArr+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @printArr(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @printArr(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
char readChar(unsigned char **pptr) {
  char c = **pptr;
  (*pptr)++;
  return c;
}


x86 assembly (clang, -O0):
<readChar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movsbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readChar>:
mov    (%rdi),%rcx
mov    (%rcx),%al
add    $0x1,%rcx
mov    %rcx,(%rdi)
ret

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

LLVM IR (-O2):
define signext i8 @readChar(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %4, i8** %0
ret i8 %3
}
void noop_rcv_add_span(struct htrace_rcv *rcv, struct htrace_span *span) {}


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

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

LLVM IR (-O0):
%struct.htrace_rcv = type opaque
%struct.htrace_span = type opaque
define void @noop_rcv_add_span(%struct.htrace_rcv* %0, %struct.htrace_span* %1) {
%3 = alloca %struct.htrace_rcv*
%4 = alloca %struct.htrace_span*
store %struct.htrace_rcv* %0, %struct.htrace_rcv** %3
store %struct.htrace_span* %1, %struct.htrace_span** %4
ret void
}

LLVM IR (-O2):
%struct.htrace_rcv = type opaque
%struct.htrace_span = type opaque
define void @noop_rcv_add_span(%struct.htrace_rcv* nocapture %0, %struct.htrace_span* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ VirtualizeTimerC__0__Timer__stop(unsigned int);
void TrickleTimerImplP__0__Timer__stop(void) {
  VirtualizeTimerC__0__Timer__stop(1U);
}


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

x86 assembly (clang, -O2):
<TrickleTimerImplP__0__Timer__stop>:
mov    $0x1,%edi
jmp    1030 <VirtualizeTimerC__0__Timer__stop@plt>

LLVM IR (-O0):
define void @TrickleTimerImplP__0__Timer__stop() {
%1 = call i32 @VirtualizeTimerC__0__Timer__stop(i32 1)
ret void
}

LLVM IR (-O2):
define void @TrickleTimerImplP__0__Timer__stop() {
%1 = tail call i32 @VirtualizeTimerC__0__Timer__stop(i32 1)
ret void
}
void dd_pbl_ios_fb_logout() {}


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

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

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

LLVM IR (-O2):
define void @dd_pbl_ios_fb_logout() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, unsigned int);
void vSetZero(unsigned char *psA, unsigned int uiLen) { memset(psA, 0, uiLen); }


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

x86 assembly (clang, -O2):
<vSetZero>:
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @vSetZero(i8* %0, i32 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
ret void
}