// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/gchain1.c
// Function: bridge_gwfa
static int32_t bridge_gwfa(bridge_aux_t *aux, int32_t kmer_size, int32_t gdp_max_ed, const mg_lchain_t *l0, const mg_lchain_t *l1, int32_t *ed)
{
	uint32_t v0 = l0->v, v1 = l1->v;
	int32_t qs = l0->qe - kmer_size, qe = l1->qs + kmer_size, end0, end1, j;
	void *z;
	gfa_edopt_t opt;
	gfa_edrst_t r;

	*ed = -1;
	end0 = l0->re - kmer_size;
	end1 = l1->rs + kmer_size - 1;

	gfa_edopt_init(&opt);
	opt.traceback = 1, opt.max_chk = 1000, opt.bw_dyn = 1000, opt.max_lag = gdp_max_ed/2;
	opt.i_term = 500000000LL;
	z = gfa_ed_init(aux->km, &opt, aux->g, aux->es, qe - qs, &aux->qseq[qs], v0, end0);
	gfa_ed_step(z, v1, end1, gdp_max_ed, &r);
	gfa_ed_destroy(z);
	//fprintf(stdout, "qs=%d,qe=%d,v0=%c%s:%d:%d,v1=%c%s:%d,s=%d,nv=%d\n", qs, qe, "><"[v0&1], aux->g->seg[v0>>1].name, end0, aux->g->seg[v0>>1].len - end0 - 1, "><"[v1&1], aux->g->seg[v1>>1].name, end1, r.s, r.nv);
	if (r.s < 0) return 0;

	for (j = 1; j < r.nv - 1; ++j) {
		mg_llchain_t *q;
		if (aux->n_llc == aux->m_llc) KEXPAND(aux->km, aux->llc, aux->m_llc);
		q = &aux->llc[aux->n_llc++];
		q->off = q->cnt = q->score = 0;
		q->v = r.v[j];
		q->ed = -1;
	}
	kfree(aux->km, r.v);
	*ed = r.s;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
subl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rax
movl 0x14(%rax), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
subl -0x14(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rax
movl 0xc(%rax), %eax
addl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
leaq -0x78(%rbp), %rdi
callq 0xf7b0
movl $0x1, -0x78(%rbp)
movl $0x3e8, -0x6c(%rbp)     # imm = 0x3E8
movl $0x3e8, -0x74(%rbp)     # imm = 0x3E8
movl -0x18(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x70(%rbp)
movq $0x1dcd6500, -0x60(%rbp) # imm = 0x1DCD6500
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movl -0x40(%rbp), %r8d
subl -0x3c(%rbp), %r8d
movq -0x10(%rbp), %rax
movq 0x18(%rax), %r9
movslq -0x3c(%rbp), %rax
addq %rax, %r9
movl -0x34(%rbp), %r10d
movl -0x44(%rbp), %eax
leaq -0x78(%rbp), %rsi
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x10450
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %esi
movl -0x48(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq -0xa0(%rbp), %r8
callq 0x108c0
movq -0x58(%rbp), %rdi
callq 0x11a90
cmpl $0x0, -0xa0(%rbp)
jge 0x290db
movl $0x0, -0x4(%rbp)
jmp 0x29218
movl $0x1, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl -0x8c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x291f5
movq -0x10(%rbp), %rax
movl 0x24(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jne 0x29173
jmp 0x29108
movq -0x10(%rbp), %rax
cmpl $0x4, 0x28(%rax)
jl 0x2912c
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
movq -0x10(%rbp), %rcx
movl 0x28(%rcx), %ecx
sarl %ecx
addl %ecx, %eax
movl %eax, -0xac(%rbp)
jmp 0x29139
movl $0x10, %eax
movl %eax, -0xac(%rbp)
jmp 0x29139
movl -0xac(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x10(%rbp), %rax
movslq 0x28(%rax), %rax
imulq $0x14, %rax, %rdx
callq 0x2ae0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
jmp 0x29173
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x24(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x24(%rdx)
movslq %ecx, %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0xa8(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0xa8(%rbp), %rax
movl $0x0, (%rax)
movq -0x80(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0xa8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0xa8(%rbp), %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x290e2
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x80(%rbp), %rsi
callq 0x2670
movl -0xa0(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)