// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/./Overlaps.h
// Function: check_tip(asg_t*, unsigned int, unsigned int*, buf_t*, unsigned int)
inline uint32_t check_tip(asg_t *sg, uint32_t begNode, uint32_t* endNode, buf_t* b, uint32_t max_ext)
{
    ///cut tip of length <= max_ext
    uint32_t v = begNode, w;
    uint32_t kv;
    uint32_t eLen = 0;
    (*endNode) = (uint32_t)-1;
    b->b.n = 0;
    while (1)
    {
        kv = get_real_length(sg, v, NULL);
        (*endNode) = v;
        eLen++;
        if(b) kv_push(uint32_t, b->b, v);
        if(kv == 0) return END_TIPS;
        if(kv > 1) return MUL_OUTPUT;
        ///if(eLen > max_ext) return LONG_TIPS;
        ///kv must be 1 here
        kv = get_real_length(sg, v, &w);
        ///here this value must be >= 1
        if(get_real_length(sg, w^1, NULL)!=1) return MUL_INPUT;
        v = w;
        if(v == begNode) return LOOP;
        if(eLen >= max_ext) return LONG_TIPS;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movl %esi, %r11d
movq %rdi, %r12
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
movq $0x0, 0x38(%rcx)
cmpl $0x1, %r8d
adcl $0x0, %r8d
xorl %r13d, %r13d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl %esi, %r15d
movl %esi, 0x4(%rsp)
movq %rdi, 0x8(%rsp)
movq 0x28(%r12), %rax
movl %r15d, %ebx
movq (%rax,%rbx,8), %rax
movq %rax, %rcx
movl $0x0, %ebp
andq %r9, %rcx
je 0x101480
movq 0x8(%r12), %rsi
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
leaq (%rsi,%rax,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edi, %edi
xorl %ebp, %ebp
movl (%rax,%rdi), %esi
notl %esi
shrl $0x1f, %esi
addl %esi, %ebp
addq $0x18, %rdi
cmpq %rdi, %rcx
jne 0x10146d
movl %r15d, (%rdx)
testq %r14, %r14
je 0x1014f1
movq 0x40(%r14), %rax
cmpq %rax, 0x38(%r14)
jne 0x1014dd
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x40(%r14)
movq 0x48(%r14), %rdi
shlq $0x2, %rsi
movq %r13, 0x10(%rsp)
movl %r8d, %r13d
movq %rdx, %r12
callq 0x2370
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl 0x4(%rsp), %r11d
movq %r12, %rdx
movq 0x8(%rsp), %r12
movl %r13d, %r8d
movq 0x10(%rsp), %r13
movq %rax, 0x48(%r14)
movq 0x38(%r14), %rax
movq 0x48(%r14), %rcx
leaq 0x1(%rax), %rsi
movq %rsi, 0x38(%r14)
movl %r15d, (%rcx,%rax,4)
cmpl $0x1, %ebp
jne 0x1015ad
movq 0x28(%r12), %rax
movq (%rax,%rbx,8), %rdi
movq %rdi, %rcx
andq %r9, %rcx
je 0x10153e
movq 0x8(%r12), %rsi
shrq $0x20, %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdi,%rdi,2), %rdi
leaq (%rsi,%rdi,8), %rdi
addq $0xc, %rdi
xorl %esi, %esi
cmpl $0x0, (%rdi,%rsi)
js 0x101535
movl -0x4(%rdi,%rsi), %r15d
addq $0x18, %rsi
cmpq %rsi, %rcx
jne 0x10152a
movl %r15d, %ecx
xorl $0x1, %ecx
movq (%rax,%rcx,8), %rcx
movq %rcx, %rdi
movl $0x3, %eax
andq %r9, %rdi
je 0x1015c2
incl %r13d
movq 0x8(%r12), %rsi
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rsi,%rcx,8), %rcx
addq $0xc, %rcx
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %r10
xorl %esi, %esi
xorl %edi, %edi
movl (%rcx,%rsi), %r9d
notl %r9d
shrl $0x1f, %r9d
addl %r9d, %edi
addq $0x18, %rsi
cmpq %rsi, %r10
jne 0x101579
cmpl $0x1, %edi
jne 0x1015c2
cmpl %r11d, %r15d
je 0x1015bd
cmpl %r8d, %r13d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
jne 0x101433
xorl %eax, %eax
jmp 0x1015c2
movl $0x4, %eax
testl %ebp, %ebp
jne 0x1015c2
movl $0x5, %eax
jmp 0x1015c2
movl $0x7, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq