// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: suffix_gorder_check(poa_g_t*, integer_t*, unsigned long, unsigned long, long, unsigned long)
int64_t suffix_gorder_check(poa_g_t *g, integer_t *buf, uint64_t gk_0, uint64_t gk_1, int64_t update_vis, uint64_t set_flag)
{
    uint32_t *g_idx = g->srt_b.res.a, *n2gidx = g->srt_b.res2nid.a, a_n, v, init_n, k; 
    poa_arc_t *a;
    if(buf->vis.n != g->seq.n) {
        kv_resize(uint32_t, buf->vis, g->seq.n); buf->vis.n = g->seq.n;
        memset(buf->vis.a, -1, sizeof((*buf->vis.a))*buf->vis.n);
    }

    if(update_vis) {
        v = g_idx[gk_0]<<1; init_n = buf->vis.n;
        kv_push(uint32_t, buf->vis, v); 
        while (buf->vis.n > init_n) {
            v = buf->vis.a[--buf->vis.n];
            buf->vis.a[n2gidx[v>>1]] = set_flag;
            a_n = poa_arc_n(g, v); a = poa_arc_a(g, v);
            for (k = 0; k < a_n; k++) {
                if(buf->vis.a[n2gidx[a[k].v>>1]] == set_flag) continue;
                kv_push(uint32_t, buf->vis, a[k].v);
            }
        }
        assert(buf->vis.n == init_n);
    }

    if(buf->vis.a[gk_1] == set_flag) return 1;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbx
movq %r8, %rbp
movq %rcx, 0x10(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movq (%rdi), %rdx
movq 0x90(%rdi), %r12
movq %rdi, 0x8(%rsp)
movq 0xa8(%rdi), %r14
cmpq %rdx, 0xa8(%rsi)
je 0x203acc
cmpq %rdx, 0xb0(%r15)
jae 0x203ab0
decq %rdx
movq %rdx, %rax
shrq %rax
orq %rdx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb0(%r15)
movq 0xb8(%r15), %rdi
leaq 0x4(,%rax,4), %rsi
callq 0x2370
movq %rax, %rdi
movq %rax, 0xb8(%r15)
movq 0x8(%rsp), %rax
movq (%rax), %rdx
jmp 0x203ab7
movq 0xb8(%r15), %rdi
movq %rdx, 0xa8(%r15)
shlq $0x2, %rdx
movl $0xff, %esi
callq 0x20e0
testq %rbp, %rbp
je 0x203b1e
movl (%r12,%r13,4), %ebp
addl %ebp, %ebp
movq 0xa8(%r15), %r12
cmpq 0xb0(%r15), %r12
jne 0x203b2a
leaq (%r12,%r12), %rax
testq %r12, %r12
movl $0x2, %esi
cmovneq %rax, %rsi
movq %rsi, 0xb0(%r15)
movq 0xb8(%r15), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0xb8(%r15)
movq 0xa8(%r15), %rdx
jmp 0x203b34
movq 0xb8(%r15), %rax
jmp 0x203c1f
movq 0xb8(%r15), %rax
movq %r12, %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0xa8(%r15)
movl %ebp, (%rax,%rdx,4)
movl %r12d, %edx
movq %rdx, (%rsp)
cmpq %rdx, %rcx
jbe 0x203c19
movq %rcx, %rdx
decq %rcx
movq %rcx, 0xa8(%r15)
movl -0x4(%rax,%rdx,4), %edx
movl %edx, %esi
shrl %esi
movl (%r14,%rsi,4), %esi
movl %ebx, (%rax,%rsi,4)
movq 0x8(%rsp), %rdi
movq 0x40(%rdi), %rsi
movq (%rsi,%rdx,8), %rdx
testl %edx, %edx
je 0x203c0f
movq 0x28(%rdi), %rsi
movq %rdx, %rdi
shrq $0x20, %rdi
movl %edx, %r13d
shlq $0x4, %rdi
leaq (%rsi,%rdi), %r12
addq $0x8, %r12
shlq $0x4, %r13
xorl %ebp, %ebp
movl (%r12,%rbp), %edx
movl %edx, %esi
shrl %esi
movl (%r14,%rsi,4), %esi
movl (%rax,%rsi,4), %esi
cmpq %rbx, %rsi
je 0x203c06
cmpq 0xb0(%r15), %rcx
jne 0x203bf5
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0xb0(%r15)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0xb8(%r15)
movl (%r12,%rbp), %edx
movq 0xa8(%r15), %rcx
leaq 0x1(%rcx), %rsi
movq %rsi, 0xa8(%r15)
movl %edx, (%rax,%rcx,4)
movq %rsi, %rcx
addq $0x10, %rbp
cmpq %rbp, %r13
jne 0x203ba3
cmpq (%rsp), %rcx
ja 0x203b52
cmpq (%rsp), %rcx
jne 0x203c3e
movq 0x10(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
xorl %eax, %eax
cmpq %rbx, %rcx
sete %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x433ae(%rip), %rdi     # 0x246ff3
leaq 0x419bd(%rip), %rsi     # 0x245609
leaq 0x433b5(%rip), %rcx     # 0x247008
movl $0x173b, %edx           # imm = 0x173B
callq 0x2110