xunge/DecIR huggingface dataset:
int bin_search(int a[], int start, int end, int k) {
  for (int i = start; i <= end; i++) {
    if (a[i] > k) {
      return i;
    }
  }
}


x86 assembly (clang, -O0):
<bin_search>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1155 <bin_search+0x55>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x1c(%rbp),%eax
jle    1142 <bin_search+0x42>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1155 <bin_search+0x55>
jmp    1147 <bin_search+0x47>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1117 <bin_search+0x17>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_search>:
mov    %esi,%eax
cmp    %edx,%esi
jg     1121 <bin_search+0x21>
movslq %eax,%rsi
add    $0x1,%edx
lea    (%rdi,%rsi,4),%rsi
cmp    %ecx,(%rsi)
jg     1121 <bin_search+0x21>
add    $0x1,%eax
add    $0x4,%rsi
cmp    %eax,%edx
jne    1110 <bin_search+0x10>
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @bin_search(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%11 = load i32, i32* %7
store i32 %11, i32* %10
br label %12
12: ; preds = %27, %4
%13 = load i32, i32* %10
%14 = load i32, i32* %8
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %30
16: ; preds = %12
%17 = load i32*, i32** %6
%18 = load i32, i32* %10
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %9
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %16
%25 = load i32, i32* %10
store i32 %25, i32* %5
br label %30
26: ; preds = %16
br label %27
27: ; preds = %26
%28 = load i32, i32* %10
%29 = add nsw i32 %28, 1
store i32 %29, i32* %10
br label %12
30: ; preds = %24, %12
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
define i32 @bin_search(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %1, %2
br i1 %5, label %20, label %6
6: ; preds = %4
%7 = sext i32 %1 to i64
%8 = add i32 %2, 1
br label %9
9: ; preds = %6, %14
%10 = phi i64 [ %7, %6 ], [ %15, %14 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = icmp sgt i32 %12, %3
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = add nsw i64 %10, 1
%16 = trunc i64 %15 to i32
%17 = icmp eq i32 %8, %16
br i1 %17, label %20, label %9
18: ; preds = %9
%19 = trunc i64 %10 to i32
br label %20
20: ; preds = %14, %18, %4
%21 = phi i32 [ %1, %4 ], [ %19, %18 ], [ %8, %14 ]
ret i32 %21
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void and_reg64_imm32(int reg64, unsigned int imm32) {
  put8(0x48);
  put8(0x81);
  put8(0xE0 + reg64);
  put32(imm32);
}


x86 assembly (clang, -O0):
<and_reg64_imm32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x48,%edi
call   1030 <put8@plt>
mov    $0x81,%edi
call   1030 <put8@plt>
mov    -0x4(%rbp),%edi
add    $0xe0,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%edi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<and_reg64_imm32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x48,%edi
call   1030 <put8@plt>
mov    $0x81,%edi
call   1030 <put8@plt>
add    $0xe0,%ebp
mov    %ebp,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @and_reg64_imm32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @put8(i32 72)
%6 = call i32 @put8(i32 129)
%7 = load i32, i32* %3
%8 = add nsw i32 224, %7
%9 = call i32 @put8(i32 %8)
%10 = load i32, i32* %4
%11 = call i32 @put32(i32 %10)
ret void
}

LLVM IR (-O2):
define void @and_reg64_imm32(i32 %0, i32 %1) {
%3 = tail call i32 @put8(i32 72)
%4 = tail call i32 @put8(i32 129)
%5 = add nsw i32 %0, 224
%6 = tail call i32 @put8(i32 %5)
%7 = tail call i32 @put32(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ read_cr3();
int /*<<< orphan*/ write_cr3(int /*<<< orphan*/);
void tlb_flush_all(void) { write_cr3(read_cr3()); }


x86 assembly (clang, -O0):
<tlb_flush_all>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <read_cr3@plt>
mov    %eax,%edi
call   1030 <write_cr3@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tlb_flush_all>:
push   %rax
xor    %eax,%eax
call   1040 <read_cr3@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <write_cr3@plt>

LLVM IR (-O0):
define void @tlb_flush_all() {
%1 = call i32 (...) @read_cr3()
%2 = call i32 @write_cr3(i32 %1)
ret void
}

LLVM IR (-O2):
define void @tlb_flush_all() {
%1 = tail call i32 (...) @read_cr3()
%2 = tail call i32 @write_cr3(i32 %1)
ret void
}
/* Variables and functions */
int getnpar(int /*<<< orphan*/, char *, char *, int *);
int getparint(char *name, int *ptr) { return getnpar(0, name, "i", ptr); }


x86 assembly (clang, -O0):
<getparint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rcx
xor    %edi,%edi
lea    0xecf(%rip),%rdx
call   1030 <getnpar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getparint>:
mov    %rsi,%rcx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdx
xor    %edi,%edi
jmp    1030 <getnpar@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"i\00"
define i32 @getparint(i8* %0, i32* %1) {
%3 = tail call i32 @getnpar(i32 0, i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void script_process_categories_footer() { printf("\t</ul>\n"); }


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

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

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

LLVM IR (-O2):
@str = [7 x i8] c"\09</ul>\00"
define void @script_process_categories_footer() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
void b_smp_unlock(unsigned long ptr) {
  asm volatile("call 0x001001C0" : : "a"(ptr));
}


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

x86 assembly (clang, -O2):
<b_smp_unlock>:
mov    %rdi,%rax
call   1001c0 <completed.0+0xfc1a0>
ret

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

LLVM IR (-O2):
define void @b_smp_unlock(i64 %0) {
tail call void asm sideeffect "call 0x001001C0", "{ax},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret void
}
int native_func() { return 14; }


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

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

LLVM IR (-O0):
define i32 @native_func() {
ret i32 14
}

LLVM IR (-O2):
define i32 @native_func() {
ret i32 14
}
/* Variables and functions */
int printSmiles(int, int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int res = printSmiles(8, 0, 1, 0);
  printf("ops required %d", res);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x8,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <printSmiles@plt>
lea    0xec5(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [16 x i8] c"ops required %d\00"
define void @main() {
%1 = tail call i32 @printSmiles(i32 8, i32 0, i32 1, i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int cap_syslog(int);
int security_syslog(int type) { return cap_syslog(type); }


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

x86 assembly (clang, -O2):
<security_syslog>:
jmp    1030 <cap_syslog@plt>

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

LLVM IR (-O2):
define i32 @security_syslog(i32 %0) {
%2 = tail call i32 @cap_syslog(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ __u64;

/* Variables and functions */
int /*<<< orphan*/ gpiotools_clear_bit(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ gpiotools_set_bit(int /*<<< orphan*/ *, int);
void gpiotools_assign_bit(__u64 *b, int n, bool value) {
  if (value)
    gpiotools_set_bit(b, n);
  else
    gpiotools_clear_bit(b, n);
}


x86 assembly (clang, -O0):
<gpiotools_assign_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     114d <gpiotools_assign_bit+0x2d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <gpiotools_set_bit@plt>
jmp    1159 <gpiotools_assign_bit+0x39>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <gpiotools_clear_bit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpiotools_assign_bit>:
test   %edx,%edx
je     1129 <gpiotools_assign_bit+0x9>
jmp    1030 <gpiotools_set_bit@plt>
jmp    1040 <gpiotools_clear_bit@plt>

LLVM IR (-O0):
define void @gpiotools_assign_bit(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 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32*, i32** %4
%11 = load i32, i32* %5
%12 = call i32 @gpiotools_set_bit(i32* %10, i32 %11)
br label %17
13: ; preds = %3
%14 = load i32*, i32** %4
%15 = load i32, i32* %5
%16 = call i32 @gpiotools_clear_bit(i32* %14, i32 %15)
br label %17
17: ; preds = %13, %9
ret void
}

LLVM IR (-O2):
define void @gpiotools_assign_bit(i32* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @gpiotools_set_bit(i32* %0, i32 %1)
br label %9
7: ; preds = %3
%8 = tail call i32 @gpiotools_clear_bit(i32* %0, i32 %1)
br label %9
9: ; preds = %7, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TSC_DIG_DriverIRQHandler();
__attribute__((weak)) void TSC_DIG_IRQHandler(void) {
  TSC_DIG_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @TSC_DIG_IRQHandler() {
%1 = call i32 (...) @TSC_DIG_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @TSC_DIG_IRQHandler() {
%1 = tail call i32 (...) @TSC_DIG_DriverIRQHandler()
ret void
}
int strCount(char *string, char comp) {
  int i = 0;
  int cnt = 0;
  for (i = 0; string[i] != '\0'; i++)
    if (string[i] == comp)
      cnt++;
  return cnt;
}


x86 assembly (clang, -O0):
<strCount>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     116c <strCount+0x6c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1159 <strCount+0x59>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115e <strCount+0x5e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <strCount+0x23>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strCount>:
mov    (%rdi),%cl
test   %cl,%cl
je     1126 <strCount+0x26>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
xor    %edx,%edx
cmp    %sil,%cl
sete   %dl
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <strCount+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strCount(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %12, %5 ], [ 0, %2 ]
%7 = phi i8 [ %14, %5 ], [ %3, %2 ]
%8 = phi i32 [ %11, %5 ], [ 0, %2 ]
%9 = icmp eq i8 %7, %1
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %8, %10
%12 = add nuw nsw i64 %6, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %11, %5 ]
ret i32 %17
}
int LZ4_sizeofStreamStateHC(void) {
  return (4 * (1 << 15) + 2 * (1 << 17) + 56);
}


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

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

LLVM IR (-O0):
define i32 @LZ4_sizeofStreamStateHC() {
ret i32 393272
}

LLVM IR (-O2):
define i32 @LZ4_sizeofStreamStateHC() {
ret i32 393272
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void dictGeneralDestructor(void *privdata, void *val) {
  ((void)privdata);
  free(val);
}


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

x86 assembly (clang, -O2):
<dictGeneralDestructor>:
mov    %rsi,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @dictGeneralDestructor(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 = load i8*, i8** %4
%7 = call i32 @free(i8* %6)
ret void
}

LLVM IR (-O2):
define void @dictGeneralDestructor(i8* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i32 @free(i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int i;
  for (i = 0; i < 10; i++) {
    printf("hello\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    114a <main+0x3a>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"hello\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %8, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %3
11: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int fun442() { return 442; }


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

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

LLVM IR (-O0):
define i32 @fun442() {
ret i32 442
}

LLVM IR (-O2):
define i32 @fun442() {
ret i32 442
}
void XtSetSelectionParameters() {}


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

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

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

LLVM IR (-O2):
define void @XtSetSelectionParameters() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ f(int *);
int /*<<< orphan*/ free(int *);
int *malloc(int);
int main(int argc, char *argv[]) {
  int *stuff;
  stuff = malloc(sizeof(int));
  *stuff = 5;
  f(stuff);
  assert(6 == *stuff);
  *stuff = 1;
  assert(1 == *stuff);
  free(stuff);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x18(%rbp),%rdi
call   1040 <f@plt>
mov    -0x18(%rbp),%rcx
mov    $0x6,%eax
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rcx
mov    $0x1,%eax
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
movl   $0x5,(%rax)
mov    %rax,%rdi
call   1040 <f@plt>
xor    %edi,%edi
cmpl   $0x6,(%rbx)
sete   %dil
call   1050 <assert@plt>
movl   $0x1,(%rbx)
mov    $0x1,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32* @malloc(i32 4)
store i32* %7, i32** %6
%8 = load i32*, i32** %6
store i32 5, i32* %8
%9 = load i32*, i32** %6
%10 = call i32 @f(i32* %9)
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = icmp eq i32 6, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i32*, i32** %6
store i32 1, i32* %16
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = icmp eq i32 1, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32*, i32** %6
%23 = call i32 @free(i32* %22)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @malloc(i32 4)
store i32 5, i32* %3
%4 = tail call i32 @f(i32* %3)
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 6
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
store i32 1, i32* %3
%9 = tail call i32 @assert(i32 1)
%10 = tail call i32 @free(i32* %3)
ret i32 0
}
int test_imm_E8int32_mem(int *val) {
  return ((*val) & (0xE8 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E8int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 232
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int comp(const void *x, const void *y) { return *(int *)y - *(int *)x; }


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

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

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

LLVM IR (-O2):
define i32 @comp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
char *strcpy(register char *to, register const char *from) {
  register char *ret = to;
  while ((*to++ = *from++) != '\0')
    continue;
  return ret;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
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
je     1147 <strcpy+0x47>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
int setgid(g) { return (0); }


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

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

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

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

/* Variables and functions */
uint32_t ident32(uint32_t x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @ident32(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ print_hex(char *);
int /*<<< orphan*/ putchar(char);
int main(int argc, char *argv[]) {
  int i;
  for (i = 1; i < argc; i++) {
    print_hex(argv[i]);
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1172 <main+0x52>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <print_hex@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jl     115c <main+0x3c>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1040 <print_hex@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 1, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @print_hex(i8* %9)
%11 = tail call i32 @putchar(i8 signext 10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret i32 0
}
void j(void) {
  extern struct u5 { int q; };
}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fputc_err(unsigned short, int /*<<< orphan*/ *);
void WriteWORDBE(FILE *outf, unsigned short data) {
  (assert(outf != NULL));
  fputc_err(data >> 8, outf);
  fputc_err(data & 0xFF, outf);
}


x86 assembly (clang, -O0):
<WriteWORDBE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movzwl -0xa(%rbp),%eax
sar    $0x8,%eax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc_err@plt>
movzwl -0xa(%rbp),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc_err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteWORDBE>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %ebp,%edi
shr    $0x8,%edi
mov    %rbx,%rsi
call   1040 <fputc_err@plt>
movzbl %bpl,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fputc_err@plt>

LLVM IR (-O0):
define void @WriteWORDBE(i32* %0, i16 zeroext %1) {
%3 = alloca i32*
%4 = alloca i16
store i32* %0, i32** %3
store i16 %1, i16* %4
%5 = load i32*, i32** %3
%6 = icmp ne i32* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i16, i16* %4
%10 = zext i16 %9 to i32
%11 = ashr i32 %10, 8
%12 = trunc i32 %11 to i16
%13 = load i32*, i32** %3
%14 = call i32 @fputc_err(i16 zeroext %12, i32* %13)
%15 = load i16, i16* %4
%16 = zext i16 %15 to i32
%17 = and i32 %16, 255
%18 = trunc i32 %17 to i16
%19 = load i32*, i32** %3
%20 = call i32 @fputc_err(i16 zeroext %18, i32* %19)
ret void
}

LLVM IR (-O2):
define void @WriteWORDBE(i32* %0, i16 zeroext %1) {
%3 = icmp ne i32* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = lshr i16 %1, 8
%7 = tail call i32 @fputc_err(i16 zeroext %6, i32* %0)
%8 = and i16 %1, 255
%9 = tail call i32 @fputc_err(i16 zeroext %8, i32* %0)
ret void
}
char *sw_strcpy(char *dest, char *src) {
  while (*src != '\0') {
    *dest++ = *src++;
  }
  *dest = '\0';
  return dest;
}


x86 assembly (clang, -O0):
<sw_strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1143 <sw_strcpy+0x43>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    110c <sw_strcpy+0xc>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sw_strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1121 <sw_strcpy+0x21>
add    $0x1,%rsi
nopl   (%rax)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <sw_strcpy+0x10>
movb   $0x0,(%rax)
ret

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

LLVM IR (-O2):
define i8* @sw_strcpy(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret i8* %14
}
/* Variables and functions */
long fatorial(long);
int /*<<< orphan*/ printf(char *, long, long);
int main(void) {
  long n = 5L;
  long f = fatorial(n);
  printf("N=%li, F=%li\n", n, f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x5,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fatorial@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1040 <fatorial@plt>
lea    0xece(%rip),%rdi
mov    $0x5,%esi
mov    %rax,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"N=%li, F=%li\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 5, i64* %2
%4 = load i64, i64* %2
%5 = call i64 @fatorial(i64 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %2
%7 = load i64, i64* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %6, i64 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"N=%li, F=%li\0A\00"
define i32 @main() {
%1 = tail call i64 @fatorial(i64 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 5, i64 %1)
ret i32 0
}
/* Variables and functions */
int pow(int, double);
int f(int a) {
  int g = pow(a, 0.75);
  return g;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
movsd  0xeda(%rip),%xmm0
call   1030 <pow@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movsd  0xee8(%rip),%xmm0
jmp    1030 <pow@plt>

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @pow(i32 %4, double 7.500000e-01)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = tail call i32 @pow(i32 %0, double 7.500000e-01)
ret i32 %2
}
void GPMCAddrDataMuxProtocolSelect(unsigned int baseAddr, unsigned int csNum,
                                   unsigned int protocol) {
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) &=
      ~(0x00000300u);
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) |=
      ((protocol << (0x00000008u)) & (0x00000300u));
}


x86 assembly (clang, -O0):
<GPMCAddrDataMuxProtocolSelect>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
imul   $0x30,-0x8(%rbp),%ecx
add    $0x60,%ecx
add    %ecx,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfffffcff,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edx
shl    $0x8,%edx
and    $0x300,%edx
mov    -0x4(%rbp),%eax
imul   $0x30,-0x8(%rbp),%ecx
add    $0x60,%ecx
add    %ecx,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPMCAddrDataMuxProtocolSelect>:
lea    (%rsi,%rsi,2),%eax
shl    $0x4,%eax
add    %edi,%eax
add    $0x60,%eax
andl   $0xfffffcff,(%rax)
and    $0x3,%edx
shl    $0x8,%edx
or     %edx,(%rax)
ret

LLVM IR (-O0):
define void @GPMCAddrDataMuxProtocolSelect(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 = mul i32 %8, 48
%10 = add i32 96, %9
%11 = add i32 %7, %10
%12 = zext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, -769
store volatile i32 %15, i32* %13
%16 = load i32, i32* %6
%17 = shl i32 %16, 8
%18 = and i32 %17, 768
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = mul i32 %20, 48
%22 = add i32 96, %21
%23 = add i32 %19, %22
%24 = zext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = or i32 %26, %18
store volatile i32 %27, i32* %25
ret void
}

LLVM IR (-O2):
define void @GPMCAddrDataMuxProtocolSelect(i32 %0, i32 %1, i32 %2) {
%4 = mul i32 %1, 48
%5 = add i32 %0, 96
%6 = add i32 %5, %4
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -769
store volatile i32 %10, i32* %8
%11 = shl i32 %2, 8
%12 = and i32 %11, 768
%13 = load volatile i32, i32* %8
%14 = or i32 %13, %12
store volatile i32 %14, i32* %8
ret void
}
unsigned ShrTest1(unsigned X, unsigned C1, unsigned C2) {
  return (X >> C1) & C2;
}


x86 assembly (clang, -O0):
<ShrTest1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
and    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShrTest1>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    %edx,%eax
ret

LLVM IR (-O0):
define i32 @ShrTest1(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 = lshr i32 %7, %8
%10 = load i32, i32* %6
%11 = and i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @ShrTest1(i32 %0, i32 %1, i32 %2) {
%4 = lshr i32 %0, %1
%5 = and i32 %4, %2
ret i32 %5
}
void b() {
  int i = 9;
  (void)(i);
}


x86 assembly (clang, -O0):
<b>:
push   %rbp
mov    %rsp,%rbp
movl   $0x9,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @b() {
%1 = alloca i32
store i32 9, i32* %1
%2 = load i32, i32* %1
ret void
}

LLVM IR (-O2):
define void @b() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cannotBeUnlocked(void) { printf("That cannot be unlocked.\n"); }


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

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

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

LLVM IR (-O2):
@str = [25 x i8] c"That cannot be unlocked.\00"
define void @cannotBeUnlocked() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
int sys_waitpid(tcp)
struct tcb *tcp;
{
  return printwaitn(tcp, 3);
}


x86 assembly (clang, -O0):
<sys_waitpid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <printwaitn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_waitpid>:
mov    $0x3,%esi
xor    %eax,%eax
jmp    1030 <printwaitn@plt>

LLVM IR (-O0):
%struct.tcb = type opaque
define i32 @sys_waitpid(%struct.tcb* %0) {
%2 = alloca %struct.tcb*
store %struct.tcb* %0, %struct.tcb** %2
%3 = load %struct.tcb*, %struct.tcb** %2
%4 = call i32 (%struct.tcb*, i32, ...) bitcast (i32 (...)* @printwaitn to i32 (%struct.tcb*, i32, ...)*)(%struct.tcb* %3, i32 3)
ret i32 %4
}

LLVM IR (-O2):
%struct.tcb = type opaque
define i32 @sys_waitpid(%struct.tcb* %0) {
%2 = tail call i32 (%struct.tcb*, i32, ...) bitcast (i32 (...)* @printwaitn to i32 (%struct.tcb*, i32, ...)*)(%struct.tcb* %0, i32 3)
ret i32 %2
}
/* Type definitions */
struct ipr_ioa {
  int dummy;
};

/* Variables and functions */
int ipr_stop_array(struct ipr_ioa *, char *, int /*<<< orphan*/);
int ipr_stop_array_protection(struct ipr_ioa *ioa) {
  return ipr_stop_array(ioa, "Stop Array Protection", 0);
}


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

x86 assembly (clang, -O2):
<ipr_stop_array_protection>:
lea    0xee9(%rip),%rsi
xor    %edx,%edx
jmp    1030 <ipr_stop_array@plt>

LLVM IR (-O0):
%struct.ipr_ioa = type { i32 }
@.str = [22 x i8] c"Stop Array Protection\00"
define i32 @ipr_stop_array_protection(%struct.ipr_ioa* %0) {
%2 = alloca %struct.ipr_ioa*
store %struct.ipr_ioa* %0, %struct.ipr_ioa** %2
%3 = load %struct.ipr_ioa*, %struct.ipr_ioa** %2
%4 = call i32 @ipr_stop_array(%struct.ipr_ioa* %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 %4
}

LLVM IR (-O2):
%struct.ipr_ioa = type { i32 }
@.str = [22 x i8] c"Stop Array Protection\00"
define i32 @ipr_stop_array_protection(%struct.ipr_ioa* %0) {
%2 = tail call i32 @ipr_stop_array(%struct.ipr_ioa* %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 %2
}
int f() { return 5; }


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

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

LLVM IR (-O0):
define i32 @f() {
ret i32 5
}

LLVM IR (-O2):
define i32 @f() {
ret i32 5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long, unsigned long);
long ret_long(long a, long b) {
  long ret = a + b;
  unsigned long *ul;
  ul = (unsigned long *)&ret;
  printf("// return %ld, %lX\n", ret, *ul);
  return ret;
}


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

x86 assembly (clang, -O2):
<ret_long>:
push   %rbx
lea    (%rsi,%rdi,1),%rbx
lea    0xee4(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"// return %ld, %lX\0A\00"
define i64 @ret_long(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64*
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = add nsw i64 %7, %8
store i64 %9, i64* %5
store i64* %5, i64** %6
%10 = load i64, i64* %5
%11 = load i64*, i64** %6
%12 = load i64, i64* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %10, i64 %12)
%14 = load i64, i64* %5
ret i64 %14
}

LLVM IR (-O2):
@.str = [20 x i8] c"// return %ld, %lX\0A\00"
define i64 @ret_long(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %3, i64 %3)
ret i64 %3
}
int GoogleHotwordDspProcess(const void *samples, int num_samples,
                            int *preamble_length_ms) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @GoogleHotwordDspProcess(i8* nocapture readnone %0, i32 %1, i32* nocapture readnone %2) {
ret i32 0
}
int g(char *x) {
  asm("g_label: .globl g_label");
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @g(i8* nocapture readnone %0) {
tail call void asm sideeffect "g_label: .globl g_label", "~{dirflag},~{fpsr},~{flags}"()
ret i32 0
}
/* Type definitions */
struct tm {
  double tm_hour;
  double tm_min;
  double tm_sec;
};

/* Variables and functions */
double tm_to_beats(struct tm *t) {
  double beats;
  beats = t->tm_hour * (1000.0 / 24.0) + t->tm_min * (1000.0 / (24.0 * 60.0)) +
          t->tm_sec * (1000.0 / (24.0 * 60.0 * 60.0));
  return beats;
}


x86 assembly (clang, -O0):
<tm_to_beats>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0xef4(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
movsd  0xedf(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  0xebe(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tm_to_beats>:
movsd  0x8(%rdi),%xmm0
mulsd  0xef3(%rip),%xmm0
movsd  (%rdi),%xmm1
mulsd  0xeef(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  0xee6(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.tm = type { double, double, double }
define double @tm_to_beats(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca double
store %struct.tm* %0, %struct.tm** %2
%4 = load %struct.tm*, %struct.tm** %2
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
%6 = load double, double* %5
%7 = load %struct.tm*, %struct.tm** %2
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%9 = load double, double* %8
%10 = fmul double %9, 0x3FE638E38E38E38E
%11 = call double @llvm.fmuladd.f64(double %6, double 0x4044D55555555555, double %10)
%12 = load %struct.tm*, %struct.tm** %2
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 2
%14 = load double, double* %13
%15 = call double @llvm.fmuladd.f64(double %14, double 0x3F87B425ED097B42, double %11)
store double %15, double* %3
%16 = load double, double* %3
ret double %16
}

LLVM IR (-O2):
%struct.tm = type { double, double, double }
define double @tm_to_beats(%struct.tm* nocapture %0) {
%2 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%3 = load double, double* %2
%4 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%5 = load double, double* %4
%6 = fmul double %5, 0x3FE638E38E38E38E
%7 = tail call double @llvm.fmuladd.f64(double %3, double 0x4044D55555555555, double %6)
%8 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%9 = load double, double* %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3F87B425ED097B42, double %7)
ret double %10
}