// File: /workspace/github_cpp_makefile_star2_O3/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, 0x316c0d(%rip)    # 0x3670f0
jne 0x50676
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
cmpl $0x0, 0x10(%rax)
je 0x505c6
movq 0x33aee(%rip), %r14     # 0x83ff0
leaq 0x1c9a2(%rip), %rsi     # 0x6ceab
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
callq 0x43dce
movq 0x3138(%rax), %rsi
movq 0x3140(%rax), %rdx
movq %r14, %rdi
callq 0x9560
movq %rax, %r14
leaq 0x1cc92(%rip), %rsi     # 0x6d1cd
movl $0x12, %edx
movq %rax, %rdi
callq 0x9560
movl 0x9c(%rbx), %esi
decl %esi
movq %r14, %rdi
callq 0x9320
movq %rax, %r14
leaq 0x1cc7e(%rip), %rsi     # 0x6d1e0
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 0x1cc55(%rip), %rsi     # 0x6d1e7
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 0x33a23(%rip), %r14     # 0x83ff0
leaq 0x1c8d7(%rip), %rsi     # 0x6ceab
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
callq 0x43dce
movq 0x3138(%rax), %rsi
movq 0x3140(%rax), %rdx
movq %r14, %rdi
callq 0x9560
movq %rax, %r14
leaq 0x1cbc7(%rip), %rsi     # 0x6d1cd
movl $0x12, %edx
movq %rax, %rdi
callq 0x9560
movl 0x9c(%rbx), %esi
movq %r14, %rdi
callq 0x9320
movq %rax, %r14
leaq 0x1cbc4(%rip), %rsi     # 0x6d1ef
movl $0xb, %edx
movq %rax, %rdi
callq 0x9560
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rsi
addq $0x10, %rsi
movq %r14, %rdi
callq 0xe974
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 0x316a5c(%rip), %edx    # 0x3670f0
shlq $0x5, %rdx
leaq (%rcx,%rdx), %rax
movsd (%rcx,%rdx), %xmm1
cmpb $0x0, 0x33(%rbx)
je 0x506fc
movapd 0x18971(%rip), %xmm0    # 0x69020
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 0xee28
movq %rax, %rdi
movaps -0x50(%rbp), %xmm0
movaps -0x40(%rbp), %xmm1
movaps -0x30(%rbp), %xmm2
movaps -0x20(%rbp), %xmm3
jmp 0x5073a
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 0xee28
movq %rax, %rdi
movaps -0x50(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
movsd -0x30(%rbp), %xmm2
movsd -0x20(%rbp), %xmm3
callq 0xcbe8
movl 0x3169ab(%rip), %eax    # 0x3670f0
movq 0x120(%rbx), %rcx
leaq (%rax,%rax,2), %rdx
movq (%rcx,%rdx,8), %r14
cmpq 0x8(%rcx,%rdx,8), %r14
je 0x5087d
movsd 0x188f9(%rip), %xmm5    # 0x69060
movsd 0x18901(%rip), %xmm6    # 0x69070
movsd 0x188d1(%rip), %xmm7    # 0x69048
movsd 0x188e8(%rip), %xmm8    # 0x69068
movl (%r14), %esi
cmpb $0x0, 0x33(%rbx)
je 0x507ec
movsd 0x8(%r14), %xmm0
movsd 0x10(%r14), %xmm1
movsd 0x18(%r14), %xmm2
movsd 0x20(%r14), %xmm3
movaps 0x18878(%rip), %xmm4    # 0x69020
xorps %xmm4, %xmm0
xorps %xmm4, %xmm1
xorps %xmm4, %xmm2
xorps %xmm4, %xmm3
movsd 0x28(%r14), %xmm4
addsd %xmm5, %xmm4
testl %esi, %esi
jle 0x5080f
ucomisd %xmm4, %xmm5
jbe 0x507df
addsd %xmm6, %xmm4
ucomisd %xmm4, %xmm5
ja 0x507c8
xorl %eax, %eax
subl 0x34(%rbx,%rsi,4), %eax
movq %rbx, %rdi
movl %eax, %esi
jmp 0x50828
ucomisd %xmm7, %xmm4
jb 0x507d2
addsd %xmm8, %xmm4
jmp 0x507df
movsd 0x8(%r14), %xmm0
movsd 0x10(%r14), %xmm1
movsd 0x18(%r14), %xmm2
movsd 0x20(%r14), %xmm3
movsd 0x28(%r14), %xmm4
movq %rbx, %rdi
jmp 0x50828
ucomisd %xmm4, %xmm5
jbe 0x50870
addsd %xmm6, %xmm4
ucomisd %xmm4, %xmm5
ja 0x50815
negl %esi
movl 0x64(%rbx,%rsi,4), %esi
movq %rbx, %rdi
callq 0x50c46
addq $0x38, %r14
movl 0x3168b9(%rip), %eax    # 0x3670f0
movq 0x120(%rbx), %rcx
leaq (%rax,%rax,2), %rdx
cmpq 0x8(%rcx,%rdx,8), %r14
movsd 0x18811(%rip), %xmm5    # 0x69060
movsd 0x18819(%rip), %xmm6    # 0x69070
movsd 0x187e9(%rip), %xmm7    # 0x69048
movsd 0x18800(%rip), %xmm8    # 0x69068
jne 0x50780
jmp 0x5087d
ucomisd %xmm7, %xmm4
jb 0x5081f
addsd %xmm8, %xmm4
jmp 0x50870
movq 0x18(%rbx), %rdi
movq 0x178(%rbx), %rcx
movl (%rcx,%rax,4), %r14d
callq 0xee28
movq %rax, %rdi
movl %r14d, %esi
callq 0xcadc
movq 0x18(%rbx), %rdi
callq 0xee28
movq %rax, %rdi
callq 0xcc84
movl 0x31683d(%rip), %eax    # 0x3670f0
incl %eax
movl %eax, 0x316835(%rip)    # 0x3670f0
movq 0x128(%rbx), %rcx
subq 0x120(%rbx), %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %rax, %rdx
ja 0x509a8
movl $0x0, 0x316802(%rip)    # 0x3670f0
movb $0x1, 0x31(%rbx)
movq 0x336f7(%rip), %r14     # 0x83ff0
leaq 0x1c5ab(%rip), %rsi     # 0x6ceab
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
callq 0x43dce
movq 0x3138(%rax), %rsi
movq 0x3140(%rax), %rdx
movq %r14, %rdi
callq 0x9560
movq %rax, %r14
leaq 0x1c89b(%rip), %rsi     # 0x6d1cd
movl $0x12, %edx
movq %rax, %rdi
callq 0x9560
movl 0x9c(%rbx), %esi
movq %r14, %rdi
callq 0x9320
movq %rax, %r14
leaq 0x1c8a4(%rip), %rsi     # 0x6d1fb
movl $0x9, %edx
movq %rax, %rdi
callq 0x9560
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rsi
addq $0x10, %rsi
movq %r14, %rdi
callq 0xe974
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