xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ shell();
int /*<<< orphan*/ unload_fs();
int main() {
  shell();
  unload_fs();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <shell@plt>
mov    $0x0,%al
call   1030 <unload_fs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <shell@plt>
xor    %eax,%eax
call   1030 <unload_fs@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @shell()
%3 = call i32 (...) @unload_fs()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @shell()
%2 = tail call i32 (...) @unload_fs()
ret i32 0
}
int m_min(int a, int b) {
  if (a < b)
    return a;
  return b;
}


x86 assembly (clang, -O0):
<m_min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <m_min+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <m_min+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @m_min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
void send_auth() {}


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

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

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

LLVM IR (-O2):
define void @send_auth() {
ret void
}
void caller_1_2_1_1_1_2_2() {}


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

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

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

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

/* Variables and functions */
int prompt_error_msg_internal(char const *, char *, int);
int /*<<< orphan*/ vsnprintf(char *, int, char const *, int /*<<< orphan*/);
int prompt_error_msg_internalv(const char title[], const char format[],
                               int prompt_skip, va_list pa) {
  char msg[2048];
  vsnprintf(msg, sizeof(msg), format, pa);
  return prompt_error_msg_internal(title, msg, prompt_skip);
}


x86 assembly (clang, -O0):
<prompt_error_msg_internalv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    -0x820(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    $0x800,%esi
call   1030 <vsnprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x820(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <prompt_error_msg_internal@plt>
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt_error_msg_internalv>:
push   %rbp
push   %r14
push   %rbx
sub    $0x800,%rsp
mov    %edx,%ebp
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x800,%esi
call   1030 <vsnprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <prompt_error_msg_internal@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @prompt_error_msg_internalv(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [2048 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %6
%12 = load i32, i32* %8
%13 = call i32 @vsnprintf(i8* %10, i32 2048, i8* %11, i32 %12)
%14 = load i8*, i8** %5
%15 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%16 = load i32, i32* %7
%17 = call i32 @prompt_error_msg_internal(i8* %14, i8* %15, i32 %16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @prompt_error_msg_internalv(i8* %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = alloca [2048 x i8]
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%7 = call i32 @vsnprintf(i8* %6, i32 2048, i8* %1, i32 %3)
%8 = call i32 @prompt_error_msg_internal(i8* %0, i8* %6, i32 %2)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ test_condition(int);
int main(void) {
  test_condition(-10);
  test_condition(-1);
  test_condition(0);
  test_condition(1);
  test_condition(10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xfffffff6,%edi
call   1030 <test_condition@plt>
mov    $0xffffffff,%edi
call   1030 <test_condition@plt>
xor    %edi,%edi
call   1030 <test_condition@plt>
mov    $0x1,%edi
call   1030 <test_condition@plt>
mov    $0xa,%edi
call   1030 <test_condition@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xfffffff6,%edi
call   1030 <test_condition@plt>
mov    $0xffffffff,%edi
call   1030 <test_condition@plt>
xor    %edi,%edi
call   1030 <test_condition@plt>
mov    $0x1,%edi
call   1030 <test_condition@plt>
mov    $0xa,%edi
call   1030 <test_condition@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test_condition(i32 -10)
%3 = call i32 @test_condition(i32 -1)
%4 = call i32 @test_condition(i32 0)
%5 = call i32 @test_condition(i32 1)
%6 = call i32 @test_condition(i32 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_condition(i32 -10)
%2 = tail call i32 @test_condition(i32 -1)
%3 = tail call i32 @test_condition(i32 0)
%4 = tail call i32 @test_condition(i32 1)
%5 = tail call i32 @test_condition(i32 10)
ret i32 0
}
void g3(int x) {}


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

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

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

LLVM IR (-O2):
define void @g3(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "vita-libs-gen by xerpi\n"
                  "usage:\n\tvita-libs-gen nids.json output-dir\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [67 x i8] c"vita-libs-gen by xerpi\0Ausage:\0A\09vita-libs-gen nids.json output-dir\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))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [67 x i8] c"vita-libs-gen by xerpi\0Ausage:\0A\09vita-libs-gen nids.json output-dir\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))
ret void
}
int PriComp(int n1, int n2) { return n2 - n1; }


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

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

LLVM IR (-O0):
define i32 @PriComp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @PriComp(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
ret i32 %3
}
int baz(void) { return 15; }


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

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

LLVM IR (-O0):
define i32 @baz() {
ret i32 15
}

LLVM IR (-O2):
define i32 @baz() {
ret i32 15
}
/* Type definitions */
struct epoll_event {
  int dummy;
};

/* Variables and functions */
int syscall(int, int, struct epoll_event *, int, int);
int epoll_wait(int epfd, struct epoll_event *events, int maxevents,
               int timeout) {
  return (syscall(256, epfd, events, maxevents, timeout));
}


x86 assembly (clang, -O0):
<epoll_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x100,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epoll_wait>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x100,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.epoll_event = type { i32 }
define i32 @epoll_wait(i32 %0, %struct.epoll_event* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.epoll_event*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store %struct.epoll_event* %1, %struct.epoll_event** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load %struct.epoll_event*, %struct.epoll_event** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @syscall(i32 256, i32 %9, %struct.epoll_event* %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.epoll_event = type { i32 }
define i32 @epoll_wait(i32 %0, %struct.epoll_event* %1, i32 %2, i32 %3) {
%5 = tail call i32 @syscall(i32 256, i32 %0, %struct.epoll_event* %1, i32 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ initPowerManagement();
int /*<<< orphan*/ initPowerManagementTest();
int /*<<< orphan*/ parseArguments(int, char **);
int /*<<< orphan*/ savePower();
int main(int argc, char *argv[]) {
  initPowerManagementTest();
  parseArguments(argc, argv);
  initPowerManagement();
  savePower();
  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)
mov    $0x0,%al
call   1030 <initPowerManagementTest@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <parseArguments@plt>
mov    $0x0,%al
call   1060 <initPowerManagement@plt>
mov    $0x0,%al
call   1040 <savePower@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <initPowerManagementTest@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <parseArguments@plt>
xor    %eax,%eax
call   1060 <initPowerManagement@plt>
xor    %eax,%eax
call   1040 <savePower@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @initPowerManagementTest()
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @parseArguments(i32 %7, i8** %8)
%10 = call i32 (...) @initPowerManagement()
%11 = call i32 (...) @savePower()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @initPowerManagementTest()
%4 = tail call i32 @parseArguments(i32 %0, i8** %1)
%5 = tail call i32 (...) @initPowerManagement()
%6 = tail call i32 (...) @savePower()
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int int32_t;

/* Variables and functions */
__attribute__((always_)) uint8_t clamp_byte(int32_t n) {
  n = n > 255 ? 255 : n;
  return n < 0 ? 0 : n;
}


x86 assembly (clang, -O0):
<clamp_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jle    1121 <clamp_byte+0x21>
mov    $0xff,%eax
mov    %eax,-0x8(%rbp)
jmp    1127 <clamp_byte+0x27>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1141 <clamp_byte+0x41>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <clamp_byte+0x47>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp_byte>:
cmp    $0xff,%edi
mov    $0xff,%ecx
cmovl  %edi,%ecx
xor    %eax,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @clamp_byte(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 255
br i1 %4, label %5, label %6
5: ; preds = %1
br label %8
6: ; preds = %1
%7 = load i32, i32* %2
br label %8
8: ; preds = %6, %5
%9 = phi i32 [ 255, %5 ], [ %7, %6 ]
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
br label %15
13: ; preds = %8
%14 = load i32, i32* %2
br label %15
15: ; preds = %13, %12
%16 = phi i32 [ 0, %12 ], [ %14, %13 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @clamp_byte(i32 %0) {
%2 = icmp slt i32 %0, 255
%3 = select i1 %2, i32 %0, i32 255
%4 = icmp sgt i32 %3, 0
%5 = select i1 %4, i32 %3, i32 0
ret i32 %5
}
/* Type definitions */
struct process {
  int dummy;
};

/* Variables and functions */
long trace_user_readw(struct process *, int);
long get_syscall_arg(struct process *proc, int arg_num) {
  if (arg_num == -1)
    return trace_user_readw(proc, 0);
  return trace_user_readw(proc, 4 * arg_num);
}


x86 assembly (clang, -O0):
<get_syscall_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    113d <get_syscall_arg+0x2d>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <trace_user_readw@plt>
mov    %rax,-0x8(%rbp)
jmp    1150 <get_syscall_arg+0x40>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
shl    $0x2,%esi
call   1030 <trace_user_readw@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_syscall_arg>:
lea    0x0(,%rsi,4),%ecx
xor    %eax,%eax
cmp    $0xffffffff,%esi
cmovne %ecx,%eax
mov    %eax,%esi
jmp    1030 <trace_user_readw@plt>

LLVM IR (-O0):
%struct.process = type { i32 }
define i64 @get_syscall_arg(%struct.process* %0, i32 %1) {
%3 = alloca i64
%4 = alloca %struct.process*
%5 = alloca i32
store %struct.process* %0, %struct.process** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load %struct.process*, %struct.process** %4
%10 = call i64 @trace_user_readw(%struct.process* %9, i32 0)
store i64 %10, i64* %3
br label %16
11: ; preds = %2
%12 = load %struct.process*, %struct.process** %4
%13 = load i32, i32* %5
%14 = mul nsw i32 4, %13
%15 = call i64 @trace_user_readw(%struct.process* %12, i32 %14)
store i64 %15, i64* %3
br label %16
16: ; preds = %11, %8
%17 = load i64, i64* %3
ret i64 %17
}

LLVM IR (-O2):
%struct.process = type { i32 }
define i64 @get_syscall_arg(%struct.process* %0, i32 %1) {
%3 = icmp eq i32 %1, -1
%4 = shl nsw i32 %1, 2
%5 = select i1 %3, i32 0, i32 %4
%6 = tail call i64 @trace_user_readw(%struct.process* %0, i32 %5)
ret i64 %6
}
struct command *GETCOMM(struct command *c) {
  return (struct command *)(((unsigned long)c) & ~1UL);
}


x86 assembly (clang, -O0):
<GETCOMM>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfffffffffffffffe,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GETCOMM>:
mov    %rdi,%rax
and    $0xfffffffffffffffe,%rax
ret

LLVM IR (-O0):
%struct.command = type opaque
define %struct.command* @GETCOMM(%struct.command* %0) {
%2 = alloca %struct.command*
store %struct.command* %0, %struct.command** %2
%3 = load %struct.command*, %struct.command** %2
%4 = ptrtoint %struct.command* %3 to i64
%5 = and i64 %4, -2
%6 = inttoptr i64 %5 to %struct.command*
ret %struct.command* %6
}

LLVM IR (-O2):
%struct.command = type opaque
define %struct.command* @GETCOMM(%struct.command* %0) {
%2 = ptrtoint %struct.command* %0 to i64
%3 = and i64 %2, -2
%4 = inttoptr i64 %3 to %struct.command*
ret %struct.command* %4
}
/* Variables and functions */
int /*<<< orphan*/ getline(char *, int);
int /*<<< orphan*/ system(char *);
void casesy(void) {
  char sybuf[1024];
  getline(sybuf, 1024);
  system(sybuf);
}


x86 assembly (clang, -O0):
<casesy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
lea    -0x400(%rbp),%rdi
mov    $0x400,%esi
call   1040 <getline@plt>
lea    -0x400(%rbp),%rdi
call   1030 <system@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<casesy>:
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <getline@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @casesy() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @getline(i8* %2, i32 1024)
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%5 = call i32 @system(i8* %4)
ret void
}

LLVM IR (-O2):
define void @casesy() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @getline(i8* %2, i32 1024)
%4 = call i32 @system(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void displayHelp() {
  printf("\n");
  printf("Usage: \n");
  printf("    snoopy-run-threads   THREAD_COUNT   THREAD_EXEC_CMD   "
         "[THREAD_EXEC_ARGS]\n");
  printf("\n");
}


x86 assembly (clang, -O0):
<displayHelp>:
push   %rbp
mov    %rsp,%rbp
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayHelp>:
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
lea    0xeca(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [9 x i8] c"Usage: \0A\00"
@.str.2 = [78 x i8] c" snoopy-run-threads THREAD_COUNT THREAD_EXEC_CMD [THREAD_EXEC_ARGS]\0A\00"
define void @displayHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [8 x i8] c"Usage: \00"
@str.3 = [77 x i8] c" snoopy-run-threads THREAD_COUNT THREAD_EXEC_CMD [THREAD_EXEC_ARGS]\00"
define void @displayHelp() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sig_xfsz(int signo) { printf("SIGXFSZ caught\n"); }


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

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

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

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

/* Variables and functions */
int _snd_ctl_add_follower(struct snd_kcontrol *, struct snd_kcontrol *,
                          int /*<<< orphan*/);
int snd_ctl_add_follower(struct snd_kcontrol *master,
                         struct snd_kcontrol *follower) {
  return _snd_ctl_add_follower(master, follower, 0);
}


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

x86 assembly (clang, -O2):
<snd_ctl_add_follower>:
xor    %edx,%edx
jmp    1030 <_snd_ctl_add_follower@plt>

LLVM IR (-O0):
%struct.snd_kcontrol = type { i32 }
define i32 @snd_ctl_add_follower(%struct.snd_kcontrol* %0, %struct.snd_kcontrol* %1) {
%3 = alloca %struct.snd_kcontrol*
%4 = alloca %struct.snd_kcontrol*
store %struct.snd_kcontrol* %0, %struct.snd_kcontrol** %3
store %struct.snd_kcontrol* %1, %struct.snd_kcontrol** %4
%5 = load %struct.snd_kcontrol*, %struct.snd_kcontrol** %3
%6 = load %struct.snd_kcontrol*, %struct.snd_kcontrol** %4
%7 = call i32 @_snd_ctl_add_follower(%struct.snd_kcontrol* %5, %struct.snd_kcontrol* %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
%struct.snd_kcontrol = type { i32 }
define i32 @snd_ctl_add_follower(%struct.snd_kcontrol* %0, %struct.snd_kcontrol* %1) {
%3 = tail call i32 @_snd_ctl_add_follower(%struct.snd_kcontrol* %0, %struct.snd_kcontrol* %1, i32 0)
ret i32 %3
}
/* Variables and functions */
unsigned char floor(float);
unsigned char clamp_u8(float v) {
  if (v > 255.)
    return 255;
  else if (v < 0)
    return 0;
  else
    return floor(v + .5);
}


x86 assembly (clang, -O0):
<clamp_u8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1141 <clamp_u8+0x31>
movb   $0xff,-0x1(%rbp)
jmp    1178 <clamp_u8+0x68>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1157 <clamp_u8+0x47>
movb   $0x0,-0x1(%rbp)
jmp    1178 <clamp_u8+0x68>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <floor@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp_u8>:
mov    $0xff,%al
ucomiss 0xee7(%rip),%xmm0
ja     1125 <clamp_u8+0x15>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    1126 <clamp_u8+0x16>
xor    %eax,%eax
ret
addss  0xed6(%rip),%xmm0
jmp    1030 <floor@plt>

LLVM IR (-O0):
define zeroext i8 @clamp_u8(float %0) {
%2 = alloca i8
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fcmp ogt double %5, 2.550000e+02
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 -1, i8* %2
br label %18
8: ; preds = %1
%9 = load float, float* %3
%10 = fcmp olt float %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
store i8 0, i8* %2
br label %18
12: ; preds = %8
%13 = load float, float* %3
%14 = fpext float %13 to double
%15 = fadd double %14, 5.000000e-01
%16 = fptrunc double %15 to float
%17 = call zeroext i8 @floor(float %16)
store i8 %17, i8* %2
br label %18
18: ; preds = %12, %11, %7
%19 = load i8, i8* %2
ret i8 %19
}

LLVM IR (-O2):
define zeroext i8 @clamp_u8(float %0) {
%2 = fcmp ogt float %0, 2.550000e+02
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = fcmp olt float %0, 0.000000e+00
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = fadd float %0, 5.000000e-01
%7 = tail call zeroext i8 @floor(float %6)
br label %8
8: ; preds = %3, %1, %5
%9 = phi i8 [ %7, %5 ], [ -1, %1 ], [ 0, %3 ]
ret i8 %9
}
int slib_get_module_id(const char *name, const char *alias) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @slib_get_module_id(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -1
}
/* Variables and functions */
int __ffsl(unsigned long);
__attribute__((always_)) int __ffsll(long long value) {
  unsigned long high = (value >> 32);
  unsigned long low = (value >> 0);
  if (low) {
    return (__ffsl(low));
  } else if (high) {
    return (32 + __ffsl(high));
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<__ffsll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x0,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1150 <__ffsll+0x40>
mov    -0x20(%rbp),%rdi
call   1030 <__ffsl@plt>
mov    %eax,-0x4(%rbp)
jmp    1176 <__ffsll+0x66>
cmpq   $0x0,-0x18(%rbp)
je     116f <__ffsll+0x5f>
mov    -0x18(%rbp),%rdi
call   1030 <__ffsl@plt>
add    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    1176 <__ffsll+0x66>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ffsll>:
test   %rdi,%rdi
je     111a <__ffsll+0xa>
jmp    1030 <__ffsl@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @__ffsll(i64 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
%6 = load i64, i64* %3
%7 = ashr i64 %6, 32
store i64 %7, i64* %4
%8 = load i64, i64* %3
%9 = ashr i64 %8, 0
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i64, i64* %5
%14 = call i32 @__ffsl(i64 %13)
store i32 %14, i32* %2
br label %23
15: ; preds = %1
%16 = load i64, i64* %4
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i64, i64* %4
%20 = call i32 @__ffsl(i64 %19)
%21 = add nsw i32 32, %20
store i32 %21, i32* %2
br label %23
22: ; preds = %15
store i32 0, i32* %2
br label %23
23: ; preds = %22, %18, %12
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @__ffsll(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @__ffsl(i64 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *realloc(void *, size_t);
void *_mc_alloc_os_emul(void *ptr, size_t size, const char *_NOT_USED_1,
                        const char *_NOT_USED_2, int _NOT_USED_3) {
  ((void)_NOT_USED_1), ((void)_NOT_USED_2), ((void)_NOT_USED_3);
  if (size) {
    return realloc(ptr, size);
  }
  free(ptr);
  return NULL;
}


x86 assembly (clang, -O0):
<_mc_alloc_os_emul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115d <_mc_alloc_os_emul+0x3d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
jmp    116e <_mc_alloc_os_emul+0x4e>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mc_alloc_os_emul>:
test   %rsi,%rsi
je     112a <_mc_alloc_os_emul+0xa>
jmp    1040 <realloc@plt>
push   %rax
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i8* @_mc_alloc_os_emul(i8* nocapture %0, i64 %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i32 %4) {
%6 = icmp eq i64 %1, 0
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = tail call i8* @realloc(i8* %0, i64 %1)
br label %11
9: ; preds = %5
%10 = tail call i32 @free(i8* %0)
br label %11
11: ; preds = %9, %7
%12 = phi i8* [ %8, %7 ], [ null, %9 ]
ret i8* %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ twoMotors(int, int);
void motorInit() {
  twoMotors(100, 7600);
  printf("Motor initialized!\n");
}


x86 assembly (clang, -O0):
<motorInit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x64,%edi
mov    $0x1db0,%esi
call   1040 <twoMotors@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<motorInit>:
push   %rax
mov    $0x64,%edi
mov    $0x1db0,%esi
call   1040 <twoMotors@plt>
lea    0xec9(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Motor initialized!\0A\00"
define void @motorInit() {
%1 = call i32 @twoMotors(i32 100, i32 7600)
%2 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"Motor initialized!\00"
define void @motorInit() {
%1 = tail call i32 @twoMotors(i32 100, i32 7600)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  int rv = socket(PF_INET, SOCK_DGRAM, 0);
  if (rv >= 0) {
    close(rv);
    exit(0);
  }
  exit(rv);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1050 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1174 <main+0x44>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1050 <socket@plt>
mov    %eax,%edi
test   %eax,%eax
js     1157 <main+0x27>
call   1030 <close@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @PF_INET
%4 = load i32, i32* @SOCK_DGRAM
%5 = call i32 @socket(i32 %3, i32 %4, i32 0)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* %2
%10 = call i32 @close(i32 %9)
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %0
%13 = load i32, i32* %2
%14 = call i32 @exit(i32 %13)
unreachable
}

LLVM IR (-O2):
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
define i32 @main() {
%1 = load i32, i32* @PF_INET
%2 = load i32, i32* @SOCK_DGRAM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 0)
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = tail call i32 @close(i32 %3)
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %0
%9 = tail call i32 @exit(i32 %3)
unreachable
}
void hint_dump(__attribute__((unused)) struct hint_data *hint) {}


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

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

LLVM IR (-O0):
%struct.hint_data = type opaque
define void @hint_dump(%struct.hint_data* %0) {
%2 = alloca %struct.hint_data*
store %struct.hint_data* %0, %struct.hint_data** %2
ret void
}

LLVM IR (-O2):
%struct.hint_data = type opaque
define void @hint_dump(%struct.hint_data* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ init_game();
void *get_init_stateI(void) { return ((void *)init_game()); }


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

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

LLVM IR (-O0):
define i8* @get_init_stateI() {
%1 = call i64 (...) @init_game()
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}

LLVM IR (-O2):
define i8* @get_init_stateI() {
%1 = tail call i64 (...) @init_game()
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ SendInterrupt(int, int, int, int);
void ScuSendDMAIllegal(void) { SendInterrupt(0x4C, 0x3, 0x1000, 0x00001000); }


x86 assembly (clang, -O0):
<ScuSendDMAIllegal>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4c,%edi
mov    $0x3,%esi
mov    $0x1000,%ecx
mov    %ecx,%edx
call   1030 <SendInterrupt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ScuSendDMAIllegal>:
mov    $0x4c,%edi
mov    $0x3,%esi
mov    $0x1000,%edx
mov    $0x1000,%ecx
jmp    1030 <SendInterrupt@plt>

LLVM IR (-O0):
define void @ScuSendDMAIllegal() {
%1 = call i32 @SendInterrupt(i32 76, i32 3, i32 4096, i32 4096)
ret void
}

LLVM IR (-O2):
define void @ScuSendDMAIllegal() {
%1 = tail call i32 @SendInterrupt(i32 76, i32 3, i32 4096, i32 4096)
ret void
}
float sgn(float v) {
  if (v == 0.0)
    return 0.0;
  if (v < 0.0)
    return -1.0;
  else
    return 1.0;
}


x86 assembly (clang, -O0):
<sgn>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1132 <sgn+0x32>
jp     1132 <sgn+0x32>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1167 <sgn+0x67>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    115a <sgn+0x5a>
movss  0xeb4(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1167 <sgn+0x67>
movss  0xe9e(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgn>:
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
lea    0xeee(%rip),%rcx
movss  (%rcx,%rax,4),%xmm2
cmpeqss %xmm1,%xmm0
andnps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @sgn(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fcmp oeq double %5, 0.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %1
store float 0.000000e+00, float* %2
br label %14
8: ; preds = %1
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = fcmp olt double %10, 0.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %8
store float -1.000000e+00, float* %2
br label %14
13: ; preds = %8
store float 1.000000e+00, float* %2
br label %14
14: ; preds = %13, %12, %7
%15 = load float, float* %2
ret float %15
}

LLVM IR (-O2):
define float @sgn(float %0) {
%2 = fcmp oeq float %0, 0.000000e+00
%3 = fcmp olt float %0, 0.000000e+00
%4 = select i1 %3, float -1.000000e+00, float 1.000000e+00
%5 = select i1 %2, float 0.000000e+00, float %4
ret float %5
}
/* Type definitions */
struct stat {
  int st_ino;
};

/* Variables and functions */
int fstat(int, struct stat *);
int /*<<< orphan*/ perror(char *);
int get_inode(int fd) {
  struct stat buf;
  int ret;
  ret = fstat(fd, &buf);
  if (ret < 0) {
    perror("fstat");
    return -1;
  }
  return buf.st_ino;
}


x86 assembly (clang, -O0):
<get_inode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <fstat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    115c <get_inode+0x3c>
lea    0xeb5(%rip),%rdi
call   1030 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <get_inode+0x42>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_inode>:
push   %rax
mov    %rsp,%rsi
call   1040 <fstat@plt>
test   %eax,%eax
js     1132 <get_inode+0x12>
mov    (%rsp),%eax
pop    %rcx
ret
lea    0xec7(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [6 x i8] c"fstat\00"
define i32 @get_inode(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.stat
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @fstat(i32 %6, %struct.stat* %4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %15
12: ; preds = %1
%13 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%14 = load i32, i32* %13
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %10
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [6 x i8] c"fstat\00"
define i32 @get_inode(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%10 = load i32, i32* %9
br label %11
11: ; preds = %8, %6
%12 = phi i32 [ -1, %6 ], [ %10, %8 ]
ret i32 %12
}
int plat_device_is_coherent(struct device *dev) {}


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

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

LLVM IR (-O0):
%struct.device = type opaque
define i32 @plat_device_is_coherent(%struct.device* %0) {
%2 = alloca i32
%3 = alloca %struct.device*
store %struct.device* %0, %struct.device** %3
%4 = load i32, i32* %2
ret i32 %4
}

LLVM IR (-O2):
%struct.device = type opaque
define i32 @plat_device_is_coherent(%struct.device* nocapture readnone %0) {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ u_short;
typedef int /*<<< orphan*/ u_char;

/* Variables and functions */
int /*<<< orphan*/ PUTSHORT(int /*<<< orphan*/, int /*<<< orphan*/ *);
void __putshort(register u_short s, register u_char *msgp) {
  PUTSHORT(s, msgp);
}


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

x86 assembly (clang, -O2):
<__putshort>:
jmp    1030 <PUTSHORT@plt>

LLVM IR (-O0):
define void @__putshort(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 = call i32 @PUTSHORT(i32 %5, i32* %6)
ret void
}

LLVM IR (-O2):
define void @__putshort(i32 %0, i32* %1) {
%3 = tail call i32 @PUTSHORT(i32 %0, i32* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t swap_bytes8(uint8_t i) { return i; }


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

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

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

LLVM IR (-O2):
define i32 @swap_bytes8(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ create_message_queue(int);
int /*<<< orphan*/ delete_message_queue();
int /*<<< orphan*/ send_message(char *);
int main() {
  int permission = 0666;
  char message[] = "Hello World!";
  create_message_queue(permission);
  send_message(message);
  delete_message_queue();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1b6,-0x8(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x15(%rbp)
mov    0xeb1(%rip),%eax
mov    %eax,-0xd(%rbp)
mov    0xeac(%rip),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <create_message_queue@plt>
lea    -0x15(%rbp),%rdi
call   1030 <send_message@plt>
mov    $0x0,%al
call   1050 <delete_message_queue@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x21646c726f5720,%rax
mov    %rax,0xd(%rsp)
movabs $0x6f57206f6c6c6548,%rax
20 57 6f
mov    %rax,0x8(%rsp)
mov    $0x1b6,%edi
call   1040 <create_message_queue@plt>
lea    0x8(%rsp),%rdi
call   1030 <send_message@plt>
xor    %eax,%eax
call   1050 <delete_message_queue@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.message = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [13 x i8]
store i32 0, i32* %1
store i32 438, i32* %2
%4 = bitcast [13 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = call i32 @create_message_queue(i32 %5)
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%8 = call i32 @send_message(i8* %7)
%9 = call i32 (...) @delete_message_queue()
ret i32 0
}

LLVM IR (-O2):
@__const.main.message = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @create_message_queue(i32 438)
%4 = call i32 @send_message(i8* %2)
%5 = call i32 (...) @delete_message_queue()
ret i32 0
}
void slpqimmed(void (*func)(), void *arg) {
  if (func != (void (*)())(0))
    (*func)(arg);
}


x86 assembly (clang, -O0):
<slpqimmed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1127 <slpqimmed+0x27>
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   *%rcx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slpqimmed>:
test   %rdi,%rdi
je     110f <slpqimmed+0xf>
mov    %rdi,%rcx
mov    %rsi,%rdi
xor    %eax,%eax
jmp    *%rcx
ret

LLVM IR (-O0):
define void @slpqimmed(void (...)* %0, i8* %1) {
%3 = alloca void (...)*
%4 = alloca i8*
store void (...)* %0, void (...)** %3
store i8* %1, i8** %4
%5 = load void (...)*, void (...)** %3
%6 = icmp ne void (...)* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load void (...)*, void (...)** %3
%9 = load i8*, i8** %4
%10 = bitcast void (...)* %8 to void (i8*, ...)*
br label %11
11: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @slpqimmed(void (...)* %0, i8* %1) {
%3 = icmp eq void (...)* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = bitcast void (...)* %0 to void (i8*, ...)*
tail call void (i8*, ...) %5(i8* %1)
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
scalar_t__ isupper(int);
int tolower(int c) { return isupper(c) ? c - ('A' - 'a') : c; }


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
je     113b <tolower+0x2b>
mov    -0x4(%rbp),%eax
sub    $0xffffffe0,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <tolower+0x31>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
push   %rbx
mov    %edi,%ebx
call   1030 <isupper@plt>
lea    0x20(%rbx),%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = tail call i64 @isupper(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void emit_help(void) {
  fputs("Usage: findup [-H] [-d|-f] [-q] filename [dir-path]", stderr);
  exit(EX_USAGE);
}


x86 assembly (clang, -O0):
<emit_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<emit_help>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Usage: findup [-H] [-d|-f] [-q] filename [dir-path]\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@.str = [52 x i8] c"Usage: findup [-H] [-d|-f] [-q] filename [dir-path]\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
char *strchr(char const *, char);
ssize_t str_index_dfl(const char *s, char c, ssize_t dfl) {
  const char *r = strchr(s, c);
  return r ? r - s : dfl;
}


x86 assembly (clang, -O0):
<str_index_dfl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1155 <str_index_dfl+0x45>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    115d <str_index_dfl+0x4d>
movslq -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_index_dfl>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
call   1030 <strchr@plt>
mov    %eax,%ecx
sub    %ebx,%ecx
test   %rax,%rax
cmove  %ebp,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @str_index_dfl(i8* %0, i8 signext %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8 %1, i8* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i8, i8* %5
%10 = call i8* @strchr(i8* %8, i8 signext %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %19
13: ; preds = %3
%14 = load i8*, i8** %7
%15 = load i8*, i8** %4
%16 = ptrtoint i8* %14 to i64
%17 = ptrtoint i8* %15 to i64
%18 = sub i64 %16, %17
br label %22
19: ; preds = %3
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
br label %22
22: ; preds = %19, %13
%23 = phi i64 [ %18, %13 ], [ %21, %19 ]
%24 = trunc i64 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @str_index_dfl(i8* %0, i8 signext %1, i32 %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext %1)
%5 = icmp eq i8* %4, null
%6 = ptrtoint i8* %4 to i64
%7 = ptrtoint i8* %0 to i64
%8 = sub i64 %6, %7
%9 = zext i32 %2 to i64
%10 = select i1 %5, i64 %9, i64 %8
%11 = trunc i64 %10 to i32
ret i32 %11
}