// File: /workspace/github_cpp_makefile_star2_O2/Chrom3D[P]Chrom3D/src/Model.cpp
// Function: Model::resetAllChromosomes(unsigned int)
void Model::resetAllChromosomes(uint maxAttempts /*=1000*/) { //, bool updateClash /*=false*/) {
  vector<Chromosome>::iterator chriter;
  boost::container::static_vector<Bead,MAXSIZE>::iterator beaditer;  
  double L = (this->getTotalChrLength() / this->numberOfChromosomes()) * 0.1;
  for(chriter = chromosomes.begin(); chriter != chromosomes.end(); chriter++) {
    vector<double> radii;
    Move mov(*chriter);
    boost::container::static_vector<Bead,MAXSIZE>::iterator beaditer;
    for(beaditer=chriter->begin(); beaditer!=chriter->end(); beaditer++) {
      radii.push_back(beaditer->getRadius());
    }
    mov.start = 0;
    mov.stop = chriter->size()-1;
    for(uint i=0; i!=maxAttempts; i++) {
      CoordinateVector origin(3);
      origin(0) = util::unif_real(-L, L, randEngine);
      origin(1) = util::unif_real(-L, L, randEngine);
      origin(2) = util::unif_real(-L, L, randEngine);
      CoordinateMatrix mat = util::createSelfAvoidingWalk(radii, origin, randEngine);
      
      if(mat.size1()!=0){
        mov.mat = mat;
        mov.validate();
        if (not isClashing(mov)) {
	  //cerr << "# " << chriter->getName() << " done!" << endl;
	  Move old = this->accept(mov); //, updateClash);
	  break;
        }
      }
    }
  }  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %esi, 0x14(%rsp)
movq %rdi, %rbx
callq 0x12626
movq 0xa78(%rbx), %rdi
movq 0xa80(%rbx), %rcx
movq %rcx, %rax
subq %rdi, %rax
movl $0x75330, %esi          # imm = 0x75330
cqto
idivq %rsi
movl %eax, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
mulsd 0xf1aa(%rip), %xmm0     # 0x21450
movapd 0xdd92(%rip), %xmm1     # 0x20040
movapd %xmm0, 0x50(%rsp)
xorpd %xmm0, %xmm1
movapd %xmm1, 0x40(%rsp)
movq %rbx, 0x18(%rsp)
leaq 0x20(%rbx), %r13
movq %rdi, %rbx
leaq 0xf8(%rsp), %r14
leaq 0x130(%rsp), %r15
movq %r13, 0x20(%rsp)
cmpq %rcx, %rbx
je 0x12567
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
callq 0xbce8
andq $0x0, 0x8(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa778
movq 0xf8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa784
movq 0x8(%rsp), %rdi
cmpq 0xf8(%rsp), %rdi
je 0x1236c
callq 0xa3e8
movsd %xmm0, 0xf8(%rsp)
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0x97f6
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0xb1ee
jmp 0x12326
andl $0x0, 0x88(%rsp)
movq %rbx, %rdi
callq 0xa75e
decl %eax
movl %eax, 0x8c(%rsp)
movl 0x14(%rsp), %ebp
subl $0x1, %ebp
jb 0x12538
leaq 0x28(%rsp), %rdi
pushq $0x3
popq %rsi
callq 0x7d3c
movapd 0x40(%rsp), %xmm0
movapd 0x50(%rsp), %xmm1
movq %r13, %rdi
callq 0x6e93
movsd %xmm0, (%rsp)
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x8638
movsd (%rsp), %xmm0
movsd %xmm0, (%rax)
movapd 0x40(%rsp), %xmm0
movapd 0x50(%rsp), %xmm1
movq %r13, %rdi
callq 0x6e93
movsd %xmm0, (%rsp)
leaq 0x28(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x8638
movsd (%rsp), %xmm0
movsd %xmm0, (%rax)
movapd 0x40(%rsp), %xmm0
movapd 0x50(%rsp), %xmm1
movq %r13, %rdi
callq 0x6e93
movsd %xmm0, (%rsp)
leaq 0x28(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x8638
movsd (%rsp), %xmm0
movsd %xmm0, (%rax)
leaq 0xe0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x7e9c
movq %r15, %rdi
leaq 0x28(%rsp), %rsi
callq 0x8932
leaq 0xb8(%rsp), %rdi
leaq 0xe0(%rsp), %r12
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl $0x3e8, %r8d            # imm = 0x3E8
callq 0x70ea
movq %r14, %r13
movq %rbx, %r14
movq %r15, %rbx
movq %r15, %rdi
callq 0x8012
movq %r12, %rdi
callq 0x92fe
cmpq $0x0, 0xb8(%rsp)
je 0x124cc
leaq 0x90(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xb528
leaq 0x80(%rsp), %rdi
callq 0xbdc4
movq 0x18(%rsp), %rdi
leaq 0x80(%rsp), %rsi
xorl %edx, %edx
callq 0xe484
testb %al, %al
je 0x124f6
leaq 0xc8(%rsp), %rdi
callq 0x8012
leaq 0x28(%rsp), %rdi
callq 0x8012
movq %rbx, %r15
movq %r14, %rbx
movq %r13, %r14
movq 0x20(%rsp), %r13
jmp 0x12389
movq %r13, %rdi
leaq 0x80(%rsp), %rdx
callq 0xea36
leaq 0x118(%rsp), %rdi
callq 0x8012
leaq 0xc8(%rsp), %rdi
callq 0x8012
leaq 0x28(%rsp), %rdi
callq 0x8012
movq %rbx, %r15
movq %r14, %rbx
movq %r13, %r14
movq 0x20(%rsp), %r13
leaq 0xa0(%rsp), %rdi
callq 0x8012
leaq 0x60(%rsp), %rdi
callq 0x92fe
addq $0x75330, %rbx          # imm = 0x75330
movq 0x18(%rsp), %rax
movq 0xa80(%rax), %rcx
jmp 0x122df
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x125ae
jmp 0x125c0
movq %rax, %rbx
jmp 0x125df
jmp 0x125c0
jmp 0x125c5
jmp 0x125c0
movq %rax, %rbx
jmp 0x1259d
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x8012
leaq 0xe0(%rsp), %rdi
callq 0x92fe
jmp 0x125c8
jmp 0x125c0
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x8012
jmp 0x125c8
movq %rax, %rbx
jmp 0x125d2
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x8012
leaq 0xa0(%rsp), %rdi
callq 0x8012
leaq 0x60(%rsp), %rdi
callq 0x92fe
movq %rbx, %rdi
callq 0x65d0
nop