// File: /workspace/github_cpp_makefile_star2_O1/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, -0x30(%rbp)
movsd %xmm0, -0x58(%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 0x48873
movq %rsi, %r14
movq %rdi, %r15
movq (%r12), %rax
cmpb $0x1, 0x112(%rax)
jne 0x4885e
movsd 0x20(%rax), %xmm0
ucomisd 0x22991(%rip), %xmm0    # 0x6b040
jbe 0x4885e
movl 0x11c(%rax), %ecx
cmpl 0x11c(%r14), %ecx
je 0x4885e
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm0
subsd 0x8(%r14), %xmm1
subsd 0x10(%r14), %xmm0
movapd %xmm1, %xmm2
andpd 0x22926(%rip), %xmm2    # 0x6b010
movsd 0x2294e(%rip), %xmm3    # 0x6b040
ucomisd %xmm2, %xmm3
jbe 0x48716
movapd %xmm0, %xmm3
andpd 0x2290c(%rip), %xmm3    # 0x6b010
xorpd %xmm2, %xmm2
movsd 0x22930(%rip), %xmm4    # 0x6b040
ucomisd %xmm3, %xmm4
ja 0x48737
callq 0x90d0
movapd %xmm0, %xmm2
mulsd 0x22921(%rip), %xmm2    # 0x6b048
divsd 0x22921(%rip), %xmm2    # 0x6b050
addsd 0x22959(%rip), %xmm2    # 0x6b090
ucomisd -0x58(%rbp), %xmm2
jbe 0x4885e
movq (%r12), %rax
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm0
subsd 0x8(%r14), %xmm1
subsd 0x10(%r14), %xmm0
movapd %xmm1, %xmm2
andpd 0x228a8(%rip), %xmm2    # 0x6b010
movsd 0x228d0(%rip), %xmm3    # 0x6b040
ucomisd %xmm2, %xmm3
jbe 0x48794
movapd %xmm0, %xmm3
andpd 0x2288e(%rip), %xmm3    # 0x6b010
xorpd %xmm2, %xmm2
movsd 0x228b2(%rip), %xmm4    # 0x6b040
ucomisd %xmm3, %xmm4
ja 0x487ad
callq 0x90d0
movapd %xmm0, %xmm2
mulsd 0x228a3(%rip), %xmm2    # 0x6b048
divsd 0x228a3(%rip), %xmm2    # 0x6b050
movsd -0x30(%rbp), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x4885e
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 0x22827(%rip), %xmm2    # 0x6b010
movsd 0x2284f(%rip), %xmm3    # 0x6b040
ucomisd %xmm2, %xmm3
jbe 0x48815
movapd %xmm0, %xmm3
andpd 0x2280d(%rip), %xmm3    # 0x6b010
xorpd %xmm2, %xmm2
movsd 0x22831(%rip), %xmm4    # 0x6b040
ucomisd %xmm3, %xmm4
ja 0x4882e
callq 0x90d0
movapd %xmm0, %xmm2
mulsd 0x22822(%rip), %xmm2    # 0x6b048
divsd 0x22822(%rip), %xmm2    # 0x6b050
movl %r13d, -0x50(%rbp)
movsd %xmm2, -0x48(%rbp)
movq -0x78(%rbp), %rsi
cmpq -0x70(%rbp), %rsi
je 0x48851
movupd -0x50(%rbp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, -0x78(%rbp)
jmp 0x4885e
leaq -0x80(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x1c99c
addq $0x8, %r12
movq 0x10(%r15), %rax
cmpq 0x2100(%rax), %r12
jne 0x48691
movq -0x80(%rbp), %r15
movq -0x78(%rbp), %r14
movq %r14, %rax
subq %r15, %rax
je 0x48951
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x49b1c
movq %r15, %rdi
movq %r14, %rsi
callq 0x49c27
xorpd %xmm0, %xmm0
movapd %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x80(%rbp), %r13
cmpq -0x78(%rbp), %r13
je 0x4897d
xorl %r12d, %r12d
leaq -0x50(%rbp), %r14
leaq -0x68(%rbp), %r15
testl %r12d, %r12d
je 0x48909
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 0x48927
movq %r14, %rdi
movq %r15, %rdx
callq 0x1c99c
jmp 0x48935
movsd 0x8(%r13), %xmm0
subsd -0x58(%rbp), %xmm0
movl %r12d, -0x68(%rbp)
movsd %xmm0, -0x60(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x48944
movupd -0x68(%rbp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, -0x48(%rbp)
addq $0x10, %r13
incl %r12d
cmpq -0x78(%rbp), %r13
jne 0x488d8
jmp 0x48980
movq %r14, %rdi
movq %r15, %rdx
callq 0x1c99c
jmp 0x48935
movsd -0x30(%rbp), %xmm1
movapd %xmm1, %xmm0
movsd -0x58(%rbp), %xmm2
subsd %xmm2, %xmm0
movsd %xmm0, (%rbx)
addsd %xmm1, %xmm2
mulsd 0x22f05(%rip), %xmm2    # 0x6b878
movsd %xmm2, -0x30(%rbp)
jmp 0x48b21
xorl %r12d, %r12d
movsd -0x30(%rbp), %xmm0
subsd -0x8(%r13), %xmm0
movl %r12d, -0x68(%rbp)
movsd %xmm0, -0x60(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x489ae
movupd -0x68(%rbp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, -0x48(%rbp)
jmp 0x489bb
leaq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x1c99c
movq -0x50(%rbp), %r14
movq -0x48(%rbp), %r15
cmpq %r15, %r14
je 0x489f5
movq %r15, %rax
subq %r14, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x49b1c
movq %r14, %rdi
movq %r15, %rsi
callq 0x49c27
movq -0x48(%rbp), %rax
movslq -0x10(%rax), %rcx
testq %rcx, %rcx
je 0x48a5c
movsd -0x8(%rax), %xmm0
movsd -0x58(%rbp), %xmm2
addsd 0x22644(%rip), %xmm2    # 0x6b058
cmpl %r12d, %ecx
jne 0x48ac3
addsd 0x25403(%rip), %xmm0    # 0x6de28
addsd 0x253f3(%rip), %xmm0    # 0x6de20
movsd %xmm0, (%rbx)
movsd -0x8(%rax), %xmm0
mulsd 0x2264a(%rip), %xmm0    # 0x6b088
movsd -0x30(%rbp), %xmm1
addsd %xmm1, %xmm0
addsd 0x253e1(%rip), %xmm0    # 0x6de30
addsd 0x253e1(%rip), %xmm0    # 0x6de38
jmp 0x48af7
movsd 0x253c4(%rip), %xmm0    # 0x6de28
movsd -0x8(%rax), %xmm1
addsd %xmm0, %xmm1
movsd 0x253ab(%rip), %xmm2    # 0x6de20
addsd %xmm2, %xmm1
movsd %xmm1, (%rbx)
movsd 0x225d3(%rip), %xmm1    # 0x6b058
movsd -0x8(%rax), %xmm3
mulsd 0x22de6(%rip), %xmm3    # 0x6b878
movsd -0x58(%rbp), %xmm4
addsd %xmm4, %xmm1
addsd %xmm4, %xmm3
addsd %xmm0, %xmm3
addsd %xmm2, %xmm3
maxsd %xmm1, %xmm3
movsd -0x30(%rbp), %xmm0
addsd 0x225e0(%rip), %xmm0    # 0x6b098
minsd %xmm3, %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x48b0c
addsd 0x2534d(%rip), %xmm0    # 0x6de18
addsd 0x2534d(%rip), %xmm0    # 0x6de20
movsd %xmm0, (%rbx)
movq -0x80(%rbp), %rdx
shlq $0x4, %rcx
movsd -0x8(%rax), %xmm0
mulsd 0x22d8c(%rip), %xmm0    # 0x6b878
addsd -0x8(%rdx,%rcx), %xmm0
movsd -0x30(%rbp), %xmm1
addsd 0x22599(%rip), %xmm1    # 0x6b098
maxsd %xmm2, %xmm0
minsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x48b21
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x48b36
movq -0x70(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movsd -0x30(%rbp), %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x48b57
jmp 0x48b50
jmp 0x48b57
movq %rax, %rbx
jmp 0x48b6f
jmp 0x48b57
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x48b6f
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x48b84
movq -0x70(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq %rbx, %rdi
callq 0x98b0