// File: /workspace/github_c_makefile_star2_O3/lh3[P]minimap/index.c
// Function: mm_idx_load
mm_idx_t *mm_idx_load(FILE *fp)
{
	int i;
	char magic[4];
	uint32_t x[6];
	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, 6, fp) != 6) return 0;
	mi = mm_idx_init(x[0], x[1], x[2]);
	mi->n = x[3], mi->max_occ = x[5];
	fread(&mi->freq_thres, sizeof(float), 1, fp);
	mi->len = (int32_t*)malloc(mi->n * 4);
	fread(mi->len, 4, mi->n, fp);
	if (x[4]) { // has names
		mi->name = (char**)calloc(mi->n, sizeof(char*));
		for (i = 0; i < mi->n; ++i) {
			uint8_t l;
			fread(&l, 1, 1, fp);
			mi->name[i] = (char*)malloc(l + 1);
			fread(mi->name[i], 1, l, fp);
			mi->name[i][l] = 0;
		}
	}
	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];
		}
	}
	return mi;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq 0x14(%rsp), %rdi
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x2070
cmpq $0x4, %rax
jne 0x4828
cmpl $0x1494d4d, 0x14(%rsp)  # imm = 0x1494D4D
jne 0x4828
leaq 0x30(%rsp), %rdi
movl $0x4, %esi
movl $0x6, %edx
movq %rbx, %rcx
callq 0x2070
cmpq $0x6, %rax
jne 0x4828
movl 0x30(%rsp), %edi
movl 0x34(%rsp), %esi
movl 0x38(%rsp), %edx
callq 0x3b98
movq %rax, %r14
movl 0x3c(%rsp), %eax
movl %eax, 0xc(%r14)
movl 0x44(%rsp), %eax
movl %eax, 0x18(%r14)
leaq 0x1c(%r14), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2070
movl 0xc(%r14), %r15d
leal (,%r15,4), %edi
callq 0x21e0
movq %r14, (%rsp)
movq %rax, 0x20(%r14)
movl $0x4, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2070
cmpl $0x0, 0x40(%rsp)
je 0x4704
movl $0x8, %esi
movq %r15, %rdi
callq 0x2150
movq %rax, %r12
movq (%rsp), %rax
movq %r12, 0x28(%rax)
testq %r15, %r15
je 0x4704
xorl %r14d, %r14d
leaq 0x20(%rsp), %r13
movl $0x1, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x2070
movzbl 0x20(%rsp), %ebp
leaq 0x1(%rbp), %rdi
callq 0x21e0
movq %rax, (%r12,%r14,8)
movl $0x1, %esi
movq %rax, %rdi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x2070
movq (%r12,%r14,8), %rax
movb $0x0, (%rax,%rbp)
incq %r14
cmpq %r14, %r15
jne 0x46ba
movq (%rsp), %rax
movl (%rax), %ecx
cmpq $0x1f, %rcx
je 0x482a
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, 0x48(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x18(%rsp)
xorl %eax, %eax
leaq 0x20(%rsp), %r12
leaq 0xc(%rsp), %r13
movq %rax, 0x50(%rsp)
leaq (%rax,%rax,2), %r14
shlq $0x4, %r14
movq 0x18(%rsp), %rax
leaq (%rax,%r14), %r15
addq $0x18, %r15
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x2070
movslq (%r15), %rbp
leaq (,%rbp,8), %rdi
callq 0x21e0
movq %rax, 0x8(%r15)
movl $0x8, %esi
movq %rax, %rdi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x2070
movl $0x4, %esi
movl $0x1, %edx
leaq 0x10(%rsp), %rdi
movq %rbx, %rcx
callq 0x2070
movl 0x10(%rsp), %ebp
testl %ebp, %ebp
je 0x480f
addq 0x18(%rsp), %r14
movl $0x1, %edi
movl $0x28, %esi
callq 0x2150
movq %rax, %r15
movq %rax, 0x28(%r14)
movq %rax, %rdi
movl %ebp, %esi
callq 0x4858
movl $0x8, %esi
movl $0x2, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x2070
movq 0x20(%rsp), %rsi
movq %r15, %rdi
movq %r13, %rdx
callq 0x4ac4
cmpl $0x0, 0xc(%rsp)
je 0x4839
movq 0x28(%rsp), %rcx
movq 0x20(%r15), %rdx
movl %eax, %eax
movq %rcx, (%rdx,%rax,8)
decl %ebp
jne 0x47d0
movq 0x50(%rsp), %rax
incq %rax
cmpq 0x48(%rsp), %rax
jne 0x4736
movq (%rsp), %rax
jmp 0x482a
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f9f(%rip), %rdi      # 0x87df
leaq 0x3f9f(%rip), %rsi      # 0x87e6
leaq 0x3fa0(%rip), %rcx      # 0x87ee
movl $0x15b, %edx            # imm = 0x15B
callq 0x2110