xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ f(int);
void usb_storage_proc_info2(int i) { f(27); }


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

x86 assembly (clang, -O2):
<usb_storage_proc_info2>:
mov    $0x1b,%edi
jmp    1030 <f@plt>

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

LLVM IR (-O2):
define void @usb_storage_proc_info2(i32 %0) {
%2 = tail call i32 @f(i32 27)
ret void
}
void si2cMasterSetAddress(char *byte, char address) { *byte = address << 1; }


x86 assembly (clang, -O0):
<si2cMasterSetAddress>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
shl    $0x1,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<si2cMasterSetAddress>:
add    %sil,%sil
mov    %sil,(%rdi)
ret

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

LLVM IR (-O2):
define void @si2cMasterSetAddress(i8* nocapture writeonly %0, i8 signext %1) {
%3 = shl i8 %1, 1
store i8 %3, i8* %0
ret void
}
/* Type definitions */
struct rdcf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rdcf_close(struct rdcf *);
int real_rdcf_write(struct rdcf *, void const *, int);
int rdcf_write(struct rdcf *f, const void *buf, int count) {
  int result;
  result = real_rdcf_write(f, buf, count);
  if (result <= 0) {
    rdcf_close(f);
  }
  return result;
}


x86 assembly (clang, -O0):
<rdcf_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <real_rdcf_write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     1159 <rdcf_write+0x39>
mov    -0x8(%rbp),%rdi
call   1040 <rdcf_close@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdcf_write>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <real_rdcf_write@plt>
mov    %eax,%ebp
test   %eax,%eax
jg     1139 <rdcf_write+0x19>
mov    %rbx,%rdi
call   1040 <rdcf_close@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.rdcf = type { i32 }
define i32 @rdcf_write(%struct.rdcf* %0, i8* %1, i32 %2) {
%4 = alloca %struct.rdcf*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store %struct.rdcf* %0, %struct.rdcf** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load %struct.rdcf*, %struct.rdcf** %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @real_rdcf_write(%struct.rdcf* %8, i8* %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp sle i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = load %struct.rdcf*, %struct.rdcf** %4
%16 = call i32 @rdcf_close(%struct.rdcf* %15)
br label %17
17: ; preds = %14, %3
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
%struct.rdcf = type { i32 }
define i32 @rdcf_write(%struct.rdcf* %0, i8* %1, i32 %2) {
%4 = tail call i32 @real_rdcf_write(%struct.rdcf* %0, i8* %1, i32 %2)
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @rdcf_close(%struct.rdcf* %0)
br label %8
8: ; preds = %6, %3
ret i32 %4
}
const char *Cmp_Name(void) { return "Cmp"; }


x86 assembly (clang, -O0):
<Cmp_Name>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cmp_Name>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"Cmp\00"
define i8* @Cmp_Name() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"Cmp\00"
define i8* @Cmp_Name() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ create(char *);
int /*<<< orphan*/ dump_descr();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
main(int argc, char **argv) {
  create(argv[1]);
  dump_descr();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <create@plt>
mov    $0x0,%al
call   1040 <dump_descr@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <create@plt>
xor    %eax,%eax
call   1040 <dump_descr@plt>
xor    %edi,%edi
call   1050 <exit@plt>

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 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @create(i8* %8)
%10 = call i32 (...) @dump_descr()
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @create(i8* %4)
%6 = tail call i32 (...) @dump_descr()
%7 = tail call i32 @exit(i32 0)
unreachable
}
__attribute__((always_)) void writew(unsigned short b, volatile void *addr) {
  *(volatile unsigned short *)addr = b;
}


x86 assembly (clang, -O0):
<writew>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x2(%rbp),%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<writew>:
mov    %di,(%rsi)
ret

LLVM IR (-O0):
define void @writew(i16 zeroext %0, i8* %1) {
%3 = alloca i16
%4 = alloca i8*
store i16 %0, i16* %3
store i8* %1, i8** %4
%5 = load i16, i16* %3
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i16*
store volatile i16 %5, i16* %7
ret void
}

LLVM IR (-O2):
define void @writew(i16 zeroext %0, i8* %1) {
%3 = bitcast i8* %1 to i16*
store volatile i16 %0, i16* %3
ret void
}
int tolower(int c) {
  int ch = c;
  if ((unsigned int)(ch - 'A') < 26u)
    ch -= 'A' - 'a';
  return ch;
}


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
cmp    $0x1a,%eax
jae    1125 <tolower+0x25>
mov    -0x8(%rbp),%eax
sub    $0xffffffe0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = add nsw 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
}
/* Type definitions */
typedef int u_int64_t;

/* Variables and functions */
u_int64_t tt_calc_block_size(u_int64_t filesize, unsigned max_levels) {
  u_int64_t tmp = 1024;
  u_int64_t maxHashes = 1ULL << (max_levels - 1);
  while ((maxHashes * tmp) < filesize)
    tmp *= 2;
  if (tmp < 64 * 1024)
    tmp = 64 * 1024;
  return tmp;
}


x86 assembly (clang, -O0):
<tt_calc_block_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x400,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1144 <tt_calc_block_size+0x44>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1126 <tt_calc_block_size+0x26>
cmpl   $0x10000,-0xc(%rbp)
jge    1158 <tt_calc_block_size+0x58>
movl   $0x10000,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tt_calc_block_size>:
lea    -0x1(%rsi),%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    $0x400,%edx
mov    %edx,%ecx
mov    %edx,%esi
imul   %eax,%esi
lea    (%rcx,%rcx,1),%edx
cmp    %edi,%esi
jl     1110 <tt_calc_block_size+0x10>
cmp    $0x10001,%ecx
mov    $0x10000,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @tt_calc_block_size(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1024, i32* %5
%7 = load i32, i32* %4
%8 = sub i32 %7, 1
%9 = zext i32 %8 to i64
%10 = shl i64 1, %9
%11 = trunc i64 %10 to i32
store i32 %11, i32* %6
br label %12
12: ; preds = %18, %2
%13 = load i32, i32* %6
%14 = load i32, i32* %5
%15 = mul nsw i32 %13, %14
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i32, i32* %5
%20 = mul nsw i32 %19, 2
store i32 %20, i32* %5
br label %12
21: ; preds = %12
%22 = load i32, i32* %5
%23 = icmp slt i32 %22, 65536
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 65536, i32* %5
br label %25
25: ; preds = %24, %21
%26 = load i32, i32* %5
ret i32 %26
}

LLVM IR (-O2):
define i32 @tt_calc_block_size(i32 %0, i32 %1) {
%3 = add i32 %1, -1
%4 = zext i32 %3 to i64
%5 = shl nuw i64 1, %4
%6 = trunc i64 %5 to i32
br label %7
7: ; preds = %7, %2
%8 = phi i32 [ 1024, %2 ], [ %11, %7 ]
%9 = mul nsw i32 %8, %6
%10 = icmp slt i32 %9, %0
%11 = shl nsw i32 %8, 1
br i1 %10, label %7, label %12
12: ; preds = %7
%13 = icmp ugt i32 %8, 65536
%14 = select i1 %13, i32 %8, i32 65536
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ BNCIO(int);
int BNCFieldLeft() {
  int ii, stat = 99;
  char com1, data;
  BNCIO(40);
  return (stat);
}


x86 assembly (clang, -O0):
<BNCFieldLeft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x63,-0x8(%rbp)
mov    $0x28,%edi
call   1030 <BNCIO@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @BNCFieldLeft() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
store i32 99, i32* %2
%5 = call i32 @BNCIO(i32 40)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @BNCFieldLeft() {
%1 = tail call i32 @BNCIO(i32 40)
ret i32 99
}
/* Variables and functions */
int cmd_mtd_erase_raw_partition(char const *);
int cmd_mtd_erase_partition(const char *partition, const char *filesystem) {
  return cmd_mtd_erase_raw_partition(partition);
}


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

x86 assembly (clang, -O2):
<cmd_mtd_erase_partition>:
jmp    1030 <cmd_mtd_erase_raw_partition@plt>

LLVM IR (-O0):
define i32 @cmd_mtd_erase_partition(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 = call i32 @cmd_mtd_erase_raw_partition(i8* %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @cmd_mtd_erase_partition(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @cmd_mtd_erase_raw_partition(i8* %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ __rename(char const *, char const *);
int rename(const char *old, const char *new) {
  int ret;
  __rename(old, new);
  ret = 0;
  return (ret);
}


x86 assembly (clang, -O0):
<rename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <__rename@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @rename(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @__rename(i8* %6, i8* %7)
store i32 0, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @rename(i8* %0, i8* %1) {
%3 = tail call i32 @__rename(i8* %0, i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
scalar_t__ memcmp(char *, char *, int);
void memcmp3() {
  char a[] = {1, 2, 3, 4};
  clang_analyzer_eval(memcmp(a, a, 4) == 0);
}


x86 assembly (clang, -O0):
<memcmp3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memcmp3>:
push   %rax
movl   $0x4030201,0x4(%rsp)
04
lea    0x4(%rsp),%rdi
mov    %rdi,%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <clang_analyzer_eval@plt>
pop    %rax
ret

LLVM IR (-O0):
@__const.memcmp3.a = [4 x i8] c"\01\02\03\04"
define void @memcmp3() {
%1 = alloca [4 x i8]
%2 = bitcast [4 x i8]* %1 to i8*
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%5 = call i64 @memcmp(i8* %3, i8* %4, i32 4)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @clang_analyzer_eval(i32 %7)
ret void
}

LLVM IR (-O2):
define void @memcmp3() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 67305985, i32* %1
%3 = call i64 @memcmp(i8* %2, i8* %2, i32 4)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @clang_analyzer_eval(i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void ct_sleep(int second) { sleep(second); }


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

x86 assembly (clang, -O2):
<ct_sleep>:
jmp    1030 <sleep@plt>

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

LLVM IR (-O2):
define void @ct_sleep(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
ret void
}
do_write(void *cookie, const char *p, int n) {
  printf("%s, cookie=%p, p=%p='%s', n=%d\n", __func__, cookie, p, p, n);
}


x86 assembly (clang, -O0):
<do_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
lea    0xec6(%rip),%rdi
lea    0xedf(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_write>:
mov    %edx,%r9d
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xee0(%rip),%rdi
lea    0xef9(%rip),%rsi
mov    %rcx,%r8
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"%s, cookie=%p, p=%p='%s', n=%d\0A\00"
@__func__.do_write = [9 x i8] c"do_write\00"
define i32 @do_write(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.do_write, i64 0, i64 0), i8* %8, i8* %9, i8* %10, i32 %11)
%13 = load i32, i32* %4
ret i32 %13
}

LLVM IR (-O2):
@.str = [32 x i8] c"%s, cookie=%p, p=%p='%s', n=%d\0A\00"
@__func__.do_write = [9 x i8] c"do_write\00"
define i32 @do_write(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.do_write, i64 0, i64 0), i8* %0, i8* %1, i8* %1, i32 %2)
ret i32 undef
}
void crc() {
  int toread;
  long long nleft;
  unsigned char buf[(128 * 1024)];
  nleft = 0;
  while (toread =
             (nleft < (2147483647 * 2U + 1U)) ? nleft : (2147483647 * 2U + 1U))
    ;
}


x86 assembly (clang, -O0):
<crc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1ffa0,%rsp
movq   $0x0,-0x10(%rbp)
mov    $0xffffffff,%eax
cmp    %rax,-0x10(%rbp)
jge    1132 <crc+0x32>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20018(%rbp)
jmp    1143 <crc+0x43>
mov    $0xffffffff,%eax
mov    %rax,-0x20018(%rbp)
jmp    1143 <crc+0x43>
mov    -0x20018(%rbp),%rax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     115b <crc+0x5b>
jmp    1113 <crc+0x13>
add    $0x1ffa0,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @crc() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca [131072 x i8]
store i64 0, i64* %2
br label %4
4: ; preds = %14, %0
%5 = load i64, i64* %2
%6 = icmp slt i64 %5, 4294967295
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = load i64, i64* %2
br label %10
9: ; preds = %4
br label %10
10: ; preds = %9, %7
%11 = phi i64 [ %8, %7 ], [ 4294967295, %9 ]
%12 = trunc i64 %11 to i32
store i32 %12, i32* %1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
br label %4
15: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @crc() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void mov_reg32_preg32pimm32(int reg1, int reg2, unsigned int imm32) {
  put8(0x8B);
  put8(0x80 | (reg1 << 3) | reg2);
  put32(imm32);
}


x86 assembly (clang, -O0):
<mov_reg32_preg32pimm32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x8b,%edi
call   1030 <put8@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0x80,%edi
or     -0x8(%rbp),%edi
call   1030 <put8@plt>
mov    -0xc(%rbp),%edi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mov_reg32_preg32pimm32>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
mov    $0x8b,%edi
call   1030 <put8@plt>
shl    $0x3,%ebx
or     %ebp,%ebx
or     $0x80,%ebx
mov    %ebx,%edi
call   1030 <put8@plt>
mov    %r14d,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @mov_reg32_preg32pimm32(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 = call i32 @put8(i32 139)
%8 = load i32, i32* %4
%9 = shl i32 %8, 3
%10 = or i32 128, %9
%11 = load i32, i32* %5
%12 = or i32 %10, %11
%13 = call i32 @put8(i32 %12)
%14 = load i32, i32* %6
%15 = call i32 @put32(i32 %14)
ret void
}

LLVM IR (-O2):
define void @mov_reg32_preg32pimm32(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @put8(i32 139)
%5 = shl i32 %0, 3
%6 = or i32 %5, %1
%7 = or i32 %6, 128
%8 = tail call i32 @put8(i32 %7)
%9 = tail call i32 @put32(i32 %2)
ret void
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
double rand_gen() { return (double)rand() / ((double)RAND_MAX + 1); }


x86 assembly (clang, -O0):
<rand_gen>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xecc(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_gen>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
addsd  0xecf(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @rand_gen() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fadd double %4, 1.000000e+00
%6 = fdiv double %2, %5
ret double %6
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @rand_gen() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fadd double %4, 1.000000e+00
%6 = fdiv double %2, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
quit(int status, char *msg) {
  fprintf(stderr, "%s", msg);
  exit(status);
}


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xebd(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %rbx
mov    %rsi,%rdx
mov    %edi,%ebx
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @quit(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %4
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* %3
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @quit(i32 %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%5 = tail call i32 @exit(i32 %0)
unreachable
}
int __cpu_disable(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @__cpu_disable() {
ret i32 0
}
/* Variables and functions */
double alaw_to_float(unsigned char);
void alaw_to_float64_array(const void *__restrict in, double *__restrict out,
                           size_t len) {
  size_t i;
  for (i = 0; i < len; i++) {
    out[i] = alaw_to_float(((unsigned char *)in)[i]);
  }
}


x86 assembly (clang, -O0):
<alaw_to_float64_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1169 <alaw_to_float64_array+0x59>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <alaw_to_float@plt>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112c <alaw_to_float64_array+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alaw_to_float64_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     1149 <alaw_to_float64_array+0x39>
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%edi
call   1030 <alaw_to_float@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <alaw_to_float64_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @alaw_to_float64_array(i8* noalias %0, double* noalias %1, i64 %2) {
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store double* %1, double** %5
store i64 %2, i64* %6
store i64 0, i64* %7
br label %8
8: ; preds = %21, %3
%9 = load i64, i64* %7
%10 = load i64, i64* %6
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = load i64, i64* %7
%15 = getelementptr inbounds i8, i8* %13, i64 %14
%16 = load i8, i8* %15
%17 = call double @alaw_to_float(i8 zeroext %16)
%18 = load double*, double** %5
%19 = load i64, i64* %7
%20 = getelementptr inbounds double, double* %18, i64 %19
store double %17, double* %20
br label %21
21: ; preds = %12
%22 = load i64, i64* %7
%23 = add i64 %22, 1
store i64 %23, i64* %7
br label %8
24: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @alaw_to_float64_array(i8* noalias nocapture %0, double* noalias nocapture writeonly %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %13, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %11, %5 ], [ 0, %3 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = tail call double @alaw_to_float(i8 zeroext %8)
%10 = getelementptr inbounds double, double* %1, i64 %6
store double %9, double* %10
%11 = add nuw i64 %6, 1
%12 = icmp eq i64 %11, %2
br i1 %12, label %13, label %5
13: ; preds = %5, %3
ret void
}
int main() {
  int a = 0;
  if (a > 2) {
    return 1;
  } else if (a >= 0) {
    return 0;
  } else {
    return 5;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1128 <main+0x28>
movl   $0x1,-0x4(%rbp)
jmp    1145 <main+0x45>
cmpl   $0x0,-0x8(%rbp)
jl     113e <main+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1145 <main+0x45>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct rtc_device {
  int dummy;
};
struct i2c_client {
  int dummy;
};

/* Variables and functions */
struct rtc_device *i2c_get_clientdata(struct i2c_client *);
int /*<<< orphan*/ rtc_device_unregister(struct rtc_device *);
int rv4162_remove(struct i2c_client *client) {
  struct rtc_device *rtc = i2c_get_clientdata(client);
  if (rtc)
    rtc_device_unregister(rtc);
  return 0;
}


x86 assembly (clang, -O0):
<rv4162_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <i2c_get_clientdata@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114d <rv4162_remove+0x2d>
mov    -0x10(%rbp),%rdi
call   1040 <rtc_device_unregister@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rv4162_remove>:
push   %rax
call   1030 <i2c_get_clientdata@plt>
test   %rax,%rax
je     1133 <rv4162_remove+0x13>
mov    %rax,%rdi
call   1040 <rtc_device_unregister@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.i2c_client = type { i32 }
%struct.rtc_device = type { i32 }
define i32 @rv4162_remove(%struct.i2c_client* %0) {
%2 = alloca %struct.i2c_client*
%3 = alloca %struct.rtc_device*
store %struct.i2c_client* %0, %struct.i2c_client** %2
%4 = load %struct.i2c_client*, %struct.i2c_client** %2
%5 = call %struct.rtc_device* @i2c_get_clientdata(%struct.i2c_client* %4)
store %struct.rtc_device* %5, %struct.rtc_device** %3
%6 = load %struct.rtc_device*, %struct.rtc_device** %3
%7 = icmp ne %struct.rtc_device* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load %struct.rtc_device*, %struct.rtc_device** %3
%10 = call i32 @rtc_device_unregister(%struct.rtc_device* %9)
br label %11
11: ; preds = %8, %1
ret i32 0
}

LLVM IR (-O2):
%struct.i2c_client = type { i32 }
%struct.rtc_device = type { i32 }
define i32 @rv4162_remove(%struct.i2c_client* %0) {
%2 = tail call %struct.rtc_device* @i2c_get_clientdata(%struct.i2c_client* %0)
%3 = icmp eq %struct.rtc_device* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @rtc_device_unregister(%struct.rtc_device* %2)
br label %6
6: ; preds = %4, %1
ret i32 0
}
/* Variables and functions */
bool isPowerOf2(size_t n) {
  if (n == 0)
    return false;
  return (n & (n - 1)) == 0;
}


x86 assembly (clang, -O0):
<isPowerOf2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <isPowerOf2+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    113d <isPowerOf2+0x3d>
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPowerOf2>:
test   %rdi,%rdi
je     1112 <isPowerOf2+0x12>
lea    -0x1(%rdi),%rcx
xor    %eax,%eax
test   %rcx,%rdi
sete   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isPowerOf2(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %14
7: ; preds = %1
%8 = load i64, i64* %3
%9 = load i64, i64* %3
%10 = sub i64 %9, 1
%11 = and i64 %8, %10
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %7, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @isPowerOf2(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i64 @llvm.ctpop.i64(i64 %0)
%5 = icmp ult i64 %4, 2
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
void Cyc_Dict_count_elem(int *cnt, void *a, void *b) {
  int *_T0;
  int *_T1;
  int _T2;
  _T0 = cnt;
  _T1 = cnt;
  _T2 = *_T1;
  *_T0 = _T2 + 1;
}


x86 assembly (clang, -O0):
<Cyc_Dict_count_elem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Dict_count_elem>:
addl   $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @Cyc_Dict_count_elem(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%10 = load i32*, i32** %4
store i32* %10, i32** %7
%11 = load i32*, i32** %4
store i32* %11, i32** %8
%12 = load i32*, i32** %8
%13 = load i32, i32* %12
store i32 %13, i32* %9
%14 = load i32, i32* %9
%15 = add nsw i32 %14, 1
%16 = load i32*, i32** %7
store i32 %15, i32* %16
ret void
}

LLVM IR (-O2):
define void @Cyc_Dict_count_elem(i32* nocapture %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = load i32, i32* %0
%5 = add nsw i32 %4, 1
store i32 %5, i32* %0
ret void
}
int f(int t[]) { return t[0]; }


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

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

LLVM IR (-O0):
define i32 @f(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @f(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
void INT_Excep_PERIB_INTB179(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB179() {
ret void
}
void xerbla(char *srname, int *info) { ; }


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

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

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

LLVM IR (-O2):
define void @xerbla(i8* nocapture %0, i32* nocapture %1) {
ret void
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("The value of EOF is: %d\n", EOF);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"The value of EOF is: %d\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @EOF
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"The value of EOF is: %d\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ apic_write(int, int /*<<< orphan*/);
void ack_APIC(void) { apic_write(0xB0, 0); }


x86 assembly (clang, -O0):
<ack_APIC>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb0,%edi
xor    %esi,%esi
call   1030 <apic_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ack_APIC>:
mov    $0xb0,%edi
xor    %esi,%esi
jmp    1030 <apic_write@plt>

LLVM IR (-O0):
define void @ack_APIC() {
%1 = call i32 @apic_write(i32 176, i32 0)
ret void
}

LLVM IR (-O2):
define void @ack_APIC() {
%1 = tail call i32 @apic_write(i32 176, i32 0)
ret void
}
/* Variables and functions */
char *strrchr(char *, char);
char *get_filename_ext(char *filename) {
  char *slash = strrchr(filename, '/');
  char *dot = strrchr(slash, '.');
  if (!dot || dot == slash)
    return "";
  return (dot);
}


x86 assembly (clang, -O0):
<get_filename_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1159 <get_filename_ext+0x49>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1169 <get_filename_ext+0x59>
lea    0xea0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1171 <get_filename_ext+0x61>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_filename_ext>:
push   %rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
cmp    %rbx,%rax
lea    0xecb(%rip),%rdx
mov    %rax,%rcx
cmove  %rdx,%rcx
test   %rax,%rax
cmove  %rdx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @get_filename_ext(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @strrchr(i8* %6, i8 signext 47)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = call i8* @strrchr(i8* %8, i8 signext 46)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %1
%13 = load i8*, i8** %5
%14 = load i8*, i8** %4
%15 = icmp eq i8* %13, %14
br i1 %15, label %16, label %17
16: ; preds = %12, %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %19
17: ; preds = %12
%18 = load i8*, i8** %5
store i8* %18, i8** %2
br label %19
19: ; preds = %17, %16
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @get_filename_ext(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %2, i8 signext 46)
%4 = icmp eq i8* %3, null
%5 = icmp eq i8* %3, %2
%6 = or i1 %4, %5
%7 = select i1 %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %7
}
/* Variables and functions */
extern int cat(const char *rem, size_t count) {}


x86 assembly (clang, -O0):
<cat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @cat(i8* nocapture readnone %0, i64 %1) {
ret i32 undef
}
void mstrncpy(char *s, char *t, int n) {
  int i = 0;
  while ((i++ < n) && (*s++ = *t++))
    ;
  *s = '\0';
}


x86 assembly (clang, -O0):
<mstrncpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x19(%rbp)
jge    115d <mstrncpy+0x5d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    116d <mstrncpy+0x6d>
jmp    1172 <mstrncpy+0x72>
jmp    1116 <mstrncpy+0x16>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mstrncpy>:
xor    %eax,%eax
test   %edx,%edx
cmovle %eax,%edx
nopw   0x0(%rax,%rax,1)
cmp    %eax,%edx
je     1123 <mstrncpy+0x23>
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <mstrncpy+0x10>
add    %rax,%rdi
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @mstrncpy(i8* nocapture writeonly %0, i8* nocapture %1, i32 %2) {
%4 = call i32 @llvm.smax.i32(i32 %2, i32 0)
br label %5
5: ; preds = %10, %3
%6 = phi i8* [ %1, %3 ], [ %12, %10 ]
%7 = phi i8* [ %0, %3 ], [ %14, %10 ]
%8 = phi i32 [ 0, %3 ], [ %11, %10 ]
%9 = icmp eq i32 %8, %4
br i1 %9, label %16, label %10
10: ; preds = %5
%11 = add nuw i32 %8, 1
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %6
%14 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %13, i8* %7
%15 = icmp eq i8 %13, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %10
%17 = phi i8* [ %14, %10 ], [ %7, %5 ]
store i8 0, i8* %17
ret void
}
/* Variables and functions */
int plus_abs(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int a = 5, b = 3;
  printf("plus_abs(%d, %d) = %d\n", a, b, plus_abs(a, b));
  b = -3;
  printf("plus_abs(%d, %d) = %d\n", a, b, plus_abs(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <plus_abs@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    %eax,%ecx
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
movl   $0xfffffffd,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <plus_abs@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x5,%edi
mov    $0x3,%esi
call   1030 <plus_abs@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x3,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    $0x5,%edi
mov    $0xfffffffd,%esi
call   1030 <plus_abs@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0xfffffffd,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [23 x i8] c"plus_abs(%d, %d) = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @plus_abs(i32 5, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 5, i32 3, i32 %1)
%3 = tail call i32 @plus_abs(i32 5, i32 -3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 5, i32 -3, i32 %3)
ret i32 0
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *fh_test_util_strip_path(const char *filename) {
  const char *pathless;
  pathless = strrchr(filename, '/');
  if (pathless == NULL) {
    pathless = filename;
  } else {
    pathless += sizeof(char);
  }
  return pathless;
}


x86 assembly (clang, -O0):
<fh_test_util_strip_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1146 <fh_test_util_strip_path+0x36>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1152 <fh_test_util_strip_path+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fh_test_util_strip_path>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @fh_test_util_strip_path(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %2
store i8* %9, i8** %3
br label %13
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 1
store i8* %12, i8** %3
br label %13
13: ; preds = %10, %8
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @fh_test_util_strip_path(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fu_Close(int /*<<< orphan*/ *);
char *fu_Fnread(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *fu_Open(char const *, char *);
char *fu_Nread(const char *path, int length) {
  char *buffer;
  FILE *stream = fu_Open(path, "r");
  if (NULL == stream)
    return NULL;
  buffer = fu_Fnread(stream, length);
  fu_Close(stream);
  return buffer;
}


x86 assembly (clang, -O0):
<fu_Nread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <fu_Open@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x28(%rbp),%rax
jne    116c <fu_Nread+0x3c>
movq   $0x0,-0x8(%rbp)
jmp    118d <fu_Nread+0x5d>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <fu_Fnread@plt>
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <fu_Close@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fu_Nread>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
lea    0xec4(%rip),%rsi
call   1040 <fu_Open@plt>
test   %rax,%rax
je     1163 <fu_Nread+0x33>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
call   1050 <fu_Fnread@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1030 <fu_Close@plt>
mov    %rbp,%rax
jmp    1165 <fu_Nread+0x35>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i8* @fu_Nread(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = load i8*, i8** %4
%9 = call i32* @fu_Open(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %7
%10 = load i32*, i32** %7
%11 = icmp eq i32* null, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store i8* null, i8** %3
br label %20
13: ; preds = %2
%14 = load i32*, i32** %7
%15 = load i32, i32* %5
%16 = call i8* @fu_Fnread(i32* %14, i32 %15)
store i8* %16, i8** %6
%17 = load i32*, i32** %7
%18 = call i32 @fu_Close(i32* %17)
%19 = load i8*, i8** %6
store i8* %19, i8** %3
br label %20
20: ; preds = %13, %12
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i8* @fu_Nread(i8* %0, i32 %1) {
%3 = tail call i32* @fu_Open(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i8* @fu_Fnread(i32* %3, i32 %1)
%7 = tail call i32 @fu_Close(i32* %3)
br label %8
8: ; preds = %2, %5
%9 = phi i8* [ %6, %5 ], [ null, %2 ]
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ example1();
void main(void) { example1(); }


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

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

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @example1()
ret void
}
void fatsay(s) char const *s;
{ startsay(s, ""); }


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

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @fatsay(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @startsay to i32 (i8*, i8*, ...)*)(i8* %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @fatsay(i8* %0) {
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @startsay to i32 (i8*, i8*, ...)*)(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}