// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x58, %rsp
movl $0x0, 0x54(%rsp)
movl %edi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
movl $0x320, %edi            # imm = 0x320
callq 0x7360
movq %rax, 0x40(%rsp)
movl $0x61a80, %edi          # imm = 0x61A80
callq 0x7360
movq %rax, 0x38(%rsp)
movl $0x29e4, %edi           # imm = 0x29E4
callq 0x7360
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rdi
movl 0x50(%rsp), %esi
movq 0x30(%rsp), %rdx
callq 0x27c0
movq 0x40(%rsp), %rdi
movq 0x30(%rsp), %rdx
leaq 0x28(%rsp), %rsi
callq 0x39b0
cmpl $0x0, %eax
je 0x23ed
cmpl $0x0, 0x28(%rsp)
jne 0x2400
movq 0x30(%rsp), %rsi
leaq 0x28c3b(%rip), %rdi     # 0x2b034
movb $0x0, %al
callq 0xc970
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x28(%rsp), %eax
jge 0x243f
movq 0x40(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x30(%rsp), %rsi
callq 0x25f20
addl 0x20(%rsp), %eax
movl %eax, 0x20(%rsp)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x2408
cmpl $0x0, 0x20(%rsp)
jne 0x2460
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq 0x48(%rax), %rsi
leaq 0x28bf6(%rip), %rdi     # 0x2b04f
movb $0x0, %al
callq 0xc970
movq 0x30(%rsp), %rax
cmpl $0x0, 0x1d74(%rax)
je 0x247c
movq 0x40(%rsp), %rdi
movl 0x28(%rsp), %esi
callq 0x24cd0
movq 0x30(%rsp), %rax
cmpl $0x0, 0x1d78(%rax)
je 0x249d
movq 0x40(%rsp), %rdi
movl 0x28(%rsp), %esi
movq 0x30(%rsp), %rdx
callq 0x25a10
movq 0x40(%rsp), %rdi
movl 0x28(%rsp), %esi
callq 0xbc70
movq 0x30(%rsp), %rax
cmpl $0x0, 0x1d80(%rax)
je 0x24cc
movq 0x40(%rsp), %rdi
movl 0x28(%rsp), %esi
movq 0x30(%rsp), %rdx
callq 0x25d20
movq 0x30(%rsp), %rax
cmpl $0x0, 0x1d8c(%rax)
je 0x24ed
movq 0x40(%rsp), %rdi
movl 0x28(%rsp), %esi
movq 0x30(%rsp), %rdx
callq 0x29b40
movq 0x30(%rsp), %rax
cmpl $0x0, 0x1d90(%rax)
je 0x250e
movq 0x40(%rsp), %rdi
movl 0x28(%rsp), %esi
movq 0x30(%rsp), %rdx
callq 0x2a0e0
movq 0x30(%rsp), %rdi
addq $0xc03, %rdi            # imm = 0xC03
callq 0x20b0
cmpq $0x0, %rax
jne 0x2536
movq 0x30(%rsp), %rdi
callq 0xbb30
movq %rax, 0x18(%rsp)
jmp 0x2551
movq 0x30(%rsp), %rdi
addq $0xc03, %rdi            # imm = 0xC03
movq 0x30(%rsp), %rdx
leaq 0x18(%rsp), %rsi
callq 0xb820
movq 0x30(%rsp), %rdi
addq $0x1004, %rdi           # imm = 0x1004
callq 0x20b0
cmpq $0x0, %rax
jne 0x2579
movq 0x30(%rsp), %rdi
callq 0xbbd0
movq %rax, 0x10(%rsp)
jmp 0x2594
movq 0x30(%rsp), %rdi
addq $0x1004, %rdi           # imm = 0x1004
movq 0x30(%rsp), %rdx
leaq 0x10(%rsp), %rsi
callq 0xb820
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x28(%rsp), %eax
jge 0x25c6
movq 0x40(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x6950
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x259c
movq 0x40(%rsp), %rdi
movl 0x2c(%rsp), %esi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0xe4c0
movl %eax, 0x24(%rsp)
cmpl $0x0, %eax
jne 0x25fa
movq 0x30(%rsp), %rsi
leaq 0x28a72(%rip), %rdi     # 0x2b065
movb $0x0, %al
callq 0xc970
movq 0x38(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x10a40
movq 0x40(%rsp), %rdi
movl 0x28(%rsp), %esi
movq 0x30(%rsp), %rdx
callq 0xbd00
movq 0x30(%rsp), %rax
cmpl $0x0, 0x1d68(%rax)
je 0x263c
movq 0x40(%rsp), %rdi
movl 0x28(%rsp), %esi
movq 0x30(%rsp), %rdx
callq 0x23220
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x28(%rsp), %eax
jge 0x2710
movq 0x40(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x26fe
movq 0x40(%rsp), %rdi
movl 0x2c(%rsp), %esi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq 0x18(%rsp), %r8
callq 0x7d20
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x28(%rsp), %eax
jge 0x26dd
movq 0x40(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x26ce
movq 0x40(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl 0xc(%rsp), %edx
movq 0x38(%rsp), %rcx
movq 0x30(%rsp), %r8
movq 0x10(%rsp), %r9
callq 0x86e0
jmp 0x26d0
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x268f
movq 0x40(%rsp), %rdi
movl 0x2c(%rsp), %esi
callq 0x23dc0
movq 0x40(%rsp), %rdi
movl 0x2c(%rsp), %esi
movq 0x38(%rsp), %rdx
callq 0x24970
jmp 0x2700
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x2644
movq 0x40(%rsp), %rdi
movl 0x28(%rsp), %esi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x1b720
movq 0x30(%rsp), %rax
cmpl $0x0, 0x1d7c(%rax)
je 0x2749
movq 0x40(%rsp), %rdi
movl 0x28(%rsp), %esi
movq 0x30(%rsp), %rdx
callq 0xc3a0
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jge 0x277b
movq 0x40(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2030
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x2751
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x24(%rsp), %eax
jge 0x27ad
movq 0x38(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2030
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x2783
movq 0x30(%rsp), %rdi
callq 0x2030
xorl %eax, %eax
addq $0x58, %rsp
retq
nop