// File: /workspace/github_c_makefile_star2_O2/cktan[P]tomlc99/toml.c
// Function: toml_rtots
int toml_rtots(toml_raw_t src_, toml_timestamp_t *ret) {
  if (!src_)
    return -1;

  const char *p = src_;
  int must_parse_time = 0;

  memset(ret, 0, sizeof(*ret));

  int *year = &ret->__buffer.year;
  int *month = &ret->__buffer.month;
  int *day = &ret->__buffer.day;
  int *hour = &ret->__buffer.hour;
  int *minute = &ret->__buffer.minute;
  int *second = &ret->__buffer.second;
  int *millisec = &ret->__buffer.millisec;

  /* parse date YYYY-MM-DD */
  if (0 == scan_date(p, year, month, day)) {
    ret->year = year;
    ret->month = month;
    ret->day = day;

    p += 10;
    if (*p) {
      // parse the T or space separator
      if (*p != 'T' && *p != 't' && *p != ' ')
        return -1;
      must_parse_time = 1;
      p++;
    }
  }

  /* parse time HH:MM:SS */
  if (0 == scan_time(p, hour, minute, second)) {
    ret->hour = hour;
    ret->minute = minute;
    ret->second = second;

    /* optionally, parse millisec */
    p += 8;
    if (*p == '.') {
      p++; /* skip '.' */
      const char *qq;
      *millisec = parse_millisec(p, &qq);
      ret->millisec = millisec;
      p = qq;
    }

    if (*p) {
      /* parse and copy Z */
      char *z = ret->__buffer.z;
      ret->z = z;
      if (*p == 'Z' || *p == 'z') {
        *z++ = 'Z';
        p++;
        *z = 0;

      } else if (*p == '+' || *p == '-') {
        *z++ = *p++;

        if (!(isdigit(p[0]) && isdigit(p[1])))
          return -1;
        *z++ = *p++;
        *z++ = *p++;

        if (*p == ':') {
          *z++ = *p++;

          if (!(isdigit(p[0]) && isdigit(p[1])))
            return -1;
          *z++ = *p++;
          *z++ = *p++;
        }

        *z = 0;
      }
    }
  }
  if (*p != 0)
    return -1;

  if (must_parse_time && !ret->hour)
    return -1;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
pushq $-0x1
popq %rbx
testq %rdi, %rdi
je 0x33f3
movq %rsi, %r14
movq %rdi, %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rsi)
movups %xmm0, 0x40(%rsi)
movups %xmm0, 0x30(%rsi)
movups %xmm0, 0x20(%rsi)
andq $0x0, 0x60(%rsi)
movups %xmm0, 0x10(%rsi)
movups %xmm0, (%rsi)
leaq 0x4(%rsi), %r12
leaq 0x8(%rsi), %r13
movq %r12, %rdx
movq %r13, %rcx
callq 0x351d
movb $0x1, %cl
movl %ecx, 0x4(%rsp)
testl %eax, %eax
jne 0x33bb
movq %r14, 0x28(%r14)
movq %r12, 0x30(%r14)
movq %r13, 0x38(%r14)
movzbl 0xa(%r15), %eax
testl %eax, %eax
je 0x33b7
cmpl $0x20, %eax
je 0x33a9
cmpl $0x74, %eax
je 0x33a9
cmpl $0x54, %eax
jne 0x33f3
addq $0xb, %r15
movl $0x0, 0x4(%rsp)
jmp 0x33bb
addq $0xa, %r15
leaq 0x10(%r14), %r12
leaq 0xc(%r14), %rbp
leaq 0x14(%r14), %r13
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x35b7
testl %eax, %eax
je 0x3404
movb (%r15), %al
testb %al, %al
jne 0x33f3
cmpb $0x0, 0x4(%rsp)
jne 0x33f1
cmpq $0x0, 0x40(%r14)
je 0x33f3
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, 0x40(%r14)
movq %r12, 0x48(%r14)
movq %r13, 0x50(%r14)
movb 0x8(%r15), %al
cmpb $0x2e, %al
jne 0x3450
leaq 0x18(%r14), %rcx
addq $0x9, %r15
pushq $0x64
popq %rax
xorl %esi, %esi
pushq $0xa
popq %rdi
movb (%r15), %dl
addb $-0x30, %dl
cmpb $0x9, %dl
ja 0x3443
movzbl %dl, %edx
imull %eax, %edx
addl %edx, %esi
incq %r15
cltd
idivl %edi
jmp 0x3428
movl %esi, 0x18(%r14)
movq %rcx, 0x58(%r14)
movb (%r15), %al
jmp 0x3454
addq $0x8, %r15
testb %al, %al
je 0x33dc
leaq 0x1c(%r14), %rax
movq %rax, 0x60(%r14)
movzbl (%r15), %eax
cmpl $0x2b, %eax
je 0x3490
cmpl $0x2d, %eax
je 0x3490
cmpl $0x7a, %eax
je 0x347c
cmpl $0x5a, %eax
jne 0x33df
leaq 0x1d(%r14), %rax
movb $0x5a, 0x1c(%r14)
incq %r15
movb $0x0, (%rax)
jmp 0x33dc
movb %al, 0x1c(%r14)
callq 0x11f0
movq (%rax), %rdx
movsbq 0x1(%r15), %rcx
testb $0x8, 0x1(%rdx,%rcx,2)
je 0x33f3
movsbq 0x2(%r15), %rsi
testb $0x8, 0x1(%rdx,%rsi,2)
je 0x33f3
movb %cl, 0x1d(%r14)
movb 0x2(%r15), %cl
movb %cl, 0x1e(%r14)
cmpb $0x3a, 0x3(%r15)
jne 0x3510
movb $0x3a, 0x1f(%r14)
movq (%rax), %rcx
movsbq 0x4(%r15), %rax
testb $0x8, 0x1(%rcx,%rax,2)
je 0x33f3
movsbq 0x5(%r15), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x33f3
movb %al, 0x20(%r14)
movb 0x5(%r15), %cl
addq $0x6, %r15
leaq 0x22(%r14), %rax
movb %cl, 0x21(%r14)
jmp 0x3488
addq $0x3, %r15
leaq 0x1f(%r14), %rax
jmp 0x3488