// File: /workspace/github_cpp_makefile_star2_O2/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
andq $0x0, (%rax)
movq (%r9,%rsi,8), %rsi
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl (%rcx,%rsi,4), %esi
andl %edx, %esi
cmpl $0x1, %esi
jne 0x1ccc16
movq (%r9,%r14,8), %rsi
xorq $0x1, %rsi
andl (%rcx,%rsi,4), %edx
cmpl $0x1, %edx
jne 0x1ccc35
movq 0x38(%rsp), %r15
movq %r9, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %rax, %r9
pushq %r15
pushq 0x38(%rsp)
callq 0x1cc43b
popq %rcx
popq %rdx
cmpq %r15, %rax
jae 0x1ccc10
movq 0x40(%rsp), %r15
movq (%r15), %rcx
cmpq 0x8(%r15), %rcx
jne 0x1ccbfa
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
pushq $0x2
popq %rsi
cmovneq %rax, %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
shlq $0x3, %rsi
callq 0x2370
movq %rax, 0x10(%r15)
movq (%r15), %rcx
jmp 0x1ccbfe
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 0x2e00c(%rip), %rdi     # 0x1fac29
leaq 0x2a8b5(%rip), %rsi     # 0x1f74d9
leaq 0x2e0dc(%rip), %rcx     # 0x1fad07
movl $0x329b, %edx           # imm = 0x329B
callq 0x2110
leaq 0x2e0a6(%rip), %rdi     # 0x1face2
leaq 0x2a896(%rip), %rsi     # 0x1f74d9
leaq 0x2e0bd(%rip), %rcx     # 0x1fad07
movl $0x329c, %edx           # imm = 0x329C
callq 0x2110