// File: Chrom3D[P]Chrom3D/src/Model.cpp
// Function: Model::detectClash()
bool Model::detectClash(){

  vector<Chromosome>::iterator chriter1; 
  vector<Chromosome>::iterator chriter2;  
  boost::container::static_vector<Bead,MAXSIZE>::iterator beaditer1;
  boost::container::static_vector<Bead,MAXSIZE>::iterator beaditer2;
  
  for(chriter1 = chromosomes.begin(); chriter1 != chromosomes.end(); chriter1++) {
    for(beaditer1 = chriter1->begin(); beaditer1 != chriter1->end(); beaditer1++) {
      for(chriter2 = chromosomes.begin(); chriter2 != chromosomes.end(); chriter2++) {
        for(beaditer2 = chriter2->begin(); beaditer2 != chriter2->end(); beaditer2++) {
          if(*beaditer1 != *beaditer2) { 
            
            if(util::coordClash(beaditer1->getX(),beaditer1->getY(), beaditer1->getZ(), beaditer2->getX(),beaditer2->getY(), beaditer2->getZ(), beaditer1->getRadius(), beaditer2->getRadius())) {              
	      return true;
            }
          }
        }
      }
    }
  }

  
  return false; 
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x27c50
leaq 0xb8(%rsp), %rdi
callq 0x27c50
leaq 0xb0(%rsp), %rdi
callq 0x16890
leaq 0xa8(%rsp), %rdi
callq 0x16890
movq 0x40(%rsp), %rdi
addq $0xa78, %rdi            # imm = 0xA78
callq 0x27be0
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x40(%rsp), %rdi
addq $0xa78, %rdi            # imm = 0xA78
callq 0x27c10
movq %rax, 0x98(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x27c70
testb $0x1, %al
jne 0x1eca0
jmp 0x1ef7d
leaq 0xc0(%rsp), %rdi
callq 0x27cb0
movq %rax, %rsi
leaq 0x90(%rsp), %rdi
callq 0x15540
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x16a00
leaq 0xc0(%rsp), %rdi
callq 0x27cb0
movq %rax, %rsi
leaq 0x88(%rsp), %rdi
callq 0x15570
leaq 0xb0(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x16b40
testb $0x1, %al
jne 0x1ed0d
jmp 0x1ef62
movq 0x40(%rsp), %rdi
addq $0xa78, %rdi            # imm = 0xA78
callq 0x27be0
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0x40(%rsp), %rdi
addq $0xa78, %rdi            # imm = 0xA78
callq 0x27c10
movq %rax, 0x78(%rsp)
leaq 0xb8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x27c70
testb $0x1, %al
jne 0x1ed67
jmp 0x1ef47
leaq 0xb8(%rsp), %rdi
callq 0x27cb0
movq %rax, %rsi
leaq 0x70(%rsp), %rdi
callq 0x15540
leaq 0xa8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x16a00
leaq 0xb8(%rsp), %rdi
callq 0x27cb0
movq %rax, %rsi
leaq 0x68(%rsp), %rdi
callq 0x15570
leaq 0xa8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x16b40
testb $0x1, %al
jne 0x1edc8
jmp 0x1ef2c
leaq 0xb0(%rsp), %rdi
callq 0x16a60
movq %rax, 0x38(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x16a60
movq 0x38(%rsp), %rdi
movq %rax, %rsi
callq 0x15030
testb $0x1, %al
jne 0x1edfd
jmp 0x1ef11
leaq 0xb0(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e30
movsd %xmm0, 0x30(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e40
movsd %xmm0, (%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e50
movsd %xmm0, 0x8(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e30
movsd %xmm0, 0x10(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e40
movsd %xmm0, 0x18(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e50
movsd %xmm0, 0x20(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e60
movsd %xmm0, 0x28(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e60
movsd (%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm3
movsd 0x18(%rsp), %xmm4
movsd 0x20(%rsp), %xmm5
movsd 0x28(%rsp), %xmm6
movaps %xmm0, %xmm7
movsd 0x30(%rsp), %xmm0
callq 0x99c0
testb $0x1, %al
jne 0x1ef05
jmp 0x1ef0f
movb $0x1, 0xd7(%rsp)
jmp 0x1ef85
jmp 0x1ef11
jmp 0x1ef13
leaq 0x60(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
xorl %edx, %edx
callq 0x16b60
jmp 0x1ed93
jmp 0x1ef2e
leaq 0xb8(%rsp), %rdi
xorl %esi, %esi
callq 0x27db0
movq %rax, 0x58(%rsp)
jmp 0x1ed36
jmp 0x1ef49
leaq 0x50(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
xorl %edx, %edx
callq 0x16b60
jmp 0x1ecd2
jmp 0x1ef64
leaq 0xc0(%rsp), %rdi
xorl %esi, %esi
callq 0x27db0
movq %rax, 0x48(%rsp)
jmp 0x1ec69
movb $0x0, 0xd7(%rsp)
movb 0xd7(%rsp), %al
andb $0x1, %al
addq $0xd8, %rsp
retq
nopw %cs:(%rax,%rax)