// File: /workspace/github_cpp_makefile_star2_O1/Chrom3D[P]Chrom3D/src/Chromosome.cpp
// Function: Chromosome::armRotate(unsigned int, double, bool)
CoordinateMatrix Chromosome::armRotate(uint pos, double theta, bool goRight) {
  assert( (pos >= 1) && (pos < this->size()-1) );
  assert( (theta >= 0) && (theta <= 2*util::PI) );
  
  CoordinateVector beadPos = this->getBeadCoordinates(pos);
  CoordinateMatrix mat;
  CoordinateVector point1;
  CoordinateVector point2;
  if(goRight) {
    mat = this->getBeadCoordinates(pos+1, this->size()-1);
    point1 = this->getBeadCoordinates(pos-1);
    point2 = this->getBeadCoordinates(pos);
  }
  else {
    mat = this->getBeadCoordinates(0, pos-1);
    point1 = this->getBeadCoordinates(pos);
    point2 = this->getBeadCoordinates(pos+1);    
  }
  CoordinateMatrix rotated = util::rotatePointsAroundArbitraryAxis(theta, point1, point2, mat);  
  return rotated;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
testl %edx, %edx
je 0xbdf7
movl %edx, %r14d
movq %rsi, %r15
movl 0x75328(%rsi), %eax
decl %eax
cmpl %edx, %eax
jbe 0xbdf7
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0xbe16
movsd 0x1d5b9(%rip), %xmm1    # 0x29018
ucomisd %xmm0, %xmm1
jb 0xbe16
movl %ecx, %ebp
movq %rdi, %rbx
movsd %xmm0, 0x90(%rsp)
leaq 0xc8(%rsp), %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xb3d6
xorpd %xmm0, %xmm0
movupd %xmm0, 0x78(%rsp)
movapd %xmm0, 0x60(%rsp)
movupd %xmm0, 0x50(%rsp)
movupd %xmm0, 0x38(%rsp)
testb %bpl, %bpl
je 0xbb9f
leal 0x1(%r14), %edx
movl 0x75328(%r15), %ecx
decl %ecx
movq %rsp, %rdi
movq %r15, %rsi
callq 0xb232
movapd (%rsp), %xmm0
leaq 0x70(%rsp), %rdi
movapd %xmm0, -0x10(%rdi)
movq 0x18(%rsp), %rsi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcc46
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0xbb06
movq 0x20(%rsp), %rsi
shlq $0x3, %rdx
movq 0x80(%rsp), %rdi
callq 0x64e0
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0xbb1e
movq 0x20(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
leal -0x1(%r14), %edx
movq %rsp, %rdi
movq %r15, %rsi
callq 0xb3d6
movq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcc46
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0xbb5f
movq 0x10(%rsp), %rsi
shlq $0x3, %rdx
movq 0x58(%rsp), %rdi
callq 0x64e0
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xbb77
movq 0x10(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq %rsp, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xb3d6
movq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcc46
jmp 0xbc85
leal -0x1(%r14), %ecx
movq %rsp, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xb232
movapd (%rsp), %xmm0
leaq 0x70(%rsp), %rdi
movapd %xmm0, -0x10(%rdi)
movq 0x18(%rsp), %rsi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcc46
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0xbbef
movq 0x20(%rsp), %rsi
shlq $0x3, %rdx
movq 0x80(%rsp), %rdi
callq 0x64e0
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0xbc07
movq 0x20(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq %rsp, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xb3d6
movq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcc46
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0xbc47
movq 0x10(%rsp), %rsi
shlq $0x3, %rdx
movq 0x58(%rsp), %rdi
callq 0x64e0
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xbc5f
movq 0x10(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
incl %r14d
movq %rsp, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xb3d6
movq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcc46
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0xbca2
movq 0x10(%rsp), %rsi
shlq $0x3, %rdx
movq 0x40(%rsp), %rdi
callq 0x64e0
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xbcba
movq 0x10(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
leaq 0xb0(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x94b0
leaq 0x98(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x94b0
leaq 0x70(%rsp), %rsi
movapd -0x10(%rsi), %xmm0
leaq 0xf0(%rsp), %rdi
movapd %xmm0, -0x10(%rdi)
callq 0x94b0
leaq 0xb0(%rsp), %rsi
leaq 0x98(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
movq %rbx, %rdi
movsd 0x90(%rsp), %xmm0
callq 0x6ca6
movq 0xf8(%rsp), %rsi
testq %rsi, %rsi
je 0xbd41
movq 0x100(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0xa0(%rsp), %rsi
testq %rsi, %rsi
je 0xbd5f
movq 0xa8(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0xb8(%rsp), %rsi
testq %rsi, %rsi
je 0xbd7d
movq 0xc0(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0x38(%rsp), %rsi
testq %rsi, %rsi
je 0xbd95
movq 0x40(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0x50(%rsp), %rsi
testq %rsi, %rsi
je 0xbdad
movq 0x58(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0x78(%rsp), %rsi
testq %rsi, %rsi
je 0xbdc8
movq 0x80(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0xd0(%rsp), %rsi
testq %rsi, %rsi
je 0xbde6
movq 0xd8(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d97f(%rip), %rdi     # 0x2977d
leaq 0x1d851(%rip), %rsi     # 0x29656
leaq 0x1d996(%rip), %rcx     # 0x297a2
movl $0x73, %edx
callq 0x6210
leaq 0x1d9c0(%rip), %rdi     # 0x297dd
leaq 0x1d832(%rip), %rsi     # 0x29656
leaq 0x1d977(%rip), %rcx     # 0x297a2
movl $0x74, %edx
callq 0x6210
jmp 0xbe45
jmp 0xbe45
jmp 0xbeed
jmp 0xbeed
jmp 0xbe45
movq %rax, %rbx
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xbef0
movq 0x10(%rsp), %rdi
jmp 0xbee2
jmp 0xbeed
jmp 0xbeed
jmp 0xbe6c
movq %rax, %rbx
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0xbef0
movq 0x20(%rsp), %rdi
jmp 0xbee2
jmp 0xbeed
jmp 0xbeed
movq %rax, %rbx
movq 0xf8(%rsp), %rsi
testq %rsi, %rsi
je 0xbeaa
movq 0x100(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
jmp 0xbeaa
movq %rax, %rbx
movq 0xa0(%rsp), %rsi
testq %rsi, %rsi
je 0xbecd
movq 0xa8(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
jmp 0xbecd
movq %rax, %rbx
movq 0xb8(%rsp), %rsi
testq %rsi, %rsi
je 0xbef0
movq 0xc0(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
jmp 0xbef0
movq %rax, %rbx
movq 0x38(%rsp), %rsi
testq %rsi, %rsi
je 0xbf08
movq 0x40(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0x50(%rsp), %rsi
testq %rsi, %rsi
je 0xbf20
movq 0x58(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0x78(%rsp), %rsi
testq %rsi, %rsi
je 0xbf3b
movq 0x80(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0xd0(%rsp), %rsi
testq %rsi, %rsi
je 0xbf59
movq 0xd8(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq %rbx, %rdi
callq 0x65b0
nop