// File: /workspace/github_cpp_makefile_star2_O2/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
cmpq $0xb0, %rdx
je 0x2042d
orl $-0x1, 0x68(%rdi,%rdx)
addq $0x10, %rdx
jmp 0x20419
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x2a0(%rdi), %rdx
movabsq $0x1, %rsi
movabsq $0x100000000, %r8       # imm = 0x100000000
movsd 0x36c05(%rip), %xmm0    # 0x57060
movapd 0x36bad(%rip), %xmm1    # 0x57010
movsd 0x36bd5(%rip), %xmm2    # 0x57040
movsd 0x373d5(%rip), %xmm3    # 0x57848
movsd 0x3812d(%rip), %xmm4    # 0x585a8
movsd 0x3812d(%rip), %xmm5    # 0x585b0
movsd 0x3812d(%rip), %xmm6    # 0x585b8
movsd 0x3812d(%rip), %xmm7    # 0x585c0
movq %rsi, %r9
cmpq $0x4, %r9
je 0x205f6
imulq $0x18, %r9, %r10
leaq (%r10,%rax), %r11
addq $-0x18, %r11
leaq 0x1(%r9), %r10
xorl %ebx, %ebx
movq %rsi, %r14
movslq 0x40(%rdi,%r9,4), %r15
cmpq %r15, %r14
jg 0x205ea
movq (%r11), %r15
movl (%r15,%rbx), %r15d
movslq %r15d, %r15
cmpl 0xce8(%rdi), %r15d
jne 0x204f1
movl %r15d, 0x274(%rdi)
shlq $0x4, %r15
movq %r8, -0x10(%r15,%rcx)
andl $0x0, -0x8(%r15,%rcx)
jmp 0x205de
movl %r15d, (%rdx,%rbx)
shlq $0x4, %r15
addq %rcx, %r15
addq $-0x10, %r15
movl %r9d, (%r15)
movl %r14d, 0x4(%r15)
movl %r10d, 0x8(%r15)
cvtsi2sd %r14d, %xmm9
movl 0x40(%rdi,%r9,4), %r12d
incl %r12d
cvtsi2sd %r12d, %xmm8
mulsd %xmm0, %xmm8
addsd %xmm9, %xmm8
movapd %xmm8, %xmm9
andpd %xmm1, %xmm9
ucomisd %xmm9, %xmm2
jbe 0x20545
movl $0x2, 0xc(%r15)
jmp 0x205de
movapd %xmm8, %xmm9
addsd %xmm0, %xmm9
andpd %xmm1, %xmm9
ucomisd %xmm9, %xmm2
jbe 0x20565
movl $0x5, 0xc(%r15)
jmp 0x205de
movapd %xmm8, %xmm9
addsd %xmm3, %xmm9
andpd %xmm1, %xmm9
ucomisd %xmm9, %xmm2
jbe 0x20585
movl $0x6, 0xc(%r15)
jmp 0x205de
movapd %xmm8, %xmm9
addsd %xmm4, %xmm9
andpd %xmm1, %xmm9
ucomisd %xmm9, %xmm5
jbe 0x205a5
movl $0x3, 0xc(%r15)
jmp 0x205de
movapd %xmm8, %xmm9
addsd %xmm6, %xmm9
andpd %xmm1, %xmm9
ucomisd %xmm9, %xmm5
jbe 0x205c5
movl $0x1, 0xc(%r15)
jmp 0x205de
ucomisd %xmm7, %xmm8
jbe 0x205d6
movl $0x4, 0xc(%r15)
jmp 0x205de
movl $0x7, 0xc(%r15)
incq %r14
addq $0x4, %rbx
jmp 0x204b5
addq $0x2c, %rdx
movq %r10, %r9
jmp 0x20496
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop