xunge/DecIR huggingface dataset:
void format_warn(msg, arg) const char *msg, arg[];
{
  char warn_msg[2048];
  snprintf(warn_msg, sizeof(warn_msg), msg, arg);
  lwarn(warn_msg);
}


x86 assembly (clang, -O0):
<format_warn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x810(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x800,%esi
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    -0x810(%rbp),%rdi
mov    $0x0,%al
call   1040 <lwarn@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_warn>:
push   %rbx
sub    $0x800,%rsp
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    %rsp,%rbx
mov    $0x800,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <snprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <lwarn@plt>
add    $0x800,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @format_warn(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [2048 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %6, i64 2048, i8* %7, i8* %8)
%10 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @lwarn to i32 (i8*, ...)*)(i8* %10)
ret void
}

LLVM IR (-O2):
define void @format_warn(i8* nocapture %0, i8* %1) {
%3 = alloca [2048 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %4, i64 2048, i8* %0, i8* %1)
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @lwarn to i32 (i8*, ...)*)(i8* %4)
ret void
}
void charClassClear(unsigned char bits[], int c) {
  bits[c >> 3] &= ~(1 << (c & 7));
}


x86 assembly (clang, -O0):
<charClassClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%esi
shl    %cl,%esi
xor    $0xffffffff,%esi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
and    %esi,%edx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<charClassClear>:
mov    %esi,%ecx
and    $0x7,%cl
mov    $0x1,%eax
shl    %cl,%eax
sar    $0x3,%esi
movslq %esi,%rcx
not    %al
and    %al,(%rdi,%rcx,1)
ret

LLVM IR (-O0):
define void @charClassClear(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 7
%7 = shl i32 1, %6
%8 = xor i32 %7, -1
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = ashr i32 %10, 3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = and i32 %15, %8
%17 = trunc i32 %16 to i8
store i8 %17, i8* %13
ret void
}

LLVM IR (-O2):
define void @charClassClear(i8* nocapture %0, i32 %1) {
%3 = and i32 %1, 7
%4 = shl nuw nsw i32 1, %3
%5 = ashr i32 %1, 3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = trunc i32 %4 to i8
%10 = xor i8 %9, -1
%11 = and i8 %8, %10
store i8 %11, i8* %7
ret void
}
void foo293() {}


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

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

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

LLVM IR (-O2):
define void @foo293() {
ret void
}
void message(const char *fmt, ...) { (void)fmt; }


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

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

