// File: /workspace/github_c_makefile_star2_O3/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 0x23d5a(%rip), %rax     # 0x93ca0
movq %rax, (%r15)
leaq 0x23d78(%rip), %rax     # 0x93cc8
movq %rax, 0x210(%r15)
movq %r14, %rdi
xorl %esi, %esi
movq %r14, 0x8(%rsp)
callq 0x8520
leaq 0x23cc3(%rip), %rax     # 0x93c30
movq %rax, (%r15)
leaq 0x23ce1(%rip), %rax     # 0x93c58
movq %rax, 0x210(%r15)
leaq 0x58(%rsp), %rdi
movl %ebp, %esi
callq 0x6f8cd
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 0x6ffb4
callq 0x8390
movl %ebp, 0x208(%r15)
xorl %edi, %edi
callq 0x8370
leaq 0x50(%rsp), %r13
movq %rax, (%r13)
leaq 0xd9b1(%rip), %rdi      # 0x7d983
callq 0x84d0
testq %rax, %rax
leaq 0x9935(%rip), %r12      # 0x79916
cmovneq %rax, %r12
movq %r13, %rdi
callq 0x82b0
movq %rax, %r13
testq %rax, %rax
je 0x7020c
callq 0x69cd0
movq %rax, %rbp
leaq 0x58(%rsp), %rdi
movq %rbx, (%rdi)
leaq 0xe33e(%rip), %rsi      # 0x7e34e
leaq 0xe343(%rip), %rdx      # 0x7e35a
callq 0x68bce
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xe32f(%rip), %rsi      # 0x7e35b
leaq 0xe33e(%rip), %rdx      # 0x7e371
leaq 0x30(%rsp), %rdi
callq 0x68bce
leaq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %rdx
leaq 0x30(%rsp), %rcx
movq %rbp, %rsi
callq 0x69c78
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x70063
callq 0x8390
movq 0x58(%rsp), %rdi
cmpq %rbx, %rdi
movq (%rsp), %rbx
je 0x70076
callq 0x8390
movq 0x10(%rsp), %rdx
leaq 0x370(%rsp), %rdi
movl $0xc8, %esi
movq %r13, %rcx
callq 0x82e0
testq %rax, %rax
je 0x700f3
leaq 0x370(%rsp), %r13
movq %r13, %rdi
callq 0x8190
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x8470
leaq 0xe28b(%rip), %rsi      # 0x7e345
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 0xf710(%rip), %rsi      # 0x7f7f4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x8470
jmp 0x7013f
cmpl $0x4, 0x208(%r15)
jne 0x701b2
leaq 0xe23d(%rip), %rsi      # 0x7e345
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 0xf6c2(%rip), %rsi      # 0x7f7f4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x8470
movl 0x208(%r15), %eax
cmpq $0x5, %rax
jae 0x7015c
leaq 0x23b9d(%rip), %rcx     # 0x93cf0
leaq (%rcx,%rax,8), %rax
movq (%rax), %r15
jmp 0x70163
leaq 0xe16b(%rip), %r15      # 0x7e2ce
movq %r15, %rdi
callq 0x8190
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x8470
leaq 0xf674(%rip), %rsi      # 0x7f7f4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x8470
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x701a0
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 0x6fef2
leaq 0x60(%rsp), %r15
leaq 0xe1a5(%rip), %rsi      # 0x7e372
movl $0x22, %edx
movq %r15, %rdi
callq 0x8470
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x8470
leaq 0xe1a0(%rip), %rsi      # 0x7e393
movl $0x1, %edx
movq %rax, %rdi
callq 0x8470
leaq 0x58(%rsp), %rdi
callq 0x70392
jmp 0x7018d
leaq 0xe0e0(%rip), %rdi      # 0x7e2f3
callq 0x8300
cmpl $0x4, 0x208(%r15)
jne 0x7027e
leaq 0xe11c(%rip), %rsi      # 0x7e345
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 0xf59d(%rip), %rsi      # 0x7f7f4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x8470
movl 0x208(%r15), %eax
cmpq $0x4, %rax
ja 0x702b2
leaq 0x23a78(%rip), %rcx     # 0x93cf0
movq (%rcx,%rax,8), %r15
jmp 0x702b9
leaq 0x58(%rsp), %rdi
movl $0x4, %esi
callq 0x6fef2
leaq 0x60(%rsp), %rdi
leaq 0xe083(%rip), %rsi      # 0x7e31c
movl $0x28, %edx
callq 0x8470
leaq 0x58(%rsp), %rdi
callq 0x70392
jmp 0x6fff9
leaq 0xe015(%rip), %r15      # 0x7e2ce
movq %r15, %rdi
callq 0x8190
movq (%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x8470
leaq 0xf51a(%rip), %rsi      # 0x7f7f4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x8470
jmp 0x701a0
movq %rax, %r15
leaq 0x58(%rsp), %rdi
callq 0x70392
jmp 0x7036f
jmp 0x70335
jmp 0x70335
jmp 0x70359
movq %rax, %r15
leaq 0x58(%rsp), %rdi
callq 0x70392
jmp 0x7035c
movq %rax, %r15
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x70327
callq 0x8390
jmp 0x70327
movq %rax, %r15
movq 0x58(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x7036a
jmp 0x7036f
jmp 0x70335
movq %rax, %r15
jmp 0x7036f
movq %rax, %r15
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x70378
callq 0x8390
jmp 0x70378
jmp 0x70354
movq %rax, %r15
jmp 0x70378
movq %rax, %r15
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7036f
callq 0x8390
movq (%rsp), %rdi
callq 0x85a0
movq 0x8(%rsp), %rdi
callq 0x8140
movq %r15, %rdi
callq 0x8720
movq %rax, %rdi
callq 0x68a31