#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);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n;
  scanf("%d", &n);
  for (int j = (n * n / 2); j; j--)
    printf("%d %d\n", (n * n / 2) - j + 1, (n * n / 2) + j);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11a0 <main+0x80>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
add    -0xc(%rbp),%edx
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <main+0x31>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r14d
imul   %r14d,%r14d
cmp    $0x2,%r14d
jb     119e <main+0x7e>
shr    %r14d
mov    %r14d,%esi
sub    %r14d,%esi
add    $0x1,%esi
lea    (%r14,%r14,1),%edx
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    %r14d,%ebp
add    $0xffffffff,%ebp
je     119e <main+0x7e>
mov    $0x2,%ebx
sub    %r14d,%ebx
lea    0xe88(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%edx
imul   %edx,%edx
shr    %edx
lea    (%rbx,%rdx,1),%esi
add    %ebp,%edx
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%ebx
add    $0xffffffff,%ebp
jne    1180 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = mul nsw i32 %5, %6
%8 = sdiv i32 %7, 2
store i32 %8, i32* %3
br label %9
9: ; preds = %27, %0
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %30
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = mul nsw i32 %13, %14
%16 = sdiv i32 %15, 2
%17 = load i32, i32* %3
%18 = sub nsw i32 %16, %17
%19 = add nsw i32 %18, 1
%20 = load i32, i32* %2
%21 = load i32, i32* %2
%22 = mul nsw i32 %20, %21
%23 = sdiv i32 %22, 2
%24 = load i32, i32* %3
%25 = add nsw i32 %23, %24
%26 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %25)
br label %27
27: ; preds = %12
%28 = load i32, i32* %3
%29 = add nsw i32 %28, -1
store i32 %29, i32* %3
br label %9
30: ; preds = %9
%31 = load i32, i32* %1
ret i32 %31
}

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