// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x5e8, %rsp            # imm = 0x5E8
movq %rdi, 0x5d8(%rsp)
movq %rsi, 0x5d0(%rsp)
movq %rdx, 0x5c8(%rsp)
movq %rcx, 0x5c0(%rsp)
movq 0x5c0(%rsp), %rax
cmpl $0x0, 0x1cf8(%rax)
je 0x1af4e
movq 0x5c0(%rsp), %rax
addq $0x1c08, %rax           # imm = 0x1C08
movq %rax, 0x8(%rsp)
movq 0x5d8(%rsp), %rax
movsbl 0x13(%rax), %edi
callq 0x6550
movq 0x8(%rsp), %rdi
movsbl %al, %esi
callq 0x6580
cmpl $0x0, %eax
jne 0x1af4e
movl $0x1, 0x5e4(%rsp)
jmp 0x1b26c
movl $0x0, 0x5bc(%rsp)
movl 0x5bc(%rsp), %ecx
movq 0x5c8(%rsp), %rdx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, 0x7(%rsp)
jge 0x1af9f
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x40(%rax), %eax
movq 0x5d8(%rsp), %rcx
movsbl 0x13(%rcx), %ecx
cmpl %ecx, %eax
setne %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x1afa9
jmp 0x1afbe
jmp 0x1afab
movl 0x5bc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5bc(%rsp)
jmp 0x1af59
movl 0x5bc(%rsp), %eax
movq 0x5c8(%rsp), %rcx
cmpl (%rcx), %eax
jne 0x1b01e
movq 0x5d0(%rsp), %rdi
movslq 0x5bc(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x43a0
movq 0x5d8(%rsp), %rax
movb 0x13(%rax), %cl
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movb %cl, 0x40(%rax)
movq 0x5c8(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x24(%rax), %eax
movl %eax, 0x5b8(%rsp)
movl $0x1b, %edi
callq 0x7360
movq %rax, %rdx
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x90(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x5d8(%rsp), %rdi
addq $0xf, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x90(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
movq 0x5d8(%rsp), %rdi
addq $0x1a, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x90(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x6, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
leaq 0x10(%rsp), %rdi
movq 0x5d8(%rsp), %rsi
callq 0x2060
movb $0x20, 0x28(%rsp)
movb $0x20, 0x33(%rsp)
leaq 0x10(%rsp), %rdi
addq $0x14, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x90(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0xc, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
leaq 0x10(%rsp), %rdi
addq $0x1f, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x90(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x12, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
movq 0x5d8(%rsp), %rax
movb 0x18(%rax), %cl
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x90(%rax), %rax
movslq 0x5b8(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movb %cl, 0x18(%rax)
movq 0x5d8(%rsp), %rax
movb 0x23(%rax), %cl
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x90(%rax), %rax
movslq 0x5b8(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movb %cl, 0x19(%rax)
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x24(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x24(%rax)
movl $0x1, 0x5e4(%rsp)
movl 0x5e4(%rsp), %eax
addq $0x5e8, %rsp            # imm = 0x5E8
retq
nopl (%rax,%rax)