// File: /workspace/github_cpp_makefile_star2_O1/WeiqiangZhou[P]BIRD/source/create_library_main.cpp
// Function: main
int main(int argc, char *argv[])
{
	char infile[255]="./par_file.txt";
	char outfile[255]="./model_file.bin";
	
    if (argc == 5 && strcmp(argv[1], "-i") == 0 && strcmp(argv[3], "-o") == 0)
	{
		strcpy(infile, argv[2]);
		strcpy(outfile, argv[4]);
	}
    else if (argc == 2 && strcmp(argv[1], "-h") == 0)
    {
                std::cout << "Usage: BIRD_build_library -i par_file.txt -o model_file.bin" << std::endl;
                std::cout << "-i Specify input file which contains the required parameters and files list." << std::endl;
                std::cout << "-o Specify output name of the model file to be used by BIRD." << std::endl;
                return 1;
    }
	else
	{
		std::cout << "Please input the correct parameters." << std::endl;
		std::cout << "Example: BIRD_build_library -i par_file.txt -o model_file.bin" << std::endl;
		return 1;
	}

	FILE * p_out;
	int param[8];
	int num_loci, num_gene, cluster_size, bin_size, num_var, DH_num1, DH_num2, DH_num3;
	char **filelist = new char *[18];
	for (int i = 0; i < 18; i++)
	{
		filelist[i] = new char[255];
	}

	if (ReadParam(infile, param, filelist)){ return 1; }

	num_loci = param[0];
	num_gene = param[1];
	cluster_size = param[2];
	bin_size = param[3];
	num_var = param[4];
	DH_num1 = param[5];
	DH_num2 = param[6];
	DH_num3 = param[7];

	double *uw_quantile = new double[num_gene];
	double *exon_mean = new double[num_gene];
	double *exon_sd = new double[num_gene];
	double *DNase_mean = new double[num_loci];
	double *DNase_sd = new double[num_loci];
	int *cluster_idx = new int[num_gene];

	double **coef = new double *[num_var];
	for (int j = 0; j < num_var; j++)
	{
		coef[j] = new double[num_loci]();
	}

	double **dis_matrix = new double *[3];
	for (int j = 0; j < 3; j++)
	{
		dis_matrix[j] = new double[num_loci]();
	}

	double **DH_coef1 = new double *[num_var];
	for (int j = 0; j < num_var; j++)
	{
		DH_coef1[j] = new double[DH_num1]();
	}

	double **DH_coef2 = new double *[num_var];
	for (int j = 0; j < num_var; j++)
	{
		DH_coef2[j] = new double[DH_num2]();
	}

	double **DH_coef3 = new double *[num_var];
	for (int j = 0; j < num_var; j++)
	{
		DH_coef3[j] = new double[DH_num3]();
	}

	int **pre_idx = new int *[num_var];
	for (int j = 0; j < num_var; j++)
	{
		pre_idx[j] = new int[num_loci]();
	}

	int **DH_pre_idx1 = new int *[num_var];
	for (int j = 0; j < num_var; j++)
	{
		DH_pre_idx1[j] = new int[DH_num1]();
	}

	int **DH_pre_idx2 = new int *[num_var];
	for (int j = 0; j < num_var; j++)
	{
		DH_pre_idx2[j] = new int[DH_num2]();
	}

	int **DH_pre_idx3 = new int *[num_var];
	for (int j = 0; j < num_var; j++)
	{
		DH_pre_idx3[j] = new int[DH_num3]();
	}

	int **DH_cluster = new int *[3];
	for (int j = 0; j < 3; j++)
	{
		DH_cluster[j] = new int[num_loci]();
	}

	char **select_loci = new char *[num_loci];
	for (int j = 0; j < num_loci; j++)
	{
		select_loci[j] = new char[30];
	}

	char **row_name = new char *[num_gene];
	for (int j = 0; j < num_gene; j++)
	{
		row_name[j] = new char[30];
	}

        //read in all required files
	if (ReadVector_d(filelist[0], uw_quantile)){ return 1; }
	if (ReadVector_d(filelist[1], exon_mean)){ return 1; }
	if (ReadVector_d(filelist[2], exon_sd)){ return 1; }
	if (ReadVector_i(filelist[3], cluster_idx)){ return 1; }
	if (ReadVector_d(filelist[4], DNase_mean)){ return 1; }
	if (ReadVector_d(filelist[5], DNase_sd)){ return 1; }
	if (ReadMatrix_d(filelist[6], coef)){ return 1; }
	if (ReadMatrix_i(filelist[7], pre_idx)){ return 1; }
	if (ReadName(filelist[8], select_loci)){ return 1; }
	if (ReadName(filelist[9], row_name)){ return 1; }
	if (ReadMatrix_d(filelist[10], dis_matrix)){ return 1; }
	if (ReadMatrix_i(filelist[11], DH_cluster)){ return 1; }
	if (ReadMatrix_d(filelist[12], DH_coef1)){ return 1; }
	if (ReadMatrix_d(filelist[13], DH_coef2)){ return 1; }
	if (ReadMatrix_d(filelist[14], DH_coef3)){ return 1; }
	if (ReadMatrix_i(filelist[15], DH_pre_idx1)){ return 1; }
	if (ReadMatrix_i(filelist[16], DH_pre_idx2)){ return 1; }
	if (ReadMatrix_i(filelist[17], DH_pre_idx3)){ return 1; }

        //combine all information into one binary file
	p_out = fopen(outfile, "wb");
	if (p_out != NULL)
	{
		std::cout << "Writing " << outfile << "..." << std::endl;
		fwrite(param, sizeof(int), 8, p_out);
		fwrite(uw_quantile, sizeof(double), num_gene, p_out);
		fwrite(exon_mean, sizeof(double), num_gene, p_out);
		fwrite(exon_sd, sizeof(double), num_gene, p_out);
		for (int k = 0; k < num_var; k++)
		{
			fwrite(coef[k], sizeof(double), num_loci, p_out);
		}
		fwrite(DNase_mean, sizeof(double), num_loci, p_out);
		fwrite(DNase_sd, sizeof(double), num_loci, p_out);
		for (int k = 0; k < num_var; k++)
		{
			fwrite(pre_idx[k], sizeof(int), num_loci, p_out);
		}
		fwrite(cluster_idx, sizeof(int), num_gene, p_out);
		for (int k = 0; k < num_loci; k++)
		{
			fwrite(select_loci[k], sizeof(char), 30, p_out);
		}
		for (int k = 0; k < num_gene; k++)
		{
			fwrite(row_name[k], sizeof(char), 30, p_out);
		}
		for (int k = 0; k < 3; k++)
		{
			fwrite(dis_matrix[k], sizeof(double), num_loci, p_out);
		}
		for (int k = 0; k < 3; k++)
		{
			fwrite(DH_cluster[k], sizeof(int), num_loci, p_out);
		}
		for (int k = 0; k < num_var; k++)
		{
			fwrite(DH_coef1[k], sizeof(double), DH_num1, p_out);
		}
		for (int k = 0; k < num_var; k++)
		{
			fwrite(DH_coef2[k], sizeof(double), DH_num2, p_out);
		}
		for (int k = 0; k < num_var; k++)
		{
			fwrite(DH_coef3[k], sizeof(double), DH_num3, p_out);
		}
		for (int k = 0; k < num_var; k++)
		{
			fwrite(DH_pre_idx1[k], sizeof(int), DH_num1, p_out);
		}
		for (int k = 0; k < num_var; k++)
		{
			fwrite(DH_pre_idx2[k], sizeof(int), DH_num2, p_out);
		}
		for (int k = 0; k < num_var; k++)
		{
			fwrite(DH_pre_idx3[k], sizeof(int), DH_num3, p_out);
		}
		fclose(p_out);
		std::cout << "Successfully generated library file." << std::endl;
	}
	else
	{
		std::cout << "Error! Cannot write " << outfile << std::endl;
		return 1;
	}

	

	//Release memory
	delete[] uw_quantile;
	delete[] exon_mean;
	delete[] exon_sd;
	delete[] DNase_mean;
	delete[] DNase_sd;
	delete[] cluster_idx;
	for (int j = 0; j < 3; j++)
	{
		delete[] dis_matrix[j];
		delete[] DH_cluster[j];
	}
	for (int j = 0; j < num_var; j++)
	{
		delete[] coef[j];
		delete[] pre_idx[j];
		delete[] DH_coef1[j];
		delete[] DH_coef2[j];
		delete[] DH_coef3[j];
		delete[] DH_pre_idx1[j];
		delete[] DH_pre_idx2[j];
		delete[] DH_pre_idx3[j];
	}
	delete[] coef;
	delete[] pre_idx;
	delete[] DH_coef1;
	delete[] DH_coef2;
	delete[] DH_coef3;
	delete[] DH_pre_idx1;
	delete[] DH_pre_idx2;
	delete[] DH_pre_idx3;
	delete[] dis_matrix;
	delete[] DH_cluster;

	return 0;


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2e8, %rsp            # imm = 0x2E8
movq %rsi, %rbx
movl %edi, %r14d
leaq 0x2c33(%rip), %rsi      # 0x5010
leaq -0x310(%rbp), %rdi
movl $0xff, %edx
callq 0x20f0
leaq 0x2d1b(%rip), %rsi      # 0x5110
leaq -0x210(%rbp), %rdi
movl $0xff, %edx
callq 0x20f0
cmpl $0x2, %r14d
je 0x2444
cmpl $0x5, %r14d
jne 0x245c
movq 0x8(%rbx), %rdi
leaq 0x2df2(%rip), %rsi      # 0x520f
callq 0x2190
testl %eax, %eax
jne 0x243e
movq 0x18(%rbx), %rdi
leaq 0x2de1(%rip), %rsi      # 0x5212
callq 0x2190
testl %eax, %eax
je 0x2580
cmpl $0x2, %r14d
jne 0x245c
movq 0x8(%rbx), %rdi
leaq 0x2dc6(%rip), %rsi      # 0x5215
callq 0x2190
testl %eax, %eax
je 0x24f2
movq 0x4b75(%rip), %rbx      # 0x6fd8
leaq 0x2e74(%rip), %rsi      # 0x52de
movl $0x24, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20d0
leaq 0x2e5e(%rip), %rsi      # 0x5303
movl $0x3d, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20d0
movl $0x1, %ecx
movl %ecx, %eax
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4adf(%rip), %rbx      # 0x6fd8
leaq 0x2d18(%rip), %rsi      # 0x5218
movl $0x3b, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20d0
leaq 0x2d19(%rip), %rsi      # 0x5254
movl $0x4c, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20d0
leaq 0x2d2b(%rip), %rsi      # 0x52a1
movl $0x3c, %edx
jmp 0x24aa
movq 0x10(%rbx), %rsi
leaq -0x310(%rbp), %rdi
callq 0x2110
movq 0x20(%rbx), %rsi
leaq -0x210(%rbp), %rdi
callq 0x2110
movl $0x90, %edi
callq 0x2030
movq %rax, %r14
xorl %ebx, %ebx
movl $0xff, %edi
callq 0x2030
movq %rax, (%r14,%rbx,8)
incq %rbx
cmpq $0x12, %rbx
jne 0x25af
leaq -0x310(%rbp), %rdi
leaq -0x100(%rbp), %rsi
movq %r14, %rdx
callq 0x3160
movl $0x1, %ecx
testl %eax, %eax
jne 0x24de
movq %r14, -0x38(%rbp)
movslq -0x100(%rbp), %r14
movslq -0xfc(%rbp), %rcx
movslq -0xf0(%rbp), %rbx
movslq -0xec(%rbp), %rax
movq %rax, -0xa0(%rbp)
movslq -0xe8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movslq -0xe4(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq (,%rcx,8), %r15
testq %rcx, %rcx
movq $-0x1, %r13
cmovsq %r13, %r15
movq %rcx, -0x50(%rbp)
leaq (,%rcx,4), %r12
cmovsq %r13, %r12
movq %r15, %rdi
callq 0x2030
movq %rax, -0xe0(%rbp)
movq %r15, %rdi
callq 0x2030
movq %rax, -0xd8(%rbp)
movq %r15, -0x110(%rbp)
movq %r15, %rdi
callq 0x2030
movq %rax, -0xd0(%rbp)
leaq (,%r14,8), %r15
movq %r14, -0x48(%rbp)
testq %r14, %r14
cmovsq %r13, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, -0xc0(%rbp)
movq %r15, %rdi
callq 0x2030
movq %rax, -0xb8(%rbp)
movq %r12, %rdi
callq 0x2030
movq %rax, -0xc8(%rbp)
leaq (,%rbx,8), %rdi
testq %rbx, %rbx
cmovsq %r13, %rdi
movq %rdi, -0x40(%rbp)
callq 0x2030
movq %rax, %r14
testq %rbx, %rbx
jle 0x270d
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x2030
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20c0
movq %r13, (%r14,%r12,8)
incq %r12
cmpq %r12, %rbx
jne 0x26e9
movq %r14, -0x98(%rbp)
movl $0x18, %edi
callq 0x2030
movq %rax, %r14
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x2030
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20c0
movq %r13, (%r14,%r12,8)
incq %r12
cmpq $0x3, %r12
jne 0x2724
movq %r15, -0x108(%rbp)
movq %r14, -0x88(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2030
movq %rax, %r15
testl %ebx, %ebx
jle 0x27aa
movq -0xa0(%rbp), %rcx
leaq (,%rcx,8), %rax
testl %ecx, %ecx
movq $-0x1, %r13
cmovnsq %rax, %r13
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x2030
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20c0
movq %r12, (%r15,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x2786
movq %r15, -0x80(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2030
movq %rax, %r15
testl %ebx, %ebx
jle 0x2801
movq -0xa8(%rbp), %rcx
leaq (,%rcx,8), %rax
testl %ecx, %ecx
movq $-0x1, %r13
cmovnsq %rax, %r13
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x2030
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20c0
movq %r12, (%r15,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x27dd
movq %r15, -0x78(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2030
movq %rax, %r15
testl %ebx, %ebx
jle 0x2858
movq -0xb0(%rbp), %rcx
leaq (,%rcx,8), %rax
testl %ecx, %ecx
movq $-0x1, %r13
cmovnsq %rax, %r13
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x2030
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20c0
movq %r12, (%r15,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x2834
movq %r15, -0x70(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2030
movq %rax, %r15
testl %ebx, %ebx
jle 0x28ac
movq -0x48(%rbp), %rcx
leaq (,%rcx,4), %rax
testl %ecx, %ecx
movq $-0x1, %r13
cmovnsq %rax, %r13
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x2030
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20c0
movq %r12, (%r15,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x2888
movq %r15, -0x90(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2030
movq %rax, %r15
testl %ebx, %ebx
jle 0x2906
movq -0xa0(%rbp), %rcx
leaq (,%rcx,4), %rax
testl %ecx, %ecx
movq $-0x1, %r13
cmovnsq %rax, %r13
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x2030
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20c0
movq %r12, (%r15,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x28e2
movq %r15, -0x68(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2030
movq %rax, %r15
testl %ebx, %ebx
jle 0x295d
movq -0xa8(%rbp), %rcx
leaq (,%rcx,4), %rax
testl %ecx, %ecx
movq $-0x1, %r13
cmovnsq %rax, %r13
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x2030
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20c0
movq %r12, (%r15,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x2939
movq %r15, -0x60(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2030
movq %rax, %r15
testl %ebx, %ebx
jle 0x29b4
movq -0xb0(%rbp), %rcx
leaq (,%rcx,4), %rax
testl %ecx, %ecx
movq $-0x1, %r12
cmovnsq %rax, %r12
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x2030
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x20c0
movq %r13, (%r15,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x2990
movq %r15, -0x58(%rbp)
movq %rbx, -0x30(%rbp)
movl $0x18, %edi
callq 0x2030
movq %rax, %rbx
movq -0x48(%rbp), %rcx
leaq (,%rcx,4), %rax
testl %ecx, %ecx
movq $-0x1, %r13
cmovnsq %rax, %r13
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x2030
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20c0
movq %r12, (%rbx,%r14,8)
incq %r14
cmpq $0x3, %r14
jne 0x29e5
movq %rbx, -0x40(%rbp)
movq -0x108(%rbp), %rdi
callq 0x2030
movq %rax, %r15
movq -0x48(%rbp), %r12
testl %r12d, %r12d
movq -0xe0(%rbp), %rbx
jle 0x2a46
xorl %r14d, %r14d
movl $0x1e, %edi
callq 0x2030
movq %rax, (%r15,%r14,8)
incq %r14
cmpq %r14, %r12
jne 0x2a30
movq -0x110(%rbp), %rdi
callq 0x2030
movq %rax, %r13
movq -0x50(%rbp), %r12
testl %r12d, %r12d
jle 0x2a78
xorl %r14d, %r14d
movl $0x1e, %edi
callq 0x2030
movq %rax, (%r13,%r14,8)
incq %r14
cmpq %r14, %r12
jne 0x2a61
movq -0x38(%rbp), %r14
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x3bbc
testl %eax, %eax
jne 0x24d9
movq 0x8(%r14), %rdi
movq -0xd8(%rbp), %rsi
callq 0x3bbc
testl %eax, %eax
jne 0x24d9
movq 0x10(%r14), %rdi
movq -0xd0(%rbp), %rsi
callq 0x3bbc
testl %eax, %eax
jne 0x24d9
movq 0x18(%r14), %rdi
movq -0xc8(%rbp), %rsi
callq 0x3d6c
testl %eax, %eax
jne 0x24d9
movq 0x20(%r14), %rdi
movq -0xc0(%rbp), %rsi
callq 0x3bbc
testl %eax, %eax
jne 0x24d9
movq 0x28(%r14), %rdi
movq -0xb8(%rbp), %rsi
callq 0x3bbc
testl %eax, %eax
jne 0x24d9
movq 0x30(%r14), %rdi
movq -0x98(%rbp), %rsi
callq 0x3f18
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x90(%rbp), %rsi
callq 0x426c
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rdi
movq %r15, %rsi
callq 0x45be
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
callq 0x45be
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x88(%rbp), %rsi
callq 0x3f18
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0x426c
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x80(%rbp), %rsi
callq 0x3f18
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x78(%rbp), %rsi
callq 0x3f18
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x70(%rax), %rdi
movq -0x70(%rbp), %rsi
callq 0x3f18
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x78(%rax), %rdi
movq -0x68(%rbp), %rsi
callq 0x426c
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x60(%rbp), %rsi
callq 0x426c
testl %eax, %eax
jne 0x24d9
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rdi
movq -0x58(%rbp), %rsi
callq 0x426c
testl %eax, %eax
jne 0x24d9
leaq 0x26fe(%rip), %rsi      # 0x5341
leaq -0x210(%rbp), %rdi
callq 0x2160
testq %rax, %rax
je 0x311b
movq %rax, %r12
movq 0x4376(%rip), %r14      # 0x6fd8
leaq 0x26db(%rip), %rsi      # 0x5344
movl $0x8, %edx
movq %r14, %rdi
callq 0x2150
leaq -0x210(%rbp), %rbx
movq %rbx, %rdi
callq 0x2090
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2150
leaq 0x26b3(%rip), %rsi      # 0x534d
movl $0x3, %edx
movq %r14, %rdi
callq 0x2150
movq %r14, %rdi
callq 0x20a0
leaq -0x100(%rbp), %rdi
movl $0x4, %esi
movl $0x8, %edx
movq %r12, %rcx
callq 0x2240
movl $0x8, %esi
movq -0xe0(%rbp), %rdi
movq -0x50(%rbp), %rbx
movq %rbx, %rdx
movq %r12, %rcx
callq 0x2240
movl $0x8, %esi
movq -0xd8(%rbp), %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x2240
movl $0x8, %esi
movq -0xd0(%rbp), %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x2240
cmpl $0x0, -0x30(%rbp)
jle 0x2d3e
xorl %ebx, %ebx
movq -0x98(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl $0x8, %esi
movq -0x48(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq %rbx, -0x30(%rbp)
jne 0x2d19
movl $0x8, %esi
movq -0xc0(%rbp), %rdi
movq -0x48(%rbp), %rbx
movq %rbx, %rdx
movq %r12, %rcx
callq 0x2240
movl $0x8, %esi
movq -0xb8(%rbp), %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x2240
cmpl $0x0, -0x30(%rbp)
jle 0x2d9d
xorl %ebx, %ebx
movq -0x90(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl $0x4, %esi
movq -0x48(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq %rbx, -0x30(%rbp)
jne 0x2d78
movl $0x4, %esi
movq -0xc8(%rbp), %rdi
movq -0x50(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
cmpl $0x0, -0x48(%rbp)
jle 0x2ddc
xorl %ebx, %ebx
movq (%r15,%rbx,8), %rdi
movl $0x1, %esi
movl $0x1e, %edx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq %rbx, -0x48(%rbp)
jne 0x2dbd
cmpl $0x0, -0x50(%rbp)
jle 0x2e04
xorl %ebx, %ebx
movq (%r13,%rbx,8), %rdi
movl $0x1, %esi
movl $0x1e, %edx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq %rbx, -0x50(%rbp)
jne 0x2de4
xorl %ebx, %ebx
movq -0x88(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl $0x8, %esi
movq -0x48(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq $0x3, %rbx
jne 0x2e06
xorl %ebx, %ebx
movq -0x40(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl $0x4, %esi
movq -0x48(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq $0x3, %rbx
jne 0x2e2d
cmpl $0x0, -0x30(%rbp)
jle 0x2e7c
xorl %ebx, %ebx
movq -0x80(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl $0x8, %esi
movq -0xa0(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq %rbx, -0x30(%rbp)
jne 0x2e57
cmpl $0x0, -0x30(%rbp)
jle 0x2ea9
xorl %ebx, %ebx
movq -0x78(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl $0x8, %esi
movq -0xa8(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq %rbx, -0x30(%rbp)
jne 0x2e84
cmpl $0x0, -0x30(%rbp)
jle 0x2ed6
xorl %ebx, %ebx
movq -0x70(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl $0x8, %esi
movq -0xb0(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq %rbx, -0x30(%rbp)
jne 0x2eb1
cmpl $0x0, -0x30(%rbp)
jle 0x2f03
xorl %ebx, %ebx
movq -0x68(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl $0x4, %esi
movq -0xa0(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq %rbx, -0x30(%rbp)
jne 0x2ede
cmpl $0x0, -0x30(%rbp)
jle 0x2f30
xorl %ebx, %ebx
movq -0x60(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl $0x4, %esi
movq -0xa8(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq %rbx, -0x30(%rbp)
jne 0x2f0b
cmpl $0x0, -0x30(%rbp)
jle 0x2f5d
xorl %ebx, %ebx
movq -0x58(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl $0x4, %esi
movq -0xb0(%rbp), %rdx
movq %r12, %rcx
callq 0x2240
incq %rbx
cmpq %rbx, -0x30(%rbp)
jne 0x2f38
movq %r12, %rdi
callq 0x2130
movq 0x406c(%rip), %rbx      # 0x6fd8
leaq 0x23de(%rip), %rsi      # 0x5351
movl $0x24, %edx
movq %rbx, %rdi
callq 0x2150
movq %rbx, %rdi
callq 0x20a0
movq -0xe0(%rbp), %rdi
callq 0x2180
movq -0xd8(%rbp), %rdi
callq 0x2180
movq -0xd0(%rbp), %rdi
callq 0x2180
movq -0xc0(%rbp), %rdi
callq 0x2180
movq -0xb8(%rbp), %rdi
callq 0x2180
movq -0xc8(%rbp), %rdi
callq 0x2180
xorl %ebx, %ebx
movq -0x88(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x2fe7
callq 0x2180
movq -0x40(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x2ff9
callq 0x2180
incq %rbx
cmpq $0x3, %rbx
jne 0x2fd2
cmpl $0x0, -0x30(%rbp)
jle 0x30b1
xorl %ebx, %ebx
movq -0x98(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x3023
callq 0x2180
movq -0x90(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x3038
callq 0x2180
movq -0x80(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x304a
callq 0x2180
movq -0x78(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x305c
callq 0x2180
movq -0x70(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x306e
callq 0x2180
movq -0x68(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x3080
callq 0x2180
movq -0x60(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x3092
callq 0x2180
movq -0x58(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x30a4
callq 0x2180
incq %rbx
cmpq %rbx, -0x30(%rbp)
jne 0x300e
movq -0x98(%rbp), %rdi
callq 0x2180
movq -0x90(%rbp), %rdi
callq 0x2180
movq -0x80(%rbp), %rdi
callq 0x2180
movq -0x78(%rbp), %rdi
callq 0x2180
movq -0x70(%rbp), %rdi
callq 0x2180
movq -0x68(%rbp), %rdi
callq 0x2180
movq -0x60(%rbp), %rdi
callq 0x2180
movq -0x58(%rbp), %rdi
callq 0x2180
movq -0x88(%rbp), %rdi
callq 0x2180
movq -0x40(%rbp), %rdi
callq 0x2180
xorl %ecx, %ecx
jmp 0x24de
movq 0x3eb6(%rip), %r14      # 0x6fd8
leaq 0x224d(%rip), %rsi      # 0x5376
movl $0x14, %edx
movq %r14, %rdi
callq 0x2150
leaq -0x210(%rbp), %r15
movq %r15, %rdi
callq 0x2090
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2150
movq %r14, %rdi
callq 0x20a0
jmp 0x24d9