// File: /workspace/github_cpp_makefile_star2_O1/Doug0855[P]TigerZone/Board.cpp
// Function: Board::buildJungle(Structure*, Tile*, std::vector<std::vector<Block, std::allocator<Block>>, std::allocator<std::vector<Block, std::allocator<Block>>>>&, std::pair<int, int>, std::vector<Tile*, std::allocator<Tile*>>&)
void Board::buildJungle(Structure* struc, Tile *tile, std::vector< std::vector<Block> >& tileBlocks, std::pair<int,int> blockSpot, std::vector<Tile*> &visitedTiles) {
	int row = blockSpot.first;
	int col = blockSpot.second;
	//debugging std::cout<<"in build jungle at "<<row<<' '<<col<<std::endl;
	tileBlocks[row][col].visit();

	struc->structureBlocks.push_back(tileBlocks[row][col]);

	if(tileBlocks[row][col].hasMeeple())
		struc->hasMeeple = true;

	bool addedTileAnimals = false;
	for(int i = 0; i < visitedTiles.size(); i++) {
			if(visitedTiles[i] == tile)
			{
				addedTileAnimals = true;
				//debugging std::cout<<"Added animals already for this tile"<<std::endl;
			}
	}
	if(!addedTileAnimals) {
		struc->checkAnimals(tile);
	}

	if(tileBlocks[row][col].getType() == "mixed") {
		int trailFaces = 0;
		// Determine how many faces are trail faces. If there's only 1 than we know the mixed blocks don't connect within the tile
		// Otherwise we know that the mixed blocks connect to form only 1 jungle rather than 2
		if(tile->getUpFace()->getType() == "trail")
			trailFaces++;
		if(tile->getDownFace()->getType() == "trail")
			trailFaces++;
		if(tile->getRightFace()->getType() == "trail")
			trailFaces++;
		if(tile->getLeftFace()->getType() == "trail")
			trailFaces++;

		if(trailFaces > 0) {
			if(trailFaces != 1) {
				for(int i = 0; i < 3; i++) {
					for(int j = 0; j < 3; j++) {
						if(tileBlocks[i][j].getType() == "mixed" && !(tileBlocks[i][j].isVisited()))
							buildJungle(struc, tile, tileBlocks, std::pair<int,int>(i,j), visitedTiles);
					}
				}
			}
		}

	}

	// Check tiles above, below, left, and right of the current block to see if lake structure continues
	// std::cout<<"about to cehck row+1"<<std::endl;
	if((row + 1) <= 2 && !(tileBlocks[row + 1][col].isVisited()) &&
		(tileBlocks[row+1][col].getType() == "jungle" || tileBlocks[row+1][col].getType() == "mixed")) {
		buildJungle(struc, tile, tileBlocks, std::pair<int,int>(row+1,col), visitedTiles);
	}
	else if(row + 1 > 2 && tile->getDownTile() != NULL) {
		bool visitedNeighborTile = false;
		for(int i = 0; i < visitedTiles.size(); i++) {
			if(visitedTiles[i] == tile->getDownTile())
				visitedNeighborTile = true;
		}
		if(!visitedNeighborTile && tile->getDownTile()->getUpFaceType()!= "lake") {
			visitedTiles.push_back(tile->getDownTile());
			std::vector< std::vector<Block> > newBlocks = tile->getDownTile()->getInnerBlocks();
			buildJungle(struc, tile->getDownTile(), newBlocks, std::pair<int,int>(row-2,col), visitedTiles);
		}
	}
	// std::cout<<"about to check row-1"<<std::endl;
	if((row - 1) >= 0 && !(tileBlocks[row - 1][col].isVisited()) &&
		(tileBlocks[row - 1][col].getType() == "jungle" || tileBlocks[row-1][col].getType() == "mixed")) {
		buildJungle(struc, tile, tileBlocks, std::pair<int,int>(row-1,col), visitedTiles);
	}
	else if(row-1 < 0 && tile->getUpTile() != NULL) {
		bool visitedNeighborTile = false;
		for(int i = 0; i < visitedTiles.size(); i++) {
			if(visitedTiles[i] == tile->getUpTile())
				visitedNeighborTile = true;
		}
		if (!visitedNeighborTile && tile->getUpTile()->getDownFaceType() != "lake") {
			visitedTiles.push_back(tile->getUpTile());
			std::vector< std::vector<Block> > newBlocks = tile->getUpTile()->getInnerBlocks();
			buildJungle(struc, tile->getUpTile(), newBlocks, std::pair<int,int>(row+2,col), visitedTiles);
		}
	}
	// std::cout<<"about to check col+1"<<std::endl;
	if((col + 1) <= 2 && !(tileBlocks[row][col + 1].isVisited()) &&
		(tileBlocks[row][col + 1].getType() == "jungle" || tileBlocks[row][col+1].getType() == "mixed")) {
		buildJungle(struc, tile, tileBlocks, std::pair<int,int>(row,col+1), visitedTiles);
	}
	else if(col+1 > 2 && tile->getRightTile() != NULL) {
		bool visitedNeighborTile = false;
		for(int i = 0; i < visitedTiles.size(); i++) {
			if(visitedTiles[i] == tile->getRightTile())
				visitedNeighborTile = true;
		}
		if (!visitedNeighborTile && tile->getRightTile()->getLeftFaceType() != "lake") {
			visitedTiles.push_back(tile->getRightTile());
			std::vector< std::vector<Block> > newBlocks = tile->getRightTile()->getInnerBlocks();
			buildJungle(struc, tile->getRightTile(), newBlocks, std::pair<int,int>(row,col-2), visitedTiles);
		}
	}
	// std::cout<<"about to check col-1"<<std::endl;
	if((col - 1) >= 0 && !(tileBlocks[row][col-1].isVisited()) &&
		(tileBlocks[row][col - 1].getType() == "jungle" ||	 tileBlocks[row][col-1].getType() == "mixed")) {
		// std::cout<<"passing col-1"<<std::endl;
		buildJungle(struc, tile, tileBlocks, std::pair<int,int>(row,col-1), visitedTiles);
	}
	else if(col-1 < 0 && tile->getLeftTile() != NULL) {
		bool visitedNeighborTile = false;
		for(int i = 0; i < visitedTiles.size(); i++) {
			if(visitedTiles[i] == tile->getLeftTile())
				visitedNeighborTile = true;
		}
		if (!visitedNeighborTile && tile->getLeftTile()->getRightFaceType() != "lake") {
			visitedTiles.push_back(tile->getLeftTile());
			std::vector< std::vector<Block> > newBlocks = tile->getLeftTile()->getInnerBlocks();
			buildJungle(struc, tile->getLeftTile(), newBlocks, std::pair<int,int>(row,col+2), visitedTiles);
		}
	}
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq %r9, %r13
movq %rcx, %rbx
movq %rdx, -0x40(%rbp)
movq %rdi, -0x58(%rbp)
movslq %r8d, %rcx
movq (%rbx), %rax
movq %rcx, -0x80(%rbp)
leaq (,%rcx,8), %rcx
leaq (%rcx,%rcx,2), %r15
movq %r8, -0x48(%rbp)
movq %r8, %r14
sarq $0x20, %r14
movq (%rax,%r15), %rcx
leaq (,%r14,8), %rdx
leaq (%rdx,%rdx,4), %r12
movb $0x1, 0x1(%rcx,%r12)
movq %rsi, -0x38(%rbp)
leaq 0x28(%rsi), %rdi
movq (%rax,%r15), %rsi
addq %r12, %rsi
callq 0x14124
movq %rbx, -0x30(%rbp)
movq (%rbx), %rax
movq (%rax,%r15), %rax
cmpb $0x1, (%rax,%r12)
jne 0x11ec7
movq -0x38(%rbp), %rax
movb $0x1, 0x50(%rax)
movq (%r13), %rax
movq 0x8(%r13), %rcx
subq %rax, %rcx
movq -0x40(%rbp), %rsi
je 0x11f02
sarq $0x3, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %r8d, %r8d
movl $0x1, %edi
xorl %edx, %edx
cmpq %rsi, (%rax,%r8,8)
movzbl %dl, %edx
cmovel %edi, %edx
incq %r8
cmpq %r8, %rcx
jne 0x11eee
jmp 0x11f04
xorl %edx, %edx
testb $0x1, %dl
jne 0x11f12
movq -0x38(%rbp), %rdi
callq 0x17b04
movq %r13, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x80(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq %rcx, -0x88(%rbp)
movq (%rax,%rcx,8), %rax
leaq (%r14,%r14,4), %rcx
leaq -0x68(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x8(%rax,%rcx,8), %rsi
movq %rcx, -0x90(%rbp)
movq 0x10(%rax,%rcx,8), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %r14
movq %r14, %rdi
callq 0x9da8
leaq 0x6931(%rip), %rsi      # 0x18894
movq %r14, %rdi
callq 0x30b0
movq %rbx, %rdx
movl %eax, %ebx
movq (%r14), %rdi
cmpq %rdx, %rdi
je 0x11f81
callq 0x3200
leaq -0x68(%rbp), %rdx
testl %ebx, %ebx
movq -0x30(%rbp), %r14
jne 0x121ba
leaq -0x78(%rbp), %r14
movq %rdx, (%r14)
movq -0x40(%rbp), %r12
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x9da8
leaq 0x6803(%rip), %rsi      # 0x187b7
movq %r14, %rdi
callq 0x30b0
leaq -0x68(%rbp), %rcx
movl %eax, %r13d
movq (%r14), %rdi
cmpq %rcx, %rdi
je 0x11fd4
callq 0x3200
leaq -0x68(%rbp), %rcx
xorl %ebx, %ebx
testl %r13d, %r13d
sete %bl
leaq -0x78(%rbp), %r15
movq %rcx, (%r15)
movq 0x38(%r12), %rsi
movq 0x40(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x9da8
leaq 0x67b8(%rip), %rsi      # 0x187b7
movq %r15, %rdi
callq 0x30b0
leaq -0x68(%rbp), %rcx
movl %eax, %r14d
movq (%r15), %rdi
cmpq %rcx, %rdi
je 0x1201f
callq 0x3200
leaq -0x68(%rbp), %rcx
xorl %eax, %eax
cmpl $0x1, %r13d
adcl $0x1, %eax
testl %r14d, %r14d
cmovel %eax, %ebx
leaq -0x78(%rbp), %r14
movq %rcx, (%r14)
movq 0x88(%r12), %rsi
movq 0x90(%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x9da8
leaq 0x6760(%rip), %rsi      # 0x187b7
movq %r14, %rdi
callq 0x30b0
leaq -0x68(%rbp), %rcx
movl %eax, %r15d
movq (%r14), %rdi
cmpq %rcx, %rdi
je 0x12077
callq 0x3200
leaq -0x68(%rbp), %rcx
cmpl $0x1, %r15d
adcl $0x0, %ebx
movq %rcx, (%r14)
movq 0x60(%r12), %rsi
movq 0x68(%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x9da8
leaq 0x671a(%rip), %rsi      # 0x187b7
movq %r14, %rdi
callq 0x30b0
leaq -0x68(%rbp), %rdx
movl %eax, %r15d
movq (%r14), %rdi
cmpq %rdx, %rdi
je 0x120bd
callq 0x3200
leaq -0x68(%rbp), %rdx
cmpl $0x1, %r15d
adcl $0x0, %ebx
cmpl $0x2, %ebx
movq -0x30(%rbp), %r14
jb 0x121ba
xorl %ebx, %ebx
leaq (%rbx,%rbx,2), %r13
xorl %r12d, %r12d
movq %rbx, -0x80(%rbp)
movq (%r14), %rax
movq (%rax,%r13,8), %rax
movq %rdx, -0x78(%rbp)
movq 0x8(%rax,%r12), %rsi
movq %rdx, %r15
movq 0x10(%rax,%r12), %rdx
addq %rsi, %rdx
movq %r13, %r14
leaq -0x78(%rbp), %r13
movq %r13, %rdi
callq 0x9da8
movq %r13, %rdi
leaq 0x6782(%rip), %rsi      # 0x18894
callq 0x30b0
testl %eax, %eax
je 0x12139
movq -0x78(%rbp), %rdi
cmpq %r15, %rdi
movq %r15, %rdx
je 0x12130
callq 0x3200
leaq -0x68(%rbp), %rdx
movq %r14, %r13
movq -0x30(%rbp), %r14
jmp 0x1218e
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %rax
movb 0x1(%rax,%r12), %al
movq -0x78(%rbp), %rdi
cmpq %r15, %rdi
movq %r15, %rdx
movq %r14, %r13
je 0x12167
movl %eax, %r14d
callq 0x3200
movl %r14d, %eax
leaq -0x68(%rbp), %rdx
testb %al, %al
movq -0x30(%rbp), %r14
jne 0x1218e
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %r14, %rcx
movq %rbx, %r8
movq -0x50(%rbp), %r9
callq 0x11e40
leaq -0x68(%rbp), %rdx
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %rbx
addq $0x28, %r12
cmpq $0x78, %r12
jne 0x120de
movq -0x80(%rbp), %rbx
incq %rbx
cmpq $0x3, %rbx
jne 0x120d3
movq -0x48(%rbp), %r15
cmpl $0x1, %r15d
jg 0x12203
movq %r15, %rcx
shlq $0x20, %rcx
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %rcx
sarq $0x20, %rcx
movq (%r14), %rax
leaq (%rcx,%rcx,2), %r14
movq (%rax,%r14,8), %rcx
movq -0x90(%rbp), %r12
cmpb $0x0, 0x1(%rcx,%r12,8)
movq -0x50(%rbp), %r13
je 0x12217
xorl %r14d, %r14d
xorl %eax, %eax
xorl %ebx, %ebx
jmp 0x1220e
xorl %r14d, %r14d
xorl %eax, %eax
xorl %ebx, %ebx
movq -0x50(%rbp), %r13
movq -0x40(%rbp), %r12
jmp 0x122ad
leaq (%rax,%r14,8), %rax
movq (%rax), %rax
leaq -0x78(%rbp), %rbx
movq %rdx, (%rbx)
movq 0x8(%rax,%r12,8), %rsi
movq 0x10(%rax,%r12,8), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x9da8
leaq 0x656a(%rip), %rsi      # 0x187ab
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
movq %r12, %rdx
movq -0x40(%rbp), %r12
je 0x122a2
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %rax
leaq -0x178(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x8(%rax,%rdx,8), %rsi
movq 0x10(%rax,%rdx,8), %rdx
addq %rsi, %rdx
leaq -0x188(%rbp), %rdi
callq 0x9da8
leaq 0x660a(%rip), %rsi      # 0x18894
leaq -0x188(%rbp), %rdi
callq 0x30b0
testl %eax, %eax
sete %bl
movb $0x1, %r14b
movb $0x1, %al
jmp 0x122a9
movb $0x1, %r14b
xorl %eax, %eax
movb $0x1, %bl
leaq -0x68(%rbp), %rdx
testb %al, %al
je 0x122ca
leaq -0x178(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x122ca
callq 0x3200
leaq -0x68(%rbp), %rdx
testb %r14b, %r14b
je 0x122dd
movq -0x78(%rbp), %rdi
cmpq %rdx, %rdi
je 0x122dd
callq 0x3200
movabsq $-0x100000000, %r14     # imm = 0xFFFFFFFF00000000
testb %bl, %bl
je 0x12314
leal 0x1(%r15), %r8d
movq %r15, %rax
andq %r14, %rax
orq %rax, %r8
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r12, %rdx
movq -0x30(%rbp), %rcx
movq %r13, %r9
callq 0x11e40
jmp 0x12465
cmpl $0x2, %r15d
jl 0x12465
movq 0xb8(%r12), %rax
testq %rax, %rax
je 0x12465
movq (%r13), %rcx
movq 0x8(%r13), %rdx
subq %rcx, %rdx
je 0x12368
sarq $0x3, %rdx
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %esi, %esi
movl $0x1, %edi
xorl %r15d, %r15d
cmpq %rax, (%rcx,%rsi,8)
movzbl %r15b, %r15d
cmovel %edi, %r15d
incq %rsi
cmpq %rsi, %rdx
jne 0x12352
jmp 0x1236b
xorl %r15d, %r15d
testb $0x1, %r15b
je 0x12375
xorl %ebx, %ebx
jmp 0x123ae
leaq -0x1f8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
leaq -0x208(%rbp), %rbx
movq %rbx, %rdi
callq 0x9da8
leaq 0x6411(%rip), %rsi      # 0x187b2
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
setne %bl
testb $0x1, %r15b
movq -0x48(%rbp), %r15
jne 0x123cd
leaq -0x1f8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x123cd
callq 0x3200
testb %bl, %bl
je 0x12465
movq 0xb8(%r12), %rax
movq %rax, -0xd0(%rbp)
movq 0x8(%r13), %rsi
cmpq 0x10(%r13), %rsi
je 0x123f8
movq %rax, (%rsi)
addq $0x8, 0x8(%r13)
jmp 0x12407
leaq -0xd0(%rbp), %rdx
movq %r13, %rdi
callq 0x14a62
movl $0xd0, %esi
addq 0xb8(%r12), %rsi
leaq -0xd0(%rbp), %rbx
movq %rbx, %rdi
callq 0x8e08
movq 0xb8(%r12), %rdx
movabsq $0x100000000, %rax      # imm = 0x100000000
leal (%rax,%r15), %r8d
addl $-0x2, %r8d
movq %r15, %rax
andq %r14, %rax
orq %rax, %r8
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rbx, %rcx
movq %r13, %r9
callq 0x11e40
leaq -0xd0(%rbp), %rdi
callq 0x14176
testl %r15d, %r15d
jle 0x1248c
leal -0x1(%r15), %ecx
movq -0x30(%rbp), %rax
movq (%rax), %rax
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rdx
movq -0x90(%rbp), %r15
cmpb $0x0, 0x1(%rdx,%r15,8)
je 0x12498
xorl %r15d, %r15d
xorl %eax, %eax
xorl %ebx, %ebx
jmp 0x12536
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %r12
movq (%rax,%r12,8), %rax
leaq -0xc0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x8(%rax,%r15,8), %rsi
movq 0x10(%rax,%r15,8), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %rbx
movq %rbx, %rdi
callq 0x9da8
leaq 0x62da(%rip), %rsi      # 0x187ab
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
je 0x1252b
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r12,8), %rax
leaq -0x158(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x8(%rax,%r15,8), %rsi
movq 0x10(%rax,%r15,8), %rdx
addq %rsi, %rdx
leaq -0x168(%rbp), %rdi
callq 0x9da8
leaq 0x6381(%rip), %rsi      # 0x18894
leaq -0x168(%rbp), %rdi
callq 0x30b0
testl %eax, %eax
sete %bl
movb $0x1, %r15b
movb $0x1, %al
jmp 0x12532
movb $0x1, %r15b
xorl %eax, %eax
movb $0x1, %bl
movq -0x40(%rbp), %r12
testb %al, %al
je 0x1254f
leaq -0x158(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1254f
callq 0x3200
testb %r15b, %r15b
movq -0x48(%rbp), %r15
je 0x1256d
leaq -0xc0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1256d
callq 0x3200
testb %bl, %bl
je 0x125a4
movabsq $0x100000000, %rax      # imm = 0x100000000
leal (%rax,%r15), %r8d
decl %r8d
movq %r15, %rax
andq %r14, %rax
orq %rax, %r8
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r12, %rdx
movq -0x30(%rbp), %rcx
movq %r13, %r9
callq 0x11e40
jmp 0x125ad
testl %r15d, %r15d
jle 0x12694
movq %r15, %rcx
shrq $0x20, %r15
cmpl $0x1, %r15d
jg 0x125f5
movq -0x30(%rbp), %rax
movq (%rax), %rax
movabsq $0x100000000, %rdx      # imm = 0x100000000
addq %rdx, %rcx
sarq $0x20, %rcx
movq -0x88(%rbp), %r12
movq (%rax,%r12,8), %rdx
leaq (%rcx,%rcx,4), %r13
cmpb $0x0, 0x1(%rdx,%r13,8)
je 0x12601
xorl %r12d, %r12d
xorl %eax, %eax
xorl %ebx, %ebx
jmp 0x126ec
xorl %r12d, %r12d
xorl %eax, %eax
xorl %ebx, %ebx
jmp 0x126f0
leaq (%rax,%r12,8), %rax
movq (%rax), %rax
leaq -0xa0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x8(%rax,%r13,8), %rsi
movq 0x10(%rax,%r13,8), %rdx
addq %rsi, %rdx
leaq -0xb0(%rbp), %rbx
movq %rbx, %rdi
callq 0x9da8
leaq 0x6175(%rip), %rsi      # 0x187ab
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
je 0x126e5
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r12,8), %rax
leaq -0x138(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x8(%rax,%r13,8), %rsi
movq 0x10(%rax,%r13,8), %rdx
addq %rsi, %rdx
leaq -0x148(%rbp), %rdi
callq 0x9da8
leaq 0x6218(%rip), %rsi      # 0x18894
leaq -0x148(%rbp), %rdi
callq 0x30b0
testl %eax, %eax
sete %bl
movb $0x1, %r12b
movb $0x1, %al
jmp 0x126ec
movq 0xb0(%r12), %rax
testq %rax, %rax
je 0x125ad
movq (%r13), %rcx
movq 0x8(%r13), %rdx
subq %rcx, %rdx
je 0x1284f
sarq $0x3, %rdx
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %esi, %esi
movl $0x1, %edi
xorl %r15d, %r15d
cmpq %rax, (%rcx,%rsi,8)
movzbl %r15b, %r15d
cmovel %edi, %r15d
incq %rsi
cmpq %rsi, %rdx
jne 0x126cc
jmp 0x12852
movb $0x1, %r12b
xorl %eax, %eax
movb $0x1, %bl
movq -0x50(%rbp), %r13
testb %al, %al
je 0x12709
leaq -0x138(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12709
callq 0x3200
testb %r12b, %r12b
movq -0x40(%rbp), %r12
je 0x12727
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12727
callq 0x3200
testb %bl, %bl
je 0x12764
movq -0x48(%rbp), %rcx
movq %rcx, %rax
andq %r14, %rax
movabsq $0x100000000, %rdx      # imm = 0x100000000
addq %rdx, %rax
movl %ecx, %r8d
orq %rax, %r8
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r12, %rdx
movq -0x30(%rbp), %rcx
movq %r13, %r9
callq 0x11e40
jmp 0x12954
cmpl $0x2, %r15d
jl 0x12954
movq 0xc8(%r12), %rax
testq %rax, %rax
je 0x12954
movq (%r13), %rcx
movq 0x8(%r13), %rdx
subq %rcx, %rdx
je 0x127b8
sarq $0x3, %rdx
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %esi, %esi
movl $0x1, %edi
xorl %r12d, %r12d
cmpq %rax, (%rcx,%rsi,8)
movzbl %r12b, %r12d
cmovel %edi, %r12d
incq %rsi
cmpq %rsi, %rdx
jne 0x127a2
jmp 0x127bb
xorl %r12d, %r12d
testb $0x1, %r12b
je 0x127c5
xorl %ebx, %ebx
jmp 0x127fe
leaq -0x1b8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
addq %rsi, %rdx
leaq -0x1c8(%rbp), %rbx
movq %rbx, %rdi
callq 0x9da8
leaq 0x5fc1(%rip), %rsi      # 0x187b2
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
setne %bl
testb $0x1, %r12b
movq -0x40(%rbp), %r12
jne 0x1281d
leaq -0x1b8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1281d
callq 0x3200
testb %bl, %bl
je 0x12954
movq 0xc8(%r12), %rax
movq %rax, -0xf0(%rbp)
movq 0x8(%r13), %rsi
cmpq 0x10(%r13), %rsi
je 0x128e6
movq %rax, (%rsi)
addq $0x8, 0x8(%r13)
jmp 0x128f5
xorl %r15d, %r15d
testb $0x1, %r15b
je 0x1285c
xorl %ebx, %ebx
jmp 0x12895
leaq -0x1d8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
addq %rsi, %rdx
leaq -0x1e8(%rbp), %rbx
movq %rbx, %rdi
callq 0x9da8
leaq 0x5f2a(%rip), %rsi      # 0x187b2
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
setne %bl
testb $0x1, %r15b
movq -0x48(%rbp), %r15
jne 0x128b4
leaq -0x1d8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x128b4
callq 0x3200
testb %bl, %bl
je 0x125ad
movq 0xb0(%r12), %rax
movq %rax, -0xb0(%rbp)
movq 0x8(%r13), %rsi
cmpq 0x10(%r13), %rsi
je 0x12b95
movq %rax, (%rsi)
addq $0x8, 0x8(%r13)
jmp 0x12ba4
leaq -0xf0(%rbp), %rdx
movq %r13, %rdi
callq 0x14a62
movl $0xd0, %esi
addq 0xc8(%r12), %rsi
leaq -0xf0(%rbp), %rbx
movq %rbx, %rdi
callq 0x8e08
movq 0xc8(%r12), %rdx
movq -0x48(%rbp), %rcx
movq %rcx, %rax
andq %r14, %rax
movl %ecx, %ecx
addq %rax, %rcx
movabsq $-0x200000000, %r8      # imm = 0xFFFFFFFE00000000
addq %rcx, %r8
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rbx, %rcx
movq %r13, %r9
callq 0x11e40
leaq -0xf0(%rbp), %rdi
callq 0x14176
testl %r15d, %r15d
jle 0x1298e
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
addq %r14, %rcx
sarq $0x20, %rcx
movq -0x88(%rbp), %r14
movq (%rax,%r14,8), %rdx
leaq (%rcx,%rcx,4), %r13
cmpb $0x0, 0x1(%rdx,%r13,8)
je 0x1299a
xorl %r12d, %r12d
xorl %eax, %eax
xorl %ebx, %ebx
jmp 0x12a31
xorl %r12d, %r12d
xorl %eax, %eax
xorl %ebx, %ebx
jmp 0x12a3f
leaq (%rax,%r14,8), %rax
movq (%rax), %rax
leaq -0xe0(%rbp), %r12
movq %r12, -0x10(%r12)
movq 0x8(%rax,%r13,8), %rsi
movq 0x10(%rax,%r13,8), %rdx
addq %rsi, %rdx
leaq -0xf0(%rbp), %rbx
movq %rbx, %rdi
callq 0x9da8
leaq 0x5ddb(%rip), %rsi      # 0x187ab
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
je 0x12a2a
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %rax
leaq -0x118(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x8(%rax,%r13,8), %rsi
movq 0x10(%rax,%r13,8), %rdx
addq %rsi, %rdx
leaq -0x128(%rbp), %rdi
callq 0x9da8
leaq 0x5e82(%rip), %rsi      # 0x18894
leaq -0x128(%rbp), %rdi
callq 0x30b0
testl %eax, %eax
sete %bl
movb $0x1, %r12b
movb $0x1, %al
jmp 0x12a31
movb $0x1, %r12b
xorl %eax, %eax
movb $0x1, %bl
movq -0x50(%rbp), %r13
movabsq $-0x100000000, %r14     # imm = 0xFFFFFFFF00000000
testb %al, %al
je 0x12a58
leaq -0x118(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12a58
callq 0x3200
testb %r12b, %r12b
movq -0x40(%rbp), %r12
je 0x12a76
leaq -0xe0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12a76
callq 0x3200
testb %bl, %bl
je 0x12aa6
movq -0x48(%rbp), %rcx
movq %rcx, %rax
andq %r14, %rax
addq %r14, %rax
movl %ecx, %r8d
orq %rax, %r8
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r12, %rdx
movq -0x30(%rbp), %rcx
movq %r13, %r9
callq 0x11e40
jmp 0x12aab
testl %r15d, %r15d
jle 0x12abd
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xc0(%r12), %rax
testq %rax, %rax
je 0x12aab
movq (%r13), %rcx
movq 0x8(%r13), %rdx
subq %rcx, %rdx
je 0x12b03
sarq $0x3, %rdx
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %esi, %esi
movl $0x1, %edi
xorl %r15d, %r15d
cmpq %rax, (%rcx,%rsi,8)
movzbl %r15b, %r15d
cmovel %edi, %r15d
incq %rsi
cmpq %rsi, %rdx
jne 0x12aed
jmp 0x12b06
xorl %r15d, %r15d
testb $0x1, %r15b
je 0x12b10
xorl %ebx, %ebx
jmp 0x12b4f
leaq -0x198(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x88(%rax), %rsi
movq 0x90(%rax), %rdx
addq %rsi, %rdx
leaq -0x1a8(%rbp), %rbx
movq %rbx, %rdi
callq 0x9da8
leaq 0x5c70(%rip), %rsi      # 0x187b2
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
setne %bl
testb $0x1, %r15b
jne 0x12b6a
leaq -0x198(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12b6a
callq 0x3200
testb %bl, %bl
je 0x12aab
movq 0xc0(%r12), %rax
movq %rax, -0x108(%rbp)
movq 0x8(%r13), %rsi
cmpq 0x10(%r13), %rsi
je 0x12bf9
movq %rax, (%rsi)
addq $0x8, 0x8(%r13)
jmp 0x12c08
leaq -0xb0(%rbp), %rdx
movq %r13, %rdi
callq 0x14a62
movl $0xd0, %esi
addq 0xb0(%r12), %rsi
leaq -0xb0(%rbp), %rbx
movq %rbx, %rdi
callq 0x8e08
movq 0xb0(%r12), %rdx
leal 0x2(%r15), %r8d
movq %r15, %rax
andq %r14, %rax
orq %rax, %r8
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rbx, %rcx
movq %r13, %r9
callq 0x11e40
leaq -0xb0(%rbp), %rdi
callq 0x14176
jmp 0x125ad
leaq -0x108(%rbp), %rdx
movq %r13, %rdi
callq 0x14a62
movq -0x48(%rbp), %r15
movl $0xd0, %esi
addq 0xc0(%r12), %rsi
leaq -0x108(%rbp), %rbx
movq %rbx, %rdi
callq 0x8e08
movq 0xc0(%r12), %rdx
andq %r15, %r14
movl %r15d, %eax
addq %r14, %rax
movabsq $0x200000000, %r8       # imm = 0x200000000
addq %rax, %r8
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rbx, %rcx
movq %r13, %r9
callq 0x11e40
leaq -0x108(%rbp), %rdi
callq 0x14176
jmp 0x12aab
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
jmp 0x12c98
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
jmp 0x12c98
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
jmp 0x12c98
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x14176
jmp 0x12ceb
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
jmp 0x12ce1
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
jmp 0x12ce1
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
cmpq %r12, %rdi
jne 0x12ce6
jmp 0x12ceb
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x12ceb
callq 0x3200
movq %rbx, %rdi
callq 0x33f0
nop