#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 */
scalar_t__ EOF;
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *);
int main() {
  int n, i;
  int *array;
  while (scanf("%d", &n) != EOF) {
    if (n == 0) {
      printf("NULL\n");
    } else {
      array = (int *)malloc(n * sizeof(int));
      for (i = 0; i < n; i++)
        scanf("%d", &array[i]);
      printf("%d", array[n - 1]);
      for (i = n - 2; i >= 0; i--)
        printf(" %d", array[i]);
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e92(%rip),%rcx
cmp    (%rcx),%rax
je     1236 <main+0x106>
cmpl   $0x0,-0x8(%rbp)
jne    117c <main+0x4c>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x101>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cb <main+0x9b>
mov    -0x18(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe4f(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1196 <main+0x66>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1223 <main+0xf3>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11f2 <main+0xc2>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe9f(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x2e75(%rip),%r14
cmp    (%r14),%rax
jne    1189 <main+0x39>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe71(%rip),%r13
lea    0x4(%rsp),%r15
lea    0xe64(%rip),%r12
jmp    11ba <main+0x6a>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
cmp    (%r14),%rax
je     1178 <main+0x28>
mov    0x4(%rsp),%edi
test   %edi,%edi
je     1260 <main+0x110>
shl    $0x2,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1217 <main+0xc7>
mov    %r15,%r14
mov    %rbx,%rbp
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %rbp,%rsi
call   1070 <scanf@plt>
add    $0x1,%r15
movslq 0x4(%rsp),%rax
add    $0x4,%rbp
cmp    %rax,%r15
jl     11f0 <main+0xa0>
mov    %r14,%r15
mov    0x2dd1(%rip),%r14
cltq
mov    -0x4(%rbx,%rax,4),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%ebp
cmp    $0x2,%ebp
jl     11a0 <main+0x50>
add    $0xfffffffe,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffffffffffff,%rbp
jb     1240 <main+0xf0>
jmp    11a0 <main+0x50>
nopl   0x0(%rax,%rax,1)
lea    0xd9d(%rip),%rdi
call   1040 <puts@plt>
jmp    11aa <main+0x5a>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.2 = [4 x i8] c" %d\00"
@str = [5 x i8] c"NULL\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %50, label %6
6: ; preds = %0, %46
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %46
11: ; preds = %6
%12 = shl i32 %7, 2
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i32*
%15 = load i32, i32* %1
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %11, %17
%18 = phi i64 [ %21, %17 ], [ 0, %11 ]
%19 = getelementptr inbounds i32, i32* %14, i64 %18
%20 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = add nuw nsw i64 %18, 1
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %17, label %25
25: ; preds = %17, %11
%26 = phi i32 [ %15, %11 ], [ %22, %17 ]
%27 = add nsw i32 %26, -1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %14, i64 %28
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %1
%33 = icmp sgt i32 %32, 1
br i1 %33, label %34, label %44
34: ; preds = %25
%35 = add nsw i32 %32, -2
%36 = zext i32 %35 to i64
br label %37
37: ; preds = %34, %37
%38 = phi i64 [ %36, %34 ], [ %42, %37 ]
%39 = getelementptr inbounds i32, i32* %14, i64 %38
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = add nsw i64 %38, -1
%43 = icmp eq i64 %38, 0
br i1 %43, label %44, label %37
44: ; preds = %37, %25
%45 = call i32 @putchar(i32 10)
br label %46
46: ; preds = %44, %9
%47 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%48 = load i64, i64* @EOF
%49 = icmp eq i64 %47, %48
br i1 %49, label %50, label %6
50: ; preds = %46, %0
ret i32 0
}