// File: /workspace/github_c_makefile_star2_O1/josch[P]stride/stride.c
// Function: main
int main(int argc, char **argv)
{

  CHAIN **Chain;
  HBOND **HBond;
  COMMAND *Cmd;
  int Cn, NChain=0, NHBond=0, ValidChain=0;
  float **PhiPsiMapHelix, **PhiPsiMapSheet;
  register int i;

  /* argc = ccommand(&argv); */ /* For Macintosh only, see readme.mac */



  Chain = (CHAIN  **)ckalloc(MAX_CHAIN*sizeof(CHAIN *));
  HBond = (HBOND  **)ckalloc(MAXHYDRBOND*sizeof(HBOND *));
  Cmd   = (COMMAND *)ckalloc(sizeof(COMMAND));

  ProcessStrideOptions(argv,argc,Cmd);

  if( !ReadPDBFile(Chain,&NChain,Cmd) || !NChain )
    die("Error reading PDB file %s\n",Cmd->InputFile);
  
  for( Cn=0; Cn<NChain; Cn++ )
    ValidChain += CheckChain(Chain[Cn],Cmd);

/*   if( Cmd->Stringent )
 *     exit(0);
 */
  if( !ValidChain ) 
    die("No valid chain in %s\n",Chain[0]->File);
  
  if( Cmd->BrookhavenAsn )
    GetPdbAsn(Chain,NChain);

  if( Cmd->DsspAsn )
    GetDsspAsn(Chain,NChain,Cmd);

  BackboneAngles(Chain,NChain);

  if( Cmd->OutSeq )
    OutSeq(Chain,NChain,Cmd);

  if( Cmd->ContactOrder )
    ContactOrder(Chain,NChain,Cmd);

  if( Cmd->ContactMap )
    ContactMap(Chain,NChain,Cmd);

  if( !strlen(Cmd->MapFileHelix) )
    PhiPsiMapHelix = DefaultHelixMap(Cmd);
  else
    ReadPhiPsiMap(Cmd->MapFileHelix,&PhiPsiMapHelix,Cmd);

  if( !strlen(Cmd->MapFileSheet) )
    PhiPsiMapSheet = DefaultSheetMap(Cmd);
  else
    ReadPhiPsiMap(Cmd->MapFileSheet,&PhiPsiMapSheet,Cmd);
  
  for( Cn=0; Cn<NChain; Cn++ )
    PlaceHydrogens(Chain[Cn]);
  
  if( (NHBond = FindHydrogenBonds(Chain,Cn,HBond,Cmd)) == 0 ) 
    die("No hydrogen bonds found in %s\n",Cmd->InputFile);
  
  NoDoubleHBond(HBond,NHBond);
  
  DiscrPhiPsi(Chain,NChain,Cmd);
  
  if(Cmd->ExposedArea)
    Area(Chain,NChain,Cmd);

  for( Cn=0; Cn<NChain; Cn++ ) {

    if( Chain[Cn]->Valid ) {
    
      Helix(Chain,Cn,HBond,Cmd,PhiPsiMapHelix);
      
      for( i=0; i<NChain; i++ ) 
	if( Chain[i]->Valid )
	  Sheet(Chain,Cn,i,HBond,Cmd,PhiPsiMapSheet);    
      
      BetaTurn(Chain,Cn);
      GammaTurn(Chain,Cn,HBond);
      
    }
  }
    
  Report(Chain,NChain,HBond,Cmd);

  if( Cmd->MolScript )
    MolScript(Chain,NChain,Cmd);

  for( i=0; i<Cn; i++ ) free(Chain[i]);
  for( i=0; i<NHBond; i++ ) free(HBond[i]);
  free(Cmd);

  return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r12
movl %edi, %ebp
leaq 0x4(%rsp), %r13
movl $0x0, (%r13)
movl $0x320, %edi            # imm = 0x320
callq 0x595c
movq %rax, %r15
movl $0x61a80, %edi          # imm = 0x61A80
callq 0x595c
movq %rax, %rbx
movl $0x29e4, %edi           # imm = 0x29E4
callq 0x595c
movq %rax, %r14
movq %r12, %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x2c22
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x37d8
testl %eax, %eax
je 0x2969
cmpl $0x0, 0x4(%rsp)
jne 0x297a
leaq 0x16730(%rip), %rdi     # 0x190a0
movq %r14, %rsi
xorl %eax, %eax
callq 0x8900
cmpl $0x0, 0x4(%rsp)
jle 0x29a5
xorl %r12d, %r12d
xorl %ebp, %ebp
movq (%r15,%r12,8), %rdi
movq %r14, %rsi
callq 0x1620c
addl %eax, %ebp
incq %r12
movslq 0x4(%rsp), %rax
cmpq %rax, %r12
jl 0x2986
testl %ebp, %ebp
jne 0x29ba
movq (%r15), %rax
movq 0x48(%rax), %rsi
leaq 0x16708(%rip), %rdi     # 0x190bb
xorl %eax, %eax
callq 0x8900
cmpl $0x0, 0x1d74(%r14)
je 0x29d0
movl 0x4(%rsp), %esi
movq %r15, %rdi
callq 0x15734
cmpl $0x0, 0x1d78(%r14)
je 0x29e9
movl 0x4(%rsp), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x15f08
movl 0x4(%rsp), %esi
movq %r15, %rdi
callq 0x81b8
cmpl $0x0, 0x1d80(%r14)
je 0x2a0e
movl 0x4(%rsp), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x160d0
cmpl $0x0, 0x1d8c(%r14)
je 0x2a27
movl 0x4(%rsp), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x18120
cmpl $0x0, 0x1d90(%r14)
je 0x2a40
movl 0x4(%rsp), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x18530
cmpb $0x0, 0xc03(%r14)
je 0x2a60
leaq 0xc03(%r14), %rdi
leaq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x7ea0
jmp 0x2a6d
movq %r14, %rdi
callq 0x80ae
movq %rax, 0x10(%rsp)
cmpb $0x0, 0x1004(%r14)
je 0x2a90
movq %r14, %rdi
addq $0x1004, %rdi           # imm = 0x1004
leaq 0x8(%rsp), %rsi
movq %r14, %rdx
callq 0x7ea0
jmp 0x2a9d
movq %r14, %rdi
callq 0x8132
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x4(%rsp)
jle 0x2abf
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
callq 0x5360
incq %r12
movslq 0x4(%rsp), %rax
cmpq %rax, %r12
jl 0x2aa7
jmp 0x2ac2
xorl %r12d, %r12d
movq %r15, %rdi
movl %r12d, %esi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x96fa
movl %eax, %ebp
testl %eax, %eax
jne 0x2aea
leaq 0x165f1(%rip), %rdi     # 0x190d1
movq %r14, %rsi
xorl %eax, %eax
callq 0x8900
movq %rbx, %rdi
movl %ebp, %esi
callq 0xa593
movl 0x4(%rsp), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x8206
cmpl $0x0, 0x1d68(%r14)
je 0x2b1c
movl 0x4(%rsp), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x14824
movl 0x4(%rsp), %esi
xorl %r12d, %r12d
testl %esi, %esi
jle 0x2bab
movq (%r15,%r12,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x2b9e
movq 0x10(%rsp), %r8
movq %r15, %rdi
movl %r12d, %esi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x6218
cmpl $0x0, 0x4(%rsp)
jle 0x2b85
xorl %r13d, %r13d
movq (%r15,%r13,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x2b78
movq 0x8(%rsp), %r9
movq %r15, %rdi
movl %r12d, %esi
movl %r13d, %edx
movq %rbx, %rcx
movq %r14, %r8
callq 0x6784
incq %r13
movslq 0x4(%rsp), %rax
cmpq %rax, %r13
jl 0x2b55
movq %r15, %rdi
movl %r12d, %esi
callq 0x14f5c
movq %r15, %rdi
movl %r12d, %esi
movq %rbx, %rdx
callq 0x15556
incq %r12
movslq 0x4(%rsp), %rsi
cmpq %rsi, %r12
jl 0x2b2b
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0xfe80
cmpl $0x0, 0x1d7c(%r14)
je 0x2bd2
movl 0x4(%rsp), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x8564
testl %r12d, %r12d
je 0x2bee
movl %r12d, %r12d
xorl %r13d, %r13d
movq (%r15,%r13,8), %rdi
callq 0x2040
incq %r13
cmpq %r13, %r12
jne 0x2bdd
testl %ebp, %ebp
jle 0x2c09
movl %ebp, %r15d
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rdi
callq 0x2040
incq %r12
cmpq %r12, %r15
jne 0x2bf8
movq %r14, %rdi
callq 0x2040
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq