#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*/ free(unsigned long long *);
scalar_t__ malloc(unsigned long long);
int /*<<< orphan*/ mergesrt(unsigned long long *, int /*<<< orphan*/,
                            unsigned long long);
int /*<<< orphan*/ printf(char *, unsigned long long);
int /*<<< orphan*/ scanf(char *, unsigned long long *);
int main() {
  unsigned long long int RANGE = 0, i = 0;
  scanf("%llu", &RANGE);
  unsigned long long int *a, *a_temp;
  a = (unsigned long long int *)malloc(RANGE * sizeof(unsigned long long int));
  for (i = 0; i < RANGE; i++)
    scanf("%llu", a + i);
  mergesrt(a, 0, RANGE);
  for (i = 0; i < RANGE; i++)
    printf("%llu\n", *(a + i));
  free(a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11d2 <main+0x82>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe44(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1198 <main+0x48>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1070 <mergesrt@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1220 <main+0xd0>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdfb(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11e9 <main+0x99>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movq   $0x0,(%rsp)
lea    0xe99(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,%r15
cmpq   $0x0,(%rsp)
je     11be <main+0x6e>
xor    %r12d,%r12d
lea    0xe70(%rip),%r14
mov    %r15,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
add    $0x1,%r12
mov    (%rsp),%rdx
add    $0x8,%rbx
cmp    %rdx,%r12
jb     11a0 <main+0x50>
jmp    11c0 <main+0x70>
xor    %edx,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1070 <mergesrt@plt>
cmpq   $0x0,(%rsp)
je     11f6 <main+0xa6>
xor    %ebx,%ebx
lea    0xe2b(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    (%rsp),%rbx
jb     11e0 <main+0x90>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%llu\00"
@.str.1 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64*
%5 = alloca i64*
store i32 0, i32* %1
store i64 0, i64* %2
store i64 0, i64* %3
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%7 = load i64, i64* %2
%8 = mul i64 %7, 8
%9 = call i64 @malloc(i64 %8)
%10 = inttoptr i64 %9 to i64*
store i64* %10, i64** %4
store i64 0, i64* %3
br label %11
11: ; preds = %20, %0
%12 = load i64, i64* %3
%13 = load i64, i64* %2
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i64*, i64** %4
%17 = load i64, i64* %3
%18 = getelementptr inbounds i64, i64* %16, i64 %17
%19 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %18)
br label %20
20: ; preds = %15
%21 = load i64, i64* %3
%22 = add i64 %21, 1
store i64 %22, i64* %3
br label %11
23: ; preds = %11
%24 = load i64*, i64** %4
%25 = load i64, i64* %2
%26 = call i32 @mergesrt(i64* %24, i32 0, i64 %25)
store i64 0, i64* %3
br label %27
27: ; preds = %37, %23
%28 = load i64, i64* %3
%29 = load i64, i64* %2
%30 = icmp ult i64 %28, %29
br i1 %30, label %31, label %40
31: ; preds = %27
%32 = load i64*, i64** %4
%33 = load i64, i64* %3
%34 = getelementptr inbounds i64, i64* %32, i64 %33
%35 = load i64, i64* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %35)
br label %37
37: ; preds = %31
%38 = load i64, i64* %3
%39 = add i64 %38, 1
store i64 %39, i64* %3
br label %27
40: ; preds = %27
%41 = load i64*, i64** %4
%42 = call i32 @free(i64* %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%llu\00"
@.str.1 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = shl i64 %4, 3
%6 = call i64 @malloc(i64 %5)
%7 = inttoptr i64 %6 to i64*
%8 = load i64, i64* %1
%9 = icmp eq i64 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds i64, i64* %7, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %12)
%14 = add nuw i64 %11, 1
%15 = load i64, i64* %1
%16 = icmp ult i64 %14, %15
br i1 %16, label %10, label %17
17: ; preds = %10, %0
%18 = phi i64 [ 0, %0 ], [ %15, %10 ]
%19 = call i32 @mergesrt(i64* %7, i32 0, i64 %18)
%20 = load i64, i64* %1
%21 = icmp eq i64 %20, 0
br i1 %21, label %30, label %22
22: ; preds = %17, %22
%23 = phi i64 [ %27, %22 ], [ 0, %17 ]
%24 = getelementptr inbounds i64, i64* %7, i64 %23
%25 = load i64, i64* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %25)
%27 = add nuw i64 %23, 1
%28 = load i64, i64* %1
%29 = icmp ult i64 %27, %28
br i1 %29, label %22, label %30
30: ; preds = %22, %17
%31 = call i32 @free(i64* %7)
ret i32 0
}