#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*/ getchar();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int book[1001], i, j, t, n;
  for (i = 0; i <= 1000; i++) {
    book[i] = 0;
  }
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &t);
    book[t]++;
  }
  for (i = 1000; i >= 0; i--) {
    for (j = 1; j <= book[i]; j++) {
      printf("%d, ", i);
    }
  }
  getchar();
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xfb4(%rbp)
cmpl   $0x3e8,-0xfb4(%rbp)
jg     1182 <main+0x52>
movslq -0xfb4(%rbp),%rax
movl   $0x0,-0xfb0(%rbp,%rax,4)
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    114c <main+0x1c>
lea    0xe77(%rip),%rdi
lea    -0xfc0(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0xfb4(%rbp)
mov    -0xfb4(%rbp),%eax
cmp    -0xfc0(%rbp),%eax
jg     11f0 <main+0xc0>
lea    0xe48(%rip),%rdi
lea    -0xfbc(%rbp),%rsi
call   1050 <scanf@plt>
movslq -0xfbc(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0xfb0(%rbp,%rax,4)
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    119f <main+0x6f>
movl   $0x3e8,-0xfb4(%rbp)
cmpl   $0x0,-0xfb4(%rbp)
jl     126a <main+0x13a>
movl   $0x1,-0xfb8(%rbp)
mov    -0xfb8(%rbp),%eax
movslq -0xfb4(%rbp),%rcx
cmp    -0xfb0(%rbp,%rcx,4),%eax
jg     1251 <main+0x121>
mov    -0xfb4(%rbp),%esi
lea    0xdcb(%rip),%rdi
call   1030 <printf@plt>
mov    -0xfb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb8(%rbp)
jmp    1211 <main+0xe1>
jmp    1256 <main+0x126>
mov    -0xfb4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xfb4(%rbp)
jmp    11fa <main+0xca>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xfc0,%rsp
lea    0x10(%rsp),%rdi
xor    %ebp,%ebp
mov    $0xfa4,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xe9b(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11ae <main+0x6e>
lea    0xe83(%rip),%r14
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movslq 0xc(%rsp),%rax
addl   $0x1,0x10(%rsp,%rax,4)
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jl     1190 <main+0x50>
mov    $0x3e8,%ebx
lea    0xe49(%rip),%r14
jmp    11c6 <main+0x86>
nopl   0x0(%rax)
sub    $0x1,%rbx
jb     11e1 <main+0xa1>
mov    0x10(%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11c0 <main+0x80>
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0x90>
jmp    11c0 <main+0x80>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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