// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/miniwfa.c
// Function: mwf_wfa_seg
wf_chkpt_t *mwf_wfa_seg(void *km, const mwf_opt_t *opt, int32_t tl, const char *pts, int32_t ql, const char *pqs, int32_t *n_seg_)
{
	int32_t max_pen, last, n_seg;
	wf_stripe_t *wf, *sf;
	wf_sss_t sss = {0,0,0};
	uint8_t *xbuf;
	wf_chkpt_t *seg;
	void *km_st;

	km_st = !(opt->flag&MWF_F_NO_KALLOC)? km_init2(km, 0) : 0;
	max_pen = opt->x;
	max_pen = max_pen > opt->o1 + opt->e1? max_pen : opt->o1 + opt->e1;
	max_pen = max_pen > opt->o2 + opt->e2? max_pen : opt->o2 + opt->e2;
	xbuf = Kcalloc(km_st, uint8_t, tl + ql + 1);
	wf = wf_stripe_init(km_st, max_pen);
	sf = wf_stripe_init(km_st, max_pen);
	assert(pts);

	while (1) {
		wf_slice_t *p = &wf->a[wf->top];
		int32_t d, lo, hi, *H = p->H;
		for (d = p->lo; d <= p->hi; ++d) {
			int32_t k;
			if (H[d] < -1 || d + H[d] < -1 || H[d] >= tl || d + H[d] >= ql) continue;
			k = wf_extend1_padded(pts, pqs, H[d], d);
			if (k == tl - 1 && d + k == ql - 1) {
				last = sf->a[sf->top].H[d];
				break;
			}
			H[d] = k;
		}
		if (d <= p->hi) break;
		lo = wf->lo > -tl? wf->lo - 1 : -tl;
		hi = wf->hi <  ql? wf->hi + 1 :  ql;
		if ((wf->s + 1) % opt->step == 0)
			wf_snapshot(km_st, &sss, sf);
		wf_next_seg(km_st, opt, xbuf, wf, sf, lo, hi);
		if ((wf->s&0xff) == 0) wf_stripe_shrink(wf, tl, ql);
	}
	seg = wf_traceback_seg(km, &sss, last, &n_seg);
	if (km_st == 0) {
		wf_snapshot_free(km_st, &sss);
		wf_stripe_destroy(km_st, wf);
		wf_stripe_destroy(km_st, sf);
		kfree(km_st, xbuf);
	} else km_destroy(km_st);

	seg = (wf_chkpt_t*)krelocate(km, seg, n_seg * sizeof(*seg));
	*n_seg_ = n_seg;
	return seg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2190
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x1bfda
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x24a0
movq %rax, -0xa8(%rbp)
jmp 0x1bfe5
xorl %eax, %eax
movq %rax, -0xa8(%rbp)
jmp 0x1bfe5
movq -0xa8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x10(%rbp), %rdx
addl 0xc(%rdx), %ecx
cmpl %ecx, %eax
jle 0x1c01a
movl -0x34(%rbp), %eax
movl %eax, -0xac(%rbp)
jmp 0x1c02e
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
addl 0xc(%rcx), %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
movq -0x10(%rbp), %rdx
addl 0x14(%rdx), %ecx
cmpl %ecx, %eax
jle 0x1c057
movl -0x34(%rbp), %eax
movl %eax, -0xb0(%rbp)
jmp 0x1c06b
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x10(%rbp), %rcx
addl 0x14(%rcx), %eax
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x78(%rbp), %rdi
movl -0x14(%rbp), %eax
addl -0x24(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movl $0x1, %edx
callq 0x2540
movq %rax, -0x68(%rbp)
movq -0x78(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x1c3c0
movq %rax, -0x48(%rbp)
movq -0x78(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x1c3c0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1c0bb
jmp 0x1c0da
leaq 0x20bce(%rip), %rdi     # 0x3cc90
leaq 0x20bcb(%rip), %rsi     # 0x3cc94
movl $0x237, %edx            # imm = 0x237
leaq 0x20bc9(%rip), %rcx     # 0x3cc9e
callq 0x2170
jmp 0x1c0dc
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x48(%rbp), %rcx
movslq 0x4(%rcx), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x80(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
movq -0x80(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jg 0x1c231
movq -0x98(%rbp), %rax
movslq -0x84(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jl 0x1c187
movl -0x84(%rbp), %eax
movq -0x98(%rbp), %rcx
movslq -0x84(%rbp), %rdx
addl (%rcx,%rdx,4), %eax
cmpl $-0x1, %eax
jl 0x1c187
movq -0x98(%rbp), %rax
movslq -0x84(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jge 0x1c187
movl -0x84(%rbp), %eax
movq -0x98(%rbp), %rcx
movslq -0x84(%rbp), %rdx
addl (%rcx,%rdx,4), %eax
cmpl -0x24(%rbp), %eax
jl 0x1c18c
jmp 0x1c21d
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x98(%rbp), %rax
movslq -0x84(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movl -0x84(%rbp), %ecx
callq 0x1c500
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1c206
movl -0x84(%rbp), %eax
addl -0x9c(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1c206
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x50(%rbp), %rcx
movslq 0x4(%rcx), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x84(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
jmp 0x1c231
movl -0x9c(%rbp), %edx
movq -0x98(%rbp), %rax
movslq -0x84(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x1c112
movl -0x84(%rbp), %eax
movq -0x80(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jg 0x1c245
jmp 0x1c325
movq -0x48(%rbp), %rax
movl 0x10(%rax), %eax
xorl %ecx, %ecx
subl -0x14(%rbp), %ecx
cmpl %ecx, %eax
jle 0x1c267
movq -0x48(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x1c272
xorl %eax, %eax
subl -0x14(%rbp), %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movl %eax, -0x88(%rbp)
movq -0x48(%rbp), %rax
movl 0x14(%rax), %eax
cmpl -0x24(%rbp), %eax
jge 0x1c29c
movq -0x48(%rbp), %rax
movl 0x14(%rax), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x1c2a5
movl -0x24(%rbp), %eax
movl %eax, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x48(%rbp), %rax
movl (%rax), %eax
addl $0x1, %eax
movq -0x10(%rbp), %rcx
cltd
idivl 0x18(%rcx)
cmpl $0x0, %edx
jne 0x1c2d8
movq -0x78(%rbp), %rdi
movq -0x50(%rbp), %rdx
leaq -0x60(%rbp), %rsi
callq 0x1c5a0
movq -0x78(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x50(%rbp), %r8
movl -0x88(%rbp), %r9d
movl -0x8c(%rbp), %eax
movl %eax, (%rsp)
callq 0x1c640
movq -0x48(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x0, %eax
jne 0x1c320
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x1cc70
jmp 0x1c0dc
movq -0x8(%rbp), %rdi
movl -0x38(%rbp), %edx
leaq -0x60(%rbp), %rsi
leaq -0x3c(%rbp), %rcx
callq 0x1cfc0
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x78(%rbp)
jne 0x1c37a
movq -0x78(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1d160
movq -0x78(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1d1f0
movq -0x78(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x1d1f0
movq -0x78(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x2670
jmp 0x1c383
movq -0x78(%rbp), %rdi
callq 0x25f0
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
movslq -0x3c(%rbp), %rdx
shlq $0x3, %rdx
callq 0x2bd0
movq %rax, -0x70(%rbp)
movl -0x3c(%rbp), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x70(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)