// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x8(%rsp), %r13
andq $0x0, (%r13)
leaq 0x58(%rsp), %r12
movq %r12, %rdi
callq 0xa778
movl %r14d, %eax
movq %r13, %rdi
movq %rax, %rdx
movq %r12, %rsi
movq %rax, 0x18(%rsp)
callq 0xb224
movl %ebp, %ebp
addq $0x9e8, %r15            # imm = 0x9E8
movq %r15, 0x10(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movq %rbx, 0x28(%rsp)
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa778
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0xb224
movq %r12, %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
callq 0xb224
movq 0x8(%rsp), %rsi
cmpq 0x58(%rsp), %rsi
je 0xe1a2
movq %r12, %rdi
callq 0xa3fa
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x13024
movq (%rax), %r14
movq %r12, %rdi
callq 0x66d0
movq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0xa3fa
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x13024
movq 0x18(%rsp), %r13
movq 0x8(%rax), %r15
movq %r12, %rdi
callq 0x66d0
cmpq %r15, %r14
je 0xe18e
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xa778
movq %rbp, %rbx
movq %r12, %rbp
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xb224
leaq 0xc0(%rsp), %r13
movq %r13, %rdi
movq 0x28(%rsp), %rsi
callq 0xa778
leaq 0x48(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0xb224
leaq 0xc8(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
callq 0xb224
movq %r14, 0x20(%rsp)
movq (%r14), %rcx
movq %rbp, %rdi
movq %rbx, %rbp
movq 0x28(%rsp), %rbx
movq %r12, %rsi
movq %r13, %rdx
callq 0x1308a
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa778
leaq 0xb8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0xb224
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xb224
movq 0x58(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0xe165
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa778
leaq 0xa8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rdx
callq 0xb224
leaq 0x88(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa778
leaq 0x90(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0xb224
leaq 0x98(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
callq 0xb224
movq 0x20(%rsp), %r13
movq 0x8(%r13), %rcx
leaq 0x38(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1308a
leaq 0x78(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa778
leaq 0x80(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0xb224
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xb224
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
movq %r13, %r14
je 0xe16a
movq %r14, %rdi
callq 0xc992
mulsd 0x11ec5(%rip), %xmm0    # 0x20028
jmp 0xe172
movq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0xc992
leaq 0x58(%rsp), %r12
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
addq $0x38, %r14
jmp 0xdf7e
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0xb1ee
jmp 0xdf1d
movsd (%rsp), %xmm0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xe1bb
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x66d0
movq %rbx, %rdi
callq 0x65d0