// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Board.cpp
// Function: Board::checkCheck(int, int)
int Board::checkCheck(int inputWhite, int inputBlack) {

	//Declaring variables
	bool whiteInCheck = 0;
	bool blackInCheck = 0;

  int kingSquare, kingRow, kingCol;

	int edges[4];					//Array of squares at the edge of board that could be attacking king, 0-3, anticlockwise starting east
	int pieceSquares[4];	//Array of squares with pieces, -1 if no piece

	//Increments for king row and column
	int kingRowIncr;
	int kingColIncr;

	//Squares that knighs could be on
	int knightSquares[8] = {17,10,-6,-15,-17,-10,6,15};

	//WHITE KING

	//Find what square the king is on, if it isn't passed
  if (inputWhite == -1) {
    for (int i = 0; i < 64; i++) {
  		if (activeArray[i]) {
  			if (pieceArray[i]->getType() == 'k' && pieceArray[i]->getIsWhite()) {
  				kingSquare = i;
  				break;
  			}
  		}
  	}
  } else {
    kingSquare = inputWhite;
  }

	//Find straight destinations
	kingRow = row(kingSquare);
	kingCol = col(kingSquare);

	edges[0] = 56 + kingRow;
	edges[1] = (8 * kingCol) + 7;
	edges[2] = 0 + kingRow;
	edges[3] = 8 * kingCol;

	//Find if pieces are on squares
	for (int i = 0; i < 4; i++) {
		pieceSquares[i] = pieceArray[kingSquare]->checkStraight(edges[i], activeArray);
		//checkStraight ignores the final square, so if it doesn't find anything, edges[i] is checked as well
		if (pieceSquares[i] == -1) {
			if (activeArray[edges[i]] == 1) {
				pieceSquares[i] = edges[i];
			}
		}
	}

	//Check squares
	for (int i = 0; i < 4; i++) {
		if (pieceSquares[i] != -1) {
			//If the piece is a black rook or queen
			if (strcmp(getPiece(pieceSquares[i]), u8"\u265C") == 0 || strcmp(getPiece(pieceSquares[i]), u8"\u265B") == 0) {
				whiteInCheck = 1;
			} else if ((abs(kingRow - row(pieceSquares[i])) <= 1 && abs(kingCol - col(pieceSquares[i])) <= 1) && strcmp(getPiece(pieceSquares[i]), u8"\u265A") == 0) {	//If the piece is a black king and within 1 square of the white king
				whiteInCheck = 1;
				blackInCheck = 1;
			}
		}
	}

	if (!whiteInCheck) {
		//Find diagonal destinations - edges now 0-3, anticlockwise starting north-east

		kingRowIncr = kingRow;
		kingColIncr = kingCol;

		while (kingRowIncr < 7 && kingColIncr < 7) {
			kingRowIncr++;
			kingColIncr++;
		}

		edges[0] = (kingColIncr * 8) + kingRowIncr;

		kingRowIncr = kingRow;
		kingColIncr = kingCol;

		while (kingRowIncr < 7 && kingColIncr > 0) {
			kingRowIncr++;
			kingColIncr--;
		}

		edges[1] = (kingColIncr * 8) + kingRowIncr;

		kingRowIncr = kingRow;
		kingColIncr = kingCol;

		while (kingRowIncr > 0 && kingColIncr > 0) {
			kingRowIncr--;
			kingColIncr--;
		}

		edges[2] = (kingColIncr * 8) + kingRowIncr;

		kingRowIncr = kingRow;
		kingColIncr = kingCol;

		while (kingRowIncr > 0 && kingColIncr < 7) {
			kingRowIncr--;
			kingColIncr++;
		}

		edges[3] = (kingColIncr * 8) + kingRowIncr;

		//Find if pieces are on squares
		for (int i = 0; i < 4; i++) {
			pieceSquares[i] = pieceArray[kingSquare]->checkDiagonal(edges[i], activeArray);
			//checkDiagonal ignores the final square, so if it doesn't find anything, edges[i] is checked as well
			if (pieceSquares[i] == -1) {
				if (activeArray[edges[i]] == 1) {
					pieceSquares[i] = edges[i];
				}
			}
		}

		//Check squares
		for (int i = 0; i < 4; i++) {
			if (pieceSquares[i] != -1) {
				//If the piece is a black bishop, queen or a pawn that is above white king on board
				if (strcmp(getPiece(pieceSquares[i]), u8"\u265D") == 0 || strcmp(getPiece(pieceSquares[i]), u8"\u265B") == 0 || (strcmp(getPiece(pieceSquares[i]), u8"\u265F") == 0 && row(pieceSquares[i]) - kingRow == 1)) {
					whiteInCheck = 1;
				} else if ((abs(kingRow - row(pieceSquares[i])) <= 1 && abs(kingCol - col(pieceSquares[i])) <= 1) && strcmp(getPiece(pieceSquares[i]), u8"\u265A") == 0) {	//If the piece is a black king and within 1 square of the white king
					whiteInCheck = 1;
					blackInCheck = 1;
				}
			}
		}
	}

	if (!whiteInCheck) {
		for (int i = 0; i < 8; i++) {
			knightSquares[i] += kingSquare;
		}

		for (int i = 0; i < 8; i++) {
			//If knightSquares[i] is an actual square
			if (knightSquares[i] >= 0 && knightSquares[i] <= 63) {
				//If there is a piece on knightSquares[i]
				if (activeArray[knightSquares[i]]) {
					//If the piece is a black knight and the within a radius of 2 squares from the king
					if (strcmp(getPiece(knightSquares[i]), u8"\u265E") == 0 && (abs(kingRow - row(knightSquares[i])) <= 2 && abs(kingCol - col(knightSquares[i])) <= 2)) {
						whiteInCheck = 1;
					}
				}
			}
		}
	}
	//BLACK KING
	//Find what square the king is on, if it isn't passed
  if (inputBlack == -1) {
    for (int i = 0; i < 64; i++) {
  		if (activeArray[i]) {
  			if (pieceArray[i]->getType() == 'k' && !pieceArray[i]->getIsWhite()) {
  				kingSquare = i;
  				break;
  			}
  		}
  	}
  } else {
    kingSquare = inputBlack;
  }

	kingRow = row(kingSquare);
	kingCol = col(kingSquare);

	//Find straight destinations
	edges[0] = 56 + kingRow;
	edges[1] = (8 * kingCol) + 7;
	edges[2] = 0 + kingRow;
	edges[3] = 8 * kingCol;

	//Find if pieces are on squares
	for (int i = 0; i < 4; i++) {
		pieceSquares[i] = pieceArray[kingSquare]->checkStraight(edges[i], activeArray);
		//checkStraight ignores the final square, so if it doesn't find anything, edges[i] is checked as well
		if (pieceSquares[i] == -1) {
			if (activeArray[edges[i]] == 1) {
				pieceSquares[i] = edges[i];
			}
		}
	}

	//Check squares
	for (int i = 0; i < 4; i++) {
		if (pieceSquares[i] != -1) {
			//If the piece is a white rook or queen
			if (strcmp(getPiece(pieceSquares[i]), u8"\u2656") == 0 || strcmp(getPiece(pieceSquares[i]), u8"\u2655") == 0) {
				blackInCheck = 1;
			}
		}
	}

	if (!blackInCheck) {
		//Find diagonal destinations - edges now 0-3, anticlockwise starting north-east
		kingRowIncr = kingRow;
		kingColIncr = kingCol;

		while (kingRowIncr < 7 && kingColIncr < 7) {
			kingRowIncr++;
			kingColIncr++;
		}

		edges[0] = (kingColIncr * 8) + kingRowIncr;

		kingRowIncr = kingRow;
		kingColIncr = kingCol;

		while (kingRowIncr < 7 && kingColIncr > 0) {
			kingRowIncr++;
			kingColIncr--;
		}

		edges[1] = (kingColIncr * 8) + kingRowIncr;

		kingRowIncr = kingRow;
		kingColIncr = kingCol;

		while (kingRowIncr > 0 && kingColIncr > 0) {
			kingRowIncr--;
			kingColIncr--;
		}

		edges[2] = (kingColIncr * 8) + kingRowIncr;

		kingRowIncr = kingRow;
		kingColIncr = kingCol;

		while (kingRowIncr > 0 && kingColIncr < 7) {
			kingRowIncr--;
			kingColIncr++;
		}

		edges[3] = (kingColIncr * 8) + kingRowIncr;

		//Find if pieces are on squares
		for (int i = 0; i < 4; i++) {
			pieceSquares[i] = pieceArray[kingSquare]->checkDiagonal(edges[i], activeArray);
			//checkDiagonal ignores the final square, so if it doesn't find anything, edges[i] is checked as well
			if (pieceSquares[i] == -1) {
				if (activeArray[edges[i]] == 1) {
					pieceSquares[i] = edges[i];
				}
			}
		}

		//Check squares
		for (int i = 0; i < 4; i++) {
			if (pieceSquares[i] != -1) {
				//If the piece is a white bishop, queen or a pawn that is below black king on board
				if (strcmp(getPiece(pieceSquares[i]), u8"\u2657") == 0 || strcmp(getPiece(pieceSquares[i]), u8"\u2655") == 0 || (strcmp(getPiece(pieceSquares[i]), u8"\u2659") == 0 && row(pieceSquares[i]) - kingRow == -1)) {
					blackInCheck = 1;
				} else if ((abs(kingRow - row(pieceSquares[i])) <= 1 && abs(kingCol - col(pieceSquares[i])) <= 1) && strcmp(getPiece(pieceSquares[i]), u8"♔") == 0) {	//If the piece is a white king and within 1 square of the black king
					whiteInCheck = 1;
					blackInCheck = 1;
				}
			}
		}
	}

	if (!blackInCheck) {

		for (int i = 0; i < 8; i++) {
			knightSquares[i] += kingSquare;
		}

		for (int i = 0; i < 8; i++) {
			//If knightSquares[i] is an actual square
			if (knightSquares[i] >= 0 && knightSquares[i] <= 63) {
				//If there is a piece on knightSquares[i]
				if (activeArray[knightSquares[i]]) {
					//If the piece is a white knight and the within a radius of 2 squares from the king
					if (strcmp(getPiece(knightSquares[i]), u8"\u2658") == 0 && (abs(kingRow - row(knightSquares[i])) <= 2 && abs(kingCol - col(knightSquares[i])) <= 2)) {
						blackInCheck = 1;
					}
				}
			}
		}
	}

	if (whiteInCheck && blackInCheck) {
		return 3;
	} else if (blackInCheck) {
		return 2;
	} else if (whiteInCheck) {
		return 1;
	}
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %r14d
movl %esi, %r12d
movq %rdi, %rbx
movaps 0x2257(%rip), %xmm0     # 0x6510
movaps %xmm0, -0x80(%rbp)
movaps 0x223c(%rip), %xmm0     # 0x6500
movaps %xmm0, -0x90(%rbp)
cmpl $-0x1, %esi
jne 0x4309
xorl %r12d, %r12d
cmpb $0x1, 0x208(%rbx,%r12)
jne 0x42fa
movq 0x8(%rbx,%r12,8), %rdi
callq 0x5c00
cmpb $0x6b, %al
jne 0x42fa
movq 0x8(%rbx,%r12,8), %rdi
callq 0x5c0a
testb %al, %al
jne 0x4309
incq %r12
cmpq $0x40, %r12
jne 0x42d3
movl $0x40, %r12d
movq %r14, -0x70(%rbp)
movl %r12d, %edi
callq 0x3a14
movl %eax, %r14d
movl %r12d, %edi
callq 0x3a29
leal 0x38(%r14), %ecx
movl %ecx, -0x40(%rbp)
leal (,%rax,8), %edx
movq %rax, -0x68(%rbp)
leal 0x7(,%rax,8), %ecx
movl %ecx, -0x3c(%rbp)
movq %r14, -0x48(%rbp)
movl %r14d, -0x38(%rbp)
movl %edx, -0x34(%rbp)
movslq %r12d, %rax
movq %rax, -0x50(%rbp)
leaq 0x208(%rbx), %r15
xorl %r14d, %r14d
movq -0x50(%rbp), %rax
movq 0x8(%rbx,%rax,8), %rdi
movl -0x40(%rbp,%r14,4), %r13d
movl %r13d, %esi
movq %r15, %rdx
callq 0x5a52
movl %eax, -0x60(%rbp,%r14,4)
cmpl $-0x1, %eax
jne 0x438a
movslq %r13d, %rax
cmpb $0x1, (%r15,%rax)
jne 0x438a
movl %r13d, -0x60(%rbp,%r14,4)
incq %r14
cmpq $0x4, %r14
jne 0x4358
xorl %r14d, %r14d
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x60(%rbp,%r14,4), %r13d
cmpl $-0x1, %r13d
je 0x4467
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x20f7(%rip), %rsi      # 0x64bf
callq 0x2160
testl %eax, %eax
je 0x4462
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x20e5(%rip), %rsi      # 0x64cf
callq 0x2160
testl %eax, %eax
je 0x4462
movl %r13d, %edi
callq 0x3a14
movq -0x48(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x4467
movl %r13d, %edi
callq 0x3a29
movq -0x68(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x4467
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x208f(%rip), %rsi      # 0x64cb
callq 0x2160
testl %eax, %eax
movl -0x2c(%rbp), %eax
movzbl %al, %eax
movl $0x1, %ecx
cmovel %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
movzbl %al, %eax
cmovel %ecx, %eax
movl %eax, -0x30(%rbp)
jmp 0x4467
movb $0x1, %al
movl %eax, -0x2c(%rbp)
incq %r14
cmpq $0x4, %r14
jne 0x43a4
testb $0x1, -0x2c(%rbp)
je 0x4938
testb $0x1, -0x2c(%rbp)
jne 0x4525
xorl %eax, %eax
addl %r12d, -0x90(%rbp,%rax,4)
incq %rax
cmpq $0x8, %rax
jne 0x448a
xorl %r14d, %r14d
movl -0x90(%rbp,%r14,4), %r13d
cmpq $0x3f, %r13
ja 0x4518
cmpb $0x1, 0x208(%rbx,%r13)
jne 0x4518
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x1ffb(%rip), %rsi      # 0x64c7
callq 0x2160
testl %eax, %eax
jne 0x4518
movl %r13d, %edi
callq 0x3a14
movq -0x48(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x2, %eax
ja 0x4518
movl %r13d, %edi
callq 0x3a29
movq -0x68(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x3, %eax
movl -0x2c(%rbp), %eax
movzbl %al, %eax
movl $0x1, %ecx
cmovbl %ecx, %eax
movl %eax, -0x2c(%rbp)
incq %r14
cmpq $0x8, %r14
jne 0x449e
movq -0x70(%rbp), %r14
cmpl $-0x1, %r14d
jne 0x4565
xorl %r14d, %r14d
cmpb $0x1, 0x208(%rbx,%r14)
jne 0x4559
movq 0x8(%rbx,%r14,8), %rdi
callq 0x5c00
cmpb $0x6b, %al
jne 0x4559
movq 0x8(%rbx,%r14,8), %rdi
callq 0x5c0a
testb %al, %al
je 0x4565
incq %r14
cmpq $0x40, %r14
jne 0x4532
movl %r12d, %r14d
movl %r14d, %edi
callq 0x3a14
movl %eax, %r12d
movl %r14d, %edi
callq 0x3a29
leal 0x38(%r12), %ecx
movl %ecx, -0x40(%rbp)
leal (,%rax,8), %edx
movq %rax, -0x48(%rbp)
leal 0x7(,%rax,8), %ecx
movl %ecx, -0x3c(%rbp)
movq %r12, -0x50(%rbp)
movl %r12d, -0x38(%rbp)
movl %edx, -0x34(%rbp)
movq %r14, -0x70(%rbp)
movslq %r14d, %r14
xorl %r13d, %r13d
movq 0x8(%rbx,%r14,8), %rdi
movl -0x40(%rbp,%r13,4), %r12d
movl %r12d, %esi
movq %r15, %rdx
callq 0x5a52
movl %eax, -0x60(%rbp,%r13,4)
cmpl $-0x1, %eax
jne 0x45d8
movslq %r12d, %rax
cmpb $0x1, (%r15,%rax)
jne 0x45d8
movl %r12d, -0x60(%rbp,%r13,4)
incq %r13
cmpq $0x4, %r13
jne 0x45aa
xorl %r13d, %r13d
movl -0x60(%rbp,%r13,4), %r12d
cmpl $-0x1, %r12d
je 0x4630
movq %rbx, %rdi
movl %r12d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x1ea3(%rip), %rsi      # 0x64a7
callq 0x2160
testl %eax, %eax
je 0x462b
movq %rbx, %rdi
movl %r12d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x1e95(%rip), %rsi      # 0x64b7
callq 0x2160
testl %eax, %eax
jne 0x4630
movb $0x1, %al
movl %eax, -0x30(%rbp)
incq %r13
cmpq $0x4, %r13
jne 0x45e4
testb $0x1, -0x30(%rbp)
jne 0x4859
movq -0x50(%rbp), %rdi
cmpl $0x7, %edi
setl %dl
movq -0x48(%rbp), %r8
cmpl $0x7, %r8d
setl %sil
movl %edi, %eax
movl %r8d, %ecx
testb %sil, %dl
je 0x4681
movl $0x6, %ecx
movl $0x6, %eax
subl %r8d, %eax
subl %edi, %ecx
cmpl %ecx, %eax
cmovbl %eax, %ecx
leal (%rdi,%rcx), %eax
incl %eax
addl %r8d, %ecx
incl %ecx
leal (%rax,%rcx,8), %eax
movl %eax, -0x40(%rbp)
cmpl $0x7, %edi
setge %al
testl %r8d, %r8d
setle %cl
orb %al, %cl
movl %edi, %ecx
movl %r8d, %eax
jne 0x46b3
leal -0x1(%r8), %eax
movl $0x6, %edx
subl %edi, %edx
cmpl %edx, %eax
cmovbl %eax, %edx
leal (%rdi,%rdx), %ecx
incl %ecx
subl %edx, %eax
leal (%rcx,%rax,8), %eax
movl %eax, -0x3c(%rbp)
testl %edi, %edi
setle %al
testl %r8d, %r8d
setle %cl
orb %al, %cl
movl %edi, %eax
movl %r8d, %ecx
jne 0x46df
leal -0x1(%rdi), %eax
leal -0x1(%r8), %ecx
cmpl %eax, %ecx
movl %eax, %edx
cmovbl %ecx, %edx
subl %edx, %eax
subl %edx, %ecx
leal (%rax,%rcx,8), %eax
movl %eax, -0x38(%rbp)
testl %edi, %edi
setle %al
cmpl $0x7, %r8d
setge %cl
orb %al, %cl
movl %edi, %eax
movl %r8d, %ecx
jne 0x4711
leal -0x1(%rdi), %eax
movl $0x6, %ecx
subl %r8d, %ecx
cmpl %ecx, %eax
cmovbl %eax, %ecx
subl %ecx, %eax
addl %r8d, %ecx
incl %ecx
leal (%rax,%rcx,8), %eax
movl %eax, -0x34(%rbp)
xorl %r13d, %r13d
movq 0x8(%rbx,%r14,8), %rdi
movl -0x40(%rbp,%r13,4), %r12d
movl %r12d, %esi
movq %r15, %rdx
callq 0x5b1a
movl %eax, -0x60(%rbp,%r13,4)
cmpl $-0x1, %eax
jne 0x4748
movslq %r12d, %rax
cmpb $0x1, (%r15,%rax)
jne 0x4748
movl %r12d, -0x60(%rbp,%r13,4)
incq %r13
cmpq $0x4, %r13
jne 0x471a
xorl %r14d, %r14d
leaq 0x1d50(%rip), %r15      # 0x64ab
movl $0x1, %r12d
movl -0x60(%rbp,%r14,4), %r13d
cmpl $-0x1, %r13d
je 0x484c
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
movq %r15, %rsi
callq 0x2160
testl %eax, %eax
je 0x4847
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x1d14(%rip), %rsi      # 0x64b7
callq 0x2160
testl %eax, %eax
je 0x4847
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x1cde(%rip), %rsi      # 0x64a3
callq 0x2160
testl %eax, %eax
jne 0x47de
movl %r13d, %edi
callq 0x3a14
subl -0x50(%rbp), %eax
cmpl $-0x1, %eax
je 0x4847
movl %r13d, %edi
callq 0x3a14
movq -0x50(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x484c
movl %r13d, %edi
callq 0x3a29
movq -0x48(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x484c
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x1c8c(%rip), %rsi      # 0x64b3
callq 0x2160
testl %eax, %eax
movl -0x2c(%rbp), %eax
movzbl %al, %eax
cmovel %r12d, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
movzbl %al, %eax
cmovel %r12d, %eax
jmp 0x4849
movb $0x1, %al
movl %eax, -0x30(%rbp)
incq %r14
cmpq $0x4, %r14
jne 0x4761
testb $0x1, -0x30(%rbp)
jne 0x4904
xorl %eax, %eax
movq -0x70(%rbp), %rcx
addl %ecx, -0x90(%rbp,%rax,4)
incq %rax
cmpq $0x8, %rax
jne 0x4869
xorl %r12d, %r12d
leaq 0x1c2c(%rip), %r14      # 0x64af
movl $0x1, %r13d
movl -0x90(%rbp,%r12,4), %r15d
cmpq $0x3f, %r15
ja 0x48fb
cmpb $0x1, 0x208(%rbx,%r15)
jne 0x48fb
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4090
movq %rax, %rdi
movq %r14, %rsi
callq 0x2160
testl %eax, %eax
jne 0x48fb
movl %r15d, %edi
callq 0x3a14
movq -0x50(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x2, %eax
ja 0x48fb
movl %r15d, %edi
callq 0x3a29
movq -0x48(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x3, %eax
movl -0x30(%rbp), %eax
movzbl %al, %eax
cmovbl %r13d, %eax
movl %eax, -0x30(%rbp)
incq %r12
cmpq $0x8, %r12
jne 0x4889
testb $0x1, -0x2c(%rbp)
je 0x4915
movl $0x3, %eax
testb $0x1, -0x30(%rbp)
jne 0x4929
movl -0x2c(%rbp), %eax
andb $0x1, %al
movzbl %al, %ecx
testb $0x1, -0x30(%rbp)
movl $0x2, %eax
cmovel %ecx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x48(%rbp), %rdi
cmpl $0x7, %edi
setl %dl
movq -0x68(%rbp), %r8
cmpl $0x7, %r8d
setl %sil
movl %edi, %eax
movl %r8d, %ecx
testb %sil, %dl
je 0x4976
movl $0x6, %ecx
movl $0x6, %eax
subl %r8d, %eax
subl %edi, %ecx
cmpl %ecx, %eax
cmovbl %eax, %ecx
leal (%rdi,%rcx), %eax
incl %eax
addl %r8d, %ecx
incl %ecx
leal (%rax,%rcx,8), %eax
movl %eax, -0x40(%rbp)
cmpl $0x7, %edi
setge %al
testl %r8d, %r8d
setle %cl
orb %al, %cl
movl %edi, %ecx
movl %r8d, %eax
jne 0x49a8
leal -0x1(%r8), %eax
movl $0x6, %edx
subl %edi, %edx
cmpl %edx, %eax
cmovbl %eax, %edx
leal (%rdi,%rdx), %ecx
incl %ecx
subl %edx, %eax
leal (%rcx,%rax,8), %eax
movl %eax, -0x3c(%rbp)
testl %edi, %edi
setle %al
testl %r8d, %r8d
setle %cl
orb %al, %cl
movl %edi, %eax
movl %r8d, %ecx
jne 0x49d4
leal -0x1(%rdi), %eax
leal -0x1(%r8), %ecx
cmpl %eax, %ecx
movl %eax, %edx
cmovbl %ecx, %edx
subl %edx, %eax
subl %edx, %ecx
leal (%rax,%rcx,8), %eax
movl %eax, -0x38(%rbp)
testl %edi, %edi
setle %al
cmpl $0x7, %r8d
setge %cl
orb %al, %cl
movl %edi, %eax
movl %r8d, %ecx
jne 0x4a06
leal -0x1(%rdi), %eax
movl $0x6, %ecx
subl %r8d, %ecx
cmpl %ecx, %eax
cmovbl %eax, %ecx
subl %ecx, %eax
addl %r8d, %ecx
incl %ecx
leal (%rax,%rcx,8), %eax
movl %eax, -0x34(%rbp)
xorl %r14d, %r14d
movq -0x50(%rbp), %rax
movq 0x8(%rbx,%rax,8), %rdi
movl -0x40(%rbp,%r14,4), %r13d
movl %r13d, %esi
movq %r15, %rdx
callq 0x5b1a
movl %eax, -0x60(%rbp,%r14,4)
cmpl $-0x1, %eax
jne 0x4a41
movslq %r13d, %rax
cmpb $0x1, (%r15,%rax)
jne 0x4a41
movl %r13d, -0x60(%rbp,%r14,4)
incq %r14
cmpq $0x4, %r14
jne 0x4a0f
xorl %r14d, %r14d
movl -0x60(%rbp,%r14,4), %r13d
cmpl $-0x1, %r13d
je 0x4ac7
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x1a56(%rip), %rsi      # 0x64c3
callq 0x2160
testl %eax, %eax
je 0x4ac2
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x1a44(%rip), %rsi      # 0x64cf
callq 0x2160
testl %eax, %eax
je 0x4ac2
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x1a12(%rip), %rsi      # 0x64bb
callq 0x2160
testl %eax, %eax
jne 0x4ad9
movl %r13d, %edi
callq 0x3a14
subl -0x48(%rbp), %eax
cmpl $0x1, %eax
jne 0x4ad9
movb $0x1, %al
movl %eax, -0x2c(%rbp)
incq %r14
cmpq $0x4, %r14
jne 0x4a4d
jmp 0x447e
movl %r13d, %edi
callq 0x3a14
movq -0x48(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x4ac7
movl %r13d, %edi
callq 0x3a29
movq -0x68(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x4ac7
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4090
movq %rax, %rdi
leaq 0x19a9(%rip), %rsi      # 0x64cb
callq 0x2160
testl %eax, %eax
movl -0x2c(%rbp), %eax
movzbl %al, %eax
movl $0x1, %ecx
cmovel %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
movzbl %al, %eax
cmovel %ecx, %eax
movl %eax, -0x30(%rbp)
jmp 0x4ac7
nop