// File: /workspace/github_c_makefile_star2_O2/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 0x24(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x4
popq %rdx
movq %rbx, %rcx
callq 0x20c0
cmpq $0x4, %rax
jne 0x7025
cmpl $0x2494d4d, 0x24(%rsp)  # imm = 0x2494D4D
jne 0x7025
leaq 0x40(%rsp), %rdi
pushq $0x4
popq %rsi
pushq $0x5
popq %rdx
movq %rbx, %rcx
callq 0x20c0
cmpq $0x5, %rax
jne 0x7025
movl 0x40(%rsp), %edi
movl 0x44(%rsp), %esi
movl 0x48(%rsp), %edx
movl 0x50(%rsp), %ecx
callq 0x58d0
movq %rax, %r15
movl 0x4c(%rsp), %r14d
movl %r14d, 0x10(%rax)
movq 0x50(%rax), %r12
pushq $0x18
popq %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x10980
movq %rax, %r13
movq %r15, 0x28(%rsp)
movq %rax, 0x20(%r15)
addq $0x10, %r13
movq $0x0, 0x8(%rsp)
pushq $0x1
popq %rbp
subq $0x1, %r14
jb 0x703a
leaq 0x30(%rsp), %rdi
movq %rbp, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x20c0
movzbl 0x30(%rsp), %r15d
testq %r15, %r15
je 0x6ff1
leaq 0x1(%r15), %rsi
movq %r12, %rdi
callq 0x10afc
movq %rax, -0x10(%r13)
movq %rax, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x20c0
movq -0x10(%r13), %rax
movb $0x0, (%rax,%r15)
movq %r13, %rdi
pushq $0x4
popq %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x20c0
movq 0x8(%rsp), %rcx
movq %rcx, -0x8(%r13)
andl $0x0, 0x4(%r13)
movl (%r13), %eax
addq %rax, %rcx
movq %rcx, 0x8(%rsp)
addq $0x18, %r13
jmp 0x6f9f
xorl %r15d, %r15d
movq %r15, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rsp), %r15
movl (%r15), %eax
movl %eax, 0x14(%rsp)
xorl %edx, %edx
pushq $0x8
popq %r14
leaq 0x1c(%rsp), %rbp
movl %edx, %eax
movl 0x14(%rsp), %ecx
shrl %cl, %eax
testl %eax, %eax
jne 0x7147
movq 0x30(%r15), %rcx
movl %edx, 0x18(%rsp)
movl %edx, %eax
imulq $0x30, %rax, %r13
movq %rcx, 0x60(%rsp)
leaq (%rcx,%r13), %r15
addq $0x18, %r15
movq %r15, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x20c0
movslq (%r15), %r12
leaq (,%r12,8), %rdi
callq 0x22f0
movq %rax, 0x8(%r15)
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x20c0
leaq 0x20(%rsp), %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x20c0
movl 0x20(%rsp), %r15d
testl %r15d, %r15d
je 0x7137
movq %r13, %rax
movq 0x60(%rsp), %r13
addq %rax, %r13
callq 0x71a5
movq %rax, %r12
movq %rax, 0x28(%r13)
pushq $0x2
popq %r13
movq %rax, %rdi
movl %r15d, %esi
callq 0x71b2
subl $0x1, %r15d
jb 0x7137
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x20c0
movq 0x30(%rsp), %rsi
movq %r12, %rdi
movq %rbp, %rdx
callq 0x7414
cmpl $0x0, 0x1c(%rsp)
je 0x7186
movq 0x38(%rsp), %rcx
movq 0x20(%r12), %rdx
movl %eax, %eax
movq %rcx, (%rdx,%rax,8)
jmp 0x70f5
movl 0x18(%rsp), %edx
incl %edx
movq 0x28(%rsp), %r15
jmp 0x7051
testb $0x2, 0xc(%r15)
jne 0x7028
movq 0x8(%rsp), %r14
addq $0x7, %r14
shrq $0x3, %r14
leaq (,%r14,4), %rdi
callq 0x22f0
movq %rax, 0x28(%r15)
pushq $0x4
popq %rsi
movq %rax, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x20c0
jmp 0x7028
leaq 0x21125(%rip), %rdi     # 0x282b2
leaq 0x21125(%rip), %rsi     # 0x282b9
leaq 0x21177(%rip), %rcx     # 0x28312
movl $0x230, %edx            # imm = 0x230
callq 0x21a0