#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;
  int i, j;
  scanf("%d", &N);
  for (i = 1; i <= N; i = i + 1) {
    for (j = 1; j <= N; j = j + 1)
      if (i > j) {
        printf("%d", N - i + j);
      } else {
        printf("%d", 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     11cd <main+0xad>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11b1 <main+0x91>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    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    119e <main+0x7e>
mov    -0x8(%rbp),%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a3 <main+0x83>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1159 <main+0x39>
lea    0xe4b(%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    11b3 <main+0x83>
mov    $0x1,%ebp
xor    %r14d,%r14d
lea    0xea1(%rip),%r15
jmp    1187 <main+0x57>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%eax
mov    0x4(%rsp),%esi
cmp    %esi,%ebp
mov    %eax,%ebp
jge    11b3 <main+0x83>
test   %esi,%esi
jle    1170 <main+0x40>
mov    $0x1,%ebx
mov    %ebp,%eax
sub    %ebx,%eax
cmovb  %r14d,%eax
sub    %eax,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1(%rbx),%eax
mov    0x4(%rsp),%esi
cmp    %esi,%ebx
mov    %eax,%ebx
jl     1190 <main+0x60>
jmp    1170 <main+0x40>
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"\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 = %35, %0
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %38
10: ; preds = %6
store i32 1, i32* %4
br label %11
11: ; preds = %30, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %33
15: ; preds = %11
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = icmp sgt 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 %29
26: ; preds = %15
%27 = load i32, i32* %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %19
br label %30
30: ; preds = %29
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %11
33: ; preds = %11
%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* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %6
38: ; 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 %24, label %6
6: ; preds = %0, %19
%7 = phi i32 [ %22, %19 ], [ %4, %0 ]
%8 = phi i32 [ %21, %19 ], [ 1, %0 ]
%9 = icmp slt i32 %7, 1
br i1 %9, label %19, label %10
10: ; preds = %6, %10
%11 = phi i32 [ %17, %10 ], [ %7, %6 ]
%12 = phi i32 [ %16, %10 ], [ 1, %6 ]
%13 = call i32 @llvm.usub.sat.i32(i32 %8, i32 %12)
%14 = sub i32 %11, %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = add nuw nsw i32 %12, 1
%17 = load i32, i32* %1
%18 = icmp slt i32 %12, %17
br i1 %18, label %10, label %19
19: ; preds = %10, %6
%20 = call i32 @putchar(i32 10)
%21 = add nuw nsw i32 %8, 1
%22 = load i32, i32* %1
%23 = icmp slt i32 %8, %22
br i1 %23, label %6, label %24
24: ; preds = %19, %0
ret i32 0
}