// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: new_path_ext(ul_resolve_t*, usg_t*, asg64_v*, asg64_v*, unsigned long, unsigned long, unsigned long*, unsigned long*, unsigned char*, unsigned int*, unsigned int)
void new_path_ext(ul_resolve_t *uidx, usg_t *ng, asg64_v *b64, asg64_v *ub64, uint64_t a_n, uint64_t n_clus, uint64_t *i_idx, uint64_t *int_a, 
uint8_t *ff, uint32_t *ng_occ, uint32_t max_ext)
{
    asg64_v res; kv_init(res); uint64_t k, i, s, e, nvtx = ng->n<<1;
    for (k = a_n + 1, i = a_n, res.n = 0; k <= b64->n; k++) {
        if(k == b64->n || (b64->a[k]>>32) != (b64->a[i]>>32)) {
            update_thread_path(ng, b64, ub64, i, k, int_a, ng_occ, i_idx, ff, max_ext, &res);
            i = k; n_clus--;
        }
    }
    assert(n_clus == 0);
    

    if(res.n > 0) {
        memset(ng_occ, 0, sizeof((*ng_occ))*nvtx);
        for (i = 0; i < res.n; i++) {
            s = res.a[i]>>32; e = ((uint32_t)res.a[i]); assert(s < e);
            for (k = s + 1; k < e; k++) {///note: here is [s, e]
                ng_occ[int_a[k]]++; ng_occ[int_a[k]^1]++; 
            }
            ng_occ[int_a[s]]++; ng_occ[int_a[e]^1]++;
        }
        for (i = 0; i < nvtx; i++) {
            if(!ng_occ[i]) ng_occ[i] = (uint32_t)-1;        
        }

        for (i = 0, ub64->n = 0; i < res.n; i++) {
            s = res.a[i]>>32; e = ((uint32_t)res.a[i]); 
            update_usg_t_threading_0(uidx, ng, int_a + s, e + 1 - s, ng_occ, ub64);
        }
    }
    kv_destroy(res);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r9, %rbp
movq %rcx, 0x30(%rsp)
movq %rdx, %r13
movl 0xc0(%rsp), %ecx
movq 0xb8(%rsp), %r15
movq 0xb0(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0xa8(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movq 0x8(%rsi), %rdx
movq %rdx, 0x58(%rsp)
movq %rax, 0x40(%rsp)
leaq 0x1(%r8), %rbx
movq (%r13), %rax
cmpq %rax, %rbx
movq %rsi, 0x38(%rsp)
ja 0x210d68
movq %rsi, %rdi
movl %ecx, %r14d
cmpq %rax, %rbx
je 0x210d1e
movq 0x10(%r13), %rax
movq (%rax,%r8,8), %rcx
xorq (%rax,%rbx,8), %rcx
shrq $0x20, %rcx
je 0x210d5c
leaq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r14, 0x18(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r15, (%rsp)
movq %r13, %rsi
movq 0x30(%rsp), %rdx
movq %r8, %rcx
movq %rbx, %r8
movq %r12, %r9
callq 0x210404
movq 0x38(%rsp), %rdi
decq %rbp
movq %rbx, %r8
incq %rbx
movq (%r13), %rax
cmpq %rax, %rbx
jbe 0x210d07
testq %rbp, %rbp
jne 0x210e90
movq 0x40(%rsp), %rbx
testq %rbx, %rbx
je 0x210e59
movq 0x58(%rsp), %rdx
leaq (%rdx,%rdx), %r13
shlq $0x3, %rdx
xorl %r14d, %r14d
movq %r15, %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x50(%rsp), %rax
movq (%rax,%r14,8), %rdx
movl %edx, %ecx
shrq $0x20, %rdx
cmpq %rcx, %rdx
jae 0x210e71
leaq 0x1(%rdx), %rsi
cmpq %rcx, %rsi
jae 0x210dd2
movq (%r12,%rsi,8), %rdi
incl (%r15,%rdi,4)
xorq $0x1, %rdi
incl (%r15,%rdi,4)
incq %rsi
cmpq %rsi, %rcx
jne 0x210dba
movq (%r12,%rdx,8), %rdx
incl (%r15,%rdx,4)
movq (%r12,%rcx,8), %rcx
xorq $0x1, %rcx
incl (%r15,%rcx,4)
incq %r14
cmpq %rbx, %r14
jne 0x210d9e
testq %r13, %r13
movq 0x30(%rsp), %rcx
je 0x210e11
xorl %eax, %eax
cmpl $0x0, (%r15,%rax,4)
jne 0x210e09
movl $0xffffffff, (%r15,%rax,4) # imm = 0xFFFFFFFF
incq %rax
cmpq %rax, %r13
jne 0x210dfa
movq $0x0, (%rcx)
movq 0x50(%rsp), %r14
cmpq $0x1, %rbx
adcq $0x0, %rbx
xorl %r13d, %r13d
movq 0x38(%rsp), %rbp
movq (%r14,%r13,8), %rax
movl %eax, %ecx
shrq $0x20, %rax
leaq (%r12,%rax,8), %rdx
subq %rax, %rcx
incq %rcx
movq %rbp, %rsi
movq %r15, %r8
movq 0x30(%rsp), %r9
callq 0x20e7c8
incq %r13
cmpq %r13, %rbx
jne 0x210e2d
movq 0x50(%rsp), %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
leaq 0x2b82c(%rip), %rdi     # 0x23c6a4
leaq 0x284a6(%rip), %rsi     # 0x239325
leaq 0x2bd9e(%rip), %rcx     # 0x23cc24
movl $0x3412, %edx           # imm = 0x3412
callq 0x2110
leaq 0x2bd81(%rip), %rdi     # 0x23cc18
leaq 0x28487(%rip), %rsi     # 0x239325
leaq 0x2bd7f(%rip), %rcx     # 0x23cc24
movl $0x340c, %edx           # imm = 0x340C
callq 0x2110