xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned long lrint(double);
unsigned long cC_to_mkelvin(double c) { return lrint(c * 10 + 273150); }


x86 assembly (clang, -O0):
<cC_to_mkelvin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed2(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <lrint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cC_to_mkelvin>:
mulsd  0xee8(%rip),%xmm0
addsd  0xee8(%rip),%xmm0
jmp    1030 <lrint@plt>

LLVM IR (-O0):
define i64 @cC_to_mkelvin(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fmuladd.f64(double %3, double 1.000000e+01, double 2.731500e+05)
%5 = call i64 @lrint(double %4)
ret i64 %5
}

LLVM IR (-O2):
define i64 @cC_to_mkelvin(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 1.000000e+01, double 2.731500e+05)
%3 = tail call i64 @lrint(double %2)
ret i64 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ IntDisable(int /*<<< orphan*/);
int /*<<< orphan*/ IntUnregister(int /*<<< orphan*/);
int /*<<< orphan*/ _USBIntNumberGet(int /*<<< orphan*/);
void USBIntUnregister(uint32_t ui32Base) {
  uint32_t ui32Int;
  ;
  ui32Int = _USBIntNumberGet(ui32Base);
  ;
  IntDisable(ui32Int);
  IntUnregister(ui32Int);
}


x86 assembly (clang, -O0):
<USBIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <_USBIntNumberGet@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <IntDisable@plt>
mov    -0x8(%rbp),%edi
call   1040 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBIntUnregister>:
push   %rbx
call   1050 <_USBIntNumberGet@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <IntDisable@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <IntUnregister@plt>

LLVM IR (-O0):
define void @USBIntUnregister(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @_USBIntNumberGet(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @IntDisable(i32 %6)
%8 = load i32, i32* %3
%9 = call i32 @IntUnregister(i32 %8)
ret void
}

LLVM IR (-O2):
define void @USBIntUnregister(i32 %0) {
%2 = tail call i32 @_USBIntNumberGet(i32 %0)
%3 = tail call i32 @IntDisable(i32 %2)
%4 = tail call i32 @IntUnregister(i32 %2)
ret void
}
/* Variables and functions */
char *p_dcgettext(char const *, char const *, int);
int /*<<< orphan*/ setup();
char *g_libintl_dcgettext(const char *domainname, const char *msgid,
                          int category) {
  setup();
  return p_dcgettext(domainname, msgid, category);
}


x86 assembly (clang, -O0):
<g_libintl_dcgettext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1040 <setup@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <p_dcgettext@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_libintl_dcgettext>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
xor    %eax,%eax
call   1040 <setup@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <p_dcgettext@plt>

LLVM IR (-O0):
define i8* @g_libintl_dcgettext(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = call i32 (...) @setup()
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i8* @p_dcgettext(i8* %8, i8* %9, i32 %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @g_libintl_dcgettext(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 (...) @setup()
%5 = tail call i8* @p_dcgettext(i8* %0, i8* %1, i32 %2)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
char *malloc(int);
char *json_arr_alloc() {
  char *buf;
  buf = malloc(3);
  assert(NULL != buf);
  buf[0] = '[';
  buf[1] = ']';
  buf[2] = '\0';
  return buf;
}


x86 assembly (clang, -O0):
<json_arr_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
movb   $0x5b,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x5d,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_arr_alloc>:
push   %rbx
mov    $0x3,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1030 <assert@plt>
movw   $0x5d5b,(%rbx)
movb   $0x0,0x2(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @json_arr_alloc() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 3)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* null, %3
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i8*, i8** %1
%8 = getelementptr inbounds i8, i8* %7, i64 0
store i8 91, i8* %8
%9 = load i8*, i8** %1
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8 93, i8* %10
%11 = load i8*, i8** %1
%12 = getelementptr inbounds i8, i8* %11, i64 2
store i8 0, i8* %12
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
define noalias i8* @json_arr_alloc() {
%1 = tail call dereferenceable_or_null(3) i8* @malloc(i32 3)
%2 = icmp ne i8* %1, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
store i8 91, i8* %1
%5 = getelementptr inbounds i8, i8* %1, i64 1
store i8 93, i8* %5
%6 = getelementptr inbounds i8, i8* %1, i64 2
store i8 0, i8* %6
ret i8* %1
}
/* Type definitions */
typedef int __le16;

/* Variables and functions */
int cpu_to_le16(int);
int ieee80211_is_assoc_resp(__le16 fc) {
  return (fc & cpu_to_le16(0x000c | 0x00f0)) == cpu_to_le16(0x0000 | 0x0010);
}


x86 assembly (clang, -O0):
<ieee80211_is_assoc_resp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0xfc,%edi
call   1030 <cpu_to_le16@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x10,%edi
call   1030 <cpu_to_le16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieee80211_is_assoc_resp>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0xfc,%edi
call   1030 <cpu_to_le16@plt>
mov    %eax,%ebp
and    %ebx,%ebp
mov    $0x10,%edi
call   1030 <cpu_to_le16@plt>
xor    %ecx,%ecx
cmp    %eax,%ebp
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ieee80211_is_assoc_resp(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @cpu_to_le16(i32 252)
%5 = and i32 %3, %4
%6 = call i32 @cpu_to_le16(i32 16)
%7 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @ieee80211_is_assoc_resp(i32 %0) {
%2 = tail call i32 @cpu_to_le16(i32 252)
%3 = and i32 %2, %0
%4 = tail call i32 @cpu_to_le16(i32 16)
%5 = icmp eq i32 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
long abs(long);
int values_close(long a, long b, int err) {
  return abs(a - b) <= (a + b) / 100 * err;
}


x86 assembly (clang, -O0):
<values_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
sub    -0x10(%rbp),%rdi
call   1030 <abs@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    $0x64,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rdx
imul   %rdx,%rcx
cmp    %rcx,%rax
setle  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<values_close>:
mov    %edx,%r8d
mov    %rdi,%rax
sub    %rsi,%rax
mov    %rax,%rcx
neg    %rcx
cmovs  %rax,%rcx
add    %rdi,%rsi
movabs $0xa3d70a3d70a3d70b,%rdx
0a d7 a3
mov    %rsi,%rax
imul   %rdx
add    %rsi,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x6,%rdx
add    %rax,%rdx
movslq %r8d,%rsi
imul   %rdx,%rsi
xor    %eax,%eax
cmp    %rsi,%rcx
setle  %al
ret

LLVM IR (-O0):
define i32 @values_close(i64 %0, i64 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i64 %0, i64* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = sub nsw i64 %7, %8
%10 = call i64 @abs(i64 %9)
%11 = load i64, i64* %4
%12 = load i64, i64* %5
%13 = add nsw i64 %11, %12
%14 = sdiv i64 %13, 100
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = mul nsw i64 %14, %16
%18 = icmp sle i64 %10, %17
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @values_close(i64 %0, i64 %1, i32 %2) {
%4 = sub nsw i64 %0, %1
%5 = tail call i64 @llvm.abs.i64(i64 %4, i1 true)
%6 = add nsw i64 %1, %0
%7 = sdiv i64 %6, 100
%8 = sext i32 %2 to i64
%9 = mul nsw i64 %7, %8
%10 = icmp sle i64 %5, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ txword(unsigned int);
void write_reg(unsigned r, unsigned v) { txword(r * 512 + 256 + (v & 255)); }


x86 assembly (clang, -O0):
<write_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x9,%edi
add    $0x100,%edi
mov    -0x8(%rbp),%eax
and    $0xff,%eax
add    %eax,%edi
call   1030 <txword@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_reg>:
shl    $0x9,%edi
movzbl %sil,%eax
add    %eax,%edi
add    $0x100,%edi
jmp    1030 <txword@plt>

LLVM IR (-O0):
define void @write_reg(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 = mul i32 %5, 512
%7 = add i32 %6, 256
%8 = load i32, i32* %4
%9 = and i32 %8, 255
%10 = add i32 %7, %9
%11 = call i32 @txword(i32 %10)
ret void
}

LLVM IR (-O2):
define void @write_reg(i32 %0, i32 %1) {
%3 = shl i32 %0, 9
%4 = and i32 %1, 255
%5 = or i32 %4, %3
%6 = or i32 %5, 256
%7 = tail call i32 @txword(i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ my_signal(int, void (*)(int));
int /*<<< orphan*/ printf(char *);
void sigquit(int signo) {
  my_signal(signo, sigquit);
  printf("Caught SIGQUIT\n");
}


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

x86 assembly (clang, -O2):
<sigquit>:
push   %rax
mov    0x2ec0(%rip),%rsi
call   1040 <my_signal@plt>
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Caught SIGQUIT\0A\00"
define void @sigquit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @my_signal(i32 %3, void (i32)* @sigquit)
%5 = 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"Caught SIGQUIT\00"
define void @sigquit(i32 %0) {
%2 = tail call i32 @my_signal(i32 %0, void (i32)* @sigquit)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int foo() { return EXIT_SUCCESS; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @foo() {
%1 = load i32, i32* @EXIT_SUCCESS
ret i32 %1
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @foo() {
%1 = load i32, i32* @EXIT_SUCCESS
ret i32 %1
}
int _func_xpath_ignore(char *chunk, void *data) {
  (void)(chunk);
  (void)(data);
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @_func_xpath_ignore(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
scalar_t__ daemon(int, int /*<<< orphan*/);
int /*<<< orphan*/ die(char *);
void start_daemon(void) {
  if (daemon(1, 0) < 0)
    die("starting daemon");
}


x86 assembly (clang, -O0):
<start_daemon>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <daemon@plt>
cmp    $0x0,%rax
jge    1146 <start_daemon+0x26>
lea    0xebf(%rip),%rdi
call   1040 <die@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_daemon>:
push   %rax
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <daemon@plt>
test   %rax,%rax
js     1134 <start_daemon+0x14>
pop    %rax
ret
lea    0xec5(%rip),%rdi
pop    %rax
jmp    1040 <die@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"starting daemon\00"
define void @start_daemon() {
%1 = call i64 @daemon(i32 1, i32 0)
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"starting daemon\00"
define void @start_daemon() {
%1 = tail call i64 @daemon(i32 1, i32 0)
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ run_implementation();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char const *argv[]) {
  srand(time(NULL));
  run_implementation();
  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)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1040 <run_implementation@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1040 <run_implementation@plt>
xor    %eax,%eax
pop    %rcx
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 @time(i32* null)
%7 = call i32 @srand(i32 %6)
%8 = call i32 (...) @run_implementation()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (...) @run_implementation()
ret i32 0
}
/* Variables and functions */
scalar_t__ clamp(float, int /*<<< orphan*/, int);
int compare_llhh(const void *a, const void *b) {
  return (int)clamp(((float *)a)[0] * 300, 0, 300 - 1) -
         (int)clamp(((float *)b)[0] * 300, 0, 300 - 1);
}


x86 assembly (clang, -O0):
<compare_llhh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  0xed4(%rip),%xmm0
mulss  (%rax),%xmm0
xor    %edi,%edi
mov    $0x12b,%esi
call   1030 <clamp@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  0xeb5(%rip),%xmm0
mulss  (%rax),%xmm0
xor    %edi,%edi
mov    $0x12b,%esi
call   1030 <clamp@plt>
mov    %rax,%rcx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_llhh>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
movss  (%rdi),%xmm0
mulss  0xedd(%rip),%xmm0
xor    %edi,%edi
mov    $0x12b,%esi
call   1030 <clamp@plt>
mov    %rax,%rbx
movss  0xec6(%rip),%xmm0
mulss  (%r14),%xmm0
xor    %edi,%edi
mov    $0x12b,%esi
call   1030 <clamp@plt>
sub    %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @compare_llhh(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to float*
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = fmul float %8, 3.000000e+02
%10 = call i64 @clamp(float %9, i32 0, i32 299)
%11 = trunc i64 %10 to i32
%12 = load i8*, i8** %4
%13 = bitcast i8* %12 to float*
%14 = getelementptr inbounds float, float* %13, i64 0
%15 = load float, float* %14
%16 = fmul float %15, 3.000000e+02
%17 = call i64 @clamp(float %16, i32 0, i32 299)
%18 = trunc i64 %17 to i32
%19 = sub nsw i32 %11, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @compare_llhh(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = load float, float* %3
%5 = fmul float %4, 3.000000e+02
%6 = tail call i64 @clamp(float %5, i32 0, i32 299)
%7 = trunc i64 %6 to i32
%8 = bitcast i8* %1 to float*
%9 = load float, float* %8
%10 = fmul float %9, 3.000000e+02
%11 = tail call i64 @clamp(float %10, i32 0, i32 299)
%12 = trunc i64 %11 to i32
%13 = sub nsw i32 %7, %12
ret i32 %13
}
/* Type definitions */
struct stat {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int fstat(int /*<<< orphan*/, struct stat *);
void *to_nit_file_stat(struct stat *);
void *file_NativeFile_NativeFile_file_stat_0(FILE *f) {
  struct stat buff;
  if (fstat(fileno(f), &buff) != -1)
    return to_nit_file_stat(&buff);
  return 0;
}


x86 assembly (clang, -O0):
<file_NativeFile_NativeFile_file_stat_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fileno@plt>
mov    %eax,%edi
lea    -0x18(%rbp),%rsi
call   1050 <fstat@plt>
cmp    $0xffffffff,%eax
je     116b <file_NativeFile_NativeFile_file_stat_0+0x3b>
lea    -0x18(%rbp),%rdi
call   1040 <to_nit_file_stat@plt>
mov    %rax,-0x8(%rbp)
jmp    1173 <file_NativeFile_NativeFile_file_stat_0+0x43>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_NativeFile_NativeFile_file_stat_0>:
push   %rax
call   1030 <fileno@plt>
mov    %rsp,%rsi
mov    %eax,%edi
call   1050 <fstat@plt>
cmp    $0xffffffff,%eax
je     114f <file_NativeFile_NativeFile_file_stat_0+0x1f>
mov    %rsp,%rdi
call   1040 <to_nit_file_stat@plt>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i8* @file_NativeFile_NativeFile_file_stat_0(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca %struct.stat
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i32 @fileno(i32* %5)
%7 = call i32 @fstat(i32 %6, %struct.stat* %4)
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i8* @to_nit_file_stat(%struct.stat* %4)
store i8* %10, i8** %2
br label %12
11: ; preds = %1
store i8* null, i8** %2
br label %12
12: ; preds = %11, %9
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i8* @file_NativeFile_NativeFile_file_stat_0(i32* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = tail call i32 @fileno(i32* %0)
%5 = call i32 @fstat(i32 %4, %struct.stat* %2)
%6 = icmp eq i32 %5, -1
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i8* @to_nit_file_stat(%struct.stat* %2)
br label %9
9: ; preds = %1, %7
%10 = phi i8* [ %8, %7 ], [ null, %1 ]
ret i8* %10
}
int Operand_ar0_encode(unsigned int *valp) {
  int error;
  error = (*valp & ~0x3f) != 0;
  return error;
}


x86 assembly (clang, -O0):
<Operand_ar0_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xffffffc0,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_ar0_encode>:
xor    %eax,%eax
cmpl   $0x40,(%rdi)
setae  %al
ret

LLVM IR (-O0):
define i32 @Operand_ar0_encode(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = and i32 %5, -64
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i32
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @Operand_ar0_encode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp ugt i32 %2, 63
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int stdin;
int main(void) {
  printf("%d", stdin);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ greek(int /*<<< orphan*/ *);
int main(int argc, const char *argv[]) {
  FILE *infile;
  infile = fopen("/Users/MainasuK/Documents/Github/TASC/ch15/ex02_greek/"
                 "ex02_greek/troilus.dat",
                 "r");
  greek(infile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    0xf09(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <greek@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xf1e(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,%rdi
call   1040 <greek@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [77 x i8] c"/Users/MainasuK/Documents/Github/TASC/ch15/ex02_greek/ex02_greek/troilus.dat\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32* @fopen(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %6
%8 = load i32*, i32** %6
%9 = call i32 @greek(i32* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [77 x i8] c"/Users/MainasuK/Documents/Github/TASC/ch15/ex02_greek/ex02_greek/troilus.dat\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @greek(i32* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ my_str(char *);
void sig_alarm() {
  my_str("Attempt to contact server timed out.\n");
  exit(1);
}


x86 assembly (clang, -O0):
<sig_alarm>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <my_str@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sig_alarm>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <my_str@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Attempt to contact server timed out.\0A\00"
define void @sig_alarm() {
%1 = call i32 @my_str(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [38 x i8] c"Attempt to contact server timed out.\0A\00"
define void @sig_alarm() {
%1 = tail call i32 @my_str(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
void set_dlen(int length) {}


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

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

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

LLVM IR (-O2):
define void @set_dlen(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long *, long *);
main() {
  long int a, b, c;
  printf("Enter two LONG numbers:\n");
  scanf("%ld %ld", &a, &b);
  c = a * b;
  printf("The result is: %ld", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x8(%rsp),%rsi
imul   0x10(%rsp),%rsi
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter two LONG numbers:\0A\00"
@.str.1 = [8 x i8] c"%ld %ld\00"
@.str.2 = [19 x i8] c"The result is: %ld\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64* %1, i64* %2)
%6 = load i64, i64* %1
%7 = load i64, i64* %2
%8 = mul nsw i64 %6, %7
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 %9)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"%ld %ld\00"
@.str.2 = [19 x i8] c"The result is: %ld\00"
@str = [24 x i8] c"Enter two LONG numbers:\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64* %1, i64* %2)
%7 = load i64, i64* %1
%8 = load i64, i64* %2
%9 = mul nsw i64 %8, %7
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strindex(char *, char *);
main() {
  int atoi(char *);
  char s[] = "1000";
  printf("%d", atoi(s));
  printf("%d", strindex("HOGEHOGE", "GEHO"));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xebd(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x5(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1040 <strindex@plt>
mov    %eax,%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1040 <strindex@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [5 x i8] c"1000\00"
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"HOGEHOGE\00"
@.str.2 = [5 x i8] c"GEHO\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = bitcast [5 x i8]* %1 to i8*
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = call i32 @atoi(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @strindex(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"HOGEHOGE\00"
@.str.2 = [5 x i8] c"GEHO\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1000)
%2 = tail call i32 @strindex(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
void quatgetconjugate(float *qout, const float *qin) {
  qout[0] = qin[0];
  qout[1] = -qin[1];
  qout[2] = -qin[2];
  qout[3] = -qin[3];
}


x86 assembly (clang, -O0):
<quatgetconjugate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<quatgetconjugate>:
movss  (%rsi),%xmm0
movss  %xmm0,(%rdi)
movss  0x4(%rsi),%xmm0
movaps 0xeec(%rip),%xmm1
xorps  %xmm1,%xmm0
movss  %xmm0,0x4(%rdi)
movss  0x8(%rsi),%xmm0
xorps  %xmm1,%xmm0
movss  %xmm0,0x8(%rdi)
movss  0xc(%rsi),%xmm0
xorps  %xmm1,%xmm0
movss  %xmm0,0xc(%rdi)
ret

LLVM IR (-O0):
define void @quatgetconjugate(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %4
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %3
%9 = getelementptr inbounds float, float* %8, i64 0
store float %7, float* %9
%10 = load float*, float** %4
%11 = getelementptr inbounds float, float* %10, i64 1
%12 = load float, float* %11
%13 = fneg float %12
%14 = load float*, float** %3
%15 = getelementptr inbounds float, float* %14, i64 1
store float %13, float* %15
%16 = load float*, float** %4
%17 = getelementptr inbounds float, float* %16, i64 2
%18 = load float, float* %17
%19 = fneg float %18
%20 = load float*, float** %3
%21 = getelementptr inbounds float, float* %20, i64 2
store float %19, float* %21
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 3
%24 = load float, float* %23
%25 = fneg float %24
%26 = load float*, float** %3
%27 = getelementptr inbounds float, float* %26, i64 3
store float %25, float* %27
ret void
}

LLVM IR (-O2):
define void @quatgetconjugate(float* nocapture writeonly %0, float* nocapture %1) {
%3 = load float, float* %1
store float %3, float* %0
%4 = getelementptr inbounds float, float* %1, i64 1
%5 = load float, float* %4
%6 = fneg float %5
%7 = getelementptr inbounds float, float* %0, i64 1
store float %6, float* %7
%8 = getelementptr inbounds float, float* %1, i64 2
%9 = load float, float* %8
%10 = fneg float %9
%11 = getelementptr inbounds float, float* %0, i64 2
store float %10, float* %11
%12 = getelementptr inbounds float, float* %1, i64 3
%13 = load float, float* %12
%14 = fneg float %13
%15 = getelementptr inbounds float, float* %0, i64 3
store float %14, float* %15
ret void
}
int undo(void *data) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @undo(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
long long inswap_le64(long long);
void inswap_le64_num(long long *s, int n) {
  int i;
  for (i = 0; i < n; i++)
    s[i] = inswap_le64(s[i]);
}


x86 assembly (clang, -O0):
<inswap_le64_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1160 <inswap_le64_num+0x50>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <inswap_le64@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <inswap_le64_num+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inswap_le64_num>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1146 <inswap_le64_num+0x36>
mov    %rdi,%r15
mov    %esi,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rdi
call   1030 <inswap_le64@plt>
mov    %rax,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <inswap_le64_num+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @inswap_le64_num(i64* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i64, i64* %0, i64 %7
%9 = load i64, i64* %8
%10 = tail call i64 @inswap_le64(i64 %9)
store i64 %10, i64* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lmn_string_free(void *);
void sp_cb_string_free(void *s) { lmn_string_free(s); }


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

x86 assembly (clang, -O2):
<sp_cb_string_free>:
jmp    1030 <lmn_string_free@plt>

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

LLVM IR (-O2):
define void @sp_cb_string_free(i8* %0) {
%2 = tail call i32 @lmn_string_free(i8* %0)
ret void
}
char *ihex_buffer_newline(char *restrict w) {
  const char *restrict r = "\n";
  do {
    *w++ = *r++;
  } while (*r);
  return w;
}


x86 assembly (clang, -O0):
<ihex_buffer_newline>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0xef1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1113 <ihex_buffer_newline+0x13>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ihex_buffer_newline>:
movb   $0xa,(%rdi)
lea    0x1(%rdi),%rax
ret

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

LLVM IR (-O2):
define i8* @ihex_buffer_newline(i8* noalias writeonly %0) {
store i8 10, i8* %0
%2 = getelementptr inbounds i8, i8* %0, i64 1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_create(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  void *(*)(void *), void *);
int /*<<< orphan*/ pthread_join(int /*<<< orphan*/, int /*<<< orphan*/ *);
int main() {
  pthread_t t1, t2;
  void *print_msg(void *);
  pthread_create(&t1, NULL, print_msg, (void *)"hello");
  pthread_create(&t2, NULL, print_msg, (void *)"world\n");
  pthread_join(t1, NULL);
  pthread_join(t2, NULL);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    0x2eb1(%rip),%rdx
lea    0xec2(%rip),%rcx
call   1030 <pthread_create@plt>
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    0x2e96(%rip),%rdx
lea    0xead(%rip),%rcx
call   1030 <pthread_create@plt>
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <pthread_join@plt>
mov    -0x8(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <pthread_join@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2ebc(%rip),%rbx
lea    0xecd(%rip),%rcx
lea    0xc(%rsp),%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <pthread_create@plt>
lea    0xebd(%rip),%rcx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <pthread_create@plt>
mov    0xc(%rsp),%edi
xor    %esi,%esi
call   1040 <pthread_join@plt>
mov    0x8(%rsp),%edi
xor    %esi,%esi
call   1040 <pthread_join@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [7 x i8] c"world\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @pthread_create(i32* %1, i32* null, i8* (i8*)* @print_msg, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @pthread_create(i32* %2, i32* null, i8* (i8*)* @print_msg, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* %1
%6 = call i32 @pthread_join(i32 %5, i32* null)
%7 = load i32, i32* %2
%8 = call i32 @pthread_join(i32 %7, i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [7 x i8] c"world\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @pthread_create(i32* %1, i32* null, i8* (i8*)* @print_msg, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @pthread_create(i32* %2, i32* null, i8* (i8*)* @print_msg, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %1
%8 = call i32 @pthread_join(i32 %7, i32* null)
%9 = load i32, i32* %2
%10 = call i32 @pthread_join(i32 %9, i32* null)
ret i32 0
}
/* Variables and functions */
double log(double);
double _log_factorial(long n) {
  static const double _LOG_2_PI_2 = 0.91893853320467;
  static const double _FACTOR_1_12 = 1.0 / 12.0;
  double x = n + 1;
  return (x - 0.5) * log(x) - x + _LOG_2_PI_2 + _FACTOR_1_12 / x;
}


x86 assembly (clang, -O0):
<_log_factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed5(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe86(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe72(%rip),%xmm1
divsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_log_factorial>:
sub    $0x18,%rsp
add    $0x1,%rdi
cvtsi2sd %rdi,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xed5(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
call   1030 <log@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm2
subsd  %xmm2,%xmm0
addsd  0xeb6(%rip),%xmm0
movsd  0xeb6(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@_log_factorial._LOG_2_PI_2 = internal constant double 0x3FED67F1C864BE9C
@_log_factorial._FACTOR_1_12 = internal constant double 0x3FB5555555555555
define double @_log_factorial(i64 %0) {
%2 = alloca i64
%3 = alloca double
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = add nsw i64 %4, 1
%6 = sitofp i64 %5 to double
store double %6, double* %3
%7 = load double, double* %3
%8 = fsub double %7, 5.000000e-01
%9 = load double, double* %3
%10 = call double @log(double %9)
%11 = load double, double* %3
%12 = fneg double %11
%13 = call double @llvm.fmuladd.f64(double %8, double %10, double %12)
%14 = fadd double %13, 0x3FED67F1C864BE9C
%15 = load double, double* %3
%16 = fdiv double 0x3FB5555555555555, %15
%17 = fadd double %14, %16
ret double %17
}

LLVM IR (-O2):
define double @_log_factorial(i64 %0) {
%2 = add nsw i64 %0, 1
%3 = sitofp i64 %2 to double
%4 = fadd double %3, -5.000000e-01
%5 = tail call double @log(double %3)
%6 = fneg double %3
%7 = tail call double @llvm.fmuladd.f64(double %4, double %5, double %6)
%8 = fadd double %7, 0x3FED67F1C864BE9C
%9 = fdiv double 0x3FB5555555555555, %3
%10 = fadd double %9, %8
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ count_sort(int *, int, int);
int get_max(int *, int);
void radix_sort(int a[], int n) {
  int exp;
  int max = get_max(a, n);
  for (exp = 1; max / exp > 0; exp *= 10)
    count_sort(a, n, exp);
}


x86 assembly (clang, -O0):
<radix_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <get_max@plt>
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%eax
jle    1170 <radix_sort+0x50>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <count_sort@plt>
imul   $0xa,-0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1145 <radix_sort+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radix_sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r15
call   1030 <get_max@plt>
test   %eax,%eax
jle    115b <radix_sort+0x3b>
mov    %eax,%ebp
mov    $0x1,%ebx
nopl   (%rax)
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
call   1040 <count_sort@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%ebx
mov    %ebp,%eax
cltd
idiv   %ebx
test   %eax,%eax
jg     1140 <radix_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @radix_sort(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
%9 = call i32 @get_max(i32* %7, i32 %8)
store i32 %9, i32* %6
store i32 1, i32* %5
br label %10
10: ; preds = %20, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = sdiv i32 %11, %12
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %10
%16 = load i32*, i32** %3
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 @count_sort(i32* %16, i32 %17, i32 %18)
br label %20
20: ; preds = %15
%21 = load i32, i32* %5
%22 = mul nsw i32 %21, 10
store i32 %22, i32* %5
br label %10
23: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @radix_sort(i32* %0, i32 %1) {
%3 = tail call i32 @get_max(i32* %0, i32 %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ 1, %2 ]
%7 = tail call i32 @count_sort(i32* %0, i32 %1, i32 %6)
%8 = mul nsw i32 %6, 10
%9 = sdiv i32 %3, %8
%10 = icmp sgt i32 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %5, %2
ret void
}
/* Type definitions */
struct cmd_result {
  int dummy;
};
struct cmd {
  int dummy;
};

/* Variables and functions */
char *cmd_2_strcmd(struct cmd *);
int /*<<< orphan*/ free(char *);
struct cmd_result *send_strcmd(char *, int, char *);
struct cmd_result *send_cmd(char *host, int port, struct cmd *command) {
  char *cmd;
  struct cmd_result *result;
  cmd = cmd_2_strcmd(command);
  result = send_strcmd(host, port, cmd);
  free(cmd);
  return result;
}


x86 assembly (clang, -O0):
<send_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <cmd_2_strcmd@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <send_strcmd@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_cmd>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
mov    %rdx,%rdi
call   1050 <cmd_2_strcmd@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %rax,%rdx
call   1040 <send_strcmd@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.cmd_result = type { i32 }
%struct.cmd = type { i32 }
define %struct.cmd_result* @send_cmd(i8* %0, i32 %1, %struct.cmd* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca %struct.cmd*
%7 = alloca i8*
%8 = alloca %struct.cmd_result*
store i8* %0, i8** %4
store i32 %1, i32* %5
store %struct.cmd* %2, %struct.cmd** %6
%9 = load %struct.cmd*, %struct.cmd** %6
%10 = call i8* @cmd_2_strcmd(%struct.cmd* %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = load i8*, i8** %7
%14 = call %struct.cmd_result* @send_strcmd(i8* %11, i32 %12, i8* %13)
store %struct.cmd_result* %14, %struct.cmd_result** %8
%15 = load i8*, i8** %7
%16 = call i32 @free(i8* %15)
%17 = load %struct.cmd_result*, %struct.cmd_result** %8
ret %struct.cmd_result* %17
}

LLVM IR (-O2):
%struct.cmd_result = type { i32 }
%struct.cmd = type { i32 }
define %struct.cmd_result* @send_cmd(i8* %0, i32 %1, %struct.cmd* %2) {
%4 = tail call i8* @cmd_2_strcmd(%struct.cmd* %2)
%5 = tail call %struct.cmd_result* @send_strcmd(i8* %0, i32 %1, i8* %4)
%6 = tail call i32 @free(i8* %4)
ret %struct.cmd_result* %5
}
int get_service_location(struct pd_qmi_client_data *data) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.pd_qmi_client_data = type opaque
define i32 @get_service_location(%struct.pd_qmi_client_data* nocapture readnone %0) {
ret i32 0
}