// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/Kicker.cpp
// Function: Kicker::Kicker()
Kicker::Kicker() {
  /** POINTS_NUM = 81 = 18 + 27 + 36 */
  mNlayer[0] = 18;
  mNlayer[1] = 27;
  mNlayer[2] = 36;

  mD1 = 0.585; /** (mDlayer[0] + mDlayer[1]) / 2.0 */
  mD2 = 0.835; /** (mDlayer[1] + mDlayer[2]) / 2.0 */
  mDlayer[0] = 0.46;
  mDlayer[1] = 0.71;
  mDlayer[2] = 0.96; /** 球员的kick_area是0.985到1.185之间 */

  /** 计算所有的点 */
  int k = 0;
  AngleDeg angle = 0.0;
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < mNlayer[i]; ++j) {
      angle = 360.0 * j / mNlayer[i];
      mPoint[k] = Polar2Vector(mDlayer[i], angle);
      ++k;
    }
  }

  mOppCurve.SetOutMinMax(0.0, 1.0);
  mOppCurve.Interpolate(0.0, 0.0, 1.0, 0.8, 2.0,
                        1.0); /** 输入为近身对手离球的距离减去球员的kick_area */
  mRandCurve.SetOutMinMax(0.6, 1.0);
  mRandCurve.Interpolate(0.0, 1.0, 1.0, 0.9, 2.0,
                         0.6); /** 输入为max_rand中属于球位置因素的部分 */
  mSpeedCurve.SetOutMinMax(0.0, 1.0);
  mSpeedCurve.Interpolate(0.0, 0.0, 1.6, 0.8,
                          ServerParam::instance().ballSpeedMax(), 1.0);

  //==========================================================================

  mInput.mPlayerType = -1;
  mKickSpeed = 0.0;
  mKickTarget = Vector(0.0, 0.0);

  for (int i = 0; i < POINTS_NUM; ++i) {
    mKickRate[i] = 0.0;
    mMaxAccel[i] = 0.0;
    mRandEva[i] = 0.0;
    mPointEva[i] = 0.0;
  }

  mMaxRandFactor = 0.0;

  for (int i = 0; i < 360; ++i) {
    for (int j = 0; j < 3; ++j) {
      mMaxSpeed[i][j] = 0.0;
    }
  }

  /** 将要读取或计算mKickerValue表 */
  memset(mKickerValue, 0, sizeof(mKickerValue));

  if (PlayerParam::instance().KickerMode() == 0) {
    ReadUtilityTable();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
movl $0x0, (%rdi)
movq %r14, 0x4(%rdi)
movb $0x0, 0xc(%rdi)
addq $0x48, %rdi
xorl %r15d, %r15d
movl $0x510, %edx            # imm = 0x510
xorl %esi, %esi
callq 0x92b0
leaq 0x2b4508(%rbx), %rax
movq %rax, -0x60(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x2b4508(%rbx)
movupd %xmm0, 0x2b4518(%rbx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x2b4528(%rbx)
leaq 0x2b4530(%rbx), %rax
movq %rax, -0x68(%rbp)
movupd %xmm0, 0x2b4530(%rbx)
movupd %xmm0, 0x2b4540(%rbx)
movq %rcx, 0x2b4550(%rbx)
leaq 0x2b4558(%rbx), %rax
movq %rax, -0x70(%rbp)
movupd %xmm0, 0x2b4558(%rbx)
movupd %xmm0, 0x2b4568(%rbx)
movq %rcx, 0x2b4578(%rbx)
movupd %xmm0, 0x2b4588(%rbx)
movupd %xmm0, 0x2b4598(%rbx)
movupd %xmm0, 0x2b45b0(%rbx)
movupd %xmm0, 0x2b45c0(%rbx)
movupd %xmm0, 0x2b45d8(%rbx)
leaq 0x2b501c(%rbx), %rax
xorl %ecx, %ecx
movl $0x0, -0xc(%rax,%rcx)
movq %r14, -0x8(%rax,%rcx)
movb $0x0, (%rax,%rcx)
addq $0x10, %rcx
cmpq $0x30, %rcx
jne 0x2cf84
addq $0x30, %r15
addq $0x30, %rax
cmpq $0x4380, %r15           # imm = 0x4380
jne 0x2cf82
movq %rbx, -0x50(%rbp)
movq -0x50(%rbp), %rax
leaq 0x2bb550(%rax), %rdi
xorl %r15d, %r15d
movl $0xca80, %edx           # imm = 0xCA80
xorl %esi, %esi
callq 0x92b0
movq -0x50(%rbp), %r9
movabsq $0x1b00000012, %rax     # imm = 0x1B00000012
movq %rax, 0x10(%r9)
movl $0x24, 0x18(%r9)
movabsq $0x3fe2b851eb851eb8, %rax # imm = 0x3FE2B851EB851EB8
movq %rax, 0x20(%r9)
movabsq $0x3feab851eb851eb8, %rax # imm = 0x3FEAB851EB851EB8
movq %rax, 0x28(%r9)
movabsq $0x3fdd70a3d70a3d71, %rax # imm = 0x3FDD70A3D70A3D71
movq %rax, 0x30(%r9)
movabsq $0x3fe6b851eb851eb8, %rax # imm = 0x3FE6B851EB851EB8
movq %rax, 0x38(%r9)
movabsq $0x3feeb851eb851eb8, %rax # imm = 0x3FEEB851EB851EB8
movq %rax, 0x40(%r9)
leaq 0x50(%r9), %rax
movq %rax, -0x78(%rbp)
movsd 0x3c032(%rip), %xmm2    # 0x69070
movsd 0x3c00a(%rip), %xmm3    # 0x69050
movsd 0x3bffa(%rip), %xmm4    # 0x69048
leaq -0x30(%rbp), %r14
leaq -0x38(%rbp), %rbx
xorl %edx, %edx
movl 0x10(%r9,%r15,4), %eax
testl %eax, %eax
jle 0x2d0f5
movl %edx, -0x54(%rbp)
movslq %edx, %r12
shlq $0x4, %r12
addq -0x78(%rbp), %r12
xorl %r13d, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd %xmm2, %xmm0
divsd %xmm1, %xmm0
mulsd %xmm3, %xmm0
divsd %xmm4, %xmm0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x92d0
movq -0x50(%rbp), %r9
movsd 0x3bf9c(%rip), %xmm4    # 0x69048
movsd 0x3bf9c(%rip), %xmm3    # 0x69050
movsd 0x3bfb4(%rip), %xmm2    # 0x69070
movsd 0x30(%r9,%r15,8), %xmm0
movsd -0x38(%rbp), %xmm1
mulsd %xmm0, %xmm1
mulsd -0x30(%rbp), %xmm0
movsd %xmm1, -0x8(%r12)
movsd %xmm0, (%r12)
incl %r13d
movl 0x10(%r9,%r15,4), %eax
addq $0x10, %r12
cmpl %eax, %r13d
jl 0x2d076
movl -0x54(%rbp), %edx
addl %r13d, %edx
incq %r15
cmpq $0x3, %r15
jne 0x2d058
xorl %r13d, %r13d
movq %r13, 0x2b4520(%r9)
movabsq $0x3ff0000000000000, %r12 # imm = 0x3FF0000000000000
movq %r12, 0x2b4528(%r9)
leaq -0x30(%rbp), %rax
movq %r13, (%rax)
movq %rax, %rsi
leaq -0x38(%rbp), %rax
movq %r13, (%rax)
movq %rax, %rdx
leaq -0x48(%rbp), %rax
movq %r12, (%rax)
movq %rax, %rcx
movabsq $0x3fe999999999999a, %rax # imm = 0x3FE999999999999A
leaq -0x40(%rbp), %rdi
movq %rax, (%rdi)
movq %rdi, %r8
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
leaq -0x80(%rbp), %r14
movq %rax, (%r14)
leaq -0x88(%rbp), %r15
movq %r12, (%r15)
movq %r15, (%rsp)
movq %r9, %rbx
movq -0x60(%rbp), %rdi
movq %r14, %r9
callq 0x3258a
movabsq $0x3fe3333333333333, %rax # imm = 0x3FE3333333333333
movq %rax, 0x2b4548(%rbx)
movq %r12, 0x2b4550(%rbx)
leaq -0x30(%rbp), %rcx
movq %r13, (%rcx)
leaq -0x38(%rbp), %rcx
movq %r12, (%rcx)
leaq -0x48(%rbp), %rcx
movq %r12, (%rcx)
movabsq $0x3feccccccccccccd, %rcx # imm = 0x3FECCCCCCCCCCCCD
leaq -0x40(%rbp), %rdx
movq %rcx, (%rdx)
movabsq $0x4000000000000000, %rcx # imm = 0x4000000000000000
movq %rcx, (%r14)
movq %rax, (%r15)
movq %r15, (%rsp)
leaq -0x30(%rbp), %rsi
leaq -0x38(%rbp), %r15
leaq -0x48(%rbp), %rcx
leaq -0x40(%rbp), %r8
movq -0x68(%rbp), %rdi
movq %r15, %rdx
movq %r14, %r9
callq 0x3258a
movq %r13, 0x2b4570(%rbx)
movq %r12, 0x2b4578(%rbx)
leaq -0x30(%rbp), %rax
movq %r13, (%rax)
movq %r13, (%r15)
movabsq $0x3ff999999999999a, %rax # imm = 0x3FF999999999999A
leaq -0x48(%rbp), %rcx
movq %rax, (%rcx)
movabsq $0x3fe999999999999a, %rax # imm = 0x3FE999999999999A
leaq -0x40(%rbp), %rcx
movq %rax, (%rcx)
callq 0x49360
leaq 0x30f8(%rax), %r9
movq %r12, (%r14)
movq %r14, (%rsp)
leaq -0x30(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0x48(%rbp), %rcx
leaq -0x40(%rbp), %r8
movq -0x70(%rbp), %rdi
callq 0x3258a
movl $0xffffffff, 0x2b4580(%rbx) # imm = 0xFFFFFFFF
leaq 0x2b45d0(%rbx), %r14
leaq 0x2b9390(%rbx), %rdi
movl $0x21c0, %edx           # imm = 0x21C0
xorl %esi, %esi
callq 0x92b0
leaq 0x558(%rbx), %rdi
movl $0x2b3fb0, %edx         # imm = 0x2B3FB0
xorl %esi, %esi
callq 0x92b0
movl $0xa40, %edx            # imm = 0xA40
movq %r14, %rdi
xorl %esi, %esi
callq 0x92b0
callq 0x43dce
cmpl $0x0, 0x5c78(%rax)
jne 0x2d2b0
movq %rbx, %rdi
callq 0x2d2c0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop