xunge/DecIR huggingface dataset:
double func2(double x, double y) { return x * x + y * y; }


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

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

LLVM IR (-O0):
define double @func2(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* %3
%7 = load double, double* %4
%8 = load double, double* %4
%9 = fmul double %7, %8
%10 = call double @llvm.fmuladd.f64(double %5, double %6, double %9)
ret double %10
}

LLVM IR (-O2):
define double @func2(double %0, double %1) {
%3 = fmul double %1, %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %3)
ret double %4
}
int __default_sigpause(mask)
long mask;
{ return __sigpause(mask, 0); }


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

x86 assembly (clang, -O2):
<__default_sigpause>:
xor    %esi,%esi
xor    %eax,%eax
jmp    1030 <__sigpause@plt>

LLVM IR (-O0):
define i32 @__default_sigpause(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 (i64, i32, ...) bitcast (i32 (...)* @__sigpause to i32 (i64, i32, ...)*)(i64 %3, i32 0)
ret i32 %4
}

LLVM IR (-O2):
define i32 @__default_sigpause(i64 %0) {
%2 = tail call i32 (i64, i32, ...) bitcast (i32 (...)* @__sigpause to i32 (i64, i32, ...)*)(i64 %0, i32 0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ mc6809_disassemble(int /*<<< orphan*/, char *, size_t);
uint32_t dbg_disassemble(uint32_t addr, char *buf, size_t bufsize) {
  return mc6809_disassemble(addr, buf, bufsize);
}


x86 assembly (clang, -O0):
<dbg_disassemble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <mc6809_disassemble@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbg_disassemble>:
jmp    1030 <mc6809_disassemble@plt>

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

LLVM IR (-O2):
define i32 @dbg_disassemble(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @mc6809_disassemble(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
signed char compareInt(void *t1, void *t2) {
  int _t1 = *(int *)t1;
  int _t2 = *(int *)t2;
  if (_t1 < _t2)
    return -1;
  else if (_t1 > _t2)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<compareInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1133 <compareInt+0x33>
movb   $0xff,-0x1(%rbp)
jmp    114c <compareInt+0x4c>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1148 <compareInt+0x48>
movb   $0x1,-0x1(%rbp)
jmp    114c <compareInt+0x4c>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @compareInt(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = icmp sgt i32 %4, %6
%9 = zext i1 %8 to i8
%10 = select i1 %7, i8 -1, i8 %9
ret i8 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int creat(char const *, int /*<<< orphan*/);
__attribute__((__weak__, __always___)) int
softboundcets_creat(const char *pathname, mode_t mode) {
  return creat(pathname, mode);
}


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

x86 assembly (clang, -O2):
<softboundcets_creat>:
jmp    1030 <creat@plt>

LLVM IR (-O0):
define weak i32 @softboundcets_creat(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 @creat(i8* %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define weak i32 @softboundcets_creat(i8* %0, i32 %1) {
%3 = tail call i32 @creat(i8* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int MB = 0;
  while (malloc(1 << 20))
    ++MB;
  printf("Allocated %d MB total.\n", MB);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x100000,%edi
call   1040 <malloc@plt>
cmp    $0x0,%rax
je     1158 <main+0x38>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    -0x8(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x100000,%edi
call   1040 <malloc@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    1130 <main+0x10>
lea    0xeb7(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Allocated %d MB total.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %6, %0
%4 = call i64 @malloc(i32 1048576)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
br label %3
9: ; preds = %3
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Allocated %d MB total.\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = tail call i64 @malloc(i32 1048576)
%4 = icmp eq i64 %3, 0
%5 = add nuw nsw i32 %2, 1
br i1 %4, label %6, label %1
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
Jsetcursor(c) register c;
{
  register r;
  r = c / 80;
  VMove(r, c - r * 80);
}


x86 assembly (clang, -O0):
<Jsetcursor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x50,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
imul   $0x50,-0xc(%rbp),%eax
sub    %eax,%esi
mov    $0x0,%al
call   1030 <VMove@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Jsetcursor>:
movslq %edi,%rsi
imul   $0x66666667,%rsi,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x25,%rdi
add    %eax,%edi
mov    %edi,%eax
shl    $0x4,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
xor    %eax,%eax
jmp    1030 <VMove@plt>

LLVM IR (-O0):
define i32 @Jsetcursor(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = sdiv i32 %5, 80
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = mul nsw i32 %9, 80
%11 = sub nsw i32 %8, %10
%12 = call i32 (i32, i32, ...) bitcast (i32 (...)* @VMove to i32 (i32, i32, ...)*)(i32 %7, i32 %11)
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @Jsetcursor(i32 %0) {
%2 = sdiv i32 %0, 80
%3 = mul nsw i32 %2, -80
%4 = add i32 %3, %0
%5 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @VMove to i32 (i32, i32, ...)*)(i32 %2, i32 %4)
ret i32 undef
}
int CountUTF8String(char *s) {
  int i = 0, j = 0;
  while (s[i]) {
    if ((s[i] & 0xc0) != 0x80)
      j++;
    i++;
  }
  return j;
}


x86 assembly (clang, -O0):
<CountUTF8String>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     115b <CountUTF8String+0x5b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
je     114d <CountUTF8String+0x4d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <CountUTF8String+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CountUTF8String>:
mov    (%rdi),%cl
test   %cl,%cl
je     1129 <CountUTF8String+0x29>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
and    $0xc0,%cl
xor    %edx,%edx
cmp    $0x80,%cl
setne  %dl
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <CountUTF8String+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @CountUTF8String(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %12, %4 ], [ 0, %1 ]
%6 = phi i8 [ %14, %4 ], [ %2, %1 ]
%7 = phi i32 [ %11, %4 ], [ 0, %1 ]
%8 = and i8 %6, -64
%9 = icmp ne i8 %8, -128
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %7, %10
%12 = add nuw nsw i64 %5, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %4, %1
%17 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %17
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
char *asctime(struct tm *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t rawtime;
  struct tm *timeinfo;
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  printf("Current local time and date: %s", asctime(timeinfo));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1060 <time@plt>
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <asctime@plt>
mov    %rax,%rsi
lea    0xe88(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rdi
call   1040 <asctime@plt>
lea    0xe97(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [32 x i8] c"Current local time and date: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
store i32 0, i32* %1
%4 = call i32 @time(i32* %2)
%5 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %5, %struct.tm** %3
%6 = load %struct.tm*, %struct.tm** %3
%7 = call i8* @asctime(%struct.tm* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [32 x i8] c"Current local time and date: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i8* @asctime(%struct.tm* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *threadfunc(void *arg) {
  int *intptr = (int *)arg;
  while (1) {
    (*intptr)++;
    (*intptr)--;
    if ((*intptr) != 0) {
      printf("value is %d\n", *intptr);
      return NULL;
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<threadfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     1161 <threadfunc+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1124 <threadfunc+0x14>

x86 assembly (clang, -O2):
<threadfunc>:
push   %rax
mov    (%rdi),%esi
test   %esi,%esi
je     1130 <threadfunc+0x20>
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
nopw   0x0(%rax,%rax,1)
jmp    1130 <threadfunc+0x20>

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

LLVM IR (-O2):
@.str = [13 x i8] c"value is %d\0A\00"
define noalias i8* @threadfunc(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1, %5
br label %5
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* null
}
/* Variables and functions */
int f(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d", f(3));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @f(i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
unsigned long min(unsigned long a, unsigned long b) {
  if (a < b)
    return (a);
  return (b);
}


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1127 <min+0x27>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    112f <min+0x2f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovb  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @min(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
void foo(int a, int b) {}


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

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

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

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
void date() {
  printf("Today's date");
  system("/bin/date");
}


x86 assembly (clang, -O0):
<date>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
call   1030 <system@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<date>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
pop    %rax
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Today's date\00"
@.str.1 = [10 x i8] c"/bin/date\00"
define void @date() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Today's date\00"
@.str.1 = [10 x i8] c"/bin/date\00"
define void @date() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct dirent {
  char *d_name;
};

/* Variables and functions */
int proc_select(const struct dirent *entry) {
  if (entry->d_name[0] < '1')
    return (0);
  if (entry->d_name[0] > '9')
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<proc_select>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
jge    1127 <proc_select+0x27>
movl   $0x0,-0x4(%rbp)
jmp    114d <proc_select+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    1146 <proc_select+0x46>
movl   $0x0,-0x4(%rbp)
jmp    114d <proc_select+0x4d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc_select>:
mov    (%rdi),%rax
mov    (%rax),%cl
add    $0xcf,%cl
xor    %eax,%eax
cmp    $0x9,%cl
setb   %al
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
define i32 @proc_select(%struct.dirent* %0) {
%2 = alloca i32
%3 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %3
%4 = load %struct.dirent*, %struct.dirent** %3
%5 = getelementptr inbounds %struct.dirent, %struct.dirent* %4, i32 0, i32 0
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp slt i32 %9, 49
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %2
br label %22
12: ; preds = %1
%13 = load %struct.dirent*, %struct.dirent** %3
%14 = getelementptr inbounds %struct.dirent, %struct.dirent* %13, i32 0, i32 0
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp sgt i32 %18, 57
br i1 %19, label %20, label %21
20: ; preds = %12
store i32 0, i32* %2
br label %22
21: ; preds = %12
store i32 1, i32* %2
br label %22
22: ; preds = %21, %20, %11
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
define i32 @proc_select(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = add i8 %4, -49
%6 = icmp ult i8 %5, 9
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ read(int, int *, int);
int main() {
  int fd = 0;
  int dst = 0;
  fd = open("/dev/memdev0", O_RDWR);
  read(fd, &dst, sizeof(int));
  printf("The dst is %d\n", dst);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0x2e84(%rip),%rax
mov    (%rax),%esi
lea    0xe93(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1050 <read@plt>
mov    -0xc(%rbp),%esi
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
mov    0x2e94(%rip),%rax
mov    (%rax),%esi
lea    0xea3(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%ebx
lea    0xc(%rsp),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1050 <read@plt>
mov    0xc(%rsp),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/memdev0\00"
@O_RDWR = global i32 0
@.str.1 = [15 x i8] c"The dst is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* @O_RDWR
%5 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @read(i32 %6, i32* %3, i32 4)
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = call i32 @close(i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/memdev0\00"
@O_RDWR = global i32 0
@.str.1 = [15 x i8] c"The dst is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = load i32, i32* @O_RDWR
%4 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @read(i32 %4, i32* %1, i32 4)
%6 = load i32, i32* %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @close(i32 %4)
ret i32 0
}
/* Type definitions */
struct stream {
  int dummy;
};

/* Variables and functions */
int decode_atom_format_6_1(unsigned char const *, struct stream *);
int decode_atom_format_6_9(const unsigned char *pkt, struct stream *stream) {
  return decode_atom_format_6_1(pkt, stream);
}


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

x86 assembly (clang, -O2):
<decode_atom_format_6_9>:
jmp    1030 <decode_atom_format_6_1@plt>

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

LLVM IR (-O2):
%struct.stream = type { i32 }
define i32 @decode_atom_format_6_9(i8* %0, %struct.stream* %1) {
%3 = tail call i32 @decode_atom_format_6_1(i8* %0, %struct.stream* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ENOMEM;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ free(void *);
void *realloc(void *, size_t);
int aeron_reallocf(void **ptr, size_t size) {
  if ((*ptr = realloc(*ptr, size)) == NULL) {
    free(*ptr);
    errno = ENOMEM;
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<aeron_reallocf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <realloc@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    117b <aeron_reallocf+0x5b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%ecx
mov    0x2e6b(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1182 <aeron_reallocf+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aeron_reallocf>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1040 <realloc@plt>
mov    %rax,%rcx
mov    %rax,(%rbx)
xor    %eax,%eax
test   %rcx,%rcx
je     113b <aeron_reallocf+0x1b>
pop    %rbx
ret
xor    %edi,%edi
call   1030 <free@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%eax
mov    0x2e86(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@ENOMEM = global i32 0
@errno = global i32 0
define i32 @aeron_reallocf(i8** nocapture %0, i64 %1) {
%3 = load i8*, i8** %0
%4 = tail call i8* @realloc(i8* %3, i64 %1)
store i8* %4, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @free(i8* null)
%8 = load i32, i32* @ENOMEM
store i32 %8, i32* @errno
br label %9
9: ; preds = %2, %6
%10 = phi i32 [ -1, %6 ], [ 0, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ mrecv_gc();
void do_free() { mrecv_gc(); }


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

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

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

LLVM IR (-O2):
define void @do_free() {
%1 = tail call i32 (...) @mrecv_gc()
ret void
}
double dnrm2(int N, double *X, int INCX) {
  extern double dnrm2_(int *N, double *X, int *INCX);
  return dnrm2_(&N, X, &INCX);
}


x86 assembly (clang, -O0):
<dnrm2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x4(%rbp),%rdi
lea    -0x14(%rbp),%rdx
call   1030 <dnrm2_@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dnrm2>:
push   %rax
mov    %edi,0x4(%rsp)
mov    %edx,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rdx
call   1030 <dnrm2_@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define double @dnrm2(i32 %0, double* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %2, i32* %5
%6 = call double @dnrm2_(i32* %4, double* %1, i32* %5)
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ EVIOCGNAME(size_t);
int ioctl(int, int /*<<< orphan*/, char *);
int evf_input_get_name(int fd, char *buf, size_t buf_len) {
  int ret;
  if ((ret = ioctl(fd, EVIOCGNAME(buf_len), buf)) <= 0)
    return -1;
  return ret;
}


x86 assembly (clang, -O0):
<evf_input_get_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <EVIOCGNAME@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jg     1168 <evf_input_get_name+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    116e <evf_input_get_name+0x4e>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evf_input_get_name>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rdx,%rdi
call   1040 <EVIOCGNAME@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <ioctl@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
cmovle %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @evf_input_get_name(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @EVIOCGNAME(i64 %2)
%5 = tail call i32 @ioctl(i32 %0, i32 %4, i8* %1)
%6 = icmp slt i32 %5, 1
%7 = select i1 %6, i32 -1, i32 %5
ret i32 %7
}
/* Variables and functions */
int is_set(int *, int);
int is_prime(int *numbers, int number) {
  int index = number >> 5;
  return is_set(numbers + index, number - (index << 5));
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x5,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%eax
shl    $0x5,%eax
sub    %eax,%esi
call   1030 <is_set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
mov    %esi,%eax
sar    $0x5,%eax
cltq
lea    (%rdi,%rax,4),%rdi
and    $0x1f,%esi
jmp    1030 <is_set@plt>

LLVM IR (-O0):
define i32 @is_prime(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = ashr i32 %6, 5
store i32 %7, i32* %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = shl i32 %13, 5
%15 = sub nsw i32 %12, %14
%16 = call i32 @is_set(i32* %11, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @is_prime(i32* %0, i32 %1) {
%3 = ashr i32 %1, 5
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = and i32 %1, 31
%7 = tail call i32 @is_set(i32* %5, i32 %6)
ret i32 %7
}
/* Variables and functions */
int my_string_strcmpFilenames(char const *, char const *);
int my_compare_filename(const void *objeto1, const void *objeto2) {
  const char *f1 = (const char *)objeto1;
  const char *f2 = (const char *)objeto2;
  return my_string_strcmpFilenames(f1, f2);
}


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

x86 assembly (clang, -O2):
<my_compare_filename>:
jmp    1030 <my_string_strcmpFilenames@plt>

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

LLVM IR (-O2):
define i32 @my_compare_filename(i8* %0, i8* %1) {
%3 = tail call i32 @my_string_strcmpFilenames(i8* %0, i8* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int open(char const *, int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int x_open(const char *pathname, int flags, mode_t mode) {
  const int result = open(pathname, flags, mode);
  if (result == -1) {
    perror("open() error");
    exit(EXIT_FAILURE);
  }
  return result;
}


x86 assembly (clang, -O0):
<x_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1178 <x_open+0x48>
lea    0xe9b(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"open() error\00"
@EXIT_FAILURE = global i32 0
define i32 @x_open(i8* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @open(i8* %0, i32 %1, i32 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %3
ret i32 %4
}
/* Type definitions */
struct buf_t {
  int dummy;
};

/* Variables and functions */
scalar_t__ buf_byte_fill(struct buf_t *, int /*<<< orphan*/);
void render_tail(struct buf_t *buf) {
  while (buf_byte_fill(buf, 0) != 0)
    ;
}


x86 assembly (clang, -O0):
<render_tail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <buf_byte_fill@plt>
cmp    $0x0,%rax
je     1136 <render_tail+0x26>
jmp    111c <render_tail+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render_tail>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <buf_byte_fill@plt>
test   %rax,%rax
jne    1120 <render_tail+0x10>
pop    %rbx
ret

LLVM IR (-O0):
%struct.buf_t = type { i32 }
define void @render_tail(%struct.buf_t* %0) {
%2 = alloca %struct.buf_t*
store %struct.buf_t* %0, %struct.buf_t** %2
br label %3
3: ; preds = %7, %1
%4 = load %struct.buf_t*, %struct.buf_t** %2
%5 = call i64 @buf_byte_fill(%struct.buf_t* %4, i32 0)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
ret void
}

LLVM IR (-O2):
%struct.buf_t = type { i32 }
define void @render_tail(%struct.buf_t* %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i64 @buf_byte_fill(%struct.buf_t* %0, i32 0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %2
5: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printArray(int numbers[], int length) {
  int i;
  for (i = 0; i < length; i++) {
    printf("%d", numbers[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printArray>:
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    1159 <printArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArray+0x16>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printArray(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 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 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
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @printArray(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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 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
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
void *realloc(void *, size_t);
void *w_malloc(size_t);
void *w_realloc(void *ptr, size_t size) {
  if (ptr == NULL) {
    return w_malloc(size);
  }
  return realloc(ptr, size);
}


x86 assembly (clang, -O0):
<w_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114d <w_realloc+0x2d>
mov    -0x18(%rbp),%rdi
call   1030 <w_malloc@plt>
mov    %rax,-0x8(%rbp)
jmp    115e <w_realloc+0x3e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<w_realloc>:
test   %rdi,%rdi
je     112a <w_realloc+0xa>
jmp    1040 <realloc@plt>
mov    %rsi,%rdi
jmp    1030 <w_malloc@plt>

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

LLVM IR (-O2):
define i8* @w_realloc(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @w_malloc(i64 %1)
br label %8
6: ; preds = %2
%7 = tail call i8* @realloc(i8* %0, i64 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %5, %4 ], [ %7, %6 ]
ret i8* %9
}
double commercial_calculation(int consumption) {
  double amount_due = 0.0;
  consumption -= 1000;
  amount_due = 60.0;
  if (consumption > 0) {
    amount_due += consumption * 0.045;
  }
  return amount_due;
}


x86 assembly (clang, -O0):
<commercial_calculation>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x3e8,%eax
mov    %eax,-0x4(%rbp)
movsd  0xede(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1150 <commercial_calculation+0x50>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xec5(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<commercial_calculation>:
movsd  0xf00(%rip),%xmm0
cmp    $0x3e9,%edi
jl     1126 <commercial_calculation+0x26>
add    $0xfffffc18,%edi
cvtsi2sd %edi,%xmm1
mulsd  0xede(%rip),%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @commercial_calculation(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
store double 0.000000e+00, double* %3
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 1000
store i32 %5, i32* %2
store double 6.000000e+01, double* %3
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = load double, double* %3
%12 = call double @llvm.fmuladd.f64(double %10, double 4.500000e-02, double %11)
store double %12, double* %3
br label %13
13: ; preds = %8, %1
%14 = load double, double* %3
ret double %14
}

LLVM IR (-O2):
define double @commercial_calculation(i32 %0) {
%2 = icmp sgt i32 %0, 1000
%3 = add nsw i32 %0, -1000
%4 = sitofp i32 %3 to double
%5 = tail call double @llvm.fmuladd.f64(double %4, double 4.500000e-02, double 6.000000e+01)
%6 = select i1 %2, double %5, double 6.000000e+01
ret double %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
long get_file_size(FILE *fp) {
  long fsize = 0;
  fseek(fp, 0, SEEK_END);
  fsize = ftell(fp);
  fseek(fp, 0, SEEK_SET);
  return fsize;
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e78(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eba(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %rax,%r14
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @get_file_size(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
store i32* %0, i32** %2
store i64 0, i64* %3
%4 = load i32*, i32** %2
%5 = load i32, i32* @SEEK_END
%6 = call i32 @fseek(i32* %4, i32 0, i32 %5)
%7 = load i32*, i32** %2
%8 = call i64 @ftell(i32* %7)
store i64 %8, i64* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %9, i32 0, i32 %10)
%12 = load i64, i64* %3
ret i64 %12
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @get_file_size(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32* %0, i32 0, i32 %2)
%4 = tail call i64 @ftell(i32* %0)
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @fseek(i32* %0, i32 0, i32 %5)
ret i64 %4
}