xunge/DecIR huggingface dataset:
/* Variables and functions */
float log2f(float);
float __ocl_half_log2_float(float src) { return log2f(src); }


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

x86 assembly (clang, -O2):
<__ocl_half_log2_float>:
jmp    1030 <log2f@plt>

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

LLVM IR (-O2):
define float @__ocl_half_log2_float(float %0) {
%2 = tail call float @log2f(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0x59() {
  Assert_real((ispunct(89) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_ispunct.c",
              450, ("ispunct should be 0 for Y"));
}


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

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

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

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 0 for Y\00"
define void @t_ispunct_0x59() {
%1 = tail call i64 @ispunct(i32 89)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 450, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ crc_offset_from_whence(int, size_t);
int /*<<< orphan*/ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ xread(int, void *, size_t);
ssize_t read_whence_crc(int fd, void *crc_buffer, size_t data_len, int whence) {
  off_t offset = crc_offset_from_whence(whence, data_len);
  lseek(fd, offset, SEEK_SET);
  return xread(fd, crc_buffer, data_len / 512 * 4);
}


x86 assembly (clang, -O0):
<read_whence_crc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <crc_offset_from_whence@plt>
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
call   1030 <lseek@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
shr    $0x9,%rdx
shl    $0x2,%rdx
call   1040 <xread@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_whence_crc>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    %ecx,%edi
mov    %rdx,%rsi
call   1050 <crc_offset_from_whence@plt>
mov    0x2e93(%rip),%rcx
mov    (%rcx),%edx
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <lseek@plt>
shr    $0x7,%rbx
and    $0xfffffffffffffffc,%rbx
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <xread@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
define i32 @read_whence_crc(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = load i64, i64* %7
%12 = call i32 @crc_offset_from_whence(i32 %10, i64 %11)
store i32 %12, i32* %9
%13 = load i32, i32* %5
%14 = load i32, i32* %9
%15 = load i32, i32* @SEEK_SET
%16 = call i32 @lseek(i32 %13, i32 %14, i32 %15)
%17 = load i32, i32* %5
%18 = load i8*, i8** %6
%19 = load i64, i64* %7
%20 = udiv i64 %19, 512
%21 = mul i64 %20, 4
%22 = call i32 @xread(i32 %17, i8* %18, i64 %21)
ret i32 %22
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define i32 @read_whence_crc(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = tail call i32 @crc_offset_from_whence(i32 %3, i64 %2)
%6 = load i32, i32* @SEEK_SET
%7 = tail call i32 @lseek(i32 %0, i32 %5, i32 %6)
%8 = lshr i64 %2, 7
%9 = and i64 %8, 144115188075855868
%10 = tail call i32 @xread(i32 %0, i8* %1, i64 %9)
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ swapr(int *, int *);
main() {
  int a = 1, b = 2;
  swapr(&a, &b);
  printf("After swap\na=%d, b=%d", a, b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <swapr@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [22 x i8] c"After swap\0Aa=%d, b=%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 2, i32* %2
%5 = call i32 @swapr(i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cgcmp(char *);
void cgeq() { cgcmp("jne"); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"jne\00"
define void @cgeq() {
%1 = call i32 @cgcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"jne\00"
define void @cgeq() {
%1 = tail call i32 @cgcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
void b_smp_run(unsigned long ptr) {
  asm volatile("call 0x001001B0" : : "a"(ptr));
}


x86 assembly (clang, -O0):
<b_smp_run>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
call   1001b0 <completed.0+0xfc190>
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_smp_run>:
mov    %rdi,%rax
call   1001b0 <completed.0+0xfc190>
ret

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

LLVM IR (-O2):
define void @b_smp_run(i64 %0) {
tail call void asm sideeffect "call 0x001001B0", "{ax},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret void
}
void atomic_inc(int *v) { asm volatile("lock; incl %0" : "+m"(*v)); }


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

x86 assembly (clang, -O2):
<atomic_inc>:
lock incl (%rdi)
ret

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

LLVM IR (-O2):
define void @atomic_inc(i32* %0) {
tail call void asm sideeffect "lock; incl $0", "=*m,*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %0, i32* elementtype(i32) %0)
ret void
}
/* Variables and functions */
int get_shnodep_value();
__attribute__((visibility("default"))) int get_stshdep_value(void) {
  return get_shnodep_value();
}


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

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

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

LLVM IR (-O2):
define i32 @get_stshdep_value() {
%1 = tail call i32 (...) @get_shnodep_value()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ SIGHUP;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
int /*<<< orphan*/ stderr;
void sighup(int sig) {
  signal(SIGHUP, sighup);
  fprintf(stderr, "W:\t%s\n", "trapped HUP and continue");
}


x86 assembly (clang, -O0):
<sighup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    0x2ea5(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
lea    0xeb0(%rip),%rdx
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sighup>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
mov    0x2eaf(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
lea    0xeba(%rip),%rdx
pop    %rax
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@SIGHUP = global i32 0
@stderr = global i32 0
@.str = [7 x i8] c"W:\09%s\0A\00"
@.str.1 = [25 x i8] c"trapped HUP and continue\00"
define void @sighup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @SIGHUP
%4 = call i32 @signal(i32 %3, void (i32)* @sighup)
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SIGHUP = global i32 0
@stderr = global i32 0
@.str = [7 x i8] c"W:\09%s\0A\00"
@.str.1 = [25 x i8] c"trapped HUP and continue\00"
define void @sighup(i32 %0) {
%2 = load i32, i32* @SIGHUP
%3 = tail call i32 @signal(i32 %2, void (i32)* @sighup)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int test_imm_6Auint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x6A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Auint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x20,%rdx
and    $0x6a,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_6Auint64_highword_reg>:
movabs $0x6a00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_6Auint64_highword_reg(i64 %0) {
%2 = and i64 %0, 455266533376
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ IPC_RMID;
int shmctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int cwirc_shm_free(int shmid) {
  if (shmid < 0 || shmctl(shmid, IPC_RMID, 0) == -1)
    return (-1);
  return (0);
}


x86 assembly (clang, -O0):
<cwirc_shm_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1141 <cwirc_shm_free+0x31>
mov    -0x8(%rbp),%edi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <shmctl@plt>
cmp    $0xffffffff,%eax
jne    114d <cwirc_shm_free+0x3d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1154 <cwirc_shm_free+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cwirc_shm_free>:
test   %edi,%edi
js     1136 <cwirc_shm_free+0x26>
push   %rax
mov    0x2ec4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <shmctl@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
sete   %al
neg    %eax
add    $0x8,%rsp
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@IPC_RMID = global i32 0
define i32 @cwirc_shm_free(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = load i32, i32* @IPC_RMID
%9 = call i32 @shmctl(i32 %7, i32 %8, i32 0)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %12
11: ; preds = %6, %1
store i32 -1, i32* %2
br label %13
12: ; preds = %6
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@IPC_RMID = global i32 0
define i32 @cwirc_shm_free(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i32, i32* @IPC_RMID
%5 = tail call i32 @shmctl(i32 %0, i32 %4, i32 0)
%6 = icmp eq i32 %5, -1
%7 = sext i1 %6 to i32
br label %8
8: ; preds = %3, %1
%9 = phi i32 [ -1, %1 ], [ %7, %3 ]
ret i32 %9
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ ECHILD;
int /*<<< orphan*/ errno;
pid_t wait(int *stat_loc) {
  errno = ECHILD;
  return -1;
}


x86 assembly (clang, -O0):
<wait>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec8(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ECHILD = global i32 0
@errno = global i32 0
define i32 @wait(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @ECHILD
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ECHILD = global i32 0
@errno = global i32 0
define i32 @wait(i32* nocapture readnone %0) {
%2 = load i32, i32* @ECHILD
store i32 %2, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ Sum(int, int);
int main(int argc, char *argv[]) {
  Sum(40, 67);
  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    $0x28,%edi
mov    $0x43,%esi
call   1030 <Sum@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @Sum(i32 40, i32 67)
ret i32 0
}
double tf_d(double c) { return c / 3; }


x86 assembly (clang, -O0):
<tf_d>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tf_d>:
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @tf_d(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 3.000000e+00
ret double %4
}

LLVM IR (-O2):
define double @tf_d(double %0) {
%2 = fdiv double %0, 3.000000e+00
ret double %2
}
int seleq(int x, int y, int z) { return x == 0 ? y : z; }


x86 assembly (clang, -O0):
<seleq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1122 <seleq+0x22>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1128 <seleq+0x28>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<seleq>:
mov    %esi,%eax
test   %edi,%edi
cmovne %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @seleq(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i32 %1, i32 %2
ret i32 %5
}
int f(int n) {
  int i;
  static int j = 0;
  for (i = 1; i <= n; i++)
    f(n - i);
  j++;
  return j;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1147 <f+0x37>
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <f@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <f+0x12>
mov    0x2edf(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ed6(%rip)
mov    0x2ed0(%rip),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
test   %edi,%edi
jle    112c <f+0x1c>
mov    %edi,%ebx
add    $0xffffffff,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <f@plt>
add    $0xffffffff,%ebx
jb     1120 <f+0x10>
mov    0x2efa(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ef1(%rip)
pop    %rbx
ret

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

LLVM IR (-O2):
@f.j = internal unnamed_addr global i32 0
define i32 @f(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = sub nsw i32 %0, %4
%6 = tail call i32 @f(i32 %5)
%7 = add nuw i32 %4, 1
%8 = icmp eq i32 %4, %0
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = load i32, i32* @f.j
%11 = add nsw i32 %10, 1
store i32 %11, i32* @f.j
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *prog) {
  printf("%s options\n\n"
         "  -t fd        TUN file descriptor\n",
         prog);
}


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

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

LLVM IR (-O0):
@.str = [48 x i8] c"%s options\0A\0A -t fd TUN file descriptor\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"%s options\0A\0A -t fd TUN file descriptor\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ isspace(char);
char *skip_whitespace(char *s) {
  while ((*s != 0) && (isspace(*s)))
    s++;
  return s;
}


x86 assembly (clang, -O0):
<skip_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1147 <skip_whitespace+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1157 <skip_whitespace+0x47>
jmp    1168 <skip_whitespace+0x58>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <skip_whitespace+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_whitespace>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1139 <skip_whitespace+0x29>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1139 <skip_whitespace+0x29>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <skip_whitespace+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @skip_whitespace(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = call i64 @isspace(i8 signext %10)
%12 = icmp ne i64 %11, 0
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ false, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @skip_whitespace(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %11, %9 ], [ %2, %1 ]
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = tail call i64 @isspace(i8 signext %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %9, %1
%14 = phi i8* [ %0, %1 ], [ %10, %9 ], [ %6, %4 ]
ret i8* %14
}
/* Variables and functions */
int getpid();
int daemonize(void) {
  int pid;
  pid = getpid();
  return pid;
}


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

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

LLVM IR (-O0):
define i32 @daemonize() {
%1 = alloca i32
%2 = call i32 (...) @getpid()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @daemonize() {
%1 = tail call i32 (...) @getpid()
ret i32 %1
}
/* Type definitions */
struct pollfd {
  int fd;
  int events;
};

/* Variables and functions */
int POLLERR;
int POLLIN;
int poll(struct pollfd *, int, int);
int sync_wait(int fd, int timeout) {
  struct pollfd fds;
  fds.fd = fd;
  fds.events = POLLIN | POLLERR;
  return poll(&fds, 1, timeout);
}


x86 assembly (clang, -O0):
<sync_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%eax
mov    0x2eb4(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edx
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <poll@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sync_wait>:
push   %rax
mov    %esi,%edx
mov    %edi,(%rsp)
mov    0x2ec3(%rip),%rax
mov    0x2ec4(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x4(%rsp)
mov    %rsp,%rdi
mov    $0x1,%esi
call   1030 <poll@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.pollfd = type { i32, i32 }
@POLLIN = global i32 0
@POLLERR = global i32 0
define i32 @sync_wait(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.pollfd
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %5, i32 0, i32 0
store i32 %6, i32* %7
%8 = load i32, i32* @POLLIN
%9 = load i32, i32* @POLLERR
%10 = or i32 %8, %9
%11 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %5, i32 0, i32 1
store i32 %10, i32* %11
%12 = load i32, i32* %4
%13 = call i32 @poll(%struct.pollfd* %5, i32 1, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.pollfd = type { i32, i32 }
@POLLIN = global i32 0
@POLLERR = global i32 0
define i32 @sync_wait(i32 %0, i32 %1) {
%3 = alloca %struct.pollfd
%4 = bitcast %struct.pollfd* %3 to i8*
%5 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 0
store i32 %0, i32* %5
%6 = load i32, i32* @POLLIN
%7 = load i32, i32* @POLLERR
%8 = or i32 %7, %6
%9 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 1
store i32 %8, i32* %9
%10 = call i32 @poll(%struct.pollfd* %3, i32 1, i32 %1)
ret i32 %10
}
/* Variables and functions */
int glutStrokeStringWidth(void *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int glutStrokeIntWidth(void *fontface, int i) {
  char buf[64];
  snprintf(buf, 64, "%d", i);
  return glutStrokeStringWidth(fontface, buf);
}


x86 assembly (clang, -O0):
<glutStrokeIntWidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0x40,%esi
lea    0xebe(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <glutStrokeStringWidth@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glutStrokeIntWidth>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %esi,%ecx
mov    %rdi,%rbx
lea    0xecd(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <glutStrokeStringWidth@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @glutStrokeIntWidth(i8* %0, i32 %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%6 = call i32 @glutStrokeStringWidth(i8* %0, i8* %4)
ret i32 %6
}
void lsh_loop(void) {
  char *line;
  char **args;
  int status;
  do {
    printf("> ");
    line = lsh_read_line();
    args = lsh_split_line(line);
    status = lsh_execute(args);
    free(line);
    free(args);
  } while (status);
}


x86 assembly (clang, -O0):
<lsh_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <lsh_read_line@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <lsh_split_line@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1070 <lsh_execute@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1158 <lsh_loop+0x8>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsh_loop>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xea2(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <lsh_read_line@plt>
movslq %eax,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <lsh_split_line@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <lsh_execute@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %ebp,%ebp
jne    1160 <lsh_loop+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"> \00"
define void @lsh_loop() {
%1 = alloca i8*
%2 = alloca i8**
%3 = alloca i32
br label %4
4: ; preds = %18, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @lsh_read_line()
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %1
%9 = load i8*, i8** %1
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @lsh_split_line to i32 (i8*, ...)*)(i8* %9)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i8**
store i8** %12, i8*** %2
%13 = load i8**, i8*** %2
%14 = call i32 (i8**, ...) bitcast (i32 (...)* @lsh_execute to i32 (i8**, ...)*)(i8** %13)
store i32 %14, i32* %3
%15 = load i8*, i8** %1
%16 = load i8**, i8*** %2
%17 = bitcast i8** %16 to i8*
br label %18
18: ; preds = %4
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 0
br i1 %20, label %4, label %21
21: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"> \00"
define void @lsh_loop() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @lsh_read_line()
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @lsh_split_line to i32 (i8*, ...)*)(i8* %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8**
%9 = tail call i32 (i8**, ...) bitcast (i32 (...)* @lsh_execute to i32 (i8**, ...)*)(i8** %8)
tail call void @free(i8* %5)
%10 = inttoptr i64 %7 to i8*
tail call void @free(i8* %10)
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %1
12: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tcp_westwood_unregister();
void module_unregister_fake(void) {
  if (0)
    tcp_westwood_unregister();
}


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

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

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

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

/* Variables and functions */
int inst_qryint(struct instrument *, char *);
int inst_488_2_stb(struct instrument *gd) { return inst_qryint(gd, "*STB?\n"); }


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

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

LLVM IR (-O0):
%struct.instrument = type { i32 }
@.str = [7 x i8] c"*STB?\0A\00"
define i32 @inst_488_2_stb(%struct.instrument* %0) {
%2 = alloca %struct.instrument*
store %struct.instrument* %0, %struct.instrument** %2
%3 = load %struct.instrument*, %struct.instrument** %2
%4 = call i32 @inst_qryint(%struct.instrument* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
%struct.instrument = type { i32 }
@.str = [7 x i8] c"*STB?\0A\00"
define i32 @inst_488_2_stb(%struct.instrument* %0) {
%2 = tail call i32 @inst_qryint(%struct.instrument* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
void main(void) {
  printf("Hello, World!\n");
  getchar();
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello, World!\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
ret void
}
/* Variables and functions */
bool checkLowerCase(char charToCheck) {
  return (charToCheck >= 'a' && charToCheck <= 'z');
}


x86 assembly (clang, -O0):
<checkLowerCase>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x61,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <checkLowerCase+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkLowerCase>:
add    $0x9f,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @checkLowerCase(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @checkLowerCase(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  while (1) {
    printf("loop\t");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [6 x i8] c"loop\09\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %2
}

LLVM IR (-O2):
@.str = [6 x i8] c"loop\09\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %1
}
int fn() { return 3; }


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

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

LLVM IR (-O0):
define i32 @fn() {
ret i32 3
}

LLVM IR (-O2):
define i32 @fn() {
ret i32 3
}
int test_imm_A3int16_mem(short *val) {
  return ((*val) & (-0xA3 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_A3int16_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, -163
%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_A3int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -163
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void TILT_SaveConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @TILT_SaveConfig() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_key_t;

/* Variables and functions */
int /*<<< orphan*/ dodgy_function(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_key_create(int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *);
int main(void) {
  pthread_key_t mykey;
  pthread_key_create(&mykey, NULL);
  dodgy_function(&mykey);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <pthread_key_create@plt>
mov    %rbx,%rdi
call   1030 <dodgy_function@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @pthread_key_create(i32* %1, i32* null)
%4 = call i32 @dodgy_function(i32* %1)
ret i32 0
}
long double atan2l(long double y, long double x) {}


x86 assembly (clang, -O0):
<atan2l>:
push   %rbp
mov    %rsp,%rbp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define x86_fp80 @atan2l(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
%6 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %6
}

LLVM IR (-O2):
define x86_fp80 @atan2l(x86_fp80 %0, x86_fp80 %1) {
ret x86_fp80 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_REQ;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_REQ_it;
X509_REQ *d2i_X509_REQ(X509_REQ **a, const unsigned char **in, long len) {
  return (X509_REQ *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_REQ_it);
}


x86 assembly (clang, -O0):
<d2i_X509_REQ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2ec1(%rip),%rcx
call   1030 <ASN1_item_d2i@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2i_X509_REQ>:
mov    0x2ee1(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@X509_REQ_it = global i32 0
define i32* @d2i_X509_REQ(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @X509_REQ_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@X509_REQ_it = global i32 0
define i32* @d2i_X509_REQ(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @X509_REQ_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_ENTROPY_C and/or "
         "MBEDTLS_FS_IO and/or MBEDTLS_CTR_DRBG_C and/or "
         "MBEDTLS_GENPRIME not defined.\n");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [127 x i8] c"MBEDTLS_BIGNUM_C and/or MBEDTLS_ENTROPY_C and/or MBEDTLS_FS_IO and/or MBEDTLS_CTR_DRBG_C and/or MBEDTLS_GENPRIME not defined.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [126 x i8] c"MBEDTLS_BIGNUM_C and/or MBEDTLS_ENTROPY_C and/or MBEDTLS_FS_IO and/or MBEDTLS_CTR_DRBG_C and/or MBEDTLS_GENPRIME not defined.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([126 x i8], [126 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void RTDbgModCreateFromMap(void) {}


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

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

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

LLVM IR (-O2):
define void @RTDbgModCreateFromMap() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ int80(int, int, int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/);
void changeFont(int n) { int80(16, n, 0, 0, 0, 0); }


x86 assembly (clang, -O0):
<changeFont>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x10,%edi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1030 <int80@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<changeFont>:
mov    %edi,%esi
mov    $0x10,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <int80@plt>

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

LLVM IR (-O2):
define void @changeFont(i32 %0) {
%2 = tail call i32 @int80(i32 16, i32 %0, i32 0, i32 0, i32 0, i32 0)
ret void
}
long add2(int n) { return n + 2; }


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

x86 assembly (clang, -O2):
<add2>:
add    $0x2,%edi
movslq %edi,%rax
ret

LLVM IR (-O0):
define i64 @add2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 2
%5 = sext i32 %4 to i64
ret i64 %5
}

LLVM IR (-O2):
define i64 @add2(i32 %0) {
%2 = add nsw i32 %0, 2
%3 = sext i32 %2 to i64
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ mbpdbus_send_video_switch();
void video_switch(void) { mbpdbus_send_video_switch(); }


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

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

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

LLVM IR (-O2):
define void @video_switch() {
%1 = tail call i32 (...) @mbpdbus_send_video_switch()
ret void
}
void I2CSlaveIntDisableEx(unsigned int baseAdd, unsigned int intFlag) {
  (*((volatile unsigned int *)(baseAdd + (0x30)))) = intFlag;
}


x86 assembly (clang, -O0):
<I2CSlaveIntDisableEx>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CSlaveIntDisableEx>:
add    $0x30,%edi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @I2CSlaveIntDisableEx(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 = load i32, i32* %3
%7 = add i32 %6, 48
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store volatile i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @I2CSlaveIntDisableEx(i32 %0, i32 %1) {
%3 = add i32 %0, 48
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
store volatile i32 %1, i32* %5
ret void
}
void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
%struct.rt2x00_dev = type opaque
define void @rt2x00rfkill_unregister(%struct.rt2x00_dev* nocapture %0) {
ret void
}
unsigned char answer_2(unsigned char arg0) { return ~(1 << arg0); }


x86 assembly (clang, -O0):
<answer_2>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<answer_2>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
not    %al
ret

LLVM IR (-O0):
define zeroext i8 @answer_2(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = shl i32 1, %4
%6 = xor i32 %5, -1
%7 = trunc i32 %6 to i8
ret i8 %7
}

LLVM IR (-O2):
define zeroext i8 @answer_2(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = shl nuw i32 1, %2
%4 = trunc i32 %3 to i8
%5 = xor i8 %4, -1
ret i8 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void PrintString(void *elemAddr, void *auxData) {
  char *word = *(char **)elemAddr;
  FILE *fp = (FILE *)auxData;
  fprintf(fp, "\t%s\n", word);
}


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

x86 assembly (clang, -O2):
<PrintString>:
mov    %rsi,%rax
mov    (%rdi),%rdx
lea    0xee3(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\09%s\0A\00"
define void @PrintString(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
%9 = load i8*, i8** %8
store i8* %9, i8** %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %6
%12 = load i32*, i32** %6
%13 = load i8*, i8** %5
%14 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\09%s\0A\00"
define void @PrintString(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i32*
%6 = tail call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo_decls();
void bar3() { foo_decls(); }


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

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

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

LLVM IR (-O2):
define void @bar3() {
%1 = tail call i32 (...) @foo_decls()
ret void
}