xunge/DecIR huggingface dataset:
int thermal_notify_cdev_delete(int cdev_id) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @thermal_notify_cdev_delete(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ BLKFLSBUF;
int /*<<< orphan*/ fsync(int);
scalar_t__ ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
void flush_buffer_cache(int fd) {
  fsync(fd);
  if (ioctl(fd, BLKFLSBUF, NULL))
    perror("BLKFLSBUF failed");
}


x86 assembly (clang, -O0):
<flush_buffer_cache>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <fsync@plt>
mov    -0x4(%rbp),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
je     116e <flush_buffer_cache+0x3e>
lea    0xe97(%rip),%rdi
call   1050 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_buffer_cache>:
push   %rbx
mov    %edi,%ebx
call   1040 <fsync@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1030 <ioctl@plt>
test   %rax,%rax
jne    1151 <flush_buffer_cache+0x21>
pop    %rbx
ret
lea    0xea8(%rip),%rdi
pop    %rbx
jmp    1050 <perror@plt>

LLVM IR (-O0):
@BLKFLSBUF = global i32 0
@.str = [17 x i8] c"BLKFLSBUF failed\00"
define void @flush_buffer_cache(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @fsync(i32 %3)
%5 = load i32, i32* %2
%6 = load i32, i32* @BLKFLSBUF
%7 = call i64 @ioctl(i32 %5, i32 %6, i32* null)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
ret void
}

LLVM IR (-O2):
@BLKFLSBUF = global i32 0
@.str = [17 x i8] c"BLKFLSBUF failed\00"
define void @flush_buffer_cache(i32 %0) {
%2 = tail call i32 @fsync(i32 %0)
%3 = load i32, i32* @BLKFLSBUF
%4 = tail call i64 @ioctl(i32 %0, i32 %3, i32* null)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_east();
int /*<<< orphan*/ do_north();
void do_north_east_corner(void) {
  do_north();
  do_east();
}


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

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

LLVM IR (-O0):
define void @do_north_east_corner() {
%1 = call i32 (...) @do_north()
%2 = call i32 (...) @do_east()
ret void
}

LLVM IR (-O2):
define void @do_north_east_corner() {
%1 = tail call i32 (...) @do_north()
%2 = tail call i32 (...) @do_east()
ret void
}
int debugger_sstep(struct pt_regs *regs) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.pt_regs = type opaque
define i32 @debugger_sstep(%struct.pt_regs* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void f2(void) { printf("f2 is calling...\n"); }


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

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

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

LLVM IR (-O2):
@str = [17 x i8] c"f2 is calling...\00"
define void @f2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void gamesdb_SafeFree(void *mem) { free(mem); }


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

x86 assembly (clang, -O2):
<gamesdb_SafeFree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @gamesdb_SafeFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ stdout;
void edit(int argc, char *argv[]) {
  fprintf(stdout, "argc = %d, argv[0] = %s\n", argc, argv[0]);
}


x86 assembly (clang, -O0):
<edit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xec7(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<edit>:
mov    %edi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rcx
lea    0xedb(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [25 x i8] c"argc = %d, argv[0] = %s\0A\00"
define void @edit(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @stdout
%6 = load i32, i32* %3
%7 = load i8**, i8*** %4
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %9)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [25 x i8] c"argc = %d, argv[0] = %s\0A\00"
define void @edit(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %1
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %4)
ret void
}
int ffi_test_51(int x, int y, int z) { return x + y + z + 1; }


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

x86 assembly (clang, -O2):
<ffi_test_51>:
add    %esi,%edi
lea    (%rdx,%rdi,1),%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ffi_test_51(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 = load i32, i32* %5
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
%12 = add nsw i32 %11, 1
ret i32 %12
}

LLVM IR (-O2):
define i32 @ffi_test_51(i32 %0, i32 %1, i32 %2) {
%4 = add i32 %0, 1
%5 = add i32 %4, %1
%6 = add i32 %5, %2
ret i32 %6
}
/* Type definitions */
struct timeval {
  int tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
double tv_seconds(const struct timeval *tv) {
  return difftime(tv->tv_sec, 0) + tv->tv_usec * 1e-6;
}


x86 assembly (clang, -O0):
<tv_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
xor    %esi,%esi
call   1030 <difftime@plt>
movaps %xmm0,%xmm1
mov    -0x8(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
movsd  0xec3(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tv_seconds>:
push   %rbx
mov    %rdi,%rbx
mov    0x4(%rdi),%edi
xor    %esi,%esi
call   1030 <difftime@plt>
cvtsi2sdl (%rbx),%xmm1
mulsd  0xed6(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define double @tv_seconds(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%5 = load i32, i32* %4
%6 = call double @difftime(i32 %5, i32 0)
%7 = load %struct.timeval*, %struct.timeval** %2
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = sitofp i32 %9 to double
%11 = call double @llvm.fmuladd.f64(double %10, double 0x3EB0C6F7A0B5ED8D, double %6)
ret double %11
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define double @tv_seconds(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%3 = load i32, i32* %2
%4 = tail call double @difftime(i32 %3, i32 0)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%6 = load i32, i32* %5
%7 = sitofp i32 %6 to double
%8 = tail call double @llvm.fmuladd.f64(double %7, double 0x3EB0C6F7A0B5ED8D, double %4)
ret double %8
}
cbuf21(f, n) int f, n;
{ cbuf(f, n, 21); }


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

x86 assembly (clang, -O2):
<cbuf21>:
mov    $0x15,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf21(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %6, i32 %7, i32 21)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @cbuf21(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 21)
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ locale_t;

/* Variables and functions */
int vsscanf(char const *, char const *, int /*<<< orphan*/);
int vsscanf_l(const char *str, locale_t l, const char *fmt, va_list args) {
  return vsscanf(str, fmt, args);
}


x86 assembly (clang, -O0):
<vsscanf_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <vsscanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vsscanf_l>:
mov    %rdx,%rsi
mov    %ecx,%edx
jmp    1030 <vsscanf@plt>

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

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


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

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

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

LLVM IR (-O2):
define void @_Unwind_Find_FDE() {
ret void
}
void rop3_215_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = T ^ S;
  stk1 = *D & stk2;
  stk1 = ~stk1;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_215_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_215_0_0>:
xor    %edx,%esi
and    (%rdi),%sil
not    %sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_215_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %6
%10 = zext i8 %9 to i32
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = xor i32 %10, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %8
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = load i8, i8* %8
%19 = zext i8 %18 to i32
%20 = and i32 %17, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %7
%22 = load i8, i8* %7
%23 = zext i8 %22 to i32
%24 = xor i32 %23, -1
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = load i8*, i8** %4
store i8 %26, i8* %27
ret void
}

LLVM IR (-O2):
define void @rop3_215_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %2, %1
%5 = load i8, i8* %0
%6 = and i8 %5, %4
%7 = xor i8 %6, -1
store i8 %7, i8* %0
ret void
}
int cgraph_cmp_int(const void *e1, const void *e2) {
  int i1 = (*((const int *)e1));
  int i2 = (*((const int *)e2));
  return (i1 - i2);
}


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

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

LLVM IR (-O0):
define i32 @cgraph_cmp_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
store i32 %9, i32* %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = sub nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @cgraph_cmp_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ cubictcp_register();
int /*<<< orphan*/ set_linux_file_name(char *);
void module_register(void) {
  cubictcp_register();
  set_linux_file_name("tcp_cubic.c");
}


x86 assembly (clang, -O0):
<module_register>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <cubictcp_register@plt>
lea    0xece(%rip),%rdi
call   1040 <set_linux_file_name@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_register>:
push   %rax
xor    %eax,%eax
call   1030 <cubictcp_register@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <set_linux_file_name@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"tcp_cubic.c\00"
define void @module_register() {
%1 = call i32 (...) @cubictcp_register()
%2 = call i32 @set_linux_file_name(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"tcp_cubic.c\00"
define void @module_register() {
%1 = tail call i32 (...) @cubictcp_register()
%2 = tail call i32 @set_linux_file_name(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
int compareFloat(void *a, void *b) { return *((float *)a) - *((float *)b); }


x86 assembly (clang, -O0):
<compareFloat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
cvttss2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareFloat>:
movss  (%rdi),%xmm0
subss  (%rsi),%xmm0
cvttss2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @compareFloat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to float*
%7 = load float, float* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to float*
%10 = load float, float* %9
%11 = fsub float %7, %10
%12 = fptosi float %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @compareFloat(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = load float, float* %3
%5 = bitcast i8* %1 to float*
%6 = load float, float* %5
%7 = fsub float %4, %6
%8 = fptosi float %7 to i32
ret i32 %8
}
double fX2(double x1, double x2, double x3) { return ((10 - x1 - x3) / 3.); }


x86 assembly (clang, -O0):
<fX2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xeed(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xed3(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fX2>:
movsd  0xef8(%rip),%xmm1
subsd  %xmm0,%xmm1
subsd  %xmm2,%xmm1
divsd  0xef0(%rip),%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fX2(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = fsub double 1.000000e+01, %7
%9 = load double, double* %6
%10 = fsub double %8, %9
%11 = fdiv double %10, 3.000000e+00
ret double %11
}

LLVM IR (-O2):
define double @fX2(double %0, double %1, double %2) {
%4 = fsub double 1.000000e+01, %0
%5 = fsub double %4, %2
%6 = fdiv double %5, 3.000000e+00
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ sd_read_i(int, unsigned int, unsigned int);
void _sd_read(unsigned dummy, unsigned target, unsigned size) {
  sd_read_i(0xc00, size * 4, target);
}


x86 assembly (clang, -O0):
<_sd_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
shl    $0x2,%esi
mov    -0x8(%rbp),%edx
mov    $0xc00,%edi
call   1030 <sd_read_i@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sd_read>:
mov    %esi,%eax
lea    0x0(,%rdx,4),%esi
mov    $0xc00,%edi
mov    %eax,%edx
jmp    1030 <sd_read_i@plt>

LLVM IR (-O0):
define void @_sd_read(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* %6
%8 = mul i32 %7, 4
%9 = load i32, i32* %5
%10 = call i32 @sd_read_i(i32 3072, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @_sd_read(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %2, 2
%5 = tail call i32 @sd_read_i(i32 3072, i32 %4, i32 %1)
ret void
}
int num_deleted(int sid) {
  int c = 0;
  while (sid) {
    if (sid & 1)
      c++;
    sid = sid >> 1;
  }
  return c;
}


x86 assembly (clang, -O0):
<num_deleted>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113e <num_deleted+0x3e>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1130 <num_deleted+0x30>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <num_deleted+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_deleted>:
xor    %eax,%eax
test   %edi,%edi
je     1120 <num_deleted+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
sar    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <num_deleted+0x10>
ret

LLVM IR (-O0):
define i32 @num_deleted(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = and i32 %8, 1
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %7
%15 = load i32, i32* %2
%16 = ashr i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @num_deleted(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = add nuw nsw i32 %4, %6
%8 = ashr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ cleanUpAndFail(int);
void panic(char *s) { cleanUpAndFail(3); }


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

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

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

LLVM IR (-O2):
define void @panic(i8* nocapture readnone %0) {
%2 = tail call i32 @cleanUpAndFail(i32 3)
ret void
}
void gkfooo() { return; }


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

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

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

LLVM IR (-O2):
define void @gkfooo() {
ret void
}
/* Variables and functions */
scalar_t__ FB_MEMCPYX(char *, char const *, int);
void fb_hStrCopy(char *dst, const char *src, int bytes) {
  if ((src != 0) && (bytes > 0)) {
    dst = (char *)FB_MEMCPYX(dst, src, bytes);
  }
  *dst = 0;
}


x86 assembly (clang, -O0):
<fb_hStrCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114c <fb_hStrCopy+0x3c>
cmpl   $0x0,-0x14(%rbp)
jle    114c <fb_hStrCopy+0x3c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <FB_MEMCPYX@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_hStrCopy>:
push   %rax
test   %rsi,%rsi
je     1122 <fb_hStrCopy+0x12>
test   %edx,%edx
jle    1122 <fb_hStrCopy+0x12>
call   1030 <FB_MEMCPYX@plt>
mov    %rax,%rdi
movb   $0x0,(%rdi)
pop    %rax
ret

LLVM IR (-O0):
define void @fb_hStrCopy(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %18
9: ; preds = %3
%10 = load i32, i32* %6
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = load i32, i32* %6
%16 = call i64 @FB_MEMCPYX(i8* %13, i8* %14, i32 %15)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %4
br label %18
18: ; preds = %12, %9, %3
%19 = load i8*, i8** %4
store i8 0, i8* %19
ret void
}

LLVM IR (-O2):
define void @fb_hStrCopy(i8* %0, i8* %1, i32 %2) {
%4 = icmp ne i8* %1, null
%5 = icmp sgt i32 %2, 0
%6 = and i1 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = tail call i64 @FB_MEMCPYX(i8* %0, i8* %1, i32 %2)
%9 = inttoptr i64 %8 to i8*
br label %10
10: ; preds = %7, %3
%11 = phi i8* [ %9, %7 ], [ %0, %3 ]
store i8 0, i8* %11
ret void
}
int get_basic_type(int *type_info, int size) { return type_info[0]; }


x86 assembly (clang, -O0):
<get_basic_type>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @get_basic_type(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 0
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_basic_type(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct ip6_rthdr {
  int ip6r_segleft;
};
struct in6_addr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, struct in6_addr const *, int);
int inet6_rth_add(void *bp, const struct in6_addr *addr) {
  struct ip6_rthdr *rth;
  rth = (struct ip6_rthdr *)bp;
  memcpy((uint8_t *)bp + 8 + rth->ip6r_segleft * sizeof(struct in6_addr), addr,
         sizeof(struct in6_addr));
  rth->ip6r_segleft += 1;
  return 0;
}


x86 assembly (clang, -O0):
<inet6_rth_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x20,%rdi
mov    -0x18(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet6_rth_add>:
push   %rbx
mov    %rdi,%rbx
movslq (%rdi),%rax
shl    $0x4,%rax
add    %rax,%rdi
add    $0x20,%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
addl   $0x1,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.in6_addr = type { i32 }
%struct.ip6_rthdr = type { i32 }
define i32 @inet6_rth_add(i8* %0, %struct.in6_addr* %1) {
%3 = alloca i8*
%4 = alloca %struct.in6_addr*
%5 = alloca %struct.ip6_rthdr*
store i8* %0, i8** %3
store %struct.in6_addr* %1, %struct.in6_addr** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.ip6_rthdr*
store %struct.ip6_rthdr* %7, %struct.ip6_rthdr** %5
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
%10 = getelementptr inbounds i32, i32* %9, i64 8
%11 = load %struct.ip6_rthdr*, %struct.ip6_rthdr** %5
%12 = getelementptr inbounds %struct.ip6_rthdr, %struct.ip6_rthdr* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 4
%16 = getelementptr inbounds i32, i32* %10, i64 %15
%17 = load %struct.in6_addr*, %struct.in6_addr** %4
%18 = call i32 @memcpy(i32* %16, %struct.in6_addr* %17, i32 4)
%19 = load %struct.ip6_rthdr*, %struct.ip6_rthdr** %5
%20 = getelementptr inbounds %struct.ip6_rthdr, %struct.ip6_rthdr* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
store i32 %22, i32* %20
ret i32 0
}

LLVM IR (-O2):
%struct.in6_addr = type { i32 }
define i32 @inet6_rth_add(i8* %0, %struct.in6_addr* %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 32
%4 = bitcast i8* %3 to i32*
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = sext i32 %6 to i64
%8 = shl nsw i64 %7, 2
%9 = getelementptr inbounds i32, i32* %4, i64 %8
%10 = tail call i32 @memcpy(i32* %9, %struct.in6_addr* %1, i32 4)
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
store i32 %12, i32* %5
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void safeCloseFd(int fd) { close(fd); }


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

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

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

LLVM IR (-O2):
define void @safeCloseFd(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
int weaks(int);
int main() { return weaks(10); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0xa,%edi
jmp    1030 <weaks@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @weaks(i32 10)
ret i32 %1
}
int mytolower(int c) {
  if ((c >= 'A') && (c <= 'Z'))
    c -= ('A' - 'a');
  return c;
}


x86 assembly (clang, -O0):
<mytolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x41,-0x4(%rbp)
jl     1124 <mytolower+0x24>
cmpl   $0x5a,-0x4(%rbp)
jg     1124 <mytolower+0x24>
mov    -0x4(%rbp),%eax
sub    $0xffffffe0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @mytolower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char str_a[20];
  strcpy(str_a, "Hello World!\n");
  printf(str_a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"Hello World!\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* %2)
ret i32 0
}
void glPointParameterfv(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glPointParameterfv() {
ret void
}
float maths_f_abs(const float a) {
  if (a >= 0.0f) {
    return a;
  } else {
    return -a;
  }
}


x86 assembly (clang, -O0):
<maths_f_abs>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1129 <maths_f_abs+0x29>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1140 <maths_f_abs+0x40>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define float @maths_f_abs(float %0) {
%2 = fcmp ult float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %3, float %0
ret float %4
}
int get_framesize() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @get_framesize() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DWB();
void writeb(unsigned val, unsigned addr) {
  DWB();
  (*(volatile unsigned char *)(addr)) = (val);
  DWB();
}


x86 assembly (clang, -O0):
<writeb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <DWB@plt>
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%eax
mov    %cl,(%rax)
mov    $0x0,%al
call   1030 <DWB@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeb>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <DWB@plt>
mov    %ebx,%eax
mov    %bpl,(%rax)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <DWB@plt>

LLVM IR (-O0):
define void @writeb(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @DWB()
%6 = load i32, i32* %3
%7 = trunc i32 %6 to i8
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store volatile i8 %7, i8* %10
%11 = call i32 (...) @DWB()
ret void
}

LLVM IR (-O2):
define void @writeb(i32 %0, i32 %1) {
%3 = tail call i32 (...) @DWB()
%4 = trunc i32 %0 to i8
%5 = zext i32 %1 to i64
%6 = inttoptr i64 %5 to i8*
store volatile i8 %4, i8* %6
%7 = tail call i32 (...) @DWB()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void sc_cleanup_file(FILE **ptr) {
  if (ptr != NULL && *ptr != NULL) {
    fclose(*ptr);
    *ptr = NULL;
  }
}


x86 assembly (clang, -O0):
<sc_cleanup_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114c <sc_cleanup_file+0x3c>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     114c <sc_cleanup_file+0x3c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <fclose@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sc_cleanup_file>:
push   %rbx
test   %rdi,%rdi
je     112d <sc_cleanup_file+0x1d>
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     112d <sc_cleanup_file+0x1d>
call   1030 <fclose@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @sc_cleanup_file(i32** %0) {
%2 = icmp eq i32** %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i32*, i32** %0
%5 = icmp eq i32* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @fclose(i32* %4)
store i32* null, i32** %0
br label %8
8: ; preds = %6, %3, %1
ret void
}
int foo(void *restrict ptr) { return *((int *)ptr); }


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

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

LLVM IR (-O0):
define i32 @foo(i8* noalias %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @foo(i8* noalias nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
int valid_size(int x) {
  if (x < 2 || x > 1024)
    return 0;
  while (x) {
    int bit = (x & 1);
    x >>= 1;
    if (x && bit) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<valid_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     111e <valid_size+0x1e>
cmpl   $0x400,-0x8(%rbp)
jle    112a <valid_size+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1177 <valid_size+0x77>
jmp    112f <valid_size+0x2f>
cmpl   $0x0,-0x8(%rbp)
je     1170 <valid_size+0x70>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     116b <valid_size+0x6b>
cmpl   $0x0,-0xc(%rbp)
je     116b <valid_size+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    1177 <valid_size+0x77>
jmp    112f <valid_size+0x2f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_size>:
lea    -0x401(%rdi),%ecx
xor    %eax,%eax
cmp    $0xfffffc01,%ecx
jb     1122 <valid_size+0x22>
test   %edi,%edi
je     1123 <valid_size+0x23>
mov    %edi,%ecx
sar    %edi
cmp    $0x1,%ecx
je     1110 <valid_size+0x10>
and    $0x1,%ecx
je     1110 <valid_size+0x10>
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @valid_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 2
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 1024
br i1 %9, label %10, label %11
10: ; preds = %7, %1
store i32 0, i32* %2
br label %28
11: ; preds = %7
br label %12
12: ; preds = %26, %11
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %12
%16 = load i32, i32* %3
%17 = and i32 %16, 1
store i32 %17, i32* %4
%18 = load i32, i32* %3
%19 = ashr i32 %18, 1
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %15
%23 = load i32, i32* %4
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 0, i32* %2
br label %28
26: ; preds = %22, %15
br label %12
27: ; preds = %12
store i32 1, i32* %2
br label %28
28: ; preds = %27, %25, %10
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @valid_size(i32 %0) {
%2 = add i32 %0, -1025
%3 = icmp ult i32 %2, -1023
br i1 %3, label %13, label %4
4: ; preds = %1, %7
%5 = phi i32 [ %9, %7 ], [ %0, %1 ]
%6 = icmp eq i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = and i32 %5, 1
%9 = ashr i32 %5, 1
%10 = icmp eq i32 %5, 1
%11 = icmp eq i32 %8, 0
%12 = or i1 %10, %11
br i1 %12, label %4, label %13
13: ; preds = %7, %4, %1
%14 = phi i32 [ 0, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
unsigned long insert_sh6(unsigned long insn, long value, const char **errmsg) {
  return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);
}


x86 assembly (clang, -O0):
<insert_sh6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
and    $0x1f,%rcx
shl    $0xb,%rcx
or     %rcx,%rax
mov    -0x10(%rbp),%rcx
and    $0x20,%rcx
sar    $0x4,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_sh6>:
mov    %esi,%eax
shl    $0xb,%eax
movzwl %ax,%eax
or     %rdi,%rax
shr    $0x4,%rsi
and    $0x2,%esi
or     %rsi,%rax
ret

LLVM IR (-O0):
define i64 @insert_sh6(i64 %0, i64 %1, i8** %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8**
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8** %2, i8*** %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = and i64 %8, 31
%10 = shl i64 %9, 11
%11 = or i64 %7, %10
%12 = load i64, i64* %5
%13 = and i64 %12, 32
%14 = ashr i64 %13, 4
%15 = or i64 %11, %14
ret i64 %15
}

LLVM IR (-O2):
define i64 @insert_sh6(i64 %0, i64 %1, i8** nocapture readnone %2) {
%4 = shl i64 %1, 11
%5 = and i64 %4, 63488
%6 = or i64 %5, %0
%7 = lshr i64 %1, 4
%8 = and i64 %7, 2
%9 = or i64 %6, %8
ret i64 %9
}
int print_b2(char *buf, _Bool val) {
  return sprintf(buf, "%s", val ? "true" : "false");
}


x86 assembly (clang, -O0):
<print_b2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
and    $0x1,%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%cl
lea    0xed6(%rip),%rdx
lea    0xeca(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rdx
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_b2>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rcx
lea    0xee3(%rip),%rax
test   %esi,%esi
cmovne %rcx,%rax
mov    %rax,%rsi
call   1030 <stpcpy@plt>
sub    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @print_b2(i8* %0, i1 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
%5 = zext i1 %1 to i8
store i8 %5, i8* %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %4
%8 = trunc i8 %7 to i1
%9 = zext i1 %8 to i64
%10 = select i1 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @print_b2(i8* %0, i1 zeroext %1) {
%3 = select i1 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%4 = tail call i8* @stpcpy(i8* %0, i8* %3)
%5 = ptrtoint i8* %4 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}
unsigned int hash_string(char *input) {
  static unsigned int prime = 16777619;
  unsigned int hash = 2166136261;
  char octet;
  while ((octet = *input++)) {
    hash ^= octet;
    hash *= prime;
  }
  return hash;
}


x86 assembly (clang, -O0):
<hash_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x811c9dc5,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0xd(%rbp)
cmp    $0x0,%al
je     1147 <hash_string+0x47>
movsbl -0xd(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    0x2ee5(%rip),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hash_string+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_string>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <hash_string+0x27>
add    $0x1,%rdi
mov    $0x811c9dc5,%eax
nop
movsbl %cl,%ecx
xor    %eax,%ecx
imul   $0x1000193,%ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_string+0x10>
ret
mov    $0x811c9dc5,%eax
ret

LLVM IR (-O0):
@hash_string.prime = internal global i32 16777619
define i32 @hash_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
store i8* %0, i8** %2
store i32 -2128831035, i32* %3
br label %5
5: ; preds = %10, %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = load i8, i8* %6
store i8 %8, i8* %4
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %5
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = load i32, i32* %3
%14 = xor i32 %13, %12
store i32 %14, i32* %3
%15 = load i32, i32* @hash_string.prime
%16 = load i32, i32* %3
%17 = mul i32 %16, %15
store i32 %17, i32* %3
br label %5
18: ; preds = %5
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @hash_string(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ -2128831035, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = sext i8 %5 to i32
%10 = xor i32 %7, %9
%11 = mul i32 %10, 16777619
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ -2128831035, %1 ], [ %11, %4 ]
ret i32 %15
}
void test4_OtherInterrupts_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @test4_OtherInterrupts_targetInit__I() {
ret void
}
void swap(double *a, double *b) {
  double temp = *a;
  *a = *b;
  *b = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movsd  %xmm1,(%rdi)
movsd  %xmm0,(%rsi)
ret

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

LLVM IR (-O2):
define void @swap(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
store double %4, double* %0
store double %3, double* %1
ret void
}
void xmunmap(void *addr, unsigned long len) {}


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

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

LLVM IR (-O0):
define void @xmunmap(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
ret void
}

LLVM IR (-O2):
define void @xmunmap(i8* nocapture %0, i64 %1) {
ret void
}