// File: /workspace/github_cpp_makefile_star2_O3/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 0x5300
cmpb $0x1, 0x41(%rbx)
jne 0x71e9
movq $-0x8, %rax
movq -0x80(%rbp,%rax), %rcx
bswapq %rcx
movq %rcx, -0x80(%rbp,%rax)
addq $0x8, %rax
cmpq $0x28, %rax
jb 0x7175
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 0x71a1
movb -0x46(%rbp), %al
cmpb $0x40, %al
je 0x71c4
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 0x6952
movl $0x38, %r14d
movl $0x4, %r15d
leaq 0x5a2c(%rip), %r12      # 0xcc28
movl $0x1, %eax
movl %r14d, %ecx
shlq %cl, %rax
movq -0x88(%rbp), %rcx
btq %r14, %rcx
jae 0x7218
xorl %ecx, %ecx
jmp 0x7255
movl $0x1, %ecx
testq %rax, -0x80(%rbp)
jne 0x7255
movl $0x2, %ecx
testq %rax, -0x78(%rbp)
jne 0x7255
movl $0x3, %ecx
testq %rax, -0x70(%rbp)
jne 0x7255
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 0x7267
callq 0x3240
movl %eax, %edi
callq 0x3220
movl %r14d, %eax
notl %eax
testb $0x7, %al
jne 0x7283
movl $0xa, %edi
callq 0x3220
addl $-0x10, %r14d
leal 0x1(%r14), %eax
cmpl $-0x2, %r14d
movl %eax, %r14d
jg 0x71fc
movzbl 0x41(%rbx), %esi
leaq 0x5b09(%rip), %rdi      # 0xcda8
xorl %eax, %eax
callq 0x3040
leaq -0x88(%rbp), %rdi
callq 0x395b
leaq 0x5afc(%rip), %rdi      # 0xcdb5
movl %eax, %esi
xorl %eax, %eax
callq 0x3040
movq 0x48(%rbx), %rsi
leaq 0x5af2(%rip), %rdi      # 0xcdbf
xorl %eax, %eax
callq 0x3040
movzbl 0x43(%rbx), %esi
leaq 0x5aeb(%rip), %rdi      # 0xcdca
xorl %eax, %eax
callq 0x3040
movq 0x58(%rbx), %rsi
subq 0x50(%rbx), %rsi
sarq $0x3, %rsi
leaq 0x5ae0(%rip), %rdi      # 0xcdd9
xorl %eax, %eax
callq 0x3040
movq 0x50(%rbx), %r14
movq 0x58(%rbx), %r15
cmpq %r15, %r14
je 0x732a
leaq 0x5ad3(%rip), %rbx      # 0xcde7
movq (%r14), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3040
addq $0x8, %r14
cmpq %r15, %r14
jne 0x7314
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x7338
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 0x7356
callq 0x31a0
movq %rbx, %rdi
callq 0x32d0