#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*/ quick_sort(int *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int A[9999999 + 1];
  int i;
  for (i = 1; i <= 9999999; i += 1)
    scanf("%d", &A[i]);
  quick_sort(A, 1, 9999999);
  printf("\nFinal array  :\n");
  for (i = 1; i <= 9999999; i++)
    printf("%d\n", A[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2625a20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x2625a14(%rbp)
cmpl   $0x98967f,-0x2625a14(%rbp)
jg     1191 <main+0x61>
movslq -0x2625a14(%rbp),%rax
lea    -0x2625a10(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe88(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x2625a14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2625a14(%rbp)
jmp    114c <main+0x1c>
lea    -0x2625a10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x98967f,%edx
call   1050 <quick_sort@plt>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x2625a14(%rbp)
cmpl   $0x98967f,-0x2625a14(%rbp)
jg     11ff <main+0xcf>
movslq -0x2625a14(%rbp),%rax
mov    -0x2625a10(%rbp,%rax,4),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2625a14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2625a14(%rbp)
jmp    11bf <main+0x8f>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x2625a20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x2625a08,%rsp
mov    $0x4,%ebx
lea    0xe9a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
lea    (%rsp,%rbx,1),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
add    $0x4,%rbx
cmp    $0x2625a00,%rbx
jne    1170 <main+0x20>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x98967f,%edx
call   1070 <quick_sort@plt>
lea    0xe65(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebx
lea    0xe50(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x989680,%rbx
jne    11c0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x2625a08,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [16 x i8] c"\0AFinal array :\00"
define i32 @main() {
%1 = alloca [10000000 x i32]
%2 = bitcast [10000000 x i32]* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 1, %0 ], [ %7, %3 ]
%5 = getelementptr inbounds [10000000 x i32], [10000000 x i32]* %1, i64 0, i64 %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = add nuw nsw i64 %4, 1
%8 = icmp eq i64 %7, 10000000
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = getelementptr inbounds [10000000 x i32], [10000000 x i32]* %1, i64 0, i64 0
%11 = call i32 @quick_sort(i32* %10, i32 1, i32 9999999)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %9, %13
%14 = phi i64 [ 1, %9 ], [ %18, %13 ]
%15 = getelementptr inbounds [10000000 x i32], [10000000 x i32]* %1, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = add nuw nsw i64 %14, 1
%19 = icmp eq i64 %18, 10000000
br i1 %19, label %20, label %13
20: ; preds = %13
%21 = call i32 @putchar(i32 10)
ret i32 0
}