// File: WeiqiangZhou[P]BIRD/source/predict_main.cpp
// Function: main
int main(int argc, char *argv[])
{
	char infile[255];
	char outfile[255];
    char outfile_expr[255];
	char libfile[255]="./model_file.bin";
	int write_flag = 0;
    int log_flag = 0;
	int locus_model = 0;
	double up_bound = 14;
	int opt;
    int match_mode = 0;
    std::string sep_str = ".";

	if(argc == 1)
	{
		help_info();
		return 1;
	}

	while ((opt = getopt(argc,argv,"b:i:o:u:wthle")) != EOF)
	{
		switch(opt)
		{
			case 'b':
				strcpy(libfile, optarg);
				break;
			case 'i':
				strcpy(infile, optarg);
				break;
			case 'o':
				strcpy(outfile, optarg);
				break;
			case 'u':
				up_bound = atof(optarg);
				break;
			case 'w':
				write_flag = 1;
				break;
            case 't':
                log_flag = 1;
                break;
			case 'h':
				help_info();
				return 1;
			case 'l':
				locus_model = 1;
				break;
            case 'e':
                match_mode = 1;
                break;
			case '?':
				std::cout << "Please input the correct parameters." << std::endl;
				std::cout << "Standard output: BIRD_predict -b model_file.bin -i input_file.txt -o output_file.txt" << std::endl;
				std::cout << "WIG output: BIRD_predict -b model_file.bin -i input_file.txt -o output_name -w" << std::endl;
				return 1;
			default:
				abort();
		}
	}

	//output parameters
	std::cout << "Using model file: " << libfile << std::endl;
	std::cout << "Input file name: " << infile << std::endl;
	std::cout << "Output file name: " << outfile << std::endl;
	std::cout << "Using upper bound: " << up_bound << std::endl;
	if(write_flag)
	{
		std::cout << "Output mode: wig file" << std::endl;
	}
	else
	{
		std::cout << "Output mode: data matrix" << std::endl;
	}

	if(locus_model)
	{
		std::cout << "Prediction mode: locus-level model" << std::endl;
	}
	else
	{
		std::cout << "Prediction mode: full model" << std::endl;
	}

	Exondata exonin;
	Exondata *indata = &exonin;
	int predictor_size, sample_size, cluster_size, var_size, loci_size, bin_size, DH_num1, DH_num2, DH_num3;

	if (ReadPar(libfile, loci_size, predictor_size, cluster_size, bin_size, var_size, DH_num1, DH_num2, DH_num3))
	{
		return 1;
	}

	double *quantile_in = new double[predictor_size];
	int *cluster_idx = new int[predictor_size];
	double *exon_mean = new double[predictor_size];
	double *exon_sd = new double[predictor_size];
	double *DNase_mean = new double[loci_size];
	double *DNase_sd = new double[loci_size];

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

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

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

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

	//DH cluster model
	double **dis_matrix = new double *[3];
	for (int j = 0; j < 3; j++)
	{
		dis_matrix[j] = new double[loci_size]();
	}

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

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

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

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

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

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

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

	//read in modle file
	if (ReadinModel(libfile, quantile_in, exon_mean, exon_sd, coef, DNase_mean, DNase_sd, pre_idx, TC_id, cluster_idx, select_loci, predictor_size, var_size, loci_size, dis_matrix, DH_cluster, DH_coef1, DH_coef2, DH_coef3, DH_pre_idx1, DH_pre_idx2, DH_pre_idx3, DH_num1, DH_num2, DH_num3))
	{
		return 1;
	}
	//read in gene expression data
	if (ReadinExon(infile, indata))
	{
		return 1;
	}

    int *match_idx = new int[predictor_size];
    
    //match and check gene expression data
    std::cout << "Matching the input gene expression data." << std::endl;
    if(match_mode == 1)
    {
        //use exact match
        if (MatchExon(TC_id, indata, predictor_size, match_idx))
        {
            std::cout << "Gene expression data format incorrect: No gene id matches the library file." << std::endl;
            std::cout << "Please check sample input file for reference." << std::endl;
            return 1;
        }
    }
    else
    {
        //match id before separate character
        if (MatchExon_sep(TC_id, indata, predictor_size, match_idx, sep_str))
        {
            std::cout << "Gene expression data format incorrect: No gene id matches the library file." << std::endl;
            std::cout << "Please check sample input file for reference." << std::endl;
            return 1;
        }
    }
    
    std::cout << "Processing data..." << std::endl;
    
	sample_size = (int)exonin.sample_name.size();

	double ** data_norm = new double *[sample_size];
	double ** data_mean = new double *[sample_size];
	double ** output = new double *[sample_size];
	double ** DH_pre1 = new double *[sample_size];
	double ** DH_pre2 = new double *[sample_size];
	double ** DH_pre3 = new double *[sample_size];

	for (int i = 0; i < sample_size; i++)
	{
		data_norm[i] = new double[predictor_size]();
		data_mean[i] = new double[cluster_size]();
		output[i] = new double[loci_size]();
		DH_pre1[i] = new double[DH_num1]();
		DH_pre2[i] = new double[DH_num2]();
		DH_pre3[i] = new double[DH_num3]();
	}

	for (int i = 0; i < sample_size; i++)
	{
		for (int j = 0; j < predictor_size; j++)
		{
            if(match_idx[j] != -1)
            {
                data_norm[i][j] = log2(exonin.data[match_idx[j]][i] + 1);
            }
            else
            {
                data_norm[i][j] = 0;
            }
		}
	}
    
    strcpy(outfile_expr, infile);
    strcat(outfile_expr, ".match.txt");
    WriteExpr(data_norm, exonin.sample_name, TC_id, outfile_expr, predictor_size, sample_size);
    
    for (int i = 0; i < sample_size; i++)
    {
        QuantileNorm(data_norm[i], quantile_in, predictor_size);
    }

	StandardizeRow(data_norm, exon_mean, exon_sd, predictor_size, sample_size); //standardize gene expression data
	ClusterMean(data_norm, data_mean, cluster_idx, predictor_size, cluster_size, sample_size); //get gene expression cluster mean;

	if(locus_model != 1)
	{
		//Locus level prediction
		Regression(data_mean, output, coef, pre_idx, var_size, loci_size, sample_size);

		//DH cluster level prediction
		Regression(data_mean, DH_pre1, DH_coef1, DH_pre_idx1, var_size, DH_num1, sample_size);
		Regression(data_mean, DH_pre2, DH_coef2, DH_pre_idx2, var_size, DH_num2, sample_size);
		Regression(data_mean, DH_pre3, DH_coef3, DH_pre_idx3, var_size, DH_num3, sample_size);

		//Combine result from locus level and DH cluster level
		ModelAverage(output, DH_pre1, DH_pre2, DH_pre3, dis_matrix, DH_cluster, loci_size, sample_size);
		std::cout << "Using full model for prediction." << std::endl;
	}
	else
	{
		//Locus level prediction
		Regression(data_mean, output, coef, pre_idx, var_size, loci_size, sample_size);
		std::cout << "Using locus-level model for prediction." << std::endl;
	}

  	//convert predicted value back to original scale
	StandardizeRow_r(output, DNase_mean, DNase_sd, loci_size, sample_size);

  	//write output file
	std::cout << "Writing output file..." << std::endl;
	if (WriteWIG(output, select_loci, exonin.sample_name, outfile, bin_size, loci_size, sample_size, write_flag, up_bound, log_flag))
	{
		return 1;
	}

	//release memory.
	ReleaseExondata(exonin);
	delete[] quantile_in;
	delete[] cluster_idx;
	for (int i = 0; i < sample_size; i++)
	{
		delete[] data_norm[i];
		delete[] data_mean[i];
		delete[] output[i];
		delete[] DH_pre1[i];
		delete[] DH_pre2[i];
		delete[] DH_pre3[i];
	}
	for (int i = 0; i < var_size; i++)
	{
		delete[] coef[i];
		delete[] pre_idx[i];
		delete[] DH_coef1[i];
		delete[] DH_coef2[i];
		delete[] DH_coef3[i];
		delete[] DH_pre_idx1[i];
		delete[] DH_pre_idx2[i];
		delete[] DH_pre_idx3[i];
	}
	for (int i = 0; i < 3; i++)
	{
		delete[] dis_matrix[i];
		delete[] DH_cluster[i];
	}
	for (int i = 0; i < predictor_size; i++)
	{
		delete[] TC_id[i];
	}
	for (int i = 0; i < loci_size; i++)
	{
		delete[] select_loci[i];
	}
	delete[] data_norm;
	delete[] data_mean;
	delete[] output;
	delete[] DH_pre1;
	delete[] DH_pre2;
	delete[] DH_pre3;
	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[] TC_id;
	delete[] select_loci;
	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 $0xc18, %rsp            # imm = 0xC18
movl $0x0, -0x2c(%rbp)
movl %edi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
leaq 0xcb07(%rip), %rsi      # 0xf100
leaq -0x440(%rbp), %rdi
movl $0xff, %edx
callq 0x2180
movl $0x0, -0x444(%rbp)
movl $0x0, -0x448(%rbp)
movl $0x0, -0x44c(%rbp)
movabsq $0x402c000000000000, %rax # imm = 0x402C000000000000
movq %rax, -0x458(%rbp)
movl $0x0, -0x460(%rbp)
leaq -0x481(%rbp), %rdi
movq %rdi, -0x708(%rbp)
callq 0x23c0
movq -0x708(%rbp), %rdx
leaq 0xd19a(%rip), %rsi      # 0xf7fe
leaq -0x480(%rbp), %rdi
callq 0x22a0
jmp 0x2672
leaq -0x481(%rbp), %rdi
callq 0x2210
cmpl $0x1, -0x30(%rbp)
jne 0x26db
callq 0x96a0
jmp 0x268b
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x498(%rbp)
jmp 0x4a0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x490(%rbp)
movl %eax, -0x494(%rbp)
leaq -0x481(%rbp), %rdi
callq 0x2210
jmp 0x4a37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x490(%rbp)
movl %eax, -0x494(%rbp)
jmp 0x4a2b
jmp 0x26dd
movl -0x30(%rbp), %edi
movq -0x38(%rbp), %rsi
leaq 0xcb14(%rip), %rdx      # 0xf1ff
callq 0x2080
movl %eax, -0x45c(%rbp)
cmpl $-0x1, %eax
je 0x28aa
movl -0x45c(%rbp), %eax
addl $-0x3f, %eax
movl %eax, %ecx
movq %rcx, -0x710(%rbp)
subl $0x38, %eax
ja 0x28a0
movq -0x710(%rbp), %rax
leaq 0xc8e8(%rip), %rcx      # 0xf010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x440(%rbp), %rdi
movq 0x13889(%rip), %rax     # 0x15fc8
movq (%rax), %rsi
callq 0x21a0
jmp 0x28a5
leaq -0x140(%rbp), %rdi
movq 0x1386e(%rip), %rax     # 0x15fc8
movq (%rax), %rsi
callq 0x21a0
jmp 0x28a5
leaq -0x240(%rbp), %rdi
movq 0x13853(%rip), %rax     # 0x15fc8
movq (%rax), %rsi
callq 0x21a0
jmp 0x28a5
movq 0x1383f(%rip), %rax     # 0x15fc8
movq (%rax), %rdi
callq 0x2240
movsd %xmm0, -0x458(%rbp)
jmp 0x28a5
movl $0x1, -0x444(%rbp)
jmp 0x28a5
movl $0x1, -0x448(%rbp)
jmp 0x28a5
callq 0x96a0
jmp 0x27c3
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x498(%rbp)
jmp 0x4a0a
movl $0x1, -0x44c(%rbp)
jmp 0x28a5
movl $0x1, -0x460(%rbp)
jmp 0x28a5
movq 0x137da(%rip), %rdi     # 0x15fd8
leaq 0xca08(%rip), %rsi      # 0xf20d
callq 0x21c0
movq %rax, -0x718(%rbp)
jmp 0x2813
movq -0x718(%rbp), %rdi
movq 0x1379f(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x2828
movq 0x137a9(%rip), %rdi     # 0x15fd8
leaq 0xc9fc(%rip), %rsi      # 0xf232
callq 0x21c0
movq %rax, -0x720(%rbp)
jmp 0x2844
movq -0x720(%rbp), %rdi
movq 0x1376e(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x2859
movq 0x13778(%rip), %rdi     # 0x15fd8
leaq 0xca20(%rip), %rsi      # 0xf287
callq 0x21c0
movq %rax, -0x728(%rbp)
jmp 0x2875
movq -0x728(%rbp), %rdi
movq 0x1373d(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x288a
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x498(%rbp)
jmp 0x4a0a
callq 0x2120
jmp 0x26dd
movq 0x13727(%rip), %rdi     # 0x15fd8
leaq 0xca1e(%rip), %rsi      # 0xf2d6
callq 0x21c0
movq %rax, -0x730(%rbp)
jmp 0x28c6
movq -0x730(%rbp), %rdi
leaq -0x440(%rbp), %rsi
callq 0x21c0
movq %rax, -0x738(%rbp)
jmp 0x28e2
movq -0x738(%rbp), %rdi
movq 0x136d0(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x28f7
movq 0x136da(%rip), %rdi     # 0x15fd8
leaq 0xc9e4(%rip), %rsi      # 0xf2e9
callq 0x21c0
movq %rax, -0x740(%rbp)
jmp 0x2913
movq -0x740(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x21c0
movq %rax, -0x748(%rbp)
jmp 0x292f
movq -0x748(%rbp), %rdi
movq 0x13683(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x2944
movq 0x1368d(%rip), %rdi     # 0x15fd8
leaq 0xc9a9(%rip), %rsi      # 0xf2fb
callq 0x21c0
movq %rax, -0x750(%rbp)
jmp 0x2960
movq -0x750(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x21c0
movq %rax, -0x758(%rbp)
jmp 0x297c
movq -0x758(%rbp), %rdi
movq 0x13636(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x2991
movq 0x13640(%rip), %rdi     # 0x15fd8
leaq 0xc96f(%rip), %rsi      # 0xf30e
callq 0x21c0
movq %rax, -0x760(%rbp)
jmp 0x29ad
movq -0x760(%rbp), %rdi
movsd -0x458(%rbp), %xmm0
callq 0x2420
movq %rax, -0x768(%rbp)
jmp 0x29ca
movq -0x768(%rbp), %rdi
movq 0x135e8(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x29df
cmpl $0x0, -0x444(%rbp)
je 0x2a1b
movq 0x135e9(%rip), %rdi     # 0x15fd8
leaq 0xc92c(%rip), %rsi      # 0xf322
callq 0x21c0
movq %rax, -0x770(%rbp)
jmp 0x2a04
movq -0x770(%rbp), %rdi
movq 0x135ae(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x2a19
jmp 0x2a4e
movq 0x135b6(%rip), %rdi     # 0x15fd8
leaq 0xc90f(%rip), %rsi      # 0xf338
callq 0x21c0
movq %rax, -0x778(%rbp)
jmp 0x2a37
movq -0x778(%rbp), %rdi
movq 0x1357b(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x2a4c
jmp 0x2a4e
cmpl $0x0, -0x44c(%rbp)
je 0x2a8a
movq 0x1357a(%rip), %rdi     # 0x15fd8
leaq 0xc8ec(%rip), %rsi      # 0xf351
callq 0x21c0
movq %rax, -0x780(%rbp)
jmp 0x2a73
movq -0x780(%rbp), %rdi
movq 0x1353f(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x2a88
jmp 0x2abd
movq 0x13547(%rip), %rdi     # 0x15fd8
leaq 0xc8dc(%rip), %rsi      # 0xf374
callq 0x21c0
movq %rax, -0x788(%rbp)
jmp 0x2aa6
movq -0x788(%rbp), %rdi
movq 0x1350c(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x2abb
jmp 0x2abd
leaq -0x4e0(%rbp), %rdi
movq %rdi, -0x798(%rbp)
callq 0x4a50
movq -0x798(%rbp), %rax
movq %rax, -0x4e8(%rbp)
movq %rsp, %rax
leaq -0x50c(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq -0x508(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x504(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x440(%rbp), %rdi
leaq -0x4fc(%rbp), %rsi
leaq -0x4ec(%rbp), %rdx
leaq -0x4f4(%rbp), %rcx
leaq -0x500(%rbp), %r8
leaq -0x4f8(%rbp), %r9
callq 0x8360
movl %eax, -0x78c(%rbp)
jmp 0x2b38
movl -0x78c(%rbp), %eax
cmpl $0x0, %eax
je 0x2b70
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x498(%rbp)
jmp 0x49ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x490(%rbp)
movl %eax, -0x494(%rbp)
jmp 0x49fc
movslq -0x4ec(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x7a0(%rbp)
jmp 0x2b9b
movq -0x7a0(%rbp), %rax
movq %rax, -0x518(%rbp)
movslq -0x4ec(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x7a8(%rbp)
jmp 0x2bd4
movq -0x7a8(%rbp), %rax
movq %rax, -0x520(%rbp)
movslq -0x4ec(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x7b0(%rbp)
jmp 0x2c0d
movq -0x7b0(%rbp), %rax
movq %rax, -0x528(%rbp)
movslq -0x4ec(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x7b8(%rbp)
jmp 0x2c46
movq -0x7b8(%rbp), %rax
movq %rax, -0x530(%rbp)
movslq -0x4fc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x7c0(%rbp)
jmp 0x2c7f
movq -0x7c0(%rbp), %rax
movq %rax, -0x538(%rbp)
movslq -0x4fc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x7c8(%rbp)
jmp 0x2cb8
movq -0x7c8(%rbp), %rax
movq %rax, -0x540(%rbp)
movslq -0x4f8(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x7d0(%rbp)
jmp 0x2cf1
movq -0x7d0(%rbp), %rax
movq %rax, -0x548(%rbp)
movl $0x0, -0x54c(%rbp)
movl -0x54c(%rbp), %eax
cmpl -0x4f8(%rbp), %eax
jge 0x2d88
movslq -0x4fc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x7e0(%rbp)
callq 0x2030
movq %rax, -0x7d8(%rbp)
jmp 0x2d49
movq -0x7d8(%rbp), %rdi
movq -0x7e0(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x7d8(%rbp), %rdx
movq -0x548(%rbp), %rax
movslq -0x54c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x54c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54c(%rbp)
jmp 0x2d09
movslq -0x4f8(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x7e8(%rbp)
jmp 0x2db3
movq -0x7e8(%rbp), %rax
movq %rax, -0x558(%rbp)
movl $0x0, -0x55c(%rbp)
movl -0x55c(%rbp), %eax
cmpl -0x4f8(%rbp), %eax
jge 0x2e4a
movslq -0x4fc(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x7f8(%rbp)
callq 0x2030
movq %rax, -0x7f0(%rbp)
jmp 0x2e0b
movq -0x7f0(%rbp), %rdi
movq -0x7f8(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x7f0(%rbp), %rdx
movq -0x558(%rbp), %rax
movslq -0x55c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x55c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x55c(%rbp)
jmp 0x2dcb
movslq -0x4fc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x800(%rbp)
jmp 0x2e75
movq -0x800(%rbp), %rax
movq %rax, -0x568(%rbp)
movl $0x0, -0x56c(%rbp)
movl -0x56c(%rbp), %eax
cmpl -0x4fc(%rbp), %eax
jge 0x2ed8
movl $0x1e, %edi
callq 0x2030
movq %rax, -0x808(%rbp)
jmp 0x2eae
movq -0x808(%rbp), %rdx
movq -0x568(%rbp), %rax
movslq -0x56c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x56c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x56c(%rbp)
jmp 0x2e8d
movslq -0x4ec(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x810(%rbp)
jmp 0x2f03
movq -0x810(%rbp), %rax
movq %rax, -0x578(%rbp)
movl $0x0, -0x57c(%rbp)
movl -0x57c(%rbp), %eax
cmpl -0x4ec(%rbp), %eax
jge 0x2f66
movl $0x1e, %edi
callq 0x2030
movq %rax, -0x818(%rbp)
jmp 0x2f3c
movq -0x818(%rbp), %rdx
movq -0x578(%rbp), %rax
movslq -0x57c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x57c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x57c(%rbp)
jmp 0x2f1b
movl $0x18, %edi
callq 0x2030
movq %rax, -0x820(%rbp)
jmp 0x2f79
movq -0x820(%rbp), %rax
movq %rax, -0x588(%rbp)
movl $0x0, -0x58c(%rbp)
cmpl $0x3, -0x58c(%rbp)
jge 0x300b
movslq -0x4fc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x830(%rbp)
callq 0x2030
movq %rax, -0x828(%rbp)
jmp 0x2fcc
movq -0x828(%rbp), %rdi
movq -0x830(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x828(%rbp), %rdx
movq -0x588(%rbp), %rax
movslq -0x58c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x58c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58c(%rbp)
jmp 0x2f91
movl $0x18, %edi
callq 0x2030
movq %rax, -0x838(%rbp)
jmp 0x301e
movq -0x838(%rbp), %rax
movq %rax, -0x598(%rbp)
movl $0x0, -0x59c(%rbp)
cmpl $0x3, -0x59c(%rbp)
jge 0x30b0
movslq -0x4fc(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x848(%rbp)
callq 0x2030
movq %rax, -0x840(%rbp)
jmp 0x3071
movq -0x840(%rbp), %rdi
movq -0x848(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x840(%rbp), %rdx
movq -0x598(%rbp), %rax
movslq -0x59c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x59c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x59c(%rbp)
jmp 0x3036
movslq -0x4f8(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x850(%rbp)
jmp 0x30db
movq -0x850(%rbp), %rax
movq %rax, -0x5a8(%rbp)
movl $0x0, -0x5ac(%rbp)
movl -0x5ac(%rbp), %eax
cmpl -0x4f8(%rbp), %eax
jge 0x3172
movslq -0x504(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x860(%rbp)
callq 0x2030
movq %rax, -0x858(%rbp)
jmp 0x3133
movq -0x858(%rbp), %rdi
movq -0x860(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x858(%rbp), %rdx
movq -0x5a8(%rbp), %rax
movslq -0x5ac(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x5ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5ac(%rbp)
jmp 0x30f3
movslq -0x4f8(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x868(%rbp)
jmp 0x319d
movq -0x868(%rbp), %rax
movq %rax, -0x5b8(%rbp)
movl $0x0, -0x5bc(%rbp)
movl -0x5bc(%rbp), %eax
cmpl -0x4f8(%rbp), %eax
jge 0x3234
movslq -0x508(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x878(%rbp)
callq 0x2030
movq %rax, -0x870(%rbp)
jmp 0x31f5
movq -0x870(%rbp), %rdi
movq -0x878(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x870(%rbp), %rdx
movq -0x5b8(%rbp), %rax
movslq -0x5bc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x5bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5bc(%rbp)
jmp 0x31b5
movslq -0x4f8(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x880(%rbp)
jmp 0x325f
movq -0x880(%rbp), %rax
movq %rax, -0x5c8(%rbp)
movl $0x0, -0x5cc(%rbp)
movl -0x5cc(%rbp), %eax
cmpl -0x4f8(%rbp), %eax
jge 0x32f6
movslq -0x50c(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x890(%rbp)
callq 0x2030
movq %rax, -0x888(%rbp)
jmp 0x32b7
movq -0x888(%rbp), %rdi
movq -0x890(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x888(%rbp), %rdx
movq -0x5c8(%rbp), %rax
movslq -0x5cc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x5cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5cc(%rbp)
jmp 0x3277
movslq -0x4f8(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x898(%rbp)
jmp 0x3321
movq -0x898(%rbp), %rax
movq %rax, -0x5d8(%rbp)
movl $0x0, -0x5dc(%rbp)
movl -0x5dc(%rbp), %eax
cmpl -0x4f8(%rbp), %eax
jge 0x33b8
movslq -0x504(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x8a8(%rbp)
callq 0x2030
movq %rax, -0x8a0(%rbp)
jmp 0x3379
movq -0x8a0(%rbp), %rdi
movq -0x8a8(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x8a0(%rbp), %rdx
movq -0x5d8(%rbp), %rax
movslq -0x5dc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x5dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5dc(%rbp)
jmp 0x3339
movslq -0x4f8(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x8b0(%rbp)
jmp 0x33e3
movq -0x8b0(%rbp), %rax
movq %rax, -0x5e8(%rbp)
movl $0x0, -0x5ec(%rbp)
movl -0x5ec(%rbp), %eax
cmpl -0x4f8(%rbp), %eax
jge 0x347a
movslq -0x508(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x8c0(%rbp)
callq 0x2030
movq %rax, -0x8b8(%rbp)
jmp 0x343b
movq -0x8b8(%rbp), %rdi
movq -0x8c0(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x8b8(%rbp), %rdx
movq -0x5e8(%rbp), %rax
movslq -0x5ec(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x5ec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5ec(%rbp)
jmp 0x33fb
movslq -0x4f8(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x8c8(%rbp)
jmp 0x34a5
movq -0x8c8(%rbp), %rax
movq %rax, -0x5f8(%rbp)
movl $0x0, -0x5fc(%rbp)
movl -0x5fc(%rbp), %eax
cmpl -0x4f8(%rbp), %eax
jge 0x353c
movslq -0x50c(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x8d8(%rbp)
callq 0x2030
movq %rax, -0x8d0(%rbp)
jmp 0x34fd
movq -0x8d0(%rbp), %rdi
movq -0x8d8(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x8d0(%rbp), %rdx
movq -0x5f8(%rbp), %rax
movslq -0x5fc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x5fc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5fc(%rbp)
jmp 0x34bd
movq -0x518(%rbp), %rsi
movq -0x528(%rbp), %rdx
movq -0x530(%rbp), %rax
movq %rax, -0x8e8(%rbp)
movq -0x548(%rbp), %r8
movq -0x538(%rbp), %r9
movq -0x540(%rbp), %rdi
movq -0x558(%rbp), %r10
movq -0x578(%rbp), %r11
movq -0x520(%rbp), %rbx
movq -0x568(%rbp), %r14
movl -0x4ec(%rbp), %r15d
movl -0x4f8(%rbp), %r12d
movl -0x4fc(%rbp), %r13d
movq -0x588(%rbp), %rax
movq %rax, -0x8f0(%rbp)
movq -0x598(%rbp), %rax
movq %rax, -0x8f8(%rbp)
movq -0x5a8(%rbp), %rax
movq %rax, -0x900(%rbp)
movq -0x5b8(%rbp), %rax
movq %rax, -0x908(%rbp)
movq -0x5c8(%rbp), %rax
movq %rax, -0x910(%rbp)
movq -0x5d8(%rbp), %rax
movq %rax, -0x918(%rbp)
movq -0x5e8(%rbp), %rax
movq %rax, -0x920(%rbp)
movq -0x5f8(%rbp), %rax
movq %rax, -0x928(%rbp)
movl -0x504(%rbp), %eax
movl %eax, -0x92c(%rbp)
movl -0x508(%rbp), %eax
movl %eax, -0x930(%rbp)
movl -0x50c(%rbp), %ecx
movq %rsp, %rax
movq %rax, -0x938(%rbp)
movl %ecx, 0x90(%rax)
movl -0x930(%rbp), %ecx
movl %ecx, 0x88(%rax)
movl -0x92c(%rbp), %ecx
movl %ecx, 0x80(%rax)
movq -0x928(%rbp), %rcx
movq %rcx, 0x78(%rax)
movq -0x920(%rbp), %rcx
movq %rcx, 0x70(%rax)
movq -0x918(%rbp), %rcx
movq %rcx, 0x68(%rax)
movq -0x910(%rbp), %rcx
movq %rcx, 0x60(%rax)
movq -0x908(%rbp), %rcx
movq %rcx, 0x58(%rax)
movq -0x900(%rbp), %rcx
movq %rcx, 0x50(%rax)
movq -0x8f8(%rbp), %rcx
movq %rcx, 0x48(%rax)
movq -0x8f0(%rbp), %rcx
movq %rcx, 0x40(%rax)
movq -0x8e8(%rbp), %rcx
movl %r13d, 0x38(%rax)
movl %r12d, 0x30(%rax)
movl %r15d, 0x28(%rax)
movq %r14, 0x20(%rax)
movq %rbx, 0x18(%rax)
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rdi, (%rax)
leaq -0x440(%rbp), %rdi
callq 0x7e80
movl %eax, -0x8dc(%rbp)
jmp 0x36e6
movl -0x8dc(%rbp), %eax
cmpl $0x0, %eax
je 0x3707
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x498(%rbp)
jmp 0x49ee
movq -0x4e8(%rbp), %rsi
leaq -0x140(%rbp), %rdi
callq 0x7150
movl %eax, -0x93c(%rbp)
jmp 0x3722
movl -0x93c(%rbp), %eax
cmpl $0x0, %eax
je 0x3743
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x498(%rbp)
jmp 0x49ee
movslq -0x4ec(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x948(%rbp)
jmp 0x376e
movq -0x948(%rbp), %rax
movq %rax, -0x608(%rbp)
movq 0x12855(%rip), %rdi     # 0x15fd8
leaq 0xbc06(%rip), %rsi      # 0xf390
callq 0x21c0
movq %rax, -0x950(%rbp)
jmp 0x3798
movq -0x950(%rbp), %rdi
movq 0x1281a(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x37ad
cmpl $0x1, -0x460(%rbp)
jne 0x386a
movq -0x578(%rbp), %rdi
movq -0x4e8(%rbp), %rsi
movl -0x4ec(%rbp), %edx
movq -0x608(%rbp), %rcx
callq 0x6c40
movl %eax, -0x954(%rbp)
jmp 0x37e2
movl -0x954(%rbp), %eax
cmpl $0x0, %eax
je 0x3865
movq 0x127e4(%rip), %rdi     # 0x15fd8
leaq 0xbbbe(%rip), %rsi      # 0xf3b9
callq 0x21c0
movq %rax, -0x960(%rbp)
jmp 0x3809
movq -0x960(%rbp), %rdi
movq 0x127a9(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x381e
movq 0x127b3(%rip), %rdi     # 0x15fd8
leaq 0xbbd9(%rip), %rsi      # 0xf405
callq 0x21c0
movq %rax, -0x968(%rbp)
jmp 0x383a
movq -0x968(%rbp), %rdi
movq 0x12778(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x384f
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x498(%rbp)
jmp 0x49ee
jmp 0x399c
movq -0x578(%rbp), %rax
movq %rax, -0x988(%rbp)
movq -0x4e8(%rbp), %rax
movq %rax, -0x980(%rbp)
movl -0x4ec(%rbp), %eax
movl %eax, -0x974(%rbp)
movq -0x608(%rbp), %rax
movq %rax, -0x970(%rbp)
leaq -0x628(%rbp), %rdi
leaq -0x480(%rbp), %rsi
callq 0x20e0
jmp 0x38b5
movq -0x970(%rbp), %rcx
movl -0x974(%rbp), %edx
movq -0x980(%rbp), %rsi
movq -0x988(%rbp), %rdi
leaq -0x628(%rbp), %r8
callq 0x6910
movl %eax, -0x98c(%rbp)
jmp 0x38e4
leaq -0x628(%rbp), %rdi
callq 0x2140
movl -0x98c(%rbp), %eax
cmpl $0x0, %eax
je 0x399a
movq 0x126d2(%rip), %rdi     # 0x15fd8
leaq 0xbaac(%rip), %rsi      # 0xf3b9
callq 0x21c0
movq %rax, -0x998(%rbp)
jmp 0x391b
movq -0x998(%rbp), %rdi
movq 0x12697(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x3930
movq 0x126a1(%rip), %rdi     # 0x15fd8
leaq 0xbac7(%rip), %rsi      # 0xf405
callq 0x21c0
movq %rax, -0x9a0(%rbp)
jmp 0x394c
movq -0x9a0(%rbp), %rdi
movq 0x12666(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x3961
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x498(%rbp)
jmp 0x49ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x490(%rbp)
movl %eax, -0x494(%rbp)
leaq -0x628(%rbp), %rdi
callq 0x2140
jmp 0x49fc
jmp 0x399c
movq 0x12635(%rip), %rdi     # 0x15fd8
leaq 0xba89(%rip), %rsi      # 0xf433
callq 0x21c0
movq %rax, -0x9a8(%rbp)
jmp 0x39b8
movq -0x9a8(%rbp), %rdi
movq 0x125fa(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x39cd
leaq -0x4e0(%rbp), %rdi
callq 0x4a90
movl %eax, -0x4f0(%rbp)
movslq -0x4f0(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x9b0(%rbp)
jmp 0x3a0a
movq -0x9b0(%rbp), %rax
movq %rax, -0x630(%rbp)
movslq -0x4f0(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x9b8(%rbp)
jmp 0x3a43
movq -0x9b8(%rbp), %rax
movq %rax, -0x638(%rbp)
movslq -0x4f0(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x9c0(%rbp)
jmp 0x3a7c
movq -0x9c0(%rbp), %rax
movq %rax, -0x640(%rbp)
movslq -0x4f0(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x9c8(%rbp)
jmp 0x3ab5
movq -0x9c8(%rbp), %rax
movq %rax, -0x648(%rbp)
movslq -0x4f0(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x9d0(%rbp)
jmp 0x3aee
movq -0x9d0(%rbp), %rax
movq %rax, -0x650(%rbp)
movslq -0x4f0(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x9d8(%rbp)
jmp 0x3b27
movq -0x9d8(%rbp), %rax
movq %rax, -0x658(%rbp)
movl $0x0, -0x65c(%rbp)
movl -0x65c(%rbp), %eax
cmpl -0x4f0(%rbp), %eax
jge 0x3da5
movslq -0x4ec(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x9e8(%rbp)
callq 0x2030
movq %rax, -0x9e0(%rbp)
jmp 0x3b83
movq -0x9e0(%rbp), %rdi
movq -0x9e8(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x9e0(%rbp), %rdx
movq -0x630(%rbp), %rax
movslq -0x65c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movslq -0x4f4(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x9f8(%rbp)
callq 0x2030
movq %rax, -0x9f0(%rbp)
jmp 0x3be3
movq -0x9f0(%rbp), %rdi
movq -0x9f8(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0x9f0(%rbp), %rdx
movq -0x638(%rbp), %rax
movslq -0x65c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movslq -0x4fc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0xa08(%rbp)
callq 0x2030
movq %rax, -0xa00(%rbp)
jmp 0x3c43
movq -0xa00(%rbp), %rdi
movq -0xa08(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0xa00(%rbp), %rdx
movq -0x640(%rbp), %rax
movslq -0x65c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movslq -0x504(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0xa18(%rbp)
callq 0x2030
movq %rax, -0xa10(%rbp)
jmp 0x3ca3
movq -0xa10(%rbp), %rdi
movq -0xa18(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0xa10(%rbp), %rdx
movq -0x648(%rbp), %rax
movslq -0x65c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movslq -0x508(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0xa28(%rbp)
callq 0x2030
movq %rax, -0xa20(%rbp)
jmp 0x3d03
movq -0xa20(%rbp), %rdi
movq -0xa28(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0xa20(%rbp), %rdx
movq -0x650(%rbp), %rax
movslq -0x65c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movslq -0x50c(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0xa38(%rbp)
callq 0x2030
movq %rax, -0xa30(%rbp)
jmp 0x3d63
movq -0xa30(%rbp), %rdi
movq -0xa38(%rbp), %rdx
xorl %esi, %esi
callq 0x2110
movq -0xa30(%rbp), %rdx
movq -0x658(%rbp), %rax
movslq -0x65c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x65c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x65c(%rbp)
jmp 0x3b3f
movl $0x0, -0x660(%rbp)
movl -0x660(%rbp), %eax
cmpl -0x4f0(%rbp), %eax
jge 0x3ea0
movl $0x0, -0x664(%rbp)
movl -0x664(%rbp), %eax
cmpl -0x4ec(%rbp), %eax
jge 0x3e8a
movq -0x608(%rbp), %rax
movslq -0x664(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x3e53
leaq -0x4e0(%rbp), %rdi
addq $0x30, %rdi
movq -0x608(%rbp), %rax
movslq -0x664(%rbp), %rcx
movslq (%rax,%rcx,4), %rsi
callq 0x4ab0
movq %rax, %rdi
movslq -0x660(%rbp), %rsi
callq 0x4ad0
movsd 0xb1de(%rip), %xmm0     # 0xf008
addsd (%rax), %xmm0
callq 0x23e0
movq -0x630(%rbp), %rax
movslq -0x660(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x664(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x3e74
movq -0x630(%rbp), %rax
movslq -0x660(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x664(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x3e76
movl -0x664(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x664(%rbp)
jmp 0x3dcb
jmp 0x3e8c
movl -0x660(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x660(%rbp)
jmp 0x3daf
leaq -0x340(%rbp), %rdi
movq %rdi, -0xa48(%rbp)
leaq -0x140(%rbp), %rsi
callq 0x21a0
movq -0xa48(%rbp), %rdi
leaq 0xb57e(%rip), %rsi      # 0xf446
callq 0x23d0
movq -0x630(%rbp), %rax
movq %rax, -0xa40(%rbp)
leaq -0x680(%rbp), %rdi
leaq -0x4e0(%rbp), %rsi
callq 0x4af0
jmp 0x3ef0
movq -0xa40(%rbp), %rdi
movq -0x578(%rbp), %rdx
movl -0x4ec(%rbp), %r8d
movl -0x4f0(%rbp), %r9d
leaq -0x680(%rbp), %rsi
leaq -0x340(%rbp), %rcx
callq 0x6f20
jmp 0x3f21
leaq -0x680(%rbp), %rdi
callq 0x4be0
movl $0x0, -0x684(%rbp)
movl -0x684(%rbp), %eax
cmpl -0x4f0(%rbp), %eax
jge 0x3fa1
movq -0x630(%rbp), %rax
movslq -0x684(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x518(%rbp), %rsi
movl -0x4ec(%rbp), %edx
callq 0x7900
jmp 0x3f6b
jmp 0x3f6d
movl -0x684(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x684(%rbp)
jmp 0x3f37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x490(%rbp)
movl %eax, -0x494(%rbp)
leaq -0x680(%rbp), %rdi
callq 0x4be0
jmp 0x49fc
movq -0x630(%rbp), %rdi
movq -0x528(%rbp), %rsi
movq -0x530(%rbp), %rdx
movl -0x4ec(%rbp), %ecx
movl -0x4f0(%rbp), %r8d
callq 0x7b70
jmp 0x3fca
movq -0x630(%rbp), %rdi
movq -0x638(%rbp), %rsi
movq -0x520(%rbp), %rdx
movl -0x4ec(%rbp), %ecx
movl -0x4f4(%rbp), %r8d
movl -0x4f0(%rbp), %r9d
callq 0x7d00
jmp 0x3ffa
cmpl $0x1, -0x44c(%rbp)
je 0x417b
movq -0x638(%rbp), %rdi
movq -0x640(%rbp), %rsi
movq -0x548(%rbp), %rdx
movq -0x558(%rbp), %rcx
movl -0x4f8(%rbp), %r8d
movl -0x4fc(%rbp), %r9d
movl -0x4f0(%rbp), %r10d
movq %rsp, %rax
movl %r10d, (%rax)
callq 0x8490
jmp 0x4045
movq -0x638(%rbp), %rdi
movq -0x648(%rbp), %rsi
movq -0x5a8(%rbp), %rdx
movq -0x5d8(%rbp), %rcx
movl -0x4f8(%rbp), %r8d
movl -0x504(%rbp), %r9d
movl -0x4f0(%rbp), %r10d
movq %rsp, %rax
movl %r10d, (%rax)
callq 0x8490
jmp 0x4083
movq -0x638(%rbp), %rdi
movq -0x650(%rbp), %rsi
movq -0x5b8(%rbp), %rdx
movq -0x5e8(%rbp), %rcx
movl -0x4f8(%rbp), %r8d
movl -0x508(%rbp), %r9d
movl -0x4f0(%rbp), %r10d
movq %rsp, %rax
movl %r10d, (%rax)
callq 0x8490
jmp 0x40c1
movq -0x638(%rbp), %rdi
movq -0x658(%rbp), %rsi
movq -0x5c8(%rbp), %rdx
movq -0x5f8(%rbp), %rcx
movl -0x4f8(%rbp), %r8d
movl -0x50c(%rbp), %r9d
movl -0x4f0(%rbp), %r10d
movq %rsp, %rax
movl %r10d, (%rax)
callq 0x8490
jmp 0x40ff
movq -0x640(%rbp), %rdi
movq -0x648(%rbp), %rsi
movq -0x650(%rbp), %rdx
movq -0x658(%rbp), %rcx
movq -0x588(%rbp), %r8
movq -0x598(%rbp), %r9
movl -0x4fc(%rbp), %r10d
movl -0x4f0(%rbp), %r11d
movq %rsp, %rax
movl %r11d, 0x8(%rax)
movl %r10d, (%rax)
callq 0x8590
jmp 0x4148
movq 0x11e89(%rip), %rdi     # 0x15fd8
leaq 0xb2fb(%rip), %rsi      # 0xf451
callq 0x21c0
movq %rax, -0xa50(%rbp)
jmp 0x4164
movq -0xa50(%rbp), %rdi
movq 0x11e4e(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x4179
jmp 0x41ec
movq -0x638(%rbp), %rdi
movq -0x640(%rbp), %rsi
movq -0x548(%rbp), %rdx
movq -0x558(%rbp), %rcx
movl -0x4f8(%rbp), %r8d
movl -0x4fc(%rbp), %r9d
movl -0x4f0(%rbp), %r10d
movq %rsp, %rax
movl %r10d, (%rax)
callq 0x8490
jmp 0x41b9
movq 0x11e18(%rip), %rdi     # 0x15fd8
leaq 0xb2ab(%rip), %rsi      # 0xf472
callq 0x21c0
movq %rax, -0xa58(%rbp)
jmp 0x41d5
movq -0xa58(%rbp), %rdi
movq 0x11ddd(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x41ea
jmp 0x41ec
movq -0x640(%rbp), %rdi
movq -0x538(%rbp), %rsi
movq -0x540(%rbp), %rdx
movl -0x4fc(%rbp), %ecx
movl -0x4f0(%rbp), %r8d
callq 0x7c60
jmp 0x4215
movq 0x11dbc(%rip), %rdi     # 0x15fd8
leaq 0xb277(%rip), %rsi      # 0xf49a
callq 0x21c0
movq %rax, -0xa60(%rbp)
jmp 0x4231
movq -0xa60(%rbp), %rdi
movq 0x11d81(%rip), %rsi     # 0x15fc0
callq 0x2200
jmp 0x4246
movq -0x640(%rbp), %rax
movq %rax, -0xa70(%rbp)
movq -0x568(%rbp), %rax
movq %rax, -0xa68(%rbp)
leaq -0x6a0(%rbp), %rdi
leaq -0x4e0(%rbp), %rsi
callq 0x4af0
jmp 0x4277
movq -0xa68(%rbp), %rsi
movq -0xa70(%rbp), %rdi
movl -0x500(%rbp), %r8d
movl -0x4fc(%rbp), %r9d
movl -0x4f0(%rbp), %ecx
movl -0x444(%rbp), %edx
movsd -0x458(%rbp), %xmm0
movl -0x448(%rbp), %r10d
movq %rsp, %rax
movl %r10d, 0x10(%rax)
movl %edx, 0x8(%rax)
movl %ecx, (%rax)
leaq -0x6a0(%rbp), %rdx
leaq -0x240(%rbp), %rcx
callq 0x8730
movl %eax, -0xa74(%rbp)
jmp 0x42d5
leaq -0x6a0(%rbp), %rdi
callq 0x4be0
movl -0xa74(%rbp), %eax
cmpl $0x0, %eax
je 0x4325
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x498(%rbp)
jmp 0x49ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x490(%rbp)
movl %eax, -0x494(%rbp)
leaq -0x6a0(%rbp), %rdi
callq 0x4be0
jmp 0x49fc
leaq -0x6e8(%rbp), %rdi
leaq -0x4e0(%rbp), %rsi
callq 0x4c40
jmp 0x433a
leaq -0x6e8(%rbp), %rdi
callq 0x67d0
jmp 0x4348
leaq -0x6e8(%rbp), %rdi
callq 0x4ce0
movq -0x518(%rbp), %rax
movq %rax, -0xa80(%rbp)
cmpq $0x0, %rax
je 0x4374
movq -0xa80(%rbp), %rdi
callq 0x2260
movq -0x520(%rbp), %rax
movq %rax, -0xa88(%rbp)
cmpq $0x0, %rax
je 0x4394
movq -0xa88(%rbp), %rdi
callq 0x2260
movl $0x0, -0x6ec(%rbp)
movl -0x6ec(%rbp), %eax
cmpl -0x4f0(%rbp), %eax
jge 0x44eb
movq -0x630(%rbp), %rax
movslq -0x6ec(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa90(%rbp)
cmpq $0x0, %rax
je 0x43db
movq -0xa90(%rbp), %rdi
callq 0x2260
movq -0x638(%rbp), %rax
movslq -0x6ec(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa98(%rbp)
cmpq $0x0, %rax
je 0x4406
movq -0xa98(%rbp), %rdi
callq 0x2260
movq -0x640(%rbp), %rax
movslq -0x6ec(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xaa0(%rbp)
cmpq $0x0, %rax
je 0x4431
movq -0xaa0(%rbp), %rdi
callq 0x2260
movq -0x648(%rbp), %rax
movslq -0x6ec(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xaa8(%rbp)
cmpq $0x0, %rax
je 0x445c
movq -0xaa8(%rbp), %rdi
callq 0x2260
movq -0x650(%rbp), %rax
movslq -0x6ec(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xab0(%rbp)
cmpq $0x0, %rax
je 0x4487
movq -0xab0(%rbp), %rdi
callq 0x2260
movq -0x658(%rbp), %rax
movslq -0x6ec(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xab8(%rbp)
cmpq $0x0, %rax
je 0x44b2
movq -0xab8(%rbp), %rdi
callq 0x2260
jmp 0x44b4
movl -0x6ec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6ec(%rbp)
jmp 0x439e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x490(%rbp)
movl %eax, -0x494(%rbp)
leaq -0x6e8(%rbp), %rdi
callq 0x4ce0
jmp 0x49fc
movl $0x0, -0x6f0(%rbp)
movl -0x6f0(%rbp), %eax
cmpl -0x4f8(%rbp), %eax
jge 0x4675
movq -0x548(%rbp), %rax
movslq -0x6f0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xac0(%rbp)
cmpq $0x0, %rax
je 0x4532
movq -0xac0(%rbp), %rdi
callq 0x2260
movq -0x558(%rbp), %rax
movslq -0x6f0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xac8(%rbp)
cmpq $0x0, %rax
je 0x455d
movq -0xac8(%rbp), %rdi
callq 0x2260
movq -0x5a8(%rbp), %rax
movslq -0x6f0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xad0(%rbp)
cmpq $0x0, %rax
je 0x4588
movq -0xad0(%rbp), %rdi
callq 0x2260
movq -0x5b8(%rbp), %rax
movslq -0x6f0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xad8(%rbp)
cmpq $0x0, %rax
je 0x45b3
movq -0xad8(%rbp), %rdi
callq 0x2260
movq -0x5c8(%rbp), %rax
movslq -0x6f0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xae0(%rbp)
cmpq $0x0, %rax
je 0x45de
movq -0xae0(%rbp), %rdi
callq 0x2260
movq -0x5d8(%rbp), %rax
movslq -0x6f0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xae8(%rbp)
cmpq $0x0, %rax
je 0x4609
movq -0xae8(%rbp), %rdi
callq 0x2260
movq -0x5e8(%rbp), %rax
movslq -0x6f0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xaf0(%rbp)
cmpq $0x0, %rax
je 0x4634
movq -0xaf0(%rbp), %rdi
callq 0x2260
movq -0x5f8(%rbp), %rax
movslq -0x6f0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xaf8(%rbp)
cmpq $0x0, %rax
je 0x465f
movq -0xaf8(%rbp), %rdi
callq 0x2260
jmp 0x4661
movl -0x6f0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6f0(%rbp)
jmp 0x44f5
movl $0x0, -0x6f4(%rbp)
cmpl $0x3, -0x6f4(%rbp)
jge 0x46f1
movq -0x588(%rbp), %rax
movslq -0x6f4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb00(%rbp)
cmpq $0x0, %rax
je 0x46b3
movq -0xb00(%rbp), %rdi
callq 0x2260
movq -0x598(%rbp), %rax
movslq -0x6f4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb08(%rbp)
cmpq $0x0, %rax
je 0x46de
movq -0xb08(%rbp), %rdi
callq 0x2260
jmp 0x46e0
movl -0x6f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6f4(%rbp)
jmp 0x467f
movl $0x0, -0x6f8(%rbp)
movl -0x6f8(%rbp), %eax
cmpl -0x4ec(%rbp), %eax
jge 0x4747
movq -0x578(%rbp), %rax
movslq -0x6f8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb10(%rbp)
cmpq $0x0, %rax
je 0x4734
movq -0xb10(%rbp), %rdi
callq 0x2260
jmp 0x4736
movl -0x6f8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6f8(%rbp)
jmp 0x46fb
movl $0x0, -0x6fc(%rbp)
movl -0x6fc(%rbp), %eax
cmpl -0x4fc(%rbp), %eax
jge 0x479d
movq -0x568(%rbp), %rax
movslq -0x6fc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb18(%rbp)
cmpq $0x0, %rax
je 0x478a
movq -0xb18(%rbp), %rdi
callq 0x2260
jmp 0x478c
movl -0x6fc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6fc(%rbp)
jmp 0x4751
movq -0x630(%rbp), %rax
movq %rax, -0xb20(%rbp)
cmpq $0x0, %rax
je 0x47bd
movq -0xb20(%rbp), %rdi
callq 0x2260
movq -0x638(%rbp), %rax
movq %rax, -0xb28(%rbp)
cmpq $0x0, %rax
je 0x47dd
movq -0xb28(%rbp), %rdi
callq 0x2260
movq -0x640(%rbp), %rax
movq %rax, -0xb30(%rbp)
cmpq $0x0, %rax
je 0x47fd
movq -0xb30(%rbp), %rdi
callq 0x2260
movq -0x648(%rbp), %rax
movq %rax, -0xb38(%rbp)
cmpq $0x0, %rax
je 0x481d
movq -0xb38(%rbp), %rdi
callq 0x2260
movq -0x650(%rbp), %rax
movq %rax, -0xb40(%rbp)
cmpq $0x0, %rax
je 0x483d
movq -0xb40(%rbp), %rdi
callq 0x2260
movq -0x658(%rbp), %rax
movq %rax, -0xb48(%rbp)
cmpq $0x0, %rax
je 0x485d
movq -0xb48(%rbp), %rdi
callq 0x2260
movq -0x548(%rbp), %rax
movq %rax, -0xb50(%rbp)
cmpq $0x0, %rax
je 0x487d
movq -0xb50(%rbp), %rdi
callq 0x2260
movq -0x558(%rbp), %rax
movq %rax, -0xb58(%rbp)
cmpq $0x0, %rax
je 0x489d
movq -0xb58(%rbp), %rdi
callq 0x2260
movq -0x5a8(%rbp), %rax
movq %rax, -0xb60(%rbp)
cmpq $0x0, %rax
je 0x48bd
movq -0xb60(%rbp), %rdi
callq 0x2260
movq -0x5b8(%rbp), %rax
movq %rax, -0xb68(%rbp)
cmpq $0x0, %rax
je 0x48dd
movq -0xb68(%rbp), %rdi
callq 0x2260
movq -0x5c8(%rbp), %rax
movq %rax, -0xb70(%rbp)
cmpq $0x0, %rax
je 0x48fd
movq -0xb70(%rbp), %rdi
callq 0x2260
movq -0x5d8(%rbp), %rax
movq %rax, -0xb78(%rbp)
cmpq $0x0, %rax
je 0x491d
movq -0xb78(%rbp), %rdi
callq 0x2260
movq -0x5e8(%rbp), %rax
movq %rax, -0xb80(%rbp)
cmpq $0x0, %rax
je 0x493d
movq -0xb80(%rbp), %rdi
callq 0x2260
movq -0x5f8(%rbp), %rax
movq %rax, -0xb88(%rbp)
cmpq $0x0, %rax
je 0x495d
movq -0xb88(%rbp), %rdi
callq 0x2260
movq -0x578(%rbp), %rax
movq %rax, -0xb90(%rbp)
cmpq $0x0, %rax
je 0x497d
movq -0xb90(%rbp), %rdi
callq 0x2260
movq -0x568(%rbp), %rax
movq %rax, -0xb98(%rbp)
cmpq $0x0, %rax
je 0x499d
movq -0xb98(%rbp), %rdi
callq 0x2260
movq -0x588(%rbp), %rax
movq %rax, -0xba0(%rbp)
cmpq $0x0, %rax
je 0x49bd
movq -0xba0(%rbp), %rdi
callq 0x2260
movq -0x598(%rbp), %rax
movq %rax, -0xba8(%rbp)
cmpq $0x0, %rax
je 0x49dd
movq -0xba8(%rbp), %rdi
callq 0x2260
movl $0x0, -0x2c(%rbp)
movl $0x1, -0x498(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x4ce0
jmp 0x4a0a
leaq -0x4e0(%rbp), %rdi
callq 0x4ce0
jmp 0x4a2b
leaq -0x480(%rbp), %rdi
callq 0x2140
movl -0x2c(%rbp), %eax
addq $0xc18, %rsp            # imm = 0xC18
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x480(%rbp), %rdi
callq 0x2140
movq -0x490(%rbp), %rdi
callq 0x23b0
nopw %cs:(%rax,%rax)
nopl (%rax)