// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/DynamicDebug.cpp
// Function: DynamicDebug::Flush()
void DynamicDebug::Flush() {
  if (PlayerParam::instance().SaveServerMessage() &&
      !PlayerParam::instance().DynamicDebugMode()) {
    if (mpFile != 0) {
      long long i = 0; // 循环变量
      // mFileHead.mHeadFlag[0] = 'D';
      // mFileHead.mHeadFlag[1] = 'D';

      // 赋值4个表的大小，后面将要写到文件中
      mFileHead.mIndexTableSize = mIndexTable.size();
      mFileHead.mParserTableSize = mParserTimeTable.size();
      mFileHead.mDecisionTableSize = mDecisionTimeTable.size();
      mFileHead.mCommandSendTableSize = mCommandSendTimeTable.size();

      // message
      long long size = mFileHead.mIndexTableSize;
      for (i = 0; i < size; ++i) {
        mIndexTable[i].mDataOffset = ftell(mpFile);
        fwrite(&mMessageTable[i].mType, 1, 1, mpFile); // 先写入消息类型
        fwrite(mMessageTable[i].mString.c_str(), mIndexTable[i].mDataSize, 1,
               mpFile);
      }

      // index table
      mFileHead.mIndexTableOffset = ftell(mpFile);
      mpIndex = new MessageIndexTableUnit[size];
      for (i = 0; i < size; ++i) {
        memcpy(&mpIndex[i], &mIndexTable[i], sizeof(MessageIndexTableUnit));
      }
      fwrite(mpIndex, size * sizeof(MessageIndexTableUnit), 1, mpFile);

      // observer time
      mFileHead.mParserTableOffset = ftell(mpFile);
      size = mFileHead.mParserTableSize;
      mpParserTime = new timeval[size];
      for (i = 0; i < size; ++i) {
        mpParserTime[i] = mParserTimeTable[i];
      }
      fwrite(mpParserTime, size * sizeof(timeval), 1, mpFile);

      // decision time
      mFileHead.mDecisionTableOffset = ftell(mpFile);
      size = mFileHead.mDecisionTableSize;
      mpDecisionTime = new timeval[size];
      for (i = 0; i < size; ++i) {
        mpDecisionTime[i] = mDecisionTimeTable[i];
      }
      fwrite(mpDecisionTime, size * sizeof(timeval), 1, mpFile);

      // commandsend time
      mFileHead.mCommandSendTableOffset = ftell(mpFile);
      size = mFileHead.mCommandSendTableSize;
      mpCommandSendTime = new timeval[size];
      for (i = 0; i < size; ++i) {
        mpCommandSendTime[i] = mCommandSendTimeTable[i];
      }
      fwrite(mpCommandSendTime, size * sizeof(timeval), 1, mpFile);

      fseek(mpFile, 0, SEEK_SET);
      fprintf(mpFile, "DD");
      fwrite(&mFileHead, sizeof(mFileHead), 1, mpFile);
    }

    if (mpFile != 0) {
      fclose(mpFile);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
callq 0x798a0
movq %rax, %rdi
callq 0x12160
testb $0x1, (%rax)
je 0x33ede
callq 0x798a0
movq %rax, %rdi
callq 0x12140
testb $0x1, (%rax)
jne 0x33ede
movq -0x30(%rbp), %rax
cmpq $0x0, 0x120(%rax)
je 0x33ebe
movq -0x30(%rbp), %rdi
movq $0x0, -0x10(%rbp)
addq $0x58, %rdi
callq 0x361d0
movq -0x30(%rbp), %rdi
movq %rax, 0x18(%rdi)
addq $0x70, %rdi
callq 0x35dd0
movq -0x30(%rbp), %rdi
movq %rax, 0x28(%rdi)
addq $0x88, %rdi
callq 0x35dd0
movq -0x30(%rbp), %rdi
movq %rax, 0x38(%rdi)
addq $0xa0, %rdi
callq 0x35dd0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x48(%rax)
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x33a9e
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rdi
callq 0xa030
movq -0x30(%rbp), %rdi
movq %rax, -0x40(%rbp)
addq $0x58, %rdi
movq -0x10(%rbp), %rsi
callq 0x361f0
movq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rdi
movq %rcx, 0x10(%rax)
addq $0xb8, %rdi
movq -0x10(%rbp), %rsi
callq 0x36210
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0xaba0
movq -0x30(%rbp), %rdi
addq $0xb8, %rdi
movq -0x10(%rbp), %rsi
callq 0x36210
movq %rax, %rdi
addq $0x8, %rdi
callq 0xa240
movq -0x30(%rbp), %rdi
movq %rax, -0x38(%rbp)
addq $0x58, %rdi
movq -0x10(%rbp), %rsi
callq 0x361f0
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq 0x8(%rcx), %rsi
movq 0x120(%rax), %rcx
movl $0x1, %edx
callq 0xaba0
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x339ce
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rdi
callq 0xa030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x20, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
movq %rdi, -0x58(%rbp)
callq 0xa050
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, -0x48(%rbp)
cmpq $0x0, %rax
je 0x33b35
movq -0x48(%rbp), %rax
movq -0x50(%rbp), %rdx
shlq $0x5, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x68(%rbp)
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x35da0
jmp 0x33b20
movq -0x68(%rbp), %rcx
movq -0x70(%rbp), %rax
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x60(%rbp)
jne 0x33b11
movq -0x30(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, 0xd0(%rax)
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x33bce
movq -0x30(%rbp), %rdi
movq 0xd0(%rdi), %rax
movq -0x10(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
addq $0x58, %rdi
movq -0x10(%rbp), %rsi
callq 0x361f0
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x33b4c
movq -0x58(%rbp), %rsi
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0xabb0
jmp 0x33ee7
movq -0x30(%rbp), %rax
movq 0xd0(%rax), %rdi
movq -0x18(%rbp), %rsi
shlq $0x5, %rsi
movq 0x120(%rax), %rcx
movl $0x1, %edx
callq 0xaba0
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rdi
callq 0xa030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x30(%rax)
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl $0x10, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xa050
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0xd8(%rax)
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x33ca0
movq -0x30(%rbp), %rdi
addq $0x70, %rdi
movq -0x10(%rbp), %rsi
callq 0x36230
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq 0xd8(%rax), %rax
movq -0x10(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x33c50
movq -0x30(%rbp), %rax
movq 0xd8(%rax), %rdi
movq -0x18(%rbp), %rsi
shlq $0x4, %rsi
movq 0x120(%rax), %rcx
movl $0x1, %edx
callq 0xaba0
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rdi
callq 0xa030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x40(%rax)
movq 0x38(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl $0x10, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xa050
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0xe0(%rax)
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x33d75
movq -0x30(%rbp), %rdi
addq $0x88, %rdi
movq -0x10(%rbp), %rsi
callq 0x36230
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq 0xe0(%rax), %rax
movq -0x10(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x33d22
movq -0x30(%rbp), %rax
movq 0xe0(%rax), %rdi
movq -0x18(%rbp), %rsi
shlq $0x4, %rsi
movq 0x120(%rax), %rcx
movl $0x1, %edx
callq 0xaba0
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rdi
callq 0xa030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movq 0x48(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl $0x10, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xa050
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0xe8(%rax)
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x33e4a
movq -0x30(%rbp), %rdi
addq $0xa0, %rdi
movq -0x10(%rbp), %rsi
callq 0x36230
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq 0xe8(%rax), %rax
movq -0x10(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x33df7
movq -0x30(%rbp), %rax
movq 0xe8(%rax), %rdi
movq -0x18(%rbp), %rsi
shlq $0x4, %rsi
movq 0x120(%rax), %rcx
movl $0x1, %edx
callq 0xaba0
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0xa690
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rdi
leaq 0x8e618(%rip), %rsi     # 0xc24ae
movb $0x0, %al
callq 0xa890
movq -0x30(%rbp), %rax
movq %rax, %rdi
addq $0x10, %rdi
movq 0x120(%rax), %rcx
movl $0x48, %esi
movl $0x1, %edx
callq 0xaba0
movq -0x30(%rbp), %rax
cmpq $0x0, 0x120(%rax)
je 0x33edc
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rdi
callq 0xa5b0
jmp 0x33ede
addq $0x80, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0xaa60