// File: /workspace/github_cpp_makefile_star2_O1/wrighteagle2d[P]wrighteaglebase/Debug/../src/VisualSystem.cpp
// Function: VisualSystem::DoVisualExecute()
void VisualSystem::DoVisualExecute() {
  mBestVisualAction.mDir = GetNormalizeAngleDeg(mBestVisualAction.mDir);

  AngleDeg finalnec = GetNormalizeAngleDeg(
      mBestVisualAction.mDir -
      mPreBodyDir); //最后要看的方向与当前（或者说执行过本周期动作后，如turn）身体正对方向的夹角，即最后的neckrelangle。

  if (fabs(finalnec) > ServerParam::instance().maxNeckAngle()) {
    if (mCanTurn) {
      if (finalnec < 0.0) {
        mpAgent->Turn(finalnec - ServerParam::instance().minNeckAngle());
        mpAgent->TurnNeck(ServerParam::instance().minNeckMoment());
      } else {
        mpAgent->Turn(finalnec - ServerParam::instance().maxNeckAngle());
        mpAgent->TurnNeck(ServerParam::instance().maxNeckMoment());
      }
    } else {
      if (finalnec < 0.0) {
        mpAgent->TurnNeck(ServerParam::instance().minNeckMoment());
      } else {
        mpAgent->TurnNeck(ServerParam::instance().maxNeckMoment());
      }
    }
  } else {
    finalnec -= mpSelfState->GetNeckDir();
    mpAgent->TurnNeck(finalnec);
  }

  if (mViewWidth != mpSelfState->GetViewWidth()) {
    mpAgent->ChangeView(mViewWidth);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movsd 0x670(%rdi), %xmm3
movsd 0x107d0(%rip), %xmm0    # 0x6b060
ucomisd %xmm3, %xmm0
jbe 0x5a8aa
movsd 0x107d2(%rip), %xmm1    # 0x6b070
addsd %xmm1, %xmm3
ucomisd %xmm3, %xmm0
ja 0x5a89e
jmp 0x5a8ce
ucomisd 0x10796(%rip), %xmm3    # 0x6b048
jb 0x5a8ce
movsd 0x107ac(%rip), %xmm1    # 0x6b068
movsd 0x10784(%rip), %xmm2    # 0x6b048
addsd %xmm1, %xmm3
ucomisd %xmm2, %xmm3
jae 0x5a8c4
movsd %xmm3, 0x670(%rbx)
subsd 0x648(%rbx), %xmm3
ucomisd %xmm3, %xmm0
jbe 0x5a8f8
movsd 0x10784(%rip), %xmm1    # 0x6b070
addsd %xmm1, %xmm3
ucomisd %xmm3, %xmm0
ja 0x5a8ec
jmp 0x5a91c
ucomisd 0x10748(%rip), %xmm3    # 0x6b048
jb 0x5a91c
movsd 0x1075e(%rip), %xmm0    # 0x6b068
movsd 0x10736(%rip), %xmm1    # 0x6b048
addsd %xmm0, %xmm3
ucomisd %xmm1, %xmm3
jae 0x5a912
movapd %xmm3, -0x30(%rbp)
movapd 0x106e7(%rip), %xmm0    # 0x6b010
andpd %xmm3, %xmm0
movapd %xmm0, -0x40(%rbp)
callq 0x4a75c
movapd -0x40(%rbp), %xmm0
ucomisd 0x3160(%rax), %xmm0
jbe 0x5a99c
movb 0x63c(%rbx), %r15b
movq 0x8(%rbx), %r14
callq 0x4a75c
xorpd %xmm0, %xmm0
cmpb $0x1, %r15b
jne 0x5a9df
movapd -0x30(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x5a9f0
subsd 0x3168(%rax), %xmm1
movapd %xmm1, -0x30(%rbp)
movq %r14, %rdi
callq 0xef28
movq %rax, %rdi
movapd -0x30(%rbp), %xmm0
callq 0xbc38
movq 0x8(%rbx), %r14
callq 0x4a75c
jmp 0x5a9e6
movq 0x20(%rbx), %r15
callq 0x4a75c
movq %rax, %r14
callq 0x4a75c
movsd 0x98(%r15), %xmm0
maxsd 0x3168(%r14), %xmm0
movsd 0x3160(%rax), %xmm1
minsd %xmm0, %xmm1
movapd -0x30(%rbp), %xmm0
subsd %xmm1, %xmm0
movapd %xmm0, -0x30(%rbp)
movq 0x8(%rbx), %r14
jmp 0x5aa28
ucomisd -0x30(%rbp), %xmm0
jbe 0x5aa1b
movsd 0x3158(%rax), %xmm0
jmp 0x5aa23
subsd 0x3160(%rax), %xmm1
movapd %xmm1, -0x30(%rbp)
movq %r14, %rdi
callq 0xef28
movq %rax, %rdi
movapd -0x30(%rbp), %xmm0
callq 0xbc38
movq 0x8(%rbx), %r14
callq 0x4a75c
movsd 0x3150(%rax), %xmm0
movapd %xmm0, -0x30(%rbp)
movq %r14, %rdi
callq 0xef28
movq %rax, %rdi
movaps -0x30(%rbp), %xmm0
callq 0xc106
movl 0x640(%rbx), %r14d
movq 0x20(%rbx), %rax
cmpl 0x118(%rax), %r14d
jne 0x5aa5b
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rdi
callq 0xef28
movq %rax, %rdi
movl %r14d, %esi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xc742
nop