xunge/DecIR huggingface dataset:
/* Variables and functions */
int largestPerimeter(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int list[] = {2, 1, 2};
  int p = largestPerimeter(list, 3);
  printf("%d\n", p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
mov    $0x3,%esi
call   1040 <largestPerimeter@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1040 <largestPerimeter@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@__const.main.list = [3 x i32] [i32 2, i32 1, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @largestPerimeter(i32* %3, i32 3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcmp(char *, char *, int);
int check_header(char *header) {
  if (!memcmp(header, "\xAA\xAA\xAA\x96\x69", 5))
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<check_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x5,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
jne    1146 <check_header+0x36>
movl   $0x0,-0x4(%rbp)
jmp    114d <check_header+0x3d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_header>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x5,%edx
call   1030 <memcmp@plt>
neg    %eax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"\AA\AA\AA\96i\00"
define i32 @check_header(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @memcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 0, i32* %2
br label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [6 x i8] c"\AA\AA\AA\96i\00"
define i32 @check_header(i8* %0) {
%2 = tail call i32 @memcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%3 = icmp ne i32 %2, 0
%4 = sext i1 %3 to i32
ret i32 %4
}
double myrand(long *rand_seed) {
  long lo;
  long hi;
  long test;
  hi = *rand_seed / 127773L;
  lo = *rand_seed % 127773L;
  test = 16807L * lo - 2836L * hi;
  if (test > 0) {
    *rand_seed = test;
  } else {
    *rand_seed = test + 2147483647L;
  }
  return ((double)*rand_seed / 2147483647L);
}


x86 assembly (clang, -O0):
<myrand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    $0x1f31d,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    $0x1f31d,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x10(%rbp)
imul   $0x41a7,-0x10(%rbp),%rax
imul   $0xb14,-0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jle    1164 <myrand+0x64>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    1176 <myrand+0x76>
mov    -0x20(%rbp),%rcx
add    $0x7fffffff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cvtsi2sdq (%rax),%xmm0
movsd  0xe79(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<myrand>:
mov    (%rdi),%rcx
movabs $0x41a705af1fe3fb79,%rdx
05 a7 41
mov    %rcx,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xf,%rdx
add    %rax,%rdx
imul   $0x1f31d,%rdx,%rax
sub    %rax,%rcx
imul   $0x41a7,%rcx,%rax
imul   $0xfffffffffffff4ec,%rdx,%rcx
lea    (%rcx,%rax,1),%rdx
test   %rdx,%rdx
lea    0x7fffffff(%rcx,%rax,1),%rax
7f
cmovg  %rdx,%rax
mov    %rax,(%rdi)
cvtsi2sd %rax,%xmm0
divsd  0xea4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @myrand(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %2
%6 = load i64*, i64** %2
%7 = load i64, i64* %6
%8 = sdiv i64 %7, 127773
store i64 %8, i64* %4
%9 = load i64*, i64** %2
%10 = load i64, i64* %9
%11 = srem i64 %10, 127773
store i64 %11, i64* %3
%12 = load i64, i64* %3
%13 = mul nsw i64 16807, %12
%14 = load i64, i64* %4
%15 = mul nsw i64 2836, %14
%16 = sub nsw i64 %13, %15
store i64 %16, i64* %5
%17 = load i64, i64* %5
%18 = icmp sgt i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %1
%20 = load i64, i64* %5
%21 = load i64*, i64** %2
store i64 %20, i64* %21
br label %26
22: ; preds = %1
%23 = load i64, i64* %5
%24 = add nsw i64 %23, 2147483647
%25 = load i64*, i64** %2
store i64 %24, i64* %25
br label %26
26: ; preds = %22, %19
%27 = load i64*, i64** %2
%28 = load i64, i64* %27
%29 = sitofp i64 %28 to double
%30 = fdiv double %29, 0x41DFFFFFFFC00000
ret double %30
}

LLVM IR (-O2):
define double @myrand(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = sdiv i64 %2, 127773
%4 = srem i64 %2, 127773
%5 = mul nsw i64 %4, 16807
%6 = mul nsw i64 %3, -2836
%7 = add nsw i64 %6, %5
%8 = icmp sgt i64 %7, 0
%9 = add nsw i64 %7, 2147483647
%10 = select i1 %8, i64 %7, i64 %9
store i64 %10, i64* %0
%11 = sitofp i64 %10 to double
%12 = fdiv double %11, 0x41DFFFFFFFC00000
ret double %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ putc(long const, int /*<<< orphan*/ *);
void writelong(FILE *fp, const long l) {
  putc((l >> 24) & 0xFF, fp);
  putc((l >> 16) & 0xFF, fp);
  putc((l >> 8) & 0xFF, fp);
  putc(l & 0xFF, fp);
}


x86 assembly (clang, -O0):
<writelong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
sar    $0x18,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rdi
sar    $0x10,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rdi
sar    $0x8,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writelong>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %ebx,%edi
shr    $0x18,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
movzbl %bh,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
movzbl %bl,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putc@plt>

LLVM IR (-O0):
define void @writelong(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = ashr i64 %5, 24
%7 = and i64 %6, 255
%8 = load i32*, i32** %3
%9 = call i32 @putc(i64 %7, i32* %8)
%10 = load i64, i64* %4
%11 = ashr i64 %10, 16
%12 = and i64 %11, 255
%13 = load i32*, i32** %3
%14 = call i32 @putc(i64 %12, i32* %13)
%15 = load i64, i64* %4
%16 = ashr i64 %15, 8
%17 = and i64 %16, 255
%18 = load i32*, i32** %3
%19 = call i32 @putc(i64 %17, i32* %18)
%20 = load i64, i64* %4
%21 = and i64 %20, 255
%22 = load i32*, i32** %3
%23 = call i32 @putc(i64 %21, i32* %22)
ret void
}

LLVM IR (-O2):
define void @writelong(i32* nocapture %0, i64 %1) {
%3 = lshr i64 %1, 24
%4 = and i64 %3, 255
%5 = tail call i32 @putc(i64 %4, i32* %0)
%6 = lshr i64 %1, 16
%7 = and i64 %6, 255
%8 = tail call i32 @putc(i64 %7, i32* %0)
%9 = lshr i64 %1, 8
%10 = and i64 %9, 255
%11 = tail call i32 @putc(i64 %10, i32* %0)
%12 = and i64 %1, 255
%13 = tail call i32 @putc(i64 %12, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ indigoFree(int);
int indigoLoadReactionSmarts(int);
int indigoReadString(char const *);
__attribute__((visibility("default"))) int
indigoLoadReactionSmartsFromString(const char *string) {
  int source = indigoReadString(string);
  int result;
  if (source <= 0)
    return -1;
  result = indigoLoadReactionSmarts(source);
  indigoFree(source);
  return result;
}


x86 assembly (clang, -O0):
<indigoLoadReactionSmartsFromString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <indigoReadString@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     115e <indigoLoadReactionSmartsFromString+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <indigoLoadReactionSmartsFromString+0x47>
mov    -0x14(%rbp),%edi
call   1040 <indigoLoadReactionSmarts@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <indigoFree@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indigoLoadReactionSmartsFromString>:
push   %rbp
push   %rbx
push   %rax
call   1050 <indigoReadString@plt>
test   %eax,%eax
jle    1152 <indigoLoadReactionSmartsFromString+0x22>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <indigoLoadReactionSmarts@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <indigoFree@plt>
mov    %ebp,%eax
jmp    1157 <indigoLoadReactionSmartsFromString+0x27>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @indigoLoadReactionSmartsFromString(i8* %0) {
%2 = tail call i32 @indigoReadString(i8* %0)
%3 = icmp slt i32 %2, 1
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @indigoLoadReactionSmarts(i32 %2)
%6 = tail call i32 @indigoFree(i32 %2)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %5, %4 ], [ -1, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ feraiseexcept(int);
void uninitvar_feraiseexcept(void) {
  int excepts;
  (void)feraiseexcept(excepts);
}


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

x86 assembly (clang, -O2):
<uninitvar_feraiseexcept>:
jmp    1030 <feraiseexcept@plt>

LLVM IR (-O0):
define void @uninitvar_feraiseexcept() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @feraiseexcept(i32 %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_feraiseexcept() {
%1 = tail call i32 @feraiseexcept(i32 undef)
ret void
}
char *CON_Input(void) { return ((void *)0); }


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

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

LLVM IR (-O0):
define i8* @CON_Input() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @CON_Input() {
ret i8* null
}
int mt_cpu_dormant(unsigned long data) { return 8; }


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

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

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

LLVM IR (-O2):
define i32 @mt_cpu_dormant(i64 %0) {
ret i32 8
}
void gtk_tool_item_get_relief_style() {}


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

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

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

LLVM IR (-O2):
define void @gtk_tool_item_get_relief_style() {
ret void
}
unsigned int lshift_(unsigned int *arg, int *len) { return (*arg << *len); }


x86 assembly (clang, -O0):
<lshift_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lshift_>:
mov    (%rdi),%eax
mov    (%rsi),%cl
shl    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @lshift_(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = shl i32 %3, %4
ret i32 %5
}
/* Variables and functions */
scalar_t__ lgamma(double);
float lgammaf(float x) { return (float)lgamma((double)x); }


x86 assembly (clang, -O0):
<lgammaf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <lgamma@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lgammaf>:
push   %rax
cvtss2sd %xmm0,%xmm0
call   1030 <lgamma@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @lgammaf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call i64 @lgamma(double %4)
%6 = sitofp i64 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @lgammaf(float %0) {
%2 = fpext float %0 to double
%3 = tail call i64 @lgamma(double %2)
%4 = sitofp i64 %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void usage(char *progname) {
  printf("\nZeusBench v1.0\n\n");
  printf("Usage: %s <machine> <file> [-k] [-n requests | -t timelimit (sec)]"
         "\n\t\t[-c concurrency] [-p port] \n",
         progname);
  printf("Filename should start with a '/' e.g. /index.html\n\n");
  exit(EINVAL);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xf27(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf1b(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"\0AZeusBench v1.0\0A\0A\00"
@.str.1 = [98 x i8] c"Usage: %s <machine> <file> [-k] [-n requests | -t timelimit (sec)]\0A\09\09[-c concurrency] [-p port] \0A\00"
@.str.2 = [52 x i8] c"Filename should start with a '/' e.g. /index.html\0A\0A\00"
@EINVAL = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @EINVAL
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@.str.1 = [98 x i8] c"Usage: %s <machine> <file> [-k] [-n requests | -t timelimit (sec)]\0A\09\09[-c concurrency] [-p port] \0A\00"
@EINVAL = global i32 0
@str = [17 x i8] c"\0AZeusBench v1.0\0A\00"
@str.3 = [51 x i8] c"Filename should start with a '/' e.g. /index.html\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.3, i64 0, i64 0))
%5 = load i32, i32* @EINVAL
%6 = tail call i32 @exit(i32 %5)
unreachable
}
void free_move(struct move *mov) {}


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

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

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

LLVM IR (-O2):
%struct.move = type opaque
define void @free_move(%struct.move* nocapture %0) {
ret void
}
/* Type definitions */
struct timeval {
  double tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double get_time(void) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  double x = tv.tv_sec;
  x *= 1000;
  x += tv.tv_usec / 1000;
  return x;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec9(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xed2(%rip),%xmm1
movslq 0x10(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, i32 }
define double @get_time() {
%1 = alloca %struct.timeval
%2 = alloca double
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load double, double* %4
store double %5, double* %2
%6 = load double, double* %2
%7 = fmul double %6, 1.000000e+03
store double %7, double* %2
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%9 = load i32, i32* %8
%10 = sdiv i32 %9, 1000
%11 = sitofp i32 %10 to double
%12 = load double, double* %2
%13 = fadd double %12, %11
store double %13, double* %2
%14 = load double, double* %2
ret double %14
}

LLVM IR (-O2):
%struct.timeval = type { double, i32 }
define double @get_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = fmul double %5, 1.000000e+03
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = sitofp i32 %9 to double
%11 = fadd double %6, %10
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ nvic_globalirq_enable();
void interrupts() { nvic_globalirq_enable(); }


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

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

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

LLVM IR (-O2):
define void @interrupts() {
%1 = tail call i32 (...) @nvic_globalirq_enable()
ret void
}
/* Variables and functions */
int remote_send_data(char *, scalar_t__);
scalar_t__ strlen(char *);
int remote_send(char *text) { return remote_send_data(text, strlen(text) + 1); }


x86 assembly (clang, -O0):
<remote_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
call   1030 <remote_send_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remote_send>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <remote_send_data@plt>

LLVM IR (-O0):
define i32 @remote_send(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i32 @remote_send_data(i8* %3, i64 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @remote_send(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i32 @remote_send_data(i8* %0, i64 %3)
ret i32 %4
}
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  if (a == 0 || b == 0)
    return a + b;
  return gcd(b, a % b);
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <gcd+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1147 <gcd+0x37>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1163 <gcd+0x53>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rdx,%rsi
call   1030 <gcd@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %rsi,%rdx
mov    %rdi,%rax
test   %rdi,%rdi
je     1110 <gcd+0x10>
test   %rdx,%rdx
jne    112d <gcd+0x2d>
mov    %rax,%rcx
add    %rdx,%rcx
mov    %rcx,%rax
ret
nopw   0x0(%rax,%rax,1)
xor    %edx,%edx
div    %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1113 <gcd+0x13>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1120 <gcd+0x20>
xor    %edx,%edx
div    %ecx
jmp    1125 <gcd+0x25>

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

LLVM IR (-O2):
define i64 @gcd(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
%4 = icmp eq i64 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %10, %2
%7 = phi i64 [ %0, %2 ], [ %11, %10 ]
%8 = phi i64 [ %1, %2 ], [ %13, %10 ]
%9 = add i64 %8, %7
ret i64 %9
10: ; preds = %2, %10
%11 = phi i64 [ %13, %10 ], [ %1, %2 ]
%12 = phi i64 [ %11, %10 ], [ %0, %2 ]
%13 = urem i64 %12, %11
%14 = icmp eq i64 %13, 0
br i1 %14, label %6, label %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage: packnam [--width=NUM] [--vram-address=NUM]\n"
         "               [--output=FILE] [--zero-terminate]\n"
         "               [--verbose]\n"
         "               [--help] [--usage] [--version]\n"
         "                FILE\n");
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [195 x i8] c"Usage: packnam [--width=NUM] [--vram-address=NUM]\0A [--output=FILE] [--zero-terminate]\0A [--verbose]\0A [--help] [--usage] [--version]\0A FILE\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([195 x i8], [195 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [194 x i8] c"Usage: packnam [--width=NUM] [--vram-address=NUM]\0A [--output=FILE] [--zero-terminate]\0A [--verbose]\0A [--help] [--usage] [--version]\0A FILE\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([194 x i8], [194 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x9e() {
  Assert_real((isdigit(158) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              795, ("isdigit should be 0 for 0x9e"));
}


x86 assembly (clang, -O0):
<t_isdigit_0x9e>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9e,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x31b,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0x9e>:
push   %rax
mov    $0x9e,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x31b,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0x9e\00"
define void @t_isdigit_0x9e() {
%1 = call i64 @isdigit(i32 158)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 795, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0x9e\00"
define void @t_isdigit_0x9e() {
%1 = tail call i64 @isdigit(i32 158)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 795, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
rwaccess(fname) char *fname;
{
  int fd;
  fd = open(fname, 2);
  if (fd < 0)
    return 0;
  (void)close(fd);
  return 1;
}


x86 assembly (clang, -O0):
<rwaccess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1040 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1155 <rwaccess+0x35>
movl   $0x0,-0x4(%rbp)
jmp    1166 <rwaccess+0x46>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1030 <close@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rwaccess>:
push   %rbx
xor    %ebx,%ebx
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <open@plt>
test   %eax,%eax
js     1141 <rwaccess+0x21>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <close@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @rwaccess(i8* %0) {
%2 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @open to i32 (i8*, i32, ...)*)(i8* %0, i32 2)
%3 = icmp slt i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
int test_imm_E6uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xE6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E6uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0xe6,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E6uint64_midword_reg>:
test   $0xe60000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_E6uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 15073280
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void *mythread(void *arg) {
  printf("%s\n", (char *)arg);
  return NULL;
}


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

x86 assembly (clang, -O2):
<mythread>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define noalias i8* @mythread(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ i2c_SetCLKREG(int /*<<< orphan*/, int, unsigned char,
                                 unsigned char);
void i2c0_SetCLKREG(int mode, unsigned char prescale1,
                    unsigned char prescale2) {
  i2c_SetCLKREG(0, mode, prescale1, prescale2);
}


x86 assembly (clang, -O0):
<i2c0_SetCLKREG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %edi,-0x4(%rbp)
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x5(%rbp),%al
xor    %edi,%edi
movzbl %al,%edx
movzbl -0x6(%rbp),%ecx
call   1030 <i2c_SetCLKREG@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c0_SetCLKREG>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <i2c_SetCLKREG@plt>

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

LLVM IR (-O2):
define void @i2c0_SetCLKREG(i32 %0, i8 zeroext %1, i8 zeroext %2) {
%4 = tail call i32 @i2c_SetCLKREG(i32 0, i32 %0, i8 zeroext %1, i8 zeroext %2)
ret void
}
/* Variables and functions */
unsigned int startHandleMessage(void *, char *, int, void **, unsigned int *);
unsigned int startAssertFact(void *handle, char *message, void **rulesBinding,
                             unsigned int *replyCount) {
  return startHandleMessage(handle, message, 1, rulesBinding, replyCount);
}


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

x86 assembly (clang, -O2):
<startAssertFact>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    $0x1,%edx
jmp    1030 <startHandleMessage@plt>

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

LLVM IR (-O2):
define i32 @startAssertFact(i8* %0, i8* %1, i8** %2, i32* %3) {
%5 = tail call i32 @startHandleMessage(i8* %0, i8* %1, i32 1, i8** %2, i32* %3)
ret i32 %5
}
void sti(void) { *(int *)0x80001104 = 1; }


x86 assembly (clang, -O0):
<sti>:
push   %rbp
mov    %rsp,%rbp
mov    $0x80001104,%eax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sti>:
mov    $0x80001104,%eax
movl   $0x1,(%rax)
ret

LLVM IR (-O0):
define void @sti() {
store i32 1, i32* inttoptr (i64 2147488004 to i32*)
ret void
}

LLVM IR (-O2):
define void @sti() {
store i32 1, i32* inttoptr (i64 2147488004 to i32*)
ret void
}
/* Variables and functions */
double exp(double);
double myrandom(int);
long random_poisson(int sn, int a) {
  long n = -1;
  double e, p = 1.0;
  e = exp((double)-a);
  do {
    p *= myrandom(sn);
    n++;
  } while (p >= e);
  return (n);
}


x86 assembly (clang, -O0):
<random_poisson>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movq   $0xffffffffffffffff,-0x10(%rbp)
ff
movsd  0xec2(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <myrandom@plt>
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jae    1156 <random_poisson+0x36>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_poisson>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebp
neg    %esi
cvtsi2sd %esi,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xebf(%rip),%xmm0
mov    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
mov    %ebp,%edi
call   1030 <myrandom@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
add    $0x1,%rbx
ucomisd 0x10(%rsp),%xmm0
jae    1150 <random_poisson+0x30>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i64 @random_poisson(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca double
%7 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
store i64 -1, i64* %5
store double 1.000000e+00, double* %7
%8 = load i32, i32* %4
%9 = sub nsw i32 0, %8
%10 = sitofp i32 %9 to double
%11 = call double @exp(double %10)
store double %11, double* %6
br label %12
12: ; preds = %19, %2
%13 = load i32, i32* %3
%14 = call double @myrandom(i32 %13)
%15 = load double, double* %7
%16 = fmul double %15, %14
store double %16, double* %7
%17 = load i64, i64* %5
%18 = add nsw i64 %17, 1
store i64 %18, i64* %5
br label %19
19: ; preds = %12
%20 = load double, double* %7
%21 = load double, double* %6
%22 = fcmp oge double %20, %21
br i1 %22, label %12, label %23
23: ; preds = %19
%24 = load i64, i64* %5
ret i64 %24
}

LLVM IR (-O2):
define i64 @random_poisson(i32 %0, i32 %1) {
%3 = sub nsw i32 0, %1
%4 = sitofp i32 %3 to double
%5 = tail call double @exp(double %4)
br label %6
6: ; preds = %6, %2
%7 = phi i64 [ -1, %2 ], [ %11, %6 ]
%8 = phi double [ 1.000000e+00, %2 ], [ %10, %6 ]
%9 = tail call double @myrandom(i32 %0)
%10 = fmul double %8, %9
%11 = add nsw i64 %7, 1
%12 = fcmp ult double %10, %5
br i1 %12, label %13, label %6
13: ; preds = %6
ret i64 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ print_field_unicode(char *, int /*<<< orphan*/ const *, int);
int decode_product(uint8_t idx, const uint8_t *buf, int len) {
  (void)idx;
  print_field_unicode("Product", buf, len);
  return 0;
}


x86 assembly (clang, -O0):
<decode_product>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xed0(%rip),%rdi
call   1030 <print_field_unicode@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_product>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <print_field_unicode@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"Product\00"
define i32 @decode_product(i32 %0, i32* %1, i32 %2) {
%4 = tail call i32 @print_field_unicode(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %1, i32 %2)
ret i32 0
}
/* Type definitions */
struct csx_match_table {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ match_table_free(struct csx_match_table **);
unsigned csx_free_match_table(struct csx_match_table **mt) {
  if (mt && *mt)
    match_table_free(mt);
  return 0;
}


x86 assembly (clang, -O0):
<csx_free_match_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113e <csx_free_match_table+0x2e>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     113e <csx_free_match_table+0x2e>
mov    -0x8(%rbp),%rdi
call   1030 <match_table_free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csx_free_match_table>:
push   %rax
test   %rdi,%rdi
je     1121 <csx_free_match_table+0x11>
cmpq   $0x0,(%rdi)
je     1121 <csx_free_match_table+0x11>
call   1030 <match_table_free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.csx_match_table = type { i32 }
define i32 @csx_free_match_table(%struct.csx_match_table** %0) {
%2 = alloca %struct.csx_match_table**
store %struct.csx_match_table** %0, %struct.csx_match_table*** %2
%3 = load %struct.csx_match_table**, %struct.csx_match_table*** %2
%4 = icmp ne %struct.csx_match_table** %3, null
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load %struct.csx_match_table**, %struct.csx_match_table*** %2
%7 = load %struct.csx_match_table*, %struct.csx_match_table** %6
%8 = icmp ne %struct.csx_match_table* %7, null
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load %struct.csx_match_table**, %struct.csx_match_table*** %2
%11 = call i32 @match_table_free(%struct.csx_match_table** %10)
br label %12
12: ; preds = %9, %5, %1
ret i32 0
}

LLVM IR (-O2):
%struct.csx_match_table = type { i32 }
define i32 @csx_free_match_table(%struct.csx_match_table** %0) {
%2 = icmp eq %struct.csx_match_table** %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load %struct.csx_match_table*, %struct.csx_match_table** %0
%5 = icmp eq %struct.csx_match_table* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @match_table_free(%struct.csx_match_table** %0)
br label %8
8: ; preds = %6, %3, %1
ret i32 0
}
/* Type definitions */
struct sigcontext {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ error(char *, int);
void handler(int sig, int code, struct sigcontext *scp) {
  error("wrote to pipe with closed read end", 204);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    0xed7(%rip),%rdi
mov    $0xcc,%esi
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handler>:
lea    0xee9(%rip),%rdi
mov    $0xcc,%esi
jmp    1030 <error@plt>

LLVM IR (-O0):
%struct.sigcontext = type { i32 }
@.str = [35 x i8] c"wrote to pipe with closed read end\00"
define void @handler(i32 %0, i32 %1, %struct.sigcontext* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sigcontext*
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.sigcontext* %2, %struct.sigcontext** %6
%7 = call i32 @error(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 204)
ret void
}

LLVM IR (-O2):
%struct.sigcontext = type { i32 }
@.str = [35 x i8] c"wrote to pipe with closed read end\00"
define void @handler(i32 %0, i32 %1, %struct.sigcontext* nocapture readnone %2) {
%4 = tail call i32 @error(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 204)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ varinfo5_main();
int main(void) {
  varinfo5_main();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @varinfo5_main()
ret i32 0
}
void cfunction_(float *a, float *b) {
  *a = 7.0;
  *b = 8.0;
}


x86 assembly (clang, -O0):
<cfunction_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  0xeec(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0xed8(%rip),%xmm0
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfunction_>:
movl   $0x40e00000,(%rdi)
movl   $0x41000000,(%rsi)
ret

LLVM IR (-O0):
define void @cfunction_(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
store float 7.000000e+00, float* %5
%6 = load float*, float** %4
store float 8.000000e+00, float* %6
ret void
}

LLVM IR (-O2):
define void @cfunction_(float* nocapture writeonly %0, float* nocapture writeonly %1) {
store float 7.000000e+00, float* %0
store float 8.000000e+00, float* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ NodeApp__Boot__booted();
void RealMainP__Boot__booted(void) { NodeApp__Boot__booted(); }


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

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

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

LLVM IR (-O2):
define void @RealMainP__Boot__booted() {
%1 = tail call i32 (...) @NodeApp__Boot__booted()
ret void
}
/* Variables and functions */
scalar_t__ find_port(int);
int get_free_port(void) {
  static int i = 1;
  while (find_port(i))
    i++;
  return i;
}


x86 assembly (clang, -O0):
<get_free_port>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <get_free_port+0x9>
mov    0x2f09(%rip),%edi
call   1030 <find_port@plt>
cmp    $0x0,%rax
je     1142 <get_free_port+0x32>
mov    0x2ef4(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eeb(%rip)
jmp    1119 <get_free_port+0x9>
mov    0x2ee0(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_free_port>:
push   %rax
mov    0x2f11(%rip),%edi
nopw   0x0(%rax,%rax,1)
call   1030 <find_port@plt>
test   %rax,%rax
je     113b <get_free_port+0x2b>
mov    0x2ef8(%rip),%edi
add    $0x1,%edi
mov    %edi,0x2eef(%rip)
jmp    1120 <get_free_port+0x10>
mov    0x2ee7(%rip),%eax
pop    %rcx
ret

LLVM IR (-O0):
@get_free_port.i = internal global i32 1
define i32 @get_free_port() {
br label %1
1: ; preds = %5, %0
%2 = load i32, i32* @get_free_port.i
%3 = call i64 @find_port(i32 %2)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @get_free_port.i
%7 = add nsw i32 %6, 1
store i32 %7, i32* @get_free_port.i
br label %1
8: ; preds = %1
%9 = load i32, i32* @get_free_port.i
ret i32 %9
}

LLVM IR (-O2):
@get_free_port.i = internal unnamed_addr global i32 1
define i32 @get_free_port() {
%1 = load i32, i32* @get_free_port.i
%2 = tail call i64 @find_port(i32 %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %0, %4
%5 = load i32, i32* @get_free_port.i
%6 = add nsw i32 %5, 1
store i32 %6, i32* @get_free_port.i
%7 = tail call i64 @find_port(i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %0
%10 = load i32, i32* @get_free_port.i
ret i32 %10
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ i;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  unsigned int i = 0x01;
  uint8_t *p;
  printf("sizeof(unsigned int) = %d\n", sizeof(i));
  p = (uint8_t *)&i;
  if (*p == 0x01) {
    printf("little endian\n");
  } else {
    printf("big endian\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xecc(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x1,(%rax)
jne    1168 <main+0x58>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1176 <main+0x66>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [27 x i8] c"sizeof(unsigned int) = %d\0A\00"
@str = [14 x i8] c"little endian\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 4)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}