// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x400bb(%rip), %r14     # 0x58078
movq 0x20(%rbx), %rdi
callq 0x1839c
testb %al, %al
jne 0x17fe6
callq 0x471ac
movq %rax, %rdi
movq %r14, %rsi
callq 0x473e8
movl $0x30d40, %edi          # imm = 0x30D40
callq 0x96b0
jmp 0x17fbd
xorpd %xmm0, %xmm0
leaq -0x40(%rbp), %r14
andq $0x0, 0x10(%r14)
movapd %xmm0, (%r14)
xorl %r12d, %r12d
leaq -0x58(%rbp), %r15
xorl %r13d, %r13d
cmpq $0x12, %r13
je 0x1803e
callq 0x38d94
movq 0x5c38(%rax), %rax
movl %r13d, -0x58(%rbp)
movsd 0x3098(%rax,%r12), %xmm0
movsd %xmm0, -0x50(%rbp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x18440
incq %r13
addq $0x3700, %r12           # imm = 0x3700
jmp 0x18002
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x185d8
pushq $0x1
popq %r14
pushq $-0x2c
popq %r15
xorl %r12d, %r12d
testq %r15, %r15
je 0x180e5
callq 0x38d94
movl 0x31a0(%rax), %eax
cmpq %rax, %r14
je 0x180d2
movq 0x8(%rbx), %rsi
cmpb $0x1, 0x36fa(%rsi,%r12)
jne 0x180d2
movq 0x18(%rbx), %rdi
callq 0x17f12
movq 0x18(%rbx), %rdi
callq 0x10dfe
movq 0x10(%rax), %rax
movslq 0x380(%rax,%r15), %rcx
shlq $0x4, %rcx
cmpl $0x3, 0x58(%rcx,%rax)
jne 0x180bf
movq 0x18(%rbx), %rdi
movq -0x38(%rbp), %rax
movl -0x10(%rax), %edx
movl %r14d, %esi
callq 0x183c4
addq $-0x10, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x334d0
movl $0x1388, %edi           # imm = 0x1388
callq 0x96b0
incq %r14
addq $0x4, %r15
addq $0x178, %r12            # imm = 0x178
jmp 0x18056
pushq $0x1
popq %r14
pushq $-0x2c
popq %r15
xorl %r12d, %r12d
testq %r15, %r15
je 0x1817f
callq 0x38d94
movl 0x31a0(%rax), %eax
cmpq %rax, %r14
je 0x1816c
movq 0x8(%rbx), %rsi
cmpb $0x1, 0x36fa(%rsi,%r12)
jne 0x1816c
movq 0x18(%rbx), %rdi
callq 0x17f12
movq 0x18(%rbx), %rdi
callq 0x10dfe
movq 0x10(%rax), %rax
movslq 0x380(%rax,%r15), %rcx
shlq $0x4, %rcx
cmpl $0x1, 0x58(%rcx,%rax)
jne 0x18159
movq 0x18(%rbx), %rdi
movq -0x38(%rbp), %rax
movl -0x10(%rax), %edx
movl %r14d, %esi
callq 0x183c4
addq $-0x10, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x334d0
movl $0x1388, %edi           # imm = 0x1388
callq 0x96b0
incq %r14
addq $0x4, %r15
addq $0x178, %r12            # imm = 0x178
jmp 0x180f0
movq 0x8(%rbx), %r14
callq 0x38d94
movslq 0x31a0(%rax), %rax
imulq $0x178, %rax, %rax      # imm = 0x178
cmpb $0x1, 0x3582(%r14,%rax)
jne 0x18241
xorpd %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x40(%rbp), %r15
xorl %r14d, %r14d
cmpq -0x38(%rbp), %r15
je 0x1820e
callq 0x38d94
movq 0x5c38(%rax), %rax
movslq (%r15), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3030(%rax,%rcx), %xmm0
ucomisd -0x48(%rbp), %xmm0
jbe 0x18208
callq 0x38d94
movq 0x5c38(%rax), %rax
movslq (%r15), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3030(%rax,%rcx), %xmm0
movsd %xmm0, -0x48(%rbp)
movq %r15, %r14
addq $0x10, %r15
jmp 0x181b5
movq 0x8(%rbx), %rsi
movq 0x18(%rbx), %rdi
callq 0x17f12
movq 0x18(%rbx), %r15
callq 0x38d94
movl 0x31a0(%rax), %esi
movl (%r14), %edx
movq %r15, %rdi
callq 0x183c4
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x183e6
movq 0x8(%rbx), %rdi
callq 0x334d0
pushq $0x1
popq %r14
pushq $-0x2c
popq %r15
xorl %r12d, %r12d
testq %r15, %r15
je 0x182e4
callq 0x38d94
movl 0x31a0(%rax), %eax
cmpq %rax, %r14
je 0x182d1
movq 0x8(%rbx), %rsi
cmpb $0x1, 0x36fa(%rsi,%r12)
jne 0x182d1
movq 0x18(%rbx), %rdi
callq 0x17f12
movq 0x18(%rbx), %rdi
callq 0x10dfe
movq 0x10(%rax), %rax
movslq 0x380(%rax,%r15), %rcx
shlq $0x4, %rcx
cmpl $0x2, 0x58(%rcx,%rax)
jne 0x182be
movq 0x18(%rbx), %rdi
movq -0x38(%rbp), %rax
movl -0x10(%rax), %edx
movl %r14d, %esi
callq 0x183c4
addq $-0x10, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x334d0
movl $0x1388, %edi           # imm = 0x1388
callq 0x96b0
incq %r14
addq $0x4, %r15
addq $0x178, %r12            # imm = 0x178
jmp 0x18255
movl $0x30d40, %edi          # imm = 0x30D40
callq 0x96b0
leaq -0x40(%rbp), %rdi
callq 0x18402
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x18312
jmp 0x18312
jmp 0x18312
jmp 0x18312
jmp 0x18312
jmp 0x18312
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x18402
movq %rbx, %rdi
callq 0x98b0