// File: Chrom3D[P]Chrom3D/src/Model.cpp
// Function: Model::getPartialLossScore(Chromosome&, unsigned int, unsigned int)
double Model::getPartialLossScore(Chromosome &chr, uint startPos, uint endPos) {
  boost::container::static_vector<Bead,MAXSIZE>::iterator it;
  vector<Constraint>::iterator it2;
  double res = 0;
  for(it = chr.begin() + startPos; it != chr.begin() + endPos+1; it++) {
    for(it2 = constraints[it->getID()].begin(); it2 != constraints[it->getID()].end(); it2++) {
      // Within a local evaluation of the loss score, any pair of beads with interactions between them (inside the move), will be counted twice. Therefore, we need to divide (by 2) the loss-score of each constraint belonging to such  pairs. (Note that e.g. Nucleus constraints will never be down-weighted like this, since the centerBead is never inside the local move, and that is the intended behavior, since there is only one of those):
      if ((find(chr.begin()+startPos, chr.begin()+endPos+1, *(it2->bead1)) != chr.begin()+endPos+1) and (find(chr.begin()+startPos, chr.begin()+endPos+1, *(it2->bead2)) != chr.begin()+endPos+1) ) {
	res += it2->eval() / 2;
      }
      else {
	res += it2->eval();
      }
    }
  }
  return res;
}

// Assembly:
subq $0x198, %rsp            # imm = 0x198
movq %rdi, 0x190(%rsp)
movq %rsi, 0x188(%rsp)
movl %edx, 0x184(%rsp)
movl %ecx, 0x180(%rsp)
movq 0x190(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x16890
leaq 0x170(%rsp), %rdi
callq 0x28240
xorps %xmm0, %xmm0
movsd %xmm0, 0x168(%rsp)
movq 0x188(%rsp), %rsi
leaq 0x158(%rsp), %rdi
callq 0x15540
movl 0x184(%rsp), %eax
movl %eax, %edx
leaq 0x160(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x16c10
leaq 0x178(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x16a00
movq 0x188(%rsp), %rsi
leaq 0x140(%rsp), %rdi
callq 0x15540
movl 0x180(%rsp), %eax
movl %eax, %edx
leaq 0x148(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x16c10
leaq 0x150(%rsp), %rdi
leaq 0x148(%rsp), %rsi
movl $0x1, %edx
callq 0x16c10
leaq 0x178(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x16b40
testb $0x1, %al
jne 0x1daeb
jmp 0x1dee5
movq 0x38(%rsp), %rax
addq $0x9e8, %rax            # imm = 0x9E8
movq %rax, 0x20(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x16ca0
movq %rax, %rsi
leaq 0x118(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x14ea0
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x28590
movq %rax, 0x30(%rsp)
jmp 0x1db33
movq 0x30(%rsp), %rdi
callq 0x28300
movq %rax, 0x138(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x170(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x8998
movq 0x38(%rsp), %rax
addq $0x9e8, %rax            # imm = 0x9E8
movq %rax, 0x8(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x16ca0
movq %rax, %rsi
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x14ea0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x28590
movq %rax, 0x18(%rsp)
jmp 0x1dbaa
movq 0x18(%rsp), %rdi
callq 0x28370
movq %rax, 0x100(%rsp)
leaq 0x170(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x28330
movb %al, 0x7(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x8998
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x1dbef
jmp 0x1deca
movq 0x188(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x15540
movl 0x184(%rsp), %eax
movl %eax, %edx
leaq 0xd0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x16c10
movq 0x188(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x15540
movl 0x180(%rsp), %eax
movl %eax, %edx
leaq 0xb8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x16c10
leaq 0xc0(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
movl $0x1, %edx
callq 0x16c10
leaq 0x170(%rsp), %rdi
callq 0x283a0
movq (%rax), %rcx
leaq 0xd8(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x28680
movq 0x188(%rsp), %rsi
leaq 0x98(%rsp), %rdi
callq 0x15540
movl 0x180(%rsp), %eax
movl %eax, %edx
leaq 0xa0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x16c10
leaq 0xa8(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movl $0x1, %edx
callq 0x16c10
leaq 0xd8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x16b40
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x6(%rsp)
jne 0x1dd10
jmp 0x1de00
movq 0x188(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x15540
movl 0x184(%rsp), %eax
movl %eax, %edx
leaq 0x88(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x16c10
movq 0x188(%rsp), %rsi
leaq 0x68(%rsp), %rdi
callq 0x15540
movl 0x180(%rsp), %eax
movl %eax, %edx
leaq 0x70(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x16c10
leaq 0x78(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movl $0x1, %edx
callq 0x16c10
leaq 0x170(%rsp), %rdi
callq 0x283a0
movq 0x8(%rax), %rcx
leaq 0x90(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x28680
movq 0x188(%rsp), %rsi
leaq 0x50(%rsp), %rdi
callq 0x15540
movl 0x180(%rsp), %eax
movl %eax, %edx
leaq 0x58(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x16c10
leaq 0x60(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movl $0x1, %edx
callq 0x16c10
leaq 0x90(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x16b40
movb %al, 0x6(%rsp)
movb 0x6(%rsp), %al
testb $0x1, %al
jne 0x1de0a
jmp 0x1de88
leaq 0x170(%rsp), %rdi
callq 0x283a0
movq %rax, %rdi
callq 0x1ab90
movsd 0x311f9(%rip), %xmm1    # 0x4f020
divsd %xmm1, %xmm0
addsd 0x168(%rsp), %xmm0
movsd %xmm0, 0x168(%rsp)
jmp 0x1deaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x8998
jmp 0x1def6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x8998
jmp 0x1def6
leaq 0x170(%rsp), %rdi
callq 0x283a0
movq %rax, %rdi
callq 0x1ab90
addsd 0x168(%rsp), %xmm0
movsd %xmm0, 0x168(%rsp)
jmp 0x1deb1
leaq 0x170(%rsp), %rdi
xorl %esi, %esi
callq 0x283b0
movq %rax, 0x48(%rsp)
jmp 0x1db62
jmp 0x1decc
leaq 0x40(%rsp), %rdi
leaq 0x178(%rsp), %rsi
xorl %edx, %edx
callq 0x16b60
jmp 0x1da80
movsd 0x168(%rsp), %xmm0
addq $0x198, %rsp            # imm = 0x198
retq
movq 0x110(%rsp), %rdi
callq 0x8870
nopw %cs:(%rax,%rax)