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

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

  SetCommunicateType(FREE_FORM);

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

  int pos_cd = pWorldState->GetTeammate(num).GetPosDelay();
  if (pos_cd <= cd) {
    if (mFreeFormCodecBitCount[TEAMMATE_ONLY_POS] + mBitsUsed <=
        MAX_BITS_USED) {
      Vector pos = pWorldState->GetTeammate(num).GetPos();
      AddUnumToCommuBits(num);
      AddDataToCommuBits(pos.X(), POS_X);
      AddDataToCommuBits(pos.Y(), POS_Y);
      AddFreeFormFlagToCommuBits(TEAMMATE_ONLY_POS);
      Logger::instance().GetTextLogger("freeform")
          << mpAgent->GetWorldState().CurrentTime() << " send tm: " << num
          << " " << pos << endl;
      mTeammateSended[num] = true;
      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 0x19aa2
movl %edx, %r15d
movq %rdi, %rbx
leaq 0x80(%rdi), %rax
movq %rax, 0xc0(%rdi)
leaq 0x98(%rdi), %rax
movq %rax, 0xc8(%rdi)
movslq %edx, %rax
cmpb $0x0, 0x24(%rdi,%rax)
jne 0x19aa2
movq %rsi, %r14
decq %rax
imulq $0x178, %rax, %r13      # imm = 0x178
cmpb $0x1, 0x1ba(%rsi,%r13)
jne 0x19aa2
movl %ecx, %r12d
movq 0x10(%rbx), %rax
movq 0x20(%rax), %rdi
callq 0x244e8
movq 0x10(%rbx), %rcx
movl 0x8(%rcx), %esi
movq %rax, %rdi
movl %r15d, %edx
callq 0x3ba96
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
callq 0x3db2c
movsd -0x38(%rbp), %xmm0
ucomisd 0x3410(%rax), %xmm0
ja 0x19aa2
addq $0xa8, %r14
cmpl %r12d, 0x18(%r14,%r13)
jg 0x19aa2
movl 0x20(%rbx), %eax
addl 0xdc(%rbx), %eax
cmpl 0x5da70(%rip), %eax     # 0x77510
jle 0x19ab3
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%r14,%r13), %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 $0x3
popq %rsi
movq %rbx, %rdi
callq 0x195d0
callq 0x2ca2e
leaq 0x3e6f3(%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 0x3e6e6(%rip), %rsi     # 0x58211
movq %rax, %rdi
callq 0x10f2a
leaq -0x2c(%rbp), %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x1a512
leaq 0x4105b(%rip), %rsi     # 0x5aba4
movq %rax, %rdi
callq 0x10ec6
movq %rax, %rdi
movq %r14, %rsi
callq 0x1a4e0
movq 0x5d44d(%rip), %rsi     # 0x76fb0
movq %rax, %rdi
callq 0x10f5c
movslq (%r15), %rax
movb $0x1, 0x24(%rbx,%rax)
movb $0x1, %al
jmp 0x19aa4