// File: /workspace/github_cpp_makefile_star2_O1/wrighteagle2d[P]wrighteaglebase/Debug/../src/CommunicateSystem.cpp
// Function: CommunicateSystem::CommunicateSystem()
CommunicateSystem::CommunicateSystem() {
  memset(CODE_TO_INT, 0, sizeof(CODE_TO_INT));
  for (int i = 0; i < CODE_SIZE; ++i) {
    CODE_TO_INT[CODE[i]] = i;
  }

  memset(mCodecBitCount, 0, sizeof(mCodecBitCount));
  memset(mCodecMask, 0, sizeof(mCodecMask));

  mCommuFlagBitCount =
      static_cast<int>(ceil(log(static_cast<double>(COMMU_MAX)) / log(2.0)));
  mCommuFlagMask = (1 << mCommuFlagBitCount) - 1;

  mFreeFormFlagBitCount = static_cast<int>(
      ceil(log(static_cast<double>(FREE_FORM_MAX)) / log(2.0)));
  mFreeFormFlagMask = (1 << mFreeFormFlagBitCount) - 1;

  mUnumBitCount =
      static_cast<int>(ceil(log(static_cast<double>(TEAMSIZE)) / log(2.0)));
  mUnumMask = (1 << mUnumBitCount) - 1;

  mTacticsBitCount = 5;
  mTacticsFlagMask = (1 << mTacticsBitCount) - 1;

  mCodecBitCount[FREE_FORM][POS_X] =
      BitCountOfEps(PlayerParam::instance().sayPosXEps(), POS_X);
  mCodecMask[FREE_FORM][POS_X] = (1 << mCodecBitCount[FREE_FORM][POS_X]) - 1;
  mCodecBitCount[FREE_FORM][POS_Y] =
      BitCountOfEps(PlayerParam::instance().sayPosYEps(), POS_Y);
  mCodecMask[FREE_FORM][POS_Y] = (1 << mCodecBitCount[FREE_FORM][POS_Y]) - 1;
  mCodecBitCount[FREE_FORM][BALL_SPEED] =
      BitCountOfEps(PlayerParam::instance().sayBallSpeedEps(), BALL_SPEED);
  mCodecMask[FREE_FORM][BALL_SPEED] =
      (1 << mCodecBitCount[FREE_FORM][BALL_SPEED]) - 1;
  mCodecBitCount[FREE_FORM][PLAYER_SPEED] =
      BitCountOfEps(PlayerParam::instance().sayPlayerSpeedEps(), BALL_SPEED);
  mCodecMask[FREE_FORM][PLAYER_SPEED] =
      (1 << mCodecBitCount[FREE_FORM][PLAYER_SPEED]) - 1;
  mCodecBitCount[FREE_FORM][DIR] =
      BitCountOfEps(PlayerParam::instance().sayDirEps(), DIR);
  mCodecMask[FREE_FORM][DIR] = (1 << mCodecBitCount[FREE_FORM][DIR]) - 1;

  mFreeFormCodecBitCount[BALL_WITH_SPEED] =
      mCodecBitCount[FREE_FORM][POS_X] + mCodecBitCount[FREE_FORM][POS_Y] +
      mCodecBitCount[FREE_FORM][BALL_SPEED] + mCodecBitCount[FREE_FORM][DIR] +
      mFreeFormFlagBitCount;
  mFreeFormCodecBitCount[BALL_WITH_ZERO_SPEED] =
      mCodecBitCount[FREE_FORM][POS_X] + mCodecBitCount[FREE_FORM][POS_Y] +
      mFreeFormFlagBitCount;
  mFreeFormCodecBitCount[BALL_ONLY_POS] = mCodecBitCount[FREE_FORM][POS_X] +
                                          mCodecBitCount[FREE_FORM][POS_Y] +
                                          mFreeFormFlagBitCount;
  mFreeFormCodecBitCount[TEAMMATE_ONLY_POS] = mCodecBitCount[FREE_FORM][POS_X] +
                                              mCodecBitCount[FREE_FORM][POS_Y] +
                                              mFreeFormFlagBitCount;
  mFreeFormCodecBitCount[OPPONENT_ONLY_POS] = mCodecBitCount[FREE_FORM][POS_X] +
                                              mCodecBitCount[FREE_FORM][POS_Y] +
                                              mFreeFormFlagBitCount;

  MAX_BITS_USED -= mCommuFlagBitCount; //这个是一定要用的位
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x694f4(%rip), %rax     # 0x86670
movq %rax, (%rdi)
leaq 0x7099a(%rip), %r14     # 0x8db20
xorl %r15d, %r15d
movl $0x200, %edx            # imm = 0x200
movq %r14, %rdi
xorl %esi, %esi
callq 0x92b0
movq 0x6a369(%rip), %rax     # 0x87508
movzbl (%rax,%r15), %ecx
movl %r15d, (%r14,%rcx,4)
incq %r15
cmpq $0x49, %r15
jne 0x1d19f
xorl %eax, %eax
movl %eax, 0x90(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x80(%rbx)
movups %xmm0, 0x98(%rbx)
movups %xmm0, 0xa8(%rbx)
movq %rax, 0xb8(%rbx)
movl %eax, 0x40(%rbx)
movq %rax, 0x48(%rbx)
movl $0x3, 0x50(%rbx)
movq $0x7, 0x58(%rbx)
movl $0x4, 0x70(%rbx)
movq $0xf, 0x78(%rbx)
movl $0x5, 0x60(%rbx)
movq $0x1f, 0x68(%rbx)
callq 0x450ba
movsd 0x31b8(%rax), %xmm0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1d352
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %edx
movl %eax, 0x80(%rbx)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
xorl %r14d, %edx
movq %rdx, 0x98(%rbx)
callq 0x450ba
movsd 0x31c0(%rax), %xmm0
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1d352
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %edx
movl %eax, 0x84(%rbx)
xorl %r14d, %edx
movq %rdx, 0xa0(%rbx)
callq 0x450ba
movsd 0x31c8(%rax), %xmm0
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1d352
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %edx
movl %eax, 0x88(%rbx)
xorl %r14d, %edx
movq %rdx, 0xa8(%rbx)
callq 0x450ba
movsd 0x31d0(%rax), %xmm0
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1d352
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %edx
movl %eax, 0x8c(%rbx)
notl %edx
movq %rdx, 0xb0(%rbx)
callq 0x450ba
movsd 0x31d8(%rax), %xmm0
movq %rbx, %rdi
movl $0x4, %esi
callq 0x1d352
movl %eax, %ecx
shll %cl, %r14d
movl %eax, 0x90(%rbx)
notl %r14d
movq %r14, 0xb8(%rbx)
movl 0x84(%rbx), %ecx
addl 0x80(%rbx), %ecx
addl 0x50(%rbx), %ecx
movl 0x40(%rbx), %edx
addl %ecx, %eax
addl 0x88(%rbx), %eax
movl %eax, 0xd0(%rbx)
movl %ecx, 0xd4(%rbx)
movl %ecx, 0xd8(%rbx)
movl %ecx, 0xdc(%rbx)
movl %ecx, 0xe0(%rbx)
subl %edx, 0x6a1c9(%rip)     # 0x87510
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq