// File: /workspace/github_c_makefile_star2_O0/lh3[P]minimap2/index.c
// Function: mm_idx_dump
void mm_idx_dump(FILE *fp, const mm_idx_t *mi)
{
	uint64_t sum_len = 0;
	uint32_t x[5], i;

	x[0] = mi->w, x[1] = mi->k, x[2] = mi->b, x[3] = mi->n_seq, x[4] = mi->flag;
	fwrite(MM_IDX_MAGIC, 1, 4, fp);
	fwrite(x, 4, 5, fp);
	for (i = 0; i < mi->n_seq; ++i) {
		if (mi->seq[i].name) {
			uint8_t l = strlen(mi->seq[i].name);
			fwrite(&l, 1, 1, fp);
			fwrite(mi->seq[i].name, 1, l, fp);
		} else {
			uint8_t l = 0;
			fwrite(&l, 1, 1, fp);
		}
		fwrite(&mi->seq[i].len, 4, 1, fp);
		sum_len += mi->seq[i].len;
	}
	for (i = 0; i < 1<<mi->b; ++i) {
		mm_idx_bucket_t *b = &mi->B[i];
		khint_t k;
		idxhash_t *h = (idxhash_t*)b->h;
		uint32_t size = h? h->size : 0;
		fwrite(&b->n, 4, 1, fp);
		fwrite(b->p, 8, b->n, fp);
		fwrite(&size, 4, 1, fp);
		if (size == 0) continue;
		for (k = 0; k < kh_end(h); ++k) {
			uint64_t x[2];
			if (!kh_exist(h, k)) continue;
			x[0] = kh_key(h, k), x[1] = kh_val(h, k);
			fwrite(x, 8, 2, fp);
		}
	}
	if (!(mi->flag & MM_I_NO_SEQ))
		fwrite(mi->S, 4, (sum_len + 7) / 8, fp);
	fflush(fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rcx
leaq 0x4d04e(%rip), %rdi     # 0x56ef5
movl $0x1, %esi
movl $0x4, %edx
callq 0x23e0
leaq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl $0x4, %esi
movl $0x5, %edx
callq 0x23e0
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x9fc6
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x9f59
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x2130
movb %al, -0x35(%rbp)
movq -0x8(%rbp), %rcx
leaq -0x35(%rbp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x23e0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movzbl -0x35(%rbp), %eax
movl %eax, %edx
movq -0x8(%rbp), %rcx
movl $0x1, %esi
callq 0x23e0
jmp 0x9f72
movb $0x0, -0x36(%rbp)
movq -0x8(%rbp), %rcx
leaq -0x36(%rbp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x23e0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movl -0x34(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rdi
addq $0x10, %rdi
movq -0x8(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x23e0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x9ed4
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jae 0xa115
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0xa01c
movq -0x50(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x74(%rbp)
jmp 0xa023
xorl %eax, %eax
movl %eax, -0x74(%rbp)
jmp 0xa023
movl -0x74(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x40(%rbp), %rdi
addq $0x18, %rdi
movq -0x8(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x23e0
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x40(%rbp), %rax
movslq 0x18(%rax), %rdx
movq -0x8(%rbp), %rcx
movl $0x8, %esi
callq 0x23e0
movq -0x8(%rbp), %rcx
leaq -0x54(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x23e0
cmpl $0x0, -0x54(%rbp)
jne 0xa084
jmp 0xa107
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x50(%rbp), %rcx
cmpl (%rcx), %eax
jae 0xa105
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x44(%rbp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0x44(%rbp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0xa0bd
jmp 0xa0fa
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x70(%rbp)
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x68(%rbp)
leaq -0x70(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl $0x8, %esi
movl $0x2, %edx
callq 0x23e0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xa08b
jmp 0xa107
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x9fcd
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0xa146
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x18(%rbp), %rdx
addq $0x7, %rdx
shrq $0x3, %rdx
movq -0x8(%rbp), %rcx
movl $0x4, %esi
callq 0x23e0
movq -0x8(%rbp), %rdi
callq 0x22f0
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)