// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/Formation.cpp
// Function: TeammateFormation::SetVInterval(double, double, double)
void TeammateFormation::SetVInterval(double back, double middle, double front) {
  double max_wide =
      Max(back * (mLineArrange[1] - 1), middle * (mLineArrange[2] - 1));
  max_wide = Max(max_wide, front * (mLineArrange[3] - 1));
  mVBallFactor = (m_FORMATION_MAX_Y - max_wide / 2.0) /
                 ServerParam::instance().PITCH_WIDTH * 2.0;
  mVBallFactor = Max(0.0, mVBallFactor);

  RoleType role_i, role_j;
  for (int i = 1; i <= TEAMSIZE; ++i) {
    role_i = mPlayerRole[i];
    mActiveField[i].SetTop(-m_FORMATION_MAX_Y +
                           (role_i.mIndexY - 1) * mVInterval[role_i.mIndexX]);
    mActiveField[i].SetBottom(m_FORMATION_MAX_Y -
                              (mLineArrange[role_i.mIndexX] - role_i.mIndexY) *
                                  mVInterval[role_i.mIndexX]);
    double iy = (role_i.mIndexY - (mLineArrange[role_i.mIndexX] + 1) / 2.0) *
                mVInterval[role_i.mIndexX];
    mOffsetMatrix[0][i].SetY(iy);
    mOffsetMatrix[i][0].SetY(-iy);

    for (int j = 1; j <= TEAMSIZE; ++j) {
      role_j = mPlayerRole[j];
      double jy = (role_j.mIndexY - (mLineArrange[role_j.mIndexX] + 1) / 2.0) *
                  mVInterval[role_j.mIndexX];
      mOffsetMatrix[i][j].SetY(jy - iy);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl 0x44(%rdi), %eax
movl 0x48(%rdi), %ecx
decl %eax
cvtsi2sd %eax, %xmm3
mulsd %xmm0, %xmm3
decl %ecx
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm0
maxsd %xmm3, %xmm0
movl 0x4c(%rdi), %eax
decl %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm2, %xmm1
maxsd %xmm0, %xmm1
mulsd 0x36ef7(%rip), %xmm1    # 0x57060
addsd 0xc98(%rdi), %xmm1
movsd %xmm1, -0x18(%rbp)
callq 0x3db2c
leaq 0x39d4e(%rip), %rax     # 0x59ed0
movsd -0x18(%rbp), %xmm1
divsd (%rax), %xmm1
addsd %xmm1, %xmm1
xorpd %xmm0, %xmm0
maxsd %xmm0, %xmm1
movsd %xmm1, 0x58(%rbx)
leaq 0x60(%rbx), %rax
leaq 0x110(%rbx), %rcx
movsd 0xc98(%rbx), %xmm0
movapd 0x36e69(%rip), %xmm1    # 0x57020
xorpd %xmm0, %xmm1
leaq 0x380(%rbx), %rdx
leaq 0x458(%rbx), %rsi
pushq $0x1
popq %rdi
movsd 0x36e8c(%rip), %xmm2    # 0x57060
movapd 0x36e44(%rip), %xmm3    # 0x57020
cmpq $0xc, %rdi
je 0x202d2
leaq -0x1(%rdi), %r9
movq %r9, %r10
shlq $0x4, %r10
movslq (%rax,%r10), %r8
movl 0x4(%rax,%r10), %r10d
leal -0x1(%r10), %r11d
cvtsi2sd %r11d, %xmm4
shlq $0x5, %r9
mulsd 0x20(%rbx,%r8,8), %xmm4
addsd %xmm1, %xmm4
movsd %xmm4, 0x10(%rcx,%r9)
movl 0x40(%rbx,%r8,4), %r11d
movl %r11d, %r14d
subl %r10d, %r14d
cvtsi2sd %r14d, %xmm4
mulsd 0x20(%rbx,%r8,8), %xmm4
movapd %xmm0, %xmm5
subsd %xmm4, %xmm5
cvtsi2sd %r10d, %xmm6
movsd %xmm5, 0x18(%rcx,%r9)
incl %r11d
cvtsi2sd %r11d, %xmm4
mulsd %xmm2, %xmm4
addsd %xmm6, %xmm4
mulsd 0x20(%rbx,%r8,8), %xmm4
movq %rdi, %r8
shlq $0x4, %r8
movsd %xmm4, 0x8(%rdx,%r8)
imulq $0xc0, %rdi, %r8
movapd %xmm4, %xmm5
xorpd %xmm3, %xmm5
movlpd %xmm5, 0x8(%rdx,%r8)
xorl %r8d, %r8d
cmpq $0xb0, %r8
je 0x202c3
movslq 0x60(%rbx,%r8), %r9
cvtsi2sdl 0x64(%rbx,%r8), %xmm5
movl 0x40(%rbx,%r9,4), %r10d
incl %r10d
cvtsi2sd %r10d, %xmm6
mulsd %xmm2, %xmm6
addsd %xmm5, %xmm6
mulsd 0x20(%rbx,%r9,8), %xmm6
subsd %xmm4, %xmm6
movsd %xmm6, (%rsi,%r8)
addq $0x10, %r8
jmp 0x20282
incq %rdi
addq $0xc0, %rsi
jmp 0x201dc
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop