// File: /workspace/github_cpp_makefile_star2_O2/rthoelen[P]NXCore_Icom/main.cc
// Function: main
int main(int argc, char *argv[])
{
    int i, j, 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;
	}

	// 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;

	std::cout << version << std::endl;
	std::cout << copyright << std::endl << std::endl;
	
	// Split by space or tab
	boost::split(elems, s, boost::is_any_of("\t "), boost::token_compress_on);


	r_list = elems;

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

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


	/* For Icom we don't need this (at least yet)

	unsigned int tempaddr;

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

	*/

	tx_busy_sem = 0;

	// 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_00.sin_family = AF_INET;
		repeater[i].rpt_addr_00.sin_port = htons(41300);

		std::cout << std::endl << std::endl;
		std::cout << "Repeater " << elems[i] << " address: " << inet_ntoa(repeater[i].rpt_addr_00.sin_addr) << std::endl << std::endl;

		freeaddrinfo(result);
		// 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 = (unsigned int *)calloc(tg_elems.size()+1,sizeof(int));
		std::cout << "Talkgroups " << tg_elems.size() << std::endl; 
		std::cout << "Repeater " << elems[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 = (unsigned 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].tx_hold_time = pt.get<int>(elems[i] + ".tx_hold_time");
		repeater[i].time_since_tx = repeater[i].tx_hold_time;
		repeater[i].stealth = pt.get<int>(elems[i] + ".stealth");
		repeater[i].tx_otaa = pt.get<int>(elems[i] + ".tx_otaa");

		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;
		}	
		
		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;
		}	
		

	}


	// start the thread

	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)
                {
                        for (i = 0; i < 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;
					freeaddrinfo(result);
                                }
                        }
                counter = 0;
                }

	}
	pthread_exit(NULL);
	free(repeater);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %rbx
movl %edi, %r14d
leaq -0xf0(%rbp), %rdi
callq 0x67f0
leaq 0x79de(%rip), %rsi      # 0xd289
leaq -0xc8(%rbp), %rdi
leaq -0x138(%rbp), %rdx
callq 0x6a0c
leaq -0x158(%rbp), %r15
movq %r15, %rdi
callq 0x4560
leaq -0xc8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
movq %r15, %rdx
callq 0x6852
leaq -0x158(%rbp), %rdi
callq 0x4400
leaq -0xc8(%rbp), %rdi
callq 0x4110
cmpl $0x1, %r14d
jle 0x5920
movq 0x8(%rbx), %rax
cmpb $0x2d, (%rax)
jne 0x5920
cmpb $0x64, 0x1(%rax)
jne 0x5920
cmpb $0x0, 0x2(%rax)
jne 0x5920
movl $0x1, 0xea5c(%rip)      # 0x1437c
leaq 0x7984(%rip), %rsi      # 0xd2ab
leaq -0xc8(%rbp), %rdi
pushq $0x2e
popq %rdx
callq 0x6a80
leaq -0x158(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x6a56
leaq -0xc8(%rbp), %rdi
callq 0x4110
leaq -0x128(%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)
movq 0xe642(%rip), %rdi      # 0x13fd0
leaq 0xe93b(%rip), %rsi      # 0x142d0
callq 0x42b0
movq %rax, %rdi
callq 0x4130
movq 0xe627(%rip), %rdi      # 0x13fd0
leaq 0xe950(%rip), %rsi      # 0x14300
callq 0x42b0
movq %rax, %rdi
callq 0x4130
movq %rax, %rdi
callq 0x4130
leaq 0x78e9(%rip), %rsi      # 0xd2b5
leaq -0x170(%rbp), %rdi
callq 0x6b44
leaq -0x70(%rbp), %rdi
leaq -0x158(%rbp), %rsi
leaq -0x170(%rbp), %rdx
xorl %ecx, %ecx
callq 0x6ab8
leaq -0x170(%rbp), %rdi
callq 0x6b76
leaq 0xe95c(%rip), %rdi      # 0x14360
leaq -0x70(%rbp), %rsi
callq 0x6b92
movq -0x68(%rbp), %rax
subq -0x70(%rbp), %rax
shrq $0x5, %rax
movl %eax, 0xe959(%rip)      # 0x14378
movq 0xe5aa(%rip), %rdi      # 0x13fd0
leaq 0x788b(%rip), %rsi      # 0xd2b8
callq 0x42b0
movl 0xe940(%rip), %esi      # 0x14378
movq %rax, %rdi
callq 0x44b0
movq %rax, %rdi
callq 0x4130
movq %rax, %rdi
callq 0x4130
movslq 0xe921(%rip), %rdi      # 0x14378
pushq $0x70
popq %rsi
callq 0x41b0
andl $0x0, 0xe91e(%rip)      # 0x14384
leaq -0x100(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movq %rax, 0xe8db(%rip)      # 0x14358
movb $0x0, (%rcx)
xorl %r12d, %r12d
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r12, %rax
jbe 0x63a2
movq %r12, %rax
shlq $0x5, %rax
movq %rax, -0x30(%rbp)
addq %rax, %rsi
leaq -0x110(%rbp), %rdi
callq 0x4160
leaq -0x110(%rbp), %rdi
leaq 0x7807(%rip), %rsi      # 0xd2ca
callq 0x4520
xorps %xmm0, %xmm0
movaps %xmm0, -0x1a0(%rbp)
movaps %xmm0, -0x180(%rbp)
movaps %xmm0, -0x190(%rbp)
movl $0x2, -0x19c(%rbp)
leaq -0xc8(%rbp), %r13
movq %r13, %rdi
leaq -0x110(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
leaq -0xf0(%rbp), %rsi
movq %r13, %rdx
callq 0x6a56
movl -0x48(%rbp), %r14d
movq %rbx, %rdi
callq 0x4110
movq %r13, %rdi
callq 0x4110
incl %r14d
movslq %r14d, %r15
pushq $0x1
popq %rdi
movq %r15, %rsi
callq 0x41b0
movq 0xe813(%rip), %rcx      # 0x14358
movq %r12, -0x118(%rbp)
imulq $0x70, %r12, %r14
movq %rax, 0x10(%rcx,%r14)
movq 0xe7fc(%rip), %rax      # 0x14358
movq 0x10(%rax,%r14), %r12
movq %r13, %rdi
leaq -0x110(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
movq %rbx, %rdi
leaq -0xf0(%rbp), %rsi
movq %r13, %rdx
callq 0x6a56
movq -0x50(%rbp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x4250
movq %rbx, %rdi
callq 0x4110
movq %r13, %rdi
callq 0x4110
movq 0xe7ad(%rip), %rax      # 0x14358
movq 0x10(%rax,%r14), %rdi
xorl %esi, %esi
leaq -0x1a0(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x4370
cmpl $-0x1, %eax
je 0x6452
movq -0x98(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %eax
movq 0xe775(%rip), %rcx      # 0x14358
movl %eax, 0x4(%rcx,%r14)
movl $0x54a10002, (%rcx,%r14) # imm = 0x54A10002
movq 0xe3d9(%rip), %rdi      # 0x13fd0
callq 0x4130
movq %rax, %rdi
callq 0x4130
movq 0xe3c5(%rip), %rdi      # 0x13fd0
leaq 0x76dc(%rip), %rsi      # 0xd2ee
callq 0x42b0
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %rax, %rdi
callq 0x4290
movq %rax, %rdi
leaq 0x76c7(%rip), %rsi      # 0xd2f8
callq 0x42b0
movq %rax, %r15
movq 0xe718(%rip), %rax      # 0x14358
movl 0x4(%rax,%r14), %edi
callq 0x4100
movq %r15, %rdi
movq %rax, %rsi
callq 0x42b0
movq %rax, %rdi
callq 0x4130
movq %rax, %rdi
callq 0x4130
movq -0x98(%rbp), %rdi
callq 0x43b0
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
leaq -0x110(%rbp), %rdi
callq 0x4160
leaq -0x110(%rbp), %rdi
leaq 0x7670(%rip), %rsi      # 0xd303
callq 0x4520
leaq -0xc8(%rbp), %r15
movq %r15, %rdi
leaq -0x110(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
movq %rbx, %rdi
leaq -0xf0(%rbp), %rsi
movq %r15, %rdx
callq 0x6a56
movq -0x50(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0x4530
movq %rbx, %rdi
callq 0x4110
movq %r15, %rdi
callq 0x4110
leaq -0x1d0(%rbp), %rdi
leaq 0x75c4(%rip), %rsi      # 0xd2b5
callq 0x6b44
leaq -0x90(%rbp), %rdi
leaq -0x138(%rbp), %rsi
leaq -0x1d0(%rbp), %rbx
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x6ab8
movq %rbx, %rdi
callq 0x6b76
movq -0x88(%rbp), %rdi
subq -0x90(%rbp), %rdi
sarq $0x5, %rdi
incq %rdi
pushq $0x4
popq %rsi
callq 0x41b0
movq 0xe617(%rip), %rcx      # 0x14358
movq %rax, 0x40(%rcx,%r14)
movq 0xe283(%rip), %rdi      # 0x13fd0
leaq 0x75de(%rip), %rsi      # 0xd332
callq 0x42b0
movq -0x88(%rbp), %rsi
subq -0x90(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x41c0
movq %rax, %rdi
callq 0x4130
movq 0xe24e(%rip), %rdi      # 0x13fd0
leaq 0x7565(%rip), %rsi      # 0xd2ee
callq 0x42b0
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %rax, %rdi
callq 0x4290
movq %rax, %rdi
leaq 0x7564(%rip), %rsi      # 0xd30c
callq 0x42b0
xorl %r15d, %r15d
xorl %r12d, %r12d
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r12, %rcx
jbe 0x5e1a
movq (%rax,%r15,8), %rdi
callq 0x4440
movq 0xe57b(%rip), %rcx      # 0x14358
movq 0x40(%rcx,%r14), %rcx
movl %eax, (%rcx,%r15)
movq 0xe1e3(%rip), %rdi      # 0x13fd0
leaq 0x74c2(%rip), %rsi      # 0xd2b6
callq 0x42b0
movq 0xe558(%rip), %rcx      # 0x14358
movq 0x40(%rcx,%r14), %rcx
movl (%rcx,%r15), %esi
movq %rax, %rdi
callq 0x41c0
incq %r12
addq $0x4, %r15
jmp 0x5db3
movq 0xe1af(%rip), %rdi      # 0x13fd0
callq 0x4130
movq -0x118(%rbp), %r15
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
leaq -0x110(%rbp), %rdi
callq 0x4160
leaq -0x110(%rbp), %rdi
leaq 0x74cc(%rip), %rsi      # 0xd31b
callq 0x4520
leaq -0xc8(%rbp), %r12
movq %r12, %rdi
leaq -0x110(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0x50(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
movq %r12, %rdx
callq 0x6a56
movq -0x50(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0x4530
leaq -0x50(%rbp), %rdi
callq 0x4110
movq %r12, %rdi
callq 0x4110
leaq -0x1b8(%rbp), %rdi
leaq 0x7476(%rip), %rsi      # 0xd325
callq 0x6c87
leaq -0x90(%rbp), %rdi
leaq -0x138(%rbp), %rsi
leaq -0x1b8(%rbp), %rbx
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x6ab8
movq %rbx, %rdi
callq 0x6b76
movq -0x88(%rbp), %rdi
subq -0x90(%rbp), %rdi
sarq $0x5, %rdi
incq %rdi
pushq $0x4
popq %rsi
callq 0x41b0
movq 0xe459(%rip), %rcx      # 0x14358
movq %rax, 0x48(%rcx,%r14)
movq 0xe0c5(%rip), %rdi      # 0x13fd0
leaq 0x7417(%rip), %rsi      # 0xd329
callq 0x42b0
movq -0x88(%rbp), %rsi
subq -0x90(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x41c0
movq %rax, %rdi
callq 0x4130
movq 0xe090(%rip), %rdi      # 0x13fd0
leaq 0x73a7(%rip), %rsi      # 0xd2ee
callq 0x42b0
movq %rax, %rdi
movl %r15d, %esi
callq 0x44b0
movq %rax, %rdi
leaq 0x73dd(%rip), %rsi      # 0xd33e
callq 0x42b0
xorl %r15d, %r15d
xorl %r12d, %r12d
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r12, %rcx
jbe 0x5fd3
movq (%rax,%r15,8), %rdi
callq 0x4440
movq 0xe3c2(%rip), %rcx      # 0x14358
movq 0x48(%rcx,%r14), %rcx
movl %eax, (%rcx,%r15)
movq 0xe02a(%rip), %rdi      # 0x13fd0
leaq 0x7309(%rip), %rsi      # 0xd2b6
callq 0x42b0
movq 0xe39f(%rip), %rcx      # 0x14358
movq 0x48(%rcx,%r14), %rcx
movl (%rcx,%r15), %esi
movq %rax, %rdi
callq 0x41c0
incq %r12
addq $0x4, %r15
jmp 0x5f6c
movq 0xdff6(%rip), %rdi      # 0x13fd0
callq 0x4130
movq -0x118(%rbp), %r12
movq %rax, %rdi
callq 0x4130
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
leaq 0x7356(%rip), %rdx      # 0xd35a
callq 0x6cca
leaq -0xc8(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0xf0(%rbp), %rdi
movq %r15, %rsi
callq 0x6cb8
movq 0xe324(%rip), %rcx      # 0x14358
movb %al, 0x34(%rcx,%r14)
movq %r15, %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4110
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %rbx, %rdi
leaq 0x7307(%rip), %rdx      # 0xd362
callq 0x6cca
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0xf0(%rbp), %rdi
movq %r15, %rsi
callq 0x6cb8
movq 0xe2d4(%rip), %rcx      # 0x14358
movb %al, 0x35(%rcx,%r14)
movq %r15, %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4110
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %rbx, %rdi
leaq 0x72bf(%rip), %rdx      # 0xd36a
callq 0x6cca
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0xf0(%rbp), %rdi
movq %r15, %rsi
callq 0x6cb8
movq 0xe284(%rip), %rcx      # 0x14358
movl %eax, 0x20(%rcx,%r14)
movq %r15, %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4110
movq 0xe268(%rip), %rax      # 0x14358
movl 0x20(%rax,%r14), %ecx
movl %ecx, 0x18(%rax,%r14)
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %rbx, %rdi
leaq 0x726c(%rip), %rdx      # 0xd378
callq 0x6cca
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0xf0(%rbp), %rdi
movq %r15, %rsi
callq 0x6cb8
movq 0xe223(%rip), %rcx      # 0x14358
movl %eax, 0x24(%rcx,%r14)
movq %r15, %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4110
movq 0xe207(%rip), %rax      # 0x14358
movl 0x24(%rax,%r14), %ecx
movl %ecx, 0x1c(%rax,%r14)
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %rbx, %rdi
leaq 0x7219(%rip), %rdx      # 0xd386
callq 0x6cca
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0xf0(%rbp), %rdi
movq %r15, %rsi
callq 0x6cb8
movq 0xe1c2(%rip), %rcx      # 0x14358
movl %eax, 0x58(%rcx,%r14)
movq %r15, %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4110
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %rbx, %rdi
leaq 0x71d2(%rip), %rdx      # 0xd38f
callq 0x6cca
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0xf0(%rbp), %rdi
movq %r15, %rsi
callq 0x6cb8
movq 0xe172(%rip), %rcx      # 0x14358
movl %eax, 0x5c(%rcx,%r14)
movq %r15, %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4110
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %rbx, %rdi
leaq 0x718b(%rip), %rdx      # 0xd398
callq 0x6cca
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0xf0(%rbp), %rdi
movq %r15, %rsi
callq 0x6cb8
movq 0xe122(%rip), %rcx      # 0x14358
movl %eax, 0x6c(%rcx,%r14)
movq %r15, %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4110
movq -0x70(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq %rbx, %rdi
leaq 0x7145(%rip), %rdx      # 0xd3a2
callq 0x6cca
leaq -0xc8(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0xf0(%rbp), %rdi
movq %r15, %rsi
callq 0x6cb8
movq 0xe0cb(%rip), %rcx      # 0x14358
movl %eax, 0x68(%rcx,%r14)
movq %r15, %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4110
movq -0x30(%rbp), %rsi
addq -0x70(%rbp), %rsi
movq %rbx, %rdi
leaq 0x70fe(%rip), %rdx      # 0xd3b2
callq 0x6cca
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0xf0(%rbp), %rdi
movq %r15, %rsi
callq 0x6cb8
movq 0xe07b(%rip), %rcx      # 0x14358
movl %eax, 0x64(%rcx,%r14)
movq %r15, %rdi
callq 0x4110
leaq -0x50(%rbp), %rdi
callq 0x4110
incq %r12
jmp 0x5a83
jmp 0x6301
jmp 0x6321
jmp 0x6343
movq %rdx, %r13
movq %rax, %rbx
movq %r15, %rdi
callq 0x4110
jmp 0x6327
movq %rdx, %r13
movq %rax, %rbx
movq %r15, %rdi
callq 0x4110
jmp 0x6338
movq %rdx, %r13
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x4110
jmp 0x6349
movq %rdx, %r13
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x4110
jmp 0x6375
movq %rdx, %r13
movq %rax, %rbx
cmpl $0x1, %r13d
jne 0x66b7
movq %rbx, %rdi
callq 0x40d0
movq 0xdff6(%rip), %rax      # 0x14358
andq $0x0, 0x64(%rax,%r14)
callq 0x4480
jmp 0x62f3
movq %rdx, %r13
movq %rax, %rbx
cmpl $0x1, %r13d
jne 0x66b7
movq %rbx, %rdi
callq 0x40d0
movq 0xdfca(%rip), %rax      # 0x14358
andl $0x0, 0x6c(%rax,%r14)
callq 0x4480
leaq -0x50(%rbp), %rbx
jmp 0x624b
leaq -0x1c71(%rip), %rdx     # 0x4738
leaq -0xc8(%rbp), %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x44f0
testl %eax, %eax
jne 0x63dc
leaq -0xc67(%rip), %rdx      # 0x575d
xorl %r12d, %r12d
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x44f0
testl %eax, %eax
je 0x64d2
movq 0xdbf5(%rip), %rax      # 0x13fd8
movq (%rax), %rcx
leaq 0x6fd4(%rip), %rdi      # 0xd3c1
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x4540
leaq -0x110(%rbp), %rdi
callq 0x4110
leaq -0x90(%rbp), %rdi
callq 0x67c4
leaq -0x70(%rbp), %rdi
callq 0x67c4
leaq -0x138(%rbp), %rdi
callq 0x4110
leaq -0x158(%rbp), %rdi
callq 0x4110
leaq -0xf0(%rbp), %rdi
callq 0x6d02
pushq $0x1
popq %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xdb77(%rip), %rdi      # 0x13fd0
leaq 0x6e73(%rip), %rsi      # 0xd2d3
callq 0x42b0
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x6c66
leaq -0x50(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x6a56
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x4290
leaq 0x6e3c(%rip), %rsi      # 0xd2e4
movq %rax, %rdi
callq 0x42b0
movq %rax, %rdi
callq 0x4130
leaq -0x50(%rbp), %rdi
callq 0x4110
leaq -0xc8(%rbp), %rdi
callq 0x6aae
jmp 0x65e9
pushq $0xa
popq %rbx
leaq -0x1a0(%rbp), %r14
leaq -0x98(%rbp), %r15
movl %ebx, %edi
callq 0x4220
leal 0x1(%r12), %eax
cmpl $0x5a, %r12d
movl %eax, %r12d
jl 0x64e3
xorl %r12d, %r12d
xorl %r13d, %r13d
movslq 0xde73(%rip), %rax      # 0x14378
cmpq %rax, %r13
jge 0x654f
movq 0xde47(%rip), %rax      # 0x14358
movq 0x10(%rax,%r12), %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0x4370
testl %eax, %eax
jne 0x6546
movq -0x98(%rbp), %rdi
movq 0x18(%rdi), %rax
movl 0x4(%rax), %eax
movq 0xde1c(%rip), %rcx      # 0x14358
movl %eax, 0x4(%rcx,%r12)
callq 0x43b0
incq %r13
addq $0x70, %r12
jmp 0x64fe
xorl %r12d, %r12d
jmp 0x64e3
jmp 0x66b4
jmp 0x66b4
jmp 0x66b4
jmp 0x66b4
movq %rax, %rbx
leaq -0x170(%rbp), %rdi
callq 0x6b76
jmp 0x66c3
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
jmp 0x66eb
movq %rax, %rbx
jmp 0x66f0
movq %rdx, %rbx
movq %rax, %r14
leaq -0x158(%rbp), %rdi
callq 0x4400
leaq -0xc8(%rbp), %rdi
callq 0x4110
jmp 0x65b9
movq %rdx, %rbx
movq %rax, %r14
cmpl $0x1, %ebx
jne 0x65f1
movq %r14, %rdi
callq 0x40d0
movq 0xda03(%rip), %rdi      # 0x13fd0
leaq 0x6cc0(%rip), %rsi      # 0xd294
callq 0x42b0
movq %rax, %rdi
callq 0x4130
movq %rax, %rdi
callq 0x4130
pushq $0x1
popq %rdi
callq 0x4340
movq %r14, %rbx
jmp 0x66f0
movq %rax, %rbx
callq 0x4480
jmp 0x66f0
movq %rax, %rdi
callq 0x6a47
jmp 0x6687
jmp 0x669f
jmp 0x66b4
movq %rax, %rbx
jmp 0x66c3
jmp 0x66b4
jmp 0x6648
jmp 0x66b4
jmp 0x6659
jmp 0x6648
jmp 0x6659
jmp 0x66b4
jmp 0x6648
jmp 0x6659
jmp 0x66b4
jmp 0x6648
jmp 0x6659
jmp 0x6648
jmp 0x66b4
jmp 0x6659
jmp 0x66b4
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x4110
jmp 0x665c
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
jmp 0x66a9
jmp 0x66b4
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
jmp 0x6680
jmp 0x6687
jmp 0x66b4
jmp 0x669f
movq %rax, %rbx
leaq -0x1d0(%rbp), %rdi
callq 0x6b76
jmp 0x66b7
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x4110
jmp 0x66a2
jmp 0x66b4
jmp 0x669f
jmp 0x66b4
jmp 0x669f
jmp 0x66b4
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x4110
jmp 0x66b7
jmp 0x66b4
jmp 0x66b4
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
callq 0x4110
leaq -0x90(%rbp), %rdi
callq 0x67c4
leaq -0x70(%rbp), %rdi
callq 0x67c4
leaq -0x138(%rbp), %rdi
callq 0x4110
leaq -0x158(%rbp), %rdi
callq 0x4110
leaq -0xf0(%rbp), %rdi
callq 0x6d02
movq %rbx, %rdi
callq 0x44c0