#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 n, x, y;
  scanf("%d", &n);
  for (y = 1; y <= n; y++, printf("\n")) {
    for (x = y; x < n; x++, printf("  "))
      ;
    for (x = 0; x < y; x++, printf("%d ", x))
      ;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11dd <main+0xbd>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1185 <main+0x65>
jmp    1169 <main+0x49>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1158 <main+0x38>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11bc <main+0x9c>
jmp    119d <main+0x7d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118c <main+0x6c>
jmp    11c1 <main+0xa1>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1146 <main+0x26>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11ee <main+0xbe>
mov    $0x1,%r12d
lea    0xe9c(%rip),%r14
lea    0xe98(%rip),%r15
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %eax,%r12d
jge    11a3 <main+0x73>
mov    %r12d,%ebx
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    0xc(%rsp),%ebx
jl     1190 <main+0x60>
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rbx,%r13,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x2,%eax
jne    11b0 <main+0x80>
lea    0x1(%r12),%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%r13d
cmp    %eax,%r12d
mov    %ebx,%r12d
jl     1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c" \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
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %4
br label %6
6: ; preds = %33, %0
%7 = load i32, i32* %4
%8 = load i32, i32* %2
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %37
10: ; preds = %6
%11 = load i32, i32* %4
store i32 %11, i32* %3
br label %12
12: ; preds = %17, %10
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %12
21: ; preds = %12
store i32 0, i32* %3
br label %22
22: ; preds = %27, %21
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %32
26: ; preds = %22
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
%30 = load i32, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %22
32: ; preds = %22
br label %33
33: ; preds = %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %6
37: ; preds = %6
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c" \00"
@.str.2 = [4 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 %27, label %6
6: ; preds = %0, %22
%7 = phi i32 [ %25, %22 ], [ %4, %0 ]
%8 = phi i32 [ %23, %22 ], [ 1, %0 ]
%9 = icmp slt i32 %8, %7
br i1 %9, label %10, label %16
10: ; preds = %6, %10
%11 = phi i32 [ %12, %10 ], [ %8, %6 ]
%12 = add nuw nsw i32 %11, 1
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %1
%15 = icmp slt i32 %12, %14
br i1 %15, label %10, label %16
16: ; preds = %10, %6
br label %17
17: ; preds = %16, %17
%18 = phi i32 [ %19, %17 ], [ 0, %16 ]
%19 = add nuw nsw i32 %18, 1
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = icmp eq i32 %19, %8
br i1 %21, label %22, label %17
22: ; preds = %17
%23 = add nuw nsw i32 %8, 1
%24 = call i32 @putchar(i32 10)
%25 = load i32, i32* %1
%26 = icmp slt i32 %8, %25
br i1 %26, label %6, label %27
27: ; preds = %22, %0
ret i32 0
}