// File: Chrom3D[P]Chrom3D/src/Randomizer.cpp
// Function: ArmWiggleRandomizer::randomize(Chromosome&, boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>&)
Move ArmWiggleRandomizer::randomize(Chromosome &chr, ENG &eng) { 
  uint r1 = util::unif_int(1, chr.size()-2, eng);

  CoordinateVector origin(3);
  origin(0) = chr[r1].getX();
  origin(1) = chr[r1].getY();
  origin(2) = chr[r1].getZ();

  Move mov(chr);
  
  bool goRight = util::unif_int(0,1, eng);
  vector<double> radii;

  boost::container::static_vector<Bead,MAXSIZE>::iterator beaditer;
  if(goRight) {
    for(beaditer=chr.begin()+r1; beaditer!=chr.end(); beaditer++) {
      radii.push_back(beaditer->getRadius());
    }
    mov.start = r1;
    mov.stop = chr.size()-1;
      
  }
  else {
    for(beaditer=chr.begin(); beaditer!=chr.begin()+r1; beaditer++) {
      radii.push_back(beaditer->getRadius());
    }
    mov.start = 0;
    mov.stop = r1-1;            
  }

  CoordinateMatrix mat = util::createSelfAvoidingWalk(radii, origin, eng);
  mov.mat = mat;
  return mov;
}

