#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 *mergeSort(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int a[] = {79, 1,  77, 74, 62, 8,  14, 54, 92, 42, 16, 82, 56, 34, 91, 11, 6,
             83, 19, 98, 26, 37, 69, 31, 2,  39, 27, 67, 72, 5,  9,  55, 61, 20,
             63, 94, 78, 71, 48, 80, 22, 58, 45, 4,  97, 23, 15, 3,  99, 60, 95,
             12, 30, 10, 47, 18, 13, 50, 29, 64, 40, 51, 96, 46, 0,  36, 85, 17,
             59, 33, 68, 86, 88, 32, 7,  35, 52, 70, 57, 87, 93, 66, 89, 76, 21,
             90, 65, 24, 44, 81, 53, 43, 28, 73, 38, 49, 25, 41, 75, 84};
  int *res;
  int i;
  for (i = 0; i < 10000; ++i) {
    res = mergeSort(a, 100);
  }
  for (i = 0; i < 100; ++i) {
    printf("%d ", res[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x190,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x1ac(%rbp)
cmpl   $0x2710,-0x1ac(%rbp)
jge    11a0 <main+0x70>
lea    -0x1a0(%rbp),%rdi
mov    $0x64,%esi
call   1050 <mergeSort@plt>
mov    %rax,-0x1a8(%rbp)
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    1164 <main+0x34>
movl   $0x0,-0x1ac(%rbp)
cmpl   $0x64,-0x1ac(%rbp)
jge    11ea <main+0xba>
mov    -0x1a8(%rbp),%rax
movslq -0x1ac(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xfc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    11aa <main+0x7a>
lea    0xfa3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x190,%rsp
lea    0xead(%rip),%rsi
mov    %rsp,%r14
mov    $0x190,%edx
mov    %r14,%rdi
call   1050 <memcpy@plt>
mov    $0x2710,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x64,%esi
call   1060 <mergeSort@plt>
add    $0xffffffff,%ebx
jne    1170 <main+0x30>
mov    %rax,%r15
lea    0x1004(%rip),%r14
xor    %ebx,%ebx
xchg   %ax,%ax
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    1190 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.a = [100 x i32] [i32 79, i32 1, i32 77, i32 74, i32 62, i32 8, i32 14, i32 54, i32 92, i32 42, i32 16, i32 82, i32 56, i32 34, i32 91, i32 11, i32 6, i32 83, i32 19, i32 98, i32 26, i32 37, i32 69, i32 31, i32 2, i32 39, i32 27, i32 67, i32 72, i32 5, i32 9, i32 55, i32 61, i32 20, i32 63, i32 94, i32 78, i32 71, i32 48, i32 80, i32 22, i32 58, i32 45, i32 4, i32 97, i32 23, i32 15, i32 3, i32 99, i32 60, i32 95, i32 12, i32 30, i32 10, i32 47, i32 18, i32 13, i32 50, i32 29, i32 64, i32 40, i32 51, i32 96, i32 46, i32 0, i32 36, i32 85, i32 17, i32 59, i32 33, i32 68, i32 86, i32 88, i32 32, i32 7, i32 35, i32 52, i32 70, i32 57, i32 87, i32 93, i32 66, i32 89, i32 76, i32 21, i32 90, i32 65, i32 24, i32 44, i32 81, i32 53, i32 43, i32 28, i32 73, i32 38, i32 49, i32 25, i32 41, i32 75, i32 84]
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [100 x i32]* %2 to i8*
store i32 0, i32* %4
br label %6
6: ; preds = %12, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 10000
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%11 = call i32* @mergeSort(i32* %10, i32 100)
store i32* %11, i32** %3
br label %12
12: ; preds = %9
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
br label %6
15: ; preds = %6
store i32 0, i32* %4
br label %16
16: ; preds = %26, %15
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 100
br i1 %18, label %19, label %29
19: ; preds = %16
%20 = load i32*, i32** %3
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %19
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %16
29: ; preds = %16
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@__const.main.a = [100 x i32] [i32 79, i32 1, i32 77, i32 74, i32 62, i32 8, i32 14, i32 54, i32 92, i32 42, i32 16, i32 82, i32 56, i32 34, i32 91, i32 11, i32 6, i32 83, i32 19, i32 98, i32 26, i32 37, i32 69, i32 31, i32 2, i32 39, i32 27, i32 67, i32 72, i32 5, i32 9, i32 55, i32 61, i32 20, i32 63, i32 94, i32 78, i32 71, i32 48, i32 80, i32 22, i32 58, i32 45, i32 4, i32 97, i32 23, i32 15, i32 3, i32 99, i32 60, i32 95, i32 12, i32 30, i32 10, i32 47, i32 18, i32 13, i32 50, i32 29, i32 64, i32 40, i32 51, i32 96, i32 46, i32 0, i32 36, i32 85, i32 17, i32 59, i32 33, i32 68, i32 86, i32 88, i32 32, i32 7, i32 35, i32 52, i32 70, i32 57, i32 87, i32 93, i32 66, i32 89, i32 76, i32 21, i32 90, i32 65, i32 24, i32 44, i32 81, i32 53, i32 43, i32 28, i32 73, i32 38, i32 49, i32 25, i32 41, i32 75, i32 84]
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
br label %4
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %7, %4 ]
%6 = call i32* @mergeSort(i32* %3, i32 100)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, 10000
br i1 %8, label %9, label %4
9: ; preds = %4, %9
%10 = phi i64 [ %14, %9 ], [ 0, %4 ]
%11 = getelementptr inbounds i32, i32* %6, i64 %10
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, 100
br i1 %15, label %16, label %9
16: ; preds = %9
%17 = call i32 @putchar(i32 10)
ret i32 0
}