// File: /workspace/github_cpp_makefile_star2_O2/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 $0x78, %rsp
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %rbx
movaps 0x27ef(%rip), %xmm0     # 0x6520
movaps %xmm0, -0x90(%rbp)
movaps 0x27d1(%rip), %xmm0     # 0x6510
movaps %xmm0, -0xa0(%rbp)
cmpl $-0x1, %esi
je 0x4180
movq %r15, -0x60(%rbp)
movl %r12d, %edi
callq 0x3558
movl %eax, %r14d
movl %r12d, %edi
callq 0x356a
leal 0x38(%r14), %ecx
movl %ecx, -0x50(%rbp)
leal (,%rax,8), %edx
movq %rax, -0x58(%rbp)
leal 0x7(,%rax,8), %ecx
movl %ecx, -0x4c(%rbp)
movq %r14, -0x38(%rbp)
movl %r14d, -0x48(%rbp)
movl %edx, -0x44(%rbp)
movl %r12d, -0x74(%rbp)
movslq %r12d, %r12
leaq 0x208(%rbx), %r14
xorl %r13d, %r13d
cmpq $0x4, %r13
je 0x3dd7
movq 0x8(%rbx,%r12,8), %rdi
movl -0x50(%rbp,%r13,4), %r15d
movl %r15d, %esi
movq %r14, %rdx
callq 0x54e6
movl %eax, -0x70(%rbp,%r13,4)
cmpl $-0x1, %eax
jne 0x3dd2
movslq %r15d, %rax
cmpb $0x1, (%r14,%rax)
jne 0x3dd2
movl %r15d, -0x70(%rbp,%r13,4)
incq %r13
jmp 0x3d9e
xorl %r15d, %r15d
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
cmpq $0x4, %r15
je 0x3ebb
movl -0x70(%rbp,%r15,4), %r13d
cmpl $-0x1, %r13d
je 0x3eb3
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x2679(%rip), %rsi      # 0x648f
callq 0x2160
testl %eax, %eax
je 0x3eae
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x2667(%rip), %rsi      # 0x649f
callq 0x2160
testl %eax, %eax
je 0x3eae
movl %r13d, %edi
callq 0x3558
movq -0x38(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x3eb3
movl %r13d, %edi
callq 0x356a
movq -0x58(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x3eb3
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x2611(%rip), %rsi      # 0x649b
callq 0x2160
testl %eax, %eax
movl -0x2c(%rbp), %eax
movzbl %al, %eax
pushq $0x1
popq %rcx
cmovel %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
movzbl %al, %eax
cmovel %ecx, %eax
movl %eax, -0x30(%rbp)
jmp 0x3eb3
movb $0x1, %al
movl %eax, -0x2c(%rbp)
incq %r15
jmp 0x3de8
pushq $0x7
popq %rdx
testb $0x1, -0x2c(%rbp)
je 0x3eed
movq -0x60(%rbp), %r12
testb $0x1, -0x2c(%rbp)
jne 0x4143
xorl %eax, %eax
movl -0x74(%rbp), %ecx
cmpq $0x8, %rax
je 0x3fb3
addl %ecx, -0xa0(%rbp,%rax,4)
incq %rax
jmp 0x3ed7
movq -0x58(%rbp), %r9
cmpl $0x8, %r9d
movl %edx, %eax
cmovgel %r9d, %eax
subl %r9d, %eax
movq -0x38(%rbp), %r8
cmpl $0x8, %r8d
cmovgel %r8d, %edx
subl %r8d, %edx
cmpl %edx, %eax
movl %edx, %ecx
cmovbl %eax, %ecx
leal (%r8,%rcx), %esi
addl %r9d, %ecx
leal (%rsi,%rcx,8), %esi
movl %r9d, %ecx
sarl $0x1f, %ecx
notl %ecx
andl %r9d, %ecx
cmpl %ecx, %edx
cmovael %ecx, %edx
movl %esi, -0x50(%rbp)
leal (%r8,%rdx), %esi
movl %r9d, %edi
subl %edx, %edi
leal (%rsi,%rdi,8), %edx
movl %r8d, %esi
sarl $0x1f, %esi
notl %esi
andl %r8d, %esi
cmpl %esi, %ecx
cmovael %esi, %ecx
movl %edx, -0x4c(%rbp)
movl %r8d, %edx
subl %ecx, %edx
movl %r9d, %edi
subl %ecx, %edi
leal (%rdx,%rdi,8), %ecx
movl %ecx, -0x48(%rbp)
cmpl %esi, %eax
cmovbl %eax, %esi
movl %r8d, %eax
subl %esi, %eax
addl %r9d, %esi
leal (%rax,%rsi,8), %eax
movl %eax, -0x44(%rbp)
xorl %r13d, %r13d
cmpq $0x4, %r13
je 0x403c
movq 0x8(%rbx,%r12,8), %rdi
movl -0x50(%rbp,%r13,4), %r15d
movl %r15d, %esi
movq %r14, %rdx
callq 0x55ae
movl %eax, -0x70(%rbp,%r13,4)
cmpl $-0x1, %eax
jne 0x3fae
movslq %r15d, %rax
cmpb $0x1, (%r14,%rax)
jne 0x3fae
movl %r15d, -0x70(%rbp,%r13,4)
incq %r13
jmp 0x3f76
xorl %r15d, %r15d
leaq 0x24da(%rip), %r12      # 0x6497
cmpq $0x8, %r15
je 0x413f
movl -0xa0(%rbp,%r15,4), %r13d
cmpq $0x3f, %r13
ja 0x4037
cmpb $0x1, (%r14,%r13)
jne 0x4037
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3b08
movq %rax, %rdi
movq %r12, %rsi
callq 0x2160
testl %eax, %eax
jne 0x4037
movl %r13d, %edi
callq 0x3558
movq -0x38(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x2, %eax
ja 0x4037
movl %r13d, %edi
callq 0x356a
movq -0x58(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x3, %eax
movl -0x2c(%rbp), %eax
movzbl %al, %eax
pushq $0x1
popq %rcx
cmovbl %ecx, %eax
movl %eax, -0x2c(%rbp)
incq %r15
jmp 0x3fbd
xorl %r15d, %r15d
leaq 0x244d(%rip), %r13      # 0x6493
movq -0x60(%rbp), %r12
cmpq $0x4, %r15
je 0x3ec8
movl -0x70(%rbp,%r15,4), %r12d
cmpl $-0x1, %r12d
je 0x40ca
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3b08
movq %rax, %rdi
movq %r13, %rsi
callq 0x2160
testl %eax, %eax
je 0x40c5
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x2411(%rip), %rsi      # 0x649f
callq 0x2160
testl %eax, %eax
je 0x40c5
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x23df(%rip), %rsi      # 0x648b
callq 0x2160
testl %eax, %eax
jne 0x40d2
movl %r12d, %edi
callq 0x3558
subl -0x38(%rbp), %eax
cmpl $0x1, %eax
jne 0x40d2
movb $0x1, %al
movl %eax, -0x2c(%rbp)
incq %r15
jmp 0x4046
movl %r12d, %edi
callq 0x3558
movq -0x38(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x40ca
movl %r12d, %edi
callq 0x356a
movq -0x58(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x40ca
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x2380(%rip), %rsi      # 0x649b
callq 0x2160
testl %eax, %eax
movl -0x2c(%rbp), %eax
movzbl %al, %eax
pushq $0x1
popq %rcx
cmovel %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
movzbl %al, %eax
cmovel %ecx, %eax
movl %eax, -0x30(%rbp)
jmp 0x40ca
movq -0x60(%rbp), %r12
cmpl $-0x1, %r12d
jne 0x41c7
xorl %r12d, %r12d
cmpq $0x40, %r12
je 0x41c1
cmpb $0x1, (%r14,%r12)
jne 0x417b
movq -0x200(%r14,%r12,8), %rdi
callq 0x5694
cmpb $0x6b, %al
jne 0x417b
movq -0x200(%r14,%r12,8), %rdi
callq 0x569e
testb %al, %al
je 0x41c7
incq %r12
jmp 0x414c
xorl %r14d, %r14d
pushq $0x40
popq %r12
cmpq $0x40, %r14
je 0x3d4f
cmpb $0x1, 0x208(%rbx,%r14)
jne 0x41bc
movq 0x8(%rbx,%r14,8), %rdi
callq 0x5694
cmpb $0x6b, %al
jne 0x41bc
movq 0x8(%rbx,%r14,8), %rdi
callq 0x569e
testb %al, %al
jne 0x4558
incq %r14
jmp 0x4187
movl -0x74(%rbp), %eax
movl %eax, %r12d
movl %r12d, %edi
callq 0x3558
movl %eax, %r15d
movl %r12d, %edi
callq 0x356a
leal 0x38(%r15), %ecx
movl %ecx, -0x50(%rbp)
leal (,%rax,8), %edx
movq %rax, -0x58(%rbp)
leal 0x7(,%rax,8), %ecx
movl %ecx, -0x4c(%rbp)
movq %r15, -0x38(%rbp)
movl %r15d, -0x48(%rbp)
movl %edx, -0x44(%rbp)
movq %r12, -0x60(%rbp)
movslq %r12d, %r13
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x4244
movq 0x8(%rbx,%r13,8), %rdi
movl -0x50(%rbp,%r12,4), %r15d
movl %r15d, %esi
movq %r14, %rdx
callq 0x54e6
movl %eax, -0x70(%rbp,%r12,4)
cmpl $-0x1, %eax
jne 0x423f
movslq %r15d, %rax
cmpb $0x1, (%r14,%rax)
jne 0x423f
movl %r15d, -0x70(%rbp,%r12,4)
incq %r12
jmp 0x420b
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x429e
movl -0x70(%rbp,%r12,4), %r15d
cmpl $-0x1, %r15d
je 0x4299
movq %rbx, %rdi
movl %r15d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x220a(%rip), %rsi      # 0x6477
callq 0x2160
testl %eax, %eax
je 0x4294
movq %rbx, %rdi
movl %r15d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x21fc(%rip), %rsi      # 0x6487
callq 0x2160
testl %eax, %eax
jne 0x4299
movb $0x1, %al
movl %eax, -0x30(%rbp)
incq %r12
jmp 0x4247
testb $0x1, -0x30(%rbp)
je 0x42e6
movq -0x60(%rbp), %rcx
testb $0x1, -0x30(%rbp)
je 0x43ab
movl -0x2c(%rbp), %eax
andb $0x1, %al
movzbl %al, %ecx
movl -0x30(%rbp), %eax
testb $0x1, %al
pushq $0x2
popq %rdx
cmovel %ecx, %edx
testb %cl, %cl
cmovnel %ecx, %edx
testb $0x1, %al
pushq $0x3
popq %rax
cmovel %edx, %eax
testb %cl, %cl
cmovel %edx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x58(%rbp), %r9
cmpl $0x8, %r9d
pushq $0x7
popq %rdi
movl %edi, %eax
cmovgel %r9d, %eax
subl %r9d, %eax
movq -0x38(%rbp), %r8
cmpl $0x8, %r8d
cmovgel %r8d, %edi
subl %r8d, %edi
cmpl %edi, %eax
movl %edi, %ecx
cmovbl %eax, %ecx
leal (%r8,%rcx), %edx
addl %r9d, %ecx
leal (%rdx,%rcx,8), %edx
movl %r9d, %ecx
sarl $0x1f, %ecx
notl %ecx
andl %r9d, %ecx
cmpl %ecx, %edi
cmovael %ecx, %edi
movl %edx, -0x50(%rbp)
leal (%r8,%rdi), %edx
movl %r9d, %esi
subl %edi, %esi
leal (%rdx,%rsi,8), %edx
movl %r8d, %esi
sarl $0x1f, %esi
notl %esi
andl %r8d, %esi
cmpl %esi, %ecx
cmovael %esi, %ecx
movl %edx, -0x4c(%rbp)
movl %r8d, %edx
subl %ecx, %edx
movl %r9d, %edi
subl %ecx, %edi
leal (%rdx,%rdi,8), %ecx
movl %ecx, -0x48(%rbp)
cmpl %esi, %eax
cmovbl %eax, %esi
movl %r8d, %eax
subl %esi, %eax
addl %r9d, %esi
leal (%rax,%rsi,8), %eax
movl %eax, -0x44(%rbp)
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x43c3
movq 0x8(%rbx,%r13,8), %rdi
movl -0x50(%rbp,%r12,4), %r15d
movl %r15d, %esi
movq %r14, %rdx
callq 0x55ae
movl %eax, -0x70(%rbp,%r12,4)
cmpl $-0x1, %eax
jne 0x43a6
movslq %r15d, %rax
cmpb $0x1, (%r14,%rax)
jne 0x43a6
movl %r15d, -0x70(%rbp,%r12,4)
incq %r12
jmp 0x4372
xorl %eax, %eax
cmpq $0x8, %rax
je 0x44cf
addl %ecx, -0xa0(%rbp,%rax,4)
incq %rax
jmp 0x43ad
xorl %r15d, %r15d
leaq 0x20ae(%rip), %r13      # 0x647b
movq -0x60(%rbp), %rcx
cmpq $0x4, %r15
je 0x42a8
movl -0x70(%rbp,%r15,4), %r12d
cmpl $-0x1, %r12d
je 0x44c7
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3b08
movq %rax, %rdi
movq %r13, %rsi
callq 0x2160
testl %eax, %eax
je 0x44c2
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x206a(%rip), %rsi      # 0x6487
callq 0x2160
testl %eax, %eax
je 0x44c2
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x2034(%rip), %rsi      # 0x6473
callq 0x2160
testl %eax, %eax
jne 0x4458
movl %r12d, %edi
callq 0x3558
subl -0x38(%rbp), %eax
cmpl $-0x1, %eax
je 0x44c2
movl %r12d, %edi
callq 0x3558
movq -0x38(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x44c7
movl %r12d, %edi
callq 0x356a
movq -0x58(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
ja 0x44c7
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3b08
movq %rax, %rdi
leaq 0x1fe2(%rip), %rsi      # 0x6483
callq 0x2160
testl %eax, %eax
movl -0x2c(%rbp), %eax
movzbl %al, %eax
pushq $0x1
popq %rcx
cmovel %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
movzbl %al, %eax
cmovel %ecx, %eax
jmp 0x44c4
movb $0x1, %al
movl %eax, -0x30(%rbp)
incq %r15
jmp 0x43cd
xorl %r13d, %r13d
leaq 0x1fa6(%rip), %r15      # 0x647f
cmpq $0x8, %r13
je 0x42b2
movl -0xa0(%rbp,%r13,4), %r12d
cmpq $0x3f, %r12
ja 0x4553
cmpb $0x1, (%r14,%r12)
jne 0x4553
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3b08
movq %rax, %rdi
movq %r15, %rsi
callq 0x2160
testl %eax, %eax
jne 0x4553
movl %r12d, %edi
callq 0x3558
movq -0x38(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x2, %eax
ja 0x4553
movl %r12d, %edi
callq 0x356a
movq -0x58(%rbp), %rcx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x3, %eax
movl -0x30(%rbp), %eax
movzbl %al, %eax
pushq $0x1
popq %rcx
cmovbl %ecx, %eax
movl %eax, -0x30(%rbp)
incq %r13
jmp 0x44d9
movl %r14d, %r12d
jmp 0x3d4f