// File: /workspace/github_c_makefile_star2_O3/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 $0x68, %rsp
movq %rdx, 0x20(%rsp)
movl %esi, 0x10(%rsp)
movl %edi, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
testl %r8d, %r8d
jle 0x7c7d
movq %r9, %r12
movl %r8d, %ebp
movl %ecx, %r14d
movl %r8d, %r13d
xorl %ebx, %ebx
xorl %r15d, %r15d
movq (%r12,%rbx,8), %rdi
callq 0x2130
addq %rax, %r15
incq %rbx
cmpq %rbx, %r13
jne 0x7a5d
xorl %eax, %eax
cmpl $0x0, 0x20(%rsp)
setne %al
leal 0x4(%rax), %ecx
cmpq $0x0, 0xa0(%rsp)
cmovnel %eax, %ecx
testl %r14d, %r14d
movl $0xe, %edx
cmovnsl %r14d, %edx
movl 0xc(%rsp), %edi
movl 0x10(%rsp), %esi
callq 0x6ac4
movq %rax, %rbx
movl %ebp, 0x10(%rax)
movq 0x50(%rax), %rdi
movl $0x18, %edx
movq %rdi, 0x50(%rsp)
movq %r13, %rsi
callq 0x124ec
movq %rax, 0x60(%rsp)
movq %rax, 0x20(%rbx)
addq $0x7, %r15
shrq $0x3, %r15
movl $0x4, %esi
movq %r15, %rdi
callq 0x2230
movq %rax, %rbp
movq %rax, 0x28(%rbx)
xorl %r15d, %r15d
movl $0x1, %esi
movl $0x28, %edx
xorl %edi, %edi
callq 0x124ec
movq %rbx, 0x18(%rsp)
movq %rax, 0x48(%rsp)
movq %rax, 0x58(%rbx)
leaq 0x2ed03(%rip), %r14     # 0x36810
xorl %ebx, %ebx
movq %r12, 0x28(%rsp)
movq %r13, 0x58(%rsp)
movq (%r12,%r15,8), %r13
leaq (%r15,%r15,2), %rax
movq 0x60(%rsp), %rcx
leaq (%rcx,%rax,8), %r12
cmpq $0x0, 0xa0(%rsp)
je 0x7b8f
movq 0xa0(%rsp), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x7b8f
callq 0x2130
leaq 0x1(%rax), %rsi
movq 0x50(%rsp), %rdi
callq 0x1264d
movq %rax, (%r12)
movq 0xa0(%rsp), %rcx
movq (%rcx,%r15,8), %rsi
movq %rax, %rdi
callq 0x2090
movq (%r12), %rsi
movq 0x48(%rsp), %rdi
leaq 0x14(%rsp), %rdx
callq 0x6ea2
cmpl $0x0, 0x14(%rsp)
je 0x7c91
movq %rbx, 0x8(%r12)
movq %r13, %rdi
callq 0x2130
movl %eax, 0x10(%r12)
movl $0x0, 0x14(%r12)
testl %eax, %eax
je 0x7c36
movl %eax, %edx
leal (,%rbx,4), %esi
xorl %edi, %edi
movq 0x28(%rsp), %r12
movzbl (%r13,%rdi), %ecx
movzbl (%r14,%rcx), %r8d
leaq (%rbx,%rdi), %r9
movl %esi, %ecx
andb $0x1c, %cl
shll %cl, %r8d
shrq $0x3, %r9
orl %r8d, (%rbp,%r9,4)
incq %rdi
addl $0x4, %esi
cmpq %rdx, %rdi
jb 0x7bc2
movl %eax, %ecx
addq %rcx, %rbx
movq $0x0, 0x30(%rsp)
xorl %edi, %edi
movq %r13, %rsi
movl %eax, %edx
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %r8d
movl %r15d, %r9d
leaq 0x30(%rsp), %rax
pushq %rax
pushq 0x28(%rsp)
callq 0x13720
addq $0x10, %rsp
movl 0x30(%rsp), %esi
movq 0x40(%rsp), %rdx
movq 0x18(%rsp), %rdi
callq 0x7cb0
jmp 0x7c3b
movq 0x28(%rsp), %r12
incq %r15
movq 0x58(%rsp), %r13
cmpq %r13, %r15
jne 0x7b19
movq 0x40(%rsp), %rdi
callq 0x2040
movq 0x18(%rsp), %rbx
movb (%rbx), %cl
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rcx
leaq 0x2c37(%rip), %rsi      # 0xa8a5
movl $0x1, %edi
movq %rbx, %rdx
callq 0x120b0
jmp 0x7c7f
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2561a(%rip), %rdi     # 0x2d2b2
leaq 0x2561a(%rip), %rsi     # 0x2d2b9
leaq 0x2561b(%rip), %rcx     # 0x2d2c1
movl $0x1c1, %edx            # imm = 0x1C1
callq 0x21a0