user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<X509_cmp_time>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  mov    (%rdi),%r13d
  mov    0x8(%rdi),%r12
  mov    D5(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,0x10(%rdi)
  je     L72
  lea    -0xd(%r13),%eax
  mov    $0x0,%edx
  cmp    $0xa,%eax
  jbe    L46
L129:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L109
  mov    %edx,%eax
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L72:
  lea    -0xb(%r13),%eax
  mov    $0x0,%edx
  cmp    $0x6,%eax
  ja     L129
  lea    0x20(%rsp),%rdi
  mov    $0xa,%edx
  mov    %r12,%rsi
  call   <memcpy@plt>
  lea    0xa(%r12),%rsi
  lea    -0xa(%r13),%eax
  lea    0x2a(%rsp),%rcx
  jmp    L81
L46:
  lea    0x20(%rsp),%rdi
  mov    $0xc,%edx
  mov    %r12,%rsi
  call   <memcpy@plt>
  lea    0xc(%r12),%rsi
  lea    -0xc(%r13),%eax
  lea    0x2c(%rsp),%rcx
L81:
  movzbl (%rsi),%edi
  lea    -0x2b(%rdi),%edx
  test   $0xfd,%dl
  je     L30
  cmp    $0x5a,%dil
  jne    L346
L30:
  movb   $0x30,(%rcx)
  movb   $0x30,0x1(%rcx)
  movb   $0x5a,0x2(%rcx)
  movb   $0x0,0x3(%rcx)
L328:
  movzbl (%rsi),%ecx
  cmp    $0x5a,%cl
  je     L204
  lea    -0x2b(%rcx),%edx
  test   $0xfd,%dl
  jne    L39
  cmp    $0x5,%eax
  je     L15
L39:
  mov    $0x0,%edx
  jmp    L129
L346:
  mov    $0x0,%edx
  cmp    $0x1,%eax
  jle    L129
  mov    %dil,(%rcx)
  movzbl 0x1(%rsi),%edx
  mov    %dl,0x1(%rcx)
  mov    %eax,%edx
  sub    $0x2,%edx
  je     L129
  cmpb   $0x2e,0x2(%rsi)
  je     L124
  add    $0x2,%rsi
  movb   $0x5a,0x2(%rcx)
  movb   $0x0,0x3(%rcx)
  mov    %edx,%eax
  jmp    L328
L124:
  add    $0x3,%rsi
  mov    %eax,%edx
  sub    $0x3,%edx
  je     L129
  mov    %edx,%eax
L70:
  movzbl (%rsi),%edi
  sub    $0x30,%edi
  cmp    $0x9,%dil
  ja     L275
  add    $0x1,%rsi
  sub    $0x1,%edx
  mov    %eax,%edi
  sub    %edx,%edi
  cmp    $0x2,%edi
  jg     L275
  test   %edx,%edx
  jne    L70
L275:
  movb   $0x5a,0x2(%rcx)
  movb   $0x0,0x3(%rcx)
  test   %edx,%edx
  je     L129
  mov    %edx,%eax
  jmp    L328
L204:
  mov    $0x0,%edx
  cmp    $0x1,%eax
  jne    L129
  mov    $0x0,%eax
L268:
  mov    0x10(%rbx),%rdx
  mov    %rdx,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  movl   $0x18,(%rsp)
  lea    0x40(%rsp),%rdx
  mov    %rdx,0x8(%rsp)
  mov    %rax,%rsi
  shl    $0x4,%rsi
  sub    %rax,%rsi
  shl    $0x2,%rsi
  mov    %rsp,%rdi
  mov    %rbp,%rdx
  call   <X509_time_adj@plt>
  test   %rax,%rax
  je     L248
  mov    D5(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,0x10(%rbx)
  je     L270
L155:
  lea    0x40(%rsp),%rsi
  lea    0x20(%rsp),%rdi
  call   <strcmp@plt>
  mov    %eax,%edx
  test   %eax,%eax
  jne    L129
  mov    $0xffffffff,%edx
  jmp    L129
L15:
  movzbl 0x1(%rsi),%eax
  lea    -0x30(%rax),%edi
  mov    $0x0,%edx
  cmp    $0x9,%dil
  ja     L129
  movzbl 0x2(%rsi),%edi
  lea    -0x30(%rdi),%r8d
  cmp    $0x9,%r8b
  ja     L129
  movzbl 0x3(%rsi),%r8d
  lea    -0x30(%r8),%r9d
  cmp    $0x9,%r9b
  ja     L129
  movzbl 0x4(%rsi),%esi
  lea    -0x30(%rsi),%r9d
  cmp    $0x9,%r9b
  ja     L129
  movsbl %al,%eax
  lea    -0xf0(%rax,%rax,4),%eax
  movsbl %dil,%edi
  lea    -0x30(%rdi,%rax,2),%edx
  imul   $0x3c,%edx,%edx
  movslq %edx,%rdx
  movsbl %r8b,%r8d
  lea    -0xf0(%r8,%r8,4),%eax
  movsbl %sil,%esi
  lea    -0x30(%rsi,%rax,2),%eax
  cltq
  add    %rdx,%rax
  mov    %rax,%rdx
  neg    %rdx
  cmp    $0x2d,%cl
  cmove  %rdx,%rax
  jmp    L268
L270:
  movsbl 0x20(%rsp),%eax
  lea    -0xf0(%rax,%rax,4),%edx
  movsbl 0x21(%rsp),%eax
  lea    -0x30(%rax,%rdx,2),%ecx
  lea    0x64(%rcx),%eax
  cmp    $0x32,%ecx
  cmovl  %eax,%ecx
  movsbl 0x40(%rsp),%eax
  lea    -0xf0(%rax,%rax,4),%edx
  movsbl 0x41(%rsp),%eax
  lea    -0x30(%rax,%rdx,2),%eax
  lea    0x64(%rax),%edx
  cmp    $0x32,%eax
  cmovl  %edx,%eax
  cmp    %eax,%ecx
  jl     L23
  mov    $0x1,%edx
  jle    L155
  jmp    L129
L248:
  mov    $0x0,%edx
  jmp    L129
L23:
  mov    $0xffffffff,%edx
  jmp    L129
L109:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time) {
  char *str;
  ASN1_TIME atm;
  long offset;
  char buff1[24], buff2[24], *p;
  int i, j, remaining;
  p = buff1;
  remaining = ctm->length;
  str = (char *)ctm->data;
  if (ctm->type == V_ASN1_UTCTIME) {
    int min_length = sizeof("YYMMDDHHMMZ") - 1;
    int max_length = sizeof("YYMMDDHHMMSS+hhmm") - 1;
    if (remaining < min_length || remaining > max_length)
      return 0;
    memcpy(p, str, 10);
    p += 10;
    str += 10;
    remaining -= 10;
  } else {
    int min_length = sizeof("YYYYMMDDHHMMZ") - 1;
    int max_length = sizeof("YYYYMMDDHHMMSS.fff+hhmm") - 1;
    if (remaining < min_length || remaining > max_length)
      return 0;
    memcpy(p, str, 12);
    p += 12;
    str += 12;
    remaining -= 12;
  }
  if ((*str == 'Z') || (*str == '-') || (*str == '+')) {
    *(p++) = '0';
    *(p++) = '0';
  } else {
    if (remaining < 2)
      return 0;
    *(p++) = *(str++);
    *(p++) = *(str++);
    remaining -= 2;
    if (remaining && *str == '.') {
      str++;
      remaining--;
      for (i = 0; i < 3 && remaining; i++, str++, remaining--) {
        if (*str < '0' || *str > '9')
          break;
      }
    }
  }
  *(p++) = 'Z';
  *(p++) = '\0';
  if (!remaining)
    return 0;
  if (*str == 'Z') {
    if (remaining != 1)
      return 0;
    offset = 0;
  } else {
    if ((*str != '+') && (*str != '-'))
      return 0;
    if (remaining != 5)
      return 0;
    if (str[1] < '0' || str[1] > '9' || str[2] < '0' || str[2] > '9' || str[3] < '0' || str[3] > '9' || str[4] < '0' || str[4] > '9')
      return 0;
    offset = ((str[1] - '0') * 10 + (str[2] - '0')) * 60;
    offset += (str[3] - '0') * 10 + (str[4] - '0');
    if (*str == '-')
      offset = -offset;
  }
  atm.type = ctm->type;
  atm.flags = 0;
  atm.length = sizeof(buff2);
  atm.data = (unsigned char *)buff2;
  if (X509_time_adj(&atm, offset * 60, cmp_time) == NULL)
    return 0;
  if (ctm->type == V_ASN1_UTCTIME) {
    i = (buff1[0] - '0') * 10 + (buff1[1] - '0');
    if (i < 50)
      i += 100;
    j = (buff2[0] - '0') * 10 + (buff2[1] - '0');
    if (j < 50)
      j += 100;
    if (i < j)
      return -1;
    if (i > j)
      return 1;
  }
  i = strcmp(buff1, buff2);
  if (i == 0)
    return -1;
  else
    return i;
}
```