// Assembly:
subq $0x198, %rsp            # imm = 0x198
movq %rdi, 0x68(%rsp)
movq %rdi, %rax
movq %rax, 0x70(%rsp)
movq %rdi, 0x190(%rsp)
movq %rsi, 0x188(%rsp)
movq %rdx, 0x180(%rsp)
movq %rcx, 0x178(%rsp)
movq 0x180(%rsp), %rdi
callq 0x154f0
movl %eax, %esi
addl $-0x2, %esi
movq 0x178(%rsp), %rdx
movl $0x1, %edi
callq 0x9980
movl %eax, 0x174(%rsp)
leaq 0x158(%rsp), %rdi
movl $0x3, %esi
callq 0xbe30
movq 0x180(%rsp), %rdi
movl 0x174(%rsp), %esi
callq 0x16820
movq %rax, 0x78(%rsp)
jmp 0x19aec
movq 0x78(%rsp), %rdi
callq 0x14e30
movsd %xmm0, 0x60(%rsp)
jmp 0x19afe
xorl %eax, %eax
movl %eax, %esi
leaq 0x158(%rsp), %rdi
callq 0xb270
movq %rax, 0x58(%rsp)
jmp 0x19b16
movq 0x58(%rsp), %rax
movsd 0x60(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x180(%rsp), %rdi
movl 0x174(%rsp), %esi
callq 0x16820
movq %rax, 0x50(%rsp)
jmp 0x19b40
movq 0x50(%rsp), %rdi
callq 0x14e40
movsd %xmm0, 0x48(%rsp)
jmp 0x19b52
leaq 0x158(%rsp), %rdi
movl $0x1, %esi
callq 0xb270
movq %rax, 0x40(%rsp)
jmp 0x19b6b
movq 0x40(%rsp), %rax
movsd 0x48(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x180(%rsp), %rdi
movl 0x174(%rsp), %esi
callq 0x16820
movq %rax, 0x38(%rsp)
jmp 0x19b95
movq 0x38(%rsp), %rdi
callq 0x14e50
movsd %xmm0, 0x30(%rsp)
jmp 0x19ba7
leaq 0x158(%rsp), %rdi
movl $0x2, %esi
callq 0xb270
movq %rax, 0x28(%rsp)
jmp 0x19bc0
movq 0x68(%rsp), %rdi
movq 0x28(%rsp), %rax
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax)
movb $0x0, 0x14b(%rsp)
movq 0x180(%rsp), %rsi
callq 0x192f0
jmp 0x19beb
movq 0x178(%rsp), %rdx
xorl %edi, %edi
movl $0x1, %esi
callq 0x9980
movl %eax, 0x24(%rsp)
jmp 0x19c05
movl 0x24(%rsp), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x14a(%rsp)
leaq 0x130(%rsp), %rdi
callq 0xc600
leaq 0x128(%rsp), %rdi
callq 0x16890
testb $0x1, 0x14a(%rsp)
je 0x19da1
movq 0x180(%rsp), %rsi
leaq 0x118(%rsp), %rdi
callq 0x15540
jmp 0x19c57
movl 0x174(%rsp), %eax
movl %eax, %edx
leaq 0x120(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x16c10
leaq 0x128(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x16a00
movq 0x180(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x15570
jmp 0x19ca1
leaq 0x128(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x16b40
testb $0x1, %al
jne 0x19cbf
jmp 0x19d6b
leaq 0x128(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e60
movsd %xmm0, 0x18(%rsp)
jmp 0x19cdc
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x108(%rsp)
leaq 0x130(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0xc5d0
jmp 0x19d02
jmp 0x19d04
leaq 0x100(%rsp), %rdi
leaq 0x128(%rsp), %rsi
xorl %edx, %edx
callq 0x16b60
jmp 0x19c8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x19ffa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x19ff0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x19fbd
movq 0x68(%rsp), %rax
movl 0x174(%rsp), %ecx
movl %ecx, 0x8(%rax)
movq 0x180(%rsp), %rdi
callq 0x154f0
movl %eax, 0x14(%rsp)
jmp 0x19d8d
movq 0x68(%rsp), %rax
movl 0x14(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, 0xc(%rax)
jmp 0x19e97
movq 0x180(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
callq 0x15540
jmp 0x19db8
leaq 0x128(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x16a00
movq 0x180(%rsp), %rsi
leaq 0xe8(%rsp), %rdi
callq 0x15540
jmp 0x19de4
movl 0x174(%rsp), %eax
movl %eax, %edx
leaq 0xf0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x16c10
leaq 0x128(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x16b40
testb $0x1, %al
jne 0x19e1d
jmp 0x19e7e
leaq 0x128(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e60
movsd %xmm0, 0x8(%rsp)
jmp 0x19e3a
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0xe0(%rsp)
leaq 0x130(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0xc5d0
jmp 0x19e60
jmp 0x19e62
leaq 0xd8(%rsp), %rdi
leaq 0x128(%rsp), %rsi
xorl %edx, %edx
callq 0x16b60
jmp 0x19dcd
movq 0x68(%rsp), %rax
movl $0x0, 0x8(%rax)
movl 0x174(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, 0xc(%rax)
leaq 0x98(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0xc2c0
jmp 0x19eae
leaq 0x80(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0xb710
jmp 0x19ec5
movq 0x178(%rsp), %rcx
leaq 0xb0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x80(%rsp), %rdx
movl $0x3e8, %r8d            # imm = 0x3E8
callq 0x9d20
jmp 0x19ef2
leaq 0x80(%rsp), %rdi
callq 0xb5b0
leaq 0x98(%rsp), %rdi
callq 0xc3c0
movq 0x68(%rsp), %rdi
addq $0x10, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x17400
jmp 0x19f24
movb $0x1, 0x14b(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0xb2d0
leaq 0x130(%rsp), %rdi
callq 0xc3c0
testb $0x1, 0x14b(%rsp)
jne 0x19fd6
jmp 0x19fcc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x19f8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
leaq 0x80(%rsp), %rdi
callq 0xb5b0
leaq 0x98(%rsp), %rdi
callq 0xc3c0
jmp 0x19fbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0xb2d0
leaq 0x130(%rsp), %rdi
callq 0xc3c0
jmp 0x19ff0
movq 0x68(%rsp), %rdi
callq 0x1a560
leaq 0x158(%rsp), %rdi
callq 0xb5b0
movq 0x70(%rsp), %rax
addq $0x198, %rsp            # imm = 0x198
retq
movq 0x68(%rsp), %rdi
callq 0x1a560
leaq 0x158(%rsp), %rdi
callq 0xb5b0
movq 0x150(%rsp), %rdi
callq 0x8870
nopw %cs:(%rax,%rax)