#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*/ printf(char *, ...);
int /*<<< orphan*/ quickSort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  int array[128] = {0};
  int length = 0;
  int i = 0;
  scanf("%d", &length);
  for (i = 0; i < length; i++) {
    scanf("%d", &array[i]);
  }
  for (i = 0; i < length; i++) {
    printf("%d ", array[i]);
  }
  printf("\n");
  quickSort(array, 0, length - 1);
  for (i = 0; i < length; i++) {
    printf("%d ", array[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1040 <memset@plt>
movl   $0x0,-0x214(%rbp)
movl   $0x0,-0x218(%rbp)
lea    0xe79(%rip),%rdi
lea    -0x214(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x218(%rbp)
mov    -0x218(%rbp),%eax
cmp    -0x214(%rbp),%eax
jge    11e4 <main+0xa4>
movslq -0x218(%rbp),%rax
lea    -0x210(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe35(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    119d <main+0x5d>
movl   $0x0,-0x218(%rbp)
mov    -0x218(%rbp),%eax
cmp    -0x214(%rbp),%eax
jge    1230 <main+0xf0>
movslq -0x218(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%esi
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    11ee <main+0xae>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1060 <quickSort@plt>
movl   $0x0,-0x218(%rbp)
mov    -0x218(%rbp),%eax
cmp    -0x214(%rbp),%eax
jge    12a1 <main+0x161>
movslq -0x218(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%esi
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    125f <main+0x11f>
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x210,%rsp
lea    0x10(%rsp),%r15
mov    $0x200,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
movl   $0x0,0xc(%rsp)
lea    0xe81(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11ec <main+0x9c>
xor    %ebx,%ebx
lea    0xe67(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     11a0 <main+0x50>
test   %eax,%eax
jle    11ec <main+0x9c>
lea    0xe3b(%rip),%r14
xor    %ebx,%ebx
nopw   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+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%edx
add    $0xffffffff,%edx
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1070 <quickSort@plt>
cmpl   $0x0,0xc(%rsp)
jle    123c <main+0xec>
lea    0xdec(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
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     1220 <main+0xd0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbx
pop    %r14
pop    %r15
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"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [128 x i32]* %6 to i8*
store i32 0, i32* %7
store i32 0, i32* %8
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
store i32 0, i32* %8
br label %11
11: ; preds = %20, %2
%12 = load i32, i32* %8
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 %17
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %18)
br label %20
20: ; preds = %15
%21 = load i32, i32* %8
%22 = add nsw i32 %21, 1
store i32 %22, i32* %8
br label %11
23: ; preds = %11
store i32 0, i32* %8
br label %24
24: ; preds = %34, %23
%25 = load i32, i32* %8
%26 = load i32, i32* %7
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %37
28: ; preds = %24
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %28
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 1
store i32 %36, i32* %8
br label %24
37: ; preds = %24
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%39 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%40 = load i32, i32* %7
%41 = sub nsw i32 %40, 1
%42 = call i32 @quickSort(i32* %39, i32 0, i32 %41)
store i32 0, i32* %8
br label %43
43: ; preds = %53, %37
%44 = load i32, i32* %8
%45 = load i32, i32* %7
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %56
47: ; preds = %43
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %47
%54 = load i32, i32* %8
%55 = add nsw i32 %54, 1
store i32 %55, i32* %8
br label %43
56: ; preds = %43
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

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