// File: /workspace/github_cpp_makefile_star2_O3/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 0xb164
movq (%r15), %r13
testq %r13, %r13
setne %al
movl %ebp, 0xc(%rsp)
testl %ebp, %ebp
sete %cl
orb %al, %cl
je 0xfb21
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xb164
movq (%r15), %rax
testq %rax, %rax
sete %cl
testl %ebx, %ebx
setne %dl
testb %cl, %dl
jne 0xfb21
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 0xfb21
movq 0x10(%rsp), %rcx
addq %rcx, %rax
addq $0x60, %rax
cmpq %rax, %r13
je 0xfb40
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0xad90
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x16876
movq (%rax), %r15
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xfab0
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6310
jmp 0xfab0
movq %r13, %rbp
cmpl $0x0, 0xc(%rsp)
sete %r13b
leaq 0x88(%rsp), %rdi
movq %r14, %rsi
callq 0xb164
movq 0x88(%rsp), %r12
testq %r12, %r12
setne %al
orb %r13b, %al
je 0xfb21
testl %ebx, %ebx
sete %r13b
leaq 0x80(%rsp), %rdi
movq %r14, %rsi
callq 0xb164
movq 0x80(%rsp), %rax
testq %rax, %rax
setne %cl
orb %r13b, %cl
je 0xfb21
testq %rax, %rax
je 0xfb21
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 0x1834a
leaq 0x78(%rsp), %rdi
movq %r14, %rsi
callq 0xb164
movq 0x78(%rsp), %rax
testq %rax, %rax
setne %cl
orb %r13b, %cl
je 0xfb21
testq %rax, %rax
je 0xfb21
movq 0x10(%rsp), %rcx
addq %rcx, %rax
addq $0x60, %rax
cmpq %rax, 0x90(%rsp)
je 0xfa91
cmpl $0x0, 0xc(%rsp)
sete %r13b
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0xb164
movq 0x68(%rsp), %r12
testq %r12, %r12
setne %al
orb %r13b, %al
je 0xfb21
testl %ebx, %ebx
sete %r13b
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0xb164
movq 0x60(%rsp), %rax
testq %rax, %rax
setne %cl
orb %r13b, %cl
je 0xfb21
testq %rax, %rax
je 0xfb21
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 0x1834a
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0xb164
movq 0x58(%rsp), %rax
testq %rax, %rax
setne %cl
orb %r13b, %cl
je 0xfb21
testq %rax, %rax
je 0xfb21
movq 0x10(%rsp), %rcx
addq %rcx, %rax
addq $0x60, %rax
cmpq %rax, 0x70(%rsp)
je 0xfa91
movq %r15, %rdi
callq 0xde80
mulsd 0x19599(%rip), %xmm0    # 0x29028
jmp 0xfa99
movq %r15, %rdi
callq 0xde80
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 0xad90
movq 0x38(%rsp), %rdi
movq %r12, %rsi
callq 0x16876
movq 0x8(%rax), %r12
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xfaed
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6310
cmpq %r12, %r15
jne 0xf8c7
testl %ebx, %ebx
sete %r15b
addq $0x60, %r13
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0xb164
movq 0x18(%rsp), %rax
testq %rax, %rax
setne %cl
orb %r15b, %cl
jne 0xf864
leaq 0x1a5ae(%rip), %rdi     # 0x2a0d6
leaq 0x19cdc(%rip), %rsi     # 0x2980b
leaq 0x1a5b0(%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 0xfb5a
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xfb79
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6310
movq %rbx, %rdi
callq 0x65b0
nop