// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/CommunicateSystem.cpp
// Function: CommunicateSystem::RecvFreeForm(long)
void CommunicateSystem::RecvFreeForm(DWORD64 bits) {
  SetCommunicateType(FREE_FORM);

  FreeFormType type;
  int bit_left = MAX_BITS_USED;
  while (bit_left > 0) {
    type = static_cast<FreeFormType>(bits & mFreeFormFlagMask);
    if (type >= FREE_FORM_DUMMY) {
      break; // mCommuBits
             // 的左端全是1，可以用来作为结束标志，因为FREE_FORM_DUMMY是不用的
    }
    if (bit_left < mFreeFormCodecBitCount[type]) {
      break;
    }

    bits >>= mFreeFormFlagBitCount;
    bit_left -= mFreeFormFlagBitCount;

    if (type == BALL_WITH_SPEED) {
      AngleDeg dir = ExtractDataFromBits(bits, DIR, bit_left);
      double speed = ExtractDataFromBits(bits, BALL_SPEED, bit_left);
      double y = ExtractDataFromBits(bits, POS_Y, bit_left);
      double x = ExtractDataFromBits(bits, POS_X, bit_left);
      mpObserver->HearBall(Vector(x, y), Polar2Vector(speed, dir));
      Logger::instance().GetTextLogger("freeform")
          << mpObserver->CurrentTime() << " hear ball: " << Vector(x, y) << " "
          << Polar2Vector(speed, dir) << endl;
    } else if (type == BALL_WITH_ZERO_SPEED) {
      double y = ExtractDataFromBits(bits, POS_Y, bit_left);
      double x = ExtractDataFromBits(bits, POS_X, bit_left);
      mpObserver->HearBall(Vector(x, y), Vector(0.0, 0.0));
      Logger::instance().GetTextLogger("freeform")
          << mpObserver->CurrentTime() << " hear ball: " << Vector(x, y) << " "
          << Polar2Vector(0, 0) << endl;
    } else if (type == BALL_ONLY_POS) {
      double y = ExtractDataFromBits(bits, POS_Y, bit_left);
      double x = ExtractDataFromBits(bits, POS_X, bit_left);
      mpObserver->HearBall(Vector(x, y));
      Logger::instance().GetTextLogger("freeform")
          << mpObserver->CurrentTime() << " hear ball: " << Vector(x, y)
          << endl;
    } else if (type == TEAMMATE_ONLY_POS) {
      double y = ExtractDataFromBits(bits, POS_Y, bit_left);
      double x = ExtractDataFromBits(bits, POS_X, bit_left);
      Unum num = ExtractUnumFromBits(bits, bit_left);
      mpObserver->HearTeammate(num, Vector(x, y));
      Logger::instance().GetTextLogger("freeform")
          << mpObserver->CurrentTime() << " hear tm: " << num << " "
          << Vector(x, y) << endl;
    } else if (type == OPPONENT_ONLY_POS) {
      double y = ExtractDataFromBits(bits, POS_Y, bit_left);
      double x = ExtractDataFromBits(bits, POS_X, bit_left);
      Unum num = ExtractUnumFromBits(bits, bit_left);
      mpObserver->HearOpponent(num, Vector(x, y));
      Logger::instance().GetTextLogger("freeform")
          << mpObserver->CurrentTime() << " hear opp: " << num << " "
          << Vector(x, y) << endl;
    } else {
      PRINT_ERROR("recv free form error");
      return;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x190(%rbp)
xorl %esi, %esi
callq 0x2e640
movl 0xd0905(%rip), %eax     # 0xfe630
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jle 0x2e529
movq -0x190(%rbp), %rcx
movq -0x10(%rbp), %rax
andq 0x58(%rcx), %rax
movl %eax, -0x14(%rbp)
cmpl $0x5, -0x14(%rbp)
jl 0x2dd55
jmp 0x2e529
movq -0x190(%rbp), %rcx
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %edx
cmpl 0xd0(%rcx,%rdx,4), %eax
jge 0x2dd70
jmp 0x2e529
movq -0x190(%rbp), %rax
movl 0x50(%rax), %ecx
movq -0x10(%rbp), %rdx
movl %ecx, %ecx
sarq %cl, %rdx
movq %rdx, %rcx
movq %rcx, -0x10(%rbp)
movl 0x50(%rax), %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x2df27
movq -0x190(%rbp), %rdi
leaq -0x10(%rbp), %rsi
movl $0x4, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rdi
movsd %xmm0, -0x20(%rbp)
leaq -0x10(%rbp), %rsi
movl $0x2, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rdi
movsd %xmm0, -0x28(%rbp)
leaq -0x10(%rbp), %rsi
movl $0x1, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rdi
movsd %xmm0, -0x30(%rbp)
leaq -0x10(%rbp), %rsi
xorl %edx, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rax
movsd %xmm0, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x1b0(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x11a10
leaq -0x28(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x112c0
movq -0x1b0(%rbp), %rdi
movsd %xmm0, -0x58(%rbp)
movsd %xmm1, -0x50(%rbp)
leaq -0x48(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x6d990
callq 0x5add0
movq %rax, %rdi
leaq 0x9434e(%rip), %rsi     # 0xc21bf
callq 0x5b110
movq %rax, %rcx
movq -0x190(%rbp), %rax
movq %rcx, -0x1a8(%rbp)
movq 0x8(%rax), %rdi
callq 0x11a70
movq -0x1a8(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq %rax, %rdi
leaq 0x9435e(%rip), %rsi     # 0xc2207
callq 0x2e730
movq %rax, -0x1a0(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x11a10
movq -0x1a0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x2e780
movq %rax, %rdi
leaq 0x96dfc(%rip), %rsi     # 0xc4cdc
callq 0x1a690
movq %rax, -0x198(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x112c0
movq -0x198(%rbp), %rdi
movsd %xmm0, -0x78(%rbp)
movsd %xmm1, -0x70(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x2e780
movq %rax, %rdi
movq 0xd0093(%rip), %rsi     # 0xfdfb0
callq 0x1a7c0
jmp 0x2e524
cmpl $0x1, -0x14(%rbp)
jne 0x2e0d3
movq -0x190(%rbp), %rdi
leaq -0x10(%rbp), %rsi
movl $0x1, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rdi
movsd %xmm0, -0x80(%rbp)
leaq -0x10(%rbp), %rsi
xorl %edx, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rax
movsd %xmm0, -0x88(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x1d0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x11a10
xorps %xmm0, %xmm0
movsd %xmm0, -0xb0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xb8(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x11a10
movq -0x1d0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
callq 0x6d990
callq 0x5add0
movq %rax, %rdi
leaq 0x941d0(%rip), %rsi     # 0xc21bf
callq 0x5b110
movq %rax, %rcx
movq -0x190(%rbp), %rax
movq %rcx, -0x1c8(%rbp)
movq 0x8(%rax), %rdi
callq 0x11a70
movq -0x1c8(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq %rax, %rdi
leaq 0x941e0(%rip), %rsi     # 0xc2207
callq 0x2e730
movq %rax, -0x1c0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x11a10
movq -0x1c0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x2e780
movq %rax, %rdi
leaq 0x96c75(%rip), %rsi     # 0xc4cdc
callq 0x1a690
movq %rax, -0x1b8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xe0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x112c0
movq -0x1b8(%rbp), %rdi
movsd %xmm0, -0xd8(%rbp)
movsd %xmm1, -0xd0(%rbp)
leaq -0xd8(%rbp), %rsi
callq 0x2e780
movq %rax, %rdi
movq 0xcfee7(%rip), %rsi     # 0xfdfb0
callq 0x1a7c0
jmp 0x2e522
cmpl $0x2, -0x14(%rbp)
jne 0x2e1ef
movq -0x190(%rbp), %rdi
leaq -0x10(%rbp), %rsi
movl $0x1, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rdi
movsd %xmm0, -0xf0(%rbp)
leaq -0x10(%rbp), %rsi
xorl %edx, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rax
movsd %xmm0, -0xf8(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x1e8(%rbp)
leaq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x11a10
movq -0x1e8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x6d9d0
callq 0x5add0
movq %rax, %rdi
leaq 0x94055(%rip), %rsi     # 0xc21bf
callq 0x5b110
movq %rax, %rcx
movq -0x190(%rbp), %rax
movq %rcx, -0x1e0(%rbp)
movq 0x8(%rax), %rdi
callq 0x11a70
movq -0x1e0(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq %rax, %rdi
leaq 0x94065(%rip), %rsi     # 0xc2207
callq 0x2e730
movq %rax, -0x1d8(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x11a10
movq -0x1d8(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x2e780
movq %rax, %rdi
movq 0xcfdcb(%rip), %rsi     # 0xfdfb0
callq 0x1a7c0
jmp 0x2e520
cmpl $0x3, -0x14(%rbp)
jne 0x2e357
movq -0x190(%rbp), %rdi
leaq -0x10(%rbp), %rsi
movl $0x1, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rdi
movsd %xmm0, -0x120(%rbp)
leaq -0x10(%rbp), %rsi
xorl %edx, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rdi
movsd %xmm0, -0x128(%rbp)
leaq -0x10(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x2dcb0
movl %eax, %ecx
movq -0x190(%rbp), %rax
movl %ecx, -0x12c(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x208(%rbp)
movl -0x12c(%rbp), %eax
movl %eax, -0x1fc(%rbp)
leaq -0x140(%rbp), %rdi
leaq -0x128(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0x11a10
movq -0x208(%rbp), %rdi
movl -0x1fc(%rbp), %esi
leaq -0x140(%rbp), %rdx
callq 0x6da10
callq 0x5add0
movq %rax, %rdi
leaq 0x93f0b(%rip), %rsi     # 0xc21bf
callq 0x5b110
movq %rax, %rcx
movq -0x190(%rbp), %rax
movq %rcx, -0x1f8(%rbp)
movq 0x8(%rax), %rdi
callq 0x11a70
movq -0x1f8(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq %rax, %rdi
leaq 0x93f28(%rip), %rsi     # 0xc2214
callq 0x1a770
movq %rax, %rdi
leaq -0x12c(%rbp), %rsi
callq 0x2e850
movq %rax, %rdi
leaq 0x969d2(%rip), %rsi     # 0xc4cdc
callq 0x1a690
movq %rax, -0x1f0(%rbp)
leaq -0x150(%rbp), %rdi
leaq -0x128(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0x11a10
movq -0x1f0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x2e780
movq %rax, %rdi
movq 0xcfc63(%rip), %rsi     # 0xfdfb0
callq 0x1a7c0
jmp 0x2e51e
cmpl $0x4, -0x14(%rbp)
jne 0x2e4bc
movq -0x190(%rbp), %rdi
leaq -0x10(%rbp), %rsi
movl $0x1, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rdi
movsd %xmm0, -0x158(%rbp)
leaq -0x10(%rbp), %rsi
xorl %edx, %edx
leaq -0x18(%rbp), %rcx
callq 0x2dc30
movq -0x190(%rbp), %rdi
movsd %xmm0, -0x160(%rbp)
leaq -0x10(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x2dcb0
movl %eax, %ecx
movq -0x190(%rbp), %rax
movl %ecx, -0x164(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x228(%rbp)
movl -0x164(%rbp), %eax
movl %eax, -0x21c(%rbp)
leaq -0x178(%rbp), %rdi
leaq -0x160(%rbp), %rsi
leaq -0x158(%rbp), %rdx
callq 0x11a10
movq -0x228(%rbp), %rdi
movl -0x21c(%rbp), %esi
leaq -0x178(%rbp), %rdx
callq 0x6da50
callq 0x5add0
movq %rax, %rdi
leaq 0x93da3(%rip), %rsi     # 0xc21bf
callq 0x5b110
movq %rax, %rcx
movq -0x190(%rbp), %rax
movq %rcx, -0x218(%rbp)
movq 0x8(%rax), %rdi
callq 0x11a70
movq -0x218(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq %rax, %rdi
leaq 0x93dcb(%rip), %rsi     # 0xc221f
callq 0x2e8a0
movq %rax, %rdi
leaq -0x164(%rbp), %rsi
callq 0x2e850
movq %rax, %rdi
leaq 0x9686a(%rip), %rsi     # 0xc4cdc
callq 0x1a690
movq %rax, -0x210(%rbp)
leaq -0x188(%rbp), %rdi
leaq -0x160(%rbp), %rsi
leaq -0x158(%rbp), %rdx
callq 0x11a10
movq -0x210(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x2e780
movq %rax, %rdi
movq 0xcfafb(%rip), %rsi     # 0xfdfb0
callq 0x1a7c0
jmp 0x2e51c
jmp 0x2e4be
movq 0xcfb2b(%rip), %rdi     # 0xfdff0
leaq 0x93c8e(%rip), %rsi     # 0xc215a
callq 0xa5a0
movq %rax, %rdi
leaq 0x96d76(%rip), %rsi     # 0xc5251
callq 0xa5a0
movq %rax, %rdi
movl $0x23f, %esi            # imm = 0x23F
callq 0xaa40
movq %rax, %rdi
leaq 0x95068(%rip), %rsi     # 0xc355f
callq 0xa5a0
movq %rax, %rdi
leaq 0x93d25(%rip), %rsi     # 0xc222b
callq 0xa5a0
movq %rax, %rdi
movq 0xcfa9b(%rip), %rsi     # 0xfdfb0
callq 0xa630
jmp 0x2e529
jmp 0x2e51e
jmp 0x2e520
jmp 0x2e522
jmp 0x2e524
jmp 0x2dd2e
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)