user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ASN1_time_parse>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L99
  mov    %rsi,%rax
  mov    %rsi,%r14
  and    $0xfffffffffffffffd,%rax
  cmp    $0xd,%rax
  jne    L99
  mov    %rdi,%r12
  mov    %rdx,%r13
  mov    %ecx,%r15d
  test   %rdx,%rdx
  je     L215
L126:
  cmpb   $0x5a,-0x1(%r12,%r14,1)
  lea    -0x1(%r14),%rbp
  jne    L99
  mov    %r12,%rbx
  add    %r12,%rbp
  nopw   0x0(%rax,%rax,1)
L13:
  movzbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L99
  add    $0x1,%rbx
  cmp    %rbx,%rbp
  jne    L13
  cmp    $0xd,%r14
  je     L25
  cmp    $0xf,%r14
  jne    L99
  mov    D25(%rip),%rax
  mov    (%rax),%esi
  cmp    %r15d,%esi
  je     L99
  movsbl (%r12),%eax
  lea    0x2(%r12),%rdx
  lea    -0xf0(%rax,%rax,4),%ecx
  movsbl 0x1(%r12),%eax
  mov    %rdx,%r12
  lea    -0x30(%rax,%rcx,2),%ecx
  mov    D13(%rip),%rax
  imul   $0x64,%ecx,%ecx
  mov    (%rax),%eax
  sub    $0x76c,%ecx
  mov    %ecx,0x0(%r13)
  test   %eax,%eax
  jne    L7
L148:
  cmp    %eax,%r15d
  je     L99
  mov    D25(%rip),%rax
  mov    0x0(%r13),%ecx
  mov    (%rax),%eax
  mov    %eax,%esi
L7:
  movsbl (%r12),%edx
  lea    -0xf0(%rdx,%rdx,4),%edi
  movsbl 0x1(%r12),%edx
  lea    -0x30(%rdx,%rdi,2),%edx
  add    %ecx,%edx
  mov    %edx,0x0(%r13)
  cmp    %esi,%eax
  jne    L40
  cmp    $0x31,%edx
  jle    L12
L40:
  movsbl 0x2(%r12),%edx
  lea    -0xf0(%rdx,%rdx,4),%ecx
  movsbl 0x3(%r12),%edx
  lea    -0x31(%rdx,%rcx,2),%edx
  mov    %edx,0x4(%r13)
  cmp    $0xb,%edx
  ja     L99
  movsbl 0x4(%r12),%edx
  lea    -0xf0(%rdx,%rdx,4),%ecx
  movsbl 0x5(%r12),%edx
  lea    -0x30(%rdx,%rcx,2),%edx
  mov    %edx,0x8(%r13)
  sub    $0x1,%edx
  cmp    $0x1e,%edx
  ja     L99
  movsbl 0x6(%r12),%edx
  lea    -0xf0(%rdx,%rdx,4),%ecx
  movsbl 0x7(%r12),%edx
  lea    -0x30(%rdx,%rcx,2),%edx
  mov    %edx,0xc(%r13)
  cmp    $0x17,%edx
  ja     L99
  movsbl 0x8(%r12),%edx
  lea    -0xf0(%rdx,%rdx,4),%ecx
  movsbl 0x9(%r12),%edx
  lea    -0x30(%rdx,%rcx,2),%edx
  mov    %edx,0x10(%r13)
  cmp    $0x3b,%edx
  ja     L99
  movsbl 0xa(%r12),%edx
  lea    -0xf0(%rdx,%rdx,4),%ecx
  movsbl 0xb(%r12),%edx
  lea    -0x30(%rdx,%rcx,2),%edx
  mov    %edx,0x14(%r13)
  cmp    $0x3b,%edx
  jbe    L207
L99:
  mov    $0xffffffff,%eax
L207:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L58
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L25:
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  jmp    L148
  cs nopw 0x0(%rax,%rax,1)
L215:
  mov    %rsp,%r13
  mov    $0x18,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  jmp    L126
L12:
  add    $0x64,%edx
  mov    %edx,0x0(%r13)
  jmp    L40
L58:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int ASN1_time_parse(const char *bytes, size_t len, struct tm *tm, int mode) {
  size_t i;
  int type = 0;
  struct tm ltm;
  struct tm *lt;
  const char *p;
  if (bytes == NULL)
    return (-1);
  if (len != 13 && len != 15)
    return (-1);
  lt = tm;
  if (lt == NULL) {
    memset(&ltm, 0, sizeof(ltm));
    lt = &ltm;
  }
  if (bytes[len - 1] != 'Z')
    return (-1);
  for (i = 0; i < len - 1; i++) {
    if (isdigit((unsigned char)bytes[i]))
      continue;
    return (-1);
  }
  p = bytes;
  switch (len) {
  case 15:
    if (mode == V_ASN1_UTCTIME)
      return (-1);
    lt->tm_year = (((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0')) * 100) - 1900;
    type = V_ASN1_GENERALIZEDTIME;
  case 13:
    if (type == 0) {
      if (mode == V_ASN1_GENERALIZEDTIME)
        return (-1);
      type = V_ASN1_UTCTIME;
    }
    lt->tm_year += ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0'));
    if (type == V_ASN1_UTCTIME) {
      if (lt->tm_year < 50)
        lt->tm_year += 100;
    }
    lt->tm_mon = ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0')) - 1;
    if (lt->tm_mon < 0 || lt->tm_mon > 11)
      return (-1);
    lt->tm_mday = ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0'));
    if (lt->tm_mday < 1 || lt->tm_mday > 31)
      return (-1);
    lt->tm_hour = ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0'));
    if (lt->tm_hour < 0 || lt->tm_hour > 23)
      return (-1);
    lt->tm_min = ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0'));
    if (lt->tm_min < 0 || lt->tm_min > 59)
      return (-1);
    lt->tm_sec = ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0'));
    if (lt->tm_sec < 0 || lt->tm_sec > 59)
      return (-1);
    break;
  default:
    return (-1);
  }
  return (type);
}
```