// File: /workspace/github_cpp_makefile_star2_O2/Chrom3D[P]Chrom3D/src/Model.cpp
// Function: Model::calculateScorePerConstraint(Chromosome&, unsigned int, unsigned int)
std::vector<double> Model::calculateScorePerConstraint(Chromosome& chr, uint startPos, uint endPos){
  
  std::vector<double> myScore(C_T_COUNT,0.0);
  
  boost::container::static_vector<Bead,MAXSIZE>::iterator it;
  vector<Constraint>::iterator it2;
  for(it = chr.begin() + startPos; it != chr.begin() + endPos+1; it++) {
    for(it2 = constraints[it->getID()].begin(); it2 != constraints[it->getID()].end(); it2++) {
      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) ) {
        myScore[it2->getConstraintTypeID()] += it2->eval()/2;
      }
      else {
        myScore[it2->getConstraintTypeID()] += it2->eval();
      }
    }
   }
  
  return myScore;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r8d, %ebx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r12
leaq 0x58(%rsp), %rdx
andq $0x0, (%rdx)
pushq $0x6
popq %rsi
leaq 0x10(%rsp), %rcx
movq %rdi, 0x18(%rsp)
callq 0x131ba
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0xa778
movl %ebp, %edx
leaq 0x58(%rsp), %r13
leaq 0x28(%rsp), %r15
movq %r13, %rdi
movq %r15, %rsi
movq %rdx, 0x30(%rsp)
callq 0xb224
movq (%r13), %rax
leaq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movl %ebx, %eax
movq %rax, (%rsp)
addq $0x9e8, %r12            # imm = 0x9E8
leaq 0x38(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0xa778
movq %r15, %rdi
movq %rbp, %rsi
movq (%rsp), %rdx
callq 0xb224
movq %r13, %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
callq 0xb224
movq 0x10(%rsp), %rsi
cmpq 0x58(%rsp), %rsi
je 0x12bed
movq %r13, %rdi
callq 0xa3fa
movq %r12, %rdi
movq %r13, %rsi
callq 0x13024
movq (%rax), %rbx
movq %r13, %rdi
callq 0x66d0
movq 0x10(%rsp), %rsi
movq %r13, %rdi
callq 0xa3fa
movq %r12, %rdi
movq %r13, %rsi
callq 0x13024
movq %r12, %rbp
movq 0x8(%rax), %r12
movq %r13, %rdi
callq 0x66d0
cmpq %r12, %rbx
je 0x12bd1
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xa778
movq %rbx, 0x8(%rsp)
movq %r13, %rbx
leaq 0xd0(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq 0x30(%rsp), %rdx
callq 0xb224
movq %r14, %rsi
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
movq %rsi, %r15
callq 0xa778
leaq 0x38(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq (%rsp), %rdx
callq 0xb224
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
callq 0xb224
movq 0x8(%rsp), %rax
movq (%rax), %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1308a
leaq 0xb0(%rsp), %r12
movq %r12, %rdi
movq %r15, %r14
movq %r15, %rsi
callq 0xa778
leaq 0xb8(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movq (%rsp), %rdx
callq 0xb224
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
callq 0xb224
movq 0x58(%rsp), %rax
cmpq 0x50(%rsp), %rax
je 0x12b8d
leaq 0xa0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa778
movq %rbp, %r12
movq %rbx, %r13
leaq 0xa8(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq 0x30(%rsp), %rdx
callq 0xb224
leaq 0x88(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa778
leaq 0x90(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
movq (%rsp), %rdx
callq 0xb224
leaq 0x98(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
pushq $0x1
popq %rdx
callq 0xb224
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rcx
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1308a
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa778
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq (%rsp), %rdx
callq 0xb224
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
callq 0xb224
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x12b93
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xc992
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
callq 0xcaa2
movsd 0x20(%rsp), %xmm0
mulsd 0xd49d(%rip), %xmm0     # 0x20028
jmp 0x12bb4
movq %rbp, %r12
movq %rbx, %r13
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xc992
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
callq 0xcaa2
movsd 0x20(%rsp), %xmm0
cltq
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
addsd (%rcx,%rax,8), %xmm0
movsd %xmm0, (%rcx,%rax,8)
addq $0x38, %rbx
jmp 0x12992
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0xb1ee
movq %rbp, %r12
leaq 0x28(%rsp), %r15
jmp 0x12937
movq 0x18(%rsp), %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x12c29
jmp 0x12c29
jmp 0x12c16
jmp 0x12c29
jmp 0x12c29
jmp 0x12c29
jmp 0x12c29
jmp 0x12c29
jmp 0x12c29
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x66d0
jmp 0x12c2c
jmp 0x12c29
jmp 0x12c29
movq %rax, %rbx
movq 0x18(%rsp), %rdi
callq 0x92fe
movq %rbx, %rdi
callq 0x65d0