// File: SaadBazaz[P]RIP-Protocol-Simulation/Router.cpp
// Function: handlePacket(int const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void handlePacket(const int &client, string packet)
{
	auto vec = tokenizeData(packet, '&');
	// for (int i=0; i<vec.size(); i++){
	// 		std::cout<<vec[i]<<std::endl;
	// }


	if (vec[0] == "OK"){
		std::cout<<"Something good happened!"<<std::endl;
		return;
	}
	else if (vec[0] == "BAD"){
		std::cout<<"Oops, something went wrong..."<<std::endl;
		return;
	}


	switch (stoi(vec[0]))
	{
	case UPDATE:
	{
		// cout<<"In UPDATE..."<<endl;
		TableRow table_row(vec[3]);
		// cout<<"Made table_row..."<<endl;
		int index = findRowByFDAndID(client, table_row.identifier);

		if (index < 0)
		{

			// if match not found
			// remove all id = -1 values from table and add new table_row
			for (int i=0; i<table.size(); i++){
				if (table[i].identifier == -1){
					table.erase (table.begin() + i);
					i--;
				}
			} 

			table_row.fd = client;
			if (table_row.hop_count < 0)
			{
				table_row.hop_count = 0;
			}
			
			table.push_back(table_row);
			printTable();
			break;
		}


		if (table_row.identifier >= 0)
		{
			table[index].identifier = table_row.identifier;
		}

		// if (table_row.client_name >= 0){
		// 	table[index].client_name = table_row.client_name;
		// }

		if (table_row.status >= 0)
		{
			table[index].status = table_row.status;
		}

		if (table_row.hop_count >= 0)
		{
			table[index].hop_count = table_row.hop_count;
		}

		if (table_row.type != "")
		{
			table[index].type = table_row.type;
		}

		// if (table_row.in_use >= 0){
		table[index].in_use = table_row.in_use;
		// }

		if (table_row.send_port >= 0)
		{
			table[index].send_port = table_row.send_port;
		}

		if (table_row.receive_port >= 0)
		{
			table[index].receive_port = table_row.receive_port;
		}

		printTable();
		sendTableToAllRouters();

		break;
	}
	case ADD:
		break;

	case DELETE:
		break;

	case TABLE:{

		// auto index_vec = findAllRowsByFD(client);

		auto new_rows = deserialize(vec[3]);		


		// cout<<"New Rows - - - - - "<<endl;
		for (int i=0; i<new_rows.size(); i++){


			new_rows[i].fd = client;

			// cout<<new_rows[i].identifier<<endl;

		}
		// cout<<"- - - - - - - - - - "<<endl;



		// Clean useless data out of new_rows vector
		for (int i=0; i<table.size(); i++)
		{
			for (int j=0; j<new_rows.size(); j++){
				if (table[i] == new_rows[j] 
				or (table[i].fd == client and table[i].identifier == new_rows[j].identifier)
				or (table[i].identifier == new_rows[j].identifier and table[i].hop_count == 0)
				or (new_rows[j].hop_count >= 15)
				//  or new_rows[j].identifier == -1 or new_rows[j].identifier == port
				)

				{
					new_rows.erase(new_rows.begin() + j);
					j--;	
				}
			}
		}

		for (int j=0; j<new_rows.size(); j++){
			if (new_rows[j].identifier == -1 or new_rows[j].identifier == port){
				new_rows.erase(new_rows.begin() + j);
				j--;
			}
		}


		// cout<<"New Rows [CLEANED] - - - - - "<<endl;
		// for (int i=0; i<new_rows.size(); i++){
		// 	cout<<new_rows[i].identifier<<endl;
		// }
		// cout<<"- - - - - - - - - - "<<endl;



		// Add data from new_rows into table
		for (int i=0; i<new_rows.size(); i++){
				new_rows[i].hop_count ++;
				new_rows[i].fd = client;
				table.push_back(new_rows[i]);
		}

		// for (int i=0; i<new_rows.size(); i++){
		// 	if (new_rows[i].identifier != port)
		// 		table.push_back(new_rows[i]);
		// }

		printTable();
		sendTableToAllRouters(client);  //ignore this client when sending table to routers
		break;
	}

	case MESSAGE:
	{
		int index = findRowByID_MinHopCount(stoi(vec[2]));

		if (index < 0)
		{
			break;
		}

		if (vec.size() == 4){
			packet += '&';
			packet += to_string(port);
		}
		else {
			packet += ',';
			packet += to_string(port);			
		}

		// Forward packet to appropriate socket
		send(table[index].fd, packet.c_str(), strlen(packet.c_str()), 0);
		break;
	}
	default:
		break;
	}
	// if (vec[0] == UPDATE){
	// 	if ()

	// }
	// send(client, "OK", 2, 0); //Reply message to client
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movq %rsi, -0x1c8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x3120
movq -0x1c0(%rbp), %rsi
leaq -0x28(%rbp), %rdi
movl $0x26, %edx
callq 0x3650
jmp 0x4a81
leaq -0x48(%rbp), %rdi
callq 0x31b0
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
callq 0x6be0
movq %rax, %rdi
leaq 0x65fb(%rip), %rsi      # 0xb09c
callq 0x72a0
movb %al, -0x1c9(%rbp)
jmp 0x4aae
movb -0x1c9(%rbp), %al
testb $0x1, %al
jne 0x4aba
jmp 0x4b22
movq 0xa507(%rip), %rdi      # 0xefc8
leaq 0x65d7(%rip), %rsi      # 0xb09f
callq 0x32b0
movq %rax, -0x1d8(%rbp)
jmp 0x4ad6
movq -0x1d8(%rbp), %rdi
movq 0xa4d4(%rip), %rsi      # 0xefb8
callq 0x32f0
jmp 0x4aeb
movl $0x1, -0x58(%rbp)
jmp 0x55f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x31b0
jmp 0x5612
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x5609
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
callq 0x6be0
movq %rax, %rdi
leaq 0x657f(%rip), %rsi      # 0xb0b8
callq 0x72a0
movb %al, -0x1d9(%rbp)
jmp 0x4b46
movb -0x1d9(%rbp), %al
testb $0x1, %al
jne 0x4b52
jmp 0x4b8f
movq 0xa46f(%rip), %rdi      # 0xefc8
leaq 0x655c(%rip), %rsi      # 0xb0bc
callq 0x32b0
movq %rax, -0x1e8(%rbp)
jmp 0x4b6e
movq -0x1e8(%rbp), %rdi
movq 0xa43c(%rip), %rsi      # 0xefb8
callq 0x32f0
jmp 0x4b83
movl $0x1, -0x58(%rbp)
jmp 0x55f7
jmp 0x4b91
xorl %eax, %eax
movl %eax, %esi
movq %rsi, -0x1f8(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x6be0
movq -0x1f8(%rbp), %rsi
movq %rax, %rdi
movl $0xa, %edx
callq 0x72d0
movl %eax, -0x1ec(%rbp)
jmp 0x4bc1
movl -0x1ec(%rbp), %eax
movl %eax, %ecx
movq %rcx, -0x200(%rbp)
subl $0x4, %eax
ja 0x55ee
movq -0x200(%rbp), %rax
leaq 0x6431(%rip), %rcx      # 0xb018
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x28(%rbp), %rdi
movl $0x3, %esi
callq 0x6be0
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x3120
jmp 0x4c0f
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
movl $0x2c, %edx
callq 0x6c00
jmp 0x4c29
leaq -0xb8(%rbp), %rdi
callq 0x31b0
movq -0x8(%rbp), %rax
movl (%rax), %edi
movl -0x98(%rbp), %esi
callq 0x4550
movl %eax, -0xbc(%rbp)
cmpl $0x0, -0xbc(%rbp)
jge 0x4dc5
movl $0x0, -0xc0(%rbp)
movslq -0xc0(%rbp), %rax
movq %rax, -0x208(%rbp)
leaq 0xa620(%rip), %rdi      # 0xf298
callq 0x6570
movq %rax, %rcx
movq -0x208(%rbp), %rax
cmpq %rcx, %rax
jae 0x4d7e
movslq -0xc0(%rbp), %rsi
leaq 0xa5fa(%rip), %rdi      # 0xf298
callq 0x6590
cmpl $-0x1, (%rax)
jne 0x4d68
leaq 0xa5e5(%rip), %rdi      # 0xf298
movq %rdi, -0x218(%rbp)
callq 0x7380
movq %rax, -0xd8(%rbp)
movslq -0xc0(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x73b0
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x73f0
movq -0x218(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x7310
movq %rax, -0x210(%rbp)
jmp 0x4d0f
movq -0x210(%rbp), %rax
movq %rax, -0xe0(%rbp)
movl -0xc0(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0x4d68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x31b0
jmp 0x5609
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x6ec0
jmp 0x5609
jmp 0x4d6a
movl -0xc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0x4c63
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x8c(%rbp)
jge 0x4d9d
movl $0x0, -0x8c(%rbp)
leaq 0xa4f4(%rip), %rdi      # 0xf298
leaq -0x98(%rbp), %rsi
callq 0x6e50
jmp 0x4db2
callq 0x4240
jmp 0x4db9
movl $0x2, -0x58(%rbp)
jmp 0x4f55
cmpl $0x0, -0x98(%rbp)
jl 0x4df5
movl -0x98(%rbp), %eax
movl %eax, -0x21c(%rbp)
movslq -0xbc(%rbp), %rsi
leaq 0xa4b0(%rip), %rdi      # 0xf298
callq 0x6590
movl -0x21c(%rbp), %ecx
movl %ecx, (%rax)
movswl -0x90(%rbp), %eax
cmpl $0x0, %eax
jl 0x4e2d
movw -0x90(%rbp), %ax
movw %ax, -0x21e(%rbp)
movslq -0xbc(%rbp), %rsi
leaq 0xa47b(%rip), %rdi      # 0xf298
callq 0x6590
movw -0x21e(%rbp), %cx
movw %cx, 0x8(%rax)
cmpl $0x0, -0x8c(%rbp)
jl 0x4e5e
movl -0x8c(%rbp), %eax
movl %eax, -0x224(%rbp)
movslq -0xbc(%rbp), %rsi
leaq 0xa448(%rip), %rdi      # 0xf298
callq 0x6590
movl -0x224(%rbp), %ecx
movl %ecx, 0xc(%rax)
leaq -0x88(%rbp), %rdi
leaq 0x6217(%rip), %rsi      # 0xb083
callq 0x7430
movb %al, -0x225(%rbp)
jmp 0x4e79
movb -0x225(%rbp), %al
testb $0x1, %al
jne 0x4e85
jmp 0x4ebd
leaq -0x88(%rbp), %rax
movq %rax, -0x230(%rbp)
movslq -0xbc(%rbp), %rsi
leaq 0xa3f7(%rip), %rdi      # 0xf298
callq 0x6590
movq -0x230(%rbp), %rsi
movq %rax, %rdi
addq $0x10, %rdi
callq 0x3040
jmp 0x4ebb
jmp 0x4ebd
movb -0x68(%rbp), %al
movb %al, -0x231(%rbp)
movslq -0xbc(%rbp), %rsi
leaq 0xa3c4(%rip), %rdi      # 0xf298
callq 0x6590
movb -0x231(%rbp), %cl
andb $0x1, %cl
movb %cl, 0x30(%rax)
cmpl $0x0, -0x64(%rbp)
jl 0x4f10
movl -0x64(%rbp), %eax
movl %eax, -0x238(%rbp)
movslq -0xbc(%rbp), %rsi
leaq 0xa396(%rip), %rdi      # 0xf298
callq 0x6590
movl -0x238(%rbp), %ecx
movl %ecx, 0x34(%rax)
cmpl $0x0, -0x60(%rbp)
jl 0x4f3b
movl -0x60(%rbp), %eax
movl %eax, -0x23c(%rbp)
movslq -0xbc(%rbp), %rsi
leaq 0xa36b(%rip), %rdi      # 0xf298
callq 0x6590
movl -0x23c(%rbp), %ecx
movl %ecx, 0x38(%rax)
callq 0x4240
jmp 0x4f42
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x4790
jmp 0x4f4e
movl $0x2, -0x58(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x6ec0
jmp 0x55f0
jmp 0x55f0
jmp 0x55f0
leaq -0x28(%rbp), %rdi
movl $0x3, %esi
callq 0x6be0
movq %rax, %rsi
leaq -0x118(%rbp), %rdi
callq 0x3120
jmp 0x4f8f
leaq -0xf8(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x39e0
jmp 0x4fa4
leaq -0x118(%rbp), %rdi
callq 0x31b0
movl $0x0, -0x11c(%rbp)
movslq -0x11c(%rbp), %rax
movq %rax, -0x248(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x6570
movq %rax, %rcx
movq -0x248(%rbp), %rax
cmpq %rcx, %rax
jae 0x5039
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x24c(%rbp)
movslq -0x11c(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x6590
movl -0x24c(%rbp), %ecx
movl %ecx, 0x4(%rax)
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x4fba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x31b0
jmp 0x5609
movl $0x0, -0x120(%rbp)
movslq -0x120(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq 0xa240(%rip), %rdi      # 0xf298
callq 0x6570
movq %rax, %rcx
movq -0x258(%rbp), %rax
cmpq %rcx, %rax
jae 0x5280
movl $0x0, -0x124(%rbp)
movslq -0x124(%rbp), %rax
movq %rax, -0x260(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x6570
movq %rax, %rcx
movq -0x260(%rbp), %rax
cmpq %rcx, %rax
jae 0x526a
movslq -0x120(%rbp), %rsi
leaq 0xa1e3(%rip), %rdi      # 0xf298
callq 0x6590
movq %rax, -0x268(%rbp)
movslq -0x124(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x6590
movq -0x268(%rbp), %rdi
movq %rax, %rsi
callq 0x37d0
testb $0x1, %al
jne 0x51b5
movslq -0x120(%rbp), %rsi
leaq 0xa19f(%rip), %rdi      # 0xf298
callq 0x6590
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x5144
movslq -0x120(%rbp), %rsi
leaq 0xa181(%rip), %rdi      # 0xf298
callq 0x6590
movl (%rax), %eax
movl %eax, -0x26c(%rbp)
movslq -0x124(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x6590
movq %rax, %rcx
movl -0x26c(%rbp), %eax
cmpl (%rcx), %eax
je 0x51b5
movslq -0x120(%rbp), %rsi
leaq 0xa146(%rip), %rdi      # 0xf298
callq 0x6590
movl (%rax), %eax
movl %eax, -0x270(%rbp)
movslq -0x124(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x6590
movq %rax, %rcx
movl -0x270(%rbp), %eax
cmpl (%rcx), %eax
jne 0x5198
movslq -0x120(%rbp), %rsi
leaq 0xa10b(%rip), %rdi      # 0xf298
callq 0x6590
cmpl $0x0, 0xc(%rax)
je 0x51b5
movslq -0x124(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x6590
cmpl $0xf, 0xc(%rax)
jl 0x5254
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x7380
movq %rax, -0x140(%rbp)
movslq -0x124(%rbp), %rsi
leaq -0x140(%rbp), %rdi
callq 0x73b0
movq %rax, -0x138(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x73f0
movq -0x280(%rbp), %rdi
movq -0x130(%rbp), %rsi
callq 0x7310
movq %rax, -0x278(%rbp)
jmp 0x5218
movq -0x278(%rbp), %rax
movq %rax, -0x148(%rbp)
movl -0x124(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x5254
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x6ee0
jmp 0x5609
jmp 0x5256
movl -0x124(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x507a
jmp 0x526c
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
jmp 0x5043
movl $0x0, -0x14c(%rbp)
movslq -0x14c(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x6570
movq %rax, %rcx
movq -0x288(%rbp), %rax
cmpq %rcx, %rax
jae 0x5386
movslq -0x14c(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x6590
cmpl $-0x1, (%rax)
je 0x52f0
movslq -0x14c(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x6590
movl (%rax), %eax
cmpl 0x9fc6(%rip), %eax      # 0xf2b0
jne 0x5370
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x7380
movq %rax, -0x168(%rbp)
movslq -0x14c(%rbp), %rsi
leaq -0x168(%rbp), %rdi
callq 0x73b0
movq %rax, -0x160(%rbp)
leaq -0x158(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x73f0
movq -0x298(%rbp), %rdi
movq -0x158(%rbp), %rsi
callq 0x7310
movq %rax, -0x290(%rbp)
jmp 0x5353
movq -0x290(%rbp), %rax
movq %rax, -0x170(%rbp)
movl -0x14c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14c(%rbp)
jmp 0x5372
movl -0x14c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14c(%rbp)
jmp 0x528a
movl $0x0, -0x174(%rbp)
movslq -0x174(%rbp), %rax
movq %rax, -0x2a0(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x6570
movq %rax, %rcx
movq -0x2a0(%rbp), %rax
cmpq %rcx, %rax
jae 0x5441
movslq -0x174(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x6590
movq -0x2a8(%rbp), %rdi
movl 0xc(%rax), %ecx
incl %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2ac(%rbp)
movslq -0x174(%rbp), %rsi
callq 0x6590
movl -0x2ac(%rbp), %ecx
movq -0x2a8(%rbp), %rdi
movl %ecx, 0x4(%rax)
movslq -0x174(%rbp), %rsi
callq 0x6590
movq %rax, %rsi
leaq 0x9e74(%rip), %rdi      # 0xf298
callq 0x6e50
jmp 0x542b
jmp 0x542d
movl -0x174(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x174(%rbp)
jmp 0x5390
callq 0x4240
jmp 0x5448
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x4790
jmp 0x5455
movl $0x2, -0x58(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x6ee0
jmp 0x55f0
leaq -0x28(%rbp), %rdi
movl $0x2, %esi
callq 0x6be0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x72d0
movl %eax, -0x2b0(%rbp)
jmp 0x5494
movl -0x2b0(%rbp), %edi
callq 0x4420
movl %eax, -0x178(%rbp)
cmpl $0x0, -0x178(%rbp)
jge 0x54b3
jmp 0x55f0
leaq -0x28(%rbp), %rdi
callq 0x6bc0
cmpq $0x4, %rax
jne 0x552c
movq -0x1c8(%rbp), %rdi
movl $0x26, %esi
callq 0x31c0
jmp 0x54d5
movl 0x9dd5(%rip), %esi      # 0xf2b0
leaq -0x198(%rbp), %rdi
callq 0x6f40
jmp 0x54e9
movq -0x1c8(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x3390
jmp 0x54fe
leaq -0x198(%rbp), %rdi
callq 0x31b0
jmp 0x5590
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x31b0
jmp 0x5609
movq -0x1c8(%rbp), %rdi
movl $0x2c, %esi
callq 0x31c0
jmp 0x553f
movl 0x9d6b(%rip), %esi      # 0xf2b0
leaq -0x1b8(%rbp), %rdi
callq 0x6f40
jmp 0x5553
movq -0x1c8(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x3390
jmp 0x5568
leaq -0x1b8(%rbp), %rdi
callq 0x31b0
jmp 0x5590
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x31b0
jmp 0x5609
movslq -0x178(%rbp), %rsi
leaq 0x9cfa(%rip), %rdi      # 0xf298
callq 0x6590
movq -0x1c8(%rbp), %rdi
movl 0x4(%rax), %eax
movl %eax, -0x2bc(%rbp)
callq 0x3110
movq -0x1c8(%rbp), %rdi
movq %rax, -0x2b8(%rbp)
callq 0x3110
movq %rax, %rdi
callq 0x3130
movl -0x2bc(%rbp), %edi
movq -0x2b8(%rbp), %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0x3150
jmp 0x55ec
jmp 0x55f0
jmp 0x55f0
movl $0x0, -0x58(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x6480
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x6480
movq -0x50(%rbp), %rdi
callq 0x3460
nopl (%rax,%rax)