// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/graph.c
// Function: asmg_uext
static inline int32_t asmg_uext(asmg_t *g, uint64_t v, int32_t max_ext, uint64_t *ne, uint64_t *le, u64_v_t *a, int tip_only)
{
    // the extension of circular unitigs will be bounded by max_ext
    // and the return value will be ASMG_VT_MERGEABLE
    int32_t vt;
    uint64_t nv, nw, l, w, n_ext, l_ext;
    l = n_ext = l_ext = 0;
    if (a) a->n = 0;
    if (a) kv_push(uint64_t, *a, v);
    do {
        nv = asmg_arc_n2(g, v, &w, &l);
        if (nv == 0) {
            vt = ASMG_VT_TIP;
        } else if (nv > 1) {
            vt = ASMG_VT_MULTI_OUT;
        } else {
            nw = asmg_arc_n1(g, w^1);
            vt = nw == 1? ASMG_VT_MERGEABLE : ASMG_VT_MULTI_NEI;
        }
        l_ext += l;
        if (vt != ASMG_VT_MERGEABLE) break;
        ++n_ext;
        if (a) kv_push(uint64_t, *a, w);
        v = w;
    } while (--max_ext > 0);
    if (tip_only && vt == ASMG_VT_MULTI_OUT) {
        // for tip extenstion
        l_ext -= l;
        if (a) (*a).n--;
    }
    if (ne) *ne = n_ext;
    if (le) *le = l_ext;
    return vt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x20dbf
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x20e57
jmp 0x20dcc
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x20e34
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x20df9
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x70(%rbp)
jmp 0x20e04
movl $0x2, %eax
movq %rax, -0x70(%rbp)
jmp 0x20e04
movq -0x70(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x20e57
jmp 0x20e59
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0x50(%rbp), %rcx
callq 0x24950
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x20e82
movl $0x1, -0x34(%rbp)
jmp 0x20ebe
cmpq $0x1, -0x40(%rbp)
jbe 0x20e92
movl $0x2, -0x34(%rbp)
jmp 0x20ebc
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
xorq $0x1, %rsi
callq 0x21690
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdx
movl $0x3, %eax
xorl %ecx, %ecx
cmpq $0x1, %rdx
cmovel %ecx, %eax
movl %eax, -0x34(%rbp)
jmp 0x20ebe
movq -0x50(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x20ed5
jmp 0x20f93
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x20f79
jmp 0x20eee
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x20f56
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x20f1b
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x78(%rbp)
jmp 0x20f26
movl $0x2, %eax
movq %rax, -0x78(%rbp)
jmp 0x20f26
movq -0x78(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x20f79
movq -0x58(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jg 0x20e59
cmpl $0x0, 0x10(%rbp)
je 0x20fc5
cmpl $0x2, -0x34(%rbp)
jne 0x20fc5
movq -0x50(%rbp), %rcx
movq -0x68(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x20fc3
movq -0x30(%rbp), %rax
movq (%rax), %rcx
addq $-0x1, %rcx
movq %rcx, (%rax)
jmp 0x20fc5
cmpq $0x0, -0x20(%rbp)
je 0x20fd7
movq -0x60(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x20fe9
movq -0x68(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl -0x34(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)