xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fun(char *, char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ puts(char *);
int main() {
  char ch[81], string[81];
  gets(ch);
  puts(ch);
  fun(ch, string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x60(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x60(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1040 <fun@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xc0,%rsp
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <fun@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [81 x i8]
%3 = alloca [81 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%7 = call i32 @puts(i8* %6)
%8 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [81 x i8], [81 x i8]* %3, i64 0, i64 0
%10 = call i32 @fun(i8* %8, i8* %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [81 x i8]
%2 = alloca [81 x i8]
%3 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %3)
%6 = call i32 @puts(i8* %3)
%7 = call i32 @fun(i8* %3, i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ io_scan_for_input(int);
void xio_wait_for_input(void) { io_scan_for_input(1); }


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

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

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

LLVM IR (-O2):
define void @xio_wait_for_input() {
%1 = tail call i32 @io_scan_for_input(i32 1)
ret void
}
void freeargs(char **args) {
  char **save = args;
  while (*args) {
    free(*args);
    args++;
  }
  free(save);
}


x86 assembly (clang, -O0):
<freeargs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     114f <freeargs+0x3f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1124 <freeargs+0x14>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeargs>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <freeargs+0x31>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <freeargs+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @freeargs(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %8, %4 ], [ %2, %1 ]
%6 = phi i8** [ %7, %4 ], [ %0, %1 ]
tail call void @free(i8* %5)
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %4
10: ; preds = %4, %1
%11 = bitcast i8** %0 to i8*
tail call void @free(i8* %11)
ret void
}
int strlen2(const char *s) {
  int i = 0;
  while (*s++ != '\0')
    i++;
  return i;
}


x86 assembly (clang, -O0):
<strlen2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1138 <strlen2+0x38>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen2+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen2>:
cmpb   $0x0,(%rdi)
je     111c <strlen2+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen2+0x10>
ret
xor    %eax,%eax
ret

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

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


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @newmap(i32 3, i32 3, i32 3)
ret i32 0
}
int isInt(double x) {
  if (x == (int)x)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isInt>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvttsd2si -0x10(%rbp),%eax
cvtsi2sd %eax,%xmm1
ucomisd %xmm1,%xmm0
jne    1133 <isInt+0x33>
jp     1133 <isInt+0x33>
movl   $0x1,-0x4(%rbp)
jmp    113a <isInt+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isInt>:
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
cmpeqsd %xmm0,%xmm1
movq   %xmm1,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @isInt(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = load double, double* %3
%6 = fptosi double %5 to i32
%7 = sitofp i32 %6 to double
%8 = fcmp oeq double %4, %7
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 1, i32* %2
br label %11
10: ; preds = %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @isInt(double %0) {
%2 = fptosi double %0 to i32
%3 = sitofp i32 %2 to double
%4 = fcmp oeq double %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ SIGILL;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int gen_ILL(void) {
  kill(getpid(), SIGILL);
  return 0;
}


x86 assembly (clang, -O0):
<gen_ILL>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_ILL>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    0x2eb9(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1040 <kill@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGILL = global i32 0
define i32 @gen_ILL() {
%1 = call i32 (...) @getpid()
%2 = load i32, i32* @SIGILL
%3 = call i32 @kill(i32 %1, i32 %2)
ret i32 0
}

LLVM IR (-O2):
@SIGILL = global i32 0
define i32 @gen_ILL() {
%1 = tail call i32 (...) @getpid()
%2 = load i32, i32* @SIGILL
%3 = tail call i32 @kill(i32 %1, i32 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ f4(int /*<<< orphan*/);
void f5(void) { f4(0); }


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <f4@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f5>:
xor    %edi,%edi
jmp    1030 <f4@plt>

LLVM IR (-O0):
define void @f5() {
%1 = call i32 @f4(i32 0)
ret void
}

LLVM IR (-O2):
define void @f5() {
%1 = tail call i32 @f4(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UI_CDKeyMenu();
void UI_CDKeyMenu_f(void) { UI_CDKeyMenu(); }


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

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

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

LLVM IR (-O2):
define void @UI_CDKeyMenu_f() {
%1 = tail call i32 (...) @UI_CDKeyMenu()
ret void
}
dmax(double x, double y) {
  if (x > y)
    return (x);
  return (y);
}


x86 assembly (clang, -O0):
<dmax>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    112b <dmax+0x2b>
cvttsd2si -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1133 <dmax+0x33>
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmax>:
maxsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @dmax(double %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load double, double* %4
%11 = fptosi double %10 to i32
store i32 %11, i32* %3
br label %15
12: ; preds = %2
%13 = load double, double* %5
%14 = fptosi double %13 to i32
store i32 %14, i32* %3
br label %15
15: ; preds = %12, %9
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @dmax(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
%5 = fptosi double %4 to i32
ret i32 %5
}
int DoObjWorld(char *s) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @DoObjWorld(i8* nocapture readnone %0) {
ret i32 0
}
void fi_algo_collection_init(struct FiAlgoCollection *coll) {
  if (!coll)
    return;
}


x86 assembly (clang, -O0):
<fi_algo_collection_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1118 <fi_algo_collection_init+0x18>
jmp    1118 <fi_algo_collection_init+0x18>
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.FiAlgoCollection = type opaque
define void @fi_algo_collection_init(%struct.FiAlgoCollection* %0) {
%2 = alloca %struct.FiAlgoCollection*
store %struct.FiAlgoCollection* %0, %struct.FiAlgoCollection** %2
%3 = load %struct.FiAlgoCollection*, %struct.FiAlgoCollection** %2
%4 = icmp ne %struct.FiAlgoCollection* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %6
6: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
%struct.FiAlgoCollection = type opaque
define void @fi_algo_collection_init(%struct.FiAlgoCollection* nocapture %0) {
ret void
}
int foo(int i) {
  if (i == 0) {
    return 0;
  }
  if (i == 1) {
    return 1;
  }
  if (i == 2) {
    return 2;
  }
  if (i == 3) {
    return 3;
  }
  if (i == 4) {
    return 4;
  }
  return -1;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <foo+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    117c <foo+0x7c>
cmpl   $0x1,-0x8(%rbp)
jne    1133 <foo+0x33>
movl   $0x1,-0x4(%rbp)
jmp    117c <foo+0x7c>
cmpl   $0x2,-0x8(%rbp)
jne    1149 <foo+0x49>
movl   $0x2,-0x4(%rbp)
jmp    117c <foo+0x7c>
cmpl   $0x3,-0x8(%rbp)
jne    115f <foo+0x5f>
movl   $0x3,-0x4(%rbp)
jmp    117c <foo+0x7c>
cmpl   $0x4,-0x8(%rbp)
jne    1175 <foo+0x75>
movl   $0x4,-0x4(%rbp)
jmp    117c <foo+0x7c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x5,%edi
mov    $0xffffffff,%eax
cmovb  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp ult i32 %0, 5
%3 = select i1 %2, i32 %0, i32 -1
ret i32 %3
}
double sigmoid_derivative(const double value_before_activation,
                          const double value_after_activation) {
  (void)value_before_activation;
  return value_after_activation * (1.0 - value_after_activation);
}


x86 assembly (clang, -O0):
<sigmoid_derivative>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xee5(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigmoid_derivative>:
movsd  0xef8(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @sigmoid_derivative(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 = load double, double* %4
%8 = fsub double 1.000000e+00, %7
%9 = fmul double %6, %8
ret double %9
}

LLVM IR (-O2):
define double @sigmoid_derivative(double %0, double %1) {
%3 = fsub double 1.000000e+00, %1
%4 = fmul double %3, %1
ret double %4
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint64_t expand64(uint32_t v) {
  uint64_t value = v;
  if (value & 0x80000000) {
    value |= (uint64_t)~0 << 32;
  }
  return value;
}


x86 assembly (clang, -O0):
<expand64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     1124 <expand64+0x24>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @expand64(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, -2147483648
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %3
%10 = or i32 %9, poison
store i32 %10, i32* %3
br label %11
11: ; preds = %8, %1
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @expand64(i32 returned %0) {
ret i32 %0
}
int fun259() { return 259; }


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

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

LLVM IR (-O0):
define i32 @fun259() {
ret i32 259
}

LLVM IR (-O2):
define i32 @fun259() {
ret i32 259
}
void register_release(void) {}


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

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

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

LLVM IR (-O2):
define void @register_release() {
ret void
}
void gcc_s_forcedunwind_impl(void) {}


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

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

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

LLVM IR (-O2):
define void @gcc_s_forcedunwind_impl() {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int rand();
uint8_t get_map_random(int min, int max) {
  return (rand() % (max - min)) + min;
}


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

x86 assembly (clang, -O2):
<get_map_random>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @get_map_random(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub nsw i32 %1, %0
%5 = srem i32 %3, %4
%6 = add nsw i32 %5, %0
ret i32 %6
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int strtol(char *, char **, int);
int32_t read_int(char **pointer, int32_t *value) {
  char *start = *pointer;
  *value = strtol(start, pointer, 10);
  return start != *pointer;
}


x86 assembly (clang, -O0):
<read_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_int>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,(%r14)
xor    %eax,%eax
cmp    (%rbx),%r15
setne  %al
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @read_int(i8** %0, i32* %1) {
%3 = alloca i8**
%4 = alloca i32*
%5 = alloca i8*
store i8** %0, i8*** %3
store i32* %1, i32** %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i8**, i8*** %3
%10 = call i32 @strtol(i8* %8, i8** %9, i32 10)
%11 = load i32*, i32** %4
store i32 %10, i32* %11
%12 = load i8*, i8** %5
%13 = load i8**, i8*** %3
%14 = load i8*, i8** %13
%15 = icmp ne i8* %12, %14
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @read_int(i8** nocapture %0, i32* nocapture writeonly %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @strtol(i8* %3, i8** %0, i32 10)
store i32 %4, i32* %1
%5 = load i8*, i8** %0
%6 = icmp ne i8* %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
void gameboy3x_generic_output(void *data, unsigned *out_width,
                              unsigned *out_height, unsigned width,
                              unsigned height) {
  *out_width = width * 3;
  *out_height = height * 3;
}


x86 assembly (clang, -O0):
<gameboy3x_generic_output>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
imul   $0x3,-0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
imul   $0x3,-0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<gameboy3x_generic_output>:
lea    (%rcx,%rcx,2),%eax
mov    %eax,(%rsi)
lea    (%r8,%r8,2),%eax
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @gameboy3x_generic_output(i8* %0, i32* %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %9
%12 = mul i32 %11, 3
%13 = load i32*, i32** %7
store i32 %12, i32* %13
%14 = load i32, i32* %10
%15 = mul i32 %14, 3
%16 = load i32*, i32** %8
store i32 %15, i32* %16
ret void
}

LLVM IR (-O2):
define void @gameboy3x_generic_output(i8* nocapture readnone %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32 %3, i32 %4) {
%6 = mul i32 %3, 3
store i32 %6, i32* %1
%7 = mul i32 %4, 3
store i32 %7, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", 1 < 2);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}
/* Variables and functions */
int link1(int);
int link2(int);
int link3(int n) { return link1(n) + link2(n); }


x86 assembly (clang, -O0):
<link3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <link1@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <link2@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<link3>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <link1@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <link2@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @link3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @link1(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @link2(i32 %5)
%7 = add nsw i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @link3(i32 %0) {
%2 = tail call i32 @link1(i32 %0)
%3 = tail call i32 @link2(i32 %0)
%4 = add nsw i32 %3, %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
                            long length, void *ks1, void *ks2, void *ks3,
                            void *ivec, int *num, int enc) {
  printf("DES_ede3_cfb64_encrypt stubbed\n");
  (void)&(in);
  (void)&(out);
  (void)&(length);
  (void)&(ks1);
  (void)&(ks2);
  (void)&(ks3);
  (void)&(ivec);
  (void)&(num);
  (void)&(enc);
}


x86 assembly (clang, -O0):
<DES_ede3_cfb64_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [32 x i8] c"DES_ede3_cfb64_encrypt stubbed\0A\00"
define void @DES_ede3_cfb64_encrypt(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4, i8* %5, i8* %6, i32* %7, i32 %8) {
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32*
%18 = alloca i32
store i8* %0, i8** %10
store i8* %1, i8** %11
store i64 %2, i64* %12
store i8* %3, i8** %13
store i8* %4, i8** %14
store i8* %5, i8** %15
store i8* %6, i8** %16
store i32* %7, i32** %17
store i32 %8, i32* %18
%19 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"DES_ede3_cfb64_encrypt stubbed\00"
define void @DES_ede3_cfb64_encrypt(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2, i8* nocapture readnone %3, i8* nocapture readnone %4, i8* nocapture readnone %5, i8* nocapture readnone %6, i32* nocapture readnone %7, i32 %8) {
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dec2bin(int);
int /*<<< orphan*/ dec2hexa(int);
int /*<<< orphan*/ dec2oct(int);
int main_2(int argc, const char *argv[]) {
  int decimal = 12785;
  dec2bin(decimal);
  dec2oct(decimal);
  dec2hexa(decimal);
  return 0;
}


x86 assembly (clang, -O0):
<main_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x31f1,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <dec2bin@plt>
mov    -0x14(%rbp),%edi
call   1040 <dec2oct@plt>
mov    -0x14(%rbp),%edi
call   1030 <dec2hexa@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_2>:
push   %rax
mov    $0x31f1,%edi
call   1050 <dec2bin@plt>
mov    $0x31f1,%edi
call   1040 <dec2oct@plt>
mov    $0x31f1,%edi
call   1030 <dec2hexa@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main_2(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @dec2bin(i32 12785)
%4 = tail call i32 @dec2oct(i32 12785)
%5 = tail call i32 @dec2hexa(i32 12785)
ret i32 0
}
void isa_write16(unsigned short port, unsigned short val) {
  *(short *)((void *)(0xfe000000 | (port))) = val;
}


x86 assembly (clang, -O0):
<isa_write16>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x4(%rbp),%cx
movzwl -0x2(%rbp),%eax
or     $0xfe000000,%eax
mov    %eax,%eax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<isa_write16>:
mov    %edi,%eax
mov    $0xfe000000,%ecx
mov    %si,(%rax,%rcx,1)
ret

LLVM IR (-O0):
define void @isa_write16(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = load i16, i16* %3
%7 = zext i16 %6 to i32
%8 = or i32 -33554432, %7
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
%11 = bitcast i8* %10 to i16*
store i16 %5, i16* %11
ret void
}

LLVM IR (-O2):
define void @isa_write16(i16 zeroext %0, i16 zeroext %1) {
%3 = zext i16 %0 to i64
%4 = or i64 %3, 4261412864
%5 = inttoptr i64 %4 to i16*
store i16 %1, i16* %5
ret void
}
void srp_core_reset(void) { return; }


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

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

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

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

/* Variables and functions */
unsigned int _mm_encodekey128_u32(unsigned int, int /*<<< orphan*/, void *);
unsigned int test_encodekey128_u32(unsigned int htype, __m128i key, void *h) {
  return _mm_encodekey128_u32(htype, key, h);
}


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

x86 assembly (clang, -O2):
<test_encodekey128_u32>:
jmp    1030 <_mm_encodekey128_u32@plt>

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

LLVM IR (-O2):
define i32 @test_encodekey128_u32(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 @_mm_encodekey128_u32(i32 %0, i32 %1, i8* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ func1();
int main(int argc, const char *argv[]) {
  func1();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @func1()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @func1()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long, unsigned int);
void writefunc(unsigned long addr, unsigned int size) {
  printf("Detected memory write at <%#08llx> of bytes %u\n", addr, size);
}


x86 assembly (clang, -O0):
<writefunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writefunc>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"Detected memory write at <%llx> of bytes %u\0A\00"
define void @writefunc(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i64 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"Detected memory write at <%llx> of bytes %u\0A\00"
define void @writefunc(i64 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i64 %0, i32 %1)
ret void
}
/* Variables and functions */
int random();
void loop(int a, int b, int c) {
  if ((b - c >= 1) && (a == c)) {
    int r = random();
    b = 10;
    c = c + 1 + r;
    a = c;
    loop(a, b, c);
  }
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x1,%eax
jl     117d <loop+0x5d>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    117d <loop+0x5d>
mov    $0x0,%al
call   1040 <random@plt>
mov    %eax,-0x10(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <loop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %rbx
cmp    %edx,%esi
jle    1131 <loop+0x21>
mov    %edx,%ebx
cmp    %edx,%edi
jne    1131 <loop+0x21>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <random@plt>
add    %eax,%ebx
add    $0x1,%ebx
cmp    $0xa,%ebx
jl     1120 <loop+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @loop(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = sub nsw i32 %8, %9
%11 = icmp sge i32 %10, 1
br i1 %11, label %12, label %26
12: ; preds = %3
%13 = load i32, i32* %4
%14 = load i32, i32* %6
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %26
16: ; preds = %12
%17 = call i32 (...) @random()
store i32 %17, i32* %7
store i32 10, i32* %5
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
%20 = load i32, i32* %7
%21 = add nsw i32 %19, %20
store i32 %21, i32* %6
%22 = load i32, i32* %6
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = load i32, i32* %6
br label %26
26: ; preds = %16, %12, %3
ret void
}

LLVM IR (-O2):
define void @loop(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, %2
%5 = icmp eq i32 %0, %2
%6 = and i1 %4, %5
br i1 %6, label %7, label %13
7: ; preds = %3, %7
%8 = phi i32 [ %11, %7 ], [ %2, %3 ]
%9 = tail call i32 (...) @random()
%10 = add nsw i32 %8, 1
%11 = add nsw i32 %10, %9
%12 = icmp slt i32 %11, 10
br i1 %12, label %7, label %13
13: ; preds = %7, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ drv_FW8888_send_cmd(int);
void __attribute__((unused)) drv_FW8888_backlight_on(void) {
  drv_FW8888_send_cmd(0x39);
}


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

x86 assembly (clang, -O2):
<drv_FW8888_backlight_on>:
mov    $0x39,%edi
jmp    1030 <drv_FW8888_send_cmd@plt>

LLVM IR (-O0):
define void @drv_FW8888_backlight_on() {
%1 = call i32 @drv_FW8888_send_cmd(i32 57)
ret void
}

LLVM IR (-O2):
define void @drv_FW8888_backlight_on() {
%1 = tail call i32 @drv_FW8888_send_cmd(i32 57)
ret void
}
unsigned long long get_cpu_clock(void) {
  unsigned int lo, hi;
  __asm__ __volatile__("rdtsc" : "=a"(lo), "=d"(hi));
  return ((unsigned long long)hi << 32ULL) | lo;
}


x86 assembly (clang, -O0):
<get_cpu_clock>:
push   %rbp
mov    %rsp,%rbp
rdtsc
mov    %eax,-0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x20,%rax
mov    -0x4(%rbp),%ecx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cpu_clock>:
rdtsc
shl    $0x20,%rdx
mov    %eax,%eax
or     %rdx,%rax
ret

LLVM IR (-O0):
define i64 @get_cpu_clock() {
%1 = alloca i32
%2 = alloca i32
%3 = call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%4 = extractvalue { i32, i32 } %3, 0
%5 = extractvalue { i32, i32 } %3, 1
store i32 %4, i32* %1
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = shl i64 %7, 32
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = or i64 %8, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @get_cpu_clock() {
%1 = tail call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = zext i32 %3 to i64
%5 = shl nuw i64 %4, 32
%6 = zext i32 %2 to i64
%7 = or i64 %5, %6
ret i64 %7
}
float fastpowf(float a, float b) {
  union {
    float d;
    int x[2];
  } u = {a};
  u.x[1] = (int)(b * (u.x[1] - 1072632447) + 1072632447);
  u.x[0] = 0;
  return u.d;
}


x86 assembly (clang, -O0):
<fastpowf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%eax
sub    $0x3fef127f,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  0xecb(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastpowf>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { [2 x i32] }
define float @fastpowf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca %union.anon
store float %0, float* %3
store float %1, float* %4
%6 = bitcast %union.anon* %5 to float*
%7 = load float, float* %3
store float %7, float* %6
%8 = load float, float* %4
%9 = bitcast %union.anon* %5 to [2 x i32]*
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%11 = load i32, i32* %10
%12 = sub nsw i32 %11, 1072632447
%13 = sitofp i32 %12 to float
%14 = call float @llvm.fmuladd.f32(float %8, float %13, float 0x41CFF78940000000)
%15 = fptosi float %14 to i32
%16 = bitcast %union.anon* %5 to [2 x i32]*
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 1
store i32 %15, i32* %17
%18 = bitcast %union.anon* %5 to [2 x i32]*
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 0
store i32 0, i32* %19
%20 = bitcast %union.anon* %5 to float*
%21 = load float, float* %20
ret float %21
}

LLVM IR (-O2):
define float @fastpowf(float %0, float %1) {
ret float 0.000000e+00
}
long double(creall)(long double _Complex x) { return __builtin_creall(x); }


x86 assembly (clang, -O0):
<creall>:
push   %rbp
mov    %rsp,%rbp
lea    0x10(%rbp),%rax
fldt   (%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<creall>:
fldt   0x8(%rsp)
ret

LLVM IR (-O0):
define x86_fp80 @creall({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16 %0) {
%2 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %0, i32 0, i32 0
%3 = load x86_fp80, x86_fp80* %2
%4 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %0, i32 0, i32 1
%5 = load x86_fp80, x86_fp80* %4
ret x86_fp80 %3
}

LLVM IR (-O2):
define x86_fp80 @creall({ x86_fp80, x86_fp80 }* nocapture byval({ x86_fp80, x86_fp80 }) align 16 %0) {
%2 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %0, i64 0, i32 0
%3 = load x86_fp80, x86_fp80* %2
ret x86_fp80 %3
}
void f15() {
  extern void f15_start(void);
  f15_start();
  extern void *f15_v(void);
  extern const void *f15_cv(void);
  extern volatile void *f15_vv(void);
  *f15_v();
  *f15_v(), *f15_v();
  f15_v() ? *f15_v() : *f15_v();
  *f15_cv();
  *f15_cv(), *f15_cv();
  f15_cv() ? *f15_cv() : *f15_cv();
  *f15_vv();
  *f15_vv(), *f15_vv();
  f15_vv() ? *f15_vv() : *f15_vv();
}


x86 assembly (clang, -O0):
<f15>:
push   %rbp
mov    %rsp,%rbp
call   1060 <f15_start@plt>
call   1050 <f15_v@plt>
call   1050 <f15_v@plt>
call   1050 <f15_v@plt>
call   1050 <f15_v@plt>
cmp    $0x0,%rax
je     1171 <f15+0x31>
call   1050 <f15_v@plt>
jmp    1176 <f15+0x36>
call   1050 <f15_v@plt>
call   1030 <f15_cv@plt>
call   1030 <f15_cv@plt>
call   1030 <f15_cv@plt>
call   1030 <f15_cv@plt>
cmp    $0x0,%rax
je     119e <f15+0x5e>
call   1030 <f15_cv@plt>
jmp    11a3 <f15+0x63>
call   1030 <f15_cv@plt>
call   1040 <f15_vv@plt>
call   1040 <f15_vv@plt>
call   1040 <f15_vv@plt>
call   1040 <f15_vv@plt>
cmp    $0x0,%rax
je     11cb <f15+0x8b>
call   1040 <f15_vv@plt>
jmp    11d0 <f15+0x90>
call   1040 <f15_vv@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f15>:
push   %rax
call   1060 <f15_start@plt>
call   1050 <f15_v@plt>
call   1050 <f15_v@plt>
call   1050 <f15_v@plt>
call   1050 <f15_v@plt>
call   1050 <f15_v@plt>
call   1030 <f15_cv@plt>
call   1030 <f15_cv@plt>
call   1030 <f15_cv@plt>
call   1030 <f15_cv@plt>
call   1030 <f15_cv@plt>
call   1040 <f15_vv@plt>
call   1040 <f15_vv@plt>
call   1040 <f15_vv@plt>
call   1040 <f15_vv@plt>
pop    %rax
jmp    1040 <f15_vv@plt>

LLVM IR (-O0):
define void @f15() {
%1 = call i8* @f15_v()
%2 = call i8* @f15_v()
%3 = call i8* @f15_v()
%4 = call i8* @f15_v()
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i8* @f15_v()
br label %10
8: ; preds = %0
%9 = call i8* @f15_v()
br label %10
10: ; preds = %8, %6
%11 = phi i8* [ %7, %6 ], [ %9, %8 ]
%12 = call i8* @f15_cv()
%13 = call i8* @f15_cv()
%14 = call i8* @f15_cv()
%15 = call i8* @f15_cv()
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %19
17: ; preds = %10
%18 = call i8* @f15_cv()
br label %21
19: ; preds = %10
%20 = call i8* @f15_cv()
br label %21
21: ; preds = %19, %17
%22 = call i8* @f15_vv()
%23 = call i8* @f15_vv()
%24 = call i8* @f15_vv()
%25 = call i8* @f15_vv()
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %29
27: ; preds = %21
%28 = call i8* @f15_vv()
br label %31
29: ; preds = %21
%30 = call i8* @f15_vv()
br label %31
31: ; preds = %29, %27
ret void
}

LLVM IR (-O2):
define void @f15() {
tail call void @f15_start()
%1 = tail call i8* @f15_v()
%2 = tail call i8* @f15_v()
%3 = tail call i8* @f15_v()
%4 = tail call i8* @f15_v()
%5 = tail call i8* @f15_v()
%6 = tail call i8* @f15_cv()
%7 = tail call i8* @f15_cv()
%8 = tail call i8* @f15_cv()
%9 = tail call i8* @f15_cv()
%10 = tail call i8* @f15_cv()
%11 = tail call i8* @f15_vv()
%12 = tail call i8* @f15_vv()
%13 = tail call i8* @f15_vv()
%14 = tail call i8* @f15_vv()
%15 = tail call i8* @f15_vv()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void write_lines(char *plines[], int num_lines) {
  for (int i = 0; i < num_lines; ++i) {
    printf("%s\n", plines[i]);
  }
}


x86 assembly (clang, -O0):
<write_lines>:
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    1158 <write_lines+0x48>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <write_lines+0x16>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @write_lines(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %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 i8**, i8*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %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"%s\0A\00"
define void @write_lines(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i8*, i8** %0, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help() {
  printf("\nUsage: hyperscan <ip-address> <start port> <end port>\n");
  printf("\nhyperscan, v0.1 - A port scanner");
  printf("\nLicense: GPLv3\n\n");
}


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

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
lea    0xf19(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [56 x i8] c"\0AUsage: hyperscan <ip-address> <start port> <end port>\0A\00"
@.str.1 = [34 x i8] c"\0Ahyperscan, v0.1 - A port scanner\00"
@.str.2 = [18 x i8] c"\0ALicense: GPLv3\0A\0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [34 x i8] c"\0Ahyperscan, v0.1 - A port scanner\00"
@str = [55 x i8] c"\0AUsage: hyperscan <ip-address> <start port> <end port>\00"
@str.3 = [17 x i8] c"\0ALicense: GPLv3\0A\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.3, i64 0, i64 0))
ret void
}
void RTS3Destroy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTS3Destroy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ProveIt(char *, char *, char *, char *);
void ProveItTest() {
  ProveIt("ex4_goal.ttp", "ex4_rules.ttp", "ex4_facts.ttp", "ex4_proveit.txt");
}


x86 assembly (clang, -O0):
<ProveItTest>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeeb(%rip),%rsi
lea    0xef2(%rip),%rdx
lea    0xef9(%rip),%rcx
call   1030 <ProveIt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ProveItTest>:
lea    0xee9(%rip),%rdi
lea    0xeef(%rip),%rsi
lea    0xef6(%rip),%rdx
lea    0xefd(%rip),%rcx
jmp    1030 <ProveIt@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"ex4_goal.ttp\00"
@.str.1 = [14 x i8] c"ex4_rules.ttp\00"
@.str.2 = [14 x i8] c"ex4_facts.ttp\00"
@.str.3 = [16 x i8] c"ex4_proveit.txt\00"
define void @ProveItTest() {
%1 = call i32 @ProveIt(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"ex4_goal.ttp\00"
@.str.1 = [14 x i8] c"ex4_rules.ttp\00"
@.str.2 = [14 x i8] c"ex4_facts.ttp\00"
@.str.3 = [16 x i8] c"ex4_proveit.txt\00"
define void @ProveItTest() {
%1 = tail call i32 @ProveIt(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
ret void
}