// File: /workspace/github_c_makefile_star2_O0/josch[P]stride/p_sheet.c
// Function: Process_SHEET
int Process_SHEET(BUFFER Buffer, CHAIN **Chain, int *ChainNumber, COMMAND *Cmd)
{
  int CC, SC, STC;
  char *Field[MAX_FIELD];
  BUFFER Tmp;
  static char PreviousChain, PreviousSheetId[RES_FIELD];

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

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

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

  if( Chain[CC]->NSheet == -1 ) {
    PreviousChain = '*';
    strcpy(PreviousSheetId,"*");
  }

  SplitString(Buffer+7,Field,2);

  if( atoi(Field[0]) == 1 || Buffer[21] != PreviousChain ) {
    if( Buffer[21] == PreviousChain && !strcmp(PreviousSheetId,Field[1]) )
      return(FAILURE);
/*      die("Here it is! -> %s%c\n", Chain[CC]->File,Chain[CC]->Id);*/
    Chain[CC]->NSheet++;
    SC = Chain[CC]->NSheet;
    Chain[CC]->Sheet[SC] =  (SHEET *)ckalloc(sizeof(SHEET));
    Chain[CC]->Sheet[SC]->NStrand = 0;
    STC = Chain[CC]->Sheet[SC]->NStrand;
    strcpy(Chain[CC]->Sheet[SC]->SheetId,Field[1]);
  }
  else
    {
      SC = Chain[CC]->NSheet;
      STC = Chain[CC]->Sheet[SC]->NStrand;
    }
  
  SplitString(Buffer+17,Field,1);
  strcpy(Chain[CC]->Sheet[SC]->ResType1[STC],Field[0]);

  SplitString(Buffer+28,Field,1);
  strcpy(Chain[CC]->Sheet[SC]->ResType2[STC],Field[0]);

  strcpy(Tmp,Buffer);
  Tmp[27] = ' ';
  Tmp[38] = ' ';
  SplitString(Tmp+22,Field,1);
  strcpy(Chain[CC]->Sheet[SC]->PDB_ResNumb1[STC],Field[0]);
  SplitString(Tmp+33,Field,1);
  strcpy(Chain[CC]->Sheet[SC]->PDB_ResNumb2[STC],Field[0]);

  Chain[CC]->Sheet[SC]->InsCode1[STC] = Buffer[26];
  Chain[CC]->Sheet[SC]->InsCode2[STC] = Buffer[37];

  SplitString(Buffer+38,Field,1);
  Chain[CC]->Sheet[SC]->Sence[STC] = atoi(Field[0]);

  if( Buffer[45] != ' ' ) {
    Chain[CC]->Sheet[SC]->RegYN[STC] = 1;
    SplitString(Buffer+45,Field,1);
    strcpy(Chain[CC]->Sheet[SC]->ResTypeReg1[STC],Field[0]);
    SplitString(Buffer+60,Field,1);
    strcpy(Chain[CC]->Sheet[SC]->ResTypeReg2[STC],Field[0]);
    
    Tmp[55] = ' ';
    Tmp[70] = ' ';
    SplitString(Tmp+50,Field,1);
    strcpy(Chain[CC]->Sheet[SC]->PDB_ResNumbReg1[STC],Field[0]);
    SplitString(Tmp+66,Field,1);
    strcpy(Chain[CC]->Sheet[SC]->PDB_ResNumbReg2[STC],Field[0]);
    
    Chain[CC]->Sheet[SC]->InsCodeReg1[STC] = Buffer[54];
    Chain[CC]->Sheet[SC]->InsCodeReg2[STC] = Buffer[69];
    
    Tmp[45] = ' ';
    Tmp[60] = ' ';
    SplitString(Tmp+41,Field,1);
    strcpy(Chain[CC]->Sheet[SC]->AtomNameReg1[STC],Field[0]);
    SplitString(Tmp+56,Field,1);
    strcpy(Chain[CC]->Sheet[SC]->AtomNameReg2[STC],Field[0]);
  }
  else Chain[CC]->Sheet[SC]->RegYN[STC] = 0;

  strcpy(PreviousSheetId,Chain[CC]->Sheet[SC]->SheetId);
  PreviousChain = Buffer[21];
  Chain[CC]->Sheet[SC]->NStrand++;

  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 0x1a53e
movq 0x5c0(%rsp), %rax
addq $0x1c08, %rax           # imm = 0x1C08
movq %rax, 0x8(%rsp)
movq 0x5d8(%rsp), %rax
movsbl 0x15(%rax), %edi
callq 0x6550
movq 0x8(%rsp), %rdi
movsbl %al, %esi
callq 0x6580
cmpl $0x0, %eax
jne 0x1a53e
movl $0x1, 0x5e4(%rsp)
jmp 0x1aebf
movl $0x0, 0x5bc(%rsp)
movl 0x5bc(%rsp), %ecx
movq 0x5c8(%rsp), %rdx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, 0x7(%rsp)
jge 0x1a58f
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x40(%rax), %eax
movq 0x5d8(%rsp), %rcx
movsbl 0x15(%rcx), %ecx
cmpl %ecx, %eax
setne %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x1a599
jmp 0x1a5ae
jmp 0x1a59b
movl 0x5bc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5bc(%rsp)
jmp 0x1a549
movl 0x5bc(%rsp), %eax
movq 0x5c8(%rsp), %rcx
cmpl (%rcx), %eax
jne 0x1a60e
movq 0x5d0(%rsp), %rdi
movslq 0x5bc(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x43a0
movq 0x5d8(%rsp), %rax
movb 0x15(%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
cmpl $-0x1, 0x20(%rax)
jne 0x1a642
movb $0x2a, 0x17839(%rip)    # 0x31e68
leaq 0x17833(%rip), %rdi     # 0x31e69
leaq 0x11281(%rip), %rsi     # 0x2b8be
callq 0x2060
movq 0x5d8(%rsp), %rdi
addq $0x7, %rdi
leaq 0x420(%rsp), %rsi
movl $0x2, %edx
callq 0x37c0
movq 0x420(%rsp), %rdi
callq 0x21d0
cmpl $0x1, %eax
je 0x1a68d
movq 0x5d8(%rsp), %rax
movsbl 0x15(%rax), %eax
movsbl 0x177e3(%rip), %ecx     # 0x31e68
cmpl %ecx, %eax
je 0x1a7d3
movq 0x5d8(%rsp), %rax
movsbl 0x15(%rax), %eax
movsbl 0x177c8(%rip), %ecx     # 0x31e68
cmpl %ecx, %eax
jne 0x1a6cd
movq 0x428(%rsp), %rsi
leaq 0x177b6(%rip), %rdi     # 0x31e69
callq 0x2130
cmpl $0x0, %eax
jne 0x1a6cd
movl $0x0, 0x5e4(%rsp)
jmp 0x1aebf
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x20(%rax), %eax
movl %eax, 0x5b8(%rsp)
movl $0x584, %edi            # imm = 0x584
callq 0x7360
movq %rax, %rdx
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x0, (%rax)
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movl %eax, 0x5b4(%rsp)
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x4, %rdi
movq 0x428(%rsp), %rsi
callq 0x2060
jmp 0x1a821
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x20(%rax), %eax
movl %eax, 0x5b8(%rsp)
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movl %eax, 0x5b4(%rsp)
movq 0x5d8(%rsp), %rdi
addq $0x11, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0xa, %rdi
movslq 0x5b4(%rsp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
movq 0x5d8(%rsp), %rdi
addq $0x1c, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x82, %rdi
movslq 0x5b4(%rsp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
leaq 0x10(%rsp), %rdi
movq 0x5d8(%rsp), %rsi
callq 0x2060
movb $0x20, 0x2b(%rsp)
movb $0x20, 0x36(%rsp)
leaq 0x10(%rsp), %rdi
addq $0x16, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0xfa, %rdi
movslq 0x5b4(%rsp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
leaq 0x10(%rsp), %rdi
addq $0x21, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x172, %rdi            # imm = 0x172
movslq 0x5b4(%rsp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
movq 0x5d8(%rsp), %rax
movb 0x1a(%rax), %dl
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x5b4(%rsp), %rcx
movb %dl, 0x1ea(%rax,%rcx)
movq 0x5d8(%rsp), %rax
movb 0x25(%rax), %dl
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x5b4(%rsp), %rcx
movb %dl, 0x1fe(%rax,%rcx)
movq 0x5d8(%rsp), %rdi
addq $0x26, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x420(%rsp), %rdi
callq 0x21d0
movl %eax, %edx
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x5b4(%rsp), %rcx
movl %edx, 0x214(%rax,%rcx,4)
movq 0x5d8(%rsp), %rax
movsbl 0x2d(%rax), %eax
cmpl $0x20, %eax
je 0x1ae04
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x5b4(%rsp), %rcx
movl $0x1, 0x264(%rax,%rcx,4)
movq 0x5d8(%rsp), %rdi
addq $0x2d, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x37c, %rdi            # imm = 0x37C
movslq 0x5b4(%rsp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
movq 0x5d8(%rsp), %rdi
addq $0x3c, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x3f4, %rdi            # imm = 0x3F4
movslq 0x5b4(%rsp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
movb $0x20, 0x47(%rsp)
movb $0x20, 0x56(%rsp)
leaq 0x10(%rsp), %rdi
addq $0x32, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x46c, %rdi            # imm = 0x46C
movslq 0x5b4(%rsp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
leaq 0x10(%rsp), %rdi
addq $0x42, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x4e4, %rdi            # imm = 0x4E4
movslq 0x5b4(%rsp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
movq 0x5d8(%rsp), %rax
movb 0x36(%rax), %dl
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x5b4(%rsp), %rcx
movb %dl, 0x55c(%rax,%rcx)
movq 0x5d8(%rsp), %rax
movb 0x45(%rax), %dl
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x5b4(%rsp), %rcx
movb %dl, 0x570(%rax,%rcx)
movb $0x20, 0x3d(%rsp)
movb $0x20, 0x4c(%rsp)
leaq 0x10(%rsp), %rdi
addq $0x29, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x2b4, %rdi            # imm = 0x2B4
movslq 0x5b4(%rsp), %rax
imulq $0x5, %rax, %rax
addq %rax, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
leaq 0x10(%rsp), %rdi
addq $0x38, %rdi
leaq 0x420(%rsp), %rsi
movl $0x1, %edx
callq 0x37c0
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x318, %rdi            # imm = 0x318
movslq 0x5b4(%rsp), %rax
imulq $0x5, %rax, %rax
addq %rax, %rdi
movq 0x420(%rsp), %rsi
callq 0x2060
jmp 0x1ae3e
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x5b4(%rsp), %rcx
movl $0x0, 0x264(%rax,%rcx,4)
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
addq $0x4, %rsi
leaq 0x16ff9(%rip), %rdi     # 0x31e69
callq 0x2060
movq 0x5d8(%rsp), %rax
movb 0x15(%rax), %al
movb %al, 0x16fe2(%rip)      # 0x31e68
movq 0x5d0(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rax), %rax
movslq 0x5b8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x1, 0x5e4(%rsp)
movl 0x5e4(%rsp), %eax
addq $0x5e8, %rsp            # imm = 0x5E8
retq
nop