#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 *);
main() {
  int n;
  scanf("%d", &n);
  int a[n][n];
  int x, y;
  for (x = 0; x < n; ++x) {
    for (y = 0; y < n; ++y) {
      if (x <= y)
        a[x][y] = y - x + 1;
      else
        a[x][y] = 1;
      printf("%d ", a[x][y]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x10(%rbp)
mov    %rcx,%rdx
imul   %rdx,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1250 <main+0x130>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1234 <main+0x114>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jg     11d8 <main+0xb8>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rsi
mov    -0x28(%rbp),%edx
sub    -0x24(%rbp),%edx
add    $0x1,%edx
movslq -0x24(%rbp),%rcx
imul   %rsi,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    11fa <main+0xda>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rdx
movslq -0x24(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rdx
movslq -0x24(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1194 <main+0x74>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1181 <main+0x61>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%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    %rsp,%r14
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11c5 <main+0x95>
mov    $0x1,%r13d
mov    $0x1,%r12d
lea    0xe99(%rip),%r15
xor    %ebp,%ebp
jmp    118c <main+0x5c>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
add    $0xffffffffffffffff,%r13
cmp    %rax,%rbp
jge    11c5 <main+0x95>
test   %eax,%eax
jle    1170 <main+0x40>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%rbx,%r13,1),%esi
cmp    %rbp,%rbx
cmovb  %r12d,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     11a0 <main+0x70>
jmp    1170 <main+0x40>
mov    %r14,%rsp
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 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = load i32, i32* %2
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %3
%14 = mul nuw i64 %10, %12
%15 = alloca i32, i64 %14
store i64 %10, i64* %4
store i64 %12, i64* %5
store i32 0, i32* %6
br label %16
16: ; preds = %64, %0
%17 = load i32, i32* %6
%18 = load i32, i32* %2
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %67
20: ; preds = %16
store i32 0, i32* %7
br label %21
21: ; preds = %59, %20
%22 = load i32, i32* %7
%23 = load i32, i32* %2
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %62
25: ; preds = %21
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = icmp sle i32 %26, %27
br i1 %28, label %29, label %41
29: ; preds = %25
%30 = load i32, i32* %7
%31 = load i32, i32* %6
%32 = sub nsw i32 %30, %31
%33 = add nsw i32 %32, 1
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = mul nsw i64 %35, %12
%37 = getelementptr inbounds i32, i32* %15, i64 %36
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
store i32 %33, i32* %40
br label %49
41: ; preds = %25
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = mul nsw i64 %43, %12
%45 = getelementptr inbounds i32, i32* %15, i64 %44
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
store i32 1, i32* %48
br label %49
49: ; preds = %41, %29
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = mul nsw i64 %51, %12
%53 = getelementptr inbounds i32, i32* %15, i64 %52
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i32, i32* %53, i64 %55
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %49
%60 = load i32, i32* %7
%61 = add nsw i32 %60, 1
store i32 %61, i32* %7
br label %21
62: ; preds = %21
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %64
64: ; preds = %62
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %16
67: ; preds = %16
%68 = load i8*, i8** %3
%69 = load i32, i32* %1
ret i32 %69
}

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