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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xec4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11d3 <main+0xb3>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11b7 <main+0x97>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1193 <main+0x73>
mov    -0x10(%rbp),%esi
sub    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a4 <main+0x84>
mov    -0x10(%rbp),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a9 <main+0x89>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115f <main+0x3f>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114c <main+0x2c>
xor    %eax,%eax
add    $0x20,%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
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* %4
store i32 %6, i32* %5
%7 = 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 %8
8: ; preds = %37, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %40
12: ; preds = %8
store i32 1, i32* %3
br label %13
13: ; preds = %32, %12
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %35
17: ; preds = %13
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i32, i32* %4
%23 = load i32, i32* %2
%24 = sub nsw i32 %22, %23
%25 = load i32, i32* %3
%26 = add nsw i32 %24, %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %31
28: ; preds = %17
%29 = load i32, i32* %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %21
br label %32
32: ; preds = %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %13
35: ; preds = %13
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %8
40: ; preds = %8
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
}