// File: /workspace/github_cpp_makefile_star2_O2/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, %r14
movq %r8, %rbx
movq %rcx, %r15
movl %esi, %ebp
andq $0x0, (%rcx)
movq %rdi, 0x10(%rsp)
andq $0x0, (%r8)
movq (%rcx), %rcx
pushq $0x2
popq %rax
cmpq 0x8(%r15), %rcx
movl %edx, 0xc(%rsp)
jne 0x151fd3
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %rax, %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
shlq $0x2, %rsi
callq 0x2370
movl 0xc(%rsp), %edx
movq %rax, 0x10(%r15)
movq (%r15), %rcx
jmp 0x151fd7
movq 0x10(%r15), %rax
leaq 0x1(%rcx), %rsi
movq %rsi, (%r15)
movl %ebp, (%rax,%rcx,4)
testq %rsi, %rsi
je 0x1520f1
leaq -0x1(%rsi), %rax
movq %rax, (%r15)
movq 0x10(%r15), %rcx
movl -0x4(%rcx,%rsi,4), %r12d
cmpb $0x0, (%r14,%r12)
movq %rax, %rsi
jne 0x151fe1
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x15203a
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rbx)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movl 0xc(%rsp), %edx
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
leaq 0x1(%rcx), %rsi
movq %rsi, (%rbx)
movl %r12d, (%rax,%rcx,4)
movb $0x1, (%r14,%r12)
cmpl %edx, %r12d
je 0x1520ec
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x28(%rcx), %rcx
movq (%rcx,%r12,8), %rcx
movl %ecx, %esi
shrq $0x20, %rcx
imulq $0x18, %rsi, %r13
imulq $0x18, %rcx, %rcx
leaq (%rax,%rcx), %r12
addq $0x8, %r12
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x1520e4
cmpl $0x0, 0x4(%r12,%rbp)
js 0x1520de
movl (%r12,%rbp), %ecx
cmpb $0x0, (%r14,%rcx)
jne 0x1520de
movq (%r15), %rdi
movq 0x10(%r15), %rax
cmpq 0x8(%r15), %rdi
jne 0x1520ce
leaq (%rdi,%rdi), %rsi
testq %rdi, %rdi
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r15)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movl 0xc(%rsp), %edx
movq %rax, 0x10(%r15)
movl (%r12,%rbp), %ecx
movq (%r15), %rdi
leaq 0x1(%rdi), %rsi
movq %rsi, (%r15)
movl %ecx, (%rax,%rdi,4)
cmpl %edx, (%r12,%rbp)
je 0x1520ec
addq $0x18, %rbp
jmp 0x15207c
movq (%r15), %rsi
jmp 0x151fe1
pushq $0x1
popq %rax
jmp 0x1520f3
xorl %eax, %eax
xorl %ecx, %ecx
movl %ecx, %edx
cmpq %rdx, (%rbx)
jbe 0x15210d
movq 0x10(%rbx), %rcx
movl (%rcx,%rdx,4), %ecx
movb $0x0, (%r14,%rcx)
leal 0x1(%rdx), %ecx
jmp 0x1520f5
andq $0x0, (%r15)
andq $0x0, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq