// File: /workspace/github_c_makefile_star2_O2/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 $0x68, %rsp
movq %rdi, %rbx
leaq 0x1c(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x4
popq %rdx
movq %rbx, %rcx
callq 0x2070
cmpq $0x4, %rax
jne 0x4355
cmpl $0x1494d4d, 0x1c(%rsp)  # imm = 0x1494D4D
jne 0x4355
leaq 0x30(%rsp), %rdi
pushq $0x4
popq %rsi
pushq $0x6
popq %rdx
movq %rbx, %rcx
callq 0x2070
cmpq $0x6, %rax
jne 0x4355
movl 0x30(%rsp), %edi
movl 0x34(%rsp), %esi
movl 0x38(%rsp), %edx
callq 0x37e0
movq %rax, %r12
movl 0x3c(%rsp), %eax
movl %eax, 0xc(%r12)
movl 0x44(%rsp), %eax
movl %eax, 0x18(%r12)
leaq 0x1c(%r12), %rdi
pushq $0x4
popq %r15
pushq $0x1
popq %rdx
movq %r15, %rsi
movq %rbx, %rcx
callq 0x2070
movl 0xc(%r12), %r14d
leal (,%r14,4), %edi
callq 0x21e0
movq %r12, (%rsp)
movq %rax, 0x20(%r12)
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2070
cmpl $0x0, 0x40(%rsp)
je 0x4366
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x2150
movq %rax, %r15
movq (%rsp), %rax
movq %r15, 0x28(%rax)
xorl %r12d, %r12d
pushq $0x1
popq %r13
cmpq %r12, %r14
je 0x4366
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x2070
movzbl 0x20(%rsp), %ebp
leaq 0x1(%rbp), %rdi
callq 0x21e0
movq %rax, (%r15,%r12,8)
movq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x2070
movq (%r15,%r12,8), %rax
movb $0x0, (%rax,%rbp)
incq %r12
jmp 0x430d
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rax
movb (%rax), %cl
pushq $0x1
popq %rdx
shll %cl, %edx
xorl %ecx, %ecx
testl %edx, %edx
cmovlel %ecx, %edx
movq %rdx, 0x50(%rsp)
pushq $0x8
popq %r13
pushq $0x2
popq %r14
leaq 0x14(%rsp), %r15
cmpq 0x50(%rsp), %rcx
je 0x4357
movq 0x10(%rax), %rax
movq %rcx, 0x60(%rsp)
imulq $0x30, %rcx, %rcx
movq %rax, 0x8(%rsp)
movq %rcx, 0x58(%rsp)
leaq (%rax,%rcx), %r12
addq $0x18, %r12
movq %r12, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2070
movslq (%r12), %rbp
leaq (,%rbp,8), %rdi
callq 0x21e0
movq %rax, 0x8(%r12)
movq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x2070
leaq 0x18(%rsp), %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2070
movl 0x18(%rsp), %r12d
testl %r12d, %r12d
je 0x4471
movq 0x8(%rsp), %rax
addq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x44a1
movq %rax, %rbp
movq 0x8(%rsp), %rax
movq %rbp, 0x28(%rax)
movq %rbp, %rdi
movl %r12d, %esi
callq 0x44ac
subl $0x1, %r12d
jb 0x4471
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2070
movq 0x20(%rsp), %rsi
movq %rbp, %rdi
movq %r15, %rdx
callq 0x46fe
cmpl $0x0, 0x14(%rsp)
je 0x4482
movq 0x28(%rsp), %rcx
movq 0x20(%rbp), %rdx
movl %eax, %eax
movq %rcx, (%rdx,%rax,8)
jmp 0x4430
movq 0x60(%rsp), %rcx
incq %rcx
movq (%rsp), %rax
jmp 0x438a
leaq 0x4356(%rip), %rdi      # 0x87df
leaq 0x4356(%rip), %rsi      # 0x87e6
leaq 0x4357(%rip), %rcx      # 0x87ee
movl $0x15b, %edx            # imm = 0x15B
callq 0x2110