// File: /workspace/github_cpp_makefile_star2_O3/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
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm0
maxsd %xmm3, %xmm0
movl 0x4c(%rdi), %eax
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd %xmm2, %xmm1
maxsd %xmm0, %xmm1
mulsd 0x43387(%rip), %xmm1    # 0x69088
addsd 0xc98(%rdi), %xmm1
movsd %xmm1, -0x18(%rbp)
callq 0x49360
leaq 0x461d6(%rip), %rax     # 0x6bef0
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 0x432d1(%rip), %xmm1    # 0x69020
xorpd %xmm0, %xmm1
leaq 0x380(%rbx), %rdx
leaq 0x458(%rbx), %rsi
movl $0x1, %edi
movsd 0x4331a(%rip), %xmm2    # 0x69088
movapd 0x432aa(%rip), %xmm3    # 0x69020
leaq -0x1(%rdi), %r9
movq %r9, %r10
shlq $0x4, %r10
movslq (%rax,%r10), %r8
movl 0x4(%rax,%r10), %r10d
leal -0x1(%r10), %r11d
xorps %xmm4, %xmm4
cvtsi2sd %r11d, %xmm4
mulsd 0x20(%rbx,%r8,8), %xmm4
shlq $0x5, %r9
addsd %xmm1, %xmm4
movsd %xmm4, 0x10(%rcx,%r9)
movl 0x40(%rbx,%r8,4), %r11d
movl %r11d, %r14d
subl %r10d, %r14d
xorps %xmm4, %xmm4
cvtsi2sd %r14d, %xmm4
mulsd 0x20(%rbx,%r8,8), %xmm4
movapd %xmm0, %xmm5
subsd %xmm4, %xmm5
movsd %xmm5, 0x18(%rcx,%r9)
xorps %xmm5, %xmm5
cvtsi2sd %r10d, %xmm5
incl %r11d
xorps %xmm4, %xmm4
cvtsi2sd %r11d, %xmm4
mulsd %xmm2, %xmm4
addsd %xmm5, %xmm4
mulsd 0x20(%rbx,%r8,8), %xmm4
movq %rdi, %r8
shlq $0x4, %r8
movsd %xmm4, 0x8(%rdx,%r8)
leaq (%rdi,%rdi,2), %r8
shlq $0x6, %r8
movapd %xmm4, %xmm5
xorpd %xmm3, %xmm5
movlpd %xmm5, 0x8(%rdx,%r8)
xorl %r8d, %r8d
movslq 0x60(%rbx,%r8), %r9
xorps %xmm5, %xmm5
cvtsi2sdl 0x64(%rbx,%r8), %xmm5
movl 0x40(%rbx,%r9,4), %r10d
incl %r10d
xorps %xmm6, %xmm6
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
cmpq $0xb0, %r8
jne 0x25e1f
incq %rdi
addq $0xc0, %rsi
cmpq $0xc, %rdi
jne 0x25d76
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop