// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: dfs_bubble(asg_t*, kvec_t_u32_warp*, kvec_t_u32_warp*, unsigned int, unsigned int, unsigned int)
void dfs_bubble(asg_t *g, kvec_t_u32_warp* stack, kvec_t_u32_warp* result, uint32_t v, uint32_t beg, uint32_t sink)
{
    asg_arc_t *acur = NULL;
    uint32_t cur, ncur, i;
    stack->a.n = result->a.n = 0;
    v = v << 1;
    kv_push(uint32_t, stack->a, v);
    while (stack->a.n > 0)
    {
        stack->a.n--;
        cur = stack->a.a[stack->a.n];
        if((v>>1) != (cur>>1)) kv_push(uint32_t, result->a, cur>>1);
        ncur = asg_arc_n(g, cur);
        acur = asg_arc_a(g, cur);
        for (i = 0; i < ncur; i++)
        {
            if(acur[i].del) continue;
            if((acur[i].v>>1) == beg || (acur[i].v>>1) == sink) continue;
            kv_push(uint32_t, stack->a, acur[i].v);
        }
    }
    

    v = v + 1;
    kv_push(uint32_t, stack->a, v);
    while (stack->a.n > 0)
    {
        stack->a.n--;
        cur = stack->a.a[stack->a.n];
        if((v>>1) != (cur>>1)) kv_push(uint32_t, result->a, cur>>1);
        ncur = asg_arc_n(g, cur);
        acur = asg_arc_a(g, cur);
        for (i = 0; i < ncur; i++)
        {
            if(acur[i].del) continue;
            if((acur[i].v>>1) == beg || (acur[i].v>>1) == sink) continue;
            kv_push(uint32_t, stack->a, acur[i].v);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebx
movl %r8d, %ebp
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, 0x10(%rsp)
xorl %eax, %eax
movq %rax, (%rdx)
movq %rax, (%rsi)
movq %rcx, 0x8(%rsp)
leal (%rcx,%rcx), %r14d
cmpq %rax, 0x8(%rsi)
jne 0x13872a
movq $0x2, 0x8(%r12)
movq 0x10(%r12), %rdi
movl $0x8, %esi
callq 0x2370
movq %rax, 0x10(%r12)
movq (%r12), %rcx
movq 0x10(%r12), %rdx
movq %rcx, %rax
incq %rax
movq %rax, (%r12)
movl %r14d, 0x18(%rsp)
movl %r14d, (%rdx,%rcx,4)
movq %r13, 0x20(%rsp)
je 0x138884
movq 0x8(%rsp), %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, 0x1c(%rsp)
leaq -0x1(%rax), %rcx
movq %rcx, (%r12)
movq 0x10(%r12), %rcx
movl -0x4(%rcx,%rax,4), %r14d
movl %r14d, %r15d
shrl %r15d
cmpl %r15d, 0x1c(%rsp)
je 0x1387c2
movq 0x8(%r13), %rax
cmpq %rax, (%r13)
jne 0x1387ae
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r13)
movq 0x10(%r13), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x10(%r13)
movq (%r13), %rax
movq 0x10(%r13), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r13)
movl %r15d, (%rcx,%rax,4)
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax,%r14,8), %rax
testl %eax, %eax
je 0x138872
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq %rax, %rdx
shrq $0x20, %rdx
movl %eax, %eax
leaq (%rdx,%rdx,2), %rdx
leaq (%rcx,%rdx,8), %r13
addq $0x8, %r13
shlq $0x3, %rax
leaq (%rax,%rax,2), %r14
xorl %r15d, %r15d
cmpl $0x0, 0x4(%r13,%r15)
js 0x138869
movl (%r13,%r15), %eax
shrl %eax
cmpl %ebp, %eax
sete %cl
cmpl %ebx, %eax
sete %al
orb %cl, %al
jne 0x138869
movq 0x8(%r12), %rax
cmpq %rax, (%r12)
jne 0x138850
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r12)
movq 0x10(%r12), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x10(%r12)
movl (%r13,%r15), %eax
movq (%r12), %rcx
movq 0x10(%r12), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r12)
movl %eax, (%rdx,%rcx,4)
addq $0x18, %r15
cmpq %r15, %r14
jne 0x138800
movq (%r12), %rax
testq %rax, %rax
movq 0x20(%rsp), %r13
jne 0x138760
movl 0x18(%rsp), %r14d
orl $0x1, %r14d
cmpq $0x0, 0x8(%r12)
jne 0x1388b2
movq $0x2, 0x8(%r12)
movq 0x10(%r12), %rdi
movl $0x8, %esi
callq 0x2370
movq %rax, 0x10(%r12)
movq (%r12), %rcx
movq 0x10(%r12), %rdx
movq %rcx, %rax
incq %rax
movq %rax, (%r12)
movl %r14d, (%rdx,%rcx,4)
je 0x138a03
movq 0x8(%rsp), %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq %rcx, 0x8(%rsp)
leaq -0x1(%rax), %rcx
movq %rcx, (%r12)
movq 0x10(%r12), %rcx
movl -0x4(%rcx,%rax,4), %r14d
movl %r14d, %r15d
shrl %r15d
cmpl %r15d, 0x8(%rsp)
je 0x138941
movq 0x8(%r13), %rax
cmpq %rax, (%r13)
jne 0x13892d
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r13)
movq 0x10(%r13), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x10(%r13)
movq (%r13), %rax
movq 0x10(%r13), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r13)
movl %r15d, (%rcx,%rax,4)
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax,%r14,8), %rax
testl %eax, %eax
je 0x1389f1
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq %rax, %rdx
shrq $0x20, %rdx
movl %eax, %eax
leaq (%rdx,%rdx,2), %rdx
leaq (%rcx,%rdx,8), %r13
addq $0x8, %r13
shlq $0x3, %rax
leaq (%rax,%rax,2), %r14
xorl %r15d, %r15d
cmpl $0x0, 0x4(%r13,%r15)
js 0x1389e8
movl (%r13,%r15), %eax
shrl %eax
cmpl %ebp, %eax
sete %cl
cmpl %ebx, %eax
sete %al
orb %cl, %al
jne 0x1389e8
movq 0x8(%r12), %rax
cmpq %rax, (%r12)
jne 0x1389cf
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r12)
movq 0x10(%r12), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x10(%r12)
movl (%r13,%r15), %eax
movq (%r12), %rcx
movq 0x10(%r12), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r12)
movl %eax, (%rdx,%rcx,4)
addq $0x18, %r15
cmpq %r15, %r14
jne 0x13897f
movq (%r12), %rax
testq %rax, %rax
movq 0x20(%rsp), %r13
jne 0x1388df
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq