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     L49
  mov    %rdi,%r12
  mov    %rsi,%r14
  mov    %rdx,%r13
  mov    %ecx,%r15d
  mov    %rsi,%rax
  and    $0xfffffffffffffffd,%rax
  cmp    $0xd,%rax
  jne    L242
  test   %rdx,%rdx
  je     L117
L184:
  lea    -0x1(%r14),%rbp
  cmpb   $0x5a,-0x1(%r12,%r14,1)
  jne    L280
  mov    %r12,%rbx
  add    %r12,%rbp
L41:
  movzbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L206
  add    $0x1,%rbx
  cmp    %rbp,%rbx
  jne    L41
  cmp    $0xd,%r14
  je     L45
  mov    $0xffffffff,%eax
  cmp    $0xf,%r14
  jne    L299
  mov    D6(%rip),%rax
  cmp    %r15d,(%rax)
  je     L68
  lea    0x2(%r12),%rdx
  movsbl (%r12),%eax
  lea    -0xf0(%rax,%rax,4),%ecx
  movsbl 0x1(%r12),%eax
  lea    -0x30(%rax,%rcx,2),%eax
  imul   $0x64,%eax,%eax
  sub    $0x76c,%eax
  mov    %eax,0x0(%r13)
  mov    D4(%rip),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L267
  mov    %rdx,%r12
L45:
  mov    D4(%rip),%rax
  cmp    %r15d,(%rax)
  je     L61
  mov    D6(%rip),%rax
  mov    (%rax),%eax
L243:
  movsbl (%r12),%edx
  lea    -0xf0(%rdx,%rdx,4),%ecx
  movsbl 0x1(%r12),%edx
  lea    -0x30(%rdx,%rcx,2),%edx
  add    0x0(%r13),%edx
  mov    %edx,0x0(%r13)
  mov    D6(%rip),%rcx
  cmp    %eax,(%rcx)
  jne    L82
  cmp    $0x31,%edx
  jle    L218
L82:
  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     L211
  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     L281
  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     L110
  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     L165
  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    $0x3c,%edx
  mov    $0xffffffff,%edx
  cmovae %edx,%eax
  jmp    L299
L117:
  mov    %rsp,%r13
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  jmp    L184
L267:
  mov    %rdx,%r12
  jmp    L243
L218:
  add    $0x64,%edx
  mov    %edx,0x0(%r13)
  jmp    L82
L49:
  mov    $0xffffffff,%eax
  jmp    L299
L242:
  mov    $0xffffffff,%eax
  jmp    L299
L280:
  mov    $0xffffffff,%eax
  jmp    L299
L206:
  mov    $0xffffffff,%eax
L299:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L22
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L68:
  mov    $0xffffffff,%eax
  jmp    L299
L61:
  mov    $0xffffffff,%eax
  jmp    L299
L211:
  mov    $0xffffffff,%eax
  jmp    L299
L281:
  mov    $0xffffffff,%eax
  jmp    L299
L110:
  mov    $0xffffffff,%eax
  jmp    L299
L165:
  mov    $0xffffffff,%eax
  jmp    L299
L22:
  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);
}
```