xunge/DecIR huggingface dataset:
/* Variables and functions */
int EINVAL;
char const atoi(char const *);
int gpio_num(const char *name) {
  return name[0] != 'P' ? -EINVAL : (((name[1] - 'A') << 5) + atoi(name + 2));
}


x86 assembly (clang, -O0):
<gpio_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x50,%eax
je     113f <gpio_num+0x2f>
xor    %eax,%eax
mov    0x2eab(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0xc(%rbp)
jmp    116a <gpio_num+0x5a>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
sub    $0x41,%eax
shl    $0x5,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
call   1030 <atoi@plt>
mov    %al,%cl
mov    -0x10(%rbp),%eax
movsbl %cl,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_num>:
push   %rbx
cmpb   $0x50,(%rdi)
jne    1132 <gpio_num+0x22>
movsbl 0x1(%rdi),%ebx
shl    $0x5,%ebx
add    $0x2,%rdi
call   1030 <atoi@plt>
movsbl %al,%eax
add    %ebx,%eax
add    $0xfffff7e0,%eax
pop    %rbx
ret
mov    0x2ea7(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rbx
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @gpio_num(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 80
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* @EINVAL
%10 = sub nsw i32 0, %9
br label %23
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 65
%17 = shl i32 %16, 5
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = call signext i8 @atoi(i8* %19)
%21 = sext i8 %20 to i32
%22 = add nsw i32 %17, %21
br label %23
23: ; preds = %11, %8
%24 = phi i32 [ %10, %8 ], [ %22, %11 ]
ret i32 %24
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @gpio_num(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 80
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
br label %17
7: ; preds = %1
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = shl nsw i32 %10, 5
%12 = add nsw i32 %11, -2080
%13 = getelementptr inbounds i8, i8* %0, i64 2
%14 = tail call signext i8 @atoi(i8* %13)
%15 = sext i8 %14 to i32
%16 = add nsw i32 %12, %15
br label %17
17: ; preds = %7, %4
%18 = phi i32 [ %6, %4 ], [ %16, %7 ]
ret i32 %18
}
void sigfdie(n) { sig_die("Floating Exception", 1); }


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

x86 assembly (clang, -O2):
<sigfdie>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
jmp    1030 <sig_die@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Floating Exception\00"
define void @sigfdie(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @sig_die to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Floating Exception\00"
define void @sigfdie(i32 %0) {
%2 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @sig_die to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int quaddobl_trace_grid_diagnostics(double *err, double *dis) {
  int *a, *b, fail;
  double c[2];
  fail = _ada_use_c2phc4c(676, a, b, c, 0);
  *err = c[0];
  *dis = c[1];
  return fail;
}


x86 assembly (clang, -O0):
<quaddobl_trace_grid_diagnostics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    -0x40(%rbp),%rcx
mov    $0x2a4,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x24(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x24(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quaddobl_trace_grid_diagnostics>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rcx
mov    $0x2a4,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @quaddobl_trace_grid_diagnostics(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca [2 x double]
store double* %0, double** %3
store double* %1, double** %4
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 0
%12 = call i32 @_ada_use_c2phc4c(i32 676, i32* %9, i32* %10, double* %11, i32 0)
store i32 %12, i32* %7
%13 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 0
%14 = load double, double* %13
%15 = load double*, double** %3
store double %14, double* %15
%16 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 1
%17 = load double, double* %16
%18 = load double*, double** %4
store double %17, double* %18
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
define i32 @quaddobl_trace_grid_diagnostics(double* nocapture writeonly %0, double* nocapture writeonly %1) {
%3 = alloca [2 x double]
%4 = bitcast [2 x double]* %3 to i8*
%5 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%6 = call i32 @_ada_use_c2phc4c(i32 676, i32* undef, i32* undef, double* %5, i32 0)
%7 = load double, double* %5
store double %7, double* %0
%8 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
%9 = load double, double* %8
store double %9, double* %1
ret i32 %6
}
/* Variables and functions */
double exp(double);
float fiddle_mtof(float f) { return (8.17579891564 * exp(.0577622650 * f)); }


x86 assembly (clang, -O0):
<fiddle_mtof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeda(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xebe(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiddle_mtof>:
push   %rax
cvtss2sd %xmm0,%xmm0
mulsd  0xee3(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xede(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fiddle_mtof(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double 0x3FAD9303FE3C5B7B, %4
%6 = call double @exp(double %5)
%7 = fmul double 0x40205A0250C2B12F, %6
%8 = fptrunc double %7 to float
ret float %8
}

LLVM IR (-O2):
define float @fiddle_mtof(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 0x3FAD9303FE3C5B7B
%4 = tail call double @exp(double %3)
%5 = fmul double %4, 0x40205A0250C2B12F
%6 = fptrunc double %5 to float
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_stream_ref() {
  printf("NOT IMPLEMENTED:"
         "pa_stream_ref"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"NOT IMPLEMENTED:pa_stream_ref\0A\00"
define i32 @pa_stream_ref() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [30 x i8] c"NOT IMPLEMENTED:pa_stream_ref\00"
define i32 @pa_stream_ref() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
unsigned int __inl_p(unsigned short port) {
  unsigned int _v;
  __asm__ __volatile__("in"
                       "l"
                       " %"
                       "w"
                       "1,%"
                       ""
                       "0"
                       : "=a"(_v)
                       : "d"(port));
  __asm__ __volatile__("outb %al,$0x80");
  return _v;
}


x86 assembly (clang, -O0):
<__inl_p>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%eax
mov    %eax,-0x8(%rbp)
out    %al,$0x80
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__inl_p>:
mov    %edi,%edx
in     (%dx),%eax
out    %al,$0x80
ret

LLVM IR (-O0):
define i32 @__inl_p(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i32 asm sideeffect "inl ${1:w},$0", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @__inl_p(i16 zeroext %0) {
%2 = tail call i32 asm sideeffect "inl ${1:w},$0", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
tail call void asm sideeffect "outb %al,$$0x80", "~{dirflag},~{fpsr},~{flags}"()
ret i32 %2
}
unsigned int fetch_and_inc(unsigned int *n) {
  unsigned int oldval;
  __asm__ __volatile__("movl		$1, %0		\n"
                       "lock xaddl	%0, (%1)	\n"
                       : "=a"(oldval)
                       : "b"(n));
  return oldval;
}


x86 assembly (clang, -O0):
<fetch_and_inc>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rbx
mov    $0x1,%eax
lock xadd %eax,(%rbx)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<fetch_and_inc>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%eax
lock xadd %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @fetch_and_inc(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 asm sideeffect "movl\09\09$$1, $0\09\09\0Alock xaddl\09$0, ($1)\09\0A", "={ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @fetch_and_inc(i32* %0) {
%2 = tail call i32 asm sideeffect "movl\09\09$$1, $0\09\09\0Alock xaddl\09$0, ($1)\09\0A", "={ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32* %0)
ret i32 %2
}
/* Type definitions */
struct aFILE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _get_actual_fp(struct aFILE *);
int setvbuf(int /*<<< orphan*/, char *, int, size_t);
int my_setvbuf(struct aFILE *fp, char *buf, int mode, size_t size) {
  return setvbuf(_get_actual_fp(fp), buf, mode, size);
}


x86 assembly (clang, -O0):
<my_setvbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_get_actual_fp@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1040 <setvbuf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_setvbuf>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %edx,%ebp
mov    %rsi,%rbx
call   1030 <_get_actual_fp@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <setvbuf@plt>

LLVM IR (-O0):
%struct.aFILE = type { i32 }
define i32 @my_setvbuf(%struct.aFILE* %0, i8* %1, i32 %2, i64 %3) {
%5 = alloca %struct.aFILE*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i64
store %struct.aFILE* %0, %struct.aFILE** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%9 = load %struct.aFILE*, %struct.aFILE** %5
%10 = call i32 @_get_actual_fp(%struct.aFILE* %9)
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i64, i64* %8
%14 = call i32 @setvbuf(i32 %10, i8* %11, i32 %12, i64 %13)
ret i32 %14
}

LLVM IR (-O2):
%struct.aFILE = type { i32 }
define i32 @my_setvbuf(%struct.aFILE* %0, i8* %1, i32 %2, i64 %3) {
%5 = tail call i32 @_get_actual_fp(%struct.aFILE* %0)
%6 = tail call i32 @setvbuf(i32 %5, i8* %1, i32 %2, i64 %3)
ret i32 %6
}
/* Variables and functions */
unsigned long htonl(unsigned long);
unsigned long CSLP_ULongToBigEndian(unsigned long uLong) {
  return htonl(uLong);
}


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

x86 assembly (clang, -O2):
<CSLP_ULongToBigEndian>:
jmp    1030 <htonl@plt>

LLVM IR (-O0):
define i64 @CSLP_ULongToBigEndian(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @htonl(i64 %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @CSLP_ULongToBigEndian(i64 %0) {
%2 = tail call i64 @htonl(i64 %0)
ret i64 %2
}
/* Variables and functions */
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int pid;
  int ppid;
  pid = getpid();
  ppid = getppid();
  printf("pid: %d\n", pid);
  printf("ppid: %d\n", ppid);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <getppid@plt>
mov    %eax,%ebp
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"pid: %d\0A\00"
@.str.1 = [10 x i8] c"ppid: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @getpid()
store i32 %4, i32* %2
%5 = call i32 (...) @getppid()
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"pid: %d\0A\00"
@.str.1 = [10 x i8] c"ppid: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 (...) @getppid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ radix_sort(int *, int, int);
int main(void) {
  int arr[] = {3,   24,   78,  98, 6,  12, 45,   868,  211,  2215,   10,  459,
               678, 1357, 36,  9,  30, 25, 1,    49,   82,   492,    83,  153,
               767, 64,   916, 81, 4,  97, 1234, 6789, 8008, 654321, 9876};
  int length = 35;
  radix_sort(arr, length, 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    -0x90(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x8c,%edx
call   1040 <memcpy@plt>
movl   $0x23,-0x94(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x94(%rbp),%esi
mov    $0x1,%edx
call   1030 <radix_sort@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x90,%rsp
lea    0xed1(%rip),%rsi
mov    %rsp,%rbx
mov    $0x8c,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
mov    %rbx,%rdi
mov    $0x23,%esi
mov    $0x1,%edx
call   1030 <radix_sort@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [35 x i32] [i32 3, i32 24, i32 78, i32 98, i32 6, i32 12, i32 45, i32 868, i32 211, i32 2215, i32 10, i32 459, i32 678, i32 1357, i32 36, i32 9, i32 30, i32 25, i32 1, i32 49, i32 82, i32 492, i32 83, i32 153, i32 767, i32 64, i32 916, i32 81, i32 4, i32 97, i32 1234, i32 6789, i32 8008, i32 654321, i32 9876]
define i32 @main() {
%1 = alloca [35 x i32]
%2 = alloca i32
%3 = bitcast [35 x i32]* %1 to i8*
store i32 35, i32* %2
%4 = getelementptr inbounds [35 x i32], [35 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @radix_sort(i32* %4, i32 %5, i32 1)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [35 x i32] [i32 3, i32 24, i32 78, i32 98, i32 6, i32 12, i32 45, i32 868, i32 211, i32 2215, i32 10, i32 459, i32 678, i32 1357, i32 36, i32 9, i32 30, i32 25, i32 1, i32 49, i32 82, i32 492, i32 83, i32 153, i32 767, i32 64, i32 916, i32 81, i32 4, i32 97, i32 1234, i32 6789, i32 8008, i32 654321, i32 9876]
define i32 @main() {
%1 = alloca [35 x i32]
%2 = bitcast [35 x i32]* %1 to i8*
%3 = getelementptr inbounds [35 x i32], [35 x i32]* %1, i64 0, i64 0
%4 = call i32 @radix_sort(i32* %3, i32 35, i32 1)
ret i32 0
}
void put_byte(void *obj, int data) {
  unsigned char **p = (unsigned char **)obj;
  *(*p)++ = data;
}


x86 assembly (clang, -O0):
<put_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_byte>:
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
mov    %sil,(%rax)
ret

LLVM IR (-O0):
define void @put_byte(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8**
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i8**
store i8** %7, i8*** %5
%8 = load i32, i32* %4
%9 = trunc i32 %8 to i8
%10 = load i8**, i8*** %5
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %10
store i8 %9, i8* %11
ret void
}

LLVM IR (-O2):
define void @put_byte(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i8**
%4 = trunc i32 %1 to i8
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %6, i8** %3
store i8 %4, i8* %5
ret void
}
int gp2d12_to_dist(int ir) {
  int dist;
  if (ir > 35)
    dist = (6787 / (ir - 3)) - 4;
  else
    dist = 200;
  return dist;
}


x86 assembly (clang, -O0):
<gp2d12_to_dist>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x23,-0x4(%rbp)
jle    112a <gp2d12_to_dist+0x2a>
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
mov    $0x1a83,%eax
cltd
idiv   %ecx
sub    $0x4,%eax
mov    %eax,-0x8(%rbp)
jmp    1131 <gp2d12_to_dist+0x31>
movl   $0xc8,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gp2d12_to_dist>:
mov    $0xc8,%eax
cmp    $0x24,%edi
jl     1119 <gp2d12_to_dist+0x19>
add    $0xfffffffd,%edi
mov    $0x1a83,%eax
xor    %edx,%edx
div    %edi
add    $0xfffffffc,%eax
ret

LLVM IR (-O0):
define i32 @gp2d12_to_dist(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 35
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 3
%9 = sdiv i32 6787, %8
%10 = sub nsw i32 %9, 4
store i32 %10, i32* %3
br label %12
11: ; preds = %1
store i32 200, i32* %3
br label %12
12: ; preds = %11, %6
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @gp2d12_to_dist(i32 %0) {
%2 = icmp sgt i32 %0, 35
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = add nsw i32 %0, -3
%5 = udiv i32 6787, %4
%6 = add nsw i32 %5, -4
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 200, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void RTCAlarm_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @RTCAlarm_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @RTCAlarm_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
int send(int, void const *, int, int);
int g_sck_send(int sck, const void *ptr, int len, int flags) {
  return send(sck, ptr, len, flags);
}


x86 assembly (clang, -O0):
<g_sck_send>:
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),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_sck_send>:
jmp    1030 <send@plt>

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

LLVM IR (-O2):
define i32 @g_sck_send(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @send(i32 %0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ die_x(int /*<<< orphan*/);
void die(int dummy) { die_x(0); }


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

x86 assembly (clang, -O2):
<die>:
xor    %edi,%edi
jmp    1030 <die_x@plt>

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

LLVM IR (-O2):
define void @die(i32 %0) {
%2 = tail call i32 @die_x(i32 0)
ret void
}
char ftypelet(bits)
long bits;
{
  if (S_ISCHR(bits))
    return 'c';
  if (S_ISDIR(bits))
    return 'd';
  if (S_ISREG(bits))
    return '-';
  return '?';
}


x86 assembly (clang, -O0):
<ftypelet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <S_ISCHR@plt>
cmp    $0x0,%eax
je     1159 <ftypelet+0x29>
movb   $0x63,-0x1(%rbp)
jmp    1197 <ftypelet+0x67>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <S_ISDIR@plt>
cmp    $0x0,%eax
je     1176 <ftypelet+0x46>
movb   $0x64,-0x1(%rbp)
jmp    1197 <ftypelet+0x67>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <S_ISREG@plt>
cmp    $0x0,%eax
je     1193 <ftypelet+0x63>
movb   $0x2d,-0x1(%rbp)
jmp    1197 <ftypelet+0x67>
movb   $0x3f,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftypelet>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <S_ISCHR@plt>
mov    %eax,%ecx
mov    $0x63,%al
test   %ecx,%ecx
je     1145 <ftypelet+0x15>
pop    %rbx
ret
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <S_ISDIR@plt>
mov    %eax,%ecx
mov    $0x64,%al
test   %ecx,%ecx
jne    1143 <ftypelet+0x13>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <S_ISREG@plt>
test   %eax,%eax
mov    $0x3f,%ecx
mov    $0x2d,%eax
cmove  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @ftypelet(i64 %0) {
%2 = alloca i8
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = call i32 (i64, ...) bitcast (i32 (...)* @S_ISCHR to i32 (i64, ...)*)(i64 %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 99, i8* %2
br label %19
8: ; preds = %1
%9 = load i64, i64* %3
%10 = call i32 (i64, ...) bitcast (i32 (...)* @S_ISDIR to i32 (i64, ...)*)(i64 %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i8 100, i8* %2
br label %19
13: ; preds = %8
%14 = load i64, i64* %3
%15 = call i32 (i64, ...) bitcast (i32 (...)* @S_ISREG to i32 (i64, ...)*)(i64 %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i8 45, i8* %2
br label %19
18: ; preds = %13
store i8 63, i8* %2
br label %19
19: ; preds = %18, %17, %12, %7
%20 = load i8, i8* %2
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @ftypelet(i64 %0) {
%2 = tail call i32 (i64, ...) bitcast (i32 (...)* @S_ISCHR to i32 (i64, ...)*)(i64 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = tail call i32 (i64, ...) bitcast (i32 (...)* @S_ISDIR to i32 (i64, ...)*)(i64 %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = tail call i32 (i64, ...) bitcast (i32 (...)* @S_ISREG to i32 (i64, ...)*)(i64 %0)
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8 63, i8 45
br label %11
11: ; preds = %7, %4, %1
%12 = phi i8 [ 99, %1 ], [ 100, %4 ], [ %10, %7 ]
ret i8 %12
}
void RTTestIPrintfV(void) {}


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

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

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

LLVM IR (-O2):
define void @RTTestIPrintfV() {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t reg_read(void *mem_virt, uint32_t offset) {
  return *(volatile uint32_t *)(mem_virt + offset);
}


x86 assembly (clang, -O0):
<reg_read>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg_read>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%eax
ret

LLVM IR (-O0):
define i32 @reg_read(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr i8, i8* %5, i64 %7
%9 = bitcast i8* %8 to i32*
%10 = load volatile i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @reg_read(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr i8, i8* %0, i64 %3
%5 = bitcast i8* %4 to i32*
%6 = load volatile i32, i32* %5
ret i32 %6
}
/* Variables and functions */
int Add(int, int);
int main() {
  int x, y, z;
  x = 1;
  y = 3;
  while (x <= y) {
    if (x == y) {
      z = Add(x, y);
    } else {
      z = y - x;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1166 <main+0x56>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1158 <main+0x48>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <Add@plt>
mov    %eax,-0x10(%rbp)
jmp    1161 <main+0x51>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 3, i32* %3
br label %5
5: ; preds = %21, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = call i32 @Add(i32 %14, i32 %15)
store i32 %16, i32* %4
br label %21
17: ; preds = %9
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = sub nsw i32 %18, %19
store i32 %20, i32* %4
br label %21
21: ; preds = %17, %13
br label %5
22: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
/* Variables and functions */
unsigned char mread(unsigned int);
void readBuffer(unsigned int address, unsigned int length,
                unsigned char *buffer) {
  unsigned int i;
  for (i = 0; i < length; i++) {
    buffer[i] = mread(address + i);
  }
}


x86 assembly (clang, -O0):
<readBuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    115a <readBuffer+0x4a>
mov    -0x4(%rbp),%edi
add    -0x14(%rbp),%edi
call   1030 <mread@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <readBuffer+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readBuffer>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     1146 <readBuffer+0x36>
mov    %rdx,%r14
mov    %esi,%r15d
mov    %edi,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
lea    (%r12,%rbx,1),%edi
call   1030 <mread@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <readBuffer+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @readBuffer(i32 %0, i32 %1, i8* nocapture writeonly %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %15, label %5
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %13, %7 ]
%9 = trunc i64 %8 to i32
%10 = add i32 %9, %0
%11 = tail call zeroext i8 @mread(i32 %10)
%12 = getelementptr inbounds i8, i8* %2, i64 %8
store i8 %11, i8* %12
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %15, label %7
15: ; preds = %7, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, short, short);
void Sound(short i, short d) {
  static char str[32];
  sprintf(str, "%i %i", i, d);
}


x86 assembly (clang, -O0):
<Sound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
lea    0x2f0f(%rip),%rdi
lea    0xec8(%rip),%rsi
movswl %ax,%edx
movswl -0x4(%rbp),%ecx
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sound>:
mov    %esi,%ecx
mov    %edi,%edx
lea    0x2f25(%rip),%rdi
lea    0xede(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@Sound.str = internal global [32 x i8] zeroinitializer
@.str = [6 x i8] c"%i %i\00"
define void @Sound(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = load i16, i16* %4
%7 = call i32 @sprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @Sound.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i16 signext %5, i16 signext %6)
ret void
}

LLVM IR (-O2):
@Sound.str = internal global [32 x i8] zeroinitializer
@.str = [6 x i8] c"%i %i\00"
define void @Sound(i16 signext %0, i16 signext %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @Sound.str, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i16 signext %0, i16 signext %1)
ret void
}
void addAllNodesToGroup(node) {
  group_clear();
  addNodeToGroup(node);
}


x86 assembly (clang, -O0):
<addAllNodesToGroup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <group_clear@plt>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <addNodeToGroup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addAllNodesToGroup>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <group_clear@plt>
mov    %ebx,%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <addNodeToGroup@plt>

LLVM IR (-O0):
define void @addAllNodesToGroup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @group_clear()
%4 = load i32, i32* %2
%5 = call i32 (i32, ...) bitcast (i32 (...)* @addNodeToGroup to i32 (i32, ...)*)(i32 %4)
ret void
}

LLVM IR (-O2):
define void @addAllNodesToGroup(i32 %0) {
%2 = tail call i32 (...) @group_clear()
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @addNodeToGroup to i32 (i32, ...)*)(i32 %0)
ret void
}
/* Variables and functions */
int cpu_count();
int /*<<< orphan*/ on_cpu(int, int /*<<< orphan*/ (*)(int /*<<< orphan*/),
                          int /*<<< orphan*/);
int /*<<< orphan*/ set_ipi_descriptor(void (*)());
int /*<<< orphan*/ setup_smp_id(int /*<<< orphan*/);
void smp_init(void) {
  int i;
  void ipi_entry(void);
  set_ipi_descriptor(ipi_entry);
  setup_smp_id(0);
  for (i = 1; i < cpu_count(); ++i)
    on_cpu(i, setup_smp_id, 0);
}


x86 assembly (clang, -O0):
<smp_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rdi
call   1050 <set_ipi_descriptor@plt>
xor    %edi,%edi
call   1060 <setup_smp_id@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <cpu_count@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
jge    118b <smp_init+0x5b>
mov    -0x4(%rbp),%edi
mov    0x2e5a(%rip),%rsi
xor    %edx,%edx
call   1030 <on_cpu@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <smp_init+0x22>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smp_init>:
push   %r14
push   %rbx
push   %rax
mov    0x2ea5(%rip),%rdi
call   1050 <set_ipi_descriptor@plt>
xor    %edi,%edi
call   1060 <setup_smp_id@plt>
xor    %eax,%eax
call   1040 <cpu_count@plt>
cmp    $0x2,%eax
jl     117a <smp_init+0x4a>
mov    $0x1,%ebx
mov    0x2e71(%rip),%r14
nop
mov    %ebx,%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <on_cpu@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <cpu_count@plt>
cmp    %eax,%ebx
jl     1160 <smp_init+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @smp_init() {
%1 = alloca i32
%2 = call i32 @set_ipi_descriptor(void (...)* bitcast (void ()* @ipi_entry to void (...)*))
%3 = call i32 @setup_smp_id(i32 0)
store i32 1, i32* %1
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %1
%6 = call i32 (...) @cpu_count()
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i32, i32* %1
%10 = call i32 @on_cpu(i32 %9, i32 (i32)* @setup_smp_id, i32 0)
br label %11
11: ; preds = %8
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %4
14: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @smp_init() {
%1 = tail call i32 @set_ipi_descriptor(void (...)* bitcast (void ()* @ipi_entry to void (...)*))
%2 = tail call i32 @setup_smp_id(i32 0)
%3 = tail call i32 (...) @cpu_count()
%4 = icmp sgt i32 %3, 1
br i1 %4, label %5, label %11
5: ; preds = %0, %5
%6 = phi i32 [ %8, %5 ], [ 1, %0 ]
%7 = tail call i32 @on_cpu(i32 %6, i32 (i32)* @setup_smp_id, i32 0)
%8 = add nuw nsw i32 %6, 1
%9 = tail call i32 (...) @cpu_count()
%10 = icmp slt i32 %8, %9
br i1 %10, label %5, label %11
11: ; preds = %5, %0
ret void
}
int left_child_index(int index) { return 2 * index + 1; }


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

x86 assembly (clang, -O2):
<left_child_index>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @left_child_index(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
/* Type definitions */
struct wpabuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wpa_hexdump_key(int, char const *, int /*<<< orphan*/,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ wpabuf_head(struct wpabuf const *);
int /*<<< orphan*/ wpabuf_len(struct wpabuf const *);
void wpa_hexdump_buf_key(int level, const char *title,
                         const struct wpabuf *buf) {
  wpa_hexdump_key(level, title, wpabuf_head(buf), wpabuf_len(buf));
}


x86 assembly (clang, -O0):
<wpa_hexdump_buf_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <wpabuf_head@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <wpabuf_len@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
call   1050 <wpa_hexdump_key@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wpa_hexdump_buf_key>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%r15d
mov    %rdx,%rdi
call   1040 <wpabuf_head@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <wpabuf_len@plt>
mov    %r15d,%edi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <wpa_hexdump_key@plt>

LLVM IR (-O0):
%struct.wpabuf = type { i32 }
define void @wpa_hexdump_buf_key(i32 %0, i8* %1, %struct.wpabuf* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.wpabuf*
store i32 %0, i32* %4
store i8* %1, i8** %5
store %struct.wpabuf* %2, %struct.wpabuf** %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load %struct.wpabuf*, %struct.wpabuf** %6
%10 = call i32 @wpabuf_head(%struct.wpabuf* %9)
%11 = load %struct.wpabuf*, %struct.wpabuf** %6
%12 = call i32 @wpabuf_len(%struct.wpabuf* %11)
%13 = call i32 @wpa_hexdump_key(i32 %7, i8* %8, i32 %10, i32 %12)
ret void
}

LLVM IR (-O2):
%struct.wpabuf = type { i32 }
define void @wpa_hexdump_buf_key(i32 %0, i8* %1, %struct.wpabuf* %2) {
%4 = tail call i32 @wpabuf_head(%struct.wpabuf* %2)
%5 = tail call i32 @wpabuf_len(%struct.wpabuf* %2)
%6 = tail call i32 @wpa_hexdump_key(i32 %0, i8* %1, i32 %4, i32 %5)
ret void
}
int fastfloor(float x) {
  int xi = (int)x;
  return ((x < xi) ? (xi - 1) : xi);
}


x86 assembly (clang, -O0):
<fastfloor>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
cvtsi2ssl -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1132 <fastfloor+0x32>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1138 <fastfloor+0x38>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastfloor>:
cvttss2si %xmm0,%eax
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
xor    %ecx,%ecx
ucomiss %xmm0,%xmm1
seta   %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fastfloor(float %0) {
%2 = alloca float
%3 = alloca i32
store float %0, float* %2
%4 = load float, float* %2
%5 = fptosi float %4 to i32
store i32 %5, i32* %3
%6 = load float, float* %2
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to float
%9 = fcmp olt float %6, %8
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
br label %15
13: ; preds = %1
%14 = load i32, i32* %3
br label %15
15: ; preds = %13, %10
%16 = phi i32 [ %12, %10 ], [ %14, %13 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @fastfloor(float %0) {
%2 = fptosi float %0 to i32
%3 = sitofp i32 %2 to float
%4 = fcmp ogt float %3, %0
%5 = sext i1 %4 to i32
%6 = add nsw i32 %5, %2
ret i32 %6
}
int isKeyStartChar(int c) {
  return ((unsigned)(c - 'a') < 26 || (unsigned)(c - 'A') < 26 || c == '_');
}


x86 assembly (clang, -O0):
<isKeyStartChar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
sub    $0x61,%ecx
mov    $0x1,%al
cmp    $0x1a,%ecx
mov    %al,-0x5(%rbp)
jb     1139 <isKeyStartChar+0x39>
mov    -0x4(%rbp),%ecx
sub    $0x41,%ecx
mov    $0x1,%al
cmp    $0x1a,%ecx
mov    %al,-0x5(%rbp)
jb     1139 <isKeyStartChar+0x39>
cmpl   $0x5f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isKeyStartChar>:
lea    -0x61(%rdi),%eax
cmp    $0x1a,%eax
setb   %al
lea    -0x41(%rdi),%ecx
cmp    $0x1a,%ecx
setb   %cl
or     %al,%cl
cmp    $0x5f,%edi
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @isKeyStartChar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 97
%5 = icmp ult i32 %4, 26
br i1 %5, label %13, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 65
%9 = icmp ult i32 %8, 26
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 95
br label %13
13: ; preds = %10, %6, %1
%14 = phi i1 [ true, %6 ], [ true, %1 ], [ %12, %10 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @isKeyStartChar(i32 %0) {
%2 = add nsw i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -65
%5 = icmp ult i32 %4, 26
%6 = select i1 %3, i1 true, i1 %5
%7 = icmp eq i32 %0, 95
%8 = or i1 %7, %6
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
void *malloc(int);
void *alloc_buffer(int bufsize) {
  void *ptr;
  ptr = malloc(bufsize);
  return ptr;
}


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

x86 assembly (clang, -O2):
<alloc_buffer>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @alloc_buffer(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ val;

/* Variables and functions */
double byteSwapDouble(double);
int /*<<< orphan*/ memcpy(double *, char *, int);
double memReadDouble(char **pPt, int isSwapped) {
  double val;
  memcpy(&val, *pPt, sizeof(val));
  if (isSwapped)
    val = byteSwapDouble(val);
  *pPt += sizeof(val);
  return val;
}


x86 assembly (clang, -O0):
<memReadDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    -0x18(%rbp),%rdi
mov    $0x8,%edx
call   1040 <memcpy@plt>
cmpl   $0x0,-0xc(%rbp)
je     115d <memReadDouble+0x3d>
movsd  -0x18(%rbp),%xmm0
call   1030 <byteSwapDouble@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x8,%rcx
mov    %rcx,(%rax)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memReadDouble>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    (%rdi),%rsi
mov    %rsp,%rdi
mov    $0x8,%edx
call   1040 <memcpy@plt>
movsd  (%rsp),%xmm0
test   %ebp,%ebp
je     1146 <memReadDouble+0x26>
call   1030 <byteSwapDouble@plt>
addq   $0x8,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define double @memReadDouble(i8** nocapture %0, i32 %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = load i8*, i8** %0
%6 = call i32 @memcpy(double* %3, i8* %5, i32 8)
%7 = icmp eq i32 %1, 0
%8 = load double, double* %3
br i1 %7, label %11, label %9
9: ; preds = %2
%10 = call double @byteSwapDouble(double %8)
br label %11
11: ; preds = %2, %9
%12 = phi double [ %10, %9 ], [ %8, %2 ]
%13 = load i8*, i8** %0
%14 = getelementptr inbounds i8, i8* %13, i64 8
store i8* %14, i8** %0
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ hoic_set_param(int, char *, char *);
int hdoip_cli_set(int fd, int fdr, char **argv, int argc) {
  hoic_set_param(fd, argv[0], argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<hdoip_cli_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
call   1030 <hoic_set_param@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdoip_cli_set>:
push   %rax
mov    (%rdx),%rsi
mov    0x8(%rdx),%rdx
call   1030 <hoic_set_param@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @hdoip_cli_set(i32 %0, i32 %1, i8** nocapture %2, i32 %3) {
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8*, i8** %2, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @hoic_set_param(i32 %0, i8* %5, i8* %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void under_on(void) { write(1, "\033[4m", 4); }


x86 assembly (clang, -O0):
<under_on>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xee0(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<under_on>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
mov    $0x4,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[4m\00"
define void @under_on() {
%1 = call i32 @write(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[4m\00"
define void @under_on() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}