// File: /workspace/github_cpp_makefile_star2_O1/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 %rsi, %r12
movq %rdi, %r13
movq 0x70(%rsp), %rdi
movq $0x0, (%r13)
cmpq $0x0, 0x8(%r13)
jne 0x20d5ff
movq $0x2, 0x8(%r13)
movq 0x10(%r13), %rdi
movl $0x10, %esi
callq 0x2370
movq 0x70(%rsp), %rdi
movq %rax, 0x10(%r13)
movq (%r13), %rax
movq 0x10(%r13), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r13)
movq %rdi, (%rcx,%rax,8)
movq (%r13), %rax
testq %rax, %rax
je 0x20d9a2
movq %rdi, %rcx
shlq $0x20, %rcx
movq %rcx, 0x28(%rsp)
movq 0x10(%r13), %rcx
leaq -0x1(%rax), %rdx
movq %rdx, (%r13)
movq -0x8(%rcx,%rax,8), %rax
cmpq $-0x1, (%rbx,%rax,8)
jne 0x20d995
movq %rax, %rcx
orq 0x28(%rsp), %rcx
movq %rcx, (%rbx,%rax,8)
movq 0x10(%r12), %rcx
movq (%rcx,%rax,8), %rax
movl %eax, %ecx
shrq $0x20, %rax
cmpq %rax, %rcx
jbe 0x20daa9
movq %rax, 0x30(%rsp)
leaq 0x1(%rax), %rdx
cmpq %rcx, %rdx
movq %rcx, 0x18(%rsp)
jae 0x20d819
movq 0x10(%rsp), %rax
movq %rdx, 0x20(%rsp)
movq (%rax,%rdx,8), %r14
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %r15
movl %r15d, %ebp
shrq $0x20, %r15
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
cmpq %rbp, %r15
jae 0x20d741
movq 0x10(%r12), %rax
movq (%rax,%r15,8), %rax
movq %rax, %rcx
shrq $0x20, %rcx
cmpq %r14, %rcx
jne 0x20d9b1
movl %eax, %eax
movq (%rbx,%rax,8), %rax
cmpq $-0x1, %rax
je 0x20d6e4
shrq $0x20, %rax
cmpq %rdi, %rax
je 0x20d735
jmp 0x20d9ef
movq 0x8(%r13), %rax
cmpq %rax, (%r13)
jne 0x20d718
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r13)
movq 0x10(%r13), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x70(%rsp), %rdi
movq %rax, 0x10(%r13)
movq 0x10(%r12), %rax
movl (%rax,%r15,8), %eax
movq (%r13), %rcx
movq 0x10(%r13), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r13)
movq %rax, (%rdx,%rcx,8)
incq %r15
cmpq %r15, %rbp
jne 0x20d6b1
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %r14
xorq $0x1, %r14
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %r15
movl %r15d, %ebp
shrq $0x20, %r15
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
cmpq %rbp, %r15
jae 0x20d803
movq 0x10(%r12), %rax
movq (%rax,%r15,8), %rax
movq %rax, %rcx
shrq $0x20, %rcx
cmpq %r14, %rcx
jne 0x20d9d0
movl %eax, %eax
movq (%rbx,%rax,8), %rax
cmpq $-0x1, %rax
je 0x20d7a6
shrq $0x20, %rax
cmpq %rdi, %rax
je 0x20d7f7
jmp 0x20da0e
movq 0x8(%r13), %rax
cmpq %rax, (%r13)
jne 0x20d7da
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r13)
movq 0x10(%r13), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x70(%rsp), %rdi
movq %rax, 0x10(%r13)
movq 0x10(%r12), %rax
movl (%rax,%r15,8), %eax
movq (%r13), %rcx
movq 0x10(%r13), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r13)
movq %rax, (%rdx,%rcx,8)
incq %r15
cmpq %r15, %rbp
jne 0x20d773
movq 0x20(%rsp), %rdx
incq %rdx
movq 0x18(%rsp), %rcx
cmpq %rcx, %rdx
jne 0x20d683
movq 0x10(%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %r14
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rbp
movl %ebp, %r15d
shrq $0x20, %rbp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
cmpq %r15, %rbp
jae 0x20d8d5
movq 0x10(%r12), %rax
movq (%rax,%rbp,8), %rax
movq %rax, %rcx
shrq $0x20, %rcx
cmpq %r14, %rcx
jne 0x20da2d
movl %eax, %eax
movq (%rbx,%rax,8), %rax
cmpq $-0x1, %rax
je 0x20d879
shrq $0x20, %rax
cmpq %rdi, %rax
je 0x20d8c9
jmp 0x20da6b
movq 0x8(%r13), %rax
cmpq %rax, (%r13)
jne 0x20d8ad
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r13)
movq 0x10(%r13), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x70(%rsp), %rdi
movq %rax, 0x10(%r13)
movq 0x10(%r12), %rax
movl (%rax,%rbp,8), %eax
movq (%r13), %rcx
movq 0x10(%r13), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r13)
movq %rax, (%rdx,%rcx,8)
incq %rbp
cmpq %rbp, %r15
jne 0x20d846
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %r14
xorq $0x1, %r14
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rbp
movl %ebp, %r15d
shrq $0x20, %rbp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
cmpq %r15, %rbp
jae 0x20d995
movq 0x10(%r12), %rax
movq (%rax,%rbp,8), %rax
movq %rax, %rcx
shrq $0x20, %rcx
cmpq %r14, %rcx
jne 0x20da4c
movl %eax, %eax
movq (%rbx,%rax,8), %rax
cmpq $-0x1, %rax
je 0x20d939
shrq $0x20, %rax
cmpq %rdi, %rax
je 0x20d989
jmp 0x20da8a
movq 0x8(%r13), %rax
cmpq %rax, (%r13)
jne 0x20d96d
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r13)
movq 0x10(%r13), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x70(%rsp), %rdi
movq %rax, 0x10(%r13)
movq 0x10(%r12), %rax
movl (%rax,%rbp,8), %eax
movq (%r13), %rcx
movq 0x10(%r13), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r13)
movq %rax, (%rdx,%rcx,8)
incq %rbp
cmpq %rbp, %r15
jne 0x20d906
movq (%r13), %rax
testq %rax, %rax
jne 0x20d62c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2ebc7(%rip), %rdi     # 0x23c57f
leaq 0x2b966(%rip), %rsi     # 0x239325
leaq 0x2ebf7(%rip), %rcx     # 0x23c5bd
movl $0x2f77, %edx           # imm = 0x2F77
callq 0x2110
leaq 0x2eba8(%rip), %rdi     # 0x23c57f
leaq 0x2b947(%rip), %rsi     # 0x239325
leaq 0x2ebd8(%rip), %rcx     # 0x23c5bd
movl $0x2f85, %edx           # imm = 0x2F85
callq 0x2110
leaq 0x2ec2b(%rip), %rdi     # 0x23c621
leaq 0x2b928(%rip), %rsi     # 0x239325
leaq 0x2ebb9(%rip), %rcx     # 0x23c5bd
movl $0x2f79, %edx           # imm = 0x2F79
callq 0x2110
leaq 0x2ec0c(%rip), %rdi     # 0x23c621
leaq 0x2b909(%rip), %rsi     # 0x239325
leaq 0x2eb9a(%rip), %rcx     # 0x23c5bd
movl $0x2f87, %edx           # imm = 0x2F87
callq 0x2110
leaq 0x2eb4b(%rip), %rdi     # 0x23c57f
leaq 0x2b8ea(%rip), %rsi     # 0x239325
leaq 0x2eb7b(%rip), %rcx     # 0x23c5bd
movl $0x2f92, %edx           # imm = 0x2F92
callq 0x2110
leaq 0x2eb2c(%rip), %rdi     # 0x23c57f
leaq 0x2b8cb(%rip), %rsi     # 0x239325
leaq 0x2eb5c(%rip), %rcx     # 0x23c5bd
movl $0x2f9e, %edx           # imm = 0x2F9E
callq 0x2110
leaq 0x2ebaf(%rip), %rdi     # 0x23c621
leaq 0x2b8ac(%rip), %rsi     # 0x239325
leaq 0x2eb3d(%rip), %rcx     # 0x23c5bd
movl $0x2f94, %edx           # imm = 0x2F94
callq 0x2110
leaq 0x2eb90(%rip), %rdi     # 0x23c621
leaq 0x2b88d(%rip), %rsi     # 0x239325
leaq 0x2eb1e(%rip), %rcx     # 0x23c5bd
movl $0x2fa0, %edx           # imm = 0x2FA0
callq 0x2110
leaq 0x2ea7b(%rip), %rdi     # 0x23c52b
leaq 0x2b86e(%rip), %rsi     # 0x239325
leaq 0x2eaff(%rip), %rcx     # 0x23c5bd
movl $0x2f70, %edx           # imm = 0x2F70
callq 0x2110