// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movl %esi, %ebp
andq $0x0, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movl 0x14(%rdi), %esi
addl %esi, %esi
je 0x1b7d
movq %rdi, %r14
xorl %r13d, %r13d
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
pushq $0x1
popq %rbx
xorl %r12d, %r12d
movl %ebp, 0xc(%rsp)
movl %esi, 0x8(%rsp)
movq 0x18(%r14), %rax
movl %r12d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,4)
js 0x1b62
movq 0x20(%r14), %rcx
movl %r12d, %eax
xorl $0x1, %eax
movq (%rcx,%rax,8), %rdi
movq %rdi, %rdx
andq %r15, %rdx
je 0x1b62
movq 0x8(%r14), %rax
shrq $0x20, %rdi
shlq $0x4, %rdi
leaq (%rax,%rdi), %rsi
addq %rax, %rdi
addq $0xc, %rdi
xorl %r8d, %r8d
xorl %r10d, %r10d
pushq $-0x1
popq %r9
xorl %r11d, %r11d
cmpl $0x0, (%rdi)
setns %r11b
cmovnsl %r8d, %r9d
addl %r11d, %r10d
incq %r8
addq $0x10, %rdi
cmpq %r8, %rdx
jne 0x19d5
cmpl $0x1, %r10d
jne 0x1b5e
movslq %r9d, %rdx
shlq $0x4, %rdx
movl 0x8(%rsi,%rdx), %edx
xorq $0x1, %rdx
movq (%rcx,%rdx,8), %rdx
movq %rdx, %rcx
andq %r15, %rcx
je 0x1a4a
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 0x1a2e
cmpl $0x1, %esi
je 0x1b5e
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
leaq 0x10(%rsp), %rcx
callq 0x4116
cmpl $0x3, %eax
jne 0x1b5e
movq %r13, 0x30(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x1b52
movq 0x20(%rsp), %rax
movq %rax, 0x38(%rsp)
xorl %edx, %edx
movq 0x38(%rsp), %rax
movq (%rax,%rdx,8), %rsi
movl %esi, %ecx
shrl %ecx
movq 0x18(%r14), %rdi
orl $0x80000000, (%rdi,%rcx,4) # imm = 0x80000000
andl $-0x2, %esi
movb $0x1, %dil
xorl %r8d, %r8d
orq %rsi, %r8
movq 0x20(%r14), %rcx
movq (%rcx,%r8,8), %r9
movq %r9, %r10
andq %r15, %r10
je 0x1b30
shrq $0x1c, %r9
andq $-0x10, %r9
addq 0x8(%r14), %r9
xorl %r11d, %r11d
movq %r11, %rcx
shlq $0x4, %rcx
orb $-0x80, 0xf(%r9,%rcx)
movl 0x8(%r9,%rcx), %ecx
xorq $0x1, %rcx
movq 0x20(%r14), %r13
movq (%r13,%rcx,8), %rcx
movq %rcx, %rbp
andq %r15, %rbp
je 0x1b28
movq 0x8(%r14), %r13
shrq $0x20, %rcx
shlq $0x4, %rbp
shlq $0x4, %rcx
addq %rcx, %r13
addq $0xc, %r13
xorl %ecx, %ecx
movl -0x4(%r13,%rcx), %eax
xorl %r8d, %eax
cmpl $0x1, %eax
jne 0x1b1f
orb $-0x80, 0x3(%r13,%rcx)
addq $0x10, %rcx
cmpq %rcx, %rbp
jne 0x1b0c
incq %r11
cmpq %r10, %r11
jne 0x1acc
movq %rbx, %r8
testb $0x1, %dil
movl $0x0, %edi
jne 0x1aaa
incq %rdx
movl %edx, %eax
cmpq %rax, 0x40(%rsp)
ja 0x1a89
movq 0x30(%rsp), %r13
incl %r13d
movl 0xc(%rsp), %ebp
movl 0x8(%rsp), %esi
incl %r12d
cmpl %esi, %r12d
jne 0x1987
movq 0x20(%rsp), %rdi
callq 0x1040
testl %r13d, %r13d
jne 0x1b82
xorl %r13d, %r13d
jmp 0x1b8a
movq %r14, %rdi
callq 0x40c7
movq 0xc467(%rip), %rax      # 0xdff8
movq (%rax), %rdi
leaq 0x85c2(%rip), %rsi      # 0xa15d
leaq 0x85de(%rip), %rdx      # 0xa180
movl %r13d, %ecx
xorl %eax, %eax
callq 0x1120
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq