// File: 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
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, 0x3c(%rax)
je 0x2d60d
movb $0x0, -0x1(%rbp)
jmp 0x2d820
movq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x2e640
movq -0x40(%rbp), %rdi
addq $0x30, %rdi
leaq -0x1c(%rbp), %rsi
callq 0x2e7d0
movb (%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2d63e
movb $0x0, -0x1(%rbp)
jmp 0x2d820
movq -0x18(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x1d480
movq %rax, %rdi
callq 0x23f20
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x2d666
movb $0x0, -0x1(%rbp)
jmp 0x2d820
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2e810
movq %rax, %rdi
callq 0x49590
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, -0x50(%rbp)
movq 0x10(%rax), %rdi
callq 0x10e40
movq -0x50(%rbp), %rdi
movl %eax, %esi
xorl %edx, %edx
subl -0x1c(%rbp), %edx
callq 0x7efb0
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x2e830
movsd -0x48(%rbp), %xmm0
ucomisd (%rax), %xmm0
jbe 0x2d6c9
movb $0x0, -0x1(%rbp)
jmp 0x2d820
movq -0x18(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x1d480
movq %rax, %rdi
addq $0x8, %rdi
callq 0x1ddd0
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x2d81c
movq -0x40(%rbp), %rcx
movl 0xe0(%rcx), %eax
addl 0x20(%rcx), %eax
cmpl 0xd0f2c(%rip), %eax     # 0xfe630
jg 0x2d81a
movq -0x18(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x1d480
movq %rax, %rdi
addq $0x8, %rdi
callq 0x11090
movq -0x40(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x1c(%rbp), %esi
callq 0x2cdf0
leaq -0x38(%rbp), %rdi
callq 0x176f0
movq -0x40(%rbp), %rdi
movsd (%rax), %xmm0
xorl %esi, %esi
callq 0x2cbc0
leaq -0x38(%rbp), %rdi
callq 0x17700
movq -0x40(%rbp), %rdi
movsd (%rax), %xmm0
movl $0x1, %esi
callq 0x2cbc0
movq -0x40(%rbp), %rdi
movl $0x4, %esi
callq 0x2ccd0
movq -0x40(%rbp), %rdi
addq $0x30, %rdi
leaq -0x1c(%rbp), %rsi
callq 0x2e7d0
movb $0x1, (%rax)
callq 0x5add0
movq %rax, %rdi
leaq 0x94a1d(%rip), %rsi     # 0xc21bf
callq 0x5b110
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, -0x58(%rbp)
movq 0x10(%rax), %rdi
callq 0x10550
movq %rax, %rdi
callq 0x12100
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq %rax, %rdi
leaq 0x94a18(%rip), %rsi     # 0xc21f1
callq 0x2e8a0
movq %rax, %rdi
leaq -0x1c(%rbp), %rsi
callq 0x2e850
movq %rax, %rdi
leaq 0x974e8(%rip), %rsi     # 0xc4cdc
callq 0x1a690
movq %rax, %rdi
leaq -0x38(%rbp), %rsi
callq 0x2e780
movq %rax, %rdi
movq 0xd07a1(%rip), %rsi     # 0xfdfb0
callq 0x1a7c0
movb $0x1, -0x1(%rbp)
jmp 0x2d820
jmp 0x2d81c
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)