xunge/DecIR huggingface dataset:
long square(long x) { return x * x; }


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

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

LLVM IR (-O0):
define i64 @square(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* %2
%5 = mul nsw i64 %3, %4
ret i64 %5
}

LLVM IR (-O2):
define i64 @square(i64 %0) {
%2 = mul nsw i64 %0, %0
ret i64 %2
}
void g(int *p) {
  extern void f(void *);
  void *q = __builtin_alloca(p);
  f(q);
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
sub    %rcx,%rax
mov    %rax,%rsp
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <f@plt>
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    %rsp,%rax
add    $0xf,%rdi
and    $0xfffffffffffffff0,%rdi
sub    %rdi,%rax
mov    %rax,%rsp
mov    %rax,%rdi
call   1030 <f@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
define void @g(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = ptrtoint i32* %4 to i64
%6 = alloca i8, i64 %5
store i8* %6, i8** %3
%7 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
define void @g(i32* %0) {
%2 = ptrtoint i32* %0 to i64
%3 = alloca i8, i64 %2
ret void
}
void X509_NAME_ENTRY_create_by_OBJ(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_NAME_ENTRY_create_by_OBJ() {
ret void
}
int pcps_sigthreadinit(int sig) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @pcps_sigthreadinit(i32 %0) {
ret i32 0
}
/* Variables and functions */
void *memmove_fixme(void *s1, const void *s2, size_t n) {
  if (n-- == 0)
    return 0;
  if (s1 > s2) {
  } else {
  }
  return s1;
}


x86 assembly (clang, -O0):
<memmove_fixme>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
jne    1136 <memmove_fixme+0x36>
movq   $0x0,-0x8(%rbp)
jmp    1156 <memmove_fixme+0x56>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1149 <memmove_fixme+0x49>
jmp    114e <memmove_fixme+0x4e>
jmp    114e <memmove_fixme+0x4e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memmove_fixme>:
mov    %rdi,%rax
test   %rdx,%rdx
cmove  %rdx,%rax
ret

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

LLVM IR (-O2):
define i8* @memmove_fixme(i8* readnone %0, i8* nocapture readnone %1, i64 %2) {
%4 = icmp eq i64 %2, 0
%5 = select i1 %4, i8* null, i8* %0
ret i8* %5
}
extern void __outl_p(unsigned int value, unsigned short port) {
  __asm__ __volatile__("out"
                       "l"
                       " %"
                       "0,%"
                       "w"
                       "1"
                       :
                       : "a"(value), "d"(port));
  __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:");
}


x86 assembly (clang, -O0):
<__outl_p>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x6(%rbp),%dx
out    %eax,(%dx)
jmp    111b <__outl_p+0x1b>
jmp    1120 <__outl_p+0x20>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__outl_p>:
mov    %esi,%edx
mov    %edi,%eax
out    %eax,(%dx)
jmp    1107 <__outl_p+0x7>
jmp    1109 <__outl_p+0x9>
ret

LLVM IR (-O0):
define void @__outl_p(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 = load i16, i16* %4
ret void
}

LLVM IR (-O2):
define void @__outl_p(i32 %0, i16 zeroext %1) {
tail call void asm sideeffect "outl $0,${1:w}", "{ax},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0, i16 %1)
tail call void asm sideeffect "jmp 1f\0A1:\09jmp 1f\0A1:", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
char *hideemail_begin_document(void *userdata, const char *options,
                               char *error_message) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @hideemail_begin_document(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
ret i8* null
}
unsigned xrop3_100_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = T | S;
  stk2 = D & stk3;
  stk1 = S ^ stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
or     %edi,%esi
not    %eax
and    %esi,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_100_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = or i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %5
%27 = load i32, i32* %10
%28 = and i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %6
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = load i32, i32* %6
%34 = xor i32 %33, -1
%35 = and i32 %32, %34
%36 = load i32, i32* %5
%37 = load i32, i32* %6
%38 = and i32 %36, %37
%39 = or i32 %35, %38
ret i32 %39
}

LLVM IR (-O2):
define i32 @xrop3_100_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = or i8 %1, %0
%6 = zext i8 %5 to i32
%7 = xor i32 %4, -1
%8 = and i32 %6, %7
%9 = or i32 %8, %3
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int print(int i) {
  printf("the data is %d \n", i);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"the data is %d \0A\00"
define i32 @print(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"the data is %d \0A\00"
define i32 @print(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ initialize_gdt();
int /*<<< orphan*/ initialize_intr_trap_table();
int /*<<< orphan*/ print_nl();
int /*<<< orphan*/ print_str_nl(char *);
int /*<<< orphan*/ test_interrupts();
int /*<<< orphan*/ test_multiboot(void *);
int /*<<< orphan*/ test_print();
int /*<<< orphan*/ test_registers();
__attribute__((__noreturn__)) void kmain(void *mb_info) {
  initialize_gdt();
  initialize_intr_trap_table();
  test_print();
  test_registers();
  test_multiboot(mb_info);
  test_interrupts();
  print_nl();
  print_str_nl("SUCCESS");
  abort();
}


x86 assembly (clang, -O0):
<kmain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   10b0 <initialize_gdt@plt>
mov    $0x0,%al
call   1050 <initialize_intr_trap_table@plt>
mov    $0x0,%al
call   10a0 <test_print@plt>
mov    $0x0,%al
call   1080 <test_registers@plt>
mov    -0x8(%rbp),%rdi
call   1090 <test_multiboot@plt>
mov    $0x0,%al
call   1070 <test_interrupts@plt>
mov    $0x0,%al
call   1040 <print_nl@plt>
lea    0xe2a(%rip),%rdi
call   1060 <print_str_nl@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<kmain>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   10b0 <initialize_gdt@plt>
xor    %eax,%eax
call   1050 <initialize_intr_trap_table@plt>
xor    %eax,%eax
call   10a0 <test_print@plt>
xor    %eax,%eax
call   1080 <test_registers@plt>
mov    %rbx,%rdi
call   1090 <test_multiboot@plt>
xor    %eax,%eax
call   1070 <test_interrupts@plt>
xor    %eax,%eax
call   1040 <print_nl@plt>
lea    0xe33(%rip),%rdi
call   1060 <print_str_nl@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"SUCCESS\00"
define void @kmain(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @initialize_gdt()
%4 = call i32 (...) @initialize_intr_trap_table()
%5 = call i32 (...) @test_print()
%6 = call i32 (...) @test_registers()
%7 = load i8*, i8** %2
%8 = call i32 @test_multiboot(i8* %7)
%9 = call i32 (...) @test_interrupts()
%10 = call i32 (...) @print_nl()
%11 = call i32 @print_str_nl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"SUCCESS\00"
define void @kmain(i8* %0) {
%2 = tail call i32 (...) @initialize_gdt()
%3 = tail call i32 (...) @initialize_intr_trap_table()
%4 = tail call i32 (...) @test_print()
%5 = tail call i32 (...) @test_registers()
%6 = tail call i32 @test_multiboot(i8* %0)
%7 = tail call i32 (...) @test_interrupts()
%8 = tail call i32 (...) @print_nl()
%9 = tail call i32 @print_str_nl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 (...) @abort()
unreachable
}
void foo_2_2_1_2_2_1_2_2_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_1_2_2_1_2_2_2() {
ret void
}
char unescapeByte(char charToUnescape) { return charToUnescape ^ 0x20; }


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

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

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

LLVM IR (-O2):
define signext i8 @unescapeByte(i8 signext %0) {
%2 = xor i8 %0, 32
ret i8 %2
}
float fabsf(float x) {
  float res;
  asm("fabs;" : "=t"(res) : "0"(x));
  return res;
}


x86 assembly (clang, -O0):
<fabsf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
flds   -0xc(%rbp)
fabs
fstps  -0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabsf>:
movss  %xmm0,-0x4(%rsp)
flds   -0x4(%rsp)
fabs
fstps  -0x8(%rsp)
movss  -0x8(%rsp),%xmm0
ret

LLVM IR (-O0):
define float @fabsf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = call float asm "fabs;", "={st},0,~{dirflag},~{fpsr},~{flags}"(float %4)
store float %5, float* %3
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
define float @fabsf(float %0) {
%2 = tail call float asm "fabs;", "={st},0,~{dirflag},~{fpsr},~{flags}"(float %0)
ret float %2
}
void os_setcolour(int colour, int index) {}


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

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

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

LLVM IR (-O2):
define void @os_setcolour(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int sprintf(char *, char *, int, int);
int ssds_field_type(int fd, int class_num, int field_num, char *sp) {
  int ret;
  ret = sprintf(sp, "FTYPE%d", class_num, field_num);
  return ret;
}


x86 assembly (clang, -O0):
<ssds_field_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeca(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssds_field_type>:
mov    %edx,%eax
mov    %esi,%edx
lea    0xee5(%rip),%rsi
mov    %rcx,%rdi
mov    %eax,%ecx
jmp    1030 <sprintf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"FTYPE%d\00"
define i32 @ssds_field_type(i32 %0, i32 %1, i32 %2, i8* nocapture writeonly %3) {
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ wStackPopString();
char *wStringChar(int /*<<< orphan*/);
char *wStackPopChar() { return wStringChar(wStackPopString()); }


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

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

LLVM IR (-O0):
define i8* @wStackPopChar() {
%1 = call i32 (...) @wStackPopString()
%2 = call i8* @wStringChar(i32 %1)
ret i8* %2
}

LLVM IR (-O2):
define i8* @wStackPopChar() {
%1 = tail call i32 (...) @wStackPopString()
%2 = tail call i8* @wStringChar(i32 %1)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ usleep(int);
void *child_function(void *arg) {
  while (1) {
    usleep(1);
  }
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<child_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <usleep@plt>
jmp    111c <child_function+0xc>

x86 assembly (clang, -O2):
<child_function>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <usleep@plt>
jmp    1120 <child_function+0x10>

LLVM IR (-O0):
define i8* @child_function(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 @usleep(i32 1)
br label %3
}

LLVM IR (-O2):
define noalias i8* @child_function(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @usleep(i32 1)
br label %2
}
/* Type definitions */
struct dirent {
  int /*<<< orphan*/ d_name;
};

/* Variables and functions */
int /*<<< orphan*/ *strstr(int /*<<< orphan*/, char *);
int selector(const struct dirent *dp) {
  if (strstr(dp->d_name, ".fa") == NULL) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<selector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    0xed7(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
jne    1144 <selector+0x34>
movl   $0x0,-0x4(%rbp)
jmp    114b <selector+0x3b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<selector>:
push   %rax
mov    (%rdi),%edi
lea    0xee6(%rip),%rsi
call   1030 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
@.str = [4 x i8] c".fa\00"
define i32 @selector(%struct.dirent* %0) {
%2 = alloca i32
%3 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %3
%4 = load %struct.dirent*, %struct.dirent** %3
%5 = getelementptr inbounds %struct.dirent, %struct.dirent* %4, i32 0, i32 0
%6 = load i32, i32* %5
%7 = call i32* @strstr(i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %11
10: ; preds = %1
store i32 1, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@.str = [4 x i8] c".fa\00"
define i32 @selector(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i32* @strstr(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
ret i32 %6
}
void foo() { static int wxyz = 42; }


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

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

LLVM IR (-O0):
@foo.wxyz = internal global i32 42
define void @foo() {
ret void
}

LLVM IR (-O2):
define void @foo() {
ret void
}
/* Variables and functions */
void *SearchInstanceNewEx(int);
void *SearchInstanceNew(void) { return SearchInstanceNewEx(10); }


x86 assembly (clang, -O0):
<SearchInstanceNew>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <SearchInstanceNewEx@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @SearchInstanceNew() {
%1 = call i8* @SearchInstanceNewEx(i32 10)
ret i8* %1
}

LLVM IR (-O2):
define i8* @SearchInstanceNew() {
%1 = tail call i8* @SearchInstanceNewEx(i32 10)
ret i8* %1
}
unsigned long string_hash(void *string) {
  unsigned long result = 5381;
  unsigned char *p;
  p = (unsigned char *)string;
  while (*p != '\0') {
    result = ((result << 5) ^ result) ^ (*p);
    ++p;
  }
  return result;
}


x86 assembly (clang, -O0):
<string_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     1153 <string_hash+0x53>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
xor    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movzbl (%rcx),%ecx
xor    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <string_hash+0x18>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <string_hash+0x2c>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
xor    %rax,%rdx
movzbl %cl,%eax
xor    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <string_hash+0x10>
ret
mov    $0x1505,%eax
ret

LLVM IR (-O0):
define i64 @string_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
store i64 5381, i64* %3
%5 = load i8*, i8** %2
store i8* %5, i8** %4
br label %6
6: ; preds = %11, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %6
%12 = load i64, i64* %3
%13 = shl i64 %12, 5
%14 = load i64, i64* %3
%15 = xor i64 %13, %14
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = zext i8 %17 to i64
%19 = xor i64 %15, %18
store i64 %19, i64* %3
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
br label %6
22: ; preds = %6
%23 = load i64, i64* %3
ret i64 %23
}

LLVM IR (-O2):
define i64 @string_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %13, %4 ], [ %2, %1 ]
%6 = phi i8* [ %12, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = shl i64 %7, 5
%9 = xor i64 %8, %7
%10 = zext i8 %5 to i64
%11 = xor i64 %9, %10
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %16
}
/* Variables and functions */
double umath_double_asin(double);
double umath_double_acos(double x) {
  return ((3.14159265) / 2) - umath_double_asin(x);
}


x86 assembly (clang, -O0):
<umath_double_acos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <umath_double_asin@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umath_double_acos>:
push   %rax
call   1030 <umath_double_asin@plt>
movsd  0xee2(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @umath_double_acos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @umath_double_asin(double %3)
%5 = fsub double 0x3FF921FB53C8D4F1, %4
ret double %5
}

LLVM IR (-O2):
define double @umath_double_acos(double %0) {
%2 = tail call double @umath_double_asin(double %0)
%3 = fsub double 0x3FF921FB53C8D4F1, %2
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ find_files(char *, char *);
char *next_value(char *);
int /*<<< orphan*/ printf(char *);
void cmd_find(char *cmd, char *args) {
  char *dir = next_value(args);
  if (!args[0] || !dir[0]) {
    printf("Usage: find <filename> <directory>\n");
    return;
  }
  find_files(dir, args);
}


x86 assembly (clang, -O0):
<cmd_find>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <next_value@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1167 <cmd_find+0x37>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1178 <cmd_find+0x48>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
jmp    1185 <cmd_find+0x55>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <find_files@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_find>:
push   %rbx
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1040 <next_value@plt>
cmpb   $0x0,(%rbx)
je     1152 <cmd_find+0x22>
cmpb   $0x0,(%rax)
je     1152 <cmd_find+0x22>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1050 <find_files@plt>
lea    0xea7(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Usage: find <filename> <directory>\0A\00"
define void @cmd_find(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** %4
%7 = call i8* @next_value(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = icmp ne i8 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %12, %2
%18 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %23
19: ; preds = %12
%20 = load i8*, i8** %5
%21 = load i8*, i8** %4
%22 = call i32 @find_files(i8* %20, i8* %21)
br label %23
23: ; preds = %19, %17
ret void
}

LLVM IR (-O2):
@str = [35 x i8] c"Usage: find <filename> <directory>\00"
define void @cmd_find(i8* nocapture readnone %0, i8* %1) {
%3 = tail call i8* @next_value(i8* %1)
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8, i8* %3
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6, %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %13
11: ; preds = %6
%12 = tail call i32 @find_files(i8* %3, i8* %1)
br label %13
13: ; preds = %11, %9
ret void
}
void idle(void) {
  int i;
  for (i = 0; i < 1000000; i++)
    ;
}


x86 assembly (clang, -O0):
<idle>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0xf4240,-0x4(%rbp)
jge    112b <idle+0x2b>
jmp    111d <idle+0x1d>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <idle+0xb>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @idle() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 1000000
br i1 %4, label %5, label %9
5: ; preds = %2
br label %6
6: ; preds = %5
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
br label %2
9: ; preds = %2
ret void
}

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

/* Variables and functions */
int /*<<< orphan*/ BUG();
void yield_task_stop(struct rq *rq) { BUG(); }


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

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

LLVM IR (-O0):
%struct.rq = type { i32 }
define void @yield_task_stop(%struct.rq* %0) {
%2 = alloca %struct.rq*
store %struct.rq* %0, %struct.rq** %2
%3 = call i32 (...) @BUG()
ret void
}

LLVM IR (-O2):
%struct.rq = type { i32 }
define void @yield_task_stop(%struct.rq* nocapture readnone %0) {
%2 = tail call i32 (...) @BUG()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void start_a2(void) { printf("start_a2\n"); }


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

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

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

LLVM IR (-O2):
@str = [9 x i8] c"start_a2\00"
define void @start_a2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct conn_info_st {
  int dummy;
};

/* Variables and functions */
int cmds_after_user(struct conn_info_st *);
scalar_t__ fw_set_user(char const *, struct conn_info_st *);
int fw_user(const char *args, struct conn_info_st *conn_info) {
  if (fw_set_user(args, conn_info) != 0) {
    return (-2);
  }
  return cmds_after_user(conn_info);
}


x86 assembly (clang, -O0):
<fw_user>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <fw_set_user@plt>
cmp    $0x0,%rax
je     1153 <fw_user+0x33>
movl   $0xfffffffe,-0x4(%rbp)
jmp    115f <fw_user+0x3f>
mov    -0x18(%rbp),%rdi
call   1030 <cmds_after_user@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fw_user>:
push   %rbx
mov    %rsi,%rbx
call   1040 <fw_set_user@plt>
test   %rax,%rax
je     1135 <fw_user+0x15>
mov    $0xfffffffe,%eax
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <cmds_after_user@plt>

LLVM IR (-O0):
%struct.conn_info_st = type { i32 }
define i32 @fw_user(i8* %0, %struct.conn_info_st* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.conn_info_st*
store i8* %0, i8** %4
store %struct.conn_info_st* %1, %struct.conn_info_st** %5
%6 = load i8*, i8** %4
%7 = load %struct.conn_info_st*, %struct.conn_info_st** %5
%8 = call i64 @fw_set_user(i8* %6, %struct.conn_info_st* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -2, i32* %3
br label %14
11: ; preds = %2
%12 = load %struct.conn_info_st*, %struct.conn_info_st** %5
%13 = call i32 @cmds_after_user(%struct.conn_info_st* %12)
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %10
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
%struct.conn_info_st = type { i32 }
define i32 @fw_user(i8* %0, %struct.conn_info_st* %1) {
%3 = tail call i64 @fw_set_user(i8* %0, %struct.conn_info_st* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @cmds_after_user(%struct.conn_info_st* %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ -2, %2 ]
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_attr_getstack(int /*<<< orphan*/ *, void **,
                                         size_t *);
int /*<<< orphan*/ pthread_getattr_np(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_self();
void get_stack_size(void **addr, size_t *size) {
  pthread_attr_t attr;
  pthread_getattr_np(pthread_self(), &attr);
  pthread_attr_getstack(&attr, addr, size);
}


x86 assembly (clang, -O0):
<get_stack_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %eax,%edi
lea    -0x14(%rbp),%rsi
call   1030 <pthread_getattr_np@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rdi
call   1040 <pthread_attr_getstack@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_stack_size>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xc(%rsp),%r15
mov    %eax,%edi
mov    %r15,%rsi
call   1030 <pthread_getattr_np@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <pthread_attr_getstack@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @get_stack_size(i8** %0, i64* %1) {
%3 = alloca i8**
%4 = alloca i64*
%5 = alloca i32
store i8** %0, i8*** %3
store i64* %1, i64** %4
%6 = call i32 (...) @pthread_self()
%7 = call i32 @pthread_getattr_np(i32 %6, i32* %5)
%8 = load i8**, i8*** %3
%9 = load i64*, i64** %4
%10 = call i32 @pthread_attr_getstack(i32* %5, i8** %8, i64* %9)
ret void
}

LLVM IR (-O2):
define void @get_stack_size(i8** %0, i64* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (...) @pthread_self()
%6 = call i32 @pthread_getattr_np(i32 %5, i32* %3)
%7 = call i32 @pthread_attr_getstack(i32* %3, i8** %0, i64* %1)
ret void
}
float int_to_float(int i) {
  union {
    int i;
    float f;
  } c;
  c.i = i;
  return c.f;
}


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

x86 assembly (clang, -O2):
<int_to_float>:
movd   %edi,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define float @int_to_float(i32 %0) {
%2 = alloca i32
%3 = alloca %union.anon
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = bitcast %union.anon* %3 to i32*
store i32 %4, i32* %5
%6 = bitcast %union.anon* %3 to float*
%7 = load float, float* %6
ret float %7
}

LLVM IR (-O2):
define float @int_to_float(i32 %0) {
%2 = bitcast i32 %0 to float
ret float %2
}
void f0(int x) {
  int *p = &x;
  if (x > 10) {
    if (x == 22)
      p = 0;
  }
  *p = 10;
}


x86 assembly (clang, -O0):
<f0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0xa,-0x4(%rbp)
jle    1130 <f0+0x30>
cmpl   $0x16,-0x4(%rbp)
jne    112b <f0+0x2b>
movq   $0x0,-0x10(%rbp)
jmp    1130 <f0+0x30>
mov    -0x10(%rbp),%rax
movl   $0xa,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f0>:
xor    %eax,%eax
cmp    $0x16,%edi
lea    -0x4(%rsp),%rcx
cmove  %rax,%rcx
movl   $0xa,(%rcx)
ret

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

LLVM IR (-O2):
define void @f0(i32 %0) {
%2 = alloca i32
%3 = icmp eq i32 %0, 22
%4 = select i1 %3, i32* null, i32* %2
store i32 10, i32* %4
ret void
}
unsigned long str2num(char *str) {
  unsigned long tmpre = 0;
  while (*str != 0) {
    if ((*str >= '0') && (*str <= '9'))
      tmpre = (tmpre * 10) + (*str - '0');
    str++;
  }
  return tmpre;
}


x86 assembly (clang, -O0):
<str2num>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116a <str2num+0x6a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1159 <str2num+0x59>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     1159 <str2num+0x59>
imul   $0xa,-0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
sub    $0x30,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <str2num+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str2num>:
mov    (%rdi),%cl
test   %cl,%cl
je     1134 <str2num+0x34>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%edx
add    $0xd0,%cl
add    $0xffffffd0,%edx
cmp    $0xa,%cl
lea    (%rax,%rax,4),%rcx
lea    (%rdx,%rcx,2),%rcx
cmovb  %rcx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <str2num+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @str2num(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %17, %4 ], [ %2, %1 ]
%6 = phi i64 [ %15, %4 ], [ 0, %1 ]
%7 = phi i8* [ %16, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i64
%9 = add i8 %5, -48
%10 = icmp ult i8 %9, 10
%11 = mul i64 %6, 10
%12 = add nsw i64 %8, 4294967248
%13 = and i64 %12, 4294967295
%14 = add i64 %13, %11
%15 = select i1 %10, i64 %14, i64 %6
%16 = getelementptr inbounds i8, i8* %7, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %4
19: ; preds = %4, %1
%20 = phi i64 [ 0, %1 ], [ %15, %4 ]
ret i64 %20
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_stmt;

/* Variables and functions */
int /*<<< orphan*/ *meta_get(char const *);
scalar_t__ sqlite3_column_text(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sqlite3_finalize(int /*<<< orphan*/ *);
char *strcopy(char const *);
char *db_meta_get_string(const char *key) {
  const char *result;
  sqlite3_stmt *stmt = meta_get(key);
  if (!stmt) {
    return 0;
  }
  result = (const char *)sqlite3_column_text(stmt, 0);
  sqlite3_finalize(stmt);
  return strcopy(result);
}


x86 assembly (clang, -O0):
<db_meta_get_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <meta_get@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1171 <db_meta_get_string+0x31>
movq   $0x0,-0x8(%rbp)
jmp    1196 <db_meta_get_string+0x56>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1040 <sqlite3_column_text@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <sqlite3_finalize@plt>
mov    -0x18(%rbp),%rdi
call   1050 <strcopy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_meta_get_string>:
push   %r14
push   %rbx
push   %rax
call   1030 <meta_get@plt>
test   %rax,%rax
je     1175 <db_meta_get_string+0x35>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   1040 <sqlite3_column_text@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1060 <sqlite3_finalize@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <strcopy@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @db_meta_get_string(i8* %0) {
%2 = tail call i32* @meta_get(i8* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i64 @sqlite3_column_text(i32* %2, i32 0)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @sqlite3_finalize(i32* %2)
%8 = tail call i8* @strcopy(i8* %6)
br label %9
9: ; preds = %1, %4
%10 = phi i8* [ %8, %4 ], [ null, %1 ]
ret i8* %10
}
void colortempRatio(unsigned int v, float *a, float *b) {
  if (v > (8))
    v = (8);
  *a = (v + 1) / 10.0;
  *b = 1.0 - *a;
}


x86 assembly (clang, -O0):
<colortempRatio>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x8,-0x4(%rbp)
jbe    1120 <colortempRatio+0x20>
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %rax,%xmm0
movsd  0xed5(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea9(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<colortempRatio>:
cmp    $0x8,%edi
mov    $0x8,%eax
cmovb  %edi,%eax
add    $0x1,%eax
cvtsi2sd %rax,%xmm0
divsd  0xee5(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsi)
movss  0xedd(%rip),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,(%rdx)
ret

LLVM IR (-O0):
define void @colortempRatio(i32 %0, float* %1, float* %2) {
%4 = alloca i32
%5 = alloca float*
%6 = alloca float*
store i32 %0, i32* %4
store float* %1, float** %5
store float* %2, float** %6
%7 = load i32, i32* %4
%8 = icmp ugt i32 %7, 8
br i1 %8, label %9, label %10
9: ; preds = %3
store i32 8, i32* %4
br label %10
10: ; preds = %9, %3
%11 = load i32, i32* %4
%12 = add i32 %11, 1
%13 = uitofp i32 %12 to double
%14 = fdiv double %13, 1.000000e+01
%15 = fptrunc double %14 to float
%16 = load float*, float** %5
store float %15, float* %16
%17 = load float*, float** %5
%18 = load float, float* %17
%19 = fpext float %18 to double
%20 = fsub double 1.000000e+00, %19
%21 = fptrunc double %20 to float
%22 = load float*, float** %6
store float %21, float* %22
ret void
}

LLVM IR (-O2):
define void @colortempRatio(i32 %0, float* nocapture writeonly %1, float* nocapture writeonly %2) {
%4 = icmp ult i32 %0, 8
%5 = select i1 %4, i32 %0, i32 8
%6 = add nuw nsw i32 %5, 1
%7 = uitofp i32 %6 to double
%8 = fdiv double %7, 1.000000e+01
%9 = fptrunc double %8 to float
store float %9, float* %1
%10 = fsub float 1.000000e+00, %9
store float %10, float* %2
ret void
}
/* Variables and functions */
unsigned long integer_new(int);
unsigned long int integer_s_new(unsigned long int recv, int num) {
  return integer_new(num);
}


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

x86 assembly (clang, -O2):
<integer_s_new>:
mov    %esi,%edi
jmp    1030 <integer_new@plt>

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

LLVM IR (-O2):
define i64 @integer_s_new(i64 %0, i32 %1) {
%3 = tail call i64 @integer_new(i32 %1)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ hostcompat_ttyreset();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int);
int /*<<< orphan*/ signal(int, int /*<<< orphan*/);
void hostcompat_stop(int sig) {
  hostcompat_ttyreset();
  signal(sig, SIG_DFL);
  kill(getpid(), sig);
}


x86 assembly (clang, -O0):
<hostcompat_stop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <hostcompat_ttyreset@plt>
mov    -0x4(%rbp),%edi
mov    0x2e84(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
call   1060 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hostcompat_stop>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <hostcompat_ttyreset@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1050 <signal@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1060 <kill@plt>

LLVM IR (-O0):
@SIG_DFL = global i32 0
define void @hostcompat_stop(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @hostcompat_ttyreset()
%4 = load i32, i32* %2
%5 = load i32, i32* @SIG_DFL
%6 = call i32 @signal(i32 %4, i32 %5)
%7 = call i32 (...) @getpid()
%8 = load i32, i32* %2
%9 = call i32 @kill(i32 %7, i32 %8)
ret void
}

LLVM IR (-O2):
@SIG_DFL = global i32 0
define void @hostcompat_stop(i32 %0) {
%2 = tail call i32 (...) @hostcompat_ttyreset()
%3 = load i32, i32* @SIG_DFL
%4 = tail call i32 @signal(i32 %0, i32 %3)
%5 = tail call i32 (...) @getpid()
%6 = tail call i32 @kill(i32 %5, i32 %0)
ret void
}
int UTF8_IS_LEADING(unsigned char c) { return c >> 7 & c >> 6; }


x86 assembly (clang, -O0):
<UTF8_IS_LEADING>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x7,%eax
movzbl -0x1(%rbp),%ecx
sar    $0x6,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UTF8_IS_LEADING>:
mov    %edi,%eax
shr    $0x7,%eax
shr    $0x6,%edi
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @UTF8_IS_LEADING(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = ashr i32 %4, 7
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = ashr i32 %7, 6
%9 = and i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @UTF8_IS_LEADING(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = lshr i32 %2, 7
%4 = lshr i32 %2, 6
%5 = and i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ str_printf(char *, int *, char *, void *);
void write_pointer(char *out, int *written, void *p) {
  str_printf(out, written, "%p", p);
}


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

x86 assembly (clang, -O2):
<write_pointer>:
mov    %rdx,%rcx
lea    0xee6(%rip),%rdx
jmp    1030 <str_printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%p\00"
define void @write_pointer(i8* %0, i32* %1, i8* %2) {
%4 = tail call i32 @str_printf(i8* %0, i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}