// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/analyzer/../common/parse.c
// Function: parseTimestamp
bool parseTimestamp(const char *msg, uint64_t *when)
{
  struct tm t;
  time_t    epoch;
  int       year  = 0;
  int       month = 0;
  int       day   = 0;
  int       hour  = 0;
  int       min   = 0;
  int       sec   = 0;
  int       milli = 0;
  char     *p;

  p = strstr(msg, "Z,");
  if (p)
  {
    if (sscanf(msg, "%d-%d-%dT%d:%d:%d.%dZ", &year, &month, &day, &hour, &min, &sec, &milli) < 6)
    {
      logDebug("Unable to parse timestamp '%s'\n", msg);
      return false;
    }
    t.tm_year  = year - 1900;
    t.tm_mon   = month - 1;
    t.tm_mday  = day;
    t.tm_hour  = hour;
    t.tm_min   = min;
    t.tm_sec   = sec;
    t.tm_isdst = -1;
    epoch      = timegm(&t);
  }
  else
  {
    if (sscanf(msg, "%d-%d-%d %d:%d:%d.%d", &year, &month, &day, &hour, &min, &sec, &milli) < 6)
    {
      logDebug("Unable to parse timestamp '%s'\n", msg);
      return false;
    }
    t.tm_year  = year - 1900;
    t.tm_mon   = month - 1;
    t.tm_mday  = day;
    t.tm_hour  = hour;
    t.tm_min   = min;
    t.tm_sec   = sec;
    t.tm_isdst = -1;
    epoch      = mktime(&t);
  }

  logDebug("parseTimestamp '%s' => %d-%d-%d %d:%d:%d.%03d\n", msg, year, month, day, hour, min, sec, milli);

  *when = epoch * UINT64_C(1000) + milli;

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x0, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x13558(%rip), %rsi     # 0x36117
callq 0xd340
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0x22c74
movq -0x10(%rbp), %rdi
leaq 0x1353c(%rip), %rsi     # 0x3611a
leaq -0x5c(%rbp), %rdx
leaq -0x60(%rbp), %rcx
leaq -0x64(%rbp), %r8
leaq -0x68(%rbp), %r9
leaq -0x6c(%rbp), %r11
leaq -0x70(%rbp), %r10
leaq -0x74(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0xd220
cmpl $0x6, %eax
jge 0x22c2f
movq -0x10(%rbp), %rsi
leaq 0x13511(%rip), %rdi     # 0x36130
movb $0x0, %al
callq 0x1f670
movb $0x0, -0x1(%rbp)
jmp 0x22d62
movl -0x5c(%rbp), %eax
subl $0x76c, %eax            # imm = 0x76C
movl %eax, -0x3c(%rbp)
movl -0x60(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x50(%rbp)
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
leaq -0x50(%rbp), %rdi
callq 0xd250
movq %rax, -0x58(%rbp)
jmp 0x22d10
movq -0x10(%rbp), %rdi
leaq 0x134d1(%rip), %rsi     # 0x36150
leaq -0x5c(%rbp), %rdx
leaq -0x60(%rbp), %rcx
leaq -0x64(%rbp), %r8
leaq -0x68(%rbp), %r9
leaq -0x6c(%rbp), %r11
leaq -0x70(%rbp), %r10
leaq -0x74(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0xd220
cmpl $0x6, %eax
jge 0x22cd0
movq -0x10(%rbp), %rsi
leaq 0x13470(%rip), %rdi     # 0x36130
movb $0x0, %al
callq 0x1f670
movb $0x0, -0x1(%rbp)
jmp 0x22d62
movl -0x5c(%rbp), %eax
subl $0x76c, %eax            # imm = 0x76C
movl %eax, -0x3c(%rbp)
movl -0x60(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x50(%rbp)
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
leaq -0x50(%rbp), %rdi
callq 0xd230
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rsi
movl -0x5c(%rbp), %edx
movl -0x60(%rbp), %ecx
movl -0x64(%rbp), %r8d
movl -0x68(%rbp), %r9d
movl -0x6c(%rbp), %r11d
movl -0x70(%rbp), %r10d
movl -0x74(%rbp), %eax
leaq 0x13431(%rip), %rdi     # 0x36165
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x1f670
imulq $0x3e8, -0x58(%rbp), %rcx # imm = 0x3E8
movslq -0x74(%rbp), %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq