#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 i, j, N, p, k, a[5555];
  scanf("%d\n", &N);
  for (p = 0; p < N; p++) {
    scanf("%d ", &a[p]);
    if (-1000 <= a[p] && a[p] <= 1000) {
      continue;
    } else {
      a[p] = 1000;
    }
  }
  for (i = 1; i <= N; i++) {
    k = N - 1;
    for (j = 1; j <= i; j++) {
      printf("%d ", a[k]);
      k = k - 1;
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x56f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11c5 <main+0xa5>
movslq -0x14(%rbp),%rax
lea    -0x56f0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe96(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x14(%rbp),%rcx
mov    $0xfffffc18,%eax
cmp    -0x56f0(%rbp,%rcx,4),%eax
jg     11a3 <main+0x83>
movslq -0x14(%rbp),%rax
cmpl   $0x3e8,-0x56f0(%rbp,%rax,4)
jg     11a3 <main+0x83>
jmp    11b7 <main+0x97>
movslq -0x14(%rbp),%rax
movl   $0x3e8,-0x56f0(%rbp,%rax,4)
jmp    11b7 <main+0x97>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <main+0x29>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1240 <main+0x120>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1224 <main+0x104>
movslq -0x18(%rbp),%rax
mov    -0x56f0(%rbp,%rax,4),%esi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e8 <main+0xc8>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11cc <main+0xac>
xor    %eax,%eax
add    $0x56f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x56e8,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1216 <main+0xe6>
lea    0x10(%rsp),%rbx
xor    %r15d,%r15d
lea    0xe98(%rip),%r14
mov    $0x3e8,%ebp
jmp    1192 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r15
movslq 0xc(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%r15
jge    11b0 <main+0x80>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rbx),%eax
add    %ebp,%eax
cmp    $0x7d1,%eax
jb     1180 <main+0x50>
movl   $0x3e8,(%rbx)
jmp    1180 <main+0x50>
test   %eax,%eax
jle    1216 <main+0xe6>
mov    $0x1,%r12d
mov    $0xffffffff,%r13d
lea    0xc(%rsp),%r15
lea    0xe38(%rip),%r14
nopl   0x0(%rax)
cltq
lea    (%r15,%rax,4),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    %ebx,%r13d
jne    11e0 <main+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%ecx
mov    0xc(%rsp),%eax
add    $0xffffffffffffffff,%r13
cmp    %eax,%r12d
mov    %ecx,%r12d
jl     11d0 <main+0xa0>
xor    %eax,%eax
add    $0x56e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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