// 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+1, ndps_in_scaf)) {
			// Is this scaf part of the cluster before the addition of the dp?
			if(!is_scaf_part_of(ndps_in_cluster, ndps_in_scaf)) {
				ndps_in_scafs_that_belong += ndps_in_cluster;
				scafs_in++;
			}
			ndps_in_scafs_that_belong++;
		}
	}

	cluster += dp;

	if(ndps_in_scafs_that_belong < 0 || ndps_in_scafs_that_belong > cluster.ndps()) {
		cerr << "Fatal error (1): 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 0x2a923
jmp 0x2a936
leaq -0x18(%rbp), %rdi
callq 0x1d0c0
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x2a93e
xorl %eax, %eax
movq %rax, -0x48(%rbp)
jmp 0x2a93e
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 0x2a9df
movq -0x38(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq 0x20(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x1, %rsi
movq -0x30(%rbp), %rdx
callq 0x2b7d0
testb $0x1, %al
jne 0x2a99c
jmp 0x2a9dd
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x2b7d0
testb $0x1, %al
jne 0x2a9d0
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rdx
movslq 0x14(%rax), %rcx
addq %rdx, %rcx
movl %ecx, 0x14(%rax)
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0x38(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
jmp 0x2a9df
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rsi
movq 0x8(%rax), %rdi
callq 0x24800
movq -0x38(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jl 0x2aa1b
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 0x2aa79
movq 0x225c6(%rip), %rdi     # 0x4cfe8
leaq 0xb8ff(%rip), %rsi      # 0x36328
callq 0x53f0
movq %rax, %rdi
movq -0x38(%rbp), %rax
movl 0x14(%rax), %esi
callq 0x5710
movq %rax, %rdi
movq 0x22549(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0x8, %edi
callq 0x51e0
movq %rax, %rdi
movq %rdi, -0x60(%rbp)
callq 0xeee0
movq -0x60(%rbp), %rdi
movq 0x22563(%rip), %rsi     # 0x4cfd0
movq 0x2257c(%rip), %rdx     # 0x4cff0
callq 0x5700
movq -0x38(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)