#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int size;
  int end;
  scanf("%d", &size);
  for (int col = size; col > 0; col--) {
    for (int row = size - 1; row > 0; row--) {
      end = size * col - row;
      printf("%d ", end);
    }
    end = size * col;
    printf("%d\n", end);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    11b3 <main+0x93>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    118c <main+0x6c>
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1158 <main+0x38>
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1145 <main+0x25>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11ae <main+0x8e>
lea    0xeb7(%rip),%r15
lea    0xeb4(%rip),%r14
mov    %esi,%r12d
cmp    $0x2,%esi
jl     118d <main+0x6d>
nopl   0x0(%rax,%rax,1)
lea    0x1(%rsi),%ebx
mov    $0x1,%ebp
sub    %esi,%ebp
nopw   0x0(%rax,%rax,1)
imul   %r12d,%esi
add    %ebp,%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
add    $0xffffffff,%ebx
add    $0x1,%ebp
cmp    $0x2,%ebx
jg     1170 <main+0x50>
imul   %r12d,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
cmp    $0x2,%r12d
jl     11ae <main+0x8e>
add    $0xffffffff,%r12d
mov    0xc(%rsp),%esi
cmp    $0x2,%esi
jge    1160 <main+0x40>
jmp    118d <main+0x6d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
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 = [4 x i8] c"%d\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 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
store i32 %7, i32* %4
br label %8
8: ; preds = %34, %0
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %37
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %5
br label %14
14: ; preds = %25, %11
%15 = load i32, i32* %5
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i32, i32* %2
%19 = load i32, i32* %4
%20 = mul nsw i32 %18, %19
%21 = load i32, i32* %5
%22 = sub nsw i32 %20, %21
store i32 %22, i32* %3
%23 = load i32, i32* %3
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %5
%27 = add nsw i32 %26, -1
store i32 %27, i32* %5
br label %14
28: ; preds = %14
%29 = load i32, i32* %2
%30 = load i32, i32* %4
%31 = mul nsw i32 %29, %30
store i32 %31, i32* %3
%32 = load i32, i32* %3
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %28
%35 = load i32, i32* %4
%36 = add nsw i32 %35, -1
store i32 %36, i32* %4
br label %8
37: ; preds = %8
ret i32 0
}

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