// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Overlaps.cpp
// Function: asg_cut_internal(asg_t*, int)
int asg_cut_internal(asg_t *g, int max_ext)
{
	asg64_v a = {0,0,0};
	uint32_t n_vtx = g->n_seq * 2, v, i, cnt = 0;
	for (v = 0; v < n_vtx; ++v) {
		if (g->seq[v>>1].del) continue;
		if (asg_is_utg_end(g, v, 0) != ASG_ET_MULTI_NEI) continue;
		if (asg_extend(g, v, max_ext, &a) != ASG_ET_MULTI_NEI) continue;
		/**
		 * so combining the last two lines, they are designed to reomve(n(1), n(2))?
							   ----->              <-------
							  |                		      |
							 n(0)--->n(1)---->n(2)---->n(3)
							  |                           |
							   ------>             <-------       
		**/
		for (i = 0; i < a.n; ++i)
			asg_seq_del(g, (uint32_t)a.a[i]>>1);
		++cnt;
	}
	free(a.a);
	if (cnt > 0) asg_cleanup(g);
	fprintf(stderr, "[M::%s] cut %d internal sequences\n", __func__, cnt);
	return cnt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
xorps %xmm0, %xmm0
andq $0x0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl 0x14(%rdi), %r13d
xorl %ebx, %ebx
addl %r13d, %r13d
je 0x7adf
movl %esi, %ebp
xorl %ebx, %ebx
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %r12d, %r12d
movl %esi, 0xc(%rsp)
movl %r13d, 0x8(%rsp)
movq 0x20(%r14), %rax
movl %r12d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x7ad3
movq 0x8(%r14), %rax
movq 0x28(%r14), %rcx
movl %r12d, %edx
xorl $0x1, %edx
movq (%rcx,%rdx,8), %rdi
movq %rdi, %rdx
shrq $0x20, %rdx
imulq $0x18, %rdx, %rdx
xorl %esi, %esi
testl %edi, %edi
jle 0x7970
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
leaq (%rax,%rdx), %r8
addq $0xc, %r8
xorl %r9d, %r9d
pushq $-0x1
popq %r10
xorl %r11d, %r11d
cmpl $0x0, (%r8)
setns %r11b
cmovnsl %r9d, %r10d
addl %r11d, %esi
incq %r9
addq $0x18, %r8
cmpq %r9, %rdi
jne 0x7946
movslq %r10d, %rdi
cmpl $0x1, %esi
sete %sil
jmp 0x7973
pushq $-0x1
popq %rdi
testb %sil, %sil
je 0x7ad3
addq %rax, %rdx
imulq $0x18, %rdi, %rsi
movl 0x8(%rdx,%rsi), %edx
xorq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
testl %ecx, %ecx
jle 0x79c8
movq %rcx, %rdx
shrq $0x20, %rdx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
imulq $0x18, %rdx, %rdx
addq %rax, %rdx
addq $0xc, %rdx
xorl %eax, %eax
movl (%rdx), %esi
notl %esi
shrl $0x1f, %esi
addl %esi, %eax
addq $0x18, %rdx
decq %rcx
jne 0x79ad
cmpl $0x1, %eax
je 0x7ad3
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
leaq 0x10(%rsp), %rcx
callq 0xa2ed8
cmpl $0x3, %eax
jne 0x7ad3
movq %rbx, 0x28(%rsp)
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x7ac3
movq 0x20(%rsp), %rcx
movq %rcx, 0x30(%rsp)
xorl %edx, %edx
movq 0x30(%rsp), %rcx
movq (%rcx,%rdx,8), %rsi
movl %esi, %edi
shrl %edi
movq 0x20(%r14), %r8
orl $0x80000000, (%r8,%rdi,8) # imm = 0x80000000
andl $-0x2, %esi
xorl %edi, %edi
leaq (%rdi,%rsi), %r8
movq 0x28(%r14), %r9
movq (%r9,%r8,8), %r10
movq %r10, %r9
andq %r15, %r9
je 0x7aa5
shrq $0x20, %r10
imulq $0x18, %r10, %r10
addq 0x8(%r14), %r10
xorl %r11d, %r11d
imulq $0x18, %r11, %rbx
orb $-0x80, 0xf(%r10,%rbx)
movl 0x8(%r10,%rbx), %ebx
xorq $0x1, %rbx
movq 0x28(%r14), %r13
movq (%r13,%rbx,8), %r13
movq %r13, %rbx
andq %r15, %rbx
je 0x7a9d
movq 0x8(%r14), %rbp
shrq $0x20, %r13
imulq $0x18, %rbx, %rbx
imulq $0x18, %r13, %r13
addq %r13, %rbp
addq $0xc, %rbp
xorl %r13d, %r13d
movl -0x4(%rbp,%r13), %ecx
xorl %r8d, %ecx
cmpl $0x1, %ecx
jne 0x7a94
orb $-0x80, 0x3(%rbp,%r13)
addq $0x18, %r13
cmpq %r13, %rbx
jne 0x7a81
incq %r11
cmpq %r9, %r11
jne 0x7a43
leaq 0x1(%rdi), %rcx
testq %rdi, %rdi
movq %rcx, %rdi
je 0x7a20
incq %rdx
movl %edx, %ecx
cmpq %rcx, %rax
ja 0x7a02
movq 0x28(%rsp), %rbx
incl %ebx
movl 0xc(%rsp), %ebp
movl 0x8(%rsp), %r13d
incl %r12d
cmpl %r13d, %r12d
jne 0x78fb
movq 0x20(%rsp), %rdi
callq 0x2220
testl %ebx, %ebx
je 0x7af5
movq %r14, %rdi
callq 0xa02fa
movq 0x2824e4(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x22292d(%rip), %rsi    # 0x22a433
leaq 0x222949(%rip), %rdx    # 0x22a456
movl %ebx, %ecx
xorl %eax, %eax
callq 0x22b0
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq