// File: codeandkey[P]neocortex/src/attacks.cpp
// Function: neocortex::attacks::init()
void attacks::init() {
	for (int sq = 0; sq < 64; ++sq) {
		int src_r = square::rank(sq), src_f = square::file(sq);

		/* white pawn spans */
		for (int rr = src_r + 1; rr < 8; ++rr) {
			pawn_frontspans_list[piece::WHITE][sq] |= bb::mask(square::at(rr, src_f));

			if (src_f > 0) {
				pawn_attackspans_list[piece::WHITE][sq] |= bb::mask(square::at(rr, src_f - 1));
			}

			if (src_f < 7) {
				pawn_attackspans_list[piece::WHITE][sq] |= bb::mask(square::at(rr, src_f + 1));
			}
		}

		/* black pawn spans */
		for (int rr = src_r - 1; rr >= 0; --rr) {
			pawn_frontspans_list[piece::BLACK][sq] |= bb::mask(square::at(rr, src_f));

			if (src_f > 0) {
				pawn_attackspans_list[piece::BLACK][sq] |= bb::mask(square::at(rr, src_f - 1));
			}

			if (src_f < 7) {
				pawn_attackspans_list[piece::BLACK][sq] |= bb::mask(square::at(rr, src_f + 1));
			}
		}

		if (src_r < 7) {
			pawn_attacks[piece::WHITE][sq] = bb::shift(bb::mask(sq) & ~FILE_A, NORTHWEST) | bb::shift(bb::mask(sq) & ~FILE_H, NORTHEAST);
		} else {
			pawn_attacks[piece::WHITE][sq] = 0;
		}

		if (src_r > 0) {
			pawn_attacks[piece::BLACK][sq] = bb::shift(bb::mask(sq) & ~FILE_A, SOUTHWEST) | bb::shift(bb::mask(sq) & ~FILE_H, SOUTHEAST);
		}
		else {
			pawn_attacks[piece::BLACK][sq] = 0;
		}

		king_attacks[sq] |= bb::shift((bb::mask(sq) & ~FILE_H), EAST);
		king_attacks[sq] |= bb::shift((bb::mask(sq) & ~FILE_A), WEST);
		king_attacks[sq] |= bb::shift((bb::mask(sq) & ~RANK_8), NORTH);
		king_attacks[sq] |= bb::shift((bb::mask(sq) & ~RANK_1), SOUTH);
		king_attacks[sq] |= bb::shift((bb::mask(sq) & ~FILE_H & ~RANK_8), NORTHEAST);
		king_attacks[sq] |= bb::shift((bb::mask(sq) & ~FILE_A & ~RANK_8), NORTHWEST);
		king_attacks[sq] |= bb::shift((bb::mask(sq) & ~FILE_H & ~RANK_1), SOUTHEAST);
		king_attacks[sq] |= bb::shift((bb::mask(sq) & ~FILE_A & ~RANK_1), SOUTHWEST);

		knight_attacks[sq] |= bb::shift((bb::mask(sq) & ~FILE_H & ~FILE_G & ~RANK_8), EAST * 2 + NORTH);
		knight_attacks[sq] |= bb::shift((bb::mask(sq) & ~FILE_H & ~FILE_G & ~RANK_1), EAST * 2 + SOUTH);
		knight_attacks[sq] |= bb::shift((bb::mask(sq) & ~FILE_B & ~FILE_A & ~RANK_8), WEST * 2 + NORTH);
		knight_attacks[sq] |= bb::shift((bb::mask(sq) & ~FILE_B & ~FILE_A & ~RANK_1), WEST * 2 + SOUTH);
		knight_attacks[sq] |= bb::shift((bb::mask(sq) & ~RANK_1 & ~RANK_2 & ~FILE_A), SOUTH * 2 + WEST);
		knight_attacks[sq] |= bb::shift((bb::mask(sq) & ~RANK_1 & ~RANK_2 & ~FILE_H), SOUTH * 2 + EAST);
		knight_attacks[sq] |= bb::shift((bb::mask(sq) & ~RANK_7 & ~RANK_8 & ~FILE_A), NORTH * 2 + WEST);
		knight_attacks[sq] |= bb::shift((bb::mask(sq) & ~RANK_7 & ~RANK_8 & ~FILE_H), NORTH * 2 + EAST);

		int num_rook_roccs = 1 << magic::rook_bits[sq];

		rook_attacks[sq] = new bitboard[num_rook_roccs];

		for (int i = 0; i < num_rook_roccs; ++i) {
			rook_attacks[sq][i] = 0;
		}

		for (int i = 0; i < num_rook_roccs; ++i) {
			bitboard rocc = make_rocc(i, magic::rook_masks[sq], magic::rook_bits[sq]);
			int mindex = magic_index(rocc, magic::rook_magics[sq], magic::rook_bits[sq]);

			assert(!rook_attacks[sq][mindex]);

			bitboard* dst = &rook_attacks[sq][mindex];

			/* west */
			for (int f = src_f - 1; f >= 0; --f) {
				bitboard mask = bb::mask(square::at(src_r, f));
				*dst |= mask;
				if (rocc & mask) break;
			}

			/* east */
			for (int f = src_f + 1; f < 8; ++f) {
				bitboard mask = bb::mask(square::at(src_r, f));
				*dst |= mask;
				if (rocc & mask) break;
			}

			/* north */
			for (int r = src_r + 1; r < 8; ++r) {
				bitboard mask = bb::mask(square::at(r, src_f));
				*dst |= mask;
				if (rocc & mask) break;
			}

			/* south */
			for (int r = src_r - 1; r >= 0; --r) {
				bitboard mask = bb::mask(square::at(r, src_f));
				*dst |= (bitboard) mask;
				if (rocc & mask) break;
			}
		}

		int num_bishop_roccs = 1 << magic::bishop_bits[sq];

		bishop_attacks[sq] = new bitboard[num_bishop_roccs];

		for (int i = 0; i < num_bishop_roccs; ++i) {
			bishop_attacks[sq][i] = 0;
		}

		for (int i = 0; i < num_bishop_roccs; ++i) {
			bitboard rocc = make_rocc(i, magic::bishop_masks[sq], magic::bishop_bits[sq]);
			int mindex = magic_index(rocc, magic::bishop_magics[sq], magic::bishop_bits[sq]);

			assert(!bishop_attacks[sq][mindex]);

			bitboard* dst = &bishop_attacks[sq][mindex];

			/* northwest */
			for (int f = src_f - 1, r = src_r + 1; f >= 0 && r < 8; --f, ++r) {
				bitboard mask = bb::mask(square::at(r, f));
				*dst |= mask;
				if (rocc & mask) break;
			}

			/* northeast */
			for (int f = src_f + 1, r = src_r + 1; f < 8 && r < 8; ++f, ++r) {
				bitboard mask = bb::mask(square::at(r, f));
				*dst |= mask;
				if (rocc & mask) break;
			}

			/* southeast */
			for (int f = src_f + 1, r = src_r - 1; f < 8 && r >= 0; ++f, --r) {
				bitboard mask = bb::mask(square::at(r, f));
				*dst |= mask;
				if (rocc & mask) break;
			}

			/* southwest */
			for (int f = src_f - 1, r = src_r - 1; f >= 0 && r >= 0; --f, --r) {
				bitboard mask = bb::mask(square::at(r, f));
				*dst |= mask;
				if (rocc & mask) break;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl $0x0, -0x4(%rbp)
cmpl $0x40, -0x4(%rbp)
jge 0x6a75
movl -0x4(%rbp), %edi
callq 0x6b30
movl %eax, -0x8(%rbp)
movl -0x4(%rbp), %edi
callq 0x6b80
movl %eax, -0xc(%rbp)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
cmpl $0x8, -0x10(%rbp)
jge 0x5ce4
movl -0x10(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2e22b(%rip), %rax     # 0x33e80
orq (%rax,%rcx,8), %rdx
leaq 0x2e220(%rip), %rax     # 0x33e80
movq %rdx, (%rax,%rcx,8)
cmpl $0x0, -0xc(%rbp)
jle 0x5c9c
movl -0x10(%rbp), %edi
movl -0xc(%rbp), %esi
subl $0x1, %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2e5f3(%rip), %rax     # 0x34280
orq (%rax,%rcx,8), %rdx
leaq 0x2e5e8(%rip), %rax     # 0x34280
movq %rdx, (%rax,%rcx,8)
cmpl $0x7, -0xc(%rbp)
jge 0x5cd4
movl -0x10(%rbp), %edi
movl -0xc(%rbp), %esi
addl $0x1, %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2e5bb(%rip), %rax     # 0x34280
orq (%rax,%rcx,8), %rdx
leaq 0x2e5b0(%rip), %rax     # 0x34280
movq %rdx, (%rax,%rcx,8)
jmp 0x5cd6
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5c2b
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x5dbe
movl -0x14(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2e169(%rip), %rax     # 0x33e80
orq 0x200(%rax,%rcx,8), %rdx
leaq 0x2e15a(%rip), %rax     # 0x33e80
movq %rdx, 0x200(%rax,%rcx,8)
cmpl $0x0, -0xc(%rbp)
jle 0x5d6e
movl -0x14(%rbp), %edi
movl -0xc(%rbp), %esi
subl $0x1, %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2e529(%rip), %rax     # 0x34280
orq 0x200(%rax,%rcx,8), %rdx
leaq 0x2e51a(%rip), %rax     # 0x34280
movq %rdx, 0x200(%rax,%rcx,8)
cmpl $0x7, -0xc(%rbp)
jge 0x5dae
movl -0x14(%rbp), %edi
movl -0xc(%rbp), %esi
addl $0x1, %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2e4e9(%rip), %rax     # 0x34280
orq 0x200(%rax,%rcx,8), %rdx
leaq 0x2e4da(%rip), %rax     # 0x34280
movq %rdx, 0x200(%rax,%rcx,8)
jmp 0x5db0
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5ced
cmpl $0x7, -0x8(%rbp)
jge 0x5e2a
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $-0x101010101010102, %rax # imm = 0xFEFEFEFEFEFEFEFE
andq %rax, %rdi
movl $0x7, %esi
callq 0x6ca0
movq %rax, -0xe8(%rbp)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $0x7f7f7f7f7f7f7f7f, %rax # imm = 0x7F7F7F7F7F7F7F7F
andq %rax, %rdi
movl $0x9, %esi
callq 0x6ca0
movq -0xe8(%rbp), %rdx
orq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2dc5c(%rip), %rax     # 0x33a80
movq %rdx, (%rax,%rcx,8)
jmp 0x5e3d
movslq -0x4(%rbp), %rcx
leaq 0x2dc4b(%rip), %rax     # 0x33a80
movq $0x0, (%rax,%rcx,8)
cmpl $0x0, -0x8(%rbp)
jle 0x5ead
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $-0x101010101010102, %rax # imm = 0xFEFEFEFEFEFEFEFE
andq %rax, %rdi
movl $0xfffffff7, %esi       # imm = 0xFFFFFFF7
callq 0x6ca0
movq %rax, -0xf0(%rbp)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $0x7f7f7f7f7f7f7f7f, %rax # imm = 0x7F7F7F7F7F7F7F7F
andq %rax, %rdi
movl $0xfffffff9, %esi       # imm = 0xFFFFFFF9
callq 0x6ca0
movq -0xf0(%rbp), %rdx
orq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2dbdd(%rip), %rax     # 0x33a80
movq %rdx, 0x200(%rax,%rcx,8)
jmp 0x5ec4
movslq -0x4(%rbp), %rcx
leaq 0x2dbc8(%rip), %rax     # 0x33a80
movq $0x0, 0x200(%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $0x7f7f7f7f7f7f7f7f, %rax # imm = 0x7F7F7F7F7F7F7F7F
andq %rax, %rdi
movl $0x1, %esi
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d78c(%rip), %rax     # 0x33680
orq (%rax,%rcx,8), %rdx
leaq 0x2d781(%rip), %rax     # 0x33680
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $-0x101010101010102, %rax # imm = 0xFEFEFEFEFEFEFEFE
andq %rax, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d74d(%rip), %rax     # 0x33680
orq (%rax,%rcx,8), %rdx
leaq 0x2d742(%rip), %rax     # 0x33680
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $0xffffffffffffff, %rax # imm = 0xFFFFFFFFFFFFFF
andq %rax, %rdi
movl $0x8, %esi
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d70e(%rip), %rax     # 0x33680
orq (%rax,%rcx,8), %rdx
leaq 0x2d703(%rip), %rax     # 0x33680
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
andq $-0x100, %rdi
movl $0xfffffff8, %esi       # imm = 0xFFFFFFF8
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d6d5(%rip), %rax     # 0x33680
orq (%rax,%rcx,8), %rdx
leaq 0x2d6ca(%rip), %rax     # 0x33680
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $0x7f7f7f7f7f7f7f7f, %rax # imm = 0x7F7F7F7F7F7F7F7F
andq %rax, %rdi
movabsq $0xffffffffffffff, %rax # imm = 0xFFFFFFFFFFFFFF
andq %rax, %rdi
movl $0x9, %esi
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d689(%rip), %rax     # 0x33680
orq (%rax,%rcx,8), %rdx
leaq 0x2d67e(%rip), %rax     # 0x33680
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $-0x101010101010102, %rax # imm = 0xFEFEFEFEFEFEFEFE
andq %rax, %rdi
movabsq $0xffffffffffffff, %rax # imm = 0xFFFFFFFFFFFFFF
andq %rax, %rdi
movl $0x7, %esi
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d63d(%rip), %rax     # 0x33680
orq (%rax,%rcx,8), %rdx
leaq 0x2d632(%rip), %rax     # 0x33680
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $0x7f7f7f7f7f7f7f7f, %rax # imm = 0x7F7F7F7F7F7F7F7F
andq %rax, %rdi
andq $-0x100, %rdi
movl $0xfffffff9, %esi       # imm = 0xFFFFFFF9
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d5f7(%rip), %rax     # 0x33680
orq (%rax,%rcx,8), %rdx
leaq 0x2d5ec(%rip), %rax     # 0x33680
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $-0x101010101010102, %rax # imm = 0xFEFEFEFEFEFEFEFE
andq %rax, %rdi
andq $-0x100, %rdi
movl $0xfffffff7, %esi       # imm = 0xFFFFFFF7
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d5b1(%rip), %rax     # 0x33680
orq (%rax,%rcx,8), %rdx
leaq 0x2d5a6(%rip), %rax     # 0x33680
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $0x7f7f7f7f7f7f7f7f, %rax # imm = 0x7F7F7F7F7F7F7F7F
andq %rax, %rdi
movabsq $-0x4040404040404041, %rax # imm = 0xBFBFBFBFBFBFBFBF
andq %rax, %rdi
movabsq $0xffffffffffffff, %rax # imm = 0xFFFFFFFFFFFFFF
andq %rax, %rdi
movl $0xa, %esi
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d758(%rip), %rax     # 0x33880
orq (%rax,%rcx,8), %rdx
leaq 0x2d74d(%rip), %rax     # 0x33880
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $0x7f7f7f7f7f7f7f7f, %rax # imm = 0x7F7F7F7F7F7F7F7F
andq %rax, %rdi
movabsq $-0x4040404040404041, %rax # imm = 0xBFBFBFBFBFBFBFBF
andq %rax, %rdi
andq $-0x100, %rdi
movl $0xfffffffa, %esi       # imm = 0xFFFFFFFA
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d705(%rip), %rax     # 0x33880
orq (%rax,%rcx,8), %rdx
leaq 0x2d6fa(%rip), %rax     # 0x33880
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $-0x202020202020203, %rax # imm = 0xFDFDFDFDFDFDFDFD
andq %rax, %rdi
movabsq $-0x101010101010102, %rax # imm = 0xFEFEFEFEFEFEFEFE
andq %rax, %rdi
movabsq $0xffffffffffffff, %rax # imm = 0xFFFFFFFFFFFFFF
andq %rax, %rdi
movl $0x6, %esi
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d6ac(%rip), %rax     # 0x33880
orq (%rax,%rcx,8), %rdx
leaq 0x2d6a1(%rip), %rax     # 0x33880
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $-0x202020202020203, %rax # imm = 0xFDFDFDFDFDFDFDFD
andq %rax, %rdi
movabsq $-0x101010101010102, %rax # imm = 0xFEFEFEFEFEFEFEFE
andq %rax, %rdi
andq $-0x100, %rdi
movl $0xfffffff6, %esi       # imm = 0xFFFFFFF6
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d659(%rip), %rax     # 0x33880
orq (%rax,%rcx,8), %rdx
leaq 0x2d64e(%rip), %rax     # 0x33880
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
andq $-0x100, %rdi
andq $-0xff01, %rdi          # imm = 0xFFFF00FF
movabsq $-0x101010101010102, %rax # imm = 0xFEFEFEFEFEFEFEFE
andq %rax, %rdi
movl $0xffffffef, %esi       # imm = 0xFFFFFFEF
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d60c(%rip), %rax     # 0x33880
orq (%rax,%rcx,8), %rdx
leaq 0x2d601(%rip), %rax     # 0x33880
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
andq $-0x100, %rdi
andq $-0xff01, %rdi          # imm = 0xFFFF00FF
movabsq $0x7f7f7f7f7f7f7f7f, %rax # imm = 0x7F7F7F7F7F7F7F7F
andq %rax, %rdi
movl $0xfffffff1, %esi       # imm = 0xFFFFFFF1
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d5bf(%rip), %rax     # 0x33880
orq (%rax,%rcx,8), %rdx
leaq 0x2d5b4(%rip), %rax     # 0x33880
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $-0xff000000000001, %rax # imm = 0xFF00FFFFFFFFFFFF
andq %rax, %rdi
movabsq $0xffffffffffffff, %rax # imm = 0xFFFFFFFFFFFFFF
andq %rax, %rdi
movabsq $-0x101010101010102, %rax # imm = 0xFEFEFEFEFEFEFEFE
andq %rax, %rdi
movl $0xf, %esi
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d566(%rip), %rax     # 0x33880
orq (%rax,%rcx,8), %rdx
leaq 0x2d55b(%rip), %rax     # 0x33880
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %edi
callq 0x6bd0
movq %rax, %rdi
movabsq $-0xff000000000001, %rax # imm = 0xFF00FFFFFFFFFFFF
andq %rax, %rdi
movabsq $0xffffffffffffff, %rax # imm = 0xFFFFFFFFFFFFFF
andq %rax, %rdi
movabsq $0x7f7f7f7f7f7f7f7f, %rax # imm = 0x7F7F7F7F7F7F7F7F
andq %rax, %rdi
movl $0x11, %esi
callq 0x6ca0
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2d50d(%rip), %rax     # 0x33880
orq (%rax,%rcx,8), %rdx
leaq 0x2d502(%rip), %rax     # 0x33880
movq %rdx, (%rax,%rcx,8)
movslq -0x4(%rbp), %rcx
leaq 0x1ec83(%rip), %rax     # 0x25010
movl (%rax,%rcx,4), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x18(%rbp)
movslq -0x18(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x5030
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2e2b3(%rip), %rax     # 0x34680
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x6406
movslq -0x4(%rbp), %rcx
leaq 0x2e295(%rip), %rax     # 0x34680
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x63d8
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x661d
movl -0x20(%rbp), %edi
movslq -0x4(%rbp), %rcx
leaq 0x1ece9(%rip), %rax     # 0x25110
movq (%rax,%rcx,8), %rsi
movslq -0x4(%rbp), %rcx
leaq 0x1ebda(%rip), %rax     # 0x25010
movl (%rax,%rcx,4), %edx
callq 0x6a80
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x4(%rbp), %rcx
leaq 0x1eebf(%rip), %rax     # 0x25310
movq (%rax,%rcx,8), %rsi
movslq -0x4(%rbp), %rcx
leaq 0x1ebb0(%rip), %rax     # 0x25010
movl (%rax,%rcx,4), %edx
callq 0x6ce0
movl %eax, -0x2c(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x2e20a(%rip), %rax     # 0x34680
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x648e
jmp 0x6490
jmp 0x64af
leaq 0x1f579(%rip), %rdi     # 0x25a10
leaq 0x1f58c(%rip), %rsi     # 0x25a2a
movl $0x64, %edx
leaq 0x1f590(%rip), %rcx     # 0x25a3a
callq 0x5290
movslq -0x4(%rbp), %rcx
leaq 0x2e1c6(%rip), %rax     # 0x34680
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl -0xc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jl 0x651d
movl -0x8(%rbp), %edi
movl -0x3c(%rbp), %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
movq -0x38(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
andq -0x48(%rbp), %rax
cmpq $0x0, %rax
je 0x6510
jmp 0x651d
jmp 0x6512
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x64d6
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
cmpl $0x8, -0x4c(%rbp)
jge 0x656d
movl -0x8(%rbp), %edi
movl -0x4c(%rbp), %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rcx
movq -0x38(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
andq -0x58(%rbp), %rax
cmpq $0x0, %rax
je 0x6560
jmp 0x656d
jmp 0x6562
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x6526
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
cmpl $0x8, -0x5c(%rbp)
jge 0x65bd
movl -0x5c(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rcx
movq -0x38(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
andq -0x68(%rbp), %rax
cmpq $0x0, %rax
je 0x65b0
jmp 0x65bd
jmp 0x65b2
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x6576
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x6c(%rbp)
jl 0x660d
movl -0x6c(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rcx
movq -0x38(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
andq -0x78(%rbp), %rax
cmpq $0x0, %rax
je 0x6600
jmp 0x660d
jmp 0x6602
movl -0x6c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x65c6
jmp 0x660f
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x640d
movslq -0x4(%rbp), %rcx
leaq 0x1eee8(%rip), %rax     # 0x25510
movl (%rax,%rcx,4), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x7c(%rbp)
movslq -0x7c(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x5030
movq %rax, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x2e218(%rip), %rax     # 0x34880
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jge 0x66a1
movslq -0x4(%rbp), %rcx
leaq 0x2e1fa(%rip), %rax     # 0x34880
movq (%rax,%rcx,8), %rax
movslq -0x80(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x6673
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jge 0x6a65
movl -0x84(%rbp), %edi
movslq -0x4(%rbp), %rcx
leaq 0x1ef45(%rip), %rax     # 0x25610
movq (%rax,%rcx,8), %rsi
movslq -0x4(%rbp), %rcx
leaq 0x1ee36(%rip), %rax     # 0x25510
movl (%rax,%rcx,4), %edx
callq 0x6a80
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movslq -0x4(%rbp), %rcx
leaq 0x1f115(%rip), %rax     # 0x25810
movq (%rax,%rcx,8), %rsi
movslq -0x4(%rbp), %rcx
leaq 0x1ee06(%rip), %rax     # 0x25510
movl (%rax,%rcx,4), %edx
callq 0x6ce0
movl %eax, -0x94(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x2e15d(%rip), %rax     # 0x34880
movq (%rax,%rcx,8), %rax
movslq -0x94(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x673e
jmp 0x6740
jmp 0x675f
leaq 0x1f313(%rip), %rdi     # 0x25a5a
leaq 0x1f2dc(%rip), %rsi     # 0x25a2a
movl $0x91, %edx
leaq 0x1f2e0(%rip), %rcx     # 0x25a3a
callq 0x5290
movslq -0x4(%rbp), %rcx
leaq 0x2e116(%rip), %rax     # 0x34880
movq (%rax,%rcx,8), %rax
movslq -0x94(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movl -0xc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xa4(%rbp)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
xorl %eax, %eax
cmpl $0x0, -0xa4(%rbp)
movb %al, -0xf1(%rbp)
jl 0x67bc
cmpl $0x8, -0xa8(%rbp)
setl %al
movb %al, -0xf1(%rbp)
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x67c8
jmp 0x6836
movl -0xa8(%rbp), %edi
movl -0xa4(%rbp), %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rcx
movq -0xa0(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rax
andq -0xb0(%rbp), %rax
cmpq $0x0, %rax
je 0x6811
jmp 0x6836
jmp 0x6813
movl -0xa4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xa4(%rbp)
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x679b
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
xorl %eax, %eax
cmpl $0x8, -0xb4(%rbp)
movb %al, -0xf2(%rbp)
jge 0x686f
cmpl $0x8, -0xb8(%rbp)
setl %al
movb %al, -0xf2(%rbp)
movb -0xf2(%rbp), %al
testb $0x1, %al
jne 0x687b
jmp 0x68e9
movl -0xb8(%rbp), %edi
movl -0xb4(%rbp), %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rcx
movq -0xa0(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rax
andq -0xc0(%rbp), %rax
cmpq $0x0, %rax
je 0x68c4
jmp 0x68e9
jmp 0x68c6
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x684e
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xc8(%rbp)
xorl %eax, %eax
cmpl $0x8, -0xc4(%rbp)
movb %al, -0xf3(%rbp)
jge 0x6922
cmpl $0x0, -0xc8(%rbp)
setge %al
movb %al, -0xf3(%rbp)
movb -0xf3(%rbp), %al
testb $0x1, %al
jne 0x692e
jmp 0x699c
movl -0xc8(%rbp), %edi
movl -0xc4(%rbp), %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rcx
movq -0xa0(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rax
andq -0xd0(%rbp), %rax
cmpq $0x0, %rax
je 0x6977
jmp 0x699c
jmp 0x6979
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
movl -0xc8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x6901
movl -0xc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xd4(%rbp)
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xd8(%rbp)
xorl %eax, %eax
cmpl $0x0, -0xd4(%rbp)
movb %al, -0xf4(%rbp)
jl 0x69d5
cmpl $0x0, -0xd8(%rbp)
setge %al
movb %al, -0xf4(%rbp)
movb -0xf4(%rbp), %al
testb $0x1, %al
jne 0x69e1
jmp 0x6a4f
movl -0xd8(%rbp), %edi
movl -0xd4(%rbp), %esi
callq 0x6c20
movl %eax, %edi
callq 0x6bd0
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rcx
movq -0xa0(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rax
andq -0xe0(%rbp), %rax
cmpq $0x0, %rax
je 0x6a2a
jmp 0x6a4f
jmp 0x6a2c
movl -0xd4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xd4(%rbp)
movl -0xd8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x69b4
jmp 0x6a51
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x66ab
jmp 0x6a67
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x5c02
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nop