// File: /workspace/github_cpp_makefile_star2_O1/cauimsouza[P]rikudo-solver/src/rikudo_solver/main.cpp
// Function: count_path_between_corners(int)
void count_path_between_corners(int n){
    if(n <= 2){
        std::cout << n << std::endl;
        return;
    }

    std::vector<std::vector<int>> adj_list(n*n, std::vector<int>());

    int di[] = {1,0,-1,0};
    int dj[] = {0,1,0,-1};
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            for(int k = 0; k < 4; k++) {
                int ii = i + di[k];
                int jj = j + dj[k];
                if (ii >= 0 && ii < n && jj >= 0 && jj < n)
                    adj_list[ i*n+j ].push_back( ii*n+jj );
            }

    Graph graph(adj_list);
    auto paths = graph.ham_path(0, n*n-1);
    printf("Number of paths: %d\n", (int) paths.size());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %edi, %r14d
cmpl $0x2, %edi
jg 0x2682
movq 0xa991(%rip), %rdi      # 0xcfd0
movl %r14d, %esi
callq 0x2370
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2140
movl %r14d, %ebx
imull %ebx, %ebx
xorps %xmm0, %xmm0
leaq -0x160(%rbp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq -0x60(%rbp), %rdi
leaq -0xb8(%rbp), %rcx
movq %rbx, %rsi
callq 0x3000
movq %rbx, -0x38(%rbp)
movq -0x160(%rbp), %rdi
testq %rdi, %rdi
je 0x26c5
callq 0x21d0
cmpl $0x2, %r14d
movl $0x1, %eax
cmovgel %r14d, %eax
movq %rax, -0x30(%rbp)
movl %r14d, %eax
movq %rax, -0x40(%rbp)
xorl %ebx, %ebx
movq %rbx, %rax
imulq -0x40(%rbp), %rax
leaq (%rax,%rax,2), %rax
movq %rax, -0x48(%rbp)
xorl %r12d, %r12d
leaq (%r12,%r12,2), %r15
shlq $0x3, %r15
xorl %r13d, %r13d
leaq 0x690c(%rip), %rax      # 0x9010
movl (%r13,%rax), %eax
addl %ebx, %eax
js 0x276f
leaq 0x690c(%rip), %rcx      # 0x9020
movl (%r13,%rcx), %ecx
addl %r12d, %ecx
cmpl %r14d, %eax
setl %dl
cmpl %r14d, %ecx
setb %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x276f
movq -0x60(%rbp), %rdx
addq %r15, %rdx
movq -0x48(%rbp), %rsi
leaq (%rdx,%rsi,8), %rdi
imull %r14d, %eax
addl %ecx, %eax
movl %eax, -0x160(%rbp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x2763
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x276f
leaq -0x160(%rbp), %rdx
callq 0x3402
addq $0x4, %r13
cmpq $0x10, %r13
jne 0x26fd
incq %r12
cmpq -0x30(%rbp), %r12
jne 0x26f2
incq %rbx
cmpq -0x30(%rbp), %rbx
jne 0x26df
leaq -0x160(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x3a42
movq -0x38(%rbp), %rdx
decl %edx
xorl %eax, %eax
leaq -0xa0(%rbp), %r9
movq %rax, 0x10(%r9)
xorps %xmm0, %xmm0
movaps %xmm0, (%r9)
leaq -0x80(%rbp), %rcx
movq %rax, 0x10(%rcx)
movaps %xmm0, (%rcx)
movq %rcx, (%rsp)
leaq -0x160(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x6730
leaq -0xb8(%rbp), %rdi
movq %rax, %rsi
callq 0x309a
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x27ff
callq 0x21d0
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x2810
callq 0x21d0
leaq -0xb8(%rbp), %rbx
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %esi # imm = 0xAAAAAAAB
leaq 0x6801(%rip), %rdi      # 0x9030
xorl %eax, %eax
callq 0x2040
movq %rbx, %rdi
callq 0x3136
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0x284f
callq 0x21d0
leaq -0xe8(%rbp), %rbx
movq %rbx, %rdi
callq 0x3136
movq -0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x288f
callq 0x21d0
xorl %eax, %eax
movq %rax, -0x110(%rbp)
movl %eax, -0x108(%rbp)
movq %rax, -0x100(%rbp)
movl %eax, -0xf8(%rbp)
movq %rax, -0xf0(%rbp)
leaq -0x128(%rbp), %rbx
movq %rbx, %rdi
callq 0x3136
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x28ac
callq 0x21d0
movq -0x158(%rbp), %rdi
testq %rdi, %rdi
je 0x28bd
callq 0x21d0
leaq -0x60(%rbp), %rdi
callq 0x3136
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2920
movq %rax, %rbx
movq -0x160(%rbp), %rdi
testq %rdi, %rdi
je 0x292c
callq 0x21d0
jmp 0x292c
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x2901
callq 0x21d0
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x2912
callq 0x21d0
leaq -0x160(%rbp), %rdi
callq 0x3180
jmp 0x2923
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x3136
movq %rbx, %rdi
callq 0x2380