// File: /workspace/github_c_makefile_star2_O1/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
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x3c0a
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)
movups %xmm0, 0x10(%rsi)
movups %xmm0, (%rsi)
movq $0x0, 0x60(%rsi)
leaq 0x4(%rsi), %r12
leaq 0x8(%rsi), %r13
movq %r12, %rdx
movq %r13, %rcx
callq 0x3c73
movb $0x1, %cl
movl %ecx, 0x4(%rsp)
testl %eax, %eax
jne 0x3ad1
movq %r14, 0x28(%r14)
movq %r12, 0x30(%r14)
movq %r13, 0x38(%r14)
movzbl 0xa(%r15), %eax
cmpl $0x53, %eax
jg 0x3ab1
testl %eax, %eax
je 0x3acd
cmpl $0x20, %eax
je 0x3abf
jmp 0x3c0a
cmpl $0x74, %eax
je 0x3abf
cmpl $0x54, %eax
jne 0x3c0a
addq $0xb, %r15
movl $0x0, 0x4(%rsp)
jmp 0x3ad1
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 0x3d19
testl %eax, %eax
je 0x3b15
cmpb $0x0, (%r15)
jne 0x3c0a
cmpb $0x0, 0x4(%rsp)
jne 0x3b0e
cmpq $0x0, 0x40(%r14)
je 0x3c0a
xorl %ebx, %ebx
jmp 0x3c0a
movq %rbp, 0x40(%r14)
movq %r12, 0x48(%r14)
movq %r13, 0x50(%r14)
cmpb $0x2e, 0x8(%r15)
jne 0x3b83
leaq 0x18(%r14), %rax
movb 0x9(%r15), %sil
addq $0x9, %r15
leal -0x30(%rsi), %edx
xorl %ecx, %ecx
cmpb $0x9, %dl
ja 0x3b79
xorl %ecx, %ecx
movl $0x64, %edx
addb $-0x30, %sil
movzbl %sil, %esi
imull %edx, %esi
addl %esi, %ecx
movslq %edx, %rdx
imulq $0x66666667, %rdx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
movb 0x1(%r15), %sil
incq %r15
leal -0x30(%rsi), %edi
cmpb $0xa, %dil
jb 0x3b45
movl %ecx, 0x18(%r14)
movq %rax, 0x58(%r14)
jmp 0x3b87
addq $0x8, %r15
cmpb $0x0, (%r15)
je 0x3af2
leaq 0x1c(%r14), %rax
movq %rax, 0x60(%r14)
movb (%r15), %cl
movzbl %cl, %eax
movb $0x1, %bpl
cmpl $0x59, %eax
jg 0x3bdd
cmpl $0x2b, %eax
je 0x3bb1
cmpl $0x2d, %eax
jne 0x3bfb
leaq 0x1(%r15), %r12
movb %cl, 0x1c(%r14)
callq 0x1200
movq (%rax), %rdx
movsbq 0x1(%r15), %rcx
testb $0x8, 0x1(%rdx,%rcx,2)
je 0x3bd9
movsbq 0x2(%r15), %rsi
testb $0x8, 0x1(%rdx,%rsi,2)
jne 0x3c1b
xorl %ebp, %ebp
jmp 0x3bfe
cmpl $0x7a, %eax
je 0x3be7
cmpl $0x5a, %eax
jne 0x3bfb
leaq 0x1d(%r14), %rax
movb $0x5a, 0x1c(%r14)
incq %r15
movq %r15, %r12
movb $0x0, (%rax)
jmp 0x3bfe
movq %r15, %r12
movq %r12, %r15
testb %bpl, %bpl
jne 0x3af2
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb %cl, 0x1d(%r14)
movb 0x2(%r15), %cl
movb %cl, 0x1e(%r14)
movb 0x3(%r15), %cl
cmpb $0x3a, %cl
jne 0x3c69
leaq 0x4(%r15), %r12
movb %cl, 0x1f(%r14)
movq (%rax), %rcx
movsbq 0x4(%r15), %rax
testb $0x8, 0x1(%rcx,%rax,2)
je 0x3bd9
movsbq 0x5(%r15), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x3bd9
movb %al, 0x20(%r14)
movb 0x5(%r15), %cl
addq $0x6, %r15
leaq 0x22(%r14), %rax
movb %cl, 0x21(%r14)
jmp 0x3bf3
addq $0x3, %r15
leaq 0x1f(%r14), %rax
jmp 0x3bf3