// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x40(%rbp)
leaq -0x14(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x20c0
cmpq $0x4, %rax
je 0xa1a1
movq $0x0, -0x8(%rbp)
jmp 0xa4e6
leaq -0x14(%rbp), %rdi
leaq 0x4cd49(%rip), %rsi     # 0x56ef5
movl $0x4, %edx
callq 0x2080
cmpl $0x0, %eax
je 0xa1c8
movq $0x0, -0x8(%rbp)
jmp 0xa4e6
leaq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x4, %esi
movl $0x5, %edx
callq 0x20c0
cmpq $0x5, %rax
je 0xa1f2
movq $0x0, -0x8(%rbp)
jmp 0xa4e6
movl -0x30(%rbp), %edi
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
movl -0x20(%rbp), %ecx
callq 0x7b90
movq %rax, -0x48(%rbp)
movl -0x24(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x48(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x48(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %esi
movl $0x18, %edx
callq 0x1a790
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x20(%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0xa319
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rcx
leaq -0x49(%rbp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x20c0
cmpb $0x0, -0x49(%rbp)
je 0xa2ca
movq -0x48(%rbp), %rax
movq 0x50(%rax), %rdi
movzbl -0x49(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x1aae0
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movzbl -0x49(%rbp), %eax
movl %eax, %edx
movq -0x10(%rbp), %rcx
movl $0x1, %esi
callq 0x20c0
movq -0x58(%rbp), %rax
movq (%rax), %rax
movzbl -0x49(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movq -0x58(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x20c0
movq -0x40(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x58(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x58(%rbp), %rax
movl 0x10(%rax), %eax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa23e
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x48(%rbp), %rcx
movl (%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jae 0xa48d
movq -0x48(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x20c0
movq -0x60(%rbp), %rax
movl 0x18(%rax), %eax
shll $0x3, %eax
movslq %eax, %rdi
callq 0x22e0
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x60(%rbp), %rax
movslq 0x18(%rax), %rdx
movq -0x10(%rbp), %rcx
movl $0x8, %esi
callq 0x20c0
movq -0x10(%rbp), %rcx
leaq -0x68(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x20c0
cmpl $0x0, -0x68(%rbp)
jne 0xa3c8
jmp 0xa47f
callq 0xa500
movq %rax, %rcx
movq %rcx, -0x78(%rbp)
movq -0x60(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x78(%rbp), %rdi
movl -0x68(%rbp), %esi
callq 0xa520
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x68(%rbp), %eax
jae 0xa47d
leaq -0x90(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x8, %esi
movl $0x2, %edx
callq 0x20c0
movq -0x78(%rbp), %rdi
movq -0x90(%rbp), %rsi
leaq -0x94(%rbp), %rdx
callq 0xaa00
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x94(%rbp)
je 0xa43a
jmp 0xa459
leaq 0x4ca59(%rip), %rdi     # 0x56e9a
leaq 0x4ca59(%rip), %rsi     # 0x56ea1
movl $0x230, %edx            # imm = 0x230
leaq 0x4caa6(%rip), %rcx     # 0x56efa
callq 0x21a0
movq -0x88(%rbp), %rdx
movq -0x78(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x6c(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0xa3ef
jmp 0xa47f
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa320
movq -0x48(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0xa4de
movq -0x40(%rbp), %rdi
addq $0x7, %rdi
shrq $0x3, %rdi
shlq $0x2, %rdi
callq 0x22e0
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x40(%rbp), %rdx
addq $0x7, %rdx
shrq $0x3, %rdx
movq -0x10(%rbp), %rcx
movl $0x4, %esi
callq 0x20c0
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)