xunge/DecIR huggingface dataset:
int betrans_shutdown(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @betrans_shutdown() {
ret i32 0
}

LLVM IR (-O2):
define i32 @betrans_shutdown() {
ret i32 0
}
__attribute__((no)) long trampoline_mprotect(unsigned long n1, unsigned long n2,
                                             int n3) {
  long ret;
  __asm__ __volatile__("leaq 1f(%%rip), %%r11\n\t"
                       "movq %%r11, %%fs:0x20\n\t"
                       "jmpq *%%gs:0x10000+"
                       "0x8"
                       "\n\t"
                       "1:\n\t"
                       : "=a"(ret)
                       : "D"(n1), "S"(n2), "d"(n3)
                       : "memory");
  return ret;
}


x86 assembly (clang, -O0):
<trampoline_mprotect>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0x11(%rip),%r11
mov    %r11,%fs:0x20
jmp    *%gs:0x10008
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trampoline_mprotect>:
lea    0x11(%rip),%r11
mov    %r11,%fs:0x20
jmp    *%gs:0x10008
ret

LLVM IR (-O0):
define i64 @trampoline_mprotect(i64 %0, i64 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%8 = load i64, i64* %4
%9 = load i64, i64* %5
%10 = load i32, i32* %6
%11 = call i64 asm sideeffect "leaq 1f(%rip), %r11\0A\09movq %r11, %fs:0x20\0A\09jmpq *%gs:0x10000+0x8\0A\091:\0A\09", "={ax},{di},{si},{dx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %8, i64 %9, i32 %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
ret i64 %12
}

LLVM IR (-O2):
define i64 @trampoline_mprotect(i64 %0, i64 %1, i32 %2) {
%4 = tail call i64 asm sideeffect "leaq 1f(%rip), %r11\0A\09movq %r11, %fs:0x20\0A\09jmpq *%gs:0x10000+0x8\0A\091:\0A\09", "={ax},{di},{si},{dx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1, i32 %2)
ret i64 %4
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int embed_dobldobl_system(int d) {
  int fail;
  int *b;
  double *c;
  fail = _ada_use_c2phc4c(129, &d, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<embed_dobldobl_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x81,%edi
lea    -0x4(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<embed_dobldobl_system>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x81,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @embed_dobldobl_system(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca double*
store i32 %0, i32* %2
%6 = load i32*, i32** %4
%7 = load double*, double** %5
%8 = call i32 @_ada_use_c2phc4c(i32 129, i32* %2, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @embed_dobldobl_system(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc4c(i32 129, i32* %2, i32* undef, double* undef, i32 0)
ret i32 %3
}
imm0adrx1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if (22 <= (((unsigned short *)11111111)[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<imm0adrx1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movslq -0x10(%rbp),%rcx
mov    $0xa98ac7,%eax
movzwl (%rax,%rcx,2),%ecx
mov    $0x16,%eax
cmp    %ecx,%eax
jg     1145 <imm0adrx1+0x45>
movl   $0x1,-0x4(%rbp)
jmp    114c <imm0adrx1+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imm0adrx1>:
movslq %ecx,%rcx
xor    %eax,%eax
cmpw   $0x16,0xa98ac7(%rcx,%rcx,1)
setae  %al
ret

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

LLVM IR (-O2):
define i32 @imm0adrx1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture readnone %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i16, i16* inttoptr (i64 11111111 to i16*), i64 %7
%9 = load i16, i16* %8
%10 = icmp ugt i16 %9, 21
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello!\n");
  return EXIT_SUCCESS;
}


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>
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [7 x i8] c"Hello!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
/* Variables and functions */
size_t strlen(const char *s) {
  size_t n;
  for (n = 0; s[n] != '\0'; ++n) {
  }
  return n;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     113b <strlen+0x3b>
jmp    112a <strlen+0x2a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ print(int *, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int *arr;
  arr = (int *)malloc(n * sizeof(int));
  print(arr, 0, 0, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%ecx
xor    %edx,%edx
mov    %edx,%esi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
mov    0x4(%rsp),%ecx
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <print@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%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 = shl i32 %4, 2
%6 = call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i32*
%8 = load i32, i32* %1
%9 = call i32 @print(i32* %7, i32 0, i32 0, i32 %8)
ret i32 0
}
/* Variables and functions */
long syscall(int, char *, char *);
long cow_copy(char *src, char *dest) { return syscall(378, src, dest); }


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

x86 assembly (clang, -O2):
<cow_copy>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x17a,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i64 @cow_copy(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 i64 @syscall(i32 378, i8* %5, i8* %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @cow_copy(i8* %0, i8* %1) {
%3 = tail call i64 @syscall(i32 378, i8* %0, i8* %1)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (argc)
    exit(0);
  printf(argv[3]);
  exit(EXIT_FAILURE);
}


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   $0x0,-0x8(%rbp)
je     1147 <main+0x27>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <printf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
test   %edi,%edi
jne    113c <main+0x1c>
mov    0x18(%rsi),%rdi
call   1030 <printf@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
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, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @exit(i32 0)
unreachable
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 3
%13 = load i8*, i8** %12
%14 = call i32 @printf(i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 3
%8 = load i8*, i8** %7
%9 = tail call i32 @printf(i8* dereferenceable(1) %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
}
/* Variables and functions */
int throw_dice();
int cont_craps(int sum_dice) {
  int new_dice;
  for (;;) {
    new_dice = throw_dice();
    if (new_dice == sum_dice)
      return 1;
    if (new_dice == 7)
      return 0;
  }
}


x86 assembly (clang, -O0):
<cont_craps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <throw_dice@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    113d <cont_craps+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    1158 <cont_craps+0x48>
cmpl   $0x7,-0xc(%rbp)
jne    1153 <cont_craps+0x43>
movl   $0x0,-0x4(%rbp)
jmp    1158 <cont_craps+0x48>
jmp    111b <cont_craps+0xb>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cont_craps>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <throw_dice@plt>
cmp    %ebx,%eax
je     1134 <cont_craps+0x24>
cmp    $0x7,%eax
jne    1120 <cont_craps+0x10>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cont_craps(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
br label %5
5: ; preds = %15, %1
%6 = call i32 (...) @throw_dice()
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %5
store i32 1, i32* %2
br label %16
11: ; preds = %5
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 7
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 0, i32* %2
br label %16
15: ; preds = %11
br label %5
16: ; preds = %14, %10
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @cont_craps(i32 %0) {
br label %2
2: ; preds = %5, %1
%3 = tail call i32 (...) @throw_dice()
%4 = icmp eq i32 %3, %0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = icmp eq i32 %3, 7
br i1 %6, label %7, label %2
7: ; preds = %5, %2
%8 = phi i32 [ 1, %2 ], [ 0, %5 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ write(int /*<<< orphan*/, void **, int);
void __cyg_profile_func_enter(void *this_fn, void *call_site) {
  write(STDOUT_FILENO, &this_fn, sizeof this_fn);
}


x86 assembly (clang, -O0):
<__cyg_profile_func_enter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__cyg_profile_func_enter>:
push   %rax
mov    %rdi,(%rsp)
mov    0x2ed4(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
define void @__cyg_profile_func_enter(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @STDOUT_FILENO
%6 = call i32 @write(i32 %5, i8** %3, i32 8)
ret void
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
define void @__cyg_profile_func_enter(i8* %0, i8* nocapture readnone %1) {
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i32, i32* @STDOUT_FILENO
%5 = call i32 @write(i32 %4, i8** %3, i32 8)
ret void
}
/* Variables and functions */
char *malloc(unsigned int);
int /*<<< orphan*/ w_abort(char *, char *);
char *ckalloc(size_t amount) {
  char *p;
  if ((p = malloc((unsigned)amount)) == NULL)
    w_abort("Ran out of memory.", "");
  return (p);
}


x86 assembly (clang, -O0):
<ckalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1158 <ckalloc+0x38>
lea    0xeb4(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1040 <w_abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ckalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1141 <ckalloc+0x21>
lea    0xecb(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1040 <w_abort@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Ran out of memory.\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @ckalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = trunc i64 %4 to i32
%6 = call i8* @malloc(i32 %5)
store i8* %6, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @w_abort(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [19 x i8] c"Ran out of memory.\00"
@.str.1 = [1 x i8] zeroinitializer
define noalias i8* @ckalloc(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i8* @malloc(i32 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @w_abort(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret i8* %3
}
/* Variables and functions */
scalar_t__ malloc(int);
int *new_ivec(int n) {
  int *p = (int *)malloc(sizeof(int) * n);
  return p;
}


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

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

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

LLVM IR (-O2):
define i32* @new_ivec(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i32*
ret i32* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
int crc16(int, int /*<<< orphan*/ const *, size_t);
int read_16b(int /*<<< orphan*/ const *);
bool checkCRC(const uint8_t *buf, size_t size) {
  const uint16_t crc_from_packet = read_16b(buf + size - 2);
  uint16_t crc_calc = 0xffff;
  crc_calc = crc16(crc_calc, buf, size - 2);
  crc_calc ^= 0xffff;
  return crc_from_packet == crc_calc;
}


x86 assembly (clang, -O0):
<checkCRC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <read_16b@plt>
mov    %eax,-0x14(%rbp)
movl   $0xffff,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
sub    $0x2,%rdx
call   1040 <crc16@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
xor    $0xffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkCRC>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
lea    (%rdi,%rsi,4),%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <read_16b@plt>
mov    %eax,%ebp
add    $0xfffffffffffffffe,%rbx
mov    $0xffff,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <crc16@plt>
xor    $0xffff,%eax
xor    %ecx,%ecx
cmp    %eax,%ebp
sete   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @checkCRC(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i64 %1, i64* %4
%7 = load i32*, i32** %3
%8 = load i64, i64* %4
%9 = getelementptr inbounds i32, i32* %7, i64 %8
%10 = getelementptr inbounds i32, i32* %9, i64 -2
%11 = call i32 @read_16b(i32* %10)
store i32 %11, i32* %5
store i32 65535, i32* %6
%12 = load i32, i32* %6
%13 = load i32*, i32** %3
%14 = load i64, i64* %4
%15 = sub i64 %14, 2
%16 = call i32 @crc16(i32 %12, i32* %13, i64 %15)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = xor i32 %17, 65535
store i32 %18, i32* %6
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = icmp eq i32 %19, %20
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @checkCRC(i32* %0, i64 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 %1
%4 = getelementptr inbounds i32, i32* %3, i64 -2
%5 = tail call i32 @read_16b(i32* %4)
%6 = add i64 %1, -2
%7 = tail call i32 @crc16(i32 65535, i32* %0, i64 %6)
%8 = xor i32 %7, 65535
%9 = icmp eq i32 %5, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Type definitions */
typedef double time_t;
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
void double_to_timeval(const double val, struct timeval *tv) {
  tv->tv_sec = val;
  tv->tv_usec = (val - (time_t)val) * 1000000.0;
}


x86 assembly (clang, -O0):
<double_to_timeval>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xed4(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_to_timeval>:
movsd  %xmm0,(%rdi)
subsd  %xmm0,%xmm0
mulsd  0xef0(%rip),%xmm0
movsd  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define void @double_to_timeval(double %0, %struct.timeval* %1) {
%3 = alloca double
%4 = alloca %struct.timeval*
store double %0, double* %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load double, double* %3
%6 = load %struct.timeval*, %struct.timeval** %4
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
store double %5, double* %7
%8 = load double, double* %3
%9 = load double, double* %3
%10 = fsub double %8, %9
%11 = fmul double %10, 1.000000e+06
%12 = load %struct.timeval*, %struct.timeval** %4
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
store double %11, double* %13
ret void
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define void @double_to_timeval(double %0, %struct.timeval* nocapture writeonly %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
store double %0, double* %3
%4 = fsub double %0, %0
%5 = fmul double %4, 1.000000e+06
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
store double %5, double* %6
ret void
}
float tophatBurn(float radius, float *params) {
  char where;
  float chop;
  chop = params[0];
  where = params[1] > 0;
  if (where) {
    if (radius < chop)
      return 0.0;
    else
      return 1.0;
  } else {
    if (radius > chop)
      return 0.0;
    else
      return 1.0;
  }
}


x86 assembly (clang, -O0):
<tophatBurn>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x11(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     1170 <tophatBurn+0x70>
movss  -0x8(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    115e <tophatBurn+0x5e>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1199 <tophatBurn+0x99>
movss  0xe9a(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1199 <tophatBurn+0x99>
movss  -0x8(%rbp),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    118c <tophatBurn+0x8c>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1199 <tophatBurn+0x99>
movss  0xe6c(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tophatBurn>:
movss  (%rdi),%xmm1
movaps %xmm0,%xmm2
cmpltss %xmm1,%xmm2
movss  0xeec(%rip),%xmm3
andnps %xmm3,%xmm2
cmpltss %xmm0,%xmm1
xorps  %xmm0,%xmm0
cmpltss 0x4(%rdi),%xmm0
andnps %xmm3,%xmm1
andps  %xmm0,%xmm2
andnps %xmm1,%xmm0
orps   %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @tophatBurn(float %0, float* %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float*
%6 = alloca i8
%7 = alloca float
store float %0, float* %4
store float* %1, float** %5
%8 = load float*, float** %5
%9 = getelementptr inbounds float, float* %8, i64 0
%10 = load float, float* %9
store float %10, float* %7
%11 = load float*, float** %5
%12 = getelementptr inbounds float, float* %11, i64 1
%13 = load float, float* %12
%14 = fcmp ogt float %13, 0.000000e+00
%15 = zext i1 %14 to i32
%16 = trunc i32 %15 to i8
store i8 %16, i8* %6
%17 = load i8, i8* %6
%18 = icmp ne i8 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load float, float* %4
%21 = load float, float* %7
%22 = fcmp olt float %20, %21
br i1 %22, label %23, label %24
23: ; preds = %19
store float 0.000000e+00, float* %3
br label %31
24: ; preds = %19
store float 1.000000e+00, float* %3
br label %31
25: ; preds = %2
%26 = load float, float* %4
%27 = load float, float* %7
%28 = fcmp ogt float %26, %27
br i1 %28, label %29, label %30
29: ; preds = %25
store float 0.000000e+00, float* %3
br label %31
30: ; preds = %25
store float 1.000000e+00, float* %3
br label %31
31: ; preds = %30, %29, %24, %23
%32 = load float, float* %3
ret float %32
}

LLVM IR (-O2):
define float @tophatBurn(float %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = getelementptr inbounds float, float* %1, i64 1
%5 = load float, float* %4
%6 = fcmp ogt float %5, 0.000000e+00
%7 = fcmp ogt float %3, %0
%8 = select i1 %7, float 0.000000e+00, float 1.000000e+00
%9 = fcmp olt float %3, %0
%10 = select i1 %9, float 0.000000e+00, float 1.000000e+00
%11 = select i1 %6, float %8, float %10
ret float %11
}
void EC_GROUP_clear_free(void) {}


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

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

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

LLVM IR (-O2):
define void @EC_GROUP_clear_free() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
__attribute__((no)) void burn(void *s, size_t n) {
  uint8_t *p = (uint8_t *)s;
  uint8_t *end = p + n;
  while (p < end)
    *p++ = 0;
}


x86 assembly (clang, -O0):
<burn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    114f <burn+0x4f>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movl   $0x0,(%rax)
jmp    1127 <burn+0x27>
pop    %rbp
ret

x86 assembly (clang, -O2):
<burn>:
lea    (%rdi,%rsi,4),%rax
cmp    %rdi,%rax
jbe    1142 <burn+0x32>
push   %rax
lea    0x4(%rdi),%rcx
cmp    %rcx,%rax
cmova  %rax,%rcx
mov    %rdi,%rax
not    %rax
lea    (%rcx,%rax,1),%rdx
add    $0x4,%rdx
and    $0xfffffffffffffffc,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @burn(i8* writeonly %0, i64 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = bitcast i8* %0 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 %1
%6 = icmp ugt i32* %5, %4
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = shl i64 %1, 2
%9 = add i64 %8, %3
%10 = add i64 %3, 4
%11 = call i64 @llvm.umax.i64(i64 %9, i64 %10)
%12 = xor i64 %3, -1
%13 = add i64 %11, %12
%14 = add i64 %13, 4
%15 = and i64 %14, -4
br label %16
16: ; preds = %7, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
char *malloc(int);
char *safealloc(int n) {
  char *x;
  if (n > 0)
    x = malloc(n);
  else
    x = malloc(10);
  if (!x)
    return x;
  else
    exit(1);
}


x86 assembly (clang, -O0):
<safealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1146 <safealloc+0x26>
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
jmp    1154 <safealloc+0x34>
mov    $0xa,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1169 <safealloc+0x49>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<safealloc>:
push   %rax
test   %edi,%edi
jg     112a <safealloc+0xa>
mov    $0xa,%edi
call   1030 <malloc@plt>
test   %rax,%rax
jne    1138 <safealloc+0x18>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i8* @safealloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i8* @malloc(i32 %7)
store i8* %8, i8** %3
br label %11
9: ; preds = %1
%10 = call i8* @malloc(i32 10)
store i8* %10, i8** %3
br label %11
11: ; preds = %9, %6
%12 = load i8*, i8** %3
%13 = icmp ne i8* %12, null
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = load i8*, i8** %3
ret i8* %15
16: ; preds = %11
%17 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define noalias i8* @safealloc(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i8* @malloc(i32 %0)
br label %7
5: ; preds = %1
%6 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
br label %7
7: ; preds = %5, %3
%8 = phi i8* [ %4, %3 ], [ %6, %5 ]
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %7
ret i8* null
11: ; preds = %7
%12 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int);
void mergeSort(int *vetor, int tam) {
  if (tam < 2)
    return;
  int metade = tam / 2;
  mergeSort(vetor, metade);
  mergeSort(vetor + metade, tam - metade);
  merge(vetor, tam, metade);
}


x86 assembly (clang, -O0):
<mergeSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    113e <mergeSort+0x1e>
jmp    1181 <mergeSort+0x61>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <merge@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSort>:
cmp    $0x1,%esi
jg     1126 <mergeSort+0x6>
ret
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
mov    %ebx,%esi
call   1030 <mergeSort@plt>
lea    (%r14,%rbx,4),%rdi
mov    %ebp,%esi
sub    %ebx,%esi
call   1030 <mergeSort@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <merge@plt>

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

LLVM IR (-O2):
define void @mergeSort(i32* %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %4, label %5
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = lshr i32 %1, 1
tail call void @mergeSort(i32* %0, i32 %6)
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = sub nsw i32 %1, %6
tail call void @mergeSort(i32* %8, i32 %9)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %6)
br label %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ generate_c_file(char *, char *, char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc < 4) {
    printf("too few arguments\n");
    exit(1);
  }
  generate_c_file(argv[1], argv[2], argv[3]);
  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   $0x4,-0x8(%rbp)
jge    1166 <main+0x36>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
call   1040 <generate_c_file@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x3,%edi
jle    114e <main+0x1e>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rax
mov    0x18(%rsi),%rdx
mov    %rax,%rsi
call   1040 <generate_c_file@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"too few arguments\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 slt i32 %6, 4
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 3
%20 = load i8*, i8** %19
%21 = call i32 @generate_c_file(i8* %14, i8* %17, i8* %20)
ret i32 0
}

LLVM IR (-O2):
@str = [18 x i8] c"too few arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = tail call i32 @generate_c_file(i8* %9, i8* %11, i8* %13)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ vwarnc(int /*<<< orphan*/, char const *, int /*<<< orphan*/);
void vwarn(const char *fmt, va_list ap) { vwarnc(errno, fmt, ap); }


x86 assembly (clang, -O0):
<vwarn>:
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),%rsi
mov    -0xc(%rbp),%edx
call   1030 <vwarnc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vwarn>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <vwarnc@plt>

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

LLVM IR (-O2):
@errno = global i32 0
define void @vwarn(i8* %0, i32 %1) {
%3 = load i32, i32* @errno
%4 = tail call i32 @vwarnc(i32 %3, i8* %0, i32 %1)
ret void
}
void is_uppercase(char c) {
  switch (c) {
  case 'A' ... 'Z':
    printf("'%c' is upper case\n", c);
    break;
  default:
    printf("'%c' is not upper case\n", c);
  }
}


x86 assembly (clang, -O0):
<is_uppercase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffbf,%eax
sub    $0x19,%eax
ja     114a <is_uppercase+0x3a>
jmp    1133 <is_uppercase+0x23>
movsbl -0x1(%rbp),%esi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115c <is_uppercase+0x4c>
movsbl -0x1(%rbp),%esi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_uppercase>:
mov    %edi,%esi
lea    -0x41(%rsi),%eax
cmp    $0x1a,%eax
lea    0xee1(%rip),%rax
lea    0xeee(%rip),%rdi
cmovb  %rax,%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"'%c' is upper case\0A\00"
@.str.1 = [24 x i8] c"'%c' is not upper case\0A\00"
define void @is_uppercase(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
switch i32 %4, label %9 [
i32 65, label %5
i32 66, label %5
i32 67, label %5
i32 68, label %5
i32 69, label %5
i32 70, label %5
i32 71, label %5
i32 72, label %5
i32 73, label %5
i32 74, label %5
i32 75, label %5
i32 76, label %5
i32 77, label %5
i32 78, label %5
i32 79, label %5
i32 80, label %5
i32 81, label %5
i32 82, label %5
i32 83, label %5
i32 84, label %5
i32 85, label %5
i32 86, label %5
i32 87, label %5
i32 88, label %5
i32 89, label %5
i32 90, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %13
9: ; preds = %1
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %5
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"'%c' is upper case\0A\00"
@.str.1 = [24 x i8] c"'%c' is not upper case\0A\00"
define void @is_uppercase(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = select i1 %4, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %5, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
char *dirname(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ rmdir(char *);
int /*<<< orphan*/ strdup(char const *);
int /*<<< orphan*/ unlink(char const *);
void unix_remove_unix_socket(const char path[], int sock_in) {
  char *dir;
  dir = dirname(strdup(path));
  close(sock_in);
  unlink(path);
  rmdir(dir);
  free(dir);
}


x86 assembly (clang, -O0):
<unix_remove_unix_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <strdup@plt>
mov    %eax,%edi
call   1060 <dirname@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
mov    -0x8(%rbp),%rdi
call   1040 <unlink@plt>
mov    -0x18(%rbp),%rdi
call   1050 <rmdir@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unix_remove_unix_socket>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1080 <strdup@plt>
mov    %eax,%edi
call   1060 <dirname@plt>
mov    %rax,%rbp
mov    %r14d,%edi
call   1070 <close@plt>
mov    %rbx,%rdi
call   1040 <unlink@plt>
mov    %rbp,%rdi
call   1050 <rmdir@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @unix_remove_unix_socket(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @strdup(i8* %6)
%8 = call i8* @dirname(i32 %7)
store i8* %8, i8** %5
%9 = load i32, i32* %4
%10 = call i32 @close(i32 %9)
%11 = load i8*, i8** %3
%12 = call i32 @unlink(i8* %11)
%13 = load i8*, i8** %5
%14 = call i32 @rmdir(i8* %13)
%15 = load i8*, i8** %5
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
define void @unix_remove_unix_socket(i8* %0, i32 %1) {
%3 = tail call i32 @strdup(i8* %0)
%4 = tail call i8* @dirname(i32 %3)
%5 = tail call i32 @close(i32 %1)
%6 = tail call i32 @unlink(i8* %0)
%7 = tail call i32 @rmdir(i8* %4)
%8 = tail call i32 @free(i8* %4)
ret void
}
void idct(block) short *block;
{ idct_M128ASM_scalar(block); }


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

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

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

LLVM IR (-O2):
define void @idct(i16* %0) {
%2 = tail call i32 (i16*, ...) bitcast (i32 (...)* @idct_M128ASM_scalar to i32 (i16*, ...)*)(i16* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __xalloc_failed(char const *, int, scalar_t__);
void *strdup(char const *);
scalar_t__ strlen(char const *);
void *__xstrdup(const char *_file, int _line, const char *s) {
  void *p = strdup(s);
  if (!p)
    __xalloc_failed(_file, _line, (strlen(s) + 1));
  return p;
  ;
}


x86 assembly (clang, -O0):
<__xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1185 <__xstrdup+0x55>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <__xalloc_failed@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__xstrdup>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbp
mov    %esi,%r14d
mov    %rdi,%r15
mov    %rdx,%rdi
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1167 <__xstrdup+0x37>
mov    %rbp,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %r14d,%esi
call   1050 <__xalloc_failed@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define noalias i8* @__xstrdup(i8* %0, i32 %1, i8* nocapture %2) {
%4 = tail call i8* @strdup(i8* %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%8 = add nsw i64 %7, 1
%9 = tail call i32 @__xalloc_failed(i8* %0, i32 %1, i64 %8)
br label %10
10: ; preds = %6, %3
ret i8* %4
}
int to_code1_glo(unsigned char code) {
  switch (code) {
  case 1:
    return 0;
  case 2:
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<to_code1_glo>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1130 <to_code1_glo+0x30>
jmp    111f <to_code1_glo+0x1f>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     113c <to_code1_glo+0x3c>
jmp    1148 <to_code1_glo+0x48>
movl   $0x0,-0x4(%rbp)
jmp    114f <to_code1_glo+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    114f <to_code1_glo+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_code1_glo>:
xor    %eax,%eax
cmp    $0x2,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @to_code1_glo(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
switch i32 %5, label %8 [
i32 1, label %6
i32 2, label %7
]
6: ; preds = %1
store i32 0, i32* %2
br label %9
7: ; preds = %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7, %6
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @to_code1_glo(i8 zeroext %0) {
%2 = icmp eq i8 %0, 2
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void pifacedigital_close(uint8_t hw_addr) { return; }


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

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

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

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