// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/miniwfa.c
// Function: mwf_wfa_core
static void mwf_wfa_core(void *km, const mwf_opt_t *opt, int32_t tl, const char *pts, int32_t ql, const char *pqs, int32_t n_seg, wf_chkpt_t *seg, mwf_rst_t *r)
{
	int32_t max_pen, sid, is_tb = !!(opt->flag&MWF_F_CIGAR), last_state = 0, stopped = 0;
	wf_stripe_t *wf;
	wf_tb_t tb = {0,0,0};
	void *km_tb, *km_st;

	memset(r, 0, sizeof(*r));
	km_tb = is_tb && !(opt->flag&MWF_F_NO_KALLOC)? km_init2(km, 0) : 0;
	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;
	wf = wf_stripe_init(km_st, max_pen);
	assert(pts);

	sid = 0;
	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 = 0;
			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);
			//fprintf(stderr, "[s=%d] [%d,%d]:%d %d->%d,%d,%d,%d,%d\n", wf->s, p->lo, p->hi, d, H[d], k, wf->a[wf->top].E1[d], wf->a[wf->top].F1[d], wf->a[wf->top].E2[d], wf->a[wf->top].F2[d]);
			if (k == tl - 1 && d + k == ql - 1) {
				if (k == H[d] && is_tb)
					last_state = tb.a[tb.n-1].x[d - tb.a[tb.n-1].lo] & 7;
				break;
			}
			H[d] = k;
		}
		if (d <= p->hi) break;
		if (is_tb && seg && sid < n_seg && seg[sid].s == wf->s) {
			assert(seg[sid].d >= wf->lo && seg[sid].d <= wf->hi);
			wf->lo = wf->hi = seg[sid++].d;
		}
		lo = wf->lo > -tl? wf->lo - 1 : -tl;
		hi = wf->hi <  ql? wf->hi + 1 :  ql;
		wf_next_basic(km_st, km_tb, opt, wf, is_tb? &tb : 0, lo, hi);
		if ((wf->s&0xff) == 0) wf_stripe_shrink(wf, tl, ql);
		r->n_iter += hi - lo + 1;
		if ((opt->max_iter > 0 && r->n_iter > opt->max_iter) || (opt->max_s > 0 && wf->s > opt->max_s)) {
			stopped = 1;
			break;
		}
	}
	r->s = stopped? -1 : wf->s;
	if (is_tb && !stopped)
		r->cigar = wf_traceback(km, opt, &tb, tl-1, pts, ql-1, pqs, last_state, &r->n_cigar);
	if (km_st == 0) wf_stripe_destroy(km_st, wf);
	else km_destroy(km_st);
	km_destroy(km_tb);
	if (is_tb && !stopped)
		r->cigar = (uint32_t*)krelocate(km, r->cigar, r->n_cigar * sizeof(*r->cigar));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2190
