xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ outb(int const, int);
int /*<<< orphan*/ wait_ec(int, int, int /*<<< orphan*/);
void write_ec(const uint32_t port, const uint8_t value) {
  wait_ec(0x66, 1, 0);
  outb(0x81, 0x66);
  wait_ec(0x66, 1, 0);
  outb(port, 0x62);
  wait_ec(0x66, 1, 0);
  outb(value, 0x62);
  wait_ec(0x66, 1, 0);
  return;
}


x86 assembly (clang, -O0):
<write_ec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x66,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <wait_ec@plt>
mov    $0x81,%edi
mov    $0x66,%esi
call   1040 <outb@plt>
mov    $0x66,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <wait_ec@plt>
mov    -0x4(%rbp),%edi
mov    $0x62,%esi
call   1040 <outb@plt>
mov    $0x66,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <wait_ec@plt>
mov    -0x8(%rbp),%edi
mov    $0x62,%esi
call   1040 <outb@plt>
mov    $0x66,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <wait_ec@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_ec>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x66,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <wait_ec@plt>
mov    $0x81,%edi
mov    $0x66,%esi
call   1040 <outb@plt>
mov    $0x66,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <wait_ec@plt>
mov    %ebp,%edi
mov    $0x62,%esi
call   1040 <outb@plt>
mov    $0x66,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <wait_ec@plt>
mov    %ebx,%edi
mov    $0x62,%esi
call   1040 <outb@plt>
mov    $0x66,%edi
mov    $0x1,%esi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <wait_ec@plt>

LLVM IR (-O0):
define void @write_ec(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @wait_ec(i32 102, i32 1, i32 0)
%6 = call i32 @outb(i32 129, i32 102)
%7 = call i32 @wait_ec(i32 102, i32 1, i32 0)
%8 = load i32, i32* %3
%9 = call i32 @outb(i32 %8, i32 98)
%10 = call i32 @wait_ec(i32 102, i32 1, i32 0)
%11 = load i32, i32* %4
%12 = call i32 @outb(i32 %11, i32 98)
%13 = call i32 @wait_ec(i32 102, i32 1, i32 0)
ret void
}

LLVM IR (-O2):
define void @write_ec(i32 %0, i32 %1) {
%3 = tail call i32 @wait_ec(i32 102, i32 1, i32 0)
%4 = tail call i32 @outb(i32 129, i32 102)
%5 = tail call i32 @wait_ec(i32 102, i32 1, i32 0)
%6 = tail call i32 @outb(i32 %0, i32 98)
%7 = tail call i32 @wait_ec(i32 102, i32 1, i32 0)
%8 = tail call i32 @outb(i32 %1, i32 98)
%9 = tail call i32 @wait_ec(i32 102, i32 1, i32 0)
ret void
}
/* Variables and functions */
int stdc_3D85D6F8(char const *, char const *);
int strcmp(const char *str1, const char *str2) {
  return stdc_3D85D6F8(str1, str2);
}


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

x86 assembly (clang, -O2):
<strcmp>:
jmp    1030 <stdc_3D85D6F8@plt>

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

LLVM IR (-O2):
define i32 @strcmp(i8* %0, i8* %1) {
%3 = tail call i32 @stdc_3D85D6F8(i8* %0, i8* %1)
ret i32 %3
}
unsigned long b_smp_enqueue(void *ptr, unsigned long var) {
  unsigned long tlong;
  asm volatile("call *0x00100030" : "=a"(tlong) : "a"(ptr), "S"(var));
  return tlong;
}


x86 assembly (clang, -O0):
<b_smp_enqueue>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rsi
call   *0x100030
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_smp_enqueue>:
mov    %rdi,%rax
call   *0x100030
ret

