#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*/ printArray(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quickSort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, k, t;
  int n, a[100000];
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    scanf("%d", &n);
    for (j = 0; j < n; j++) {
      scanf("%d", &a[j]);
    }
    quickSort(a, 0, n - 1);
    printf("Sorted array: \n");
    printArray(a, n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61aa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1201 <main+0xc1>
lea    0xe84(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11c4 <main+0x84>
movslq -0xc(%rbp),%rax
lea    -0x61aa0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe4f(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118c <main+0x4c>
lea    -0x61aa0(%rbp),%rdi
mov    -0x18(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1050 <quickSort@plt>
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
lea    -0x61aa0(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1060 <printArray@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <main+0x29>
xor    %eax,%eax
add    $0x61aa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x61a98,%rsp
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11ff <main+0xbf>
mov    $0x1,%ebp
lea    0xe87(%rip),%r13
lea    0x10(%rsp),%r15
lea    0xe7e(%rip),%r12
jmp    11bc <main+0x7c>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <quickSort@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%esi
mov    %r15,%rdi
call   1060 <printArray@plt>
lea    0x1(%rbp),%eax
cmp    0xc(%rsp),%ebp
mov    %eax,%ebp
jge    11ff <main+0xbf>
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%edx
test   %edx,%edx
jle    1190 <main+0x50>
mov    %r15,%rbx
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0x1,%r14
movslq 0x8(%rsp),%rdx
add    $0x4,%rbx
cmp    %rdx,%r14
jl     11e0 <main+0xa0>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x61a98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [15 x i8] c"Sorted array: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100000 x i32]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [100000 x i32]* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 1
br i1 %9, label %35, label %10
10: ; preds = %0
%11 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 0
br label %12
12: ; preds = %10, %25
%13 = phi i32 [ 1, %10 ], [ %32, %25 ]
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %12, %17
%18 = phi i64 [ %21, %17 ], [ 0, %12 ]
%19 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, 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* %2
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %17, label %25
25: ; preds = %17, %12
%26 = phi i32 [ %15, %12 ], [ %22, %17 ]
%27 = add nsw i32 %26, -1
%28 = call i32 @quickSort(i32* %11, i32 0, i32 %27)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%30 = load i32, i32* %2
%31 = call i32 @printArray(i32* %11, i32 %30)
%32 = add nuw nsw i32 %13, 1
%33 = load i32, i32* %1
%34 = icmp slt i32 %13, %33
br i1 %34, label %12, label %35
35: ; preds = %25, %0
ret i32 0
}