// File: Doug0855[P]TigerZone/Board.cpp
// Function: Board::buildLake(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::buildLake(Structure* struc, Tile *tile, std::vector< std::vector<Block> >& tileBlocks, std::pair<int,int> blockSpot, std::vector<Tile*> &visitedTiles) {
	// std::cout<<"in build lake"<<std::endl;
	int row = blockSpot.first;
	int col = blockSpot.second;
	tileBlocks[row][col].visit();
	// for(int i = 0; i < 3; i++) {
	// 	for(int j = 0; j < 3; j++) {
	// 		std::cout<<"Block at "<<i<<' '<<j<<" for tile "<<tile<<" has been visited? "<<tileBlocks[i][j].isVisited()<<std::endl;
	// 	}
	// }

	// Push the current block into the vector of blocks for this structure
	struc->structureBlocks.push_back(tileBlocks[row][col]);

	// check block for meeple and set the structure boolean accordingly
	if(tileBlocks[row][col].hasMeeple())
		struc->hasMeeple = true;

	// Check to see if you've already added this tiles animals to the structure
	bool addedTileAnimals;
	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 you havent already added the tiles animals to the structure, do so
	if(!addedTileAnimals) {
		struc->checkAnimals(tile);
		// if(tile->hasCrocodile())
		// 	struc->crocodileCount++;
		// if(tile->hasDeer())
		// 	struc->deerCount++;
		// if(tile->hasBoar())
		// 	struc->boarCount++;
		// if(tile->hasBuffalo())
		// 	struc->buffaloCount++;
	}

	// Check tiles above, below, left, and right of the current block to see if lake structure continues. 
	// Call this function with the new coordinates (of the direction you're going) again if it does
	if((row + 1) <= 2 && !(tileBlocks[row + 1][col].isVisited()) && tileBlocks[row+1][col].getType() == "lake") {
		buildLake(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) {
			visitedTiles.push_back(tile->getDownTile());
			std::vector< std::vector<Block> > newBlocks = tile->getDownTile()->getInnerBlocks();
			buildLake(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() == "lake") {
		buildLake(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) {
			visitedTiles.push_back(tile->getUpTile());
			std::vector< std::vector<Block> > newBlocks = tile->getUpTile()->getInnerBlocks();
			buildLake(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() == "lake") {
		buildLake(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) {
			visitedTiles.push_back(tile->getRightTile());
			std::vector< std::vector<Block> > newBlocks = tile->getRightTile()->getInnerBlocks();
			buildLake(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() == "lake") {
		// std::cout<<"passing col-1"<<std::endl;
		buildLake(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) {
			visitedTiles.push_back(tile->getLeftTile());
			std::vector< std::vector<Block> > newBlocks = tile->getLeftTile()->getInnerBlocks();
			buildLake(struc, tile->getLeftTile(), newBlocks, std::pair<int,int>(row,col+2), visitedTiles);
		}
	}
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %r8, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x200(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x17390
movq %rax, %rdi
movslq -0x38(%rbp), %rsi
callq 0x173b0
movq %rax, %rdi
callq 0x20580
movq -0x18(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x1f8(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x17390
movq %rax, %rdi
movslq -0x38(%rbp), %rsi
callq 0x173b0
movq -0x1f8(%rbp), %rdi
movq %rax, %rsi
callq 0x205a0
movq -0x28(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x17390
movq %rax, %rdi
movslq -0x38(%rbp), %rsi
callq 0x173b0
movq %rax, %rdi
callq 0x20610
testb $0x1, %al
jne 0x1e289
jmp 0x1e291
movq -0x18(%rbp), %rax
movb $0x1, 0x50(%rax)
movl $0x0, -0x40(%rbp)
movslq -0x40(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x30(%rbp), %rdi
callq 0x81f0
movq %rax, %rcx
movq -0x208(%rbp), %rax
cmpq %rcx, %rax
jae 0x1e2e2
movq -0x30(%rbp), %rdi
movslq -0x40(%rbp), %rsi
callq 0x8230
movq (%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0x1e2d5
movb $0x1, -0x39(%rbp)
jmp 0x1e2d7
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x1e298
testb $0x1, -0x39(%rbp)
jne 0x1e2f5
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x28760
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movb $0x0, -0x61(%rbp)
xorl %eax, %eax
cmpl $0x2, %ecx
movb %al, -0x209(%rbp)
jg 0x1e3a2
movq -0x28(%rbp), %rdi
movl -0x34(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x17390
movq %rax, %rdi
movslq -0x38(%rbp), %rsi
callq 0x173b0
movq %rax, %rdi
callq 0x20630
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x209(%rbp)
jne 0x1e3a2
movq -0x28(%rbp), %rdi
movl -0x34(%rbp), %eax
incl %eax
movslq %eax, %rsi
callq 0x17390
movq %rax, %rdi
movslq -0x38(%rbp), %rsi
callq 0x173b0
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x15490
movq -0x218(%rbp), %rdi
movb $0x1, -0x61(%rbp)
leaq 0xb327(%rip), %rsi      # 0x296ae
callq 0x85b0
movb %al, -0x20a(%rbp)
jmp 0x1e394
movb -0x20a(%rbp), %al
movb %al, -0x209(%rbp)
jmp 0x1e3a2
movb -0x209(%rbp), %al
movb %al, -0x219(%rbp)
testb $0x1, -0x61(%rbp)
jne 0x1e3b6
jmp 0x1e3bf
leaq -0x60(%rbp), %rdi
callq 0x3210
movb -0x219(%rbp), %al
testb $0x1, %al
jne 0x1e3ce
jmp 0x1e459
movq -0x18(%rbp), %rax
movq %rax, -0x238(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x228(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
leaq -0x7c(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x20450
movq -0x200(%rbp), %rdi
movq -0x238(%rbp), %rsi
movq -0x230(%rbp), %rdx
movq -0x228(%rbp), %rcx
movq -0x30(%rbp), %r9
movq -0x7c(%rbp), %r8
callq 0x1e1d0
jmp 0x1e5f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
testb $0x1, -0x61(%rbp)
jne 0x1e44b
jmp 0x1e454
leaq -0x60(%rbp), %rdi
callq 0x3210
jmp 0x1ef4a
movl -0x34(%rbp), %eax
addl $0x1, %eax
cmpl $0x2, %eax
jle 0x1e5ee
movq -0x20(%rbp), %rdi
callq 0x20650
cmpq $0x0, %rax
je 0x1e5ee
movb $0x0, -0x81(%rbp)
movl $0x0, -0x88(%rbp)
movslq -0x88(%rbp), %rax
movq %rax, -0x240(%rbp)
movq -0x30(%rbp), %rdi
callq 0x81f0
movq %rax, %rcx
movq -0x240(%rbp), %rax
cmpq %rcx, %rax
jae 0x1e4fe
movq -0x30(%rbp), %rdi
movslq -0x88(%rbp), %rsi
callq 0x8230
movq (%rax), %rax
movq %rax, -0x248(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20650
movq %rax, %rcx
movq -0x248(%rbp), %rax
cmpq %rcx, %rax
jne 0x1e4eb
movb $0x1, -0x81(%rbp)
jmp 0x1e4ed
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x1e48c
testb $0x1, -0x81(%rbp)
jne 0x1e5ec
movq -0x30(%rbp), %rax
movq %rax, -0x260(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20650
movq -0x260(%rbp), %rdi
movq %rax, -0x90(%rbp)
leaq -0x90(%rbp), %rsi
callq 0x206a0
movq -0x20(%rbp), %rdi
callq 0x20650
movq %rax, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x206d0
movq -0x18(%rbp), %rax
movq %rax, -0x258(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20650
movq %rax, -0x250(%rbp)
jmp 0x1e56e
movl -0x34(%rbp), %eax
addl $-0x2, %eax
movl %eax, -0xb4(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb4(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x20450
jmp 0x1e593
movq -0x250(%rbp), %rdx
movq -0x258(%rbp), %rsi
movq -0x200(%rbp), %rdi
movq -0x30(%rbp), %r9
movq -0xb0(%rbp), %r8
leaq -0xa8(%rbp), %rcx
callq 0x1e1d0
jmp 0x1e5c1
leaq -0xa8(%rbp), %rdi
callq 0x20710
jmp 0x1e5ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x20710
jmp 0x1ef4a
jmp 0x1e5ee
jmp 0x1e5f0
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movb $0x0, -0xd9(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x261(%rbp)
jl 0x1e6a6
movq -0x28(%rbp), %rdi
movl -0x34(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x17390
movq %rax, %rdi
movslq -0x38(%rbp), %rsi
callq 0x173b0
movq %rax, %rdi
callq 0x20630
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x261(%rbp)
jne 0x1e6a6
movq -0x28(%rbp), %rdi
movl -0x34(%rbp), %eax
decl %eax
movslq %eax, %rsi
callq 0x17390
movq %rax, %rdi
movslq -0x38(%rbp), %rsi
callq 0x173b0
movq %rax, %rsi
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x15490
movq -0x270(%rbp), %rdi
movb $0x1, -0xd9(%rbp)
leaq 0xb023(%rip), %rsi      # 0x296ae
callq 0x85b0
movb %al, -0x262(%rbp)
jmp 0x1e698
movb -0x262(%rbp), %al
movb %al, -0x261(%rbp)
jmp 0x1e6a6
movb -0x261(%rbp), %al
movb %al, -0x271(%rbp)
testb $0x1, -0xd9(%rbp)
jne 0x1e6bd
jmp 0x1e6c9
leaq -0xd8(%rbp), %rdi
callq 0x3210
movb -0x271(%rbp), %al
testb $0x1, %al
jne 0x1e6d8
jmp 0x1e775
movq -0x18(%rbp), %rax
movq %rax, -0x290(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x288(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x280(%rbp)
movl -0x34(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xe8(%rbp)
leaq -0xe4(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x20450
movq -0x200(%rbp), %rdi
movq -0x290(%rbp), %rsi
movq -0x288(%rbp), %rdx
movq -0x280(%rbp), %rcx
movq -0x30(%rbp), %r9
movq -0xe4(%rbp), %r8
callq 0x1e1d0
jmp 0x1e90c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
testb $0x1, -0xd9(%rbp)
jne 0x1e764
jmp 0x1e770
leaq -0xd8(%rbp), %rdi
callq 0x3210
jmp 0x1ef4a
movl -0x34(%rbp), %eax
subl $0x1, %eax
cmpl $0x0, %eax
jge 0x1e90a
movq -0x20(%rbp), %rdi
callq 0x20770
cmpq $0x0, %rax
je 0x1e90a
movb $0x0, -0xe9(%rbp)
movl $0x0, -0xf0(%rbp)
movslq -0xf0(%rbp), %rax
movq %rax, -0x298(%rbp)
movq -0x30(%rbp), %rdi
callq 0x81f0
movq %rax, %rcx
movq -0x298(%rbp), %rax
cmpq %rcx, %rax
jae 0x1e81a
movq -0x30(%rbp), %rdi
movslq -0xf0(%rbp), %rsi
callq 0x8230
movq (%rax), %rax
movq %rax, -0x2a0(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20770
movq %rax, %rcx
movq -0x2a0(%rbp), %rax
cmpq %rcx, %rax
jne 0x1e807
movb $0x1, -0xe9(%rbp)
jmp 0x1e809
movl -0xf0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf0(%rbp)
jmp 0x1e7a8
testb $0x1, -0xe9(%rbp)
jne 0x1e908
movq -0x30(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20770
movq -0x2b8(%rbp), %rdi
movq %rax, -0xf8(%rbp)
leaq -0xf8(%rbp), %rsi
callq 0x206a0
movq -0x20(%rbp), %rdi
callq 0x20770
movq %rax, %rsi
leaq -0x110(%rbp), %rdi
callq 0x206d0
movq -0x18(%rbp), %rax
movq %rax, -0x2b0(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20770
movq %rax, -0x2a8(%rbp)
jmp 0x1e88a
movl -0x34(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x11c(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x11c(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x20450
jmp 0x1e8af
movq -0x2a8(%rbp), %rdx
movq -0x2b0(%rbp), %rsi
movq -0x200(%rbp), %rdi
movq -0x30(%rbp), %r9
movq -0x118(%rbp), %r8
leaq -0x110(%rbp), %rcx
callq 0x1e1d0
jmp 0x1e8dd
leaq -0x110(%rbp), %rdi
callq 0x20710
jmp 0x1e908
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x20710
jmp 0x1ef4a
jmp 0x1e90a
jmp 0x1e90c
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movb $0x0, -0x141(%rbp)
xorl %eax, %eax
cmpl $0x2, %ecx
movb %al, -0x2b9(%rbp)
jg 0x1e9c2
movq -0x28(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x17390
movq %rax, %rdi
movl -0x38(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x173b0
movq %rax, %rdi
callq 0x20630
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x2b9(%rbp)
jne 0x1e9c2
movq -0x28(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x17390
movq %rax, %rdi
movl -0x38(%rbp), %eax
incl %eax
movslq %eax, %rsi
callq 0x173b0
movq %rax, %rsi
leaq -0x140(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
callq 0x15490
movq -0x2c8(%rbp), %rdi
movb $0x1, -0x141(%rbp)
leaq 0xad07(%rip), %rsi      # 0x296ae
callq 0x85b0
movb %al, -0x2ba(%rbp)
jmp 0x1e9b4
movb -0x2ba(%rbp), %al
movb %al, -0x2b9(%rbp)
jmp 0x1e9c2
movb -0x2b9(%rbp), %al
movb %al, -0x2c9(%rbp)
testb $0x1, -0x141(%rbp)
jne 0x1e9d9
jmp 0x1e9e5
leaq -0x140(%rbp), %rdi
callq 0x3210
movb -0x2c9(%rbp), %al
testb $0x1, %al
jne 0x1e9f4
jmp 0x1ea91
movq -0x18(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x2e0(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x2d8(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x150(%rbp)
leaq -0x14c(%rbp), %rdi
leaq -0x34(%rbp), %rsi
leaq -0x150(%rbp), %rdx
callq 0x20480
movq -0x200(%rbp), %rdi
movq -0x2e8(%rbp), %rsi
movq -0x2e0(%rbp), %rdx
movq -0x2d8(%rbp), %rcx
movq -0x30(%rbp), %r9
movq -0x14c(%rbp), %r8
callq 0x1e1d0
jmp 0x1ec28
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
testb $0x1, -0x141(%rbp)
jne 0x1ea80
jmp 0x1ea8c
leaq -0x140(%rbp), %rdi
callq 0x3210
jmp 0x1ef4a
movl -0x38(%rbp), %eax
addl $0x1, %eax
cmpl $0x2, %eax
jle 0x1ec26
movq -0x20(%rbp), %rdi
callq 0x207c0
cmpq $0x0, %rax
je 0x1ec26
movb $0x0, -0x151(%rbp)
movl $0x0, -0x158(%rbp)
movslq -0x158(%rbp), %rax
movq %rax, -0x2f0(%rbp)
movq -0x30(%rbp), %rdi
callq 0x81f0
movq %rax, %rcx
movq -0x2f0(%rbp), %rax
cmpq %rcx, %rax
jae 0x1eb36
movq -0x30(%rbp), %rdi
movslq -0x158(%rbp), %rsi
callq 0x8230
movq (%rax), %rax
movq %rax, -0x2f8(%rbp)
movq -0x20(%rbp), %rdi
callq 0x207c0
movq %rax, %rcx
movq -0x2f8(%rbp), %rax
cmpq %rcx, %rax
jne 0x1eb23
movb $0x1, -0x151(%rbp)
jmp 0x1eb25
movl -0x158(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x158(%rbp)
jmp 0x1eac4
testb $0x1, -0x151(%rbp)
jne 0x1ec24
movq -0x30(%rbp), %rax
movq %rax, -0x310(%rbp)
movq -0x20(%rbp), %rdi
callq 0x207c0
movq -0x310(%rbp), %rdi
movq %rax, -0x160(%rbp)
leaq -0x160(%rbp), %rsi
callq 0x206a0
movq -0x20(%rbp), %rdi
callq 0x207c0
movq %rax, %rsi
leaq -0x178(%rbp), %rdi
callq 0x206d0
movq -0x18(%rbp), %rax
movq %rax, -0x308(%rbp)
movq -0x20(%rbp), %rdi
callq 0x207c0
movq %rax, -0x300(%rbp)
jmp 0x1eba6
movl -0x38(%rbp), %eax
addl $-0x2, %eax
movl %eax, -0x184(%rbp)
leaq -0x180(%rbp), %rdi
leaq -0x34(%rbp), %rsi
leaq -0x184(%rbp), %rdx
callq 0x20480
jmp 0x1ebcb
movq -0x300(%rbp), %rdx
movq -0x308(%rbp), %rsi
movq -0x200(%rbp), %rdi
movq -0x30(%rbp), %r9
movq -0x180(%rbp), %r8
leaq -0x178(%rbp), %rcx
callq 0x1e1d0
jmp 0x1ebf9
leaq -0x178(%rbp), %rdi
callq 0x20710
jmp 0x1ec24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x20710
jmp 0x1ef4a
jmp 0x1ec26
jmp 0x1ec28
movl -0x38(%rbp), %ecx
subl $0x1, %ecx
movb $0x0, -0x1a9(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x311(%rbp)
jl 0x1ecde
movq -0x28(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x17390
movq %rax, %rdi
movl -0x38(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x173b0
movq %rax, %rdi
callq 0x20630
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x311(%rbp)
jne 0x1ecde
movq -0x28(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x17390
movq %rax, %rdi
movl -0x38(%rbp), %eax
decl %eax
movslq %eax, %rsi
callq 0x173b0
movq %rax, %rsi
leaq -0x1a8(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x15490
movq -0x320(%rbp), %rdi
movb $0x1, -0x1a9(%rbp)
leaq 0xa9eb(%rip), %rsi      # 0x296ae
callq 0x85b0
movb %al, -0x312(%rbp)
jmp 0x1ecd0
movb -0x312(%rbp), %al
movb %al, -0x311(%rbp)
jmp 0x1ecde
movb -0x311(%rbp), %al
movb %al, -0x321(%rbp)
testb $0x1, -0x1a9(%rbp)
jne 0x1ecf5
jmp 0x1ed01
leaq -0x1a8(%rbp), %rdi
callq 0x3210
movb -0x321(%rbp), %al
testb $0x1, %al
jne 0x1ed10
jmp 0x1edad
movq -0x18(%rbp), %rax
movq %rax, -0x340(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x338(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x330(%rbp)
movl -0x38(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1b8(%rbp)
leaq -0x1b4(%rbp), %rdi
leaq -0x34(%rbp), %rsi
leaq -0x1b8(%rbp), %rdx
callq 0x20480
movq -0x200(%rbp), %rdi
movq -0x340(%rbp), %rsi
movq -0x338(%rbp), %rdx
movq -0x330(%rbp), %rcx
movq -0x30(%rbp), %r9
movq -0x1b4(%rbp), %r8
callq 0x1e1d0
jmp 0x1ef41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
testb $0x1, -0x1a9(%rbp)
jne 0x1ed9c
jmp 0x1eda8
leaq -0x1a8(%rbp), %rdi
callq 0x3210
jmp 0x1ef4a
movl -0x38(%rbp), %eax
subl $0x1, %eax
cmpl $0x0, %eax
jge 0x1ef3f
movq -0x20(%rbp), %rdi
callq 0x20810
cmpq $0x0, %rax
je 0x1ef3f
movb $0x0, -0x1b9(%rbp)
movl $0x0, -0x1c0(%rbp)
movslq -0x1c0(%rbp), %rax
movq %rax, -0x348(%rbp)
movq -0x30(%rbp), %rdi
callq 0x81f0
movq %rax, %rcx
movq -0x348(%rbp), %rax
cmpq %rcx, %rax
jae 0x1ee52
movq -0x30(%rbp), %rdi
movslq -0x1c0(%rbp), %rsi
callq 0x8230
movq (%rax), %rax
movq %rax, -0x350(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20810
movq %rax, %rcx
movq -0x350(%rbp), %rax
cmpq %rcx, %rax
jne 0x1ee3f
movb $0x1, -0x1b9(%rbp)
jmp 0x1ee41
movl -0x1c0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c0(%rbp)
jmp 0x1ede0
testb $0x1, -0x1b9(%rbp)
jne 0x1ef3d
movq -0x30(%rbp), %rax
movq %rax, -0x368(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20810
movq -0x368(%rbp), %rdi
movq %rax, -0x1c8(%rbp)
leaq -0x1c8(%rbp), %rsi
callq 0x206a0
movq -0x20(%rbp), %rdi
callq 0x20810
movq %rax, %rsi
leaq -0x1e0(%rbp), %rdi
callq 0x206d0
movq -0x18(%rbp), %rax
movq %rax, -0x360(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20810
movq %rax, -0x358(%rbp)
jmp 0x1eec2
movl -0x38(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x1ec(%rbp)
leaq -0x1e8(%rbp), %rdi
leaq -0x34(%rbp), %rsi
leaq -0x1ec(%rbp), %rdx
callq 0x20480
jmp 0x1eee7
movq -0x358(%rbp), %rdx
movq -0x360(%rbp), %rsi
movq -0x200(%rbp), %rdi
movq -0x30(%rbp), %r9
movq -0x1e8(%rbp), %r8
leaq -0x1e0(%rbp), %rcx
callq 0x1e1d0
jmp 0x1ef15
leaq -0x1e0(%rbp), %rdi
callq 0x20710
jmp 0x1ef3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x20710
jmp 0x1ef4a
jmp 0x1ef3f
jmp 0x1ef41
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x34f0
nopw %cs:(%rax,%rax)