// File: /workspace/github_c_makefile_star2_O3/ugobas[P]tnm/read.c
// Function: Read_coord
int Read_coord(char *pdb_name, int *nmr,
	       struct residue *seq, atom *atoms,
	       char *chain_to_read, int *ANISOU, float *TEMP)
{
  /* Open file */
  int Compression;
  FILE *file_in=Open_compressed_file(pdb_name, &Compression);
  if(file_in==NULL)return(0);

  int N_res=0, n_exo=0, start=0;
  char string[200];
  atom *atom_ptr=atoms, *first_atom=atoms;

  short i_atom=0, alternative=0;
  int hetatm=0, hetatm_old=0;
  int i, j, res_num, res_num_old=10000;
  char altloc, altloc_sel=' ';
  char chain_old='\0', chain=' ';
  char res_type[5], res_type_old[5], icode=' ', icode_old='U';
  float x, y, z;
  int nchains=0, ic, ichain=0, ini_chain=0, *rchain=NULL, readall=0;
  char *chain_pdb=CHAIN_CODE;

  n_atom=0;
  if(HYD)printf("Considering hydrogen atoms\n");

  // Count chains to read
  if(chain_to_read[0]=='*'){
    readall=1;
     printf("Reading atoms in all chains\n");
  }else{
    i=0;
    while(chain_to_read[i]!='\0')i++;
    nchains=i; 
    if(nchains==0)nchains=1;
    rchain=(int *)malloc(nchains*sizeof(int));
    for(i=0; i<nchains; i++)rchain[i]=0;
    printf("%d chains to read\n", nchains);
  }
  
  *nmr=0;
  strcpy(res_type_old,"xxx");
  while(fgets(string, sizeof(string), file_in)!=NULL){
    if(strncmp(string,"ATOM", 4)==0){
      /* Standard residue or DNA basis */
      hetatm=0;
      if(ini_chain==0)ini_chain=1; 	 
    }else if(strncmp(string,"HETATM", 6)==0){
      if(ini_chain==0)continue;
      hetatm=1;
      /* Cofactor or exotic residue */
      }else if(TEMP && strncmp(string,"REMARK 200", 10)==0){
      char word1[40], word2[40], word3[40], word4[40];
      sscanf(string+12, "%s%s%s%s", word1, word2, word3, word4);
      if((strncmp(word1,"TEMPERATURE", 11)==0)&&
	 (strncmp(word4,"NULL", 4)!=0)){
	sscanf(word4, "%f", TEMP);
	if(strncmp(word2,"(KELVIN)", 8)!=0){*TEMP+=273;}
	}
      continue;
    }else if(strncmp(string,"EXPDTA", 6)==0){
      char word1[80], word2[80];
      sscanf(string+8, "%s%s", word1, word2);
      if(strncmp(word1, "NMR", 3)==0){*nmr=1;}
      else if(strncmp(word2, "NMR", 3)==0){*nmr=1;}
      continue;
      /* NMR structure */
    }else if((strncmp(string,"TER",3)==0)&&(N_res>0)){
      chain_pdb++;
      //printf("-NR- |%3d|%c|%c|\n",N_res,chain_old,chain);
      Next_residue(&N_res, &start, seq, first_atom, &i_atom,
		   res_type_old, &res_num_old, &icode_old,
		   &chain_old, &hetatm_old, n_exo,
		   res_type, res_num, icode, chain, hetatm);
      ini_chain=0;
      continue;
    }else if(strncmp(string,"MODRES", 6)==0){
      res_exo[n_exo][0]=string[12]; res_std[n_exo][0]=string[24];
      res_exo[n_exo][1]=string[13]; res_std[n_exo][1]=string[25];
      res_exo[n_exo][2]=string[14]; res_std[n_exo][2]=string[26];
      for(j=0; j<n_exo; j++){
	if(strncmp(res_exo[j],res_exo[n_exo],3)==0)break;
      }
      if(j==n_exo)n_exo++;
      continue;
    }else if(strncmp(string,"ENDMDL", 6)==0){
      break;                                    /* end model */
    }else if(strncmp(string,"ANISOU", 6)==0){
      // Anisotropic structure factor
      int i, j;
      if(*ANISOU==0)*ANISOU=1;
      //for(i=0; i<3; i++)atom_ptr->anisou[i]=malloc(3*sizeof(float));
      sscanf(string+28, "%f %f %f %f %f %f",
	     &(atom_ptr->anisou[0][0]), &(atom_ptr->anisou[1][1]),
	     &(atom_ptr->anisou[2][2]), &(atom_ptr->anisou[0][1]),
	     &(atom_ptr->anisou[0][2]), &(atom_ptr->anisou[1][2]));
      for(i=0; i<3; i++)
	{for(j=i; j<3; j++)
	    {atom_ptr->anisou[i][j]*=0.0001;
	      if(j!=i)atom_ptr->anisou[j][i]=atom_ptr->anisou[i][j];
	    }
	}
      // Check
      //for(i=0; i<3; i++)B+=aniso[i][i]; B*=26.319; // 8pi^2/2
      //printf("B= %.2f %.2f %d\n", atom_ptr->B_factor, B, n_atom);
      continue;
      /* }else if(strncmp(string,"HELIX ", 6)==0){
	 Read_sec_str(string, chain, 'H'); continue;
	 }else if(strncmp(string,"SHEET ", 6)==0){
	 Read_sec_str(string, chain, 'E'); continue;
	 }else if(strncmp(string,"TURN ", 5)==0){
	 Read_sec_str(string, chain, 'T'); continue;
	 }*/
    }else{
      continue;
    }

    chain=string[21];
    if(chain==' ')chain=*chain_pdb;
    if(readall)
    	{if(chain!=chain_old)
	    {printf("Reading chain %c\n", chain);
	      chain_to_read[nchains]=chain; nchains++; chain_old=chain;
	    }
    	}
    else
      {if((chain_to_read[0]==' ')||(chain_to_read[0]=='\0'))
	  {chain_to_read[0]=chain; chain_to_read[1]='\0';
	  }
	for(ic=0; ic<nchains; ic++)
	  {if(chain==chain_to_read[ic])
	      {rchain[ic]=1; goto read;}
	  }
	continue;
      }
    
    /*if(*chain_to_read!='*'){
      if((*chain_to_read==' ')||(*chain_to_read=='\0'))*chain_to_read=chain;
      for(ic=0; ic<nchains; ic++)if(chain==chain_to_read[ic])goto read;
      continue;
      }*/
    
   
  read:
    // Hydrogen atoms
    if((string[13]=='H')||(string[12]=='H') || (string[13]=='D') ||(string[12]=='D'))
    	{if(HYD==0){continue;}   // Omit hydrogen
      	 else if((string[13]=='H')&&(string[12]!=' '))
      	 	{// if name 1HB1 change to HB11
		  	 char c=string[12];
			 if((c=='1')||(c=='2')||(c=='3'))
			 	{string[12]='H'; string[13]=string[14];
	  			 string[14]=string[15]; string[15]=c; 
				}
      		}
    	}
  
    /* Read residue; check if water molecule */
    res_type[0]=string[17]; res_type[1]=string[18]; res_type[2]=string[19];
    res_type[3]='\0';
    if((hetatm==1)&&((strncmp(res_type,"HOH",3)==0)||(strncmp(res_type,"DOD",3)==0)))continue;

    icode=string[26]; string[26]=' ';

    /* Read coordinates */
    sscanf(&string[22],"%d %f %f %f", &res_num, &x, &y, &z); //modyves

    /* Check if alternative conformation */
    if((string[72]=='A')&&(string[73]=='L')&&(string[74]=='T')&&(string[75]!='1')&&(string[75]!=' '))continue;

    altloc=string[16];
    if(altloc!=' '){
      if(altloc_sel==' ')altloc_sel=altloc;
      if(altloc!=altloc_sel)continue;
    }

    if((icode!=icode_old)&&(res_num==res_num_old)){
      if(alternative==1){
	continue;
      }else{
	atom *atom_old=first_atom;
	float dx, dy, dz;
	dx=x-atom_old->r[0]; dy=y-atom_old->r[1]; dz=z-atom_old->r[2];
	if((dx*dx+dy*dy+dz*dz)<.5){alternative=1; continue;}
      }
    }

    /* New residue */
    if((res_num!=res_num_old)||(icode!=icode_old)||
       (strncmp(res_type, res_type_old, 3)!=0)){
      Next_residue(&N_res, &start, seq, first_atom, &i_atom,
		   res_type_old, &res_num_old, &icode_old,
		   &chain_old, &hetatm_old, n_exo,
		   res_type, res_num, icode, chain, hetatm);
    }
    atom_ptr=atoms+n_atom;

    if(i_atom==0)first_atom=atom_ptr;
    i_atom++;
    n_atom++;
    atom_ptr->r[0] = x;
    atom_ptr->r[1] = y;
    atom_ptr->r[2] = z;
    
    // Copy name
    if(string[12]!=' ')
    	{ // Hydrogen atoms
      	 if(strncmp(string+12, "SE", 2)==0)
      	 	{// Selenium in Seleniomethionine is at delta position
			 string[13]='D';
      		}
      	 for(ic=0; ic<3; ic++)atom_ptr->name[ic]=string[12+ic];
    	}
    else if(string[13]!=' ')
     	{for(ic=0; ic<3; ic++)atom_ptr->name[ic]=string[13+ic];
   		}
    else
    	{for(ic=0; ic<3; ic++)atom_ptr->name[ic]=string[14+ic];
    	}
    atom_ptr->name[3]='\0';
    
    if(string[62]!=' ')
    	{sscanf(string+60, "%f", &atom_ptr->B_factor);
     	}
     else
     	{atom_ptr->B_factor=0;
    	}
    if(string[60]!=' ')string[60]=' ';
    if(string[56]!=' ')
    	{sscanf(string+54, "%f", &atom_ptr->occupancy);
    	}
    else
    	{atom_ptr->occupancy=0;
    	}

    atom_ptr->chain=ichain;
  }
  Next_residue(&N_res, &start, seq, first_atom, &i_atom,
	       res_type_old, &res_num_old, &icode_old,
	       &chain_old, &hetatm_old, n_exo,
	       res_type, res_num, icode, chain, hetatm);
	       
  if(N_res > L_MAX)
  	{printf("\n ERROR, more than %d residues found\n", L_MAX); exit(8);
  	}
  fclose(file_in);
  printf("Reading %3d residues in %d chains: %s\n",N_res, nchains, chain_to_read);
  chain_to_read[nchains]='\0';
  
  
  if(readall==0){free(rchain);rchain=NULL;} //modyves: this was never freed
  if(Compression)Delete_tmp_file();
  return(N_res);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2f8, %rsp            # imm = 0x2F8
movq %r9, 0x98(%rsp)
movq %r8, %rbx
movq %rcx, 0x80(%rsp)
movq %rdx, 0x88(%rsp)
movq %rsi, 0xa0(%rsp)
leaq 0x94(%rsp), %rsi
callq 0xe1e3
testq %rax, %rax
je 0xd101
movq %rax, %r14
xorl %eax, %eax
movl %eax, 0x24(%rsp)
movl %eax, 0x54(%rsp)
movw $0x0, 0xc(%rsp)
movl %eax, 0x50(%rsp)
movl $0x2710, 0x20(%rsp)     # imm = 0x2710
movb $0x0, 0x6(%rsp)
movb $0x55, 0x7(%rsp)
movl %eax, 0x5ceb8(%rip)     # 0x69f78
leaq 0x5bf99(%rip), %rcx     # 0x69060
cmpl %eax, (%rcx)
je 0xd0d7
leaq 0x48ed5(%rip), %rdi     # 0x55fa7
callq 0x2090
movb (%rbx), %al
movb %al, 0xe(%rsp)
cmpb $0x2a, %al
jne 0xd108
leaq 0x48eda(%rip), %rdi     # 0x55fc2
callq 0x2090
movq $0x0, 0x58(%rsp)
movq $0x0, 0x78(%rsp)
jmp 0xd16a
xorl %ebp, %ebp
jmp 0xdc76
movq $-0x1, %r15
cmpb $0x0, 0x1(%rbx,%r15)
leaq 0x1(%r15), %r15
jne 0xd10f
cmpl $0x2, %r15d
movl $0x1, %r12d
cmovael %r15d, %r12d
leaq (,%r12,4), %rdi
callq 0x21e0
cmpq $0x1, %r15
adcq $0x0, %r15
shlq $0x2, %r15
movq %rax, 0x78(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x2110
leaq 0x48bef(%rip), %rdi     # 0x55d4a
movq %r12, 0x58(%rsp)
movl %r12d, %esi
xorl %eax, %eax
callq 0x20f0
movq 0xa0(%rsp), %rax
movl $0x0, (%rax)
movl $0x787878, 0x44(%rsp)   # imm = 0x787878
leaq 0xb0(%rsp), %rdi
movl $0xc8, %esi
movq %r14, %rdx
callq 0x2170
testq %rax, %rax
movq %r14, 0x28(%rsp)
je 0xdb62
movb $0x20, 0x5(%rsp)
leaq 0x5cd01(%rip), %rax     # 0x69eb0
movq %rax, 0xa8(%rsp)
movb $0x20, %r15b
movq $0x0, 0x30(%rsp)
movq 0x80(%rsp), %rax
movq %rax, %r12
movq %rax, 0x38(%rsp)
movl $0x0, 0x8(%rsp)
xorl %edx, %edx
movb $0x20, %al
movl %eax, 0x14(%rsp)
movq $0x0, 0x18(%rsp)
movl 0xb0(%rsp), %ebp
movl $0x0, %r13d
cmpl $0x4d4f5441, %ebp       # imm = 0x4D4F5441
movq %rdx, 0x70(%rsp)
jne 0xd264
movb 0xc5(%rsp), %r15b
cmpb $0x20, %r15b
jne 0xd21f
movq 0xa8(%rsp), %rax
movb (%rax), %r15b
cmpb $0x2a, 0xe(%rsp)
jne 0xd381
cmpb 0x6(%rsp), %r15b
je 0xd3dd
movsbl %r15b, %esi
leaq 0x48b68(%rip), %rdi     # 0x55da8
xorl %eax, %eax
callq 0x20f0
movq 0x58(%rsp), %rcx
movslq %ecx, %rax
movb %r15b, (%rbx,%rax)
incl %ecx
movq %rcx, 0x58(%rsp)
movb %r15b, 0x6(%rsp)
jmp 0xd3dd
movl 0xb0(%rsp), %eax
movl $0x41544548, %ecx       # imm = 0x41544548
xorl %ecx, %eax
movzwl 0xb4(%rsp), %ecx
xorl $0x4d54, %ecx           # imm = 0x4D54
orl %eax, %ecx
je 0xd3b3
cmpq $0x0, 0x330(%rsp)
je 0xd2c0
movq 0xb0(%rsp), %rax
movabsq $0x32204b52414d4552, %rcx # imm = 0x32204B52414D4552
xorq %rcx, %rax
movzwl 0xb8(%rsp), %ecx
xorq $0x3030, %rcx           # imm = 0x3030
orq %rax, %rcx
je 0xd6fd
movl 0xb0(%rsp), %eax
movl $0x44505845, %ecx       # imm = 0x44505845
xorl %ecx, %eax
movzwl 0xb4(%rsp), %ecx
xorl $0x4154, %ecx           # imm = 0x4154
orl %eax, %ecx
je 0xd562
movl 0xb0(%rsp), %eax
movl $0x4554, %ecx           # imm = 0x4554
xorl %ecx, %eax
movzbl 0xb2(%rsp), %ecx
xorl $0x52, %ecx
orw %ax, %cx
jne 0xd5db
cmpl $0x0, 0x24(%rsp)
jle 0xd5db
incq 0xa8(%rsp)
movl 0x4c(%rsp), %eax
movsbl %r15b, %r10d
movsbl 0x5(%rsp), %r11d
leaq 0x24(%rsp), %rdi
leaq 0x54(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0xc(%rsp), %r8
leaq 0x44(%rsp), %r9
pushq 0x18(%rsp)
pushq %r10
pushq %r11
pushq %rax
leaq 0x2f(%rsp), %rax
pushq %rax
pushq 0x58(%rsp)
leaq 0x80(%rsp), %rax
pushq %rax
leaq 0x3e(%rsp), %rax
pushq %rax
leaq 0x47(%rsp), %rax
pushq %rax
leaq 0x68(%rsp), %rax
pushq %rax
callq 0xe2ab
addq $0x50, %rsp
jmp 0xd3c4
movzbl (%rbx), %eax
testb $-0x21, %al
jne 0xd38f
movb %r15b, (%rbx)
movb $0x0, 0x1(%rbx)
movq 0x58(%rsp), %rax
testl %eax, %eax
jle 0xd526
movl %eax, %eax
xorl %ecx, %ecx
cmpb (%rbx,%rcx), %r15b
je 0xd3d1
incq %rcx
cmpq %rcx, %rax
jne 0xd3a0
jmp 0xd526
movl $0x1, %r13d
cmpl $0x0, 0x8(%rsp)
jne 0xd206
movl $0x0, 0x8(%rsp)
jmp 0xdb3d
movq 0x78(%rsp), %rax
movl $0x1, (%rax,%rcx,4)
movb 0xbc(%rsp), %al
movb 0xbd(%rsp), %cl
cmpb $0x48, %cl
sete %dl
cmpb $0x48, %al
sete %sil
orb %dl, %sil
cmpb $0x44, %cl
sete %dl
cmpb $0x44, %al
sete %dil
orb %dl, %dil
orb %sil, %dil
cmpb $0x1, %dil
jne 0xd457
leaq 0x5bc47(%rip), %rdx     # 0x69060
cmpl $0x0, (%rdx)
je 0xd526
cmpb $0x48, %cl
sete %cl
leal -0x31(%rax), %edx
cmpb $0x3, %dl
setb %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xd457
movb $0x48, 0xbc(%rsp)
movzwl 0xbe(%rsp), %ecx
movw %cx, 0xbd(%rsp)
movb %al, 0xbf(%rsp)
movb 0xc1(%rsp), %al
movb %al, 0xf(%rsp)
movzwl 0xc2(%rsp), %eax
movw %ax, 0x10(%rsp)
movb $0x0, 0x12(%rsp)
cmpl $0x4d4f5441, %ebp       # imm = 0x4D4F5441
je 0xd4bc
movzwl 0xf(%rsp), %eax
xorl $0x4f48, %eax           # imm = 0x4F48
movzbl 0x11(%rsp), %ecx
xorl $0x48, %ecx
movl $0x1, %edx
movq %rdx, 0x18(%rsp)
orw %ax, %cx
je 0xd555
movzwl 0xf(%rsp), %eax
xorl $0x4f44, %eax           # imm = 0x4F44
movzbl 0x11(%rsp), %ecx
xorl $0x44, %ecx
orw %ax, %cx
je 0xd555
movb 0xca(%rsp), %al
movb %al, 0x5(%rsp)
movb $0x20, 0xca(%rsp)
leaq 0xc6(%rsp), %rdi
leaq 0x4880d(%rip), %rsi     # 0x55ceb
leaq 0x4c(%rsp), %rdx
leaq 0x6c(%rsp), %rcx
leaq 0x68(%rsp), %r8
leaq 0x64(%rsp), %r9
xorl %eax, %eax
callq 0x2200
cmpb $0x41, 0xf8(%rsp)
jne 0xd538
cmpb $0x4c, 0xf9(%rsp)
jne 0xd538
cmpb $0x54, 0xfa(%rsp)
jne 0xd538
movb 0xfb(%rsp), %al
cmpb $0x31, %al
je 0xd538
cmpb $0x20, %al
je 0xd538
movl $0x1, 0x8(%rsp)
movq %r13, 0x18(%rsp)
jmp 0xdb3d
movb 0xc0(%rsp), %bpl
cmpb $0x20, %bpl
jne 0xd7ca
movl 0x14(%rsp), %eax
movl %eax, %ebp
jmp 0xd7e0
movl $0x1, 0x8(%rsp)
jmp 0xdb3d
leaq 0xb8(%rsp), %rdi
leaq 0x487fb(%rip), %rsi     # 0x55d6c
leaq 0x200(%rsp), %rdx
leaq 0x1b0(%rsp), %rcx
xorl %eax, %eax
callq 0x2200
movl 0x200(%rsp), %eax
movl $0x4d4e, %ecx           # imm = 0x4D4E
xorl %ecx, %eax
movzbl 0x202(%rsp), %ecx
xorl $0x52, %ecx
orw %ax, %cx
je 0xd5c8
movl 0x1b0(%rsp), %eax
movl $0x4d4e, %ecx           # imm = 0x4D4E
xorl %ecx, %eax
movzbl 0x1b2(%rsp), %ecx
xorl $0x52, %ecx
orw %ax, %cx
jne 0xdb3d
movq 0xa0(%rsp), %rax
movl $0x1, (%rax)
jmp 0xdb3d
movl 0xb0(%rsp), %eax
movl $0x52444f4d, %ecx       # imm = 0x52444F4D
xorl %ecx, %eax
movzwl 0xb4(%rsp), %ecx
xorl $0x5345, %ecx           # imm = 0x5345
orl %eax, %ecx
je 0xd86c
movl 0xb0(%rsp), %eax
movl $0x4d444e45, %ecx       # imm = 0x4D444E45
xorl %ecx, %eax
movzwl 0xb4(%rsp), %ecx
xorl $0x4c44, %ecx           # imm = 0x4C44
orl %eax, %ecx
je 0xdb89
movl 0xb0(%rsp), %eax
movl $0x53494e41, %ecx       # imm = 0x53494E41
xorl %ecx, %eax
movzwl 0xb4(%rsp), %ecx
xorl $0x554f, %ecx           # imm = 0x554F
orl %eax, %ecx
jne 0xdb3d
movq 0x98(%rsp), %rax
cmpl $0x0, (%rax)
jne 0xd662
movq 0x98(%rsp), %rax
movl $0x1, (%rax)
leaq 0x20(%r12), %rdx
leaq 0x30(%r12), %rcx
leaq 0x40(%r12), %r8
leaq 0x24(%r12), %r9
leaq 0x28(%r12), %r10
leaq 0x34(%r12), %r11
leaq 0xcc(%rsp), %rdi
leaq 0x48707(%rip), %rsi     # 0x55d96
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x2200
addq $0x10, %rsp
movl $0x20, %eax
xorl %ecx, %ecx
movsd 0x4851b(%rip), %xmm1    # 0x55bc8
movl $0x3, %edx
movq %rax, %rsi
movq %rax, %rdi
xorps %xmm0, %xmm0
cvtss2sd (%r12,%rdi), %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%r12,%rdi)
cmpq $0x3, %rdx
je 0xd6db
movss %xmm0, (%r12,%rsi)
decq %rdx
addq $0x4, %rdi
addq $0xc, %rsi
cmpq %rdx, %rcx
jne 0xd6b8
incq %rcx
addq $0x10, %rax
cmpq $0x3, %rcx
jne 0xd6ad
jmp 0xdb3d
leaq 0xbc(%rsp), %rdi
leaq 0x4865c(%rip), %rsi     # 0x55d68
leaq 0x200(%rsp), %rdx
leaq 0x1b0(%rsp), %rcx
leaq 0x2d0(%rsp), %r8
leaq 0x180(%rsp), %r9
xorl %eax, %eax
callq 0x2200
movq 0x200(%rsp), %rax
movabsq $0x54415245504d4554, %rcx # imm = 0x54415245504D4554
xorq %rcx, %rax
movq 0x203(%rsp), %rcx
movabsq $0x4552555441524550, %rdx # imm = 0x4552555441524550
xorq %rdx, %rcx
orq %rax, %rcx
jne 0xdb3d
cmpl $0x4c4c554e, 0x180(%rsp) # imm = 0x4C4C554E
je 0xdb3d
leaq 0x180(%rsp), %rdi
leaq 0x4856e(%rip), %rsi     # 0x55cf4
movq 0x330(%rsp), %rdx
xorl %eax, %eax
callq 0x2200
movabsq $0x294e49564c454b28, %rax # imm = 0x294E49564C454B28
cmpq %rax, 0x1b0(%rsp)
je 0xdb3d
movq 0x330(%rsp), %rax
movss (%rax), %xmm0
addss 0x483ff(%rip), %xmm0    # 0x55bc0
movss %xmm0, (%rax)
jmp 0xdb3d
movl 0x14(%rsp), %ecx
cmpb $0x20, %cl
movzbl %bpl, %eax
movzbl %cl, %ecx
cmovel %eax, %ecx
cmpb %cl, %bpl
jne 0xd856
movl $0x1, 0x8(%rsp)
movl 0x4c(%rsp), %r14d
movl 0x20(%rsp), %eax
movb 0x5(%rsp), %cl
cmpb 0x7(%rsp), %cl
jne 0xd825
cmpl %eax, %r14d
jne 0xd980
movl $0x3, %edx
leaq 0xf(%rsp), %rdi
leaq 0x44(%rsp), %rsi
callq 0x2070
testl %eax, %eax
jne 0xd980
jmp 0xd9e0
cmpl %eax, %r14d
jne 0xd980
movq 0x70(%rsp), %rax
cmpw $0x1, %ax
jne 0xd92a
movq %r13, 0x18(%rsp)
movl %ebp, %eax
movl %eax, 0x14(%rsp)
movw $0x1, %ax
movq %rax, 0x70(%rsp)
jmp 0xd920
movl %ecx, 0x14(%rsp)
movl $0x1, 0x8(%rsp)
movq %r13, 0x18(%rsp)
jmp 0xd920
movq %rbx, 0x178(%rsp)
movb 0xbc(%rsp), %al
movslq 0x30(%rsp), %r14
leaq (%r14,%r14,4), %r13
leaq 0x5c6f5(%rip), %rbp     # 0x69f80
movb %al, (%rbp,%r13)
movb 0xc8(%rsp), %al
leaq 0x5ceb2(%rip), %rcx     # 0x6a750
movb %al, (%rcx,%r13)
movb 0xbd(%rsp), %al
movb %al, 0x1(%rbp,%r13)
movb 0xc9(%rsp), %al
movb %al, 0x1(%rcx,%r13)
movb 0xbe(%rsp), %al
movb %al, 0x2(%rbp,%r13)
movb 0xca(%rsp), %al
movb %al, 0x2(%rcx,%r13)
testl %r14d, %r14d
jle 0xd903
addq %rbp, %r13
xorl %ebx, %ebx
movl $0x3, %edx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2070
testl %eax, %eax
je 0xd905
incq %rbx
addq $0x5, %rbp
cmpq %rbx, %r14
jne 0xd8dc
movq 0x30(%rsp), %rbx
jmp 0xd905
xorl %ebx, %ebx
xorl %eax, %eax
movq 0x30(%rsp), %rcx
cmpl %ecx, %ebx
sete %al
addl %ecx, %eax
movq %rax, 0x30(%rsp)
movq 0x178(%rsp), %rbx
movq 0x28(%rsp), %r14
jmp 0xdb3d
cvtss2sd 0x6c(%rsp), %xmm0
movq 0x38(%rsp), %rax
subsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
cvtss2sd 0x68(%rsp), %xmm1
subsd 0x8(%rax), %xmm1
cvtsd2ss %xmm1, %xmm1
cvtss2sd 0x64(%rsp), %xmm2
subsd 0x10(%rax), %xmm2
cvtsd2ss %xmm2, %xmm2
mulss %xmm1, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
mulss %xmm2, %xmm2
addss %xmm0, %xmm2
movss 0x4824d(%rip), %xmm0    # 0x55bc4
ucomiss %xmm2, %xmm0
ja 0xd83d
movsbl %r15b, %eax
movsbl 0x5(%rsp), %r10d
leaq 0x24(%rsp), %rdi
leaq 0x54(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0xc(%rsp), %r8
leaq 0x44(%rsp), %r9
pushq %r13
pushq %rax
pushq %r10
pushq %r14
leaq 0x2f(%rsp), %rax
pushq %rax
pushq 0x58(%rsp)
leaq 0x80(%rsp), %rax
pushq %rax
leaq 0x3e(%rsp), %rax
pushq %rax
leaq 0x47(%rsp), %rax
pushq %rax
leaq 0x68(%rsp), %rax
pushq %rax
callq 0xe2ab
addq $0x50, %rsp
movslq 0x5c591(%rip), %rax     # 0x69f78
imulq $0x70, %rax, %rcx
movq 0x80(%rsp), %rsi
leaq (%rsi,%rcx), %r12
movzwl 0xc(%rsp), %edx
testw %dx, %dx
movq 0x38(%rsp), %rdi
cmoveq %r12, %rdi
movq %rdi, 0x38(%rsp)
incl %edx
movw %dx, 0xc(%rsp)
incl %eax
movss 0x68(%rsp), %xmm0
movss 0x6c(%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
cvtps2pd %xmm1, %xmm0
movl %eax, 0x5c54a(%rip)     # 0x69f78
movups %xmm0, (%rsi,%rcx)
xorps %xmm0, %xmm0
cvtss2sd 0x64(%rsp), %xmm0
movsd %xmm0, 0x10(%rsi,%rcx)
cmpb $0x20, 0xbc(%rsp)
jne 0xda6e
leaq 0x18(%r12), %rax
cmpb $0x20, 0xbd(%rsp)
jne 0xda9d
leaq 0xbc(%rsp), %rdx
movb 0x4(%rdx), %cl
movb %cl, 0x2(%rax)
movzwl 0x2(%rdx), %ecx
jmp 0xdaaf
cmpw $0x4553, 0xbc(%rsp)     # imm = 0x4553
jne 0xda82
movb $0x44, 0xbd(%rsp)
leaq 0xbc(%rsp), %rcx
movb 0x2(%rcx), %al
movb %al, 0x1a(%r12)
movzwl (%rcx), %eax
movw %ax, 0x18(%r12)
jmp 0xdab2
leaq 0xbc(%rsp), %rdx
movb 0x3(%rdx), %cl
movb %cl, 0x2(%rax)
movzwl 0x1(%rdx), %ecx
movw %cx, (%rax)
movq 0x28(%rsp), %r14
movb $0x0, 0x1b(%r12)
leaq 0x1c(%r12), %rdx
cmpb $0x20, 0xee(%rsp)
jne 0xdad4
movl $0x0, (%rdx)
jmp 0xdaea
leaq 0xec(%rsp), %rdi
leaq 0x48211(%rip), %rsi     # 0x55cf4
xorl %eax, %eax
callq 0x2200
cmpb $0x20, 0xec(%rsp)
je 0xdafc
movb $0x20, 0xec(%rsp)
leaq 0x44(%r12), %rdx
cmpb $0x20, 0xe8(%rsp)
jne 0xdb13
movl $0x0, (%rdx)
jmp 0xdb29
leaq 0xe6(%rsp), %rdi
leaq 0x481d2(%rip), %rsi     # 0x55cf4
xorl %eax, %eax
callq 0x2200
movl $0x0, 0x6c(%r12)
movq %r13, 0x18(%rsp)
movl %ebp, %eax
movl %eax, 0x14(%rsp)
leaq 0xb0(%rsp), %rdi
movl $0xc8, %esi
movq %r14, %rdx
callq 0x2170
testq %rax, %rax
movq 0x70(%rsp), %rdx
jne 0xd1ec
jmp 0xdb89
movb $0x20, %r15b
movq $0x0, 0x18(%rsp)
movb $0x20, 0x5(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movl 0x4c(%rsp), %r14d
movsbl %r15b, %r12d
movsbl 0x5(%rsp), %r13d
leaq 0xf(%rsp), %rbp
leaq 0x50(%rsp), %rax
leaq 0x6(%rsp), %r11
leaq 0x7(%rsp), %r10
leaq 0x24(%rsp), %r15
leaq 0x54(%rsp), %rsi
leaq 0xc(%rsp), %r8
leaq 0x44(%rsp), %r9
movq %r15, %rdi
movq 0x88(%rsp), %rdx
movq 0x38(%rsp), %rcx
pushq 0x18(%rsp)
pushq %r12
pushq %r13
pushq %r14
pushq %rbp
pushq 0x58(%rsp)
pushq %rax
pushq %r11
pushq %r10
leaq 0x68(%rsp), %rax
pushq %rax
callq 0xe2ab
addq $0x50, %rsp
movl (%r15), %ebp
leaq 0x5c293(%rip), %rax     # 0x69e90
movl (%rax), %esi
cmpl %esi, %ebp
jg 0xdc8a
movq 0x28(%rsp), %rdi
callq 0x20c0
leaq 0x481c8(%rip), %rdi     # 0x55de0
movl %ebp, %esi
movq 0x58(%rsp), %r14
movl %r14d, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x20f0
movslq %r14d, %rax
movb $0x0, (%rbx,%rax)
cmpb $0x2a, 0xe(%rsp)
je 0xdc44
movq 0x78(%rsp), %rdi
callq 0x2050
cmpl $0x0, 0x94(%rsp)
je 0xdc76
leaq 0x481e1(%rip), %rsi     # 0x55e36
leaq 0x481bc(%rip), %rdx     # 0x55e18
leaq 0x200(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2270
movq %rbx, %rdi
callq 0x20e0
movl %ebp, %eax
addq $0x2f8, %rsp            # imm = 0x2F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x48129(%rip), %rdi     # 0x55dba
xorl %eax, %eax
callq 0x20f0
movl $0x8, %edi
callq 0x2280