// File: 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:
subq $0x208, %rsp            # imm = 0x208
movq %rdi, 0x88(%rsp)
movq %rdi, %rax
movq %rax, 0x78(%rsp)
movq %rdi, 0x200(%rsp)
movq %rsi, 0x1f8(%rsp)
movq %rdx, 0x1f0(%rsp)
movl %ecx, 0x1ec(%rsp)
movl %r8d, 0x1e8(%rsp)
movq 0x1f8(%rsp), %rax
movq %rax, 0x80(%rsp)
movb $0x0, 0x1e7(%rsp)
movq $0x0, 0x1d8(%rsp)
leaq 0x1d7(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0xbf30
movq 0x88(%rsp), %rdi
movq 0x90(%rsp), %rcx
movl $0x6, %esi
leaq 0x1d8(%rsp), %rdx
callq 0x28990
jmp 0x2719b
leaq 0x1d7(%rsp), %rdi
callq 0xbfd0
leaq 0x1b8(%rsp), %rdi
callq 0x16890
leaq 0x1b0(%rsp), %rdi
callq 0x28240
movq 0x1f0(%rsp), %rsi
leaq 0x1a0(%rsp), %rdi
callq 0x15540
jmp 0x271d9
movl 0x1ec(%rsp), %eax
movl %eax, %edx
leaq 0x1a8(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x16c10
leaq 0x1b8(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x16a00
movq 0x1f0(%rsp), %rsi
leaq 0x188(%rsp), %rdi
callq 0x15540
jmp 0x27223
movl 0x1e8(%rsp), %eax
movl %eax, %edx
leaq 0x190(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x16c10
leaq 0x198(%rsp), %rdi
leaq 0x190(%rsp), %rsi
movl $0x1, %edx
callq 0x16c10
leaq 0x1b8(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0x16b40
testb $0x1, %al
jne 0x27279
jmp 0x27775
movq 0x80(%rsp), %rax
addq $0x9e8, %rax            # imm = 0x9E8
movq %rax, 0x70(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x16ca0
movq %rax, %rsi
leaq 0x160(%rsp), %rdi
callq 0x14ea0
jmp 0x272ab
movq 0x70(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x28590
movq %rax, 0x68(%rsp)
jmp 0x272c4
movq 0x68(%rsp), %rdi
callq 0x28300
movq %rax, 0x180(%rsp)
movq 0x180(%rsp), %rax
movq %rax, 0x1b0(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x8998
movq 0x80(%rsp), %rax
addq $0x9e8, %rax            # imm = 0x9E8
movq %rax, 0x60(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x16ca0
movq %rax, %rsi
leaq 0x138(%rsp), %rdi
callq 0x14ea0
jmp 0x27325
movq 0x60(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x28590
movq %rax, 0x58(%rsp)
jmp 0x2733e
movq 0x58(%rsp), %rdi
callq 0x28370
movq %rax, 0x158(%rsp)
leaq 0x1b0(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x28330
movb %al, 0x57(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x8998
movb 0x57(%rsp), %al
testb $0x1, %al
jne 0x27383
jmp 0x27757
movq 0x1f0(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x15540
jmp 0x2739a
movl 0x1ec(%rsp), %eax
movl %eax, %edx
leaq 0x128(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x16c10
movq 0x1f0(%rsp), %rsi
leaq 0x108(%rsp), %rdi
callq 0x15540
jmp 0x273cf
movl 0x1e8(%rsp), %eax
movl %eax, %edx
leaq 0x110(%rsp), %rdi
movq %rdi, 0x40(%rsp)
leaq 0x108(%rsp), %rsi
callq 0x16c10
movq 0x40(%rsp), %rsi
leaq 0x118(%rsp), %rdi
movq %rdi, 0x48(%rsp)
movl $0x1, %edx
callq 0x16c10
leaq 0x1b0(%rsp), %rdi
callq 0x283a0
movq 0x48(%rsp), %rdx
movq (%rax), %rcx
leaq 0x130(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0x28680
jmp 0x2743a
movq 0x1f0(%rsp), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x15540
jmp 0x27451
movl 0x1e8(%rsp), %eax
movl %eax, %edx
leaq 0xf8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x16c10
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
movl $0x1, %edx
callq 0x16c10
leaq 0x130(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x16b40
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x3f(%rsp)
jne 0x274b0
jmp 0x275d0
movq 0x1f0(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
callq 0x15540
jmp 0x274c7
movl 0x1ec(%rsp), %eax
movl %eax, %edx
leaq 0xe0(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x16c10
movq 0x1f0(%rsp), %rsi
leaq 0xc0(%rsp), %rdi
callq 0x15540
jmp 0x274fc
movl 0x1e8(%rsp), %eax
movl %eax, %edx
leaq 0xc8(%rsp), %rdi
movq %rdi, 0x28(%rsp)
leaq 0xc0(%rsp), %rsi
callq 0x16c10
movq 0x28(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
movq %rdi, 0x30(%rsp)
movl $0x1, %edx
callq 0x16c10
leaq 0x1b0(%rsp), %rdi
callq 0x283a0
movq 0x30(%rsp), %rdx
movq 0x8(%rax), %rcx
leaq 0xe8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x28680
jmp 0x27568
movq 0x1f0(%rsp), %rsi
leaq 0xa8(%rsp), %rdi
callq 0x15540
jmp 0x2757f
movl 0x1e8(%rsp), %eax
movl %eax, %edx
leaq 0xb0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x16c10
leaq 0xb8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
movl $0x1, %edx
callq 0x16c10
leaq 0xe8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x16b40
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x275dd
jmp 0x276df
leaq 0x1b0(%rsp), %rdi
callq 0x283a0
movq %rax, %rdi
callq 0x1ab90
movsd %xmm0, 0x20(%rsp)
jmp 0x275fa
movsd 0x20(%rsp), %xmm0
movsd 0x28fc0(%rip), %xmm1    # 0x505c8
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x1b0(%rsp), %rdi
callq 0x283a0
movq %rax, %rdi
callq 0x1b0a0
movl %eax, 0x1c(%rsp)
jmp 0x2762d
movq 0x88(%rsp), %rdi
movl 0x1c(%rsp), %eax
movslq %eax, %rsi
callq 0xbd40
movsd 0x10(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x27739
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c8(%rsp)
movl %eax, 0x1c4(%rsp)
leaq 0x1d7(%rsp), %rdi
callq 0xbfd0
jmp 0x277ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c8(%rsp)
movl %eax, 0x1c4(%rsp)
jmp 0x277a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c8(%rsp)
movl %eax, 0x1c4(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x8998
jmp 0x277a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c8(%rsp)
movl %eax, 0x1c4(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x8998
jmp 0x277a1
leaq 0x1b0(%rsp), %rdi
callq 0x283a0
movq %rax, %rdi
callq 0x1ab90
movsd %xmm0, 0x8(%rsp)
jmp 0x276fc
leaq 0x1b0(%rsp), %rdi
callq 0x283a0
movq %rax, %rdi
callq 0x1b0a0
movl %eax, 0x4(%rsp)
jmp 0x27717
movq 0x88(%rsp), %rdi
movl 0x4(%rsp), %eax
movslq %eax, %rsi
callq 0xbd40
movsd 0x8(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x2773b
leaq 0x1b0(%rsp), %rdi
xorl %esi, %esi
callq 0x283b0
movq %rax, 0xa0(%rsp)
jmp 0x272f3
jmp 0x27759
leaq 0x98(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
xorl %edx, %edx
callq 0x16b60
jmp 0x2720c
movb $0x1, 0x1e7(%rsp)
testb $0x1, 0x1e7(%rsp)
jne 0x27794
movq 0x88(%rsp), %rdi
callq 0xc3c0
movq 0x78(%rsp), %rax
addq $0x208, %rsp            # imm = 0x208
retq
movq 0x88(%rsp), %rdi
callq 0xc3c0
movq 0x1c8(%rsp), %rdi
callq 0x8870
nopl (%rax,%rax)