// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/gchain1.c
// Function: mg_gchain_extra
void mg_gchain_extra(const gfa_t *g, mg_gchains_t *gs)
{
	int32_t i, j, k;
	for (i = 0; i < gs->n_gc; ++i) { // iterate over gchains
		mg_gchain_t *p = &gs->gc[i];
		const mg_llchain_t *q;
		const mg128_t *last_a;
		int32_t q_span, rest_pl, tmp, n_mini;

		p->qs = p->qe = p->ps = p->pe = -1, p->plen = p->blen = p->mlen = 0, p->div = -1.0f;
		if (p->cnt == 0) continue;

		assert(gs->lc[p->off].cnt > 0 && gs->lc[p->off + p->cnt - 1].cnt > 0); // first and last lchains can't be empty
		q = &gs->lc[p->off];
		q_span = (int32_t)(gs->a[q->off].y>>32&0xff);
		p->qs = (int32_t)gs->a[q->off].y + 1 - q_span;
		p->ps = (int32_t)gs->a[q->off].x + 1 - q_span;
		tmp = (int32_t)(gs->a[q->off].x>>32);
		assert(p->qs >= 0 && p->ps >= 0);
		q = &gs->lc[p->off + p->cnt - 1];
		p->qe = (int32_t)gs->a[q->off + q->cnt - 1].y + 1;
		p->pe = g->seg[q->v>>1].len - (int32_t)gs->a[q->off + q->cnt - 1].x - 1; // this is temporary
		n_mini = (int32_t)(gs->a[q->off + q->cnt - 1].x>>32) - tmp + 1;
		assert(p->n_anchor > 0);

		rest_pl = 0; // this value is never used if the first lchain is not empty (which should always be true)
		last_a = &gs->a[gs->lc[p->off].off];
		for (j = 0; j < p->cnt; ++j) { // iterate over lchains
			const mg_llchain_t *q = &gs->lc[p->off + j];
			int32_t vlen = g->seg[q->v>>1].len;
			p->plen += vlen;
			for (k = 0; k < q->cnt; ++k) { // iterate over anchors
				const mg128_t *r = &gs->a[q->off + k];
				int32_t pl, ql = (int32_t)r->y - (int32_t)last_a->y;
				int32_t span = (int32_t)(r->y>>32&0xff);
				if (j == 0 && k == 0) { // the first anchor on the first lchain
					pl = ql = span;
				} else if (j > 0 && k == 0) { // the first anchor but not on the first lchain
					pl = (int32_t)r->x + 1 + rest_pl;
				} else {
					pl = (int32_t)r->x - (int32_t)last_a->x;
				}
				if (ql < 0) ql = -ql, n_mini += (int32_t)(last_a->x>>32) - (int32_t)(r->x>>32); // dealing with overlapping query at junctions
				p->blen += pl > ql? pl : ql;
				p->mlen += pl > span && ql > span? span : pl < ql? pl : ql;
				last_a = r;
			}
			if (q->cnt == 0) rest_pl += vlen;
			else rest_pl = vlen - (int32_t)gs->a[q->off + q->cnt - 1].x - 1;
		}
		p->pe = p->plen - p->pe;
		assert(p->pe >= p->ps);
		// here n_mini >= p->n_anchor should stand almost all the time
		p->div = n_mini >= p->n_anchor? log((double)n_mini / p->n_anchor) / q_span : log((double)p->n_anchor / n_mini) / q_span;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x27f7a
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0xffffffff, 0x28(%rax) # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movl $0xffffffff, 0x24(%rax) # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movl $0xffffffff, 0x1c(%rax) # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movl $0x0, 0x30(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x2c(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x28(%rbp), %rax
movss 0x15996(%rip), %xmm0    # 0x3d3b0
movss %xmm0, 0x34(%rax)
movq -0x28(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x27a2e
jmp 0x27f6c
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
movslq 0x8(%rcx), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4(%rax)
jle 0x27a76
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x28(%rbp), %rdx
addl 0xc(%rdx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4(%rax)
jle 0x27a76
jmp 0x27a95
leaq 0x15adf(%rip), %rdi     # 0x3d55c
leaq 0x15930(%rip), %rsi     # 0x3d3b4
movl $0xfe, %edx
leaq 0x15b0a(%rip), %rcx     # 0x3d59a
callq 0x2170
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
movslq 0x8(%rcx), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
addl $0x1, %ecx
subl -0x3c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, %ecx
addl $0x1, %ecx
subl -0x3c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jl 0x27b5e
movq -0x28(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jl 0x27b5e
jmp 0x27b7d
leaq 0x15a69(%rip), %rdi     # 0x3d5ce
leaq 0x15848(%rip), %rsi     # 0x3d3b4
movl $0x104, %edx            # imm = 0x104
leaq 0x15a22(%rip), %rcx     # 0x3d59a
callq 0x2170
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x28(%rbp), %rdx
addl 0xc(%rdx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rcx
movl (%rcx), %ecx
movq -0x30(%rbp), %rdx
addl 0x4(%rdx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
movl 0x8(%rcx), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rdx
movl (%rdx), %edx
movq -0x30(%rbp), %rsi
addl 0x4(%rsi), %edx
subl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %rax
subl %eax, %ecx
subl $0x1, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rcx
movl (%rcx), %ecx
movq -0x30(%rbp), %rdx
addl 0x4(%rdx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
subl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jle 0x27c61
jmp 0x27c80
leaq 0x1597f(%rip), %rdi     # 0x3d5e7
leaq 0x15745(%rip), %rsi     # 0x3d3b4
movl $0x109, %edx            # imm = 0x109
leaq 0x1591f(%rip), %rcx     # 0x3d59a
callq 0x2170
movl $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq -0x28(%rbp), %rdx
movslq 0x8(%rdx), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x27ebc
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
movl 0x8(%rcx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x50(%rbp), %rcx
movl 0x8(%rcx), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %ecx
movq -0x28(%rbp), %rax
addl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x50(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x27e67
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x50(%rbp), %rcx
movl (%rcx), %ecx
addl -0x1c(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x8(%rcx), %rcx
subl %ecx, %eax
movl %eax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x27d8e
cmpl $0x0, -0x1c(%rbp)
jne 0x27d8e
movl -0x6c(%rbp), %eax
movl %eax, -0x68(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x27dc1
cmpl $0x0, -0x18(%rbp)
jle 0x27dac
cmpl $0x0, -0x1c(%rbp)
jne 0x27dac
movq -0x60(%rbp), %rax
movq (%rax), %rax
addl $0x1, %eax
addl -0x40(%rbp), %eax
movl %eax, -0x64(%rbp)
jmp 0x27dbf
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
subl %ecx, %eax
movl %eax, -0x64(%rbp)
jmp 0x27dc1
cmpl $0x0, -0x68(%rbp)
jge 0x27ded
xorl %eax, %eax
subl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
shrq $0x20, %rcx
subl %ecx, %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x68(%rbp), %eax
jle 0x27dfd
movl -0x64(%rbp), %eax
movl %eax, -0x70(%rbp)
jmp 0x27e03
movl -0x68(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %ecx
movq -0x28(%rbp), %rax
addl 0x2c(%rax), %ecx
movl %ecx, 0x2c(%rax)
movl -0x64(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jle 0x27e28
movl -0x68(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jle 0x27e28
movl -0x6c(%rbp), %eax
movl %eax, -0x74(%rbp)
jmp 0x27e44
movl -0x64(%rbp), %eax
cmpl -0x68(%rbp), %eax
jge 0x27e38
movl -0x64(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x27e3e
movl -0x68(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %ecx
movq -0x28(%rbp), %rax
addl 0x30(%rax), %ecx
movl %ecx, 0x30(%rax)
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x27d1e
movq -0x50(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x27e7c
movl -0x54(%rbp), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x27eac
movl -0x54(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x50(%rbp), %rdx
movl (%rdx), %edx
movq -0x50(%rbp), %rsi
addl 0x4(%rsi), %edx
subl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
subl %ecx, %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x27eae
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x27cbb
movq -0x28(%rbp), %rax
movl 0x20(%rax), %ecx
movq -0x28(%rbp), %rax
subl 0x28(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x28(%rbp), %rax
movl 0x28(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x24(%rcx), %eax
jl 0x27ee3
jmp 0x27f02
leaq 0x1570d(%rip), %rdi     # 0x3d5f7
leaq 0x154c3(%rip), %rsi     # 0x3d3b4
movl $0x125, %edx            # imm = 0x125
leaq 0x1569d(%rip), %rcx     # 0x3d59a
callq 0x2170
movl -0x48(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jl 0x27f35
cvtsi2sdl -0x48(%rbp), %xmm0
movq -0x28(%rbp), %rax
cvtsi2sdl 0x10(%rax), %xmm1
divsd %xmm1, %xmm0
callq 0x21b0
cvtsi2sdl -0x3c(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
jmp 0x27f5a
movq -0x28(%rbp), %rax
cvtsi2sdl 0x10(%rax), %xmm0
cvtsi2sdl -0x48(%rbp), %xmm1
divsd %xmm1, %xmm0
callq 0x21b0
cvtsi2sdl -0x3c(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x80(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x28(%rbp), %rax
movss %xmm0, 0x34(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2799a
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)