// File: Doug0855[P]TigerZone/main.cpp
// Function: moveProtocol(Client&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, Game&, Game&, int&, int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int moveProtocol(Client &client, std::string &message_list, Game &game1, Game &game2, int &success1, int &success2, std::string OPPONENT_ID)
{
	/*
	This protocol is called whenever a move needs to be made.
	It takes a reference to both games being played and two success values.
	These success values are used to calculate the number of iterations needed in the processing loop
	*/
	std::string message_to_send;
	std::string message;
	values_t message_info;
	Adapter adapter;
	int runTime = 3;
	Tile tmpTile;

	message = getMesssage(client, message_list);
	std::cout << GREEN << "Server sent: " << RESET << message << std::endl;

	if ((success1 == -1 || success2 == -1) && message.compare(0,1,"M") == 0) //Need to make a move
		runTime = 2;
	else if ((success1 == -1 || success2 == -1) && message.compare(0,1,"G") == 0) //Need to get a game piece
		runTime = 1;
	else if (success1 == -1 && success2 == -1) //Do nothing
		runTime = 0;

	for (int i = 0; i < runTime; i++)
	{
		if (message.compare(0,1,"M") == 0)
		{
			std::cout<<"	SERVER ASKING FOR A MOVE"<<std::endl;
			message_info = adapter.translate(message);
			if (game1.getID() == "")
				game1.setID(message_info.gameId);
			if (message_info.gameId == game1.getID())
			{
				//std::cout << "sent our move for tile: " << message_info.tile_num <<  " and game: " << message_info.gameId << std::endl;
				tmpTile = Tile(message_info.tile_num);
				message_to_send = game1.makeMove(tmpTile, message_info.moveNumber);
			}
			else if (message_info.gameId == game2.getID())
			{
				//std::cout << "sent our move for tile: " << message_info.tile_num <<  " and game: " << message_info.gameId << std::endl;
				tmpTile = Tile(message_info.tile_num);
				message_to_send = game2.makeMove(tmpTile, message_info.moveNumber);
			}
			std::cout << RED << "	We sent: " << RESET << message_to_send << std::endl;
			client.sendMessage(message_to_send);
			message = getMesssage(client, message_list);
			std::cout << GREEN << "Server sent: " << RESET << message << std::endl;
		}
		else if (message.compare(0,1,"G") == 0)
		{
			std::cout << "	GAME MOVES INFORMATION" << std::endl;
			message_info = adapter.translate(message);
			if (message_info.gameId != game1.getID() && game2.getID() == "")
				game2.setID(message_info.gameId);
			if (message_info.forfeit == -1)
			{
				if (game2.getID() == message_info.gameId)
					success2 = -1;
				else if (game1.getID() == message_info.gameId)
					success1 = -1;
				if (success1 == -1 && success2 == -1)
					break;
			}
			else
			{
				if (message_info.playerId == OPPONENT_ID)
				{
					tmpTile = Tile(message_info.tile_num);
					int i = message_info.coordinates.first;
					int j = message_info.coordinates.second;
					int orientation = message_info.rotation;

					if (message_info.gameId == game1.getID())
					{
						//std::cout << "	Received opponent move for tile: " << message_info.tile_num <<  " in game: " << message_info.gameId << std::endl;
						//std::cout << "		tile placed at <" << i << ", " << j << "> " << "with rotation: " << orientation << std::endl;
						//std::cout << "		croc? " << message_info.croc << " tiger? " << message_info.tiger << " zone " << "[" <<message_info.tiger_spot.first << ", " << message_info.tiger_spot.second << "] " << std::endl;
						tmpTile = Tile(message_info.tile_num);
						game1.enemyMove(tmpTile, i, j, orientation, message_info.tiger, message_info.croc, message_info.tiger_spot);
					}
					else if (message_info.gameId == game2.getID())
					{
						//std::cout << "	Received opponent move for tile: " << message_info.tile_num <<  " in game: " << message_info.gameId << std::endl;
						//std::cout << "		tile placed at <" << i << ", " << j << "> :" << "with rotation: " << orientation << std::endl;
						//std::cout << "		croc? " << message_info.croc << " tiger? " << message_info.tiger << " zone " << "[" <<message_info.tiger_spot.first << ", " << message_info.tiger_spot.second << "] " << std::endl;
						//tmpTile = Tile(message_info.tile_num);
						//debugging std::cout << "DEBUG FLAG" << std::endl;
						game2.enemyMove(tmpTile, i, j, orientation, message_info.tiger, message_info.croc, message_info.tiger_spot);
						//debugging std::cout << "DEBUG FLAG 2" << std::endl;
					}
				}
			}
			if (i < runTime-1) //if it isn't the final message, display the message the server sent.
			{
				message = getMesssage(client, message_list);
				std::cout << GREEN << "Server sent: " << RESET << message << std::endl;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1010, %rsp           # imm = 0x1010
movq 0x10(%rbp), %rax
movq %rax, -0xe90(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x33c0
leaq -0x70(%rbp), %rdi
callq 0x33c0
leaq -0x120(%rbp), %rdi
callq 0x83e0
jmp 0x41de
leaq -0x228(%rbp), %rdi
callq 0xe260
jmp 0x41ec
movl $0x3, -0x22c(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x26760
jmp 0x4204
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x338(%rbp), %rdi
callq 0x4070
jmp 0x421a
leaq -0x70(%rbp), %rdi
leaq -0x338(%rbp), %rsi
movq %rsi, -0xea0(%rbp)
callq 0x3360
movq -0xea0(%rbp), %rdi
callq 0x3210
movq 0x32d74(%rip), %rdi     # 0x36fb8
leaq 0x24dfb(%rip), %rsi     # 0x29046
callq 0x32b0
movq %rax, -0xe98(%rbp)
jmp 0x4259
movq -0xe98(%rbp), %rdi
leaq 0x24e07(%rip), %rsi     # 0x2906e
callq 0x32b0
movq %rax, -0xea8(%rbp)
jmp 0x4275
movq -0xea8(%rbp), %rdi
leaq 0x24dcf(%rip), %rsi     # 0x29052
callq 0x32b0
movq %rax, -0xeb0(%rbp)
jmp 0x4291
movq -0xeb0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3290
movq %rax, -0xeb8(%rbp)
jmp 0x42aa
movq -0xeb8(%rbp), %rdi
movq 0x32cf0(%rip), %rsi     # 0x36fa8
callq 0x32e0
jmp 0x42bf
movq -0x28(%rbp), %rax
cmpl $-0x1, (%rax)
je 0x42d5
movq -0x30(%rbp), %rax
cmpl $-0x1, (%rax)
jne 0x436c
leaq 0x24da0(%rip), %rcx     # 0x2907c
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
movl $0x1, %edx
callq 0x3390
movl %eax, -0xebc(%rbp)
jmp 0x42f6
movl -0xebc(%rbp), %eax
cmpl $0x0, %eax
jne 0x436c
movl $0x2, -0x22c(%rbp)
jmp 0x43d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x5187
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x517b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x516f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x5163
movq -0x28(%rbp), %rax
cmpl $-0x1, (%rax)
je 0x437e
movq -0x30(%rbp), %rax
cmpl $-0x1, (%rax)
jne 0x43b6
leaq 0x251c5(%rip), %rcx     # 0x2954a
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
movl $0x1, %edx
callq 0x3390
movl %eax, -0xec0(%rbp)
jmp 0x439f
movl -0xec0(%rbp), %eax
cmpl $0x0, %eax
jne 0x43b6
movl $0x1, -0x22c(%rbp)
jmp 0x43d4
movq -0x28(%rbp), %rax
cmpl $-0x1, (%rax)
jne 0x43d2
movq -0x30(%rbp), %rax
cmpl $-0x1, (%rax)
jne 0x43d2
movl $0x0, -0x22c(%rbp)
jmp 0x43d4
jmp 0x43d6
movl $0x0, -0x33c(%rbp)
movl -0x33c(%rbp), %eax
cmpl -0x22c(%rbp), %eax
jge 0x5161
leaq 0x24c83(%rip), %rcx     # 0x2907c
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
movl $0x1, %edx
callq 0x3390
movl %eax, -0xec4(%rbp)
jmp 0x4413
movl -0xec4(%rbp), %eax
cmpl $0x0, %eax
jne 0x4a49
movq 0x32b8f(%rip), %rdi     # 0x36fb8
leaq 0x24c4e(%rip), %rsi     # 0x2907e
callq 0x32b0
movq %rax, -0xed0(%rbp)
jmp 0x443e
movq -0xed0(%rbp), %rdi
movq 0x32b5c(%rip), %rsi     # 0x36fa8
callq 0x32e0
jmp 0x4453
leaq -0x410(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3160
jmp 0x4465
leaq -0x3f0(%rbp), %rdi
leaq -0x228(%rbp), %rsi
leaq -0x410(%rbp), %rdx
callq 0xff00
jmp 0x4481
leaq -0x120(%rbp), %rdi
leaq -0x3f0(%rbp), %rsi
movq %rsi, -0xed8(%rbp)
callq 0x8480
movq -0xed8(%rbp), %rdi
callq 0x8560
leaq -0x410(%rbp), %rdi
callq 0x3210
movq -0x18(%rbp), %rsi
leaq -0x430(%rbp), %rdi
callq 0x85e0
jmp 0x44c5
leaq 0x251c5(%rip), %rsi     # 0x29691
leaq -0x430(%rbp), %rdi
callq 0x85b0
movb %al, -0xed9(%rbp)
jmp 0x44e0
leaq -0x430(%rbp), %rdi
callq 0x3210
movb -0xed9(%rbp), %al
testb $0x1, %al
jne 0x44fb
jmp 0x45a7
movq -0x18(%rbp), %rax
movq %rax, -0xee8(%rbp)
leaq -0xe0(%rbp), %rsi
leaq -0x450(%rbp), %rdi
callq 0x3160
jmp 0x451b
movq -0xee8(%rbp), %rdi
leaq -0x450(%rbp), %rsi
callq 0x8610
jmp 0x4530
leaq -0x450(%rbp), %rdi
callq 0x3210
jmp 0x45a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x3210
jmp 0x5163
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x430(%rbp), %rdi
callq 0x3210
jmp 0x5163
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x450(%rbp), %rdi
callq 0x3210
jmp 0x5163
leaq -0xe0(%rbp), %rax
movq %rax, -0xef0(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x470(%rbp), %rdi
callq 0x85e0
jmp 0x45c7
movq -0xef0(%rbp), %rdi
leaq -0x470(%rbp), %rsi
callq 0x8640
movb %al, -0xef1(%rbp)
leaq -0x470(%rbp), %rdi
callq 0x3210
movb -0xef1(%rbp), %al
testb $0x1, %al
jne 0x45fb
jmp 0x4727
movl -0x11c(%rbp), %esi
leaq -0x558(%rbp), %rdi
callq 0x250d0
jmp 0x460f
leaq -0x318(%rbp), %rdi
leaq -0x558(%rbp), %rsi
callq 0x86d0
jmp 0x4624
leaq -0x558(%rbp), %rdi
callq 0x26870
movq -0x18(%rbp), %rax
movq %rax, -0xf00(%rbp)
leaq -0x660(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x82a0
jmp 0x4650
leaq -0xc0(%rbp), %rsi
leaq -0x680(%rbp), %rdi
callq 0x3160
jmp 0x4665
movq -0xf00(%rbp), %rsi
leaq -0x578(%rbp), %rdi
leaq -0x660(%rbp), %rdx
leaq -0x680(%rbp), %rcx
callq 0x13fc0
jmp 0x4688
leaq -0x50(%rbp), %rdi
leaq -0x578(%rbp), %rsi
callq 0x3360
leaq -0x578(%rbp), %rdi
callq 0x3210
leaq -0x680(%rbp), %rdi
callq 0x3210
leaq -0x660(%rbp), %rdi
callq 0x26870
jmp 0x48a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x558(%rbp), %rdi
callq 0x26870
jmp 0x5163
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x4716
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x680(%rbp), %rdi
callq 0x3210
leaq -0x660(%rbp), %rdi
callq 0x26870
jmp 0x5163
leaq -0xe0(%rbp), %rax
movq %rax, -0xf08(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x6a0(%rbp), %rdi
callq 0x85e0
jmp 0x4747
movq -0xf08(%rbp), %rdi
leaq -0x6a0(%rbp), %rsi
callq 0x8640
movb %al, -0xf09(%rbp)
leaq -0x6a0(%rbp), %rdi
callq 0x3210
movb -0xf09(%rbp), %al
testb $0x1, %al
jne 0x477b
jmp 0x48a4
movl -0x11c(%rbp), %esi
leaq -0x788(%rbp), %rdi
callq 0x250d0
jmp 0x478f
leaq -0x318(%rbp), %rdi
leaq -0x788(%rbp), %rsi
callq 0x86d0
jmp 0x47a4
leaq -0x788(%rbp), %rdi
callq 0x26870
movq -0x20(%rbp), %rax
movq %rax, -0xf18(%rbp)
leaq -0x890(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x82a0
jmp 0x47d0
leaq -0xc0(%rbp), %rsi
leaq -0x8b0(%rbp), %rdi
callq 0x3160
jmp 0x47e5
movq -0xf18(%rbp), %rsi
leaq -0x7a8(%rbp), %rdi
leaq -0x890(%rbp), %rdx
leaq -0x8b0(%rbp), %rcx
callq 0x13fc0
jmp 0x4808
leaq -0x50(%rbp), %rdi
leaq -0x7a8(%rbp), %rsi
callq 0x3360
leaq -0x7a8(%rbp), %rdi
callq 0x3210
leaq -0x8b0(%rbp), %rdi
callq 0x3210
leaq -0x890(%rbp), %rdi
callq 0x26870
jmp 0x48a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x788(%rbp), %rdi
callq 0x26870
jmp 0x5163
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x4893
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x8b0(%rbp), %rdi
callq 0x3210
leaq -0x890(%rbp), %rdi
callq 0x26870
jmp 0x5163
jmp 0x48a6
movq 0x3270b(%rip), %rdi     # 0x36fb8
leaq 0x247e4(%rip), %rsi     # 0x29098
callq 0x32b0
movq %rax, -0xf20(%rbp)
jmp 0x48c2
movq -0xf20(%rbp), %rdi
leaq 0x247ce(%rip), %rsi     # 0x2909e
callq 0x32b0
movq %rax, -0xf28(%rbp)
jmp 0x48de
movq -0xf28(%rbp), %rdi
leaq 0x24766(%rip), %rsi     # 0x29052
callq 0x32b0
movq %rax, -0xf30(%rbp)
jmp 0x48fa
movq -0xf30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3290
movq %rax, -0xf38(%rbp)
jmp 0x4913
movq -0xf38(%rbp), %rdi
movq 0x32687(%rip), %rsi     # 0x36fa8
callq 0x32e0
jmp 0x4928
movq -0x8(%rbp), %rax
movq %rax, -0xf40(%rbp)
leaq -0x8d0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3160
jmp 0x4945
movq -0xf40(%rbp), %rdi
leaq -0x8d0(%rbp), %rsi
callq 0x184b0
jmp 0x495a
leaq -0x8d0(%rbp), %rdi
callq 0x3210
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x8f0(%rbp), %rdi
callq 0x4070
jmp 0x497c
leaq -0x70(%rbp), %rdi
leaq -0x8f0(%rbp), %rsi
movq %rsi, -0xf50(%rbp)
callq 0x3360
movq -0xf50(%rbp), %rdi
callq 0x3210
movq 0x32612(%rip), %rdi     # 0x36fb8
leaq 0x24699(%rip), %rsi     # 0x29046
callq 0x32b0
movq %rax, -0xf48(%rbp)
jmp 0x49bb
movq -0xf48(%rbp), %rdi
leaq 0x246a5(%rip), %rsi     # 0x2906e
callq 0x32b0
movq %rax, -0xf58(%rbp)
jmp 0x49d7
movq -0xf58(%rbp), %rdi
leaq 0x2466d(%rip), %rsi     # 0x29052
callq 0x32b0
movq %rax, -0xf60(%rbp)
jmp 0x49f3
movq -0xf60(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3290
movq %rax, -0xf68(%rbp)
jmp 0x4a0c
movq -0xf68(%rbp), %rdi
movq 0x3258e(%rip), %rsi     # 0x36fa8
callq 0x32e0
jmp 0x4a21
jmp 0x514b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x8d0(%rbp), %rdi
callq 0x3210
jmp 0x5163
leaq 0x24afa(%rip), %rcx     # 0x2954a
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
movl $0x1, %edx
callq 0x3390
movl %eax, -0xf6c(%rbp)
jmp 0x4a6a
movl -0xf6c(%rbp), %eax
cmpl $0x0, %eax
jne 0x5149
movq 0x32538(%rip), %rdi     # 0x36fb8
leaq 0x24622(%rip), %rsi     # 0x290a9
callq 0x32b0
movq %rax, -0xf78(%rbp)
jmp 0x4a95
movq -0xf78(%rbp), %rdi
movq 0x32505(%rip), %rsi     # 0x36fa8
callq 0x32e0
jmp 0x4aaa
leaq -0x9c0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3160
jmp 0x4abc
leaq -0x9a0(%rbp), %rdi
leaq -0x228(%rbp), %rsi
leaq -0x9c0(%rbp), %rdx
callq 0xff00
jmp 0x4ad8
leaq -0x120(%rbp), %rdi
leaq -0x9a0(%rbp), %rsi
movq %rsi, -0xf88(%rbp)
callq 0x8480
movq -0xf88(%rbp), %rdi
callq 0x8560
leaq -0x9c0(%rbp), %rdi
callq 0x3210
leaq -0xe0(%rbp), %rax
movq %rax, -0xf80(%rbp)
movq -0x18(%rbp), %rsi
movb $0x0, -0xa01(%rbp)
leaq -0x9e0(%rbp), %rdi
callq 0x85e0
jmp 0x4b31
movq -0xf80(%rbp), %rdi
leaq -0x9e0(%rbp), %rsi
callq 0x87c0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xf89(%rbp)
jne 0x4b55
jmp 0x4b97
movq -0x20(%rbp), %rsi
leaq -0xa00(%rbp), %rdi
callq 0x85e0
jmp 0x4b67
movb $0x1, -0xa01(%rbp)
leaq 0x24b1c(%rip), %rsi     # 0x29691
leaq -0xa00(%rbp), %rdi
callq 0x85b0
movb %al, -0xf8a(%rbp)
jmp 0x4b89
movb -0xf8a(%rbp), %al
movb %al, -0xf89(%rbp)
jmp 0x4b97
movb -0xf89(%rbp), %al
movb %al, -0xf8b(%rbp)
testb $0x1, -0xa01(%rbp)
jne 0x4bae
jmp 0x4bba
leaq -0xa00(%rbp), %rdi
callq 0x3210
leaq -0x9e0(%rbp), %rdi
callq 0x3210
movb -0xf8b(%rbp), %al
testb $0x1, %al
jne 0x4bd5
jmp 0x4cb1
movq -0x20(%rbp), %rax
movq %rax, -0xf98(%rbp)
leaq -0xe0(%rbp), %rsi
leaq -0xa28(%rbp), %rdi
callq 0x3160
jmp 0x4bf5
movq -0xf98(%rbp), %rdi
leaq -0xa28(%rbp), %rsi
callq 0x8610
jmp 0x4c0a
leaq -0xa28(%rbp), %rdi
callq 0x3210
jmp 0x4cb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x9c0(%rbp), %rdi
callq 0x3210
jmp 0x5163
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x4c7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
testb $0x1, -0xa01(%rbp)
jne 0x4c6f
jmp 0x4c7b
leaq -0xa00(%rbp), %rdi
callq 0x3210
jmp 0x4c7d
leaq -0x9e0(%rbp), %rdi
callq 0x3210
jmp 0x5163
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0xa28(%rbp), %rdi
callq 0x3210
jmp 0x5163
cmpl $-0x1, -0x7c(%rbp)
jne 0x4d7d
movq -0x20(%rbp), %rsi
leaq -0xa48(%rbp), %rdi
callq 0x85e0
jmp 0x4ccd
leaq -0x120(%rbp), %rsi
addq $0x40, %rsi
leaq -0xa48(%rbp), %rdi
callq 0x8640
movb %al, -0xf99(%rbp)
leaq -0xa48(%rbp), %rdi
callq 0x3210
movb -0xf99(%rbp), %al
testb $0x1, %al
jne 0x4d02
jmp 0x4d0e
movq -0x30(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x4d61
movq -0x18(%rbp), %rsi
leaq -0xa68(%rbp), %rdi
callq 0x85e0
jmp 0x4d20
leaq -0x120(%rbp), %rsi
addq $0x40, %rsi
leaq -0xa68(%rbp), %rdi
callq 0x8640
movb %al, -0xf9a(%rbp)
leaq -0xa68(%rbp), %rdi
callq 0x3210
movb -0xf9a(%rbp), %al
testb $0x1, %al
jne 0x4d55
jmp 0x4d5f
movq -0x28(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x4d61
movq -0x28(%rbp), %rax
cmpl $-0x1, (%rax)
jne 0x4d78
movq -0x30(%rbp), %rax
cmpl $-0x1, (%rax)
jne 0x4d78
jmp 0x5161
jmp 0x5073
movq -0xe90(%rbp), %rsi
leaq -0x120(%rbp), %rdi
addq $0x80, %rdi
callq 0x8640
testb $0x1, %al
jne 0x4da0
jmp 0x5071
movl -0x11c(%rbp), %esi
leaq -0xb50(%rbp), %rdi
callq 0x250d0
jmp 0x4db4
leaq -0x318(%rbp), %rdi
leaq -0xb50(%rbp), %rsi
callq 0x86d0
jmp 0x4dc9
leaq -0xb50(%rbp), %rdi
callq 0x26870
movl -0xf0(%rbp), %eax
movl %eax, -0xb54(%rbp)
movl -0xec(%rbp), %eax
movl %eax, -0xb58(%rbp)
movl -0x118(%rbp), %eax
movl %eax, -0xb5c(%rbp)
leaq -0xe0(%rbp), %rax
movq %rax, -0xfa8(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xb80(%rbp), %rdi
callq 0x85e0
jmp 0x4e19
movq -0xfa8(%rbp), %rdi
leaq -0xb80(%rbp), %rsi
callq 0x8640
movb %al, -0xfa9(%rbp)
leaq -0xb80(%rbp), %rdi
callq 0x3210
movb -0xfa9(%rbp), %al
testb $0x1, %al
jne 0x4e4d
jmp 0x4f72
movl -0x11c(%rbp), %esi
leaq -0xc68(%rbp), %rdi
callq 0x250d0
jmp 0x4e61
leaq -0x318(%rbp), %rdi
leaq -0xc68(%rbp), %rsi
callq 0x86d0
jmp 0x4e76
leaq -0xc68(%rbp), %rdi
callq 0x26870
movq -0x18(%rbp), %rax
movq %rax, -0xfb8(%rbp)
leaq -0xd50(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x82a0
jmp 0x4ea2
movq -0xfb8(%rbp), %rdi
movl -0xb54(%rbp), %edx
movl -0xb58(%rbp), %ecx
movl -0xb5c(%rbp), %r8d
movzbl -0x7f(%rbp), %r9d
movzbl -0x80(%rbp), %esi
movq -0xe8(%rbp), %rax
movq %rax, -0xd58(%rbp)
movq -0xd58(%rbp), %r10
movq %rsp, %rax
movq %r10, 0x8(%rax)
andl $0x1, %esi
movl %esi, (%rax)
andl $0x1, %r9d
leaq -0xd50(%rbp), %rsi
callq 0x13e80
jmp 0x4ef8
leaq -0xd50(%rbp), %rdi
callq 0x26870
jmp 0x506f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0xb50(%rbp), %rdi
callq 0x26870
jmp 0x5163
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0xc68(%rbp), %rdi
callq 0x26870
jmp 0x5163
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0xd50(%rbp), %rdi
callq 0x26870
jmp 0x5163
leaq -0xe0(%rbp), %rax
movq %rax, -0xfc0(%rbp)
movq -0x20(%rbp), %rsi
leaq -0xd78(%rbp), %rdi
callq 0x85e0
jmp 0x4f92
movq -0xfc0(%rbp), %rdi
leaq -0xd78(%rbp), %rsi
callq 0x8640
movb %al, -0xfc1(%rbp)
leaq -0xd78(%rbp), %rdi
callq 0x3210
movb -0xfc1(%rbp), %al
testb $0x1, %al
jne 0x4fc6
jmp 0x506d
movq -0x20(%rbp), %rax
movq %rax, -0xfd0(%rbp)
leaq -0xe60(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x82a0
jmp 0x4fe6
movq -0xfd0(%rbp), %rdi
movl -0xb54(%rbp), %edx
movl -0xb58(%rbp), %ecx
movl -0xb5c(%rbp), %r8d
movzbl -0x7f(%rbp), %r9d
movzbl -0x80(%rbp), %esi
movq -0xe8(%rbp), %rax
movq %rax, -0xe68(%rbp)
movq -0xe68(%rbp), %r10
movq %rsp, %rax
movq %r10, 0x8(%rax)
andl $0x1, %esi
movl %esi, (%rax)
andl $0x1, %r9d
leaq -0xe60(%rbp), %rsi
callq 0x13e80
jmp 0x503c
leaq -0xe60(%rbp), %rdi
callq 0x26870
jmp 0x506d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0xe60(%rbp), %rdi
callq 0x26870
jmp 0x5163
jmp 0x506f
jmp 0x5071
jmp 0x5073
movl -0x33c(%rbp), %eax
movl -0x22c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5147
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0xe88(%rbp), %rdi
callq 0x4070
jmp 0x50a0
leaq -0x70(%rbp), %rdi
leaq -0xe88(%rbp), %rsi
movq %rsi, -0xfe0(%rbp)
callq 0x3360
movq -0xfe0(%rbp), %rdi
callq 0x3210
movq 0x31eee(%rip), %rdi     # 0x36fb8
leaq 0x23f75(%rip), %rsi     # 0x29046
callq 0x32b0
movq %rax, -0xfd8(%rbp)
jmp 0x50df
movq -0xfd8(%rbp), %rdi
leaq 0x23f81(%rip), %rsi     # 0x2906e
callq 0x32b0
movq %rax, -0xfe8(%rbp)
jmp 0x50fb
movq -0xfe8(%rbp), %rdi
leaq 0x23f49(%rip), %rsi     # 0x29052
callq 0x32b0
movq %rax, -0xff0(%rbp)
jmp 0x5117
movq -0xff0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3290
movq %rax, -0xff8(%rbp)
jmp 0x5130
movq -0xff8(%rbp), %rdi
movq 0x31e6a(%rip), %rsi     # 0x36fa8
callq 0x32e0
jmp 0x5145
jmp 0x5147
jmp 0x5149
jmp 0x514b
jmp 0x514d
movl -0x33c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x33c(%rbp)
jmp 0x43e0
ud2
leaq -0x318(%rbp), %rdi
callq 0x26870
leaq -0x228(%rbp), %rdi
callq 0xe2f0
leaq -0x120(%rbp), %rdi
callq 0x8560
leaq -0x70(%rbp), %rdi
callq 0x3210
leaq -0x50(%rbp), %rdi
callq 0x3210
movq -0x128(%rbp), %rdi
callq 0x34f0
nopw %cs:(%rax,%rax)