xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_)) __attribute__((const)) uint32_t bswap_32(uint32_t x) {
  x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0x00FF00FF);
  x = (x >> 16) | (x << 16);
  return x;
}


x86 assembly (clang, -O0):
<bswap_32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
and    $0xff00ff00,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff00ff,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
mov    -0x4(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bswap_32>:
bswap  %edi
ror    $0x10,%edi
mov    %edi,%eax
sar    $0x10,%eax
shl    $0x10,%edi
or     %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @bswap_32(i32 %0) {
%2 = shl i32 %0, 8
%3 = and i32 %2, -16711936
%4 = lshr i32 %0, 8
%5 = and i32 %4, 16711935
%6 = or i32 %3, %5
%7 = ashr i32 %6, 16
%8 = shl i32 %6, 16
%9 = or i32 %7, %8
ret i32 %9
}
OP(ed, ce) { illegal_2(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
/* Variables and functions */
int sqr(int);
int pow4(int x) { return sqr(x) * sqr(x); }


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

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

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

LLVM IR (-O2):
define i32 @pow4(i32 %0) {
%2 = tail call i32 @sqr(i32 %0)
%3 = tail call i32 @sqr(i32 %0)
%4 = mul nsw i32 %3, %2
ret i32 %4
}
/* Type definitions */
struct info_win {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ info_win_display_msg(struct info_win *);
void info_win_tick(struct info_win *w) { info_win_display_msg(w); }


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

x86 assembly (clang, -O2):
<info_win_tick>:
jmp    1030 <info_win_display_msg@plt>

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

LLVM IR (-O2):
%struct.info_win = type { i32 }
define void @info_win_tick(%struct.info_win* %0) {
%2 = tail call i32 @info_win_display_msg(%struct.info_win* %0)
ret void
}
void I2SRxEnable(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000810))) = 0x00000001;
  (*((volatile unsigned long *)(ulBase + 0x00000C00))) |= 0x00000002;
}


x86 assembly (clang, -O0):
<I2SRxEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x1,0x810(%rax)
mov    -0x8(%rbp),%rax
mov    0xc00(%rax),%rcx
or     $0x2,%rcx
mov    %rcx,0xc00(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2SRxEnable>:
movq   $0x1,0x810(%rdi)
orq    $0x2,0xc00(%rdi)
02
ret

LLVM IR (-O0):
define void @I2SRxEnable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 2064
%5 = inttoptr i64 %4 to i64*
store volatile i64 1, i64* %5
%6 = load i64, i64* %2
%7 = add i64 %6, 3072
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, 2
store volatile i64 %10, i64* %8
ret void
}

LLVM IR (-O2):
define void @I2SRxEnable(i64 %0) {
%2 = add i64 %0, 2064
%3 = inttoptr i64 %2 to i64*
store volatile i64 1, i64* %3
%4 = add i64 %0, 3072
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = or i64 %6, 2
store volatile i64 %7, i64* %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ copro_opc7_write_io(int /*<<< orphan*/, int /*<<< orphan*/);
void dbg_iowrite(uint32_t addr, uint32_t value) {
  copro_opc7_write_io(addr, value);
}


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

x86 assembly (clang, -O2):
<dbg_iowrite>:
jmp    1030 <copro_opc7_write_io@plt>

LLVM IR (-O0):
define void @dbg_iowrite(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 = call i32 @copro_opc7_write_io(i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @dbg_iowrite(i32 %0, i32 %1) {
%3 = tail call i32 @copro_opc7_write_io(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int /*<<< orphan*/);
void __attribute__((regparm(3))) memcpy_0(void *dest, void *src) {
  memcpy(dest, src, 0);
}


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

x86 assembly (clang, -O2):
<memcpy_0>:
xor    %edx,%edx
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @memcpy_0(i8* %0, i8* %1) {
%3 = tail call i32 @memcpy(i8* %0, i8* %1, i32 0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ __is_big_endian();
int __swab32(int);
extern int be32_to_native(uint32_t i) {
  if (!__is_big_endian()) {
    return __swab32(i);
  } else {
    return i;
  }
}


x86 assembly (clang, -O0):
<be32_to_native>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__is_big_endian@plt>
cmp    $0x0,%eax
jne    114b <be32_to_native+0x2b>
mov    -0x8(%rbp),%edi
call   1040 <__swab32@plt>
mov    %eax,-0x4(%rbp)
jmp    1151 <be32_to_native+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<be32_to_native>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <__is_big_endian@plt>
test   %eax,%eax
je     1132 <be32_to_native+0x12>
mov    %ebx,%eax
pop    %rbx
ret
mov    %ebx,%edi
pop    %rbx
jmp    1040 <__swab32@plt>

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

LLVM IR (-O2):
define i32 @be32_to_native(i32 %0) {
%2 = tail call i32 (...) @__is_big_endian()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @__swab32(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %0, %1 ]
ret i32 %7
}
int mod(int n) {
  if (n < 0)
    return -n;
  else
    return n;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111e <mod+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <mod+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @mod(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ nerror(char *);
float *vector(long nl, long nh) {
  float *v;
  v = (float *)malloc((size_t)((nh - nl + 1 + 1) * sizeof(float)));
  if (!v)
    nerror("allocation failure in vector()");
  return v - nl + 1;
}


x86 assembly (clang, -O0):
<vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
sub    -0x8(%rbp),%rdi
add    $0x1,%rdi
add    $0x1,%rdi
shl    $0x2,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1164 <vector+0x44>
lea    0xea1(%rip),%rdi
call   1040 <nerror@plt>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x4,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
sub    %rdi,%rsi
lea    0x8(,%rsi,4),%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114b <vector+0x2b>
lea    0xeba(%rip),%rdi
call   1040 <nerror@plt>
shl    $0x2,%r14
sub    %r14,%rbx
add    $0x4,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"allocation failure in vector()\00"
define float* @vector(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca float*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = add nsw i64 %8, 1
%10 = add nsw i64 %9, 1
%11 = mul i64 %10, 4
%12 = call i64 @malloc(i64 %11)
%13 = inttoptr i64 %12 to float*
store float* %13, float** %5
%14 = load float*, float** %5
%15 = icmp ne float* %14, null
br i1 %15, label %18, label %16
16: ; preds = %2
%17 = call i32 @nerror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
%19 = load float*, float** %5
%20 = load i64, i64* %3
%21 = sub i64 0, %20
%22 = getelementptr inbounds float, float* %19, i64 %21
%23 = getelementptr inbounds float, float* %22, i64 1
ret float* %23
}

LLVM IR (-O2):
@.str = [31 x i8] c"allocation failure in vector()\00"
define float* @vector(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = shl i64 %3, 2
%5 = add i64 %4, 8
%6 = tail call i64 @malloc(i64 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @nerror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = inttoptr i64 %6 to float*
%12 = sub i64 0, %0
%13 = getelementptr inbounds float, float* %11, i64 %12
%14 = getelementptr inbounds float, float* %13, i64 1
ret float* %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void func1(void) { printf("hello\n"); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"hello\0A\00"
define void @func1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define void @func1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double pow(int, int);
double sin(int);
double ElasticEaseIn(double p) {
  return sin(13 * 3.14159265358979323846264338327 / 2 * p) *
         pow(2, 10 * (p - 1));
}


x86 assembly (clang, -O0):
<ElasticEaseIn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xeb3(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe9f(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ElasticEaseIn>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
movsd  0xece(%rip),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xeb5(%rip),%xmm0
mulsd  0xeb5(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @ElasticEaseIn(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 0x40346B9C347764A4, %3
%5 = fptosi double %4 to i32
%6 = call double @sin(i32 %5)
%7 = load double, double* %2
%8 = fsub double %7, 1.000000e+00
%9 = fmul double 1.000000e+01, %8
%10 = fptosi double %9 to i32
%11 = call double @pow(i32 2, i32 %10)
%12 = fmul double %6, %11
ret double %12
}

LLVM IR (-O2):
define double @ElasticEaseIn(double %0) {
%2 = fmul double %0, 0x40346B9C347764A4
%3 = fptosi double %2 to i32
%4 = tail call double @sin(i32 %3)
%5 = fadd double %0, -1.000000e+00
%6 = fmul double %5, 1.000000e+01
%7 = fptosi double %6 to i32
%8 = tail call double @pow(i32 2, i32 %7)
%9 = fmul double %4, %8
ret double %9
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  struct timeval tv;
  int i, j;
  for (i = 0; i < 1000; i++) {
    j = gettimeofday(&tv, NULL);
  }
  return j;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    1158 <main+0x48>
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <main+0x1d>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x3e8,%ebp
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
add    $0xffffffff,%ebp
jne    1120 <main+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
br label %5
5: ; preds = %2, %5
%6 = phi i32 [ 0, %2 ], [ %8, %5 ]
%7 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, 1000
br i1 %9, label %10, label %5
10: ; preds = %5
ret i32 %7
}
void unused_fn(void) {}


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

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

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

LLVM IR (-O2):
define void @unused_fn() {
ret void
}
int main(void) {
  char hello[6 + 5 * 8] = "hello";
  *hello = 'u';
  *hello = "uu";
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x2e,%edx
call   1030 <memset@plt>
movb   $0x68,-0x40(%rbp)
movb   $0x65,-0x3f(%rbp)
movb   $0x6c,-0x3e(%rbp)
movb   $0x6c,-0x3d(%rbp)
movb   $0x6f,-0x3c(%rbp)
movb   $0x75,-0x40(%rbp)
lea    0xeb2(%rip),%rax
mov    %al,-0x40(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"uu\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [46 x i8]
store i32 0, i32* %1
%3 = bitcast [46 x i8]* %2 to i8*
%4 = bitcast i8* %3 to [46 x i8]*
%5 = getelementptr inbounds [46 x i8], [46 x i8]* %4, i32 0, i32 0
store i8 104, i8* %5
%6 = getelementptr inbounds [46 x i8], [46 x i8]* %4, i32 0, i32 1
store i8 101, i8* %6
%7 = getelementptr inbounds [46 x i8], [46 x i8]* %4, i32 0, i32 2
store i8 108, i8* %7
%8 = getelementptr inbounds [46 x i8], [46 x i8]* %4, i32 0, i32 3
store i8 108, i8* %8
%9 = getelementptr inbounds [46 x i8], [46 x i8]* %4, i32 0, i32 4
store i8 111, i8* %9
%10 = getelementptr inbounds [46 x i8], [46 x i8]* %2, i64 0, i64 0
store i8 117, i8* %10
%11 = getelementptr inbounds [46 x i8], [46 x i8]* %2, i64 0, i64 0
store i8 ptrtoint ([3 x i8]* @.str to i8), i8* %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "Usage: ischroot [OPTION]\n"
                  "  -f, --default-false return false if detection fails\n"
                  "  -t, --default-true  return true if detection fails\n"
                  "  -V, --version       output version information and exit.\n"
                  "  -h, --help          display this help and exit.\n");
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [242 x i8] c"Usage: ischroot [OPTION]\0A -f, --default-false return false if detection fails\0A -t, --default-true return true if detection fails\0A -V, --version output version information and exit.\0A -h, --help display this help and exit.\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([242 x i8], [242 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [242 x i8] c"Usage: ischroot [OPTION]\0A -f, --default-false return false if detection fails\0A -t, --default-true return true if detection fails\0A -V, --version output version information and exit.\0A -h, --help display this help and exit.\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([242 x i8], [242 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
double log(double);
double f(double x) {
  if (x > 0.0)
    return log(x);
  return 0.0;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1143 <f+0x33>
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    114b <f+0x3b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    111f <f+0xf>
jmp    1030 <log@plt>
xorpd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = call double @log(double %7)
store double %8, double* %2
br label %10
9: ; preds = %1
store double 0.000000e+00, double* %2
br label %10
10: ; preds = %9, %6
%11 = load double, double* %2
ret double %11
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call double @log(double %0)
br label %5
5: ; preds = %1, %3
%6 = phi double [ %4, %3 ], [ 0.000000e+00, %1 ]
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ NOT_IMPLEMENTED();
int mp_remove(const char *target_path) { NOT_IMPLEMENTED(); }


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

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

LLVM IR (-O0):
define i32 @mp_remove(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (...) @NOT_IMPLEMENTED()
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
define i32 @mp_remove(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @NOT_IMPLEMENTED()
ret i32 undef
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
double dtime(void) {
  struct timeval tv;
  struct timezone tz;
  gettimeofday(&tv, &tz);
  return ((double)(tv.tv_sec)) + ((double)(tv.tv_usec)) / 1000000.0;
}


x86 assembly (clang, -O0):
<dtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xec7(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
divsd  0xec9(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define double @dtime() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %6, %10
ret double %11
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define double @dtime() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to double
%12 = fdiv double %11, 1.000000e+06
%13 = fadd double %12, %8
ret double %13
}
int field_size_valid(int deg) {
  return (deg >= 8) && (deg <= 1024) && (deg % 8 == 0);
}


x86 assembly (clang, -O0):
<field_size_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x8,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     113c <field_size_valid+0x3c>
xor    %eax,%eax
cmpl   $0x400,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jg     113c <field_size_valid+0x3c>
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<field_size_valid>:
lea    -0x8(%rdi),%eax
cmp    $0x3f9,%eax
setb   %al
test   $0x7,%dil
sete   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @field_size_valid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 8
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 1024
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* %2
%10 = srem i32 %9, 8
%11 = icmp eq i32 %10, 0
br label %12
12: ; preds = %8, %5, %1
%13 = phi i1 [ false, %5 ], [ false, %1 ], [ %11, %8 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @field_size_valid(i32 %0) {
%2 = add i32 %0, -8
%3 = icmp ult i32 %2, 1017
%4 = and i32 %0, 7
%5 = icmp eq i32 %4, 0
%6 = and i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
int edge_perm(int cubieval) { return cubieval >> 1; }


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

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

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

LLVM IR (-O2):
define i32 @edge_perm(i32 %0) {
%2 = ashr i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void google_map_output_heading_close(FILE *output_file) {
  fprintf(output_file, "}\n"
                       "\n"
                       "//]]>\n"
                       "</script>\n"
                       "</head>\n");
}


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

x86 assembly (clang, -O2):
<google_map_output_heading_close>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"}\0A\0A//]]>\0A</script>\0A</head>\0A\00"
define void @google_map_output_heading_close(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"}\0A\0A//]]>\0A</script>\0A</head>\0A\00"
define void @google_map_output_heading_close(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 27, i64 1, i32* %0)
ret void
}
/* Variables and functions */
scalar_t__ ioperm(int, int, int);
int /*<<< orphan*/ outb(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i;
  if (ioperm((0x0378), 1, 1)) {
    printf("Please this program as root\n");
    return 1;
  }
  while (1) {
    scanf("%i", &i);
    outb(i, (0x0378));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x378,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1050 <ioperm@plt>
cmp    $0x0,%rax
je     1181 <main+0x41>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1186 <main+0x46>
lea    0xe90(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    $0x378,%esi
call   1040 <outb@plt>
jmp    1186 <main+0x46>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x378,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1050 <ioperm@plt>
test   %rax,%rax
je     1176 <main+0x36>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe83(%rip),%r14
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
mov    $0x378,%esi
call   1040 <outb@plt>
jmp    1190 <main+0x50>

LLVM IR (-O0):
@.str = [29 x i8] c"Please this program as root\0A\00"
@.str.1 = [3 x i8] c"%i\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i64 @ioperm(i32 888, i32 1, i32 1)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 1
7: ; preds = %0
br label %8
8: ; preds = %7, %8
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = call i32 @outb(i32 %10, i32 888)
br label %8
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%i\00"
@str = [28 x i8] c"Please this program as root\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i64 @ioperm(i32 888, i32 1, i32 1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 1
7: ; preds = %0, %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = call i32 @outb(i32 %9, i32 888)
br label %7
}
void __attribute__((
    __warning__("curl_easy_setopt expects a "
                "curl_opensocket_callback argument for this option")))
__attribute__((__unused__)) __attribute__((__no__))
_curl_easy_setopt_err_opensocket_cb(void) {
  __asm__("");
}


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

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

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

LLVM IR (-O2):
define void @_curl_easy_setopt_err_opensocket_cb() {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *);
int /*<<< orphan*/ kill_this_task();
void disarm(void) {
  debug("Killed fists");
  kill_this_task();
}


x86 assembly (clang, -O0):
<disarm>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <debug@plt>
mov    $0x0,%al
call   1030 <kill_this_task@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<disarm>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <debug@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <kill_this_task@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Killed fists\00"
define void @disarm() {
%1 = call i32 @debug(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @kill_this_task()
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Killed fists\00"
define void @disarm() {
%1 = tail call i32 @debug(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @kill_this_task()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
void mem_write8(uint8_t *mem, uint16_t addr, uint8_t value) {
  if (addr >= 0xFFFF) {
    puts("OOB RAM WRITE\n");
    exit(0);
  }
  if (addr >= 0x2000) {
    mem[addr] = value;
  }
}


x86 assembly (clang, -O0):
<mem_write8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0xffff,-0xc(%rbp)
jl     1152 <mem_write8+0x32>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>
cmpl   $0x2000,-0xc(%rbp)
jl     116d <mem_write8+0x4d>
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_write8>:
push   %rax
cmp    $0xffff,%esi
jge    1138 <mem_write8+0x18>
cmp    $0x2000,%esi
jl     1136 <mem_write8+0x16>
mov    %esi,%eax
mov    %edx,(%rdi,%rax,4)
pop    %rax
ret
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"OOB RAM WRITE\0A\00"
define void @mem_write8(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = icmp sge i32 %7, 65535
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %3
%13 = load i32, i32* %5
%14 = icmp sge i32 %13, 8192
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %6
%17 = load i32*, i32** %4
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 %16, i32* %20
br label %21
21: ; preds = %15, %12
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"OOB RAM WRITE\0A\00"
define void @mem_write8(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 65534
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %3
%9 = icmp sgt i32 %1, 8191
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = zext i32 %1 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
store i32 %2, i32* %12
br label %13
13: ; preds = %10, %8
ret void
}
void protobuf_c_data_buffer_cleanup_recycling_bin() {}


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

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

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

LLVM IR (-O2):
define void @protobuf_c_data_buffer_cleanup_recycling_bin() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void neighbor() { printf("inside neigbor\n"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"inside neigbor\0A\00"
define void @neighbor() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [15 x i8] c"inside neigbor\00"
define void @neighbor() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pthread_exit(void *);
void *thr_fn2(void *arg) {
  printf("in thr_fn2:\n");
  pthread_exit((void *)1);
}


x86 assembly (clang, -O0):
<thr_fn2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thr_fn2>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"in thr_fn2:\0A\00"
define i8* @thr_fn2(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @pthread_exit(i8* inttoptr (i64 1 to i8*))
%6 = load i8*, i8** %2
ret i8* %6
}

LLVM IR (-O2):
@str = [12 x i8] c"in thr_fn2:\00"
define noalias i8* @thr_fn2(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @pthread_exit(i8* inttoptr (i64 1 to i8*))
ret i8* undef
}
void vmul(float *v, float f) {
  v[0] *= f;
  v[1] *= f;
  v[2] *= f;
}


x86 assembly (clang, -O0):
<vmul>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  (%rax),%xmm0
movss  %xmm0,(%rax)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm0
movss  %xmm0,0x4(%rax)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x8(%rax),%xmm0
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vmul>:
movss  (%rdi),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%rdi)
movss  0x4(%rdi),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%rdi)
mulss  0x8(%rdi),%xmm0
movss  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define void @vmul(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
store float* %0, float** %3
store float %1, float* %4
%5 = load float, float* %4
%6 = load float*, float** %3
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = fmul float %8, %5
store float %9, float* %7
%10 = load float, float* %4
%11 = load float*, float** %3
%12 = getelementptr inbounds float, float* %11, i64 1
%13 = load float, float* %12
%14 = fmul float %13, %10
store float %14, float* %12
%15 = load float, float* %4
%16 = load float*, float** %3
%17 = getelementptr inbounds float, float* %16, i64 2
%18 = load float, float* %17
%19 = fmul float %18, %15
store float %19, float* %17
ret void
}

LLVM IR (-O2):
define void @vmul(float* nocapture %0, float %1) {
%3 = load float, float* %0
%4 = fmul float %3, %1
store float %4, float* %0
%5 = getelementptr inbounds float, float* %0, i64 1
%6 = load float, float* %5
%7 = fmul float %6, %1
store float %7, float* %5
%8 = getelementptr inbounds float, float* %0, i64 2
%9 = load float, float* %8
%10 = fmul float %9, %1
store float %10, float* %8
ret void
}
/* Variables and functions */
int read_mail_box(int, int);
bool read_my_rmb(int index) { return read_mail_box(false, index); }


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

x86 assembly (clang, -O2):
<read_my_rmb>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <read_mail_box@plt>

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

LLVM IR (-O2):
define i32 @read_my_rmb(i32 %0) {
%2 = tail call i32 @read_mail_box(i32 0, i32 %0)
ret i32 %2
}
/* Variables and functions */
int myAtoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d", myAtoi("    2147483648"));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [15 x i8] c" 2147483648\00"
define i32 @main() {
%1 = tail call i32 @myAtoi(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void FreeOwnermap(void *hh) { free(hh); }


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

x86 assembly (clang, -O2):
<FreeOwnermap>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @FreeOwnermap(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CE(int);
void CE_High() { CE(1); }


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

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

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

LLVM IR (-O2):
define void @CE_High() {
%1 = tail call i32 @CE(i32 1)
ret void
}
int pmp_master_read() {
  while (*(volatile unsigned *)(0xBF800000 + (0x7010)) & 0x8000)
    ;
  return *(volatile unsigned *)(0xBF800000 + (0x7040));
}


x86 assembly (clang, -O0):
<pmp_master_read>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <pmp_master_read+0x9>
mov    $0xbf807010,%eax
mov    (%rax),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     1123 <pmp_master_read+0x23>
jmp    1109 <pmp_master_read+0x9>
mov    $0xbf807040,%eax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmp_master_read>:
mov    $0xbf807010,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testl  $0x8000,(%rax)
jne    1110 <pmp_master_read+0x10>
mov    0x30(%rax),%eax
ret

LLVM IR (-O0):
define i32 @pmp_master_read() {
br label %1
1: ; preds = %5, %0
%2 = load volatile i32, i32* inttoptr (i64 3212865552 to i32*)
%3 = and i32 %2, 32768
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
%7 = load volatile i32, i32* inttoptr (i64 3212865600 to i32*)
ret i32 %7
}

LLVM IR (-O2):
define i32 @pmp_master_read() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i32, i32* inttoptr (i64 3212865552 to i32*)
%3 = and i32 %2, 32768
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %1
5: ; preds = %1
%6 = load volatile i32, i32* inttoptr (i64 3212865600 to i32*)
ret i32 %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int a_ctz_32(int);
int a_clz_32(uint32_t x) {
  x >>= 1;
  x |= x >> 1;
  x |= x >> 2;
  x |= x >> 4;
  x |= x >> 8;
  x |= x >> 16;
  x++;
  return 31 - a_ctz_32(x);
}


x86 assembly (clang, -O0):
<a_clz_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <a_ctz_32@plt>
mov    %eax,%ecx
mov    $0x1f,%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_clz_32>:
push   %rax
mov    %edi,%eax
sar    %eax
sar    $0x2,%edi
or     %eax,%edi
mov    %edi,%eax
sar    $0x2,%eax
or     %eax,%edi
mov    %edi,%eax
sar    $0x4,%eax
or     %eax,%edi
mov    %edi,%eax
sar    $0x8,%eax
or     %eax,%edi
mov    %edi,%eax
sar    $0x10,%eax
or     %eax,%edi
add    $0x1,%edi
call   1030 <a_ctz_32@plt>
mov    $0x1f,%ecx
sub    %eax,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @a_clz_32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 1
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = ashr i32 %9, 2
%11 = load i32, i32* %2
%12 = or i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = ashr i32 %13, 4
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = ashr i32 %17, 8
%19 = load i32, i32* %2
%20 = or i32 %19, %18
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = ashr i32 %21, 16
%23 = load i32, i32* %2
%24 = or i32 %23, %22
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = call i32 @a_ctz_32(i32 %27)
%29 = sub nsw i32 31, %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @a_clz_32(i32 %0) {
%2 = ashr i32 %0, 1
%3 = ashr i32 %0, 2
%4 = or i32 %2, %3
%5 = ashr i32 %4, 2
%6 = or i32 %5, %4
%7 = ashr i32 %6, 4
%8 = or i32 %7, %6
%9 = ashr i32 %8, 8
%10 = or i32 %9, %8
%11 = ashr i32 %10, 16
%12 = or i32 %11, %10
%13 = add nsw i32 %12, 1
%14 = tail call i32 @a_ctz_32(i32 %13)
%15 = sub nsw i32 31, %14
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int show_usage() {
  printf("Usage: ./change_net_config_space.bin [dev_addr_start] [mac_addr]\n");
  printf("Example:\n");
  printf("> ./change_net_config_space.bin 0xd00001000 0x060504030201\n");
  return 0;
}


x86 assembly (clang, -O0):
<show_usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf1b(%rip),%rdi
call   1030 <printf@plt>
lea    0xf19(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [66 x i8] c"Usage: ./change_net_config_space.bin [dev_addr_start] [mac_addr]\0A\00"
@.str.1 = [10 x i8] c"Example:\0A\00"
@.str.2 = [60 x i8] c"> ./change_net_config_space.bin 0xd00001000 0x060504030201\0A\00"
define i32 @show_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [65 x i8] c"Usage: ./change_net_config_space.bin [dev_addr_start] [mac_addr]\00"
@str.3 = [9 x i8] c"Example:\00"
@str.4 = [59 x i8] c"> ./change_net_config_space.bin 0xd00001000 0x060504030201\00"
define i32 @show_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}