// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/levdist.c
// Function: wf_traceback
static uint32_t *wf_traceback(int32_t t_end, const char *ts, int32_t q_end, const char *qs, wf_tb_t *tb, int32_t *n_cigar)
{
    wf_cigar_t cigar = {0,0,0};
    int32_t i = q_end, k = t_end, s = tb->n - 1;
    for (;;) {
        int32_t k0 = k, j, pre;
        while (i >= 0 && k >= 0 && qs[i] == ts[k])
            --i, --k;
        if (k0 - k > 0)    
            wf_cigar_push1(&cigar, 7, k0 - k);
        if (i < 0 || k < 0) break;
        assert(s >= 0);
        j = i - k - tb->a[s].d0;
        assert(j < tb->a[s].n);
        pre = (int32_t)(tb->a[s].a[j>>5] >> (j&0x1f)*2 & 0x3) - 1;
        if (pre == 0) {
            wf_cigar_push1(&cigar, 8, 1);
            --i, --k;
        } else if (pre < 0) {
            wf_cigar_push1(&cigar, 1, 1);
            --i;
        } else {
            wf_cigar_push1(&cigar, 2, 1);
            --k;
        }
        --s;
    }
    if (i >= 0) wf_cigar_push1(&cigar, 1, i + 1);
    else if (k >= 0) wf_cigar_push1(&cigar, 2, k + 1);
    for (i = 0; i < cigar.n>>1; ++i) {
        uint32_t t = cigar.cigar[i];
        cigar.cigar[i] = cigar.cigar[cigar.n - i - 1];
        cigar.cigar[cigar.n - i - 1] = t;
    }
    *n_cigar = cigar.n;
    return cigar.cigar;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x18(%rsp)
movq %rcx, %r15
movl %edx, %eax
movq %rsi, %r12
movl %edi, %edx
xorps %xmm0, %xmm0
movq %rsp, %rcx
movaps %xmm0, (%rcx)
movq %r8, 0x20(%rsp)
movl 0x8(%r8), %ebp
decl %ebp
testl %eax, %eax
js 0x1406f
testl %edx, %edx
js 0x1406f
movl %edx, %ecx
movl %eax, %esi
movb (%r15,%rsi), %sil
movl %ecx, %edi
cmpb (%r12,%rdi), %sil
jne 0x14074
leal -0x1(%rax), %ebx
leal -0x1(%rcx), %r13d
testl %eax, %eax
jle 0x14079
movl %ebx, %eax
testl %ecx, %ecx
movl %r13d, %ecx
jg 0x1404b
jmp 0x14079
movl %edx, %r13d
jmp 0x14077
movl %ecx, %r13d
movl %eax, %ebx
subl %r13d, %edx
jle 0x1408b
movq %rsp, %rdi
movl $0x7, %esi
callq 0x14ed7
movl %ebx, %r14d
orl %r13d, %r14d
js 0x14121
testl %ebp, %ebp
js 0x141be
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movl %ebp, %edx
shlq $0x4, %rdx
movl 0x4(%rax,%rdx), %esi
addl %r13d, %esi
movl %ebx, %ecx
subl %esi, %ecx
cmpl (%rax,%rdx), %ecx
jge 0x1419f
addq %rdx, %rax
movq 0x8(%rax), %rax
movl %ecx, %edx
sarl $0x5, %edx
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
addl %ecx, %ecx
shrq %cl, %rax
movq %rsp, %rdi
andl $0x3, %eax
je 0x140fa
cmpl $0x1, %eax
jne 0x1410d
movl $0x8, %esi
movl $0x1, %edx
callq 0x14ed7
decl %ebx
jmp 0x1411c
movl $0x1, %esi
movl $0x1, %edx
callq 0x14ed7
decl %ebx
jmp 0x1411f
movl $0x2, %esi
movl $0x1, %edx
callq 0x14ed7
decl %r13d
decl %ebp
movl %r13d, %edx
movl %ebx, %eax
testl %r14d, %r14d
jns 0x14041
movl $0x1, %esi
testl %eax, %eax
jns 0x14143
movl $0x2, %esi
movl %edx, %eax
testl %edx, %edx
js 0x1414f
incl %eax
movq %rsp, %rdi
movl %eax, %edx
callq 0x14ed7
movl 0x4(%rsp), %eax
movl %eax, %edx
sarl %edx
testl %edx, %edx
jle 0x14184
movq 0x8(%rsp), %rcx
movl %edx, %edx
leal -0x1(%rax), %esi
xorl %edi, %edi
movl (%rcx,%rdi,4), %r8d
movslq %esi, %rsi
movl (%rcx,%rsi,4), %r9d
movl %r9d, (%rcx,%rdi,4)
movl %r8d, (%rcx,%rsi,4)
incq %rdi
decl %esi
cmpq %rdi, %rdx
jne 0x14167
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
movq 0x8(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa9e2(%rip), %rdi      # 0x1eb88
leaq 0xa829(%rip), %rsi      # 0x1e9d6
leaq 0xa979(%rip), %rcx      # 0x1eb2d
movl $0xf0, %edx
callq 0x21d0
leaq 0xa961(%rip), %rdi      # 0x1eb26
leaq 0xa80a(%rip), %rsi      # 0x1e9d6
leaq 0xa95a(%rip), %rcx      # 0x1eb2d
movl $0xee, %edx
callq 0x21d0