xunge/DecIR huggingface dataset:
/* Variables and functions */
char *ConcatNCopies(int, char *);
int /*<<< orphan*/ printf(char *, ...);
main() {
  printf("The next line could be used as a section divider.\n");
  printf("%s\n", ConcatNCopies(25, "- "));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x19,%edi
lea    0xef9(%rip),%rsi
call   1040 <ConcatNCopies@plt>
mov    %rax,%rsi
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rsi
mov    $0x19,%edi
call   1040 <ConcatNCopies@plt>
mov    %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"The next line could be used as a section divider.\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [3 x i8] c"- \00"
define i32 @main() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%2 = call i8* @ConcatNCopies(i32 25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"- \00"
@str = [50 x i8] c"The next line could be used as a section divider.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%2 = tail call i8* @ConcatNCopies(i32 25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void handle_sigint(int param) {
  printf("\n!   ERROR: Program terminated.\n");
  exit(-1000);
}


x86 assembly (clang, -O0):
<handle_sigint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    $0xfffffc18,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handle_sigint>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xfffffc18,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"\0A! ERROR: Program terminated.\0A\00"
define void @handle_sigint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 -1000)
unreachable
}

LLVM IR (-O2):
@str = [32 x i8] c"\0A! ERROR: Program terminated.\00"
define void @handle_sigint(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 -1000)
unreachable
}
int clamp(int n, int a, int b) {
  if (n > b)
    return b;
  if (n < a)
    return a;
  return n;
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1124 <clamp+0x24>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <clamp+0x41>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <clamp+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <clamp+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
mov    %esi,%eax
cmp    %esi,%edi
cmovge %edi,%eax
cmp    %edx,%edi
cmovg  %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @clamp(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %2
%5 = icmp slt i32 %0, %1
%6 = select i1 %5, i32 %1, i32 %0
%7 = select i1 %4, i32 %2, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print(int n) {
  if (n > 9)
    print(n / 10);
  printf("%d ", n % 10);
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jle    1147 <print+0x27>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <print@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbx
mov    %edi,%ebx
cmp    $0xa,%edi
jl     113c <print+0x1c>
mov    %ebx,%eax
mov    $0xcccccccd,%edi
imul   %rax,%rdi
shr    $0x23,%rdi
call   1040 <print@plt>
movslq %ebx,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
lea    0xe9f(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @print(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 9
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sdiv i32 %6, 10
br label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = srem i32 %9, 10
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print(i32 %0) {
%2 = icmp sgt i32 %0, 9
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = udiv i32 %0, 10
tail call void @print(i32 %4)
br label %5
5: ; preds = %3, %1
%6 = srem i32 %0, 10
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}
void init_fft16() {}


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

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

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

LLVM IR (-O2):
define void @init_fft16() {
ret void
}
/* Variables and functions */
long strtol(char const *, char **, int);
long atol(const char *str) { return (strtol(str, (char **)NULL, 10)); }


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

x86 assembly (clang, -O2):
<atol>:
xor    %esi,%esi
mov    $0xa,%edx
jmp    1030 <strtol@plt>

LLVM IR (-O0):
define i64 @atol(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strtol(i8* %3, i8** null, i32 10)
ret i64 %4
}

LLVM IR (-O2):
define i64 @atol(i8* nocapture %0) {
%2 = tail call i64 @strtol(i8* nocapture %0, i8** null, i32 10)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void print_int(void) { fprintf(stdout, "int function\n"); }


x86 assembly (clang, -O0):
<print_int>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [14 x i8] c"int function\0A\00"
define void @print_int() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [14 x i8] c"int function\0A\00"
define void @print_int() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ readl(void *);
uint32_t read_pxpens(unsigned port) {
  return readl((void *)0xb0010000 + (port * 0x100) + (0x74));
}


x86 assembly (clang, -O0):
<read_pxpens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,%eax
mov    $0xb0010000,%edi
add    %rax,%rdi
add    $0x74,%rdi
call   1030 <readl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_pxpens>:
shl    $0x8,%edi
mov    $0xb0010074,%eax
add    %rax,%rdi
jmp    1030 <readl@plt>

LLVM IR (-O0):
define i32 @read_pxpens(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul i32 %3, 256
%5 = zext i32 %4 to i64
%6 = getelementptr i8, i8* inttoptr (i64 2952855552 to i8*), i64 %5
%7 = getelementptr i8, i8* %6, i64 116
%8 = call i32 @readl(i8* %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @read_pxpens(i32 %0) {
%2 = shl i32 %0, 8
%3 = zext i32 %2 to i64
%4 = getelementptr i8, i8* inttoptr (i64 2952855552 to i8*), i64 %3
%5 = getelementptr i8, i8* %4, i64 116
%6 = tail call i32 @readl(i8* %5)
ret i32 %6
}
void diff(double v1[3], double v2[3], double output[3]) {
  output[0] = v1[0] - v2[0];
  output[1] = v1[1] - v2[1];
  output[2] = v1[2] - v2[2];
}


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

x86 assembly (clang, -O2):
<diff>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
movsd  %xmm0,(%rdx)
movsd  0x8(%rdi),%xmm0
subsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  0x10(%rdi),%xmm0
subsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x10(%rdx)
ret

LLVM IR (-O0):
define void @diff(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %4
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = fsub double %9, %12
%14 = load double*, double** %6
%15 = getelementptr inbounds double, double* %14, i64 0
store double %13, double* %15
%16 = load double*, double** %4
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = load double*, double** %5
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = fsub double %18, %21
%23 = load double*, double** %6
%24 = getelementptr inbounds double, double* %23, i64 1
store double %22, double* %24
%25 = load double*, double** %4
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
%28 = load double*, double** %5
%29 = getelementptr inbounds double, double* %28, i64 2
%30 = load double, double* %29
%31 = fsub double %27, %30
%32 = load double*, double** %6
%33 = getelementptr inbounds double, double* %32, i64 2
store double %31, double* %33
ret void
}

LLVM IR (-O2):
define void @diff(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = fsub double %4, %5
store double %6, double* %2
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
%11 = fsub double %8, %10
%12 = getelementptr inbounds double, double* %2, i64 1
store double %11, double* %12
%13 = getelementptr inbounds double, double* %0, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %1, i64 2
%16 = load double, double* %15
%17 = fsub double %14, %16
%18 = getelementptr inbounds double, double* %2, i64 2
store double %17, double* %18
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sum(int num1, int num2) {
  int sum = num1 + num2;
  printf("Sum: %d\n", sum);
  return sum;
}


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

x86 assembly (clang, -O2):
<sum>:
push   %rbx
lea    (%rsi,%rdi,1),%ebx
lea    0xee5(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Sum: %d\0A\00"
define i32 @sum(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* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
@.str = [9 x i8] c"Sum: %d\0A\00"
define i32 @sum(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 %3
}
short __VERIFIER_nondet_short() {
  short val;
  return val;
}


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

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

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

LLVM IR (-O2):
define signext i16 @__VERIFIER_nondet_short() {
ret i16 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
char *getfname(char *);
void doSaveCommand(FILE **f) {
  char *fname;
  *f = NULL;
  fname = getfname("Save file as:");
  *f = fopen(fname, "wb");
}


x86 assembly (clang, -O0):
<doSaveCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
lea    0xec2(%rip),%rdi
call   1030 <getfname@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doSaveCommand>:
push   %rbx
mov    %rdi,%rbx
movq   $0x0,(%rdi)
lea    0xece(%rip),%rdi
call   1030 <getfname@plt>
lea    0xed0(%rip),%rsi
mov    %rax,%rdi
call   1040 <fopen@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Save file as:\00"
@.str.1 = [3 x i8] c"wb\00"
define void @doSaveCommand(i32** %0) {
%2 = alloca i32**
%3 = alloca i8*
store i32** %0, i32*** %2
%4 = load i32**, i32*** %2
store i32* null, i32** %4
%5 = call i8* @getfname(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32**, i32*** %2
store i32* %7, i32** %8
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Save file as:\00"
@.str.1 = [3 x i8] c"wb\00"
define void @doSaveCommand(i32** nocapture writeonly %0) {
store i32* null, i32** %0
%2 = tail call i8* @getfname(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void exit_usage(const char *program) {
  fprintf(stderr,
          "usage: %s -f <bpf_file> [-v]"
          " -a <arch> -s <syscall_num> [-0 <a0>] ... [-5 <a5>]\n",
          program);
  exit(EINVAL);
}


x86 assembly (clang, -O0):
<exit_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exit_usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [81 x i8] c"usage: %s -f <bpf_file> [-v] -a <arch> -s <syscall_num> [-0 <a0>] ... [-5 <a5>]\0A\00"
@EINVAL = global i32 0
define void @exit_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EINVAL
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [81 x i8] c"usage: %s -f <bpf_file> [-v] -a <arch> -s <syscall_num> [-0 <a0>] ... [-5 <a5>]\0A\00"
@EINVAL = global i32 0
define void @exit_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EINVAL
%5 = tail call i32 @exit(i32 %4)
unreachable
}
int squareValue(int x) { return x * x; }


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

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

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

LLVM IR (-O2):
define i32 @squareValue(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
extern char *opencores_device_str(int id) {
  switch (id) {
  case 0x4:
    return "OPENCORES_PCIBR";
  case 0x5:
    return "OPENCORES_ETHMAC";
  default:
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<opencores_device_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x4,%eax
je     112c <opencores_device_str+0x2c>
jmp    111b <opencores_device_str+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x5,%eax
je     113c <opencores_device_str+0x3c>
jmp    114c <opencores_device_str+0x4c>
lea    0xecd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1159 <opencores_device_str+0x59>
lea    0xecd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1159 <opencores_device_str+0x59>
jmp    1151 <opencores_device_str+0x51>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<opencores_device_str>:
xor    %ecx,%ecx
cmp    $0x5,%edi
lea    0xf04(%rip),%rax
cmove  %rax,%rcx
cmp    $0x4,%edi
lea    0xee6(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [16 x i8] c"OPENCORES_PCIBR\00"
@.str.1 = [17 x i8] c"OPENCORES_ETHMAC\00"
define i8* @opencores_device_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 4, label %5
i32 5, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
br label %8
8: ; preds = %7
store i8* null, i8** %2
br label %9
9: ; preds = %8, %6, %5
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [16 x i8] c"OPENCORES_PCIBR\00"
@.str.1 = [17 x i8] c"OPENCORES_ETHMAC\00"
define i8* @opencores_device_str(i32 %0) {
%2 = icmp eq i32 %0, 5
%3 = select i1 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* null
%4 = icmp eq i32 %0, 4
%5 = select i1 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
long long zuuu() { return 0x00007fff7fff7fffLL; }


x86 assembly (clang, -O0):
<zuuu>:
push   %rbp
mov    %rsp,%rbp
movabs $0x7fff7fff7fff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zuuu>:
movabs $0x7fff7fff7fff,%rax
ret

LLVM IR (-O0):
define i64 @zuuu() {
ret i64 140735340838911
}

LLVM IR (-O2):
define i64 @zuuu() {
ret i64 140735340838911
}
/* Variables and functions */
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void FLASH_init(void) {
  mbus_remote_register_write(0x5, 0x26, 0x0D7788);
  mbus_remote_register_write(0x5, 0x27, 0x011BC8);
  mbus_remote_register_write(0x5, 0x01, 0x000109);
  mbus_remote_register_write(0x5, 0x19, 0x000F03);
  mbus_remote_register_write(0x5, 0x0F, 0x001001);
}


x86 assembly (clang, -O0):
<FLASH_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
mov    $0x26,%esi
mov    $0xd7788,%edx
call   1030 <mbus_remote_register_write@plt>
mov    $0x5,%edi
mov    $0x27,%esi
mov    $0x11bc8,%edx
call   1030 <mbus_remote_register_write@plt>
mov    $0x5,%edi
mov    $0x1,%esi
mov    $0x109,%edx
call   1030 <mbus_remote_register_write@plt>
mov    $0x5,%edi
mov    $0x19,%esi
mov    $0xf03,%edx
call   1030 <mbus_remote_register_write@plt>
mov    $0x5,%edi
mov    $0xf,%esi
mov    $0x1001,%edx
call   1030 <mbus_remote_register_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<FLASH_init>:
push   %rax
mov    $0x5,%edi
mov    $0x26,%esi
mov    $0xd7788,%edx
call   1030 <mbus_remote_register_write@plt>
mov    $0x5,%edi
mov    $0x27,%esi
mov    $0x11bc8,%edx
call   1030 <mbus_remote_register_write@plt>
mov    $0x5,%edi
mov    $0x1,%esi
mov    $0x109,%edx
call   1030 <mbus_remote_register_write@plt>
mov    $0x5,%edi
mov    $0x19,%esi
mov    $0xf03,%edx
call   1030 <mbus_remote_register_write@plt>
mov    $0x5,%edi
mov    $0xf,%esi
mov    $0x1001,%edx
pop    %rax
jmp    1030 <mbus_remote_register_write@plt>

LLVM IR (-O0):
define void @FLASH_init() {
%1 = call i32 @mbus_remote_register_write(i32 5, i32 38, i32 882568)
%2 = call i32 @mbus_remote_register_write(i32 5, i32 39, i32 72648)
%3 = call i32 @mbus_remote_register_write(i32 5, i32 1, i32 265)
%4 = call i32 @mbus_remote_register_write(i32 5, i32 25, i32 3843)
%5 = call i32 @mbus_remote_register_write(i32 5, i32 15, i32 4097)
ret void
}

LLVM IR (-O2):
define void @FLASH_init() {
%1 = tail call i32 @mbus_remote_register_write(i32 5, i32 38, i32 882568)
%2 = tail call i32 @mbus_remote_register_write(i32 5, i32 39, i32 72648)
%3 = tail call i32 @mbus_remote_register_write(i32 5, i32 1, i32 265)
%4 = tail call i32 @mbus_remote_register_write(i32 5, i32 25, i32 3843)
%5 = tail call i32 @mbus_remote_register_write(i32 5, i32 15, i32 4097)
ret void
}
void RTReqQueueDestroy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTReqQueueDestroy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, char *);
void CWE190_Integer_Overflow__char_fscanf_add_01_bad() {
  char data;
  data = ' ';
  scanf("%c", &data);
  {
    char result = data + 1;
    printf("%d\n", result);
  }
}


x86 assembly (clang, -O0):
<CWE190_Integer_Overflow__char_fscanf_add_01_bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x20,-0x1(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x2(%rbp)
lea    0xeb6(%rip),%rdi
movsbl -0x2(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CWE190_Integer_Overflow__char_fscanf_add_01_bad>:
push   %rax
movb   $0x20,0x7(%rsp)
lea    0xed3(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x7(%rsp),%al
add    $0x1,%al
movsbl %al,%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @CWE190_Integer_Overflow__char_fscanf_add_01_bad() {
%1 = alloca i8
%2 = alloca i8
store i8 32, i8* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = add nsw i32 %5, 1
%7 = trunc i32 %6 to i8
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %8)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @CWE190_Integer_Overflow__char_fscanf_add_01_bad() {
%1 = alloca i8
store i8 32, i8* %1
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = add i8 %3, 1
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
ret void
}
int IsOperator(char c) {
  int i;
  char ops[] = "+-*/%^";
  for (i = 0; i < 6; i++) {
    if (c == ops[i])
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<IsOperator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    0xef0(%rip),%eax
mov    %eax,-0x13(%rbp)
mov    0xeea(%rip),%ax
mov    %ax,-0xf(%rbp)
mov    0xee2(%rip),%al
mov    %al,-0xd(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jge    116c <IsOperator+0x6c>
movsbl -0x5(%rbp),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x13(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    1159 <IsOperator+0x59>
movl   $0x1,-0x4(%rbp)
jmp    1173 <IsOperator+0x73>
jmp    115e <IsOperator+0x5e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112e <IsOperator+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsOperator>:
add    $0xdb,%dil
cmp    $0x39,%dil
ja     1124 <IsOperator+0x24>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x200000000000561,%rdx
bt     %rcx,%rdx
jae    1124 <IsOperator+0x24>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@__const.IsOperator.ops = [7 x i8] c"+-*/%^\00"
define i32 @IsOperator(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
%5 = alloca [7 x i8]
store i8 %0, i8* %3
%6 = bitcast [7 x i8]* %5 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %21, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 6
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %12, %17
br i1 %18, label %19, label %20
19: ; preds = %10
store i32 1, i32* %2
br label %25
20: ; preds = %10
br label %21
21: ; preds = %20
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %7
24: ; preds = %7
store i32 0, i32* %2
br label %25
25: ; preds = %24, %19
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @IsOperator(i8 signext %0) {
switch i8 %0, label %2 [
i8 43, label %3
i8 45, label %3
i8 42, label %3
i8 47, label %3
i8 37, label %3
i8 94, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 1, %1 ], [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
void view_bar(void *b) {}


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

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

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

LLVM IR (-O2):
define void @view_bar(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t fib_seq(int n) {
  if (n < 2)
    return n;
  return fib_seq(n - 1) + fib_seq(n - 2);
}


x86 assembly (clang, -O0):
<fib_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1130 <fib_seq+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <fib_seq+0x43>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib_seq@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib_seq@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib_seq>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jge    1120 <fib_seq+0x10>
mov    %ebx,%ecx
jmp    1144 <fib_seq+0x34>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbx),%edi
call   1030 <fib_seq@plt>
lea    -0x2(%rbx),%ecx
add    %eax,%ebp
cmp    $0x3,%ebx
mov    %ecx,%ebx
ja     1130 <fib_seq+0x20>
add    %ecx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib_seq(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fib_seq(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 4
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %9, %3 ]
%13 = phi i32 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i32 %13, %12
ret i32 %14
}
/* Variables and functions */
void *realloc(void *, size_t);
void *lb_realloc(void *ptr, size_t size) { return realloc(ptr, size); }


x86 assembly (clang, -O0):
<lb_realloc>:
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 <realloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lb_realloc>:
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define noalias i8* @lb_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int INET_ADDRSTRLEN;
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/ *, char *,
                             int);
scalar_t__ malloc(int);
char *idrnet_sockaddr_ipv4(void *sockaddr) {
  struct sockaddr_in *addr = (struct sockaddr_in *)sockaddr;
  char *ip_addr = (char *)malloc(sizeof(char) * INET_ADDRSTRLEN);
  inet_ntop(AF_INET, &(addr->sin_addr), ip_addr, INET_ADDRSTRLEN);
  return ip_addr;
}


x86 assembly (clang, -O0):
<idrnet_sockaddr_ipv4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e9d(%rip),%rax
movslq (%rax),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2e73(%rip),%rax
mov    (%rax),%ecx
call   1030 <inet_ntop@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idrnet_sockaddr_ipv4>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    0x2ea9(%rip),%r15
mov    (%r15),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%ecx
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <inet_ntop@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
@INET_ADDRSTRLEN = global i32 0
@AF_INET = global i32 0
define i8* @idrnet_sockaddr_ipv4(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.sockaddr_in*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to %struct.sockaddr_in*
store %struct.sockaddr_in* %6, %struct.sockaddr_in** %3
%7 = load i32, i32* @INET_ADDRSTRLEN
%8 = sext i32 %7 to i64
%9 = mul i64 1, %8
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %4
%13 = load i32, i32* @AF_INET
%14 = load %struct.sockaddr_in*, %struct.sockaddr_in** %3
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 0
%16 = load i8*, i8** %4
%17 = load i32, i32* @INET_ADDRSTRLEN
%18 = call i32 @inet_ntop(i32 %13, i32* %15, i8* %16, i32 %17)
%19 = load i8*, i8** %4
ret i8* %19
}

LLVM IR (-O2):
@INET_ADDRSTRLEN = global i32 0
@AF_INET = global i32 0
define i8* @idrnet_sockaddr_ipv4(i8* %0) {
%2 = load i32, i32* @INET_ADDRSTRLEN
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i8*
%5 = load i32, i32* @AF_INET
%6 = bitcast i8* %0 to i32*
%7 = load i32, i32* @INET_ADDRSTRLEN
%8 = tail call i32 @inet_ntop(i32 %5, i32* %6, i8* %4, i32 %7)
ret i8* %4
}
int *getNextEntry(int *entry) { return (int *)*entry; }


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

x86 assembly (clang, -O2):
<getNextEntry>:
movslq (%rdi),%rax
ret

LLVM IR (-O0):
define i32* @getNextEntry(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
ret i32* %6
}

LLVM IR (-O2):
define i32* @getNextEntry(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
ret i32* %4
}
short decodeY(int value) { return value & 0xFF; }


x86 assembly (clang, -O0):
<decodeY>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<decodeY>:
movzbl %dil,%eax
ret

LLVM IR (-O0):
define signext i16 @decodeY(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = trunc i32 %4 to i16
ret i16 %5
}

LLVM IR (-O2):
define signext i16 @decodeY(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = and i16 %2, 255
ret i16 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ fprintf(int /*<<< orphan*/ *, char *, int, int);
int file_stats_gnuplot_write(FILE *out, int cycle_number, int alive_cells) {
  if (fprintf(out, "%d %d\n", cycle_number, alive_cells) < 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<file_stats_gnuplot_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
cmp    $0x0,%rax
jge    114e <file_stats_gnuplot_write+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1155 <file_stats_gnuplot_write+0x45>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_stats_gnuplot_write>:
push   %rax
mov    %edx,%ecx
mov    %esi,%edx
lea    0xee4(%rip),%rsi
call   1030 <fprintf@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @file_stats_gnuplot_write(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i64 @fprintf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%5 = lshr i64 %4, 63
%6 = trunc i64 %5 to i32
%7 = xor i32 %6, 1
ret i32 %7
}
/* Type definitions */
struct passwd {
  int dummy;
};

/* Variables and functions */
int passwd_test_correctness(struct passwd *, int /*<<< orphan*/ *);
int passwd_test_getpwent(struct passwd *pwd, void *mdata) {
  return (passwd_test_correctness(pwd, NULL));
}


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

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

LLVM IR (-O0):
%struct.passwd = type { i32 }
define i32 @passwd_test_getpwent(%struct.passwd* %0, i8* %1) {
%3 = alloca %struct.passwd*
%4 = alloca i8*
store %struct.passwd* %0, %struct.passwd** %3
store i8* %1, i8** %4
%5 = load %struct.passwd*, %struct.passwd** %3
%6 = call i32 @passwd_test_correctness(%struct.passwd* %5, i32* null)
ret i32 %6
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
define i32 @passwd_test_getpwent(%struct.passwd* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @passwd_test_correctness(%struct.passwd* %0, i32* null)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_usage(int end) {
  fprintf(stderr, "Usage: ottd_preview file [-v] [-m nw|ne|iso] [-d "
                  "output.txt] [-p output.png]\n");
  if (end)
    exit(1);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
cmpl   $0x0,-0x4(%rbp)
je     1154 <print_usage+0x34>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
test   %ebx,%ebx
jne    113e <print_usage+0x1e>
pop    %rbx
ret
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [78 x i8] c"Usage: ottd_preview file [-v] [-m nw|ne|iso] [-d output.txt] [-p output.png]\0A\00"
define void @print_usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [78 x i8] c"Usage: ottd_preview file [-v] [-m nw|ne|iso] [-d output.txt] [-p output.png]\0A\00"
define void @print_usage(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ OPENSSL_showfatal(char *, char const *, int, char const *);
int /*<<< orphan*/ abort();
void OpenSSLDie(const char *file, int line, const char *assertion) {
  OPENSSL_showfatal("%s(%d): OpenSSL internal error, assertion failed: %s\n",
                    file, line, assertion);
  abort();
}


x86 assembly (clang, -O0):
<OpenSSLDie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xebb(%rip),%rdi
call   1040 <OPENSSL_showfatal@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<OpenSSLDie>:
push   %rax
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xed0(%rip),%rdi
call   1040 <OPENSSL_showfatal@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"%s(%d): OpenSSL internal error, assertion failed: %s\0A\00"
define void @OpenSSLDie(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @OPENSSL_showfatal(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i8* %9)
%11 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [54 x i8] c"%s(%d): OpenSSL internal error, assertion failed: %s\0A\00"
define void @OpenSSLDie(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @OPENSSL_showfatal(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
%5 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputs(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ gettext(char *);
void print_usage(FILE *stream) {
  fputs(gettext("Usage: ypset [-d domain] [-h hostname] server\n"), stream);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <gettext@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1040 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <gettext@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <fputs@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"Usage: ypset [-d domain] [-h hostname] server\0A\00"
define void @print_usage(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @gettext(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i32*, i32** %2
%5 = call i32 @fputs(i32 %3, i32* %4)
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"Usage: ypset [-d domain] [-h hostname] server\0A\00"
define void @print_usage(i32* %0) {
%2 = tail call i32 @gettext(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @fputs(i32 %2, i32* %0)
ret void
}
void RGBAToARGB() {}


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

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

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

LLVM IR (-O2):
define void @RGBAToARGB() {
ret void
}
/* Variables and functions */
float height(int);
float length_sum(int);
int /*<<< orphan*/ printf(char *, float);
void main() {
  float length = 0;
  float height1 = 0;
  length = length_sum(10);
  height1 = height(10);
  printf("The total length is:%f\n", length);
  printf("The 10 times height is:%f\n", height1);
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    $0xa,%edi
call   1050 <length_sum@plt>
movss  %xmm0,-0x4(%rbp)
mov    $0xa,%edi
call   1040 <height@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1050 <length_sum@plt>
movss  %xmm0,0x4(%rsp)
mov    $0xa,%edi
call   1040 <height@plt>
movss  %xmm0,(%rsp)
lea    0xea9(%rip),%rdi
movss  0x4(%rsp),%xmm0
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
movss  (%rsp),%xmm0
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"The total length is:%f\0A\00"
@.str.1 = [27 x i8] c"The 10 times height is:%f\0A\00"
define void @main() {
%1 = alloca float
%2 = alloca float
store float 0.000000e+00, float* %1
store float 0.000000e+00, float* %2
%3 = call float @length_sum(i32 10)
store float %3, float* %1
%4 = call float @height(i32 10)
store float %4, float* %2
%5 = load float, float* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), float %5)
%7 = load float, float* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), float %7)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"The total length is:%f\0A\00"
@.str.1 = [27 x i8] c"The 10 times height is:%f\0A\00"
define void @main() {
%1 = tail call float @length_sum(i32 10)
%2 = tail call float @height(i32 10)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), float %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), float %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ preload_seq(int);
void main(void) {
  preload_seq(173);
  preload_seq(56);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0xad,%edi
call   1030 <preload_seq@plt>
mov    $0x38,%edi
call   1030 <preload_seq@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xad,%edi
call   1030 <preload_seq@plt>
mov    $0x38,%edi
pop    %rax
jmp    1030 <preload_seq@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 @preload_seq(i32 173)
%2 = call i32 @preload_seq(i32 56)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @preload_seq(i32 173)
%2 = tail call i32 @preload_seq(i32 56)
ret void
}
/* Variables and functions */
double days2secs(double);
double jd2ctime(double jd[2]) {
  double d = (jd[0] - 2440587.5) + jd[1];
  return days2secs(d);
}


x86 assembly (clang, -O0):
<jd2ctime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xed4(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
addsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <days2secs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jd2ctime>:
movsd  (%rdi),%xmm0
addsd  0xee4(%rip),%xmm0
addsd  0x8(%rdi),%xmm0
jmp    1030 <days2secs@plt>

LLVM IR (-O0):
define double @jd2ctime(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 0
%6 = load double, double* %5
%7 = fsub double %6, 0x41429EC5C0000000
%8 = load double*, double** %2
%9 = getelementptr inbounds double, double* %8, i64 1
%10 = load double, double* %9
%11 = fadd double %7, %10
store double %11, double* %3
%12 = load double, double* %3
%13 = call double @days2secs(double %12)
ret double %13
}

LLVM IR (-O2):
define double @jd2ctime(double* nocapture %0) {
%2 = load double, double* %0
%3 = fadd double %2, 0xC1429EC5C0000000
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = fadd double %3, %5
%7 = tail call double @days2secs(double %6)
ret double %7
}