// File: /workspace/github_cpp_makefile_star2_O3/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 0x21b7cf
movq (%r9,%r14,8), %rsi
xorq $0x1, %rsi
andl (%rcx,%rsi,4), %edx
cmpl $0x1, %edx
jne 0x21b7ee
movq 0x38(%rsp), %r15
movq %r9, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %rax, %r9
pushq %r15
pushq 0x38(%rsp)
callq 0x21af98
addq $0x10, %rsp
cmpq %r15, %rax
jae 0x21b7c9
movq 0x40(%rsp), %r15
movq (%r15), %rcx
cmpq 0x8(%r15), %rcx
jne 0x21b7b3
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
movl $0x2, %esi
cmovneq %rax, %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
shlq $0x3, %rsi
callq 0x2370
movq %rax, 0x10(%r15)
movq (%r15), %rcx
jmp 0x21b7b7
movq 0x10(%r15), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, (%r15)
shlq $0x20, %rbx
orq %r14, %rbx
movq %rbx, (%rax,%rcx,8)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2d494(%rip), %rdi     # 0x248c6a
leaq 0x29e2c(%rip), %rsi     # 0x245609
leaq 0x2d564(%rip), %rcx     # 0x248d48
movl $0x329b, %edx           # imm = 0x329B
callq 0x2110
leaq 0x2d52e(%rip), %rdi     # 0x248d23
leaq 0x29e0d(%rip), %rsi     # 0x245609
leaq 0x2d545(%rip), %rcx     # 0x248d48
movl $0x329c, %edx           # imm = 0x329C
callq 0x2110