// File: /workspace/github_cpp_makefile_star2_O3/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 0xbd53
movl %edx, %r14d
movq %rsi, %r15
movl 0x75328(%rsi), %eax
decl %eax
cmpl %edx, %eax
jbe 0xbd53
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0xbd72
movsd 0x1d65d(%rip), %xmm1    # 0x29018
ucomisd %xmm0, %xmm1
jb 0xbd72
movl %ecx, %ebp
movq %rdi, %rbx
movsd %xmm0, 0x90(%rsp)
leaq 0xc8(%rsp), %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xb332
xorpd %xmm0, %xmm0
movupd %xmm0, 0x78(%rsp)
movapd %xmm0, 0x60(%rsp)
movupd %xmm0, 0x50(%rsp)
movupd %xmm0, 0x38(%rsp)
testb %bpl, %bpl
je 0xbafb
leal 0x1(%r14), %edx
movl 0x75328(%r15), %ecx
decl %ecx
movq %rsp, %rdi
movq %r15, %rsi
callq 0xb18e
movapd (%rsp), %xmm0
leaq 0x70(%rsp), %rdi
movapd %xmm0, -0x10(%rdi)
movq 0x18(%rsp), %rsi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcbba
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0xba7a
movq 0x20(%rsp), %rsi
shlq $0x3, %rdx
movq 0x80(%rsp), %rdi
callq 0x64e0
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0xba7a
movq 0x20(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
leal -0x1(%r14), %edx
movq %rsp, %rdi
movq %r15, %rsi
callq 0xb332
movq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcbba
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0xbad3
movq 0x10(%rsp), %rsi
shlq $0x3, %rdx
movq 0x58(%rsp), %rdi
callq 0x64e0
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xbad3
movq 0x10(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq %rsp, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xb332
movq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcbba
jmp 0xbbe1
leal -0x1(%r14), %ecx
movq %rsp, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xb18e
movapd (%rsp), %xmm0
leaq 0x70(%rsp), %rdi
movapd %xmm0, -0x10(%rdi)
movq 0x18(%rsp), %rsi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcbba
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0xbb63
movq 0x20(%rsp), %rsi
shlq $0x3, %rdx
movq 0x80(%rsp), %rdi
callq 0x64e0
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0xbb63
movq 0x20(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq %rsp, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xb332
movq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcbba
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0xbbbb
movq 0x10(%rsp), %rsi
shlq $0x3, %rdx
movq 0x58(%rsp), %rdi
callq 0x64e0
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xbbbb
movq 0x10(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
incl %r14d
movq %rsp, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xb332
movq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdi
xorpd %xmm0, %xmm0
xorl %edx, %edx
callq 0xcbba
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0xbc16
movq 0x10(%rsp), %rsi
shlq $0x3, %rdx
movq 0x40(%rsp), %rdi
callq 0x64e0
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xbc16
movq 0x10(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
leaq 0xb0(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x9478
leaq 0x98(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x9478
leaq 0x70(%rsp), %rsi
movapd -0x10(%rsi), %xmm0
leaq 0xf0(%rsp), %rdi
movapd %xmm0, -0x10(%rdi)
callq 0x9478
leaq 0xb0(%rsp), %rsi
leaq 0x98(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
movq %rbx, %rdi
movsd 0x90(%rsp), %xmm0
callq 0x6cc6
movq 0xf8(%rsp), %rsi
testq %rsi, %rsi
je 0xbc9d
movq 0x100(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0xa0(%rsp), %rsi
testq %rsi, %rsi
je 0xbcbb
movq 0xa8(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0xb8(%rsp), %rsi
testq %rsi, %rsi
je 0xbcd9
movq 0xc0(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0x38(%rsp), %rsi
testq %rsi, %rsi
je 0xbcf1
movq 0x40(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0x50(%rsp), %rsi
testq %rsi, %rsi
je 0xbd09
movq 0x58(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0x78(%rsp), %rsi
testq %rsi, %rsi
je 0xbd24
movq 0x80(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0xd0(%rsp), %rsi
testq %rsi, %rsi
je 0xbd42
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 0x1da23(%rip), %rdi     # 0x2977d
leaq 0x1d8f5(%rip), %rsi     # 0x29656
leaq 0x1da3a(%rip), %rcx     # 0x297a2
movl $0x73, %edx
callq 0x6210
leaq 0x1da64(%rip), %rdi     # 0x297dd
leaq 0x1d8d6(%rip), %rsi     # 0x29656
leaq 0x1da1b(%rip), %rcx     # 0x297a2
movl $0x74, %edx
callq 0x6210
jmp 0xbda1
jmp 0xbda1
jmp 0xbe49
jmp 0xbe49
jmp 0xbda1
movq %rax, %rbx
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xbe4c
movq 0x10(%rsp), %rdi
jmp 0xbe3e
jmp 0xbe49
jmp 0xbe49
jmp 0xbdc8
movq %rax, %rbx
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0xbe4c
movq 0x20(%rsp), %rdi
jmp 0xbe3e
jmp 0xbe49
jmp 0xbe49
movq %rax, %rbx
movq 0xf8(%rsp), %rsi
testq %rsi, %rsi
je 0xbe06
movq 0x100(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
jmp 0xbe06
movq %rax, %rbx
movq 0xa0(%rsp), %rsi
testq %rsi, %rsi
je 0xbe29
movq 0xa8(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
jmp 0xbe29
movq %rax, %rbx
movq 0xb8(%rsp), %rsi
testq %rsi, %rsi
je 0xbe4c
movq 0xc0(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
jmp 0xbe4c
movq %rax, %rbx
movq 0x38(%rsp), %rsi
testq %rsi, %rsi
je 0xbe64
movq 0x40(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0x50(%rsp), %rsi
testq %rsi, %rsi
je 0xbe7c
movq 0x58(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0x78(%rsp), %rsi
testq %rsi, %rsi
je 0xbe97
movq 0x80(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq 0xd0(%rsp), %rsi
testq %rsi, %rsi
je 0xbeb5
movq 0xd8(%rsp), %rdi
shlq $0x3, %rsi
callq 0x6310
movq %rbx, %rdi
callq 0x65b0
nop