// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/Formation.cpp
// Function: TeammateFormation::SetHInterval(double, double)
void TeammateFormation::SetHInterval(double back_middle, double middle_front) {
  mHBallFactor = (m_FORMATION_MAX_X - (back_middle + middle_front) / 2.0) /
                 ServerParam::instance().PITCH_LENGTH * 2.0;
  mHBallFactor = Max(0.0, mHBallFactor);

  RoleType role_i, role_j;
  for (int i = 1; i <= TEAMSIZE; ++i) {
    role_i = mPlayerRole[i];
    if (role_i.mIndexX == 1) /** 后卫 */
    {
      mActiveField[i].SetLeft(-m_FORMATION_MAX_X);
      mActiveField[i].SetRight(m_FORMATION_MAX_X - mHInterval[0] -
                               mHInterval[1]);
      mOffsetMatrix[0][i].SetX(-mHInterval[0]);
      mOffsetMatrix[i][0].SetX(mHInterval[0]);
    } else if (role_i.mIndexX == 2) /** 中场 */
    {
      mActiveField[i].SetLeft(-m_FORMATION_MAX_X + mHInterval[0]);
      mActiveField[i].SetRight(m_FORMATION_MAX_X - mHInterval[1]);
      mOffsetMatrix[0][i].SetX(0.0);
      mOffsetMatrix[i][0].SetX(0.0);
    } else if (role_i.mIndexX == 3) /** 前锋 */
    {
      mActiveField[i].SetLeft(-m_FORMATION_MAX_X + mHInterval[0] +
                              mHInterval[1]);
      mActiveField[i].SetRight(m_FORMATION_MAX_X);
      mOffsetMatrix[0][i].SetX(mHInterval[1]);
      mOffsetMatrix[i][0].SetX(-mHInterval[1]);
    }

    for (int j = 1; j <= TEAMSIZE; ++j) {
      role_j = mPlayerRole[j];

      if (role_i.mIndexX == 1) {
        if (role_j.mIndexX == 1) {
          mOffsetMatrix[i][j].SetX(0.0);
        } else if (role_j.mIndexX == 2) {
          mOffsetMatrix[i][j].SetX(mHInterval[0]);
        } else if (role_j.mIndexX == 3) {
          mOffsetMatrix[i][j].SetX(mHInterval[0] + mHInterval[1]);
        }
      } else if (role_i.mIndexX == 2) {
        if (role_j.mIndexX == 1) {
          mOffsetMatrix[i][j].SetX(-mHInterval[0]);
        } else if (role_j.mIndexX == 2) {
          mOffsetMatrix[i][j].SetX(0.0);
        } else if (role_j.mIndexX == 3) {
          mOffsetMatrix[i][j].SetX(mHInterval[1]);
        }
      } else if (role_i.mIndexX == 3) {
        if (role_j.mIndexX == 1) {
          mOffsetMatrix[i][j].SetX(-mHInterval[0] - mHInterval[1]);
        } else if (role_j.mIndexX == 2) {
          mOffsetMatrix[i][j].SetX(-mHInterval[1]);
        } else if (role_j.mIndexX == 3) {
          mOffsetMatrix[i][j].SetX(0.0);
        }
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addsd %xmm1, %xmm0
mulsd 0x435d3(%rip), %xmm0    # 0x69088
addsd 0xc90(%rdi), %xmm0
movsd %xmm0, -0x10(%rbp)
callq 0x49360
leaq 0x4641a(%rip), %rax     # 0x6bee8
movsd -0x10(%rbp), %xmm1
divsd (%rax), %xmm1
addsd %xmm1, %xmm1
xorpd %xmm0, %xmm0
maxsd %xmm0, %xmm1
movsd %xmm1, 0x50(%rbx)
leaq 0x60(%rbx), %rax
leaq 0x380(%rbx), %rcx
movsd 0x10(%rbx), %xmm0
movsd 0x18(%rbx), %xmm1
movapd 0x4351b(%rip), %xmm2    # 0x69020
movapd %xmm1, %xmm3
xorpd %xmm2, %xmm3
movapd %xmm0, %xmm4
xorpd %xmm2, %xmm4
movapd %xmm4, %xmm5
subsd %xmm1, %xmm5
movapd %xmm0, %xmm6
addsd %xmm1, %xmm6
leaq 0x110(%rbx), %rdx
movsd 0xc90(%rbx), %xmm7
movapd %xmm0, %xmm8
subsd %xmm7, %xmm8
movapd %xmm8, %xmm9
addsd %xmm1, %xmm9
movapd %xmm7, %xmm10
subsd %xmm1, %xmm10
xorpd %xmm7, %xmm2
subsd %xmm0, %xmm7
subsd %xmm1, %xmm7
leaq 0x450(%rbx), %rsi
movl $0x1, %edi
leaq -0x1(%rdi), %r9
movq %r9, %r8
shlq $0x4, %r8
movl (%rax,%r8), %r8d
cmpl $0x3, %r8d
je 0x25bcb
cmpl $0x2, %r8d
je 0x25bad
cmpl $0x1, %r8d
jne 0x25c11
movq %r9, %r10
shlq $0x5, %r10
movsd %xmm2, (%rdx,%r10)
movapd %xmm7, %xmm12
movapd %xmm4, %xmm11
movapd %xmm0, %xmm13
jmp 0x25beb
movq %r9, %r10
shlq $0x5, %r10
movsd %xmm8, (%rdx,%r10)
xorpd %xmm11, %xmm11
movapd %xmm10, %xmm12
xorpd %xmm13, %xmm13
jmp 0x25beb
movq %r9, %r10
shlq $0x5, %r10
movsd %xmm9, (%rdx,%r10)
movsd 0xc90(%rbx), %xmm12
movapd %xmm1, %xmm11
movapd %xmm3, %xmm13
shlq $0x5, %r9
movsd %xmm12, 0x8(%rdx,%r9)
movq %rdi, %r9
shlq $0x4, %r9
movsd %xmm11, (%rcx,%r9)
leaq (%rdi,%rdi,2), %r9
shlq $0x6, %r9
movsd %xmm13, (%rcx,%r9)
xorl %r9d, %r9d
movl (%rax,%r9), %r10d
cmpl $0x3, %r8d
je 0x25c60
cmpl $0x2, %r8d
je 0x25c42
cmpl $0x1, %r8d
jne 0x25c89
cmpl $0x1, %r10d
je 0x25c7e
movapd %xmm6, %xmm11
cmpl $0x3, %r10d
je 0x25c83
movapd %xmm0, %xmm11
jmp 0x25c76
movapd %xmm4, %xmm11
cmpl $0x1, %r10d
je 0x25c83
movapd %xmm1, %xmm11
cmpl $0x3, %r10d
je 0x25c83
cmpl $0x2, %r10d
je 0x25c7e
jmp 0x25c89
movapd %xmm5, %xmm11
cmpl $0x1, %r10d
je 0x25c83
cmpl $0x3, %r10d
je 0x25c7e
movapd %xmm3, %xmm11
cmpl $0x2, %r10d
je 0x25c83
jmp 0x25c89
xorpd %xmm11, %xmm11
movsd %xmm11, (%rsi,%r9)
addq $0x10, %r9
cmpq $0xb0, %r9
jne 0x25c14
incq %rdi
addq $0xc0, %rsi
cmpq $0xc, %rdi
jne 0x25b6a
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop