xunge/DecIR huggingface dataset:
/* Variables and functions */
int PATH_MAX;
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printf("Not define MAXPAHTLEN\n");
  printf("PATH_MAX: %d\n", PATH_MAX);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str.1 = [14 x i8] c"PATH_MAX: %d\0A\00"
@PATH_MAX = global i32 0
@str = [22 x i8] c"Not define MAXPAHTLEN\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @PATH_MAX
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
int hash(void *mem) {
  return (int)(((unsigned long long)mem) % (unsigned long long)196613);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x30005,%ecx
xor    %edx,%edx
div    %rcx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
movabs $0x5554c71d5ecf0ca7,%rcx
c7 54 55
mov    %rdi,%rax
mul    %rcx
shr    $0x10,%rdx
imul   $0x30005,%edx,%eax
sub    %eax,%edi
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = urem i64 %2, 196613
%4 = trunc i64 %3 to i32
ret i32 %4
}
int gcd(int a, int b) {
  int c = a % b;
  if (c != 0) {
    return gcd(b, c);
  }
  return b;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1145 <gcd+0x35>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <gcd@plt>
mov    %eax,-0x4(%rbp)
jmp    114b <gcd+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %esi,%edx
mov    %edi,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %0, %2 ], [ %5, %3 ]
%5 = phi i32 [ %1, %2 ], [ %6, %3 ]
%6 = srem i32 %4, %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ do_abort();
int /*<<< orphan*/ do_exit();
void foo(int x, int a) {
  if (x < a)
    goto doit;
  do_exit();
  if (x != a)
    goto doit;
  do_abort();
  return;
doit:
  do_abort();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    113f <foo+0x1f>
jmp    1163 <foo+0x43>
mov    $0x0,%al
call   1030 <do_exit@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1157 <foo+0x37>
jmp    1163 <foo+0x43>
mov    $0x0,%al
call   1040 <do_abort@plt>
jmp    116a <foo+0x4a>
mov    $0x0,%al
call   1040 <do_abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    %esi,%edi
jl     1130 <foo+0x10>
push   %rax
xor    %eax,%eax
call   1030 <do_exit@plt>
add    $0x8,%rsp
xor    %eax,%eax
jmp    1040 <do_abort@plt>

LLVM IR (-O0):
define void @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %2
br label %17
9: ; preds = %2
%10 = call i32 (...) @do_exit()
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %9
br label %17
15: ; preds = %9
%16 = call i32 (...) @do_abort()
br label %19
17: ; preds = %14, %8
%18 = call i32 (...) @do_abort()
br label %19
19: ; preds = %17, %15
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @do_exit()
br label %6
6: ; preds = %4, %2
%7 = tail call i32 (...) @do_abort()
ret void
}
/* Variables and functions */
int bar();
int /*<<< orphan*/ bar2(int);
int foo4() {
  int result = 0;
  int f = -1;
  f = bar();
  if (f < 0) {
    result = 1;
    goto bail;
  }
  bar();
bail:
  bar2(f);
  return result;
}


x86 assembly (clang, -O0):
<foo4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    $0x0,%al
call   1040 <bar@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1156 <foo4+0x36>
movl   $0x1,-0x4(%rbp)
jmp    115d <foo4+0x3d>
mov    $0x0,%al
call   1040 <bar@plt>
mov    -0x8(%rbp),%edi
call   1030 <bar2@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo4>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <bar@plt>
mov    %eax,%ebp
test   %eax,%eax
js     113b <foo4+0x1b>
xor    %eax,%eax
call   1040 <bar@plt>
jmp    1140 <foo4+0x20>
mov    $0x1,%ebx
mov    %ebp,%edi
call   1030 <bar2@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @foo4() {
%1 = tail call i32 (...) @bar()
%2 = icmp slt i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @bar()
br label %5
5: ; preds = %0, %3
%6 = phi i32 [ 0, %3 ], [ 1, %0 ]
%7 = tail call i32 @bar2(i32 %1)
ret i32 %6
}
void omap4_register_ion(void) { return; }


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

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

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

