xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, double *, double *);
main() {
  double r, w;
  double a;
  scanf("%lf%lf", &r, &w);
  a = 2 * 3.1415926 * r * w;
  printf("%.0f EARTHS\n", a / 196.935e6);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
movsd  0xec4(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xea0(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0xeb8(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
divsd  0xeb2(%rip),%xmm0
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%lf%lf\00"
@.str.1 = [13 x i8] c"%.0f EARTHS\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double* %1, double* %2)
%5 = load double, double* %1
%6 = fmul double 0x401921FB4D12D84A, %5
%7 = load double, double* %2
%8 = fmul double %6, %7
store double %8, double* %3
%9 = load double, double* %3
%10 = fdiv double %9, 1.969350e+08
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%lf%lf\00"
@.str.1 = [13 x i8] c"%.0f EARTHS\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double* %1, double* %2)
%6 = load double, double* %1
%7 = fmul double %6, 0x401921FB4D12D84A
%8 = load double, double* %2
%9 = fmul double %7, %8
%10 = fdiv double %9, 1.969350e+08
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dcopy_(int *, double *, int *, double *, int *);
void dcopy(int N, double *X, int INCX, double *Y, int INCY) {
  dcopy_(&N, X, &INCX, Y, &INCY);
}


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

x86 assembly (clang, -O2):
<dcopy>:
sub    $0x18,%rsp
mov    %edi,0x14(%rsp)
mov    %edx,0x10(%rsp)
mov    %r8d,0xc(%rsp)
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%r8
call   1030 <dcopy_@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define void @dcopy(i32 %0, double* %1, i32 %2, double* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %6
store i32 %2, i32* %7
store i32 %4, i32* %8
%9 = call i32 @dcopy_(i32* %6, double* %1, i32* %7, double* %3, i32* %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("Hello 99World!\n");
  printf("It Went North\n");
  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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [16 x i8] c"Hello 99World!\0A\00"
@.str.1 = [15 x i8] c"It Went North\0A\00"
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 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [15 x i8] c"Hello 99World!\00"
@str.2 = [14 x i8] c"It Went North\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
void *__ioremap(unsigned long, unsigned long, int);
void *ioremap_writethrough(unsigned long physaddr, unsigned long size) {
  return __ioremap(physaddr, size, 3);
}


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

x86 assembly (clang, -O2):
<ioremap_writethrough>:
mov    $0x3,%edx
jmp    1030 <__ioremap@plt>

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

LLVM IR (-O2):
define i8* @ioremap_writethrough(i64 %0, i64 %1) {
%3 = tail call i8* @__ioremap(i64 %0, i64 %1, i32 3)
ret i8* %3
}
void outl(unsigned int val, int port) {
  __asm__ __volatile__("outl %0, %w1" : : "a"(val), "Nd"(port));
}


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

x86 assembly (clang, -O2):
<outl>:
mov    %esi,%edx
mov    %edi,%eax
out    %eax,(%dx)
ret

LLVM IR (-O0):
define void @outl(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
ret void
}

LLVM IR (-O2):
define void @outl(i32 %0, i32 %1) {
tail call void asm sideeffect "outl $0, ${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void grib_yy_fatal_error(const char *msg) {
  (void)fprintf(stderr, "%s\n", msg);
  exit(2);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @grib_yy_fatal_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @grib_yy_fatal_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 2)
unreachable
}
/* Variables and functions */
int munmap(void *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void HPCC_free(void *addr) {
  return;
  if (munmap(addr, 0) == -1) {
    perror("Error un-mmapping the file");
  }
}


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

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

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

LLVM IR (-O2):
define void @HPCC_free(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lookNarray(char *, unsigned int);
void lookpointer8array(void *x, int n) {
  lookNarray((char *)x, (unsigned int)(n * 8));
}


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

x86 assembly (clang, -O2):
<lookpointer8array>:
shl    $0x3,%esi
jmp    1030 <lookNarray@plt>

LLVM IR (-O0):
define void @lookpointer8array(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = mul nsw i32 %6, 8
%8 = call i32 @lookNarray(i8* %5, i32 %7)
ret void
}

LLVM IR (-O2):
define void @lookpointer8array(i8* %0, i32 %1) {
%3 = shl nsw i32 %1, 3
%4 = tail call i32 @lookNarray(i8* %0, i32 %3)
ret void
}
/* Type definitions */
struct vmallocator {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ vmallocator_alloc(struct vmallocator *, size_t);
void *vmallocator_ofs2mem(struct vmallocator *, int /*<<< orphan*/);
void *vmallocator_allocptr(struct vmallocator *v, size_t s) {
  return vmallocator_ofs2mem(v, vmallocator_alloc(v, s));
}


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

x86 assembly (clang, -O2):
<vmallocator_allocptr>:
push   %rbx
mov    %rdi,%rbx
call   1040 <vmallocator_alloc@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <vmallocator_ofs2mem@plt>

LLVM IR (-O0):
%struct.vmallocator = type { i32 }
define i8* @vmallocator_allocptr(%struct.vmallocator* %0, i64 %1) {
%3 = alloca %struct.vmallocator*
%4 = alloca i64
store %struct.vmallocator* %0, %struct.vmallocator** %3
store i64 %1, i64* %4
%5 = load %struct.vmallocator*, %struct.vmallocator** %3
%6 = load %struct.vmallocator*, %struct.vmallocator** %3
%7 = load i64, i64* %4
%8 = call i32 @vmallocator_alloc(%struct.vmallocator* %6, i64 %7)
%9 = call i8* @vmallocator_ofs2mem(%struct.vmallocator* %5, i32 %8)
ret i8* %9
}

LLVM IR (-O2):
%struct.vmallocator = type { i32 }
define i8* @vmallocator_allocptr(%struct.vmallocator* %0, i64 %1) {
%3 = tail call i32 @vmallocator_alloc(%struct.vmallocator* %0, i64 %1)
%4 = tail call i8* @vmallocator_ofs2mem(%struct.vmallocator* %0, i32 %3)
ret i8* %4
}
int power_of_two(n)
int n;
{
  int i;
  for (i = n; i > 1; i >>= 1)
    if (i & 1)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<power_of_two>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    1145 <power_of_two+0x45>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1132 <power_of_two+0x32>
movl   $0x0,-0x4(%rbp)
jmp    114c <power_of_two+0x4c>
jmp    1137 <power_of_two+0x37>
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110d <power_of_two+0xd>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<power_of_two>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     1121 <power_of_two+0x21>
nopw   0x0(%rax,%rax,1)
test   $0x1,%dil
jne    1122 <power_of_two+0x22>
mov    %edi,%ecx
shr    %ecx
cmp    $0x4,%edi
mov    %ecx,%edi
jae    1110 <power_of_two+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @power_of_two(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %6, label %10
3: ; preds = %6
%4 = lshr i32 %7, 1
%5 = icmp ugt i32 %7, 3
br i1 %5, label %6, label %10
6: ; preds = %1, %3
%7 = phi i32 [ %4, %3 ], [ %0, %1 ]
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %3, label %10
10: ; preds = %6, %3, %1
%11 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 0, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int foo(char *);
int main() {
  if (foo("a") != 1)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <foo@plt>
cmp    $0x1,%eax
je     114b <main+0x2b>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    1136 <main+0x16>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
define i32 @main() {
%1 = tail call i32 @foo(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ expression();
int /*<<< orphan*/ match(int);
void expression_stmt() {
  expression();
  match(55);
}


x86 assembly (clang, -O0):
<expression_stmt>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <expression@plt>
mov    $0x37,%edi
call   1040 <match@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<expression_stmt>:
push   %rax
xor    %eax,%eax
call   1030 <expression@plt>
mov    $0x37,%edi
pop    %rax
jmp    1040 <match@plt>

LLVM IR (-O0):
define void @expression_stmt() {
%1 = call i32 (...) @expression()
%2 = call i32 @match(i32 55)
ret void
}

LLVM IR (-O2):
define void @expression_stmt() {
%1 = tail call i32 (...) @expression()
%2 = tail call i32 @match(i32 55)
ret void
}
cbuf6(f, n) int f, n;
{ cbuf(f, n, 6); }


x86 assembly (clang, -O0):
<cbuf6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x6,%edx
mov    $0x0,%al
call   1030 <cbuf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuf6>:
mov    $0x6,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf6(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 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %6, i32 %7, i32 6)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @cbuf6(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 6)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *s) { fprintf(stderr, "%s -w <workers> [-q dqsize] <n>\n", s); }


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"%s -w <workers> [-q dqsize] <n>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"%s -w <workers> [-q dqsize] <n>\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char s[20];
  printf("Please input something:\n");
  scanf("%s", s);
  printf("number is:%d\n", atoi(s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1060 <atoi@plt>
lea    0xe91(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Please input something:\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [14 x i8] c"number is:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = call i32 @atoi(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [14 x i8] c"number is:%d\0A\00"
@str = [24 x i8] c"Please input something:\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @atoi(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}
unsigned assign_bit_RTS(unsigned reg_value, int set) {
  return (reg_value & ~0x10) | (set ? 0x10 : 0);
}


x86 assembly (clang, -O0):
<assign_bit_RTS>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffffef,%eax
mov    -0x8(%rbp),%esi
xor    %ecx,%ecx
mov    $0x10,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<assign_bit_RTS>:
xor    %eax,%eax
test   %esi,%esi
setne  %al
and    $0xffffffef,%edi
shl    $0x4,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @assign_bit_RTS(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 = and i32 %5, -17
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 16, i32 0
%11 = or i32 %6, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @assign_bit_RTS(i32 %0, i32 %1) {
%3 = and i32 %0, -17
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i32 0, i32 16
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ yyunput(int /*<<< orphan*/, char *);
int yywrap(void) {
  {
    if (0) {
      yyunput(0, "");
    }
  }
  return 1;
}


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

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

LLVM IR (-O0):
define i32 @yywrap() {
ret i32 1
}

LLVM IR (-O2):
define i32 @yywrap() {
ret i32 1
}
/* Type definitions */
struct mmapfile {
  int dummy;
};

/* Variables and functions */
scalar_t__ ytht_smth_filter_file(char *, struct mmapfile *);
scalar_t__ ytht_smth_filter_string(char *, struct mmapfile *);
int ytht_smth_filter_article(char *title, char *filename,
                             struct mmapfile *badword_img) {
  return (ytht_smth_filter_string(title, badword_img) ||
          ytht_smth_filter_file(filename, badword_img));
}


x86 assembly (clang, -O0):
<ytht_smth_filter_article>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <ytht_smth_filter_string@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x19(%rbp)
jne    116a <ytht_smth_filter_article+0x4a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <ytht_smth_filter_file@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ytht_smth_filter_article>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdx,%rsi
call   1030 <ytht_smth_filter_string@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1155 <ytht_smth_filter_article+0x35>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <ytht_smth_filter_file@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.mmapfile = type { i32 }
define i32 @ytht_smth_filter_article(i8* %0, i8* %1, %struct.mmapfile* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.mmapfile*
store i8* %0, i8** %4
store i8* %1, i8** %5
store %struct.mmapfile* %2, %struct.mmapfile** %6
%7 = load i8*, i8** %4
%8 = load %struct.mmapfile*, %struct.mmapfile** %6
%9 = call i64 @ytht_smth_filter_string(i8* %7, %struct.mmapfile* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = load %struct.mmapfile*, %struct.mmapfile** %6
%14 = call i64 @ytht_smth_filter_file(i8* %12, %struct.mmapfile* %13)
%15 = icmp ne i64 %14, 0
br label %16
16: ; preds = %11, %3
%17 = phi i1 [ true, %3 ], [ %15, %11 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
%struct.mmapfile = type { i32 }
define i32 @ytht_smth_filter_article(i8* %0, i8* %1, %struct.mmapfile* %2) {
%4 = tail call i64 @ytht_smth_filter_string(i8* %0, %struct.mmapfile* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i64 @ytht_smth_filter_file(i8* %1, %struct.mmapfile* %2)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ 1, %3 ], [ %9, %6 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ pem_password_cb;
typedef int /*<<< orphan*/ d2i_of_void;
typedef int /*<<< orphan*/ EC_KEY;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int /*<<< orphan*/ *PEM_ASN1_read_bio(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                      int /*<<< orphan*/ *, void **,
                                      int /*<<< orphan*/ *, void *);
int /*<<< orphan*/ PEM_STRING_PUBLIC;
scalar_t__ d2i_EC_PUBKEY;
EC_KEY *PEM_read_bio_EC_PUBKEY(BIO *bp, EC_KEY **x, pem_password_cb *cb,
                               void *u) {
  return PEM_ASN1_read_bio((d2i_of_void *)d2i_EC_PUBKEY, PEM_STRING_PUBLIC, bp,
                           (void **)x, cb, u);
}


x86 assembly (clang, -O0):
<PEM_read_bio_EC_PUBKEY>:
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    0x2eb1(%rip),%rax
mov    (%rax),%rdi
mov    0x2eaf(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
call   1030 <PEM_ASN1_read_bio@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PEM_read_bio_EC_PUBKEY>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2ebd(%rip),%rax
mov    (%rax),%rdi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
jmp    1030 <PEM_ASN1_read_bio@plt>

LLVM IR (-O0):
@d2i_EC_PUBKEY = global i64 0
@PEM_STRING_PUBLIC = global i32 0
define i32* @PEM_read_bio_EC_PUBKEY(i32* %0, i32** %1, i32* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32**
%7 = alloca i32*
%8 = alloca i8*
store i32* %0, i32** %5
store i32** %1, i32*** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%9 = load i64, i64* @d2i_EC_PUBKEY
%10 = inttoptr i64 %9 to i32*
%11 = load i32, i32* @PEM_STRING_PUBLIC
%12 = load i32*, i32** %5
%13 = load i32**, i32*** %6
%14 = bitcast i32** %13 to i8**
%15 = load i32*, i32** %7
%16 = load i8*, i8** %8
%17 = call i32* @PEM_ASN1_read_bio(i32* %10, i32 %11, i32* %12, i8** %14, i32* %15, i8* %16)
ret i32* %17
}

LLVM IR (-O2):
@d2i_EC_PUBKEY = global i64 0
@PEM_STRING_PUBLIC = global i32 0
define i32* @PEM_read_bio_EC_PUBKEY(i32* %0, i32** %1, i32* %2, i8* %3) {
%5 = load i64, i64* @d2i_EC_PUBKEY
%6 = inttoptr i64 %5 to i32*
%7 = load i32, i32* @PEM_STRING_PUBLIC
%8 = bitcast i32** %1 to i8**
%9 = tail call i32* @PEM_ASN1_read_bio(i32* %6, i32 %7, i32* %0, i8** %8, i32* %2, i8* %3)
ret i32* %9
}
/* Variables and functions */
int /*<<< orphan*/ FIONREAD;
scalar_t__ ioctl(int /*<<< orphan*/, int /*<<< orphan*/, int *);
typahead() {
  int x;
  return ((ioctl(0, FIONREAD, &x) < 0) ? 0 : x);
}


x86 assembly (clang, -O0):
<typahead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x4(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    1140 <typahead+0x30>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <typahead+0x36>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<typahead>:
push   %rbx
sub    $0x10,%rsp
mov    0x2ecc(%rip),%rax
mov    (%rax),%esi
xor    %ebx,%ebx
lea    0xc(%rsp),%rdx
xor    %edi,%edi
call   1030 <ioctl@plt>
test   %rax,%rax
js     1135 <typahead+0x25>
mov    0xc(%rsp),%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@FIONREAD = global i32 0
define i32 @typahead() {
%1 = alloca i32
%2 = load i32, i32* @FIONREAD
%3 = call i64 @ioctl(i32 0, i32 %2, i32* %1)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
br label %8
6: ; preds = %0
%7 = load i32, i32* %1
br label %8
8: ; preds = %6, %5
%9 = phi i32 [ 0, %5 ], [ %7, %6 ]
ret i32 %9
}

LLVM IR (-O2):
@FIONREAD = global i32 0
define i32 @typahead() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @FIONREAD
%4 = call i64 @ioctl(i32 0, i32 %3, i32* %1)
%5 = icmp slt i64 %4, 0
%6 = load i32, i32* %1
%7 = select i1 %5, i32 0, i32 %6
ret i32 %7
}
double MAX(double a, double b) {
  if (a > b)
    return a;
  return b;
}


x86 assembly (clang, -O0):
<MAX>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    112d <MAX+0x2d>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1137 <MAX+0x37>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @MAX(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
double SFMMetersToMiles(double m) { return (m * 0.00062137); }


x86 assembly (clang, -O0):
<SFMMetersToMiles>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<SFMMetersToMiles>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @SFMMetersToMiles(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 6.213700e-04
ret double %4
}

LLVM IR (-O2):
define double @SFMMetersToMiles(double %0) {
%2 = fmul double %0, 6.213700e-04
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int x = 10, y = 21;
  y %= x;
  printf("integer remainder: %d\n", y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x15,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [23 x i8] c"integer remainder: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}
void rop3_225_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D | S;
  stk1 = T ^ stk2;
  stk1 = ~stk1;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_225_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_225_0_0>:
or     (%rdi),%sil
xor    %dl,%sil
not    %sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_225_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = load i8, i8* %8
%19 = zext i8 %18 to i32
%20 = xor i32 %17, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %7
%22 = load i8, i8* %7
%23 = zext i8 %22 to i32
%24 = xor i32 %23, -1
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = load i8*, i8** %4
store i8 %26, i8* %27
ret void
}

LLVM IR (-O2):
define void @rop3_225_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %4, %1
%6 = xor i8 %5, %2
%7 = xor i8 %6, -1
store i8 %7, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assertEqual(size_t, int /*<<< orphan*/);
int /*<<< orphan*/ memoryLimit();
int /*<<< orphan*/ setMemoryLimit(size_t);
void testSetMemoryLimit(void) {
  assertEqual(0, memoryLimit());
  size_t newLimit = 4096;
  setMemoryLimit(newLimit);
  assertEqual(newLimit, memoryLimit());
  setMemoryLimit(0);
}


x86 assembly (clang, -O0):
<testSetMemoryLimit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <memoryLimit@plt>
mov    %eax,%esi
xor    %eax,%eax
mov    %eax,%edi
call   1050 <assertEqual@plt>
movq   $0x1000,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <setMemoryLimit@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <memoryLimit@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1050 <assertEqual@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <setMemoryLimit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testSetMemoryLimit>:
push   %rax
xor    %eax,%eax
call   1040 <memoryLimit@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1050 <assertEqual@plt>
mov    $0x1000,%edi
call   1030 <setMemoryLimit@plt>
xor    %eax,%eax
call   1040 <memoryLimit@plt>
mov    $0x1000,%edi
mov    %eax,%esi
call   1050 <assertEqual@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <setMemoryLimit@plt>

LLVM IR (-O0):
define void @testSetMemoryLimit() {
%1 = alloca i64
%2 = call i32 (...) @memoryLimit()
%3 = call i32 @assertEqual(i64 0, i32 %2)
store i64 4096, i64* %1
%4 = load i64, i64* %1
%5 = call i32 @setMemoryLimit(i64 %4)
%6 = load i64, i64* %1
%7 = call i32 (...) @memoryLimit()
%8 = call i32 @assertEqual(i64 %6, i32 %7)
%9 = call i32 @setMemoryLimit(i64 0)
ret void
}

LLVM IR (-O2):
define void @testSetMemoryLimit() {
%1 = tail call i32 (...) @memoryLimit()
%2 = tail call i32 @assertEqual(i64 0, i32 %1)
%3 = tail call i32 @setMemoryLimit(i64 4096)
%4 = tail call i32 (...) @memoryLimit()
%5 = tail call i32 @assertEqual(i64 4096, i32 %4)
%6 = tail call i32 @setMemoryLimit(i64 0)
ret void
}
int _extr(int src2, int src1) {
  unsigned int csta = (src1 >> 5) & 0x1f;
  unsigned int cstb = src1 & 0x1f;
  return (src2 << csta) >> cstb;
}


x86 assembly (clang, -O0):
<_extr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x5,%eax
and    $0x1f,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1f,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_extr>:
mov    %edi,%eax
mov    %esi,%ecx
shr    $0x5,%ecx
shl    %cl,%eax
mov    %esi,%ecx
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @_extr(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = ashr i32 %7, 5
%9 = and i32 %8, 31
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = and i32 %10, 31
store i32 %11, i32* %6
%12 = load i32, i32* %3
%13 = load i32, i32* %5
%14 = shl i32 %12, %13
%15 = load i32, i32* %6
%16 = ashr i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @_extr(i32 %0, i32 %1) {
%3 = lshr i32 %1, 5
%4 = and i32 %3, 31
%5 = and i32 %1, 31
%6 = shl i32 %0, %4
%7 = ashr i32 %6, %5
ret i32 %7
}
/* Type definitions */
struct ringbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rbuf_align(struct ringbuf *, int, char, int, char const *);
void rbuf_alignl(struct ringbuf *r, int w, char pad, const char *s) {
  rbuf_align(r, w, pad, 1, s);
}


x86 assembly (clang, -O0):
<rbuf_alignl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0xd(%rbp),%al
mov    -0x18(%rbp),%r8
mov    $0x1,%ecx
movsbl %al,%edx
call   1030 <rbuf_align@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rbuf_alignl>:
mov    %rcx,%r8
mov    $0x1,%ecx
jmp    1030 <rbuf_align@plt>

LLVM IR (-O0):
%struct.ringbuf = type { i32 }
define void @rbuf_alignl(%struct.ringbuf* %0, i32 %1, i8 signext %2, i8* %3) {
%5 = alloca %struct.ringbuf*
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8*
store %struct.ringbuf* %0, %struct.ringbuf** %5
store i32 %1, i32* %6
store i8 %2, i8* %7
store i8* %3, i8** %8
%9 = load %struct.ringbuf*, %struct.ringbuf** %5
%10 = load i32, i32* %6
%11 = load i8, i8* %7
%12 = load i8*, i8** %8
%13 = call i32 @rbuf_align(%struct.ringbuf* %9, i32 %10, i8 signext %11, i32 1, i8* %12)
ret void
}

LLVM IR (-O2):
%struct.ringbuf = type { i32 }
define void @rbuf_alignl(%struct.ringbuf* %0, i32 %1, i8 signext %2, i8* %3) {
%5 = tail call i32 @rbuf_align(%struct.ringbuf* %0, i32 %1, i8 signext %2, i32 1, i8* %3)
ret void
}
const char *dd_pbl_ios_gc_user_name() { return ""; }


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

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @dd_pbl_ios_gc_user_name() {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @dd_pbl_ios_gc_user_name() {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
int gca_search_uint64(const void *aa, void *bb) {
  const uint64_t a = *(const uint64_t *)aa;
  const uint64_t b = *(uint64_t *)bb;
  return (((a) > (b)) - ((b) > (a)));
}


x86 assembly (clang, -O0):
<gca_search_uint64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x20(%rbp),%rcx
cmp    -0x18(%rbp),%rcx
setg   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gca_search_uint64>:
mov    (%rdi),%rcx
mov    (%rsi),%rdx
xor    %eax,%eax
xor    %esi,%esi
cmp    %rdx,%rcx
setg   %al
setl   %sil
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @gca_search_uint64(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
store i64 %9, i64* %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i64*
%12 = load i64, i64* %11
store i64 %12, i64* %6
%13 = load i64, i64* %5
%14 = load i64, i64* %6
%15 = icmp sgt i64 %13, %14
%16 = zext i1 %15 to i32
%17 = load i64, i64* %6
%18 = load i64, i64* %5
%19 = icmp sgt i64 %17, %18
%20 = zext i1 %19 to i32
%21 = sub nsw i32 %16, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @gca_search_uint64(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp sgt i64 %4, %6
%8 = zext i1 %7 to i32
%9 = icmp sgt i64 %6, %4
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
char *strdup(char *str) {
  char *res;
  int len;
  len = strlen(str) + 1;
  res = malloc(len);
  memcpy(res, str, len);
  return res;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = load i32, i32* %4
%13 = call i32 @memcpy(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %3)
ret i8* %4
}
__attribute__((always_)) void debug_object_free(void *addr,
                                                struct debug_obj_descr *descr) {
}


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

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

LLVM IR (-O0):
%struct.debug_obj_descr = type opaque
define void @debug_object_free(i8* %0, %struct.debug_obj_descr* %1) {
%3 = alloca i8*
%4 = alloca %struct.debug_obj_descr*
store i8* %0, i8** %3
store %struct.debug_obj_descr* %1, %struct.debug_obj_descr** %4
ret void
}

LLVM IR (-O2):
%struct.debug_obj_descr = type opaque
define void @debug_object_free(i8* nocapture %0, %struct.debug_obj_descr* nocapture %1) {
ret void
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ printf(char *);
scalar_t__ unit_test_add_numbers();
int main() {
  if (unit_test_add_numbers() != 0)
    printf("unit_test_add_numbers failed!\n\r");
  else
    printf("unit_test_add_numbers succeeded!\n\r");
  return getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <unit_test_add_numbers@plt>
cmp    $0x0,%rax
je     1161 <main+0x31>
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
jmp    116d <main+0x3d>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <unit_test_add_numbers@plt>
test   %rax,%rax
lea    0xede(%rip),%rax
lea    0xeb7(%rip),%rdi
cmove  %rax,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <getchar@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"unit_test_add_numbers failed!\0A\0D\00"
@.str.1 = [35 x i8] c"unit_test_add_numbers succeeded!\0A\0D\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @unit_test_add_numbers()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
%9 = call i32 (...) @getchar()
ret i32 %9
}

LLVM IR (-O2):
@.str = [32 x i8] c"unit_test_add_numbers failed!\0A\0D\00"
@.str.1 = [35 x i8] c"unit_test_add_numbers succeeded!\0A\0D\00"
define i32 @main() {
%1 = tail call i64 (...) @unit_test_add_numbers()
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0)
%4 = tail call i32 @printf(i8* dereferenceable(1) %3)
%5 = tail call i32 (...) @getchar()
ret i32 %5
}
/* Variables and functions */
bool nk_getrandom(char *seed, size_t len) {
  (void)seed;
  (void)len;
  return false;
}


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

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

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

LLVM IR (-O2):
define i32 @nk_getrandom(i8* nocapture readnone %0, i64 %1) {
ret i32 0
}
/* Type definitions */
struct emuState {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_modes(struct emuState *, int);
void do_SM(struct emuState *S) { do_modes(S, 1); }


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

x86 assembly (clang, -O2):
<do_SM>:
mov    $0x1,%esi
jmp    1030 <do_modes@plt>

LLVM IR (-O0):
%struct.emuState = type { i32 }
define void @do_SM(%struct.emuState* %0) {
%2 = alloca %struct.emuState*
store %struct.emuState* %0, %struct.emuState** %2
%3 = load %struct.emuState*, %struct.emuState** %2
%4 = call i32 @do_modes(%struct.emuState* %3, i32 1)
ret void
}

LLVM IR (-O2):
%struct.emuState = type { i32 }
define void @do_SM(%struct.emuState* %0) {
%2 = tail call i32 @do_modes(%struct.emuState* %0, i32 1)
ret void
}
/* Variables and functions */
int xcmd_simple(char *, int);
int xcmd_simple_led_on(char *buffer) { return xcmd_simple(buffer, 1); }


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

x86 assembly (clang, -O2):
<xcmd_simple_led_on>:
mov    $0x1,%esi
jmp    1030 <xcmd_simple@plt>

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

LLVM IR (-O2):
define i32 @xcmd_simple_led_on(i8* %0) {
%2 = tail call i32 @xcmd_simple(i8* %0, i32 1)
ret i32 %2
}
int test_imm_67uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x67 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_67uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 103
%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_67uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 6750208
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}