#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 *radix_sort(int *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int A[1000100];
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf(" %d", A + i);
  }
  int *B = radix_sort(A, 2, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3d0ab0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec8(%rip),%rdi
lea    -0x3d0aa4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x3d0aa8(%rbp)
mov    -0x3d0aa8(%rbp),%eax
cmp    -0x3d0aa4(%rbp),%eax
jg     1196 <main+0x76>
lea    -0x3d0aa0(%rbp),%rsi
movslq -0x3d0aa8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe83(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x3d0aa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0aa8(%rbp)
jmp    114f <main+0x2f>
lea    -0x3d0aa0(%rbp),%rdi
mov    -0x3d0aa4(%rbp),%edx
mov    $0x2,%esi
call   1030 <radix_sort@plt>
mov    %rax,-0x3d0ab0(%rbp)
xor    %eax,%eax
add    $0x3d0ab0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x3d0aa0,%rsp
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    117d <main+0x5d>
lea    0x14(%rsp),%r15
xor    %ebx,%ebx
lea    0xead(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rdx
add    $0x1,%rbx
add    $0x4,%r15
cmp    %rdx,%rbx
jl     1160 <main+0x40>
lea    0x10(%rsp),%rdi
mov    $0x2,%esi
call   1030 <radix_sort@plt>
xor    %eax,%eax
add    $0x3d0aa0,%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"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000100 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %4
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = getelementptr inbounds [1000100 x i32], [1000100 x i32]* %2, i64 0, i64 0
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %15)
br label %17
17: ; preds = %11
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %7
20: ; preds = %7
%21 = getelementptr inbounds [1000100 x i32], [1000100 x i32]* %2, i64 0, i64 0
%22 = load i32, i32* %3
%23 = call i32* @radix_sort(i32* %21, i32 2, i32 %22)
store i32* %23, i32** %5
ret i32 0
}

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