movq 0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2190
cmpl $0x0, -0x3c(%rbp)
je 0x1d6a0
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x1d6a0
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x24a0
movq %rax, -0xa0(%rbp)
jmp 0x1d6ab
xorl %eax, %eax
movq %rax, -0xa0(%rbp)
jmp 0x1d6ab
movq -0xa0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x1d6da
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x24a0
movq %rax, -0xa8(%rbp)
jmp 0x1d6e5
xorl %eax, %eax
movq %rax, -0xa8(%rbp)
jmp 0x1d6e5
movq -0xa8(%rbp), %rax
movq %rax, -0x70(%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 0x1d71a
movl -0x34(%rbp), %eax
movl %eax, -0xac(%rbp)
jmp 0x1d72e
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 0x1d757
movl -0x34(%rbp), %eax
movl %eax, -0xb0(%rbp)
jmp 0x1d76b
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 -0x70(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x1c3c0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1d78d
jmp 0x1d7ac
leaq 0x1f4fc(%rip), %rdi     # 0x3cc90
leaq 0x1f4f9(%rip), %rsi     # 0x3cc94
movl $0x18a, %edx            # imm = 0x18A
leaq 0x1f643(%rip), %rcx     # 0x3cdea
callq 0x2170
movl $0x0, -0x38(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x50(%rbp), %rcx
movslq 0x4(%rcx), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x78(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jg 0x1d91a
movl $0x0, -0x94(%rbp)
movq -0x90(%rbp), %rax
movslq -0x7c(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jl 0x1d850
movl -0x7c(%rbp), %eax
movq -0x90(%rbp), %rcx
movslq -0x7c(%rbp), %rdx
addl (%rcx,%rdx,4), %eax
cmpl $-0x1, %eax
jl 0x1d850
movq -0x90(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jge 0x1d850
movl -0x7c(%rbp), %eax
movq -0x90(%rbp), %rcx
movslq -0x7c(%rbp), %rdx
addl (%rcx,%rdx,4), %eax
cmpl -0x24(%rbp), %eax
jl 0x1d855
jmp 0x1d90c
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x90(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movl -0x7c(%rbp), %ecx
callq 0x1c500
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1d8f8
movl -0x7c(%rbp), %eax
addl -0x94(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1d8f8
movl -0x94(%rbp), %eax
movq -0x90(%rbp), %rcx
movslq -0x7c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x1d8f6
cmpl $0x0, -0x3c(%rbp)
je 0x1d8f6
movq -0x58(%rbp), %rax
movl -0x5c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x7c(%rbp), %ecx
movq -0x58(%rbp), %rdx
movl -0x5c(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
shlq $0x4, %rsi
addq %rsi, %rdx
subl (%rdx), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
andl $0x7, %eax
movl %eax, -0x40(%rbp)
jmp 0x1d91a
movl -0x94(%rbp), %edx
movq -0x90(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x1d7e6
movl -0x7c(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jg 0x1d92b
jmp 0x1db34
cmpl $0x0, -0x3c(%rbp)
je 0x1d9ce
cmpq $0x0, 0x18(%rbp)
je 0x1d9ce
movl -0x38(%rbp), %eax
cmpl 0x10(%rbp), %eax
jge 0x1d9ce
movq 0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,8), %eax
movq -0x50(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x1d9ce
movq 0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %eax
movq -0x50(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jl 0x1d98b
movq 0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %eax
movq -0x50(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jg 0x1d98b
jmp 0x1d9aa
leaq 0x1f4d7(%rip), %rdi     # 0x3ce69
leaq 0x1f2fb(%rip), %rsi     # 0x3cc94
movl $0x19e, %edx            # imm = 0x19E
leaq 0x1f445(%rip), %rcx     # 0x3cdea
callq 0x2170
movq 0x18(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x38(%rbp)
movslq %ecx, %rcx
movl 0x4(%rax,%rcx,8), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x50(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x50(%rbp), %rax
movl 0x10(%rax), %eax
xorl %ecx, %ecx
subl -0x14(%rbp), %ecx
cmpl %ecx, %eax
jle 0x1d9f0
movq -0x50(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x1d9fb
xorl %eax, %eax
subl -0x14(%rbp), %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x50(%rbp), %rax
movl 0x14(%rax), %eax
cmpl -0x24(%rbp), %eax
jge 0x1da22
movq -0x50(%rbp), %rax
movl 0x14(%rax), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x1da2b
movl -0x24(%rbp), %eax
movl %eax, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0xc0(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x1da76
leaq -0x60(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x1da81
xorl %eax, %eax
movq %rax, -0xe0(%rbp)
jmp 0x1da81
movq -0xc0(%rbp), %rcx
movq -0xc8(%rbp), %rdx
movq -0xd0(%rbp), %rsi
movq -0xd8(%rbp), %rdi
movq -0xe0(%rbp), %r8
movl -0x80(%rbp), %r9d
movl -0x84(%rbp), %eax
movl %eax, (%rsp)
callq 0x1f580
movq -0x50(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x0, %eax
jne 0x1dad5
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x1cc70
movl -0x84(%rbp), %eax
subl -0x80(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
movq 0x20(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jle 0x1db0d
movq 0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jg 0x1db26
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jle 0x1db2f
movq -0x50(%rbp), %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jle 0x1db2f
movl $0x1, -0x44(%rbp)
jmp 0x1db34
jmp 0x1d7b3
cmpl $0x0, -0x44(%rbp)
je 0x1db47
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0xe4(%rbp)
jmp 0x1db53
movq -0x50(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xe4(%rbp)
movl -0xe4(%rbp), %ecx
movq 0x20(%rbp), %rax
movl %ecx, (%rax)
cmpl $0x0, -0x3c(%rbp)
je 0x1dbb7
cmpl $0x0, -0x44(%rbp)
jne 0x1dbb7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movq -0x20(%rbp), %r8
movl -0x24(%rbp), %r9d
subl $0x1, %r9d
movq -0x30(%rbp), %r11
movl -0x40(%rbp), %r10d
movq 0x20(%rbp), %rax
addq $0x4, %rax
leaq -0x60(%rbp), %rdx
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x1f880
movq %rax, %rcx
movq 0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
cmpq $0x0, -0x70(%rbp)
jne 0x1dbcd
movq -0x70(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x1d1f0
jmp 0x1dbd6
movq -0x70(%rbp), %rdi
callq 0x25f0
movq -0x68(%rbp), %rdi
callq 0x25f0
cmpl $0x0, -0x3c(%rbp)
je 0x1dc13
cmpl $0x0, -0x44(%rbp)
jne 0x1dc13
movq -0x8(%rbp), %rdi
movq 0x20(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x20(%rbp), %rax
movslq 0x4(%rax), %rdx
shlq $0x2, %rdx
callq 0x2bd0
movq %rax, %rcx
movq 0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax)