#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*/ approx(int, int *, int *);
int /*<<< orphan*/ exact(int, int *, int *);
int /*<<< orphan*/ fill_dist(int, int *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int dist[n * n];
  fill_dist(n, dist);
  int path[n];
  if (n > 20)
    approx(n, path, dist);
  else
    exact(n, path, dist);
  for (int i = 0; i < n; i++)
    printf("%d\n", path[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x38(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <fill_dist@plt>
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
cmpl   $0x14,-0x8(%rbp)
jle    11e0 <main+0x90>
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%edi
call   1030 <approx@plt>
jmp    11f0 <main+0xa0>
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%edi
call   1070 <exact@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1228 <main+0xd8>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdee(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11f7 <main+0xa7>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe9a(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1060 <scanf@plt>
mov    %rsp,%r15
mov    -0x24(%rbp),%eax
imul   %eax,%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    -0x24(%rbp),%edi
mov    %r14,%rsi
call   1050 <fill_dist@plt>
mov    -0x24(%rbp),%edi
mov    %rsp,%r12
lea    0xf(,%rdi,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
cmp    $0x15,%edi
jl     11c8 <main+0x78>
mov    %r12,%rsi
mov    %r14,%rdx
call   1030 <approx@plt>
cmpl   $0x0,-0x24(%rbp)
jg     11d9 <main+0x89>
jmp    1209 <main+0xb9>
mov    %r12,%rsi
mov    %r14,%rdx
call   1070 <exact@plt>
cmpl   $0x0,-0x24(%rbp)
jle    1209 <main+0xb9>
xor    %ebx,%ebx
lea    0xe21(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
movslq -0x24(%rbp),%rax
cmp    %rax,%rbx
jl     11f0 <main+0xa0>
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%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\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = mul nsw i32 %8, %9
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %3
%13 = alloca i32, i64 %11
store i64 %11, i64* %4
%14 = load i32, i32* %2
%15 = call i32 @fill_dist(i32 %14, i32* %13)
%16 = load i32, i32* %2
%17 = zext i32 %16 to i64
%18 = alloca i32, i64 %17
store i64 %17, i64* %5
%19 = load i32, i32* %2
%20 = icmp sgt i32 %19, 20
br i1 %20, label %21, label %24
21: ; preds = %0
%22 = load i32, i32* %2
%23 = call i32 @approx(i32 %22, i32* %18, i32* %13)
br label %27
24: ; preds = %0
%25 = load i32, i32* %2
%26 = call i32 @exact(i32 %25, i32* %18, i32* %13)
br label %27
27: ; preds = %24, %21
store i32 0, i32* %6
br label %28
28: ; preds = %38, %27
%29 = load i32, i32* %6
%30 = load i32, i32* %2
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %18, i64 %34
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %28
41: ; preds = %28
store i32 0, i32* %1
%42 = load i8*, i8** %3
%43 = load i32, i32* %1
ret i32 %43
}

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