// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: iter_unique_arcs(asg64_v*, asg64_v*, unsigned long, unsigned long*, unsigned long*, unsigned long*, unsigned long)
void iter_unique_arcs(asg64_v *buf, asg64_v *b64, uint64_t a_n, uint64_t *idx, uint64_t *integ_seq, uint64_t *cidx, uint64_t i0)
{
    uint64_t s, e, x, k, v, zs, ze, z;
    buf->n = 0;
    kv_push(uint64_t, *buf, i0);
    while(buf->n) {
        x = kv_pop(*buf);
        if(cidx[x] != (uint64_t)-1) continue;
        cidx[x] = (i0<<32)|(x);
        s = b64->a[x]>>32; e = (uint32_t)(b64->a[x]); assert(e > s);
        for (k = s + 1; k < e; k++) {///note: here is [s, e]
            v = integ_seq[k];///v is the raw unitig id
            zs = (idx[v]<<1)>>33; ze = (uint32_t)idx[v];
            for (z = zs; z < ze; z++) {
                ///(b64->a[z]>>32):: raw unitig id
                ///(uint32_t)b64->a[z]:: available interval id
                assert((b64->a[z]>>32)==v);
                if(cidx[((uint32_t)b64->a[z])] != (uint64_t)-1) {
                    assert((cidx[((uint32_t)b64->a[z])]>>32)==i0);
                    continue;
                }
                // cidx[((uint32_t)b64->a[z])] = (i0<<32)|((uint32_t)b64->a[z]);
                kv_push(uint64_t, *buf, ((uint32_t)b64->a[z]));
            }

            v = integ_seq[k]^1;
            zs = (idx[v]<<1)>>33; ze = (uint32_t)idx[v];
            for (z = zs; z < ze; z++) {
                ///(b64->a[z]>>32):: raw unitig id
                ///(uint32_t)b64->a[z]:: available interval id
                assert((b64->a[z]>>32)==v);
                if(cidx[((uint32_t)b64->a[z])] != (uint64_t)-1) {
                    assert((cidx[((uint32_t)b64->a[z])]>>32)==i0);
                    continue;
                }
                // cidx[((uint32_t)b64->a[z])] = (i0<<32)|((uint32_t)b64->a[z]);
                kv_push(uint64_t, *buf, ((uint32_t)b64->a[z]));
            }
        }

        v = integ_seq[s];
        zs = (idx[v]<<1)>>33; ze = (uint32_t)idx[v];
        for (z = zs; z < ze; z++) {
            assert((b64->a[z]>>32)==v);
            if(cidx[((uint32_t)b64->a[z])] != (uint64_t)-1) {
                assert((cidx[((uint32_t)b64->a[z])]>>32)==i0);
                continue;
            }
            // cidx[((uint32_t)b64->a[z])] = (i0<<32)|((uint32_t)b64->a[z]);
            kv_push(uint64_t, *buf, ((uint32_t)b64->a[z]));
        }

        v = integ_seq[e]^1;
        zs = (idx[v]<<1)>>33; ze = (uint32_t)idx[v];
        for (z = zs; z < ze; z++) {
            assert((b64->a[z]>>32)==v);
            if(cidx[((uint32_t)b64->a[z])] != (uint64_t)-1) {
                assert((cidx[((uint32_t)b64->a[z])]>>32)==i0);
                continue;
            }
            // cidx[((uint32_t)b64->a[z])] = (i0<<32)|((uint32_t)b64->a[z]);
            kv_push(uint64_t, *buf, ((uint32_t)b64->a[z]));
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %rbx
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdi, %r12
andq $0x0, (%rdi)
movq %rsi, (%rsp)
movq 0x70(%rsp), %rbp
cmpq $0x0, 0x8(%rdi)
je 0x1ca27d
movq 0x10(%r12), %rax
xorl %ecx, %ecx
jmp 0x1ca29c
movq $0x2, 0x8(%r12)
movq 0x10(%r12), %rdi
pushq $0x10
popq %rsi
callq 0x2370
movq %rax, 0x10(%r12)
movq (%r12), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r12)
movq %rbp, (%rax,%rcx,8)
movq %rbp, %rcx
shlq $0x20, %rcx
movq %rcx, 0x28(%rsp)
movq (%r12), %rcx
testq %rcx, %rcx
je 0x1ca5e8
leaq -0x1(%rcx), %rdx
movq %rdx, (%r12)
movq -0x8(%rax,%rcx,8), %rdx
cmpq $-0x1, (%rbx,%rdx,8)
jne 0x1ca2b4
movq %rdx, %rcx
orq 0x28(%rsp), %rcx
movq %rcx, (%rbx,%rdx,8)
movq (%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%rcx,%rdx,8), %rdx
movl %edx, %esi
movq %rdx, %rdi
shrq $0x20, %rdi
movq %rdi, %r8
movq %rsi, 0x18(%rsp)
movq %rdi, 0x30(%rsp)
cmpq %rdi, %rsi
jbe 0x1ca6ef
incq %r8
cmpq 0x18(%rsp), %r8
jae 0x1ca486
movq 0x10(%rsp), %rdx
movq %r8, 0x20(%rsp)
movq (%rdx,%r8,8), %r14
movq 0x8(%rsp), %rdx
movq (%rdx,%r14,8), %r13
movl %r13d, %r15d
shrq $0x20, %r13
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
cmpq %r15, %r13
jae 0x1ca3c9
movq (%rcx,%r13,8), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
cmpq %r14, %rsi
jne 0x1ca5f7
movl %edx, %edx
movq (%rbx,%rdx,8), %rdx
cmpq $-0x1, %rdx
je 0x1ca376
shrq $0x20, %rdx
cmpq %rbp, %rdx
je 0x1ca3c1
jmp 0x1ca635
movq (%r12), %rdx
cmpq 0x8(%r12), %rdx
jne 0x1ca3b1
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r12)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r12)
movq (%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%r12), %rdx
movl (%rcx,%r13,8), %esi
leaq 0x1(%rdx), %rdi
movq %rdi, (%r12)
movq %rsi, (%rax,%rdx,8)
incq %r13
jmp 0x1ca33f
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rsi
movq (%rdx,%rsi,8), %r14
xorq $0x1, %r14
movq 0x8(%rsp), %rdx
movq (%rdx,%r14,8), %r15
movl %r15d, %r13d
shrq $0x20, %r15
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
cmpq %r13, %r15
jae 0x1ca47c
movq (%rcx,%r15,8), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
cmpq %r14, %rsi
jne 0x1ca616
movl %edx, %edx
movq (%rbx,%rdx,8), %rdx
cmpq $-0x1, %rdx
je 0x1ca429
shrq $0x20, %rdx
cmpq %rbp, %rdx
je 0x1ca474
jmp 0x1ca654
movq (%r12), %rdx
cmpq 0x8(%r12), %rdx
jne 0x1ca464
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r12)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r12)
movq (%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%r12), %rdx
movl (%rcx,%r15,8), %esi
leaq 0x1(%rdx), %rdi
movq %rdi, (%r12)
movq %rsi, (%rax,%rdx,8)
incq %r15
jmp 0x1ca3f2
movq 0x20(%rsp), %r8
jmp 0x1ca30c
movq 0x10(%rsp), %rdx
movq 0x30(%rsp), %rsi
movq (%rdx,%rsi,8), %r14
movq 0x8(%rsp), %rdx
movq (%rdx,%r14,8), %r13
movl %r13d, %r15d
shrq $0x20, %r13
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
cmpq %r15, %r13
jae 0x1ca535
movq (%rcx,%r13,8), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
cmpq %r14, %rsi
jne 0x1ca673
movl %edx, %edx
movq (%rbx,%rdx,8), %rdx
cmpq $-0x1, %rdx
je 0x1ca4e2
shrq $0x20, %rdx
cmpq %rbp, %rdx
je 0x1ca52d
jmp 0x1ca6b1
movq (%r12), %rdx
cmpq 0x8(%r12), %rdx
jne 0x1ca51d
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r12)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r12)
movq (%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%r12), %rdx
movl (%rcx,%r13,8), %esi
leaq 0x1(%rdx), %rdi
movq %rdi, (%r12)
movq %rsi, (%rax,%rdx,8)
incq %r13
jmp 0x1ca4ab
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rsi
movq (%rdx,%rsi,8), %r14
xorq $0x1, %r14
movq 0x8(%rsp), %rdx
movq (%rdx,%r14,8), %r13
movl %r13d, %r15d
shrq $0x20, %r13
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
cmpq %r15, %r13
jae 0x1ca2b4
movq (%rcx,%r13,8), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
cmpq %r14, %rsi
jne 0x1ca692
movl %edx, %edx
movq (%rbx,%rdx,8), %rdx
cmpq $-0x1, %rdx
je 0x1ca595
shrq $0x20, %rdx
cmpq %rbp, %rdx
je 0x1ca5e0
jmp 0x1ca6d0
movq (%r12), %rdx
cmpq 0x8(%r12), %rdx
jne 0x1ca5d0
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r12)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r12)
movq (%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%r12), %rdx
movl (%rcx,%r13,8), %esi
leaq 0x1(%rdx), %rdi
movq %rdi, (%r12)
movq %rsi, (%rax,%rdx,8)
incq %r13
jmp 0x1ca55e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30224(%rip), %rdi     # 0x1fa822
leaq 0x2ced4(%rip), %rsi     # 0x1f74d9
leaq 0x30254(%rip), %rcx     # 0x1fa860
movl $0x2f77, %edx           # imm = 0x2F77
callq 0x2110
leaq 0x30205(%rip), %rdi     # 0x1fa822
leaq 0x2ceb5(%rip), %rsi     # 0x1f74d9
leaq 0x30235(%rip), %rcx     # 0x1fa860
movl $0x2f85, %edx           # imm = 0x2F85
callq 0x2110
leaq 0x30288(%rip), %rdi     # 0x1fa8c4
leaq 0x2ce96(%rip), %rsi     # 0x1f74d9
leaq 0x30216(%rip), %rcx     # 0x1fa860
movl $0x2f79, %edx           # imm = 0x2F79
callq 0x2110
leaq 0x30269(%rip), %rdi     # 0x1fa8c4
leaq 0x2ce77(%rip), %rsi     # 0x1f74d9
leaq 0x301f7(%rip), %rcx     # 0x1fa860
movl $0x2f87, %edx           # imm = 0x2F87
callq 0x2110
leaq 0x301a8(%rip), %rdi     # 0x1fa822
leaq 0x2ce58(%rip), %rsi     # 0x1f74d9
leaq 0x301d8(%rip), %rcx     # 0x1fa860
movl $0x2f92, %edx           # imm = 0x2F92
callq 0x2110
leaq 0x30189(%rip), %rdi     # 0x1fa822
leaq 0x2ce39(%rip), %rsi     # 0x1f74d9
leaq 0x301b9(%rip), %rcx     # 0x1fa860
movl $0x2f9e, %edx           # imm = 0x2F9E
callq 0x2110
leaq 0x3020c(%rip), %rdi     # 0x1fa8c4
leaq 0x2ce1a(%rip), %rsi     # 0x1f74d9
leaq 0x3019a(%rip), %rcx     # 0x1fa860
movl $0x2f94, %edx           # imm = 0x2F94
callq 0x2110
leaq 0x301ed(%rip), %rdi     # 0x1fa8c4
leaq 0x2cdfb(%rip), %rsi     # 0x1f74d9
leaq 0x3017b(%rip), %rcx     # 0x1fa860
movl $0x2fa0, %edx           # imm = 0x2FA0
callq 0x2110
leaq 0x300d8(%rip), %rdi     # 0x1fa7ce
leaq 0x2cddc(%rip), %rsi     # 0x1f74d9
leaq 0x3015c(%rip), %rcx     # 0x1fa860
movl $0x2f70, %edx           # imm = 0x2F70
callq 0x2110