xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ default_isr();
__attribute__((weak)) void BLE_WAKEUP_LP_Handler() { default_isr(); }


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

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

LLVM IR (-O0):
define weak void @BLE_WAKEUP_LP_Handler() {
%1 = call i32 (...) @default_isr()
ret void
}

LLVM IR (-O2):
define weak void @BLE_WAKEUP_LP_Handler() {
%1 = tail call i32 (...) @default_isr()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
int htoi(char *str) {
  unsigned int ret;
  sscanf(str, "0x%x", &ret);
  return ret;
}


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

x86 assembly (clang, -O2):
<htoi>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"0x%x\00"
define i32 @htoi(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ putchar(int);
void getchar3() {
  int c;
  while ((c = getchar()) != 0)
    putchar(c);
}


x86 assembly (clang, -O0):
<getchar3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     1148 <getchar3+0x28>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
jmp    1128 <getchar3+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchar3>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
test   %eax,%eax
je     1144 <getchar3+0x24>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    1130 <getchar3+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @getchar3() {
%1 = alloca i32
br label %2
2: ; preds = %5, %0
%3 = call i32 (...) @getchar()
store i32 %3, i32* %1
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* %1
%7 = call i32 @putchar(i32 %6)
br label %2
8: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @getchar3() {
%1 = tail call i32 (...) @getchar()
%2 = icmp eq i32 %1, 0
br i1 %2, label %8, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ %1, %0 ]
%5 = tail call i32 @putchar(i32 %4)
%6 = tail call i32 (...) @getchar()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %0
ret void
}
/* Variables and functions */
int _getline(char *, int, int);
int /*<<< orphan*/ monLock();
int /*<<< orphan*/ monUnlock();
int mon_getline(char *buf, int max, int ledit) {
  int ret;
  monLock();
  ret = _getline(buf, max, ledit);
  monUnlock();
  return (ret);
}


x86 assembly (clang, -O0):
<mon_getline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1030 <monLock@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <_getline@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <monUnlock@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mon_getline>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <monLock@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1050 <_getline@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <monUnlock@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mon_getline(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = call i32 (...) @monLock()
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @_getline(i8* %9, i32 %10, i32 %11)
store i32 %12, i32* %7
%13 = call i32 (...) @monUnlock()
%14 = load i32, i32* %7
ret i32 %14
}

LLVM IR (-O2):
define i32 @mon_getline(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @monLock()
%5 = tail call i32 @_getline(i8* %0, i32 %1, i32 %2)
%6 = tail call i32 (...) @monUnlock()
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ b3dHeaderItemBytes(int *, int *);
void b3dheaderitembytes_(int *nflags, int *nbytes) {
  b3dHeaderItemBytes(nflags, nbytes);
}


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

x86 assembly (clang, -O2):
<b3dheaderitembytes_>:
jmp    1030 <b3dHeaderItemBytes@plt>

LLVM IR (-O0):
define void @b3dheaderitembytes_(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 @b3dHeaderItemBytes(i32* %5, i32* %6)
ret void
}

LLVM IR (-O2):
define void @b3dheaderitembytes_(i32* %0, i32* %1) {
%3 = tail call i32 @b3dHeaderItemBytes(i32* %0, i32* %1)
ret void
}
float timer_toms(unsigned int t) { return t / (100000000 / 1000.0); }


x86 assembly (clang, -O0):
<timer_toms>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0xee9(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_toms>:
mov    %edi,%eax
cvtsi2sd %rax,%xmm0
divsd  0xef1(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @timer_toms(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = uitofp i32 %3 to double
%5 = fdiv double %4, 1.000000e+05
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @timer_toms(i32 %0) {
%2 = uitofp i32 %0 to double
%3 = fdiv double %2, 1.000000e+05
%4 = fptrunc double %3 to float
ret float %4
}
int test_imm_A3int16_reg(short val) {
  return ((val) & (-0xA3 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A3int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff5d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_A3int16_reg(i16 signext %0) {
%2 = and i16 %0, -163
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void gtk_text_iter_forward_lines() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_iter_forward_lines() {
ret void
}
extern void init_runpath() {}


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

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

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

LLVM IR (-O2):
define void @init_runpath() {
ret void
}
/* Type definitions */
struct caldate {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ caldate_frommjd(struct caldate *, int /*<<< orphan*/, int *,
                                   int *);
int /*<<< orphan*/ caldate_mjd(struct caldate *);
void caldate_normalize(struct caldate *cd) {
  caldate_frommjd(cd, caldate_mjd(cd), (int *)0, (int *)0);
}


x86 assembly (clang, -O0):
<caldate_normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <caldate_mjd@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   1030 <caldate_frommjd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caldate_normalize>:
push   %rbx
mov    %rdi,%rbx
call   1040 <caldate_mjd@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
pop    %rbx
jmp    1030 <caldate_frommjd@plt>

LLVM IR (-O0):
%struct.caldate = type { i32 }
define void @caldate_normalize(%struct.caldate* %0) {
%2 = alloca %struct.caldate*
store %struct.caldate* %0, %struct.caldate** %2
%3 = load %struct.caldate*, %struct.caldate** %2
%4 = load %struct.caldate*, %struct.caldate** %2
%5 = call i32 @caldate_mjd(%struct.caldate* %4)
%6 = call i32 @caldate_frommjd(%struct.caldate* %3, i32 %5, i32* null, i32* null)
ret void
}

LLVM IR (-O2):
%struct.caldate = type { i32 }
define void @caldate_normalize(%struct.caldate* %0) {
%2 = tail call i32 @caldate_mjd(%struct.caldate* %0)
%3 = tail call i32 @caldate_frommjd(%struct.caldate* %0, i32 %2, i32* null, i32* null)
ret void
}
int DRV_UPGRADE_NV_SET_RESULT(int status) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @DRV_UPGRADE_NV_SET_RESULT(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int x = 42;
  int *x_ptr = &x;
  printf("x = %d\n", x);
  printf("x_ptr = %p\n", x_ptr);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"x = %d\0A\00"
@.str.1 = [12 x i8] c"x_ptr = %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 42, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 42)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %1)
ret i32 0
}
void ffgo_() {}


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

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

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

LLVM IR (-O2):
define void @ffgo_() {
ret void
}
/* Variables and functions */
char **refit(char **array, int num) {
  while (array[num] != NULL) {
    array[num] = array[num + 1];
    num++;
  }
  return array;
}


x86 assembly (clang, -O0):
<refit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1149 <refit+0x49>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110b <refit+0xb>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<refit>:
mov    %rdi,%rax
movslq %esi,%rcx
cmpq   $0x0,(%rdi,%rcx,8)
je     1130 <refit+0x30>
lea    (%rax,%rcx,8),%rcx
add    $0x8,%rcx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rcx),%rdx
mov    %rdx,-0x8(%rcx)
add    $0x8,%rcx
test   %rdx,%rdx
jne    1120 <refit+0x20>
ret

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

LLVM IR (-O2):
define i8** @refit(i8** returned %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
br i1 %6, label %15, label %7
7: ; preds = %2, %7
%8 = phi i64 [ %10, %7 ], [ %3, %2 ]
%9 = phi i8** [ %11, %7 ], [ %4, %2 ]
%10 = add i64 %8, 1
%11 = getelementptr inbounds i8*, i8** %0, i64 %10
%12 = load i8*, i8** %11
store i8* %12, i8** %9
%13 = load i8*, i8** %11
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %7
15: ; preds = %7, %2
ret i8** %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void fun1(int i) { printf("this is fun%d\n", i); }


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

x86 assembly (clang, -O2):
<fun1>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"this is fun%d\0A\00"
define void @fun1(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Trees(int);
int main() {
  int i;
  for (i = 0; i < 100; i++)
    Trees(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1146 <main+0x36>
mov    -0x8(%rbp),%edi
call   1030 <Trees@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <Trees@plt>
add    $0x1,%ebx
cmp    $0x64,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @Trees(i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 100
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int isPowerOfTwo(uint32_t n) {
  if (n == 0) {
    return 0;
  }
  while (n != 1) {
    if (n % 2 != 0) {
      return 0;
    }
    n = n / 2;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isPowerOfTwo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <isPowerOfTwo+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1166 <isPowerOfTwo+0x66>
jmp    1122 <isPowerOfTwo+0x22>
cmpl   $0x1,-0x8(%rbp)
je     115f <isPowerOfTwo+0x5f>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     114c <isPowerOfTwo+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1166 <isPowerOfTwo+0x66>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1122 <isPowerOfTwo+0x22>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPowerOfTwo>:
mov    %edi,%eax
cmp    $0x2,%edi
jb     112c <isPowerOfTwo+0x2c>
nopw   0x0(%rax,%rax,1)
test   $0x1,%al
jne    112d <isPowerOfTwo+0x2d>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
and    $0xfffffffe,%eax
cmp    $0x2,%eax
mov    %ecx,%eax
jne    1110 <isPowerOfTwo+0x10>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @isPowerOfTwo(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %7
%4 = phi i32 [ %8, %7 ], [ %0, %1 ]
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = sdiv i32 %4, 2
%9 = and i32 %4, -2
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %3
11: ; preds = %3, %7, %1
%12 = phi i32 [ %0, %1 ], [ 0, %3 ], [ 1, %7 ]
ret i32 %12
}
/* Type definitions */
typedef char wint_t;

/* Variables and functions */
wint_t towupper(wint_t c) {
  if ((unsigned int)(c - 'a') < 26u)
    c += 'A' - 'a';
  return c;
}


x86 assembly (clang, -O0):
<towupper>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x61,%eax
cmp    $0x1a,%eax
jae    1124 <towupper+0x24>
movsbl -0x1(%rbp),%eax
add    $0xffffffe0,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<towupper>:
lea    -0x61(%rdi),%eax
lea    -0x20(%rdi),%ecx
cmp    $0x1a,%eax
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @towupper(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 97
%6 = icmp ult i32 %5, 26
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = add nsw i32 %9, -32
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
br label %12
12: ; preds = %7, %1
%13 = load i8, i8* %2
ret i8 %13
}

LLVM IR (-O2):
define signext i8 @towupper(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -97
%4 = icmp ult i32 %3, 26
%5 = add i8 %0, -32
%6 = select i1 %4, i8 %5, i8 %0
ret i8 %6
}
/* Variables and functions */
char *ext_split(char *, size_t, char const *, char, int);
char *filename_extension(char *buffer, size_t buflen, const char *pattern) {
  return (ext_split(buffer, buflen, pattern, '.', 1));
}


x86 assembly (clang, -O0):
<filename_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x2e,%ecx
mov    $0x1,%r8d
call   1030 <ext_split@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filename_extension>:
mov    $0x2e,%ecx
mov    $0x1,%r8d
jmp    1030 <ext_split@plt>

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

LLVM IR (-O2):
define i8* @filename_extension(i8* %0, i64 %1, i8* %2) {
%4 = tail call i8* @ext_split(i8* %0, i64 %1, i8* %2, i8 signext 46, i32 1)
ret i8* %4
}
/* Variables and functions */
double RAND_MAX;
double rand();
size_t TestingMostlyDescending(size_t index, size_t total) {
  return total - index + rand() * 1.0 / RAND_MAX * 5 - 2.5;
}


x86 assembly (clang, -O0):
<TestingMostlyDescending>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
movq   %rax,%xmm0
movaps 0xec9(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xecd(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xor    %eax,%eax
call   1030 <rand@plt>
movsd  -0x18(%rbp),%xmm1
mov    0x2e7e(%rip),%rax
movsd  (%rax),%xmm2
divsd  %xmm2,%xmm0
movsd  0xea6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe9e(%rip),%xmm1
addsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
movsd  0xe8b(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestingMostlyDescending>:
sub    $0x18,%rsp
sub    %rdi,%rsi
movq   %rsi,%xmm0
punpckldq 0xedc(%rip),%xmm0
subpd  0xee4(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2e9d(%rip),%rax
divsd  (%rax),%xmm0
mulsd  0xec9(%rip),%xmm0
addsd  (%rsp),%xmm0
addsd  0xec4(%rip),%xmm0
cvttsd2si %xmm0,%rcx
mov    %rcx,%rdx
sar    $0x3f,%rdx
subsd  0xeb8(%rip),%xmm0
cvttsd2si %xmm0,%rax
and    %rdx,%rax
or     %rcx,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i64 @TestingMostlyDescending(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = sub i64 %5, %6
%8 = uitofp i64 %7 to double
%9 = call double (...) @rand()
%10 = fmul double %9, 1.000000e+00
%11 = load double, double* @RAND_MAX
%12 = fdiv double %10, %11
%13 = call double @llvm.fmuladd.f64(double %12, double 5.000000e+00, double %8)
%14 = fsub double %13, 2.500000e+00
%15 = fptoui double %14 to i64
ret i64 %15
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i64 @TestingMostlyDescending(i64 %0, i64 %1) {
%3 = sub i64 %1, %0
%4 = uitofp i64 %3 to double
%5 = tail call double (...) @rand()
%6 = load double, double* @RAND_MAX
%7 = fdiv double %5, %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double 5.000000e+00, double %4)
%9 = fadd double %8, -2.500000e+00
%10 = fptoui double %9 to i64
ret i64 %10
}
int niggli_get_micro_version(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @niggli_get_micro_version() {
ret i32 2
}

LLVM IR (-O2):
define i32 @niggli_get_micro_version() {
ret i32 2
}
void put_unused_fd(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<put_unused_fd>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_unused_fd>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.put_unused_fd = [14 x i8] c"put_unused_fd\00"
define void @put_unused_fd() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.put_unused_fd, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.put_unused_fd = [14 x i8] c"put_unused_fd\00"
define void @put_unused_fd() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.put_unused_fd, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void yyerror(char *s) { printf("*** Error: %s\n", s); }


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

x86 assembly (clang, -O2):
<yyerror>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"*** Error: %s\0A\00"
define void @yyerror(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("Hello, World!"); }


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

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, World!\00"
define void @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned int f06(unsigned int);
unsigned int f07(unsigned int a) { return f06(f06(a)); }


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

x86 assembly (clang, -O2):
<f07>:
push   %rax
call   1030 <f06@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <f06@plt>

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

LLVM IR (-O2):
define i32 @f07(i32 %0) {
%2 = tail call i32 @f06(i32 %0)
%3 = tail call i32 @f06(i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ _mm_comile_ss(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_load_ss(float *);
int determ_le_float(uint32_t a, uint32_t b) {
  return !!_mm_comile_ss(_mm_load_ss((float *)&a), _mm_load_ss((float *)&b));
}


x86 assembly (clang, -O0):
<determ_le_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
call   1040 <_mm_load_ss@plt>
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <_mm_load_ss@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1030 <_mm_comile_ss@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<determ_le_float>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,0xc(%rsp)
mov    %esi,0x8(%rsp)
lea    0xc(%rsp),%rdi
call   1040 <_mm_load_ss@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rdi
call   1040 <_mm_load_ss@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <_mm_comile_ss@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @determ_le_float(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = bitcast i32* %3 to float*
%6 = call i32 @_mm_load_ss(float* %5)
%7 = bitcast i32* %4 to float*
%8 = call i32 @_mm_load_ss(float* %7)
%9 = call i32 @_mm_comile_ss(i32 %6, i32 %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @determ_le_float(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = bitcast i32* %3 to float*
%6 = call i32 @_mm_load_ss(float* %5)
%7 = bitcast i32* %4 to float*
%8 = call i32 @_mm_load_ss(float* %7)
%9 = call i32 @_mm_comile_ss(i32 %6, i32 %8)
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}
void picolcd_fb_refresh(struct picolcd_data *data) {}


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

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

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

LLVM IR (-O2):
%struct.picolcd_data = type opaque
define void @picolcd_fb_refresh(%struct.picolcd_data* nocapture %0) {
ret void
}
void ourfree(ptr) void *ptr;
{ free(ptr); }


x86 assembly (clang, -O0):
<ourfree>:
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):
<ourfree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @ourfree(i8* nocapture %0) {
tail call void @free(i8* %0)
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ snprintf(char *, int, char *);
int main(void) {
  char *tmp = malloc(128);
  snprintf(tmp, 128, "Hello mem\n");
  puts(tmp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x80,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x80,%esi
lea    0xea3(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x80,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xebb(%rip),%rdx
mov    %rax,%rdi
mov    $0x80,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Hello mem\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @malloc(i32 128)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 @puts(i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Hello mem\0A\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%2 = tail call i32 @snprintf(i8* %1, i32 128, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  const float pi = 3.14;
  float r;
  printf("Enter the Value for the Radius of Cirlce: ");
  scanf("%f", &r);
  printf("Area of the Cirlce is: %.2f \n", (pi * r * r));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xec9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xe9e(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xebb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  0xeb2(%rip),%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xece(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Enter the Value for the Radius of Cirlce: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [30 x i8] c"Area of the Cirlce is: %.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 0x40091EB860000000, float* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%6 = load float, float* %3
%7 = fmul float 0x40091EB860000000, %6
%8 = load float, float* %3
%9 = fmul float %7, %8
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"Enter the Value for the Radius of Cirlce: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [30 x i8] c"Area of the Cirlce is: %.2f \0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fmul float %5, 0x40091EB860000000
%7 = fmul float %5, %6
%8 = fpext float %7 to double
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %8)
ret i32 0
}
char charFix_caseSensitive(char ch) { return ch; }


x86 assembly (clang, -O0):
<charFix_caseSensitive>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @charFix_caseSensitive(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
ret i8 %3
}

LLVM IR (-O2):
define signext i8 @charFix_caseSensitive(i8 returned signext %0) {
ret i8 %0
}
/* Type definitions */
struct pq {
  int dummy;
};
struct packet {
  int dummy;
};

/* Variables and functions */
struct packet *deq_impl(struct pq *, int /*<<< orphan*/);
struct packet *deq(struct pq *pq) {
  return deq_impl(pq, 0);
}


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

x86 assembly (clang, -O2):
<deq>:
xor    %esi,%esi
jmp    1030 <deq_impl@plt>

LLVM IR (-O0):
%struct.packet = type { i32 }
%struct.pq = type { i32 }
define %struct.packet* @deq(%struct.pq* %0) {
%2 = alloca %struct.pq*
store %struct.pq* %0, %struct.pq** %2
%3 = load %struct.pq*, %struct.pq** %2
%4 = call %struct.packet* @deq_impl(%struct.pq* %3, i32 0)
ret %struct.packet* %4
}

LLVM IR (-O2):
%struct.packet = type { i32 }
%struct.pq = type { i32 }
define %struct.packet* @deq(%struct.pq* %0) {
%2 = tail call %struct.packet* @deq_impl(%struct.pq* %0, i32 0)
ret %struct.packet* %2
}
/* Variables and functions */
int /*<<< orphan*/ qsort(char *, int /*<<< orphan*/, int);
int strlen(char *);
void ssort(char a[]) {
  int len;
  if (a != NULL) {
    len = strlen(a);
    qsort(a, 0, len - 1);
  }
}


x86 assembly (clang, -O0):
<ssort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1154 <ssort+0x34>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <qsort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssort>:
test   %rdi,%rdi
je     113c <ssort+0x1c>
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    -0x1(%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1030 <qsort@plt>
ret

LLVM IR (-O0):
define void @ssort(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %3
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 1
%12 = call i32 @qsort(i8* %9, i32 0, i32 %11)
br label %13
13: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @ssort(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, -1
%6 = tail call i32 @qsort(i8* %0, i32 0, i32 %5)
br label %7
7: ; preds = %3, %1
ret void
}
float convert_adc_voltage(float adc_volts) {
  return adc_volts * (1E9 / 94.34E3 / 1000.);
}


x86 assembly (clang, -O0):
<convert_adc_voltage>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_adc_voltage>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @convert_adc_voltage(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double %4, 0x4025332DA47F6E1E
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @convert_adc_voltage(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 0x4025332DA47F6E1E
%4 = fptrunc double %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *null_fn(void *arg) { pthread_exit(NULL); }


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

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

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

LLVM IR (-O2):
define noalias i8* @null_fn(i8* nocapture readnone %0) {
%2 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Type definitions */
struct printf_format {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ print_integer(struct printf_format *, long long);
void print_signed_int(struct printf_format *format, long long int data) {
  print_integer(format, data);
}


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

x86 assembly (clang, -O2):
<print_signed_int>:
jmp    1030 <print_integer@plt>

LLVM IR (-O0):
%struct.printf_format = type { i32 }
define void @print_signed_int(%struct.printf_format* %0, i64 %1) {
%3 = alloca %struct.printf_format*
%4 = alloca i64
store %struct.printf_format* %0, %struct.printf_format** %3
store i64 %1, i64* %4
%5 = load %struct.printf_format*, %struct.printf_format** %3
%6 = load i64, i64* %4
%7 = call i32 @print_integer(%struct.printf_format* %5, i64 %6)
ret void
}

LLVM IR (-O2):
%struct.printf_format = type { i32 }
define void @print_signed_int(%struct.printf_format* %0, i64 %1) {
%3 = tail call i32 @print_integer(%struct.printf_format* %0, i64 %1)
ret void
}
/* Variables and functions */
int get_nprocs();
int sysinfo_ncores() { return get_nprocs(); }


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

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

LLVM IR (-O0):
define i32 @sysinfo_ncores() {
%1 = call i32 (...) @get_nprocs()
ret i32 %1
}

LLVM IR (-O2):
define i32 @sysinfo_ncores() {
%1 = tail call i32 (...) @get_nprocs()
ret i32 %1
}
void fk42ecl(dtheta, dphi, epoch) double *dtheta;
double *dphi;
double epoch;
{
  void fk425e(), fk52ecl();
  fk425e(dtheta, dphi, epoch);
  fk52ecl(dtheta, dphi, epoch);
  return;
}


x86 assembly (clang, -O0):
<fk42ecl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%al
call   1040 <fk425e@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%al
call   1030 <fk52ecl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fk42ecl>:
push   %r14
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x1,%al
call   1040 <fk425e@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  (%rsp),%xmm0
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fk52ecl@plt>

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

LLVM IR (-O2):
define void @fk42ecl(double* %0, double* %1, double %2) {
tail call void (double*, double*, double, ...) bitcast (void (...)* @fk425e to void (double*, double*, double, ...)*)(double* %0, double* %1, double %2)
tail call void (double*, double*, double, ...) bitcast (void (...)* @fk52ecl to void (double*, double*, double, ...)*)(double* %0, double* %1, double %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ drv_GU311_make_text_string(int const, int const,
                                              char const *, int);
void drv_GU311_write(const int row, const int col, const char *data, int len) {
  drv_GU311_make_text_string(row, col, data, len);
}


x86 assembly (clang, -O0):
<drv_GU311_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <drv_GU311_make_text_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_GU311_write>:
jmp    1030 <drv_GU311_make_text_string@plt>

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

LLVM IR (-O2):
define void @drv_GU311_write(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 @drv_GU311_make_text_string(i32 %0, i32 %1, i8* %2, i32 %3)
ret void
}
void d2i_OCSP_CERTID(void) {}


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

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

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

LLVM IR (-O2):
define void @d2i_OCSP_CERTID() {
ret void
}
/* Type definitions */
struct output {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_exec(char **, int /*<<< orphan*/, struct output *);
void forward_ip(struct output *output) {
  char *forw_argv[] = {"bash", "-c", "echo 1 > /proc/sys/net/ipv4/ip_forward",
                       NULL};
  do_exec(forw_argv, 0, output);
}


x86 assembly (clang, -O0):
<forward_ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2cdd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cd7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cd4(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <do_exec@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<forward_ip>:
sub    $0x28,%rsp
mov    %rdi,%rdx
movaps 0x2cf2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2cd6(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <do_exec@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.output = type { i32 }
@.str = [5 x i8] c"bash\00"
@.str.1 = [3 x i8] c"-c\00"
@.str.2 = [39 x i8] c"echo 1 > /proc/sys/net/ipv4/ip_forward\00"
@__const.forward_ip.forw_argv = [4 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i32 0, i32 0), i8* null]
define void @forward_ip(%struct.output* %0) {
%2 = alloca %struct.output*
%3 = alloca [4 x i8*]
store %struct.output* %0, %struct.output** %2
%4 = bitcast [4 x i8*]* %3 to i8*
%5 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%6 = load %struct.output*, %struct.output** %2
%7 = call i32 @do_exec(i8** %5, i32 0, %struct.output* %6)
ret void
}

LLVM IR (-O2):
%struct.output = type { i32 }
@.str = [5 x i8] c"bash\00"
@.str.1 = [3 x i8] c"-c\00"
@.str.2 = [39 x i8] c"echo 1 > /proc/sys/net/ipv4/ip_forward\00"
@__const.forward_ip.forw_argv = [4 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i32 0, i32 0), i8* null]
define void @forward_ip(%struct.output* %0) {
%2 = alloca [4 x i8*]
%3 = bitcast [4 x i8*]* %2 to i8*
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%5 = call i32 @do_exec(i8** %4, i32 0, %struct.output* %0)
ret void
}
int GraphResult() { return 0; }


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

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

LLVM IR (-O0):
define i32 @GraphResult() {
ret i32 0
}

LLVM IR (-O2):
define i32 @GraphResult() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ writeByte(int, int);
void digitalWriteBytePiFace(int value) { writeByte(0x12, value); }


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

x86 assembly (clang, -O2):
<digitalWriteBytePiFace>:
mov    %edi,%esi
mov    $0x12,%edi
jmp    1030 <writeByte@plt>

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

LLVM IR (-O2):
define void @digitalWriteBytePiFace(i32 %0) {
%2 = tail call i32 @writeByte(i32 18, i32 %0)
ret void
}