// File: /workspace/github_c_makefile_star2_O2/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 $0x78, %rsp
movq %r9, 0x38(%rsp)
movq %r8, %r14
movq %rcx, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
xorps %xmm0, %xmm0
movq %rsp, %rbx
movaps %xmm0, (%rbx)
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
movq %rdx, 0x40(%rsp)
leaq 0x18(%r8), %rax
movq %rax, 0x18(%rsp)
pushq $0x1
popq %r15
leaq 0x8eb7(%rip), %rbp      # 0x24eb0
xorl %r13d, %r13d
xorl %eax, %eax
cmpq 0x40(%rsp), %rax
je 0x1c213
movq %rax, 0x70(%rsp)
imulq $0x28, %rax, %rdx
movq 0x30(%rsp), %rsi
leaq (%rsi,%rdx), %r13
movslq (%rsi,%rdx), %rax
shlq $0x4, %rax
movzbl 0xc(%r14,%rax), %ecx
movl 0x4(%rsi,%rdx), %r10d
shlq $0x21, %r10
sarq $0x21, %r10
addq 0x18(%rsp), %rax
movq %r15, %rdx
movl %ecx, %r15d
movl %ecx, %r11d
cmpq %r10, %rdx
jge 0x1c081
movl -0x8(%rax), %esi
movl (%rax), %edi
subl -0x10(%rax), %edi
subl -0x18(%rax), %esi
cmpl %edi, %esi
movl %edi, %r8d
cmovgl %esi, %r8d
movl %edi, %r9d
cmovll %esi, %r9d
addl %r8d, %r15d
cmpl %ecx, %edi
movl %r9d, %edi
cmovgl %ecx, %edi
cmpl %ecx, %esi
cmovlel %r9d, %edi
addl %edi, %r11d
incq %rdx
addq $0x10, %rax
jmp 0x1c044
andl $0x0, (%rsp)
movl 0x14(%r13), %ecx
movl 0x18(%r13), %r8d
movl 0x8(%r13), %r12d
movl 0xc(%r13), %eax
movq %rax, 0x68(%rsp)
movl %r12d, %eax
andl $0x1, %eax
leaq 0x72c8(%rip), %rdx      # 0x2336f
movsbl (%rax,%rdx), %r9d
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x60(%rsp)
shrl %r12d
shlq $0x6, %r12
movl (%rax,%r12), %eax
movq %rax, 0x58(%rsp)
movl 0x10(%r13), %eax
movq %rax, 0x50(%rsp)
movl 0x1c(%r13), %eax
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x8d9f(%rip), %rsi      # 0x24e88
movq 0x38(%rsp), %rdx
xorl %eax, %eax
pushq %r10
pushq %r15
pushq %r11
pushq 0x60(%rsp)
pushq 0x70(%rsp)
pushq 0x90(%rsp)
pushq 0x88(%rsp)
movq 0x98(%rsp), %r10
pushq 0x18(%r10,%r12)
leaq 0x8db8(%rip), %r12      # 0x24ed8
callq 0x1be9c
addq $0x40, %rsp
xorl %r15d, %r15d
movl 0x4(%r13), %eax
addl %eax, %eax
sarl %eax
cmpl %eax, %r15d
jge 0x1c15b
movslq (%r13), %rax
addq %r15, %rax
shlq $0x4, %rax
movl 0x8(%r14,%rax), %edx
movq %rbx, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x1be9c
incq %r15
jmp 0x1c12c
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1be9c
xorl %r15d, %r15d
movl 0x4(%r13), %eax
addl %eax, %eax
sarl %eax
cmpl %eax, %r15d
jge 0x1c199
movslq (%r13), %rax
addq %r15, %rax
shlq $0x4, %rax
movl (%r14,%rax), %edx
movq %rbx, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x1be9c
incq %r15
jmp 0x1c16b
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1be9c
xorl %r15d, %r15d
movl 0x4(%r13), %eax
addl %eax, %eax
sarl %eax
cmpl %eax, %r15d
jge 0x1c1d9
movslq (%r13), %rax
addq %r15, %rax
shlq $0x4, %rax
movzbl 0xf(%r14,%rax), %edx
movq %rbx, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x1be9c
incq %r15
jmp 0x1c1a9
movq %rbx, %rdi
leaq 0x8bd3(%rip), %rsi      # 0x24db6
xorl %eax, %eax
callq 0x1be9c
movq 0x8(%rsp), %r13
movl (%rsp), %edx
movq %r13, %rdi
pushq $0x1
popq %r15
movq %r15, %rsi
movq 0x20(%rsp), %rcx
callq 0x2340
movq 0x70(%rsp), %rax
incq %rax
jmp 0x1bffe
movq %r13, %rdi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2040