#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*/);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int arr[200004];
  int t, n, i;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      scanf("%d", &arr[i]);
    }
    printf("%lld\n", mergeSort(arr, n));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc3530,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0xc3524(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc3524(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc3524(%rbp)
cmp    $0x0,%eax
je     11f8 <main+0xc8>
lea    0xe8a(%rip),%rdi
lea    -0xc3528(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0xc352c(%rbp)
mov    -0xc352c(%rbp),%eax
cmp    -0xc3528(%rbp),%eax
jge    11d3 <main+0xa3>
movslq -0xc352c(%rbp),%rax
lea    -0xc3520(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe46(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xc352c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc352c(%rbp)
jmp    118c <main+0x5c>
lea    -0xc3520(%rbp),%rdi
mov    -0xc3528(%rbp),%esi
call   1040 <mergeSort@plt>
mov    %eax,%esi
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
jmp    1155 <main+0x25>
xor    %eax,%eax
add    $0xc3530,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc3528,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    116d <main+0x3d>
xor    %eax,%eax
add    $0xc3528,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe8c(%rip),%r13
lea    0x8(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0xe7e(%rip),%r12
jmp    11a9 <main+0x79>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <mergeSort@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
subl   $0x1,0xc(%rsp)
jb     1159 <main+0x29>
mov    %r13,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%esi
test   %esi,%esi
jle    1190 <main+0x60>
mov    %r15,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbp
movslq 0x8(%rsp),%rsi
add    $0x4,%rbx
cmp    %rsi,%rbp
jl     11d0 <main+0xa0>
jmp    1190 <main+0x60>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [200004 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %7
7: ; preds = %25, %0
%8 = load i32, i32* %3
%9 = add nsw i32 %8, -1
store i32 %9, i32* %3
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %30
11: ; preds = %7
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
br label %13
13: ; preds = %22, %11
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %25
17: ; preds = %13
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [200004 x i32], [200004 x i32]* %2, i64 0, i64 %19
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %20)
br label %22
22: ; preds = %17
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %13
25: ; preds = %13
%26 = getelementptr inbounds [200004 x i32], [200004 x i32]* %2, i64 0, i64 0
%27 = load i32, i32* %4
%28 = call i32 @mergeSort(i32* %26, i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %7
30: ; preds = %7
ret i32 0
}

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