// File: /workspace/github_cpp_makefile_star2_O1/wrighteagle2d[P]wrighteaglebase/Debug/../src/Kicker.h
// Function: Kicker::NearestPoint(Vector const&)
inline int NearestPoint(const Vector &p) {
    double ang = 0.0;
    double value = p.Mod();
    int idxA;
    if (value < mD1) {
      double fix = 180.0 / mNlayer[0];
      ang = p.Dir() + fix;
      ang = GetNormalizeAngleDeg(ang, 0.0);
      idxA = int(ang * mNlayer[0] / 360.0);
      return idxA;
    } else if (value > mD2) {
      double fix = 180.0 / mNlayer[2];
      ang = p.Dir() + fix;
      ang = GetNormalizeAngleDeg(ang, 0.0);
      idxA = int(ang * mNlayer[2] / 360.0);
      return mNlayer[0] + mNlayer[1] + idxA;
    } else {
      double fix = 180.0 / mNlayer[1];
      ang = p.Dir() + fix;
      ang = GetNormalizeAngleDeg(ang, 0.0);
      idxA = int(ang * mNlayer[1] / 360.0);
      return mNlayer[0] + idxA;
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movsd (%rsi), %xmm0
movsd 0x8(%rsi), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x33738
sqrtsd %xmm0, %xmm0
jmp 0x3373d
callq 0x93c0
movsd 0x20(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x3378c
xorps %xmm0, %xmm0
cvtsi2sdl 0x10(%rbx), %xmm0
movsd 0x378f0(%rip), %xmm1    # 0x6b048
divsd %xmm0, %xmm1
movsd %xmm1, -0x18(%rbp)
movq %r14, %rdi
callq 0xe804
addsd -0x18(%rbp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x337e2
movsd 0x378f0(%rip), %xmm2    # 0x6b070
addsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
ja 0x33780
jmp 0x33806
ucomisd 0x28(%rbx), %xmm0
jbe 0x33823
xorps %xmm0, %xmm0
cvtsi2sdl 0x18(%rbx), %xmm0
movsd 0x378a1(%rip), %xmm1    # 0x6b048
divsd %xmm0, %xmm1
movsd %xmm1, -0x18(%rbp)
movq %r14, %rdi
callq 0xe804
addsd -0x18(%rbp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x33867
movsd 0x3789d(%rip), %xmm2    # 0x6b070
addsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
ja 0x337d3
jmp 0x3388b
ucomisd 0x37886(%rip), %xmm0    # 0x6b070
jb 0x33806
movsd 0x37874(%rip), %xmm1    # 0x6b068
movsd 0x37874(%rip), %xmm2    # 0x6b070
addsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jae 0x337fc
xorps %xmm1, %xmm1
cvtsi2sdl 0x10(%rbx), %xmm1
mulsd %xmm0, %xmm1
divsd 0x37856(%rip), %xmm1    # 0x6b070
cvttsd2si %xmm1, %eax
jmp 0x338ec
xorps %xmm0, %xmm0
cvtsi2sdl 0x14(%rbx), %xmm0
movsd 0x37815(%rip), %xmm1    # 0x6b048
divsd %xmm0, %xmm1
movsd %xmm1, -0x18(%rbp)
movq %r14, %rdi
callq 0xe804
addsd -0x18(%rbp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x338ad
movsd 0x37815(%rip), %xmm2    # 0x6b070
addsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
ja 0x3385b
jmp 0x338d1
ucomisd 0x37801(%rip), %xmm0    # 0x6b070
jb 0x3388b
movsd 0x377ef(%rip), %xmm1    # 0x6b068
movsd 0x377ef(%rip), %xmm2    # 0x6b070
addsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jae 0x33881
xorps %xmm1, %xmm1
cvtsi2sdl 0x18(%rbx), %xmm1
mulsd %xmm0, %xmm1
divsd 0x377d1(%rip), %xmm1    # 0x6b070
cvttsd2si %xmm1, %ecx
movl 0x14(%rbx), %eax
addl 0x10(%rbx), %eax
addl %ecx, %eax
jmp 0x338ec
ucomisd 0x377bb(%rip), %xmm0    # 0x6b070
jb 0x338d1
movsd 0x377a9(%rip), %xmm1    # 0x6b068
movsd 0x377a9(%rip), %xmm2    # 0x6b070
addsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jae 0x338c7
xorps %xmm1, %xmm1
cvtsi2sdl 0x14(%rbx), %xmm1
mulsd %xmm0, %xmm1
divsd 0x3778b(%rip), %xmm1    # 0x6b070
cvttsd2si %xmm1, %eax
addl 0x10(%rbx), %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop