// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Trio.cpp
// Function: ha_polybin_list(hifiasm_opt_t const*)
uint32_t *ha_polybin_list(const hifiasm_opt_t *opt)
{
	int64_t i;
	khint_t k;
	cstr_ht_t *h;
	assert(R_INF.total_reads < (uint32_t)-1);
	h = cstr_ht_init();
	for (i = 0; i < (int64_t)R_INF.total_reads; ++i) {
		int absent;
		char *str = (char*)calloc(Get_NAME_LENGTH(R_INF, i) + 1, 1);
		strncpy(str, Get_NAME(R_INF, i), Get_NAME_LENGTH(R_INF, i));
		k = cstr_ht_put(h, str, &absent);
		if (absent) kh_val(h, k) = i;
	}
	fprintf(stderr, "[M::%s::%.3f*%.2f] created the hash table for read names\n", __func__, yak_realtime(), yak_cpu_usage());

	gzFile fp;
	kstream_t *ks;
	kstring_t str = {0,0,0};
	char *rname = NULL;
	uint32_t hid, *ss = NULL;
	int dret;
	int64_t n_tot = 0, n_bin = 0;
	fp = gzopen(opt->fn_bin_poy, "r");
	if (fp == 0) {
		fprintf(stderr, "ERROR: failed to open file '%s'\n", opt->fn_bin_poy);
		for (k = 0; k < kh_end(h); ++k)
			if (kh_exist(h, k))
				free((char*)kh_key(h, k));
		cstr_ht_destroy(h);
		return NULL;
	}
	CALLOC(ss, R_INF.total_reads);
	ks = ks_init(fp);
	while (ks_getuntil(ks, KS_SEP_LINE, &str, &dret) >= 0) {
		khint_t k; ++n_tot;
		phrase_hstatus(str.s, &rname, &hid);
		if((!(*rname)) || hid == (uint32_t)-1) {
			fprintf(stderr, "ERROR: wrong hap status\n");
			continue;
		}
		k = cstr_ht_get(h, rname);
		if (k != kh_end(h)) {
			ss[kh_val(h, k)] |= (((uint32_t)1)<<(hid-1));
			++n_bin;
		}
	}
	free(str.s);
	ks_destroy(ks);
	gzclose(fp);
	
	for (k = 0; k < kh_end(h); ++k)
		if (kh_exist(h, k))
			free((char*)kh_key(h, k));
	cstr_ht_destroy(h);
	fprintf(stderr, "[M::%s::%.3f*%.2f] ==> partitioned reads with external lists\n", __func__, yak_realtime(), yak_cpu_usage());
	return ss;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
leaq 0x18f380(%rip), %rax    # 0x254230
movq 0x50(%rax), %r15
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r15
jae 0xc51aa
movq %rdi, %r13
xorl %r12d, %r12d
callq 0xc51c9
movq %rax, %rbx
movq %r13, 0x8(%rsp)
cmpq %r15, %r12
jge 0xc4f4d
leaq 0x18f34f(%rip), %r14    # 0x254230
movq 0x40(%r14), %rax
movq (%rax,%r12,8), %r13
movq 0x8(%rax,%r12,8), %rbp
subq %r13, %rbp
leaq 0x1(%rbp), %rdi
pushq $0x1
popq %rsi
callq 0x2120
movq %rax, %r15
addq 0x8(%r14), %r13
movq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x20d0
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x20(%rsp), %rdx
callq 0xc51d4
cmpl $0x0, 0x20(%rsp)
je 0xc4f38
movq 0x10(%rbx), %rcx
movl %eax, %eax
shlq $0x4, %rax
movq %r12, 0x8(%rcx,%rax)
leaq 0x18f2f1(%rip), %rax    # 0x254230
movq 0x50(%rax), %r15
incq %r12
movq 0x8(%rsp), %r13
jmp 0xc4ed5
movq 0x18e08c(%rip), %r12    # 0x252fe0
movq (%r12), %r15
callq 0xefea7
movsd %xmm0, (%rsp)
callq 0xefef4
movaps %xmm0, %xmm1
leaq 0x12638d(%rip), %rsi    # 0x1eb2fe
leaq 0x1263c0(%rip), %rdx    # 0x1eb338
movq %r15, %rdi
movsd (%rsp), %xmm0
movb $0x2, %al
callq 0x22b0
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
andq $0x0, 0x18(%rsp)
movq 0x40(%r13), %rdi
leaq 0x12c711(%rip), %rsi    # 0x1f16b7
callq 0x22d0
testq %rax, %rax
jne 0xc5010
movq (%r12), %rdi
movq 0x40(%r13), %rdx
leaq 0x126389(%rip), %rsi    # 0x1eb348
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x22b0
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0xc4fdf
movb (%rbx), %cl
pushq $0x1
popq %rdx
shlq %cl, %rdx
jmp 0xc4fe1
xorl %edx, %edx
cmpq %rdx, %r15
jae 0xc50e5
movq 0x8(%rbx), %rcx
movq %r15, %rdx
shrq $0x5, %rdx
movl (%rcx,%rdx,4), %ecx
btl %r15d, %ecx
jae 0xc5007
movq (%rax,%r14), %rdi
callq 0x2220
incq %r15
addq $0x10, %r14
jmp 0xc4fcc
movq %rax, %r15
leaq 0x18f216(%rip), %rax    # 0x254230
movq 0x50(%rax), %rdi
pushq $0x4
popq %rsi
callq 0x2120
movq %rax, 0x8(%rsp)
movq %r15, (%rsp)
movq %r15, %rdi
callq 0xc4c78
movq %rax, %r13
leaq 0x18(%rsp), %r15
leaq 0x14(%rsp), %r14
pushq $0x1
popq %r12
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x44(%rsp), %rdx
callq 0xc4ca9
movq 0x30(%rsp), %rdi
testl %eax, %eax
js 0xc50f4
movq %r15, %rsi
movq %r14, %rdx
callq 0xc675a
movq 0x18(%rsp), %rsi
cmpb $0x0, (%rsi)
je 0xc50c4
movl 0x14(%rsp), %ebp
cmpl $-0x1, %ebp
je 0xc50c4
movq %rbx, %rdi
callq 0xc5540
movq 0x10(%rbx), %rdx
testq %rdx, %rdx
je 0xc509f
movb (%rbx), %cl
movl %r12d, %esi
shll %cl, %esi
jmp 0xc50a1
xorl %esi, %esi
cmpl %esi, %eax
je 0xc5048
decb %bpl
movl %r12d, %esi
movl %ebp, %ecx
shll %cl, %esi
movl %eax, %eax
shlq $0x4, %rax
movq 0x8(%rdx,%rax), %rax
movq 0x8(%rsp), %rcx
orl %esi, (%rcx,%rax,4)
jmp 0xc5048
movq 0x18df15(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x126294(%rip), %rdi    # 0x1eb369
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
jmp 0xc5048
movq %rbx, %rdi
callq 0xc551b
xorl %eax, %eax
jmp 0xc519b
callq 0x2220
movq %r13, %rdi
callq 0xc4e80
movq (%rsp), %rdi
callq 0x2390
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x18dec9(%rip), %r12    # 0x252fe0
pushq $0x1
popq %r13
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0xc512e
movb (%rbx), %cl
movq %r13, %rdx
shlq %cl, %rdx
jmp 0xc5130
xorl %edx, %edx
cmpq %rdx, %r15
jae 0xc515b
movq 0x8(%rbx), %rcx
movq %r15, %rdx
shrq $0x5, %rdx
movl (%rcx,%rdx,4), %ecx
btl %r15d, %ecx
jae 0xc5152
movq (%rax,%r14), %rdi
callq 0x2220
incq %r15
addq $0x10, %r14
jmp 0xc511b
movq %rbx, %rdi
callq 0xc551b
movq (%r12), %rbx
callq 0xefea7
movsd %xmm0, (%rsp)
callq 0xefef4
movaps %xmm0, %xmm1
leaq 0x126202(%rip), %rsi    # 0x1eb382
leaq 0x1261b1(%rip), %rdx    # 0x1eb338
movq %rbx, %rdi
movsd (%rsp), %xmm0
movb $0x2, %al
callq 0x22b0
movq 0x8(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1260f2(%rip), %rdi    # 0x1eb2a3
leaq 0x12610c(%rip), %rsi    # 0x1eb2c4
leaq 0x12610e(%rip), %rcx    # 0x1eb2cd
movl $0x18c, %edx            # imm = 0x18C
callq 0x2110