// File: codeandkey[P]neocortex/src/position.cpp
// Function: neocortex::Position::pseudolegal_moves_evasions(neocortex::Move*)
int Position::pseudolegal_moves_evasions(Move* out) {
	int count = 0;

	assert(check());

	bitboard ctm = board.get_color_occ(color_to_move);
	bitboard opp = board.get_color_occ(!color_to_move);

	/* King moves */
	bitboard kings = ctm & board.get_piece_occ(piece::KING);

	/* Also grab attackers */
	int king_sq = bb::getlsb(kings);
	bitboard attackers = board.attacks_on(king_sq) & opp;

	while (kings) {
		int src = bb::poplsb(kings);
		bitboard moves = attacks::king(src) & ~ctm;

		while (moves) {
			int dst = bb::poplsb(moves);
			out[count++] = Move(src, dst);
		}
	}

	if (bb::popcount(attackers) > 1) {
		/* double check, king moves only */
		return count;
	}

	/* Only one attacker -- look for pieces that can capture it */
	int attacker_square = bb::getlsb(attackers);

	/* If checker is sliding piece, add blocking moves */
	bitboard block_dsts = bb::between(king_sq, attacker_square);

	bitboard ep_mask = 0;
	int ep_square = ply.back().en_passant_square;

	if (square::is_valid(ep_square)) {
		ep_mask = bb::mask(ep_square);
	}

	/* Pawn moves */
	bitboard pawns = ctm & board.get_piece_occ(piece::PAWN);

	bitboard promoting_rank = (color_to_move == piece::WHITE) ? RANK_7 : RANK_2;
	bitboard starting_rank = (color_to_move == piece::WHITE) ? RANK_2 : RANK_7;

	int adv_dir = (color_to_move == piece::WHITE) ? NORTH : SOUTH;
	int left_dir = (color_to_move == piece::WHITE) ? NORTHWEST : SOUTHWEST;
	int right_dir = (color_to_move == piece::WHITE) ? NORTHEAST : SOUTHEAST;

	bitboard promoting_pawns = pawns & promoting_rank;

	/* Promoting left captures */
	bitboard promoting_left_cap = bb::shift(promoting_pawns & ~FILE_A, left_dir) & attackers;

	while (promoting_left_cap) {
		int dst = bb::poplsb(promoting_left_cap);
		out[count++] = Move(dst - left_dir, dst, piece::QUEEN);
		out[count++] = Move(dst - left_dir, dst, piece::KNIGHT);
		out[count++] = Move(dst - left_dir, dst, piece::ROOK);
		out[count++] = Move(dst - left_dir, dst, piece::BISHOP);
	}

	/* Promoting right captures */
	bitboard promoting_right_cap = bb::shift(promoting_pawns & ~FILE_H, right_dir) & attackers;

	while (promoting_right_cap) {
		int dst = bb::poplsb(promoting_right_cap);
		out[count++] = Move(dst - right_dir, dst, piece::QUEEN);
		out[count++] = Move(dst - right_dir, dst, piece::KNIGHT);
		out[count++] = Move(dst - right_dir, dst, piece::ROOK);
		out[count++] = Move(dst - right_dir, dst, piece::BISHOP);
	}

	/* Promoting advances, blocking */
	bitboard promoting_advances = bb::shift(promoting_pawns, adv_dir) & ~board.get_global_occ() & block_dsts;

	while (promoting_advances) {
		int dst = bb::poplsb(promoting_advances);
		out[count++] = Move(dst - adv_dir, dst, piece::QUEEN);
		out[count++] = Move(dst - adv_dir, dst, piece::KNIGHT);
		out[count++] = Move(dst - adv_dir, dst, piece::ROOK);
		out[count++] = Move(dst - adv_dir, dst, piece::BISHOP);
	}

	/* Nonpromoting pawn moves */
	bitboard npm_pawns = pawns & ~promoting_pawns;

	/* Blocking advances */
	bitboard npm_advances = bb::shift(npm_pawns, adv_dir) & ~board.get_global_occ() & block_dsts;

	while (npm_advances) {
		int dst = bb::poplsb(npm_advances);
		out[count++] = Move(dst - adv_dir, dst);
	}

	/* Left captures */
	bitboard npm_left_cap = bb::shift(npm_pawns & ~FILE_A, left_dir) & (attackers | ep_mask);

	while (npm_left_cap) {
		int dst = bb::poplsb(npm_left_cap);
		out[count++] = Move(dst - left_dir, dst);
	}

	/* Right captures */
	bitboard npm_right_cap = bb::shift(npm_pawns & ~FILE_H, right_dir) & (attackers | ep_mask);

	while (npm_right_cap) {
		int dst = bb::poplsb(npm_right_cap);
		out[count++] = Move(dst - right_dir, dst);
	}

	/* Jumps */
	bitboard npm_jumps = bb::shift(pawns & starting_rank, adv_dir) & ~board.get_global_occ();
	npm_jumps = bb::shift(npm_jumps, adv_dir) & ~board.get_global_occ() & block_dsts;

	while (npm_jumps) {
		int dst = bb::poplsb(npm_jumps);
		out[count++] = Move(dst - 2 * adv_dir, dst);
	}

	/* Queen moves */
	bitboard queens = ctm & board.get_piece_occ(piece::QUEEN);

	while (queens) {
		int src = bb::poplsb(queens);
		bitboard moves = attacks::queen(src, board.get_global_occ()) & (block_dsts | attackers);

		while (moves) {
			int dst = bb::poplsb(moves);
			out[count++] = Move(src, dst);
		}
	}

	/* Rook moves */
	bitboard rooks = ctm & board.get_piece_occ(piece::ROOK);

	while (rooks) {
		int src = bb::poplsb(rooks);
		bitboard moves = attacks::rook(src, board.get_global_occ()) & (block_dsts | attackers);

		while (moves) {
			int dst = bb::poplsb(moves);
			out[count++] = Move(src, dst);
		}
	}

	/* Knight moves */
	bitboard knights = ctm & board.get_piece_occ(piece::KNIGHT);

	while (knights) {
		int src = bb::poplsb(knights);
		bitboard moves = attacks::knight(src) & (block_dsts | attackers);

		while (moves) {
			int dst = bb::poplsb(moves);
			out[count++] = Move(src, dst);
		}
	}

	/* Bishop moves */
	bitboard bishops = ctm & board.get_piece_occ(piece::BISHOP);

	while (bishops) {
		int src = bb::poplsb(bishops);
		bitboard moves = attacks::bishop(src, board.get_global_occ()) & (block_dsts | attackers);

		while (moves) {
			int dst = bb::poplsb(moves);
			out[count++] = Move(src, dst);
		}
	}

	assert(count <= MAX_PL_MOVES);
	return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x288(%rbp)
movl $0x0, -0x1c(%rbp)
callq 0xbc10
testb $0x1, %al
jne 0xf0d0
jmp 0xf0d2
jmp 0xf0f1
leaq 0x188c3(%rip), %rdi     # 0x2799c
leaq 0x186e5(%rip), %rsi     # 0x277c5
movl $0x222, %edx            # imm = 0x222
leaq 0x188b8(%rip), %rcx     # 0x279a4
callq 0x5290
movq -0x288(%rbp), %rdi
movl 0x170(%rdi), %esi
callq 0x14e30
movq -0x288(%rbp), %rdi
movq %rax, -0x28(%rbp)
cmpl $0x0, 0x170(%rdi)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %esi
callq 0x14e30
movq -0x288(%rbp), %rdi
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x290(%rbp)
movl $0x5, %esi
callq 0x14e50
movq %rax, %rcx
movq -0x290(%rbp), %rax
andq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x9030
movq -0x288(%rbp), %rdi
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %esi
callq 0x83a0
andq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xf1f3
leaq -0x38(%rbp), %rdi
callq 0x8f70
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %edi
callq 0x8f50
movq -0x28(%rbp), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0xf1f1
leaq -0x58(%rbp), %rdi
callq 0x8f70
movl %eax, -0x5c(%rbp)
movl -0x4c(%rbp), %esi
movl -0x5c(%rbp), %edx
leaq -0x68(%rbp), %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x68(%rbp), %rcx
movq %rcx, (%rax)
movl -0x60(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xf1a2
jmp 0xf178
movq -0x48(%rbp), %rdi
callq 0x14ed0
cmpl $0x1, %eax
jle 0xf20c
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xfed8
movq -0x48(%rbp), %rdi
callq 0x9030
movl %eax, -0x6c(%rbp)
movl -0x3c(%rbp), %edi
movl -0x6c(%rbp), %esi
callq 0x14f40
movq -0x288(%rbp), %rdi
movq %rax, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
addq $0x158, %rdi            # imm = 0x158
callq 0xbce0
movl 0xc(%rax), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %edi
callq 0x6d10
testb $0x1, %al
jne 0xf25c
jmp 0xf26b
movl -0x84(%rbp), %edi
callq 0x6bd0
movq %rax, -0x80(%rbp)
movq -0x288(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x298(%rbp)
xorl %esi, %esi
callq 0x14e50
movq -0x298(%rbp), %rcx
movq %rax, %rdx
movq -0x288(%rbp), %rax
andq %rdx, %rcx
movq %rcx, -0x90(%rbp)
movl 0x170(%rax), %esi
movl $0xff00, %ecx           # imm = 0xFF00
movabsq $0xff000000000000, %rdx # imm = 0xFF000000000000
cmpl $0x0, %esi
cmoveq %rdx, %rcx
movq %rcx, -0x98(%rbp)
movl 0x170(%rax), %esi
movabsq $0xff000000000000, %rcx # imm = 0xFF000000000000
movl $0xff00, %edx           # imm = 0xFF00
cmpl $0x0, %esi
cmoveq %rdx, %rcx
movq %rcx, -0xa0(%rbp)
movl 0x170(%rax), %esi
movl $0xfffffff8, %ecx       # imm = 0xFFFFFFF8
movl $0x8, %edx
cmpl $0x0, %esi
cmovel %edx, %ecx
movl %ecx, -0xa4(%rbp)
movl 0x170(%rax), %esi
movl $0xfffffff7, %ecx       # imm = 0xFFFFFFF7
movl $0x7, %edx
cmpl $0x0, %esi
cmovel %edx, %ecx
movl %ecx, -0xa8(%rbp)
movl 0x170(%rax), %edx
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
movl $0x9, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0xac(%rbp)
movq -0x90(%rbp), %rax
andq -0x98(%rbp), %rax
movq %rax, -0xb8(%rbp)
movabsq $-0x101010101010102, %rdi # imm = 0xFEFEFEFEFEFEFEFE
andq -0xb8(%rbp), %rdi
movl -0xa8(%rbp), %esi
callq 0x6ca0
andq -0x48(%rbp), %rax
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
je 0xf4d6
leaq -0xc0(%rbp), %rdi
callq 0x8f70
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %esi
subl -0xa8(%rbp), %esi
movl -0xc4(%rbp), %edx
leaq -0xd0(%rbp), %rdi
movl $0x4, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0xd0(%rbp), %rcx
movq %rcx, (%rax)
movl -0xc8(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0xc4(%rbp), %esi
subl -0xa8(%rbp), %esi
movl -0xc4(%rbp), %edx
leaq -0xdc(%rbp), %rdi
movl $0x2, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0xdc(%rbp), %rcx
movq %rcx, (%rax)
movl -0xd4(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0xc4(%rbp), %esi
subl -0xa8(%rbp), %esi
movl -0xc4(%rbp), %edx
leaq -0xe8(%rbp), %rdi
movl $0x3, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0xe8(%rbp), %rcx
movq %rcx, (%rax)
movl -0xe0(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0xc4(%rbp), %esi
subl -0xa8(%rbp), %esi
movl -0xc4(%rbp), %edx
leaq -0xf4(%rbp), %rdi
movl $0x1, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0xf4(%rbp), %rcx
movq %rcx, (%rax)
movl -0xec(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xf375
movabsq $0x7f7f7f7f7f7f7f7f, %rdi # imm = 0x7F7F7F7F7F7F7F7F
andq -0xb8(%rbp), %rdi
movl -0xac(%rbp), %esi
callq 0x6ca0
andq -0x48(%rbp), %rax
movq %rax, -0x100(%rbp)
cmpq $0x0, -0x100(%rbp)
je 0xf65e
leaq -0x100(%rbp), %rdi
callq 0x8f70
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %esi
subl -0xac(%rbp), %esi
movl -0x104(%rbp), %edx
leaq -0x110(%rbp), %rdi
movl $0x4, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x110(%rbp), %rcx
movq %rcx, (%rax)
movl -0x108(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0x104(%rbp), %esi
subl -0xac(%rbp), %esi
movl -0x104(%rbp), %edx
leaq -0x11c(%rbp), %rdi
movl $0x2, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x11c(%rbp), %rcx
movq %rcx, (%rax)
movl -0x114(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0x104(%rbp), %esi
subl -0xac(%rbp), %esi
movl -0x104(%rbp), %edx
leaq -0x128(%rbp), %rdi
movl $0x3, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x128(%rbp), %rcx
movq %rcx, (%rax)
movl -0x120(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0x104(%rbp), %esi
subl -0xac(%rbp), %esi
movl -0x104(%rbp), %edx
leaq -0x134(%rbp), %rdi
movl $0x1, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x134(%rbp), %rcx
movq %rcx, (%rax)
movl -0x12c(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xf4fd
movq -0xb8(%rbp), %rdi
movl -0xa4(%rbp), %esi
callq 0x6ca0
movq -0x288(%rbp), %rdi
movq %rax, -0x2a0(%rbp)
callq 0x14e70
movq %rax, %rcx
movq -0x2a0(%rbp), %rax
xorq $-0x1, %rcx
andq %rcx, %rax
andq -0x78(%rbp), %rax
movq %rax, -0x140(%rbp)
cmpq $0x0, -0x140(%rbp)
je 0xf800
leaq -0x140(%rbp), %rdi
callq 0x8f70
movl %eax, -0x144(%rbp)
movl -0x144(%rbp), %esi
subl -0xa4(%rbp), %esi
movl -0x144(%rbp), %edx
leaq -0x150(%rbp), %rdi
movl $0x4, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x150(%rbp), %rcx
movq %rcx, (%rax)
movl -0x148(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0x144(%rbp), %esi
subl -0xa4(%rbp), %esi
movl -0x144(%rbp), %edx
leaq -0x15c(%rbp), %rdi
movl $0x2, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x15c(%rbp), %rcx
movq %rcx, (%rax)
movl -0x154(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0x144(%rbp), %esi
subl -0xa4(%rbp), %esi
movl -0x144(%rbp), %edx
leaq -0x168(%rbp), %rdi
movl $0x3, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x168(%rbp), %rcx
movq %rcx, (%rax)
movl -0x160(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0x144(%rbp), %esi
subl -0xa4(%rbp), %esi
movl -0x144(%rbp), %edx
leaq -0x174(%rbp), %rdi
movl $0x1, %ecx
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x174(%rbp), %rcx
movq %rcx, (%rax)
movl -0x16c(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xf69f
movq -0x90(%rbp), %rax
movq -0xb8(%rbp), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rdi
movl -0xa4(%rbp), %esi
callq 0x6ca0
movq -0x288(%rbp), %rdi
movq %rax, -0x2a8(%rbp)
callq 0x14e70
movq %rax, %rcx
movq -0x2a8(%rbp), %rax
xorq $-0x1, %rcx
andq %rcx, %rax
andq -0x78(%rbp), %rax
movq %rax, -0x188(%rbp)
cmpq $0x0, -0x188(%rbp)
je 0xf8ca
leaq -0x188(%rbp), %rdi
callq 0x8f70
movl %eax, -0x18c(%rbp)
movl -0x18c(%rbp), %esi
subl -0xa4(%rbp), %esi
movl -0x18c(%rbp), %edx
leaq -0x198(%rbp), %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x198(%rbp), %rcx
movq %rcx, (%rax)
movl -0x190(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xf85d
movabsq $-0x101010101010102, %rdi # imm = 0xFEFEFEFEFEFEFEFE
andq -0x180(%rbp), %rdi
movl -0xa8(%rbp), %esi
callq 0x6ca0
movq -0x48(%rbp), %rcx
orq -0x80(%rbp), %rcx
andq %rcx, %rax
movq %rax, -0x1a0(%rbp)
cmpq $0x0, -0x1a0(%rbp)
je 0xf965
leaq -0x1a0(%rbp), %rdi
callq 0x8f70
movl %eax, -0x1a4(%rbp)
movl -0x1a4(%rbp), %esi
subl -0xa8(%rbp), %esi
movl -0x1a4(%rbp), %edx
leaq -0x1b0(%rbp), %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x1b0(%rbp), %rcx
movq %rcx, (%rax)
movl -0x1a8(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xf8f8
movabsq $0x7f7f7f7f7f7f7f7f, %rdi # imm = 0x7F7F7F7F7F7F7F7F
andq -0x180(%rbp), %rdi
movl -0xac(%rbp), %esi
callq 0x6ca0
movq -0x48(%rbp), %rcx
orq -0x80(%rbp), %rcx
andq %rcx, %rax
movq %rax, -0x1b8(%rbp)
cmpq $0x0, -0x1b8(%rbp)
je 0xfa00
leaq -0x1b8(%rbp), %rdi
callq 0x8f70
movl %eax, -0x1bc(%rbp)
movl -0x1bc(%rbp), %esi
subl -0xac(%rbp), %esi
movl -0x1bc(%rbp), %edx
leaq -0x1c8(%rbp), %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x1c8(%rbp), %rcx
movq %rcx, (%rax)
movl -0x1c0(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xf993
movq -0x90(%rbp), %rdi
andq -0xa0(%rbp), %rdi
movl -0xa4(%rbp), %esi
callq 0x6ca0
movq -0x288(%rbp), %rdi
movq %rax, -0x2b8(%rbp)
callq 0x14e70
movq %rax, %rcx
movq -0x2b8(%rbp), %rax
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rdi
movl -0xa4(%rbp), %esi
callq 0x6ca0
movq -0x288(%rbp), %rdi
movq %rax, -0x2b0(%rbp)
callq 0x14e70
movq %rax, %rcx
movq -0x2b0(%rbp), %rax
xorq $-0x1, %rcx
andq %rcx, %rax
andq -0x78(%rbp), %rax
movq %rax, -0x1d0(%rbp)
cmpq $0x0, -0x1d0(%rbp)
je 0xfaf6
leaq -0x1d0(%rbp), %rdi
callq 0x8f70
movl %eax, -0x1d4(%rbp)
movl -0x1d4(%rbp), %esi
movl -0xa4(%rbp), %eax
shll %eax
subl %eax, %esi
movl -0x1d4(%rbp), %edx
leaq -0x1e0(%rbp), %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x1e0(%rbp), %rcx
movq %rcx, (%rax)
movl -0x1d8(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xfa85
movq -0x288(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x2c0(%rbp)
movl $0x4, %esi
callq 0x14e50
movq %rax, %rcx
movq -0x2c0(%rbp), %rax
andq %rcx, %rax
movq %rax, -0x1e8(%rbp)
cmpq $0x0, -0x1e8(%rbp)
je 0xfbea
leaq -0x1e8(%rbp), %rdi
callq 0x8f70
movq -0x288(%rbp), %rdi
movl %eax, -0x1ec(%rbp)
movl -0x1ec(%rbp), %eax
movl %eax, -0x2c4(%rbp)
callq 0x14e70
movl -0x2c4(%rbp), %edi
movq %rax, %rsi
callq 0x14e90
movq -0x78(%rbp), %rcx
orq -0x48(%rbp), %rcx
andq %rcx, %rax
movq %rax, -0x1f8(%rbp)
cmpq $0x0, -0x1f8(%rbp)
je 0xfbe5
leaq -0x1f8(%rbp), %rdi
callq 0x8f70
movl %eax, -0x1fc(%rbp)
movl -0x1ec(%rbp), %esi
movl -0x1fc(%rbp), %edx
leaq -0x208(%rbp), %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x208(%rbp), %rcx
movq %rcx, (%rax)
movl -0x200(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xfb7e
jmp 0xfb26
movq -0x288(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x2d0(%rbp)
movl $0x3, %esi
callq 0x14e50
movq %rax, %rcx
movq -0x2d0(%rbp), %rax
andq %rcx, %rax
movq %rax, -0x210(%rbp)
cmpq $0x0, -0x210(%rbp)
je 0xfcde
leaq -0x210(%rbp), %rdi
callq 0x8f70
movq -0x288(%rbp), %rdi
movl %eax, -0x214(%rbp)
movl -0x214(%rbp), %eax
movl %eax, -0x2d4(%rbp)
callq 0x14e70
movl -0x2d4(%rbp), %edi
movq %rax, %rsi
callq 0x8eb0
movq -0x78(%rbp), %rcx
orq -0x48(%rbp), %rcx
andq %rcx, %rax
movq %rax, -0x220(%rbp)
cmpq $0x0, -0x220(%rbp)
je 0xfcd9
leaq -0x220(%rbp), %rdi
callq 0x8f70
movl %eax, -0x224(%rbp)
movl -0x214(%rbp), %esi
movl -0x224(%rbp), %edx
leaq -0x230(%rbp), %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x230(%rbp), %rcx
movq %rcx, (%rax)
movl -0x228(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xfc72
jmp 0xfc1a
movq -0x288(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x2e0(%rbp)
movl $0x2, %esi
callq 0x14e50
movq %rax, %rcx
movq -0x2e0(%rbp), %rax
andq %rcx, %rax
movq %rax, -0x238(%rbp)
cmpq $0x0, -0x238(%rbp)
je 0xfdb7
leaq -0x238(%rbp), %rdi
callq 0x8f70
movl %eax, -0x23c(%rbp)
movl -0x23c(%rbp), %edi
callq 0x8df0
movq -0x78(%rbp), %rcx
orq -0x48(%rbp), %rcx
andq %rcx, %rax
movq %rax, -0x248(%rbp)
cmpq $0x0, -0x248(%rbp)
je 0xfdb2
leaq -0x248(%rbp), %rdi
callq 0x8f70
movl %eax, -0x24c(%rbp)
movl -0x23c(%rbp), %esi
movl -0x24c(%rbp), %edx
leaq -0x258(%rbp), %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x258(%rbp), %rcx
movq %rcx, (%rax)
movl -0x250(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xfd4b
jmp 0xfd0e
movq -0x288(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movl $0x1, %esi
callq 0x14e50
movq %rax, %rcx
movq -0x2e8(%rbp), %rax
andq %rcx, %rax
movq %rax, -0x260(%rbp)
cmpq $0x0, -0x260(%rbp)
je 0xfeab
leaq -0x260(%rbp), %rdi
callq 0x8f70
movq -0x288(%rbp), %rdi
movl %eax, -0x264(%rbp)
movl -0x264(%rbp), %eax
movl %eax, -0x2ec(%rbp)
callq 0x14e70
movl -0x2ec(%rbp), %edi
movq %rax, %rsi
callq 0x8e10
movq -0x78(%rbp), %rcx
orq -0x48(%rbp), %rcx
andq %rcx, %rax
movq %rax, -0x270(%rbp)
cmpq $0x0, -0x270(%rbp)
je 0xfea6
leaq -0x270(%rbp), %rdi
callq 0x8f70
movl %eax, -0x274(%rbp)
movl -0x264(%rbp), %esi
movl -0x274(%rbp), %edx
leaq -0x280(%rbp), %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xa8a0
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x280(%rbp), %rcx
movq %rcx, (%rax)
movl -0x278(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0xfe3f
jmp 0xfde7
cmpl $0x64, -0x1c(%rbp)
jg 0xfeb3
jmp 0xfed2
leaq 0x17a99(%rip), %rdi     # 0x27953
leaq 0x17904(%rip), %rsi     # 0x277c5
movl $0x2cf, %edx            # imm = 0x2CF
leaq 0x17ad7(%rip), %rcx     # 0x279a4
callq 0x5290
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
nopw %cs:(%rax,%rax)