xunge/DecIR huggingface dataset:
/* Variables and functions */
double GammaQ(double, double);
int /*<<< orphan*/ assert(int);
double chi2cdfQ(double x, double df) {
  assert(df > 0);
  return GammaQ(0.5 * df, 0.5 * x);
}


x86 assembly (clang, -O0):
<chi2cdfQ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  0xead(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xea0(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
call   1040 <GammaQ@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chi2cdfQ>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
xor    %edi,%edi
ucomisd %xmm0,%xmm1
seta   %dil
call   1030 <assert@plt>
movsd  0xeb5(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
mulsd  %xmm2,%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm2,%xmm1
add    $0x18,%rsp
jmp    1040 <GammaQ@plt>

LLVM IR (-O0):
define double @chi2cdfQ(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp ogt double %5, 0.000000e+00
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load double, double* %4
%10 = fmul double 5.000000e-01, %9
%11 = load double, double* %3
%12 = fmul double 5.000000e-01, %11
%13 = call double @GammaQ(double %10, double %12)
ret double %13
}

LLVM IR (-O2):
define double @chi2cdfQ(double %0, double %1) {
%3 = fcmp ogt double %1, 0.000000e+00
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = fmul double %1, 5.000000e-01
%7 = fmul double %0, 5.000000e-01
%8 = tail call double @GammaQ(double %6, double %7)
ret double %8
}
unsigned long long rev8(unsigned long long in) {
  __asm__("bswap %0" : "=r"(in) : "0"(in));
  return in;
}


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

x86 assembly (clang, -O2):
<rev8>:
mov    %rdi,%rax
bswap  %rax
ret

LLVM IR (-O0):
define i64 @rev8(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 asm "bswap $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %3)
store i64 %4, i64* %2
%5 = load i64, i64* %2
ret i64 %5
}

LLVM IR (-O2):
define i64 @rev8(i64 %0) {
%2 = tail call i64 asm "bswap $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret i64 %2
}
int icomp(int *p1, int *p2) { return ((*p1 < *p2) ? -1 : (*p1 > *p2)); }


x86 assembly (clang, -O0):
<icomp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    112b <icomp+0x2b>
mov    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <icomp+0x42>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @icomp(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 = icmp slt i32 %6, %8
br i1 %9, label %10, label %11
10: ; preds = %2
br label %18
11: ; preds = %2
%12 = load i32*, i32** %3
%13 = load i32, i32* %12
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = icmp sgt i32 %13, %15
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %11, %10
%19 = phi i32 [ -1, %10 ], [ %17, %11 ]
ret i32 %19
}

LLVM IR (-O2):
define i32 @icomp(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %3, %4
%6 = icmp sgt i32 %3, %4
%7 = zext i1 %6 to i32
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
/* Variables and functions */
long Bar3(int, int);
int /*<<< orphan*/ printf(char *, long);
int main() {
  long res;
  res = Bar3(6, 8);
  printf("main: res = %d\n", res);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"main: res = %d\0A\00"
define i32 @main() {
%1 = tail call i64 @Bar3(i32 6, i32 8)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %1)
ret i32 0
}
double csys(x)
char *x;
{
  system(x + 1);
  cmdh();
  return (0.0);
}


x86 assembly (clang, -O0):
<csys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    $0x0,%al
call   1030 <system@plt>
mov    $0x0,%al
call   1040 <cmdh@plt>
xorps  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csys>:
push   %rax
add    $0x1,%rdi
xor    %eax,%eax
call   1030 <system@plt>
xor    %eax,%eax
call   1040 <cmdh@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @csys(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %4)
%6 = call i32 (...) @cmdh()
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @csys(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %2)
%4 = tail call i32 (...) @cmdh()
ret double 0.000000e+00
}
/* Variables and functions */
long strtol(char *, char **, int);
int sysapi_get_int(char *data, int *err, long int *val) {
  char *endptr;
  *val = strtol(data, &endptr, 10);
  if (endptr) {
    *err = -1;
    return -1;
  }
  *err = 0;
  return 0;
}


x86 assembly (clang, -O0):
<sysapi_get_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     1161 <sysapi_get_int+0x51>
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1172 <sysapi_get_int+0x62>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysapi_get_int>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,(%rbx)
xor    %eax,%eax
cmp    (%rsp),%rax
sbb    %eax,%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @sysapi_get_int(i8* %0, i32* nocapture writeonly %1, i64* nocapture writeonly %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = call i64 @strtol(i8* %0, i8** %4, i32 10)
store i64 %6, i64* %2
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
%9 = sext i1 %8 to i32
store i32 %9, i32* %1
ret i32 %9
}
int test_imm_8Cint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x8C << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_8Cint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 9175040
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ initDirectories();
void dirSetup(const char *executable[]) { initDirectories(); }


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

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

LLVM IR (-O0):
define void @dirSetup(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 (...) @initDirectories()
ret void
}

LLVM IR (-O2):
define void @dirSetup(i8** nocapture readnone %0) {
%2 = tail call i32 (...) @initDirectories()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pci_scan_devices(int /*<<< orphan*/);
void pci_init() { pci_scan_devices(0); }


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

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

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

LLVM IR (-O2):
define void @pci_init() {
%1 = tail call i32 @pci_scan_devices(i32 0)
ret void
}
/* Variables and functions */
float __nv_erfinvf(float);
float erfinvf(float __a) { return __nv_erfinvf(__a); }


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

x86 assembly (clang, -O2):
<erfinvf>:
jmp    1030 <__nv_erfinvf@plt>

LLVM IR (-O0):
define float @erfinvf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @__nv_erfinvf(float %3)
ret float %4
}

LLVM IR (-O2):
define float @erfinvf(float %0) {
%2 = tail call float @__nv_erfinvf(float %0)
ret float %2
}
int LOG_2(int bsize) {
  int val = 1, count = 0;
  if (bsize <= 0 || (bsize & (bsize - 1))) {
    return -1;
  }
  do {
    count++;
    val = (bsize & 1);
    bsize >>= 1;
  } while (val == 0);
  return (count - 1);
}


x86 assembly (clang, -O0):
<LOG_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1133 <LOG_2+0x33>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     113f <LOG_2+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1172 <LOG_2+0x72>
jmp    1144 <LOG_2+0x44>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1144 <LOG_2+0x44>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LOG_2>:
mov    $0xffffffff,%eax
test   %edi,%edi
jle    115d <LOG_2+0x5d>
mov    %edi,%ecx
shr    %ecx
and    $0x55555555,%ecx
mov    %edi,%edx
sub    %ecx,%edx
mov    %edx,%ecx
and    $0x33333333,%ecx
shr    $0x2,%edx
and    $0x33333333,%edx
add    %ecx,%edx
mov    %edx,%ecx
shr    $0x4,%ecx
add    %edx,%ecx
and    $0xf0f0f0f,%ecx
imul   $0x1010101,%ecx,%ecx
shr    $0x18,%ecx
cmp    $0x1,%ecx
ja     115d <LOG_2+0x5d>
mov    $0xffffffff,%eax
mov    %edi,%ecx
nopl   0x0(%rax)
sar    %ecx
add    $0x1,%eax
test   $0x1,%dil
mov    %ecx,%edi
je     1150 <LOG_2+0x50>
ret

LLVM IR (-O0):
define i32 @LOG_2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %1
%9 = load i32, i32* %3
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 1
%12 = and i32 %9, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %8, %1
store i32 -1, i32* %2
br label %29
15: ; preds = %8
br label %16
16: ; preds = %23, %15
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
%19 = load i32, i32* %3
%20 = and i32 %19, 1
store i32 %20, i32* %4
%21 = load i32, i32* %3
%22 = ashr i32 %21, 1
store i32 %22, i32* %3
br label %23
23: ; preds = %16
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 0
br i1 %25, label %16, label %26
26: ; preds = %23
%27 = load i32, i32* %5
%28 = sub nsw i32 %27, 1
store i32 %28, i32* %2
br label %29
29: ; preds = %26, %14
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @LOG_2(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = tail call i32 @llvm.ctpop.i32(i32 %0)
%4 = icmp ult i32 %3, 2
%5 = and i1 %2, %4
br i1 %5, label %6, label %13
6: ; preds = %1, %6
%7 = phi i32 [ %11, %6 ], [ %0, %1 ]
%8 = phi i32 [ %9, %6 ], [ 0, %1 ]
%9 = add nuw nsw i32 %8, 1
%10 = and i32 %7, 1
%11 = ashr i32 %7, 1
%12 = icmp eq i32 %10, 0
br i1 %12, label %6, label %13
13: ; preds = %6, %1
%14 = phi i32 [ -1, %1 ], [ %8, %6 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ scrabbleScore();
int main(int argc, const char *argv[]) {
  scrabbleScore();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @scrabbleScore()
ret i32 0
}
void ecc_context_destroy(void) {}


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

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

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

LLVM IR (-O2):
define void @ecc_context_destroy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ simulator_parse_args(int, char **);
int /*<<< orphan*/ simulator_run();
int main(int argc, char **argv) {
  if (!simulator_parse_args(argc, argv))
    return 1;
  simulator_run();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <simulator_parse_args@plt>
cmp    $0x0,%eax
jne    1157 <main+0x37>
movl   $0x1,-0x4(%rbp)
jmp    1165 <main+0x45>
mov    $0x0,%al
call   1030 <simulator_run@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1040 <simulator_parse_args@plt>
test   %eax,%eax
je     1135 <main+0x15>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <simulator_run@plt>
jmp    113a <main+0x1a>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @simulator_parse_args(i32 %0, i8** %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @simulator_run()
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ 0, %5 ], [ 1, %2 ]
ret i32 %8
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ thread_id;
typedef scalar_t__ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
scalar_t__ pthread_self();
int util_djb_hash_block(unsigned char *, int);
uint32_t __err_get_threadid(void) {
  pthread_t tid;
  int thread_id = 0;
  memset((void *)&tid, 0, sizeof(pthread_t));
  tid = pthread_self();
  if (sizeof(pthread_t) == sizeof(int)) {
    memcpy((void *)&thread_id, (void *)&tid, sizeof(thread_id));
  } else {
    thread_id = util_djb_hash_block((unsigned char *)&tid, sizeof(pthread_t));
  }
  return thread_id;
}


x86 assembly (clang, -O0):
<__err_get_threadid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %rax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <util_djb_hash_block@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__err_get_threadid>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
xor    %eax,%eax
call   1050 <pthread_self@plt>
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <util_djb_hash_block@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @__err_get_threadid() {
%1 = alloca i64
%2 = alloca i32
store i32 0, i32* %2
%3 = bitcast i64* %1 to i8*
%4 = call i32 @memset(i8* %3, i32 0, i32 8)
%5 = call i64 (...) @pthread_self()
store i64 %5, i64* %1
%6 = bitcast i64* %1 to i8*
%7 = call i32 @util_djb_hash_block(i8* %6, i32 8)
store i32 %7, i32* %2
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @__err_get_threadid() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @memset(i8* %2, i32 0, i32 8)
%4 = call i64 (...) @pthread_self()
store i64 %4, i64* %1
%5 = call i32 @util_djb_hash_block(i8* %2, i32 8)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fs_univ_rollback(int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/);
uint8_t fs_rollback(uint32_t inode, uint32_t indx, uint64_t prevchunkid,
                    uint64_t chunkid) {
  return fs_univ_rollback(0, inode, indx, prevchunkid, chunkid);
}


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

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

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

LLVM IR (-O2):
define i32 @fs_rollback(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @fs_univ_rollback(i32 0, i32 %0, i32 %1, i32 %2, i32 %3)
ret i32 %5
}
int PPMmin(int i1, int i2) {
  if (i1 < i2)
    return i1;
  else
    return i2;
}


x86 assembly (clang, -O0):
<PPMmin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <PPMmin+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <PPMmin+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PPMmin>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @PPMmin(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
scalar_t__ islower(unsigned char);
scalar_t__ isupper(unsigned char);
int number(int l) {
  if (islower((unsigned char)l))
    return (l - 'a');
  else if (isupper((unsigned char)l))
    return (l - 'A');
  else
    return (-1);
}


x86 assembly (clang, -O0):
<number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movzbl %al,%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     114e <number+0x2e>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <number+0x58>
mov    -0x8(%rbp),%eax
movzbl %al,%edi
call   1040 <isupper@plt>
cmp    $0x0,%rax
je     1171 <number+0x51>
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <number+0x58>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<number>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
movzbl %bl,%ebp
mov    %ebp,%edi
call   1030 <islower@plt>
test   %rax,%rax
je     1139 <number+0x19>
add    $0xffffff9f,%ebx
jmp    114b <number+0x2b>
mov    %ebp,%edi
call   1040 <isupper@plt>
add    $0xffffffbf,%ebx
cmp    $0x1,%rax
sbb    %eax,%eax
or     %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @number(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = trunc i32 %4 to i8
%6 = call i64 @islower(i8 zeroext %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 97
store i32 %10, i32* %2
br label %20
11: ; preds = %1
%12 = load i32, i32* %3
%13 = trunc i32 %12 to i8
%14 = call i64 @isupper(i8 zeroext %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 65
store i32 %18, i32* %2
br label %20
19: ; preds = %11
store i32 -1, i32* %2
br label %20
20: ; preds = %19, %16, %8
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @number(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = tail call i64 @islower(i8 zeroext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = add nsw i32 %0, -97
br label %12
7: ; preds = %1
%8 = tail call i64 @isupper(i8 zeroext %2)
%9 = icmp eq i64 %8, 0
%10 = add nsw i32 %0, -65
%11 = select i1 %9, i32 -1, i32 %10
br label %12
12: ; preds = %7, %5
%13 = phi i32 [ %6, %5 ], [ %11, %7 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ fexcept_t;

/* Variables and functions */
int /*<<< orphan*/ fegetexceptflag(int /*<<< orphan*/ *, int);
void nullPointer_fegetexceptflag(int excepts) {
  fexcept_t *flagp = 0;
  (void)fegetexceptflag(flagp, excepts);
  (void)fegetexceptflag(0, excepts);
}


x86 assembly (clang, -O0):
<nullPointer_fegetexceptflag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <fegetexceptflag@plt>
mov    -0x4(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <fegetexceptflag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nullPointer_fegetexceptflag>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
mov    %ebx,%esi
call   1030 <fegetexceptflag@plt>
xor    %edi,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <fegetexceptflag@plt>

LLVM IR (-O0):
define void @nullPointer_fegetexceptflag(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
store i32* null, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %2
%6 = call i32 @fegetexceptflag(i32* %4, i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @fegetexceptflag(i32* null, i32 %7)
ret void
}

LLVM IR (-O2):
define void @nullPointer_fegetexceptflag(i32 %0) {
%2 = tail call i32 @fegetexceptflag(i32* null, i32 %0)
%3 = tail call i32 @fegetexceptflag(i32* null, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_something_other_cu();
int main(void) {
  do_something_other_cu();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @do_something_other_cu()
ret i32 0
}
char *langDbgRegsYmf278() { return "YMF278 Registers"; }


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

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

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

LLVM IR (-O2):
@.str = [17 x i8] c"YMF278 Registers\00"
define i8* @langDbgRegsYmf278() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}
int mapif_save_scdata_ack(int fd, int account_id, int flag) { return 0; }


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

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

LLVM IR (-O0):
define i32 @mapif_save_scdata_ack(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
ret i32 0
}

LLVM IR (-O2):
define i32 @mapif_save_scdata_ack(i32 %0, i32 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ errx(int /*<<< orphan*/, char *);
int main(int argc, char **argv) {
  errx(EXIT_FAILURE, "not yet supported on this platform");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
call   1030 <errx@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <errx@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [35 x i8] c"not yet supported on this platform\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @errx(i32 %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [35 x i8] c"not yet supported on this platform\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @errx(i32 %3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned char);
void fprint_subb_Rn(FILE *stream, unsigned char n) {
  fprintf(stream, "SUBB  A, R%X                     ", n);
}


x86 assembly (clang, -O0):
<fprint_subb_Rn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
movzbl -0x9(%rbp),%edx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_subb_Rn>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"SUBB A, R%X \00"
define void @fprint_subb_Rn(i32* %0, i8 zeroext %1) {
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
store i8 %1, i8* %4
%5 = load i32*, i32** %3
%6 = load i8, i8* %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"SUBB A, R%X \00"
define void @fprint_subb_Rn(i32* nocapture %0, i8 zeroext %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vt100_EscSeq(int, unsigned char *, long long);
void vt100_EL(int n) { vt100_EscSeq(n, (unsigned char *)"K", (long long)2); }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
mov    $0x2,%edx
call   1030 <vt100_EscSeq@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
lea    0xee9(%rip),%rsi
mov    $0x2,%edx
jmp    1030 <vt100_EscSeq@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"K\00"
define void @vt100_EL(i32 %0) {
%2 = tail call i32 @vt100_EscSeq(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64 2)
ret void
}
void RTDbgModSegmentAdd(void) {}


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

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

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

LLVM IR (-O2):
define void @RTDbgModSegmentAdd() {
ret void
}
double dmnsn_min(double a, double b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<dmnsn_min>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <dmnsn_min+0x31>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113b <dmnsn_min+0x3b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmnsn_min>:
minsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dmnsn_min(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @dmnsn_min(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ com_drain(int);
int /*<<< orphan*/ com_putc_fast(int, unsigned char);
void com_putc(int fd, unsigned char c) {
  com_drain(fd);
  com_putc_fast(fd, c);
}


x86 assembly (clang, -O0):
<com_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <com_drain@plt>
mov    -0x4(%rbp),%edi
movzbl -0x5(%rbp),%esi
call   1030 <com_putc_fast@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<com_putc>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1040 <com_drain@plt>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <com_putc_fast@plt>

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

LLVM IR (-O2):
define void @com_putc(i32 %0, i8 zeroext %1) {
%3 = tail call i32 @com_drain(i32 %0)
%4 = tail call i32 @com_putc_fast(i32 %0, i8 zeroext %1)
ret void
}
int fun1077() { return 1077; }


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

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

LLVM IR (-O0):
define i32 @fun1077() {
ret i32 1077
}

LLVM IR (-O2):
define i32 @fun1077() {
ret i32 1077
}
/* Variables and functions */
unsigned long lrint(double);
unsigned long feet_to_mm(double feet) { return lrint(feet * 304.8); }


x86 assembly (clang, -O0):
<feet_to_mm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <lrint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<feet_to_mm>:
mulsd  0xee8(%rip),%xmm0
jmp    1030 <lrint@plt>

LLVM IR (-O0):
define i64 @feet_to_mm(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 3.048000e+02
%5 = call i64 @lrint(double %4)
ret i64 %5
}

LLVM IR (-O2):
define i64 @feet_to_mm(double %0) {
%2 = fmul double %0, 3.048000e+02
%3 = tail call i64 @lrint(double %2)
ret i64 %3
}
unsigned int ECAPClockDisableStatusGet(unsigned int baseAdd) {
  unsigned int status;
  status = (*((volatile unsigned int *)(baseAdd + 0x0C)));
  status = status << 0x01;
  return status;
}


x86 assembly (clang, -O0):
<ECAPClockDisableStatusGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc,%eax
mov    %eax,%eax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ECAPClockDisableStatusGet>:
add    $0xc,%edi
mov    (%rdi),%eax
add    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ECAPClockDisableStatusGet(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add i32 %4, 12
%6 = zext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = shl i32 %9, 1
store i32 %10, i32* %3
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @ECAPClockDisableStatusGet(i32 %0) {
%2 = add i32 %0, 12
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = shl i32 %5, 1
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
void stopWorker(pid_t worker) { kill(worker, SIGKILL); }


x86 assembly (clang, -O0):
<stopWorker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stopWorker>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <kill@plt>

LLVM IR (-O0):
@SIGKILL = global i32 0
define void @stopWorker(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGKILL
%5 = call i32 @kill(i32 %3, i32 %4)
ret void
}

LLVM IR (-O2):
@SIGKILL = global i32 0
define void @stopWorker(i32 %0) {
%2 = load i32, i32* @SIGKILL
%3 = tail call i32 @kill(i32 %0, i32 %2)
ret void
}
void SSLeay(void) {}


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

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

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

LLVM IR (-O2):
define void @SSLeay() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int *, int);
int *malloc(int);
void foo(int len) {
  int *xbuf = malloc(len * sizeof(int));
  bar(xbuf, len);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
lea    0x0(,%rbx,4),%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 4
%7 = trunc i64 %6 to i32
%8 = call i32* @malloc(i32 %7)
store i32* %8, i32** %3
%9 = load i32*, i32** %3
%10 = load i32, i32* %2
%11 = call i32 @bar(i32* %9, i32 %10)
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i32* @malloc(i32 %2)
%4 = tail call i32 @bar(i32* %3, i32 %0)
ret void
}
int lirc_t_max(int a, int b) { return (a > b ? a : b); }


x86 assembly (clang, -O0):
<lirc_t_max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <lirc_t_max+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <lirc_t_max+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @lirc_t_max(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @lirc_t_max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
long long INT_MAX;
int /*<<< orphan*/ parse_numberll(char *, long long *, int);
int parse_number(char *start, int *res, int size) {
  long long number;
  if (!parse_numberll(start, &number, size))
    return 0;
  if (number > INT_MAX)
    return 0;
  *res = (int)number;
  return 1;
}


x86 assembly (clang, -O0):
<parse_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    -0x28(%rbp),%rsi
call   1030 <parse_numberll@plt>
cmp    $0x0,%eax
jne    1148 <parse_number+0x38>
movl   $0x0,-0x4(%rbp)
jmp    117b <parse_number+0x6b>
mov    -0x28(%rbp),%rax
mov    0x2e95(%rip),%rcx
cmp    (%rcx),%rax
jle    1168 <parse_number+0x58>
movl   $0x0,-0x4(%rbp)
jmp    117b <parse_number+0x6b>
mov    -0x28(%rbp),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_number>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
call   1030 <parse_numberll@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1142 <parse_number+0x32>
mov    0x8(%rsp),%rcx
mov    0x2eb2(%rip),%rdx
cmp    (%rdx),%rcx
jg     1142 <parse_number+0x32>
mov    %ecx,(%rbx)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@INT_MAX = global i64 0
define i32 @parse_number(i8* %0, i32* nocapture writeonly %1, i32 %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
%6 = call i32 @parse_numberll(i8* %0, i64* %4, i32 %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %3
%9 = load i64, i64* %4
%10 = load i64, i64* @INT_MAX
%11 = icmp sgt i64 %9, %10
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = trunc i64 %9 to i32
store i32 %13, i32* %1
br label %14
14: ; preds = %8, %3, %12
%15 = phi i32 [ 1, %12 ], [ 0, %3 ], [ 0, %8 ]
ret i32 %15
}
void SIO1_writeStat32(unsigned long val) {}


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

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

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

LLVM IR (-O2):
define void @SIO1_writeStat32(i64 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ strtoull(char const *, char **, int);
uint64_t str_to_uint64(const char *nptr, char **endptr, int base) {
  return strtoull(nptr, endptr, base);
}


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

x86 assembly (clang, -O2):
<str_to_uint64>:
jmp    1030 <strtoull@plt>

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

LLVM IR (-O2):
define i32 @str_to_uint64(i8* %0, i8** nocapture %1, i32 %2) {
%4 = tail call i32 @strtoull(i8* %0, i8** %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ strerr_die(int, char *, char *, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
void nomem(void) {
  strerr_die((111), ("tcprules: fatal: "), ("out of memory"), 0, 0, 0, 0, 0);
}


x86 assembly (clang, -O0):
<nomem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x6f,%edi
lea    0xedc(%rip),%rsi
lea    0xee7(%rip),%rdx
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1030 <strerr_die@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nomem>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0xef3(%rip),%rdx
mov    $0x6f,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x0
call   1030 <strerr_die@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
@.str = [18 x i8] c"tcprules: fatal: \00"
@.str.1 = [14 x i8] c"out of memory\00"
define void @nomem() {
%1 = call i32 @strerr_die(i32 111, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"tcprules: fatal: \00"
@.str.1 = [14 x i8] c"out of memory\00"
define void @nomem() {
%1 = tail call i32 @strerr_die(i32 111, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 0, i32 0, i32 0)
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *xmalloc(size_t s) {
  void *m = malloc(s);
  return m;
}


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

x86 assembly (clang, -O2):
<xmalloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ dlclose(void *);
void _vVclosedl(void *handle) { dlclose(handle); }


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

x86 assembly (clang, -O2):
<_vVclosedl>:
jmp    1030 <dlclose@plt>

LLVM IR (-O0):
define void @_vVclosedl(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @dlclose(i8* %3)
ret void
}

LLVM IR (-O2):
define void @_vVclosedl(i8* %0) {
%2 = tail call i32 @dlclose(i8* %0)
ret void
}