// File: /workspace/github_cpp_makefile_star2_O3/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 0x23044
testq %rsi, %rsi
je 0x22dd3
movq %rdi, %rbx
movq %rsi, (%rdi)
callq 0x43dce
cmpb $0x1, 0x5c40(%rax)
jne 0x22e6b
movl $0x208, %edi            # imm = 0x208
callq 0x94c0
movq %rax, %r14
leaq 0x475c8(%rip), %rsi     # 0x6a368
movq %rax, %rdi
movl $0x8, %edx
callq 0x9920
movq %r14, 0x128(%rbx)
movq 0x6121d(%rip), %rdi     # 0x83fd8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
addq $0x10, %r14
movq %r14, %rsi
callq 0x9960
jmp 0x23040
movq 0x61216(%rip), %rbx     # 0x83ff0
leaq 0x47559(%rip), %rsi     # 0x6a33a
movl $0x17, %edx
movq %rbx, %rdi
callq 0x9560
leaq 0x4a39d(%rip), %rsi     # 0x6d192
movl $0x1, %edx
movq %rbx, %rdi
callq 0x9560
movq %rbx, %rdi
movl $0x59, %esi
callq 0x9880
movq %rax, %rbx
leaq 0x4863e(%rip), %rsi     # 0x6b457
movl $0x3, %edx
movq %rax, %rdi
callq 0x9560
leaq 0x47525(%rip), %rsi     # 0x6a352
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 0x43dce
cmpb $0x1, 0x5c42(%rax)
jne 0x23001
callq 0x43dce
movq 0x30f8(%rax), %r14
callq 0x43dce
movq 0x3138(%rax), %rcx
movq (%rbx), %rax
movl 0x2c(%rax), %r8d
leaq 0x474d6(%rip), %rsi     # 0x6a379
leaq -0x60(%rbp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x9110
leaq 0x474cf(%rip), %rsi     # 0x6a38a
movq %r15, %rdi
callq 0x95a0
movq %rax, 0x120(%rbx)
testq %rax, %rax
je 0x22f49
movl $0x800000, %ecx         # imm = 0x800000
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x9060
testl %eax, %eax
je 0x23001
movq 0x61101(%rip), %r14     # 0x83ff0
leaq 0x47444(%rip), %rsi     # 0x6a33a
movl $0x17, %edx
movq %r14, %rdi
callq 0x9560
leaq 0x4a288(%rip), %rsi     # 0x6d192
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
movq %r14, %rdi
movl $0x72, %esi
callq 0x9880
movq %rax, %r14
leaq 0x48529(%rip), %rsi     # 0x6b457
movl $0x3, %edx
movq %rax, %rdi
callq 0x9560
leaq 0x4744b(%rip), %rsi     # 0x6a38d
movl $0x15, %edx
jmp 0x22fa8
movq 0x610a0(%rip), %r14     # 0x83ff0
leaq 0x473e3(%rip), %rsi     # 0x6a33a
movl $0x17, %edx
movq %r14, %rdi
callq 0x9560
leaq 0x4a227(%rip), %rsi     # 0x6d192
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
movq %r14, %rdi
movl $0x75, %esi
callq 0x9880
movq %rax, %r14
leaq 0x484c8(%rip), %rsi     # 0x6b457
movl $0x3, %edx
movq %rax, %rdi
callq 0x9560
leaq 0x47408(%rip), %rsi     # 0x6a3ab
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 0x473d6(%rip), %rsi     # 0x6a3a3
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 0x23040
movl $0x4a, %esi
xorl %edx, %edx
callq 0x9530
movq $0x0, 0x18(%rbx)
leaq 0x58(%rbx), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x2400e
leaq 0xb8(%rbx), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x240c8
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