// File: /workspace/github_c_makefile_star2_O0/yhg926[P]public_kssd/command_reverse.c
// Function: co_rvs2kmer_byreads
int co_rvs2kmer_byreads( reverse_opt_val_t *opt_val ){
  dim_shuffle_t* shuf_arr = read_dim_shuffle_file(opt_val->shufile);
 int shuf_arr_len = 1LLU << (4 * shuf_arr->dim_shuffle_stat.subk) ;
 unsigned int rev_shuf_arr[MIN_SUBCTX_DIM_SMP_SZ];
 int count = 0;
  for(unsigned int i=0; i< shuf_arr_len; i++) {
    if( shuf_arr->shuffled_dim[i] < MIN_SUBCTX_DIM_SMP_SZ ){
      rev_shuf_arr[shuf_arr->shuffled_dim[i]] = i ;
      count++;
    }
  }
 if(count != MIN_SUBCTX_DIM_SMP_SZ) err(errno,"count %d not match MIN_SUBCTX_DIM_SMP_SZ %d",count,MIN_SUBCTX_DIM_SMP_SZ);
 int comp_code_bits = shuf_arr->dim_shuffle_stat.k - shuf_arr->dim_shuffle_stat.drlevel > COMPONENT_SZ
                      ? 4*(shuf_arr->dim_shuffle_stat.k - shuf_arr->dim_shuffle_stat.drlevel - COMPONENT_SZ ) : 0 ;
 int inner_ctx_bits = shuf_arr->dim_shuffle_stat.subk * 4;
 int half_outer_ctx_bits = (shuf_arr->dim_shuffle_stat.k - shuf_arr->dim_shuffle_stat.subk) *2 ;
 int pf_bits = ( shuf_arr->dim_shuffle_stat.subk - shuf_arr->dim_shuffle_stat.drlevel ) * 4;
 int TL = shuf_arr->dim_shuffle_stat.k * 2;
 if (!(opt_val->num_remaining_args == 1 ))
  err(errno,"need speficy one query path");
 const char *qryco_dstat_fpath = NULL;
 qryco_dstat_fpath = test_get_fullpath(opt_val->remaining_args[0],co_dstat);
 if( qryco_dstat_fpath == NULL )
 err(errno,"%s is not a valid query folder",opt_val->remaining_args[0]);
 FILE *qry_co_stat_fp;
 if (( qry_co_stat_fp = fopen(qryco_dstat_fpath,"rb")) == NULL) err(errno,"qry co stat file:%s",qryco_dstat_fpath);
 char *qryco_dname = opt_val->remaining_args[0];
 co_dstat_t co_qry_dstat;
 fread( &co_qry_dstat, sizeof(co_dstat_t), 1, qry_co_stat_fp);
 FILE *cbd_fcode_comp_index_fp;
 char co_cbd_fcode[PATHLEN];char co_cbd_index_fcode[PATHLEN];
 struct stat fstat;
 sprintf(co_cbd_index_fcode,"%s/combco.index.0",qryco_dname);
 stat(co_cbd_index_fcode, &fstat);
 llong readn = fstat.st_size/sizeof(size_t) - 1 ;
 size_t **cbd_fcode_index_mem = (size_t **) malloc( co_qry_dstat.comp_num * sizeof(size_t *));
 FILE **cbd_fcode_comp_fp = (FILE **) malloc(co_qry_dstat.comp_num * sizeof(FILE *)) ;
 for ( int j = 0; j < co_qry_dstat.comp_num; j++ ){
  cbd_fcode_index_mem[j] = (size_t *) malloc( (readn+1)* sizeof(size_t));
  sprintf(co_cbd_index_fcode,"%s/combco.index.%d",qryco_dname,j);
  if( (cbd_fcode_comp_index_fp = fopen(co_cbd_index_fcode,"rb"))==NULL) err(errno,"co_rvs2kmer_btreads()::%s",co_cbd_index_fcode);
  fread(cbd_fcode_index_mem[j],sizeof(size_t),readn+1,cbd_fcode_comp_index_fp);
  fclose(cbd_fcode_comp_index_fp);
  sprintf(co_cbd_fcode,"%s/combco.%d",qryco_dname,j);
  if( (cbd_fcode_comp_fp[j] = fopen(co_cbd_fcode,"rb"))==NULL) err(errno,"co_rvs2kmer_btreads()::%s[%d]",co_cbd_fcode,j);
 }
 char *kstring = malloc(TL + 1);
 kstring[TL] = '\0';
 unsigned int ind;
 for(llong n=0; n< readn;n++){
  printf(">read %llu\n", n+1);
  for ( int j = 0; j < co_qry_dstat.comp_num; j++ ){
   for ( llong k=0; k< cbd_fcode_index_mem[j][n+1]-cbd_fcode_index_mem[j][n]; k++){
    fread(&ind,sizeof(unsigned int),1,cbd_fcode_comp_fp[j]);
    llong unituple = core_reverse2unituple(ind,j,comp_code_bits,pf_bits,inner_ctx_bits,half_outer_ctx_bits,rev_shuf_arr);
    for(int i=0; i<TL;i++){
     kstring[TL-i-1] = Mapbase[unituple % 4] ;
     unituple >>= 2 ;
    }
    printf("%s\n",kstring);
   }
  }
 }
 for ( int j = 0; j < co_qry_dstat.comp_num; j++ ){
  fclose(cbd_fcode_comp_fp[j]);
   free(cbd_fcode_index_mem[j]);
 }
 free(cbd_fcode_index_mem);
 free(cbd_fcode_comp_fp);
 return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4380, %rsp           # imm = 0x4380
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x16300
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
shll $0x2, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movl %eax, -0x14(%rbp)
movl $0x0, -0x4024(%rbp)
movl $0x0, -0x4028(%rbp)
movl -0x4028(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x10cfc
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x4028(%rbp), %ecx
cmpl $0x1000, (%rax,%rcx,4)  # imm = 0x1000
jge 0x10ce9
movl -0x4028(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x4028(%rbp), %edx
movslq (%rax,%rdx,4), %rax
movl %ecx, -0x4020(%rbp,%rax,4)
movl -0x4024(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4024(%rbp)
jmp 0x10ceb
movl -0x4028(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4028(%rbp)
jmp 0x10c99
cmpl $0x1000, -0x4024(%rbp)  # imm = 0x1000
je 0x10d28
callq 0x3050
movl (%rax), %edi
movl -0x4024(%rbp), %edx
leaq 0xcf57(%rip), %rsi      # 0x1dc73
movl $0x1000, %ecx           # imm = 0x1000
movb $0x0, %al
callq 0x3300
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
subl 0xc(%rcx), %eax
cmpl $0x7, %eax
jle 0x10d57
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
subl 0xc(%rcx), %eax
subl $0x7, %eax
shll $0x2, %eax
movl %eax, -0x436c(%rbp)
jmp 0x10d61
xorl %eax, %eax
movl %eax, -0x436c(%rbp)
jmp 0x10d61
movl -0x436c(%rbp), %eax
movl %eax, -0x402c(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
shll $0x2, %eax
movl %eax, -0x4030(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
subl 0x8(%rcx), %eax
shll %eax
movl %eax, -0x4034(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
subl 0xc(%rcx), %eax
shll $0x2, %eax
movl %eax, -0x4038(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
movl %eax, -0x403c(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x208(%rax)
je 0x10ddb
callq 0x3050
movl (%rax), %edi
leaq 0xcecb(%rip), %rsi      # 0x1dc9f
movb $0x0, %al
callq 0x3300
movq $0x0, -0x4048(%rbp)
movq -0x8(%rbp), %rax
movq 0x210(%rax), %rax
movq (%rax), %rdi
leaq 0xb8f5(%rip), %rsi      # 0x1c6f0
callq 0x8250
movq %rax, -0x4048(%rbp)
cmpq $0x0, -0x4048(%rbp)
jne 0x10e34
callq 0x3050
movl (%rax), %edi
movq -0x8(%rbp), %rax
movq 0x210(%rax), %rax
movq (%rax), %rdx
leaq 0xce8e(%rip), %rsi      # 0x1dcbb
movb $0x0, %al
callq 0x3300
movq -0x4048(%rbp), %rdi
leaq 0xb215(%rip), %rsi      # 0x1c057
callq 0x3370
movq %rax, -0x4050(%rbp)
cmpq $0x0, %rax
jne 0x10e70
callq 0x3050
movl (%rax), %edi
movq -0x4048(%rbp), %rdx
leaq 0xbb3a(%rip), %rsi      # 0x1c9a3
movb $0x0, %al
callq 0x3300
movq -0x8(%rbp), %rax
movq 0x210(%rax), %rax
movq (%rax), %rax
movq %rax, -0x4058(%rbp)
movq -0x4050(%rbp), %rcx
leaq -0x4078(%rbp), %rdi
movl $0x20, %esi
movl $0x1, %edx
callq 0x30a0
leaq -0x4280(%rbp), %rdi
movq -0x4058(%rbp), %rdx
leaq 0xce23(%rip), %rsi      # 0x1dcda
movb $0x0, %al
callq 0x3400
leaq -0x4280(%rbp), %rdi
leaq -0x4310(%rbp), %rsi
callq 0x32b0
movq -0x42e0(%rbp), %rax
shrq $0x3, %rax
subq $0x1, %rax
movq %rax, -0x4318(%rbp)
movslq -0x4068(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3310
movq %rax, -0x4320(%rbp)
movslq -0x4068(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3310
movq %rax, -0x4328(%rbp)
movl $0x0, -0x432c(%rbp)
movl -0x432c(%rbp), %eax
cmpl -0x4068(%rbp), %eax
jge 0x11077
movq -0x4318(%rbp), %rdi
addq $0x1, %rdi
shlq $0x3, %rdi
callq 0x3310
movq %rax, %rdx
movq -0x4320(%rbp), %rax
movslq -0x432c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq -0x4280(%rbp), %rdi
movq -0x4058(%rbp), %rdx
movl -0x432c(%rbp), %ecx
leaq 0xb0f9(%rip), %rsi      # 0x1c06e
movb $0x0, %al
callq 0x3400
leaq -0x4280(%rbp), %rdi
leaq 0xb0cd(%rip), %rsi      # 0x1c057
callq 0x3370
movq %rax, -0x4080(%rbp)
cmpq $0x0, %rax
jne 0x10fb8
callq 0x3050
movl (%rax), %edi
leaq -0x4280(%rbp), %rdx
leaq 0xcd3b(%rip), %rsi      # 0x1dcec
movb $0x0, %al
callq 0x3300
movq -0x4320(%rbp), %rax
movslq -0x432c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x4318(%rbp), %rdx
addq $0x1, %rdx
movq -0x4080(%rbp), %rcx
movl $0x8, %esi
callq 0x30a0
movq -0x4080(%rbp), %rdi
callq 0x30e0
leaq -0x4180(%rbp), %rdi
movq -0x4058(%rbp), %rdx
movl -0x432c(%rbp), %ecx
leaq 0xb074(%rip), %rsi      # 0x1c081
movb $0x0, %al
callq 0x3400
leaq -0x4180(%rbp), %rdi
leaq 0xb035(%rip), %rsi      # 0x1c057
callq 0x3370
movq -0x4328(%rbp), %rcx
movslq -0x432c(%rbp), %rdx
movq %rax, (%rcx,%rdx,8)
cmpq $0x0, %rax
jne 0x11061
callq 0x3050
movl (%rax), %edi
leaq -0x4180(%rbp), %rdx
movl -0x432c(%rbp), %ecx
leaq 0xccac(%rip), %rsi      # 0x1dd06
movb $0x0, %al
callq 0x3300
jmp 0x11063
movl -0x432c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x432c(%rbp)
jmp 0x10f1f
movl -0x403c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x3310
movq %rax, -0x4338(%rbp)
movq -0x4338(%rbp), %rax
movslq -0x403c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq $0x0, -0x4348(%rbp)
movq -0x4348(%rbp), %rax
cmpq -0x4318(%rbp), %rax
jae 0x11277
movq -0x4348(%rbp), %rsi
addq $0x1, %rsi
leaq 0xcc52(%rip), %rdi      # 0x1dd24
movb $0x0, %al
callq 0x3150
movl $0x0, -0x434c(%rbp)
movl -0x434c(%rbp), %eax
cmpl -0x4068(%rbp), %eax
jge 0x1125e
movq $0x0, -0x4358(%rbp)
movq -0x4358(%rbp), %rax
movq -0x4320(%rbp), %rcx
movslq -0x434c(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq -0x4348(%rbp), %rdx
movq 0x8(%rcx,%rdx,8), %rcx
movq -0x4320(%rbp), %rdx
movslq -0x434c(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movq -0x4348(%rbp), %rsi
subq (%rdx,%rsi,8), %rcx
cmpq %rcx, %rax
jae 0x11248
movq -0x4328(%rbp), %rax
movslq -0x434c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
leaq -0x433c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x30a0
movl -0x433c(%rbp), %edi
movl -0x434c(%rbp), %esi
movl -0x402c(%rbp), %edx
movl -0x4038(%rbp), %ecx
movl -0x4030(%rbp), %r8d
movl -0x4034(%rbp), %r9d
leaq -0x4020(%rbp), %rax
movq %rax, (%rsp)
callq 0x11bd0
movq %rax, -0x4360(%rbp)
movl $0x0, -0x4364(%rbp)
movl -0x4364(%rbp), %eax
cmpl -0x403c(%rbp), %eax
jge 0x1121c
movq -0x4360(%rbp), %rcx
andq $0x3, %rcx
leaq 0xd9b6(%rip), %rax      # 0x1eb90
movb (%rax,%rcx), %dl
movq -0x4338(%rbp), %rax
movl -0x403c(%rbp), %ecx
subl -0x4364(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x4360(%rbp), %rax
shrq $0x2, %rax
movq %rax, -0x4360(%rbp)
movl -0x4364(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4364(%rbp)
jmp 0x111ba
movq -0x4338(%rbp), %rsi
leaq 0xc240(%rip), %rdi      # 0x1d46a
movb $0x0, %al
callq 0x3150
movq -0x4358(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4358(%rbp)
jmp 0x11100
jmp 0x1124a
movl -0x434c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x434c(%rbp)
jmp 0x110e3
jmp 0x11260
movq -0x4348(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4348(%rbp)
jmp 0x110ac
movl $0x0, -0x4368(%rbp)
movl -0x4368(%rbp), %eax
cmpl -0x4068(%rbp), %eax
jge 0x112ce
movq -0x4328(%rbp), %rax
movslq -0x4368(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x30e0
movq -0x4320(%rbp), %rax
movslq -0x4368(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3040
movl -0x4368(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4368(%rbp)
jmp 0x11281
movq -0x4320(%rbp), %rdi
callq 0x3040
movq -0x4328(%rbp), %rdi
callq 0x3040
movl $0x1, %eax
addq $0x4380, %rsp           # imm = 0x4380
popq %rbp
retq
nopw %cs:(%rax,%rax)