// File: /workspace/github_c_makefile_star2_O0/josch[P]stride/p_atom.c
// Function: Process_ATOM
int Process_ATOM(BUFFER Buffer, CHAIN **Chain, int *ChainNumber, 
		 BOOLEAN *First_ATOM, COMMAND *Cmd)
{

  char *Field[MAX_FIELD];
  BUFFER Tmp;
  int CC, NR, NA;
  static char LastRes[MAX_CHAIN][RES_FIELD];
  RESIDUE *r;

  if( Cmd->NActive && !ChInStr(Cmd->Active,SpaceToDash(Buffer[21])) )
     return(SUCCESS);

  if( Buffer[16] != 'A' && Buffer[16] != ' ' && Buffer[16] != '1' ) 
    return(SUCCESS);

  if( *First_ATOM ) {
    for( CC=0; CC<MAX_CHAIN; CC++ ) 
      strcpy(LastRes[CC],"XXXX");
    *First_ATOM = NO;
  }
  
  for( CC=0; CC < *ChainNumber && Chain[CC]->Id != Buffer[21] ; CC++ );
  
  if( CC == *ChainNumber ) {
    InitChain(&Chain[CC]); 
    Chain[CC]->Id = Buffer[21];
    (*ChainNumber)++;
  }
  else
  if( Chain[CC]->Ter == 1 ) 
    return(SUCCESS);

  if( Buffer[34] != '.' || Buffer[42] != '.' || Buffer[50] != '.' )
    return(escape(FAILURE,"File %s has no coordinates\n",Cmd->InputFile));

  
  if( Cmd->Stringent && Buffer[63] != '.')
    return(escape(FAILURE,"File %s has no temperature factor\n",Cmd->InputFile));


  SplitString(Buffer+22,Field,1);
  if( strcmp(Field[0],LastRes[CC]) ) {
    if( strcmp(LastRes[CC],"XXXX") && !FindAtom(Chain[CC],Chain[CC]->NRes,"CA",&NA) ) {
      free(Chain[CC]->Rsd[Chain[CC]->NRes]);
      Chain[CC]->NRes--;
    }
    if( strcmp(LastRes[CC],"XXXX") ) Chain[CC]->NRes++;
    NR = Chain[CC]->NRes;
    strcpy(LastRes[CC],Field[0]);
    Chain[CC]->Rsd[NR] = (RESIDUE *)ckalloc(sizeof(RESIDUE));
    strcpy(Chain[CC]->Rsd[NR]->PDB_ResNumb,LastRes[CC]);
    Chain[CC]->Rsd[NR]->NAtom = 0;
    SplitString(Buffer+17,Field,1);
    strcpy(Chain[CC]->Rsd[NR]->ResType,Field[0]);
  }
  else 
    NR = Chain[CC]->NRes;
  
  NA = Chain[CC]->Rsd[NR]->NAtom;

  if( Buffer[16] != ' ' ) {
    strcpy(Tmp,Buffer);
    Tmp[16] = ' ';
    SplitString(Tmp+12,Field,1);
  }
  else
    SplitString(Buffer+12,Field,1);
  
  r = Chain[CC]->Rsd[NR];
  strcpy(r->AtomType[NA],Field[0]);


  strcpy(Tmp,Buffer);
  Buffer[38] = ' ';
  SplitString(Tmp+30,Field,1);
  r->Coord[NA][0] = atof(Field[0]);

  strcpy(Tmp,Buffer);
  Buffer[46] = ' ';
  SplitString(Tmp+38,Field,1);
  r->Coord[NA][1] = atof(Field[0]);

  strcpy(Tmp,Buffer);
  Buffer[54] = ' ';
  SplitString(Tmp+46,Field,1);
  r->Coord[NA][2] = atof(Field[0]);

  if( Buffer[57] == '.' ) {
    strcpy(Tmp,Buffer);
    Tmp[60] = ' ';
    SplitString(Tmp+54,Field,1);
    r->Occupancy[NA] = atof(Field[0]);
  }
  else 
    r->Occupancy[NA] = -1.00;
  
  SplitString(Buffer+63,Field,1);
  r->TempFactor[NA] = atof(Field[0]);

  r->NAtom++;

  if( r->NAtom > MAX_AT_IN_RES-1 )
    return(escape(FAILURE,"File %s has too many atoms in residue %s %s %c\n",
		  Cmd->InputFile,r->ResType,r->PDB_ResNumb,Chain[CC]->Id));

  return(SUCCESS);
}

// Assembly:
subq $0x608, %rsp            # imm = 0x608
movq %rdi, 0x5f8(%rsp)
movq %rsi, 0x5f0(%rsp)
movq %rdx, 0x5e8(%rsp)
movq %rcx, 0x5e0(%rsp)
movq %r8, 0x5d8(%rsp)
movq 0x5d8(%rsp), %rax
cmpl $0x0, 0x1cf8(%rax)
je 0x19906
movq 0x5d8(%rsp), %rax
addq $0x1c08, %rax           # imm = 0x1C08
movq %rax, 0x10(%rsp)
movq 0x5f8(%rsp), %rax
movsbl 0x15(%rax), %edi
callq 0x6550
movq 0x10(%rsp), %rdi
movsbl %al, %esi
callq 0x6580
cmpl $0x0, %eax
jne 0x19906
movl $0x1, 0x604(%rsp)
jmp 0x1a0a1
movq 0x5f8(%rsp), %rax
movsbl 0x10(%rax), %eax
cmpl $0x41, %eax
je 0x19949
movq 0x5f8(%rsp), %rax
movsbl 0x10(%rax), %eax
cmpl $0x20, %eax
je 0x19949
movq 0x5f8(%rsp), %rax
movsbl 0x10(%rax), %eax
cmpl $0x31, %eax
je 0x19949
movl $0x1, 0x604(%rsp)
jmp 0x1a0a1
movq 0x5e0(%rsp), %rax
cmpl $0x0, (%rax)
je 0x1999f
movl $0x0, 0x2c(%rsp)
cmpl $0x64, 0x2c(%rsp)
jge 0x19991
movslq 0x2c(%rsp), %rax
leaq 0x1829f(%rip), %rdi     # 0x31c10
imulq $0x6, %rax, %rax
addq %rax, %rdi
leaq 0x12697(%rip), %rsi     # 0x2c016
callq 0x2060
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x1995e
movq 0x5e0(%rsp), %rax
movl $0x0, (%rax)
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %ecx
movq 0x5e8(%rsp), %rdx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, 0xf(%rsp)
jge 0x199e7
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x40(%rax), %eax
movq 0x5f8(%rsp), %rcx
movsbl 0x15(%rcx), %ecx
cmpl %ecx, %eax
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x199f1
jmp 0x19a00
jmp 0x199f3
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x199a7
movl 0x2c(%rsp), %eax
movq 0x5e8(%rsp), %rcx
cmpl (%rcx), %eax
jne 0x19a59
movq 0x5f0(%rsp), %rdi
movslq 0x2c(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x43a0
movq 0x5f8(%rsp), %rax
movb 0x15(%rax), %cl
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movb %cl, 0x40(%rax)
movq 0x5e8(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x19a82
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x1, 0xc(%rax)
jne 0x19a80
movl $0x1, 0x604(%rsp)
jmp 0x1a0a1
jmp 0x19a82
movq 0x5f8(%rsp), %rax
movsbl 0x22(%rax), %eax
cmpl $0x2e, %eax
jne 0x19ab5
movq 0x5f8(%rsp), %rax
movsbl 0x2a(%rax), %eax
cmpl $0x2e, %eax
jne 0x19ab5
movq 0x5f8(%rsp), %rax
movsbl 0x32(%rax), %eax
cmpl $0x2e, %eax
je 0x19ad9
movq 0x5d8(%rsp), %rdx
xorl %edi, %edi
leaq 0x12555(%rip), %rsi     # 0x2c01b
movb $0x0, %al
callq 0x19470
movl %eax, 0x604(%rsp)
jmp 0x1a0a1
movq 0x5d8(%rsp), %rax
cmpl $0x0, 0x1d84(%rax)
je 0x19b1f
movq 0x5f8(%rsp), %rax
movsbl 0x3f(%rax), %eax
cmpl $0x2e, %eax
je 0x19b1f
movq 0x5d8(%rsp), %rdx
xorl %edi, %edi
leaq 0x1252b(%rip), %rsi     # 0x2c037
movb $0x0, %al
callq 0x19470
movl %eax, 0x604(%rsp)
jmp 0x1a0a1
movq 0x5f8(%rsp), %rdi
addq $0x16, %rdi
leaq 0x440(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x440(%rsp), %rdi
movslq 0x2c(%rsp), %rax
leaq 0x180bf(%rip), %rsi     # 0x31c10
imulq $0x6, %rax, %rax
addq %rax, %rsi
callq 0x2130
cmpl $0x0, %eax
je 0x19d5d
movslq 0x2c(%rsp), %rax
leaq 0x1809e(%rip), %rdi     # 0x31c10
imulq $0x6, %rax, %rax
addq %rax, %rdi
leaq 0x12496(%rip), %rsi     # 0x2c016
callq 0x2130
cmpl $0x0, %eax
je 0x19c12
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %esi
leaq 0x13087(%rip), %rdx     # 0x2cc40
leaq 0x24(%rsp), %rcx
callq 0x6140
cmpl $0x0, %eax
jne 0x19c12
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movq 0x5f0(%rsp), %rcx
movslq 0x2c(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2030
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movslq 0x2c(%rsp), %rax
leaq 0x17ff2(%rip), %rdi     # 0x31c10
imulq $0x6, %rax, %rax
addq %rax, %rdi
leaq 0x123ea(%rip), %rsi     # 0x2c016
callq 0x2130
cmpl $0x0, %eax
je 0x19c4e
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movl %eax, 0x28(%rsp)
movslq 0x2c(%rsp), %rax
leaq 0x17f9f(%rip), %rdi     # 0x31c10
imulq $0x6, %rax, %rax
addq %rax, %rdi
movq 0x440(%rsp), %rsi
callq 0x2060
movl $0x778, %edi            # imm = 0x778
callq 0x7360
movq %rax, %rdx
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x28(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x4, %rdi
movslq 0x2c(%rsp), %rax
leaq 0x17f32(%rip), %rsi     # 0x31c10
imulq $0x6, %rax, %rax
addq %rax, %rsi
callq 0x2060
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x0, (%rax)
movq 0x5f8(%rsp), %rdi
addq $0x11, %rdi
leaq 0x440(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0xa, %rdi
movq 0x440(%rsp), %rsi
callq 0x2060
jmp 0x19d74
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movl %eax, 0x28(%rsp)
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movl %eax, 0x24(%rsp)
movq 0x5f8(%rsp), %rax
movsbl 0x10(%rax), %eax
cmpl $0x20, %eax
je 0x19ddd
leaq 0x30(%rsp), %rdi
movq 0x5f8(%rsp), %rsi
callq 0x2060
movb $0x20, 0x40(%rsp)
leaq 0x30(%rsp), %rdi
addq $0xc, %rdi
leaq 0x440(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
jmp 0x19dfb
movq 0x5f8(%rsp), %rdi
addq $0xc, %rdi
leaq 0x440(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
addq $0x10, %rdi
movslq 0x24(%rsp), %rax
imulq $0x5, %rax, %rax
addq %rax, %rdi
movq 0x440(%rsp), %rsi
callq 0x2060
leaq 0x30(%rsp), %rdi
movq 0x5f8(%rsp), %rsi
callq 0x2060
movq 0x5f8(%rsp), %rax
movb $0x20, 0x26(%rax)
leaq 0x30(%rsp), %rdi
addq $0x1e, %rdi
leaq 0x440(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x440(%rsp), %rdi
callq 0x2080
cvtsd2ss %xmm0, %xmm0
movq 0x18(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x24(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
leaq 0x30(%rsp), %rdi
movq 0x5f8(%rsp), %rsi
callq 0x2060
movq 0x5f8(%rsp), %rax
movb $0x20, 0x2e(%rax)
leaq 0x30(%rsp), %rdi
addq $0x26, %rdi
leaq 0x440(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x440(%rsp), %rdi
callq 0x2080
cvtsd2ss %xmm0, %xmm0
movq 0x18(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x24(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
leaq 0x30(%rsp), %rdi
movq 0x5f8(%rsp), %rsi
callq 0x2060
movq 0x5f8(%rsp), %rax
movb $0x20, 0x36(%rax)
leaq 0x30(%rsp), %rdi
addq $0x2e, %rdi
leaq 0x440(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x440(%rsp), %rdi
callq 0x2080
cvtsd2ss %xmm0, %xmm0
movq 0x18(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x24(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x8(%rax)
movq 0x5f8(%rsp), %rax
movsbl 0x39(%rax), %eax
cmpl $0x2e, %eax
jne 0x19fda
leaq 0x30(%rsp), %rdi
movq 0x5f8(%rsp), %rsi
callq 0x2060
movb $0x20, 0x6c(%rsp)
leaq 0x30(%rsp), %rdi
addq $0x36, %rdi
leaq 0x440(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x440(%rsp), %rdi
callq 0x2080
cvtsd2ss %xmm0, %xmm0
movq 0x18(%rsp), %rax
movslq 0x24(%rsp), %rcx
movss %xmm0, 0x50c(%rax,%rcx,4)
jmp 0x19ff5
movq 0x18(%rsp), %rax
movslq 0x24(%rsp), %rcx
movss 0x11040(%rip), %xmm0    # 0x2b02c
movss %xmm0, 0x50c(%rax,%rcx,4)
movq 0x5f8(%rsp), %rdi
addq $0x3f, %rdi
leaq 0x440(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x440(%rsp), %rdi
callq 0x2080
cvtsd2ss %xmm0, %xmm0
movq 0x18(%rsp), %rax
movslq 0x24(%rsp), %rcx
movss %xmm0, 0x638(%rax,%rcx,4)
movq 0x18(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq 0x18(%rsp), %rax
cmpl $0x4a, (%rax)
jle 0x1a096
movq 0x5d8(%rsp), %rdx
movq 0x18(%rsp), %rcx
addq $0xa, %rcx
movq 0x18(%rsp), %r8
addq $0x4, %r8
movq 0x5f0(%rsp), %rax
movslq 0x2c(%rsp), %rsi
movq (%rax,%rsi,8), %rax
movsbl 0x40(%rax), %r9d
xorl %edi, %edi
leaq 0x11fd4(%rip), %rsi     # 0x2c05a
movb $0x0, %al
callq 0x19470
movl %eax, 0x604(%rsp)
jmp 0x1a0a1
movl $0x1, 0x604(%rsp)
movl 0x604(%rsp), %eax
addq $0x608, %rsp            # imm = 0x608
retq