// File: /workspace/github_c_makefile_star2_O3/lh3[P]minimap2/index.c
// Function: mm_idx_load
mm_idx_t *mm_idx_load(FILE *fp)
{
	char magic[4];
	uint32_t x[5], i;
	uint64_t sum_len = 0;
	mm_idx_t *mi;

	if (fread(magic, 1, 4, fp) != 4) return 0;
	if (strncmp(magic, MM_IDX_MAGIC, 4) != 0) return 0;
	if (fread(x, 4, 5, fp) != 5) return 0;
	mi = mm_idx_init(x[0], x[1], x[2], x[4]);
	mi->n_seq = x[3];
	mi->seq = (mm_idx_seq_t*)kcalloc(mi->km, mi->n_seq, sizeof(mm_idx_seq_t));
	for (i = 0; i < mi->n_seq; ++i) {
		uint8_t l;
		mm_idx_seq_t *s = &mi->seq[i];
		fread(&l, 1, 1, fp);
		if (l) {
			s->name = (char*)kmalloc(mi->km, l + 1);
			fread(s->name, 1, l, fp);
			s->name[l] = 0;
		}
		fread(&s->len, 4, 1, fp);
		s->offset = sum_len;
		s->is_alt = 0;
		sum_len += s->len;
	}
	for (i = 0; i < 1<<mi->b; ++i) {
		mm_idx_bucket_t *b = &mi->B[i];
		uint32_t j, size;
		khint_t k;
		idxhash_t *h;
		fread(&b->n, 4, 1, fp);
		b->p = (uint64_t*)malloc(b->n * 8);
		fread(b->p, 8, b->n, fp);
		fread(&size, 4, 1, fp);
		if (size == 0) continue;
		b->h = h = kh_init(idx);
		kh_resize(idx, h, size);
		for (j = 0; j < size; ++j) {
			uint64_t x[2];
			int absent;
			fread(x, 8, 2, fp);
			k = kh_put(idx, h, x[0], &absent);
			assert(absent);
			kh_val(h, k) = x[1];
		}
	}
	if (!(mi->flag & MM_I_NO_SEQ)) {
		mi->S = (uint32_t*)malloc((sum_len + 7) / 8 * 4);
		fread(mi->S, 4, (sum_len + 7) / 8, fp);
	}
	return mi;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x14(%rsp), %rdi
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x20c0
cmpq $0x4, %rax
jne 0x80ee
cmpl $0x2494d4d, 0x14(%rsp)  # imm = 0x2494D4D
jne 0x80ee
leaq 0x40(%rsp), %rdi
movl $0x4, %esi
movl $0x5, %edx
movq %rbx, %rcx
callq 0x20c0
cmpq $0x5, %rax
jne 0x80ee
movl 0x40(%rsp), %edi
movl 0x44(%rsp), %esi
movl 0x48(%rsp), %edx
movl 0x50(%rsp), %ecx
callq 0x6ac4
movq %rax, %r15
movl 0x4c(%rsp), %r14d
movl %r14d, 0x10(%rax)
movq 0x50(%rax), %r12
movl $0x18, %edx
movq %r12, %rdi
movq %r14, %rsi
callq 0x124ec
xorl %edx, %edx
movq %rax, 0x20(%r15)
testq %r14, %r14
movq %r15, 0x20(%rsp)
je 0x8103
movq %rax, %r13
addq $0x10, %r13
xorl %r15d, %r15d
movl $0x1, %esi
movl $0x1, %edx
leaq 0x30(%rsp), %rdi
movq %rbx, %rcx
callq 0x20c0
movzbl 0x30(%rsp), %ebp
testq %rbp, %rbp
je 0x80a7
leaq 0x1(%rbp), %rsi
movq %r12, %rdi
callq 0x1264d
movq %rax, -0x10(%r13)
movl $0x1, %esi
movq %rax, %rdi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x20c0
movq -0x10(%r13), %rax
movb $0x0, (%rax,%rbp)
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x20c0
movq %r15, -0x8(%r13)
movl $0x0, 0x4(%r13)
movl (%r13), %eax
addq %rax, %r15
addq $0x18, %r13
decq %r14
jne 0x805b
addq $0x7, %r15
shrq $0x3, %r15
movq %r15, 0x18(%rsp)
xorl %edx, %edx
movq 0x20(%rsp), %r15
jmp 0x810c
xorl %r14d, %r14d
movq %r14, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, 0x18(%rsp)
movl (%r15), %eax
movl %eax, 0x8(%rsp)
movq 0x30(%r15), %rax
movq %rax, 0x28(%rsp)
leaq 0x30(%rsp), %r13
leaq 0xc(%rsp), %r14
movq %rdx, 0x60(%rsp)
movl %edx, %eax
leaq (%rax,%rax,2), %r15
shlq $0x4, %r15
movq 0x28(%rsp), %rax
leaq (%rax,%r15), %r12
addq $0x18, %r12
movl $0x4, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x20c0
movslq (%r12), %rbp
leaq (,%rbp,8), %rdi
callq 0x22f0
movq %rax, 0x8(%r12)
movl $0x8, %esi
movq %rax, %rdi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x20c0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x10(%rsp), %rdi
movq %rbx, %rcx
callq 0x20c0
movl 0x10(%rsp), %r12d
testl %r12d, %r12d
je 0x8209
addq 0x28(%rsp), %r15
movl $0x1, %esi
movl $0x28, %edx
xorl %edi, %edi
callq 0x124ec
movq %rax, %rbp
movq %rax, 0x28(%r15)
movq %rax, %rdi
movl %r12d, %esi
callq 0x827d
movl $0x8, %esi
movl $0x2, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x20c0
movq 0x30(%rsp), %rsi
movq %rbp, %rdi
movq %r14, %rdx
callq 0x84fc
cmpl $0x0, 0xc(%rsp)
je 0x825e
movq 0x38(%rsp), %rcx
movq 0x20(%rbp), %rdx
movl %eax, %eax
movq %rcx, (%rdx,%rax,8)
decl %r12d
jne 0x81c9
movq 0x60(%rsp), %rdx
incl %edx
movl %edx, %eax
movl 0x8(%rsp), %ecx
shrl %cl, %eax
testl %eax, %eax
je 0x8126
movq 0x20(%rsp), %r14
testb $0x2, 0xc(%r14)
jne 0x80f1
movq 0x18(%rsp), %r15
leaq (,%r15,4), %rdi
callq 0x22f0
movq %rax, 0x28(%r14)
movl $0x4, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x20c0
jmp 0x80f1
leaq 0x2504d(%rip), %rdi     # 0x2d2b2
leaq 0x2504d(%rip), %rsi     # 0x2d2b9
leaq 0x2509f(%rip), %rcx     # 0x2d312
movl $0x230, %edx            # imm = 0x230
callq 0x21a0