// File: CK7[P]abawaca/src/ClusterSeparatorSplitScafs.cpp
// Function: ClusterSeparatorSplitScafs::ClusterStats::operator-=(unsigned long)
const ClusterSeparatorSplitScafs::ClusterStats& ClusterSeparatorSplitScafs::ClusterStats::operator -= (size_t dp)
{
	auto	mit = cluster.scafs_find(this->scaf_db.dp2scaf(dp));
	size_t	ndps_in_cluster = (mit != cluster.scafs_end())? mit->second : 0;
	size_t	ndps_in_scaf = scaf_db.ndps(this->scaf_db.dp2scaf(dp));

	if(ndps_in_scaf > 1) {
		this->cluster_useful_ndps--;
		// Is this scaf part of the cluster after the addition of the dp?
		if(is_scaf_part_of(ndps_in_cluster, ndps_in_scaf)) {
			// Is this scaf part of the cluster before the addition of the dp?
			if(!is_scaf_part_of(ndps_in_cluster-1, ndps_in_scaf)) {
				ndps_in_scafs_that_belong -= ndps_in_cluster;
				scafs_in--;
			}
			else
				ndps_in_scafs_that_belong--;
		}
	}
	cluster -= dp;

	if(ndps_in_scafs_that_belong < 0 || ndps_in_scafs_that_belong > cluster.ndps()) {
		cerr << "Fatal error (2): illegal number of dps in scafs that belong: " << ndps_in_scafs_that_belong << endl;
		throw exception();
	}

	return *this;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x40(%rbp)
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x13a40
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x28380
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, -0x18(%rbp)
movq 0x8(%rax), %rdi
callq 0x26800
movq %rax, -0x28(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x218d0
testb $0x1, %al
jne 0x2aaf3
jmp 0x2ab06
leaq -0x18(%rbp), %rdi
callq 0x1d0c0
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x2ab0e
xorl %eax, %eax
movq %rax, -0x48(%rbp)
jmp 0x2ab0e
movq -0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, -0x20(%rbp)
movq (%rax), %rcx
movq %rcx, -0x50(%rbp)
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x13a40
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0x13b50
movq %rax, -0x30(%rbp)
cmpq $0x1, -0x30(%rbp)
jbe 0x2abb3
movq -0x38(%rbp), %rax
movl 0x10(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x10(%rax)
movq 0x20(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x2b7d0
testb $0x1, %al
jne 0x2ab68
jmp 0x2abb1
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x20(%rbp), %rsi
subq $0x1, %rsi
movq -0x30(%rbp), %rdx
callq 0x2b7d0
testb $0x1, %al
jne 0x2aba2
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rdx
movslq 0x14(%rax), %rcx
subq %rdx, %rcx
movl %ecx, 0x14(%rax)
movl 0x18(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x18(%rax)
jmp 0x2abaf
movq -0x38(%rbp), %rax
movl 0x14(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x14(%rax)
jmp 0x2abb1
jmp 0x2abb3
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rsi
movq 0x8(%rax), %rdi
callq 0x249b0
movq -0x38(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jl 0x2abef
movq -0x38(%rbp), %rax
movslq 0x14(%rax), %rcx
movq %rcx, -0x58(%rbp)
movq 0x8(%rax), %rdi
callq 0xa030
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jbe 0x2ac4d
movq 0x223f2(%rip), %rdi     # 0x4cfe8
leaq 0xb769(%rip), %rsi      # 0x36366
callq 0x53f0
movq %rax, %rdi
movq -0x38(%rbp), %rax
movl 0x14(%rax), %esi
callq 0x5710
movq %rax, %rdi
movq 0x22375(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0x8, %edi
callq 0x51e0
movq %rax, %rdi
movq %rdi, -0x60(%rbp)
callq 0xeee0
movq -0x60(%rbp), %rdi
movq 0x2238f(%rip), %rsi     # 0x4cfd0
movq 0x223a8(%rip), %rdx     # 0x4cff0
callq 0x5700
movq -0x38(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)