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


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,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ca <main+0xaa>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ae <main+0x8e>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118d <main+0x6d>
mov    -0x8(%rbp),%esi
sub    -0xc(%rbp),%esi
add    -0x10(%rbp),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119b <main+0x7b>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a0 <main+0x80>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1159 <main+0x39>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11cc <main+0x9c>
mov    $0x1,%ebx
lea    0xea4(%rip),%r14
xor    %r15d,%r15d
jmp    118b <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
mov    0x4(%rsp),%esi
add    $0xffffffff,%r15d
cmp    %esi,%ebx
mov    %eax,%ebx
jge    11cc <main+0x9c>
test   %esi,%esi
jle    1170 <main+0x40>
xor    %eax,%eax
jmp    11b4 <main+0x84>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x4e,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%esi
mov    %ebp,%eax
cmp    %esi,%ebp
jge    1170 <main+0x40>
lea    0x1(%rax),%ebp
cmp    %ebx,%ebp
jae    11a0 <main+0x70>
add    %r15d,%esi
add    %eax,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11aa <main+0x7a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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