// File: /workspace/github_cpp_makefile_star2_O1/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 0x4f686
movb 0x4f(%r15), %r15b
movq %r14, %rdi
callq 0x4f6a2
testb %r15b, %r15b
jne 0x1c44e
leaq 0x4fca8(%rip), %r14     # 0x6c0b8
callq 0x55830
movq %rax, %rdi
movq %r14, %rsi
callq 0x55b22
movl $0x30d40, %edi          # imm = 0x30D40
callq 0x9690
movq 0x20(%rbx), %r12
leaq 0x20(%r12), %r15
movq %r15, %rdi
callq 0x4f686
movb 0x4f(%r12), %r12b
movq %r15, %rdi
callq 0x4f6a2
cmpb $0x1, %r12b
jne 0x1c410
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 0x450ba
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 0x1c4a5
movupd -0x58(%rbp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, -0x38(%rbp)
jmp 0x1c4b0
movq %r14, %rdi
movq %r15, %rdx
callq 0x1c99c
incq %r13
addq $0x3700, %r12           # imm = 0x3700
cmpq $0x12, %r13
jne 0x1c470
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %r15
cmpq %r15, %r14
je 0x1c4fa
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 0x1caea
movq %r14, %rdi
movq %r15, %rsi
callq 0x1cbf5
movl $0x1, %r14d
movl $0x36fa, %r12d          # imm = 0x36FA
xorl %r13d, %r13d
callq 0x450ba
movl 0x31a0(%rax), %eax
cmpq %rax, %r14
je 0x1c5ac
movq 0x8(%rbx), %r15
cmpb $0x1, (%r15,%r12)
jne 0x1c5ac
movq 0x18(%rbx), %rdi
movb 0x3382(%r15), %al
movb %al, 0x28(%rdi)
movq 0x1838(%r15), %rax
movq %rax, 0x2c(%rdi)
callq 0xef28
movq %rax, %rdi
movq %r15, %rsi
callq 0xd71a
movq 0x18(%rbx), %rdi
callq 0x1356e
movq 0x10(%rax), %rax
movslq 0x354(%rax,%r13,4), %rcx
shlq $0x4, %rcx
cmpl $0x3, 0x58(%rcx,%rax)
jne 0x1c599
movq 0x18(%rbx), %rdi
movq -0x38(%rbp), %rax
movl -0x10(%rax), %r15d
callq 0xef28
movq %rax, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0xca84
addq $-0x10, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x3d2b6
movl $0x1388, %edi           # imm = 0x1388
callq 0x9690
incq %r14
addq $0x178, %r12            # imm = 0x178
incq %r13
cmpq $0xb, %r13
jne 0x1c509
movl $0x1, %r14d
movl $0x36fa, %r12d          # imm = 0x36FA
xorl %r13d, %r13d
callq 0x450ba
movl 0x31a0(%rax), %eax
cmpq %rax, %r14
je 0x1c675
movq 0x8(%rbx), %r15
cmpb $0x1, (%r15,%r12)
jne 0x1c675
movq 0x18(%rbx), %rdi
movb 0x3382(%r15), %al
movb %al, 0x28(%rdi)
movq 0x1838(%r15), %rax
movq %rax, 0x2c(%rdi)
callq 0xef28
movq %rax, %rdi
movq %r15, %rsi
callq 0xd71a
movq 0x18(%rbx), %rdi
callq 0x1356e
movq 0x10(%rax), %rax
movslq 0x354(%rax,%r13,4), %rcx
shlq $0x4, %rcx
cmpl $0x1, 0x58(%rcx,%rax)
jne 0x1c662
movq 0x18(%rbx), %rdi
movq -0x38(%rbp), %rax
movl -0x10(%rax), %r15d
callq 0xef28
movq %rax, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0xca84
addq $-0x10, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x3d2b6
movl $0x1388, %edi           # imm = 0x1388
callq 0x9690
incq %r14
addq $0x178, %r12            # imm = 0x178
incq %r13
cmpq $0xb, %r13
jne 0x1c5d2
movq 0x8(%rbx), %r14
callq 0x450ba
movslq 0x31a0(%rax), %rax
imulq $0x178, %rax, %rax      # imm = 0x178
cmpb $0x1, 0x3582(%r14,%rax)
jne 0x1c7c7
movq -0x40(%rbp), %r14
cmpq -0x38(%rbp), %r14
je 0x1c721
xorpd %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
xorl %r13d, %r13d
callq 0x450ba
movq 0x5c38(%rax), %rax
movslq (%r14), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3030(%rax,%rcx), %xmm0
ucomisd -0x48(%rbp), %xmm0
jbe 0x1c715
callq 0x450ba
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 0x1c6c8
jmp 0x1c724
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 0xef28
movq %rax, %rdi
movq %r14, %rsi
callq 0xd71a
movq 0x18(%rbx), %r12
callq 0x450ba
movl 0x31a0(%rax), %r14d
movl (%r13), %r15d
movq %r12, %rdi
callq 0xef28
movq %rax, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0xca84
movq -0x38(%rbp), %rax
leaq 0x10(%r13), %rdx
cmpq %rax, %rdx
je 0x1c7bf
movq %rax, %rcx
subq %rdx, %rcx
sarq $0x4, %rcx
testq %rcx, %rcx
jle 0x1c7bf
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
jg 0x1c79e
addq $-0x10, %rax
movq %rax, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x3d2b6
movl $0x1, %r14d
movl $0x36fa, %r12d          # imm = 0x36FA
xorl %r13d, %r13d
callq 0x450ba
movl 0x31a0(%rax), %eax
cmpq %rax, %r14
je 0x1c882
movq 0x8(%rbx), %r15
cmpb $0x1, (%r15,%r12)
jne 0x1c882
movq 0x18(%rbx), %rdi
movb 0x3382(%r15), %al
movb %al, 0x28(%rdi)
movq 0x1838(%r15), %rax
movq %rax, 0x2c(%rdi)
callq 0xef28
movq %rax, %rdi
movq %r15, %rsi
callq 0xd71a
movq 0x18(%rbx), %rdi
callq 0x1356e
movq 0x10(%rax), %rax
movslq 0x354(%rax,%r13,4), %rcx
shlq $0x4, %rcx
cmpl $0x2, 0x58(%rcx,%rax)
jne 0x1c86f
movq 0x18(%rbx), %rdi
movq -0x38(%rbp), %rax
movl -0x10(%rax), %r15d
callq 0xef28
movq %rax, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0xca84
addq $-0x10, -0x38(%rbp)
movq 0x8(%rbx), %rdi
callq 0x3d2b6
movl $0x1388, %edi           # imm = 0x1388
callq 0x9690
incq %r14
addq $0x178, %r12            # imm = 0x178
incq %r13
cmpq $0xb, %r13
jne 0x1c7df
movl $0x30d40, %edi          # imm = 0x30D40
callq 0x9690
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x1c8b8
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 0x1c8d3
jmp 0x1c8d3
jmp 0x1c8d3
jmp 0x1c8d3
jmp 0x1c8d3
jmp 0x1c8d3
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x1c8eb
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq %rbx, %rdi
callq 0x98b0
nop