// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5a8, %rsp            # imm = 0x5A8
movq %r8, %rbx
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
cmpl $0x0, 0x1cf8(%r8)
je 0xeee6
leaq 0x1c08(%rbx), %rbp
movsbl 0x15(%r15), %edi
callq 0x517a
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5187
testl %eax, %eax
je 0xef63
movzbl 0x10(%r15), %eax
movl $0x1, %ebp
addl $-0x20, %eax
cmpl $0x21, %eax
ja 0xef9e
movabsq $0x200020001, %rcx      # imm = 0x200020001
btq %rax, %rcx
jae 0xef9e
cmpl $0x0, (%r13)
je 0xef40
xorl %eax, %eax
leaq 0x13490(%rip), %rcx     # 0x223b0
movb $0x0, 0x4(%rax,%rcx)
movl $0x58585858, (%rax,%rcx) # imm = 0x58585858
addq $0x6, %rax
cmpq $0x258, %rax            # imm = 0x258
jne 0xef20
movl $0x0, (%r13)
movl (%r12), %eax
testl %eax, %eax
jle 0xef6a
movb 0x15(%r15), %dl
xorl %ecx, %ecx
movq (%r14,%rcx,8), %rsi
cmpb %dl, 0x40(%rsi)
je 0xef6c
incq %rcx
cmpq %rcx, %rax
jne 0xef4e
movl %eax, %ecx
jmp 0xef6c
movl $0x1, %ebp
jmp 0xef9e
xorl %ecx, %ecx
movl %ecx, %edx
movq %rdx, 0x8(%rsp)
leaq (%r14,%rdx,8), %r13
cmpl %eax, %ecx
jne 0xef94
movq %r13, %rdi
callq 0x3d9c
movb 0x15(%r15), %al
movq (%r13), %rcx
movb %al, 0x40(%rcx)
incl (%r12)
jmp 0xefb2
movq (%r13), %rax
cmpl $0x1, 0xc(%rax)
jne 0xefb2
movl %ebp, %eax
addq $0x5a8, %rsp            # imm = 0x5A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x2e, 0x22(%r15)
jne 0xf12a
cmpb $0x2e, 0x2a(%r15)
jne 0xf12a
cmpb $0x2e, 0x32(%r15)
jne 0xf12a
cmpl $0x0, 0x1d84(%rbx)
je 0xefe7
cmpb $0x2e, 0x3f(%r15)
jne 0xf14e
leaq 0x16(%r15), %rdi
leaq 0x10(%rsp), %r12
movq %r12, %rsi
movl $0x1, %edx
callq 0x36b8
movq (%r12), %rdi
movq 0x8(%rsp), %r13
leaq (,%r13,2), %rax
addq %r13, %rax
leaq 0x13398(%rip), %rcx     # 0x223b0
leaq (%rcx,%rax,2), %r12
movq %r12, %rsi
callq 0x2150
testl %eax, %eax
je 0xf157
leaq 0xb12c(%rip), %rsi      # 0x1a15f
movq %r12, %rdi
callq 0x2150
testl %eax, %eax
je 0xf074
movq (%r14,%r13,8), %rdi
movl (%rdi), %esi
leaq 0xbdfc(%rip), %rdx      # 0x1ae48
leaq 0x4(%rsp), %rcx
callq 0x4f78
testl %eax, %eax
jne 0xf074
movq (%r14,%r13,8), %rax
movq 0x68(%rax), %rcx
movslq (%rax), %rax
movq (%rcx,%rax,8), %rdi
callq 0x2040
movq (%r14,%r13,8), %rax
decl (%rax)
leaq 0xb0e4(%rip), %rsi      # 0x1a15f
movq %r12, %rdi
callq 0x2150
testl %eax, %eax
je 0xf08d
movq (%r14,%r13,8), %rax
incl (%rax)
movq (%r14,%r13,8), %rax
movslq (%rax), %rbp
leaq 0x10(%rsp), %r13
movq (%r13), %rsi
movq %r12, %rdi
callq 0x2070
movl $0x778, %edi            # imm = 0x778
callq 0x595c
movq 0x8(%rsp), %rcx
movq (%r14,%rcx,8), %rcx
movq 0x68(%rcx), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0x8(%rsp), %rax
movq (%r14,%rax,8), %rax
movq 0x68(%rax), %rax
movq (%rax,%rbp,8), %rdi
addq $0x4, %rdi
movq %r12, %rsi
callq 0x2070
movq 0x8(%rsp), %rax
movq (%r14,%rax,8), %rax
movq 0x68(%rax), %rax
movq (%rax,%rbp,8), %rax
movl $0x0, (%rax)
leaq 0x11(%r15), %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x36b8
movq 0x8(%rsp), %rax
movq (%r14,%rax,8), %rax
movq 0x68(%rax), %rax
movq (%rax,%rbp,8), %rdi
addq $0xa, %rdi
movq (%r13), %rsi
movq 0x8(%rsp), %r13
callq 0x2070
jmp 0xf15d
leaq 0xb033(%rip), %rsi      # 0x1a164
xorl %edi, %edi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x5a8, %rsp            # imm = 0x5A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2424
leaq 0xb02b(%rip), %rsi      # 0x1a180
jmp 0xf131
movq (%r14,%r13,8), %rax
movl (%rax), %ebp
movq (%r14,%r13,8), %rax
movq 0x68(%rax), %rax
movslq %ebp, %rbp
movq (%rax,%rbp,8), %rax
movl (%rax), %eax
movl %eax, 0x4(%rsp)
cmpb $0x20, 0x10(%r15)
movq %r15, %r12
je 0xf195
leaq 0x1a0(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x2070
movb $0x20, 0x10(%r12)
addq $0xc, %r12
leaq 0x10(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x36b8
movq 0x8(%rsp), %rax
movq (%r14,%rax,8), %rax
movq 0x68(%rax), %rax
movq (%rax,%rbp,8), %r12
movslq 0x4(%rsp), %rax
leaq (%rax,%rax,4), %rax
leaq (%r12,%rax), %rdi
addq $0x10, %rdi
movq (%r13), %rsi
callq 0x2070
leaq 0x1a0(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2070
movb $0x20, %al
movb %al, 0x26(%r15)
leaq 0x1be(%rsp), %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x36b8
movq (%r13), %rdi
callq 0x2080
cvtsd2ss %xmm0, %xmm0
movslq 0x4(%rsp), %rax
leaq (%rax,%rax,2), %rax
movss %xmm0, 0x188(%r12,%rax,4)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2070
movb $0x20, %al
movb %al, 0x2e(%r15)
leaq 0x1c6(%rsp), %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x36b8
movq (%r13), %rdi
callq 0x2080
cvtsd2ss %xmm0, %xmm0
movslq 0x4(%rsp), %rax
leaq (%rax,%rax,2), %rax
movss %xmm0, 0x18c(%r12,%rax,4)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2070
movb $0x20, %al
movb %al, 0x36(%r15)
leaq 0x1ce(%rsp), %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x36b8
movq (%r13), %rdi
callq 0x2080
cvtsd2ss %xmm0, %xmm0
movslq 0x4(%rsp), %rax
leaq (%rax,%rax,2), %rcx
movss %xmm0, 0x190(%r12,%rcx,4)
cmpb $0x2e, 0x39(%r15)
jne 0xf30a
leaq 0x1a0(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x2070
movb $0x20, 0x3c(%r13)
leaq 0x1d6(%rsp), %rdi
leaq 0x10(%rsp), %r13
movq %r13, %rsi
movl $0x1, %edx
callq 0x36b8
movq (%r13), %rdi
callq 0x2080
cvtsd2ss %xmm0, %xmm0
movslq 0x4(%rsp), %rax
movss %xmm0, 0x50c(%r12,%rax,4)
jmp 0xf316
movl $0xbf800000, 0x50c(%r12,%rax,4) # imm = 0xBF800000
addq $0x3f, %r15
leaq 0x10(%rsp), %r13
movl $0x1, %ebp
movq %r15, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x36b8
movq (%r13), %rdi
callq 0x2080
cvtsd2ss %xmm0, %xmm0
movslq 0x4(%rsp), %rax
movss %xmm0, 0x638(%r12,%rax,4)
movl (%r12), %eax
leal 0x1(%rax), %ecx
movl %ecx, (%r12)
cmpl $0x4a, %eax
jl 0xef9e
leaq 0xa(%r12), %rcx
addq $0x4, %r12
movq 0x8(%rsp), %rax
movq (%r14,%rax,8), %rax
movsbl 0x40(%rax), %r9d
leaq 0xae21(%rip), %rsi      # 0x1a1a3
xorl %edi, %edi
movq %rbx, %rdx
movq %r12, %r8
xorl %eax, %eax
callq 0x2424
movl %eax, %ebp
jmp 0xef9e