// File: /workspace/github_cpp_makefile_star2_O1/lotuskip[P]yuxtapa/client/network.cpp
// Function: Network::connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool Network::connect(string &errors)
{
	// determine ip and port
	string sip = Config::get_server_ip(); // this is just what was read from the config; could be garbage!
	string port = "", ip = "";
	size_t i;
	if((i = sip.rfind(':')) != string::npos && i > 1 && i != sip.size()-1)
	{
		port = sip.substr(i+1);
		ip = sip.substr(0, i);
		if(ip[0] == '[') // this would indicate IPv6
		{
			ip.erase(0,1);
			if(ip.empty())
			{
				errors = "Not a valid address: " + sip;
				return false;
			}
			ip.erase(ip.size()-1,1); // erase assumed ']'
		}
	}
	else
	{
		errors = "Not a valid address: " + sip;
		return false;
	}

	// create the socket
	struct addrinfo hints;
	int rv;
	bzero(&hints, sizeof(hints));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_DGRAM;
	// get server info:
	if((rv = getaddrinfo(ip.c_str(), port.c_str(), &hints, &servinfo)))
	{
		errors = string("Error in getaddrinfo: ") + gai_strerror(rv);
		return false;
	}
	// initialize the_serv and make the socket based on its protocol info:
	for(the_serv = servinfo; the_serv; the_serv = the_serv->ai_next)
	{
		if((s_me = socket(the_serv->ai_family, the_serv->ai_socktype, the_serv->ai_protocol)) != -1)
			break;
	}
	if(!the_serv)
	{
		errors = "Failed to create socket!";
		freeaddrinfo(servinfo);
		return false;
	}
	// set socket to nonblock mode:
	fcntl(s_me, F_SETFL, O_NONBLOCK);

	last_sent_axn.update(); // must init this at some point

	add_msg("[Connecting to " + sip + "...]", 15);
	// construct a hello message:
	send_buffer.add((unsigned char)MID_HELLO);
	send_buffer.add(INTR_VERSION);
	add_id_info_for_server(sip);
	send_buffer.add(Config::get_nick());
	
	// send hello message (repeatedly) and wait for a reply
	int k;
	for(char j = 0; j < CONNECTION_ATTEMPTS; ++j)
	{
		if(do_send())
		{
			errors = "Problem sending connection request.";
			close(s_me);
			freeaddrinfo(servinfo);
			return false;
		}
		// Wait for the reply (the timeout on the getch() call will delay):
		for(k = 0; k < REPLY_WAIT_MS/GETCH_TIMEOUT; ++k)
		{
			if(do_receive() != -1)
			{
				// got *some* message
				unsigned char mid = recv_buffer.read_ch();
				switch(mid)
				{
				case MID_HELLO:
					Base::print_str("(identified)", 7, 0, 5, STAT_WIN, false);
					return true;
				case MID_HELLO_FULL:
				case MID_HELLO_BANNED:
				case MID_HELLO_VERSION:
				case MID_HELLO_STEAL:
					errors = hello_errors[mid - MID_HELLO_FULL];
					close(s_me);
					freeaddrinfo(servinfo);
					return false;
				case MID_HELLO_NEWID:
				{
					cur_id = recv_buffer.read_sh();
					string passw;
					recv_buffer.read_str(passw);
					store_id_for_server(cur_id, sip, passw);
					Base::print_str("(new id)", 7, 0, 5, STAT_WIN, false);
					return true;
				}
				default: break; // ignore other messages
				}
			} // received something
			if(getch() == KEYCODE_INT)
			{
				errors = "Aborted by user.";
				return false;
			}
		} // listen for connections loop
	} // send connection requests loop
	errors = "Did not get a reply from the server.";
	close(s_me);
	freeaddrinfo(servinfo);
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x568, %rsp            # imm = 0x568
movq %rdi, %r14
callq 0xe063
leaq -0x80(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rdi
callq 0x731c
leaq -0x130(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x5021(%rip), %rdx      # 0x10479
leaq -0x140(%rbp), %rdi
movq %rdx, %rsi
callq 0x8912
leaq -0xc0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x5000(%rip), %rdx      # 0x10479
leaq -0xd0(%rbp), %rdi
movq %rdx, %rsi
callq 0x8912
leaq -0x90(%rbp), %rdi
movl $0x3a, %esi
movq $-0x1, %rdx
callq 0x4720
movq %rax, %rbx
addq $-0x2, %rax
cmpq $-0x4, %rax
ja 0xb4c0
movq -0x88(%rbp), %rax
decq %rax
cmpq %rax, %rbx
jne 0xb57f
leaq 0x5291(%rip), %rsi      # 0x10758
leaq -0x558(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0xcca0
leaq -0x558(%rbp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4490
movq (%rbx), %rdi
leaq -0x548(%rbp), %rax
cmpq %rax, %rdi
je 0xb50a
movq -0x548(%rbp), %rsi
incq %rsi
callq 0x43a0
xorl %ebx, %ebx
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0xb52e
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0xb550
movq -0x130(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x90(%rbp), %rdi
cmpq %r13, %rdi
je 0xb568
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x43a0
andb $0x1, %bl
movl %ebx, %eax
addq $0x568, %rsp            # imm = 0x568
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, -0x30(%rbp)
leaq 0x1(%rbx), %rdx
leaq -0x558(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq $-0x1, %rcx
callq 0x43c0
leaq -0x140(%rbp), %rdi
leaq -0x558(%rbp), %r14
movq %r14, %rsi
callq 0x4490
movq (%r14), %rdi
leaq -0x548(%rbp), %rax
cmpq %rax, %rdi
je 0xb5d5
movq -0x548(%rbp), %rsi
incq %rsi
callq 0x43a0
leaq -0x558(%rbp), %rdi
leaq -0x90(%rbp), %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x43c0
leaq -0xd0(%rbp), %rdi
leaq -0x558(%rbp), %rbx
movq %rbx, %rsi
callq 0x4490
movq (%rbx), %rdi
leaq -0x548(%rbp), %rax
cmpq %rax, %rdi
je 0xb621
movq -0x548(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0xd0(%rbp), %rax
cmpb $0x5b, (%rax)
jne 0xb668
leaq -0xd0(%rbp), %rdi
movl $0x1, %edx
xorl %esi, %esi
callq 0x40d0
movq -0xc8(%rbp), %rsi
testq %rsi, %rsi
movq -0x30(%rbp), %r14
je 0xb848
decq %rsi
leaq -0xd0(%rbp), %rdi
movl $0x1, %edx
callq 0x40d0
xorps %xmm0, %xmm0
leaq -0x590(%rbp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x20(%rdx)
movaps %xmm0, 0x10(%rdx)
movl $0x2, 0x8(%rdx)
movq -0xd0(%rbp), %rdi
movq -0x140(%rbp), %rsi
leaq 0xdb97(%rip), %rcx      # 0x19230
callq 0x44a0
movl %eax, %ebx
testl %eax, %eax
je 0xb716
leaq -0x340(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x50b8(%rip), %rsi      # 0x1076e
leaq 0x50c7(%rip), %rdx      # 0x10784
leaq -0x350(%rbp), %rdi
callq 0x8912
movl %ebx, %edi
callq 0x4520
leaq -0x350(%rbp), %rdi
movq %rax, %rsi
callq 0x46f0
leaq -0x548(%rbp), %r15
movq %r15, -0x558(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xb7e4
movq %rdx, -0x558(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x548(%rbp)
jmp 0xb7eb
movq 0xdb13(%rip), %rax      # 0x19230
movq %rax, 0xdb14(%rip)      # 0x19238
testq %rax, %rax
je 0xb74f
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x40e0
movl %eax, 0xdb03(%rip)      # 0x19240
cmpl $-0x1, %eax
jne 0xb74f
movq 0xdaef(%rip), %rax      # 0x19238
movq 0x28(%rax), %rax
jmp 0xb71d
cmpq $0x0, 0xdae1(%rip)      # 0x19238
je 0xb867
movl 0xdadd(%rip), %edi      # 0x19240
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
callq 0x4210
leaq 0xdacd(%rip), %rdi      # 0x19248
callq 0xf2e8
leaq 0x5017(%rip), %rsi      # 0x1079e
leaq -0x350(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0xcca0
leaq 0x500d(%rip), %rsi      # 0x107ae
leaq -0x350(%rbp), %rdi
callq 0x46f0
leaq -0x548(%rbp), %rsi
movq %rsi, -0x558(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xb888
movq %rdx, -0x558(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x548(%rbp)
jmp 0xb88e
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq -0x558(%rbp), %rbx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x4490
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0xb82c
movq -0x548(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x350(%rbp), %rdi
cmpq %r14, %rdi
je 0xb50a
movq -0x340(%rbp), %rsi
jmp 0xb502
leaq 0x4f09(%rip), %rsi      # 0x10758
leaq -0x558(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0xcca0
jmp 0xb4e1
movq -0x30(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x4f0f(%rip), %rcx      # 0x10785
movl $0x18, %r8d
xorl %esi, %esi
callq 0x45b0
jmp 0xc19f
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq -0x558(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl $0xf, %esi
callq 0x9c17
movq -0x558(%rbp), %rdi
leaq -0x548(%rbp), %rax
cmpq %rax, %rdi
je 0xb8d8
movq -0x548(%rbp), %rsi
incq %rsi
callq 0x43a0
leaq -0x340(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb8f7
movq -0x340(%rbp), %rsi
incq %rsi
callq 0x43a0
leaq 0xd07a(%rip), %rdi      # 0x18978
xorl %esi, %esi
callq 0xf360
leaq 0xd06c(%rip), %rdi      # 0x18978
movl $0x3, %esi
callq 0xf374
movw $0xffff, 0xd939(%rip)   # imm = 0xFFFF
callq 0xe0c6
leaq 0xd85d(%rip), %rdx      # 0x19188
leaq -0x350(%rbp), %rdi
movq %rax, %rsi
callq 0xcd32
movq -0x350(%rbp), %rsi
leaq -0x558(%rbp), %rdi
movl $0x8, %edx
callq 0x46a0
movq -0x350(%rbp), %rdi
leaq -0x340(%rbp), %rax
cmpq %rax, %rdi
je 0xb974
movq -0x340(%rbp), %rsi
incq %rsi
callq 0x43a0
leaq -0x340(%rbp), %rax
movq %rax, -0x350(%rbp)
xorl %eax, %eax
movq %rax, -0x348(%rbp)
movb %al, -0x340(%rbp)
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq -0x558(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x538(%rbp,%rax)
jne 0xba3d
leaq -0x558(%rbp), %rbx
leaq -0x350(%rbp), %r14
leaq -0x50(%rbp), %r15
leaq -0x70(%rbp), %r12
movq %rbx, %rdi
movq %r14, %rsi
callq 0x44b0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4560
movq %rbx, %rdi
movq %r12, %rsi
callq 0x44b0
movq -0x348(%rbp), %rdx
cmpq -0x88(%rbp), %rdx
jne 0xba1b
testq %rdx, %rdx
je 0xba32
movq -0x90(%rbp), %rsi
movq -0x350(%rbp), %rdi
callq 0x43b0
testl %eax, %eax
je 0xba32
movq -0x558(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x538(%rbp,%rax)
je 0xb9ce
jmp 0xba3d
movzwl -0x50(%rbp), %eax
movw %ax, 0xd81b(%rip)       # 0x19258
movzwl 0xd814(%rip), %esi      # 0x19258
leaq 0xcf2d(%rip), %rdi      # 0x18978
callq 0xf374
cmpw $-0x1, 0xd800(%rip)     # 0x19258
je 0xba6a
leaq 0xcf17(%rip), %rdi      # 0x18978
leaq -0x70(%rbp), %rsi
callq 0xf39e
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xba83
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x350(%rbp), %rdi
leaq -0x340(%rbp), %rax
cmpq %rax, %rdi
je 0xbaa5
movq -0x340(%rbp), %rsi
incq %rsi
callq 0x43a0
leaq -0x558(%rbp), %r14
movq %r14, %rdi
callq 0x40f0
callq 0xe070
leaq 0xceb8(%rip), %rdi      # 0x18978
movq %rax, %rsi
callq 0xf39e
movq 0xb4e9(%rip), %rax      # 0x16fb8
movq (%rax), %rcx
movq %rcx, -0x150(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x148(%rbp)
xorl %r12d, %r12d
leaq 0xce94(%rip), %rsi      # 0x18982
leaq -0x50(%rbp), %r15
movq $0x0, -0x118(%rbp)
movl 0xd73d(%rip), %edi      # 0x19240
movswq 0xce75(%rip), %rdx      # 0x18980
movq 0xd726(%rip), %rax      # 0x19238
movq 0x18(%rax), %r8
movl 0x10(%rax), %r9d
xorl %ecx, %ecx
callq 0x4060
cmpq $-0x1, %rax
je 0xc1b0
movq %r12, -0x120(%rbp)
xorl %r12d, %r12d
callq 0xc4cc
cmpw $-0x1, %ax
je 0xc0f5
leaq 0xc61d(%rip), %rdi      # 0x18168
callq 0xf480
movzbl %al, %eax
leal -0x10(%rax), %ecx
cmpl $0x4, %ecx
jae 0xbb9a
shll $0x5, %eax
leaq 0xd64b(%rip), %rcx      # 0x191b0
leaq (%rax,%rcx), %rsi
addq $-0x200, %rsi           # imm = 0xFE00
movq -0x30(%rbp), %rdi
callq 0x4200
movl 0xd6c1(%rip), %edi      # 0x19240
callq 0x4710
movq 0xd6a5(%rip), %rdi      # 0x19230
callq 0x44e0
xorl %r13d, %r13d
xorl %ebx, %ebx
jmp 0xc0ec
testl %eax, %eax
je 0xbca6
movb $0x1, %r13b
cmpl $0x14, %eax
jne 0xc0ec
leaq 0xc5b3(%rip), %rdi      # 0x18168
callq 0xf468
movw %ax, 0xd697(%rip)       # 0x19258
leaq -0x100(%rbp), %rax
movq %rax, -0x110(%rbp)
movq $0x0, -0x108(%rbp)
movb $0x0, -0x100(%rbp)
leaq 0xc580(%rip), %rdi      # 0x18168
leaq -0x110(%rbp), %rsi
callq 0xf492
leaq -0x548(%rbp), %r13
movzwl 0xd656(%rip), %ebx      # 0x19258
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x731c
movq -0x48(%rbp), %rsi
movl $0x1, %ecx
movq %r15, %rdi
xorl %edx, %edx
movl $0x20, %r8d
callq 0x46e0
leaq -0xb0(%rbp), %rdi
movl %ebx, %esi
callq 0xfe83
movq -0x50(%rbp), %rcx
movl $0xf, %esi
leaq -0x40(%rbp), %rax
cmpq %rax, %rcx
je 0xbc60
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %r8
movq -0xa8(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0xbc95
movl $0xf, %esi
leaq -0xa0(%rbp), %rdi
cmpq %rdi, -0xb0(%rbp)
je 0xbc90
movq -0xa0(%rbp), %rsi
cmpq %rsi, %rax
jbe 0xbcce
movq -0xb0(%rbp), %rsi
movq %r15, %rdi
callq 0x4120
jmp 0xbcde
xorl %r13d, %r13d
leaq 0x4b27(%rip), %rdi      # 0x107d7
movl $0x7, %esi
xorl %edx, %edx
movl $0x5, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x68af
movb $0x1, %bl
jmp 0xc0ec
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4410
leaq -0x340(%rbp), %rsi
movq %rsi, -0x350(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0xbd0b
movq %rdx, -0x350(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x340(%rbp)
jmp 0xbd11
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x348(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq -0x348(%rbp), %rsi
movl $0x1, %ecx
leaq -0x350(%rbp), %rdi
xorl %edx, %edx
movl $0x20, %r8d
callq 0x46e0
movq %r13, -0x558(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbd79
movq %rdx, -0x558(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x548(%rbp)
jmp 0xbd81
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, -0x550(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
movq %r14, %rdi
callq 0x4120
leaq -0x60(%rbp), %rsi
movq %rsi, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbdd5
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0xbddb
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x558(%rbp), %rdi
cmpq %r13, %rdi
je 0xbe0d
movq -0x548(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x350(%rbp), %rdi
leaq -0x340(%rbp), %r13
cmpq %r13, %rdi
je 0xbe2f
movq -0x340(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0xbe51
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xbe6a
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x43a0
xorps %xmm0, %xmm0
movaps %xmm0, -0xf0(%rbp)
movq $0x0, -0xe0(%rbp)
callq 0xe0c6
leaq -0x350(%rbp), %rdi
movq %rax, %rsi
leaq 0xd2f3(%rip), %rdx      # 0x19188
callq 0xcd32
movq -0x350(%rbp), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x46a0
movq -0x350(%rbp), %rdi
cmpq %r13, %rdi
je 0xbec9
movq -0x340(%rbp), %rsi
incq %rsi
callq 0x43a0
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movb $0x0, -0x40(%rbp)
movb $0x1, %bl
leaq -0x60(%rbp), %r13
movq -0x558(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x46c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xbf58
testb $0x1, %bl
je 0xbf47
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rcx
movq %r15, %rdi
xorl %edx, %edx
callq 0x4660
testq %rax, %rax
jne 0xbf47
movq %r15, %rdi
leaq -0x70(%rbp), %rsi
callq 0x4200
xorl %ebx, %ebx
leaq -0xf0(%rbp), %rdi
movq %r15, %rsi
callq 0x95c4
jmp 0xbee3
movq %r14, %rdi
callq 0x40a0
testb $0x1, %bl
je 0xbf75
leaq -0xf0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x95c4
callq 0xe0c6
leaq -0xb0(%rbp), %rdi
movq %rax, %rsi
leaq 0xd1fd(%rip), %rdx      # 0x19188
callq 0xcd32
movq -0xb0(%rbp), %rsi
leaq -0x350(%rbp), %rdi
movl $0x10, %edx
callq 0x43f0
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0xbfca
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0xf0(%rbp), %rax
cmpq -0xe8(%rbp), %rax
je 0xc02c
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq -0x350(%rbp), %rdi
callq 0x4420
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movq -0xf0(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x9808
jmp 0xbfca
movq -0x150(%rbp), %rax
movq %rax, -0x350(%rbp)
movq -0x18(%rax), %rax
movq -0x148(%rbp), %rcx
movq %rcx, -0x350(%rbp,%rax)
leaq -0x348(%rbp), %rdi
callq 0x4300
leaq -0x258(%rbp), %rdi
callq 0x4140
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xc07e
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x43a0
movq %r14, %rdi
callq 0x40f0
leaq -0xf0(%rbp), %rdi
callq 0x72b2
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0xc0a7
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x43a0
leaq 0x4736(%rip), %rdi      # 0x107e4
movl $0x7, %esi
xorl %edx, %edx
movl $0x5, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x68af
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0xc0e7
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x43a0
movb $0x1, %bl
xorl %r13d, %r13d
testb %r13b, %r13b
leaq -0x80(%rbp), %r13
je 0xc167
movq 0xaec4(%rip), %rax      # 0x16fc0
movq (%rax), %rdi
callq 0x44c0
cmpl $0x3, %eax
je 0xc140
incl %r12d
cmpl $0x32, %r12d
jne 0xbb35
movq -0x118(%rbp), %rax
cmpb $0x2, %al
leal 0x1(%rax), %eax
setae %r12b
movl %eax, %ecx
movq %rcx, -0x118(%rbp)
cmpb $0x3, %al
leaq 0xc84a(%rip), %rsi      # 0x18982
jne 0xbafd
jmp 0xc16e
movq -0x30(%rbp), %rdi
movq 0x8(%rdi), %rdx
xorl %ebx, %ebx
leaq 0x469c(%rip), %rcx      # 0x107ed
movl $0x10, %r8d
xorl %esi, %esi
callq 0x45b0
movq -0x120(%rbp), %r12
jmp 0xc16e
movq -0x120(%rbp), %r12
testb $0x1, %r12b
je 0xb50c
movq -0x30(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x4677(%rip), %rcx      # 0x107fe
movl $0x24, %r8d
xorl %esi, %esi
callq 0x45b0
movl 0xd0a6(%rip), %edi      # 0x19240
callq 0x4710
movq 0xd08a(%rip), %rdi      # 0x19230
callq 0x44e0
jmp 0xb50a
leaq 0x45fc(%rip), %rsi      # 0x107b3
movq -0x30(%rbp), %rdi
callq 0x4500
movl 0xd07a(%rip), %edi      # 0x19240
callq 0x4710
movq 0xd05e(%rip), %rdi      # 0x19230
callq 0x44e0
xorl %ebx, %ebx
jmp 0xc16e
jmp 0xc3da
jmp 0xc3da
jmp 0xc3da
movq %rax, %rbx
movq -0x350(%rbp), %rdi
leaq -0x340(%rbp), %rax
jmp 0xc232
movq %rax, %rbx
movq -0x558(%rbp), %rdi
leaq -0x548(%rbp), %rax
cmpq %rax, %rdi
je 0xc227
movq -0x548(%rbp), %rsi
incq %rsi
callq 0x43a0
jmp 0xc227
movq %rax, %rbx
leaq -0x340(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0xc349
jmp 0xc464
jmp 0xc3da
jmp 0xc3da
jmp 0xc379
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0xc3f8
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x43a0
jmp 0xc3f8
movq %rax, %rbx
movq -0x350(%rbp), %rdi
cmpq %r13, %rdi
je 0xc41d
movq -0x340(%rbp), %rsi
incq %rsi
callq 0x43a0
jmp 0xc41d
movq %rax, %rbx
movq -0x558(%rbp), %rdi
cmpq %r13, %rdi
je 0xc2c7
movq -0x548(%rbp), %rsi
incq %rsi
callq 0x43a0
jmp 0xc2c7
movq %rax, %rbx
movq -0x350(%rbp), %rdi
leaq -0x340(%rbp), %rax
cmpq %rax, %rdi
je 0xc2ee
movq -0x340(%rbp), %rsi
incq %rsi
callq 0x43a0
jmp 0xc2ee
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0xc317
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x43a0
jmp 0xc317
jmp 0xc314
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xc442
movq -0x40(%rbp), %rsi
jmp 0xc43a
jmp 0xc3e4
movq %rax, %rbx
movq -0x350(%rbp), %rdi
cmpq %r14, %rdi
je 0xc464
movq -0x340(%rbp), %rsi
jmp 0xc45c
jmp 0xc3da
jmp 0xc3e4
movq %rax, %rbx
jmp 0xc41d
jmp 0xc3da
movq %rax, %rbx
jmp 0xc442
jmp 0xc3da
jmp 0xc3da
jmp 0xc3da
jmp 0xc3da
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xc395
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x350(%rbp), %rdi
leaq -0x340(%rbp), %rax
cmpq %rax, %rdi
je 0xc3b7
movq -0x340(%rbp), %rsi
incq %rsi
callq 0x43a0
leaq -0x558(%rbp), %rdi
callq 0x40f0
jmp 0xc464
movq %rax, %rbx
jmp 0xc486
movq %rax, %rbx
jmp 0xc4a8
jmp 0xc3da
movq %rax, %rbx
jmp 0xc464
jmp 0xc3e9
movq %rax, %rbx
jmp 0xc3f8
movq %rax, %rbx
leaq -0x350(%rbp), %rdi
callq 0x4550
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xc411
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x43a0
leaq -0x558(%rbp), %rdi
callq 0x40f0
leaq -0xf0(%rbp), %rdi
callq 0x72b2
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xc442
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0xc464
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0xc486
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0xc4a8
movq -0x130(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xc4c4
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x43a0
movq %rbx, %rdi
callq 0x4670