// File: /workspace/github_cpp_makefile_star2_O3/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 $0x138, %rsp            # imm = 0x138
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 $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2140
movl %r14d, %ebx
imull %ebx, %ebx
xorps %xmm0, %xmm0
leaq -0x150(%rbp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq -0x58(%rbp), %rdi
leaq -0xa8(%rbp), %rcx
movq %rbx, %rsi
callq 0x2fec
movq %rbx, -0x30(%rbp)
movq -0x150(%rbp), %rdi
testq %rdi, %rdi
je 0x26c5
callq 0x21d0
movl %r14d, %ecx
xorl %r13d, %r13d
movq %rcx, -0x38(%rbp)
movq %r13, %rax
imulq %rcx, %rax
leaq (%rax,%rax,2), %rax
movq %rax, -0x40(%rbp)
xorl %r12d, %r12d
leaq (%r12,%r12,2), %r15
shlq $0x3, %r15
xorl %ebx, %ebx
leaq 0x691e(%rip), %rax      # 0x9010
movl (%rbx,%rax), %eax
addl %r13d, %eax
js 0x275a
leaq 0x691f(%rip), %rcx      # 0x9020
movl (%rbx,%rcx), %ecx
addl %r12d, %ecx
cmpl %r14d, %eax
setl %dl
cmpl %r14d, %ecx
setb %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x275a
movq -0x58(%rbp), %rdx
addq %r15, %rdx
movq -0x40(%rbp), %rsi
leaq (%rdx,%rsi,8), %rdi
imull %r14d, %eax
addl %ecx, %eax
movl %eax, -0x150(%rbp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x274e
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x275a
leaq -0x150(%rbp), %rdx
callq 0x33fc
addq $0x4, %rbx
cmpq $0x10, %rbx
jne 0x26eb
incq %r12
movq -0x38(%rbp), %rcx
cmpq %rcx, %r12
jne 0x26e1
incq %r13
cmpq %rcx, %r13
jne 0x26cf
leaq -0x150(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x39c8
movq -0x30(%rbp), %rdx
decl %edx
xorl %eax, %eax
leaq -0x90(%rbp), %r9
movq %rax, 0x10(%r9)
xorps %xmm0, %xmm0
movaps %xmm0, (%r9)
leaq -0x70(%rbp), %rcx
movq %rax, 0x10(%rcx)
movaps %xmm0, (%rcx)
movq %rcx, (%rsp)
leaq -0x150(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x6662
leaq -0xa8(%rbp), %rdi
movq %rax, %rsi
callq 0x3086
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x27ec
callq 0x21d0
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x27fd
callq 0x21d0
leaq -0xa8(%rbp), %rbx
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %esi # imm = 0xAAAAAAAB
leaq 0x6814(%rip), %rdi      # 0x9030
xorl %eax, %eax
callq 0x2040
movq %rbx, %rdi
callq 0x3122
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0x283c
callq 0x21d0
leaq -0xd8(%rbp), %rbx
movq %rbx, %rdi
callq 0x3122
movq -0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x287c
callq 0x21d0
xorl %eax, %eax
movq %rax, -0x100(%rbp)
movl %eax, -0xf8(%rbp)
movq %rax, -0xf0(%rbp)
movl %eax, -0xe8(%rbp)
movq %rax, -0xe0(%rbp)
leaq -0x118(%rbp), %rbx
movq %rbx, %rdi
callq 0x3122
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x2899
callq 0x21d0
movq -0x148(%rbp), %rdi
testq %rdi, %rdi
je 0x28aa
callq 0x21d0
leaq -0x58(%rbp), %rdi
callq 0x3122
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x290d
movq %rax, %rbx
movq -0x150(%rbp), %rdi
testq %rdi, %rdi
je 0x2919
callq 0x21d0
jmp 0x2919
movq %rax, %rbx
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x28ee
callq 0x21d0
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x28ff
callq 0x21d0
leaq -0x150(%rbp), %rdi
callq 0x3176
jmp 0x2910
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3122
movq %rbx, %rdi
callq 0x2380