xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fc8080_write(void *, int, int);
int fc8080_set_filter(void *handle) {
  unsigned char cal = 0;
  unsigned int tcxo = 19200 * 1000;
  unsigned int csfbw = 780000;
  cal = (unsigned int)(tcxo * 78 * 2 / csfbw) / 100;
  fc8080_write(handle, 0x3c, 0x01);
  fc8080_write(handle, 0x3d, cal);
  fc8080_write(handle, 0x3c, 0x00);
  fc8080_write(handle, 0x32, 0x07);
  return 0;
}


x86 assembly (clang, -O0):
<fc8080_set_filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movl   $0x124f800,-0x10(%rbp)
movl   $0xbe6e0,-0x14(%rbp)
imul   $0x4e,-0x10(%rbp),%eax
shl    $0x1,%eax
xor    %edx,%edx
divl   -0x14(%rbp)
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3c,%esi
mov    $0x1,%edx
call   1030 <fc8080_write@plt>
mov    -0x8(%rbp),%rdi
movzbl -0x9(%rbp),%edx
mov    $0x3d,%esi
call   1030 <fc8080_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3c,%esi
xor    %edx,%edx
call   1030 <fc8080_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x32,%esi
mov    $0x7,%edx
call   1030 <fc8080_write@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fc8080_set_filter>:
push   %rbx
mov    %rdi,%rbx
mov    $0x3c,%esi
mov    $0x1,%edx
call   1030 <fc8080_write@plt>
mov    %rbx,%rdi
mov    $0x3d,%esi
mov    $0x26,%edx
call   1030 <fc8080_write@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
xor    %edx,%edx
call   1030 <fc8080_write@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
mov    $0x7,%edx
call   1030 <fc8080_write@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @fc8080_set_filter(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i8 0, i8* %3
store i32 19200000, i32* %4
store i32 780000, i32* %5
%6 = load i32, i32* %4
%7 = mul i32 %6, 78
%8 = mul i32 %7, 2
%9 = load i32, i32* %5
%10 = udiv i32 %8, %9
%11 = udiv i32 %10, 100
%12 = trunc i32 %11 to i8
store i8 %12, i8* %3
%13 = load i8*, i8** %2
%14 = call i32 @fc8080_write(i8* %13, i32 60, i32 1)
%15 = load i8*, i8** %2
%16 = load i8, i8* %3
%17 = zext i8 %16 to i32
%18 = call i32 @fc8080_write(i8* %15, i32 61, i32 %17)
%19 = load i8*, i8** %2
%20 = call i32 @fc8080_write(i8* %19, i32 60, i32 0)
%21 = load i8*, i8** %2
%22 = call i32 @fc8080_write(i8* %21, i32 50, i32 7)
ret i32 0
}

