#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 EXIT_SUCCESS;
int /*<<< orphan*/ bubble_sort(int, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int nc, n;
  scanf("%d", &nc);
  for (int i = 0; i < nc; i++) {
    scanf("%d", &n);
    int h[n];
    for (int j = 0; j < n; j++)
      scanf("%d", &h[j]);
    bubble_sort(n, h);
    for (int j = 0; j < n; j++)
      printf("%d ", h[j]);
    printf("\n");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1245 <main+0x115>
lea    0xe90(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11dc <main+0xac>
mov    -0x40(%rbp),%rsi
movslq -0x34(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe37(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11a7 <main+0x77>
mov    -0x40(%rbp),%rsi
mov    -0x18(%rbp),%edi
call   1050 <bubble_sort@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1222 <main+0xf2>
mov    -0x40(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11ef <main+0xbf>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115d <main+0x2d>
mov    0x2d94(%rip),%rax
mov    (%rax),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xea8(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x30(%rbp)
jle    1241 <main+0x101>
lea    0xe8e(%rip),%r12
lea    0xe8a(%rip),%r15
xor    %r14d,%r14d
jmp    119c <main+0x5c>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x40(%rbp),%rsp
add    $0x1,%r14d
cmp    -0x30(%rbp),%r14d
jge    1241 <main+0x101>
mov    %r12,%rdi
lea    -0x2c(%rbp),%rsi
call   1050 <scanf@plt>
mov    %rsp,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    -0x2c(%rbp),%edi
test   %edi,%edi
jle    1200 <main+0xc0>
mov    %r14d,-0x34(%rbp)
mov    %r13,%rbx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%r14
movslq -0x2c(%rbp),%rdi
add    $0x4,%rbx
cmp    %rdi,%r14
jl     11e0 <main+0xa0>
mov    -0x34(%rbp),%r14d
mov    %r13,%rsi
call   1060 <bubble_sort@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    1180 <main+0x40>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%r13,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jl     1220 <main+0xe0>
jmp    1180 <main+0x40>
mov    0x2d98(%rip),%rax
mov    (%rax),%eax
lea    -0x28(%rbp),%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 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 0, i32* %8
br label %14
14: ; preds = %55, %2
%15 = load i32, i32* %8
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %58
18: ; preds = %14
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%20 = load i32, i32* %7
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %9
%23 = alloca i32, i64 %21
store i64 %21, i64* %10
store i32 0, i32* %11
br label %24
24: ; preds = %33, %18
%25 = load i32, i32* %11
%26 = load i32, i32* %7
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %36
28: ; preds = %24
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %23, i64 %30
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %31)
br label %33
33: ; preds = %28
%34 = load i32, i32* %11
%35 = add nsw i32 %34, 1
store i32 %35, i32* %11
br label %24
36: ; preds = %24
%37 = load i32, i32* %7
%38 = call i32 @bubble_sort(i32 %37, i32* %23)
store i32 0, i32* %12
br label %39
39: ; preds = %49, %36
%40 = load i32, i32* %12
%41 = load i32, i32* %7
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %52
43: ; preds = %39
%44 = load i32, i32* %12
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %23, i64 %45
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %43
%50 = load i32, i32* %12
%51 = add nsw i32 %50, 1
store i32 %51, i32* %12
br label %39
52: ; preds = %39
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%54 = load i8*, i8** %9
br label %55
55: ; preds = %52
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
br label %14
58: ; preds = %14
%59 = load i32, i32* @EXIT_SUCCESS
ret i32 %59
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast 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 %12, label %10
10: ; preds = %34, %2
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
12: ; preds = %2, %34
%13 = phi i32 [ %36, %34 ], [ 0, %2 ]
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%15 = load i32, i32* %4
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
%18 = alloca i32, i64 %16
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %26, %12
%22 = phi i32 [ %19, %12 ], [ %31, %26 ]
%23 = call i32 @bubble_sort(i32 %22, i32* %18)
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 0
br i1 %25, label %39, label %34
26: ; preds = %12, %26
%27 = phi i64 [ %30, %26 ], [ 0, %12 ]
%28 = getelementptr inbounds i32, i32* %18, i64 %27
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %28)
%30 = add nuw nsw i64 %27, 1
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %30, %32
br i1 %33, label %26, label %21
34: ; preds = %39, %21
%35 = call i32 @putchar(i32 10)
%36 = add nuw nsw i32 %13, 1
%37 = load i32, i32* %3
%38 = icmp slt i32 %36, %37
br i1 %38, label %12, label %10
39: ; preds = %21, %39
%40 = phi i64 [ %44, %39 ], [ 0, %21 ]
%41 = getelementptr inbounds i32, i32* %18, i64 %40
%42 = load i32, i32* %41
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = add nuw nsw i64 %40, 1
%45 = load i32, i32* %4
%46 = sext i32 %45 to i64
%47 = icmp slt i64 %44, %46
br i1 %47, label %39, label %34
}