xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ writestr(int, char *);
void usage(void) { writestr(2, "usage: rm [-f] FILE ...\n"); }


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
lea    0xee0(%rip),%rsi
call   1030 <writestr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xee9(%rip),%rsi
mov    $0x2,%edi
jmp    1030 <writestr@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"usage: rm [-f] FILE ...\0A\00"
define void @usage() {
%1 = call i32 @writestr(i32 2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"usage: rm [-f] FILE ...\0A\00"
define void @usage() {
%1 = tail call i32 @writestr(i32 2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("bench_pipe [-d?] [-c count]\n");
  errno = 0;
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ebc(%rip),%rax
movq   $0x0,(%rax)
pop    %rax
ret

LLVM IR (-O0):
@.str = [29 x i8] c"bench_pipe [-d?] [-c count]\0A\00"
@errno = global i64 0
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* @errno
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@str = [28 x i8] c"bench_pipe [-d?] [-c count]\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
store i64 0, i64* @errno
ret void
}
void ff_hevc_put_hevc_uni_epel_h8_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_epel_h8_12_sse4() {
ret void
}
/* Type definitions */
struct st_trx {
  int dummy;
};

/* Variables and functions */
void *EXIT_SUCCESS;
int /*<<< orphan*/ serve_rq(struct st_trx *);
void *thr_func(void *arg) {
  serve_rq((struct st_trx *)arg);
  return (EXIT_SUCCESS);
}


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

x86 assembly (clang, -O2):
<thr_func>:
push   %rax
call   1030 <serve_rq@plt>
mov    0x2ec3(%rip),%rax
mov    (%rax),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.st_trx = type { i32 }
@EXIT_SUCCESS = global i8* null
define i8* @thr_func(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.st_trx*
%5 = call i32 @serve_rq(%struct.st_trx* %4)
%6 = load i8*, i8** @EXIT_SUCCESS
ret i8* %6
}

LLVM IR (-O2):
%struct.st_trx = type { i32 }
@EXIT_SUCCESS = global i8* null
define i8* @thr_func(i8* %0) {
%2 = bitcast i8* %0 to %struct.st_trx*
%3 = tail call i32 @serve_rq(%struct.st_trx* %2)
%4 = load i8*, i8** @EXIT_SUCCESS
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ InitializeRaspberryPi();
int /*<<< orphan*/ TestRaspberryPi();
int /*<<< orphan*/ TestSpi();
int main(int argc, char **argv) {
  InitializeRaspberryPi();
  TestRaspberryPi();
  TestSpi();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <InitializeRaspberryPi@plt>
mov    $0x0,%al
call   1050 <TestRaspberryPi@plt>
mov    $0x0,%al
call   1040 <TestSpi@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @InitializeRaspberryPi()
%6 = call i32 (...) @TestRaspberryPi()
%7 = call i32 (...) @TestSpi()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @InitializeRaspberryPi()
%4 = tail call i32 (...) @TestRaspberryPi()
%5 = tail call i32 (...) @TestSpi()
ret i32 0
}
/* Variables and functions */
int yaffs_Dofsync(int, int);
int yaffs_fdatasync(int handle) { return yaffs_Dofsync(handle, 1); }


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

x86 assembly (clang, -O2):
<yaffs_fdatasync>:
mov    $0x1,%esi
jmp    1030 <yaffs_Dofsync@plt>

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

LLVM IR (-O2):
define i32 @yaffs_fdatasync(i32 %0) {
%2 = tail call i32 @yaffs_Dofsync(i32 %0, i32 1)
ret i32 %2
}
AR0I1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{
  if ((p0[10000000]) <= 33)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<AR0I1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movswl 0x1312d00(%rax),%eax
cmp    $0x21,%eax
jg     113f <AR0I1+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    1146 <AR0I1+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AR0I1>:
xor    %eax,%eax
cmpw   $0x22,0x1312d00(%r8)
01 22
setl   %al
ret

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

LLVM IR (-O2):
define i32 @AR0I1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture %4, i16* nocapture readnone %5) {
%7 = getelementptr inbounds i16, i16* %4, i64 10000000
%8 = load i16, i16* %7
%9 = icmp slt i16 %8, 34
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMREA_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_WMREA_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

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

LLVM IR (-O2):
define void @U_WMREA_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
int func1(void) { return 12345; }


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

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

LLVM IR (-O0):
define i32 @func1() {
ret i32 12345
}

LLVM IR (-O2):
define i32 @func1() {
ret i32 12345
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sum(int *, int);
int main() {
  int a[] = {3, 10, 4, 1, 5, 9, 2, 6, 5};
  printf("sum=%d\n", sum(a, sizeof(a) / sizeof(*a)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1050 <sum@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef6(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebf(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x9,%esi
call   1040 <sum@plt>
lea    0xecb(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@__const.main.a = [9 x i32] [i32 3, i32 10, i32 4, i32 1, i32 5, i32 9, i32 2, i32 6, i32 5]
@.str = [8 x i8] c"sum=%d\0A\00"
define i32 @main() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i32 @sum(i32* %3, i32 9)
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
void delay(int dly) {
  while (dly--)
    ;
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1120 <delay+0x20>
jmp    1107 <delay+0x7>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @delay(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
store i32 %5, i32* %2
%6 = icmp ne i32 %4, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @delay(i32 %0) {
ret void
}
void XtRemoveCallback() {}


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

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

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

LLVM IR (-O2):
define void @XtRemoveCallback() {
ret void
}
void Tmf_Mutex_Off() { return; }


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

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

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

LLVM IR (-O2):
define void @Tmf_Mutex_Off() {
ret void
}
/* Variables and functions */
double volume(double, double);
double sg(double sg, double r, double t) { return (sg * volume(r, t)); }


x86 assembly (clang, -O0):
<sg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <volume@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg>:
push   %rax
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm0
movaps %xmm2,%xmm1
call   1030 <volume@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sg(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = load double, double* %6
%10 = call double @volume(double %8, double %9)
%11 = fmul double %7, %10
ret double %11
}

LLVM IR (-O2):
define double @sg(double %0, double %1, double %2) {
%4 = tail call double @volume(double %1, double %2)
%5 = fmul double %4, %0
ret double %5
}
void my_swap(char *a, char *b) {
  char temp;
  temp = *a;
  *a = *b;
  *b = temp;
  return;
}


x86 assembly (clang, -O0):
<my_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_swap>:
mov    (%rdi),%al
mov    (%rsi),%cl
mov    %cl,(%rdi)
mov    %al,(%rsi)
ret

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

LLVM IR (-O2):
define void @my_swap(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
store i8 %4, i8* %0
store i8 %3, i8* %1
ret void
}
int debug_print(const char *format, ...) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @debug_print(i8* nocapture readnone %0, ...) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ get_string(char *);
char *l_askNbytes(int /*<<< orphan*/, char *, int /*<<< orphan*/, int);
char *macjobstatus(char *arg) {
  return l_askNbytes(get_string(arg), "55", 0, 8);
}


x86 assembly (clang, -O0):
<macjobstatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <get_string@plt>
mov    %eax,%edi
lea    0xec2(%rip),%rsi
xor    %edx,%edx
mov    $0x8,%ecx
call   1030 <l_askNbytes@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macjobstatus>:
push   %rax
call   1040 <get_string@plt>
lea    0xed3(%rip),%rsi
mov    %eax,%edi
xor    %edx,%edx
mov    $0x8,%ecx
pop    %rax
jmp    1030 <l_askNbytes@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"55\00"
define i8* @macjobstatus(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @get_string(i8* %3)
%5 = call i8* @l_askNbytes(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0, i32 8)
ret i8* %5
}

LLVM IR (-O2):
@.str = [3 x i8] c"55\00"
define i8* @macjobstatus(i8* %0) {
%2 = tail call i32 @get_string(i8* %0)
%3 = tail call i8* @l_askNbytes(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0, i32 8)
ret i8* %3
}
double f4_cb_send_pre_double_double_short(double (*cb)(double, double, short)) {
  short r = -22;
  return cb(8.25, 9.25, r) + 1.0;
}


x86 assembly (clang, -O0):
<f4_cb_send_pre_double_double_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movw   $0xffea,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xeea(%rip),%xmm0
movsd  0xeea(%rip),%xmm1
movswl -0xa(%rbp),%edi
call   *%rax
movsd  0xecc(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4_cb_send_pre_double_double_short>:
push   %rax
mov    %rdi,%rax
movsd  0xef4(%rip),%xmm0
movsd  0xef4(%rip),%xmm1
mov    $0xffffffea,%edi
call   *%rax
addsd  0xeed(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @f4_cb_send_pre_double_double_short(double (double, double, i16)* %0) {
%2 = alloca double (double, double, i16)*
%3 = alloca i16
store double (double, double, i16)* %0, double (double, double, i16)** %2
store i16 -22, i16* %3
%4 = load double (double, double, i16)*, double (double, double, i16)** %2
%5 = load i16, i16* %3
%6 = call double %4(double 8.250000e+00, double 9.250000e+00, i16 signext %5)
%7 = fadd double %6, 1.000000e+00
ret double %7
}

LLVM IR (-O2):
define double @f4_cb_send_pre_double_double_short(double (double, double, i16)* nocapture %0) {
%2 = tail call double %0(double 8.250000e+00, double 9.250000e+00, i16 signext -22)
%3 = fadd double %2, 1.000000e+00
ret double %3
}
unsigned huffman_bits(const short value) {
  return value - ((unsigned)value >> 31);
}


x86 assembly (clang, -O0):
<huffman_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
movswl -0x2(%rbp),%ecx
shr    $0x1f,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<huffman_bits>:
mov    %edi,%eax
sar    $0x1f,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @huffman_bits(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = load i16, i16* %2
%6 = sext i16 %5 to i32
%7 = lshr i32 %6, 31
%8 = sub i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @huffman_bits(i16 signext %0) {
%2 = sext i16 %0 to i32
%3 = ashr i32 %2, 31
%4 = add nsw i32 %3, %2
ret i32 %4
}
/* Variables and functions */
int *malloc(int);
int *newIntArray(int n) { return malloc(sizeof(int) * n); }


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

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

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

LLVM IR (-O2):
define noalias i32* @newIntArray(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i32* @malloc(i32 %2)
ret i32* %3
}
void PORT5_IRQHandler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<PORT5_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <PORT5_IRQHandler+0x9>
jmp    1109 <PORT5_IRQHandler+0x9>

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

LLVM IR (-O0):
define void @PORT5_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @PORT5_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
int ft_nextchr(char *str, char c) {
  int index;
  index = 0;
  while (str[index]) {
    if (str[index] == c)
      return (index);
    index++;
  }
  return (-1);
}


x86 assembly (clang, -O0):
<ft_nextchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1158 <ft_nextchr+0x58>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    114a <ft_nextchr+0x4a>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <ft_nextchr+0x5f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <ft_nextchr+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_nextchr>:
mov    (%rdi),%dl
mov    $0xffffffff,%eax
test   %dl,%dl
je     1122 <ft_nextchr+0x22>
xor    %ecx,%ecx
nopl   (%rax)
cmp    %sil,%dl
je     1123 <ft_nextchr+0x23>
movzbl 0x1(%rdi,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <ft_nextchr+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_nextchr(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %9
%6 = phi i64 [ %10, %9 ], [ 0, %2 ]
%7 = phi i8 [ %12, %9 ], [ %3, %2 ]
%8 = icmp eq i8 %7, %1
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = add nuw i64 %6, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %16, label %5
14: ; preds = %5
%15 = trunc i64 %6 to i32
br label %16
16: ; preds = %9, %14, %2
%17 = phi i32 [ -1, %2 ], [ %15, %14 ], [ -1, %9 ]
ret i32 %17
}
int test_imm_CBuint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xCB << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_CBuint64_highword_mem>:
testb  $0xcb,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_CBuint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 871878361088
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void test_zero() {
#pragma omp parallel sections
  {}
}


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

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

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

LLVM IR (-O2):
define void @test_zero() {
ret void
}
int get_val(char _c) {
  if (_c >= 'a' && _c <= 'z')
    return (_c - 'a' + 11);
  else if (_c >= '0' && _c <= '9')
    return (_c - '0' + 1);
  return 0;
}


x86 assembly (clang, -O0):
<get_val>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1136 <get_val+0x36>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1136 <get_val+0x36>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0xb,%eax
mov    %eax,-0x4(%rbp)
jmp    116e <get_val+0x6e>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1162 <get_val+0x62>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1162 <get_val+0x62>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116e <get_val+0x6e>
jmp    1167 <get_val+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_val>:
mov    %edi,%eax
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     110e <get_val+0xe>
add    $0xffffffaa,%eax
ret
lea    -0x30(%rax),%ecx
add    $0xffffffd1,%eax
xor    %edx,%edx
cmp    $0xa,%cl
cmovb  %eax,%edx
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @get_val(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -97
%4 = icmp ult i8 %3, 26
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = add nsw i32 %2, -86
br label %12
7: ; preds = %1
%8 = add i8 %0, -48
%9 = icmp ult i8 %8, 10
%10 = add nsw i32 %2, -47
%11 = select i1 %9, i32 %10, i32 0
br label %12
12: ; preds = %7, %5
%13 = phi i32 [ %6, %5 ], [ %11, %7 ]
ret i32 %13
}
char *obtenerCodigo() {
  char codigo[64];
  printf("Ingrese el codigo:");
  scanf("%s", &codigo);
  return &codigo;
}


x86 assembly (clang, -O0):
<obtenerCodigo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x40(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<obtenerCodigo>:
push   %rbx
sub    $0x40,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rbx,%rax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Ingrese el codigo:\00"
@.str.1 = [3 x i8] c"%s\00"
define i8* @obtenerCodigo() {
%1 = alloca [64 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [64 x i8]* %1)
%4 = bitcast [64 x i8]* %1 to i8*
ret i8* %4
}

LLVM IR (-O2):
@.str = [19 x i8] c"Ingrese el codigo:\00"
@.str.1 = [3 x i8] c"%s\00"
define i8* @obtenerCodigo() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [64 x i8]* %1)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int chaz_Util_can_open_file(const char *file_path) {
  FILE *garbage_fh;
  garbage_fh = fopen(file_path, "r");
  if (garbage_fh == NULL) {
    return 0;
  } else {
    fclose(garbage_fh);
    return 1;
  }
}


x86 assembly (clang, -O0):
<chaz_Util_can_open_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1157 <chaz_Util_can_open_file+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1167 <chaz_Util_can_open_file+0x47>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chaz_Util_can_open_file>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <chaz_Util_can_open_file+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @chaz_Util_can_open_file(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
scalar_t__ _sysconfig(int);
int __get_nprocs() { return (int)_sysconfig(12); }


x86 assembly (clang, -O0):
<__get_nprocs>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc,%edi
call   1030 <_sysconfig@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__get_nprocs>:
mov    $0xc,%edi
jmp    1030 <_sysconfig@plt>

LLVM IR (-O0):
define i32 @__get_nprocs() {
%1 = call i64 @_sysconfig(i32 12)
%2 = trunc i64 %1 to i32
ret i32 %2
}

LLVM IR (-O2):
define i32 @__get_nprocs() {
%1 = tail call i64 @_sysconfig(i32 12)
%2 = trunc i64 %1 to i32
ret i32 %2
}
int CorrectLong1(unsigned long *l, unsigned char *Buf) {
  Buf[0] = (unsigned char)(*l >> 24 & 0xffL);
  Buf[1] = (unsigned char)(*l >> 16 & 0xffL);
  Buf[2] = (unsigned char)(*l >> 8 & 0xffL);
  Buf[3] = (unsigned char)(*l & 0xffL);
  return (0);
}


x86 assembly (clang, -O0):
<CorrectLong1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
shr    $0x18,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CorrectLong1>:
mov    0x3(%rdi),%al
mov    %al,(%rsi)
mov    0x2(%rdi),%al
mov    %al,0x1(%rsi)
mov    0x1(%rdi),%al
mov    %al,0x2(%rsi)
mov    (%rdi),%al
mov    %al,0x3(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @CorrectLong1(i64* %0, i8* %1) {
%3 = alloca i64*
%4 = alloca i8*
store i64* %0, i64** %3
store i8* %1, i8** %4
%5 = load i64*, i64** %3
%6 = load i64, i64* %5
%7 = lshr i64 %6, 24
%8 = and i64 %7, 255
%9 = trunc i64 %8 to i8
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %9, i8* %11
%12 = load i64*, i64** %3
%13 = load i64, i64* %12
%14 = lshr i64 %13, 16
%15 = and i64 %14, 255
%16 = trunc i64 %15 to i8
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8 %16, i8* %18
%19 = load i64*, i64** %3
%20 = load i64, i64* %19
%21 = lshr i64 %20, 8
%22 = and i64 %21, 255
%23 = trunc i64 %22 to i8
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 2
store i8 %23, i8* %25
%26 = load i64*, i64** %3
%27 = load i64, i64* %26
%28 = and i64 %27, 255
%29 = trunc i64 %28 to i8
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i64 3
store i8 %29, i8* %31
ret i32 0
}

LLVM IR (-O2):
define i32 @CorrectLong1(i64* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i64, i64* %0
%4 = lshr i64 %3, 24
%5 = trunc i64 %4 to i8
store i8 %5, i8* %1
%6 = load i64, i64* %0
%7 = lshr i64 %6, 16
%8 = trunc i64 %7 to i8
%9 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %8, i8* %9
%10 = load i64, i64* %0
%11 = lshr i64 %10, 8
%12 = trunc i64 %11 to i8
%13 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %12, i8* %13
%14 = load i64, i64* %0
%15 = trunc i64 %14 to i8
%16 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %15, i8* %16
ret i32 0
}
void FlashTX_LED(int FlashTime_ms) {}


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

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

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

LLVM IR (-O2):
define void @FlashTX_LED(i32 %0) {
ret void
}
unsigned long uuid_version(void) { return (unsigned long)(0x100200); }


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

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

LLVM IR (-O0):
define i64 @uuid_version() {
ret i64 1049088
}

LLVM IR (-O2):
define i64 @uuid_version() {
ret i64 1049088
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_usage(const char *bin_name) {
  printf("Usage: %s DEVICE DAEMON\n", bin_name);
  printf("If DAEMON is the character 1, the program will go into the "
         "background.\n");
}


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

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Usage: %s DEVICE DAEMON\0A\00"
@.str.1 = [72 x i8] c"If DAEMON is the character 1, the program will go into the background.\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Usage: %s DEVICE DAEMON\0A\00"
@str = [71 x i8] c"If DAEMON is the character 1, the program will go into the background.\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *joystick_standard_init(void) { return NULL; }


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

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

LLVM IR (-O0):
define i8* @joystick_standard_init() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @joystick_standard_init() {
ret i8* null
}
/* Variables and functions */
char *realloc(char *, scalar_t__);
scalar_t__ strlen(char *);
char *str_realloc(char **p) {
  if (!*p)
    return NULL;
  char *t = realloc(*p, strlen(*p) + 1);
  if (!t)
    return NULL;
  return (*p = t);
}


x86 assembly (clang, -O0):
<str_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1147 <str_realloc+0x27>
movq   $0x0,-0x8(%rbp)
jmp    1199 <str_realloc+0x79>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118a <str_realloc+0x6a>
movq   $0x0,-0x8(%rbp)
jmp    1199 <str_realloc+0x79>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_realloc>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rbx
test   %rbx,%rbx
je     114d <str_realloc+0x2d>
mov    %rdi,%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rsi
mov    %rbx,%rdi
call   1040 <realloc@plt>
test   %rax,%rax
je     114d <str_realloc+0x2d>
mov    %rax,(%r14)
jmp    114f <str_realloc+0x2f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @str_realloc(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = tail call i64 @strlen(i8* %2)
%6 = add nsw i64 %5, 1
%7 = tail call i8* @realloc(i8* %2, i64 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %4
store i8* %7, i8** %0
br label %10
10: ; preds = %9, %4, %1
%11 = phi i8* [ null, %1 ], [ %7, %9 ], [ null, %4 ]
ret i8* %11
}
double mult_noproto(v1, v2)
double v1, v2;
{ return v1 * v2; }


x86 assembly (clang, -O0):
<mult_noproto>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mult_noproto>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @mult_noproto(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @mult_noproto(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
unsigned int f36(unsigned int x, int y __attribute__((unused))) {
  return (x >> (8 * 4 - 1)) | (x << 1);
}


x86 assembly (clang, -O0):
<f36>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1f,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f36(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 = lshr i32 %5, 31
%7 = load i32, i32* %3
%8 = shl i32 %7, 1
%9 = or i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @f36(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.fshl.i32(i32 %0, i32 %0, i32 1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int getsize(FILE *f) {
  int size;
  fseek(f, 0, SEEK_END);
  size = ftell(f);
  fseek(f, 0, SEEK_SET);
  return size;
}


x86 assembly (clang, -O0):
<getsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsize>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %eax,%ebp
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @getsize(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* @SEEK_END
%6 = call i32 @fseek(i32* %4, i32 0, i32 %5)
%7 = load i32*, i32** %2
%8 = call i32 @ftell(i32* %7)
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %9, i32 0, i32 %10)
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @getsize(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32* %0, i32 0, i32 %2)
%4 = tail call i32 @ftell(i32* %0)
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @fseek(i32* %0, i32 0, i32 %5)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char *p;
  char *s = "hello";
  strcpy(p, s);
  puts(p);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @strcpy(i8* undef, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) undef)
ret i32 0
}
void XmbDrawImageString() {}


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

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

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

LLVM IR (-O2):
define void @XmbDrawImageString() {
ret void
}
unsigned char FastUByteDiv(unsigned char x, unsigned char y) { return x / y; }


x86 assembly (clang, -O0):
<FastUByteDiv>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
cltd
idiv   %ecx
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FastUByteDiv>:
movzbl %dil,%eax
div    %sil
ret

LLVM IR (-O0):
define zeroext i8 @FastUByteDiv(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = sdiv i32 %6, %8
%10 = trunc i32 %9 to i8
ret i8 %10
}

LLVM IR (-O2):
define zeroext i8 @FastUByteDiv(i8 zeroext %0, i8 zeroext %1) {
%3 = udiv i8 %0, %1
ret i8 %3
}
/* Type definitions */
struct sudoku {
  int dummy;
};

/* Variables and functions */
int solve_recursive(struct sudoku *, int /*<<< orphan*/, int /*<<< orphan*/);
int sudoku_solve(struct sudoku *s) { return solve_recursive(s, 0, 0); }


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

x86 assembly (clang, -O2):
<sudoku_solve>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <solve_recursive@plt>

LLVM IR (-O0):
%struct.sudoku = type { i32 }
define i32 @sudoku_solve(%struct.sudoku* %0) {
%2 = alloca %struct.sudoku*
store %struct.sudoku* %0, %struct.sudoku** %2
%3 = load %struct.sudoku*, %struct.sudoku** %2
%4 = call i32 @solve_recursive(%struct.sudoku* %3, i32 0, i32 0)
ret i32 %4
}

LLVM IR (-O2):
%struct.sudoku = type { i32 }
define i32 @sudoku_solve(%struct.sudoku* %0) {
%2 = tail call i32 @solve_recursive(%struct.sudoku* %0, i32 0, i32 0)
ret i32 %2
}
/* Variables and functions */
int hexstr_get_nibble(char const **);
int hexstr_get_byte(char const **p) {
  int h = hexstr_get_nibble(p);
  int l = hexstr_get_nibble(p);
  if (h >= 0 && l >= 0)
    return (h << 4) | l;
  return -1;
}


x86 assembly (clang, -O0):
<hexstr_get_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <hexstr_get_nibble@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <hexstr_get_nibble@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1159 <hexstr_get_byte+0x49>
cmpl   $0x0,-0x18(%rbp)
jl     1159 <hexstr_get_byte+0x49>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <hexstr_get_byte+0x50>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexstr_get_byte>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <hexstr_get_nibble@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <hexstr_get_nibble@plt>
mov    %ebp,%ecx
shl    $0x4,%ecx
or     %eax,%ecx
or     %eax,%ebp
mov    $0xffffffff,%eax
cmovns %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @hexstr_get_byte(i8** %0) {
%2 = tail call i32 @hexstr_get_nibble(i8** %0)
%3 = tail call i32 @hexstr_get_nibble(i8** %0)
%4 = icmp sgt i32 %2, -1
%5 = icmp sgt i32 %3, -1
%6 = select i1 %4, i1 %5, i1 false
%7 = shl i32 %2, 4
%8 = or i32 %7, %3
%9 = select i1 %6, i32 %8, i32 -1
ret i32 %9
}