// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq -0x38(%rbp), %rax
movq %rsi, (%rax)
leaq 0x80(%rdi), %rax
movq %rax, 0xc0(%rdi)
leaq 0x98(%rdi), %rax
movq %rax, 0xc8(%rdi)
leaq 0x5d526(%rip), %rax     # 0x77510
leaq 0x3e12b(%rip), %r15     # 0x5811c
leaq -0x54(%rbp), %r13
leaq -0x48(%rbp), %r12
movl (%rax), %eax
testl %eax, %eax
jle 0x1a49f
movq -0x38(%rbp), %rsi
movq 0x58(%rbx), %rdx
andq %rsi, %rdx
cmpl $0x4, %edx
jg 0x1a49f
movl %edx, %ecx
cmpl 0xd0(%rbx,%rcx,4), %eax
jl 0x1a49f
movl 0x50(%rbx), %ecx
sarq %cl, %rsi
movq %rsi, -0x38(%rbp)
subl %ecx, %eax
movl %eax, -0x54(%rbp)
cmpl $0x4, %edx
ja 0x1a44a
movl %edx, %eax
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movq %rbx, %rdi
leaq -0x38(%rbp), %r14
movq %r14, %rsi
pushq $0x4
popq %rdx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x80(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2
popq %rdx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x78(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x50(%rbp)
movq 0x8(%rbx), %r15
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %r13
movq %r13, %rsi
callq 0xd15b
movsd %xmm0, -0x70(%rbp)
movsd %xmm1, -0x68(%rbp)
movq %r15, %rdi
movq %r12, %rsi
leaq -0x70(%rbp), %r14
movq %r14, %rdx
callq 0x334e8
callq 0x2ca2e
movq %rax, %rdi
leaq 0x3e109(%rip), %rsi     # 0x581fb
callq 0x2cc3e
movq 0x8(%rbx), %rsi
addq $0xc, %rsi
movq %rax, %rdi
callq 0x10e94
movq %rax, %rdi
leaq 0x3e121(%rip), %rsi     # 0x58232
callq 0x1a4ae
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %rax, %rdi
movq %r12, %rsi
callq 0x1a4e0
movq %rax, %rdi
leaq 0x40a65(%rip), %rsi     # 0x5aba4
callq 0x10ec6
movq %rax, %r15
leaq -0x78(%rbp), %rdi
movq %r13, %rsi
leaq -0x54(%rbp), %r13
jmp 0x1a412
movq %rbx, %rdi
leaq -0x38(%rbp), %r14
movq %r14, %rsi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x50(%rbp)
movq -0x38(%rbp), %rax
movl 0x78(%rbx), %esi
andl %eax, %esi
movl 0x70(%rbx), %ecx
sarq %cl, %rax
movq %rax, -0x38(%rbp)
subl %ecx, -0x54(%rbp)
movl %esi, -0x70(%rbp)
movq 0x8(%rbx), %rdi
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r12, %rdx
callq 0x33556
callq 0x2ca2e
movq %rax, %rdi
leaq 0x3e032(%rip), %rsi     # 0x581fb
callq 0x2cc3e
movq 0x8(%rbx), %rsi
addq $0xc, %rsi
movq %rax, %rdi
callq 0x10e94
movq %rax, %rdi
leaq 0x3e062(%rip), %rsi     # 0x5824a
callq 0x1a544
jmp 0x1a30a
movq %rbx, %rdi
leaq -0x38(%rbp), %r14
movq %r14, %rsi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x50(%rbp)
movq 0x8(%rbx), %rdi
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r12, %rsi
callq 0x3351c
callq 0x2ca2e
movq %rax, %rdi
leaq 0x3dfb0(%rip), %rsi     # 0x581fb
callq 0x2cc3e
movq 0x8(%rbx), %rsi
addq $0xc, %rsi
movq %rax, %rdi
callq 0x10e94
movq %rax, %rdi
leaq 0x3dfc8(%rip), %rsi     # 0x58232
callq 0x1a4ae
jmp 0x1a325
movq %rbx, %rdi
leaq -0x38(%rbp), %r14
movq %r14, %rsi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x50(%rbp)
movq -0x38(%rbp), %rax
movl 0x78(%rbx), %esi
andl %eax, %esi
movl 0x70(%rbx), %ecx
sarq %cl, %rax
movq %rax, -0x38(%rbp)
subl %ecx, -0x54(%rbp)
movl %esi, -0x70(%rbp)
movq 0x8(%rbx), %rdi
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r12, %rdx
callq 0x3353e
callq 0x2ca2e
movq %rax, %rdi
leaq 0x3df15(%rip), %rsi     # 0x581fb
callq 0x2cc3e
movq 0x8(%rbx), %rsi
addq $0xc, %rsi
movq %rax, %rdi
callq 0x10e94
movq %rax, %rdi
leaq 0x3df3a(%rip), %rsi     # 0x5823f
callq 0x10f2a
movq %rax, %rdi
leaq -0x70(%rbp), %rsi
callq 0x1a512
movq %rax, %rdi
leaq 0x40884(%rip), %rsi     # 0x5aba4
callq 0x10ec6
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %rax, %rdi
movq %r12, %rsi
jmp 0x1a42e
movq %rbx, %rdi
leaq -0x38(%rbp), %r14
movq %r14, %rsi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r13, %rcx
callq 0x19f56
movsd %xmm0, -0x50(%rbp)
movq 0x8(%rbx), %rdi
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq %r12, %rsi
leaq -0x70(%rbp), %r14
movq %r14, %rdx
callq 0x334e8
callq 0x2ca2e
movq %rax, %rdi
leaq 0x3de50(%rip), %rsi     # 0x581fb
callq 0x2cc3e
movq 0x8(%rbx), %rsi
addq $0xc, %rsi
movq %rax, %rdi
callq 0x10e94
movq %rax, %rdi
leaq 0x3de68(%rip), %rsi     # 0x58232
callq 0x1a4ae
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %rax, %rdi
movq %r12, %rsi
callq 0x1a4e0
movq %rax, %rdi
leaq 0x407ac(%rip), %rsi     # 0x5aba4
callq 0x10ec6
andq $0x0, -0x80(%rbp)
movq %rax, %r15
andq $0x0, -0x78(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xd15b
movsd %xmm0, -0x70(%rbp)
movsd %xmm1, -0x68(%rbp)
movq %r15, %rdi
leaq 0x3dcf1(%rip), %r15     # 0x5811c
movq %r14, %rsi
callq 0x1a4e0
movq %rax, %rdi
movq 0x5cb73(%rip), %rsi     # 0x76fb0
callq 0x10f5c
movq %r13, %rax
jmp 0x19ff9
movq 0x5cb9f(%rip), %rdi     # 0x76ff0
leaq 0x3dd3e(%rip), %rsi     # 0x58196
callq 0x94b0
leaq 0x40d0e(%rip), %rsi     # 0x5b172
movq %rax, %rdi
callq 0x94b0
movq %rax, %rdi
movl $0x23f, %esi            # imm = 0x23F
callq 0x9890
leaq 0x3ef9f(%rip), %rsi     # 0x5941f
movq %rax, %rdi
callq 0x94b0
leaq 0x3ddc7(%rip), %rsi     # 0x58256
movq %rax, %rdi
callq 0x94b0
movq %rax, %rdi
callq 0x99e8
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq