// File: /workspace/github_cpp_makefile_star2_O2/codeandkey[P]neocortex/src/position.cpp
// Function: neocortex::Position::pseudolegal_moves(neocortex::Move*)
int Position::pseudolegal_moves(Move* out) {
	if (check()) {
		return pseudolegal_moves_evasions(out);
	}

	int count = 0;

	bitboard ctm = board.get_color_occ(color_to_move);
	bitboard opp = board.get_color_occ(!color_to_move);
	
	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) & opp;

	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) & opp;

	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 */
	bitboard promoting_advances = bb::shift(promoting_pawns, adv_dir) & ~board.get_global_occ();

	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;

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

	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) & (opp | 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) & (opp | 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();

	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()) & ~ctm;

		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()) & ~ctm;

		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) & ~ctm;

		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()) & ~ctm;

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

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

	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);
		}
	}

	/* Castling moves */

	/* We perform most of the legal move tests here, notably the noattack and occ tests */
	bitboard castle_rank = (color_to_move == piece::WHITE) ? RANK_1 : RANK_8;
	bitboard noattack_ks = castle_rank & (FILE_E | FILE_F | FILE_G);
	bitboard noattack_qs = castle_rank & (FILE_E | FILE_D | FILE_C);
	bitboard no_occ_ks = castle_rank & (FILE_F | FILE_G);
	bitboard no_occ_qs = castle_rank & (FILE_B | FILE_C | FILE_D);

	int king_src = (color_to_move == piece::WHITE) ? square::at(0, 4) : square::at(7, 4);
	int ks_dst = (color_to_move == piece::WHITE) ? square::at(0, 6) : square::at(7, 6);
	int qs_dst = (color_to_move == piece::WHITE) ? square::at(0, 2) : square::at(7, 2);

	/* Kingside */
	if (ply.back().castle_rights & (1 << (color_to_move * 2))) {
		/* occ test */
		if (!(board.get_global_occ() & no_occ_ks)) {
			/* noattack test */
			if (!board.mask_is_attacked(noattack_ks, !color_to_move)) {
				out[count++] = Move(king_src, ks_dst);
			}
		}
	}

	/* Queenside */
	if (ply.back().castle_rights & (1 << (color_to_move * 2 + 1))) {
		/* occ test */
		if (!(board.get_global_occ() & no_occ_qs)) {
			/* noattack test */
			if (!board.mask_is_attacked(noattack_qs, !color_to_move)) {
				out[count++] = Move(king_src, qs_dst);
			}
		}
	}

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r12
movq %rdi, %r14
movq 0x160(%rdi), %rax
cmpl $0x0, -0x14(%rax)
je 0x8a44
movq %r14, %rdi
movq %r12, %rsi
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x94d0
movslq 0x170(%r14), %r8
xorl %ecx, %ecx
testq %r8, %r8
sete %cl
movq 0x8(%r14,%r8,8), %rdx
movq %rdx, 0x40(%rsp)
movq 0x8(%r14,%rcx,8), %rcx
movq %rcx, 0x70(%rsp)
movl -0x2c(%rax), %edi
cmpl $0x3f, %edi
ja 0x8a82
callq 0x5103
movq %rax, 0x68(%rsp)
movl 0x170(%r14), %r8d
jmp 0x8a8b
movq $0x0, 0x68(%rsp)
movq %r14, 0x18(%rsp)
movq 0x18(%r14), %rax
andq 0x40(%rsp), %rax
xorl %ecx, %ecx
testl %r8d, %r8d
sete %cl
movabsq $0xff000000000000, %rdi # imm = 0xFF000000000000
movl $0xff00, %edx           # imm = 0xFF00
movl $0xff00, %esi           # imm = 0xFF00
cmoveq %rdi, %rsi
shll $0x4, %ecx
addl $-0x9, %ecx
movq %rax, 0x80(%rsp)
andq %rax, %rsi
movabsq $0xfe00000000fe00, %rax # imm = 0xFE00000000FE00
movq %rsi, 0x30(%rsp)
andq %rsi, %rax
movq %rax, %rsi
movq %rcx, 0x20(%rsp)
shlq %cl, %rsi
shrq $0x9, %rax
movq %r8, 0x38(%rsp)
testl %r8d, %r8d
cmoveq %rdx, %rdi
movq %rdi, 0xb0(%rsp)
cmoveq %rsi, %rax
andq 0x70(%rsp), %rax
leaq 0xa8(%rsp), %rcx
movq %rax, (%rcx)
xorl %r15d, %r15d
leaq 0xc(%rsp), %r14
pushq $0x1
popq %r13
movq %r12, 0x28(%rsp)
testq %rax, %rax
je 0x8bde
leaq 0xa8(%rsp), %rdi
callq 0x64fc
movl %eax, %ebp
movl %eax, %ebx
subl 0x20(%rsp), %ebx
movq %r14, %rdi
movl %ebx, %esi
movl %eax, %edx
pushq $0x4
popq %rcx
callq 0x6d4e
movl 0x14(%rsp), %eax
movl %eax, 0x8(%r12)
movq 0xc(%rsp), %rax
movq %rax, (%r12)
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
pushq $0x2
popq %rcx
callq 0x6d4e
movl 0x14(%rsp), %eax
movl %eax, 0x14(%r12)
movq 0xc(%rsp), %rax
movq %rax, 0xc(%r12)
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
pushq $0x3
popq %rcx
callq 0x6d4e
movl 0x14(%rsp), %eax
movl %eax, 0x20(%r12)
movq 0xc(%rsp), %rax
movq %rax, 0x18(%r12)
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
movl %r13d, %ecx
callq 0x6d4e
addq $0x4, %r15
movl 0x14(%rsp), %eax
movl %eax, 0x2c(%r12)
movq 0xc(%rsp), %rax
movq %rax, 0x24(%r12)
movq 0xa8(%rsp), %rax
addq $0x30, %r12
jmp 0x8b24
xorl %ecx, %ecx
movq 0x38(%rsp), %rsi
testl %esi, %esi
sete %cl
shll $0x4, %ecx
addl $-0x7, %ecx
movabsq $0x7f000000007f00, %rax # imm = 0x7F000000007F00
andq 0x30(%rsp), %rax
movq %rax, %rdx
movq %rcx, 0x78(%rsp)
shlq %cl, %rdx
shrq $0x7, %rax
testl %esi, %esi
cmoveq %rdx, %rax
andq 0x70(%rsp), %rax
leaq 0xa0(%rsp), %rcx
movq %rax, (%rcx)
leaq 0xc(%rsp), %r14
pushq $0x1
popq %rbp
testq %rax, %rax
je 0x8ceb
leaq 0xa0(%rsp), %rdi
callq 0x64fc
movl %eax, %ebx
movl %eax, %r13d
subl 0x78(%rsp), %r13d
movq %r14, %rdi
movl %r13d, %esi
movl %eax, %edx
pushq $0x4
popq %rcx
callq 0x6d4e
movl 0x14(%rsp), %eax
movl %eax, 0x8(%r12)
movq 0xc(%rsp), %rax
movq %rax, (%r12)
movq %r14, %rdi
movl %r13d, %esi
movl %ebx, %edx
pushq $0x2
popq %rcx
callq 0x6d4e
movl 0x14(%rsp), %eax
movl %eax, 0x14(%r12)
movq 0xc(%rsp), %rax
movq %rax, 0xc(%r12)
movq %r14, %rdi
movl %r13d, %esi
movl %ebx, %edx
pushq $0x3
popq %rcx
callq 0x6d4e
movl 0x14(%rsp), %eax
movl %eax, 0x20(%r12)
movq 0xc(%rsp), %rax
movq %rax, 0x18(%r12)
movq %r14, %rdi
movl %r13d, %esi
movl %ebx, %edx
movl %ebp, %ecx
callq 0x6d4e
addq $0x4, %r15
movl 0x14(%rsp), %eax
movl %eax, 0x2c(%r12)
movq 0xc(%rsp), %rax
movq %rax, 0x24(%r12)
movq 0xa0(%rsp), %rax
addq $0x30, %r12
jmp 0x8c2c
xorl %ebp, %ebp
movq 0x38(%rsp), %rdx
testl %edx, %edx
sete %bpl
shll $0x4, %ebp
addl $-0x8, %ebp
movq 0x30(%rsp), %rsi
movq %rsi, %rax
movl %ebp, %ecx
shlq %cl, %rax
movq %rsi, %rcx
shrq $0x8, %rcx
testl %edx, %edx
cmoveq %rax, %rcx
movq 0x18(%rsp), %rax
movq (%rax), %rax
notq %rax
andq %rcx, %rax
leaq 0x98(%rsp), %rcx
movq %rax, (%rcx)
leaq 0xc(%rsp), %rbx
testq %rax, %rax
je 0x8df8
leaq 0x98(%rsp), %rdi
callq 0x64fc
movl %eax, %r14d
movl %eax, %r13d
subl %ebp, %r13d
movq %rbx, %rdi
movl %r13d, %esi
movl %eax, %edx
pushq $0x4
popq %rcx
callq 0x6d4e
movl 0x14(%rsp), %eax
movl %eax, 0x8(%r12)
movq 0xc(%rsp), %rax
movq %rax, (%r12)
movq %rbx, %rdi
movl %r13d, %esi
movl %r14d, %edx
pushq $0x2
popq %rcx
callq 0x6d4e
movl 0x14(%rsp), %eax
movl %eax, 0x14(%r12)
movq 0xc(%rsp), %rax
movq %rax, 0xc(%r12)
movq %rbx, %rdi
movl %r13d, %esi
movl %r14d, %edx
pushq $0x3
popq %rcx
callq 0x6d4e
movl 0x14(%rsp), %eax
movl %eax, 0x20(%r12)
movq 0xc(%rsp), %rax
movq %rax, 0x18(%r12)
movq %rbx, %rdi
movl %r13d, %esi
movl %r14d, %edx
pushq $0x1
popq %rcx
callq 0x6d4e
addq $0x4, %r15
movl 0x14(%rsp), %eax
movl %eax, 0x2c(%r12)
movq 0xc(%rsp), %rax
movq %rax, 0x24(%r12)
movq 0x98(%rsp), %rax
addq $0x30, %r12
jmp 0x8d36
movq 0x30(%rsp), %rdx
xorq 0x80(%rsp), %rdx
movq %rdx, %rax
movl %ebp, %ecx
shlq %cl, %rax
movq %rdx, 0x30(%rsp)
movq %rdx, %rcx
shrq $0x8, %rcx
cmpl $0x0, 0x38(%rsp)
cmoveq %rax, %rcx
movq 0x18(%rsp), %rax
movq (%rax), %rax
notq %rax
andq %rcx, %rax
leaq 0xd0(%rsp), %rbx
movq %rax, (%rbx)
leaq 0xc(%rsp), %r14
pushq $-0x1
popq %r13
testq %rax, %rax
je 0x8e85
movq %rbx, %rdi
callq 0x64fc
movl %eax, %esi
subl %ebp, %esi
movq %r14, %rdi
movl %eax, %edx
movl %r13d, %ecx
callq 0x6d4e
incq %r15
movl 0x14(%rsp), %eax
movl %eax, 0x8(%r12)
movq 0xc(%rsp), %rax
movq %rax, (%r12)
movq 0xd0(%rsp), %rax
addq $0xc, %r12
jmp 0x8e44
movabsq $-0x101010101010102, %rax # imm = 0xFEFEFEFEFEFEFEFE
andq 0x30(%rsp), %rax
movq %rax, %rdx
movq 0x20(%rsp), %rcx
shlq %cl, %rdx
shrq $0x9, %rax
cmpl $0x0, 0x38(%rsp)
cmoveq %rdx, %rax
movq 0x68(%rsp), %rcx
orq 0x70(%rsp), %rcx
movq %rcx, 0x68(%rsp)
andq %rcx, %rax
leaq 0xc8(%rsp), %rbx
movq %rax, (%rbx)
leaq 0xc(%rsp), %r14
pushq $-0x1
popq %r13
testq %rax, %rax
je 0x8f15
movq %rbx, %rdi
callq 0x64fc
movl %eax, %esi
subl 0x20(%rsp), %esi
movq %r14, %rdi
movl %eax, %edx
movl %r13d, %ecx
callq 0x6d4e
incq %r15
movl 0x14(%rsp), %eax
movl %eax, 0x8(%r12)
movq 0xc(%rsp), %rax
movq %rax, (%r12)
movq 0xc8(%rsp), %rax
addq $0xc, %r12
jmp 0x8ed2
movabsq $0x7f7f7f7f7f7f7f7f, %rax # imm = 0x7F7F7F7F7F7F7F7F
movq 0x30(%rsp), %rdx
andq %rax, %rdx
movq %rdx, %rax
movq 0x78(%rsp), %rcx
shlq %cl, %rax
shrq $0x7, %rdx
cmpl $0x0, 0x38(%rsp)
cmoveq %rax, %rdx
andq 0x68(%rsp), %rdx
leaq 0xc0(%rsp), %rbx
movq %rdx, (%rbx)
leaq 0xc(%rsp), %r14
pushq $-0x1
popq %r13
testq %rdx, %rdx
je 0x8f9b
movq %rbx, %rdi
callq 0x64fc
movl %eax, %esi
subl 0x78(%rsp), %esi
movq %r14, %rdi
movl %eax, %edx
movl %r13d, %ecx
callq 0x6d4e
incq %r15
movl 0x14(%rsp), %eax
movl %eax, 0x8(%r12)
movq 0xc(%rsp), %rax
movq %rax, (%r12)
movq 0xc0(%rsp), %rdx
addq $0xc, %r12
jmp 0x8f58
movq 0xb0(%rsp), %rdi
andq 0x80(%rsp), %rdi
movq %rdi, %rax
movl %ebp, %ecx
shlq %cl, %rax
shrq $0x8, %rdi
movq 0x38(%rsp), %rsi
testl %esi, %esi
cmoveq %rax, %rdi
movq 0x18(%rsp), %rax
movq (%rax), %rax
notq %rax
andq %rax, %rdi
movq %rdi, %rdx
shlq %cl, %rdx
shrq $0x8, %rdi
testl %esi, %esi
cmoveq %rdx, %rdi
andq %rax, %rdi
leaq 0xb8(%rsp), %rbx
movq %rdi, (%rbx)
addl %ebp, %ebp
leaq 0xc(%rsp), %r14
pushq $-0x1
popq %r13
testq %rdi, %rdi
je 0x903a
movq %rbx, %rdi
callq 0x64fc
movl %eax, %esi
subl %ebp, %esi
movq %r14, %rdi
movl %eax, %edx
movl %r13d, %ecx
callq 0x6d4e
incq %r15
movl 0x14(%rsp), %eax
movl %eax, 0x8(%r12)
movq 0xc(%rsp), %rax
movq %rax, (%r12)
movq 0xb8(%rsp), %rdi
addq $0xc, %r12
jmp 0x8ff9
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x40(%rsp), %rcx
andq %rcx, %rax
leaq 0x90(%rsp), %rdx
movq %rax, (%rdx)
notq %rcx
movq %rcx, 0x20(%rsp)
leaq 0x60(%rsp), %rbx
leaq 0xc(%rsp), %r12
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x90ea
leaq 0x90(%rsp), %rdi
callq 0x64fc
movl %eax, %r13d
movq 0x18(%rsp), %rax
movq (%rax), %rsi
movl %r13d, %edi
callq 0xcf4b
andq 0x20(%rsp), %rax
movq %rax, 0x60(%rsp)
movslq %r15d, %r15
imulq $0xc, %r15, %r14
addq 0x28(%rsp), %r14
testq %rax, %rax
je 0x90e0
movq %rbx, %rdi
callq 0x64fc
movq %r12, %rdi
movl %r13d, %esi
movl %eax, %edx
movl %ebp, %ecx
callq 0x6d4e
incq %r15
movl 0x14(%rsp), %eax
movl %eax, 0x8(%r14)
movq 0xc(%rsp), %rax
movq %rax, (%r14)
movq 0x60(%rsp), %rax
addq $0xc, %r14
jmp 0x90a6
movq 0x90(%rsp), %rax
jmp 0x906b
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rax
andq 0x40(%rsp), %rax
leaq 0x60(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x58(%rsp), %r14
leaq 0xc(%rsp), %r12
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x9185
leaq 0x60(%rsp), %rdi
callq 0x64fc
movl %eax, %r13d
movq 0x18(%rsp), %rax
movq (%rax), %rsi
movl %r13d, %edi
callq 0x649e
andq 0x20(%rsp), %rax
movq %rax, 0x58(%rsp)
movslq %r15d, %r15
imulq $0xc, %r15, %rbx
addq 0x28(%rsp), %rbx
testq %rax, %rax
je 0x917e
movq %r14, %rdi
callq 0x64fc
movq %r12, %rdi
movl %r13d, %esi
movl %eax, %edx
movl %ebp, %ecx
callq 0x6d4e
incq %r15
movl 0x14(%rsp), %eax
movl %eax, 0x8(%rbx)
movq 0xc(%rsp), %rax
movq %rax, (%rbx)
movq 0x58(%rsp), %rax
addq $0xc, %rbx
jmp 0x9145
movq 0x60(%rsp), %rax
jmp 0x910d
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rax
andq 0x40(%rsp), %rax
leaq 0x58(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x50(%rsp), %r14
leaq 0xc(%rsp), %r12
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x921d
leaq 0x58(%rsp), %rdi
callq 0x64fc
movl %eax, %r13d
cltq
leaq 0x145fd(%rip), %rcx     # 0x1d7c0
movq (%rcx,%rax,8), %rax
andq 0x20(%rsp), %rax
movq %rax, 0x50(%rsp)
movslq %r15d, %r15
imulq $0xc, %r15, %rbx
addq 0x28(%rsp), %rbx
testq %rax, %rax
je 0x9216
movq %r14, %rdi
callq 0x64fc
movq %r12, %rdi
movl %r13d, %esi
movl %eax, %edx
movl %ebp, %ecx
callq 0x6d4e
incq %r15
movl 0x14(%rsp), %eax
movl %eax, 0x8(%rbx)
movq 0xc(%rsp), %rax
movq %rax, (%rbx)
movq 0x50(%rsp), %rax
addq $0xc, %rbx
jmp 0x91dd
movq 0x58(%rsp), %rax
jmp 0x91a8
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
andq 0x40(%rsp), %rax
leaq 0x50(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x48(%rsp), %r14
leaq 0xc(%rsp), %r12
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x92b8
leaq 0x50(%rsp), %rdi
callq 0x64fc
movl %eax, %r13d
movq 0x18(%rsp), %rax
movq (%rax), %rsi
movl %r13d, %edi
callq 0x6440
andq 0x20(%rsp), %rax
movq %rax, 0x48(%rsp)
movslq %r15d, %r15
imulq $0xc, %r15, %rbx
addq 0x28(%rsp), %rbx
testq %rax, %rax
je 0x92b1
movq %r14, %rdi
callq 0x64fc
movq %r12, %rdi
movl %r13d, %esi
movl %eax, %edx
movl %ebp, %ecx
callq 0x6d4e
incq %r15
movl 0x14(%rsp), %eax
movl %eax, 0x8(%rbx)
movq 0xc(%rsp), %rax
movq %rax, (%rbx)
movq 0x48(%rsp), %rax
addq $0xc, %rbx
jmp 0x9278
movq 0x50(%rsp), %rax
jmp 0x9240
movq 0x18(%rsp), %rax
movq 0x40(%rsp), %rcx
andq 0x40(%rax), %rcx
movq %rcx, %rax
leaq 0x48(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x88(%rsp), %r14
leaq 0xc(%rsp), %r12
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x935c
leaq 0x48(%rsp), %rdi
callq 0x64fc
movl %eax, %r13d
cltq
leaq 0x142c4(%rip), %rcx     # 0x1d5c0
movq (%rcx,%rax,8), %rax
andq 0x20(%rsp), %rax
movq %rax, 0x88(%rsp)
movslq %r15d, %r15
imulq $0xc, %r15, %rbx
addq 0x28(%rsp), %rbx
testq %rax, %rax
je 0x9355
movq %r14, %rdi
callq 0x64fc
movq %r12, %rdi
movl %r13d, %esi
movl %eax, %edx
movl %ebp, %ecx
callq 0x6d4e
incq %r15
movl 0x14(%rsp), %eax
movl %eax, 0x8(%rbx)
movq 0xc(%rsp), %rax
movq %rax, (%rbx)
movq 0x88(%rsp), %rax
addq $0xc, %rbx
jmp 0x9319
movq 0x48(%rsp), %rax
jmp 0x92e1
movq 0x18(%rsp), %rdi
movl 0x170(%rdi), %eax
testl %eax, %eax
movl $0xff, %ecx
movabsq $-0x100000000000000, %r13 # imm = 0xFF00000000000000
cmoveq %rcx, %r13
pushq $0x6
popq %rcx
pushq $0x3e
popq %rbx
cmovel %ecx, %ebx
pushq $0x3c
popq %rbp
pushq $0x4
popq %rcx
cmovel %ecx, %ebp
pushq $0x3a
popq %r12
pushq $0x2
popq %rcx
cmovel %ecx, %r12d
movq 0x160(%rdi), %rcx
movl -0x28(%rcx), %ecx
leal (%rax,%rax), %edx
btl %edx, %ecx
jae 0x9413
movq (%rdi), %rcx
andq %r13, %rcx
movabsq $0x6000000000000060, %rdx # imm = 0x6000000000000060
testq %rdx, %rcx
jne 0x9413
movabsq $0x7000000000000070, %rsi # imm = 0x7000000000000070
andq %r13, %rsi
xorl %edx, %edx
testl %eax, %eax
sete %dl
callq 0x5ffa
testb %al, %al
jne 0x9413
leaq 0xc(%rsp), %r14
pushq $-0x1
popq %rcx
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x6d4e
movslq %r15d, %rax
leal 0x1(%r15), %ecx
imulq $0xc, %rax, %rax
movl 0x8(%r14), %edx
movq 0x28(%rsp), %rsi
movl %edx, 0x8(%rsi,%rax)
movq (%r14), %rdx
movq %rdx, (%rsi,%rax)
movl %ecx, %r15d
movq 0x18(%rsp), %rdi
movq 0x160(%rdi), %rax
movl -0x28(%rax), %edx
movl 0x170(%rdi), %eax
leal (%rax,%rax), %ecx
shrl %cl, %edx
testb $0x2, %dl
je 0x9496
movabsq $0xe0000000000000e, %rcx # imm = 0xE0000000000000E
andq %r13, %rcx
testq %rcx, (%rdi)
jne 0x9496
movabsq $0x1c0000000000001c, %rcx # imm = 0x1C0000000000001C
andq %rcx, %r13
xorl %edx, %edx
testl %eax, %eax
sete %dl
movq %r13, %rsi
callq 0x5ffa
testb %al, %al
jne 0x9496
leaq 0xc(%rsp), %rbx
pushq $-0x1
popq %rcx
movq %rbx, %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x6d4e
movslq %r15d, %rax
incl %r15d
imulq $0xc, %rax, %rax
movl 0x8(%rbx), %ecx
movq 0x28(%rsp), %rdx
movl %ecx, 0x8(%rdx,%rax)
movq (%rbx), %rcx
movq %rcx, (%rdx,%rax)
cmpl $0x65, %r15d
jge 0x94b1
movl %r15d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb9eb(%rip), %rdi      # 0x14ea3
leaq 0xb856(%rip), %rsi      # 0x14d15
leaq 0xb9f3(%rip), %rcx      # 0x14eb9
movl $0x21b, %edx            # imm = 0x21B
callq 0x41f0