// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: worker_unique_bridge_check_s(void*, long, int)
static void worker_unique_bridge_check_s(void *data, long i, int tid) // callback for kt_for()
{
    unique_bridge_check_t *uaux = (unique_bridge_check_t *)data;
    uint64_t *integer_seq = uaux->integer_seq, s, e, vk, wk, nse, k;
    uint64_t *gidx = uaux->gidx, *interval = uaux->interval_idx;
    bubble_type *bub = uaux->uidx->bub; usg_t *ng = uaux->ng;

    s = interval[((uint32_t)gidx[i])]>>32; 
    e = ((uint32_t)interval[((uint32_t)gidx[i])]); 
    assert(s < e);
    for (k = s, vk = wk = (uint32_t)-1; k <= e; k++) {
        if(k > s) {
            // nse = get_arc_support(uaux->uidx, (ng->a[integer_seq[k-1]>>1].mm<<1)|(integer_seq[k-1]&1), 
            // (ng->a[integer_seq[k]>>1].mm<<1)|(integer_seq[k]&1));
            nse = get_arc_support_chain(uaux->uidx, integer_seq+k-1, 2, ng);
            if(nse < unique_bridge_occ) {
                // if((!(uaux->is_double_check)) || (!is_consist_ul(uaux->uidx, integer_seq+k-1, 2, ng))) {
                    gidx[i] |= ((uint64_t)0x8000000000000000); return;
                // }
            }
        }
        if(IF_HOM((integer_seq[k]>>1), *bub)) continue;
        // w = (ng->a[integer_seq[k]>>1].mm<<1)|(integer_seq[k]&1);
        wk = k;
        if(vk != (uint32_t)-1) {
            // nse = get_arc_support(uaux->uidx, v, w);
            nse = get_arc_support_chain(uaux->uidx, integer_seq+vk, wk+1-vk, ng);
            if(nse < unique_bridge_occ) {
                // if((!(uaux->is_double_check)) || (!is_consist_ul(uaux->uidx, integer_seq+vk, wk+1-vk, ng))) {
                    gidx[i] |= ((uint64_t)0x8000000000000000); return;
                // }
            }
        }
        vk = wk;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x68(%rbp), %rax
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x30(%rbp)
movq -0x68(%rbp), %rax
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x35c693
jmp 0x35c6b2
leaq 0x3cfde(%rip), %rdi     # 0x399678
leaq 0x39b18(%rip), %rsi     # 0x3961b9
movl $0x339a, %edx           # imm = 0x339A
leaq 0x3ec14(%rip), %rcx     # 0x39b2c1
callq 0x2130
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x48(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x40(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x38(%rbp), %rax
ja 0x35c7e7
movq -0x58(%rbp), %rax
cmpq -0x30(%rbp), %rax
jbe 0x35c738
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x58(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
addq $-0x8, %rsi
movq -0x78(%rbp), %rcx
movl $0x2, %edx
callq 0x35c120
movq %rax, -0x50(%rbp)
cmpq $0x2, -0x50(%rbp)
jae 0x35c736
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x35c7e7
jmp 0x35c738
movq -0x70(%rbp), %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movq -0x58(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq %rcx
movl (%rax,%rcx,4), %eax
movq -0x70(%rbp), %rcx
movq 0x80(%rcx), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jbe 0x35c767
jmp 0x35c7d6
movq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x40(%rbp)
je 0x35c7ce
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x40(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x48(%rbp), %rdx
addq $0x1, %rdx
subq -0x40(%rbp), %rdx
movq -0x78(%rbp), %rcx
callq 0x35c120
movq %rax, -0x50(%rbp)
cmpq $0x2, -0x50(%rbp)
jae 0x35c7cc
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x35c7e7
jmp 0x35c7ce
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x35c6cc
addq $0x80, %rsp
popq %rbp
retq