// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/Formation.cpp
// Function: OpponentFormation::SetFormationRole()
void OpponentFormation::SetFormationRole() {
  mLineArrange[0] = 1;
  mLineArrange[1] = mLineMember[0].size();
  mLineArrange[2] = mLineMember[1].size();
  mLineArrange[3] = mLineMember[2].size();
  //建立位置索引
  //第一个是门将，索引(0,1)
  //其他队员
  int xidx;
  int yidx;
  int n;
  for (n = 1; n <= 11; n++)
    mPlayerRole[n].mLineType = LT_Null;
  for (xidx = 1; xidx <= 3; xidx++) {
    for (yidx = 1; yidx <= mLineArrange[xidx]; yidx++) {
      n = mLineMember[xidx - 1][yidx - 1]; // 得到号码
      if (n == mGoalieUnum) {
        mPos2Index[0][1] = n;
        mPlayerRole[mGoalieUnum].mIndexX = 0;
        mPlayerRole[mGoalieUnum].mIndexY = 1;
        mPlayerRole[mGoalieUnum].mLineType = LT_Goalie;
      } else {
        mPos2Index[xidx][yidx] = n;
        mPlayerRole[n].mIndexX = xidx;
        mPlayerRole[n].mIndexY = yidx;
        mPlayerRole[n].mLineType = LineType(xidx + 1);
        double midoffset = yidx - (mLineArrange[xidx] + 1) * 0.5;
        if (fabs(midoffset) < FLOAT_EPS) {
          mPlayerRole[n].mPositionType = PT_Middle;
        } else if (fabs(midoffset - 0.5) < FLOAT_EPS) {
          mPlayerRole[n].mPositionType = PT_RightMiddle;
        } else if (fabs(midoffset + 0.5) < FLOAT_EPS) {
          mPlayerRole[n].mPositionType = PT_LeftMiddle;
        } else if (fabs(midoffset - 1.25) < 0.25 + FLOAT_EPS) { // 1.5 or 1.0
          mPlayerRole[n].mPositionType = PT_Right;
        } else if (fabs(midoffset + 1.25) < 0.25 + FLOAT_EPS) { // 1.5 or 1.0
          mPlayerRole[n].mPositionType = PT_Left;
        } else if (midoffset > 2.0 - FLOAT_EPS) {
          mPlayerRole[n].mPositionType = PT_RightRight;
        } else {
          mPlayerRole[n].mPositionType = PT_LeftLeft;
        }
      }
    }
  }
}

// Assembly:
movl $0x1, 0x40(%rdi)
leaq 0xc90(%rdi), %rax
movq 0xc98(%rdi), %rcx
movq 0xcb0(%rdi), %rdx
subq 0xc90(%rdi), %rcx
shrq $0x2, %rcx
movl %ecx, 0x44(%rdi)
subq 0xca8(%rdi), %rdx
shrq $0x2, %rdx
movl %edx, 0x48(%rdi)
movq 0xcc8(%rdi), %rcx
subq 0xcc0(%rdi), %rcx
shrq $0x2, %rcx
movl %ecx, 0x4c(%rdi)
leaq 0x60(%rdi), %rcx
xorl %edx, %edx
movl $0xffffffff, 0x68(%rdi,%rdx) # imm = 0xFFFFFFFF
addq $0x10, %rdx
cmpq $0xb0, %rdx
jne 0x26055
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x274(%rdi), %rdx
movl $0x1, %esi
movabsq $0x100000000, %r8       # imm = 0x100000000
movsd 0x42ff5(%rip), %xmm0    # 0x69088
movapd 0x42f75(%rip), %xmm1    # 0x69010
movsd 0x42f9d(%rip), %xmm2    # 0x69040
movsd 0x437cd(%rip), %xmm3    # 0x69878
movsd 0x44525(%rip), %xmm4    # 0x6a5d8
movsd 0x44525(%rip), %xmm5    # 0x6a5e0
movsd 0x44525(%rip), %xmm6    # 0x6a5e8
movsd 0x44525(%rip), %xmm7    # 0x6a5f0
cmpl $0x0, 0x40(%rdi,%rsi,4)
jle 0x2622e
leaq (%rsi,%rsi,2), %r9
movq -0x18(%rax,%r9,8), %r10
leaq 0x1(%rsi), %r9
imulq $0x2c, %rsi, %r11
addq %rdx, %r11
xorl %ebx, %ebx
movl (%r10,%rbx,4), %r14d
movslq %r14d, %r14
cmpl 0xce8(%rdi), %r14d
jne 0x2611f
movl %r14d, 0x274(%rdi)
shlq $0x4, %r14
movq %r8, -0x10(%r14,%rcx)
movl $0x0, -0x8(%r14,%rcx)
movl 0x40(%rdi,%rsi,4), %r14d
jmp 0x2621a
movl %r14d, (%r11,%rbx,4)
shlq $0x4, %r14
leaq (%r14,%rcx), %r15
addq $-0x10, %r15
movl %esi, (%r15)
leal 0x1(%rbx), %r14d
movl %r14d, 0x4(%r15)
movl %r9d, 0x8(%r15)
xorps %xmm9, %xmm9
cvtsi2sd %r14d, %xmm9
movl 0x40(%rdi,%rsi,4), %r14d
leal 0x1(%r14), %r12d
xorps %xmm8, %xmm8
cvtsi2sd %r12d, %xmm8
mulsd %xmm0, %xmm8
addsd %xmm9, %xmm8
movapd %xmm8, %xmm9
andpd %xmm1, %xmm9
ucomisd %xmm9, %xmm2
jbe 0x26181
movl $0x2, 0xc(%r15)
jmp 0x2621a
movapd %xmm8, %xmm9
addsd %xmm0, %xmm9
andpd %xmm1, %xmm9
ucomisd %xmm9, %xmm2
jbe 0x261a1
movl $0x5, 0xc(%r15)
jmp 0x2621a
movapd %xmm8, %xmm9
addsd %xmm3, %xmm9
andpd %xmm1, %xmm9
ucomisd %xmm9, %xmm2
jbe 0x261c1
movl $0x6, 0xc(%r15)
jmp 0x2621a
movapd %xmm8, %xmm9
addsd %xmm4, %xmm9
andpd %xmm1, %xmm9
ucomisd %xmm9, %xmm5
jbe 0x261e1
movl $0x3, 0xc(%r15)
jmp 0x2621a
movapd %xmm8, %xmm9
addsd %xmm6, %xmm9
andpd %xmm1, %xmm9
ucomisd %xmm9, %xmm5
jbe 0x26201
movl $0x1, 0xc(%r15)
jmp 0x2621a
ucomisd %xmm7, %xmm8
jbe 0x26212
movl $0x4, 0xc(%r15)
jmp 0x2621a
movl $0x7, 0xc(%r15)
movslq %r14d, %r14
incq %rbx
cmpq %r14, %rbx
jl 0x260ec
movq %r9, %rsi
jmp 0x26234
incq %rsi
movq %rsi, %r9
cmpq $0x4, %r9
jne 0x260cb
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop