// File: /workspace/github_cpp_makefile_star2_O3/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, 0x18(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %r13
movq 0x70(%rsp), %r8
movq $0x0, (%rdi)
cmpq $0x0, 0x8(%rdi)
je 0x2188e3
movq 0x10(%r13), %rax
xorl %ecx, %ecx
jmp 0x218906
movq $0x2, 0x8(%r13)
movq 0x10(%r13), %rdi
movl $0x10, %esi
callq 0x2370
movq 0x70(%rsp), %r8
movq %rax, 0x10(%r13)
movq (%r13), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r13)
movq %r8, (%rax,%rcx,8)
movq (%r13), %rcx
testq %rcx, %rcx
je 0x218c75
movq %r8, %rdx
shlq $0x20, %rdx
movq %rdx, 0x20(%rsp)
leaq -0x1(%rcx), %rdx
movq %rdx, (%r13)
movq -0x8(%rax,%rcx,8), %rdx
cmpq $-0x1, (%rbx,%rdx,8)
jne 0x218c68
movq %rdx, %rcx
orq 0x20(%rsp), %rcx
movq %rcx, (%rbx,%rdx,8)
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%rcx,%rdx,8), %rdx
movl %edx, %ebp
shrq $0x20, %rdx
cmpq %rdx, %rbp
jbe 0x218d7c
movq %rdx, 0x28(%rsp)
leaq 0x1(%rdx), %r15
cmpq %rbp, %r15
movq %rbp, 0x30(%rsp)
jae 0x218af9
movq 0x10(%rsp), %rdx
movq (%rdx,%r15,8), %r14
movq 0x18(%rsp), %rdx
movq (%rdx,%r14,8), %rbp
movl %ebp, %r12d
shrq $0x20, %rbp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
cmpq %r12, %rbp
jae 0x218a3c
movq (%rcx,%rbp,8), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
cmpq %r14, %rsi
jne 0x218c84
movl %edx, %edx
movq (%rbx,%rdx,8), %rdx
cmpq $-0x1, %rdx
je 0x2189d8
shrq $0x20, %rdx
cmpq %r8, %rdx
je 0x218a27
jmp 0x218cc2
movq (%r13), %rdx
cmpq 0x8(%r13), %rdx
jne 0x218a18
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r13)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x70(%rsp), %r8
movq %rax, 0x10(%r13)
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%r13), %rdx
movl (%rcx,%rbp,8), %esi
leaq 0x1(%rdx), %rdi
movq %rdi, (%r13)
movq %rsi, (%rax,%rdx,8)
incq %rbp
cmpq %rbp, %r12
jne 0x2189aa
movq 0x10(%rsp), %rdx
movq (%rdx,%r15,8), %r14
xorq $0x1, %r14
movq 0x18(%rsp), %rdx
movq (%rdx,%r14,8), %rbp
movl %ebp, %r12d
shrq $0x20, %rbp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
cmpq %r12, %rbp
jae 0x218ae8
movq (%rcx,%rbp,8), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
cmpq %r14, %rsi
jne 0x218ca3
movl %edx, %edx
movq (%rbx,%rdx,8), %rdx
cmpq $-0x1, %rdx
je 0x218a8d
shrq $0x20, %rdx
cmpq %r8, %rdx
je 0x218adc
jmp 0x218ce1
movq (%r13), %rdx
cmpq 0x8(%r13), %rdx
jne 0x218acd
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r13)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x70(%rsp), %r8
movq %rax, 0x10(%r13)
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%r13), %rdx
movl (%rcx,%rbp,8), %esi
leaq 0x1(%rdx), %rdi
movq %rdi, (%r13)
movq %rsi, (%rax,%rdx,8)
incq %rbp
cmpq %rbp, %r12
jne 0x218a5f
incq %r15
movq 0x30(%rsp), %rbp
cmpq %rbp, %r15
jne 0x218982
movq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rsi
movq (%rdx,%rsi,8), %r14
movq 0x18(%rsp), %rdx
movq (%rdx,%r14,8), %r12
movl %r12d, %r15d
shrq $0x20, %r12
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
cmpq %r15, %r12
jae 0x218bb1
movq (%rcx,%r12,8), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
cmpq %r14, %rsi
jne 0x218d00
movl %edx, %edx
movq (%rbx,%rdx,8), %rdx
cmpq $-0x1, %rdx
je 0x218b55
shrq $0x20, %rdx
cmpq %r8, %rdx
je 0x218ba5
jmp 0x218d3e
movq (%r13), %rdx
cmpq 0x8(%r13), %rdx
jne 0x218b95
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r13)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x70(%rsp), %r8
movq %rax, 0x10(%r13)
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%r13), %rdx
movl (%rcx,%r12,8), %esi
leaq 0x1(%rdx), %rdi
movq %rdi, (%r13)
movq %rsi, (%rax,%rdx,8)
incq %r12
cmpq %r12, %r15
jne 0x218b27
movq 0x10(%rsp), %rdx
movq (%rdx,%rbp,8), %r14
xorq $0x1, %r14
movq 0x18(%rsp), %rdx
movq (%rdx,%r14,8), %r12
movl %r12d, %r15d
shrq $0x20, %r12
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
cmpq %r15, %r12
jae 0x218c68
movq (%rcx,%r12,8), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
cmpq %r14, %rsi
jne 0x218d1f
movl %edx, %edx
movq (%rbx,%rdx,8), %rdx
cmpq $-0x1, %rdx
je 0x218c0c
shrq $0x20, %rdx
cmpq %r8, %rdx
je 0x218c5c
jmp 0x218d5d
movq (%r13), %rdx
cmpq 0x8(%r13), %rdx
jne 0x218c4c
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r13)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x70(%rsp), %r8
movq %rax, 0x10(%r13)
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%r13), %rdx
movl (%rcx,%r12,8), %esi
leaq 0x1(%rdx), %rdi
movq %rdi, (%r13)
movq %rsi, (%rax,%rdx,8)
incq %r12
cmpq %r12, %r15
jne 0x218bde
movq (%r13), %rcx
testq %rcx, %rcx
jne 0x21892b
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2fbd8(%rip), %rdi     # 0x248863
leaq 0x2c977(%rip), %rsi     # 0x245609
leaq 0x2fc08(%rip), %rcx     # 0x2488a1
movl $0x2f77, %edx           # imm = 0x2F77
callq 0x2110
leaq 0x2fbb9(%rip), %rdi     # 0x248863
leaq 0x2c958(%rip), %rsi     # 0x245609
leaq 0x2fbe9(%rip), %rcx     # 0x2488a1
movl $0x2f85, %edx           # imm = 0x2F85
callq 0x2110
leaq 0x2fc3c(%rip), %rdi     # 0x248905
leaq 0x2c939(%rip), %rsi     # 0x245609
leaq 0x2fbca(%rip), %rcx     # 0x2488a1
movl $0x2f79, %edx           # imm = 0x2F79
callq 0x2110
leaq 0x2fc1d(%rip), %rdi     # 0x248905
leaq 0x2c91a(%rip), %rsi     # 0x245609
leaq 0x2fbab(%rip), %rcx     # 0x2488a1
movl $0x2f87, %edx           # imm = 0x2F87
callq 0x2110
leaq 0x2fb5c(%rip), %rdi     # 0x248863
leaq 0x2c8fb(%rip), %rsi     # 0x245609
leaq 0x2fb8c(%rip), %rcx     # 0x2488a1
movl $0x2f92, %edx           # imm = 0x2F92
callq 0x2110
leaq 0x2fb3d(%rip), %rdi     # 0x248863
leaq 0x2c8dc(%rip), %rsi     # 0x245609
leaq 0x2fb6d(%rip), %rcx     # 0x2488a1
movl $0x2f9e, %edx           # imm = 0x2F9E
callq 0x2110
leaq 0x2fbc0(%rip), %rdi     # 0x248905
leaq 0x2c8bd(%rip), %rsi     # 0x245609
leaq 0x2fb4e(%rip), %rcx     # 0x2488a1
movl $0x2f94, %edx           # imm = 0x2F94
callq 0x2110
leaq 0x2fba1(%rip), %rdi     # 0x248905
leaq 0x2c89e(%rip), %rsi     # 0x245609
leaq 0x2fb2f(%rip), %rcx     # 0x2488a1
movl $0x2fa0, %edx           # imm = 0x2FA0
callq 0x2110
leaq 0x2fa8c(%rip), %rdi     # 0x24880f
leaq 0x2c87f(%rip), %rsi     # 0x245609
leaq 0x2fb10(%rip), %rcx     # 0x2488a1
movl $0x2f70, %edx           # imm = 0x2F70
callq 0x2110