LLVM IR (-O0):
define i64 @b_smp_enqueue(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i64 asm sideeffect "call *0x00100030", "={ax},{ax},{si},~{dirflag},~{fpsr},~{flags}"(i8* %6, i64 %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
ret i64 %9
}

LLVM IR (-O2):
define i64 @b_smp_enqueue(i8* %0, i64 %1) {
%3 = tail call i64 asm sideeffect "call *0x00100030", "={ax},{ax},{si},~{dirflag},~{fpsr},~{flags}"(i8* %0, i64 %1)
ret i64 %3
}
char toUpperCase(char c) {
  return (char)(c >= 'a' && c <= 'z' ? c - ('a' - 'A') : c);
}


x86 assembly (clang, -O0):
<toUpperCase>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1133 <toUpperCase+0x33>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jg     1133 <toUpperCase+0x33>
movsbl -0x1(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    113a <toUpperCase+0x3a>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toUpperCase>:
lea    -0x61(%rdi),%eax
lea    -0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @toUpperCase(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = sub nsw i32 %12, 32
br label %17
14: ; preds = %6, %1
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
br label %17
17: ; preds = %14, %10
%18 = phi i32 [ %13, %10 ], [ %16, %14 ]
%19 = trunc i32 %18 to i8
ret i8 %19
}

LLVM IR (-O2):
define signext i8 @toUpperCase(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, -32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
double max(double x, double y) {
  if (x >= y)
    return x;
  else
    return y;
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     112d <max+0x2d>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1137 <max+0x37>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
movapd %xmm1,%xmm2
cmplesd %xmm0,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

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

LLVM IR (-O2):
define double @max(double %0, double %1) {
%3 = fcmp oge double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
main() {
  puts("Hello World!");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
unsigned int flip(unsigned int input) {
  assert(sizeof(unsigned int) == 4);
  unsigned char *bytes = (unsigned char *)&input;
  int c;
  unsigned char temp;
  for (c = 0; c < 2; c++) {
    temp = bytes[c];
    bytes[c] = bytes[3 - c];
    bytes[3 - c] = temp;
  }
  return input;
}


x86 assembly (clang, -O0):
<flip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <assert@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    118c <flip+0x7c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x3,%ecx
sub    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x15(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    $0x3,%ecx
sub    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <flip+0x24>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flip>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
call   1030 <assert@plt>
bswap  %ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @flip(i32 %0) {
%2 = tail call i32 @assert(i32 1)
%3 = call i32 @llvm.bswap.i32(i32 %0)
ret i32 %3
}
void Profiler_FrameEnd() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ tcomplain();
void tdefault_load(struct target_ops *self, char *arg1, int arg2) {
  tcomplain();
}


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

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

LLVM IR (-O0):
%struct.target_ops = type { i32 }
define void @tdefault_load(%struct.target_ops* %0, i8* %1, i32 %2) {
%4 = alloca %struct.target_ops*
%5 = alloca i8*
%6 = alloca i32
store %struct.target_ops* %0, %struct.target_ops** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = call i32 (...) @tcomplain()
ret void
}

LLVM IR (-O2):
%struct.target_ops = type { i32 }
define void @tdefault_load(%struct.target_ops* nocapture readnone %0, i8* nocapture readnone %1, i32 %2) {
%4 = tail call i32 (...) @tcomplain()
ret void
}
float min(float a, float b) {
  if (b < a)
    return b;
  return a;
}


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <min+0x30>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    113a <min+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
minss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @min(float %0, float %1) {
%3 = fcmp olt float %1, %0
%4 = select i1 %3, float %1, float %0
ret float %4
}
int sanitycheck(int a, int b) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @sanitycheck(i32 %0, i32 %1) {
ret i32 0
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
pid_t fork() {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<fork>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec4(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fork>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @fork() {
%1 = load i32, i32* @ENOSYS
store i32 %1, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @fork() {
%1 = load i32, i32* @ENOSYS
store i32 %1, i32* @errno
ret i32 -1
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ value_mask;
};
struct TYPE_4__ {
  TYPE_1__ xconfigurerequest;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
unsigned long get_XEvent_xconfigurerequest_value_mask(void *_p) {
  return (unsigned long)((XEvent *)_p)->xconfigurerequest.value_mask;
}


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

x86 assembly (clang, -O2):
<get_XEvent_xconfigurerequest_value_mask>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i64 @get_XEvent_xconfigurerequest_value_mask(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @get_XEvent_xconfigurerequest_value_mask(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
main() {
  void *jmps[3];
  int i = 0;
  jmps[0] = &&a, jmps[1] = &&b, jmps[2] = &&c;
rejmp:
  goto *jmps[i];
a:
  i = 1;
  goto rejmp;
b:
  i = 2;
  goto rejmp;
c:
  i = 3;
  goto fin;
fin:
  return i;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0x2c(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0x2d(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0x2e(%rip),%rax
mov    %rax,-0x10(%rbp)
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rax
mov    %rax,-0x30(%rbp)
jmp    1169 <main+0x69>
movl   $0x1,-0x24(%rbp)
jmp    1133 <main+0x33>
movl   $0x2,-0x24(%rbp)
jmp    1133 <main+0x33>
movl   $0x3,-0x24(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret
mov    -0x30(%rbp),%rax
jmp    *%rax

x86 assembly (clang, -O2):
<main>:
lea    0x42(%rip),%rax
movq   %rax,%xmm0
lea    0x2d(%rip),%rax
movq   %rax,%xmm1
punpcklqdq %xmm0,%xmm1
movdqa %xmm1,-0x18(%rsp)
lea    0x29(%rip),%rax
mov    %rax,-0x8(%rsp)
xor    %eax,%eax
jmp    *-0x18(%rsp,%rax,8)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1,%eax
jmp    *-0x18(%rsp,%rax,8)
mov    $0x2,%eax
jmp    *-0x18(%rsp,%rax,8)
mov    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8*]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
store i8* blockaddress(@main, %12), i8** %4
%5 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 1
store i8* blockaddress(@main, %13), i8** %5
%6 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 2
store i8* blockaddress(@main, %14), i8** %6
br label %7
7: ; preds = %13, %12, %0
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 %9
%11 = load i8*, i8** %10
br label %17
12: ; preds = %17
store i32 1, i32* %3
br label %7
13: ; preds = %17
store i32 2, i32* %3
br label %7
14: ; preds = %17
store i32 3, i32* %3
br label %15
15: ; preds = %14
%16 = load i32, i32* %3
ret i32 %16
17: ; preds = %7
%18 = phi i8* [ %11, %7 ]
indirectbr i8* %18, [label %12, label %13, label %14]
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [3 x i8*]
%2 = bitcast [3 x i8*]* %1 to <2 x i8*>*
store <2 x i8*> <i8* blockaddress(@main, %4), i8* blockaddress(@main, %8)>, <2 x i8*>* %2
%3 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 2
store i8* blockaddress(@main, %9), i8** %3
br label %4
4: ; preds = %4, %8, %0
%5 = phi i64 [ 0, %0 ], [ 2, %8 ], [ 1, %4 ]
%6 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 %5
%7 = load i8*, i8** %6
indirectbr i8* %7, [label %4, label %8, label %9]
8: ; preds = %4
br label %4
9: ; preds = %4
ret i32 3
}
/* Variables and functions */
int rec(int, char *, int);
int start(int param1, char *param2) { return rec(param1, param2, 15000); }


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

x86 assembly (clang, -O2):
<start>:
mov    $0x3a98,%edx
jmp    1030 <rec@plt>

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

LLVM IR (-O2):
define i32 @start(i32 %0, i8* %1) {
%3 = tail call i32 @rec(i32 %0, i8* %1, i32 15000)
ret i32 %3
}
int compare(const void *key1, const void *key2) {
  int k1, k2;
  k1 = *((int *)key1);
  k2 = *((int *)key2);
  if (k1 > k2)
    return 1;
  else if (k1 == k2)
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1136 <compare+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1155 <compare+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    114e <compare+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1155 <compare+0x55>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setne  %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp ne i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ structSample1();
int /*<<< orphan*/ structSample2();
int /*<<< orphan*/ structSample3();
int main() {
  structSample1();
  structSample2();
  structSample3();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <structSample1@plt>
mov    $0x0,%al
call   1050 <structSample2@plt>
mov    $0x0,%al
call   1040 <structSample3@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <structSample1@plt>
xor    %eax,%eax
call   1050 <structSample2@plt>
xor    %eax,%eax
call   1040 <structSample3@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @structSample1()
%3 = call i32 (...) @structSample2()
%4 = call i32 (...) @structSample3()
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @structSample1()
%2 = tail call i32 (...) @structSample2()
%3 = tail call i32 (...) @structSample3()
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
/* Variables and functions */
scalar_t__ DBL_EPSILON;
scalar_t__ abs_dbl(double);
int equal_dbl(double a, double b) { return abs_dbl(a - b) < DBL_EPSILON; }


x86 assembly (clang, -O0):
<equal_dbl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1030 <abs_dbl@plt>
mov    0x2eb0(%rip),%rcx
cmp    (%rcx),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal_dbl>:
push   %rax
subsd  %xmm1,%xmm0
call   1030 <abs_dbl@plt>
mov    0x2ec7(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%rax
setl   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@DBL_EPSILON = global i64 0
define i32 @equal_dbl(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 = fsub double %5, %6
%8 = call i64 @abs_dbl(double %7)
%9 = load i64, i64* @DBL_EPSILON
%10 = icmp slt i64 %8, %9
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
@DBL_EPSILON = global i64 0
define i32 @equal_dbl(double %0, double %1) {
%3 = fsub double %0, %1
%4 = tail call i64 @abs_dbl(double %3)
%5 = load i64, i64* @DBL_EPSILON
%6 = icmp slt i64 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
void g_thread_pool_get_max_unused_threads() {}


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

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

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

LLVM IR (-O2):
define void @g_thread_pool_get_max_unused_threads() {
ret void
}
void foo_1_2_2_1_1_2_1_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_2_1_1_2_1_2_1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int minInsertions(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "Usage: ./test s\n");
    exit(-1);
  }
  printf("%d\n", minInsertions(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     117f <main+0x3f>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <minInsertions@plt>
mov    %eax,%esi
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1161 <main+0x21>
mov    0x8(%rsi),%rdi
call   1050 <minInsertions@plt>
lea    0xebb(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"Usage: ./test s\0A\00"
@.str.1 = [4 x i8] c"%d\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 %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @minInsertions(i8* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Usage: ./test s\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @minInsertions(i8* %10)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
void dalibc_linux_deinitialize() {
  fclose(stdin);
  fclose(stdout);
  fclose(stderr);
}


x86 assembly (clang, -O0):
<dalibc_linux_deinitialize>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <fclose@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
call   1030 <fclose@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
call   1030 <fclose@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dalibc_linux_deinitialize>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <fclose@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1030 <fclose@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@stdin = global i32 0
@stdout = global i32 0
@stderr = global i32 0
define void @dalibc_linux_deinitialize() {
%1 = load i32, i32* @stdin
%2 = call i32 @fclose(i32 %1)
%3 = load i32, i32* @stdout
%4 = call i32 @fclose(i32 %3)
%5 = load i32, i32* @stderr
%6 = call i32 @fclose(i32 %5)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@stdout = global i32 0
@stderr = global i32 0
define void @dalibc_linux_deinitialize() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @fclose(i32 %1)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fclose(i32 %3)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fclose(i32 %5)
ret void
}
/* Variables and functions */
int vink_daemon_main(int, char **);
int main(int argc, char **argv) { return vink_daemon_main(argc, argv); }


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

x86 assembly (clang, -O2):
<main>:
jmp    1030 <vink_daemon_main@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @vink_daemon_main(i32 %0, i8** %1)
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ __v2si;
typedef scalar_t__ __m64;

/* Variables and functions */
__m64 __attribute__((__always___, __nodebug__))
_mm_cmpgt_pi32(__m64 __m1, __m64 __m2) {
  return (__m64)((__v2si)__m1 > (__v2si)__m2);
}


x86 assembly (clang, -O0):
<_mm_cmpgt_pi32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mm_cmpgt_pi32>:
xor    %eax,%eax
cmp    %rsi,%rdi
setg   %al
ret

LLVM IR (-O0):
define i64 @_mm_cmpgt_pi32(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp sgt i64 %5, %6
%8 = zext i1 %7 to i32
%9 = sext i32 %8 to i64
ret i64 %9
}

LLVM IR (-O2):
define i64 @_mm_cmpgt_pi32(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = zext i1 %3 to i64
ret i64 %4
}
void quiterr(code, s) char *s;
{
  perror(s);
  exit(code);
}


x86 assembly (clang, -O0):
<quiterr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <perror@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<quiterr>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
xor    %eax,%eax
call   1030 <perror@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @quiterr(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %5)
%7 = load i32, i32* %3
unreachable
}

LLVM IR (-O2):
define void @quiterr(i32 %0, i8* %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %1)
tail call void @exit(i32 %0)
unreachable
}
void force_error(void) {}


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

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

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

LLVM IR (-O2):
define void @force_error() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ qsort(void *const, size_t, size_t,
                         int (*)(void const *, void const *));
void sortValues(void *const pbase, size_t total_elems, size_t size,
                int (*cmp)(const void *, const void *)) {
  qsort(pbase, total_elems, size, cmp);
}


x86 assembly (clang, -O0):
<sortValues>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <qsort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sortValues>:
jmp    1030 <qsort@plt>

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

LLVM IR (-O2):
define void @sortValues(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* nocapture %3) {
%5 = tail call i32 @qsort(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("[31m");
  printf("hello\n");
  printf("[0m");
  printf("[2J");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[31m\00"
@.str.1 = [7 x i8] c"hello\0A\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
@.str.3 = [5 x i8] c"\1B[2J\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[31m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
@.str.3 = [5 x i8] c"\1B[2J\00"
@str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ handle_error(char *);
scalar_t__ shm_unlink(char *);
void handle_sigint(int signum) {
  if (shm_unlink("MEMORY_PATH") < 0) {
    handle_error("Error calling shm_unlink\n");
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<handle_sigint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1040 <shm_unlink@plt>
cmp    $0x0,%rax
jge    115d <handle_sigint+0x2d>
lea    0xeb4(%rip),%rdi
call   1050 <handle_error@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<handle_sigint>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <shm_unlink@plt>
test   %rax,%rax
jns    114e <handle_sigint+0x1e>
lea    0xec3(%rip),%rdi
call   1050 <handle_error@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"MEMORY_PATH\00"
@.str.1 = [26 x i8] c"Error calling shm_unlink\0A\00"
@EXIT_SUCCESS = global i32 0
define void @handle_sigint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 @shm_unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @handle_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = load i32, i32* @EXIT_SUCCESS
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"MEMORY_PATH\00"
@.str.1 = [26 x i8] c"Error calling shm_unlink\0A\00"
@EXIT_SUCCESS = global i32 0
define void @handle_sigint(i32 %0) {
%2 = tail call i64 @shm_unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @handle_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
unreachable
}
/* Type definitions */
typedef scalar_t__ vaddr;
typedef int uint32_t;

/* Variables and functions */
int virt_to_phys_page(int);
uint32_t virt_to_phys(uint32_t vaddr) {
  int pg;
  uint32_t pgaddr;
  if ((pg = virt_to_phys_page(((uint32_t)(vaddr) >> 12))) == -1) {
    return 0;
  }
  pgaddr = ((uint32_t)(pg) << 12);
  return pgaddr | ((uint32_t)(vaddr)&0xfff);
}


x86 assembly (clang, -O0):
<virt_to_phys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
sar    $0xc,%edi
call   1030 <virt_to_phys_page@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    113e <virt_to_phys+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1158 <virt_to_phys+0x48>
mov    -0xc(%rbp),%eax
shl    $0xc,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
and    $0xfff,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<virt_to_phys>:
push   %rbx
mov    %edi,%ebx
sar    $0xc,%edi
call   1030 <virt_to_phys_page@plt>
mov    %eax,%ecx
shl    $0xc,%ecx
and    $0xfff,%ebx
or     %ecx,%ebx
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
cmovne %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @virt_to_phys(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = ashr i32 %6, 12
%8 = call i32 @virt_to_phys_page(i32 %7)
store i32 %8, i32* %4
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %18
11: ; preds = %1
%12 = load i32, i32* %4
%13 = shl i32 %12, 12
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = and i32 %15, 4095
%17 = or i32 %14, %16
store i32 %17, i32* %2
br label %18
18: ; preds = %11, %10
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @virt_to_phys(i32 %0) {
%2 = ashr i32 %0, 12
%3 = tail call i32 @virt_to_phys_page(i32 %2)
%4 = icmp eq i32 %3, -1
%5 = shl i32 %3, 12
%6 = and i32 %0, 4095
%7 = or i32 %5, %6
%8 = select i1 %4, i32 0, i32 %7
ret i32 %8
}
/* Variables and functions */
int _glp_lib_jday(int, int, int);
int weekday(int j) { return (j + _glp_lib_jday(1, 1, 1970)) % 7 + 1; }


x86 assembly (clang, -O0):
<weekday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x1,%esi
mov    $0x7b2,%edx
mov    %esi,%edi
call   1030 <_glp_lib_jday@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<weekday>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x7b2,%edx
call   1030 <_glp_lib_jday@plt>
add    %ebx,%eax
cltq
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %ecx,%eax
add    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @weekday(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_glp_lib_jday(i32 1, i32 1, i32 1970)
%5 = add nsw i32 %3, %4
%6 = srem i32 %5, 7
%7 = add nsw i32 %6, 1
ret i32 %7
}

LLVM IR (-O2):
define i32 @weekday(i32 %0) {
%2 = tail call i32 @_glp_lib_jday(i32 1, i32 1, i32 1970)
%3 = add nsw i32 %2, %0
%4 = srem i32 %3, 7
%5 = add nsw i32 %4, 1
ret i32 %5
}
void ASN1_generate_v3(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_generate_v3() {
ret void
}
double calc_1root(double a, double b) {
  double root1;
  root1 = -b / (2 * a);
  return root1;
}


x86 assembly (clang, -O0):
<calc_1root>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xece(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_1root>:
xorpd  0xef8(%rip),%xmm1
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @calc_1root(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %4
%7 = fneg double %6
%8 = load double, double* %3
%9 = fmul double 2.000000e+00, %8
%10 = fdiv double %7, %9
store double %10, double* %5
%11 = load double, double* %5
ret double %11
}

LLVM IR (-O2):
define double @calc_1root(double %0, double %1) {
%3 = fneg double %1
%4 = fmul double %0, 2.000000e+00
%5 = fdiv double %3, %4
ret double %5
}
int find(int *a, int size, int x) {
  for (int i = 0; i < size; i++) {
    if (a[i] == x) {
      return 1;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<find>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1154 <find+0x54>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1141 <find+0x41>
movl   $0x1,-0x4(%rbp)
jmp    115b <find+0x5b>
jmp    1146 <find+0x46>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <find+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <find+0x1e>
mov    %esi,%ecx
xor    %esi,%esi
nopl   (%rax)
cmp    %edx,(%rdi,%rsi,4)
je     111f <find+0x1f>
add    $0x1,%rsi
cmp    %rsi,%rcx
jne    1110 <find+0x10>
ret
mov    $0x1,%eax
ret

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

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


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ __print_book(struct book *, int);
void print_book(struct book *book) { __print_book(book, false); }


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

x86 assembly (clang, -O2):
<print_book>:
xor    %esi,%esi
jmp    1030 <__print_book@plt>

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

LLVM IR (-O2):
%struct.book = type { i32 }
define void @print_book(%struct.book* %0) {
%2 = tail call i32 @__print_book(%struct.book* %0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void cleanUp(char *base[]) {
  int i;
  for (i = 0; i < 81920; i++) {
    free(base[i]);
  }
}


x86 assembly (clang, -O0):
<cleanUp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x14000,-0xc(%rbp)
jge    114f <cleanUp+0x3f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <cleanUp+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanUp>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    $0x14000,%rbx
jne    1120 <cleanUp+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @cleanUp(i8** nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = tail call i32 @free(i8* %5)
%7 = add nuw nsw i64 %3, 1
%8 = icmp eq i64 %7, 81920
br i1 %8, label %9, label %2
9: ; preds = %2
ret void
}