// File: /workspace/github_cpp_makefile_star2_O3/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)
movq %rdx, 0x20(%rsp)
je 0x13e501
movq 0x10(%r12), %rax
movl %r14d, (%rax)
movl $0x1, %ecx
jmp 0x13e536
movq $0x2, 0x8(%r12)
movq 0x10(%r12), %rdi
movl $0x8, %esi
callq 0x2370
movq %rax, 0x10(%r12)
movq (%r12), %rdx
movq %rdx, %rcx
incq %rcx
movq %rcx, (%r12)
movl %r14d, (%rax,%rdx,4)
je 0x13e676
movl %r14d, 0x18(%rsp)
movq 0x8(%rsp), %rax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, 0x1c(%rsp)
leaq -0x1(%rcx), %rax
movq %rax, (%r12)
movq 0x10(%r12), %rax
movl -0x4(%rax,%rcx,4), %r14d
movl %r14d, %r15d
shrl %r15d
cmpl %r15d, 0x1c(%rsp)
je 0x13e5aa
movq (%r13), %rcx
movq 0x10(%r13), %rax
cmpq 0x8(%r13), %rcx
jne 0x13e59e
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r13)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r13)
movq (%r13), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r13)
movl %r15d, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax,%r14,8), %rax
testl %eax, %eax
je 0x13e65a
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 0x13e651
movl (%r13,%r15), %ecx
movl %ecx, %eax
shrl %eax
cmpl %ebp, %eax
sete %dl
cmpl %ebx, %eax
sete %al
orb %dl, %al
jne 0x13e651
movq (%r12), %rdx
movq 0x10(%r12), %rax
cmpq 0x8(%r12), %rdx
jne 0x13e646
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r12)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r12)
movl (%r13,%r15), %ecx
movq (%r12), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, (%r12)
movl %ecx, (%rax,%rdx,4)
addq $0x18, %r15
cmpq %r15, %r14
jne 0x13e5e8
movq (%r12), %rcx
testq %rcx, %rcx
movq 0x20(%rsp), %r13
jne 0x13e549
movq 0x10(%r12), %rax
movl 0x18(%rsp), %r14d
orl $0x1, %r14d
cmpq $0x0, 0x8(%r12)
je 0x13e68c
movl %r14d, (%rax)
movl $0x1, %ecx
jmp 0x13e6bf
movq $0x2, 0x8(%r12)
movl $0x8, %esi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r12)
movq (%r12), %rdx
movq %rdx, %rcx
incq %rcx
movq %rcx, (%r12)
movl %r14d, (%rax,%rdx,4)
je 0x13e7f1
movq 0x8(%rsp), %rax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0x8(%rsp)
leaq -0x1(%rcx), %rax
movq %rax, (%r12)
movq 0x10(%r12), %rax
movl -0x4(%rax,%rcx,4), %r14d
movl %r14d, %r15d
shrl %r15d
cmpl %r15d, 0x8(%rsp)
je 0x13e72f
movq (%r13), %rcx
movq 0x10(%r13), %rax
cmpq 0x8(%r13), %rcx
jne 0x13e723
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r13)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r13)
movq (%r13), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r13)
movl %r15d, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax,%r14,8), %rax
testl %eax, %eax
je 0x13e7df
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 0x13e7d6
movl (%r13,%r15), %ecx
movl %ecx, %eax
shrl %eax
cmpl %ebp, %eax
sete %dl
cmpl %ebx, %eax
sete %al
orb %dl, %al
jne 0x13e7d6
movq (%r12), %rdx
movq 0x10(%r12), %rax
cmpq 0x8(%r12), %rdx
jne 0x13e7cb
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r12)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r12)
movl (%r13,%r15), %ecx
movq (%r12), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, (%r12)
movl %ecx, (%rax,%rdx,4)
addq $0x18, %r15
cmpq %r15, %r14
jne 0x13e76d
movq (%r12), %rcx
testq %rcx, %rcx
movq 0x20(%rsp), %r13
jne 0x13e6ce
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq