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

```asm
<parse_asn1_time>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    $0x1,%r13d
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  mov    (%rdi),%eax
  add    $0xffffff80,%eax
  cmp    $0x1,%eax
  jbe    L16
L8:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L65
  add    $0x38,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L16:
  mov    %rsi,%rbx
  mov    %rdi,%rbp
  mov    $0x18,%edx
  xor    %esi,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    0x0(%rbp),%eax
  mov    0x8(%rbp),%r12
  cmp    $0x80,%eax
  je     L4
  cmp    $0x81,%eax
  jne    L8
  mov    %r12,%rdi
  lea    0x1c(%rsp),%rdx
  xor    %eax,%eax
  mov    $0x8,%r14d
  lea    D6(%rip),%rsi
  mov    $0x6,%r15d
  call   <sscanf@plt>
  mov    0x1c(%rsp),%eax
  mov    $0x4,%edi
  movq   $0xc,0x8(%rsp)
  movq   $0xa,(%rsp)
  sub    $0x76c,%eax
  mov    %eax,0x1c(%rsp)
L15:
  mov    %eax,(%rbx)
  lea    0x23(%rsp),%rbp
  add    %r12,%rdi
  xor    %eax,%eax
  lea    D4(%rip),%r13
  mov    %rbp,%rdx
  mov    %r13,%rsi
  call   <sscanf@plt>
  mov    $0xa,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  movb   $0x0,0x25(%rsp)
  call   <strtol@plt>
  mov    %r13,%rsi
  lea    (%r12,%r15,1),%rdi
  mov    %rbp,%rdx
  sub    $0x1,%eax
  mov    %eax,0x4(%rbx)
  mov    %eax,0x1c(%rsp)
  xor    %eax,%eax
  call   <sscanf@plt>
  mov    $0xa,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  movb   $0x0,0x25(%rsp)
  call   <strtol@plt>
  mov    %r13,%rsi
  lea    (%r12,%r14,1),%rdi
  mov    %rbp,%rdx
  mov    %eax,0x8(%rbx)
  mov    %eax,0x1c(%rsp)
  xor    %eax,%eax
  call   <sscanf@plt>
  mov    $0xa,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  movb   $0x0,0x25(%rsp)
  call   <strtol@plt>
  mov    (%rsp),%rdi
  mov    %r13,%rsi
  mov    %rbp,%rdx
  mov    %eax,0xc(%rbx)
  mov    %eax,0x1c(%rsp)
  add    %r12,%rdi
  xor    %eax,%eax
  call   <sscanf@plt>
  mov    $0xa,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  movb   $0x0,0x25(%rsp)
  call   <strtol@plt>
  mov    0x8(%rsp),%rdi
  mov    %r13,%rsi
  mov    %rbp,%rdx
  mov    %eax,0x10(%rbx)
  xor    %r13d,%r13d
  mov    %eax,0x1c(%rsp)
  add    %r12,%rdi
  xor    %eax,%eax
  call   <sscanf@plt>
  mov    $0xa,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  movb   $0x0,0x25(%rsp)
  call   <strtol@plt>
  mov    %eax,0x14(%rbx)
  jmp    L8
  nopw   0x0(%rax,%rax,1)
L4:
  lea    0x1c(%rsp),%rdx
  lea    D1(%rip),%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <sscanf@plt>
  mov    0x1c(%rsp),%eax
  cmp    $0x31,%eax
  jg     L30
  add    $0x64,%eax
  mov    %eax,0x1c(%rsp)
L30:
  movq   $0xa,0x8(%rsp)
  mov    $0x6,%r14d
  mov    $0x2,%edi
  mov    $0x4,%r15d
  movq   $0x8,(%rsp)
  jmp    L15
L65:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D6
type: string
name: retrieve_data
arguments: label: D4
type: string
name: retrieve_data
arguments: label: D1
type: string

tool: D6: %04i

tool: D4: %02s

tool: D1: %02i

assistant: ```c
int parse_asn1_time(const ASN1_TIME *atp, struct tm *tsp) {
  const char *str;
  unsigned offset;
  int val;
  char buff[5];
  if ((atp->type != V_ASN1_GENERALIZEDTIME) && (atp->type != V_ASN1_UTCTIME))
    return (1);
  memset(tsp, 0, sizeof(struct tm));
  str = (const char *)atp->data;
  offset = 0;
  switch (atp->type) {
  case V_ASN1_GENERALIZEDTIME:
    sscanf(&str[offset], "%04i", &val);
    val -= 1900;
    tsp->tm_year = val;
    offset += 4;
    break;
  case V_ASN1_UTCTIME:
    sscanf(&str[offset], "%02i", &val);
    if (val < 50)
      val += 2000 - 1900;
    tsp->tm_year = val;
    offset += 2;
    break;
  default:
    return (1);
  };
  sscanf(&str[offset], "%02s", buff);
  buff[2] = '\0';
  val = strtol(buff, NULL, 10) - 1;
  tsp->tm_mon = val;
  offset += 2;
  sscanf(&str[offset], "%02s", buff);
  buff[2] = '\0';
  val = strtol(buff, NULL, 10);
  tsp->tm_mday = val;
  offset += 2;
  sscanf(&str[offset], "%02s", buff);
  buff[2] = '\0';
  val = strtol(buff, NULL, 10);
  tsp->tm_hour = val;
  offset += 2;
  sscanf(&str[offset], "%02s", buff);
  buff[2] = '\0';
  val = strtol(buff, NULL, 10);
  tsp->tm_min = val;
  offset += 2;
  sscanf(&str[offset], "%02s", buff);
  buff[2] = '\0';
  val = strtol(buff, NULL, 10);
  tsp->tm_sec = val;
  return (0);
}
```