#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 /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sort(int *, int);
void main() {
  int i, n, *arr;
  printf("ÇëÊäÈëÊý×éµÄ´óÐ¡ n = ");
  scanf("%d", &n);
  arr = (int *)malloc(sizeof(int) * n);
  printf("ÇëÊäÈë%d¸öÊý×éÔªËØ£º\n", n);
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  printf("ÔÚÅÅÐòÇ°£¬Êý×éÎª£º");
  for (i = 0; i < n; i++) {
    printf("%d ", arr[i]);
  }
  printf("\nµ÷ÓÃÅÅÐòº¯ÊýÖÐ...\n");
  sort(arr, n);
  printf("ÔÚÅÅÐòºó£¬Êý×é±äÎª£º");
  for (i = 0; i < n; i++) {
    printf("%d ", arr[i]);
  }
  printf("\n");
  free(arr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d6 <main+0x86>
mov    -0x10(%rbp),%rsi
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe63(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11a1 <main+0x51>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    121e <main+0xce>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <main+0x9b>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <sort@plt>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1280 <main+0x130>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    124d <main+0xfd>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe99(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1090 <scanf@plt>
mov    0x4(%rsp),%edi
shl    $0x2,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    0x4(%rsp),%esi
lea    0xe78(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11ed <main+0x7d>
xor    %r12d,%r12d
lea    0xe5d(%rip),%r14
mov    %r15,%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
add    $0x1,%r12
movslq 0x4(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%r12
jl     11d0 <main+0x60>
lea    0xe5d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    122c <main+0xbc>
lea    0xe6d(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     1210 <main+0xa0>
lea    0xe70(%rip),%rdi
call   1050 <puts@plt>
mov    0x4(%rsp),%esi
mov    %r15,%rdi
call   1070 <sort@plt>
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    128c <main+0x11c>
lea    0xe16(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     1270 <main+0x100>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [38 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\8A\C3\BD\C3\97\C3\A9\C2\B5\C3\84\C2\B4\C3\B3\C3\90\C2\A1 n = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [40 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB%d\C2\B8\C3\B6\C3\8A\C3\BD\C3\97\C3\A9\C3\94\C2\AA\C3\8B\C3\98\C2\A3\C2\BA\0A\00"
@.str.3 = [37 x i8] c"\C3\94\C3\9A\C3\85\C3\85\C3\90\C3\B2\C3\87\C2\B0\C2\A3\C2\AC\C3\8A\C3\BD\C3\97\C3\A9\C3\8E\C2\AA\C2\A3\C2\BA\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [34 x i8] c"\0A\C2\B5\C3\B7\C3\93\C3\83\C3\85\C3\85\C3\90\C3\B2\C2\BA\C2\AF\C3\8A\C3\BD\C3\96\C3\90...\0A\00"
@.str.6 = [41 x i8] c"\C3\94\C3\9A\C3\85\C3\85\C3\90\C3\B2\C2\BA\C3\B3\C2\A3\C2\AC\C3\8A\C3\BD\C3\97\C3\A9\C2\B1\C3\A4\C3\8E\C2\AA\C2\A3\C2\BA\00"
@.str.7 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = mul i64 4, %7
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %3
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %12)
store i32 0, i32* %1
br label %14
14: ; preds = %24, %0
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load i32*, i32** %3
%20 = load i32, i32* %1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
br label %24
24: ; preds = %18
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
br label %14
27: ; preds = %14
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %29
29: ; preds = %40, %27
%30 = load i32, i32* %1
%31 = load i32, i32* %2
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %43
33: ; preds = %29
%34 = load i32*, i32** %3
%35 = load i32, i32* %1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %33
%41 = load i32, i32* %1
%42 = add nsw i32 %41, 1
store i32 %42, i32* %1
br label %29
43: ; preds = %29
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%45 = load i32*, i32** %3
%46 = load i32, i32* %2
%47 = call i32 @sort(i32* %45, i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %1
br label %49
49: ; preds = %60, %43
%50 = load i32, i32* %1
%51 = load i32, i32* %2
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %63
53: ; preds = %49
%54 = load i32*, i32** %3
%55 = load i32, i32* %1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %54, i64 %56
%58 = load i32, i32* %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %53
%61 = load i32, i32* %1
%62 = add nsw i32 %61, 1
store i32 %62, i32* %1
br label %49
63: ; preds = %49
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%65 = load i32*, i32** %3
%66 = call i32 @free(i32* %65)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\8A\C3\BD\C3\97\C3\A9\C2\B5\C3\84\C2\B4\C3\B3\C3\90\C2\A1 n = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [40 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB%d\C2\B8\C3\B6\C3\8A\C3\BD\C3\97\C3\A9\C3\94\C2\AA\C3\8B\C3\98\C2\A3\C2\BA\0A\00"
@.str.3 = [37 x i8] c"\C3\94\C3\9A\C3\85\C3\85\C3\90\C3\B2\C3\87\C2\B0\C2\A3\C2\AC\C3\8A\C3\BD\C3\97\C3\A9\C3\8E\C2\AA\C2\A3\C2\BA\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.6 = [41 x i8] c"\C3\94\C3\9A\C3\85\C3\85\C3\90\C3\B2\C2\BA\C3\B3\C2\A3\C2\AC\C3\8A\C3\BD\C3\97\C3\A9\C2\B1\C3\A4\C3\8E\C2\AA\C2\A3\C2\BA\00"
@str = [33 x i8] c"\0A\C2\B5\C3\B7\C3\93\C3\83\C3\85\C3\85\C3\90\C3\B2\C2\BA\C2\AF\C3\8A\C3\BD\C3\96\C3\90...\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = shl i32 %5, 2
%7 = call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i32*
%9 = load i32, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %0, %13
%14 = phi i64 [ %17, %13 ], [ 0, %0 ]
%15 = getelementptr inbounds i32, i32* %8, i64 %14
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%17 = add nuw nsw i64 %14, 1
%18 = load i32, i32* %1
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %13, label %21
21: ; preds = %13, %0
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* %1
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %34
25: ; preds = %21, %25
%26 = phi i64 [ %30, %25 ], [ 0, %21 ]
%27 = getelementptr inbounds i32, i32* %8, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = add nuw nsw i64 %26, 1
%31 = load i32, i32* %1
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %30, %32
br i1 %33, label %25, label %34
34: ; preds = %25, %21
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%36 = load i32, i32* %1
%37 = call i32 @sort(i32* %8, i32 %36)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%39 = load i32, i32* %1
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %50
41: ; preds = %34, %41
%42 = phi i64 [ %46, %41 ], [ 0, %34 ]
%43 = getelementptr inbounds i32, i32* %8, i64 %42
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%46 = add nuw nsw i64 %42, 1
%47 = load i32, i32* %1
%48 = sext i32 %47 to i64
%49 = icmp slt i64 %46, %48
br i1 %49, label %41, label %50
50: ; preds = %41, %34
%51 = call i32 @putchar(i32 10)
%52 = call i32 @free(i32* %8)
ret void
}