// File: /workspace/github_c_makefile_star2_O1/lh3[P]minimap2/index.c
// Function: mm_idx_str
mm_idx_t *mm_idx_str(int w, int k, int is_hpc, int bucket_bits, int n, const char **seq, const char **name)
{
	uint64_t sum_len = 0;
	mm128_v a = {0,0,0};
	mm_idx_t *mi;
	khash_t(str) *h;
	int i, flag = 0;

	if (n <= 0) return 0;
	for (i = 0; i < n; ++i) // get the total length
		sum_len += strlen(seq[i]);
	if (is_hpc) flag |= MM_I_HPC;
	if (name == 0) flag |= MM_I_NO_NAME;
	if (bucket_bits < 0) bucket_bits = 14;
	mi = mm_idx_init(w, k, bucket_bits, flag);
	mi->n_seq = n;
	mi->seq = (mm_idx_seq_t*)kcalloc(mi->km, n, sizeof(mm_idx_seq_t)); // ->seq is allocated from km
	mi->S = (uint32_t*)calloc((sum_len + 7) / 8, 4);
	mi->h = h = kh_init(str);
	for (i = 0, sum_len = 0; i < n; ++i) {
		const char *s = seq[i];
		mm_idx_seq_t *p = &mi->seq[i];
		uint32_t j;
		if (name && name[i]) {
			int absent;
			p->name = (char*)kmalloc(mi->km, strlen(name[i]) + 1);
			strcpy(p->name, name[i]);
			kh_put(str, h, p->name, &absent);
			assert(absent);
		}
		p->offset = sum_len;
		p->len = strlen(s);
		p->is_alt = 0;
		for (j = 0; j < p->len; ++j) {
			int c = seq_nt4_table[(uint8_t)s[j]];
			uint64_t o = sum_len + j;
			mm_seq4_set(mi->S, o, c);
		}
		sum_len += p->len;
		if (p->len > 0) {
			a.n = 0;
			mm_sketch(0, s, p->len, w, k, i, is_hpc, &a);
			mm_idx_add(mi, a.n, a.a);
		}
	}
	free(a.a);
	mm_idx_post(mi, 1);
	return mi;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, 0x18(%rsp)
movl %esi, 0x4(%rsp)
movl %edi, (%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
testl %r8d, %r8d
jle 0x7cb1
movq %r9, %r12
movl %r8d, %ebp
movl %ecx, %r15d
movl %r8d, %r13d
xorl %ebx, %ebx
xorl %r14d, %r14d
movq (%r12,%rbx,8), %rdi
callq 0x2130
addq %rax, %r14
incq %rbx
cmpq %rbx, %r13
jne 0x7a98
movq %r12, 0x50(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x18(%rsp)
setne %al
leal 0x4(%rax), %ecx
cmpq $0x0, 0x90(%rsp)
cmovnel %eax, %ecx
testl %r15d, %r15d
movl $0xe, %edx
cmovnsl %r15d, %edx
movl (%rsp), %edi
movl 0x4(%rsp), %esi
callq 0x6b3c
movq %rax, %r15
movl %ebp, 0x10(%rax)
movq 0x50(%rax), %rdi
movl $0x18, %edx
movq %r13, %rsi
callq 0x1257c
movq %rax, 0x20(%r15)
addq $0x7, %r14
shrq $0x3, %r14
movl $0x4, %esi
movq %r14, %rdi
callq 0x2230
movq %rax, 0x28(%r15)
xorl %r14d, %r14d
movl $0x1, %esi
movl $0x28, %edx
xorl %edi, %edi
callq 0x1257c
movq %rax, 0x40(%rsp)
movq %rax, 0x58(%r15)
leaq 0x2dcd6(%rip), %rbx     # 0x35810
xorl %r12d, %r12d
movq %r15, 0x8(%rsp)
movq %r13, 0x48(%rsp)
leaq (%r14,%r14,2), %r13
shlq $0x3, %r13
addq 0x20(%r15), %r13
movq 0x50(%rsp), %rax
movq (%rax,%r14,8), %rbp
cmpq $0x0, 0x90(%rsp)
je 0x7bc3
movq 0x90(%rsp), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x7bc3
movq 0x50(%r15), %r15
callq 0x2130
leaq 0x1(%rax), %rsi
movq %r15, %rdi
callq 0x126e9
movq %rax, (%r13)
movq 0x90(%rsp), %rcx
movq (%rcx,%r14,8), %rsi
movq %rax, %rdi
callq 0x2090
movq (%r13), %rsi
movq 0x40(%rsp), %rdi
leaq 0x14(%rsp), %rdx
callq 0x6f09
cmpl $0x0, 0x14(%rsp)
je 0x7cc6
movq %r12, 0x8(%r13)
movq %rbp, %rdi
callq 0x2130
movq %rax, %r15
movl %r15d, 0x10(%r13)
movl $0x0, 0x14(%r13)
testl %r15d, %r15d
je 0x7c21
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
leal (,%r12,4), %edx
xorl %esi, %esi
movzbl (%rbp,%rsi), %ecx
movzbl (%rbx,%rcx), %edi
leaq (%r12,%rsi), %r8
movl %edx, %ecx
andb $0x1c, %cl
shll %cl, %edi
shrq $0x3, %r8
orl %edi, (%rax,%r8,4)
incq %rsi
movl 0x10(%r13), %r15d
addl $0x4, %edx
cmpq %r15, %rsi
jb 0x7bf6
testl %r15d, %r15d
je 0x7c68
movq $0x0, 0x20(%rsp)
xorl %edi, %edi
movq %rbp, %rsi
movl %r15d, %edx
movl (%rsp), %ecx
movl 0x4(%rsp), %r8d
movl %r14d, %r9d
leaq 0x20(%rsp), %rax
pushq %rax
pushq 0x20(%rsp)
callq 0x1376c
addq $0x10, %rsp
movl 0x20(%rsp), %esi
movq 0x30(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x7ce5
movl %r15d, %eax
addq %rax, %r12
incq %r14
movq 0x48(%rsp), %r13
cmpq %r13, %r14
movq 0x8(%rsp), %r15
jne 0x7b47
movq 0x30(%rsp), %rdi
callq 0x2040
movb (%r15), %cl
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rcx
leaq 0x2d16(%rip), %rsi      # 0xa9b8
movl $0x1, %edi
movq %r15, %rdx
callq 0x12138
jmp 0x7cb4
xorl %r15d, %r15d
movq %r15, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x245c1(%rip), %rdi     # 0x2c28e
leaq 0x245c1(%rip), %rsi     # 0x2c295
leaq 0x245c2(%rip), %rcx     # 0x2c29d
movl $0x1c1, %edx            # imm = 0x1C1
callq 0x21a0