#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, counter;
  scanf("%d", &size);
  for (int row = 1; row < size + 1; row++) {
    counter = (size * size) - (size * row) + 1;
    for (int column = 1; column < size; column++, counter++) {
      printf("%d ", counter);
    }
    printf("%d\n", counter);
  }
  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>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11c3 <main+0xa3>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x10(%rbp),%ecx
sub    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a6 <main+0x86>
mov    -0xc(%rbp),%esi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1174 <main+0x54>
mov    -0xc(%rbp),%esi
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11b8 <main+0x98>
mov    $0x1,%r13d
mov    $0xffffffff,%r12d
lea    0xeac(%rip),%r15
lea    0xea9(%rip),%r14
jmp    1189 <main+0x69>
mov    %eax,%ebx
sub    %r13d,%ebx
imul   %eax,%ebx
add    $0x1,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0x1(%r13),%ecx
mov    0x4(%rsp),%eax
add    $0xffffffff,%r12d
cmp    %r13d,%eax
mov    %ecx,%r13d
jle    11b8 <main+0x98>
cmp    $0x2,%eax
jl     1160 <main+0x40>
lea    (%rax,%r12,1),%ebx
imul   %eax,%ebx
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     11a0 <main+0x80>
add    %ebp,%ebx
jmp    116b <main+0x4b>
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 = [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)
store i32 1, i32* %4
br label %7
7: ; preds = %36, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %39
12: ; preds = %7
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = mul nsw i32 %13, %14
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = mul nsw i32 %16, %17
%19 = sub nsw i32 %15, %18
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
store i32 1, i32* %5
br label %21
21: ; preds = %28, %12
%22 = load i32, i32* %5
%23 = load i32, i32* %2
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %33
25: ; preds = %21
%26 = load i32, i32* %3
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %21
33: ; preds = %21
%34 = load i32, i32* %3
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %7
39: ; preds = %7
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 slt i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %14, %0
ret i32 0
7: ; preds = %0, %14
%8 = phi i32 [ %18, %14 ], [ %4, %0 ]
%9 = phi i32 [ %17, %14 ], [ 1, %0 ]
%10 = sub i32 %8, %9
%11 = mul i32 %10, %8
%12 = add nsw i32 %11, 1
%13 = icmp sgt i32 %8, 1
br i1 %13, label %20, label %14
14: ; preds = %20, %7
%15 = phi i32 [ %12, %7 ], [ %25, %20 ]
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = add nuw nsw i32 %9, 1
%18 = load i32, i32* %1
%19 = icmp sgt i32 %18, %9
br i1 %19, label %7, label %6
20: ; preds = %7, %20
%21 = phi i32 [ %25, %20 ], [ %12, %7 ]
%22 = phi i32 [ %24, %20 ], [ 1, %7 ]
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%24 = add nuw nsw i32 %22, 1
%25 = add nsw i32 %21, 1
%26 = load i32, i32* %1
%27 = icmp slt i32 %24, %26
br i1 %27, label %20, label %14
}