// File: SethKasmann[P]clever-girl/src/evaluation.cpp
// Function: Evaluate::evalPieces(Color)
void Evaluate::evalPieces(const Color c)
{
    U64 moves, pins;
    U64 mobilityNet;
    int king_threats = 0;
    U64 bottomRank = c == white ? Rank_1 : Rank_8;
    Square kingSq = mState.getKingSquare(c);

    // The mobilityNet is all empty squares not attacked by enemy pawns.
    mobilityNet = mState.getEmptyBB();
    if (c == white)
        mobilityNet &= ~((mState.getPieceBB<pawn>(black) & Not_a_file) >> 7
                       | (mState.getPieceBB<pawn>(black) & Not_h_file) >> 9);
    else
        mobilityNet &= ~((mState.getPieceBB<pawn>(white) & Not_a_file) << 9
                       | (mState.getPieceBB<pawn>(white) & Not_h_file) << 7);

    // Get the pinned pieces for the current player.
    pins = mState.getPinsBB(c);

    // Knight evaluation.
    for (Square p : mState.getPieceList<knight>(c))
    {
        if (p == no_sq)
            break;
        mMaterial[c] += Knight_wt;
        mMaterial[c] += outpost<knight>(p, c);

        if (square_bb[p] & pins)
        {
            mMobility[c] += knightMobility[0];
            continue;
        }

        moves = mState.getAttackBB<knight>(p);
        mPieceAttacksBB[c][knight] |= moves & mState.getOccupancyBB();
        mAllAttacksBB[c] |= mPieceAttacksBB[c][knight];

        mMobility[c] += knightMobility[pop_count(moves & mobilityNet)];

        if (moves & king_net_bb[!c][mState.getKingSquare(!c)] & mobilityNet)
            king_threats += Knight_th;
    }

    // Bishop evaluation.
    for (Square p : mState.getPieceList<bishop>(c))
    {
        if (p == no_sq)
            break;
        mMaterial[c] += Bishop_wt;
        mMaterial[c] += outpost<bishop>(p, c);

        moves = mState.getAttackBB<bishop>(p);

        if (square_bb[p] & pins)
            moves &= coplanar[p][kingSq];

        mPieceAttacksBB[c][bishop] = moves & mState.getOccupancyBB();
        mAllAttacksBB[c] |= mPieceAttacksBB[c][bishop];

        if (moves & king_net_bb[!c][mState.getKingSquare(!c)] & mobilityNet)
            king_threats += Bishop_th;

        mMobility[c] += bishopMobility[pop_count(moves & mobilityNet)];

        // Check for a bad bishop (penalty for pawns on the same square);
        mMaterial[c] += BadBishop * 
            pop_count(squares_of_color(p) & mState.getPieceBB<pawn>(c));
    }

    // Rook evaluation.
    for (Square p : mState.getPieceList<rook>(c))
    {
        if (p == no_sq)
            break;
        mMaterial[c] += Rook_wt;

        moves = mState.getAttackBB<rook>(p);
        if (square_bb[p] & pins)
            moves &= coplanar[p][kingSq];

        mPieceAttacksBB[c][rook] = moves & mState.getOccupancyBB();
        mAllAttacksBB[c] |= mPieceAttacksBB[c][rook];

        if (moves & king_net_bb[!c][mState.getKingSquare(!c)] & mobilityNet)
            king_threats += Rook_th;

        mMobility[c] += rookMobility[pop_count(moves & mobilityNet)];

        // Check if the rook is trapped.
        // TODO: more testing to confirm this is working propertly.
        if (mState.getPieceBB<king>(c) & bottomRank 
            && square_bb[p] & bottomRank)
        {
            if ((kingSq > p && !mState.canCastleKingside(c) &&
                square_bb[kingSq] & Rightside) ||
                (kingSq < p && !mState.canCastleQueenside(c) &&
                square_bb[kingSq] & Leftside)) 
            {
                if (pop_count(moves & mobilityNet & ~(bottomRank)) <= 3)
                    mMaterial[c] += TrappedRook;
            }
        }
    }

    // Queen evaluation.
    for (Square p : mState.getPieceList<queen>(c))
    {
        if (p == no_sq)
            break;
        mMaterial[c] += Queen_wt;
        moves = mState.getAttackBB<queen>(p);
        if (square_bb[p] & pins)
            moves &= coplanar[p][kingSq];

        mPieceAttacksBB[c][queen] = moves & mState.getOccupancyBB();
        mAllAttacksBB[c] |= mPieceAttacksBB[c][queen];

        if (moves & king_net_bb[!c][mState.getKingSquare(!c)] & mobilityNet)
            king_threats += Queen_th;

        // Calculate queen mobility.
        mMobility[c] += queenMobility[pop_count(moves & mobilityNet)];
    }

    // King evaluation.
    mKingSafety[!c] -= Safety_table[king_threats];
}

