xunge/DecIR huggingface dataset:
int pcjoy_deadzone(signed int axis) {
  return (((axis > 3201) || (axis < -3201)) ||
          ((axis < 3200) && (axis > -3200)));
}


x86 assembly (clang, -O0):
<pcjoy_deadzone>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0xc81,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jg     1150 <pcjoy_deadzone+0x50>
mov    $0x1,%al
cmpl   $0xfffff37f,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1150 <pcjoy_deadzone+0x50>
xor    %eax,%eax
cmpl   $0xc80,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jge    114a <pcjoy_deadzone+0x4a>
cmpl   $0xfffff380,-0x4(%rbp)
setg   %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcjoy_deadzone>:
lea    -0xc82(%rdi),%eax
cmp    $0xffffe6fd,%eax
setb   %al
add    $0xc7f,%edi
cmp    $0x18ff,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @pcjoy_deadzone(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 3201
br i1 %4, label %16, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, -3201
br i1 %7, label %16, label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 3200
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, -3200
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ false, %8 ], [ %13, %11 ]
br label %16
16: ; preds = %14, %5, %1
%17 = phi i1 [ true, %5 ], [ true, %1 ], [ %15, %14 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @pcjoy_deadzone(i32 %0) {
%2 = add i32 %0, -3202
%3 = icmp ult i32 %2, -6403
%4 = add i32 %0, 3199
%5 = icmp ult i32 %4, 6399
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void end_rtf_page() { printf("\\page\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"\\page\00"
define void @end_rtf_page() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ start();
int main() { start(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @start()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @start()
ret i32 0
}
int test_imm_D2int16_mem(short *val) {
  return ((*val) & (0xD2 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D2int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xd2,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_D2int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 210
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int cpsw_hal_common_random();
int cpsw_hal_common_random_range(int min, int max) {
  int tmp;
  tmp = cpsw_hal_common_random();
  tmp %= ((max - min) + 1);
  tmp += min;
  return (tmp);
}


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

x86 assembly (clang, -O2):
<cpsw_hal_common_random_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <cpsw_hal_common_random@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cpsw_hal_common_random_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 (...) @cpsw_hal_common_random()
store i32 %6, i32* %5
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
%10 = add nsw i32 %9, 1
%11 = load i32, i32* %5
%12 = srem i32 %11, %10
store i32 %12, i32* %5
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = add nsw i32 %14, %13
store i32 %15, i32* %5
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
define i32 @cpsw_hal_common_random_range(i32 %0, i32 %1) {
%3 = tail call i32 (...) @cpsw_hal_common_random()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Variables and functions */
scalar_t__ fork();
int pfork(int x) {
  int j;
  for (j = 1; j < x; j++) {
    if (fork() == 0) {
      return j;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<pfork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115d <pfork+0x4d>
mov    $0x0,%al
call   1030 <fork@plt>
cmp    $0x0,%rax
jne    114a <pfork+0x3a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1164 <pfork+0x54>
jmp    114f <pfork+0x3f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <pfork+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfork>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
cmp    $0x2,%edi
jl     1145 <pfork+0x35>
mov    %edi,%ebp
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <fork@plt>
test   %rax,%rax
je     1145 <pfork+0x35>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1130 <pfork+0x20>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @pfork(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %10
3: ; preds = %1, %7
%4 = phi i32 [ %8, %7 ], [ 1, %1 ]
%5 = tail call i64 (...) @fork()
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %3, %7, %1
%11 = phi i32 [ 0, %1 ], [ 0, %7 ], [ %4, %3 ]
ret i32 %11
}
/* Type definitions */
struct rtattr {
  int dummy;
};
struct qdisc_util {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int hpfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) {
  return -1;
}


x86 assembly (clang, -O0):
<hpfq_print_opt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.qdisc_util = type { i32 }
%struct.rtattr = type { i32 }
define i32 @hpfq_print_opt(%struct.qdisc_util* %0, i32* %1, %struct.rtattr* %2) {
%4 = alloca %struct.qdisc_util*
%5 = alloca i32*
%6 = alloca %struct.rtattr*
store %struct.qdisc_util* %0, %struct.qdisc_util** %4
store i32* %1, i32** %5
store %struct.rtattr* %2, %struct.rtattr** %6
ret i32 -1
}

LLVM IR (-O2):
%struct.qdisc_util = type { i32 }
%struct.rtattr = type { i32 }
define i32 @hpfq_print_opt(%struct.qdisc_util* nocapture readnone %0, i32* nocapture readnone %1, %struct.rtattr* nocapture readnone %2) {
ret i32 -1
}
__uint128_t __attribute__((no)) ushift_53_ll(unsigned long long data) {
  return (__uint128_t)data << 53;
}


x86 assembly (clang, -O0):
<ushift_53_ll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    %rcx,%rax
shl    $0x35,%rax
shr    $0xb,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ushift_53_ll>:
mov    %rdi,%rax
shl    $0x35,%rax
shr    $0xb,%rdi
mov    %rdi,%rdx
ret

LLVM IR (-O0):
define { i64, i64 } @ushift_53_ll(i64 %0) {
%2 = alloca i128
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = zext i64 %4 to i128
%6 = shl i128 %5, 53
store i128 %6, i128* %2
%7 = bitcast i128* %2 to { i64, i64 }*
%8 = load { i64, i64 }, { i64, i64 }* %7
ret { i64, i64 } %8
}

LLVM IR (-O2):
define { i64, i64 } @ushift_53_ll(i64 %0) {
%2 = shl i64 %0, 53
%3 = lshr i64 %0, 11
%4 = insertvalue { i64, i64 } poison, i64 %2, 0
%5 = insertvalue { i64, i64 } %4, i64 %3, 1
ret { i64, i64 } %5
}
int abs(int n) { return ((n >= 0) ? n : -n); }


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

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
void *dlopen(char const *, int /*<<< orphan*/);
void *pixie_load_library(const char *library_name) {
  return dlopen(library_name, 0);
}


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

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

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

LLVM IR (-O2):
define i8* @pixie_load_library(i8* %0) {
%2 = tail call i8* @dlopen(i8* %0, i32 0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void clearDrivers(char **d) {
  int index = 0;
  while (d[index]) {
    free(d[index]);
    d[index++] = 0;
  }
}


x86 assembly (clang, -O0):
<clearDrivers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1166 <clearDrivers+0x56>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    1123 <clearDrivers+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearDrivers>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1139 <clearDrivers+0x29>
add    $0x8,%rbx
call   1030 <free@plt>
movq   $0x0,-0x8(%rbx)
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1120 <clearDrivers+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @clearDrivers(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %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, null
br i1 %10, label %11, label %23
11: ; preds = %4
%12 = load i8**, i8*** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @free(i8* %16)
%18 = load i8**, i8*** %2
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds i8*, i8** %18, i64 %21
store i8* null, i8** %22
br label %4
23: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @clearDrivers(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8* [ %11, %4 ], [ %2, %1 ]
%7 = phi i8** [ %10, %4 ], [ %0, %1 ]
%8 = tail call i32 @free(i8* %6)
%9 = add nuw nsw i64 %5, 1
store i8* null, i8** %7
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void a52e_set_substreamid(uint8_t *p_a52, uint8_t i_substreamid) {
  p_a52[2] &= ~0x38;
  p_a52[2] |= (i_substreamid & 0x7) << 3;
}


x86 assembly (clang, -O0):
<a52e_set_substreamid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
and    $0xffffffc7,%ecx
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
shl    $0x3,%ecx
mov    -0x8(%rbp),%rax
or     0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<a52e_set_substreamid>:
mov    0x8(%rdi),%eax
and    $0xffffffc7,%eax
and    $0x7,%esi
lea    (%rax,%rsi,8),%eax
mov    %eax,0x8(%rdi)
ret

LLVM IR (-O0):
define void @a52e_set_substreamid(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 = getelementptr inbounds i32, i32* %5, i64 2
%7 = load i32, i32* %6
%8 = and i32 %7, -57
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = and i32 %9, 7
%11 = shl i32 %10, 3
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = or i32 %14, %11
store i32 %15, i32* %13
ret void
}

LLVM IR (-O2):
define void @a52e_set_substreamid(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 2
%4 = load i32, i32* %3
%5 = and i32 %4, -57
%6 = shl i32 %1, 3
%7 = and i32 %6, 56
%8 = or i32 %5, %7
store i32 %8, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ noecho();
void opencurses(void) {
  initscr();
  cbreak();
  noecho();
}


x86 assembly (clang, -O0):
<opencurses>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <initscr@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    $0x0,%al
call   1050 <noecho@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<opencurses>:
push   %rax
xor    %eax,%eax
call   1040 <initscr@plt>
xor    %eax,%eax
call   1030 <cbreak@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <noecho@plt>

LLVM IR (-O0):
define void @opencurses() {
%1 = call i32 (...) @initscr()
%2 = call i32 (...) @cbreak()
%3 = call i32 (...) @noecho()
ret void
}

LLVM IR (-O2):
define void @opencurses() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @cbreak()
%3 = tail call i32 (...) @noecho()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ err(int /*<<< orphan*/, char *, size_t const);
void *realloc(void *, size_t const);
__attribute__((alloc_size(2))) void *xrealloc(void *ptr, const size_t size) {
  void *ret = realloc(ptr, size);
  if (!ret && size)
    err(EXIT_FAILURE, "cannot allocate %zu bytes", size);
  return ret;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1170 <xrealloc+0x50>
cmpq   $0x0,-0x10(%rbp)
je     1170 <xrealloc+0x50>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe95(%rip),%rsi
call   1030 <err@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1040 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1151 <xrealloc+0x31>
test   %r14,%r14
jne    1151 <xrealloc+0x31>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdx
call   1030 <err@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [26 x i8] c"cannot allocate %zu bytes\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %18, label %11
11: ; preds = %2
%12 = load i64, i64* %4
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* @EXIT_FAILURE
%16 = load i64, i64* %4
%17 = call i32 @err(i32 %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %16)
br label %18
18: ; preds = %14, %11, %2
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [26 x i8] c"cannot allocate %zu bytes\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i64 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @err(i32 %8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %10
10: ; preds = %7, %2
ret i8* %3
}
float ffmodf(float a, float b) {
  while (a >= b)
    a -= b;
  return a;
}


x86 assembly (clang, -O0):
<ffmodf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1135 <ffmodf+0x35>
movss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    110e <ffmodf+0xe>
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffmodf>:
ucomiss %xmm1,%xmm0
jb     1119 <ffmodf+0x19>
cs nopw 0x0(%rax,%rax,1)
nop
subss  %xmm1,%xmm0
ucomiss %xmm1,%xmm0
jae    1110 <ffmodf+0x10>
ret

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

LLVM IR (-O2):
define float @ffmodf(float %0, float %1) {
%3 = fcmp ult float %0, %1
br i1 %3, label %8, label %4
4: ; preds = %2, %4
%5 = phi float [ %6, %4 ], [ %0, %2 ]
%6 = fsub float %5, %1
%7 = fcmp ult float %6, %1
br i1 %7, label %8, label %4
8: ; preds = %4, %2
%9 = phi float [ %0, %2 ], [ %6, %4 ]
ret float %9
}
/* Variables and functions */
float powf(float, float);
float linear(float v) {
  float K0 = 0.04045f;
  float a = 0.055f;
  float phi = 12.92f;
  float gamma = 2.4f;
  return v <= K0 ? v / phi : powf((v + a) / (1.0f + a), gamma);
}


x86 assembly (clang, -O0):
<linear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xee7(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xed6(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xec5(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xeb4(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     1178 <linear+0x68>
movss  -0x4(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    11a2 <linear+0x92>
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  0xe86(%rip),%xmm1
addss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
call   1030 <powf@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linear>:
movss  0xee8(%rip),%xmm1
ucomiss %xmm0,%xmm1
jae    113a <linear+0x2a>
addss  0xee3(%rip),%xmm0
divss  0xedf(%rip),%xmm0
movss  0xedb(%rip),%xmm1
jmp    1030 <powf@plt>
divss  0xec2(%rip),%xmm0
ret

LLVM IR (-O0):
define float @linear(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %2
store float 0x3FA4B5DCC0000000, float* %3
store float 0x3FAC28F5C0000000, float* %4
store float 0x4029D70A40000000, float* %5
store float 0x4003333340000000, float* %6
%7 = load float, float* %2
%8 = load float, float* %3
%9 = fcmp ole float %7, %8
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load float, float* %2
%12 = load float, float* %5
%13 = fdiv float %11, %12
br label %23
14: ; preds = %1
%15 = load float, float* %2
%16 = load float, float* %4
%17 = fadd float %15, %16
%18 = load float, float* %4
%19 = fadd float 1.000000e+00, %18
%20 = fdiv float %17, %19
%21 = load float, float* %6
%22 = call float @powf(float %20, float %21)
br label %23
23: ; preds = %14, %10
%24 = phi float [ %13, %10 ], [ %22, %14 ]
ret float %24
}

LLVM IR (-O2):
define float @linear(float %0) {
%2 = fcmp ugt float %0, 0x3FA4B5DCC0000000
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = fdiv float %0, 0x4029D70A40000000
br label %9
5: ; preds = %1
%6 = fadd float %0, 0x3FAC28F5C0000000
%7 = fdiv float %6, 0x3FF0E147A0000000
%8 = tail call float @powf(float %7, float 0x4003333340000000)
br label %9
9: ; preds = %5, %3
%10 = phi float [ %4, %3 ], [ %8, %5 ]
ret float %10
}
void handle_CHLD(int sig) {}


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

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

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

LLVM IR (-O2):
define void @handle_CHLD(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int32_t onStart(void *context) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @onStart(i8* nocapture readnone %0) {
ret i32 0
}
char _tolower(const char c) { return c | 0x20; }


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

x86 assembly (clang, -O2):
<_tolower>:
mov    %edi,%eax
or     $0x20,%al
ret

LLVM IR (-O0):
define signext i8 @_tolower(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = or i32 %4, 32
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
define signext i8 @_tolower(i8 signext %0) {
%2 = or i8 %0, 32
ret i8 %2
}
int utf8_code_encoding_size(unsigned int code) {
  switch (code) {
  case 0 ... 0x7F:
    return 1;
  case 0x80 ... 0x7FF:
    return 2;
  case 0x800 ... 0xFFFF:
    return 3;
  case 0x10000 ... 0x1FFFF:
    return 4;
  }
  return 0;
}


x86 assembly (clang, -O0):
<utf8_code_encoding_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1186 <utf8_code_encoding_size+0x86>
movl   $0x1,-0x4(%rbp)
jmp    11a5 <utf8_code_encoding_size+0xa5>
mov    -0xc(%rbp),%eax
sub    $0x0,%eax
cmp    $0x7f,%eax
jbe    1112 <utf8_code_encoding_size+0x12>
jmp    119e <utf8_code_encoding_size+0x9e>
movl   $0x2,-0x4(%rbp)
jmp    11a5 <utf8_code_encoding_size+0xa5>
mov    -0xc(%rbp),%eax
sub    $0x80,%eax
cmp    $0x77f,%eax
jbe    1132 <utf8_code_encoding_size+0x32>
jmp    111e <utf8_code_encoding_size+0x1e>
movl   $0x3,-0x4(%rbp)
jmp    11a5 <utf8_code_encoding_size+0xa5>
mov    -0xc(%rbp),%eax
sub    $0x800,%eax
cmp    $0xf7ff,%eax
jbe    1156 <utf8_code_encoding_size+0x56>
jmp    113e <utf8_code_encoding_size+0x3e>
movl   $0x4,-0x4(%rbp)
jmp    11a5 <utf8_code_encoding_size+0xa5>
mov    -0xc(%rbp),%eax
sub    $0x10000,%eax
cmp    $0xffff,%eax
jbe    117a <utf8_code_encoding_size+0x7a>
jmp    1162 <utf8_code_encoding_size+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_code_encoding_size>:
mov    %edi,%ecx
and    $0xffff0000,%ecx
mov    $0x4,%eax
cmp    $0x10000,%ecx
je     1143 <utf8_code_encoding_size+0x43>
lea    -0x800(%rdi),%ecx
mov    $0x3,%eax
cmp    $0xf7ff,%ecx
jbe    1143 <utf8_code_encoding_size+0x43>
lea    -0x80(%rdi),%ecx
mov    $0x2,%eax
cmp    $0x780,%ecx
jb     1143 <utf8_code_encoding_size+0x43>
xor    %eax,%eax
cmp    $0x80,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @utf8_code_encoding_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %18 [
]
5: ; preds = %6
store i32 1, i32* %2
br label %22
6: ; preds = %10
%7 = sub i32 %4, 0
%8 = icmp ule i32 %7, 127
br i1 %8, label %5, label %21
9: ; preds = %10
store i32 2, i32* %2
br label %22
10: ; preds = %14
%11 = sub i32 %4, 128
%12 = icmp ule i32 %11, 1919
br i1 %12, label %9, label %6
13: ; preds = %14
store i32 3, i32* %2
br label %22
14: ; preds = %18
%15 = sub i32 %4, 2048
%16 = icmp ule i32 %15, 63487
br i1 %16, label %13, label %10
17: ; preds = %18
store i32 4, i32* %2
br label %22
18: ; preds = %1
%19 = sub i32 %4, 65536
%20 = icmp ule i32 %19, 65535
br i1 %20, label %17, label %14
21: ; preds = %6
store i32 0, i32* %2
br label %22
22: ; preds = %21, %17, %13, %9, %5
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @utf8_code_encoding_size(i32 %0) {
%2 = and i32 %0, -65536
%3 = icmp eq i32 %2, 65536
br i1 %3, label %13, label %10
4: ; preds = %7
%5 = icmp ult i32 %0, 128
%6 = zext i1 %5 to i32
br label %13
7: ; preds = %10
%8 = add i32 %0, -128
%9 = icmp ult i32 %8, 1920
br i1 %9, label %13, label %4
10: ; preds = %1
%11 = add i32 %0, -2048
%12 = icmp ult i32 %11, 63488
br i1 %12, label %13, label %7
13: ; preds = %4, %1, %10, %7
%14 = phi i32 [ 2, %7 ], [ 3, %10 ], [ 4, %1 ], [ %6, %4 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("I work.\n"); }


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

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

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

LLVM IR (-O2):
@str = [8 x i8] c"I work.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void sigalrm_handler(int sig) {
  printf("Program timed out after %d seconds\n", 2);
  exit(1);
}


x86 assembly (clang, -O0):
<sigalrm_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sigalrm_handler>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Program timed out after %d seconds\0A\00"
define void @sigalrm_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 2)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [36 x i8] c"Program timed out after %d seconds\0A\00"
define void @sigalrm_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 2)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct file_handle {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int name_to_handle_at(int dirfd, const char *pathname,
                      struct file_handle *handle, int *mount_id, int flags) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<name_to_handle_at>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    0x2eca(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb1(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<name_to_handle_at>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.file_handle = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @name_to_handle_at(i32 %0, i8* %1, %struct.file_handle* %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca %struct.file_handle*
%9 = alloca i32*
%10 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store %struct.file_handle* %2, %struct.file_handle** %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%11 = load i32, i32* @ENOSYS
store i32 %11, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.file_handle = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @name_to_handle_at(i32 %0, i8* nocapture readnone %1, %struct.file_handle* nocapture readnone %2, i32* nocapture readnone %3, i32 %4) {
%6 = load i32, i32* @ENOSYS
store i32 %6, i32* @errno
ret i32 -1
}
float fadd_byValue(float a_firstValue, float a_secondValue) {
  float a_resultValue;
  a_firstValue += 41.0f;
  a_secondValue += 1.0f;
  a_resultValue = a_firstValue + a_secondValue;
  return a_resultValue;
}


x86 assembly (clang, -O0):
<fadd_byValue>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  0xeee(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  0xed8(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fadd_byValue>:
addss  0xef8(%rip),%xmm0
addss  0xef4(%rip),%xmm1
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @fadd_byValue(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = fadd float %6, 4.100000e+01
store float %7, float* %3
%8 = load float, float* %4
%9 = fadd float %8, 1.000000e+00
store float %9, float* %4
%10 = load float, float* %3
%11 = load float, float* %4
%12 = fadd float %10, %11
store float %12, float* %5
%13 = load float, float* %5
ret float %13
}

LLVM IR (-O2):
define float @fadd_byValue(float %0, float %1) {
%3 = fadd float %0, 4.100000e+01
%4 = fadd float %1, 1.000000e+00
%5 = fadd float %3, %4
ret float %5
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_OCTET_STRING;

/* Variables and functions */
int /*<<< orphan*/ *ASN1_STRING_dup(int /*<<< orphan*/ const *);
ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x) {
  return ASN1_STRING_dup(x);
}


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

x86 assembly (clang, -O2):
<ASN1_OCTET_STRING_dup>:
jmp    1030 <ASN1_STRING_dup@plt>

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

LLVM IR (-O2):
define i32* @ASN1_OCTET_STRING_dup(i32* %0) {
%2 = tail call i32* @ASN1_STRING_dup(i32* %0)
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ log_err(int, char *, char *);
void log_err_open(char *fname) { log_err(1, "Could not open %s", fname); }


x86 assembly (clang, -O0):
<log_err_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xed4(%rip),%rsi
call   1030 <log_err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_err_open>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rsi
mov    $0x1,%edi
jmp    1030 <log_err@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Could not open %s\00"
define void @log_err_open(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @log_err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Could not open %s\00"
define void @log_err_open(i8* %0) {
%2 = tail call i32 @log_err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
double check_probablity(int);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i = 0;
  srand(time(NULL));
  printf("probablity = %2f\%\n", check_probablity(32000));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x7d00,%edi
call   1060 <check_probablity@plt>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x7d00,%edi
call   1060 <check_probablity@plt>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"probablity = %2f%\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
%5 = call double @check_probablity(i32 32000)
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"probablity = %2f%\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call double @check_probablity(i32 32000)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double %3)
ret i32 0
}
unsigned char readb(unsigned int address) {
  return *((volatile unsigned char *)address);
}


x86 assembly (clang, -O0):
<readb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    (%rax),%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i8 @readb(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = load volatile i8, i8* %5
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @readb(i32 %0) {
%2 = zext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
%4 = load volatile i8, i8* %3
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ print_ar(int *, int);
int /*<<< orphan*/ printf(char *, char *);
main() {
  int x[] = {4, 3, 2, 1};
  char s[] = "hi there\n";
  print_ar(x, sizeof x / sizeof *x);
  printf("'%s'\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x1a(%rbp)
mov    0xec8(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1030 <print_ar@plt>
lea    -0x1a(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x6572656874206968,%rax
65 72 65
mov    %rax,(%rsp)
movw   $0xa,0x8(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1030 <print_ar@plt>
lea    0xebf(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@__const.main.x = [4 x i32] [i32 4, i32 3, i32 2, i32 1]
@__const.main.s = [10 x i8] c"hi there\0A\00"
@.str = [6 x i8] c"'%s'\0A\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = alloca [10 x i8]
%3 = bitcast [4 x i32]* %1 to i8*
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%6 = call i32 @print_ar(i32* %5, i32 4)
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ emisorCRC();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int args, char **argv) {
  if (strcmp(argv[1], "--tx") == 0)
    emisorCRC();
  else
    fprintf(stderr, "Argumento desconocido");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeab(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1170 <main+0x40>
mov    $0x0,%al
call   1050 <emisorCRC@plt>
jmp    1185 <main+0x55>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
lea    0xec4(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     115d <main+0x2d>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xeaf(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1164 <main+0x34>
xor    %eax,%eax
call   1050 <emisorCRC@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"--tx\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Argumento desconocido\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @emisorCRC()
br label %16
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %13, %11
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"--tx\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Argumento desconocido\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (...) @emisorCRC()
br label %12
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %9, %7
ret i32 0
}
int kronecker_delta(int i, int j) { return i == j ? 1 : 0; }


x86 assembly (clang, -O0):
<kronecker_delta>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kronecker_delta>:
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @kronecker_delta(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 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 1, i32 0
ret i32 %9
}

LLVM IR (-O2):
define i32 @kronecker_delta(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int is_logtime_enabled(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @is_logtime_enabled() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, float);
void ftoa(float value, char *strFloat) { sprintf(strFloat, "%.2f", value); }


x86 assembly (clang, -O0):
<ftoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movss  -0x4(%rbp),%xmm0
lea    0xecf(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftoa>:
lea    0xee9(%rip),%rsi
jmp    1030 <sprintf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%.2f\00"
define void @ftoa(float %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float %0)
ret void
}
/* Variables and functions */
int MCL_CURRENT;
int MCL_FUTURE;
scalar_t__ mlockall(int);
int /*<<< orphan*/ warning(char *);
void coreInitMemory(void) {
  if (mlockall(MCL_FUTURE | MCL_CURRENT)) {
    warning("unable to lock memory with mlockall()\n");
  }
}


x86 assembly (clang, -O0):
<coreInitMemory>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    0x2ea4(%rip),%rax
or     (%rax),%edi
call   1040 <mlockall@plt>
cmp    $0x0,%rax
je     1151 <coreInitMemory+0x31>
lea    0xeb4(%rip),%rdi
call   1030 <warning@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<coreInitMemory>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    0x2ea9(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1040 <mlockall@plt>
test   %rax,%rax
je     114a <coreInitMemory+0x2a>
lea    0xebc(%rip),%rdi
pop    %rax
jmp    1030 <warning@plt>
pop    %rax
ret

LLVM IR (-O0):
@MCL_FUTURE = global i32 0
@MCL_CURRENT = global i32 0
@.str = [39 x i8] c"unable to lock memory with mlockall()\0A\00"
define void @coreInitMemory() {
%1 = load i32, i32* @MCL_FUTURE
%2 = load i32, i32* @MCL_CURRENT
%3 = or i32 %1, %2
%4 = call i64 @mlockall(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @warning(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret void
}

LLVM IR (-O2):
@MCL_FUTURE = global i32 0
@MCL_CURRENT = global i32 0
@.str = [39 x i8] c"unable to lock memory with mlockall()\0A\00"
define void @coreInitMemory() {
%1 = load i32, i32* @MCL_FUTURE
%2 = load i32, i32* @MCL_CURRENT
%3 = or i32 %2, %1
%4 = tail call i64 @mlockall(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = tail call i32 @warning(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret void
}
long long int longlongint_ignoring_shortint(long long int x, short int y) {
  return x;
}


x86 assembly (clang, -O0):
<longlongint_ignoring_shortint>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<longlongint_ignoring_shortint>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @longlongint_ignoring_shortint(i64 returned %0, i16 signext %1) {
ret i64 %0
}
/* Variables and functions */
int /*<<< orphan*/ __WFI();
void port_wait_for_interrupt(void) { __WFI(); }


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

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

LLVM IR (-O0):
define void @port_wait_for_interrupt() {
%1 = call i32 (...) @__WFI()
ret void
}

LLVM IR (-O2):
define void @port_wait_for_interrupt() {
%1 = tail call i32 (...) @__WFI()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void foo(void) {
  printf("in foo\n");
  return;
}


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

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

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

LLVM IR (-O2):
@str = [7 x i8] c"in foo\00"
define void @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dlclose(void *);
void closeLib(void *handle) {
  if (handle != NULL) {
    dlclose(handle);
  }
}


x86 assembly (clang, -O0):
<closeLib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <closeLib+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <dlclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeLib>:
test   %rdi,%rdi
je     111a <closeLib+0xa>
jmp    1030 <dlclose@plt>
ret

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

LLVM IR (-O2):
define void @closeLib(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @dlclose(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}