// File: /workspace/github_cpp_makefile_star2_O2/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, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq %rdx, %rbp
movl 0xc0(%rsp), %ebx
movq 0xb8(%rsp), %r15
movq 0xb0(%rsp), %r14
movq 0xa8(%rsp), %r12
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rcx
movups %xmm0, 0x8(%rcx)
movq %rsi, 0x40(%rsp)
movq 0x8(%rsi), %rax
movq %rax, 0x48(%rsp)
andq $0x0, (%rcx)
movq (%rbp), %rax
leaq 0x1(%r8), %rcx
cmpq %rax, %rcx
ja 0x1cd496
movq %rcx, %r13
je 0x1cd459
movq 0x10(%rbp), %rcx
movq (%rcx,%r8,8), %rdx
xorq (%rcx,%r13,8), %rdx
shrq $0x20, %rdx
leaq 0x1(%r13), %rcx
testq %rdx, %rdx
je 0x1cd436
leaq 0x50(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %rbx, 0x18(%rsp)
movq %r14, 0x10(%rsp)
movq %r15, (%rsp)
movq 0x40(%rsp), %rdi
movq %rbp, %rsi
movq 0x30(%rsp), %rdx
movq %r8, %rcx
movq %r13, %r8
movq %r12, %r9
callq 0x1ccc54
decq 0x38(%rsp)
movq %r13, %r8
jmp 0x1cd42e
cmpq $0x0, 0x38(%rsp)
jne 0x1cd5a6
movq 0x50(%rsp), %rbp
movq 0x60(%rsp), %r13
testq %rbp, %rbp
je 0x1cd571
movq 0x48(%rsp), %rdx
leaq (%rdx,%rdx), %rbx
shlq $0x3, %rdx
xorl %r14d, %r14d
movq %r15, %rdi
xorl %esi, %esi
callq 0x20e0
cmpq %rbp, %r14
je 0x1cd51f
movq (%r13,%r14,8), %rcx
movl %ecx, %eax
shrq $0x20, %rcx
cmpq %rax, %rcx
jae 0x1cd587
leaq 0x1(%rcx), %rdx
cmpq %rax, %rdx
jae 0x1cd506
movq (%r12,%rdx,8), %rsi
incl (%r15,%rsi,4)
xorq $0x1, %rsi
incl (%r15,%rsi,4)
incq %rdx
jmp 0x1cd4ec
movq (%r12,%rcx,8), %rcx
incl (%r15,%rcx,4)
movq (%r12,%rax,8), %rax
xorq $0x1, %rax
incl (%r15,%rax,4)
incq %r14
jmp 0x1cd4cf
xorl %eax, %eax
movq 0x30(%rsp), %r14
cmpq %rax, %rbx
je 0x1cd53c
cmpl $0x0, (%r15,%rax,4)
jne 0x1cd537
orl $-0x1, (%r15,%rax,4)
incq %rax
jmp 0x1cd526
andq $0x0, (%r14)
xorl %ebx, %ebx
cmpq %rbx, %rbp
je 0x1cd571
movq (%r13,%rbx,8), %rax
movl %eax, %ecx
shrq $0x20, %rax
leaq (%r12,%rax,8), %rdx
subq %rax, %rcx
incq %rcx
movq 0x40(%rsp), %rsi
movq %r15, %r8
movq %r14, %r9
callq 0x1cb332
incq %rbx
jmp 0x1cd542
movq %r13, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
leaq 0x2d3b9(%rip), %rdi     # 0x1fa947
leaq 0x29f44(%rip), %rsi     # 0x1f74d9
leaq 0x2d92b(%rip), %rcx     # 0x1faec7
movl $0x3412, %edx           # imm = 0x3412
callq 0x2110
leaq 0x2d90e(%rip), %rdi     # 0x1faebb
leaq 0x29f25(%rip), %rsi     # 0x1f74d9
leaq 0x2d90c(%rip), %rcx     # 0x1faec7
movl $0x340c, %edx           # imm = 0x340C
callq 0x2110