// File: /workspace/github_c_makefile_star2_O1/rikuu[P]kermit/miniasm/asg.c
// Function: asg_cut_internal
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;
		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 0x1b15
movl %esi, %ebp
xorl %ebx, %ebx
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %r12d, %r12d
movl %esi, 0xc(%rsp)
movl %r13d, 0x8(%rsp)
movq 0x18(%r14), %rax
movl %r12d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,4)
js 0x1b09
movq 0x8(%r14), %rax
movq 0x20(%r14), %rcx
movl %r12d, %edx
xorl $0x1, %edx
movq (%rcx,%rdx,8), %rdi
movq %rdi, %rdx
shrq $0x20, %rdx
shlq $0x4, %rdx
xorl %esi, %esi
andq %r15, %rdi
je 0x19a1
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 $0x10, %r8
cmpq %r9, %rdi
jne 0x1977
movslq %r10d, %rdi
cmpl $0x1, %esi
sete %sil
jmp 0x19a4
pushq $-0x1
popq %rdi
testb %sil, %sil
je 0x1b09
addq %rax, %rdx
shlq $0x4, %rdi
movl 0x8(%rdx,%rdi), %edx
xorq $0x1, %rdx
movq (%rcx,%rdx,8), %rdx
movq %rdx, %rcx
andq %r15, %rcx
je 0x19fb
shrq $0x20, %rdx
shlq $0x4, %rcx
shlq $0x4, %rdx
addq %rdx, %rax
addq $0xc, %rax
xorl %edx, %edx
xorl %esi, %esi
movl (%rax,%rdx), %edi
notl %edi
shrl $0x1f, %edi
addl %edi, %esi
addq $0x10, %rdx
cmpq %rdx, %rcx
jne 0x19df
cmpl $0x1, %esi
je 0x1b09
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
leaq 0x10(%rsp), %rcx
callq 0x4218
cmpl $0x3, %eax
jne 0x1b09
movq %rbx, 0x28(%rsp)
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x1af9
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 0x18(%r14), %r8
orl $0x80000000, (%r8,%rdi,4) # imm = 0x80000000
andl $-0x2, %esi
xorl %edi, %edi
leaq (%rdi,%rsi), %r8
movq 0x20(%r14), %r9
movq (%r9,%r8,8), %r9
movq %r9, %r10
andq %r15, %r10
je 0x1adb
shrq $0x1c, %r9
andq $-0x10, %r9
addq 0x8(%r14), %r9
xorl %r11d, %r11d
movq %r11, %rbx
shlq $0x4, %rbx
orb $-0x80, 0xf(%r9,%rbx)
movl 0x8(%r9,%rbx), %ebx
xorq $0x1, %rbx
movq 0x20(%r14), %r13
movq (%r13,%rbx,8), %r13
movq %r13, %rbx
andq %r15, %rbx
je 0x1ad3
movq 0x8(%r14), %rbp
shrq $0x20, %r13
shlq $0x4, %rbx
shlq $0x4, %r13
addq %r13, %rbp
addq $0xc, %rbp
xorl %r13d, %r13d
movl -0x4(%rbp,%r13), %ecx
xorl %r8d, %ecx
cmpl $0x1, %ecx
jne 0x1aca
orb $-0x80, 0x3(%rbp,%r13)
addq $0x10, %r13
cmpq %r13, %rbx
jne 0x1ab7
incq %r11
cmpq %r10, %r11
jne 0x1a76
leaq 0x1(%rdi), %rcx
testq %rdi, %rdi
movq %rcx, %rdi
je 0x1a53
incq %rdx
movl %edx, %ecx
cmpq %rcx, %rax
ja 0x1a35
movq 0x28(%rsp), %rbx
incl %ebx
movl 0xc(%rsp), %ebp
movl 0x8(%rsp), %r13d
incl %r12d
cmpl %r13d, %r12d
jne 0x1931
movq 0x20(%rsp), %rdi
callq 0x1040
testl %ebx, %ebx
je 0x1b2b
movq %r14, %rdi
callq 0x41c9
movq 0xd4c6(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x8621(%rip), %rsi      # 0xa15d
leaq 0x863d(%rip), %rdx      # 0xa180
movl %ebx, %ecx
xorl %eax, %eax
callq 0x1120
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq