// File: /workspace/github_cpp_makefile_star2_O1/SethKasmann[P]clever-girl/src/move_generator.cpp
// Function: void MoveList::pushPromotion<(MoveType)2>(Square, Square)
void MoveList::pushPromotion(Square src, Square dst)
{
    const Color C = mState.getOurColor();
    if (square_bb[dst] & Not_a_file && square_bb[dst+1] & mState.getOccupancyBB(!C))
    {
        if (T == MoveType::Attacks || T == MoveType::All)
            push(makeMove(src, dst+1, queen));

        if (T == MoveType::Quiets || T == MoveType::All)
        {
            push(makeMove(src, dst+1, knight));
            push(makeMove(src, dst+1, rook));
            push(makeMove(src, dst+1, bishop));
        }

        if (T == MoveType::Evasions)
        {
            if (square_bb[dst+1] & mValid)
            {
                push(makeMove(src, dst+1, queen));
                push(makeMove(src, dst+1, knight));
                push(makeMove(src, dst+1, rook));
                push(makeMove(src, dst+1, bishop));
            }
        }

        if (T == MoveType::QuietChecks)
        {
            if (mState.getCheckSquaresBB(knight) & square_bb[dst+1])
                push(makeMove(src, dst+1, knight));
        }
    }

    if (square_bb[dst] & Not_h_file && square_bb[dst-1] & mState.getOccupancyBB(!C))
    {
        if (T == MoveType::Attacks || T == MoveType::All)
            push(makeMove(src, dst-1, queen));

        if (T == MoveType::Quiets || T == MoveType::All)
        {
            push(makeMove(src, dst-1, knight));
            push(makeMove(src, dst-1, rook));
            push(makeMove(src, dst-1, bishop));
        }

        if (T == MoveType::Evasions)
        {
            if (square_bb[dst-1] & mValid)
            {
                push(makeMove(src, dst-1, queen));
                push(makeMove(src, dst-1, knight));
                push(makeMove(src, dst-1, rook));
                push(makeMove(src, dst-1, bishop));
            }
        }

        if (T == MoveType::QuietChecks)
        {
            if (mState.getCheckSquaresBB(knight) & square_bb[dst-1])
                push(makeMove(src, dst-1, knight));
        }
    }

    if (square_bb[dst] & mState.getEmptyBB())
    {
        if (T == MoveType::Attacks || T == MoveType::All)
            push(makeMove(src, dst, queen));

        if (T == MoveType::Quiets || T == MoveType::All)
        {
            push(makeMove(src, dst, knight));
            push(makeMove(src, dst, rook));
            push(makeMove(src, dst, bishop));
        }

        if (T == MoveType::Evasions)
        {
            if (square_bb[dst] & mValid)
            {
                push(makeMove(src, dst, queen));
                push(makeMove(src, dst, knight));
                push(makeMove(src, dst, rook));
                push(makeMove(src, dst, bishop));
            }
        }

        if (T == MoveType::QuietChecks)
        {
            if (mState.getCheckSquaresBB(knight) & square_bb[dst])
                push(makeMove(src, dst, knight));
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
movq 0x18(%rdi), %rcx
movl (%rcx), %r8d
movl %edx, %eax
leaq 0xe7089(%rip), %r9      # 0xf8a70
movq (%r9,%rax,8), %rax
movabsq $0x7f7f7f7f7f7f7f7f, %r10 # imm = 0x7F7F7F7F7F7F7F7F
testq %r10, %rax
je 0x11a92
leal 0x1(%rdx), %r10d
movq (%r9,%r10,8), %r11
xorl %ebx, %ebx
testl %r8d, %r8d
sete %bl
testq %r11, 0x78(%rcx,%rbx,8)
je 0x11a92
testq %r11, 0x8(%rdi)
je 0x11a92
shll $0x6, %r10d
orl %esi, %r10d
movl %r10d, %r11d
orl $0x4000, %r11d          # imm = 0x4000
movq 0x848(%rdi), %rbx
leaq 0x1(%rbx), %r14
movq %r14, 0x848(%rdi)
movw %r11w, 0x30(%rdi,%rbx,8)
movl %r10d, %r11d
orl $0x1000, %r11d          # imm = 0x1000
leaq 0x2(%rbx), %r14
movq %r14, 0x848(%rdi)
movw %r11w, 0x38(%rdi,%rbx,8)
movl %r10d, %r11d
orl $0x3000, %r11d          # imm = 0x3000
leaq 0x3(%rbx), %r14
movq %r14, 0x848(%rdi)
movw %r11w, 0x40(%rdi,%rbx,8)
orl $0x2000, %r10d          # imm = 0x2000
leaq 0x4(%rbx), %r11
movq %r11, 0x848(%rdi)
movw %r10w, 0x48(%rdi,%rbx,8)
movabsq $-0x101010101010102, %r10 # imm = 0xFEFEFEFEFEFEFEFE
testq %r10, %rax
je 0x11b3b
leal -0x1(%rdx), %r10d
movq (%r9,%r10,8), %r9
xorl %r11d, %r11d
testl %r8d, %r8d
sete %r11b
testq %r9, 0x78(%rcx,%r11,8)
je 0x11b3b
testq %r9, 0x8(%rdi)
je 0x11b3b
shll $0x6, %r10d
orl %esi, %r10d
movl %r10d, %r8d
orl $0x4000, %r8d           # imm = 0x4000
movq 0x848(%rdi), %r9
leaq 0x1(%r9), %r11
movq %r11, 0x848(%rdi)
movw %r8w, 0x30(%rdi,%r9,8)
movl %r10d, %r8d
orl $0x1000, %r8d           # imm = 0x1000
leaq 0x2(%r9), %r11
movq %r11, 0x848(%rdi)
movw %r8w, 0x38(%rdi,%r9,8)
movl %r10d, %r8d
orl $0x3000, %r8d           # imm = 0x3000
leaq 0x3(%r9), %r11
movq %r11, 0x848(%rdi)
movw %r8w, 0x40(%rdi,%r9,8)
orl $0x2000, %r10d          # imm = 0x2000
leaq 0x4(%r9), %r8
movq %r8, 0x848(%rdi)
movw %r10w, 0x48(%rdi,%r9,8)
movq 0x80(%rcx), %r8
orq 0x78(%rcx), %r8
notq %r8
testq %r8, %rax
je 0x11bbb
testq %rax, 0x8(%rdi)
je 0x11bbb
shll $0x6, %edx
orl %esi, %edx
movl %edx, %eax
orl $0x4000, %eax           # imm = 0x4000
movq 0x848(%rdi), %rcx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x848(%rdi)
movw %ax, 0x30(%rdi,%rcx,8)
movl %edx, %eax
orl $0x1000, %eax           # imm = 0x1000
leaq 0x2(%rcx), %rsi
movq %rsi, 0x848(%rdi)
movw %ax, 0x38(%rdi,%rcx,8)
movl %edx, %eax
orl $0x3000, %eax           # imm = 0x3000
leaq 0x3(%rcx), %rsi
movq %rsi, 0x848(%rdi)
movw %ax, 0x40(%rdi,%rcx,8)
orl $0x2000, %edx           # imm = 0x2000
leaq 0x4(%rcx), %rax
movq %rax, 0x848(%rdi)
movw %dx, 0x48(%rdi,%rcx,8)
popq %rbx
popq %r14
retq
nop