// File: /workspace/github_cpp_makefile_star2_O3/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
movl %esi, %ebp
movq %rdi, %r12
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
movq $0x0, 0x38(%rcx)
cmpl $0x1, %r8d
adcl $0x0, %r8d
movq 0x28(%rdi), %r13
xorl %r14d, %r14d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl %esi, %r15d
xorl %ebx, %ebx
movq %rcx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movl %ebx, 0x4(%rsp)
movl %r15d, %ebx
movq (%r13,%rbx,8), %rax
movq %rax, %rdi
movl $0x0, %r13d
andq %r10, %rdi
je 0x1057b8
movq 0x8(%r12), %rsi
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
leaq (%rsi,%rax,8), %rax
addq $0xc, %rax
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %r9
xorl %esi, %esi
xorl %r13d, %r13d
movl (%rax,%rsi), %edi
notl %edi
shrl $0x1f, %edi
addl %edi, %r13d
addq $0x18, %rsi
cmpq %rsi, %r9
jne 0x1057a4
movl %r15d, (%rdx)
testq %rcx, %rcx
je 0x105823
movq 0x48(%rcx), %rax
cmpq 0x40(%rcx), %r14
jne 0x105814
leaq (%r14,%r14), %rsi
testq %r14, %r14
movl $0x2, %edi
cmoveq %rdi, %rsi
movq %rsi, 0x40(%rcx)
shlq $0x2, %rsi
movq %rax, %rdi
movq %rdx, %r12
movl %ebp, %r14d
movl %r8d, %ebp
callq 0x2370
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl %ebp, %r8d
movl %r14d, %ebp
movq 0x10(%rsp), %rcx
movq %r12, %rdx
movq 0x8(%rsp), %r12
movq %rax, 0x48(%rcx)
movq 0x38(%rcx), %r14
leaq 0x1(%r14), %rsi
movq %rsi, 0x38(%rcx)
movl %r15d, (%rax,%r14,4)
movq %rsi, %r14
cmpl $0x1, %r13d
jne 0x1058ee
movq 0x28(%r12), %r13
movq (%r13,%rbx,8), %rsi
movq %rsi, %rax
andq %r10, %rax
je 0x105878
movq 0x8(%r12), %rdi
shrq $0x20, %rsi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
leaq (%rsi,%rsi,2), %rsi
leaq (%rdi,%rsi,8), %rsi
addq $0xc, %rsi
xorl %edi, %edi
movl 0x4(%rsp), %ebx
cmpl $0x0, (%rsi,%rdi)
js 0x10586d
movl -0x4(%rsi,%rdi), %r15d
addq $0x18, %rdi
cmpq %rdi, %rax
jne 0x105862
jmp 0x10587c
movl 0x4(%rsp), %ebx
movl %r15d, %eax
xorl $0x1, %eax
movq (%r13,%rax,8), %rsi
movq %rsi, %rdi
movl $0x3, %eax
andq %r10, %rdi
je 0x105904
incl %ebx
movq 0x8(%r12), %r9
shrq $0x20, %rsi
leaq (%rsi,%rsi,2), %rsi
leaq (%r9,%rsi,8), %rsi
addq $0xc, %rsi
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %rdi
xorl %r11d, %r11d
xorl %r9d, %r9d
movl (%rsi,%r11), %r10d
notl %r10d
shrl $0x1f, %r10d
addl %r10d, %r9d
addq $0x18, %r11
cmpq %r11, %rdi
jne 0x1058b9
cmpl $0x1, %r9d
jne 0x105904
cmpl %ebp, %r15d
je 0x1058ff
cmpl %r8d, %ebx
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
jne 0x105768
xorl %eax, %eax
jmp 0x105904
movl $0x5, %eax
testl %r13d, %r13d
je 0x105904
movl $0x4, %eax
jmp 0x105904
movl $0x7, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq