// File: /workspace/github_c_makefile_star2_O3/josch[P]stride/p_turn.c
// Function: Process_TURN
int Process_TURN(BUFFER Buffer, CHAIN **Chain, int *ChainNumber, COMMAND *Cmd)
{
  int CC, TC;
  char *Field[MAX_FIELD];
  BUFFER Tmp;

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

  for( CC=0; CC < *ChainNumber && Chain[CC]->Id != Buffer[19]; CC++ );

  if( CC == *ChainNumber ) {
    InitChain(&Chain[CC]);
    Chain[CC]->Id = Buffer[19];
    (*ChainNumber)++;
  }

  TC = Chain[CC]->NTurn;
  Chain[CC]->Turn[TC] = (TURN *)ckalloc(sizeof(TURN));

  SplitString(Buffer+15,Field,1);

  strcpy(Chain[CC]->Turn[TC]->Res1,Field[0]);

  SplitString(Buffer+26,Field,1);
  strcpy(Chain[CC]->Turn[TC]->Res2,Field[0]);

  strcpy(Tmp,Buffer);
  Tmp[24] = ' ';
  Tmp[35] = ' ';
  SplitString(Tmp+20,Field,1);
  strcpy(Chain[CC]->Turn[TC]->PDB_ResNumb1,Field[0]);
  SplitString(Tmp+31,Field,1);
  strcpy(Chain[CC]->Turn[TC]->PDB_ResNumb2,Field[0]);

  Chain[CC]->Turn[TC]->InsCode1 = Buffer[24];
  Chain[CC]->Turn[TC]->InsCode2 = Buffer[35];

  Chain[CC]->NTurn++;

  return(SUCCESS);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5a8, %rsp            # imm = 0x5A8
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x1cf8(%rcx)
je 0xfc85
movq %rcx, %r12
addq $0x1c08, %r12           # imm = 0x1C08
movsbl 0x13(%rbx), %edi
callq 0x50a2
movsbl %al, %esi
movq %r12, %rdi
callq 0x50af
testl %eax, %eax
je 0xfdd9
movl (%r15), %r12d
testl %r12d, %r12d
jle 0xfca9
movb 0x13(%rbx), %al
xorl %r13d, %r13d
movq (%r14,%r13,8), %rcx
cmpb %al, 0x40(%rcx)
je 0xfcac
incq %r13
cmpq %r13, %r12
jne 0xfc93
movl %r12d, %r13d
jmp 0xfcb1
xorl %r13d, %r13d
cmpl %r12d, %r13d
jne 0xfcc7
leaq (%r14,%r12,8), %rdi
callq 0x3d9c
movb 0x13(%rbx), %al
movq (%r14,%r12,8), %rcx
movb %al, 0x40(%rcx)
incl (%r15)
movl %r13d, %r13d
movq (%r14,%r13,8), %rax
movslq 0x24(%rax), %rbp
movl $0x1b, %edi
callq 0x5880
movq (%r14,%r13,8), %rcx
movq 0x90(%rcx), %rcx
movq %rax, (%rcx,%rbp,8)
leaq 0xf(%rbx), %rdi
leaq 0x410(%rsp), %r15
movq %r15, %rsi
movl $0x1, %edx
callq 0x36c4
movq (%r14,%r13,8), %rax
movq 0x90(%rax), %rax
movq (%rax,%rbp,8), %rdi
movq (%r15), %rsi
callq 0x2070
leaq 0x1a(%rbx), %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x36c4
movq (%r14,%r13,8), %rax
movq 0x90(%rax), %rax
movq (%rax,%rbp,8), %rdi
addq $0x6, %rdi
movq (%r15), %rsi
callq 0x2070
movq %rsp, %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2070
movb $0x20, %al
movb %al, 0x18(%r12)
movb %al, 0x23(%r12)
leaq 0x14(%rsp), %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x36c4
movq (%r14,%r13,8), %rax
movq 0x90(%rax), %rax
movq (%rax,%rbp,8), %rdi
addq $0xc, %rdi
movq (%r15), %rsi
callq 0x2070
leaq 0x1f(%rsp), %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x36c4
movq (%r14,%r13,8), %rax
movq 0x90(%rax), %rax
movq (%rax,%rbp,8), %rdi
addq $0x12, %rdi
movq (%r15), %rsi
callq 0x2070
movb 0x18(%rbx), %al
movq (%r14,%r13,8), %rcx
movq 0x90(%rcx), %rdx
movq (%rdx,%rbp,8), %rdx
movb %al, 0x18(%rdx)
movb 0x23(%rbx), %al
movb %al, 0x19(%rdx)
incl 0x24(%rcx)
movl $0x1, %eax
addq $0x5a8, %rsp            # imm = 0x5A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq