#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ merge(unsigned long long *, int *, int *,
                         unsigned long long *, int *, int *, int, int, int,
                         int);
void mergeSort(unsigned long long int *A, int *B, int *C,
               unsigned long long int *X, int *Y, int *Z, int left, int right,
               int N) {
  int mid = 0;
  if (left >= right)
    return;
  mid = (left + right) / 2;
  mergeSort(A, B, C, X, Y, Z, left, mid, N);
  mergeSort(A, B, C, X, Y, Z, mid + 1, right, N);
  merge(A, B, C, X, Y, Z, left, mid, right, N);
}


x86 assembly (clang, -O0):
<mergeSort>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x58,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    0x10(%rbp),%eax
cmp    0x18(%rbp),%eax
jl     1162 <mergeSort+0x42>
jmp    121d <mergeSort+0xfd>
mov    0x10(%rbp),%eax
add    0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    0x10(%rbp),%r11d
mov    -0x3c(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <mergeSort@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    -0x3c(%rbp),%r11d
add    $0x1,%r11d
mov    0x18(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <mergeSort@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    0x10(%rbp),%ebx
mov    -0x3c(%rbp),%r11d
mov    0x18(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1040 <merge@plt>
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x58(%rsp),%ebp
mov    0x50(%rsp),%eax
cmp    %ebp,%eax
jge    11e4 <mergeSort+0xc4>
mov    0x60(%rsp),%r11d
mov    %rax,%rbx
add    %ebp,%eax
mov    %eax,%r14d
shr    $0x1f,%r14d
add    %eax,%r14d
sar    %r14d
sub    $0x8,%rsp
mov    %r8,%r12
mov    %rdi,%r15
mov    %r9,0x18(%rsp)
push   %r11
push   %r14
push   %rbx
mov    %rcx,%rbx
mov    %rcx,0x28(%rsp)
mov    %rdx,%r13
mov    %rsi,%rbp
call   1030 <mergeSort@plt>
add    $0x20,%rsp
lea    0x1(%r14),%r10d
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %r12,%r8
mov    0x18(%rsp),%rbx
mov    %rbx,%r9
mov    0x68(%rsp),%eax
push   %rax
mov    0x68(%rsp),%eax
push   %rax
push   %r10
call   1030 <mergeSort@plt>
add    $0x20,%rsp
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    0x8(%rsp),%rcx
mov    %r12,%r8
mov    %rbx,%r9
mov    0x60(%rsp),%eax
push   %rax
mov    0x60(%rsp),%eax
push   %rax
push   %r14
mov    0x68(%rsp),%eax
push   %rax
call   1040 <merge@plt>
add    $0x38,%rsp
jmp    11e8 <mergeSort+0xc8>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @mergeSort(i64* %0, i32* %1, i32* %2, i64* %3, i32* %4, i32* %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca i64*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i64*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i64* %0, i64** %10
store i32* %1, i32** %11
store i32* %2, i32** %12
store i64* %3, i64** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
store i32 0, i32* %19
%20 = load i32, i32* %16
%21 = load i32, i32* %17
%22 = icmp sge i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %9
br label %59
24: ; preds = %9
%25 = load i32, i32* %16
%26 = load i32, i32* %17
%27 = add nsw i32 %25, %26
%28 = sdiv i32 %27, 2
store i32 %28, i32* %19
%29 = load i64*, i64** %10
%30 = load i32*, i32** %11
%31 = load i32*, i32** %12
%32 = load i64*, i64** %13
%33 = load i32*, i32** %14
%34 = load i32*, i32** %15
%35 = load i32, i32* %16
%36 = load i32, i32* %19
%37 = load i32, i32* %18
%38 = load i64*, i64** %10
%39 = load i32*, i32** %11
%40 = load i32*, i32** %12
%41 = load i64*, i64** %13
%42 = load i32*, i32** %14
%43 = load i32*, i32** %15
%44 = load i32, i32* %19
%45 = add nsw i32 %44, 1
%46 = load i32, i32* %17
%47 = load i32, i32* %18
%48 = load i64*, i64** %10
%49 = load i32*, i32** %11
%50 = load i32*, i32** %12
%51 = load i64*, i64** %13
%52 = load i32*, i32** %14
%53 = load i32*, i32** %15
%54 = load i32, i32* %16
%55 = load i32, i32* %19
%56 = load i32, i32* %17
%57 = load i32, i32* %18
%58 = call i32 @merge(i64* %48, i32* %49, i32* %50, i64* %51, i32* %52, i32* %53, i32 %54, i32 %55, i32 %56, i32 %57)
br label %59
59: ; preds = %24, %23
ret void
}

LLVM IR (-O2):
define void @mergeSort(i64* %0, i32* %1, i32* %2, i64* %3, i32* %4, i32* %5, i32 %6, i32 %7, i32 %8) {
%10 = icmp slt i32 %6, %7
br i1 %10, label %12, label %11
11: ; preds = %9, %12
ret void
12: ; preds = %9
%13 = add nsw i32 %7, %6
%14 = sdiv i32 %13, 2
tail call void @mergeSort(i64* %0, i32* %1, i32* %2, i64* %3, i32* %4, i32* %5, i32 %6, i32 %14, i32 %8)
%15 = add nsw i32 %14, 1
tail call void @mergeSort(i64* %0, i32* %1, i32* %2, i64* %3, i32* %4, i32* %5, i32 %15, i32 %7, i32 %8)
%16 = tail call i32 @merge(i64* %0, i32* %1, i32* %2, i64* %3, i32* %4, i32* %5, i32 %6, i32 %14, i32 %7, i32 %8)
br label %11
}