#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*/ MergeSort(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int n, i, a[1024];
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    scanf("%d", &a[i]);
  MergeSort(a, n);
  printf("%s:\n", argv[0]);
  for (i = 0; i < n; i++)
    printf("\t%d", a[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb6(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1198 <main+0x68>
movslq -0x18(%rbp),%rax
lea    -0x1020(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe81(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1160 <main+0x30>
lea    -0x1020(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <MergeSort@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f6 <main+0xc6>
movslq -0x18(%rbp),%rax
mov    -0x1020(%rbp,%rax,4),%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c3 <main+0x93>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1018,%rsp
mov    %rsi,%r14
lea    0xeae(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    119d <main+0x5d>
lea    0x10(%rsp),%r12
xor    %ebx,%ebx
lea    0xe8e(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rsi
add    $0x4,%r12
cmp    %rsi,%rbx
jl     1180 <main+0x40>
lea    0x10(%rsp),%rdi
call   1060 <MergeSort@plt>
mov    (%r14),%rsi
lea    0xe4f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11ec <main+0xac>
lea    0xe3f(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11d0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x1018,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%s:\0A\00"
@.str.2 = [4 x i8] c"\09%d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [1024 x i32]
%5 = bitcast i32* %3 to i8*
%6 = bitcast [1024 x i32]* %4 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %2, %10
%11 = phi i64 [ %14, %10 ], [ 0, %2 ]
%12 = getelementptr inbounds [1024 x i32], [1024 x i32]* %4, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %10, label %18
18: ; preds = %10, %2
%19 = phi i32 [ %8, %2 ], [ %15, %10 ]
%20 = getelementptr inbounds [1024 x i32], [1024 x i32]* %4, i64 0, i64 0
%21 = call i32 @MergeSort(i32* %20, i32 %19)
%22 = load i8*, i8** %1
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = load i32, i32* %3
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %35
26: ; preds = %18, %26
%27 = phi i64 [ %31, %26 ], [ 0, %18 ]
%28 = getelementptr inbounds [1024 x i32], [1024 x i32]* %4, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = add nuw nsw i64 %27, 1
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = icmp slt i64 %31, %33
br i1 %34, label %26, label %35
35: ; preds = %26, %18
%36 = call i32 @putchar(i32 10)
ret i32 0
}