// File: chhylp123[P]hifiasm/Trio.cpp
// Function: ha_triobin_yak(hifiasm_opt_t const*)
static void ha_triobin_yak(const hifiasm_opt_t *opt)
{
    yak_ch_t *ch;
    int i /**, min_cnt = 2, mid_cnt = 5**/;
    tb_shared_t aux;
    memset(&aux, 0, sizeof(tb_shared_t));
	aux.n_threads = opt->thread_num, aux.print_diff = 0;
	aux.ratio_thres = 0.33;
	aux.seq = &R_INF;

    ch = yak_ch_restore_core(0,  opt->fn_bin_yak[0], YAK_LOAD_TRIOBIN1, opt->min_cnt, opt->mid_cnt);
	ch = yak_ch_restore_core(ch, opt->fn_bin_yak[1], YAK_LOAD_TRIOBIN2, opt->min_cnt, opt->mid_cnt);

    aux.k = ch->k;
    aux.ch = ch;
	aux.buf = (tb_buf_t*)calloc(aux.n_threads, sizeof(tb_buf_t));
	aux.bseq = (UC_Read*)calloc(aux.n_threads, sizeof(UC_Read));
	for (i = 0; i < aux.n_threads; ++i)
		init_UC_Read(&aux.bseq[i]);
	
	kt_for(aux.n_threads, tb_worker, &aux, aux.seq->total_reads);
	
    for (i = 0; i < aux.n_threads; ++i) {
		free(aux.buf[i].s);
		destory_UC_Read(&aux.bseq[i]);
	} 
	free(aux.buf);
	free(aux.bseq);
    yak_ch_destroy(ch);

	fprintf(stderr, "[M::%s::%.3f*%.2f] ==> partitioned reads using yak dumps\n", __func__, yak_realtime(), yak_cpu_usage());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x2100
movq -0x8(%rbp), %rax
movl 0x7c(%rax), %eax
movl %eax, -0x4c(%rbp)
movl $0x0, -0x48(%rbp)
movsd 0x21f4bb(%rip), %xmm0   # 0x389fd0
movsd %xmm0, -0x40(%rbp)
leaq 0x25a7af(%rip), %rax    # 0x3c52d0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x8(%rbp), %rax
movl 0x128(%rax), %ecx
movq -0x8(%rbp), %rax
movl 0x12c(%rax), %r8d
xorl %eax, %eax
movl %eax, %edi
movl $0x2, %edx
movb $0x0, %al
callq 0x16bbd0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x8(%rbp), %rax
movl 0x128(%rax), %ecx
movq -0x8(%rbp), %rax
movl 0x12c(%rax), %r8d
movl $0x3, %edx
movb $0x0, %al
callq 0x16bbd0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movslq -0x4c(%rbp), %rdi
movl $0x10, %esi
callq 0x2140
movq %rax, -0x30(%rbp)
movslq -0x4c(%rbp), %rdi
movl $0x20, %esi
callq 0x2140
movq %rax, -0x28(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0x16abea
movq -0x28(%rbp), %rdi
movslq -0x14(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x9850
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x16abc3
movl -0x4c(%rbp), %edi
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rcx
leaq 0x15b4(%rip), %rsi      # 0x16c1b0
leaq -0x50(%rbp), %rdx
callq 0x16d710
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0x16ac4b
movq -0x30(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x2210
movq -0x28(%rbp), %rdi
movslq -0x14(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x9670
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x16ac0c
movq -0x30(%rbp), %rdi
callq 0x2210
movq -0x28(%rbp), %rdi
callq 0x2210
movq -0x10(%rbp), %rdi
callq 0x16c810
movq 0x259373(%rip), %rax    # 0x3c3fe0
movq (%rax), %rax
movq %rax, -0x60(%rbp)
callq 0x1b7ca0
movsd %xmm0, -0x58(%rbp)
callq 0x1b7d20
movq -0x60(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
leaq 0x21f4f4(%rip), %rsi    # 0x38a18a
leaq 0x21f527(%rip), %rdx    # 0x38a1c4
movb $0x2, %al
callq 0x22a0
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)