// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: update_thread_path(usg_t*, asg64_v*, asg64_v*, unsigned long, unsigned long, unsigned long*, unsigned int*, unsigned long*, unsigned char*, unsigned long, asg64_v*)
void update_thread_path(usg_t *g, asg64_v *b64, asg64_v *ub64, uint64_t g_s, uint64_t g_e, uint64_t *integer_seq, 
uint32_t *ng_occ, uint64_t *reliable_idx, uint8_t *f, uint64_t max_ext, asg64_v *res)
{
    uint64_t i, k, s, e; 
    for (i = g_s; i < g_e; i++) {///available intervals within the same cluster
        s = b64->a[((uint32_t)b64->a[i])]>>32; e = ((uint32_t)b64->a[((uint32_t)b64->a[i])]); assert(s < e);
        for (k = s + 1; k < e; k++) {///note: here is [s, e]
            f[integer_seq[k]] = f[integer_seq[k]^1] = 1;
        }
        f[integer_seq[s]] = f[integer_seq[e]^1] = 1;
    }

    for (i = g_s; i < g_e; i++) {///available intervals within the same cluster
        s = b64->a[((uint32_t)b64->a[i])]>>32; e = ((uint32_t)b64->a[((uint32_t)b64->a[i])]); assert(s < e);
        // fprintf(stderr, "[M::%s::] i::%lu, chain_id::%u\n", __func__, i, ((uint32_t)b64->a[i]));
        // select_unqiue_path_on_fly(g, s, e, b64, ub64, integer_seq, ng_occ, reliable_idx, f, max_ext, res);
        select_unqiue_path_on_fly_raw(g, s, e, b64, ub64, integer_seq, ng_occ, reliable_idx, f, max_ext, res);
    }

    for (i = g_s; i < g_e; i++) {///available intervals within the same cluster
        s = b64->a[((uint32_t)b64->a[i])]>>32; e = ((uint32_t)b64->a[((uint32_t)b64->a[i])]); assert(s < e);
        for (k = s + 1; k < e; k++) {///note: here is [s, e]
            f[integer_seq[k]] = f[integer_seq[k]^1] = 0;
        }
        f[integer_seq[s]] = f[integer_seq[e]^1] = 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x35bd02
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x35bc56
jmp 0x35bc75
leaq 0x3da1b(%rip), %rdi     # 0x399678
leaq 0x3a555(%rip), %rsi     # 0x3961b9
movl $0x32cf, %edx           # imm = 0x32CF
leaq 0x3de62(%rip), %rcx     # 0x399ad2
callq 0x2130
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x35bcc5
movq 0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x50(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
xorq $0x1, %rcx
movb $0x1, (%rax,%rcx)
movq 0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x50(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movb $0x1, (%rax,%rcx)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x35bc81
movq 0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
xorq $0x1, %rcx
movb $0x1, (%rax,%rcx)
movq 0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x58(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movb $0x1, (%rax,%rcx)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x35bbf2
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x35bde7
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x35bd6e
jmp 0x35bd8d
leaq 0x3d903(%rip), %rdi     # 0x399678
leaq 0x3a43d(%rip), %rsi     # 0x3961b9
movl $0x32d7, %edx           # imm = 0x32D7
leaq 0x3dd4a(%rip), %rcx     # 0x399ad2
callq 0x2130
movq -0x18(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x40(%rbp), %r9
movq 0x10(%rbp), %r14
movq 0x18(%rbp), %rbx
movq 0x20(%rbp), %r11
movq 0x28(%rbp), %r10
movq 0x30(%rbp), %rax
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x35b9d0
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x35bd0a
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x35beff
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x35be53
jmp 0x35be72
leaq 0x3d81e(%rip), %rdi     # 0x399678
leaq 0x3a358(%rip), %rsi     # 0x3961b9
movl $0x32de, %edx           # imm = 0x32DE
leaq 0x3dc65(%rip), %rcx     # 0x399ad2
callq 0x2130
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x35bec2
movq 0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x50(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
xorq $0x1, %rcx
movb $0x0, (%rax,%rcx)
movq 0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x50(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movb $0x0, (%rax,%rcx)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x35be7e
movq 0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
xorq $0x1, %rcx
movb $0x0, (%rax,%rcx)
movq 0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x58(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movb $0x0, (%rax,%rcx)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x35bdef
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax,%rax)