#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 main(int argc, const char *argv[]) {
  int number;
  int *a;
  int i;
  printf("输入数量:");
  scanf("%d", &number);
  a = (int *)malloc(number * sizeof(int));
  for (i = 0; i < number; i++) {
    scanf("%d", &a[i]);
  }
  for (i = number; i >= 0; i--) {
    printf("%d", a[i]);
  }
  free(a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c3 <main+0x83>
mov    -0x20(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe5e(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118e <main+0x4e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     11fa <main+0xba>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    11c9 <main+0x89>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
shl    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11ad <main+0x6d>
xor    %r12d,%r12d
lea    0xe86(%rip),%r14
mov    %r15,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
add    $0x1,%r12
movslq 0x4(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%r12
jl     1190 <main+0x50>
test   %eax,%eax
js     11d4 <main+0x94>
mov    %eax,%ebx
lea    0xe54(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
jb     11c0 <main+0x80>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\E8\BE\93\E5\85\A5\E6\95\B0\E9\87\8F:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 4
%14 = trunc i64 %13 to i32
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i32*
store i32* %16, i32** %7
store i32 0, i32* %8
br label %17
17: ; preds = %27, %2
%18 = load i32, i32* %8
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load i32*, i32** %7
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %25)
br label %27
27: ; preds = %21
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %17
30: ; preds = %17
%31 = load i32, i32* %6
store i32 %31, i32* %8
br label %32
32: ; preds = %42, %30
%33 = load i32, i32* %8
%34 = icmp sge i32 %33, 0
br i1 %34, label %35, label %45
35: ; preds = %32
%36 = load i32*, i32** %7
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %35
%43 = load i32, i32* %8
%44 = add nsw i32 %43, -1
store i32 %44, i32* %8
br label %32
45: ; preds = %32
%46 = load i32*, i32** %7
%47 = call i32 @free(i32* %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"\E8\BE\93\E5\85\A5\E6\95\B0\E9\87\8F:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = shl i32 %7, 2
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i32*
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %18, %2
%14 = phi i32 [ %11, %2 ], [ %23, %18 ]
%15 = icmp sgt i32 %14, -1
br i1 %15, label %16, label %33
16: ; preds = %13
%17 = zext i32 %14 to i64
br label %26
18: ; preds = %2, %18
%19 = phi i64 [ %22, %18 ], [ 0, %2 ]
%20 = getelementptr inbounds i32, i32* %10, i64 %19
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = add nuw nsw i64 %19, 1
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %22, %24
br i1 %25, label %18, label %13
26: ; preds = %16, %26
%27 = phi i64 [ %17, %16 ], [ %31, %26 ]
%28 = getelementptr inbounds i32, i32* %10, i64 %27
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = add nsw i64 %27, -1
%32 = icmp eq i64 %27, 0
br i1 %32, label %33, label %26
33: ; preds = %26, %13
%34 = call i32 @free(i32* %10)
ret i32 0
}