// File: /workspace/github_cpp_makefile_star2_O1/wrighteagle2d[P]wrighteaglebase/Debug/../src/Formation.cpp
// Function: OpponentFormation::SetOffsetMatrix()
void OpponentFormation::SetOffsetMatrix() {
  if (mHIntervalTimes[0] == 0 || mHIntervalTimes[1] == 0)
    return;
  RoleType iRole, jRole;
  const double MAXX = 50.0;
  const double MINX = -50.0;
  const double MAXY = 23.0;
  const double MINY = -23.0;

  mHBallFactor = (MAXX - (mHInterval[0] + mHInterval[1]) * 0.5) /
                 ServerParam::instance().PITCH_LENGTH * 2;
  mHBallFactor = Max(0.0, mHBallFactor);

  double maxwide = Max(mVInterval[1] * (mLineArrange[1] - 1),
                       mVInterval[2] * (mLineArrange[2] - 1));
  maxwide = Max(maxwide, mVInterval[3] * (mLineArrange[3] - 1));
  mVBallFactor =
      (MAXY - maxwide * 0.5) / ServerParam::instance().PITCH_WIDTH * 2;
  mVBallFactor = Max(0.0, mVBallFactor);

  for (int i = 1; i <= TEAMSIZE; i++) {
    if (i == mGoalieUnum)
      continue;
    iRole = mPlayerRole[i];
    if (iRole.mLineType == LT_Null)
      continue;
    if (iRole.mIndexX == 1) {
      mActiveField[i].SetLeft(MINX);
      mActiveField[i].SetRight(MAXX - mHInterval[1] - mHInterval[0]);
    } else if (iRole.mIndexX == 2) {
      mActiveField[i].SetLeft(MINX + mHInterval[0]);
      mActiveField[i].SetRight(MAXX - mHInterval[1]);
    } else if (iRole.mIndexX == 3) {
      mActiveField[i].SetLeft(MINX + mHInterval[0] + mHInterval[1]);
      mActiveField[i].SetRight(MAXX);
    }
    mActiveField[i].SetBottom(MAXY -
                              (mLineArrange[iRole.mIndexX] - iRole.mIndexY) *
                                  mVInterval[iRole.mIndexX]);
    mActiveField[i].SetTop(MINY + iRole.mIndexY * mVInterval[iRole.mIndexX]);
    //与中心的相互偏移
    if (iRole.mIndexX == 1) {
      mOffsetMatrix[0][i].SetX(-mHInterval[0]);
      mOffsetMatrix[i][0].SetX(mHInterval[0]);
    } else if (iRole.mIndexX == 2) {
      mOffsetMatrix[0][i].SetX(0);
      mOffsetMatrix[i][0].SetX(0);
    } else if (iRole.mIndexX == 3) {
      mOffsetMatrix[0][i].SetX(mHInterval[1]);
      mOffsetMatrix[i][0].SetX(-mHInterval[1]);
    }

    double iy = (iRole.mIndexY - mLineArrange[iRole.mIndexX] * 0.5) *
                mVInterval[iRole.mIndexX];
    mOffsetMatrix[0][i].SetY(iy);
    mOffsetMatrix[i][0].SetY(-iy);

    for (int j = 1; j < 11; j++) {
      if (j == mGoalieUnum || i == j)
        continue;
      jRole = mPlayerRole[j];
      if (jRole.mLineType == LT_Null)
        continue;
      //与其他队员的相互偏移
      if (iRole.mIndexX == 1) {
        if (jRole.mIndexX == 1) {
          mOffsetMatrix[i][j].SetX(0.0);
        } else if (jRole.mIndexX == 2) {
          mOffsetMatrix[i][j].SetX(mHInterval[0]);
        } else if (jRole.mIndexX == 3) {
          mOffsetMatrix[i][j].SetX(mHInterval[0] + mHInterval[1]);
        }
      } else if (iRole.mIndexX == 2) {
        if (jRole.mIndexX == 1) {
          mOffsetMatrix[i][j].SetX(-mHInterval[0]);
        } else if (jRole.mIndexX == 2) {
          mOffsetMatrix[i][j].SetX(0);
        } else if (jRole.mIndexX == 3) {
          mOffsetMatrix[i][j].SetX(mHInterval[1]);
        }
      } else if (iRole.mIndexX == 3) {
        if (jRole.mIndexX == 1) {
          mOffsetMatrix[i][j].SetX(-mHInterval[0] - mHInterval[1]);
        } else if (jRole.mIndexX == 2) {
          mOffsetMatrix[i][j].SetX(-mHInterval[1]);
        } else if (jRole.mIndexX == 3) {
          mOffsetMatrix[i][j].SetX(0.0);
        }
      }
      double jy = (jRole.mIndexY - (mLineArrange[jRole.mIndexX] + 1) * 0.5) *
                  mVInterval[jRole.mIndexX];
      mOffsetMatrix[i][j].SetY(jy - iy);
    }
  }
}

