// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: select_unqiue_path_on_fly_raw(usg_t*, unsigned long, unsigned long, asg64_v*, asg64_v*, unsigned long*, unsigned int*, unsigned long*, unsigned char*, unsigned long, asg64_v*)
void select_unqiue_path_on_fly_raw(usg_t *g, uint64_t s, uint64_t e, asg64_v *b64, asg64_v *ub64,
uint64_t *integer_seq, uint32_t *ng_occ, uint64_t *is_reli, uint8_t *f, uint64_t max_ext, asg64_v *res)
{
    uint64_t k, sk = (uint64_t)-1, ek = (uint64_t)-1, *p = NULL; ub64->n = 0;
    assert(occ_m(ng_occ[integer_seq[s]]) == 1);
    assert(occ_m(ng_occ[integer_seq[e]^1]) == 1);
    sk = s; ek = e;
    if(get_ext_tip(g, integer_seq, sk, ek, b64, ub64, f, max_ext) < max_ext) {
        kv_pushp(uint64_t, *res, &p); *p = sk; (*p) <<= 32; (*p) |= ek;
        // fprintf(stderr, "+ext_k::[%lu, %lu]\ts::%lu\te::%lu\n", sk, ek, s, e);
        // fprintf(stderr, "occ[sk]::%u\tocc[ek]::%u\tocc[s]::%u\tocc[e]::%u\n", 
        // occ_m(ng_occ[integer_seq[sk]]), occ_m(ng_occ[integer_seq[ek]^1]), 
        // occ_m(ng_occ[integer_seq[s]]), occ_m(ng_occ[integer_seq[e]^1]));
    }
    return;
    


    for (k = sk + 1; k <= e; k++) {
        if(sk != ((uint64_t)-1)) {
            if(reli_pass(is_reli[(integer_seq[k]^1)])) {
                if(occ_m((ng_occ[integer_seq[k]]^1)) == 1) {
                    ek = k; ///check and extend [sk, ek]
                    if((ek > sk) && (get_ext_tip(g, integer_seq, sk, ek, b64, ub64, f, max_ext) < max_ext)) {
                        p = ((res->n > 0)? (&(res->a[res->n-1])):NULL);
                        if(p && (((uint32_t)(*p)) == sk)) {
                            (*p) >>= 32; (*p) <<= 32; (*p) |= ek;
                        } else {
                            kv_pushp(uint64_t, *res, &p); *p = sk; (*p) <<= 32; (*p) |= ek;
                        }
                    }
                    sk = ek = ((uint64_t)-1);
                }
            } else {
                sk = ek = ((uint64_t)-1);
            }
        }

        ///case2: sk != (uint64_t)-1 && ek == (uint64_t)-1 -> wait for an available ek
        ///case3: sk == (uint64_t)-1 && ek == (uint64_t)-1 -> not available
        if(k < e) {
            if((!(reli_pass(is_reli[integer_seq[k]])))) {
                sk = ek = (uint64_t)-1; continue;
            }
            if((sk == (uint64_t)-1) && (occ_m(ng_occ[integer_seq[k]]) == 1)) {
                sk = k;
            }
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %r8, %rax
movq %rcx, %r8
movq %rdx, %r14
movq %rsi, %rbx
movq 0x20(%rsp), %rcx
movq $0x0, (%rax)
movq (%r9,%rsi,8), %rsi
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl (%rcx,%rsi,4), %esi
andl %edx, %esi
cmpl $0x1, %esi
jne 0x2103c6
movq (%r9,%r14,8), %rsi
xorq $0x1, %rsi
andl (%rcx,%rsi,4), %edx
cmpl $0x1, %edx
jne 0x2103e5
movq 0x38(%rsp), %r15
movq %r9, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %rax, %r9
pushq %r15
pushq 0x38(%rsp)
callq 0x20fb6b
addq $0x10, %rsp
cmpq %r15, %rax
jae 0x2103c0
movq 0x40(%rsp), %r15
movq 0x8(%r15), %rax
cmpq %rax, (%r15)
jne 0x2103a7
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
shlq $0x3, %rsi
callq 0x2370
movq %rax, 0x10(%r15)
movq (%r15), %rax
movq 0x10(%r15), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r15)
shlq $0x20, %rbx
orq %r14, %rbx
movq %rbx, (%rcx,%rax,8)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2c5b9(%rip), %rdi     # 0x23c986
leaq 0x28f51(%rip), %rsi     # 0x239325
leaq 0x2c689(%rip), %rcx     # 0x23ca64
movl $0x329b, %edx           # imm = 0x329B
callq 0x2110
leaq 0x2c653(%rip), %rdi     # 0x23ca3f
leaq 0x28f32(%rip), %rsi     # 0x239325
leaq 0x2c66a(%rip), %rcx     # 0x23ca64
movl $0x329c, %edx           # imm = 0x329C
callq 0x2110