// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/PositionInfo.cpp
// Function: PositionInfo::GetShootAngle(double, double, PlayerState const&, double&)
AngleDeg PositionInfo::GetShootAngle(AngleDeg left, AngleDeg right,
                                     const PlayerState &state,
                                     AngleDeg &interval) {
  vector<pair<Unum, AngleDeg>> tmp;
  for (vector<PlayerState *>::const_iterator it =
           mpWorldState->GetPlayerList().begin();
       it != mpWorldState->GetPlayerList().end(); ++it) {
    if ((*it)->IsAlive() && (*it)->GetPosConf() > FLOAT_EPS &&
        (*it)->GetUnum() != state.GetUnum() &&
        ((*it)->GetPos() - state.GetPos()).Dir() + Rad2Deg(1 / 10) > left &&
        ((*it)->GetPos() - state.GetPos()).Dir() - Rad2Deg(1 / 10) <
            right) { //介于左右门柱之间
      tmp.push_back(pair<Unum, AngleDeg>(
          (*it)->GetUnum(), ((*it)->GetPos() - state.GetPos()).Dir()));
    }
  }
  if (tmp.size() != 0) {
    sort(tmp.begin(), tmp.end(), PlayerDirCompare());
    vector<pair<int, AngleDeg>> dis;
    int i = 0;
    vector<pair<int, AngleDeg>>::const_iterator it;
    for (it = tmp.begin(); it != tmp.end(); ++it) {
      if (i == 0) {
        dis.push_back(pair<int, AngleDeg>(
            i++, ((*it).second - left /* - Rad2Deg(1/10) - Rad2Deg(1/3)*/)));
      } else {
        dis.push_back(pair<int, AngleDeg>(
            i++, ((*it).second -
                  (*(it - 1)).second) /*- 2*Rad2Deg(1/10) - Rad2Deg(1/3)*/));
      }
    }
    dis.push_back(pair<int, AngleDeg>(
        i, (right - (*(it - 1)).second) /*- Rad2Deg(1/10) - Rad2Deg(1/3)*/));
    sort(dis.begin(), dis.end(), PlayerDirCompare());

    if (dis.back().first == 0) {
      interval = dis.back().second - Rad2Deg(1.0 / 10.0) - Rad2Deg(1.0 / 4.0);
      return MinMax(left + 1,
                    dis.back().second / 2 + left - Rad2Deg(1.0 / 10.0) -
                        Rad2Deg(1.0 / 4.0),
                    right - 1);
    } else if (dis.back().first == i) {
      interval = dis.back().second - Rad2Deg(1.0 / 10.0) - Rad2Deg(1.0 / 4.0);
      return MinMax(left + 1,
                    right - dis.back().second / 2 + Rad2Deg(1.0 / 10.0) +
                        Rad2Deg(1.0 / 4.0),
                    right - 1);
    } else {
      interval =
          dis.back().second - 2 * Rad2Deg(1.0 / 10.0) - Rad2Deg(1.0 / 4.0);
      return MinMax(left + 1,
                    (*(tmp.begin() + dis.back().first - 1)).second +
                        dis.back().second / 2,
                    right - 1);
    }
  } else {
    interval = right - left;
    return (left + right) / 2;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rbx
movsd %xmm1, -0x58(%rbp)
movsd %xmm0, -0x30(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x80(%rbp)
movq $0x0, -0x70(%rbp)
movq 0x10(%rdi), %rax
movq 0x20f8(%rax), %r12
cmpq 0x2100(%rax), %r12
je 0x47550
movq %rsi, %r14
movq %rdi, %r15
movq (%r12), %rax
cmpb $0x1, 0x112(%rax)
jne 0x4745a
movsd 0x20(%rax), %xmm0
ucomisd 0x21d95(%rip), %xmm0    # 0x69040
jbe 0x4745a
movl 0x11c(%rax), %ecx
cmpl 0x11c(%r14), %ecx
je 0x4745a
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm0
subsd 0x8(%r14), %xmm1
subsd 0x10(%r14), %xmm0
movapd %xmm1, %xmm2
andpd 0x21d2a(%rip), %xmm2    # 0x69010
movsd 0x21d52(%rip), %xmm3    # 0x69040
ucomisd %xmm2, %xmm3
jbe 0x47312
movapd %xmm0, %xmm3
andpd 0x21d10(%rip), %xmm3    # 0x69010
xorpd %xmm2, %xmm2
movsd 0x21d34(%rip), %xmm4    # 0x69040
ucomisd %xmm3, %xmm4
ja 0x47333
callq 0x90d0
movapd %xmm0, %xmm2
mulsd 0x21d25(%rip), %xmm2    # 0x69048
divsd 0x21d25(%rip), %xmm2    # 0x69050
addsd 0x21d5d(%rip), %xmm2    # 0x69090
ucomisd -0x30(%rbp), %xmm2
jbe 0x4745a
movq (%r12), %rax
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm0
subsd 0x8(%r14), %xmm1
subsd 0x10(%r14), %xmm0
movapd %xmm1, %xmm2
andpd 0x21cac(%rip), %xmm2    # 0x69010
movsd 0x21cd4(%rip), %xmm3    # 0x69040
ucomisd %xmm2, %xmm3
jbe 0x47390
movapd %xmm0, %xmm3
andpd 0x21c92(%rip), %xmm3    # 0x69010
xorpd %xmm2, %xmm2
movsd 0x21cb6(%rip), %xmm4    # 0x69040
ucomisd %xmm3, %xmm4
ja 0x473a9
callq 0x90d0
movapd %xmm0, %xmm2
mulsd 0x21ca7(%rip), %xmm2    # 0x69048
divsd 0x21ca7(%rip), %xmm2    # 0x69050
movsd -0x58(%rbp), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x4745a
movq (%r12), %rax
movl 0x11c(%rax), %r13d
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm0
subsd 0x8(%r14), %xmm1
subsd 0x10(%r14), %xmm0
movapd %xmm1, %xmm2
andpd 0x21c2b(%rip), %xmm2    # 0x69010
movsd 0x21c53(%rip), %xmm3    # 0x69040
ucomisd %xmm2, %xmm3
jbe 0x47411
movapd %xmm0, %xmm3
andpd 0x21c11(%rip), %xmm3    # 0x69010
xorpd %xmm2, %xmm2
movsd 0x21c35(%rip), %xmm4    # 0x69040
ucomisd %xmm3, %xmm4
ja 0x4742a
callq 0x90d0
movapd %xmm0, %xmm2
mulsd 0x21c26(%rip), %xmm2    # 0x69048
divsd 0x21c26(%rip), %xmm2    # 0x69050
movl %r13d, -0x50(%rbp)
movsd %xmm2, -0x48(%rbp)
movq -0x78(%rbp), %rsi
cmpq -0x70(%rbp), %rsi
je 0x4744d
movupd -0x50(%rbp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, -0x78(%rbp)
jmp 0x4745a
leaq -0x80(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x1c5f0
addq $0x8, %r12
movq 0x10(%r15), %rax
cmpq 0x2100(%rax), %r12
jne 0x4728d
movq -0x80(%rbp), %r14
movq -0x78(%rbp), %r15
movq %r15, %rax
subq %r14, %rax
je 0x47553
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x48798
movq %r14, %rdi
movq %r15, %rsi
callq 0x488a3
xorpd %xmm0, %xmm0
movapd %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x80(%rbp), %r13
cmpq -0x78(%rbp), %r13
je 0x475b4
xorl %r12d, %r12d
leaq -0x50(%rbp), %r14
leaq -0x68(%rbp), %r15
testl %r12d, %r12d
je 0x47505
movsd 0x8(%r13), %xmm0
subsd -0x8(%r13), %xmm0
movl %r12d, -0x68(%rbp)
movsd %xmm0, -0x60(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
jne 0x47526
movq %r14, %rdi
movq %r15, %rdx
callq 0x1c5f0
jmp 0x47534
movsd 0x8(%r13), %xmm0
subsd -0x30(%rbp), %xmm0
movl $0x0, -0x68(%rbp)
movsd %xmm0, -0x60(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x47543
movupd -0x68(%rbp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, -0x48(%rbp)
addq $0x10, %r13
incl %r12d
cmpq -0x78(%rbp), %r13
jne 0x474d4
jmp 0x4757f
movq %r14, %rdi
movq %r15, %rdx
callq 0x1c5f0
jmp 0x47534
xorl %r14d, %r14d
movsd -0x58(%rbp), %xmm2
movapd %xmm2, %xmm0
movsd -0x30(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, (%rbx)
addsd %xmm2, %xmm1
mulsd 0x22303(%rip), %xmm1    # 0x69878
movsd %xmm1, -0x30(%rbp)
jmp 0x4774c
movq -0x48(%rbp), %rsi
movsd -0x58(%rbp), %xmm0
subsd -0x8(%r13), %xmm0
movl %r12d, -0x68(%rbp)
movsd %xmm0, -0x60(%rbp)
cmpq -0x40(%rbp), %rsi
je 0x475d0
movupd -0x68(%rbp), %xmm0
movupd %xmm0, (%rsi)
movq -0x48(%rbp), %r14
addq $0x10, %r14
movq %r14, -0x48(%rbp)
jmp 0x475e1
movsd -0x58(%rbp), %xmm0
subsd -0x8(%r13), %xmm0
movl $0x0, -0x68(%rbp)
movsd %xmm0, -0x60(%rbp)
xorl %r12d, %r12d
xorl %esi, %esi
leaq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x1c5f0
movq -0x48(%rbp), %r14
movq -0x50(%rbp), %r15
cmpq %r14, %r15
je 0x4761b
movq %r14, %rax
subq %r15, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x48798
movq %r15, %rdi
movq %r14, %rsi
callq 0x488a3
movq -0x48(%rbp), %r14
movslq -0x10(%r14), %rax
testq %rax, %rax
je 0x47680
movsd -0x8(%r14), %xmm0
movsd -0x30(%rbp), %xmm1
addsd 0x21a21(%rip), %xmm1    # 0x69058
cmpl %r12d, %eax
jne 0x476e9
addsd 0x247b0(%rip), %xmm0    # 0x6bdf8
addsd 0x247a0(%rip), %xmm0    # 0x6bdf0
movsd %xmm0, (%rbx)
movsd -0x8(%r14), %xmm0
mulsd 0x21a26(%rip), %xmm0    # 0x69088
movsd -0x58(%rbp), %xmm2
addsd %xmm2, %xmm0
addsd 0x2478d(%rip), %xmm0    # 0x6be00
addsd 0x2478d(%rip), %xmm0    # 0x6be08
jmp 0x4771e
movsd 0x24770(%rip), %xmm0    # 0x6bdf8
movsd -0x8(%r14), %xmm1
addsd %xmm0, %xmm1
movsd 0x24756(%rip), %xmm2    # 0x6bdf0
addsd %xmm2, %xmm1
movsd %xmm1, (%rbx)
movsd 0x219ae(%rip), %xmm1    # 0x69058
movsd -0x30(%rbp), %xmm4
addsd %xmm4, %xmm1
movsd -0x8(%r14), %xmm3
mulsd 0x221b7(%rip), %xmm3    # 0x69878
addsd %xmm4, %xmm3
addsd %xmm0, %xmm3
addsd %xmm2, %xmm3
maxsd %xmm1, %xmm3
movsd -0x58(%rbp), %xmm0
addsd 0x219ba(%rip), %xmm0    # 0x69098
minsd %xmm3, %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x47733
addsd 0x246f7(%rip), %xmm0    # 0x6bde8
addsd 0x246f7(%rip), %xmm0    # 0x6bdf0
movsd %xmm0, (%rbx)
movq -0x80(%rbp), %rcx
shlq $0x4, %rax
movsd -0x8(%r14), %xmm0
mulsd 0x22165(%rip), %xmm0    # 0x69878
addsd -0x8(%rcx,%rax), %xmm0
movsd -0x58(%rbp), %xmm2
addsd 0x21972(%rip), %xmm2    # 0x69098
maxsd %xmm1, %xmm0
minsd %xmm0, %xmm2
movsd %xmm2, -0x30(%rbp)
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x47748
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq -0x80(%rbp), %r14
testq %r14, %r14
je 0x47760
movq -0x70(%rbp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x94e0
movsd -0x30(%rbp), %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4777a
jmp 0x47781
jmp 0x47781
movq %rax, %rbx
jmp 0x47799
jmp 0x47781
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x47799
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x477ae
movq -0x70(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq %rbx, %rdi
callq 0x98b0