// File: /workspace/github_c_makefile_star2_O0/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_parse_date_string
MG_INTERNAL time_t mg_parse_date_string(const char *datetime) {
  static const unsigned short days_before_month[] = {
      0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
  char month_str[32];
  int second, minute, hour, day, month, year, leap_days, days;
  time_t result = (time_t) 0;

  if (((sscanf(datetime, "%d/%3s/%d %d:%d:%d", &day, month_str, &year, &hour,
               &minute, &second) == 6) ||
       (sscanf(datetime, "%d %3s %d %d:%d:%d", &day, month_str, &year, &hour,
               &minute, &second) == 6) ||
       (sscanf(datetime, "%*3s, %d %3s %d %d:%d:%d", &day, month_str, &year,
               &hour, &minute, &second) == 6) ||
       (sscanf(datetime, "%d-%3s-%d %d:%d:%d", &day, month_str, &year, &hour,
               &minute, &second) == 6)) &&
      year > 1970 && (month = mg_get_month_index(month_str)) != -1) {
    leap_days = mg_num_leap_years(year) - mg_num_leap_years(1970);
    year -= 1970;
    days = year * 365 + days_before_month[month] + (day - 1) + leap_days;
    result = days * 24 * 3600 + hour * 3600 + minute * 60 + second;
  }

  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rcx
leaq 0x55ab(%rip), %rsi      # 0x210be
leaq -0x40(%rbp), %rdx
leaq -0x48(%rbp), %r8
leaq -0x3c(%rbp), %r9
leaq -0x38(%rbp), %r10
leaq -0x34(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x3460
cmpl $0x6, %eax
je 0x1bbec
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rcx
leaq 0x5588(%rip), %rsi      # 0x210d7
leaq -0x40(%rbp), %rdx
leaq -0x48(%rbp), %r8
leaq -0x3c(%rbp), %r9
leaq -0x38(%rbp), %r10
leaq -0x34(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x3460
cmpl $0x6, %eax
je 0x1bbec
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rcx
leaq 0x554a(%rip), %rsi      # 0x210d1
leaq -0x40(%rbp), %rdx
leaq -0x48(%rbp), %r8
leaq -0x3c(%rbp), %r9
leaq -0x38(%rbp), %r10
leaq -0x34(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x3460
cmpl $0x6, %eax
je 0x1bbec
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rcx
leaq 0x552b(%rip), %rsi      # 0x210ea
leaq -0x40(%rbp), %rdx
leaq -0x48(%rbp), %r8
leaq -0x3c(%rbp), %r9
leaq -0x38(%rbp), %r10
leaq -0x34(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x3460
cmpl $0x6, %eax
jne 0x1bc7c
cmpl $0x7b2, -0x48(%rbp)     # imm = 0x7B2
jle 0x1bc7c
leaq -0x30(%rbp), %rdi
callq 0x1bc90
movl %eax, -0x44(%rbp)
cmpl $-0x1, %eax
je 0x1bc7c
movl -0x48(%rbp), %edi
callq 0x1bd00
movl %eax, -0x5c(%rbp)
movl $0x7b2, %edi            # imm = 0x7B2
callq 0x1bd00
movl %eax, %ecx
movl -0x5c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
subl $0x7b2, %eax            # imm = 0x7B2
movl %eax, -0x48(%rbp)
imull $0x16d, -0x48(%rbp), %eax # imm = 0x16D
movslq -0x44(%rbp), %rdx
leaq 0x389a(%rip), %rcx      # 0x1f4e0
movzwl (%rcx,%rdx,2), %ecx
addl %ecx, %eax
movl -0x40(%rbp), %ecx
subl $0x1, %ecx
addl %ecx, %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x50(%rbp)
imull $0x18, -0x50(%rbp), %eax
imull $0xe10, %eax, %eax      # imm = 0xE10
imull $0xe10, -0x3c(%rbp), %ecx # imm = 0xE10
addl %ecx, %eax
imull $0x3c, -0x38(%rbp), %ecx
addl %ecx, %eax
addl -0x34(%rbp), %eax
cltq
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)