// File: /workspace/github_c_makefile_star2_O3/jiqingxiaoxi[P]RPA/single.c
// Function: main
void main(int argc, char **argv) 
{
	double stackEntropies[625],stackEnthalpies[625],stackint2Entropies[625],stackint2Enthalpies[625],dangleEntropies3[125],dangleEnthalpies3[125],dangleEntropies5[125],dangleEnthalpies5[125];
        double hairpinLoopEntropies[30],interiorLoopEntropies[30],bulgeLoopEntropies[30],hairpinLoopEnthalpies[30],interiorLoopEnthalpies[30],bulgeLoopEnthalpies[30],tstackEntropies[625],tstackEnthalpies[625],tstack2Entropies[625],tstack2Enthalpies[625];
        char *triloopEntropies1,*triloopEnthalpies1,*tetraloopEntropies1,*tetraloopEnthalpies1;
        double *triloopEntropies2,*triloopEnthalpies2,*tetraloopEntropies2,*tetraloopEnthalpies2,atpS[25],atpH[25];
	char *store_path,*prefix,*tm_path,*curren_path,*input,*par_path,*seq,*temp;
	FILE *fp,*Primer,*Probe;
	int i,flag[10],length,numTriloops,numTetraloops,Num[3];
	float deltah[16],deltas[16],temp1,temp2;
	struct stat statbuf;
//flag: 0:input; 1: out_prefix; 2: dir; 3: NoExo; 4: No secondary structure; 5: path for secondary structure
        time_t start,end;
	
	start=time(NULL);
//get input

	for(i=0;i<6;i++)
	{
		flag[i]=0;
	}
	flag[8]=1;

	for(i=1;i<argc;)
	{
		if(strcmp(argv[i],"-in")==0)
		{
			flag[0]=1;
			if(i+1==argc)
			{
				printf("Error! The \"-in\" parameter is not completed.\n");
				usage();
				exit(1);
			}
			length=strlen(argv[i+1]);
			input=(char *)malloc(length+1);
			memset(input,'\0',length+1);
			strcpy(input,argv[i+1]);
			i=i+2;
		}
		else if(strcmp(argv[i],"-out")==0)
		{
			flag[1]=1;
			if(i+1==argc)
                        {
                                printf("Error! The \"-out\" parameter is not completed.\n");
                                usage();
                                exit(1);
                        }
			length=strlen(argv[i+1]);
			prefix=(char *)malloc(length+1);
			memset(prefix,'\0',length+1);
			strcpy(prefix,argv[i+1]);
			i=i+2;
		}
                else if(strcmp(argv[i],"-dir")==0)
                {
			flag[2]=1;
			if(i+1==argc)
                        {
                                printf("Error! The \"-dir\" parameter is not completed.\n");
                                usage();
                                exit(1);
                        }
			length=strlen(argv[i+1]);
			if(argv[i+1][length-1]=='/')
			{
				store_path=(char *)malloc(length+1);
				memset(store_path,'\0',length+1);
                        	strcpy(store_path,argv[i+1]);
			}
			else
			{
				store_path=(char *)malloc(length+2);
                                memset(store_path,'\0',length+2);
                                strcpy(store_path,argv[i+1]);
				store_path[length]='/';
			}
			i=i+2;
                }
		else if(strcmp(argv[i],"-h")==0 || strcmp(argv[i],"-help")==0)
                {
                        usage();
                       	exit(1);
                }
		else if(strcmp(argv[i],"-NoExo")==0)
		{
			flag[3]=1;
			i++;
		}
		else if(strcmp(argv[i],"-NoCheck")==0)
		{
			flag[4]=1;
			i++;
		}
		else if(strcmp(argv[i],"-par")==0)
		{
			flag[5]=1;
			if(i+1==argc)
                        {
                                printf("Error! The \"-par\" parameter is not completed.\n");
                                usage();
                                exit(1);
                        }
			length=strlen(argv[i+1]);
			if(argv[i+1][length-1]=='/')
			{
				par_path=(char *)malloc(length+1);
				strcpy(par_path,argv[i+1]);
				par_path[length]='\0';
			}
			else
			{
				par_path=(char *)malloc(length+2);
                                strcpy(par_path,argv[i+1]);
                                par_path[length]='/';
				par_path[length+1]='\0';
			}
                        i=i+2;
                }
		else
		{
			printf("Error: don't have the parameter: %s\n",argv[i]);
			usage();
			exit(1);
		}
	}

//check paramters
	if(flag[0]==0)
	{
		printf("Error! Users must input the reference sequence file with -in!\n");
		usage();
		exit(1);
	}
	if(flag[1]==0)
	{
		printf("Error! Users must supply the prefix name for output file with -out!\n");
		usage();
		exit(1);
	}
	for(i=0;i<strlen(prefix);i++)
	{
		if(prefix[i]=='/')
		{
			printf("Error! the -out parameter couldn't contain any directory!\n");
			usage();
			exit(1);
		}
	}

//prepare 
	temp=(char *)malloc(4096);
	memset(temp,'\0',4096);
	getcwd(temp,4096);
	length=strlen(temp);
	curren_path=(char *)malloc(length+1);
	memset(curren_path,'\0',length+1);
	strcpy(curren_path,temp);
	if(flag[2]==0)
        {
                store_path=(char *)malloc(length+2);
                memset(store_path,'\0',length+2);
                strcpy(store_path,temp);
                store_path[length]='/';
        }
	free(temp);

	length=strlen(store_path)+strlen(prefix)+10;
	temp=(char *)malloc(length);
	memset(temp,'\0',length);
	strcpy(temp,store_path);
	strcat(temp,"Primer/");
	mkdir(temp,0755);
	strcat(temp,prefix);
	Primer=fopen(temp,"w");
	if(Primer==NULL)
	{
		printf("Error! Can't create the %s file!\n",temp);
		exit(1);
	}

	if(flag[3]==0)
	{
		memset(temp,'\0',length);       
        	strcpy(temp,store_path);      
        	strcat(temp,"Probe/");
		mkdir(temp,0755);
        	strcat(temp,prefix);
        	Probe=fopen(temp,"w");
        	if(Probe==NULL)
        	{
        	        printf("Error! Can't create the %s file!\n",temp);
        	        exit(1);       
        	}
	}
	free(temp);

	if(flag[5]==0)  
        {
                length=strlen(curren_path);
                par_path=(char *)malloc(length+10);
                memset(par_path,'\0',length+10);
                strcpy(par_path,curren_path);
                i=length-1;  
                if(par_path[i]!='/')
                {
                        par_path[i+1]='/';
                        par_path[i+2]='\0';
                }            
                strcat(par_path,"Par/");
        }
//tm parameter file
	tm_path=(char *)malloc(length+30);
	memset(tm_path,'\0',length+30);
	strcpy(tm_path,par_path);
	strcat(tm_path,"tm_nn_parameter.txt");

//secondary structure
	if((flag[4]==0)&&(flag[5]==0))
	{
		length=strlen(curren_path);
                par_path=(char *)malloc(length+10);
                memset(par_path,'\0',length+10);
                strcpy(par_path,curren_path);
                i=length-1;
                if(par_path[i]!='/')
                {
			par_path[i+1]='/';
                        par_path[i+2]='\0';
                }
                strcat(par_path,"Par/");
	}

	if(flag[4]==0)//check
	{
		getStack(stackEntropies,stackEnthalpies,par_path);
		getStackint2(stackint2Entropies,stackint2Enthalpies,par_path);
		getDangle(dangleEntropies3,dangleEnthalpies3,dangleEntropies5,dangleEnthalpies5,par_path);
		getLoop(hairpinLoopEntropies,interiorLoopEntropies,bulgeLoopEntropies,hairpinLoopEnthalpies,interiorLoopEnthalpies,bulgeLoopEnthalpies,par_path);
		getTstack(tstackEntropies,tstackEnthalpies,par_path);
		getTstack2(tstack2Entropies,tstack2Enthalpies,par_path);

		numTriloops=get_num_line(par_path,0);
		triloopEntropies1=(char *)malloc(numTriloops*5);
		triloopEnthalpies1=(char *)malloc(numTriloops*5);
		triloopEntropies2=(double *)malloc(numTriloops*sizeof(double));
		triloopEnthalpies2=(double *)malloc(numTriloops*sizeof(double));
		getTriloop(triloopEntropies1,triloopEnthalpies1,triloopEntropies2,triloopEnthalpies2,par_path);
        
		numTetraloops=get_num_line(par_path,1);
		tetraloopEntropies1=(char *)malloc(numTetraloops*6);
		tetraloopEnthalpies1=(char *)malloc(numTetraloops*6);
		tetraloopEntropies2=(double *)malloc(numTetraloops*sizeof(double));
		tetraloopEnthalpies2=(double *)malloc(numTetraloops*sizeof(double));
		getTetraloop(tetraloopEntropies1,tetraloopEnthalpies1,tetraloopEntropies2,tetraloopEnthalpies2,par_path);
		tableStartATS(6.9,atpS);
		tableStartATH(2200.0,atpH);
	}

//input reference sequence
	if(access(input,0)==-1)
	{
		printf("Error! Don't have the %s file.\n",input);
		exit(1);
	}
	stat(input,&statbuf);
	length=statbuf.st_size;
	length=length+100;
	temp=(char *)malloc(length);
	memset(temp,'\0',length);
	seq=(char *)malloc(length*sizeof(char));
	memset(seq,'\0',length*sizeof(char));

	fp=fopen(input,"r");   //open the sequence file
	if(fp==NULL)
	{
		printf("Error! can't open the %s file!\n",input);
		exit(1);
	}
	fread(temp,length*sizeof(char),1,fp);
        fclose(fp); 

        length=0;
        i=0;
        while(temp[i]!='\n')
        {
                i++;
        }
        i++;
        while(temp[i]!='\0')
        {
                if(temp[i]=='\n')
                {
                        i++;
                        continue;
                }
		if(temp[i]=='a'||temp[i]=='A')
	                seq[length]='A';
		else if(temp[i]=='t'||temp[i]=='T')
			seq[length]='T';
		else if(temp[i]=='c'||temp[i]=='C')
                        seq[length]='C';
		else if(temp[i]=='g'||temp[i]=='G')
                        seq[length]='G';
		else
			seq[length]='N';
                i++;
                length++;
        }
        free(temp);
	length=strlen(seq);

//input Tm parameter
	fp=fopen(tm_path,"r");  //read the paramter of deltah and deltas
	if(fp==NULL)
	{
		printf("Error: can't open the %s file!\n",tm_path);
		exit(1);
	}
	while(fscanf(fp,"%d\t%f\t%f",&i,&temp1,&temp2)!=EOF)
	{
		deltah[i]=temp1;
		deltas[i]=temp2;
	}
	fclose(fp);

	end=time(NULL);
	printf("It takes %d seconds to prepare.\n",(int)difftime(end,start));
	start=time(NULL);
	Num[0]=0; //primer
	Num[1]=0; //probe
	candidate_primer(seq,flag,Primer,Probe,Num,deltah,deltas,length,stackEntropies,stackEnthalpies,stackint2Entropies,stackint2Enthalpies,dangleEntropies3,dangleEnthalpies3,dangleEntropies5,dangleEnthalpies5,hairpinLoopEntropies,interiorLoopEntropies,bulgeLoopEntropies,hairpinLoopEnthalpies,interiorLoopEnthalpies,bulgeLoopEnthalpies,tstackEntropies,tstackEnthalpies,tstack2Entropies,tstack2Enthalpies,triloopEntropies1,triloopEnthalpies1,tetraloopEntropies1,tetraloopEnthalpies1,triloopEntropies2,triloopEnthalpies2,tetraloopEntropies2,tetraloopEnthalpies2,numTriloops,numTetraloops,atpS,atpH);
	free(seq);
	printf("There are %d candidate primers.\n",Num[0]);
	fclose(Primer);
	if(flag[3]==0)
	{
		printf("There are %d candidate exo probes.\n",Num[1]);
		fclose(Probe);
	}
	//check
	if(Num[0]<2)
		printf("Warning: there don't have enough primers(>=2).\n");
	if(flag[3]==0 && Num[1]<1)
		printf("Warning: there don't have any probes.\n");

	end=time(NULL);
        printf("It takes %d seconds to identify candidate single primer or probe regions.\n",(int)difftime(end,start));

	free(store_path);
	free(prefix);
	free(tm_path);
	free(curren_path);
	free(input);
	if(flag[4]==0)
	{
		free(triloopEntropies1);
	        free(triloopEnthalpies1);
	        free(tetraloopEntropies1);
	        free(tetraloopEnthalpies1);
	        free(triloopEntropies2);
	        free(triloopEnthalpies2);
	        free(tetraloopEntropies2);
	        free(tetraloopEnthalpies2);
	}
	if((flag[4]==0)||flag[5])
		free(par_path);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb598, %rsp           # imm = 0xB598
movq %rsi, %r14
movl %edi, %ebx
xorl %edi, %edi
callq 0x1170
movq %rax, -0x98(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x100(%rbp)
movq $0x0, -0xf0(%rbp)
movl $0x1, -0xe0(%rbp)
movl %ebx, -0x38(%rbp)
cmpl $0x2, %ebx
jl 0xb8fd
movq $0x0, -0x70(%rbp)
movl $0x1, %r15d
movabsq $0x100000000, %r13      # imm = 0x100000000
movl $0x0, -0x50(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x80(%rbp)
movq %r14, -0x68(%rbp)
movslq %r15d, %rax
movq (%r14,%rax,8), %rbx
movq %rbx, %rdi
leaq 0x170f(%rip), %rsi      # 0xc27f
callq 0x1130
testl %eax, %eax
je 0xac8c
movq %rbx, %rdi
leaq 0x16fc(%rip), %rsi      # 0xc283
callq 0x1130
testl %eax, %eax
je 0xacdf
movq %rbx, %rdi
leaq 0x16ea(%rip), %rsi      # 0xc288
callq 0x1130
testl %eax, %eax
je 0xad38
cmpb $0x2d, (%rbx)
jne 0xabc0
cmpb $0x68, 0x1(%rbx)
jne 0xabc0
cmpb $0x0, 0x2(%rbx)
je 0xb91b
movq %rbx, %rdi
leaq 0x16c3(%rip), %rsi      # 0xc28d
callq 0x1130
testl %eax, %eax
je 0xb91b
movq %rbx, %rdi
leaq 0x1a5e(%rip), %rsi      # 0xc63f
callq 0x1130
testl %eax, %eax
je 0xad96
movq %rbx, %rdi
leaq 0x1aa2(%rip), %rsi      # 0xc69a
callq 0x1130
testl %eax, %eax
je 0xadfc
movq %rbx, %rdi
leaq 0x1684(%rip), %rsi      # 0xc293
callq 0x1130
testl %eax, %eax
jne 0xb8e1
movq %r12, -0x58(%rbp)
leal 0x1(%r15), %eax
cmpl -0x38(%rbp), %eax
je 0xb8f4
cltq
movq (%r14,%rax,8), %rbx
movq %rbx, %rdi
callq 0x10c0
movq %rax, %r14
movslq %r14d, %r12
shlq $0x20, %r14
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %r14, %rax
sarq $0x20, %rax
cmpb $0x2f, (%rbx,%rax)
jne 0xae0c
addq %r13, %r14
sarq $0x20, %r14
movq %r14, %rdi
callq 0x1180
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1050
movq %r14, -0x90(%rbp)
addq %r14, %r12
jmp 0xae5f
leal 0x1(%r15), %eax
cmpl -0x38(%rbp), %eax
je 0xb8c6
cltq
movq (%r14,%rax,8), %rbx
movq %rbx, %rdi
callq 0x10c0
shlq $0x20, %rax
leaq (%rax,%r13), %rsi
sarq $0x20, %rsi
movl $0x1, %edi
callq 0x1120
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1050
addl $0x2, %r15d
movl %r15d, -0x2c(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0xae7b
leal 0x1(%r15), %eax
cmpl -0x38(%rbp), %eax
je 0xb8cf
cltq
movq (%r14,%rax,8), %rbx
movq %rbx, %rdi
callq 0x10c0
shlq $0x20, %rax
leaq (%rax,%r13), %rsi
sarq $0x20, %rsi
movl $0x1, %edi
callq 0x1120
movq %rax, -0xd0(%rbp)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1050
addl $0x2, %r15d
movl %r15d, -0x2c(%rbp)
movl $0x1, %eax
movq %rax, -0x70(%rbp)
jmp 0xae7b
leal 0x1(%r15), %eax
cmpl -0x38(%rbp), %eax
je 0xb8d8
cltq
movq (%r14,%rax,8), %rbx
movq %rbx, %rdi
callq 0x10c0
movq %rax, %r14
shlq $0x20, %r14
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %r14, %rax
sarq $0x20, %rax
cmpb $0x2f, (%rbx,%rax)
jne 0xada9
addq %r13, %r14
sarq $0x20, %r14
movl $0x1, %edi
movq %r14, %rsi
callq 0x1120
movq %rax, -0x78(%rbp)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1050
jmp 0xadeb
incl %r15d
movl %r15d, -0x2c(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0xae7b
movabsq $0x200000000, %rax      # imm = 0x200000000
leaq (%r14,%rax), %rsi
sarq $0x20, %rsi
movl $0x1, %edi
callq 0x1120
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1050
sarq $0x20, %r14
movq %r13, -0x78(%rbp)
movb $0x2f, (%r13,%r14)
movabsq $0x100000000, %r13      # imm = 0x100000000
addl $0x2, %r15d
movl %r15d, -0x2c(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xae77
incl %r15d
movl %r15d, -0x2c(%rbp)
movl $0x1, -0x60(%rbp)
jmp 0xae7b
movabsq $0x200000000, %rax      # imm = 0x200000000
leaq (%r14,%rax), %rdi
sarq $0x20, %rdi
callq 0x1180
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1050
movb $0x2f, (%r13,%r12)
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r14
sarq $0x20, %r14
movq %r13, -0x90(%rbp)
addq %r13, %r14
movabsq $0x100000000, %r13      # imm = 0x100000000
movq %r14, %r12
movb $0x0, (%r12)
addl $0x2, %r15d
movl %r15d, -0x2c(%rbp)
movl $0x1, -0x48(%rbp)
movq -0x58(%rbp), %r12
movq -0x68(%rbp), %r14
cmpl -0x38(%rbp), %r15d
jl 0xab5f
movl -0x48(%rbp), %eax
movl %eax, -0xec(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0xf0(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0xf4(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0xf8(%rbp)
movq -0x70(%rbp), %rax
movl %eax, -0xfc(%rbp)
movl -0x80(%rbp), %ecx
movl %ecx, -0x100(%rbp)
testl %ecx, %ecx
je 0xb8fd
testl %eax, %eax
movq -0xd0(%rbp), %r14
je 0xb90f
movq %r14, %rdi
callq 0x10c0
movl $0x0, -0x2c(%rbp)
testq %rax, %rax
je 0xaeff
xorl %ecx, %ecx
cmpb $0x2f, (%r14,%rcx)
je 0xb8bd
incq %rcx
movl %ecx, -0x2c(%rbp)
cmpq %rcx, %rax
jne 0xaee9
movq %r12, -0x58(%rbp)
movl $0x1, %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0x1120
movq %rax, %rbx
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rdi
callq 0x1100
movq %rbx, %rdi
callq 0x10c0
movq %rax, %r15
shlq $0x20, %r15
leaq (%r15,%r13), %rsi
sarq $0x20, %rsi
movl $0x1, %edi
callq 0x1120
movq %rax, -0x70(%rbp)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1050
cmpl $0x0, -0x50(%rbp)
jne 0xaf8e
movabsq $0x200000000, %rsi      # imm = 0x200000000
addq %r15, %rsi
sarq $0x20, %rsi
movl $0x1, %edi
callq 0x1120
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1050
sarq $0x20, %r15
movq %r12, -0x78(%rbp)
movb $0x2f, (%r12,%r15)
movq %rbx, %rdi
callq 0x1030
movq -0x78(%rbp), %r13
movq %r13, %rdi
callq 0x10c0
movq %rax, %rbx
movq %r14, %rdi
callq 0x10c0
addl %eax, %ebx
addl $0xa, %ebx
movslq %ebx, %r12
movl $0x1, %edi
movq %r12, %rsi
callq 0x1120
movq %rax, %r15
movq %rax, %rdi
movq %r13, %rsi
callq 0x1050
movq %r15, %rdi
callq 0x10c0
movabsq $0x2f72656d697250, %rcx # imm = 0x2F72656D697250
movq %rcx, (%r15,%rax)
movq %r15, %rdi
movl $0x1ed, %esi            # imm = 0x1ED
callq 0x1070
movq %r15, %rdi
movq %r14, %rsi
callq 0x11c0
leaq 0x12b8(%rip), %rsi      # 0xc2bd
movq %r15, %rdi
callq 0x11b0
testq %rax, %rax
je 0xb906
movq %rax, -0x118(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0xb08c
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x10f0
movq %r15, %rdi
movq -0x78(%rbp), %rsi
callq 0x1050
movq %r15, %rdi
callq 0x10c0
movl $0x626f7250, (%r15,%rax) # imm = 0x626F7250
movl $0x2f6562, 0x3(%r15,%rax) # imm = 0x2F6562
movq %r15, %rdi
movl $0x1ed, %esi            # imm = 0x1ED
callq 0x1070
movq %r15, %rdi
movq %r14, %rsi
callq 0x11c0
leaq 0x1249(%rip), %rsi      # 0xc2bd
movq %r15, %rdi
callq 0x11b0
movq %rax, -0x108(%rbp)
testq %rax, %rax
je 0xb906
movq %r15, %rdi
callq 0x1030
movl -0x48(%rbp), %r14d
testl %r14d, %r14d
movq -0x58(%rbp), %r15
movq -0x90(%rbp), %r12
movabsq $0x100000000, %r13      # imm = 0x100000000
jne 0xb130
movq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0x10c0
movq %rax, %rbx
movq %rax, %r14
shlq $0x20, %r14
movabsq $0xa00000000, %rsi      # imm = 0xA00000000
addq %r14, %rsi
sarq $0x20, %rsi
movl $0x1, %edi
callq 0x1120
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x1050
movslq %ebx, %rcx
leaq -0x1(%rcx), %rax
movl %eax, -0x2c(%rbp)
cmpb $0x2f, -0x1(%r12,%rcx)
je 0xb112
sarq $0x20, %r14
movb $0x2f, (%r12,%r14)
movb $0x0, 0x2(%r12,%rax)
movq %r12, %rdi
callq 0x10c0
movl $0x2f726150, (%r12,%rax) # imm = 0x2F726150
movb $0x0, 0x4(%r12,%rax)
movl -0x48(%rbp), %r14d
movq -0x58(%rbp), %r15
addl $0x1e, %ebx
movslq %ebx, %rsi
movl $0x1, %edi
callq 0x1120
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
callq 0x1050
movq %rbx, %rdi
callq 0x10c0
movupd 0x118a(%rip), %xmm0     # 0xc2e8
movupd %xmm0, (%rbx,%rax)
movq %rbx, -0x38(%rbp)
movl $0x747874, 0x10(%rbx,%rax) # imm = 0x747874
movl -0x60(%rbp), %eax
orl %eax, %r14d
je 0xb18c
testl %eax, %eax
je 0xb202
movq %rax, -0x48(%rbp)
movq %rax, -0x60(%rbp)
jmp 0xb421
movq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0x10c0
movq %rax, %rbx
movq %rax, %r14
shlq $0x20, %r14
movabsq $0xa00000000, %rsi      # imm = 0xA00000000
addq %r14, %rsi
sarq $0x20, %rsi
movl $0x1, %edi
callq 0x1120
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x1050
movslq %ebx, %rcx
leaq -0x1(%rcx), %rax
movl %eax, -0x2c(%rbp)
cmpb $0x2f, -0x1(%r12,%rcx)
je 0xb1ec
sarq $0x20, %r14
movb $0x2f, (%r12,%r14)
movb $0x0, 0x2(%r12,%rax)
movq %r12, %rdi
callq 0x10c0
movl $0x2f726150, (%r12,%rax) # imm = 0x2F726150
movb $0x0, 0x4(%r12,%rax)
leaq -0xb5c0(%rbp), %rdi
leaq -0xa230(%rbp), %rsi
movq %r12, %rdx
callq 0x14cd
leaq -0x8ea0(%rbp), %rdi
leaq -0x7b10(%rbp), %rsi
movq %r12, %rdx
callq 0x1889
leaq -0x1940(%rbp), %rdi
leaq -0x1550(%rbp), %rsi
leaq -0x1160(%rbp), %rdx
leaq -0xd70(%rbp), %rcx
movq %r12, %r8
callq 0x1c41
subq $0x8, %rsp
leaq -0x8f0(%rbp), %rdi
leaq -0x800(%rbp), %rsi
leaq -0x710(%rbp), %rdx
leaq -0x620(%rbp), %rcx
leaq -0x530(%rbp), %r8
leaq -0x440(%rbp), %r9
pushq %r12
callq 0x2231
addq $0x10, %rsp
leaq -0x6780(%rbp), %rdi
leaq -0x53f0(%rbp), %rsi
movq %r12, %rdx
callq 0x23db
leaq -0x4060(%rbp), %rdi
leaq -0x2cd0(%rbp), %rsi
movq %r12, %rdx
callq 0x2716
xorl %r14d, %r14d
movq %r12, %rdi
xorl %esi, %esi
callq 0x2a4d
movl %eax, %r15d
leal (%r15,%r15,4), %eax
movslq %eax, %rbx
movq %rbx, %rdi
callq 0x1180
movq %rax, -0x68(%rbp)
movq %rbx, %rdi
callq 0x1180
movq %rax, %r13
movq %r15, -0x48(%rbp)
movslq %r15d, %rbx
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x1180
movq %rax, %r15
movq %rbx, %rdi
callq 0x1180
movq -0x68(%rbp), %rdi
movq %r13, -0xb8(%rbp)
movq %r13, %rsi
movq %r15, -0xc8(%rbp)
movq %r15, %rdx
movq %rax, -0xc0(%rbp)
movq %rax, %rcx
movq %r12, %r8
callq 0x2b38
movq %r12, %rdi
movl $0x1, %esi
callq 0x2a4d
movl %eax, %r15d
leal (%r15,%r15), %eax
leal (%rax,%rax,2), %eax
movslq %eax, %rbx
movq %rbx, %rdi
callq 0x1180
movq %rax, -0x50(%rbp)
movq %rbx, %rdi
callq 0x1180
movq %rax, %r13
movq %r15, -0x60(%rbp)
movslq %r15d, %rbx
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x1180
movq %rax, %r15
movq %rbx, %rdi
callq 0x1180
movq -0x50(%rbp), %rdi
movq %r13, -0xa0(%rbp)
movq %r13, %rsi
movq %r15, -0xb0(%rbp)
movq %r15, %rdx
movq %rax, -0xa8(%rbp)
movq %rax, %rcx
movq %r12, %r8
callq 0x2e13
leaq -0x280(%rbp), %rax
movabsq $0x3da5fd7fe1796495, %rcx # imm = 0x3DA5FD7FE1796495
movq -0x58(%rbp), %r15
xorl %edx, %edx
movq %rcx, (%rax,%rdx,8)
incq %rdx
cmpq $0x5, %rdx
jne 0xb3bd
incq %r14
addq $0x28, %rax
cmpq $0x5, %r14
jne 0xb3bb
movabsq $0x401b99999999999a, %rax # imm = 0x401B99999999999A
movq %rax, -0x208(%rbp)
movq %rax, -0x268(%rbp)
leaq -0x350(%rbp), %rbx
movl $0xc8, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10f0
movabsq $0x40a1300000000000, %rax # imm = 0x40A1300000000000
movq %rax, 0x78(%rbx)
movq %rax, 0x18(%rbx)
movabsq $0x100000000, %r13      # imm = 0x100000000
movq %r12, -0x90(%rbp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x11a0
cmpl $-0x1, %eax
je 0xb92a
leaq -0x980(%rbp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1150
movl 0x30(%rbx), %eax
addl $0x64, %eax
movslq %eax, %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x1120
movq %rax, %r12
movl $0x1, %edi
movq %rbx, %rsi
callq 0x1120
movq %rax, -0x80(%rbp)
leaq 0xe18(%rip), %rsi       # 0xc296
movq %r15, %rdi
callq 0x11b0
testq %rax, %rax
je 0xb936
movq %rax, %r14
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rsi
movq %rax, %rcx
callq 0x1090
movq %r14, %rdi
callq 0x10b0
movq $-0x1, %rax
cmpb $0xa, 0x1(%r12,%rax)
leaq 0x1(%rax), %rax
jne 0xb4b4
xorl %ecx, %ecx
movq -0x80(%rbp), %rbx
shlq $0x20, %rax
addq %r13, %rax
sarq $0x20, %rax
movzbl (%r12,%rax), %edx
cmpl $0xa, %edx
jne 0xb4e0
incq %rax
jmp 0xb4d1
cmpl $0x53, %edx
jle 0xb4fb
cmpl $0x62, %edx
jle 0xb519
cmpl $0x63, %edx
je 0xb527
cmpl $0x67, %edx
je 0xb515
cmpl $0x74, %edx
je 0xb52b
jmp 0xb52f
cmpl $0x42, %edx
jg 0xb50b
testl %edx, %edx
je 0xb539
cmpl $0x41, %edx
je 0xb523
jmp 0xb52f
cmpl $0x43, %edx
je 0xb527
cmpl $0x47, %edx
jne 0xb52f
movb $0x47, %dl
jmp 0xb531
cmpl $0x54, %edx
je 0xb52b
cmpl $0x61, %edx
jne 0xb52f
movb $0x41, %dl
jmp 0xb531
movb $0x43, %dl
jmp 0xb531
movb $0x54, %dl
jmp 0xb531
movb $0x4e, %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0xb4c6
movl %eax, -0x2c(%rbp)
movq %r12, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x10c0
movq %rax, %r14
leaq 0xd40(%rip), %rsi       # 0xc296
movq -0x38(%rbp), %rdi
callq 0x11b0
testq %rax, %rax
je 0xb943
movq %rax, %rbx
movq %r14, -0x110(%rbp)
leaq 0xde3(%rip), %rsi       # 0xc35c
leaq -0x2c(%rbp), %rdx
leaq -0x88(%rbp), %rcx
leaq -0x84(%rbp), %r8
movq %rax, %rdi
xorl %eax, %eax
callq 0x1060
cmpl $-0x1, %eax
je 0xb5f4
leaq 0xdbb(%rip), %r14       # 0xc35c
leaq -0x2c(%rbp), %r13
leaq -0x88(%rbp), %r12
leaq -0x84(%rbp), %r15
movss -0x88(%rbp), %xmm0
movslq -0x2c(%rbp), %rax
movss %xmm0, -0x1b0(%rbp,%rax,4)
movss -0x84(%rbp), %xmm0
movss %xmm0, -0x170(%rbp,%rax,4)
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x1060
cmpl $-0x1, %eax
jne 0xb5b3
movq %rbx, %rdi
callq 0x10b0
xorl %edi, %edi
callq 0x1170
movq %rax, %rdi
movq -0x98(%rbp), %rsi
callq 0x10e0
cvttsd2si %xmm0, %esi
leaq 0xd48(%rip), %rdi       # 0xc365
xorl %eax, %eax
callq 0x10d0
xorl %edi, %edi
callq 0x1170
movq %rax, -0x98(%rbp)
leaq -0x124(%rbp), %r13
movq $0x0, (%r13)
leaq -0x350(%rbp), %rax
leaq -0x280(%rbp), %r10
leaq -0x4060(%rbp), %r11
leaq -0x440(%rbp), %r12
leaq -0x100(%rbp), %rsi
leaq -0x1b0(%rbp), %r9
movq -0x80(%rbp), %r14
movq %r14, %rdi
movq -0x118(%rbp), %rbx
movq %rbx, %rdx
movq -0x108(%rbp), %r15
movq %r15, %rcx
movq %r13, %r8
pushq %rax
pushq %r10
pushq -0x60(%rbp)
pushq -0x48(%rbp)
pushq -0xa8(%rbp)
pushq -0xb0(%rbp)
pushq -0xc0(%rbp)
pushq -0xc8(%rbp)
pushq -0xa0(%rbp)
pushq -0x50(%rbp)
pushq -0xb8(%rbp)
pushq -0x68(%rbp)
leaq -0x2cd0(%rbp), %rax
pushq %rax
pushq %r11
leaq -0x53f0(%rbp), %rax
pushq %rax
leaq -0x6780(%rbp), %rax
pushq %rax
pushq %r12
leaq -0x530(%rbp), %rax
pushq %rax
leaq -0x620(%rbp), %rax
pushq %rax
leaq -0x710(%rbp), %rax
pushq %rax
leaq -0x800(%rbp), %rax
pushq %rax
leaq -0x8f0(%rbp), %rax
pushq %rax
leaq -0xd70(%rbp), %rax
pushq %rax
leaq -0x1160(%rbp), %rax
pushq %rax
leaq -0x1550(%rbp), %rax
pushq %rax
leaq -0x1940(%rbp), %rax
pushq %rax
leaq -0x7b10(%rbp), %rax
pushq %rax
leaq -0x8ea0(%rbp), %rax
pushq %rax
leaq -0xa230(%rbp), %rax
pushq %rax
leaq -0xb5c0(%rbp), %rax
pushq %rax
pushq -0x110(%rbp)
leaq -0x170(%rbp), %rax
pushq %rax
callq 0x99d6
addq $0x100, %rsp            # imm = 0x100
movq %r14, %rdi
callq 0x1030
movl (%r13), %r14d
leaq 0xc19(%rip), %rdi       # 0xc386
movl %r14d, %esi
xorl %eax, %eax
callq 0x10d0
movq %rbx, %rdi
callq 0x10b0
movl -0x3c(%rbp), %r12d
testl %r12d, %r12d
jne 0xb7a4
movl -0x120(%rbp), %esi
leaq 0xc12(%rip), %rdi       # 0xc3a7
xorl %eax, %eax
callq 0x10d0
movq %r15, %rdi
callq 0x10b0
cmpl $0x1, %r14d
movq -0x58(%rbp), %rbx
movq -0xd0(%rbp), %r14
movq -0x90(%rbp), %r15
jg 0xb7c8
leaq 0xfe2(%rip), %rdi       # 0xc7a5
callq 0x1080
testl %r12d, %r12d
jne 0xb7e2
cmpl $0x0, -0x120(%rbp)
jg 0xb7e2
leaq 0xff7(%rip), %rdi       # 0xc7d4
callq 0x1080
xorl %edi, %edi
callq 0x1170
movq %rax, %rdi
movq -0x98(%rbp), %rsi
callq 0x10e0
cvttsd2si %xmm0, %esi
leaq 0xbc8(%rip), %rdi       # 0xc3cb
xorl %eax, %eax
callq 0x10d0
movq -0x78(%rbp), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
movq -0x38(%rbp), %rdi
callq 0x1030
movq -0x70(%rbp), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
cmpl $0x0, -0xf0(%rbp)
je 0xb849
cmpl $0x0, -0xec(%rbp)
jne 0xb8a3
jmp 0xb8ab
movq -0x68(%rbp), %rdi
callq 0x1030
movq -0xb8(%rbp), %rdi
callq 0x1030
movq -0x50(%rbp), %rdi
callq 0x1030
movq -0xa0(%rbp), %rdi
callq 0x1030
movq -0xc8(%rbp), %rdi
callq 0x1030
movq -0xc0(%rbp), %rdi
callq 0x1030
movq -0xb0(%rbp), %rdi
callq 0x1030
movq -0xa8(%rbp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
addq $0xb598, %rsp           # imm = 0xB598
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf36(%rip), %rdi       # 0xc7fa
jmp 0xb916
leaq 0x1073(%rip), %rdi      # 0xc940
jmp 0xb916
leaq 0x103c(%rip), %rdi      # 0xc912
jmp 0xb916
leaq 0x1005(%rip), %rdi      # 0xc8e4
jmp 0xb916
leaq 0x9b0(%rip), %rdi       # 0xc298
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10d0
jmp 0xb91b
leaq 0xfbb(%rip), %rdi       # 0xc8b6
jmp 0xb916
leaq 0xf74(%rip), %rdi       # 0xc878
jmp 0xb916
leaq 0x9b2(%rip), %rdi       # 0xc2bf
jmp 0xb931
leaq 0xf1e(%rip), %rdi       # 0xc834
callq 0x1080
callq 0xa9cb
movl $0x1, %edi
callq 0x11d0
leaq 0x9cb(%rip), %rdi       # 0xc2fc
movq %r15, %rsi
jmp 0xb94e
leaq 0x9df(%rip), %rdi       # 0xc31c
movq -0x58(%rbp), %rsi
jmp 0xb94e
leaq 0x9f2(%rip), %rdi       # 0xc33c
movq -0x38(%rbp), %rsi
xorl %eax, %eax
callq 0x10d0
jmp 0xb920