// Assembly:
cmpl $0x0, 0xce0(%rdi)
je 0x26dae
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0xce4(%rdi)
je 0x26da0
movsd 0x10(%rbx), %xmm0
addsd 0x18(%rbx), %xmm0
mulsd 0x44e8f(%rip), %xmm0    # 0x6b878
movsd 0x4548f(%rip), %xmm1    # 0x6be80
subsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
callq 0x4a75c
leaq 0x47512(%rip), %rax     # 0x6df18
movsd -0x30(%rbp), %xmm1
divsd (%rax), %xmm1
addsd %xmm1, %xmm1
xorpd %xmm0, %xmm0
maxsd %xmm0, %xmm1
movsd %xmm1, 0x50(%rbx)
movl 0x44(%rbx), %eax
decl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movl 0x48(%rbx), %eax
mulsd 0x28(%rbx), %xmm0
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x30(%rbx), %xmm1
movl 0x4c(%rbx), %eax
decl %eax
cvtsi2sd %eax, %xmm2
maxsd %xmm0, %xmm1
mulsd 0x38(%rbx), %xmm2
maxsd %xmm1, %xmm2
mulsd 0x44e18(%rip), %xmm2    # 0x6b878
movsd 0x45ba0(%rip), %xmm0    # 0x6c608
subsd %xmm2, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x4a75c
leaq 0x474a3(%rip), %rax     # 0x6df20
movsd -0x30(%rbp), %xmm0
divsd (%rax), %xmm0
addsd %xmm0, %xmm0
maxsd 0x445fe(%rip), %xmm0    # 0x6b090
movsd %xmm0, 0x58(%rbx)
movl 0xce8(%rbx), %eax
leaq 0x60(%rbx), %rcx
movsd 0x10(%rbx), %xmm9
movsd 0x18(%rbx), %xmm1
movsd 0x45b5c(%rip), %xmm2    # 0x6c610
addsd %xmm9, %xmm2
movapd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x453b2(%rip), %xmm4    # 0x6be80
subsd %xmm1, %xmm4
movapd %xmm4, %xmm5
subsd %xmm9, %xmm5
leaq 0x110(%rbx), %rdx
movapd 0x44536(%rip), %xmm6    # 0x6b020
movapd %xmm1, %xmm7
xorpd %xmm6, %xmm7
xorpd %xmm9, %xmm6
leaq 0x380(%rbx), %rsi
movapd %xmm6, %xmm8
subsd %xmm1, %xmm8
movapd %xmm9, %xmm3
addsd %xmm1, %xmm3
leaq 0x458(%rbx), %rdi
movq %rax, %r8
shlq $0x4, %r8
addq $-0x10, %r8
movl $0x1, %r9d
xorl %r10d, %r10d
movsd 0x45adb(%rip), %xmm10   # 0x6c610
movsd 0x45ada(%rip), %xmm11   # 0x6c618
movsd 0x44541(%rip), %xmm12   # 0x6b088
movapd 0x444d0(%rip), %xmm13   # 0x6b020
cmpq %rax, %r9
je 0x26d88
leaq -0x1(%r9), %r14
movq %r14, %r15
shlq $0x4, %r15
cmpl $-0x1, 0x8(%rcx,%r15)
je 0x26d88
movslq (%rcx,%r15), %r11
movl 0x4(%rcx,%r15), %r12d
movapd %xmm10, %xmm14
movapd %xmm5, %xmm0
cmpl $0x1, %r11d
je 0x26bad
cmpl $0x3, %r11d
je 0x26b9f
movapd %xmm2, %xmm14
movapd %xmm4, %xmm0
cmpl $0x2, %r11d
je 0x26bad
jmp 0x26bc1
movsd -0x30(%rbp), %xmm14
movsd 0x452d3(%rip), %xmm0    # 0x6be80
movq %r14, %r15
shlq $0x5, %r15
movsd %xmm14, (%rdx,%r15)
movsd %xmm0, 0x8(%rdx,%r15)
shlq $0x5, %r14
movl 0x40(%rbx,%r11,4), %r15d
movl %r15d, %r13d
subl %r12d, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
mulsd 0x20(%rbx,%r11,8), %xmm0
movsd 0x45a20(%rip), %xmm15   # 0x6c608
subsd %xmm0, %xmm15
xorps %xmm14, %xmm14
cvtsi2sd %r12d, %xmm14
movsd %xmm15, 0x18(%rdx,%r14)
movsd 0x20(%rbx,%r11,8), %xmm0
mulsd %xmm14, %xmm0
addsd %xmm11, %xmm0
movsd %xmm0, 0x10(%rdx,%r14)
movapd %xmm6, %xmm15
movapd %xmm9, %xmm0
cmpl $0x1, %r11d
je 0x26c45
cmpl $0x3, %r11d
je 0x26c3c
cmpl $0x2, %r11d
jne 0x26c60
xorpd %xmm15, %xmm15
xorpd %xmm0, %xmm0
jmp 0x26c45
movapd %xmm1, %xmm15
movapd %xmm7, %xmm0
movq %r9, %r14
shlq $0x4, %r14
movsd %xmm15, (%rsi,%r14)
leaq (%r9,%r9,2), %r14
shlq $0x6, %r14
movsd %xmm0, (%rsi,%r14)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
mulsd %xmm12, %xmm0
addsd %xmm0, %xmm14
mulsd 0x20(%rbx,%r11,8), %xmm14
movq %r9, %r14
shlq $0x4, %r14
movsd %xmm14, 0x8(%rsi,%r14)
leaq (%r9,%r9,2), %r14
shlq $0x6, %r14
movapd %xmm14, %xmm0
xorpd %xmm13, %xmm0
movlpd %xmm0, 0x8(%rsi,%r14)
xorl %r14d, %r14d
cmpq %r14, %r8
sete %r15b
cmpq %r14, %r10
sete %r12b
orb %r15b, %r12b
jne 0x26d77
cmpl $-0x1, 0x68(%rbx,%r14)
je 0x26d77
movslq 0x60(%rbx,%r14), %r15
movl 0x64(%rbx,%r14), %r12d
cmpl $0x3, %r11d
je 0x26d18
cmpl $0x2, %r11d
je 0x26cfa
cmpl $0x1, %r11d
jne 0x26d42
cmpl $0x1, %r15d
je 0x26d36
movapd %xmm3, %xmm15
cmpl $0x3, %r15d
je 0x26d3b
movapd %xmm9, %xmm15
jmp 0x26d2e
movapd %xmm6, %xmm15
cmpl $0x1, %r15d
je 0x26d3b
movapd %xmm1, %xmm15
cmpl $0x3, %r15d
je 0x26d3b
cmpl $0x2, %r15d
je 0x26d36
jmp 0x26d42
movapd %xmm8, %xmm15
cmpl $0x1, %r15d
je 0x26d3b
cmpl $0x3, %r15d
je 0x26d36
movapd %xmm7, %xmm15
cmpl $0x2, %r15d
je 0x26d3b
jmp 0x26d42
xorpd %xmm15, %xmm15
movsd %xmm15, -0x8(%rdi,%r14)
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movl 0x40(%rbx,%r15,4), %r12d
incl %r12d
xorps %xmm15, %xmm15
cvtsi2sd %r12d, %xmm15
mulsd %xmm12, %xmm15
addsd %xmm0, %xmm15
mulsd 0x20(%rbx,%r15,8), %xmm15
subsd %xmm14, %xmm15
movsd %xmm15, (%rdi,%r14)
addq $0x10, %r14
cmpq $0xa0, %r14
jne 0x26ca3
incq %r9
addq $0xc0, %rdi
addq $0x10, %r10
cmpq $0xc, %r9
jne 0x26b50
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop