// File: /workspace/github_cpp_makefile_star2_O1/wrighteagle2d[P]wrighteaglebase/Debug/../src/VisualSystem.cpp
// Function: VisualSystem::DoInfoGatherForBallFree()
void VisualSystem::DoInfoGatherForBallFree() {
  const Strategy &strategy = mpAgent->GetStrategy();

  double
      ball_free_cyc_left; // ball free cycle
                          // left,这里是经过调整的有概率意义的freecyc,不同于StrategyInfo里的那个值
  const double rate = 0.6; //可以认为是调整值符合真实值的成功率
  double my_int_cycle, tm_int_cycle, opp_int_cycle;

  my_int_cycle = strategy.GetMyInterCycle();
  tm_int_cycle = strategy.GetMinTmInterCycle() * rate +
                 strategy.GetSureTmInterCycle() * (1 - rate);
  opp_int_cycle = strategy.GetMinOppInterCycle() * rate +
                  strategy.GetSureOppInterCycle() * (1 - rate);

  ball_free_cyc_left = Min(tm_int_cycle, opp_int_cycle);
  ball_free_cyc_left = Min(my_int_cycle, ball_free_cyc_left);

  if (opp_int_cycle < ball_free_cyc_left + 2 && ball_free_cyc_left > 3) {
    ball_free_cyc_left -= 1;
  }

  std::vector<OrderedIT>::const_iterator it;
  const std::vector<OrderedIT> &OIT = mpInfoState->GetInterceptInfo().GetOIT();

  if (strategy.IsMyControl() &&
      mpAgent->GetFormation()
              .GetTeammateRoleType(mpSelfState->GetUnum())
              .mLineType != LT_Defender &&
      ball_free_cyc_left < 6 && ball_free_cyc_left > 2) {
    RaiseBall(1.0);
  } else {
    RaiseBall();
  }

  if (!strategy.IsMyControl()) { //自己不用拿球
    int eva = 3;
    for (it = OIT.begin(); it != OIT.end(); ++it) {
      if (it->mpInterceptInfo->mMinCycle > 50)
        break;
      RaisePlayer(it->mUnum, eva++);
    }
  } else { //自己需要拿球
    RaiseBall(2.0);
    int eva = 3;
    for (it = OIT.begin(); it != OIT.end(); ++it) {
      if (it->mpInterceptInfo->mMinCycle > 50)
        break;
      if (it->mUnum == mpSelfState->GetUnum())
        continue;
      RaisePlayer(it->mUnum, ++eva);
      if (mpWorldState->GetPlayer(it->mUnum).GetPosDelay() >
          it->mpInterceptInfo->mMinCycle) {
        mHighPriorityPlayerSet.insert(GetVisualRequest(it->mUnum));
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
leaq 0x38(%rdi), %rsi
callq 0xf5c4
movq %rax, %r15
movl 0x64(%rax), %eax
movl %eax, -0x30(%rbp)
movl 0x68(%r15), %eax
movl %eax, -0x38(%rbp)
movl 0x7c(%r15), %eax
movl %eax, -0x34(%rbp)
movl 0x6c(%r15), %r12d
movl 0x80(%r15), %r13d
movq 0x28(%rbx), %rdi
callq 0x2ae32
movq %rax, %r14
movq %r15, %rdi
callq 0x4c97e
testb %al, %al
je 0x599e5
movq 0x8(%rbx), %rdi
callq 0x1356e
movq 0x20(%rbx), %rcx
movslq 0x11c(%rcx), %rcx
movq 0x10(%rax), %rax
movslq 0x350(%rax,%rcx,4), %rcx
shlq $0x4, %rcx
cmpl $0x1, 0x58(%rcx,%rax)
je 0x599e5
cvtsi2sd %r12d, %xmm0
cvtsi2sd %r13d, %xmm1
movsd 0x14518(%rip), %xmm2    # 0x6de58
mulsd %xmm2, %xmm1
movsd 0x12074(%rip), %xmm3    # 0x6b9c0
mulsd %xmm3, %xmm0
addsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl -0x38(%rbp), %xmm1
cvtsi2sdl -0x34(%rbp), %xmm4
mulsd %xmm2, %xmm4
mulsd %xmm3, %xmm1
addsd %xmm4, %xmm1
movapd %xmm0, %xmm2
minsd %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsi2sdl -0x30(%rbp), %xmm1
minsd %xmm1, %xmm2
movsd 0x11df7(%rip), %xmm1    # 0x6b780
addsd %xmm2, %xmm1
movsd 0x11703(%rip), %xmm3    # 0x6b098
addsd %xmm2, %xmm3
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm3
andnpd %xmm2, %xmm0
orpd %xmm3, %xmm0
movsd 0x1226e(%rip), %xmm1    # 0x6bc20
cmpltsd %xmm2, %xmm1
andpd %xmm1, %xmm0
andnpd %xmm2, %xmm1
orpd %xmm0, %xmm1
movsd 0x144f5(%rip), %xmm0    # 0x6dec0
ucomisd %xmm1, %xmm0
jbe 0x599e5
ucomisd 0x11da7(%rip), %xmm1    # 0x6b780
jbe 0x599e5
movsd 0x11675(%rip), %xmm0    # 0x6b058
jmp 0x599e9
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x59178
movq %r15, %rdi
callq 0x4c97e
testb %al, %al
je 0x59aef
movq 0x8(%rbx), %rdi
leaq 0x38(%rdi), %rsi
callq 0xf5c4
movsd 0x11d6a(%rip), %xmm0    # 0x6b780
minsd 0x48(%rbx), %xmm0
movsd %xmm0, 0x48(%rbx)
movq 0xc80(%r14), %r13
cmpq 0xc88(%r14), %r13
je 0x59b32
leaq 0x608(%rbx), %r15
leaq 0x30(%rbx), %rax
movq %rax, -0x30(%rbp)
movl $0x3, %r12d
movq (%r13), %rax
cmpl $0x32, 0x74(%rax)
jg 0x59b32
movl 0x8(%r13), %esi
movq 0x20(%rbx), %rax
cmpl 0x11c(%rax), %esi
je 0x59adc
incl %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movq %rbx, %rdi
callq 0x58f34
movslq 0x8(%r13), %rax
leal -0x1(%rax), %ecx
testq %rax, %rax
movl %eax, %edx
notl %edx
cmovgl %ecx, %edx
movl $0x10d0, %ecx           # imm = 0x10D0
movl $0xa8, %esi
cmovgq %rsi, %rcx
addq 0x10(%rbx), %rcx
movslq %edx, %rdx
imulq $0x178, %rdx, %rdx      # imm = 0x178
movl 0x18(%rdx,%rcx), %ecx
movq (%r13), %rdx
cmpl 0x74(%rdx), %ecx
jle 0x59adc
movl $0xb, %ecx
subl %eax, %ecx
movslq %ecx, %rcx
testl %eax, %eax
cmovnsq %rax, %rcx
shlq $0x6, %rcx
addq -0x30(%rbp), %rcx
movq %rcx, -0x40(%rbp)
movq %r15, %rdi
leaq -0x40(%rbp), %rsi
callq 0x5b782
addq $0x10, %r13
cmpq 0xc88(%r14), %r13
jne 0x59a49
jmp 0x59b32
movq 0xc80(%r14), %r15
cmpq 0xc88(%r14), %r15
je 0x59b32
movl $0x3, %r12d
movq (%r15), %rax
cmpl $0x32, 0x74(%rax)
jg 0x59b32
movl 0x8(%r15), %esi
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
incl %r12d
movq %rbx, %rdi
callq 0x58f34
addq $0x10, %r15
cmpq 0xc88(%r14), %r15
jne 0x59b05
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop