// File: /workspace/github_cpp_makefile_star2_O1/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 $0x98, %rsp
movl %ecx, %ebx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, 0x38(%rsp)
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0xb208
movq (%r15), %r13
testq %r13, %r13
setne %al
movl %ebp, 0xc(%rsp)
testl %ebp, %ebp
sete %cl
orb %al, %cl
je 0xfb89
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xb208
movq (%r15), %rax
testq %rax, %rax
sete %cl
testl %ebx, %ebx
setne %dl
testb %cl, %dl
jne 0xfb89
movl 0xc(%rsp), %ecx
movl %ebx, %edx
leaq (%rcx,%rcx,2), %rcx
shlq $0x5, %rcx
movq %rcx, 0x50(%rsp)
addq %rcx, %r13
addq $0x9e8, 0x38(%rsp)      # imm = 0x9E8
xorpd %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
leaq (%rdx,%rdx,2), %rcx
shlq $0x5, %rcx
movq %rcx, 0x10(%rsp)
testq %rax, %rax
je 0xfb89
movq 0x10(%rsp), %rcx
addq %rcx, %rax
addq $0x60, %rax
cmpq %rax, %r13
je 0xfba8
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0xae24
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x16bf2
movq (%rax), %r15
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xfb18
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6310
jmp 0xfb18
movq %r13, %rbp
cmpl $0x0, 0xc(%rsp)
sete %r13b
leaq 0x88(%rsp), %rdi
movq %r14, %rsi
callq 0xb208
movq 0x88(%rsp), %r12
testq %r12, %r12
setne %al
orb %r13b, %al
je 0xfb89
testl %ebx, %ebx
sete %r13b
leaq 0x80(%rsp), %rdi
movq %r14, %rsi
callq 0xb208
movq 0x80(%rsp), %rax
testq %rax, %rax
setne %cl
orb %r13b, %cl
je 0xfb89
testq %rax, %rax
je 0xfb89
addq 0x50(%rsp), %r12
testl %ebx, %ebx
sete %r13b
movq 0x10(%rsp), %rcx
addq %rcx, %rax
addq $0x60, %rax
movq (%r15), %rcx
movq %r12, 0x18(%rsp)
movq %rax, 0x48(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x18698
leaq 0x78(%rsp), %rdi
movq %r14, %rsi
callq 0xb208
movq 0x78(%rsp), %rax
testq %rax, %rax
setne %cl
orb %r13b, %cl
je 0xfb89
testq %rax, %rax
je 0xfb89
movq 0x10(%rsp), %rcx
addq %rcx, %rax
addq $0x60, %rax
cmpq %rax, 0x90(%rsp)
je 0xfaf9
cmpl $0x0, 0xc(%rsp)
sete %r13b
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0xb208
movq 0x68(%rsp), %r12
testq %r12, %r12
setne %al
orb %r13b, %al
je 0xfb89
testl %ebx, %ebx
sete %r13b
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0xb208
movq 0x60(%rsp), %rax
testq %rax, %rax
setne %cl
orb %r13b, %cl
je 0xfb89
testq %rax, %rax
je 0xfb89
addq 0x50(%rsp), %r12
testl %ebx, %ebx
sete %r13b
movq 0x10(%rsp), %rcx
addq %rcx, %rax
addq $0x60, %rax
movq 0x8(%r15), %rcx
movq %r12, 0x18(%rsp)
movq %rax, 0x48(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x18698
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0xb208
movq 0x58(%rsp), %rax
testq %rax, %rax
setne %cl
orb %r13b, %cl
je 0xfb89
testq %rax, %rax
je 0xfb89
movq 0x10(%rsp), %rcx
addq %rcx, %rax
addq $0x60, %rax
cmpq %rax, 0x70(%rsp)
je 0xfaf9
movq %r15, %rdi
callq 0xdf26
mulsd 0x19531(%rip), %xmm0    # 0x29028
jmp 0xfb01
movq %r15, %rdi
callq 0xdf26
movq %rbp, %r13
movsd 0x40(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
addq $0x38, %r15
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0xae24
movq 0x38(%rsp), %rdi
movq %r12, %rsi
callq 0x16bf2
movq 0x8(%rax), %r12
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xfb55
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6310
cmpq %r12, %r15
jne 0xf92f
testl %ebx, %ebx
sete %r15b
addq $0x60, %r13
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0xb208
movq 0x18(%rsp), %rax
testq %rax, %rax
setne %cl
orb %r15b, %cl
jne 0xf8cc
leaq 0x1a546(%rip), %rdi     # 0x2a0d6
leaq 0x19c74(%rip), %rsi     # 0x2980b
leaq 0x1a548(%rip), %rcx     # 0x2a0e6
movl $0xab, %edx
callq 0x6210
movsd 0x40(%rsp), %xmm0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xfbc2
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xfbe1
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6310
movq %rbx, %rdi
callq 0x65b0
nop