// File: /workspace/github_cpp_makefile_star2_O1/wrighteagle2d[P]wrighteaglebase/Debug/../src/DynamicDebug.cpp
// Function: DynamicDebug::Initial(Observer*)
void DynamicDebug::Initial(Observer *pObserver) {
  if (mInitialOK == true) {
    return;
  }

  if (pObserver == 0) {
    PRINT_ERROR("Observer Null Pointer");
    return;
  }

  mpObserver = pObserver;

  if (PlayerParam::instance().DynamicDebugMode() == true) // 动态调试
  {
    mpFileStream = new std::ifstream("dynamicdebug.txt");
    if (mpFileStream) {
      std::cin.rdbuf(mpFileStream->rdbuf());
    }
  } else // 正常比赛时
  {
    if (PlayerParam::instance().SaveServerMessage() ==
        true) // 需要保存server信息
    {
      char file_name[64];
      sprintf(file_name, "%s/%s-%d-msg.log",
              PlayerParam::instance().logDir().c_str(),
              PlayerParam::instance().teamName().c_str(),
              mpObserver->SelfUnum());
      mpFile = fopen(file_name, "wb");
      if (mpFile) {
        if (setvbuf(mpFile, 0, _IOFBF, 1024 * 8192) != 0) {
          PRINT_ERROR("set buffer for file \"" << file_name << "\" error");
        }
      } else {
        PRINT_ERROR("open file \"" << file_name << "\" error");
      }
    }

    if (mpFile != 0) {
      fseek(mpFile, sizeof(mFileHead) + 2 * sizeof(char),
            SEEK_SET); // 留出mFileHead的地方，最后再填
      mFileHead.mIndexTableSize = 0;
      mIndexTable.reserve(8192);
      mMessageTable.reserve(8192);
    }
  }
  mInitialOK = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
cmpb $0x0, 0x8(%rdi)
jne 0x236f6
testq %rsi, %rsi
je 0x23485
movq %rdi, %rbx
movq %rsi, (%rdi)
callq 0x450ba
cmpb $0x1, 0x5c40(%rax)
jne 0x2351d
movl $0x208, %edi            # imm = 0x208
callq 0x94c0
movq %rax, %r14
leaq 0x48f26(%rip), %rsi     # 0x6c378
movq %rax, %rdi
movl $0x8, %edx
callq 0x9920
movq %r14, 0x128(%rbx)
movq 0x63b6b(%rip), %rdi     # 0x86fd8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
addq $0x10, %r14
movq %r14, %rsi
callq 0x9960
jmp 0x236f2
movq 0x63b64(%rip), %rbx     # 0x86ff0
leaq 0x48eb7(%rip), %rsi     # 0x6c34a
movl $0x17, %edx
movq %rbx, %rdi
callq 0x9560
leaq 0x4bd1b(%rip), %rsi     # 0x6f1c2
movl $0x1, %edx
movq %rbx, %rdi
callq 0x9560
movq %rbx, %rdi
movl $0x59, %esi
callq 0x9880
movq %rax, %rbx
leaq 0x49fb4(%rip), %rsi     # 0x6d47f
movl $0x3, %edx
movq %rax, %rdi
callq 0x9560
leaq 0x48e83(%rip), %rsi     # 0x6c362
movl $0x15, %edx
movq %rbx, %rdi
callq 0x9560
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %rbx, %rdi
callq 0x9070
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9330
callq 0x450ba
cmpb $0x1, 0x5c42(%rax)
jne 0x236b3
callq 0x450ba
movq 0x30f8(%rax), %r14
callq 0x450ba
movq 0x3138(%rax), %rcx
movq (%rbx), %rax
movl 0x2c(%rax), %r8d
leaq 0x48e34(%rip), %rsi     # 0x6c389
leaq -0x60(%rbp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x9110
leaq 0x48e2d(%rip), %rsi     # 0x6c39a
movq %r15, %rdi
callq 0x95a0
movq %rax, 0x120(%rbx)
testq %rax, %rax
je 0x235fb
movl $0x800000, %ecx         # imm = 0x800000
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x9060
testl %eax, %eax
je 0x236b3
movq 0x63a4f(%rip), %r14     # 0x86ff0
leaq 0x48da2(%rip), %rsi     # 0x6c34a
movl $0x17, %edx
movq %r14, %rdi
callq 0x9560
leaq 0x4bc06(%rip), %rsi     # 0x6f1c2
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
movq %r14, %rdi
movl $0x72, %esi
callq 0x9880
movq %rax, %r14
leaq 0x49e9f(%rip), %rsi     # 0x6d47f
movl $0x3, %edx
movq %rax, %rdi
callq 0x9560
leaq 0x48da9(%rip), %rsi     # 0x6c39d
movl $0x15, %edx
jmp 0x2365a
movq 0x639ee(%rip), %r14     # 0x86ff0
leaq 0x48d41(%rip), %rsi     # 0x6c34a
movl $0x17, %edx
movq %r14, %rdi
callq 0x9560
leaq 0x4bba5(%rip), %rsi     # 0x6f1c2
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
movq %r14, %rdi
movl $0x75, %esi
callq 0x9880
movq %rax, %r14
leaq 0x49e3e(%rip), %rsi     # 0x6d47f
movl $0x3, %edx
movq %rax, %rdi
callq 0x9560
leaq 0x48d66(%rip), %rsi     # 0x6c3bb
movl $0xb, %edx
movq %r14, %rdi
callq 0x9560
movq %r15, %rdi
callq 0x9200
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x9560
leaq 0x48d34(%rip), %rsi     # 0x6c3b3
movl $0x7, %edx
movq %r14, %rdi
callq 0x9560
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %r14, %rdi
callq 0x9070
movq %rax, %rdi
callq 0x9330
movq 0x120(%rbx), %rdi
testq %rdi, %rdi
je 0x236f2
movl $0x4a, %esi
xorl %edx, %edx
callq 0x9530
movq $0x0, 0x18(%rbx)
leaq 0x58(%rbx), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x246cc
leaq 0xb8(%rbx), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x24786
movb $0x1, 0x8(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
callq 0x94e0
movq %rbx, %rdi
callq 0x98b0
nop