// File: 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
movq %rsp, %rbp
subq $0xa0, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x35661a
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3565df
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x78(%rbp)
jmp 0x3565ea
movl $0x2, %eax
movq %rax, -0x78(%rbp)
jmp 0x3565ea
movq -0x78(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x35663d
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x356dc0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $-0x1, %rsi
movq %rsi, (%rdx)
movq -0x8(%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpq $-0x1, (%rax,%rcx,8)
je 0x35667e
jmp 0x35663d
movq 0x10(%rbp), %rdx
shlq $0x20, %rdx
orq -0x48(%rbp), %rdx
movq -0x30(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
jbe 0x3566d0
jmp 0x3566ef
leaq 0x42e28(%rip), %rdi     # 0x3994ff
leaq 0x3fadb(%rip), %rsi     # 0x3961b9
movl $0x2f70, %edx           # imm = 0x2F70
leaq 0x42ea7(%rip), %rcx     # 0x399591
callq 0x2130
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x356a67
movq -0x28(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shlq %rax
shrq $0x21, %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x3568a8
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
cmpq -0x58(%rbp), %rax
jne 0x356774
jmp 0x356793
leaq 0x42dd8(%rip), %rdi     # 0x399553
leaq 0x3fa37(%rip), %rsi     # 0x3961b9
movl $0x2f77, %edx           # imm = 0x2F77
leaq 0x42e03(%rip), %rcx     # 0x399591
callq 0x2130
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
cmpq $-0x1, (%rax,%rcx,8)
je 0x3567fa
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
cmpq 0x10(%rbp), %rax
jne 0x3567d6
jmp 0x3567f5
leaq 0x42e18(%rip), %rdi     # 0x3995f5
leaq 0x3f9d5(%rip), %rsi     # 0x3961b9
movl $0x2f79, %edx           # imm = 0x2F79
leaq 0x42da1(%rip), %rcx     # 0x399591
callq 0x2130
jmp 0x356897
jmp 0x3567fc
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x356864
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x356829
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x80(%rbp)
jmp 0x356834
movl $0x2, %eax
movq %rax, -0x80(%rbp)
jmp 0x356834
movq -0x80(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x356897
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x35674a
movq -0x28(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
xorq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shlq %rax
shrq $0x21, %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x356a54
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
cmpq -0x58(%rbp), %rax
jne 0x356917
jmp 0x356936
leaq 0x42c35(%rip), %rdi     # 0x399553
leaq 0x3f894(%rip), %rsi     # 0x3961b9
movl $0x2f85, %edx           # imm = 0x2F85
leaq 0x42c60(%rip), %rcx     # 0x399591
callq 0x2130
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
cmpq $-0x1, (%rax,%rcx,8)
je 0x35699d
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
cmpq 0x10(%rbp), %rax
jne 0x356979
jmp 0x356998
leaq 0x42c75(%rip), %rdi     # 0x3995f5
leaq 0x3f832(%rip), %rsi     # 0x3961b9
movl $0x2f87, %edx           # imm = 0x2F87
leaq 0x42bfe(%rip), %rcx     # 0x399591
callq 0x2130
jmp 0x356a43
jmp 0x35699f
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x356a10
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3569cf
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x88(%rbp)
jmp 0x3569dd
movl $0x2, %eax
movq %rax, -0x88(%rbp)
jmp 0x3569dd
movq -0x88(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x356a43
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x3568ed
jmp 0x356a56
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x3566fb
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shlq %rax
shrq $0x21, %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x356c0f
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
cmpq -0x58(%rbp), %rax
jne 0x356ad2
jmp 0x356af1
leaq 0x42a7a(%rip), %rdi     # 0x399553
leaq 0x3f6d9(%rip), %rsi     # 0x3961b9
movl $0x2f92, %edx           # imm = 0x2F92
leaq 0x42aa5(%rip), %rcx     # 0x399591
callq 0x2130
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
cmpq $-0x1, (%rax,%rcx,8)
je 0x356b58
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
cmpq 0x10(%rbp), %rax
jne 0x356b34
jmp 0x356b53
leaq 0x42aba(%rip), %rdi     # 0x3995f5
leaq 0x3f677(%rip), %rsi     # 0x3961b9
movl $0x2f94, %edx           # imm = 0x2F94
leaq 0x42a43(%rip), %rcx     # 0x399591
callq 0x2130
jmp 0x356bfe
jmp 0x356b5a
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x356bcb
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x356b8a
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x90(%rbp)
jmp 0x356b98
movl $0x2, %eax
movq %rax, -0x90(%rbp)
jmp 0x356b98
movq -0x90(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x356bfe
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x356aa8
movq -0x28(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
xorq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shlq %rax
shrq $0x21, %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x356dbb
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
cmpq -0x58(%rbp), %rax
jne 0x356c7e
jmp 0x356c9d
leaq 0x428ce(%rip), %rdi     # 0x399553
leaq 0x3f52d(%rip), %rsi     # 0x3961b9
movl $0x2f9e, %edx           # imm = 0x2F9E
leaq 0x428f9(%rip), %rcx     # 0x399591
callq 0x2130
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
cmpq $-0x1, (%rax,%rcx,8)
je 0x356d04
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
cmpq 0x10(%rbp), %rax
jne 0x356ce0
jmp 0x356cff
leaq 0x4290e(%rip), %rdi     # 0x3995f5
leaq 0x3f4cb(%rip), %rsi     # 0x3961b9
movl $0x2fa0, %edx           # imm = 0x2FA0
leaq 0x42897(%rip), %rcx     # 0x399591
callq 0x2130
jmp 0x356daa
jmp 0x356d06
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x356d77
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x356d36
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x98(%rbp)
jmp 0x356d44
movl $0x2, %eax
movq %rax, -0x98(%rbp)
jmp 0x356d44
movq -0x98(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x356daa
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x356c54
jmp 0x35663d
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)