// File: 4n6ist[P]usn_analytics/lib/utils.cpp
// Function: parse_datetimemicro[abi:cxx11](unsigned long, bool)
string parse_datetimemicro(uint64_t _time, bool lt) {  
  char buf1[32], buf2[7];
  struct tm *tm_info;
  int microseconds;
  time_t epoch;
  string time_str;
 
  // 11644473600.0 seconds from 1601/01/01 to 1970/01/01
  epoch = _time/(10*1000*1000) - 11644473600L;
  microseconds = (_time%(10*1000*1000))/10;
 
  if(lt)
    tm_info = localtime(&epoch);
  else
    tm_info = gmtime(&epoch);
 
  strftime(buf1, 20, "%Y/%m/%d %H:%M:%S", tm_info);
  sprintf(buf2, "%06d", microseconds);  
  time_str = string(buf1) + "." + string(buf2);
  
  return time_str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x118(%rbp)
movb %dl, %al
movq %rdi, %rcx
movq %rcx, -0x110(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movb $0x0, -0x61(%rbp)
callq 0x34b0
movq -0x10(%rbp), %rax
movl $0x989680, %ecx         # imm = 0x989680
xorl %edx, %edx
divq %rcx
movabsq $0x2b6109100, %rcx      # imm = 0x2B6109100
subq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movl $0x989680, %ecx         # imm = 0x989680
xorl %edx, %edx
divq %rcx
movq %rdx, %rax
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
movl %eax, -0x54(%rbp)
testb $0x1, -0x11(%rbp)
je 0x17ba6
leaq -0x60(%rbp), %rdi
callq 0x3250
movq %rax, -0x50(%rbp)
jmp 0x17bb3
leaq -0x60(%rbp), %rdi
callq 0x32d0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
leaq 0x4bfe(%rip), %rdx      # 0x1c7bc
leaq -0x40(%rbp), %rdi
movq %rdi, -0x128(%rbp)
movl $0x14, %esi
callq 0x3280
movl -0x54(%rbp), %edx
leaq 0x4bff(%rip), %rsi      # 0x1c7dc
xorl %eax, %eax
leaq -0x47(%rbp), %rdi
callq 0x30a0
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x35d0
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0xa400
jmp 0x17c17
leaq 0x4b69(%rip), %rdx      # 0x1c787
leaq -0xa8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xa360
jmp 0x17c33
leaq -0x101(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x35d0
movq -0x130(%rbp), %rdx
leaq -0x100(%rbp), %rdi
leaq -0x47(%rbp), %rsi
callq 0xa400
jmp 0x17c5f
leaq -0x88(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0xaa80
jmp 0x17c7b
movq -0x118(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3450
leaq -0x88(%rbp), %rdi
callq 0x31d0
leaq -0x100(%rbp), %rdi
callq 0x31d0
leaq -0x101(%rbp), %rdi
callq 0x33c0
leaq -0xa8(%rbp), %rdi
callq 0x31d0
leaq -0xc8(%rbp), %rdi
callq 0x31d0
leaq -0xc9(%rbp), %rdi
callq 0x33c0
movb $0x1, -0x61(%rbp)
testb $0x1, -0x61(%rbp)
jne 0x17d8d
jmp 0x17d81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x17d67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x17d5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x17d43
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x31d0
leaq -0x101(%rbp), %rdi
callq 0x33c0
leaq -0xa8(%rbp), %rdi
callq 0x31d0
leaq -0xc8(%rbp), %rdi
callq 0x31d0
leaq -0xc9(%rbp), %rdi
callq 0x33c0
movq -0x118(%rbp), %rdi
callq 0x31d0
jmp 0x17d9d
movq -0x118(%rbp), %rdi
callq 0x31d0
movq -0x110(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0xd8(%rbp), %rdi
callq 0x35c0
nopl (%rax)