// File: /workspace/github_cpp_makefile_star2_O1/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 0x44e59(%rip), %xmm0    # 0x6b088
addsd 0xc90(%rdi), %xmm0
movsd %xmm0, -0x10(%rbp)
callq 0x4a75c
leaq 0x47cd0(%rip), %rax     # 0x6df18
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 0x44da1(%rip), %xmm2    # 0x6b020
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
movl $0x1, %esi
leaq -0x1(%rsi), %r8
movq %r8, %rdi
shlq $0x4, %rdi
movl (%rax,%rdi), %edi
cmpl $0x3, %edi
je 0x2633c
cmpl $0x2, %edi
je 0x2631d
cmpl $0x1, %edi
jne 0x2637e
shlq $0x5, %r8
leaq (%rdx,%r8), %r9
movsd %xmm2, (%rdx,%r8)
movapd %xmm7, %xmm12
movapd %xmm4, %xmm11
movapd %xmm0, %xmm13
jmp 0x2635d
shlq $0x5, %r8
leaq (%rdx,%r8), %r9
movsd %xmm8, (%rdx,%r8)
xorpd %xmm11, %xmm11
movapd %xmm10, %xmm12
xorpd %xmm13, %xmm13
jmp 0x2635d
shlq $0x5, %r8
leaq (%rdx,%r8), %r9
movsd %xmm9, (%rdx,%r8)
movsd 0xc90(%rbx), %xmm12
movapd %xmm1, %xmm11
movapd %xmm3, %xmm13
movsd %xmm12, 0x8(%r9)
movq %rsi, %r8
shlq $0x4, %r8
movsd %xmm11, (%rcx,%r8)
leaq (%rsi,%rsi,2), %r8
shlq $0x6, %r8
movsd %xmm13, (%rcx,%r8)
movq %rsi, %r8
shlq $0x6, %r8
leaq (%r8,%r8,2), %r8
addq %rcx, %r8
xorl %r9d, %r9d
movl (%rax,%r9), %r10d
cmpl $0x3, %edi
je 0x263d8
cmpl $0x2, %edi
je 0x263ba
cmpl $0x1, %edi
jne 0x26402
cmpl $0x1, %r10d
je 0x263f6
movapd %xmm6, %xmm11
cmpl $0x3, %r10d
je 0x263fb
movapd %xmm0, %xmm11
jmp 0x263ee
movapd %xmm4, %xmm11
cmpl $0x1, %r10d
je 0x263fb
movapd %xmm1, %xmm11
cmpl $0x3, %r10d
je 0x263fb
cmpl $0x2, %r10d
je 0x263f6
jmp 0x26402
movapd %xmm5, %xmm11
cmpl $0x1, %r10d
je 0x263fb
cmpl $0x3, %r10d
je 0x263f6
movapd %xmm3, %xmm11
cmpl $0x2, %r10d
je 0x263fb
jmp 0x26402
xorpd %xmm11, %xmm11
movsd %xmm11, 0x10(%r8,%r9)
addq $0x10, %r9
cmpq $0xb0, %r9
jne 0x2638f
incq %rsi
cmpq $0xc, %rsi
jne 0x262dd
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop