// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
addq $0x40, %rdi
movq $0x0, -0x10(%rbp)
leaq -0x10(%rbp), %rsi
callq 0x40280
movq -0xa0(%rbp), %rdi
movl $0x1, (%rax)
addq $0xc90, %rdi            # imm = 0xC90
movq $0x0, -0x18(%rbp)
leaq -0x18(%rbp), %rsi
callq 0x40460
movq %rax, %rdi
callq 0x1d7a0
movq -0xa0(%rbp), %rdi
movl %eax, -0xa8(%rbp)
addq $0x40, %rdi
movq $0x1, -0x20(%rbp)
leaq -0x20(%rbp), %rsi
callq 0x40280
movl -0xa8(%rbp), %ecx
movq -0xa0(%rbp), %rdi
movl %ecx, (%rax)
addq $0xc90, %rdi            # imm = 0xC90
movq $0x1, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x40460
movq %rax, %rdi
callq 0x1d7a0
movq -0xa0(%rbp), %rdi
movl %eax, -0xa4(%rbp)
addq $0x40, %rdi
movq $0x2, -0x30(%rbp)
leaq -0x30(%rbp), %rsi
callq 0x40280
movl -0xa4(%rbp), %ecx
movq -0xa0(%rbp), %rdi
movl %ecx, (%rax)
addq $0xc90, %rdi            # imm = 0xC90
movq $0x2, -0x38(%rbp)
leaq -0x38(%rbp), %rsi
callq 0x40460
movq %rax, %rdi
callq 0x1d7a0
movq -0xa0(%rbp), %rdi
movl %eax, -0x94(%rbp)
addq $0x40, %rdi
movq $0x3, -0x40(%rbp)
leaq -0x40(%rbp), %rsi
callq 0x40280
movl -0x94(%rbp), %ecx
movl %ecx, (%rax)
movl $0x1, -0x4c(%rbp)
cmpl $0xb, -0x4c(%rbp)
jg 0x3bccb
movq -0xa0(%rbp), %rdi
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3bc9f
movl $0x1, -0x44(%rbp)
cmpl $0x3, -0x44(%rbp)
jg 0x3c11e
movl $0x1, -0x48(%rbp)
movq -0xa0(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, -0xac(%rbp)
addq $0x40, %rdi
movslq -0x44(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0x58(%rbp), %rsi
callq 0x40280
movq %rax, %rcx
movl -0xac(%rbp), %eax
cmpl (%rcx), %eax
jg 0x3c10e
movq -0xa0(%rbp), %rdi
addq $0xc90, %rdi            # imm = 0xC90
movl -0x44(%rbp), %eax
subl $0x1, %eax
cltq
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rsi
callq 0x40460
movq %rax, %rdi
movl -0x48(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x1f260
movq -0xa0(%rbp), %rcx
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl 0xce8(%rcx), %eax
jne 0x3be13
movq -0xa0(%rbp), %rdi
movl -0x4c(%rbp), %eax
movl %eax, -0xb0(%rbp)
addq $0x270, %rdi            # imm = 0x270
movq $0x0, -0x68(%rbp)
leaq -0x68(%rbp), %rsi
callq 0x3faf0
movq %rax, %rdi
movq $0x1, -0x70(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x3fb10
movl -0xb0(%rbp), %ecx
movq -0xa0(%rbp), %rsi
movl %ecx, (%rax)
movq %rsi, %rdi
addq $0x60, %rdi
addq $0xce8, %rsi            # imm = 0xCE8
callq 0x40240
movq -0xa0(%rbp), %rsi
movl $0x0, (%rax)
movq %rsi, %rdi
addq $0x60, %rdi
addq $0xce8, %rsi            # imm = 0xCE8
callq 0x40240
movq -0xa0(%rbp), %rsi
movl $0x1, 0x4(%rax)
movq %rsi, %rdi
addq $0x60, %rdi
addq $0xce8, %rsi            # imm = 0xCE8
callq 0x40240
movl $0x0, 0x8(%rax)
jmp 0x3c0fe
movq -0xa0(%rbp), %rdi
movl -0x4c(%rbp), %eax
movl %eax, -0xc8(%rbp)
addq $0x270, %rdi            # imm = 0x270
movslq -0x44(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x3faf0
movq %rax, %rdi
movslq -0x48(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x3fb10
movl -0xc8(%rbp), %ecx
movq -0xa0(%rbp), %rdi
movl %ecx, (%rax)
movl -0x44(%rbp), %eax
movl %eax, -0xc4(%rbp)
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl -0xc4(%rbp), %ecx
movq -0xa0(%rbp), %rdi
movl %ecx, (%rax)
movl -0x48(%rbp), %eax
movl %eax, -0xc0(%rbp)
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl -0xc0(%rbp), %ecx
movq -0xa0(%rbp), %rdi
movl %ecx, 0x4(%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl -0xbc(%rbp), %ecx
movq -0xa0(%rbp), %rdi
movl %ecx, 0x8(%rax)
cvtsi2sdl -0x48(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
addq $0x40, %rdi
movslq -0x44(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x90(%rbp), %rsi
callq 0x40280
movsd -0xb8(%rbp), %xmm1
movl (%rax), %eax
addl $0x1, %eax
cvtsi2sd %eax, %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x850f6(%rip), %xmm2    # 0xc1020
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x88(%rbp), %xmm1
movaps 0x85117(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x850b3(%rip), %xmm0    # 0xc1008
ucomisd %xmm1, %xmm0
jbe 0x3bf7b
movq -0xa0(%rbp), %rdi
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl $0x2, 0xc(%rax)
jmp 0x3c0fc
movsd -0x88(%rbp), %xmm1
movsd 0x85095(%rip), %xmm0    # 0xc1020
subsd %xmm0, %xmm1
movaps 0x850ca(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x85066(%rip), %xmm0    # 0xc1008
ucomisd %xmm1, %xmm0
jbe 0x3bfc8
movq -0xa0(%rbp), %rdi
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl $0x5, 0xc(%rax)
jmp 0x3c0fa
movsd 0x85050(%rip), %xmm1    # 0xc1020
addsd -0x88(%rbp), %xmm1
movaps 0x85081(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x8501d(%rip), %xmm0    # 0xc1008
ucomisd %xmm1, %xmm0
jbe 0x3c011
movq -0xa0(%rbp), %rdi
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl $0x6, 0xc(%rax)
jmp 0x3c0f8
movsd -0x88(%rbp), %xmm1
movsd 0x86507(%rip), %xmm0    # 0xc2528
subsd %xmm0, %xmm1
movaps 0x85034(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x864e8(%rip), %xmm0    # 0xc2520
ucomisd %xmm1, %xmm0
jbe 0x3c05e
movq -0xa0(%rbp), %rdi
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl $0x3, 0xc(%rax)
jmp 0x3c0f6
movsd 0x864c2(%rip), %xmm1    # 0xc2528
addsd -0x88(%rbp), %xmm1
movaps 0x84feb(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x8649f(%rip), %xmm0    # 0xc2520
ucomisd %xmm1, %xmm0
jbe 0x3c0a4
movq -0xa0(%rbp), %rdi
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl $0x1, 0xc(%rax)
jmp 0x3c0f4
movsd -0x88(%rbp), %xmm0
movsd 0x8647c(%rip), %xmm1    # 0xc2530
ucomisd %xmm1, %xmm0
jbe 0x3c0d7
movq -0xa0(%rbp), %rdi
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl $0x4, 0xc(%rax)
jmp 0x3c0f2
movq -0xa0(%rbp), %rdi
addq $0x60, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x40240
movl $0x7, 0xc(%rax)
jmp 0x3c0f4
jmp 0x3c0f6
jmp 0x3c0f8
jmp 0x3c0fa
jmp 0x3c0fc
jmp 0x3c0fe
jmp 0x3c100
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x3bce3
jmp 0x3c110
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3bcd2
addq $0xd0, %rsp
popq %rbp
retq
nopw (%rax,%rax)