#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*/ putchar(char);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, n;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n - i; j++)
      putchar(' ');
    for (j = 1; j <= i; j++)
      printf("%d", j);
    printf("\n");
  }
  for (j = j - 2; j >= 1; j--) {
    for (j = 1; j <= n - i; j++)
      putchar(' ');
    for (j = 1; j <= i; j++)
      printf("%d", j);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11e0 <main+0xb0>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     1192 <main+0x62>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1169 <main+0x39>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11c4 <main+0x94>
mov    -0xc(%rbp),%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1199 <main+0x69>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x26>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     1271 <main+0x141>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     1223 <main+0xf3>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11fa <main+0xca>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1255 <main+0x125>
mov    -0xc(%rbp),%esi
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    122a <main+0xfa>
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11e9 <main+0xb9>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1248 <main+0x118>
mov    $0x1,%r12d
mov    $0x2,%ecx
lea    0xe96(%rip),%r14
xor    %r13d,%r13d
nopl   (%rax)
mov    %ecx,%ebx
cmp    %r12d,%eax
jle    1198 <main+0x68>
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
sub    %r12d,%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     1180 <main+0x50>
mov    $0x1,%ebp
nopl   (%rax)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1(%r13,%rbp,1),%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x2,%eax
jne    11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%r15d
mov    0x4(%rsp),%eax
lea    0x1(%rbx),%ecx
add    $0xffffffff,%r13d
cmp    %eax,%r12d
mov    %r15d,%r12d
jl     1170 <main+0x40>
cmp    $0x3,%ebx
jl     1248 <main+0x118>
lea    0xe15(%rip),%r14
cmp    %r15d,%eax
jle    1218 <main+0xe8>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
sub    %r15d,%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     1200 <main+0xd0>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %ebp,%ebx
jne    1220 <main+0xf0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    %r15d,%eax
jg     11f0 <main+0xc0>
jmp    1218 <main+0xe8>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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