LLVM IR (-O2):
define i32 @fc8080_set_filter(i8* %0) {
%2 = tail call i32 @fc8080_write(i8* %0, i32 60, i32 1)
%3 = tail call i32 @fc8080_write(i8* %0, i32 61, i32 38)
%4 = tail call i32 @fc8080_write(i8* %0, i32 60, i32 0)
%5 = tail call i32 @fc8080_write(i8* %0, i32 50, i32 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int a[3] = {2};
  printf("a[0] = %d\na[1] = %d\na[2] = %d\n", a[0], a[1], a[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xec9(%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    $0x2,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [31 x i8] c"a[0] = %d\0Aa[1] = %d\0Aa[2] = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 2, i32 0, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello, C! \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%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>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello, C! \0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"Hello, C! \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int doo();
int foo(int a, int b) {
  if (a && b)
    return doo();
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1141 <foo+0x31>
cmpl   $0x0,-0xc(%rbp)
je     1141 <foo+0x31>
mov    $0x0,%al
call   1030 <doo@plt>
mov    %eax,-0x4(%rbp)
jmp    1148 <foo+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %edi,%edi
je     111f <foo+0xf>
test   %esi,%esi
je     111f <foo+0xf>
xor    %eax,%eax
jmp    1030 <doo@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @foo(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 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 (...) @doo()
store i32 %12, i32* %3
br label %14
13: ; preds = %8, %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %11
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, 0
%4 = icmp ne i32 %1, 0
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @doo()
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void long_func(void) {
  int k = 0;
  sleep(3);
  k = 1;
  k = 2;
}


x86 assembly (clang, -O0):
<long_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
call   1030 <sleep@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_func>:
mov    $0x3,%edi
jmp    1030 <sleep@plt>

LLVM IR (-O0):
define void @long_func() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @sleep(i32 3)
store i32 1, i32* %1
store i32 2, i32* %1
ret void
}

LLVM IR (-O2):
define void @long_func() {
%1 = tail call i32 @sleep(i32 3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x54() {
  Assert_real((isdigit(84) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              425, ("isdigit should be 0 for T"));
}


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

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

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

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for T\00"
define void @t_isdigit_0x54() {
%1 = tail call i64 @isdigit(i32 84)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 425, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int base32_blksize_raw() { return 5; }


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

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

LLVM IR (-O0):
define i32 @base32_blksize_raw() {
ret i32 5
}

LLVM IR (-O2):
define i32 @base32_blksize_raw() {
ret i32 5
}
/* Variables and functions */
scalar_t__ abs(int);
float gyroToFloat(int degree) { return ((float)abs(degree)) / 10.0; }


x86 assembly (clang, -O0):
<gyroToFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xecc(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gyroToFloat>:
push   %rax
call   1030 <abs@plt>
cvtsi2ss %rax,%xmm0
divss  0xedd(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @gyroToFloat(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @abs(i32 %3)
%5 = sitofp i64 %4 to float
%6 = fpext float %5 to double
%7 = fdiv double %6, 1.000000e+01
%8 = fptrunc double %7 to float
ret float %8
}

LLVM IR (-O2):
define float @gyroToFloat(i32 %0) {
%2 = tail call i64 @abs(i32 %0)
%3 = sitofp i64 %2 to float
%4 = fdiv float %3, 1.000000e+01
ret float %4
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
long sys_get_tick_count(void) {
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC, &ts);
  return (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000);
}


x86 assembly (clang, -O0):
<sys_get_tick_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_get_tick_count>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
movslq (%rsp),%rax
imul   $0x3e8,%rax,%rcx
movslq 0x4(%rsp),%rax
imul   $0x431bde83,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @sys_get_tick_count() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000000
%10 = add nsw i32 %6, %9
%11 = sext i32 %10 to i64
ret i64 %11
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @sys_get_tick_count() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load i32, i32* %8
%10 = sdiv i32 %9, 1000000
%11 = add nsw i32 %10, %7
%12 = sext i32 %11 to i64
ret i64 %12
}
double negate_logical_notnot(double a) { return -(a != 0.0); }


x86 assembly (clang, -O0):
<negate_logical_notnot>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<negate_logical_notnot>:
xorpd  %xmm1,%xmm1
cmpneqsd %xmm1,%xmm0
movsd  0xeef(%rip),%xmm1
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @negate_logical_notnot(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp une double %3, 0.000000e+00
%5 = zext i1 %4 to i32
%6 = sub nsw i32 0, %5
%7 = sitofp i32 %6 to double
ret double %7
}

LLVM IR (-O2):
define double @negate_logical_notnot(double %0) {
%2 = fcmp une double %0, 0.000000e+00
%3 = sitofp i1 %2 to double
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ init();
int /*<<< orphan*/ ioNext();
int /*<<< orphan*/ ioOpenInput(int /*<<< orphan*/ *);
int /*<<< orphan*/ parseProgram();
int /*<<< orphan*/ utilReady();
int main(int ac, char **av) {
  utilReady();
  init();
  ioOpenInput(NULL);
  ioNext();
  parseProgram();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <utilReady@plt>
mov    $0x0,%al
call   1060 <init@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <ioOpenInput@plt>
mov    $0x0,%al
call   1040 <ioNext@plt>
mov    $0x0,%al
call   1070 <parseProgram@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <utilReady@plt>
xor    %eax,%eax
call   1060 <init@plt>
xor    %edi,%edi
call   1030 <ioOpenInput@plt>
xor    %eax,%eax
call   1040 <ioNext@plt>
xor    %eax,%eax
call   1070 <parseProgram@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @utilReady()
%7 = call i32 (...) @init()
%8 = call i32 @ioOpenInput(i32* null)
%9 = call i32 (...) @ioNext()
%10 = call i32 (...) @parseProgram()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @utilReady()
%4 = tail call i32 (...) @init()
%5 = tail call i32 @ioOpenInput(i32* null)
%6 = tail call i32 (...) @ioNext()
%7 = tail call i32 (...) @parseProgram()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int test();
int main(void) {
  if (test() != 100)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <test@plt>
cmp    $0x64,%eax
je     1156 <main+0x26>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <test@plt>
cmp    $0x64,%eax
jne    1144 <main+0x14>
xor    %edi,%edi
call   1040 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test()
%3 = icmp ne i32 %2, 100
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test()
%2 = icmp eq i32 %1, 100
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int sys_get_uptime_us();
uint64_t sys_get_uptime_ms(void) { return sys_get_uptime_us() / 1000; }


x86 assembly (clang, -O0):
<sys_get_uptime_ms>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <sys_get_uptime_us@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_get_uptime_ms>:
push   %rax
xor    %eax,%eax
call   1030 <sys_get_uptime_us@plt>
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @sys_get_uptime_ms() {
%1 = call i32 (...) @sys_get_uptime_us()
%2 = sdiv i32 %1, 1000
ret i32 %2
}

LLVM IR (-O2):
define i32 @sys_get_uptime_ms() {
%1 = tail call i32 (...) @sys_get_uptime_us()
%2 = sdiv i32 %1, 1000
ret i32 %2
}
void doNothingEffect(short led, short *data) { return; }


x86 assembly (clang, -O0):
<doNothingEffect>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @doNothingEffect(i16 signext %0, i16* %1) {
%3 = alloca i16
%4 = alloca i16*
store i16 %0, i16* %3
store i16* %1, i16** %4
ret void
}

LLVM IR (-O2):
define void @doNothingEffect(i16 signext %0, i16* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void sigint_handler(int sig) { write(0, "Hummm!!!\n", sizeof("Hummm!!!\n")); }


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

x86 assembly (clang, -O2):
<sigint_handler>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
mov    $0xa,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Hummm!!!\0A\00"
define void @sigint_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @write(i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Hummm!!!\0A\00"
define void @sigint_handler(i32 %0) {
%2 = tail call i32 @write(i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}
struct device_d *of_find_device_by_node(struct device_node *np) {
  return ((void *)0);
}


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

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

LLVM IR (-O0):
%struct.device_d = type opaque
%struct.device_node = type opaque
define %struct.device_d* @of_find_device_by_node(%struct.device_node* %0) {
%2 = alloca %struct.device_node*
store %struct.device_node* %0, %struct.device_node** %2
ret %struct.device_d* null
}

LLVM IR (-O2):
%struct.device_d = type opaque
%struct.device_node = type opaque
define noalias %struct.device_d* @of_find_device_by_node(%struct.device_node* nocapture readnone %0) {
ret %struct.device_d* null
}
/* Variables and functions */
int /*<<< orphan*/ s2diskxz(float, float, float, float, float);
void s2diskxz_(float *px, float *py, float *pz, float *r1, float *r2) {
  s2diskxz(*px, *py, *pz, *r1, *r2);
}


x86 assembly (clang, -O0):
<s2diskxz_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm3
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm4
call   1030 <s2diskxz@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s2diskxz_>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
movss  (%rdx),%xmm2
movss  (%rcx),%xmm3
movss  (%r8),%xmm4
jmp    1030 <s2diskxz@plt>

LLVM IR (-O0):
define void @s2diskxz_(float* %0, float* %1, float* %2, float* %3, float* %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca float*
%10 = alloca float*
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store float* %3, float** %9
store float* %4, float** %10
%11 = load float*, float** %6
%12 = load float, float* %11
%13 = load float*, float** %7
%14 = load float, float* %13
%15 = load float*, float** %8
%16 = load float, float* %15
%17 = load float*, float** %9
%18 = load float, float* %17
%19 = load float*, float** %10
%20 = load float, float* %19
%21 = call i32 @s2diskxz(float %12, float %14, float %16, float %18, float %20)
ret void
}

LLVM IR (-O2):
define void @s2diskxz_(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* nocapture %3, float* nocapture %4) {
%6 = load float, float* %0
%7 = load float, float* %1
%8 = load float, float* %2
%9 = load float, float* %3
%10 = load float, float* %4
%11 = tail call i32 @s2diskxz(float %6, float %7, float %8, float %9, float %10)
ret void
}
/* Type definitions */
struct pico_mqtt_serializer {
  int dummy;
};

/* Variables and functions */
int serialize_acknowledge(struct pico_mqtt_serializer *, int);
int serialize_pubrel(struct pico_mqtt_serializer *serializer) {
  do {
  } while (0);
  return serialize_acknowledge(serializer, (6 << 4));
}


x86 assembly (clang, -O0):
<serialize_pubrel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
jmp    1121 <serialize_pubrel+0x11>
mov    -0x8(%rbp),%rdi
mov    $0x60,%esi
call   1030 <serialize_acknowledge@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialize_pubrel>:
mov    $0x60,%esi
jmp    1030 <serialize_acknowledge@plt>

LLVM IR (-O0):
%struct.pico_mqtt_serializer = type { i32 }
define i32 @serialize_pubrel(%struct.pico_mqtt_serializer* %0) {
%2 = alloca %struct.pico_mqtt_serializer*
store %struct.pico_mqtt_serializer* %0, %struct.pico_mqtt_serializer** %2
br label %3
3: ; preds = %1
br label %4
4: ; preds = %3
%5 = load %struct.pico_mqtt_serializer*, %struct.pico_mqtt_serializer** %2
%6 = call i32 @serialize_acknowledge(%struct.pico_mqtt_serializer* %5, i32 96)
ret i32 %6
}

LLVM IR (-O2):
%struct.pico_mqtt_serializer = type { i32 }
define i32 @serialize_pubrel(%struct.pico_mqtt_serializer* %0) {
%2 = tail call i32 @serialize_acknowledge(%struct.pico_mqtt_serializer* %0, i32 96)
ret i32 %2
}
int _f(int i) { return i + 1; }


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

x86 assembly (clang, -O2):
<_f>:
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @_f(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Type definitions */
struct statfs {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __statfs(const char *file, struct statfs *buf) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__statfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__statfs>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.statfs = type { i32 }
@ENOSYS = global i32 0
define i32 @__statfs(i8* %0, %struct.statfs* %1) {
%3 = alloca i8*
%4 = alloca %struct.statfs*
store i8* %0, i8** %3
store %struct.statfs* %1, %struct.statfs** %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
%struct.statfs = type { i32 }
@ENOSYS = global i32 0
define i32 @__statfs(i8* nocapture readnone %0, %struct.statfs* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void func2() { print("gives strength turn\non alarm for 1 second"); }


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

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

LLVM IR (-O0):
@.str = [42 x i8] c"gives strength turn\0Aon alarm for 1 second\00"
define void @func2() {
%1 = call i32 @print(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"gives strength turn\0Aon alarm for 1 second\00"
define void @func2() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ max_heapify(int *, int, int);
void build_max_heap(int *a, int length) {
  int i;
  for (i = (length / 2) - 1; i >= 0; i--) {
    max_heapify(a, i, length);
  }
}


x86 assembly (clang, -O0):
<build_max_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1157 <build_max_heap+0x47>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <max_heapify@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <build_max_heap+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_max_heap>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%esi
jl     1145 <build_max_heap+0x35>
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x2(%rbx),%esi
mov    %r14,%rdi
mov    %ebp,%edx
call   1030 <max_heapify@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1130 <build_max_heap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @build_max_heap(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = lshr i32 %1, 1
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ %8, %6 ], [ %5, %4 ]
%8 = add nsw i32 %7, -1
%9 = tail call i32 @max_heapify(i32* %0, i32 %8, i32 %1)
%10 = icmp ugt i32 %7, 1
br i1 %10, label %6, label %11
11: ; preds = %6, %2
ret void
}
void glEndTransformFeedback(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glEndTransformFeedback() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, int *, double *);
int main(void) {
  int a;
  double b, c;
  scanf("%d %lf", &a, &b);
  c = a / b;
  printf("%.3lf km/l\n", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"%d %lf\00"
@.str.1 = [12 x i8] c"%.3lf km/l\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, double* %2)
%5 = load i32, i32* %1
%6 = sitofp i32 %5 to double
%7 = load double, double* %2
%8 = fdiv double %6, %7
store double %8, double* %3
%9 = load double, double* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %lf\00"
@.str.1 = [12 x i8] c"%.3lf km/l\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %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), i32* %1, double* %2)
%6 = load i32, i32* %1
%7 = sitofp i32 %6 to double
%8 = load double, double* %2
%9 = fdiv double %7, %8
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int str_count(char const *, char const *);
void main() {
  const char *text = "abcdasdfafasdfacjjjjjjjjjjjjcanndnnn";
  const char *sub = "abcd";
  printf("ret = %d\n", str_count(text, sub));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeeb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <str_count@plt>
mov    %eax,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xef6(%rip),%rsi
call   1040 <str_count@plt>
lea    0xeef(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [37 x i8] c"abcdasdfafasdfacjjjjjjjjjjjjcanndnnn\00"
@.str.1 = [5 x i8] c"abcd\00"
@.str.2 = [10 x i8] c"ret = %d\0A\00"
define void @main() {
%1 = tail call i32 @str_count(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %1)
ret void
}
void netbuf_get_16bitnum(unsigned char *buf, int buflen, int *offset,
                         unsigned short *num) {
  unsigned char *start = buf + *offset;
  unsigned char *p = start;
  *num = 0;
  *num |= (*p++) << 8;
  *num |= (*p++);
  *offset += 2;
}


x86 assembly (clang, -O0):
<netbuf_get_16bitnum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movw   $0x0,(%rax)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movzbl (%rax),%edx
shl    $0x8,%edx
mov    -0x20(%rbp),%rax
movzwl (%rax),%ecx
or     %edx,%ecx
mov    %cx,(%rax)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movzbl (%rax),%edx
mov    -0x20(%rbp),%rax
movzwl (%rax),%ecx
or     %edx,%ecx
mov    %cx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<netbuf_get_16bitnum>:
movslq (%rdx),%rax
movw   $0x0,(%rcx)
movzbl (%rdi,%rax,1),%esi
shl    $0x8,%esi
mov    %si,(%rcx)
movzbl 0x1(%rdi,%rax,1),%edi
or     %esi,%edi
mov    %di,(%rcx)
add    $0x2,%eax
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @netbuf_get_16bitnum(i8* %0, i32 %1, i32* %2, i16* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i16*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i16* %3, i16** %8
%11 = load i8*, i8** %5
%12 = load i32*, i32** %7
%13 = load i32, i32* %12
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
store i8* %15, i8** %9
%16 = load i8*, i8** %9
store i8* %16, i8** %10
%17 = load i16*, i16** %8
store i16 0, i16* %17
%18 = load i8*, i8** %10
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %10
%20 = load i8, i8* %18
%21 = zext i8 %20 to i32
%22 = shl i32 %21, 8
%23 = load i16*, i16** %8
%24 = load i16, i16* %23
%25 = zext i16 %24 to i32
%26 = or i32 %25, %22
%27 = trunc i32 %26 to i16
store i16 %27, i16* %23
%28 = load i8*, i8** %10
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %10
%30 = load i8, i8* %28
%31 = zext i8 %30 to i32
%32 = load i16*, i16** %8
%33 = load i16, i16* %32
%34 = zext i16 %33 to i32
%35 = or i32 %34, %31
%36 = trunc i32 %35 to i16
store i16 %36, i16* %32
%37 = load i32*, i32** %7
%38 = load i32, i32* %37
%39 = add nsw i32 %38, 2
store i32 %39, i32* %37
ret void
}

LLVM IR (-O2):
define void @netbuf_get_16bitnum(i8* nocapture %0, i32 %1, i32* nocapture %2, i16* nocapture writeonly %3) {
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i16 0, i16* %3
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %7
%10 = zext i8 %9 to i16
%11 = shl nuw i16 %10, 8
store i16 %11, i16* %3
%12 = load i8, i8* %8
%13 = zext i8 %12 to i16
%14 = or i16 %11, %13
store i16 %14, i16* %3
%15 = add nsw i32 %5, 2
store i32 %15, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int n;
  int a[5];
  int *p;
  a[2] = 1024;
  p = &n;
  *(p + 5) = 98;
  printf("a[2] = %d\n", a[2]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x400,-0x18(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x62,0x14(%rax)
mov    -0x18(%rbp),%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"a[2] = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1024)
ret i32 0
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int *a = malloc(sizeof(int));
  float *b = malloc(sizeof(float));
  a = (int *)b;
  *a = 1.5;
  printf("a = %i, hex = 0x%x\n", *a, *a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [20 x i8] c"a = %i, hex = 0x%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca float*
store i32 0, i32* %1
%4 = call i8* @malloc(i32 4)
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %2
%6 = call i8* @malloc(i32 4)
%7 = bitcast i8* %6 to float*
store float* %7, float** %3
%8 = load float*, float** %3
%9 = bitcast float* %8 to i32*
store i32* %9, i32** %2
%10 = load i32*, i32** %2
store i32 1, i32* %10
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = load i32*, i32** %2
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"a = %i, hex = 0x%x\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 1, i32 1)
ret i32 0
}
/* Variables and functions */
int get_ticks();
int /*<<< orphan*/ milli_delay(int);
int /*<<< orphan*/ printf(char *, int);
void TestA() {
  while (1) {
    printf("<Ticks:%d>", get_ticks());
    milli_delay(200);
  }
}


x86 assembly (clang, -O0):
<TestA>:
push   %rbp
mov    %rsp,%rbp
jmp    1139 <TestA+0x9>
mov    $0x0,%al
call   1040 <get_ticks@plt>
mov    %eax,%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    $0xc8,%edi
call   1050 <milli_delay@plt>
jmp    1139 <TestA+0x9>

x86 assembly (clang, -O2):
<TestA>:
push   %rbx
lea    0xec8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <get_ticks@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xc8,%edi
call   1050 <milli_delay@plt>
jmp    1140 <TestA+0x10>

LLVM IR (-O0):
@.str = [11 x i8] c"<Ticks:%d>\00"
define void @TestA() {
br label %1
1: ; preds = %0, %1
%2 = call i32 (...) @get_ticks()
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @milli_delay(i32 200)
br label %1
}

LLVM IR (-O2):
@.str = [11 x i8] c"<Ticks:%d>\00"
define void @TestA() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @get_ticks()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @milli_delay(i32 200)
br label %1
}
/* Type definitions */
struct timeval {
  int tv_usec;
  int /*<<< orphan*/ tv_sec;
};
struct timespec {
  int tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
void bot_timespec_to_timeval(struct timespec *ts, struct timeval *tv) {
  tv->tv_sec = ts->tv_sec;
  tv->tv_usec = ts->tv_nsec / 1000;
}


x86 assembly (clang, -O0):
<bot_timespec_to_timeval>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bot_timespec_to_timeval>:
mov    0x4(%rdi),%eax
mov    %eax,0x4(%rsi)
movslq (%rdi),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
%struct.timeval = type { i32, i32 }
define void @bot_timespec_to_timeval(%struct.timespec* %0, %struct.timeval* %1) {
%3 = alloca %struct.timespec*
%4 = alloca %struct.timeval*
store %struct.timespec* %0, %struct.timespec** %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load %struct.timespec*, %struct.timespec** %3
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 1
%7 = load i32, i32* %6
%8 = load %struct.timeval*, %struct.timeval** %4
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
store i32 %7, i32* %9
%10 = load %struct.timespec*, %struct.timespec** %3
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = sdiv i32 %12, 1000
%14 = load %struct.timeval*, %struct.timeval** %4
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
store i32 %13, i32* %15
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
%struct.timeval = type { i32, i32 }
define void @bot_timespec_to_timeval(%struct.timespec* nocapture %0, %struct.timeval* nocapture writeonly %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
store i32 %4, i32* %5
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%7 = load i32, i32* %6
%8 = sdiv i32 %7, 1000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
store i32 %8, i32* %9
ret void
}
/* Variables and functions */
char **malloc(int);
char **string_array_new() {
  char **array = malloc(sizeof(char *));
  array[0] = NULL;
  return array;
}


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

x86 assembly (clang, -O2):
<string_array_new>:
push   %rax
mov    $0x8,%edi
call   1030 <malloc@plt>
movq   $0x0,(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define i8** @string_array_new() {
%1 = alloca i8**
%2 = call i8** @malloc(i32 8)
store i8** %2, i8*** %1
%3 = load i8**, i8*** %1
%4 = getelementptr inbounds i8*, i8** %3, i64 0
store i8* null, i8** %4
%5 = load i8**, i8*** %1
ret i8** %5
}

LLVM IR (-O2):
define noalias i8** @string_array_new() {
%1 = tail call i8** @malloc(i32 8)
store i8* null, i8** %1
ret i8** %1
}
/* Variables and functions */
int /*<<< orphan*/ createKey();
char *generatePasscode(int);
int /*<<< orphan*/ phase(int);
void phase_6() {
  char *pass = generatePasscode(6);
  phase(6);
  createKey();
}


x86 assembly (clang, -O0):
<phase_6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x6,%edi
call   1040 <generatePasscode@plt>
mov    %rax,-0x8(%rbp)
mov    $0x6,%edi
call   1050 <phase@plt>
mov    $0x0,%al
call   1030 <createKey@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phase_6>:
push   %rax
mov    $0x6,%edi
call   1040 <generatePasscode@plt>
mov    $0x6,%edi
call   1050 <phase@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <createKey@plt>

LLVM IR (-O0):
define void @phase_6() {
%1 = alloca i8*
%2 = call i8* @generatePasscode(i32 6)
store i8* %2, i8** %1
%3 = call i32 @phase(i32 6)
%4 = call i32 (...) @createKey()
ret void
}

LLVM IR (-O2):
define void @phase_6() {
%1 = tail call i8* @generatePasscode(i32 6)
%2 = tail call i32 @phase(i32 6)
%3 = tail call i32 (...) @createKey()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ countWordsInFile(int, char **);
int main(int argc, char *argv[]) {
  countWordsInFile(argc, argv);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @countWordsInFile(i32 %0, i8** %1)
ret i32 0
}
void ctk_dialog_new() {}


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

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

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

LLVM IR (-O2):
define void @ctk_dialog_new() {
ret void
}
int BS2PP_CheckIncludeHashName(char *str) {
  int h;
  char *s;
  s = str;
  h = 0;
  while (*s)
    h = (h * 251) + (*s++);
  h = h * 251;
  return ((h >> 8) & 4095);
}


x86 assembly (clang, -O0):
<BS2PP_CheckIncludeHashName>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <BS2PP_CheckIncludeHashName+0x47>
imul   $0xfb,-0xc(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <BS2PP_CheckIncludeHashName+0x17>
imul   $0xfb,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xfff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BS2PP_CheckIncludeHashName>:
mov    (%rdi),%cl
test   %cl,%cl
je     112f <BS2PP_CheckIncludeHashName+0x2f>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
add    %eax,%ecx
imul   $0xfb,%ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <BS2PP_CheckIncludeHashName+0x10>
shr    $0x8,%eax
and    $0xfff,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @BS2PP_CheckIncludeHashName(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %4
store i32 0, i32* %3
br label %6
6: ; preds = %10, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i32, i32* %3
%12 = mul nsw i32 %11, 251
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %4
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = add nsw i32 %12, %16
store i32 %17, i32* %3
br label %6
18: ; preds = %6
%19 = load i32, i32* %3
%20 = mul nsw i32 %19, 251
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = ashr i32 %21, 8
%23 = and i32 %22, 4095
ret i32 %23
}

LLVM IR (-O2):
define i32 @BS2PP_CheckIncludeHashName(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ 0, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = sext i8 %5 to i32
%10 = add nsw i32 %7, %9
%11 = mul i32 %10, 251
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = lshr i32 %11, 8
%16 = and i32 %15, 4095
br label %17
17: ; preds = %14, %1
%18 = phi i32 [ 0, %1 ], [ %16, %14 ]
ret i32 %18
}