xunge/DecIR huggingface dataset:
int khash_default_cmp(void *key1, void *key2) {
  if ((int)key1 == (int)key2) {
    return 0;
  } else if ((int)key1 > (int)key2) {
    return 1;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<khash_default_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmp    %ecx,%eax
jne    1128 <khash_default_cmp+0x28>
movl   $0x0,-0x4(%rbp)
jmp    114b <khash_default_cmp+0x4b>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmp    %ecx,%eax
jle    1144 <khash_default_cmp+0x44>
movl   $0x1,-0x4(%rbp)
jmp    114b <khash_default_cmp+0x4b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<khash_default_cmp>:
xor    %ecx,%ecx
xor    %eax,%eax
cmp    %esi,%edi
setg   %al
lea    -0x1(%rax,%rax,1),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @khash_default_cmp(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = ptrtoint i8* %1 to i64
%6 = trunc i64 %5 to i32
%7 = icmp eq i32 %4, %6
%8 = icmp sgt i32 %4, %6
%9 = select i1 %8, i32 1, i32 -1
%10 = select i1 %7, i32 0, i32 %9
ret i32 %10
}
void swap_short_2(short *tni2) {
  *tni2 = (((*tni2 >> 8) & 0xff) | ((*tni2 & 0xff) << 8));
}


x86 assembly (clang, -O0):
<swap_short_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    -0x8(%rbp),%rcx
movswl (%rcx),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_short_2>:
rolw   $0x8,(%rdi)
ret

LLVM IR (-O0):
define void @swap_short_2(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = ashr i32 %5, 8
%7 = and i32 %6, 255
%8 = load i16*, i16** %2
%9 = load i16, i16* %8
%10 = sext i16 %9 to i32
%11 = and i32 %10, 255
%12 = shl i32 %11, 8
%13 = or i32 %7, %12
%14 = trunc i32 %13 to i16
%15 = load i16*, i16** %2
store i16 %14, i16* %15
ret void
}

LLVM IR (-O2):
define void @swap_short_2(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = tail call i16 @llvm.bswap.i16(i16 %2)
store i16 %3, i16* %0
ret void
}
/* Variables and functions */
scalar_t__ io_process();
void io_processLoop(void) {
  while (io_process())
    continue;
}


x86 assembly (clang, -O0):
<io_processLoop>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <io_processLoop+0x9>
mov    $0x0,%al
call   1030 <io_process@plt>
cmp    $0x0,%rax
je     112f <io_processLoop+0x1f>
jmp    1119 <io_processLoop+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_processLoop>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <io_process@plt>
test   %rax,%rax
jne    1120 <io_processLoop+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @io_processLoop() {
br label %1
1: ; preds = %4, %0
%2 = call i64 (...) @io_process()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1
br label %1
5: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @io_processLoop() {
br label %1
1: ; preds = %1, %0
%2 = tail call i64 (...) @io_process()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %1
4: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fail(char const *, int /*<<< orphan*/, char *);
int /*<<< orphan*/ strlen(char const *);
void __stack_chk_fail(void) {
  const char *msg = "*** stack smashing detected ***: ";
  fail(msg, strlen(msg), "stack smashing detected: terminated");
}


x86 assembly (clang, -O0):
<__stack_chk_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
lea    0xed1(%rip),%rdx
call   1030 <fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__stack_chk_fail>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xeeb(%rip),%rdx
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <fail@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"*** stack smashing detected ***: \00"
@.str.1 = [36 x i8] c"stack smashing detected: terminated\00"
define void @__stack_chk_fail() {
%1 = alloca i8*
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @strlen(i8* %3)
%5 = call i32 @fail(i8* %2, i32 %4, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"*** stack smashing detected ***: \00"
@.str.1 = [36 x i8] c"stack smashing detected: terminated\00"
define void @__stack_chk_fail() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @fail(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void g_type_init() {}


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

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

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

LLVM IR (-O2):
define void @g_type_init() {
ret void
}
float testFloatCast(int i) {
  float f = i;
  return f - f;
}


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

x86 assembly (clang, -O2):
<testFloatCast>:
cvtsi2ss %edi,%xmm0
subss  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @testFloatCast(i32 %0) {
%2 = alloca i32
%3 = alloca float
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to float
store float %5, float* %3
%6 = load float, float* %3
%7 = load float, float* %3
%8 = fsub float %6, %7
ret float %8
}

LLVM IR (-O2):
define float @testFloatCast(i32 %0) {
%2 = sitofp i32 %0 to float
%3 = fsub float %2, %2
ret float %3
}
int RECOIL_ToAtari8Char(int ascii) {
  switch (ascii & 96) {
  case 0:
    return ascii + 64;
  case 32:
  case 64:
    return ascii - 32;
  default:
    return ascii;
  }
}


x86 assembly (clang, -O0):
<RECOIL_ToAtari8Char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x60,%eax
mov    %eax,-0xc(%rbp)
je     113d <RECOIL_ToAtari8Char+0x3d>
jmp    111b <RECOIL_ToAtari8Char+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
je     114b <RECOIL_ToAtari8Char+0x4b>
jmp    112c <RECOIL_ToAtari8Char+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x40,%eax
je     114b <RECOIL_ToAtari8Char+0x4b>
jmp    1159 <RECOIL_ToAtari8Char+0x59>
mov    -0x8(%rbp),%eax
add    $0x40,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <RECOIL_ToAtari8Char+0x5f>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <RECOIL_ToAtari8Char+0x5f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RECOIL_ToAtari8Char>:
mov    %edi,%eax
mov    %edi,%ecx
and    $0x60,%ecx
cmp    $0x40,%ecx
je     1119 <RECOIL_ToAtari8Char+0x19>
cmp    $0x20,%ecx
je     1119 <RECOIL_ToAtari8Char+0x19>
test   %ecx,%ecx
jne    111c <RECOIL_ToAtari8Char+0x1c>
add    $0x40,%eax
ret
add    $0xffffffe0,%eax
ret

LLVM IR (-O0):
define i32 @RECOIL_ToAtari8Char(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 96
switch i32 %5, label %12 [
i32 0, label %6
i32 32, label %9
i32 64, label %9
]
6: ; preds = %1
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 64
store i32 %8, i32* %2
br label %14
9: ; preds = %1, %1
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 32
store i32 %11, i32* %2
br label %14
12: ; preds = %1
%13 = load i32, i32* %3
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %9, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @RECOIL_ToAtari8Char(i32 %0) {
%2 = and i32 %0, 96
switch i32 %2, label %7 [
i32 0, label %3
i32 32, label %5
i32 64, label %5
]
3: ; preds = %1
%4 = add nsw i32 %0, 64
br label %7
5: ; preds = %1, %1
%6 = add nsw i32 %0, -32
br label %7
7: ; preds = %1, %5, %3
%8 = phi i32 [ %6, %5 ], [ %4, %3 ], [ %0, %1 ]
ret i32 %8
}
void insl(int port, void *addr, unsigned long count) {
  asm volatile("rep; ins"
               "l"
               : "+D"(addr), "+c"(count)
               : "d"(port));
}


x86 assembly (clang, -O0):
<insl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    -0x4(%rbp),%edx
rep insl (%dx),%es:(%rdi)
mov    %rdi,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<insl>:
mov    %rdx,%rcx
mov    %edi,%edx
mov    %rsi,%rdi
rep insl (%dx),%es:(%rdi)
ret

LLVM IR (-O0):
define void @insl(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = load i32, i32* %4
%10 = call { i8*, i64 } asm sideeffect "rep; insl", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %9, i8* %7, i64 %8)
%11 = extractvalue { i8*, i64 } %10, 0
%12 = extractvalue { i8*, i64 } %10, 1
store i8* %11, i8** %5
store i64 %12, i64* %6
ret void
}

LLVM IR (-O2):
define void @insl(i32 %0, i8* %1, i64 %2) {
%4 = tail call { i8*, i64 } asm sideeffect "rep; insl", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* %1, i64 %2)
ret void
}
/* Variables and functions */
scalar_t__ test_sat_parser_should_fail(char *);
int test19(void) {
  return test_sat_parser_should_fail("(a or") ||
         test_sat_parser_should_fail("(-a  or   ");
}


x86 assembly (clang, -O0):
<test19>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <test_sat_parser_should_fail@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
jne    114c <test19+0x3c>
lea    0xec9(%rip),%rdi
call   1030 <test_sat_parser_should_fail@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test19>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <test_sat_parser_should_fail@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     112c <test19+0x1c>
pop    %rcx
ret
lea    0xed3(%rip),%rdi
call   1030 <test_sat_parser_should_fail@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"(a or\00"
@.str.1 = [11 x i8] c"(-a or \00"
define i32 @test19() {
%1 = call i64 @test_sat_parser_should_fail(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = call i64 @test_sat_parser_should_fail(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br label %6
6: ; preds = %3, %0
%7 = phi i1 [ true, %0 ], [ %5, %3 ]
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
@.str = [6 x i8] c"(a or\00"
@.str.1 = [11 x i8] c"(-a or \00"
define i32 @test19() {
%1 = tail call i64 @test_sat_parser_should_fail(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i64 @test_sat_parser_should_fail(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ 1, %0 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void __stack_chk_fail(void) { exit(0); }


x86 assembly (clang, -O0):
<__stack_chk_fail>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<__stack_chk_fail>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @__stack_chk_fail() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @__stack_chk_fail() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ free(int **);
int **malloc(int);
int main() {
  int **val = malloc(sizeof(int *));
  int result = 5;
  *val = &result;
  int ret = **val;
  free(val);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
mov    -0x10(%rbp),%rax
lea    -0x14(%rbp),%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x8,%edi
call   1040 <malloc@plt>
lea    0x4(%rsp),%rcx
mov    %rcx,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
mov    $0x5,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = tail call i32** @malloc(i32 8)
%3 = bitcast i32* %1 to i8*
store i32* %1, i32** %2
%4 = call i32 @free(i32** %2)
ret i32 5
}
int get_freqmap_idx(unsigned char c) {
  if (c >= 'A' && c <= 'Z')
    return c - 'A';
  if (c >= 'a' && c <= 'z')
    return c - 'a';
  if (c == ' ')
    return 26;
  return -1;
}


x86 assembly (clang, -O0):
<get_freqmap_idx>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1133 <get_freqmap_idx+0x33>
movzbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1133 <get_freqmap_idx+0x33>
movzbl -0x5(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    117c <get_freqmap_idx+0x7c>
movzbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     115c <get_freqmap_idx+0x5c>
movzbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     115c <get_freqmap_idx+0x5c>
movzbl -0x5(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    117c <get_freqmap_idx+0x7c>
movzbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    1175 <get_freqmap_idx+0x75>
movl   $0x1a,-0x4(%rbp)
jmp    117c <get_freqmap_idx+0x7c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_freqmap_idx>:
mov    %edi,%eax
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     110e <get_freqmap_idx+0xe>
add    $0xffffffbf,%eax
ret
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     111a <get_freqmap_idx+0x1a>
add    $0xffffff9f,%eax
ret
cmp    $0x20,%al
mov    $0x1a,%ecx
mov    $0xffffffff,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @get_freqmap_idx(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = sub nsw i32 %13, 65
store i32 %14, i32* %2
br label %33
15: ; preds = %7, %1
%16 = load i8, i8* %3
%17 = zext i8 %16 to i32
%18 = icmp sge i32 %17, 97
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = load i8, i8* %3
%21 = zext i8 %20 to i32
%22 = icmp sle i32 %21, 122
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i8, i8* %3
%25 = zext i8 %24 to i32
%26 = sub nsw i32 %25, 97
store i32 %26, i32* %2
br label %33
27: ; preds = %19, %15
%28 = load i8, i8* %3
%29 = zext i8 %28 to i32
%30 = icmp eq i32 %29, 32
br i1 %30, label %31, label %32
31: ; preds = %27
store i32 26, i32* %2
br label %33
32: ; preds = %27
store i32 -1, i32* %2
br label %33
33: ; preds = %32, %31, %23, %11
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @get_freqmap_idx(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = add i8 %0, -65
%4 = icmp ult i8 %3, 26
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = add nsw i32 %2, -65
br label %15
7: ; preds = %1
%8 = add i8 %0, -97
%9 = icmp ult i8 %8, 26
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = add nsw i32 %2, -97
br label %15
12: ; preds = %7
%13 = icmp eq i8 %0, 32
%14 = select i1 %13, i32 26, i32 -1
br label %15
15: ; preds = %12, %10, %5
%16 = phi i32 [ %6, %5 ], [ %11, %10 ], [ %14, %12 ]
ret i32 %16
}
/* Variables and functions */
int read(int, char *, int);
void read_file_fd(int fd, char *dst, int len) {
  size_t size = 0;
  int r;
  do {
    r = read(fd, dst + size, len);
    if (r > 0) {
      size += r;
      len -= r;
    }
  } while (r > 0);
}


x86 assembly (clang, -O0):
<read_file_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <read@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    1161 <read_file_fd+0x51>
movslq -0x24(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    1166 <read_file_fd+0x56>
cmpl   $0x0,-0x24(%rbp)
jg     112a <read_file_fd+0x1a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_file_fd>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%r14,%rbp,1),%rsi
mov    %r15d,%edi
mov    %ebx,%edx
call   1030 <read@plt>
cltq
add    %rax,%rbp
sub    %eax,%ebx
test   %eax,%eax
jg     1130 <read_file_fd+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @read_file_fd(i32 %0, i8* nocapture %1, i32 %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i64 [ 0, %3 ], [ %11, %4 ]
%6 = phi i32 [ %2, %3 ], [ %12, %4 ]
%7 = getelementptr inbounds i8, i8* %1, i64 %5
%8 = tail call i32 @read(i32 %0, i8* %7, i32 %6)
%9 = icmp sgt i32 %8, 0
%10 = sext i32 %8 to i64
%11 = add i64 %5, %10
%12 = sub nsw i32 %6, %8
br i1 %9, label %4, label %13
13: ; preds = %4
ret void
}
int block_ser_if_block_track_IDL_fname(IDL_parsdecl) {}


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

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

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

LLVM IR (-O2):
define i32 @block_ser_if_block_track_IDL_fname(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  char buf[200];
  strcpy(buf, argv[1]);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0xc8,%rsp
mov    0x8(%rsi),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0xc8,%rsp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [200 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @strcpy(i8* %7, i8* %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = call i32 @strcpy(i8* %4, i8* %6)
ret i32 0
}
unsigned hash(const char *string) {
  int i;
  unsigned u = 0;
  for (i = 0; string[i] != '\0'; i++)
    u = (u << 5) + (u >> (10 - 5)) + (unsigned char)string[i];
  return (u & ((1 << 10) - 1));
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1158 <hash+0x58>
mov    -0x10(%rbp),%eax
shl    $0x5,%eax
mov    -0x10(%rbp),%ecx
shr    $0x5,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <hash+0x16>
mov    -0x10(%rbp),%eax
and    $0x3ff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1132 <hash+0x32>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
mov    %eax,%edx
shl    $0x5,%edx
shr    $0x5,%eax
mov    %eax,%esi
add    %edx,%esi
movzbl %cl,%eax
add    %esi,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
and    $0x3ff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(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 i64 [ %13, %4 ], [ 0, %1 ]
%6 = phi i8 [ %15, %4 ], [ %2, %1 ]
%7 = phi i32 [ %12, %4 ], [ 0, %1 ]
%8 = shl i32 %7, 5
%9 = lshr i32 %7, 5
%10 = add i32 %8, %9
%11 = zext i8 %6 to i32
%12 = add i32 %10, %11
%13 = add nuw nsw i64 %5, 1
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %4
%18 = and i32 %12, 1023
br label %19
19: ; preds = %17, %1
%20 = phi i32 [ 0, %1 ], [ %18, %17 ]
ret i32 %20
}
/* Variables and functions */
int /*<<< orphan*/ os_free(void *);
int /*<<< orphan*/ os_memset(void *, int /*<<< orphan*/, int);
void aes_decrypt_deinit(void *ctx) {
  os_memset(ctx, 0, (4 * 44));
  os_free(ctx);
}


x86 assembly (clang, -O0):
<aes_decrypt_deinit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0xb0,%edx
call   1040 <os_memset@plt>
mov    -0x8(%rbp),%rdi
call   1030 <os_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes_decrypt_deinit>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0xb0,%edx
call   1040 <os_memset@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <os_free@plt>

LLVM IR (-O0):
define void @aes_decrypt_deinit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @os_memset(i8* %3, i32 0, i32 176)
%5 = load i8*, i8** %2
%6 = call i32 @os_free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @aes_decrypt_deinit(i8* %0) {
%2 = tail call i32 @os_memset(i8* %0, i32 0, i32 176)
%3 = tail call i32 @os_free(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *Fopen(char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void TestReadFile(char *fn) {
  FILE *f = NULL;
  f = Fopen(fn, "r");
  fclose(f);
}


x86 assembly (clang, -O0):
<TestReadFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1040 <Fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestReadFile>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <Fopen@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <fclose@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define void @TestReadFile(i8* %0) {
%2 = tail call i32* @Fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @fclose(i32* %2)
ret void
}
int rp_get_signals(float ***s, int *sig_num, int *sig_len) { return 0; }


x86 assembly (clang, -O0):
<rp_get_signals>:
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):
<rp_get_signals>:
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @rp_get_signals(float*** nocapture readnone %0, i32* nocapture readnone %1, i32* nocapture readnone %2) {
ret i32 0
}
void XCopyColormapAndFree() {}


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

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

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

LLVM IR (-O2):
define void @XCopyColormapAndFree() {
ret void
}
/* Variables and functions */
double fran();
double getRandomDouble(double min, double max) {
  return (fran() * (max - min) + min);
}


x86 assembly (clang, -O0):
<getRandomDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <fran@plt>
movsd  -0x10(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandomDouble>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <fran@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @getRandomDouble(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = call double (...) @fran()
%6 = load double, double* %4
%7 = load double, double* %3
%8 = fsub double %6, %7
%9 = load double, double* %3
%10 = call double @llvm.fmuladd.f64(double %5, double %8, double %9)
ret double %10
}

LLVM IR (-O2):
define double @getRandomDouble(double %0, double %1) {
%3 = tail call double (...) @fran()
%4 = fsub double %1, %0
%5 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %0)
ret double %5
}
char upper(char c) {
  if (c >= 'a' && c <= 'z') {
    return c - ('a' - 'A');
  }
  return c;
}


x86 assembly (clang, -O0):
<upper>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x61,%eax
jl     1133 <upper+0x33>
movsbl -0x2(%rbp),%eax
cmp    $0x7a,%eax
jg     1133 <upper+0x33>
movsbl -0x2(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x1(%rbp)
jmp    1139 <upper+0x39>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<upper>:
lea    -0x61(%rdi),%eax
lea    -0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @upper(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 32
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
br label %18
16: ; preds = %7, %1
%17 = load i8, i8* %3
store i8 %17, i8* %2
br label %18
18: ; preds = %16, %11
%19 = load i8, i8* %2
ret i8 %19
}

LLVM IR (-O2):
define signext i8 @upper(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, -32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Variables and functions */
scalar_t__ SQL_disconnect();
int sql_close() {
  if (SQL_disconnect()) {
    return (-1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<sql_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <SQL_disconnect@plt>
cmp    $0x0,%rax
je     1135 <sql_close+0x25>
movl   $0xffffffff,-0x4(%rbp)
jmp    113c <sql_close+0x2c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sql_close>:
push   %rax
xor    %eax,%eax
call   1030 <SQL_disconnect@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @sql_close() {
%1 = alloca i32
%2 = call i64 (...) @SQL_disconnect()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 -1, i32* %1
br label %6
5: ; preds = %0
store i32 0, i32* %1
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @sql_close() {
%1 = tail call i64 (...) @SQL_disconnect()
%2 = icmp ne i64 %1, 0
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ raise(int);
void abort() {
  raise(6);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
call   1030 <raise@plt>
jmp    111e <abort+0xe>

x86 assembly (clang, -O2):
<abort>:
push   %rax
mov    $0x6,%edi
call   1030 <raise@plt>
nopl   0x0(%rax,%rax,1)
jmp    1120 <abort+0x10>

LLVM IR (-O0):
define void @abort() {
%1 = call i32 @raise(i32 6)
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
define void @abort() {
%1 = tail call i32 @raise(i32 6)
br label %2
2: ; preds = %0, %2
br label %2
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int, int);
void *work(void *param) {
  printf("I'm %d, PID: %d\n", (int)param, getpid());
  if (param == NULL) {
    return 1;
  } else {
    return 2;
  }
}


x86 assembly (clang, -O0):
<work>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1164 <work+0x44>
mov    $0x1,%eax
mov    %rax,-0x8(%rbp)
jmp    116d <work+0x4d>
mov    $0x2,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<work>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xece(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
cmp    $0x1,%rbx
mov    $0x2,%eax
sbb    $0x0,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"I'm %d, PID: %d\0A\00"
define i8* @work(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = ptrtoint i8* %4 to i32
%6 = call i32 (...) @getpid()
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %1
store i8* inttoptr (i64 1 to i8*), i8** %2
br label %12
11: ; preds = %1
store i8* inttoptr (i64 2 to i8*), i8** %2
br label %12
12: ; preds = %11, %10
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [17 x i8] c"I'm %d, PID: %d\0A\00"
define i8* @work(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 (...) @getpid()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = icmp eq i8* %0, null
%7 = select i1 %6, i8* inttoptr (i64 1 to i8*), i8* inttoptr (i64 2 to i8*)
ret i8* %7
}
double geocentric_longitude(double l) {
  double theta = l + 180.0;
  if (theta >= 360.0)
    theta -= 360.0;
  return theta;
}


x86 assembly (clang, -O0):
<geocentric_longitude>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1148 <geocentric_longitude+0x48>
movsd  -0x10(%rbp),%xmm0
movsd  0xec1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<geocentric_longitude>:
addsd  0xef8(%rip),%xmm0
movsd  0xef8(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xef4(%rip),%xmm2
cmpnlesd %xmm0,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @geocentric_longitude(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fadd double %4, 1.800000e+02
store double %5, double* %3
%6 = load double, double* %3
%7 = fcmp oge double %6, 3.600000e+02
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load double, double* %3
%10 = fsub double %9, 3.600000e+02
store double %10, double* %3
br label %11
11: ; preds = %8, %1
%12 = load double, double* %3
ret double %12
}

LLVM IR (-O2):
define double @geocentric_longitude(double %0) {
%2 = fadd double %0, 1.800000e+02
%3 = fcmp ult double %2, 3.600000e+02
%4 = fadd double %2, -3.600000e+02
%5 = select i1 %3, double %2, double %4
ret double %5
}
int do_something(int i) { return i; }


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

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

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

LLVM IR (-O2):
define i32 @do_something(i32 returned %0) {
ret i32 %0
}
int ls_cost_nm8_work(int *sz_arg, int *sz_res, int *sz_iw, int *sz_w) {
  if (sz_arg)
    *sz_arg = 2;
  if (sz_res)
    *sz_res = 2;
  if (sz_iw)
    *sz_iw = 0;
  if (sz_w)
    *sz_w = 1;
  return 0;
}


x86 assembly (clang, -O0):
<ls_cost_nm8_work>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1129 <ls_cost_nm8_work+0x29>
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     113e <ls_cost_nm8_work+0x3e>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1153 <ls_cost_nm8_work+0x53>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1168 <ls_cost_nm8_work+0x68>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_cost_nm8_work>:
test   %rdi,%rdi
je     110b <ls_cost_nm8_work+0xb>
movl   $0x2,(%rdi)
test   %rsi,%rsi
je     1116 <ls_cost_nm8_work+0x16>
movl   $0x2,(%rsi)
test   %rdx,%rdx
je     1121 <ls_cost_nm8_work+0x21>
movl   $0x0,(%rdx)
test   %rcx,%rcx
je     112c <ls_cost_nm8_work+0x2c>
movl   $0x1,(%rcx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ls_cost_nm8_work(i32* writeonly %0, i32* writeonly %1, i32* writeonly %2, i32* writeonly %3) {
%5 = icmp eq i32* %0, null
br i1 %5, label %7, label %6
6: ; preds = %4
store i32 2, i32* %0
br label %7
7: ; preds = %6, %4
%8 = icmp eq i32* %1, null
br i1 %8, label %10, label %9
9: ; preds = %7
store i32 2, i32* %1
br label %10
10: ; preds = %9, %7
%11 = icmp eq i32* %2, null
br i1 %11, label %13, label %12
12: ; preds = %10
store i32 0, i32* %2
br label %13
13: ; preds = %12, %10
%14 = icmp eq i32* %3, null
br i1 %14, label %16, label %15
15: ; preds = %13
store i32 1, i32* %3
br label %16
16: ; preds = %15, %13
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *gettext(char *);
int /*<<< orphan*/ stderr;
char *strrchr(char *, char);
void usage(char *name) {
  char *this;
  if ((this = strrchr(name, '/')) != NULL)
    name = this + 1;
  fprintf(stderr, gettext("usage: %s [ -n ] device\n"), name);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1174 <usage+0x34>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xe79(%rip),%rdi
call   1030 <gettext@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rsi
mov    -0x8(%rbp),%rdx
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x2f,%esi
call   1040 <strrchr@plt>
lea    0x1(%rax),%rbx
test   %rax,%rax
cmove  %r14,%rbx
mov    0x2e7d(%rip),%rax
mov    (%rax),%ebp
lea    0xe94(%rip),%rdi
call   1030 <gettext@plt>
mov    %ebp,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"usage: %s [ -n ] device\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 47)
store i8* %5, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %9, i8** %2
br label %10
10: ; preds = %7, %1
%11 = load i32, i32* @stderr
%12 = call i8* @gettext(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %2
%14 = call i32 @fprintf(i32 %11, i8* %12, i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"usage: %s [ -n ] device\0A\00"
define void @usage(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
%6 = load i32, i32* @stderr
%7 = tail call i8* @gettext(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @fprintf(i32 %6, i8* %7, i8* %5)
%9 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
unsigned int _castf32_u32(float);
unsigned int test_castf32_u32(float __A) { return _castf32_u32(__A); }


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

x86 assembly (clang, -O2):
<test_castf32_u32>:
jmp    1030 <_castf32_u32@plt>

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

LLVM IR (-O2):
define i32 @test_castf32_u32(float %0) {
%2 = tail call i32 @_castf32_u32(float %0)
ret i32 %2
}
void preinterp_flux_point2avg(void) { int i, j, k, dir; }


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

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

LLVM IR (-O0):
define void @preinterp_flux_point2avg() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
ret void
}

LLVM IR (-O2):
define void @preinterp_flux_point2avg() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() {
  while (1) {
    puts("hello");
  }
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %1
}
void fd_install(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<fd_install>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@__func__.fd_install = [11 x i8] c"fd_install\00"
define void @fd_install() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.fd_install, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.fd_install = [11 x i8] c"fd_install\00"
define void @fd_install() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.fd_install, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void uncalledFunction() { printf("This line should not execute."); }


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

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

LLVM IR (-O0):
@.str = [30 x i8] c"This line should not execute.\00"
define void @uncalledFunction() {
%1 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"This line should not execute.\00"
define void @uncalledFunction() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ genrand_real2();
double const log(int /*<<< orphan*/);
double rexp(const double lambda) { return -log(genrand_real2()) / lambda; }


x86 assembly (clang, -O0):
<rexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <genrand_real2@plt>
mov    %eax,%edi
call   1040 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rexp>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <genrand_real2@plt>
mov    %eax,%edi
call   1040 <log@plt>
xorpd  0xec4(%rip),%xmm0
divsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rexp(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 (...) @genrand_real2()
%4 = call double @log(i32 %3)
%5 = fneg double %4
%6 = load double, double* %2
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @rexp(double %0) {
%2 = tail call i32 (...) @genrand_real2()
%3 = tail call double @log(i32 %2)
%4 = fneg double %3
%5 = fdiv double %4, %0
ret double %5
}
/* Variables and functions */
int rename(char const *, char const *);
int rename_utf8(const char *source, const char *destination) {
  return (rename(source, destination));
}


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

x86 assembly (clang, -O2):
<rename_utf8>:
jmp    1030 <rename@plt>

LLVM IR (-O0):
define i32 @rename_utf8(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 @rename(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @rename_utf8(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @rename(i8* %0, i8* %1)
ret i32 %3
}