xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char const *);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
char *my_alloc(int size, int lnum, const char *fe) {
  char *ptr;
  ptr = (char *)malloc(size);
  if (ptr == 0) {
    fprintf(stderr, "Memory allocation bombed on line %d in %s\n", lnum, fe);
  }
  return (ptr);
}


x86 assembly (clang, -O0):
<my_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1165 <my_alloc+0x45>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xea0(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_alloc>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1150 <my_alloc+0x30>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
mov    %ebp,%edx
mov    %r14,%rcx
call   1030 <fprintf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"Memory allocation bombed on line %d in %s\0A\00"
define i8* @my_alloc(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i32, i32* %4
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = load i32, i32* %5
%16 = load i8*, i8** %6
%17 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %15, i8* %16)
br label %18
18: ; preds = %13, %3
%19 = load i8*, i8** %7
ret i8* %19
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"Memory allocation bombed on line %d in %s\0A\00"
define i8* @my_alloc(i32 %0, i32 %1, i8* %2) {
%4 = tail call i64 @malloc(i32 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2)
br label %9
9: ; preds = %6, %3
%10 = inttoptr i64 %4 to i8*
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ init_daemon();
int /*<<< orphan*/ towrite();
void Linux_Start() {
  init_daemon();
  towrite();
  return;
}


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

x86 assembly (clang, -O2):
<Linux_Start>:
push   %rax
xor    %eax,%eax
call   1030 <init_daemon@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <towrite@plt>

LLVM IR (-O0):
define void @Linux_Start() {
%1 = call i32 (...) @init_daemon()
%2 = call i32 (...) @towrite()
ret void
}

LLVM IR (-O2):
define void @Linux_Start() {
%1 = tail call i32 (...) @init_daemon()
%2 = tail call i32 (...) @towrite()
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ _color_set(int, int);
void vt_color_fg_set(uint8_t color) {
  if (color > 7) {
    return;
  }
  _color_set(30, color);
}


x86 assembly (clang, -O0):
<vt_color_fg_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x7,-0x4(%rbp)
jle    112a <vt_color_fg_set+0x1a>
jmp    1137 <vt_color_fg_set+0x27>
mov    -0x4(%rbp),%esi
mov    $0x1e,%edi
call   1030 <_color_set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vt_color_fg_set>:
cmp    $0x7,%edi
jle    1116 <vt_color_fg_set+0x6>
ret
mov    %edi,%esi
mov    $0x1e,%edi
jmp    1030 <_color_set@plt>

LLVM IR (-O0):
define void @vt_color_fg_set(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 7
br i1 %4, label %5, label %6
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @_color_set(i32 30, i32 %7)
br label %9
9: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @vt_color_fg_set(i32 %0) {
%2 = icmp sgt i32 %0, 7
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @_color_set(i32 30, i32 %0)
br label %5
5: ; preds = %1, %3
ret void
}
unsigned long setBit_fun_ulong(unsigned long x, unsigned i) {
  return x | 1 << i;
}


x86 assembly (clang, -O0):
<setBit_fun_ulong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setBit_fun_ulong>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @setBit_fun_ulong(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = shl i32 1, %6
%8 = sext i32 %7 to i64
%9 = or i64 %5, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @setBit_fun_ulong(i64 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = sext i32 %3 to i64
%5 = or i64 %4, %0
ret i64 %5
}
__attribute__((weak)) int _lseek(int file, int ptr, int dir) {
  do {
    (void)(file);
  } while (0);
  do {
    (void)(ptr);
  } while (0);
  do {
    (void)(dir);
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<_lseek>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
jmp    1112 <_lseek+0x12>
jmp    1117 <_lseek+0x17>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define weak i32 @_lseek(i32 %0, i32 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ imv_source_load_next_frame(void *);
void *next_frame_thread(void *src) {
  imv_source_load_next_frame(src);
  return NULL;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @next_frame_thread(i8* %0) {
%2 = tail call i32 @imv_source_load_next_frame(i8* %0)
ret i8* null
}
unsigned int rotl(unsigned int value, int shift) {
  return (value << shift) | (value >> (sizeof(value) * 8 - shift));
}


x86 assembly (clang, -O0):
<rotl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
movslq -0x8(%rbp),%rsi
mov    $0x20,%ecx
sub    %rsi,%rcx
shr    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotl>:
mov    %esi,%ecx
mov    %edi,%eax
rol    %cl,%eax
ret

LLVM IR (-O0):
define i32 @rotl(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 = shl i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = sub i64 32, %10
%12 = trunc i64 %11 to i32
%13 = lshr i32 %8, %12
%14 = or i32 %7, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @rotl(i32 %0, i32 %1) {
%3 = shl i32 %0, %1
%4 = sub i32 32, %1
%5 = lshr i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_secp256k1_square(uintptr_t, uintptr_t);
void fiat_secp256k1_square(uint32_t out1[8], const uint32_t arg1[8]) {
  internal_fiat_secp256k1_square((uintptr_t)out1, (uintptr_t)arg1);
}


x86 assembly (clang, -O0):
<fiat_secp256k1_square>:
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 <internal_fiat_secp256k1_square@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiat_secp256k1_square>:
jmp    1030 <internal_fiat_secp256k1_square@plt>

LLVM IR (-O0):
define void @fiat_secp256k1_square(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 = ptrtoint i32* %5 to i64
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = call i32 @internal_fiat_secp256k1_square(i64 %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @fiat_secp256k1_square(i32* %0, i32* %1) {
%3 = ptrtoint i32* %0 to i64
%4 = ptrtoint i32* %1 to i64
%5 = tail call i32 @internal_fiat_secp256k1_square(i64 %3, i64 %4)
ret void
}
/* Variables and functions */
int dp(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  printf("%d", dp(n));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edi
call   1050 <dp@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @dp(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
double ceil(double);
double fig_drops_min(double rate, double drop_factor) {
  return ceil((rate * drop_factor) / 60);
}


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

x86 assembly (clang, -O2):
<fig_drops_min>:
mulsd  %xmm1,%xmm0
divsd  0xee4(%rip),%xmm0
jmp    1030 <ceil@plt>

LLVM IR (-O0):
define double @fig_drops_min(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
%8 = fdiv double %7, 6.000000e+01
%9 = call double @llvm.ceil.f64(double %8)
ret double %9
}

LLVM IR (-O2):
define double @fig_drops_min(double %0, double %1) {
%3 = fmul double %0, %1
%4 = fdiv double %3, 6.000000e+01
%5 = tail call double @llvm.ceil.f64(double %4)
ret double %5
}
int bibl_illegalinmode(int mode) {
  if (mode < (100) || mode > ((100) + 7))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<bibl_illegalinmode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jl     111b <bibl_illegalinmode+0x1b>
cmpl   $0x6b,-0x8(%rbp)
jle    1127 <bibl_illegalinmode+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <bibl_illegalinmode+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bibl_illegalinmode>:
add    $0xffffff94,%edi
xor    %eax,%eax
cmp    $0xfffffff8,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @bibl_illegalinmode(i32 %0) {
%2 = add i32 %0, -108
%3 = icmp ult i32 %2, -8
%4 = zext i1 %3 to i32
ret i32 %4
}
float evaluation_max(float new_val, float old_val, int o) {
  return new_val > old_val ? new_val : old_val;
}


x86 assembly (clang, -O0):
<evaluation_max>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    112f <evaluation_max+0x2f>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1139 <evaluation_max+0x39>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluation_max>:
maxss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @evaluation_max(float %0, float %1, i32 %2) {
%4 = fcmp ogt float %0, %1
%5 = select i1 %4, float %0, float %1
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ya_free(void **ptr) {
  free(*ptr);
  *ptr = NULL;
}


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

x86 assembly (clang, -O2):
<ya_free>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ya_free(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @free(i8* %2)
store i8* null, i8** %0
ret void
}
void mt_dcm_topck_on(void) {}


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

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

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

LLVM IR (-O2):
define void @mt_dcm_topck_on() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int, int);
int main() {
  foo(1, 1);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 1, i32 1)
ret i32 0
}
/* Variables and functions */
int close(int);
int serialport_close(int fd) { return close(fd); }


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

x86 assembly (clang, -O2):
<serialport_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @serialport_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
unsigned char _uchar(unsigned char x) { return x; }


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

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

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

LLVM IR (-O2):
define zeroext i8 @_uchar(i8 returned zeroext %0) {
ret i8 %0
}
void gtk_text_iter_forward_visible_cursor_position() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_iter_forward_visible_cursor_position() {
ret void
}
/* Variables and functions */
int isalnum(int);
__attribute__((regparm(0))) int(_win_isalnum)(int c) { return isalnum(c); }


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

x86 assembly (clang, -O2):
<_win_isalnum>:
jmp    1030 <isalnum@plt>

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

LLVM IR (-O2):
define i32 @_win_isalnum(i32 %0) {
%2 = tail call i32 @isalnum(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef scalar_t__ time_t;

/* Variables and functions */
char *asctime(int /*<<< orphan*/);
int /*<<< orphan*/ localtime(scalar_t__ *);
int /*<<< orphan*/ printf(char *, char *, long long, char *);
scalar_t__ time(int /*<<< orphan*/ *);
void announce(char *what) {
  time_t result = time(NULL);
  printf("%s : %lld : %s\n", asctime(localtime(&result)), (long long int)result,
         what);
}


x86 assembly (clang, -O0):
<announce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
mov    %rax,%rsi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe85(%rip),%rdi
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<announce>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
mov    0x8(%rsp),%rdx
lea    0xe8f(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rcx
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%s : %lld : %s\0A\00"
define void @announce(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = call i64 @time(i32* null)
store i64 %4, i64* %3
%5 = call i32 @localtime(i64* %3)
%6 = call i8* @asctime(i32 %5)
%7 = load i64, i64* %3
%8 = load i8*, i8** %2
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %6, i64 %7, i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s : %lld : %s\0A\00"
define void @announce(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = tail call i64 @time(i32* null)
store i64 %4, i64* %2
%5 = call i32 @localtime(i64* %2)
%6 = call i8* @asctime(i32 %5)
%7 = load i64, i64* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %6, i64 %7, i8* %0)
ret void
}
void u1_csort_swap(int *a, int *b) {
  int swap = *a;
  *a = *b;
  *b = swap;
}


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

x86 assembly (clang, -O2):
<u1_csort_swap>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @u1_csort_swap(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** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @u1_csort_swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
char *strchr(sp, c)
register char *sp, c;
{
  do {
    if (*sp == c)
      return (sp);
  } while (*sp++);
  return (0);
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    112e <strchr+0x2e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <strchr+0x53>
jmp    1133 <strchr+0x33>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
jne    110e <strchr+0xe>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rax),%ecx
cmp    %sil,%cl
je     1122 <strchr+0x22>
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %0, %2 ], [ %8, %7 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, %1
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = icmp eq i8 %5, 0
br i1 %9, label %10, label %3
10: ; preds = %7, %3
%11 = phi i8* [ %4, %3 ], [ null, %7 ]
ret i8* %11
}
void var_validate(void) {}


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

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

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

LLVM IR (-O2):
define void @var_validate() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M577_f(char *s) {
  debug("M577_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M577_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M577_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M577_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M577_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M577_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M577_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
double check5(double x, double y) { return __builtin_copysign(-x, -y); }


x86 assembly (clang, -O0):
<check5>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movaps 0xeb3(%rip),%xmm2
pand   %xmm2,%xmm1
movaps 0xeb8(%rip),%xmm2
pand   %xmm2,%xmm0
por    %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<check5>:
xorps  0xef9(%rip),%xmm1
movaps 0xf02(%rip),%xmm2
andps  %xmm2,%xmm0
andnps %xmm1,%xmm2
orps   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @check5(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fneg double %5
%7 = load double, double* %4
%8 = fneg double %7
%9 = call double @llvm.copysign.f64(double %6, double %8)
ret double %9
}

LLVM IR (-O2):
define double @check5(double %0, double %1) {
%3 = fneg double %1
%4 = tail call double @llvm.copysign.f64(double %0, double %3)
ret double %4
}
int get_state(int c, int current_state) {
  if (current_state == 0) {
    if (c == 27) {
      return 1;
    } else {
      return current_state;
    }
  } else if (current_state == 1) {
    if (c == 27) {
      return 0;
    } else if (c == 'q') {
      return -1;
    } else {
      return current_state;
    }
  } else {
    return current_state;
  }
}


x86 assembly (clang, -O0):
<get_state>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1135 <get_state+0x35>
cmpl   $0x1b,-0x8(%rbp)
jne    112a <get_state+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    117c <get_state+0x7c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117c <get_state+0x7c>
cmpl   $0x1,-0xc(%rbp)
jne    1176 <get_state+0x76>
cmpl   $0x1b,-0x8(%rbp)
jne    1155 <get_state+0x55>
movl   $0x0,-0x4(%rbp)
jmp    117c <get_state+0x7c>
cmpl   $0x71,-0x8(%rbp)
jne    116b <get_state+0x6b>
movl   $0xffffffff,-0x4(%rbp)
jmp    117c <get_state+0x7c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117c <get_state+0x7c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_state>:
cmp    $0x1,%esi
je     1114 <get_state+0x14>
mov    %esi,%eax
test   %esi,%esi
jne    112a <get_state+0x2a>
xor    %eax,%eax
cmp    $0x1b,%edi
sete   %al
ret
xor    %eax,%eax
cmp    $0x71,%edi
setne  %al
lea    (%rax,%rax,1),%ecx
add    $0xffffffff,%ecx
xor    %eax,%eax
cmp    $0x1b,%edi
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @get_state(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* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 27
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 1, i32* %3
br label %29
12: ; preds = %8
%13 = load i32, i32* %5
store i32 %13, i32* %3
br label %29
14: ; preds = %2
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 27
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 0, i32* %3
br label %29
21: ; preds = %17
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 113
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 -1, i32* %3
br label %29
25: ; preds = %21
%26 = load i32, i32* %5
store i32 %26, i32* %3
br label %29
27: ; preds = %14
%28 = load i32, i32* %5
store i32 %28, i32* %3
br label %29
29: ; preds = %27, %25, %24, %20, %12, %11
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @get_state(i32 %0, i32 %1) {
switch i32 %1, label %11 [
i32 0, label %3
i32 1, label %6
]
3: ; preds = %2
%4 = icmp eq i32 %0, 27
%5 = zext i1 %4 to i32
br label %11
6: ; preds = %2
%7 = icmp eq i32 %0, 113
%8 = select i1 %7, i32 -1, i32 1
%9 = icmp eq i32 %0, 27
%10 = select i1 %9, i32 0, i32 %8
br label %11
11: ; preds = %6, %2, %3
%12 = phi i32 [ %5, %3 ], [ %1, %2 ], [ %10, %6 ]
ret i32 %12
}
double nearbyint(double x) {}


x86 assembly (clang, -O0):
<nearbyint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @nearbyint(double %0) {
ret double undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ putc(unsigned int, int /*<<< orphan*/ *);
void write_int16(FILE *out, unsigned int i) {
  putc((i >> 8) & 255, out);
  putc(i & 255, out);
}


x86 assembly (clang, -O0):
<write_int16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
shr    $0x8,%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0xc(%rbp),%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_int16>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movzbl %bh,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
movzbl %bl,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putc@plt>

LLVM IR (-O0):
define void @write_int16(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = lshr i32 %5, 8
%7 = and i32 %6, 255
%8 = load i32*, i32** %3
%9 = call i32 @putc(i32 %7, i32* %8)
%10 = load i32, i32* %4
%11 = and i32 %10, 255
%12 = load i32*, i32** %3
%13 = call i32 @putc(i32 %11, i32* %12)
ret void
}

LLVM IR (-O2):
define void @write_int16(i32* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 8
%4 = and i32 %3, 255
%5 = tail call i32 @putc(i32 %4, i32* %0)
%6 = and i32 %1, 255
%7 = tail call i32 @putc(i32 %6, i32* %0)
ret void
}
/* Variables and functions */
double MBtoMMHG(double);
double HPAtoMMHG(double HPA) {
  double mmhg = MBtoMMHG(HPA);
  return mmhg;
}


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

x86 assembly (clang, -O2):
<HPAtoMMHG>:
jmp    1030 <MBtoMMHG@plt>

LLVM IR (-O0):
define double @HPAtoMMHG(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @MBtoMMHG(double %4)
store double %5, double* %3
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
define double @HPAtoMMHG(double %0) {
%2 = tail call double @MBtoMMHG(double %0)
ret double %2
}
int compile_errors(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @compile_errors() {
ret i32 0
}
int main() {
  int var = 5;
  printf("Value: %d\n", var);
  printf("Address: %d", &var);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"Value: %d\0A\00"
@.str.1 = [12 x i8] c"Address: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 5)
%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
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char text[] = "hello world";
  printf("%s\n", text);
  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)
lea    -0x10(%rbp),%rsi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x6f77206f6c6c6568,%rax
20 77 6f
mov    %rax,0x8(%rsp)
movl   $0x646c72,0x10(%rsp)
lea    0xeda(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.text = [12 x i8] c"hello world\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i8]
store i32 0, i32* %1
%3 = bitcast [12 x i8]* %2 to i8*
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.text = [12 x i8] c"hello world\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ merge_sort_divide(int *, int /*<<< orphan*/, int);
void merge_sort(register int a[], register int length) {
  if (length < 2)
    return;
  merge_sort_divide(a, 0, length - 1);
}


x86 assembly (clang, -O0):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    112e <merge_sort+0x1e>
jmp    113f <merge_sort+0x2f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <merge_sort_divide@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort>:
cmp    $0x2,%esi
jge    1116 <merge_sort+0x6>
ret
mov    %esi,%edx
add    $0xffffffff,%edx
xor    %esi,%esi
jmp    1030 <merge_sort_divide@plt>

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

LLVM IR (-O2):
define void @merge_sort(i32* %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = add nsw i32 %1, -1
%6 = tail call i32 @merge_sort_divide(i32* %0, i32 0, i32 %5)
br label %7
7: ; preds = %2, %4
ret void
}
/* Variables and functions */
int d11(int);
int d12(int a) { return d11(d11(a)); }


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

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

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

LLVM IR (-O2):
define i32 @d12(i32 %0) {
%2 = tail call i32 @d11(i32 %0)
%3 = tail call i32 @d11(i32 %2)
ret i32 %3
}
/* Variables and functions */
int floor_div(int, int);
int floor_mod(int dd, int dr) { return (dd - dr * floor_div(dd, dr)); }


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

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

LLVM IR (-O0):
define i32 @floor_mod(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 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @floor_div(i32 %7, i32 %8)
%10 = mul nsw i32 %6, %9
%11 = sub nsw i32 %5, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @floor_mod(i32 %0, i32 %1) {
%3 = tail call i32 @floor_div(i32 %0, i32 %1)
%4 = mul nsw i32 %3, %1
%5 = sub nsw i32 %0, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void print_flag() { system("cat flag.txt"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"cat flag.txt\00"
define void @print_flag() {
%1 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"cat flag.txt\00"
define void @print_flag() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_more_strings();
int /*<<< orphan*/ test_some_strings();
int main() {
  test_some_strings();
  test_more_strings();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_some_strings()
%2 = tail call i32 (...) @test_more_strings()
ret i32 0
}
void bfqg_stats_set_start_empty_time(struct bfq_group *bfqg) {}


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

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

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

LLVM IR (-O2):
%struct.bfq_group = type opaque
define void @bfqg_stats_set_start_empty_time(%struct.bfq_group* nocapture %0) {
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char ch[10];
  int number;
  printf("Please input the number:\n");
  gets(ch);
  number = atoi(ch);
  printf("After transform:\n%d", number);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1060 <atoi@plt>
lea    0xe93(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please input the number:\0A\00"
@.str.1 = [20 x i8] c"After transform:\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i32 @atoi(i8* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"After transform:\0A%d\00"
@str = [25 x i8] c"Please input the number:\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @atoi(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/);
int bar(void) {
  free(0);
  return 40;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <free@plt>
mov    $0x28,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
xor    %edi,%edi
call   1030 <free@plt>
mov    $0x28,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bar() {
%1 = call i32 @free(i32 0)
ret i32 40
}

LLVM IR (-O2):
define i32 @bar() {
%1 = tail call i32 @free(i32 0)
ret i32 40
}
void tv_i(int c) { return; }


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

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

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

LLVM IR (-O2):
define void @tv_i(i32 %0) {
ret void
}
void gtk_widget_get_settings() {}


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

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

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

LLVM IR (-O2):
define void @gtk_widget_get_settings() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _putchar(char);
void puts2(char *str) {
  int i;
  for (i = 0; str[i]; i++) {
    if (i % 2 == 0)
      _putchar(str[i]);
  }
  _putchar('\n');
}


x86 assembly (clang, -O0):
<puts2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     116d <puts2+0x5d>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115a <puts2+0x4a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <_putchar@plt>
jmp    115f <puts2+0x4f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <puts2+0x13>
mov    $0xa,%edi
call   1030 <_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts2>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     114d <puts2+0x3d>
mov    %rdi,%r14
xor    %ebx,%ebx
jmp    113e <puts2+0x2e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl 0x1(%r14,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
je     114d <puts2+0x3d>
test   $0x1,%bl
jne    1130 <puts2+0x20>
movsbl %al,%edi
call   1030 <_putchar@plt>
jmp    1130 <puts2+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <_putchar@plt>

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

LLVM IR (-O2):
define void @puts2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %11
%5 = phi i64 [ %12, %11 ], [ 0, %1 ]
%6 = phi i8 [ %14, %11 ], [ %2, %1 ]
%7 = and i64 %5, 1
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @_putchar(i8 signext %6)
br label %11
11: ; preds = %4, %9
%12 = add nuw i64 %5, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %11, %1
%17 = tail call i32 @_putchar(i8 signext 10)
ret void
}