// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi-lite/misc.c
// Function: fml_fmi_gen
struct rld_t *fml_fmi_gen(int n, bseq1_t *seq, int is_mt)
{
	mrope_t *mr;
	kstring_t str = {0,0,0};
	mritr_t itr;
	rlditr_t di;
	const uint8_t *block;
	rld_t *e = 0;
	int k;

	for (k = 0; k < n; ++k)
		if (seq[k].l_seq > 0)
			break;
	if (k == n) return 0;

	mr = mr_init(ROPE_DEF_MAX_NODES, ROPE_DEF_BLOCK_LEN, MR_SO_RCLO);
	for (k = 0; k < n; ++k) {
		int i;
		bseq1_t *s = &seq[k];
		if (s->l_seq == 0) continue;
		free(s->qual);
		for (i = 0; i < s->l_seq; ++i)
			s->seq[i] = seq_nt6_table[(int)s->seq[i]];
		for (i = 0; i < s->l_seq; ++i)
			if (s->seq[i] == 5) break;
		if (i < s->l_seq) {
			free(s->seq);
			continue;
		}
		if (is_rev_same(s->l_seq, s->seq))
			--s->l_seq, s->seq[s->l_seq] = 0;
		seq_reverse(s->l_seq, (uint8_t*)s->seq);
		kputsn(s->seq, s->l_seq + 1, &str);
		seq_revcomp6(s->l_seq, (uint8_t*)s->seq);
		kputsn(s->seq, s->l_seq + 1, &str);
		free(s->seq);
	}
	free(seq);
	mr_insert_multi(mr, str.l, (uint8_t*)str.s, is_mt);
	free(str.s);

	e = rld_init(6, 3);
	rld_itr_init(e, &di, 0);
	mr_itr_first(mr, &itr, 1);
	while ((block = mr_itr_next_block(&itr)) != 0) {
		const uint8_t *q = block + 2, *end = block + 2 + *rle_nptr(block);
		while (q < end) {
			int c = 0;
			int64_t l;
			rle_dec1(q, c, l);
			rld_enc(e, &di, l, c);
		}
	}
	rld_enc_finish(e, &di);

	mr_destroy(mr);
	return e;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4a0, %rsp            # imm = 0x4A0
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2110
movq $0x0, -0x468(%rbp)
movl $0x0, -0x46c(%rbp)
movl -0x46c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2941
movq -0x18(%rbp), %rax
movslq -0x46c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
jle 0x292e
jmp 0x2941
jmp 0x2930
movl -0x46c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x46c(%rbp)
jmp 0x290a
movl -0x46c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jne 0x2959
movq $0x0, -0x8(%rbp)
jmp 0x2dec
movl $0x40, %edi
movl $0x200, %esi            # imm = 0x200
movl $0x2, %edx
callq 0x9b70
movq %rax, -0x28(%rbp)
movl $0x0, -0x46c(%rbp)
movl -0x46c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2b74
movq -0x18(%rbp), %rax
movslq -0x46c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x478(%rbp)
movq -0x478(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x29b4
jmp 0x2b60
movq -0x478(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2040
movl $0x0, -0x470(%rbp)
movl -0x470(%rbp), %eax
movq -0x478(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x2a28
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x470(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x27781(%rip), %rax     # 0x2a180
movb (%rax,%rcx), %dl
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x470(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x470(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x470(%rbp)
jmp 0x29ce
movl $0x0, -0x470(%rbp)
movl -0x470(%rbp), %eax
movq -0x478(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x2a73
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x470(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x5, %eax
jne 0x2a60
jmp 0x2a73
jmp 0x2a62
movl -0x470(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x470(%rbp)
jmp 0x2a32
movl -0x470(%rbp), %eax
movq -0x478(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x2a99
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
jmp 0x2b60
movq -0x478(%rbp), %rax
movl (%rax), %edi
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x2e00
cmpl $0x0, %eax
je 0x2ade
movq -0x478(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x478(%rbp), %rcx
movslq (%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq -0x478(%rbp), %rax
movl (%rax), %edi
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x4620
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x478(%rbp), %rax
movl (%rax), %esi
addl $0x1, %esi
leaq -0x40(%rbp), %rdx
callq 0x2e90
movq -0x478(%rbp), %rax
movl (%rax), %edi
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x4690
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x478(%rbp), %rax
movl (%rax), %esi
addl $0x1, %esi
leaq -0x40(%rbp), %rdx
callq 0x2e90
movq -0x478(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
movl -0x46c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x46c(%rbp)
jmp 0x297b
movq -0x18(%rbp), %rdi
callq 0x2040
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x1c(%rbp), %ecx
callq 0xa570
movq -0x30(%rbp), %rdi
callq 0x2040
movl $0x6, %edi
movl $0x3, %esi
callq 0xb4b0
movq %rax, -0x468(%rbp)
movq -0x468(%rbp), %rdi
leaq -0x458(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xb740
movq -0x28(%rbp), %rdi
leaq -0x420(%rbp), %rsi
movl $0x1, %edx
callq 0xa420
leaq -0x420(%rbp), %rdi
callq 0xa480
movq %rax, -0x460(%rbp)
cmpq $0x0, %rax
je 0x2dc5
movq -0x460(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x480(%rbp)
movq -0x460(%rbp), %rax
addq $0x2, %rax
movq -0x460(%rbp), %rcx
movzwl (%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x488(%rbp)
movq -0x480(%rbp), %rax
cmpq -0x488(%rbp), %rax
jae 0x2dc0
movl $0x0, -0x48c(%rbp)
movq -0x480(%rbp), %rax
movzbl (%rax), %eax
andl $0x7, %eax
movl %eax, -0x48c(%rbp)
movq -0x480(%rbp), %rax
movzbl (%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x2ca9
movq -0x480(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x480(%rbp)
movzbl (%rax), %eax
sarl $0x3, %eax
cltq
movq %rax, -0x498(%rbp)
jmp 0x2d96
movq -0x480(%rbp), %rax
movzbl (%rax), %eax
sarl $0x5, %eax
cmpl $0x6, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x2d0b
movq -0x480(%rbp), %rax
movzbl (%rax), %eax
andq $0x18, %rax
shlq $0x3, %rax
movq -0x480(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
andq $0x3f, %rcx
orq %rcx, %rax
movq %rax, -0x498(%rbp)
movq -0x480(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x480(%rbp)
jmp 0x2d94
movq -0x480(%rbp), %rax
movzbl (%rax), %eax
andl $0x10, %eax
sarl $0x2, %eax
addl $0x4, %eax
movl %eax, -0x49c(%rbp)
movq -0x480(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x480(%rbp)
movzbl (%rax), %eax
sarl $0x3, %eax
andl $0x1, %eax
cltq
movq %rax, -0x498(%rbp)
movl -0x49c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x49c(%rbp)
cmpl $0x0, %eax
je 0x2d92
movq -0x498(%rbp), %rax
shlq $0x6, %rax
movq -0x480(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x480(%rbp)
movzbl (%rcx), %ecx
andq $0x3f, %rcx
orq %rcx, %rax
movq %rax, -0x498(%rbp)
jmp 0x2d4b
jmp 0x2d94
jmp 0x2d96
jmp 0x2d98
movq -0x468(%rbp), %rdi
movq -0x498(%rbp), %rdx
movl -0x48c(%rbp), %eax
leaq -0x458(%rbp), %rsi
movzbl %al, %ecx
callq 0xb870
jmp 0x2c2d
jmp 0x2bdc
movq -0x468(%rbp), %rdi
leaq -0x458(%rbp), %rsi
callq 0xbee0
movq -0x28(%rbp), %rdi
callq 0x9c20
movq -0x468(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x4a0, %rsp            # imm = 0x4A0
popq %rbp
retq
nopl (%rax)