// Assembly:
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rdi, 0x1e0(%rsp)
movl %esi, 0x1dc(%rsp)
movq 0x1e0(%rsp), %rax
movq %rax, 0x120(%rsp)
movl $0x0, 0x1bc(%rsp)
movl 0x1dc(%rsp), %esi
movabsq $-0x100000000000000, %rcx # imm = 0xFF00000000000000
movl $0xff, %edx
cmpl $0x0, %esi
cmoveq %rdx, %rcx
movq %rcx, 0x1b0(%rsp)
movq 0x8(%rax), %rdi
movl 0x1dc(%rsp), %esi
callq 0x24ea0
movl %eax, %ecx
movq 0x120(%rsp), %rax
movl %ecx, 0x1ac(%rsp)
movq 0x8(%rax), %rdi
callq 0x24ef0
movq %rax, 0x1c0(%rsp)
cmpl $0x0, 0x1dc(%rsp)
jne 0x2271f
movq 0x120(%rsp), %rax
movq 0x8(%rax), %rdi
movl $0x1, %esi
callq 0x24b80
movq %rax, %rcx
movq 0x120(%rsp), %rax
movabsq $0x7f7f7f7f7f7f7f7f, %rdx # imm = 0x7F7F7F7F7F7F7F7F
andq %rdx, %rcx
shrq $0x7, %rcx
movq %rcx, 0x118(%rsp)
movq 0x8(%rax), %rdi
movl $0x1, %esi
callq 0x24b80
movq %rax, %rcx
movq 0x118(%rsp), %rax
movabsq $-0x101010101010102, %rdx # imm = 0xFEFEFEFEFEFEFEFE
andq %rdx, %rcx
shrq $0x9, %rcx
orq %rcx, %rax
xorq $-0x1, %rax
andq 0x1c0(%rsp), %rax
movq %rax, 0x1c0(%rsp)
jmp 0x22794
movq 0x120(%rsp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x24b80
movq %rax, %rcx
movq 0x120(%rsp), %rax
movabsq $0x7f7f7f7f7f7f7f7f, %rdx # imm = 0x7F7F7F7F7F7F7F7F
andq %rdx, %rcx
shlq $0x9, %rcx
movq %rcx, 0x110(%rsp)
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x24b80
movq %rax, %rcx
movq 0x110(%rsp), %rax
movabsq $-0x101010101010102, %rdx # imm = 0xFEFEFEFEFEFEFEFE
andq %rdx, %rcx
shlq $0x7, %rcx
orq %rcx, %rax
xorq $-0x1, %rax
andq 0x1c0(%rsp), %rax
movq %rax, 0x1c0(%rsp)
movq 0x120(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x1dc(%rsp), %esi
callq 0x24f40
movq %rax, %rcx
movq 0x120(%rsp), %rax
movq %rcx, 0x1c8(%rsp)
movq 0x8(%rax), %rdi
movl 0x1dc(%rsp), %esi
callq 0x24f70
movq %rax, 0x1a0(%rsp)
movq 0x1a0(%rsp), %rdi
callq 0x24dc0
movq %rax, 0x198(%rsp)
movq 0x1a0(%rsp), %rdi
callq 0x24dd0
movq %rax, 0x190(%rsp)
movq 0x198(%rsp), %rax
cmpq 0x190(%rsp), %rax
je 0x22af0
movq 0x198(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x18c(%rsp)
cmpl $0x40, 0x18c(%rsp)
jne 0x22837
jmp 0x22af0
movq 0x120(%rsp), %rdi
addq $0x2c, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movq 0x120(%rsp), %rdi
movl (%rax), %ecx
addl $0x12c, %ecx            # imm = 0x12C
movl %ecx, (%rax)
movl 0x18c(%rsp), %esi
movl 0x1dc(%rsp), %edx
callq 0x24fb0
movq 0x120(%rsp), %rdi
movl %eax, 0x10c(%rsp)
addq $0x2c, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl 0x10c(%rsp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movl 0x18c(%rsp), %eax
movl %eax, %ecx
leaq 0x13225e(%rip), %rax    # 0x154b10
movq (%rax,%rcx,8), %rax
andq 0x1c8(%rsp), %rax
cmpq $0x0, %rax
je 0x228fb
movq 0x120(%rsp), %rdi
movl 0x1e85e(%rip), %eax     # 0x41130
movl %eax, 0x108(%rsp)
addq $0x14, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl 0x108(%rsp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x22ad7
movq 0x120(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x18c(%rsp), %esi
xorl %edx, %edx
callq 0x25160
movq %rax, %rcx
movq 0x120(%rsp), %rax
movq %rcx, 0x1d0(%rsp)
movq 0x1d0(%rsp), %rcx
movq %rcx, 0xd0(%rsp)
movq 0x8(%rax), %rdi
callq 0x24bc0
movq 0x120(%rsp), %rdi
movq %rax, %rcx
movq 0xd0(%rsp), %rax
andq %rcx, %rax
movq %rax, 0xd8(%rsp)
addq $0x40, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c10
movq %rax, %rdi
movl $0x1, %esi
callq 0x24c40
movq 0xd8(%rsp), %rcx
movq 0x120(%rsp), %rdi
orq (%rax), %rcx
movq %rcx, (%rax)
addq $0x40, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c10
movq %rax, %rdi
movl $0x1, %esi
callq 0x24c40
movq 0x120(%rsp), %rdi
movq (%rax), %rax
movq %rax, 0xe0(%rsp)
addq $0xa0, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c70
movq 0xe0(%rsp), %rcx
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x1d0(%rsp), %rdi
andq 0x1c0(%rsp), %rdi
callq 0x24df0
movq 0x120(%rsp), %rdi
movslq %eax, %rcx
leaq 0x1e720(%rip), %rax     # 0x41130
movl (%rax,%rcx,4), %eax
movl %eax, 0xec(%rsp)
addq $0x14, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl 0xec(%rsp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movq 0x1d0(%rsp), %rax
movq %rax, 0x100(%rsp)
movl 0x1dc(%rsp), %edi
callq 0x24ce0
movl %eax, %ecx
movq 0x120(%rsp), %rax
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x1538a8(%rip), %rcx    # 0x176310
shlq $0x9, %rdx
addq %rdx, %rcx
movq %rcx, 0xf8(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0xf0(%rsp)
movl 0x1dc(%rsp), %edi
callq 0x24ce0
movq 0xf0(%rsp), %rdi
movl %eax, %esi
callq 0x24ea0
movq 0xf8(%rsp), %rcx
movl %eax, %edx
movq 0x100(%rsp), %rax
movl %edx, %edx
andq (%rcx,%rdx,8), %rax
andq 0x1c0(%rsp), %rax
cmpq $0x0, %rax
je 0x22ad5
movl 0x1bc(%rsp), %eax
addl $0x2, %eax
movl %eax, 0x1bc(%rsp)
jmp 0x22ad7
movq 0x198(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x198(%rsp)
jmp 0x22801
movq 0x120(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x1dc(%rsp), %esi
callq 0x25180
movq %rax, 0x180(%rsp)
movq 0x180(%rsp), %rdi
callq 0x24dc0
movq %rax, 0x178(%rsp)
movq 0x180(%rsp), %rdi
callq 0x24dd0
movq %rax, 0x170(%rsp)
movq 0x178(%rsp), %rax
cmpq 0x170(%rsp), %rax
je 0x22e90
movq 0x178(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x16c(%rsp)
cmpl $0x40, 0x16c(%rsp)
jne 0x22b70
jmp 0x22e90
movq 0x120(%rsp), %rdi
addq $0x2c, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movq 0x120(%rsp), %rdi
movl (%rax), %ecx
addl $0x12c, %ecx            # imm = 0x12C
movl %ecx, (%rax)
movl 0x16c(%rsp), %esi
movl 0x1dc(%rsp), %edx
callq 0x251c0
movq 0x120(%rsp), %rdi
movl %eax, 0xcc(%rsp)
addq $0x2c, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl 0xcc(%rsp), %edx
movq %rax, %rcx
movq 0x120(%rsp), %rax
addl (%rcx), %edx
movl %edx, (%rcx)
movq 0x8(%rax), %rdi
movl 0x16c(%rsp), %esi
xorl %edx, %edx
callq 0x25370
movq %rax, 0x1d0(%rsp)
movl 0x16c(%rsp), %eax
movl %eax, %ecx
leaq 0x131f00(%rip), %rax    # 0x154b10
movq (%rax,%rcx,8), %rax
andq 0x1c8(%rsp), %rax
cmpq $0x0, %rax
je 0x22c54
movl 0x16c(%rsp), %eax
movl %eax, %ecx
leaq 0x14b0de(%rip), %rax    # 0x16dd10
shlq $0x9, %rcx
addq %rcx, %rax
movl 0x1ac(%rsp), %ecx
movq (%rax,%rcx,8), %rax
andq 0x1d0(%rsp), %rax
movq %rax, 0x1d0(%rsp)
movq 0x120(%rsp), %rax
movq 0x1d0(%rsp), %rcx
movq %rcx, 0x98(%rsp)
movq 0x8(%rax), %rdi
callq 0x24bc0
movq 0x120(%rsp), %rdi
movq %rax, %rcx
movq 0x98(%rsp), %rax
andq %rcx, %rax
movq %rax, 0xa0(%rsp)
addq $0x40, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c10
movq %rax, %rdi
movl $0x2, %esi
callq 0x24c40
movq 0xa0(%rsp), %rcx
movq 0x120(%rsp), %rdi
movq %rcx, (%rax)
addq $0x40, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c10
movq %rax, %rdi
movl $0x2, %esi
callq 0x24c40
movq 0x120(%rsp), %rdi
movq (%rax), %rax
movq %rax, 0xa8(%rsp)
addq $0xa0, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c70
movq 0xa8(%rsp), %rcx
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x1d0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movl 0x1dc(%rsp), %edi
callq 0x24ce0
movl %eax, %ecx
movq 0x120(%rsp), %rax
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x1535c5(%rip), %rcx    # 0x176310
shlq $0x9, %rdx
addq %rdx, %rcx
movq %rcx, 0xb8(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0xb0(%rsp)
movl 0x1dc(%rsp), %edi
callq 0x24ce0
movq 0xb0(%rsp), %rdi
movl %eax, %esi
callq 0x24ea0
movq 0xb8(%rsp), %rcx
movl %eax, %edx
movq 0xc0(%rsp), %rax
movl %edx, %edx
andq (%rcx,%rdx,8), %rax
andq 0x1c0(%rsp), %rax
cmpq $0x0, %rax
je 0x22db8
movl 0x1bc(%rsp), %eax
addl $0x2, %eax
movl %eax, 0x1bc(%rsp)
movq 0x1d0(%rsp), %rdi
andq 0x1c0(%rsp), %rdi
callq 0x24df0
movq 0x120(%rsp), %rdi
movslq %eax, %rcx
leaq 0x1e381(%rip), %rax     # 0x41160
movl (%rax,%rcx,4), %eax
movl %eax, 0x84(%rsp)
addq $0x14, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl 0x84(%rsp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movl 0x16c(%rsp), %edi
callq 0x25400
movq %rax, %rcx
movq 0x120(%rsp), %rax
movq %rcx, 0x88(%rsp)
movq 0x8(%rax), %rdi
movl 0x1dc(%rsp), %esi
callq 0x24b80
movq 0x88(%rsp), %rdi
andq %rax, %rdi
callq 0x24df0
movq 0x120(%rsp), %rdi
imull $0xfffffffe, %eax, %eax # imm = 0xFFFFFFFE
movl %eax, 0x94(%rsp)
addq $0x2c, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl 0x94(%rsp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movq 0x178(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x178(%rsp)
jmp 0x22b3a
movq 0x120(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x1dc(%rsp), %esi
callq 0x25440
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rdi
callq 0x24dc0
movq %rax, 0x158(%rsp)
movq 0x160(%rsp), %rdi
callq 0x24dd0
movq %rax, 0x150(%rsp)
movq 0x158(%rsp), %rax
cmpq 0x150(%rsp), %rax
je 0x23295
movq 0x158(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x14c(%rsp)
cmpl $0x40, 0x14c(%rsp)
jne 0x22f10
jmp 0x23295
movq 0x120(%rsp), %rdi
addq $0x2c, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movq %rax, %rcx
movq 0x120(%rsp), %rax
movl (%rcx), %edx
addl $0x1f4, %edx            # imm = 0x1F4
movl %edx, (%rcx)
movq 0x8(%rax), %rdi
movl 0x14c(%rsp), %esi
xorl %edx, %edx
callq 0x25480
movq %rax, 0x1d0(%rsp)
movl 0x14c(%rsp), %eax
movl %eax, %ecx
leaq 0x131ba7(%rip), %rax    # 0x154b10
movq (%rax,%rcx,8), %rax
andq 0x1c8(%rsp), %rax
cmpq $0x0, %rax
je 0x22fad
movl 0x14c(%rsp), %eax
movl %eax, %ecx
leaq 0x14ad85(%rip), %rax    # 0x16dd10
shlq $0x9, %rcx
addq %rcx, %rax
movl 0x1ac(%rsp), %ecx
movq (%rax,%rcx,8), %rax
andq 0x1d0(%rsp), %rax
movq %rax, 0x1d0(%rsp)
movq 0x120(%rsp), %rax
movq 0x1d0(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq 0x8(%rax), %rdi
callq 0x24bc0
movq 0x120(%rsp), %rdi
movq %rax, %rcx
movq 0x50(%rsp), %rax
andq %rcx, %rax
movq %rax, 0x58(%rsp)
addq $0x40, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c10
movq %rax, %rdi
movl $0x3, %esi
callq 0x24c40
movq 0x58(%rsp), %rcx
movq 0x120(%rsp), %rdi
movq %rcx, (%rax)
addq $0x40, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c10
movq %rax, %rdi
movl $0x3, %esi
callq 0x24c40
movq 0x120(%rsp), %rdi
movq (%rax), %rax
movq %rax, 0x60(%rsp)
addq $0xa0, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c70
movq 0x60(%rsp), %rcx
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x1d0(%rsp), %rax
movq %rax, 0x78(%rsp)
movl 0x1dc(%rsp), %edi
callq 0x24ce0
movl %eax, %ecx
movq 0x120(%rsp), %rax
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x153281(%rip), %rcx    # 0x176310
shlq $0x9, %rdx
addq %rdx, %rcx
movq %rcx, 0x70(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x68(%rsp)
movl 0x1dc(%rsp), %edi
callq 0x24ce0
movq 0x68(%rsp), %rdi
movl %eax, %esi
callq 0x24ea0
movq 0x70(%rsp), %rcx
movl %eax, %edx
movq 0x78(%rsp), %rax
movl %edx, %edx
andq (%rcx,%rdx,8), %rax
andq 0x1c0(%rsp), %rax
cmpq $0x0, %rax
je 0x230ed
movl 0x1bc(%rsp), %eax
addl $0x3, %eax
movl %eax, 0x1bc(%rsp)
movq 0x1d0(%rsp), %rdi
andq 0x1c0(%rsp), %rdi
callq 0x24df0
movq 0x120(%rsp), %rdi
movslq %eax, %rcx
leaq 0x1e08c(%rip), %rax     # 0x411a0
movl (%rax,%rcx,4), %eax
movl %eax, 0x4c(%rsp)
addq $0x14, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl 0x4c(%rsp), %edx
movq %rax, %rcx
movq 0x120(%rsp), %rax
addl (%rcx), %edx
movl %edx, (%rcx)
movq 0x8(%rax), %rdi
movl 0x1dc(%rsp), %esi
callq 0x25510
andq 0x1b0(%rsp), %rax
cmpq $0x0, %rax
je 0x2327a
movl 0x14c(%rsp), %eax
movl %eax, %ecx
leaq 0x13199e(%rip), %rax    # 0x154b10
movq (%rax,%rcx,8), %rax
andq 0x1b0(%rsp), %rax
cmpq $0x0, %rax
je 0x2327a
movl 0x1ac(%rsp), %eax
cmpl 0x14c(%rsp), %eax
jbe 0x231d8
movq 0x120(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x1dc(%rsp), %esi
callq 0x25550
testb $0x1, %al
jne 0x231d8
movl 0x1ac(%rsp), %eax
movl %eax, %edx
leaq 0x13194c(%rip), %rcx    # 0x154b10
movabsq $0xf0f0f0f0f0f0f0f, %rax # imm = 0xF0F0F0F0F0F0F0F
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
jne 0x2322c
movl 0x1ac(%rsp), %eax
cmpl 0x14c(%rsp), %eax
jae 0x23278
movq 0x120(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x1dc(%rsp), %esi
callq 0x255a0
testb $0x1, %al
jne 0x23278
movl 0x1ac(%rsp), %eax
movl %eax, %edx
leaq 0x1318f8(%rip), %rcx    # 0x154b10
movabsq $-0xf0f0f0f0f0f0f10, %rax # imm = 0xF0F0F0F0F0F0F0F0
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x23278
movq 0x1d0(%rsp), %rdi
andq 0x1c0(%rsp), %rdi
movq 0x1b0(%rsp), %rax
xorq $-0x1, %rax
andq %rax, %rdi
callq 0x24df0
cmpl $0x3, %eax
jg 0x23276
movq 0x120(%rsp), %rdi
addq $0x2c, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl (%rax), %ecx
addl $-0x19, %ecx
movl %ecx, (%rax)
jmp 0x23278
jmp 0x2327a
jmp 0x2327c
movq 0x158(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x158(%rsp)
jmp 0x22eda
movq 0x120(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x1dc(%rsp), %esi
callq 0x255f0
movq %rax, 0x140(%rsp)
movq 0x140(%rsp), %rdi
callq 0x24dc0
movq %rax, 0x138(%rsp)
movq 0x140(%rsp), %rdi
callq 0x24dd0
movq %rax, 0x130(%rsp)
movq 0x138(%rsp), %rax
cmpq 0x130(%rsp), %rax
je 0x23553
movq 0x138(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x12c(%rsp)
cmpl $0x40, 0x12c(%rsp)
jne 0x23315
jmp 0x23553
movq 0x120(%rsp), %rdi
addq $0x2c, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movq %rax, %rcx
movq 0x120(%rsp), %rax
movl (%rcx), %edx
addl $0x3b6, %edx            # imm = 0x3B6
movl %edx, (%rcx)
movq 0x8(%rax), %rdi
movl 0x12c(%rsp), %esi
xorl %edx, %edx
callq 0x25630
movq %rax, 0x1d0(%rsp)
movl 0x12c(%rsp), %eax
movl %eax, %ecx
leaq 0x1317a2(%rip), %rax    # 0x154b10
movq (%rax,%rcx,8), %rax
andq 0x1c8(%rsp), %rax
cmpq $0x0, %rax
je 0x233b2
movl 0x12c(%rsp), %eax
movl %eax, %ecx
leaq 0x14a980(%rip), %rax    # 0x16dd10
shlq $0x9, %rcx
addq %rcx, %rax
movl 0x1ac(%rsp), %ecx
movq (%rax,%rcx,8), %rax
andq 0x1d0(%rsp), %rax
movq %rax, 0x1d0(%rsp)
movq 0x120(%rsp), %rax
movq 0x1d0(%rsp), %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rax), %rdi
callq 0x24bc0
movq 0x120(%rsp), %rdi
movq %rax, %rcx
movq 0x18(%rsp), %rax
andq %rcx, %rax
movq %rax, 0x20(%rsp)
addq $0x40, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c10
movq %rax, %rdi
movl $0x4, %esi
callq 0x24c40
movq 0x20(%rsp), %rcx
movq 0x120(%rsp), %rdi
movq %rcx, (%rax)
addq $0x40, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c10
movq %rax, %rdi
movl $0x4, %esi
callq 0x24c40
movq 0x120(%rsp), %rdi
movq (%rax), %rax
movq %rax, 0x28(%rsp)
addq $0xa0, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24c70
movq 0x28(%rsp), %rcx
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x1d0(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x1dc(%rsp), %edi
callq 0x24ce0
movl %eax, %ecx
movq 0x120(%rsp), %rax
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x152e7c(%rip), %rcx    # 0x176310
shlq $0x9, %rdx
addq %rdx, %rcx
movq %rcx, 0x38(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
movl 0x1dc(%rsp), %edi
callq 0x24ce0
movq 0x30(%rsp), %rdi
movl %eax, %esi
callq 0x24ea0
movq 0x38(%rsp), %rcx
movl %eax, %edx
movq 0x40(%rsp), %rax
movl %edx, %edx
andq (%rcx,%rdx,8), %rax
andq 0x1c0(%rsp), %rax
cmpq $0x0, %rax
je 0x234f2
movl 0x1bc(%rsp), %eax
addl $0x5, %eax
movl %eax, 0x1bc(%rsp)
movq 0x1d0(%rsp), %rdi
andq 0x1c0(%rsp), %rdi
callq 0x24df0
movq 0x120(%rsp), %rdi
movslq %eax, %rcx
leaq 0x1dcc7(%rip), %rax     # 0x411e0
movl (%rax,%rcx,4), %eax
movl %eax, 0x14(%rsp)
addq $0x14, %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x24cb0
movl 0x14(%rsp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movq 0x138(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x138(%rsp)
jmp 0x232df
movq 0x120(%rsp), %rax
movslq 0x1bc(%rsp), %rdx
leaq 0x1dce6(%rip), %rcx     # 0x41250
movl (%rcx,%rdx,4), %ecx
movl %ecx, 0x10(%rsp)
addq $0x1c, %rax
movq %rax, 0x8(%rsp)
movl 0x1dc(%rsp), %edi
callq 0x24ce0
movq 0x8(%rsp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x24cb0
movl 0x10(%rsp), %edx
movl (%rax), %ecx
subl %edx, %ecx
movl %ecx, (%rax)
addq $0x1e8, %rsp            # imm = 0x1E8
retq
nopw %cs:(%rax,%rax)