#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*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ quicksort(int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int *n, *a, *i;
  i = (int *)malloc(sizeof(int));
  n = (int *)malloc(sizeof(int));
  scanf("%d", n);
  a = (int *)malloc((*n) * sizeof(int));
  for ((*i) = 0; (*i) < (*n); ++(*i)) {
    scanf("%d", &a[*i]);
  }
  quicksort(a, (*n));
  for ((*i) = 0; (*i) < (*n); ++(*i)) {
    printf("%d ", a[*i]);
  }
  free(a);
  free(n);
  free(i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    11eb <main+0x9b>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe2a(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    11ab <main+0x5b>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1040 <quicksort@plt>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1240 <main+0xf0>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdd8(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1204 <main+0xb4>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xe87(%rip),%rdi
mov    %rax,%rsi
call   1070 <scanf@plt>
mov    (%r14),%edi
shl    $0x2,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
movl   $0x0,(%rbx)
mov    (%r14),%esi
test   %esi,%esi
jle    11cc <main+0x7c>
xor    %eax,%eax
lea    0xe5b(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
cltq
lea    (%r15,%rax,4),%rsi
mov    %r12,%rdi
call   1070 <scanf@plt>
mov    (%rbx),%eax
add    $0x1,%eax
mov    %eax,(%rbx)
mov    (%r14),%esi
cmp    %esi,%eax
jl     11b0 <main+0x60>
mov    %r15,%rdi
call   1040 <quicksort@plt>
movl   $0x0,(%rbx)
cmpl   $0x0,(%r14)
jle    120a <main+0xba>
xor    %eax,%eax
lea    0xe1a(%rip),%r12
nopl   0x0(%rax)
cltq
mov    (%r15,%rax,4),%esi
mov    %r12,%rdi
call   1050 <printf@plt>
mov    (%rbx),%eax
add    $0x1,%eax
mov    %eax,(%rbx)
cmp    (%r14),%eax
jl     11f0 <main+0xa0>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i64 @malloc(i32 4)
%6 = inttoptr i64 %5 to i32*
store i32* %6, i32** %4
%7 = call i64 @malloc(i32 4)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %2
%9 = load i32*, i32** %2
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 4
%15 = trunc i64 %14 to i32
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to i32*
store i32* %17, i32** %3
%18 = load i32*, i32** %4
store i32 0, i32* %18
br label %19
19: ; preds = %32, %0
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = load i32*, i32** %2
%23 = load i32, i32* %22
%24 = icmp slt i32 %21, %23
br i1 %24, label %25, label %36
25: ; preds = %19
%26 = load i32*, i32** %3
%27 = load i32*, i32** %4
%28 = load i32, i32* %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %26, i64 %29
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %30)
br label %32
32: ; preds = %25
%33 = load i32*, i32** %4
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
store i32 %35, i32* %33
br label %19
36: ; preds = %19
%37 = load i32*, i32** %3
%38 = load i32*, i32** %2
%39 = load i32, i32* %38
%40 = call i32 @quicksort(i32* %37, i32 %39)
%41 = load i32*, i32** %4
store i32 0, i32* %41
br label %42
42: ; preds = %56, %36
%43 = load i32*, i32** %4
%44 = load i32, i32* %43
%45 = load i32*, i32** %2
%46 = load i32, i32* %45
%47 = icmp slt i32 %44, %46
br i1 %47, label %48, label %60
48: ; preds = %42
%49 = load i32*, i32** %3
%50 = load i32*, i32** %4
%51 = load i32, i32* %50
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %49, i64 %52
%54 = load i32, i32* %53
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %48
%57 = load i32*, i32** %4
%58 = load i32, i32* %57
%59 = add nsw i32 %58, 1
store i32 %59, i32* %57
br label %42
60: ; preds = %42
%61 = load i32*, i32** %3
%62 = call i32 @free(i32* %61)
%63 = load i32*, i32** %2
%64 = call i32 @free(i32* %63)
%65 = load i32*, i32** %4
%66 = call i32 @free(i32* %65)
%67 = load i32, i32* %1
ret i32 %67
}

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