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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x56e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x56d4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x56d8(%rbp)
mov    -0x56d8(%rbp),%eax
mov    -0x56d4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     119b <main+0x7b>
movslq -0x56d8(%rbp),%rax
lea    -0x56d0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe81(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x56d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x56d8(%rbp)
jmp    114f <main+0x2f>
movl   $0x1,-0x56dc(%rbp)
mov    -0x56dc(%rbp),%eax
cmp    -0x56d4(%rbp),%eax
jg     1232 <main+0x112>
mov    -0x56d4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x56d8(%rbp)
mov    -0x56d8(%rbp),%eax
mov    -0x56d4(%rbp),%ecx
sub    -0x56dc(%rbp),%ecx
cmp    %ecx,%eax
jl     1210 <main+0xf0>
movslq -0x56d8(%rbp),%rax
mov    -0x56d0(%rbp,%rax,4),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x56d8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x56d8(%rbp)
jmp    11c6 <main+0xa6>
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x56dc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x56dc(%rbp)
jmp    11a5 <main+0x85>
xor    %eax,%eax
add    $0x56e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x56e0,%rsp
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11ec <main+0xbc>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe9d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1170 <main+0x40>
test   %eax,%eax
jle    11ec <main+0xbc>
mov    $0x1,%r15d
lea    0xe62(%rip),%r14
xchg   %ax,%ax
movslq %eax,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0xc(%rsp,%rbx,4),%esi
add    $0xffffffffffffffff,%rbx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0xc(%rsp),%rax
movslq %r15d,%rcx
sub    %rcx,%rax
cmp    %rax,%rbx
jg     11b0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%ecx
mov    0xc(%rsp),%eax
cmp    %eax,%r15d
mov    %ecx,%r15d
jl     11a0 <main+0x70>
xor    %eax,%eax
add    $0x56e0,%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"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5555 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 0, i32* %4
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = icmp sle i32 %8, %10
br i1 %11, label %12, label %20
12: ; preds = %7
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5555 x i32], [5555 x i32]* %2, i64 0, 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 = %12
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %7
20: ; preds = %7
store i32 1, i32* %5
br label %21
21: ; preds = %45, %20
%22 = load i32, i32* %5
%23 = load i32, i32* %3
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %48
25: ; preds = %21
%26 = load i32, i32* %3
%27 = sub nsw i32 %26, 1
store i32 %27, i32* %4
br label %28
28: ; preds = %40, %25
%29 = load i32, i32* %4
%30 = load i32, i32* %3
%31 = load i32, i32* %5
%32 = sub nsw i32 %30, %31
%33 = icmp sge i32 %29, %32
br i1 %33, label %34, label %43
34: ; preds = %28
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [5555 x i32], [5555 x i32]* %2, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %34
%41 = load i32, i32* %4
%42 = add nsw i32 %41, -1
store i32 %42, i32* %4
br label %28
43: ; preds = %28
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %45
45: ; preds = %43
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
br label %21
48: ; preds = %21
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 [5555 x i32]
%2 = alloca i32
%3 = bitcast [5555 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 sgt i32 %6, 0
br i1 %7, label %10, label %37
8: ; preds = %10
%9 = icmp slt i32 %15, 1
br i1 %9, label %37, label %18
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds [5555 x i32], [5555 x i32]* %1, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %10, label %8
18: ; preds = %8, %32
%19 = phi i32 [ %35, %32 ], [ %15, %8 ]
%20 = phi i32 [ %34, %32 ], [ 1, %8 ]
%21 = sext i32 %19 to i64
br label %22
22: ; preds = %18, %22
%23 = phi i64 [ %21, %18 ], [ %24, %22 ]
%24 = add nsw i64 %23, -1
%25 = getelementptr inbounds [5555 x i32], [5555 x i32]* %1, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %2
%29 = sub nsw i32 %28, %20
%30 = sext i32 %29 to i64
%31 = icmp sgt i64 %24, %30
br i1 %31, label %22, label %32
32: ; preds = %22
%33 = call i32 @putchar(i32 10)
%34 = add nuw nsw i32 %20, 1
%35 = load i32, i32* %2
%36 = icmp slt i32 %20, %35
br i1 %36, label %18, label %37
37: ; preds = %32, %0, %8
ret i32 0
}