LLVM IR (-O2):
define void @omap4_register_ion() {
ret void
}
int test_imm_0Cuint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x0C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Cuint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x20,%rdx
and    $0xc,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_0Cuint64_highword_reg>:
movabs $0xc00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_0Cuint64_highword_reg(i64 %0) {
%2 = and i64 %0, 51539607552
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void simple_read_from_buffer(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<simple_read_from_buffer>:
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):
<simple_read_from_buffer>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

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

LLVM IR (-O2):
@__func__.simple_read_from_buffer = [24 x i8] c"simple_read_from_buffer\00"
define void @simple_read_from_buffer() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @__func__.simple_read_from_buffer, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_roundtrip(char *);
void bgpdump_test_fmt_ip() {
  test_roundtrip("fe80::");
  test_roundtrip("2001:db8::1");
  test_roundtrip("::ffff:192.168.2.1");
  test_roundtrip("::192.168.1.2");
  test_roundtrip("2001:7f8:30::2:1:0:8447");
}


x86 assembly (clang, -O0):
<bgpdump_test_fmt_ip>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <test_roundtrip@plt>
lea    0xee0(%rip),%rdi
call   1030 <test_roundtrip@plt>
lea    0xee0(%rip),%rdi
call   1030 <test_roundtrip@plt>
lea    0xee7(%rip),%rdi
call   1030 <test_roundtrip@plt>
lea    0xee9(%rip),%rdi
call   1030 <test_roundtrip@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bgpdump_test_fmt_ip>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <test_roundtrip@plt>
lea    0xee3(%rip),%rdi
call   1030 <test_roundtrip@plt>
lea    0xee3(%rip),%rdi
call   1030 <test_roundtrip@plt>
lea    0xeea(%rip),%rdi
call   1030 <test_roundtrip@plt>
lea    0xeec(%rip),%rdi
pop    %rax
jmp    1030 <test_roundtrip@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"fe80::\00"
@.str.1 = [12 x i8] c"2001:db8::1\00"
@.str.2 = [19 x i8] c"::ffff:192.168.2.1\00"
@.str.3 = [14 x i8] c"::192.168.1.2\00"
@.str.4 = [24 x i8] c"2001:7f8:30::2:1:0:8447\00"
define void @bgpdump_test_fmt_ip() {
%1 = call i32 @test_roundtrip(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @test_roundtrip(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @test_roundtrip(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @test_roundtrip(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @test_roundtrip(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"fe80::\00"
@.str.1 = [12 x i8] c"2001:db8::1\00"
@.str.2 = [19 x i8] c"::ffff:192.168.2.1\00"
@.str.3 = [14 x i8] c"::192.168.1.2\00"
@.str.4 = [24 x i8] c"2001:7f8:30::2:1:0:8447\00"
define void @bgpdump_test_fmt_ip() {
%1 = tail call i32 @test_roundtrip(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @test_roundtrip(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @test_roundtrip(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @test_roundtrip(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @test_roundtrip(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
char *now_str() {
  static char buffer[1000];
  time_t now = time(0);
  strftime(buffer, sizeof buffer, "%Y-%m-%d %H:%M:%S", localtime(&now));
  return buffer;
}


x86 assembly (clang, -O0):
<now_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %eax,%ecx
lea    0x2efc(%rip),%rdi
mov    $0x3e8,%esi
lea    0xea0(%rip),%rdx
call   1050 <strftime@plt>
lea    0x2ee4(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now_str>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0x2eff(%rip),%rbx
lea    0xea8(%rip),%rdx
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %eax,%ecx
call   1050 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@now_str.buffer = internal global [1000 x i8] zeroinitializer
@.str = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
define i8* @now_str() {
%1 = alloca i32
%2 = call i32 @time(i32 0)
store i32 %2, i32* %1
%3 = call i32 @localtime(i32* %1)
%4 = call i32 @strftime(i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @now_str.buffer, i64 0, i64 0), i32 1000, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @now_str.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
@now_str.buffer = internal global [1000 x i8] zeroinitializer
@.str = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
define i8* @now_str() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32 0)
store i32 %3, i32* %1
%4 = call i32 @localtime(i32* %1)
%5 = call i32 @strftime(i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @now_str.buffer, i64 0, i64 0), i32 1000, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @now_str.buffer, i64 0, i64 0)
}
unsigned int read_le_short(const unsigned char *buf) {
  return buf[0] | (buf[1] << 8);
}


x86 assembly (clang, -O0):
<read_le_short>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_le_short>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @read_le_short(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %6, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @read_le_short(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %3
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ Arg_print();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
void errorWrongArg(char *name, char *arg, char *input) {
  printf("invalid arg for switch: %s\n"
         "expects: %s\n"
         "but got: %s\n",
         name, arg, input);
  Arg_print();
  exit(0);
}


x86 assembly (clang, -O0):
<errorWrongArg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <Arg_print@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<errorWrongArg>:
push   %rax
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <Arg_print@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"invalid arg for switch: %s\0Aexpects: %s\0Abut got: %s\0A\00"
define void @errorWrongArg(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
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i8* %9)
%11 = call i32 (...) @Arg_print()
%12 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [52 x i8] c"invalid arg for switch: %s\0Aexpects: %s\0Abut got: %s\0A\00"
define void @errorWrongArg(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
%5 = tail call i32 (...) @Arg_print()
%6 = tail call i32 @exit(i32 0)
unreachable
}
void fd288(int n) {
P0A:
  goto P0A;
  {
    typedef int(*b)[n];
  P01A:
    goto P01A;
    {
      typedef int(*c)[n];
    P012A:
      goto P012A;
      0;
    }
  P01B:
    goto P01B;
    {
      typedef int(*d)[n];
    P013A:
      goto P013A;
      0;
    }
  P01C:
    goto P01C;
    ;
    typedef int(*e)[n];
  P014A:
    goto P014A;
    0;
  };
P0B:
  goto P0B;
  {
    typedef int(*f)[n];
  P02A:
    goto P02A;
    {
      typedef int(*g)[n];
    P024A:
      goto P024A;
      0;
    };
  P02B:
    goto P02B;
    {
      typedef int(*h)[n];
    P025A:
      goto P025A;
      0;
    };
  P02C:
    goto P02C;
    ;
    typedef int(*i)[n];
  P026A:
    goto P026A;
    0;
  };
P0C:
  goto P0C;
  ;
  typedef int(*j)[n];
P03A:
  goto P03A;
  0;
a:
  goto a;
P03B:
  goto P03B;
}


x86 assembly (clang, -O0):
<fd288>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <fd288+0x7>

x86 assembly (clang, -O2):
<fd288>:
jmp    1100 <fd288>

LLVM IR (-O0):
define void @fd288(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %3, %1
br label %3
4: ; No predecessors!
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %7, %4
br label %7
8: ; No predecessors!
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %11, %8
br label %11
12: ; preds = %12
br label %12
13: ; No predecessors!
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
br label %16
16: ; preds = %16, %13
br label %16
17: ; preds = %17
br label %17
18: ; No predecessors!
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
br label %21
21: ; preds = %21, %18
br label %21
22: ; preds = %22
br label %22
23: ; No predecessors!
%24 = load i32, i32* %2
%25 = zext i32 %24 to i64
br label %26
26: ; preds = %26, %23
br label %26
27: ; No predecessors!
%28 = load i32, i32* %2
%29 = zext i32 %28 to i64
br label %30
30: ; preds = %30, %27
br label %30
31: ; preds = %31
br label %31
32: ; No predecessors!
%33 = load i32, i32* %2
%34 = zext i32 %33 to i64
br label %35
35: ; preds = %35, %32
br label %35
36: ; preds = %36
br label %36
37: ; No predecessors!
%38 = load i32, i32* %2
%39 = zext i32 %38 to i64
br label %40
40: ; preds = %40, %37
br label %40
41: ; preds = %41
br label %41
42: ; No predecessors!
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
br label %45
45: ; preds = %45, %42
br label %45
46: ; preds = %46
br label %46
47: ; preds = %47
br label %47
}

LLVM IR (-O2):
define void @fd288(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
void deparse_script(int shmid) {}


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

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

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

LLVM IR (-O2):
define void @deparse_script(i32 %0) {
ret void
}
/* Variables and functions */
double Q_rsqrt(int);
int /*<<< orphan*/ printf(char *, int);
int sqrt(int);
int main() {
  printf("Q_rsqrt: %f\n", Q_rsqrt(5));
  printf("Math 1/sqrt: %f\n", 1 / sqrt(5));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1040 <Q_rsqrt@plt>
cvttsd2si %xmm0,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1040 <Q_rsqrt@plt>
cvttsd2si %xmm0,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1050 <sqrt@plt>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x3,%ecx
cmovae %edx,%eax
lea    0xea6(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Q_rsqrt: %f\0A\00"
@.str.1 = [17 x i8] c"Math 1/sqrt: %f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double @Q_rsqrt(i32 5)
%3 = fptosi double %2 to i32
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @sqrt(i32 5)
%6 = sdiv i32 1, %5
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Q_rsqrt: %f\0A\00"
@.str.1 = [17 x i8] c"Math 1/sqrt: %f\0A\00"
define i32 @main() {
%1 = tail call double @Q_rsqrt(i32 5)
%2 = fptosi double %1 to i32
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @sqrt(i32 5)
%5 = add i32 %4, 1
%6 = icmp ult i32 %5, 3
%7 = select i1 %6, i32 %4, i32 0
%8 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(short *);
void freeVolS(short *volume) { free(volume); }


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

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

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

LLVM IR (-O2):
define void @freeVolS(i16* nocapture %0) {
%2 = tail call i32 @free(i16* %0)
ret void
}
void smp_cmb(void) { __asm __volatile("" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @smp_cmb() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ errx(int /*<<< orphan*/, char *);
void alrm_handler(int s) {
  s = s;
  errx(EXIT_FAILURE, "Timed out while waiting for lock");
}


x86 assembly (clang, -O0):
<alrm_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <errx@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alrm_handler>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <errx@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [33 x i8] c"Timed out while waiting for lock\00"
define void @alrm_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
store i32 %3, i32* %2
%4 = load i32, i32* @EXIT_FAILURE
%5 = call i32 @errx(i32 %4, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [33 x i8] c"Timed out while waiting for lock\00"
define void @alrm_handler(i32 %0) {
%2 = load i32, i32* @EXIT_FAILURE
%3 = tail call i32 @errx(i32 %2, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned xrop3_29_1_1(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 ^ D;
  stk2 = S & stk3;
  stk1 = D ^ stk2;
  stk1 = ~stk1;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_29_1_1>:
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
xor    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @xrop3_29_1_1(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* %5
%25 = xor i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %6
%27 = load i32, i32* %10
%28 = and i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %5
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = xor i32 %32, -1
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = load i32, i32* %6
%36 = xor i32 %35, -1
%37 = and i32 %34, %36
%38 = load i32, i32* %7
%39 = xor i32 %38, -1
%40 = and i32 %37, %39
%41 = load i32, i32* %5
%42 = load i32, i32* %6
%43 = and i32 %41, %42
%44 = or i32 %40, %43
%45 = load i32, i32* %5
%46 = load i32, i32* %7
%47 = and i32 %45, %46
%48 = or i32 %44, %47
ret i32 %48
}

LLVM IR (-O2):
define i32 @xrop3_29_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = zext i8 %1 to i32
%5 = mul nuw nsw i32 %4, 257
%6 = xor i32 %3, -1
%7 = shl nsw i32 %6, 8
%8 = xor i32 %5, -1
%9 = and i32 %7, %8
%10 = or i8 %1, %0
%11 = zext i8 %10 to i32
%12 = or i32 %9, %11
ret i32 %12
}
int ld_blt_rr2(long double a1, long double a2) {
  return !(__builtin_isless(a1, a2));
}


x86 assembly (clang, -O0):
<ld_blt_rr2>:
push   %rbp
mov    %rsp,%rbp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
fucomip %st(1),%st
fstp   %st(0)
seta   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_blt_rr2>:
fldt   0x8(%rsp)
fldt   0x18(%rsp)
xor    %eax,%eax
fucomip %st(1),%st
fstp   %st(0)
setbe  %al
ret

LLVM IR (-O0):
define i32 @ld_blt_rr2(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %4
%7 = fcmp olt x86_fp80 %5, %6
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @ld_blt_rr2(x86_fp80 %0, x86_fp80 %1) {
%3 = fcmp uge x86_fp80 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int msrp_add_line(char *, char *, char *);
int msrp_add_topath_line(char *buffer, char *topath) {
  if (!buffer || !topath)
    return -1;
  return msrp_add_line(buffer, "To-Path: %s", topath);
}


x86 assembly (clang, -O0):
<msrp_add_topath_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <msrp_add_topath_line+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1142 <msrp_add_topath_line+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1159 <msrp_add_topath_line+0x49>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeaf(%rip),%rsi
call   1030 <msrp_add_line@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msrp_add_topath_line>:
test   %rdi,%rdi
je     1129 <msrp_add_topath_line+0x19>
mov    %rsi,%rdx
test   %rsi,%rsi
je     1129 <msrp_add_topath_line+0x19>
lea    0xedc(%rip),%rsi
jmp    1030 <msrp_add_line@plt>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"To-Path: %s\00"
define i32 @msrp_add_topath_line(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 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %8, %2
store i32 -1, i32* %3
br label %16
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = call i32 @msrp_add_line(i8* %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %12, %11
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [12 x i8] c"To-Path: %s\00"
define i32 @msrp_add_topath_line(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @msrp_add_line(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ -1, %2 ]
ret i32 %9
}
long TestingEqual(long index, long total) { return 1000; }


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

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

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

LLVM IR (-O2):
define i64 @TestingEqual(i64 %0, i64 %1) {
ret i64 1000
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ F_GETFD;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fcntl(int /*<<< orphan*/, int /*<<< orphan*/);
void check_stdout_open(void) {
  if (fcntl(STDOUT_FILENO, F_GETFD) < 0) {
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<check_stdout_open>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
call   1030 <fcntl@plt>
cmp    $0x0,%rax
jge    1153 <check_stdout_open+0x33>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_stdout_open>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
call   1030 <fcntl@plt>
test   %rax,%rax
js     113f <check_stdout_open+0x1f>
pop    %rax
ret
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
@F_GETFD = global i32 0
@EXIT_FAILURE = global i32 0
define void @check_stdout_open() {
%1 = load i32, i32* @STDOUT_FILENO
%2 = load i32, i32* @F_GETFD
%3 = call i64 @fcntl(i32 %1, i32 %2)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
ret void
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
@F_GETFD = global i32 0
@EXIT_FAILURE = global i32 0
define void @check_stdout_open() {
%1 = load i32, i32* @STDOUT_FILENO
%2 = load i32, i32* @F_GETFD
%3 = tail call i64 @fcntl(i32 %1, i32 %2)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
ret void
}
long int long_tmin() { return 1L << (sizeof(long) << 3) - 1; }


x86 assembly (clang, -O0):
<long_tmin>:
push   %rbp
mov    %rsp,%rbp
movabs $0x8000000000000000,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_tmin>:
movabs $0x8000000000000000,%rax
ret

LLVM IR (-O0):
define i64 @long_tmin() {
ret i64 -9223372036854775808
}

LLVM IR (-O2):
define i64 @long_tmin() {
ret i64 -9223372036854775808
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void _print_word(char *word) { printf("%s\n", word); }


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

x86 assembly (clang, -O2):
<_print_word>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @_print_word(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
g(int i) { return i + 1; }


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

x86 assembly (clang, -O2):
<g>:
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @g(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef size_t uint64_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int uint16_t;

/* Variables and functions */
uint32_t callb(uint16_t x, uint16_t y, void *user_ptr) {
  uint32_t *image;
  uint64_t c;
  image = (uint32_t *)user_ptr;
  c = 3840 * y + x;
  return image[c];
}


x86 assembly (clang, -O0):
<callb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
imul   $0xf00,-0x8(%rbp),%eax
add    -0x4(%rbp),%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<callb>:
imul   $0xf00,%esi,%eax
add    %edi,%eax
cltq
mov    (%rdx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @callb(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %7
%11 = load i32, i32* %5
%12 = mul nsw i32 3840, %11
%13 = load i32, i32* %4
%14 = add nsw i32 %12, %13
%15 = sext i32 %14 to i64
store i64 %15, i64* %8
%16 = load i32*, i32** %7
%17 = load i64, i64* %8
%18 = getelementptr inbounds i32, i32* %16, i64 %17
%19 = load i32, i32* %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @callb(i32 %0, i32 %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i32*
%5 = mul nsw i32 %1, 3840
%6 = add nsw i32 %5, %0
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %4, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}
void codegen_debug() {}


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

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

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

LLVM IR (-O2):
define void @codegen_debug() {
ret void
}
/* Variables and functions */
int *malloc(int);
int *malloc_int(int count) { return malloc(count * sizeof(int)); }


x86 assembly (clang, -O0):
<malloc_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc_int>:
shl    $0x2,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i32* @malloc_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = mul i64 %4, 4
%6 = trunc i64 %5 to i32
%7 = call i32* @malloc(i32 %6)
ret i32* %7
}

LLVM IR (-O2):
define noalias i32* @malloc_int(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i32* @malloc(i32 %2)
ret i32* %3
}
/* Variables and functions */
int /*<<< orphan*/ draw_border();
int /*<<< orphan*/ new_piece();
int /*<<< orphan*/ reset_score();
void init() {
  draw_border();
  reset_score();
  new_piece();
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <draw_border@plt>
mov    $0x0,%al
call   1030 <reset_score@plt>
mov    $0x0,%al
call   1050 <new_piece@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rax
xor    %eax,%eax
call   1040 <draw_border@plt>
xor    %eax,%eax
call   1030 <reset_score@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <new_piece@plt>

LLVM IR (-O0):
define void @init() {
%1 = call i32 (...) @draw_border()
%2 = call i32 (...) @reset_score()
%3 = call i32 (...) @new_piece()
ret void
}

LLVM IR (-O2):
define void @init() {
%1 = tail call i32 (...) @draw_border()
%2 = tail call i32 (...) @reset_score()
%3 = tail call i32 (...) @new_piece()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void errmalloc(void) {
  fprintf(stderr, "xclip: Error: Could not allocate memory.\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<errmalloc>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<errmalloc>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"xclip: Error: Could not allocate memory.\0A\00"
@EXIT_FAILURE = global i32 0
define void @errmalloc() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"xclip: Error: Could not allocate memory.\0A\00"
@EXIT_FAILURE = global i32 0
define void @errmalloc() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(
      stderr,
      "usage: mtp3d [-c <configdir>] [-m <protocol-dump-file>] [-d] [-p]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [67 x i8] c"usage: mtp3d [-c <configdir>] [-m <protocol-dump-file>] [-d] [-p]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [67 x i8] c"usage: mtp3d [-c <configdir>] [-m <protocol-dump-file>] [-d] [-p]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
int is_close_paren(char c) { return (c == ')' || c == '}' || c == ']'); }


x86 assembly (clang, -O0):
<is_close_paren>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x29,%ecx
mov    %al,-0x2(%rbp)
je     113b <is_close_paren+0x3b>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7d,%ecx
mov    %al,-0x2(%rbp)
je     113b <is_close_paren+0x3b>
movsbl -0x1(%rbp),%eax
cmp    $0x5d,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_close_paren>:
mov    $0x1,%eax
cmp    $0x29,%dil
je     1111 <is_close_paren+0x11>
cmp    $0x7d,%dil
jne    1112 <is_close_paren+0x12>
ret
xor    %eax,%eax
cmp    $0x5d,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @is_close_paren(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 41
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 125
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 93
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @is_close_paren(i8 signext %0) {
switch i8 %0, label %2 [
i8 125, label %5
i8 41, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 93
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int strlen(char *);
char toupper(char);
void mkupper(char *sx) {
  int len, k;
  len = strlen(sx);
  for (k = 0; k < len; ++k) {
    sx[k] = toupper(sx[k]);
  }
}


x86 assembly (clang, -O0):
<mkupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1177 <mkupper+0x57>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113f <mkupper+0x1f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkupper>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1040 <strlen@plt>
test   %eax,%eax
jle    1157 <mkupper+0x37>
mov    %eax,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <mkupper+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @mkupper(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call signext i8 @toupper(i8 signext %9)
store i8 %10, i8* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %1
ret void
}
int failure_func(void *_data) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @failure_func(i8* nocapture readnone %0) {
ret i32 -1
}
/* Type definitions */
typedef int int8_t;

/* Variables and functions */
int8_t abs_8(int8_t c) { return ((c ^ (c >> 7)) - (c >> 7)); }


x86 assembly (clang, -O0):
<abs_8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x7,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x7,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_8>:
mov    %edi,%eax
mov    %edi,%ecx
sar    $0x7,%ecx
xor    %ecx,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @abs_8(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 7
%6 = xor i32 %3, %5
%7 = load i32, i32* %2
%8 = ashr i32 %7, 7
%9 = sub nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @abs_8(i32 %0) {
%2 = ashr i32 %0, 7
%3 = xor i32 %2, %0
%4 = sub nsw i32 %3, %2
ret i32 %4
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
int getusec() {
  struct timeval tv;
  gettimeofday(&tv, 0);
  return tv.tv_sec * 1000000 + tv.tv_usec;
}


x86 assembly (clang, -O0):
<getusec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x8(%rbp),%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getusec>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,(%rsp),%eax
add    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @getusec() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = add nsw i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @getusec() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = add nsw i32 %6, %8
ret i32 %9
}