// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/Coach.cpp
// Function: Coach::SendOptionToServer()
void Coach::SendOptionToServer() {
  while (!mpParser->IsEyeOnOk()) {
    UDPSocket::instance().Send("(eye on)");
    WaitFor(200);
  }
  vector<pair<int, double>> a;
  for (int i = 0; i <= 17;
       ++i) { //这里的18不知道如何去引用PlayerParam::DEFAULT_PLAYER_TYPES
    a.push_back(pair<int, double>(
        i, PlayerParam::instance().HeteroPlayer(i).effectiveSpeedMax()));
  }
  sort(a.begin(), a.end(), PlayerCompare());
  for (int i = 1; i <= TEAMSIZE; ++i) {
    if (i != PlayerParam::instance().ourGoalieUnum() &&
        mpObserver->Teammate_Fullstate(i).IsAlive()) {
      mpAgent->CheckCommands(mpObserver);
      if (mpAgent->GetFormation().GetTeammateRoleType(i).mLineType ==
          LT_Forward) {
        mpAgent->ChangePlayerType(i, a.back().first);
        a.pop_back();
      }
      mpObserver->SetCommandSend();
      WaitFor(5);
    }
  }
  for (int i = 1; i <= TEAMSIZE; ++i) {
    if (i != PlayerParam::instance().ourGoalieUnum() &&
        mpObserver->Teammate_Fullstate(i).IsAlive()) {
      mpAgent->CheckCommands(mpObserver);
      if (mpAgent->GetFormation().GetTeammateRoleType(i).mLineType ==
          LT_Defender) {
        mpAgent->ChangePlayerType(i, a.back().first);
        a.pop_back();
      }
      mpObserver->SetCommandSend();
      WaitFor(5);
    }
  }
  if (mpObserver->Teammate_Fullstate(PlayerParam::instance().ourGoalieUnum())
          .IsAlive()) {
    double maxAcceleration = 0;
    vector<pair<int, double>>::iterator goalie;
    for (vector<pair<int, double>>::iterator it = a.begin(); it != a.end();
         it++) {
      if (PlayerParam::instance().HeteroPlayer((*it).first).dashPowerRate() >
          maxAcceleration) {
        maxAcceleration =
            PlayerParam::instance().HeteroPlayer((*it).first).dashPowerRate();
        goalie = it;
      }
    }
    mpAgent->CheckCommands(mpObserver);
    mpAgent->ChangePlayerType(PlayerParam::instance().ourGoalieUnum(),
                              (*goalie).first);
    a.erase(goalie);
  }

  mpObserver->SetCommandSend();
  for (int i = 1; i <= TEAMSIZE; ++i) {
    if (i != PlayerParam::instance().ourGoalieUnum() &&
        mpObserver->Teammate_Fullstate(i).IsAlive()) {
      mpAgent->CheckCommands(mpObserver);
      if (mpAgent->GetFormation().GetPlayerRoleType(i).mLineType ==
          LT_Midfielder) {
        mpAgent->ChangePlayerType(i, a.back().first);
        a.pop_back();
      }
      mpObserver->SetCommandSend();
      WaitFor(5);
    }
  }

  /** check whether each player's type is changed OK */
  WaitFor(200);
  /*	for (int i = 1; i <= TEAMSIZE; ++i)
      {
          if (i != PlayerParam::instance().ourGoalieUnum() &&
     mpObserver->Teammate_Fullstate(i).IsAlive())
          {
              while (!mpParser->IsChangePlayerTypeOk(i) &&
     mpObserver->CurrentTime().T() < 1)
              {
                              mpAgent->CheckCommands(mpObserver);
                              mpAgent->ChangePlayerType(i, i);
                              mpObserver->SetCommandSend();
                  WaitFor(200);
                      }
          }
          }
          */
  /*	a.clear();
          for (int i=1 ;i <= 18 ; ++i){
     //这里的18不知道如何去引用PlayerParam::DEFAULT_PLAYER_TYPES
                  a.push_back(pair<int ,
     double>(i,PlayerParam::instance().HeteroPlayer(i).kickRand()));
          }
          for (int i = 1; i <= TEAMSIZE; ++i)
      {
          if (i != PlayerParam::instance().ourGoalieUnum() &&
     mpObserver->Teammate_Fullstate(i).IsAlive())
          {
                  mpAgent->CheckCommands(mpObserver);
                  if(mpAgent->GetFormation().GetPlayerRoleType(i).mLineType==LT_Forward)
                          mpAgent->ChangePlayerType(i, a.back().first);
              mpObserver->SetCommandSend();
              WaitFor(5);
          }
          }
          for (int i = 1; i <= TEAMSIZE; ++i)
      {
          if (i != PlayerParam::instance().ourGoalieUnum() &&
     mpObserver->Teammate_Fullstate(i).IsAlive())
          {
                  mpAgent->CheckCommands(mpObserver);
                  if(mpAgent->GetFormation().GetPlayerRoleType(i).mLineType==LT_Defender)
                          mpAgent->ChangePlayerType(i, a.back().first);
              mpObserver->SetCommandSend();
              WaitFor(5);
          }
          }
          for (int i = 1; i <= TEAMSIZE; ++i)
      {
          if (i != PlayerParam::instance().ourGoalieUnum() &&
     mpObserver->Teammate_Fullstate(i).IsAlive())
          {
                  mpAgent->CheckCommands(mpObserver);
                  if(mpAgent->GetFormation().GetPlayerRoleType(i).mLineType==LT_Midfielder)
                          mpAgent->ChangePlayerType(i, a.back().first);
              mpObserver->SetCommandSend();
              WaitFor(5);
          }
          }*/
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x293a0
xorb $-0x1, %al
testb $0x1, %al
jne 0x28b82
jmp 0x28ba2
callq 0x9e170
movq %rax, %rdi
leaq 0x994b7(%rip), %rsi     # 0xc2048
callq 0x9e4c0
movl $0xc8, %edi
callq 0x28840
jmp 0x28b6a
leaq -0x20(%rbp), %rdi
callq 0x293e0
movl $0x0, -0x24(%rbp)
cmpl $0x11, -0x24(%rbp)
jg 0x28c44
callq 0x798a0
movq %rax, -0xb8(%rbp)
jmp 0x28bca
movq -0xb8(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x129d0
movq %rax, -0xc0(%rbp)
jmp 0x28be3
movq -0xc0(%rbp), %rdi
callq 0x29430
movq %rax, -0xc8(%rbp)
jmp 0x28bf8
movq -0xc8(%rbp), %rdx
leaq -0x38(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x29450
jmp 0x28c0e
leaq -0x20(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x29400
jmp 0x28c1d
jmp 0x28c1f
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x28bb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x29810
jmp 0x292ff
leaq -0x20(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x294c0
movq -0xd0(%rbp), %rdi
movq %rax, -0x50(%rbp)
callq 0x294f0
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x29480
jmp 0x28c77
movl $0x1, -0x60(%rbp)
cmpl $0xb, -0x60(%rbp)
jg 0x28dcf
movl -0x60(%rbp), %eax
movl %eax, -0xdc(%rbp)
callq 0x798a0
movq %rax, -0xd8(%rbp)
jmp 0x28c9f
movq -0xd8(%rbp), %rdi
callq 0x29520
movq %rax, -0xe8(%rbp)
jmp 0x28cb4
movl -0xdc(%rbp), %eax
movq -0xe8(%rbp), %rcx
cmpl (%rcx), %eax
je 0x28dbf
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x60(%rbp), %esi
callq 0x29540
movq %rax, -0xf0(%rbp)
jmp 0x28ce5
movq -0xf0(%rbp), %rdi
callq 0x23f20
movb %al, -0xf1(%rbp)
jmp 0x28cf9
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x28d08
jmp 0x28dbf
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x18(%rax), %rdi
callq 0x28990
jmp 0x28d1e
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1a4c0
movq %rax, -0x100(%rbp)
jmp 0x28d37
movq -0x100(%rbp), %rdi
movl -0x60(%rbp), %esi
callq 0x29570
movq %rax, -0x108(%rbp)
jmp 0x28d4f
movq -0x108(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x28d9f
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x118(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x10c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x295e0
movq -0x118(%rbp), %rdi
movl -0x10c(%rbp), %esi
movl (%rax), %edx
callq 0x295a0
jmp 0x28d96
leaq -0x20(%rbp), %rdi
callq 0x29620
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6d960
jmp 0x28db1
movl $0x5, %edi
callq 0x28840
jmp 0x28dbd
jmp 0x28dbf
jmp 0x28dc1
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x28c7e
movl $0x1, -0x64(%rbp)
cmpl $0xb, -0x64(%rbp)
jg 0x28f27
movl -0x64(%rbp), %eax
movl %eax, -0x124(%rbp)
callq 0x798a0
movq %rax, -0x120(%rbp)
jmp 0x28df7
movq -0x120(%rbp), %rdi
callq 0x29520
movq %rax, -0x130(%rbp)
jmp 0x28e0c
movl -0x124(%rbp), %eax
movq -0x130(%rbp), %rcx
cmpl (%rcx), %eax
je 0x28f17
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x64(%rbp), %esi
callq 0x29540
movq %rax, -0x138(%rbp)
jmp 0x28e3d
movq -0x138(%rbp), %rdi
callq 0x23f20
movb %al, -0x139(%rbp)
jmp 0x28e51
movb -0x139(%rbp), %al
testb $0x1, %al
jne 0x28e60
jmp 0x28f17
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x18(%rax), %rdi
callq 0x28990
jmp 0x28e76
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1a4c0
movq %rax, -0x148(%rbp)
jmp 0x28e8f
movq -0x148(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x29570
movq %rax, -0x150(%rbp)
jmp 0x28ea7
movq -0x150(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x28ef7
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x160(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x154(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x295e0
movq -0x160(%rbp), %rdi
movl -0x154(%rbp), %esi
movl (%rax), %edx
callq 0x295a0
jmp 0x28eee
leaq -0x20(%rbp), %rdi
callq 0x29620
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6d960
jmp 0x28f09
movl $0x5, %edi
callq 0x28840
jmp 0x28f15
jmp 0x28f17
jmp 0x28f19
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x28dd6
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x170(%rbp)
callq 0x798a0
movq %rax, -0x168(%rbp)
jmp 0x28f47
movq -0x168(%rbp), %rdi
callq 0x29520
movq %rax, -0x178(%rbp)
jmp 0x28f5c
movq -0x170(%rbp), %rdi
movq -0x178(%rbp), %rax
movl (%rax), %esi
callq 0x29540
movq %rax, -0x180(%rbp)
jmp 0x28f7a
movq -0x180(%rbp), %rdi
callq 0x23f20
movb %al, -0x181(%rbp)
jmp 0x28f8e
movb -0x181(%rbp), %al
testb $0x1, %al
jne 0x28f9d
jmp 0x2915f
xorps %xmm0, %xmm0
movsd %xmm0, -0x70(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x29650
leaq -0x20(%rbp), %rdi
callq 0x294c0
movq %rax, -0x80(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x294f0
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x29670
testb $0x1, %al
jne 0x28fe4
jmp 0x290af
callq 0x798a0
movq %rax, -0x190(%rbp)
jmp 0x28ff2
leaq -0x80(%rbp), %rdi
callq 0x296b0
movq -0x190(%rbp), %rdi
movq %rax, %rsi
callq 0x129d0
movq %rax, -0x198(%rbp)
jmp 0x29013
movq -0x198(%rbp), %rdi
callq 0x12fc0
movq %rax, -0x1a0(%rbp)
jmp 0x29028
movq -0x1a0(%rbp), %rax
movsd (%rax), %xmm0
ucomisd -0x70(%rbp), %xmm0
jbe 0x29096
callq 0x798a0
movq %rax, -0x1a8(%rbp)
jmp 0x29048
leaq -0x80(%rbp), %rdi
callq 0x296b0
movq -0x1a8(%rbp), %rdi
movq %rax, %rsi
callq 0x129d0
movq %rax, -0x1b0(%rbp)
jmp 0x29069
movq -0x1b0(%rbp), %rdi
callq 0x12fc0
movq %rax, -0x1b8(%rbp)
jmp 0x2907e
movq -0x1b8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x29098
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
callq 0x296d0
movq %rax, -0x90(%rbp)
jmp 0x28fbb
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x18(%rax), %rdi
callq 0x28990
jmp 0x290c5
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x1c8(%rbp)
callq 0x798a0
movq %rax, -0x1c0(%rbp)
jmp 0x290e5
movq -0x1c0(%rbp), %rdi
callq 0x29520
movq %rax, -0x1d0(%rbp)
jmp 0x290fa
movq -0x1d0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1d4(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x296b0
movq -0x1c8(%rbp), %rdi
movl -0x1d4(%rbp), %esi
movl (%rax), %edx
callq 0x295a0
jmp 0x29128
leaq -0x98(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x29780
movq -0x98(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x29710
movq %rax, -0x1e0(%rbp)
jmp 0x29151
movq -0x1e0(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6d960
jmp 0x29171
movl $0x1, -0xa4(%rbp)
cmpl $0xb, -0xa4(%rbp)
jg 0x292e1
movl -0xa4(%rbp), %eax
movl %eax, -0x1ec(%rbp)
callq 0x798a0
movq %rax, -0x1e8(%rbp)
jmp 0x291a2
movq -0x1e8(%rbp), %rdi
callq 0x29520
movq %rax, -0x1f8(%rbp)
jmp 0x291b7
movl -0x1ec(%rbp), %eax
movq -0x1f8(%rbp), %rcx
cmpl (%rcx), %eax
je 0x292cb
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0xa4(%rbp), %esi
callq 0x29540
movq %rax, -0x200(%rbp)
jmp 0x291eb
movq -0x200(%rbp), %rdi
callq 0x23f20
movb %al, -0x201(%rbp)
jmp 0x291ff
movb -0x201(%rbp), %al
testb $0x1, %al
jne 0x2920e
jmp 0x292cb
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x18(%rax), %rdi
callq 0x28990
jmp 0x29224
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1a4c0
movq %rax, -0x210(%rbp)
jmp 0x2923d
movq -0x210(%rbp), %rdi
movl -0xa4(%rbp), %esi
callq 0x297c0
movq %rax, -0x218(%rbp)
jmp 0x29258
movq -0x218(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x292ab
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x228(%rbp)
movl -0xa4(%rbp), %eax
movl %eax, -0x21c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x295e0
movq -0x228(%rbp), %rdi
movl -0x21c(%rbp), %esi
movl (%rax), %edx
callq 0x295a0
jmp 0x292a2
leaq -0x20(%rbp), %rdi
callq 0x29620
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6d960
jmp 0x292bd
movl $0x5, %edi
callq 0x28840
jmp 0x292c9
jmp 0x292cb
jmp 0x292cd
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x2917b
movl $0xc8, %edi
callq 0x28840
jmp 0x292ed
leaq -0x20(%rbp), %rdi
callq 0x29810
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0xaa60
nopl (%rax,%rax)