// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/logger.cpp
// Function: ash::Logger::Logger(ash::Severity)
Logger::Logger(const Severity lvl)
  : ostream(NULL), log(get_target(lvl).c_str(), fstream::out | fstream::app), level(lvl)
{
  char time_now[200];
  time_t t = time(NULL);

  // Get the session_id, if it has already beeen set.
  const char * session_id =
    getenv("ASH_SESSION_ID") ? getenv("ASH_SESSION_ID") : "?";

  // Get the time now.
  struct tm * tmp = localtime(&t);
  if (tmp == NULL) {
    perror("advanced shell history Logger: localtime");
    if (level != FATAL) {
      LOG(FATAL) << "Failed to get localtime on this machine.";  // recurse
    } else {
      log << "SESSION " << session_id << ": " << to_str(level) << ": ";
      return;
    }
  }

  // Get the log date format, if one was specified.
  Config & config = Config::instance();
  string format = config.get_string("LOG_DATE_FMT", "%Y-%m-%d %H:%M:%S %Z: ");
  if (strftime(time_now, sizeof(time_now), format.c_str(), tmp) == 0) {
    if (level != FATAL) {  // avoids infinite recursion.
      LOG(FATAL) << "ASH_CFG_LOG_DATE_FMT is invalid: '" << format << "'";
    } else {
      log << "SESSION " << session_id << ": " << to_str(level) << ": ";
    }
  } else {
    log << time_now << "SESSION " << session_id << ": " << to_str(level)
        << ": ";
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x438, %rsp            # imm = 0x438
movl %esi, %ebp
movq %rdi, %r15
leaq 0x210(%rdi), %r14
movq %r14, %rdi
callq 0x8110
movq $0x0, 0x2e8(%r15)
movw $0x0, 0x2f0(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x2f8(%r15)
movups %xmm0, 0x308(%r15)
leaq 0x23ac6(%rip), %rax     # 0x93ca0
movq %rax, (%r15)
leaq 0x23ae4(%rip), %rax     # 0x93cc8
movq %rax, 0x210(%r15)
movq %r14, %rdi
xorl %esi, %esi
movq %r14, 0x8(%rsp)
callq 0x8520
leaq 0x23a2f(%rip), %rax     # 0x93c30
movq %rax, (%r15)
leaq 0x23a4d(%rip), %rax     # 0x93c58
movq %rax, 0x210(%r15)
leaq 0x58(%rsp), %rdi
movl %ebp, %esi
callq 0x6fb61
leaq 0x8(%r15), %rdi
movq 0x58(%rsp), %rsi
movq %rdi, (%rsp)
movl $0x11, %edx
callq 0x8460
leaq 0x68(%rsp), %rbx
movq -0x10(%rbx), %rdi
cmpq %rbx, %rdi
je 0x70248
callq 0x8390
movl %ebp, 0x208(%r15)
xorl %edi, %edi
callq 0x8370
leaq 0x50(%rsp), %r13
movq %rax, (%r13)
leaq 0xd6cd(%rip), %rdi      # 0x7d933
callq 0x84d0
testq %rax, %rax
leaq 0x96a1(%rip), %r12      # 0x79916
cmovneq %rax, %r12
movq %r13, %rdi
callq 0x82b0
movq %rax, %r13
testq %rax, %rax
je 0x704a0
callq 0x69ef2
movq %rax, %rbp
leaq 0x58(%rsp), %rdi
movq %rbx, (%rdi)
leaq 0xe05a(%rip), %rsi      # 0x7e2fe
leaq 0xe05f(%rip), %rdx      # 0x7e30a
callq 0x68de4
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xe04b(%rip), %rsi      # 0x7e30b
leaq 0xe05a(%rip), %rdx      # 0x7e321
leaq 0x30(%rsp), %rdi
callq 0x68de4
leaq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %rdx
leaq 0x30(%rsp), %rcx
movq %rbp, %rsi
callq 0x69e9a
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x702f7
callq 0x8390
movq 0x58(%rsp), %rdi
cmpq %rbx, %rdi
movq (%rsp), %rbx
je 0x7030a
callq 0x8390
movq 0x10(%rsp), %rdx
leaq 0x370(%rsp), %rdi
movl $0xc8, %esi
movq %r13, %rcx
callq 0x82e0
testq %rax, %rax
je 0x70387
leaq 0x370(%rsp), %r13
movq %r13, %rdi
callq 0x8190
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x8470
leaq 0xdfa7(%rip), %rsi      # 0x7e2f5
movl $0x8, %edx
movq %rbx, %rdi
callq 0x8470
movq %r12, %rdi
callq 0x8190
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x8470
leaq 0xf42c(%rip), %rsi      # 0x7f7a4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x8470
jmp 0x703d3
cmpl $0x4, 0x208(%r15)
jne 0x70446
leaq 0xdf59(%rip), %rsi      # 0x7e2f5
movl $0x8, %edx
movq %rbx, %rdi
callq 0x8470
movq %r12, %rdi
callq 0x8190
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x8470
leaq 0xf3de(%rip), %rsi      # 0x7f7a4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x8470
movl 0x208(%r15), %eax
cmpq $0x4, %rax
ja 0x703f0
leaq 0x23909(%rip), %rcx     # 0x93cf0
leaq (%rcx,%rax,8), %rax
movq (%rax), %r15
jmp 0x703f7
leaq 0xde87(%rip), %r15      # 0x7e27e
movq %r15, %rdi
callq 0x8190
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x8470
leaq 0xf390(%rip), %rsi      # 0x7f7a4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x8470
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x70434
callq 0x8390
addq $0x438, %rsp            # imm = 0x438
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x58(%rsp), %rdi
movl $0x4, %esi
callq 0x70186
leaq 0x60(%rsp), %r15
leaq 0xdec1(%rip), %rsi      # 0x7e322
movl $0x22, %edx
movq %r15, %rdi
callq 0x8470
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x8470
leaq 0xdebc(%rip), %rsi      # 0x7e343
movl $0x1, %edx
movq %rax, %rdi
callq 0x8470
leaq 0x58(%rsp), %rdi
callq 0x70626
jmp 0x70421
leaq 0xddfc(%rip), %rdi      # 0x7e2a3
callq 0x8300
cmpl $0x4, 0x208(%r15)
jne 0x70512
leaq 0xde38(%rip), %rsi      # 0x7e2f5
movl $0x8, %edx
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x8470
movq %r12, %rdi
callq 0x8190
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x8470
leaq 0xf2b9(%rip), %rsi      # 0x7f7a4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x8470
movl 0x208(%r15), %eax
cmpq $0x4, %rax
ja 0x70546
leaq 0x237e4(%rip), %rcx     # 0x93cf0
movq (%rcx,%rax,8), %r15
jmp 0x7054d
leaq 0x58(%rsp), %rdi
movl $0x4, %esi
callq 0x70186
leaq 0x60(%rsp), %rdi
leaq 0xdd9f(%rip), %rsi      # 0x7e2cc
movl $0x28, %edx
callq 0x8470
leaq 0x58(%rsp), %rdi
callq 0x70626
jmp 0x7028d
leaq 0xdd31(%rip), %r15      # 0x7e27e
movq %r15, %rdi
callq 0x8190
movq (%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x8470
leaq 0xf236(%rip), %rsi      # 0x7f7a4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x8470
jmp 0x70434
movq %rax, %r15
leaq 0x58(%rsp), %rdi
callq 0x70626
jmp 0x70603
jmp 0x705c9
jmp 0x705c9
jmp 0x705ed
movq %rax, %r15
leaq 0x58(%rsp), %rdi
callq 0x70626
jmp 0x705f0
movq %rax, %r15
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x705bb
callq 0x8390
jmp 0x705bb
movq %rax, %r15
movq 0x58(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x705fe
jmp 0x70603
jmp 0x705c9
movq %rax, %r15
jmp 0x70603
movq %rax, %r15
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7060c
callq 0x8390
jmp 0x7060c
jmp 0x705e8
movq %rax, %r15
jmp 0x7060c
movq %rax, %r15
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x70603
callq 0x8390
movq (%rsp), %rdi
callq 0x85a0
movq 0x8(%rsp), %rdi
callq 0x8140
movq %r15, %rdi
callq 0x8720
movq %rax, %rdi
callq 0x68c53