// File: /workspace/github_c_makefile_star2_O0/yhg926[P]public_kssd/iseq2comem.c
// Function: fastq2koc
llong * fastq2koc (char* seqfname, llong *co, char *pipecmd, int Q)
{
  llong tuple = 0LLU, crvstuple = 0LLU, unituple, drtuple, pfilter;
  memset(co,0LLU,hashsize*sizeof(llong));
  FILE *infp;
  char fq_fname[PATHLEN];
 if(pipecmd[0] != '\0')
    sprintf(fq_fname,"%s %s",pipecmd,seqfname);
  else
    sprintf(fq_fname,"%s %s",gzpipe_cmd,seqfname);
  if( (infp=popen(fq_fname,"r")) == NULL ) err(errno,"fastq2koc():%s",fq_fname);
 char *seq = malloc(LEN+10);
  char *qual = malloc(LEN+10);
  fgets(seq,LEN,infp); fgets(seq,LEN,infp);
  fgets(qual,LEN,infp); fgets(qual,LEN,infp);
  llong base = 1; char ch ; int basenum,line_num = 0 ;
  unsigned int keycount =0 ;
 int sl = strlen(seq);
  for(int pos = 0; pos < sl; pos++){
    if(seq[pos] == '\n' ){
      fgets(seq,LEN,infp); fgets(seq,LEN,infp);
      fgets(qual,LEN,infp); fgets(qual,LEN,infp);
   sl = strlen(seq);
      line_num+=4;
      if( !feof(infp) ) {
        base = 1;
        pos = -1;
        continue ;
      }
      else break;
    }
    else{
      ch = seq[pos];
      basenum = Basemap[(int)ch];
      if( (basenum != DEFAULT) && ( qual[pos] >= Q ) ){
        tuple = ( ( tuple<< 2 ) | (llong)basenum ) & tupmask ;
        crvstuple = ( crvstuple >> 2 ) + (((llong)basenum^3LLU) << crvsaddmove);
        base++;
      }
      else {
        base = 1;
        continue;
      };
    };
    if( base > TL ){
      unituple = tuple < crvstuple ? tuple:crvstuple;
      unsigned 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] == 0LLU){
          co[n] = (drtuple << OCCRC_BIT) + 1LLU ;
          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] >> OCCRC_BIT ) == drtuple ) {
            if( (co[n] & OCCRC_MAX) < OCCRC_MAX )
              co[n]+=1LLU;
          break ;
        };
      };
    };
  }
  pclose(infp);
 free(seq);
 free(qual);
  return co;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movl 0x4aef8(%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 0x1975c
leaq -0x150(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x8(%rbp), %rcx
leaq 0x5893(%rip), %rsi      # 0x1efe6
movb $0x0, %al
callq 0x3400
jmp 0x1977c
leaq -0x150(%rbp), %rdi
movq -0x8(%rbp), %rcx
leaq 0x5878(%rip), %rsi      # 0x1efe6
leaq 0x5a72(%rip), %rdx      # 0x1f1e7
movb $0x0, %al
callq 0x3400
leaq -0x150(%rbp), %rdi
leaq 0x454e(%rip), %rsi      # 0x1dcd8
callq 0x3360
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
jne 0x197b5
callq 0x3050
movl (%rax), %edi
leaq -0x150(%rbp), %rdx
leaq 0x5a2a(%rip), %rsi      # 0x1f1d8
movb $0x0, %al
callq 0x3300
movl $0x4e2a, %edi           # imm = 0x4E2A
callq 0x3310
movq %rax, -0x158(%rbp)
movl $0x4e2a, %edi           # imm = 0x4E2A
callq 0x3310
movq %rax, -0x160(%rbp)
movq -0x158(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl $0x4e20, %esi           # imm = 0x4E20
callq 0x3260
movq -0x158(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl $0x4e20, %esi           # imm = 0x4E20
callq 0x3260
movq -0x160(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl $0x4e20, %esi           # imm = 0x4E20
callq 0x3260
movq -0x160(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl $0x4e20, %esi           # imm = 0x4E20
callq 0x3260
movq $0x1, -0x168(%rbp)
movl $0x0, -0x174(%rbp)
movl $0x0, -0x178(%rbp)
movq -0x158(%rbp), %rdi
callq 0x3110
movl %eax, -0x17c(%rbp)
movl $0x0, -0x180(%rbp)
movl -0x180(%rbp), %eax
cmpl -0x17c(%rbp), %eax
jge 0x19c55
movq -0x158(%rbp), %rax
movslq -0x180(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x19935
movq -0x158(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl $0x4e20, %esi           # imm = 0x4E20
callq 0x3260
movq -0x158(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl $0x4e20, %esi           # imm = 0x4E20
callq 0x3260
movq -0x160(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl $0x4e20, %esi           # imm = 0x4E20
callq 0x3260
movq -0x160(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl $0x4e20, %esi           # imm = 0x4E20
callq 0x3260
movq -0x158(%rbp), %rdi
callq 0x3110
movl %eax, -0x17c(%rbp)
movl -0x174(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x174(%rbp)
movq -0x50(%rbp), %rdi
callq 0x32a0
cmpl $0x0, %eax
jne 0x19930
movq $0x1, -0x168(%rbp)
movl $0xffffffff, -0x180(%rbp) # imm = 0xFFFFFFFF
jmp 0x19c41
jmp 0x19c55
movq -0x158(%rbp), %rax
movslq -0x180(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x169(%rbp)
movsbl -0x169(%rbp), %eax
movslq %eax, %rcx
leaq 0x5033(%rip), %rax      # 0x1e990
movl (%rax,%rcx,4), %eax
movl %eax, -0x170(%rbp)
cmpl $-0x1, -0x170(%rbp)
je 0x199dd
movq -0x160(%rbp), %rax
movslq -0x180(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl -0x1c(%rbp), %eax
jl 0x199dd
movq -0x28(%rbp), %rax
shlq $0x2, %rax
movslq -0x170(%rbp), %rcx
orq %rcx, %rax
andq 0x4ac91(%rip), %rax     # 0x64630
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
shrq $0x2, %rax
movslq -0x170(%rbp), %rdx
xorq $0x3, %rdx
movl 0x4ac70(%rip), %ecx     # 0x6462c
shlq %cl, %rdx
movq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x168(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x168(%rbp)
jmp 0x199ed
movq $0x1, -0x168(%rbp)
jmp 0x19c41
jmp 0x199ef
movq -0x168(%rbp), %rax
movslq 0x4ac3b(%rip), %rcx     # 0x64638
cmpq %rcx, %rax
jbe 0x19c3f
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x19a1d
movq -0x28(%rbp), %rax
movq %rax, -0x198(%rbp)
jmp 0x19a28
movq -0x30(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
andq 0x4ac02(%rip), %rax     # 0x64640
movl 0x4abd0(%rip), %ecx     # 0x64614
shll %ecx
movl %ecx, %ecx
shrq %cl, %rax
movl %eax, -0x184(%rbp)
movq 0x4abf8(%rip), %rax     # 0x64650
movl -0x184(%rbp), %ecx
movslq (%rax,%rcx,4), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movslq 0x4abef(%rip), %rcx     # 0x64660
cmpq %rcx, %rax
jae 0x19a86
movq -0x48(%rbp), %rax
movslq 0x4abdb(%rip), %rcx     # 0x6465c
cmpq %rcx, %rax
jae 0x19a8b
jmp 0x19c41
movq -0x48(%rbp), %rax
movslq 0x4abc6(%rip), %rcx     # 0x6465c
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
andq 0x4aba0(%rip), %rax     # 0x64648
movq -0x38(%rbp), %rdx
movl 0x4ab62(%rip), %ecx     # 0x64614
shll %ecx
movl %ecx, %ecx
movl $0x1, %esi
shlq %cl, %rsi
movq %rsi, %rcx
subq $0x1, %rcx
andq %rcx, %rdx
movl 0x4ab6a(%rip), %ecx     # 0x64638
shll %ecx
movl 0x4ab3e(%rip), %esi     # 0x64614
shll $0x2, %esi
subl %esi, %ecx
movl %ecx, %ecx
shlq %cl, %rdx
movq %rdx, %rcx
addq %rcx, %rax
movl 0x4ab2c(%rip), %ecx     # 0x64618
shll $0x2, %ecx
movl %ecx, %ecx
shrq %cl, %rax
addq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x188(%rbp)
movl -0x188(%rbp), %eax
cmpl 0x4ab0a(%rip), %eax     # 0x6461c
jae 0x19c3d
movq -0x40(%rbp), %rax
movl 0x4aafa(%rip), %ecx     # 0x6461c
xorl %edx, %edx
divq %rcx
movq %rdx, -0x1a0(%rbp)
movl -0x188(%rbp), %eax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl 0x4aadc(%rip), %edx     # 0x6461c
subl $0x1, %edx
movl %edx, %edx
movl %edx, %esi
xorl %edx, %edx
divq %rsi
movq -0x1a0(%rbp), %rax
addq $0x1, %rdx
imulq %rdx, %rcx
addq %rcx, %rax
movl 0x4aab8(%rip), %ecx     # 0x6461c
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0x18c(%rbp)
movq -0x10(%rbp), %rax
movl -0x18c(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
jne 0x19bd9
movq -0x40(%rbp), %rdx
shlq $0x10, %rdx
addq $0x1, %rdx
movq -0x10(%rbp), %rax
movl -0x18c(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0x178(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x178(%rbp)
movl -0x178(%rbp), %eax
cmpl 0x4aa69(%rip), %eax     # 0x64620
jbe 0x19bd7
callq 0x3050
movl (%rax), %edi
movl 0x4aa46(%rip), %edx     # 0x6460c
addl $0x1, %edx
leaq 0x5500(%rip), %rsi      # 0x1f0d0
movb $0x0, %al
callq 0x3300
jmp 0x19c3d
movq -0x10(%rbp), %rax
movl -0x18c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x10, %rax
cmpq -0x40(%rbp), %rax
jne 0x19c25
movq -0x10(%rbp), %rax
movl -0x18c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpq $0xffff, %rax           # imm = 0xFFFF
jae 0x19c23
movq -0x10(%rbp), %rax
movl -0x18c(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x19c3d
jmp 0x19c27
jmp 0x19c29
movl -0x188(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x188(%rbp)
jmp 0x19b06
jmp 0x19c3f
jmp 0x19c41
movl -0x180(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x180(%rbp)
jmp 0x19866
movq -0x50(%rbp), %rdi
callq 0x3180
movq -0x158(%rbp), %rdi
callq 0x3040
movq -0x160(%rbp), %rdi
callq 0x3040
movq -0x10(%rbp), %rax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
nopw %cs:(%rax,%rax)