// File: /workspace/github_cpp_makefile_star2_O1/cpirc[P]Monochrome/src/move.cpp
// Function: print_moves(Position const&)
void print_moves(const Position& pos) {
    SearchStack ss[1];
    clear_ss(ss, 1);

    int movecount;
    movecount = generate(pos, ss->ml);
    printf("Move count: %i\n", movecount);
    int i = 0;

    Move move;
    while ((move = next_move(ss, movecount))) {
        Position npos = pos;

        make_move(npos, move);
        if (is_checked(npos, THEM)) {
            continue;
        }

        if (pos.flipped) {
            move = flip_move(move);
        }

        std::string mtypestr = "";
        switch (move_type(move)) {
            case NORMAL:
                mtypestr = "normal";
                break;
            case CAPTURE:
                mtypestr = "capture";
                break;
            case CASTLE:
                mtypestr = "castle";
                break;
            case ENPASSANT:
                mtypestr = "enpassant";
                break;
            case PROMOTION:
                mtypestr = "promotion";
                break;
            case DOUBLE_PUSH:
                mtypestr = "double pawn";
                break;
            case PROM_CAPTURE:
                mtypestr = "promotion capture";
                break;
            default:
                mtypestr = "ERROR";
                break;
        }

        char mstr[6];
        move_to_lan(mstr, move);
        printf(
            "%i)  %s  (3-fold: %i)  (50-moves: %i)  (Check: %i)  (Type: %s)\n",
            i + 1, mstr, is_threefold(npos), is_fifty_moves(npos),
            is_checked(npos, US), mtypestr.c_str());
        i++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x8d8, %rsp            # imm = 0x8D8
movq %rdi, %rbx
leaq -0x8f0(%rbp), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x7ed9
leaq -0x8ec(%rbp), %rsi
movq %rbx, -0x38(%rbp)
movq %rbx, %rdi
callq 0x608e
leaq -0x3c(%rbp), %r15
movl %eax, (%r15)
leaq 0x768a(%rip), %rdi      # 0xc903
movl %eax, %esi
xorl %eax, %eax
callq 0x3040
movq %r14, %rdi
movq %r15, %rsi
callq 0x7b5f
testl %eax, %eax
je 0x562d
movl %eax, %r15d
leaq -0x80(%rbp), %r14
movq -0x38(%rbp), %rax
leaq 0x50(%rax), %r13
leaq -0xd0(%rbp), %r12
leaq -0x8f0(%rbp), %rbx
movl $0x0, -0x2c(%rbp)
movl $0xa, %ecx
movq %r12, %rdi
movq -0x38(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movq %r13, %rsi
callq 0x5692
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ac0
movq -0xa8(%rbp), %rax
movq -0x98(%rbp), %rcx
andq %rax, %rcx
je 0x563f
bsfq %rcx, %rsi
movq -0xa0(%rbp), %rcx
movq -0x98(%rbp), %rdi
orq %rcx, %rdi
leal (,%rsi,8), %edx
movq -0xd0(%rbp), %r9
movq -0xc8(%rbp), %r8
leaq 0xbe9a(%rip), %r10      # 0x111c0
andq 0x200(%r10,%rdx), %r9
leaq 0xc28b(%rip), %r10      # 0x115c0
andq (%r10,%rdx), %r8
leaq 0x7160(%rip), %r10      # 0xc4a0
movq (%r10,%rdx), %r10
andq %rdi, %r10
leaq 0x6f52(%rip), %r11      # 0xc2a0
imulq (%r11,%rdx), %r10
orq %r9, %r8
shrq $0x37, %r10
movl %esi, %r9d
shll $0xc, %r9d
addq 0xbc48(%rip), %r9       # 0x10fb0
movq (%r9,%r10,8), %r9
movq -0xc0(%rbp), %r10
andq %r9, %r10
leaq 0x6c23(%rip), %r11      # 0xbfa0
andq (%r11,%rdx), %rdi
leaq 0x6a18(%rip), %r11      # 0xbda0
imulq (%r11,%rdx), %rdi
orq %r8, %r10
shrq $0x34, %rdi
shll $0xf, %esi
addq 0xbbfa(%rip), %rsi      # 0x10f98
movq (%rsi,%rdi,8), %rsi
movq -0xb8(%rbp), %rdi
andq %rsi, %rdi
orq %r10, %rdi
orq %r9, %rsi
leaq 0xc407(%rip), %r8       # 0x117c0
andq (%r8,%rdx), %rax
orq %rdi, %rax
andq -0xb0(%rbp), %rsi
orq %rsi, %rax
testq %rcx, %rax
jne 0x5608
movq %r13, %rbx
movq %r14, %r13
movl %r15d, %r14d
andl $0x3ffff, %r14d         # imm = 0x3FFFF
xorl $0xe38, %r14d           # imm = 0xE38
movq -0x38(%rbp), %rax
cmpb $0x0, 0x41(%rax)
cmovel %r15d, %r14d
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x68(%rbp), %r15
movq %r15, %rdi
leaq 0x7586(%rip), %rdx      # 0xc992
movq %rdx, %rsi
callq 0x5730
movl %r14d, %eax
shrl $0xc, %eax
andl $0x7, %eax
movl $0x6, %r8d
leaq 0x73ea(%rip), %rcx      # 0xc814
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x74d9(%rip), %rcx      # 0xc913
jmp 0x549d
movl $0x9, %r8d
leaq 0x74e2(%rip), %rcx      # 0xc92b
jmp 0x549d
movl $0x7, %r8d
leaq 0x74f3(%rip), %rcx      # 0xc94b
jmp 0x549d
movl $0x9, %r8d
leaq 0x74ba(%rip), %rcx      # 0xc921
jmp 0x549d
movl $0x5, %r8d
leaq 0x7414(%rip), %rcx      # 0xc88a
jmp 0x549d
leaq 0x749b(%rip), %rcx      # 0xc91a
jmp 0x549d
movl $0xb, %r8d
leaq 0x74a7(%rip), %rcx      # 0xc935
jmp 0x549d
movl $0x11, %r8d
leaq 0x74a4(%rip), %rcx      # 0xc941
movq -0x60(%rbp), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x3270
leaq -0x42(%rbp), %rdi
movl %r14d, %esi
callq 0x4ee6
movq %r12, %r15
movq %r12, %rdi
xorl %esi, %esi
callq 0x762f
movl %eax, %r14d
movq %r15, %rdi
callq 0x7681
movq -0xa8(%rbp), %rcx
movq -0xa0(%rbp), %rsi
movq %rsi, %rdx
andq %rcx, %rdx
je 0x563f
bsfq %rdx, %r8
movq -0x98(%rbp), %rdx
orq %rdx, %rsi
leal (,%r8,8), %edi
movq -0xd0(%rbp), %r9
movq -0xc8(%rbp), %r10
leaq 0xbcac(%rip), %r11      # 0x111c0
andq (%r11,%rdi), %r9
leaq 0xc0a1(%rip), %r11      # 0x115c0
andq (%r11,%rdi), %r10
orq %r9, %r10
leaq 0x6f73(%rip), %r9       # 0xc4a0
movq (%r9,%rdi), %r9
andq %rsi, %r9
leaq 0x6d65(%rip), %r11      # 0xc2a0
imulq (%r11,%rdi), %r9
shrq $0x37, %r9
movl %r8d, %r11d
shll $0xc, %r11d
addq 0xba5e(%rip), %r11      # 0x10fb0
movq (%r11,%r9,8), %r9
movq -0xc0(%rbp), %r11
andq %r9, %r11
leaq 0x6a39(%rip), %r15      # 0xbfa0
andq (%r15,%rdi), %rsi
orq %r10, %r11
leaq 0x682b(%rip), %r10      # 0xbda0
imulq (%r10,%rdi), %rsi
shrq $0x34, %rsi
shll $0xf, %r8d
addq 0xba0f(%rip), %r8       # 0x10f98
movq (%r8,%rsi,8), %r15
movq -0xb8(%rbp), %r8
andq %r15, %r8
orq %r11, %r8
leaq 0xc21f(%rip), %r10      # 0x117c0
andq (%r10,%rdi), %rcx
orq %r9, %r15
orq %r8, %rcx
andq -0xb0(%rbp), %r15
movl -0x2c(%rbp), %esi
incl %esi
orq %r15, %rcx
xorl %r9d, %r9d
testq %rdx, %rcx
movzbl %r14b, %ecx
setne %r9b
movzbl %al, %r8d
movq -0x68(%rbp), %rax
movq %rax, (%rsp)
leaq 0x7378(%rip), %rdi      # 0xc953
movl %esi, -0x2c(%rbp)
leaq -0x42(%rbp), %rdx
xorl %eax, %eax
callq 0x3040
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x55fb
callq 0x31a0
movq %r13, %r14
movq %rbx, %r13
leaq -0x8f0(%rbp), %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x5616
callq 0x31a0
movq %rbx, %rdi
leaq -0x3c(%rbp), %rsi
callq 0x7b5f
movl %eax, %r15d
testl %eax, %eax
jne 0x52b9
addq $0x8d8, %rsp            # imm = 0x8D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x660a(%rip), %rdi      # 0xbc50
leaq 0x6606(%rip), %rsi      # 0xbc53
leaq 0x660e(%rip), %rcx      # 0xbc62
movl $0x3e, %edx
callq 0x3100
jmp 0x5662
jmp 0x5679
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x567c
callq 0x31a0
jmp 0x567c
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x568a
callq 0x31a0
movq %rbx, %rdi
callq 0x32d0