#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 total;
  int end;
  scanf("%d", &total);
  for (int col = total - 1; col >= 0; col--) {
    for (int row = total; row > col; row--) {
      end = total * col + row;
      printf("%d ", end);
    }
    end = total * 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
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     11b5 <main+0x95>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    118e <main+0x6e>
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe88(%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    0xe65(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1148 <main+0x28>
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),%ebx
test   %ebx,%ebx
jle    11d0 <main+0xb0>
lea    -0x1(%rbx),%r13d
lea    0xeb4(%rip),%r14
lea    0xea9(%rip),%r15
mov    %ebx,%ebp
nopl   0x0(%rax)
lea    -0x1(%rbp),%r12d
cmp    %ebp,%ebx
jl     11b0 <main+0x90>
mov    %ebx,%esi
imul   %ebp,%esi
mov    %r15,%rdi
call   1030 <printf@plt>
cmp    %ebp,%ebx
jle    11a5 <main+0x85>
nopl   0x0(%rax)
mov    0x4(%rsp),%eax
imul   %r13d,%eax
mov    %ebx,%r14d
add    $0xffffffff,%r14d
lea    (%rbx,%rax,1),%esi
add    $0xffffffff,%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %r14d,%ebx
cmp    %ebp,%r14d
jg     1180 <main+0x60>
mov    0x4(%rsp),%ebx
lea    0xe57(%rip),%r14
imul   %r12d,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
cmp    $0x2,%ebp
jl     11d0 <main+0xb0>
mov    0x4(%rsp),%ebx
add    $0xffffffff,%r13d
mov    %r12d,%ebp
jmp    1160 <main+0x40>
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)
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 1
store i32 %8, i32* %4
br label %9
9: ; preds = %35, %0
%10 = load i32, i32* %4
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %38
12: ; preds = %9
%13 = load i32, i32* %2
store i32 %13, i32* %5
br label %14
14: ; preds = %26, %12
%15 = load i32, i32* %5
%16 = load i32, i32* %4
%17 = icmp sgt i32 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = mul nsw i32 %19, %20
%22 = load i32, i32* %5
%23 = add nsw i32 %21, %22
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %18
%27 = load i32, i32* %5
%28 = add nsw i32 %27, -1
store i32 %28, i32* %5
br label %14
29: ; preds = %14
%30 = load i32, i32* %2
%31 = load i32, i32* %4
%32 = mul nsw i32 %30, %31
store i32 %32, i32* %3
%33 = load i32, i32* %3
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %29
%36 = load i32, i32* %4
%37 = add nsw i32 %36, -1
store i32 %37, i32* %4
br label %9
38: ; preds = %9
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 = %18, %0
ret i32 0
7: ; preds = %0, %23
%8 = phi i32 [ %24, %23 ], [ %4, %0 ]
%9 = phi i32 [ %10, %23 ], [ %4, %0 ]
%10 = add nsw i32 %9, -1
%11 = icmp slt i32 %8, %9
br i1 %11, label %18, label %12
12: ; preds = %7
%13 = mul i32 %8, %9
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = icmp sgt i32 %8, %9
br i1 %15, label %25, label %16
16: ; preds = %25, %12
%17 = load i32, i32* %1
br label %18
18: ; preds = %16, %7
%19 = phi i32 [ %17, %16 ], [ %8, %7 ]
%20 = mul nsw i32 %19, %10
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = icmp sgt i32 %9, 1
br i1 %22, label %23, label %6
23: ; preds = %18
%24 = load i32, i32* %1
br label %7
25: ; preds = %12, %25
%26 = phi i32 [ %27, %25 ], [ %8, %12 ]
%27 = add nsw i32 %26, -1
%28 = load i32, i32* %1
%29 = mul nsw i32 %28, %10
%30 = add nsw i32 %29, %27
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = icmp sgt i32 %27, %9
br i1 %32, label %25, label %16
}