LLVM IR (-O0):
define void @message(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @message(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, unsigned long long, int);
int verify_alignment(void *ptr, char *ptr_name) {
  uintptr_t addr = (uintptr_t)ptr;
  uintptr_t mask = 128 - 1;
  if (addr & mask) {
    printf("ERROR: %s address 0x%llx is not aligned to 0x%x byte boundary \n",
           ptr_name, (unsigned long long)ptr, 128);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<verify_alignment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movq   $0x7f,-0x28(%rbp)
mov    -0x20(%rbp),%rax
and    -0x28(%rbp),%rax
cmp    $0x0,%rax
je     1167 <verify_alignment+0x57>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeaf(%rip),%rdi
mov    $0x80,%ecx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    116e <verify_alignment+0x5e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_alignment>:
mov    %rdi,%rdx
test   $0x7f,%dl
je     1131 <verify_alignment+0x21>
push   %rax
lea    0xee0(%rip),%rdi
mov    $0x80,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
@.str = [64 x i8] c"ERROR: %s address 0x%llx is not aligned to 0x%x byte boundary \0A\00"
define i32 @verify_alignment(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = ptrtoint i8* %8 to i64
store i64 %9, i64* %6
store i64 127, i64* %7
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = and i64 %10, %11
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i8*, i8** %5
%16 = load i8*, i8** %4
%17 = ptrtoint i8* %16 to i64
%18 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %15, i64 %17, i32 128)
store i32 0, i32* %3
br label %20
19: ; preds = %2
store i32 1, i32* %3
br label %20
20: ; preds = %19, %14
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [64 x i8] c"ERROR: %s address 0x%llx is not aligned to 0x%x byte boundary \0A\00"
define i32 @verify_alignment(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = and i64 %3, 127
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %1, i64 %3, i32 128)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %9
}
void write_string(int colour, const char *string) {
  volatile char *video = (volatile char *)0xB8000;
  while (*string != 0) {
    *video++ = *string++;
    *video++ = colour;
  }
}


x86 assembly (clang, -O0):
<write_string>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xb8000,%eax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1161 <write_string+0x61>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1114 <write_string+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_string>:
mov    (%rsi),%al
test   %al,%al
je     112c <write_string+0x2c>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %al,0xb8000(%rcx,%rcx,1)
mov    %dil,0xb8001(%rcx,%rcx,1)
movzbl 0x1(%rsi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1110 <write_string+0x10>
ret

LLVM IR (-O0):
define void @write_string(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
store i8* inttoptr (i64 753664 to i8*), i8** %5
br label %6
6: ; preds = %11, %2
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %6
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %4
%14 = load i8, i8* %12
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %5
store volatile i8 %14, i8* %15
%17 = load i32, i32* %3
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %5
store volatile i8 %18, i8* %19
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @write_string(i32 %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2
%6 = trunc i32 %0 to i8
br label %7
7: ; preds = %5, %7
%8 = phi i8 [ %3, %5 ], [ %14, %7 ]
%9 = phi i8* [ inttoptr (i64 753664 to i8*), %5 ], [ %13, %7 ]
%10 = phi i8* [ %1, %5 ], [ %11, %7 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = getelementptr inbounds i8, i8* %9, i64 1
store volatile i8 %8, i8* %9
%13 = getelementptr inbounds i8, i8* %9, i64 2
store volatile i8 %6, i8* %12
%14 = load i8, i8* %11
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %2
ret void
}
/* Variables and functions */
char *mapping_getwd(char *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
void pwd(void) {
  int canary = 7;
  char path[10 + 1];
  if (mapping_getwd(path) == (char *)NULL) {
    if (0)
      printf("Couldn't get current directory!\n");
  } else {
    if (0)
      printf("Current directory = %s\n", path);
    if (0)
      printf("max strlen(path) is %d, strlen(path) = %d\n", 10 - 1,
             strlen(path));
    if (0)
      printf("Canary should be 7.  Canary = %d\n", canary);
    if (canary != 7)
      if (0)
        printf("ALERT: path[MAXPATHLEN + 1] has been overflowed!\n");
  }
}


x86 assembly (clang, -O0):
<pwd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x7,-0x4(%rbp)
lea    -0xf(%rbp),%rdi
call   1030 <mapping_getwd@plt>
cmp    $0x0,%rax
jne    1137 <pwd+0x27>
jmp    114b <pwd+0x3b>
cmpl   $0x7,-0x4(%rbp)
je     1146 <pwd+0x36>
jmp    1146 <pwd+0x36>
jmp    114b <pwd+0x3b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwd>:
sub    $0x18,%rsp
lea    0xd(%rsp),%rdi
call   1030 <mapping_getwd@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @pwd() {
%1 = alloca i32
%2 = alloca [11 x i8]
store i32 7, i32* %1
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%4 = call i8* @mapping_getwd(i8* %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %0
br label %12
7: ; preds = %0
%8 = load i32, i32* %1
%9 = icmp ne i32 %8, 7
br i1 %9, label %10, label %11
10: ; preds = %7
br label %11
11: ; preds = %10, %7
br label %12
12: ; preds = %11, %6
ret void
}

LLVM IR (-O2):
define void @pwd() {
%1 = alloca [11 x i8]
%2 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%3 = call i8* @mapping_getwd(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
extern void finaliza_ncurses() { endwin(); }


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

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

LLVM IR (-O0):
define void @finaliza_ncurses() {
%1 = call i32 (...) @endwin()
ret void
}

LLVM IR (-O2):
define void @finaliza_ncurses() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AddRight(int *, int *, int);
void AddVecRight(int *dst, int *length_dst, int *src, int length_src) {
  int i;
  ;
  ;
  ;
  for (i = 0; i < length_src; i++) {
    ;
    AddRight(dst, length_dst, src[i]);
  };
}


x86 assembly (clang, -O0):
<AddVecRight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1160 <AddVecRight+0x50>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
call   1030 <AddRight@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112e <AddVecRight+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AddVecRight>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %ecx,%ecx
jle    1148 <AddVecRight+0x38>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %ecx,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <AddRight@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1130 <AddVecRight+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @AddVecRight(i32* %0, i32* %1, i32* nocapture %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %15
6: ; preds = %4
%7 = zext i32 %3 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %13, %8 ]
%10 = getelementptr inbounds i32, i32* %2, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 @AddRight(i32* %0, i32* %1, i32 %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %4
ret void
}
void Blink_Timer_RestoreConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @Blink_Timer_RestoreConfig() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ munmap(void *, unsigned int);
void u_munmap(void *addr, unsigned int len) { munmap(addr, len); }


x86 assembly (clang, -O0):
<u_munmap>:
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 <munmap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_munmap>:
jmp    1030 <munmap@plt>

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

LLVM IR (-O2):
define void @u_munmap(i8* %0, i32 %1) {
%3 = tail call i32 @munmap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
double const cos(double const);
int exp(double const);
double boltzmann_cos(const double phase, const double k) {
  return 1. / (1. + exp(k * cos(phase)));
}


x86 assembly (clang, -O0):
<boltzmann_cos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe9d(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xe91(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boltzmann_cos>:
push   %rax
movsd  %xmm1,(%rsp)
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
call   1030 <exp@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xebc(%rip),%xmm0
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @boltzmann_cos(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = call double @cos(double %6)
%8 = fmul double %5, %7
%9 = call i32 @exp(double %8)
%10 = sitofp i32 %9 to double
%11 = fadd double 1.000000e+00, %10
%12 = fdiv double 1.000000e+00, %11
ret double %12
}

LLVM IR (-O2):
define double @boltzmann_cos(double %0, double %1) {
%3 = tail call double @cos(double %0)
%4 = fmul double %3, %1
%5 = tail call i32 @exp(double %4)
%6 = sitofp i32 %5 to double
%7 = fadd double %6, 1.000000e+00
%8 = fdiv double 1.000000e+00, %7
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/);
void *thread_func() {
  pthread_exit(0);
  return NULL;
}


x86 assembly (clang, -O0):
<thread_func>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <pthread_exit@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_func>:
push   %rax
xor    %edi,%edi
call   1030 <pthread_exit@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @thread_func() {
%1 = call i32 @pthread_exit(i32 0)
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @thread_func() {
%1 = tail call i32 @pthread_exit(i32 0)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stdout;
void logint(char *name, int var) {
  fprintf(stdout, "VARIABLE -- `%s`: %d -- (int)\n", name, var);
}


x86 assembly (clang, -O0):
<logint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logint>:
mov    %esi,%ecx
mov    %rdi,%rdx
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
lea    0xedb(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [31 x i8] c"VARIABLE -- `%s`: %d -- (int)\0A\00"
define void @logint(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stdout
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [31 x i8] c"VARIABLE -- `%s`: %d -- (int)\0A\00"
define void @logint(i8* %0, i32 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
void __log_unused(const char *format, ...) {}


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

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

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

LLVM IR (-O2):
define void @__log_unused(i8* nocapture %0, ...) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ LogVfprintf(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void LogWarn(FILE *prFP, char *pcFmt, va_list rVArgList) {
  fprintf(prFP, "WARNING: ");
  LogVfprintf(prFP, pcFmt, rVArgList);
}


x86 assembly (clang, -O0):
<LogWarn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <LogVfprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LogWarn>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xecc(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1040 <fwrite@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <LogVfprintf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"WARNING: \00"
define void @LogWarn(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %4
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @LogVfprintf(i32* %9, i8* %10, i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"WARNING: \00"
define void @LogWarn(i32* %0, i8* %1, i32 %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 9, i64 1, i32* %0)
%5 = tail call i32 @LogVfprintf(i32* %0, i8* %1, i32 %2)
ret void
}
int isopt(char *arg) { return *arg == '-'; }


x86 assembly (clang, -O0):
<isopt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isopt>:
xor    %eax,%eax
cmpb   $0x2d,(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @isopt(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 45
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @isopt(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 45
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n = 0;
  scanf("%d", &n);
  int square = n * n;
  int cube = n * square;
  printf("%d\n%d\n", square, cube);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edx
mov    %edx,%esi
imul   %edx,%esi
imul   %esi,%edx
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%d\0A%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = mul nsw i32 %4, %4
%6 = mul nsw i32 %5, %4
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fill(int, int, int);
int /*<<< orphan*/ insertSort(int, int, int);
void fill_and_sort(int idx) {
  int j;
  int maxnum, lb, ub, i;
  maxnum = 10000;
  lb = 0;
  ub = maxnum - 1;
  fill(idx, lb, ub);
  insertSort(idx, lb, ub);
}


x86 assembly (clang, -O0):
<fill_and_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x2710,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <fill@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <insertSort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_and_sort>:
push   %rbx
mov    %edi,%ebx
xor    %esi,%esi
mov    $0x270f,%edx
call   1040 <fill@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x270f,%edx
pop    %rbx
jmp    1030 <insertSort@plt>

LLVM IR (-O0):
define void @fill_and_sort(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
store i32 10000, i32* %4
store i32 0, i32* %5
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %6
%10 = load i32, i32* %2
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 @fill(i32 %10, i32 %11, i32 %12)
%14 = load i32, i32* %2
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call i32 @insertSort(i32 %14, i32 %15, i32 %16)
ret void
}

LLVM IR (-O2):
define void @fill_and_sort(i32 %0) {
%2 = tail call i32 @fill(i32 %0, i32 0, i32 9999)
%3 = tail call i32 @insertSort(i32 %0, i32 0, i32 9999)
ret void
}
/* Variables and functions */
int eg_indirect_table_set(unsigned int, int, unsigned int, int, unsigned int *);
int eg_sak_table_set(unsigned int dev_id, unsigned int index,
                     unsigned int *pentry) {
  if ((index < 64) || (index > 95)) {
    return -1;
  }
  return eg_indirect_table_set(dev_id, 2, index, 4, pentry);
}


x86 assembly (clang, -O0):
<eg_sak_table_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x40,-0xc(%rbp)
jb     1136 <eg_sak_table_set+0x26>
cmpl   $0x5f,-0xc(%rbp)
jbe    1142 <eg_sak_table_set+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    115e <eg_sak_table_set+0x4e>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%r8
mov    $0x2,%esi
mov    $0x4,%ecx
call   1030 <eg_indirect_table_set@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eg_sak_table_set>:
mov    %rdx,%r8
mov    %esi,%edx
lea    -0x60(%rdx),%eax
cmp    $0xffffffe0,%eax
jae    1123 <eg_sak_table_set+0x13>
mov    $0xffffffff,%eax
ret
mov    $0x2,%esi
mov    $0x4,%ecx
jmp    1030 <eg_indirect_table_set@plt>

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

LLVM IR (-O2):
define i32 @eg_sak_table_set(i32 %0, i32 %1, i32* %2) {
%4 = add i32 %1, -96
%5 = icmp ult i32 %4, -32
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @eg_indirect_table_set(i32 %0, i32 2, i32 %1, i32 4, i32* %2)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %7, %6 ], [ -1, %3 ]
ret i32 %9
}
void acpi_debugfs_init(void) { return; }


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

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

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

LLVM IR (-O2):
define void @acpi_debugfs_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
quit_prog() {
  endwin();
  exit(0);
}


x86 assembly (clang, -O0):
<quit_prog>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<quit_prog>:
push   %rax
xor    %eax,%eax
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @quit_prog() {
%1 = call i32 (...) @endwin()
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @quit_prog() {
%1 = tail call i32 (...) @endwin()
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ aes_decrypt(void *, void *, void *, size_t, int);
int /*<<< orphan*/ setup_aeskey(int, int, void *);
int /*<<< orphan*/ use_aeskey(int);
void decrypt(void *key, void *iv, void *inbuf, void *outbuf, size_t size) {
  setup_aeskey(0x2C, 1 | 4, key);
  use_aeskey(0x2C);
  aes_decrypt(inbuf, outbuf, iv, size / 0x10, (2 << 27));
}


x86 assembly (clang, -O0):
<decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x2c,%edi
mov    $0x5,%esi
call   1040 <setup_aeskey@plt>
mov    $0x2c,%edi
call   1030 <use_aeskey@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rcx
shr    $0x4,%rcx
mov    $0x10000000,%r8d
call   1050 <aes_decrypt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decrypt>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %r8,%rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rdx
mov    $0x2c,%edi
mov    $0x5,%esi
call   1040 <setup_aeskey@plt>
mov    $0x2c,%edi
call   1030 <use_aeskey@plt>
shr    $0x4,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    $0x10000000,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <aes_decrypt@plt>

LLVM IR (-O0):
define void @decrypt(i8* %0, i8* %1, i8* %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%11 = load i8*, i8** %6
%12 = call i32 @setup_aeskey(i32 44, i32 5, i8* %11)
%13 = call i32 @use_aeskey(i32 44)
%14 = load i8*, i8** %8
%15 = load i8*, i8** %9
%16 = load i8*, i8** %7
%17 = load i64, i64* %10
%18 = udiv i64 %17, 16
%19 = call i32 @aes_decrypt(i8* %14, i8* %15, i8* %16, i64 %18, i32 268435456)
ret void
}

LLVM IR (-O2):
define void @decrypt(i8* %0, i8* %1, i8* %2, i8* %3, i64 %4) {
%6 = tail call i32 @setup_aeskey(i32 44, i32 5, i8* %0)
%7 = tail call i32 @use_aeskey(i32 44)
%8 = lshr i64 %4, 4
%9 = tail call i32 @aes_decrypt(i8* %2, i8* %3, i8* %1, i64 %8, i32 268435456)
ret void
}
int test_imm_45int64_highword_reg(long long val) {
  return ((val >> 32) & (0x45 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_45int64_highword_reg(i64 %0) {
%2 = and i64 %0, 296352743424
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ proc_scheduler(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("usage kvasir host_file\n");
    return 0;
  }
  proc_scheduler(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1158 <main+0x38>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    116c <main+0x4c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <proc_scheduler@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1131 <main+0x11>
mov    0x8(%rsi),%rdi
call   1040 <proc_scheduler@plt>
jmp    113d <main+0x1d>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [23 x i8] c"usage kvasir host_file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @proc_scheduler(i8* %8)
br label %10
10: ; preds = %6, %4
ret i32 0
}
/* 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 file_length(FILE *stream) {
  int flen = 0;
  fseek(stream, 0, SEEK_END);
  flen = ftell(stream);
  fseek(stream, 0, SEEK_SET);
  return flen;
}


x86 assembly (clang, -O0):
<file_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eaa(%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    0x2e7a(%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):
<file_length>:
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 @file_length(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%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 @file_length(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*/ cm_angle(int, int);
void camera_straight() { cm_angle(1533 / 256, 1533 % 256); }


x86 assembly (clang, -O0):
<camera_straight>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
mov    $0xfd,%esi
call   1030 <cm_angle@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<camera_straight>:
mov    $0x5,%edi
mov    $0xfd,%esi
jmp    1030 <cm_angle@plt>

LLVM IR (-O0):
define void @camera_straight() {
%1 = call i32 @cm_angle(i32 5, i32 253)
ret void
}

LLVM IR (-O2):
define void @camera_straight() {
%1 = tail call i32 @cm_angle(i32 5, i32 253)
ret void
}
/* Variables and functions */
size_t size_next(size_t current) { return current * 2; }


x86 assembly (clang, -O0):
<size_next>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_next>:
lea    (%rdi,%rdi,1),%rax
ret

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

LLVM IR (-O2):
define i64 @size_next(i64 %0) {
%2 = shl i64 %0, 1
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void msleep(unsigned char msec) {
  do {
    usleep(250);
    usleep(250);
    usleep(250);
    usleep(250);
  } while (--msec);
}


x86 assembly (clang, -O0):
<msleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xfa,%edi
call   1030 <usleep@plt>
mov    $0xfa,%edi
call   1030 <usleep@plt>
mov    $0xfa,%edi
call   1030 <usleep@plt>
mov    $0xfa,%edi
call   1030 <usleep@plt>
mov    -0x1(%rbp),%al
add    $0xff,%al
mov    %al,-0x1(%rbp)
cmp    $0x0,%al
jne    111e <msleep+0xe>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msleep>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xfa,%edi
call   1030 <usleep@plt>
mov    $0xfa,%edi
call   1030 <usleep@plt>
mov    $0xfa,%edi
call   1030 <usleep@plt>
mov    $0xfa,%edi
call   1030 <usleep@plt>
add    $0xff,%bl
jne    1120 <msleep+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @msleep(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %8, %1
%4 = call i32 @usleep(i32 250)
%5 = call i32 @usleep(i32 250)
%6 = call i32 @usleep(i32 250)
%7 = call i32 @usleep(i32 250)
br label %8
8: ; preds = %3
%9 = load i8, i8* %2
%10 = add i8 %9, -1
store i8 %10, i8* %2
%11 = icmp ne i8 %10, 0
br i1 %11, label %3, label %12
12: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @msleep(i8 zeroext %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8 [ %0, %1 ], [ %8, %2 ]
%4 = tail call i32 @usleep(i32 250)
%5 = tail call i32 @usleep(i32 250)
%6 = tail call i32 @usleep(i32 250)
%7 = tail call i32 @usleep(i32 250)
%8 = add i8 %3, -1
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %2
10: ; preds = %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ _sha512_be64enc(unsigned char *, int /*<<< orphan*/ const);
void be64enc_vect(unsigned char *dst, const uint64_t *src, size_t len) {
  size_t i;
  for (i = 0; i < len / 8; i++) {
    _sha512_be64enc(dst + i * 8, src[i]);
  }
}


x86 assembly (clang, -O0):
<be64enc_vect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
shr    $0x3,%rcx
cmp    %rcx,%rax
jae    1171 <be64enc_vect+0x61>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <_sha512_be64enc@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112c <be64enc_vect+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<be64enc_vect>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x8,%rdx
jb     1149 <be64enc_vect+0x39>
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
shr    $0x3,%r15
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r14,%rbx,4),%esi
mov    %r12,%rdi
call   1030 <_sha512_be64enc@plt>
add    $0x1,%rbx
add    $0x8,%r12
cmp    %rbx,%r15
jne    1130 <be64enc_vect+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @be64enc_vect(i8* %0, i32* nocapture %1, i64 %2) {
%4 = icmp ult i64 %2, 8
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = lshr i64 %2, 3
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ %14, %7 ], [ 0, %5 ]
%9 = shl i64 %8, 3
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = getelementptr inbounds i32, i32* %1, i64 %8
%12 = load i32, i32* %11
%13 = tail call i32 @_sha512_be64enc(i8* %10, i32 %12)
%14 = add nuw nsw i64 %8, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %16, label %7
16: ; preds = %7, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ *strchr(char const *, char);
int is_wildcard(const char *str) {
  if (str && strchr(str, '%') != NULL)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_wildcard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114b <is_wildcard+0x3b>
mov    -0x10(%rbp),%rdi
mov    $0x25,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     114b <is_wildcard+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1152 <is_wildcard+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_wildcard>:
test   %rdi,%rdi
je     1133 <is_wildcard+0x23>
push   %rax
mov    $0x25,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
lea    0x8(%rsp),%rsp
je     1133 <is_wildcard+0x23>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @is_wildcard(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i32* @strchr(i8* %7, i8 signext 37)
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %11
10: ; preds = %6
store i32 1, i32* %2
br label %12
11: ; preds = %6, %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @is_wildcard(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32* @strchr(i8* %0, i8 signext 37)
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %7
6: ; preds = %3, %1
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ 0, %6 ], [ 1, %3 ]
ret i32 %8
}
unsigned long long catTrimToHour(unsigned long long timeMs) {
  return timeMs / (3600 * 1000);
}


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

x86 assembly (clang, -O2):
<catTrimToHour>:
mov    %rdi,%rax
movabs $0x4a90be587de6e565,%rcx
be 90 4a
mul    %rcx
mov    %rdx,%rax
shr    $0x14,%rax
ret

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

LLVM IR (-O2):
define i64 @catTrimToHour(i64 %0) {
%2 = udiv i64 %0, 3600000
ret i64 %2
}
const char *__malidrv_build_info(void) {
  return "malidrv:  CONFIG=sc8825 USING_OS_MEMORY=0 API_VERSION=14 REPO_URL= "
         "REVISION=-rr3p0 CHANGED_REVISION= CHANGE_DATE= CPU= USING_UMP=1 "
         "USING_MALI200=0 USING_MALI400=4 USING_MALI400_L2_CACHE=1 USING_GP2=0 "
         "KDIR= MALI_PLATFORM_FILE=platform/sc8825/mali_platform.c "
         "OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=6 USING_PROFILING=1 "
         "USING_INTERNAL_PROFILING=0 USING_GPU_UTILIZATION=y";
}


x86 assembly (clang, -O0):
<__malidrv_build_info>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__malidrv_build_info>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [363 x i8] c"malidrv: CONFIG=sc8825 USING_OS_MEMORY=0 API_VERSION=14 REPO_URL= REVISION=-rr3p0 CHANGED_REVISION= CHANGE_DATE= CPU= USING_UMP=1 USING_MALI200=0 USING_MALI400=4 USING_MALI400_L2_CACHE=1 USING_GP2=0 KDIR= MALI_PLATFORM_FILE=platform/sc8825/mali_platform.c OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=6 USING_PROFILING=1 USING_INTERNAL_PROFILING=0 USING_GPU_UTILIZATION=y\00"
define i8* @__malidrv_build_info() {
ret i8* getelementptr inbounds ([363 x i8], [363 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [363 x i8] c"malidrv: CONFIG=sc8825 USING_OS_MEMORY=0 API_VERSION=14 REPO_URL= REVISION=-rr3p0 CHANGED_REVISION= CHANGE_DATE= CPU= USING_UMP=1 USING_MALI200=0 USING_MALI400=4 USING_MALI400_L2_CACHE=1 USING_GP2=0 KDIR= MALI_PLATFORM_FILE=platform/sc8825/mali_platform.c OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=6 USING_PROFILING=1 USING_INTERNAL_PROFILING=0 USING_GPU_UTILIZATION=y\00"
define i8* @__malidrv_build_info() {
ret i8* getelementptr inbounds ([363 x i8], [363 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void SysCtlGPIOAHBEnable(uint32_t ui32GPIOPeripheral) {

  ;
  (*((volatile uint32_t *)(0x400FE06C))) |= (1 << (ui32GPIOPeripheral & 0xF));
}


x86 assembly (clang, -O0):
<SysCtlGPIOAHBEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    $0x400fe06c,%ecx
mov    (%rcx),%ecx
or     %eax,%ecx
mov    $0x400fe06c,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlGPIOAHBEnable>:
mov    %edi,%ecx
and    $0xf,%cl
mov    $0x1,%eax
shl    %cl,%eax
or     %eax,0x400fe06c
ret

LLVM IR (-O0):
define void @SysCtlGPIOAHBEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 15
%5 = shl i32 1, %4
%6 = load volatile i32, i32* inttoptr (i64 1074782316 to i32*)
%7 = or i32 %6, %5
store volatile i32 %7, i32* inttoptr (i64 1074782316 to i32*)
ret void
}

LLVM IR (-O2):
define void @SysCtlGPIOAHBEnable(i32 %0) {
%2 = and i32 %0, 15
%3 = shl nuw nsw i32 1, %2
%4 = load volatile i32, i32* inttoptr (i64 1074782316 to i32*)
%5 = or i32 %4, %3
store volatile i32 %5, i32* inttoptr (i64 1074782316 to i32*)
ret void
}
/* Variables and functions */
void bzero_2(char *s, size_t n) {
  char *e = s + n;
#pragma clang loop unroll(disable)
  while (s < e)
    *s++ = 0;
}


x86 assembly (clang, -O0):
<bzero_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    113d <bzero_2+0x3d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
jmp    1118 <bzero_2+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bzero_2>:
test   %rsi,%rsi
jle    1135 <bzero_2+0x25>
push   %rax
mov    %rsi,%rdx
add    %rdi,%rdx
lea    0x1(%rdi),%rax
cmp    %rax,%rdx
cmovbe %rax,%rdx
sub    %rdi,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @bzero_2(i8* writeonly %0, i64 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = icmp sgt i64 %1, 0
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = add i64 %3, %1
%7 = add i64 %3, 1
%8 = call i64 @llvm.umax.i64(i64 %6, i64 %7)
%9 = sub i64 %8, %3
br label %10
10: ; preds = %5, %2
ret void
}