// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/Formation.cpp
// Function: TeammateFormation::SetTeammateRole()
void TeammateFormation::SetTeammateRole() {
  for (int i = 1; i <= TEAMSIZE; ++i) {
    mPlayerRole[i].mLineType = LineType(mPlayerRole[i].mIndexX);

    /** 确定mPositionType */
    double midoffset = mPlayerRole[i].mIndexY -
                       (mLineArrange[mPlayerRole[i].mIndexX] + 1) * 0.5;
    if (fabs(midoffset) < FLOAT_EPS) {
      mPlayerRole[i].mPositionType = PT_Middle;
    } else if (fabs(midoffset - 0.5) < FLOAT_EPS) {
      mPlayerRole[i].mPositionType = PT_RightMiddle;
    } else if (fabs(midoffset + 0.5) < FLOAT_EPS) {
      mPlayerRole[i].mPositionType = PT_LeftMiddle;
    } else if (fabs(midoffset - 1.25) < 0.25 + FLOAT_EPS) { // 1.5 or 1.0
      mPlayerRole[i].mPositionType = PT_Right;
    } else if (fabs(midoffset + 1.25) < 0.25 + FLOAT_EPS) { // 1.5 or 1.0
      mPlayerRole[i].mPositionType = PT_Left;
    } else if (midoffset > 2.0 - FLOAT_EPS) {
      mPlayerRole[i].mPositionType = PT_RightRight;
    } else {
      mPlayerRole[i].mPositionType = PT_LeftLeft;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x1, -0xc(%rbp)
cmpl $0xb, -0xc(%rbp)
jg 0x3a652
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movq -0x28(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movl -0x3c(%rbp), %ecx
movq -0x28(%rbp), %rdi
movl %ecx, 0x8(%rax)
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movq -0x28(%rbp), %rdi
cvtsi2sdl 0x4(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq %rdi, %rax
addq $0x40, %rax
movq %rax, -0x38(%rbp)
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movq -0x38(%rbp), %rdi
movslq (%rax), %rax
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rsi
callq 0x40280
movsd -0x30(%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 0x86b86(%rip), %xmm2    # 0xc1020
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm1
movaps 0x86bad(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x86b49(%rip), %xmm0    # 0xc1008
ucomisd %xmm1, %xmm0
jbe 0x3a4e2
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movl $0x2, 0xc(%rax)
jmp 0x3a642
movsd -0x18(%rbp), %xmm1
movsd 0x86b31(%rip), %xmm0    # 0xc1020
subsd %xmm0, %xmm1
movaps 0x86b66(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x86b02(%rip), %xmm0    # 0xc1008
ucomisd %xmm1, %xmm0
jbe 0x3a529
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movl $0x5, 0xc(%rax)
jmp 0x3a640
movsd 0x86aef(%rip), %xmm1    # 0xc1020
addsd -0x18(%rbp), %xmm1
movaps 0x86b23(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x86abf(%rip), %xmm0    # 0xc1008
ucomisd %xmm1, %xmm0
jbe 0x3a56c
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movl $0x6, 0xc(%rax)
jmp 0x3a63e
movsd -0x18(%rbp), %xmm1
movsd 0x87faf(%rip), %xmm0    # 0xc2528
subsd %xmm0, %xmm1
movaps 0x86adc(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x87f90(%rip), %xmm0    # 0xc2520
ucomisd %xmm1, %xmm0
jbe 0x3a5b3
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movl $0x3, 0xc(%rax)
jmp 0x3a63c
movsd 0x87f6d(%rip), %xmm1    # 0xc2528
addsd -0x18(%rbp), %xmm1
movaps 0x86a99(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x87f4d(%rip), %xmm0    # 0xc2520
ucomisd %xmm1, %xmm0
jbe 0x3a5f3
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movl $0x1, 0xc(%rax)
jmp 0x3a63a
movsd -0x18(%rbp), %xmm0
movsd 0x87f30(%rip), %xmm1    # 0xc2530
ucomisd %xmm1, %xmm0
jbe 0x3a620
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movl $0x4, 0xc(%rax)
jmp 0x3a638
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
leaq -0xc(%rbp), %rsi
callq 0x40240
movl $0x7, 0xc(%rax)
jmp 0x3a63a
jmp 0x3a63c
jmp 0x3a63e
jmp 0x3a640
jmp 0x3a642
jmp 0x3a644
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3a3eb
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)