// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/tovlp.cpp
// Function: dfs_reach(asg_t*, unsigned int, unsigned int, kvec_t_u32_warp*, kvec_t_u32_warp*, unsigned char*)
uint32_t dfs_reach(asg_t *g, uint32_t src, uint32_t dest, kvec_t_u32_warp *stack, kvec_t_u32_warp *tmp, uint8_t *vis)
{
    uint32_t cur, ncur, i, occ = 0;;
    asg_arc_t *acur = NULL;
    stack->a.n = 0; tmp->a.n = 0;
    kv_push(uint32_t, stack->a, src);

    while (stack->a.n > 0)
    {
        stack->a.n--;
        cur = stack->a.a[stack->a.n];
        if(vis[cur]) continue;
        else kv_push(uint32_t, tmp->a, cur);
        vis[cur] = 1;
        if(cur == dest)
        {
            occ = 1;
            break;
        }


        ncur = asg_arc_n(g, cur);
        acur = asg_arc_a(g, cur);
        for (i = 0; i < ncur; i++)
        {
            if(acur[i].del) continue;
            if(vis[acur[i].v]) continue;
            kv_push(uint32_t, stack->a, acur[i].v);
            if(acur[i].v == dest)
            {
                occ = 1;
                break;
            }
        }
        if(occ) break;
    }

    for (i = 0; i < tmp->a.n; i++)
    {
        vis[tmp->a.a[i]] = 0;
    }
    
    stack->a.n = 0; tmp->a.n = 0;
    return occ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r15
movq %r8, %rbx
movq %rcx, %r14
movl %esi, %r12d
movq %rdi, 0x10(%rsp)
xorl %r13d, %r13d
movq %r13, (%rcx)
movq %r13, (%r8)
movq 0x8(%rcx), %rax
cmpq %rax, (%rcx)
movl %edx, 0xc(%rsp)
jne 0x1906fd
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x8(%r14)
movq 0x10(%r14), %rdi
shlq $0x2, %rsi
callq 0x2370
movl 0xc(%rsp), %edx
movq %rax, 0x10(%r14)
movq (%r14), %rcx
movq 0x10(%r14), %rsi
movq %rcx, %rax
incq %rax
movq %rax, (%r14)
movl %r12d, (%rsi,%rcx,4)
je 0x190847
leaq -0x1(%rax), %rcx
movq %rcx, (%r14)
movq 0x10(%r14), %rcx
movl -0x4(%rcx,%rax,4), %r12d
cmpb $0x0, (%r15,%r12)
jne 0x190830
movq 0x8(%rbx), %rax
cmpq %rax, (%rbx)
jne 0x190764
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x2, %rsi
callq 0x2370
movl 0xc(%rsp), %edx
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
movl %r12d, (%rcx,%rax,4)
movb $0x1, (%r15,%r12)
movl $0x1, %r13d
cmpl %edx, %r12d
je 0x190847
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax,%r12,8), %rax
testl %eax, %eax
je 0x190830
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq %rax, %rsi
shrq $0x20, %rsi
movl %eax, %eax
leaq (%rsi,%rsi,2), %rsi
leaq (%rcx,%rsi,8), %r12
addq $0x8, %r12
shlq $0x3, %rax
leaq (%rax,%rax,2), %r13
xorl %ebp, %ebp
cmpl $0x0, 0x4(%r12,%rbp)
js 0x190827
movl (%r12,%rbp), %eax
cmpb $0x0, (%r15,%rax)
jne 0x190827
movq 0x8(%r14), %rax
cmpq %rax, (%r14)
jne 0x19080c
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r14)
movq 0x10(%r14), %rdi
shlq $0x2, %rsi
callq 0x2370
movl 0xc(%rsp), %edx
movq %rax, 0x10(%r14)
movl (%r12,%rbp), %eax
movq (%r14), %rcx
movq 0x10(%r14), %rdi
leaq 0x1(%rcx), %rsi
movq %rsi, (%r14)
movl %eax, (%rdi,%rcx,4)
cmpl %edx, (%r12,%rbp)
je 0x190841
addq $0x18, %rbp
cmpq %rbp, %r13
jne 0x1907c7
movq (%r14), %rax
testq %rax, %rax
jne 0x190717
xorl %r13d, %r13d
jmp 0x190847
movl $0x1, %r13d
cmpq $0x0, (%rbx)
je 0x190869
movl $0x1, %eax
xorl %ecx, %ecx
movq 0x10(%rbx), %rdx
movl (%rdx,%rcx,4), %ecx
movb $0x0, (%r15,%rcx)
movl %eax, %ecx
incl %eax
cmpq %rcx, (%rbx)
ja 0x190854
xorl %eax, %eax
movq %rax, (%r14)
movq %rax, (%rbx)
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq