// File: /workspace/github_cpp_makefile_star2_O1/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:
cmpl $0x0, 0x3c(%rdi)
je 0x1e355
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r14d
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 0x1e40e
movq %rsi, %r12
decq %rax
imulq $0x178, %rax, %r13      # imm = 0x178
cmpb $0x1, 0x1ba(%rsi,%r13)
jne 0x1e40e
movl %ecx, %r15d
movq %rax, -0x48(%rbp)
movq 0x10(%rbx), %rax
movq 0x20(%rax), %rdi
callq 0x2adf8
movq 0x10(%rbx), %rcx
movl 0x8(%rcx), %esi
movq %rax, %rdi
movl %r14d, %edx
callq 0x4848a
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
callq 0x4a75c
movsd -0x50(%rbp), %xmm0
ucomisd 0x3410(%rax), %xmm0
ja 0x1e40e
leaq (%r12,%r13), %rax
addq $0xa8, %rax
cmpl %r15d, 0x18(%rax)
jg 0x1e40e
movl 0x20(%rbx), %ecx
addl 0xdc(%rbx), %ecx
cmpl 0x69104(%rip), %ecx     # 0x87510
jle 0x1e41f
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x8, %rax
movups (%rax), %xmm0
movaps %xmm0, -0x40(%rbp)
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1dd72
movsd -0x40(%rbp), %xmm0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1db6c
movsd -0x38(%rbp), %xmm0
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1db6c
movq %rbx, %rdi
movl $0x3, %esi
callq 0x1dc6a
callq 0x35b4a
leaq 0x4ddcc(%rip), %rsi     # 0x6c23b
movq %rax, %rdi
callq 0x35d5e
movq %rax, %r15
movq 0x10(%rbx), %rax
movq 0x18(%rax), %r12
callq 0x450ba
cmpb $0x1, 0x5c45(%rax)
jne 0x1e4a6
addq $0x10, %r12
movq %r15, %rdi
addq $0x210, %rdi            # imm = 0x210
movq %r12, %rsi
callq 0xea74
leaq 0x4ddb5(%rip), %rsi     # 0x6c262
movq %r15, %rdi
callq 0x13672
movq %rax, %r15
callq 0x450ba
cmpb $0x1, 0x5c45(%rax)
jne 0x1e4d8
movq %r15, %rdi
addq $0x210, %rdi            # imm = 0x210
movl %r14d, %esi
callq 0x9880
leaq 0x50715(%rip), %rsi     # 0x6ebf4
movq %r15, %rdi
callq 0x135bc
movq %rax, %r14
callq 0x450ba
cmpb $0x1, 0x5c45(%rax)
jne 0x1e508
leaq 0x210(%r14), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1f49d
callq 0x450ba
cmpb $0x1, 0x5c45(%rax)
jne 0x1e525
addq $0x210, %r14            # imm = 0x210
movq %r14, %rdi
callq 0x9240
movq -0x48(%rbp), %rax
movb $0x1, 0x25(%rbx,%rax)
movb $0x1, %al
jmp 0x1e410
nop