// File: /workspace/github_cpp_makefile_star2_O2/rthoelen[P]NXCore_Kenwood/main.cc
// Function: main
int main(int argc, char *argv[])
{
	unsigned int i, j;
	int len;
	struct addrinfo hints, *result;

	boost::property_tree::ptree pt;

	try {

	boost::property_tree::ini_parser::read_ini("NXCore.ini", pt);

	}
	catch(const boost::property_tree::ptree_error  &e)
	{
		std::cout << "Config file not found!" << std::endl << std::endl;
		exit(1);
	}


	if(argc > 1)
		if (strcmp(argv[1], "-d") == 0)
			debug = 1;

	// Print out version and copyright info
	std::cout << version << std::endl;
	std::cout << copyright << std::endl << std::endl;

	// Get list of repeaters

	std::string s = pt.get<std::string>("repeaters");
	std::string tg;

	std::vector<std::string> elems;
	std::vector<std::string> tg_elems;

	// Split by space or tab
	boost::split(elems, s, boost::is_any_of("\t ,"), boost::token_compress_on);

	repeater_count = elems.size();
	std::cout << "Repeater Count:  " << repeater_count << std::endl << std::endl;

	r_list = elems;

	repeater = (struct rpt *)calloc(repeater_count, sizeof(struct rpt));


	tempaddr = inet_addr(pt.get<std::string>("nodeip").c_str());

	up_packet[4] = (tempaddr >> 24);
	up_packet[5] = (tempaddr >> 16) & 0xff;
	up_packet[6] = (tempaddr >> 8) & 0xff;
	up_packet[7] = (tempaddr & 0xff);

	down_packet[4] = (tempaddr >> 24);
	down_packet[5] = (tempaddr >> 16) & 0xff;
	down_packet[6] = (tempaddr >> 8) & 0xff;
	down_packet[7] = (tempaddr & 0xff);


	// Start populating structure
	std::string key;

	for(i = 0; i < elems.size(); i++)
	{

		key.assign(elems[i]);
		key.append(".address");

		memset(&hints,0, sizeof(hints));
		hints.ai_family = AF_INET;

		
		len = pt.get<std::string>(key).size();
		repeater[i].hostname = (char *)calloc(1, len+1);
		memcpy(repeater[i].hostname, (char *)pt.get<std::string>(key).c_str(),len+1);

		if(getaddrinfo(repeater[i].hostname, NULL, &hints, &result) == -1)
		{
			std::cout << "Error resolving " << pt.get<std::string>(key) << ", exiting" << std::endl;
			exit(1);
		}	
	
		repeater[i].rpt_addr_00.sin_addr.s_addr = ((struct sockaddr_in *)(result->ai_addr))->sin_addr.s_addr;
		repeater[i].rpt_addr_01.sin_addr.s_addr = ((struct sockaddr_in *)(result->ai_addr))->sin_addr.s_addr;
		repeater[i].rpt_addr_00.sin_family = AF_INET;
		repeater[i].rpt_addr_01.sin_family = AF_INET;
		repeater[i].rpt_addr_00.sin_port = htons(64000);
		repeater[i].rpt_addr_01.sin_port = htons(64001);
		
		freeaddrinfo(result);
		std::cout << std::endl << std::endl;
		std::cout << "Repeater " << r_list[i] << " address: " 
			<< inet_ntoa(repeater[i].rpt_addr_00.sin_addr) << std::endl << std::endl;

		// Parse out the talkgroups

		key.assign(elems[i]);
		key.append(".tg_list");
		tg = pt.get<std::string>(key).c_str();

		boost::split(tg_elems, tg, boost::is_any_of("\t ,"), boost::token_compress_on);
	
		repeater[i].tg_list = (int *)calloc(tg_elems.size()+1,sizeof(int));
		std::cout << "Talkgroups " << tg_elems.size() << std::endl; 
		std::cout << "Repeater " << r_list[i] << "  Talkgroups: ";

		for(j = 0; j < tg_elems.size(); j++)
		{
			repeater[i].tg_list[j] = atoi(tg_elems[j].c_str());
			std::cout << " " << repeater[i].tg_list[j];

		}
		std::cout << std::endl;

		// Do the same for the tactical list

		key.assign(elems[i]);
		key.append(".tac_list");
		tg = pt.get<std::string>(key).c_str();

		boost::split(tg_elems, tg, boost::is_any_of("\t ,"), boost::token_compress_on);
	
		repeater[i].tac_list = (int *)calloc(tg_elems.size()+1,sizeof(int));
		std::cout << "Tactical Talkgroups " << tg_elems.size() << std::endl; 
		std::cout << "Repeater " << i << "  Tactical Talkgroup List: ";

		for(j = 0; j < tg_elems.size(); j++)
		{
			repeater[i].tac_list[j] = atoi(tg_elems[j].c_str());
			std::cout << " " << repeater[i].tac_list[j];

		}


		std::cout << std::endl << std::endl;
		repeater[i].tx_ran = pt.get<int>(elems[i] + ".tx_ran");
		repeater[i].rx_ran = pt.get<int>(elems[i] + ".rx_ran");
		repeater[i].hold_time = pt.get<int>(elems[i] + ".rx_hold_time");
		repeater[i].time_since_rx = repeater[i].hold_time;
		repeater[i].stealth = pt.get<int>(elems[i] + ".stealth");
		repeater[i].tx_hold_time = pt.get<int>(elems[i] + ".tx_hold_time");
		repeater[i].time_since_tx = repeater[i].tx_hold_time;
		repeater[i].tx_otaa = pt.get<int>(elems[i] + ".tx_otaa");

                try {
                        repeater[i].tg_network_off = pt.get<int>(elems[i] + ".tg_network_off");
                        repeater[i].tg_network_on = pt.get<int>(elems[i] + ".tg_network_on");
                }
                catch(const boost::property_tree::ptree_error &e)
                {
                        repeater[i].tg_network_off = 0;
                        repeater[i].tg_network_on = 0;
                }
		
		try {
			repeater[i].msg_flag = pt.get<int>(elems[i] + ".msg_flag");
		}
		catch(const boost::property_tree::ptree_error &e)
		{
			repeater[i].msg_flag = 0;
		}

	}

	//

	tx_sem = 0;
	tx_busy_sem = 0;

	// start the threads


	pthread_t l_thread;
	pthread_t t_thread;

	if(pthread_create(&l_thread, NULL, listen_thread, (void *)0))  {
		fprintf(stderr, "Problem creating thread.  Exiting\n");
		return 1; 
	}
	
	if(pthread_create(&t_thread, NULL, timing_thread, (void *)0))  {
		fprintf(stderr, "Problem creating thread.  Exiting\n");
		return 1; 
	}

	int counter = 0;


	while(1==1)
	{
	
		sleep(10);
		counter++;

		if (counter > 90)
		{
			while(tx_sem==1)
				usleep(1);
			tx_sem = 1;
		
			for (i = 0; i < (unsigned int)repeater_count; i++)
			{
                       		if(getaddrinfo(repeater[i].hostname, NULL, &hints, &result) == 0)
                        	{
                                	repeater[i].rpt_addr_00.sin_addr.s_addr = ((struct sockaddr_in *)(result->ai_addr))->sin_addr.s_addr;
                                	repeater[i].rpt_addr_01.sin_addr.s_addr = ((struct sockaddr_in *)(result->ai_addr))->sin_addr.s_addr;
				freeaddrinfo(result);
                        	}
			}
			tx_sem = 0;
		counter = 0;
		}

	}
	pthread_exit(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %rbx
movl %edi, %r14d
leaq -0x140(%rbp), %rdi
callq 0x70cc
leaq 0x7421(%rip), %rsi      # 0xd367
leaq -0xc8(%rbp), %rdi
leaq -0x118(%rbp), %rdx
callq 0x72e8
leaq -0x160(%rbp), %r15
movq %r15, %rdi
callq 0x4600
leaq -0xc8(%rbp), %rdi
leaq -0x140(%rbp), %rsi
movq %r15, %rdx
callq 0x712e
leaq -0x160(%rbp), %rdi
callq 0x4480
leaq -0xc8(%rbp), %rdi
callq 0x4120
cmpl $0x1, %r14d
jle 0x5fbb
movq 0x8(%rbx), %rax
cmpb $0x2d, (%rax)
jne 0x5fbb
cmpb $0x64, 0x1(%rax)
jne 0x5fbb
cmpb $0x0, 0x2(%rax)
jne 0x5fbb
movl $0x1, 0xe441(%rip)      # 0x143fc
movq 0xe00e(%rip), %rdi      # 0x13fd0
leaq 0xe357(%rip), %rsi      # 0x14320
callq 0x4320
movq %rax, %rdi
callq 0x4150
movq 0xdff3(%rip), %rdi      # 0x13fd0
leaq 0xe36c(%rip), %rsi      # 0x14350
callq 0x4320
movq %rax, %rdi
callq 0x4150
movq %rax, %rdi
callq 0x4150
leaq 0x7389(%rip), %rsi      # 0xd389
leaq -0xc8(%rbp), %rdi
pushq $0x2e
popq %rdx
callq 0x735c
leaq -0x160(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x7332
leaq -0xc8(%rbp), %rdi
callq 0x4120
leaq -0x108(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
andq $0x0, -0x60(%rbp)
movaps %xmm0, -0x90(%rbp)
andq $0x0, -0x80(%rbp)
leaq 0x732c(%rip), %rsi      # 0xd393
leaq -0x178(%rbp), %rdi
callq 0x7420
leaq -0x70(%rbp), %rdi
leaq -0x160(%rbp), %rsi
leaq -0x178(%rbp), %rdx
xorl %ecx, %ecx
callq 0x7394
leaq -0x178(%rbp), %rdi
callq 0x7452
movq -0x68(%rbp), %rax
subq -0x70(%rbp), %rax
shrq $0x5, %rax
movl %eax, 0xe34e(%rip)      # 0x143f8
movq 0xdf1f(%rip), %rdi      # 0x13fd0
leaq 0x72df(%rip), %rsi      # 0xd397
callq 0x4320
movl 0xe335(%rip), %esi      # 0x143f8
movq %rax, %rdi
callq 0x4540
movq %rax, %rdi
callq 0x4150
movq %rax, %rdi
callq 0x4150
leaq 0xe31e(%rip), %rdi      # 0x14400
leaq -0x70(%rbp), %rsi
callq 0x746e
movslq 0xe306(%rip), %rdi      # 0x143f8
movl $0x90, %esi
callq 0x41f0
movq %rax, 0xe2ed(%rip)      # 0x143f0
leaq 0x729f(%rip), %rsi      # 0xd3a9
leaq -0xc8(%rbp), %rdi
pushq $0x2e
popq %rdx
callq 0x735c
leaq -0xe8(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x7332
leaq -0xe8(%rbp), %rbx
movq (%rbx), %rdi
callq 0x4340
movl %eax, 0xe2d0(%rip)      # 0x14418
movq %rbx, %rdi
callq 0x4120
leaq -0xc8(%rbp), %rbx
movq %rbx, %rdi
callq 0x4120
movl 0xe2b3(%rip), %eax      # 0x14418
movl %eax, %ecx
shrl $0x18, %ecx
movl %eax, %edx
shrl $0x10, %edx
movb %cl, 0xe22f(%rip)       # 0x143a4
movb %dl, 0xe22a(%rip)       # 0x143a5
movb %ah, 0xe225(%rip)       # 0x143a6
movb %al, 0xe220(%rip)       # 0x143a7
bswapl %eax
leaq -0xd8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movl %eax, 0xe1e5(%rip)      # 0x14384
movb $0x0, (%rcx)
xorl %r12d, %r12d
leaq -0x140(%rbp), %r13
movl %r12d, %r12d
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r12, %rax
jbe 0x6aba
movq %r12, %rax
shlq $0x5, %rax
movq %rax, -0x30(%rbp)
addq %rax, %rsi
leaq -0xe8(%rbp), %rdi
callq 0x4190
leaq -0xe8(%rbp), %rdi
leaq 0x71c1(%rip), %rsi      # 0xd3b0
callq 0x45c0
xorps %xmm0, %xmm0
movaps %xmm0, -0x1b0(%rbp)
movaps %xmm0, -0x190(%rbp)
movaps %xmm0, -0x1a0(%rbp)
movl $0x2, -0x1ac(%rbp)
movq %rbx, %rdi
leaq -0xe8(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rsi
leaq -0x50(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rdx
callq 0x7332
movl -0x48(%rbp), %r14d
movq %r13, %rdi
callq 0x4120
movq %rbx, %rdi
callq 0x4120
incl %r14d
movq %r12, %r15
movslq %r14d, %r12
pushq $0x1
popq %rdi
movq %r12, %rsi
callq 0x41f0
movq 0xe187(%rip), %rcx      # 0x143f0
movq %r15, -0xf8(%rbp)
imulq $0x90, %r15, %r15
movq %rax, 0x20(%rcx,%r15)
movq 0xe16d(%rip), %rax      # 0x143f0
movq 0x20(%rax,%r15), %r14
movq %rbx, %rdi
leaq -0xe8(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rdi
leaq -0x140(%rbp), %rsi
movq %rbx, %rdx
callq 0x7332
movq -0x50(%rbp), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x42b0
movq %r13, %rdi
callq 0x4120
movq %rbx, %rdi
callq 0x4120
movq 0xe11e(%rip), %rax      # 0x143f0
movq 0x20(%rax,%r15), %rdi
xorl %esi, %esi
leaq -0x1b0(%rbp), %rdx
leaq -0xf0(%rbp), %rcx
callq 0x43e0
movq -0xf8(%rbp), %r12
leaq -0x140(%rbp), %r13
cmpl $-0x1, %eax
je 0x6b77
movq -0xf0(%rbp), %rdi
movq 0x18(%rdi), %rax
movl 0x4(%rax), %eax
movq 0xe0d8(%rip), %rcx      # 0x143f0
movl %eax, 0x4(%rcx,%r15)
movl %eax, 0x14(%rcx,%r15)
movl $0xfa0002, (%rcx,%r15)  # imm = 0xFA0002
movl $0x1fa0002, 0x10(%rcx,%r15) # imm = 0x1FA0002
callq 0x4420
movq 0xdc91(%rip), %rdi      # 0x13fd0
callq 0x4150
movq %rax, %rdi
callq 0x4150
movq 0xdc7d(%rip), %rdi      # 0x13fd0
leaq 0x6e71(%rip), %rsi      # 0xd1cb
callq 0x4320
movq 0xe09a(%rip), %rsi      # 0x14400
addq -0x30(%rbp), %rsi
movq %rax, %rdi
callq 0x42f0
movq %rax, %rdi
leaq 0x7058(%rip), %rsi      # 0xd3d4
callq 0x4320
movq %rax, %r14
movq 0xe065(%rip), %rax      # 0x143f0
movl 0x4(%rax,%r15), %edi
callq 0x4110
movq %r14, %rdi
movq %rax, %rsi
callq 0x4320
movq %rax, %rdi
callq 0x4150
movq %rax, %rdi
callq 0x4150
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x4190
leaq -0xe8(%rbp), %rdi
leaq 0x700d(%rip), %rsi      # 0xd3df
callq 0x45c0
movq %rbx, %rdi
leaq -0xe8(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x7542
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x7332
movq -0x50(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0x45d0
leaq -0x50(%rbp), %rdi
callq 0x4120
movq %rbx, %rdi
callq 0x4120
leaq -0x1e0(%rbp), %rdi
leaq 0x6f6c(%rip), %rsi      # 0xd393
callq 0x7420
leaq -0x90(%rbp), %rdi
leaq -0x118(%rbp), %rsi
leaq -0x1e0(%rbp), %r14
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x7394
movq %r14, %rdi
callq 0x7452
movq -0x88(%rbp), %rdi
subq -0x90(%rbp), %rdi
sarq $0x5, %rdi
incq %rdi
pushq $0x4
popq %rsi
callq 0x41f0
movq 0xdf79(%rip), %rcx      # 0x143f0
movq %rax, 0x58(%rcx,%r15)
movq 0xdb4d(%rip), %rdi      # 0x13fd0
leaq 0x6f80(%rip), %rsi      # 0xd40a
callq 0x4320
movq -0x88(%rbp), %rsi
subq -0x90(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x4200
movq %rax, %rdi
callq 0x4150
movq 0xdb18(%rip), %rdi      # 0x13fd0
leaq 0x6d0c(%rip), %rsi      # 0xd1cb
callq 0x4320
movq 0xdf35(%rip), %rsi      # 0x14400
addq -0x30(%rbp), %rsi
movq %rax, %rdi
callq 0x42f0
movq %rax, %rdi
leaq 0x6f07(%rip), %rsi      # 0xd3e8
callq 0x4320
xorl %r14d, %r14d
movl %r14d, %r14d
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r14, %rcx
jbe 0x6556
movq %r14, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rdi
callq 0x44c0
movq 0xded3(%rip), %rcx      # 0x143f0
movq 0x58(%rcx,%r15), %rcx
movl %eax, (%rcx,%r14,4)
movq 0xdaa3(%rip), %rdi      # 0x13fd0
leaq 0x6e73(%rip), %rsi      # 0xd3a7
callq 0x4320
movq 0xdeb0(%rip), %rcx      # 0x143f0
movq 0x58(%rcx,%r15), %rcx
movl (%rcx,%r14,4), %esi
movq %rax, %rdi
callq 0x4540
incl %r14d
jmp 0x64e9
movq 0xda73(%rip), %rdi      # 0x13fd0
callq 0x4150
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x4190
leaq -0xe8(%rbp), %rdi
leaq 0x6e73(%rip), %rsi      # 0xd3f7
callq 0x45c0
movq %rbx, %rdi
leaq -0xe8(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x7542
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x7332
movq -0x50(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0x45d0
leaq -0x50(%rbp), %rdi
callq 0x4120
movq %rbx, %rdi
callq 0x4120
leaq -0x1c8(%rbp), %rdi
leaq 0x6dba(%rip), %rsi      # 0xd393
callq 0x7420
leaq -0x90(%rbp), %rdi
leaq -0x118(%rbp), %rsi
leaq -0x1c8(%rbp), %r14
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x7394
movq %r14, %rdi
callq 0x7452
movq -0x88(%rbp), %rdi
subq -0x90(%rbp), %rdi
sarq $0x5, %rdi
incq %rdi
pushq $0x4
popq %rsi
callq 0x41f0
movq 0xddc7(%rip), %rcx      # 0x143f0
movq %rax, 0x60(%rcx,%r15)
movq 0xd99b(%rip), %rdi      # 0x13fd0
leaq 0x6dc5(%rip), %rsi      # 0xd401
callq 0x4320
movq -0x88(%rbp), %rsi
subq -0x90(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x4200
movq %rax, %rdi
callq 0x4150
movq 0xd966(%rip), %rdi      # 0x13fd0
leaq 0x6b5a(%rip), %rsi      # 0xd1cb
callq 0x4320
movq %rax, %rdi
movq %r12, %rsi
callq 0x4200
movq %rax, %rdi
leaq 0x6d8b(%rip), %rsi      # 0xd416
callq 0x4320
xorl %r14d, %r14d
movl %r14d, %r14d
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r14, %rcx
jbe 0x6700
movq %r14, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rdi
callq 0x44c0
movq 0xdd29(%rip), %rcx      # 0x143f0
movq 0x60(%rcx,%r15), %rcx
movl %eax, (%rcx,%r14,4)
movq 0xd8f9(%rip), %rdi      # 0x13fd0
leaq 0x6cc9(%rip), %rsi      # 0xd3a7
callq 0x4320
movq 0xdd06(%rip), %rcx      # 0x143f0
movq 0x60(%rcx,%r15), %rcx
movl (%rcx,%r14,4), %esi
movq %rax, %rdi
callq 0x4540
incl %r14d
jmp 0x6693
movq 0xd8c9(%rip), %rdi      # 0x13fd0
callq 0x4150
movq %rax, %rdi
callq 0x4150
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
leaq -0x50(%rbp), %r14
movq %r14, %rdi
leaq 0x6d08(%rip), %rdx      # 0xd432
callq 0x7576
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7564
movq 0xdca1(%rip), %rcx      # 0x143f0
movb %al, 0x48(%rcx,%r15)
movq %rbx, %rdi
callq 0x4120
movq %r14, %rdi
callq 0x4120
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %r14, %rdi
leaq 0x6cc4(%rip), %rdx      # 0xd43a
callq 0x7576
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7564
movq 0xdc55(%rip), %rcx      # 0x143f0
movb %al, 0x49(%rcx,%r15)
movq %rbx, %rdi
callq 0x4120
movq %r14, %rdi
callq 0x4120
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %r14, %rdi
leaq 0x6c80(%rip), %rdx      # 0xd442
callq 0x7576
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7564
movq 0xdc09(%rip), %rcx      # 0x143f0
movl %eax, 0x30(%rcx,%r15)
movq %rbx, %rdi
callq 0x4120
movq %r14, %rdi
callq 0x4120
movq 0xdbed(%rip), %rax      # 0x143f0
movl 0x30(%rax,%r15), %ecx
movl %ecx, 0x28(%rax,%r15)
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %r14, %rdi
leaq 0x6c31(%rip), %rdx      # 0xd450
callq 0x7576
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7564
movq 0xdbac(%rip), %rcx      # 0x143f0
movl %eax, 0x44(%rcx,%r15)
movq %rbx, %rdi
callq 0x4120
movq %r14, %rdi
callq 0x4120
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %r14, %rdi
leaq 0x6bee(%rip), %rdx      # 0xd459
callq 0x7576
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7564
movq 0xdb60(%rip), %rcx      # 0x143f0
movl %eax, 0x34(%rcx,%r15)
movq %rbx, %rdi
callq 0x4120
movq %r14, %rdi
callq 0x4120
movq 0xdb44(%rip), %rax      # 0x143f0
movl 0x34(%rax,%r15), %ecx
movl %ecx, 0x2c(%rax,%r15)
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %r14, %rdi
leaq 0x6b9f(%rip), %rdx      # 0xd467
callq 0x7576
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7564
movq 0xdb03(%rip), %rcx      # 0x143f0
movl %eax, 0x70(%rcx,%r15)
movq %rbx, %rdi
callq 0x4120
movq %r14, %rdi
callq 0x4120
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %r14, %rdi
leaq 0x6b5c(%rip), %rdx      # 0xd470
callq 0x7576
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7564
movq 0xdab7(%rip), %rcx      # 0x143f0
movl %eax, 0x84(%rcx,%r15)
movq %rbx, %rdi
callq 0x4120
movq %r14, %rdi
callq 0x4120
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %r14, %rdi
leaq 0x6b1d(%rip), %rdx      # 0xd480
callq 0x7576
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7564
movq 0xda68(%rip), %rcx      # 0x143f0
movl %eax, 0x80(%rcx,%r15)
movq %rbx, %rdi
callq 0x4120
movq %r14, %rdi
callq 0x4120
movq -0x30(%rbp), %rsi
addq -0x70(%rbp), %rsi
movq %r14, %rdi
leaq 0x6add(%rip), %rdx      # 0xd48f
callq 0x7576
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2e
popq %rdx
callq 0x7542
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7564
movq 0xda19(%rip), %rcx      # 0x143f0
movl %eax, 0x88(%rcx,%r15)
movq %rbx, %rdi
callq 0x4120
leaq -0x50(%rbp), %rdi
callq 0x4120
incl %r12d
jmp 0x61ac
jmp 0x6a12
jmp 0x6a38
jmp 0x6a88
movq %rdx, %r14
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
callq 0x4120
jmp 0x6a2d
movq %rdx, -0x98(%rbp)
movq %rax, %r14
movq %rbx, %rdi
callq 0x4120
jmp 0x6a42
movq %rdx, %r14
movq %rax, -0x30(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x4120
jmp 0x6a5b
movq %rdx, -0x98(%rbp)
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x4120
movq -0x98(%rbp), %rdx
jmp 0x6a8b
movq %rdx, %r14
movq %rax, -0x30(%rbp)
cmpl $0x1, %r14d
jne 0x6cab
movq -0x30(%rbp), %rdi
callq 0x40e0
movq 0xd97b(%rip), %rax      # 0x143f0
andl $0x0, 0x88(%rax,%r15)
callq 0x4500
jmp 0x69f0
movq %rax, %r14
cmpl $0x1, %edx
jne 0x6e2e
movq %r14, %rdi
callq 0x40e0
movq 0xd94d(%rip), %rax      # 0x143f0
andq $0x0, 0x80(%rax,%r15)
callq 0x4500
leaq -0x50(%rbp), %r14
jmp 0x69a0
andl $0x0, 0xd963(%rip)      # 0x14424
andl $0x0, 0xd960(%rip)      # 0x14428
leaq -0x228f(%rip), %rdx     # 0x4840
leaq -0xc8(%rbp), %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x4580
testl %eax, %eax
jne 0x6b01
leaq -0xe9c(%rip), %rdx      # 0x5c4e
xorl %ebx, %ebx
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x4580
testl %eax, %eax
je 0x6bf7
movq 0xd4d0(%rip), %rax      # 0x13fd8
movq (%rax), %rcx
leaq 0x6987(%rip), %rdi      # 0xd499
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x45e0
leaq -0xe8(%rbp), %rdi
callq 0x4120
leaq -0x90(%rbp), %rdi
callq 0x6f3c
leaq -0x70(%rbp), %rdi
callq 0x6f3c
leaq -0x118(%rbp), %rdi
callq 0x4120
leaq -0x160(%rbp), %rdi
callq 0x4120
leaq -0x140(%rbp), %rdi
callq 0x75ae
pushq $0x1
popq %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xd452(%rip), %rdi      # 0x13fd0
leaq 0x6834(%rip), %rsi      # 0xd3b9
callq 0x4320
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x7542
leaq -0x50(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x7332
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x42f0
leaq 0x67fd(%rip), %rsi      # 0xd3ca
movq %rax, %rdi
callq 0x4320
movq %rax, %rdi
callq 0x4150
leaq -0x50(%rbp), %rdi
callq 0x4120
leaq -0xc8(%rbp), %rdi
callq 0x738a
jmp 0x6d60
pushq $0xa
popq %r13
pushq $0x1
popq %r14
leaq -0x1b0(%rbp), %r15
leaq -0xf0(%rbp), %r12
movl %r13d, %edi
callq 0x4270
leal 0x1(%rbx), %eax
cmpl $0x5a, %ebx
movl %eax, %ebx
jl 0x6c0d
cmpl $0x1, 0xd7fe(%rip)      # 0x14424
jne 0x6c32
movl %r14d, %edi
callq 0x4490
jmp 0x6c1f
movl $0x1, 0xd7e8(%rip)      # 0x14424
xorl %r13d, %r13d
xorl %ebx, %ebx
movl 0xd7b1(%rip), %eax      # 0x143f8
cmpq %rax, %rbx
jae 0x6c99
movq 0xd79d(%rip), %rax      # 0x143f0
movq 0x20(%rax,%r13), %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0x43e0
testl %eax, %eax
jne 0x6c8d
movq -0xf0(%rbp), %rdi
movq 0x18(%rdi), %rax
movl 0x4(%rax), %eax
movq 0xd772(%rip), %rcx      # 0x143f0
movl %eax, 0x4(%rcx,%r13)
movl %eax, 0x14(%rcx,%r13)
callq 0x4420
incq %rbx
addq $0x90, %r13
jmp 0x6c41
andl $0x0, 0xd784(%rip)      # 0x14424
xorl %ebx, %ebx
pushq $0xa
popq %r13
jmp 0x6c0d
movq -0x30(%rbp), %r14
jmp 0x6e2e
jmp 0x6e2b
jmp 0x6e2b
jmp 0x6e2b
jmp 0x6e2b
jmp 0x6e2b
movq %rax, %r14
leaq -0xc8(%rbp), %rdi
jmp 0x6e35
jmp 0x6d8c
movq %rax, %r14
leaq -0x178(%rbp), %rdi
callq 0x7452
jmp 0x6e3a
movq %rax, %r14
leaq -0xc8(%rbp), %rdi
jmp 0x6e62
jmp 0x6d84
movq %rdx, %rbx
movq %rax, %r14
leaq -0x160(%rbp), %rdi
callq 0x4480
leaq -0xc8(%rbp), %rdi
callq 0x4120
jmp 0x6d2c
movq %rdx, %rbx
movq %rax, %r14
cmpl $0x1, %ebx
jne 0x6e67
movq %r14, %rdi
callq 0x40e0
movq 0xd28c(%rip), %rdi      # 0x13fd0
leaq 0x6627(%rip), %rsi      # 0xd372
callq 0x4320
movq %rax, %rdi
callq 0x4150
movq %rax, %rdi
callq 0x4150
pushq $0x1
popq %rdi
callq 0x43b0
movq %rax, %r14
callq 0x4500
jmp 0x6e67
movq %rax, %rdi
callq 0x7323
jmp 0x6dfe
jmp 0x6e16
movq %rax, %r14
jmp 0x6e67
movq %rax, %r14
jmp 0x6e3a
jmp 0x6e2b
jmp 0x6e2b
jmp 0x6dbf
jmp 0x6e2b
jmp 0x6dd0
jmp 0x6dbf
jmp 0x6dd0
jmp 0x6e2b
jmp 0x6dbf
jmp 0x6dd0
jmp 0x6e2b
jmp 0x6dbf
jmp 0x6dd0
jmp 0x6dbf
jmp 0x6e2b
jmp 0x6dd0
jmp 0x6e2b
movq %rax, %r14
leaq -0xc8(%rbp), %rdi
callq 0x4120
jmp 0x6dd3
movq %rax, %r14
leaq -0x50(%rbp), %rdi
jmp 0x6e20
jmp 0x6e2b
movq %rax, %r14
leaq -0x1c8(%rbp), %rdi
jmp 0x6df7
jmp 0x6dfe
jmp 0x6e2b
jmp 0x6e16
movq %rax, %r14
leaq -0x1e0(%rbp), %rdi
callq 0x7452
jmp 0x6e2e
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x4120
jmp 0x6e19
jmp 0x6e2b
jmp 0x6e16
jmp 0x6e2b
jmp 0x6e16
jmp 0x6e2b
movq %rax, %r14
leaq -0xc8(%rbp), %rdi
callq 0x4120
jmp 0x6e2e
jmp 0x6e2b
jmp 0x6e2b
movq %rax, %r14
leaq -0xe8(%rbp), %rdi
callq 0x4120
leaq -0x90(%rbp), %rdi
callq 0x6f3c
leaq -0x70(%rbp), %rdi
callq 0x6f3c
leaq -0x118(%rbp), %rdi
callq 0x4120
leaq -0x160(%rbp), %rdi
callq 0x4120
leaq -0x140(%rbp), %rdi
callq 0x75ae
movq %r14, %rdi
callq 0x4550
nop