#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*/ exit(int);
int /*<<< orphan*/ print_data(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ quicksort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ read_data(int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int A[2048000], n;
  scanf("%d", &n);
  printf("n=%d\n", n);
  if (n < 2048000)
    read_data(A, n);
  else
    exit(1);
  quicksort(A, 0, n - 1);
  print_data(A, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7d0020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe80(%rip),%rdi
lea    -0x7d0014(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x7d0014(%rbp),%esi
lea    0xe6a(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x1f4000,-0x7d0014(%rbp)
jge    11c5 <main+0x65>
lea    -0x7d0010(%rbp),%rdi
mov    -0x7d0014(%rbp),%esi
call   1030 <read_data@plt>
jmp    11cf <main+0x6f>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x7d0010(%rbp),%rdi
mov    -0x7d0014(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1040 <quicksort@plt>
lea    -0x7d0010(%rbp),%rdi
mov    -0x7d0014(%rbp),%esi
call   1060 <print_data@plt>
xor    %eax,%eax
add    $0x7d0020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x7d0010,%rsp
lea    0xe91(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xe7f(%rip),%rdi
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
cmp    $0x1f3fff,%esi
jg     11ca <main+0x6a>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <read_data@plt>
mov    0xc(%rsp),%edx
add    $0xffffffff,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <quicksort@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1060 <print_data@plt>
xor    %eax,%eax
add    $0x7d0010,%rsp
pop    %rbx
ret
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"n=%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2048000 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%9 = load i32, i32* %7
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 2048000
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = getelementptr inbounds [2048000 x i32], [2048000 x i32]* %6, i64 0, i64 0
%15 = load i32, i32* %7
%16 = call i32 @read_data(i32* %14, i32 %15)
br label %19
17: ; preds = %2
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %13
%20 = getelementptr inbounds [2048000 x i32], [2048000 x i32]* %6, i64 0, i64 0
%21 = load i32, i32* %7
%22 = sub nsw i32 %21, 1
%23 = call i32 @quicksort(i32* %20, i32 0, i32 %22)
%24 = getelementptr inbounds [2048000 x i32], [2048000 x i32]* %6, i64 0, i64 0
%25 = load i32, i32* %7
%26 = call i32 @print_data(i32* %24, i32 %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"n=%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2048000 x i32]
%4 = alloca i32
%5 = bitcast [2048000 x 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* %4)
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2048000
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = getelementptr inbounds [2048000 x i32], [2048000 x i32]* %3, i64 0, i64 0
%14 = call i32 @read_data(i32* %13, i32 %10)
%15 = load i32, i32* %4
%16 = add nsw i32 %15, -1
%17 = call i32 @quicksort(i32* %13, i32 0, i32 %16)
%18 = load i32, i32* %4
%19 = call i32 @print_data(i32* %13, i32 %18)
ret i32 0
20: ; preds = %2
%21 = call i32 @exit(i32 1)
unreachable
}