// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/levdist.c
// Function: wf_ed_core
void wf_ed_core(wf_config_t *conf)
{
    char *ts, *qs;
    int32_t s, n, tl, ql, t_end, q_end, is_ext, bw;
    wf_diag1_t *a;
    wf_tb_t *tb;

    ts = conf->ts;
    qs = conf->qs;
    tl = conf->tl;
    ql = conf->ql;
    t_end = conf->t_end;
    q_end = conf->q_end;

    s = conf->score;
    n = conf->wf_diag->n;
    if (conf->wf_diag->m < 2 * (tl + ql + 2)) {
        conf->wf_diag->m = 2 * (tl + ql + 2);
        MYREALLOC(conf->wf_diag->a, conf->wf_diag->m);
    }
    a = conf->wf_diag->a;
    n = conf->wf_diag->n;
    tb = conf->wf_tb;
    
    is_ext = conf->is_ext;
    bw = conf->bw;

    int na = n;
    while (1) {
        na = wf_step_basic(tb, is_ext, bw, tl, ts, ql, qs, n, a, &t_end, &q_end);
        if (na < 0) break;
        ++s;
        n = na;
        if (bw >= 0 && s > bw) break;
    }
    
    if (tb) {
        free(conf->cigar);
        conf->cigar = wf_traceback(t_end, ts, q_end, qs, tb, &conf->n_cigar);
    }
    conf->t_end = t_end + 1;
    conf->q_end = q_end + 1;
    conf->score = s;
    conf->wf_diag->a = a;
    conf->wf_diag->n = n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movl -0x34(%rbp), %ecx
addl -0x38(%rbp), %ecx
addl $0x2, %ecx
shll %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jae 0x1de5f
movl -0x34(%rbp), %eax
addl -0x38(%rbp), %eax
addl $0x2, %eax
shll %eax
movslq %eax, %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
imulq $0xc, 0x8(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x48(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x5c(%rbp)
movq -0x58(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movl -0x34(%rbp), %ecx
movq -0x20(%rbp), %r8
movl -0x38(%rbp), %r9d
movq -0x28(%rbp), %r14
movl -0x30(%rbp), %ebx
movq -0x50(%rbp), %r11
leaq -0x3c(%rbp), %r10
leaq -0x40(%rbp), %rax
movq %r14, (%rsp)
movl %ebx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x1dfa0
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jge 0x1def2
jmp 0x1df13
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x48(%rbp)
jl 0x1df11
movl -0x2c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jle 0x1df11
jmp 0x1df13
jmp 0x1dea3
cmpq $0x0, -0x58(%rbp)
je 0x1df51
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x2060
movl -0x3c(%rbp), %edi
movq -0x20(%rbp), %rsi
movl -0x40(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x58(%rbp), %r8
movq -0x18(%rbp), %r9
addq $0x3c, %r9
callq 0x1e750
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x34(%rax)
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x38(%rax)
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x50(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x10(%rax)
movslq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, (%rax)
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq