// File: /workspace/github_c_makefile_star2_O1/lh3[P]minigraph/format.c
// Function: mg_print_lchain
void mg_print_lchain(FILE *fp, const mg_idx_t *gi, int n_lc, const mg_lchain_t *lc, const mg128_t *a, const char *qname)
{
	kstring_t str = {0,0,0};
	int i, j;
	for (i = 0; i < n_lc; ++i) {
		const mg_lchain_t *p = &lc[i];
		int mlen, blen, span = a[p->off].y>>32&0xff;
		mlen = blen = span;
		for (j = 1; j < p->cnt; ++j) {
			int ql = (int32_t)a[p->off + j].y - (int32_t)a[p->off + j - 1].y;
			int pl = (int32_t)a[p->off + j].x - (int32_t)a[p->off + j - 1].x;
			blen += pl > ql? pl : ql;
			mlen += pl > span && ql > span? span : pl < ql? pl : ql;
		}
		str.l = 0;
		mg_sprintf_lite(&str, "LC\t%s\t%d\t%d\t%c\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t", qname, p->qs, p->qe, "+-"[p->v&1], gi->g->seg[p->v>>1].name, gi->g->seg[p->v>>1].len,
						p->rs, p->re, p->score, mlen, blen, p->cnt);
		for (j = 0; j < p->cnt; ++j)
			mg_sprintf_lite(&str, "%d,", (int32_t)a[p->off + j].y);
		mg_sprintf_lite(&str, "\t");
		for (j = 0; j < p->cnt; ++j)
			mg_sprintf_lite(&str, "%d,", (int32_t)a[p->off + j].x);
		mg_sprintf_lite(&str, "\t");
		for (j = 0; j < p->cnt; ++j)
			mg_sprintf_lite(&str, "%d,", (int32_t)(a[p->off + j].y>>MG_SEED_OCC_SHIFT));
		mg_sprintf_lite(&str, "\n");
		fwrite(str.s, 1, str.l, fp);
	}
	free(str.s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r9, 0x30(%rsp)
movq %rcx, 0x10(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
testl %edx, %edx
jle 0x2009f
movq %r8, %r14
movl %edx, %eax
movq %rax, 0x18(%rsp)
xorl %eax, %eax
movq %rsp, %rbp
leaq 0x9fdf(%rip), %rbx      # 0x29e30
movq %rax, 0x60(%rsp)
leaq (%rax,%rax,4), %rax
movq 0x10(%rsp), %rsi
movslq (%rsi,%rax,8), %rcx
shlq $0x4, %rcx
movzbl 0xc(%r14,%rcx), %edx
movl 0x4(%rsi,%rax,8), %r10d
addl %r10d, %r10d
sarl %r10d
cmpl $0x2, %r10d
jl 0x1fed9
movl %r10d, %esi
addq %r14, %rcx
shlq $0x4, %rsi
movl $0x10, %edi
movl %edx, %r11d
movl %edx, %r15d
movl (%rcx,%rdi), %r8d
movl 0x8(%rcx,%rdi), %r9d
subl -0x8(%rcx,%rdi), %r9d
subl -0x10(%rcx,%rdi), %r8d
cmpl %r9d, %r8d
movl %r9d, %r12d
cmovgl %r8d, %r12d
movl %r9d, %r13d
cmovll %r8d, %r13d
addl %r12d, %r15d
cmpl %edx, %r9d
movl %r13d, %r9d
cmovgl %edx, %r9d
cmpl %edx, %r8d
cmovlel %r13d, %r9d
addl %r9d, %r11d
addq $0x10, %rdi
cmpq %rdi, %rsi
jne 0x1fe93
jmp 0x1fedf
movl %edx, %r15d
movl %edx, %r11d
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %r12
movl $0x0, (%rsp)
movl 0x14(%r12), %ecx
movl 0x18(%r12), %r8d
movl 0x8(%r12), %r13d
movl 0xc(%r12), %eax
movq %rax, 0x58(%rsp)
movl %r13d, %eax
andl $0x1, %eax
leaq 0x845a(%rip), %rdx      # 0x2836f
movsbl (%rax,%rdx), %r9d
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x50(%rsp)
shrl %r13d
shlq $0x6, %r13
movl (%rax,%r13), %eax
movq %rax, 0x48(%rsp)
movl 0x10(%r12), %eax
movq %rax, 0x40(%rsp)
movl 0x1c(%r12), %eax
movq %rax, 0x38(%rsp)
movq %rbp, %rdi
leaq 0x9eaf(%rip), %rsi      # 0x29e08
movq 0x30(%rsp), %rdx
xorl %eax, %eax
pushq %r10
pushq %r15
pushq %r11
pushq 0x50(%rsp)
pushq 0x60(%rsp)
pushq 0x80(%rsp)
pushq 0x78(%rsp)
movq 0x88(%rsp), %r10
pushq 0x18(%r10,%r13)
callq 0x1fcfb
addq $0x40, %rsp
movl 0x4(%r12), %eax
addl %eax, %eax
testl %eax, %eax
jle 0x1ffcb
xorl %r15d, %r15d
movslq (%r12), %rax
addq %r15, %rax
shlq $0x4, %rax
movl 0x8(%r14,%rax), %edx
movq %rbp, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1fcfb
movl 0x4(%r12), %eax
addl %eax, %eax
sarl %eax
incq %r15
cmpl %eax, %r15d
jl 0x1ff9d
movq %rbp, %rdi
leaq 0x9e83(%rip), %r13      # 0x29e58
movq %r13, %rsi
xorl %eax, %eax
callq 0x1fcfb
movl 0x4(%r12), %eax
addl %eax, %eax
testl %eax, %eax
jle 0x2001a
xorl %r15d, %r15d
movslq (%r12), %rax
addq %r15, %rax
shlq $0x4, %rax
movl (%r14,%rax), %edx
movq %rbp, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1fcfb
movl 0x4(%r12), %eax
addl %eax, %eax
sarl %eax
incq %r15
cmpl %eax, %r15d
jl 0x1ffed
movq %rbp, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x1fcfb
movl 0x4(%r12), %eax
addl %eax, %eax
testl %eax, %eax
jle 0x20064
xorl %r15d, %r15d
movslq (%r12), %rax
addq %r15, %rax
shlq $0x4, %rax
movzbl 0xf(%r14,%rax), %edx
movq %rbp, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1fcfb
movl 0x4(%r12), %eax
addl %eax, %eax
sarl %eax
incq %r15
cmpl %eax, %r15d
jl 0x20035
movq %rbp, %rdi
leaq 0x9cc8(%rip), %rsi      # 0x29d36
xorl %eax, %eax
callq 0x1fcfb
movq 0x8(%rsp), %rdi
movl (%rsp), %edx
movl $0x1, %esi
movq 0x20(%rsp), %rcx
callq 0x2340
movq 0x60(%rsp), %rax
incq %rax
cmpq 0x18(%rsp), %rax
jne 0x1fe51
movq 0x8(%rsp), %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2040