// File: /workspace/github_c_makefile_star2_O0/yhg926[P]public_kssd/iseq2comem.c
// Function: fasta2co
llong * fasta2co(char* seqfname, llong *co, char * pipecmd)
{
 llong tuple = 0LLU, crvstuple = 0LLU,
    unituple, drtuple, pfilter;
 memset(co,0LLU,hashsize*sizeof(llong));
 char seqin_buff[ READSEQ_BUFFSZ + 1 ];
 FILE *infp;
 char fas_fname[PATHLEN];
 if(pipecmd[0] != '\0')
  sprintf(fas_fname,"%s %s",pipecmd,seqfname);
 else
  sprintf(fas_fname,"%s %s",gzpipe_cmd,seqfname);
 if( (infp=popen(fas_fname,"r")) == NULL ) err(errno,"fasta2co():%s",fas_fname);
 int newLen = fread(seqin_buff, sizeof(char),READSEQ_BUFFSZ,infp);
 if(! (newLen >0) ) err(errno,"fastco():eof or fread error file=%s",seqfname);
 llong base = 1; char ch; int basenum;
 unsigned int keycount = 0;
 for(int pos = 0; pos <= newLen; pos++)
 {
  if(pos == newLen){
    newLen = fread(seqin_buff, sizeof(char),READSEQ_BUFFSZ,infp);
   if(newLen > 0)
    pos = 0;
   else break;
  };
  ch = seqin_buff[pos];
  basenum = Basemap[(int)ch];
  if(basenum != DEFAULT)
  {
   tuple = ( ( tuple<< 2 ) | (llong)basenum ) & tupmask ;
   crvstuple = ( crvstuple >> 2 ) + (((llong)basenum^3LLU) << crvsaddmove);
   base++;
  }
  else if ( (ch == '\n') || (ch == '\r') ) { continue;}
  else if (isalpha(ch)){ base=1; continue; }
  else if ( ch == '>' )
  {
   while( (pos < newLen ) && ( seqin_buff[pos] != '\n' ) )
   {
    if (pos < newLen - 1)
     pos++;
    else
    {
     newLen = fread(seqin_buff, sizeof(char),READSEQ_BUFFSZ,infp);
     if(newLen > 0) pos = -1;
     else err(errno,"fasta2co(): can not find seqences head start from '>' %d",newLen);
    };
   };
      base = 1;
      continue;
  }
  else {
      base=1;
      continue;
    };
  if( base > TL )
  {
   unituple = tuple < crvstuple ? tuple:crvstuple;
   int dim_tup = ((unituple & domask) >> ( (half_outctx_len)*2 ) ) ;
   pfilter = dim_shuf_arr[dim_tup];
   if( ( pfilter >= dim_end) || (pfilter < dim_start ) ) continue;
   pfilter = pfilter - dim_start;
   drtuple = ( ( (unituple & undomask)
       + ( ( unituple & ( ( 1LLU<< ( half_outctx_len*2) ) - 1)) << (TL*2 - half_outctx_len*4) ) )
             >> ( drlevel*4 ) )
             + pfilter ;
   unsigned int i,n ;
     for(i=0;i<hashsize;i++)
     {
       n = HASH(drtuple,i,hashsize);
       if (co[n] == 0)
       {
         co[n] = drtuple;
         keycount++;
         if( keycount > hashlimit)
           err(errno,"the context space is too crowd, try rerun the program using -k%d", half_ctx_len + 1);
         break;
       }
       else if ( co[n] == drtuple )
          break;
   };
  };
 };
  pclose(infp);
  return co;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x101a0, %rsp          # imm = 0x101A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl 0x4babb(%rip), %eax     # 0x6461c
movl %eax, %edx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x31f0
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x18b99
leaq -0x10160(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x8(%rbp), %rcx
leaq 0x6456(%rip), %rsi      # 0x1efe6
movb $0x0, %al
callq 0x3400
jmp 0x18bb9
leaq -0x10160(%rbp), %rdi
movq -0x8(%rbp), %rcx
leaq 0x643b(%rip), %rsi      # 0x1efe6
leaq 0x6635(%rip), %rdx      # 0x1f1e7
movb $0x0, %al
callq 0x3400
leaq -0x10160(%rbp), %rdi
leaq 0x5111(%rip), %rsi      # 0x1dcd8
callq 0x3360
movq %rax, -0x10058(%rbp)
cmpq $0x0, %rax
jne 0x18bf5
callq 0x3050
movl (%rax), %edi
leaq -0x10160(%rbp), %rdx
leaq 0x64b0(%rip), %rsi      # 0x1f09e
movb $0x0, %al
callq 0x3300
leaq -0x10050(%rbp), %rdi
movq -0x10058(%rbp), %rcx
movl $0x1, %esi
movl $0x10000, %edx          # imm = 0x10000
callq 0x30a0
movl %eax, -0x10164(%rbp)
cmpl $0x0, -0x10164(%rbp)
jg 0x18c3a
callq 0x3050
movl (%rax), %edi
movq -0x8(%rbp), %rdx
leaq 0x6479(%rip), %rsi      # 0x1f0ac
movb $0x0, %al
callq 0x3300
movq $0x1, -0x10170(%rbp)
movl $0x0, -0x1017c(%rbp)
movl $0x0, -0x10180(%rbp)
movl -0x10180(%rbp), %eax
cmpl -0x10164(%rbp), %eax
jg 0x190ac
movl -0x10180(%rbp), %eax
cmpl -0x10164(%rbp), %eax
jne 0x18cb8
leaq -0x10050(%rbp), %rdi
movq -0x10058(%rbp), %rcx
movl $0x1, %esi
movl $0x10000, %edx          # imm = 0x10000
callq 0x30a0
movl %eax, -0x10164(%rbp)
cmpl $0x0, -0x10164(%rbp)
jle 0x18cb1
movl $0x0, -0x10180(%rbp)
jmp 0x18cb6
jmp 0x190ac
jmp 0x18cb8
movslq -0x10180(%rbp), %rax
movb -0x10050(%rbp,%rax), %al
movb %al, -0x10171(%rbp)
movsbl -0x10171(%rbp), %eax
movslq %eax, %rcx
leaq 0x5cb3(%rip), %rax      # 0x1e990
movl (%rax,%rcx,4), %eax
movl %eax, -0x10178(%rbp)
cmpl $-0x1, -0x10178(%rbp)
je 0x18d49
movq -0x20(%rbp), %rax
shlq $0x2, %rax
movslq -0x10178(%rbp), %rcx
orq %rcx, %rax
andq 0x4b928(%rip), %rax     # 0x64630
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
shrq $0x2, %rax
movslq -0x10178(%rbp), %rdx
xorq $0x3, %rdx
movl 0x4b907(%rip), %ecx     # 0x6462c
shlq %cl, %rdx
movq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x10170(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10170(%rbp)
jmp 0x18e83
movsbl -0x10171(%rbp), %eax
cmpl $0xa, %eax
je 0x18d61
movsbl -0x10171(%rbp), %eax
cmpl $0xd, %eax
jne 0x18d66
jmp 0x19098
callq 0x34a0
movq (%rax), %rax
movsbl -0x10171(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x18d96
movq $0x1, -0x10170(%rbp)
jmp 0x19098
movsbl -0x10171(%rbp), %eax
cmpl $0x3e, %eax
jne 0x18e73
jmp 0x18da8
movl -0x10180(%rbp), %ecx
xorl %eax, %eax
cmpl -0x10164(%rbp), %ecx
movb %al, -0x1018d(%rbp)
jge 0x18dd9
movslq -0x10180(%rbp), %rax
movsbl -0x10050(%rbp,%rax), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x1018d(%rbp)
movb -0x1018d(%rbp), %al
testb $0x1, %al
jne 0x18de5
jmp 0x18e63
movl -0x10180(%rbp), %eax
movl -0x10164(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x18e09
movl -0x10180(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10180(%rbp)
jmp 0x18e5e
leaq -0x10050(%rbp), %rdi
movq -0x10058(%rbp), %rcx
movl $0x1, %esi
movl $0x10000, %edx          # imm = 0x10000
callq 0x30a0
movl %eax, -0x10164(%rbp)
cmpl $0x0, -0x10164(%rbp)
jle 0x18e41
movl $0xffffffff, -0x10180(%rbp) # imm = 0xFFFFFFFF
jmp 0x18e5c
callq 0x3050
movl (%rax), %edi
movl -0x10164(%rbp), %edx
leaq 0x61ea(%rip), %rsi      # 0x1f03f
movb $0x0, %al
callq 0x3300
jmp 0x18e5e
jmp 0x18da8
movq $0x1, -0x10170(%rbp)
jmp 0x19098
movq $0x1, -0x10170(%rbp)
jmp 0x19098
movq -0x10170(%rbp), %rax
movslq 0x4b7a7(%rip), %rcx     # 0x64638
cmpq %rcx, %rax
jbe 0x19096
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x18eb1
movq -0x20(%rbp), %rax
movq %rax, -0x10198(%rbp)
jmp 0x18ebc
movq -0x28(%rbp), %rax
movq %rax, -0x10198(%rbp)
movq -0x10198(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
andq 0x4b76e(%rip), %rax     # 0x64640
movl 0x4b73c(%rip), %ecx     # 0x64614
shll %ecx
movl %ecx, %ecx
shrq %cl, %rax
movl %eax, -0x10184(%rbp)
movq 0x4b764(%rip), %rax     # 0x64650
movslq -0x10184(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movslq 0x4b75a(%rip), %rcx     # 0x64660
cmpq %rcx, %rax
jae 0x18f1b
movq -0x40(%rbp), %rax
movslq 0x4b746(%rip), %rcx     # 0x6465c
cmpq %rcx, %rax
jae 0x18f20
jmp 0x19098
movq -0x40(%rbp), %rax
movslq 0x4b731(%rip), %rcx     # 0x6465c
subq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
andq 0x4b70b(%rip), %rax     # 0x64648
movq -0x30(%rbp), %rdx
movl 0x4b6cd(%rip), %ecx     # 0x64614
shll %ecx
movl %ecx, %ecx
movl $0x1, %esi
shlq %cl, %rsi
movq %rsi, %rcx
subq $0x1, %rcx
andq %rcx, %rdx
movl 0x4b6d5(%rip), %ecx     # 0x64638
shll %ecx
movl 0x4b6a9(%rip), %esi     # 0x64614
shll $0x2, %esi
subl %esi, %ecx
movl %ecx, %ecx
shlq %cl, %rdx
movq %rdx, %rcx
addq %rcx, %rax
movl 0x4b697(%rip), %ecx     # 0x64618
shll $0x2, %ecx
movl %ecx, %ecx
shrq %cl, %rax
addq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x10188(%rbp)
movl -0x10188(%rbp), %eax
cmpl 0x4b675(%rip), %eax     # 0x6461c
jae 0x19094
movq -0x38(%rbp), %rax
movl 0x4b665(%rip), %ecx     # 0x6461c
xorl %edx, %edx
divq %rcx
movq %rdx, -0x101a0(%rbp)
movl -0x10188(%rbp), %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl 0x4b647(%rip), %edx     # 0x6461c
subl $0x1, %edx
movl %edx, %edx
movl %edx, %esi
xorl %edx, %edx
divq %rsi
movq -0x101a0(%rbp), %rax
addq $0x1, %rdx
imulq %rdx, %rcx
addq %rcx, %rax
movl 0x4b623(%rip), %ecx     # 0x6461c
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0x1018c(%rbp)
movq -0x10(%rbp), %rax
movl -0x1018c(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
jne 0x19066
movq -0x38(%rbp), %rdx
movq -0x10(%rbp), %rax
movl -0x1018c(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0x1017c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1017c(%rbp)
movl -0x1017c(%rbp), %eax
cmpl 0x4b5dc(%rip), %eax     # 0x64620
jbe 0x19064
callq 0x3050
movl (%rax), %edi
movl 0x4b5b9(%rip), %edx     # 0x6460c
addl $0x1, %edx
leaq 0x6073(%rip), %rsi      # 0x1f0d0
movb $0x0, %al
callq 0x3300
jmp 0x19094
movq -0x10(%rbp), %rax
movl -0x1018c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpq -0x38(%rbp), %rax
jne 0x1907c
jmp 0x19094
jmp 0x1907e
jmp 0x19080
movl -0x10188(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10188(%rbp)
jmp 0x18f9b
jmp 0x19096
jmp 0x19098
movl -0x10180(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10180(%rbp)
jmp 0x18c59
movq -0x10058(%rbp), %rdi
callq 0x3180
movq -0x10(%rbp), %rax
addq $0x101a0, %rsp          # imm = 0x101A0
popq %rbp
retq
nopw %cs:(%rax,%rax)