// File: 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
subq $0x310, %rsp            # imm = 0x310
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x258(%rbp)
movsd 0xc90(%rax), %xmm0
movsd -0x10(%rbp), %xmm1
addsd -0x18(%rbp), %xmm1
movsd 0x86e12(%rip), %xmm2    # 0xc14b0
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x260(%rbp)
callq 0x855e0
movsd -0x260(%rbp), %xmm0
movq -0x258(%rbp), %rsi
leaq 0x8996f(%rip), %rax     # 0xc4038
divsd (%rax), %xmm0
movsd 0x86ddb(%rip), %xmm1    # 0xc14b0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsi)
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
addq $0x50, %rsi
leaq -0x20(%rbp), %rdi
callq 0x12a90
movq %rax, %rcx
movq -0x258(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x50(%rax)
leaq -0x30(%rbp), %rdi
callq 0x40300
leaq -0x40(%rbp), %rdi
callq 0x40300
movl $0x1, -0x44(%rbp)
cmpl $0xb, -0x44(%rbp)
jg 0x3b300
movq -0x258(%rbp), %rdi
addq $0x60, %rdi
leaq -0x44(%rbp), %rsi
callq 0x40240
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
cmpl $0x1, -0x30(%rbp)
jne 0x3a947
movq -0x258(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
leaq -0x44(%rbp), %rsi
callq 0x3fb70
movq %rax, %rdi
movq -0x258(%rbp), %rax
movsd 0xc90(%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x50(%rbp)
leaq -0x50(%rbp), %rsi
callq 0x40330
movq -0x258(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
leaq -0x44(%rbp), %rsi
callq 0x3fb70
movq -0x258(%rbp), %rdi
movq %rax, -0x278(%rbp)
movsd 0xc90(%rdi), %xmm0
movsd %xmm0, -0x288(%rbp)
addq $0x10, %rdi
movq $0x0, -0x60(%rbp)
leaq -0x60(%rbp), %rsi
callq 0x402c0
movsd -0x288(%rbp), %xmm0
movq -0x258(%rbp), %rdi
subsd (%rax), %xmm0
movsd %xmm0, -0x280(%rbp)
addq $0x10, %rdi
movq $0x1, -0x68(%rbp)
leaq -0x68(%rbp), %rsi
callq 0x402c0
movsd -0x280(%rbp), %xmm0
movq -0x278(%rbp), %rdi
subsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
leaq -0x58(%rbp), %rsi
callq 0x218a0
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movq $0x0, -0x70(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x44(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x3fb50
movq -0x258(%rbp), %rdi
movq %rax, -0x270(%rbp)
addq $0x10, %rdi
movq $0x0, -0x88(%rbp)
leaq -0x88(%rbp), %rsi
callq 0x402c0
movq -0x270(%rbp), %rdi
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x80(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x1ee90
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x90(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movq $0x0, -0x98(%rbp)
leaq -0x98(%rbp), %rsi
callq 0x3fb50
movq -0x258(%rbp), %rdi
movq %rax, -0x268(%rbp)
addq $0x10, %rdi
movq $0x0, -0xa0(%rbp)
leaq -0xa0(%rbp), %rsi
callq 0x402c0
movq -0x268(%rbp), %rdi
movq %rax, %rsi
callq 0x1ee90
jmp 0x3ad21
cmpl $0x2, -0x30(%rbp)
jne 0x3ab0d
movq -0x258(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
leaq -0x44(%rbp), %rsi
callq 0x3fb70
movq -0x258(%rbp), %rdi
movq %rax, -0x2a0(%rbp)
movsd 0xc90(%rdi), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x2a8(%rbp)
addq $0x10, %rdi
movq $0x0, -0xb0(%rbp)
leaq -0xb0(%rbp), %rsi
callq 0x402c0
movsd -0x2a8(%rbp), %xmm0
movq -0x2a0(%rbp), %rdi
addsd (%rax), %xmm0
movsd %xmm0, -0xa8(%rbp)
leaq -0xa8(%rbp), %rsi
callq 0x40330
movq -0x258(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
leaq -0x44(%rbp), %rsi
callq 0x3fb70
movq -0x258(%rbp), %rdi
movq %rax, -0x290(%rbp)
movsd 0xc90(%rdi), %xmm0
movsd %xmm0, -0x298(%rbp)
addq $0x10, %rdi
movq $0x1, -0xc0(%rbp)
leaq -0xc0(%rbp), %rsi
callq 0x402c0
movsd -0x298(%rbp), %xmm0
movq -0x290(%rbp), %rdi
subsd (%rax), %xmm0
movsd %xmm0, -0xb8(%rbp)
leaq -0xb8(%rbp), %rsi
callq 0x218a0
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movq $0x0, -0xc8(%rbp)
leaq -0xc8(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x44(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xd0(%rbp), %rsi
callq 0x3fb50
movq %rax, %rdi
xorps %xmm0, %xmm0
movsd %xmm0, -0xd8(%rbp)
leaq -0xd8(%rbp), %rsi
callq 0x1ee90
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0xe0(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movq $0x0, -0xe8(%rbp)
leaq -0xe8(%rbp), %rsi
callq 0x3fb50
movq %rax, %rdi
xorps %xmm0, %xmm0
movsd %xmm0, -0xf0(%rbp)
leaq -0xf0(%rbp), %rsi
callq 0x1ee90
jmp 0x3ad1f
cmpl $0x3, -0x30(%rbp)
jne 0x3ad1d
movq -0x258(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
leaq -0x44(%rbp), %rsi
callq 0x3fb70
movq -0x258(%rbp), %rdi
movq %rax, -0x2c0(%rbp)
movsd 0xc90(%rdi), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x2d0(%rbp)
addq $0x10, %rdi
movq $0x0, -0x100(%rbp)
leaq -0x100(%rbp), %rsi
callq 0x402c0
movsd -0x2d0(%rbp), %xmm0
movq -0x258(%rbp), %rdi
addsd (%rax), %xmm0
movsd %xmm0, -0x2c8(%rbp)
addq $0x10, %rdi
movq $0x1, -0x108(%rbp)
leaq -0x108(%rbp), %rsi
callq 0x402c0
movsd -0x2c8(%rbp), %xmm0
movq -0x2c0(%rbp), %rdi
addsd (%rax), %xmm0
movsd %xmm0, -0xf8(%rbp)
leaq -0xf8(%rbp), %rsi
callq 0x40330
movq -0x258(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
leaq -0x44(%rbp), %rsi
callq 0x3fb70
movq -0x258(%rbp), %rsi
movq %rax, %rdi
addq $0xc90, %rsi            # imm = 0xC90
callq 0x218a0
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movq $0x0, -0x110(%rbp)
leaq -0x110(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x44(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0x118(%rbp), %rsi
callq 0x3fb50
movq -0x258(%rbp), %rdi
movq %rax, -0x2b8(%rbp)
addq $0x10, %rdi
movq $0x1, -0x120(%rbp)
leaq -0x120(%rbp), %rsi
callq 0x402c0
movq -0x2b8(%rbp), %rdi
movq %rax, %rsi
callq 0x1ee90
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq -0x128(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movq $0x0, -0x130(%rbp)
leaq -0x130(%rbp), %rsi
callq 0x3fb50
movq -0x258(%rbp), %rdi
movq %rax, -0x2b0(%rbp)
addq $0x10, %rdi
movq $0x1, -0x140(%rbp)
leaq -0x140(%rbp), %rsi
callq 0x402c0
movq -0x2b0(%rbp), %rdi
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x138(%rbp)
leaq -0x138(%rbp), %rsi
callq 0x1ee90
jmp 0x3ad1f
jmp 0x3ad21
movl $0x1, -0x144(%rbp)
cmpl $0xb, -0x144(%rbp)
jg 0x3b2f0
movq -0x258(%rbp), %rdi
addq $0x60, %rdi
leaq -0x144(%rbp), %rsi
callq 0x40240
movq (%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x1, -0x30(%rbp)
jne 0x3af27
cmpl $0x1, -0x40(%rbp)
jne 0x3adcf
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x150(%rbp)
leaq -0x150(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x144(%rbp), %rax
movq %rax, -0x158(%rbp)
leaq -0x158(%rbp), %rsi
callq 0x3fb50
movq %rax, %rdi
xorps %xmm0, %xmm0
movsd %xmm0, -0x160(%rbp)
leaq -0x160(%rbp), %rsi
callq 0x1ee90
jmp 0x3af22
cmpl $0x2, -0x40(%rbp)
jne 0x3ae54
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0x168(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x144(%rbp), %rax
movq %rax, -0x170(%rbp)
leaq -0x170(%rbp), %rsi
callq 0x3fb50
movq -0x258(%rbp), %rdi
movq %rax, -0x2d8(%rbp)
addq $0x10, %rdi
movq $0x0, -0x178(%rbp)
leaq -0x178(%rbp), %rsi
callq 0x402c0
movq -0x2d8(%rbp), %rdi
movq %rax, %rsi
callq 0x1ee90
jmp 0x3af20
cmpl $0x3, -0x40(%rbp)
jne 0x3af1e
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x180(%rbp)
leaq -0x180(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x144(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x188(%rbp), %rsi
callq 0x3fb50
movq -0x258(%rbp), %rdi
movq %rax, -0x2e0(%rbp)
addq $0x10, %rdi
movq $0x0, -0x198(%rbp)
leaq -0x198(%rbp), %rsi
callq 0x402c0
movq -0x258(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x2e8(%rbp)
addq $0x10, %rdi
movq $0x1, -0x1a0(%rbp)
leaq -0x1a0(%rbp), %rsi
callq 0x402c0
movsd -0x2e8(%rbp), %xmm0
movq -0x2e0(%rbp), %rdi
addsd (%rax), %xmm0
movsd %xmm0, -0x190(%rbp)
leaq -0x190(%rbp), %rsi
callq 0x1ee90
jmp 0x3af20
jmp 0x3af22
jmp 0x3b2da
cmpl $0x2, -0x30(%rbp)
jne 0x3b0d1
cmpl $0x1, -0x40(%rbp)
jne 0x3afe1
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq -0x1a8(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x144(%rbp), %rax
movq %rax, -0x1b0(%rbp)
leaq -0x1b0(%rbp), %rsi
callq 0x3fb50
movq -0x258(%rbp), %rdi
movq %rax, -0x2f0(%rbp)
addq $0x10, %rdi
movq $0x0, -0x1c0(%rbp)
leaq -0x1c0(%rbp), %rsi
callq 0x402c0
movq -0x2f0(%rbp), %rdi
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x1b8(%rbp)
leaq -0x1b8(%rbp), %rsi
callq 0x1ee90
jmp 0x3b0cc
cmpl $0x2, -0x40(%rbp)
jne 0x3b048
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x1c8(%rbp)
leaq -0x1c8(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x144(%rbp), %rax
movq %rax, -0x1d0(%rbp)
leaq -0x1d0(%rbp), %rsi
callq 0x3fb50
movq %rax, %rdi
xorps %xmm0, %xmm0
movsd %xmm0, -0x1d8(%rbp)
leaq -0x1d8(%rbp), %rsi
callq 0x1ee90
jmp 0x3b0ca
cmpl $0x3, -0x40(%rbp)
jne 0x3b0c8
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x1e0(%rbp)
leaq -0x1e0(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x144(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq -0x1e8(%rbp), %rsi
callq 0x3fb50
movq -0x258(%rbp), %rdi
movq %rax, -0x2f8(%rbp)
addq $0x10, %rdi
movq $0x1, -0x1f0(%rbp)
leaq -0x1f0(%rbp), %rsi
callq 0x402c0
movq -0x2f8(%rbp), %rdi
movq %rax, %rsi
callq 0x1ee90
jmp 0x3b0ca
jmp 0x3b0cc
jmp 0x3b2d8
cmpl $0x3, -0x30(%rbp)
jne 0x3b2d6
cmpl $0x1, -0x40(%rbp)
jne 0x3b1c1
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x1f8(%rbp)
leaq -0x1f8(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x144(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0x200(%rbp), %rsi
callq 0x3fb50
movq -0x258(%rbp), %rdi
movq %rax, -0x300(%rbp)
addq $0x10, %rdi
movq $0x0, -0x210(%rbp)
leaq -0x210(%rbp), %rsi
callq 0x402c0
movq -0x258(%rbp), %rdi
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x308(%rbp)
addq $0x10, %rdi
movq $0x1, -0x218(%rbp)
leaq -0x218(%rbp), %rsi
callq 0x402c0
movsd -0x308(%rbp), %xmm0
movq -0x300(%rbp), %rdi
subsd (%rax), %xmm0
movsd %xmm0, -0x208(%rbp)
leaq -0x208(%rbp), %rsi
callq 0x1ee90
jmp 0x3b2d4
cmpl $0x2, -0x40(%rbp)
jne 0x3b26e
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x220(%rbp)
leaq -0x220(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x144(%rbp), %rax
movq %rax, -0x228(%rbp)
leaq -0x228(%rbp), %rsi
callq 0x3fb50
movq -0x258(%rbp), %rdi
movq %rax, -0x310(%rbp)
addq $0x10, %rdi
movq $0x1, -0x238(%rbp)
leaq -0x238(%rbp), %rsi
callq 0x402c0
movq -0x310(%rbp), %rdi
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x230(%rbp)
leaq -0x230(%rbp), %rsi
callq 0x1ee90
jmp 0x3b2d2
cmpl $0x3, -0x40(%rbp)
jne 0x3b2d0
movq -0x258(%rbp), %rdi
addq $0x380, %rdi            # imm = 0x380
movslq -0x44(%rbp), %rax
movq %rax, -0x240(%rbp)
leaq -0x240(%rbp), %rsi
callq 0x3fb30
movq %rax, %rdi
movslq -0x144(%rbp), %rax
movq %rax, -0x248(%rbp)
leaq -0x248(%rbp), %rsi
callq 0x3fb50
movq %rax, %rdi
xorps %xmm0, %xmm0
movsd %xmm0, -0x250(%rbp)
leaq -0x250(%rbp), %rsi
callq 0x1ee90
jmp 0x3b2d2
jmp 0x3b2d4
jmp 0x3b2d6
jmp 0x3b2d8
jmp 0x3b2da
jmp 0x3b2dc
movl -0x144(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x144(%rbp)
jmp 0x3ad2b
jmp 0x3b2f2
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3a71f
addq $0x310, %rsp            # imm = 0x310
popq %rbp
retq
nopl (%rax)