// File: /workspace/github_cpp_makefile_star2_O1/cpirc[P]Monochrome/src/position.cpp
// Function: print_position(Position const&)
void print_position(const Position &pos) {
    Position npos = pos;
    if (pos.flipped) {
        flip_position(npos);
        calculate_key(npos);
    }

    int sq = A8;
    while (sq >= 0) {
        Piece piece = get_piece_on_square(npos, (std::uint64_t)1 << sq);
        bool white = ((std::uint64_t)1 << sq) & get_colour(npos, US);

        if (white)
            printf("%c", Piece_ASCII[piece]);
        else
            printf("%c", tolower(Piece_ASCII[piece]));

        if (sq % 8 == 7) {
            printf("\n");
            sq -= 16;
        }
        sq++;
    }

    printf("Flipped: %i\n", pos.flipped);
    printf("Eval: %i\n", evaluate(npos));
    printf("Hash: %" PRIx64 "\n", pos.hash_key);
    printf("Halfmoves: %i\n", pos.halfmoves);
    printf("History: %" PRIu64 "\n", pos.history.size());
    for (auto &i : pos.history) {
        printf("  %" PRIx64 "\n", i);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
leaq -0x88(%rbp), %rdi
movl $0xa, %ecx
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq -0x38(%rbp), %rdi
leaq 0x50(%rbx), %rsi
callq 0x5692
cmpb $0x1, 0x41(%rbx)
jne 0x747d
movq $-0x8, %rax
movq -0x80(%rbp,%rax), %rcx
bswapq %rcx
movq %rcx, -0x80(%rbp,%rax)
addq $0x8, %rax
cmpq $0x28, %rax
jb 0x7409
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rax, -0x50(%rbp)
movq %rcx, -0x58(%rbp)
movl $0x28, %eax
movq -0x80(%rbp,%rax), %rcx
bswapq %rcx
movq %rcx, -0x80(%rbp,%rax)
addq $0x8, %rax
cmpq $0x38, %rax
jb 0x7435
movb -0x46(%rbp), %al
cmpb $0x40, %al
je 0x7458
xorb $0x38, %al
movb %al, -0x46(%rbp)
leaq -0x88(%rbp), %rdi
movb 0x40(%rdi), %al
leal (,%rax,4), %ecx
andb $0xc, %cl
shrb $0x2, %al
xorb %cl, %al
movb %al, 0x40(%rdi)
xorb $0x1, 0x41(%rdi)
callq 0x6c3a
movl $0x38, %r14d
movl $0x4, %r15d
leaq 0x5858(%rip), %r12      # 0xcce8
movl $0x1, %eax
movl %r14d, %ecx
shlq %cl, %rax
movq -0x88(%rbp), %rcx
btq %r14, %rcx
jae 0x74ac
xorl %ecx, %ecx
jmp 0x74e9
movl $0x1, %ecx
testq %rax, -0x80(%rbp)
jne 0x74e9
movl $0x2, %ecx
testq %rax, -0x78(%rbp)
jne 0x74e9
movl $0x3, %ecx
testq %rax, -0x70(%rbp)
jne 0x74e9
movq -0x60(%rbp), %rcx
andq %rax, %rcx
cmpq $0x1, %rcx
movl $0x0, %ecx
adcq $0x5, %rcx
testq %rax, -0x68(%rbp)
cmovneq %r15, %rcx
movsbl (%rcx,%r12), %edi
testq %rax, -0x58(%rbp)
jne 0x74fb
callq 0x3240
movl %eax, %edi
callq 0x3220
movl %r14d, %eax
notl %eax
testb $0x7, %al
jne 0x7517
movl $0xa, %edi
callq 0x3220
addl $-0x10, %r14d
leal 0x1(%r14), %eax
cmpl $-0x2, %r14d
movl %eax, %r14d
jg 0x7490
movzbl 0x41(%rbx), %esi
leaq 0x5935(%rip), %rdi      # 0xce68
xorl %eax, %eax
callq 0x3040
leaq -0x88(%rbp), %rdi
callq 0x3bbb
leaq 0x5928(%rip), %rdi      # 0xce75
movl %eax, %esi
xorl %eax, %eax
callq 0x3040
movq 0x48(%rbx), %rsi
leaq 0x591e(%rip), %rdi      # 0xce7f
xorl %eax, %eax
callq 0x3040
movzbl 0x43(%rbx), %esi
leaq 0x5917(%rip), %rdi      # 0xce8a
xorl %eax, %eax
callq 0x3040
movq 0x58(%rbx), %rsi
subq 0x50(%rbx), %rsi
sarq $0x3, %rsi
leaq 0x590c(%rip), %rdi      # 0xce99
xorl %eax, %eax
callq 0x3040
movq 0x50(%rbx), %r14
movq 0x58(%rbx), %r15
cmpq %r15, %r14
je 0x75be
leaq 0x58ff(%rip), %rbx      # 0xcea7
movq (%r14), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3040
addq $0x8, %r14
cmpq %r15, %r14
jne 0x75a8
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x75cc
callq 0x31a0
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x75ea
callq 0x31a0
movq %rbx, %rdi
callq 0x32d0