// File: /workspace/github_cpp_makefile_star2_O3/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
movq 0x20(%rdi), %r15
leaq 0x20(%r15), %r14
movq %r14, %rdi
callq 0x4e01a
movb 0x4f(%r15), %r15b
movq %r14, %rdi
callq 0x4e036
testb %r15b, %r15b
jne 0x1c0a2
leaq 0x4e054(%rip), %r14     # 0x6a0b8
callq 0x54038
movq %rax, %rdi
movq %r14, %rsi
callq 0x5432c
movl $0x30d40, %edi          # imm = 0x30D40
callq 0x9690
movq 0x20(%rbx), %r12
leaq 0x20(%r12), %r15
movq %r15, %rdi
callq 0x4e01a
movb 0x4f(%r12), %r12b
movq %r15, %rdi
callq 0x4e036
cmpb $0x1, %r12b
jne 0x1c064
xorpd %xmm0, %xmm0
leaq -0x40(%rbp), %r14
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movl $0x3098, %r12d          # imm = 0x3098
xorl %r13d, %r13d
leaq -0x58(%rbp), %r15
callq 0x43dce
movq 0x5c38(%rax), %rax
movl %r13d, -0x58(%rbp)
movsd (%rax,%r12), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x1c0f9
movupd -0x58(%rbp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, -0x38(%rbp)
jmp 0x1c104
movq %r14, %rdi
movq %r15, %rdx
callq 0x1c5f0
incq %r13
addq $0x3700, %r12           # imm = 0x3700
cmpq $0x12, %r13
jne 0x1c0c4
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %r15
cmpq %r15, %r14
je 0x1c14e
movq %r15, %rax
subq %r14, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1c73e
movq %r14, %rdi
movq %r15, %rsi
callq 0x1c849
movl $0x1, %r14d
movl $0x36fa, %r12d          # imm = 0x36FA
xorl %r13d, %r13d
callq 0x43dce
movl 0x31a0(%rax), %eax
cmpq %rax, %r14
je 0x1c200
movq 0x8(%rbx), %r15
cmpb $0x1, (%r15,%r12)
jne 0x1c200
movq 0x18(%rbx), %rdi
movb 0x3382(%r15), %al
movb %al, 0x28(%rdi)
movq 0x1838(%r15), %rax
movq %rax, 0x2c(%rdi)
callq 0xee28
movq %rax, %rdi
movq %r15, %rsi
callq 0xd632
movq 0x18(%rbx), %rdi
callq 0x13432
movq 0x10(%rax), %rax
movslq 0x354(%rax,%r13,4), %rcx
shlq $0x4, %rcx
cmpl $0x3, 0x58(%rcx,%rax)
jne 0x1c1ed
movq 0x18(%rbx), %rdi
movq -0x38(%rbp), %rax
movl -0x10(%rax), %r15d
callq 0xee28
movq %rax, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0xc9b4
addq $-0x10, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x3c2e6
movl $0x1388, %edi           # imm = 0x1388
callq 0x9690
incq %r14
addq $0x178, %r12            # imm = 0x178
incq %r13
cmpq $0xb, %r13
jne 0x1c15d
movl $0x1, %r14d
movl $0x36fa, %r12d          # imm = 0x36FA
xorl %r13d, %r13d
callq 0x43dce
movl 0x31a0(%rax), %eax
cmpq %rax, %r14
je 0x1c2c9
movq 0x8(%rbx), %r15
cmpb $0x1, (%r15,%r12)
jne 0x1c2c9
movq 0x18(%rbx), %rdi
movb 0x3382(%r15), %al
movb %al, 0x28(%rdi)
movq 0x1838(%r15), %rax
movq %rax, 0x2c(%rdi)
callq 0xee28
movq %rax, %rdi
movq %r15, %rsi
callq 0xd632
movq 0x18(%rbx), %rdi
callq 0x13432
movq 0x10(%rax), %rax
movslq 0x354(%rax,%r13,4), %rcx
shlq $0x4, %rcx
cmpl $0x1, 0x58(%rcx,%rax)
jne 0x1c2b6
movq 0x18(%rbx), %rdi
movq -0x38(%rbp), %rax
movl -0x10(%rax), %r15d
callq 0xee28
movq %rax, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0xc9b4
addq $-0x10, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x3c2e6
movl $0x1388, %edi           # imm = 0x1388
callq 0x9690
incq %r14
addq $0x178, %r12            # imm = 0x178
incq %r13
cmpq $0xb, %r13
jne 0x1c226
movq 0x8(%rbx), %r14
callq 0x43dce
movslq 0x31a0(%rax), %rax
imulq $0x178, %rax, %rax      # imm = 0x178
cmpb $0x1, 0x3582(%r14,%rax)
jne 0x1c41b
movq -0x40(%rbp), %r14
cmpq -0x38(%rbp), %r14
je 0x1c375
xorpd %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
xorl %r13d, %r13d
callq 0x43dce
movq 0x5c38(%rax), %rax
movslq (%r14), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3030(%rax,%rcx), %xmm0
ucomisd -0x48(%rbp), %xmm0
jbe 0x1c369
callq 0x43dce
movq 0x5c38(%rax), %rax
movslq (%r14), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3030(%rax,%rcx), %xmm0
movsd %xmm0, -0x48(%rbp)
movq %r14, %r13
addq $0x10, %r14
cmpq -0x38(%rbp), %r14
jne 0x1c31c
jmp 0x1c378
xorl %r13d, %r13d
movq 0x8(%rbx), %r14
movq 0x18(%rbx), %rdi
movb 0x3382(%r14), %al
movb %al, 0x28(%rdi)
movq 0x1838(%r14), %rax
movq %rax, 0x2c(%rdi)
callq 0xee28
movq %rax, %rdi
movq %r14, %rsi
callq 0xd632
movq 0x18(%rbx), %r12
callq 0x43dce
movl 0x31a0(%rax), %r14d
movl (%r13), %r15d
movq %r12, %rdi
callq 0xee28
movq %rax, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0xc9b4
movq -0x38(%rbp), %rax
leaq 0x10(%r13), %rdx
cmpq %rax, %rdx
je 0x1c413
movq %rax, %rcx
subq %rdx, %rcx
sarq $0x4, %rcx
testq %rcx, %rcx
jle 0x1c413
incq %rcx
addq $0x18, %r13
movl -0x8(%r13), %edx
movl %edx, -0x18(%r13)
movsd (%r13), %xmm0
movsd %xmm0, -0x10(%r13)
decq %rcx
addq $0x10, %r13
cmpq $0x1, %rcx
ja 0x1c3f2
addq $-0x10, %rax
movq %rax, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x3c2e6
movl $0x1, %r14d
movl $0x36fa, %r12d          # imm = 0x36FA
xorl %r13d, %r13d
callq 0x43dce
movl 0x31a0(%rax), %eax
cmpq %rax, %r14
je 0x1c4d6
movq 0x8(%rbx), %r15
cmpb $0x1, (%r15,%r12)
jne 0x1c4d6
movq 0x18(%rbx), %rdi
movb 0x3382(%r15), %al
movb %al, 0x28(%rdi)
movq 0x1838(%r15), %rax
movq %rax, 0x2c(%rdi)
callq 0xee28
movq %rax, %rdi
movq %r15, %rsi
callq 0xd632
movq 0x18(%rbx), %rdi
callq 0x13432
movq 0x10(%rax), %rax
movslq 0x354(%rax,%r13,4), %rcx
shlq $0x4, %rcx
cmpl $0x2, 0x58(%rcx,%rax)
jne 0x1c4c3
movq 0x18(%rbx), %rdi
movq -0x38(%rbp), %rax
movl -0x10(%rax), %r15d
callq 0xee28
movq %rax, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0xc9b4
addq $-0x10, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x3c2e6
movl $0x1388, %edi           # imm = 0x1388
callq 0x9690
incq %r14
addq $0x178, %r12            # imm = 0x178
incq %r13
cmpq $0xb, %r13
jne 0x1c433
movl $0x30d40, %edi          # imm = 0x30D40
callq 0x9690
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x1c50c
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1c527
jmp 0x1c527
jmp 0x1c527
jmp 0x1c527
jmp 0x1c527
jmp 0x1c527
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x1c53f
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq %rbx, %rdi
callq 0x98b0
nop