// File: 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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
leaq 0xd17c5(%rip), %rax     # 0xfd670
addq $0x10, %rax
movq %rax, (%rdi)
addq $0x25, %rdi
callq 0x2e540
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x2e540
leaq 0xd8db1(%rip), %rdi     # 0x104c80
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0xa310
movl $0x0, -0xc(%rbp)
cmpl $0x49, -0xc(%rbp)
jge 0x2bf11
movl -0xc(%rbp), %edx
movq 0xd2736(%rip), %rax     # 0xfe628
movslq -0xc(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0xd8d7d(%rip), %rax     # 0x104c80
movl %edx, (%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2bee2
movq -0x18(%rbp), %rdi
addq $0x80, %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0xa310
movq -0x18(%rbp), %rdi
addq $0x98, %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0xa310
movsd 0x950c9(%rip), %xmm0    # 0xc1010
callq 0xa490
movsd %xmm0, -0x30(%rbp)
movsd 0x95557(%rip), %xmm0    # 0xc14b0
callq 0xa490
movaps %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0xa110
movq -0x18(%rbp), %rax
cvttsd2si %xmm0, %ecx
movl %ecx, 0x40(%rax)
movl 0x40(%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rcx, 0x48(%rax)
movsd 0x96130(%rip), %xmm0    # 0xc20c8
callq 0xa490
movsd %xmm0, -0x28(%rbp)
movsd 0x95506(%rip), %xmm0    # 0xc14b0
callq 0xa490
movaps %xmm0, %xmm1
movsd -0x28(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0xa110
movq -0x18(%rbp), %rax
cvttsd2si %xmm0, %ecx
movl %ecx, 0x50(%rax)
movl 0x50(%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rcx, 0x58(%rax)
movsd 0x960d7(%rip), %xmm0    # 0xc20c0
callq 0xa490
movsd %xmm0, -0x20(%rbp)
movsd 0x954b5(%rip), %xmm0    # 0xc14b0
callq 0xa490
movaps %xmm0, %xmm1
movsd -0x20(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0xa110
movq -0x18(%rbp), %rax
cvttsd2si %xmm0, %ecx
movl %ecx, 0x70(%rax)
movl 0x70(%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rcx, 0x78(%rax)
movl $0x5, 0x60(%rax)
movl 0x60(%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rcx, 0x68(%rax)
callq 0x798a0
movq %rax, %rdi
callq 0x2e560
movq -0x18(%rbp), %rdi
movsd (%rax), %xmm0
xorl %esi, %esi
callq 0x2c240
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x80(%rax)
movl 0x80(%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rcx, 0x98(%rax)
callq 0x798a0
movq %rax, %rdi
callq 0x2e580
movq -0x18(%rbp), %rdi
movsd (%rax), %xmm0
movl $0x1, %esi
callq 0x2c240
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x84(%rax)
movl 0x84(%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rcx, 0xa0(%rax)
callq 0x798a0
movq %rax, %rdi
callq 0x2e5a0
movq -0x18(%rbp), %rdi
movsd (%rax), %xmm0
movl $0x2, %esi
callq 0x2c240
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x88(%rax)
movl 0x88(%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rcx, 0xa8(%rax)
callq 0x798a0
movq %rax, %rdi
callq 0x2e5c0
movq -0x18(%rbp), %rdi
movsd (%rax), %xmm0
movl $0x2, %esi
callq 0x2c240
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8c(%rax)
movl 0x8c(%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rcx, 0xb0(%rax)
callq 0x798a0
movq %rax, %rdi
callq 0x2e5e0
movq -0x18(%rbp), %rdi
movsd (%rax), %xmm0
movl $0x4, %esi
callq 0x2c240
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x90(%rax)
movl 0x90(%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rcx, 0xb8(%rax)
movl 0x80(%rax), %ecx
addl 0x84(%rax), %ecx
addl 0x88(%rax), %ecx
addl 0x90(%rax), %ecx
addl 0x50(%rax), %ecx
movl %ecx, 0xd0(%rax)
movl 0x80(%rax), %ecx
addl 0x84(%rax), %ecx
addl 0x50(%rax), %ecx
movl %ecx, 0xd4(%rax)
movl 0x80(%rax), %ecx
addl 0x84(%rax), %ecx
addl 0x50(%rax), %ecx
movl %ecx, 0xd8(%rax)
movl 0x80(%rax), %ecx
addl 0x84(%rax), %ecx
addl 0x50(%rax), %ecx
movl %ecx, 0xdc(%rax)
movl 0x80(%rax), %ecx
addl 0x84(%rax), %ecx
addl 0x50(%rax), %ecx
movl %ecx, 0xe0(%rax)
movl 0x40(%rax), %ecx
movl 0xd2403(%rip), %eax     # 0xfe630
subl %ecx, %eax
movl %eax, 0xd23fb(%rip)     # 0xfe630
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)