// File: /workspace/github_cpp_makefile_star2_O1/wrighteagle2d[P]wrighteaglebase/Debug/../src/Trainer.cpp
// Function: Trainer::PrepareForTrain()
void Trainer::PrepareForTrain() {
  static uint i = 0;

  if (i == 0) {
    if (mpAgent->World().CurrentTime().T()) {
      std::cerr << "#" << PlayerParam::instance().teamName()
                << " Trainer: episode " << mTrainCount - 1 << " last "
                << mpAgent->World().CurrentTime().T() - mLastStopTime
                << " cycles" << std::endl;
    }

    std::cerr << "#" << PlayerParam::instance().teamName()
              << " Trainer: episode " << mTrainCount << " prepair @ "
              << mpAgent->World().CurrentTime() << std::endl;
  }

  mLastStopTime = mpAgent->World().CurrentTime().T();

  if (!mConverse)
    MoveBall(mBallStateList[i].first, mBallStateList[i].second);
  else
    MoveBall(-mBallStateList[i].first, -mBallStateList[i].second);

  for (std::vector<Trainer::PlayerState>::const_iterator it =
           mPlayerStatesList[i].begin();
       it != mPlayerStatesList[i].end(); it++) {
    if (!mConverse) {
      MovePlayer(it->mUnum, it->mPos, it->mVel, it->mBodyDir);
    } else {
      if (it->mUnum > 0) {
        MovePlayer(-mTm2Opp[it->mUnum], -it->mPos, -it->mVel,
                   GetNormalizeAngleDeg(-180 + it->mBodyDir));
      } else {
        MovePlayer(mOpp2Tm[-it->mUnum], -it->mPos, -it->mVel,
                   GetNormalizeAngleDeg(-180 + it->mBodyDir));
      }
    }
  }
  mpAgent->ChangePlayMode(mServerPlayModeList[i]);
  Recover();
  i++;

  if (i >= mPlayerStatesList.size()) {
    i = 0;
    mPrepared = true;
    std::cerr << "#" << PlayerParam::instance().teamName()
              << " Trainer: episode " << mTrainCount << " start @ "
              << mpAgent->World().CurrentTime() << std::endl;

    mTrainCount++;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x31854d(%rip)    # 0x36a0f0
jne 0x51d36
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
cmpl $0x0, 0x10(%rax)
je 0x51c86
movq 0x3542e(%rip), %r14     # 0x86ff0
leaq 0x1d312(%rip), %rsi     # 0x6eedb
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
callq 0x450ba
movq 0x3138(%rax), %rsi
movq 0x3140(%rax), %rdx
movq %r14, %rdi
callq 0x9560
movq %rax, %r14
leaq 0x1d602(%rip), %rsi     # 0x6f1fd
movl $0x12, %edx
movq %rax, %rdi
callq 0x9560
movl 0x9c(%rbx), %esi
decl %esi
movq %r14, %rdi
callq 0x9320
movq %rax, %r14
leaq 0x1d5ee(%rip), %rsi     # 0x6f210
movl $0x6, %edx
movq %rax, %rdi
callq 0x9560
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
movl 0x10(%rax), %esi
subl 0x194(%rbx), %esi
movq %r14, %rdi
callq 0x9320
movq %rax, %r14
leaq 0x1d5c5(%rip), %rsi     # 0x6f217
movl $0x7, %edx
movq %rax, %rdi
callq 0x9560
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %r14, %rdi
callq 0x9070
movq %rax, %rdi
callq 0x9330
movq 0x35363(%rip), %r14     # 0x86ff0
leaq 0x1d247(%rip), %rsi     # 0x6eedb
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
callq 0x450ba
movq 0x3138(%rax), %rsi
movq 0x3140(%rax), %rdx
movq %r14, %rdi
callq 0x9560
movq %rax, %r14
leaq 0x1d537(%rip), %rsi     # 0x6f1fd
movl $0x12, %edx
movq %rax, %rdi
callq 0x9560
movl 0x9c(%rbx), %esi
movq %r14, %rdi
callq 0x9320
movq %rax, %r14
leaq 0x1d534(%rip), %rsi     # 0x6f21f
movl $0xb, %edx
movq %rax, %rdi
callq 0x9560
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rsi
addq $0x10, %rsi
movq %r14, %rdi
callq 0xea74
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %r14, %rdi
callq 0x9070
movq %rax, %rdi
callq 0x9330
movq 0x18(%rbx), %rdi
movq 0x160(%rbx), %rcx
movq 0x18(%rdi), %rax
movl 0x10(%rax), %eax
movl %eax, 0x194(%rbx)
movl 0x31839c(%rip), %edx    # 0x36a0f0
shlq $0x5, %rdx
leaq (%rcx,%rdx), %rax
movsd (%rcx,%rdx), %xmm1
cmpb $0x0, 0x33(%rbx)
je 0x51dbc
movapd 0x192b1(%rip), %xmm0    # 0x6b020
xorpd %xmm0, %xmm1
movapd %xmm1, -0x50(%rbp)
movsd 0x8(%rax), %xmm2
movsd 0x10(%rax), %xmm3
movsd 0x18(%rax), %xmm4
xorpd %xmm0, %xmm2
movapd %xmm2, -0x40(%rbp)
xorpd %xmm0, %xmm3
movapd %xmm3, -0x30(%rbp)
xorpd %xmm0, %xmm4
movapd %xmm4, -0x20(%rbp)
callq 0xef28
movq %rax, %rdi
movaps -0x50(%rbp), %xmm0
movaps -0x40(%rbp), %xmm1
movaps -0x30(%rbp), %xmm2
movaps -0x20(%rbp), %xmm3
jmp 0x51dfa
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x18(%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
movapd %xmm1, -0x50(%rbp)
callq 0xef28
movq %rax, %rdi
movaps -0x50(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
movsd -0x30(%rbp), %xmm2
movsd -0x20(%rbp), %xmm3
callq 0xccb8
movl 0x3182eb(%rip), %eax    # 0x36a0f0
movq 0x120(%rbx), %rcx
leaq (%rax,%rax,2), %rdx
movq (%rcx,%rdx,8), %r14
cmpq 0x8(%rcx,%rdx,8), %r14
je 0x51f47
movsd 0x19239(%rip), %xmm5    # 0x6b060
movsd 0x19241(%rip), %xmm6    # 0x6b070
movsd 0x19211(%rip), %xmm7    # 0x6b048
movsd 0x19228(%rip), %xmm8    # 0x6b068
movl (%r14), %esi
cmpb $0x0, 0x33(%rbx)
je 0x51eac
movsd 0x8(%r14), %xmm0
movsd 0x10(%r14), %xmm1
movsd 0x18(%r14), %xmm2
movsd 0x20(%r14), %xmm3
movaps 0x191b8(%rip), %xmm4    # 0x6b020
xorps %xmm4, %xmm0
xorps %xmm4, %xmm1
xorps %xmm4, %xmm2
xorps %xmm4, %xmm3
movsd 0x28(%r14), %xmm4
addsd %xmm5, %xmm4
testl %esi, %esi
jle 0x51ecf
ucomisd %xmm4, %xmm5
jbe 0x51e9f
addsd %xmm6, %xmm4
ucomisd %xmm4, %xmm5
ja 0x51e88
xorl %eax, %eax
subl 0x34(%rbx,%rsi,4), %eax
movq %rbx, %rdi
movl %eax, %esi
jmp 0x51ef2
ucomisd %xmm7, %xmm4
jb 0x51e92
addsd %xmm8, %xmm4
jmp 0x51e9f
movsd 0x8(%r14), %xmm0
movsd 0x10(%r14), %xmm1
movsd 0x18(%r14), %xmm2
movsd 0x20(%r14), %xmm3
movsd 0x28(%r14), %xmm4
movq %rbx, %rdi
jmp 0x51ef2
ucomisd %xmm4, %xmm5
jbe 0x51f3a
addsd %xmm6, %xmm4
ucomisd %xmm4, %xmm5
ja 0x51ed5
movslq %esi, %rax
shlq $0x2, %rax
movq %rbx, %rcx
subq %rax, %rcx
movl 0x64(%rcx), %esi
movq %rbx, %rdi
callq 0x52310
addq $0x38, %r14
movl 0x3181ef(%rip), %eax    # 0x36a0f0
movq 0x120(%rbx), %rcx
leaq (%rax,%rax,2), %rdx
cmpq 0x8(%rcx,%rdx,8), %r14
movsd 0x19147(%rip), %xmm5    # 0x6b060
movsd 0x1914f(%rip), %xmm6    # 0x6b070
movsd 0x1911f(%rip), %xmm7    # 0x6b048
movsd 0x19136(%rip), %xmm8    # 0x6b068
jne 0x51e40
jmp 0x51f47
ucomisd %xmm7, %xmm4
jb 0x51edf
addsd %xmm8, %xmm4
jmp 0x51f3a
movq 0x18(%rbx), %rdi
movq 0x178(%rbx), %rcx
movl (%rcx,%rax,4), %r14d
callq 0xef28
movq %rax, %rdi
movl %r14d, %esi
callq 0xcbac
movq 0x18(%rbx), %rdi
callq 0xef28
movq %rax, %rdi
callq 0xcd54
movl 0x318173(%rip), %eax    # 0x36a0f0
incl %eax
movl %eax, 0x31816b(%rip)    # 0x36a0f0
movq 0x128(%rbx), %rcx
subq 0x120(%rbx), %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %rax, %rdx
ja 0x52072
movl $0x0, 0x318138(%rip)    # 0x36a0f0
movb $0x1, 0x31(%rbx)
movq 0x3502d(%rip), %r14     # 0x86ff0
leaq 0x1cf11(%rip), %rsi     # 0x6eedb
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
callq 0x450ba
movq 0x3138(%rax), %rsi
movq 0x3140(%rax), %rdx
movq %r14, %rdi
callq 0x9560
movq %rax, %r14
leaq 0x1d201(%rip), %rsi     # 0x6f1fd
movl $0x12, %edx
movq %rax, %rdi
callq 0x9560
movl 0x9c(%rbx), %esi
movq %r14, %rdi
callq 0x9320
movq %rax, %r14
leaq 0x1d20a(%rip), %rsi     # 0x6f22b
movl $0x9, %edx
movq %rax, %rdi
callq 0x9560
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rsi
addq $0x10, %rsi
movq %r14, %rdi
callq 0xea74
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %r14, %rdi
callq 0x9070
movq %rax, %rdi
callq 0x9330
incl 0x9c(%rbx)
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop