// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/CommunicateSystem.cpp
// Function: CommunicateSystem::SendOpponentStatus(WorldState const*, int, int)
bool CommunicateSystem::SendOpponentStatus(const WorldState *pWorldState,
                                           Unum num, int cd) {
  Assert(num > 0);

  if (mCommuType != FREE_FORM) {
    return false;
  }

  SetCommunicateType(FREE_FORM);

  if (mOpponentSended[num] == true) {
    return false;
  }
  if (pWorldState->GetOpponent(num).IsAlive() == false) {
    return false;
  }
  if (mpAgent->GetInfoState().GetPositionInfo().GetPlayerDistToPlayer(
          mpAgent->GetSelfUnum(), -num) >
      ServerParam::instance().unumFarLength()) {
    return false;
  }

  int pos_cd = pWorldState->GetOpponent(num).GetPosDelay();
  if (pos_cd <= cd) {
    if (mFreeFormCodecBitCount[OPPONENT_ONLY_POS] + mBitsUsed <=
        MAX_BITS_USED) {
      Vector pos = pWorldState->GetOpponent(num).GetPos();
      AddUnumToCommuBits(num);
      AddDataToCommuBits(pos.X(), POS_X);
      AddDataToCommuBits(pos.Y(), POS_Y);
      AddFreeFormFlagToCommuBits(OPPONENT_ONLY_POS);
      mOpponentSended[num] = true;
      Logger::instance().GetTextLogger("freeform")
          << mpAgent->GetWorldState().CurrentTime() << " send opp: " << num
          << " " << pos << endl;
      return true;
    }
  }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, -0x2c(%rbp)
cmpl $0x0, 0x3c(%rdi)
jne 0x19c44
movl %edx, %r15d
movq %rdi, %rbx
leaq 0x80(%rdi), %rax
movq %rax, 0xc0(%rdi)
leaq 0x98(%rdi), %rax
movq %rax, 0xc8(%rdi)
movslq %edx, %r13
cmpb $0x0, 0x2f(%rdi,%r13)
jne 0x19c44
movq %rsi, %r14
decq %r13
imulq $0x178, %r13, %rax      # imm = 0x178
cmpb $0x1, 0x11e2(%rsi,%rax)
jne 0x19c44
movl %ecx, %r12d
movq %rax, -0x38(%rbp)
movq 0x10(%rbx), %rax
movq 0x20(%rax), %rdi
callq 0x244e8
movq 0x10(%rbx), %rcx
movl 0x8(%rcx), %esi
movl %r15d, %edx
negl %edx
movq %rax, %rdi
callq 0x3ba96
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0x3db2c
movsd -0x40(%rbp), %xmm0
ucomisd 0x3410(%rax), %xmm0
ja 0x19c44
addq $0x10d0, %r14           # imm = 0x10D0
movq -0x38(%rbp), %rcx
cmpl %r12d, 0x18(%r14,%rcx)
jg 0x19c44
movl 0x20(%rbx), %eax
addl 0xe0(%rbx), %eax
cmpl 0x5d8ce(%rip), %eax     # 0x77510
jle 0x19c55
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%r14,%rcx), %rax
addq $0x8, %rax
movups (%rax), %xmm0
leaq -0x50(%rbp), %r14
movaps %xmm0, (%r14)
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1968c
movsd (%r14), %xmm0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x19512
movsd 0x8(%r14), %xmm0
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x19512
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x195d0
movb $0x1, 0x30(%rbx,%r13)
callq 0x2ca2e
leaq 0x3e54b(%rip), %rsi     # 0x581fb
movq %rax, %rdi
callq 0x2cc3e
movq 0x10(%rbx), %rcx
movq 0x18(%rcx), %rsi
addq $0x10, %rsi
movq %rax, %rdi
callq 0x10e94
leaq 0x3e549(%rip), %rsi     # 0x5821c
movq %rax, %rdi
callq 0x1a544
leaq -0x2c(%rbp), %rsi
movq %rax, %rdi
callq 0x1a512
leaq 0x40eb6(%rip), %rsi     # 0x5aba4
movq %rax, %rdi
callq 0x10ec6
movq %rax, %rdi
movq %r14, %rsi
callq 0x1a4e0
movq 0x5d2a8(%rip), %rsi     # 0x76fb0
movq %rax, %rdi
callq 0x10f5c
movb $0x1, %al
jmp 0x19c46
nop