user: 请从给定的汇编指令推导出C源代码:

```asm
<zmime_header_date_decode>:
  endbr64
  push   %r14
  mov    $0x30,%edx
  xor    %esi,%esi
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0xc0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  lea    0x30(%rsp),%rbx
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    $0x7f,%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <zstrncpy@plt>
  mov    %rbx,%rdi
  call   <ztolower@plt>
  movzbl 0x30(%rsp),%eax
  mov    %rbx,%rdi
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  jbe    L260
  test   %al,%al
  je     L260
  nopl   0x0(%rax)
L114:
  movzbl 0x1(%rdi),%eax
  add    $0x1,%rdi
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  jbe    L260
  test   %al,%al
  jne    L114
L401:
  mov    $0xffffffffffffffff,%rax
L17:
  mov    0xb8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L415
  add    $0xc0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L260:
  test   %al,%al
  je     L401
  mov    %rdi,%rbx
  test   $0xdf,%al
  je     L269
  nopl   0x0(%rax,%rax,1)
L368:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  test   $0xdf,%al
  jne    L368
  test   %al,%al
  je     L401
L269:
  movb   $0x0,(%rbx)
  lea    0x1(%rbx),%r12
  call   <atoi@plt>
  mov    %rax,0x28(%rsp)
  movzbl 0x1(%rbx),%eax
  cmp    $0x20,%al
  jne    L130
  nopl   0x0(%rax)
L425:
  movzbl 0x1(%r12),%eax
  add    $0x1,%r12
  cmp    $0x20,%al
  je     L425
L130:
  test   %al,%al
  je     L401
  test   $0xdf,%al
  je     L401
  mov    %r12,%rax
  nopl   0x0(%rax)
L252:
  mov    %rax,%rdi
  movzbl 0x1(%rax),%edx
  add    $0x1,%rax
  test   $0xdf,%dl
  jne    L252
  test   %dl,%dl
  je     L401
  mov    %rax,%rdx
  sub    %r12,%rdx
  cmp    $0x3,%rdx
  jne    L401
  movb   $0x0,(%rax)
  movzbl (%r12),%edx
  add    $0x2,%rdi
  sub    $0x61,%edx
  cmp    $0x12,%dl
  ja     L401
  lea    D8(%rip),%rcx
  movzbl %dl,%edx
  movslq (%rcx,%rdx,4),%rdx
  add    %rcx,%rdx
  notrack jmp *%rdx
  mov    $0xa,%edx
  nopl   0x0(%rax)
L359:
  movzbl 0x1(%rax),%eax
  mov    %edx,(%rsp)
  cmp    $0x20,%al
  jne    L502
  nopl   0x0(%rax,%rax,1)
L148:
  movzbl 0x1(%rdi),%eax
  add    $0x1,%rdi
  cmp    $0x20,%al
  je     L148
L502:
  test   %al,%al
  je     L401
  test   $0xdf,%al
  je     L401
  mov    %rdi,%rbx
  nop
L36:
  mov    %rbx,%r12
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  test   $0xdf,%al
  jne    L36
  test   %al,%al
  je     L401
  mov    %rbx,%rax
  sub    %rdi,%rax
  cmp    $0x4,%rax
  jne    L401
  movb   $0x0,(%rbx)
  add    $0x2,%r12
  call   <atoi@plt>
  sub    $0x76c,%rax
  mov    %rax,0x20(%rsp)
  movzbl 0x1(%rbx),%eax
  cmp    $0x20,%al
  jne    L50
  cs nopw 0x0(%rax,%rax,1)
L67:
  movzbl 0x1(%r12),%eax
  add    $0x1,%r12
  cmp    $0x20,%al
  je     L67
L50:
  test   %al,%al
  je     L401
  mov    %r12,%rbx
  cmp    $0x3a,%al
  je     L481
  nopl   (%rax)
L381:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  test   %al,%al
  je     L401
  cmp    $0x3a,%al
  jne    L381
  test   %al,%al
  je     L401
L481:
  movb   $0x0,(%rbx)
  mov    %r12,%rdi
  lea    0x1(%rbx),%r13
  call   <atoi@plt>
  mov    %rax,0x18(%rsp)
  movzbl 0x1(%rbx),%eax
  mov    %r13,%rbx
  cmp    $0x3a,%al
  je     L189
  test   %al,%al
  je     L189
  nop
L163:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  test   %al,%al
  je     L401
  cmp    $0x3a,%al
  jne    L163
L189:
  test   %al,%al
  je     L401
  movb   $0x0,(%rbx)
  mov    %r13,%rdi
  lea    0x1(%rbx),%r14
  mov    %r14,%r12
  call   <atoi@plt>
  mov    %rax,0x10(%rsp)
  movzbl 0x1(%rbx),%eax
  test   $0xdf,%al
  je     L446
  nopl   0x0(%rax,%rax,1)
L8:
  movzbl 0x1(%r12),%eax
  add    $0x1,%r12
  test   $0xdf,%al
  jne    L8
L446:
  test   %al,%al
  je     L401
  movb   $0x0,(%r12)
  mov    %r14,%rdi
  lea    0x1(%r12),%rbx
  call   <atoi@plt>
  mov    %rax,0x8(%rsp)
  movzbl 0x1(%r12),%eax
  cmp    $0x20,%al
  jne    L448
  nopw   0x0(%rax,%rax,1)
L125:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  cmp    $0x20,%al
  je     L125
L448:
  test   %al,%al
  je     L401
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    $0x4,%eax
  jle    L401
  movsbl 0x1(%rbx),%eax
  xor    %r12d,%r12d
  cmpb   $0x2d,(%rbx)
  mov    %rbp,%rdi
  setne  %r12b
  lea    -0xf0(%rax,%rax,4),%edx
  movsbl 0x2(%rbx),%eax
  lea    -0x1(%r12,%r12,1),%r12d
  lea    -0x30(%rax,%rdx,2),%eax
  movsbl 0x3(%rbx),%edx
  imul   $0x3c,%eax,%eax
  lea    -0xf0(%rdx,%rdx,4),%edx
  lea    (%rax,%rdx,2),%edx
  movsbl 0x4(%rbx),%eax
  lea    -0x30(%rdx,%rax,1),%ebx
  call   <timegm@plt>
  cmp    $0xffffffffffffffff,%rax
  je     L401
  imul   %ebx,%r12d
  imul   $0x3c,%r12d,%r12d
  movslq %r12d,%r12
  sub    %r12,%rax
  jmp    L17
  xor    %edx,%edx
  cmpb   $0x70,0x2(%rax)
  setne  %dl
  lea    0x3(,%rdx,4),%edx
  jmp    L359
  mov    $0xb,%edx
  jmp    L359
  mov    $0x1,%edx
  jmp    L359
  xor    %edx,%edx
  cmpb   $0x61,0x2(%rax)
  je     L359
  xor    %edx,%edx
  cmpb   $0x6e,0x3(%rax)
  setne  %dl
  add    $0x5,%edx
  jmp    L359
  xor    %edx,%edx
  cmpb   $0x72,0x3(%rax)
  setne  %dl
  lea    0x2(%rdx,%rdx,1),%edx
  jmp    L359
  mov    $0x8,%edx
  jmp    L359
  mov    $0x9,%edx
  jmp    L359
L415:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
long zmime_header_date_decode(const char *str) {
  char str_copy[128];
  char *ps, *p, *p2, *p3;
  int v, sign, offset;
  struct tm tm;
  long result = -1;
  memset(&tm, 0, sizeof(struct tm));
  zstrncpy(str_copy, str, 127);
  ztolower(str_copy);
  p = str_copy;
  {
    while ((*p) && ((*p < '0') || (*p > '9')))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  ps = p;
  {
    while ((*p) && (*p != ' '))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  *(p++) = 0;
  tm.tm_mday = atoi(ps);
  {
    while ((*p) && (*p == ' '))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  ps = p;
  {
    while ((*p) && (*p != ' '))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  if (p - ps != 3) {
    goto err;
  }
  *(p++) = 0;
  v = -1;
  p2 = p + 1;
  p3 = p + 2;
  switch (*ps) {
  case 'a':
    if (*p2 == 'p') {
      v = 3;
    } else {
      v = 7;
    }
    break;
  case 'd':
    v = 11;
    break;
  case 'f':
    v = 1;
    break;
  case 'j':
    if (*p2 == 'a') {
      v = 0;
    } else if (*p3 == 'n') {
      v = 5;
    } else {
      v = 6;
    }
    break;
  case 'm':
    if (*p3 == 'r') {
      v = 2;
    } else {
      v = 4;
    }
    break;
  case 'n':
    v = 10;
    break;
  case 'o':
    v = 9;
    break;
  case 's':
    v = 8;
    break;
  }
  if (v == -1) {
    goto err;
  }
  tm.tm_mon = v;
  {
    while ((*p) && (*p == ' '))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  ps = p;
  {
    while ((*p) && (*p != ' '))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  if (p - ps != 4) {
    goto err;
  }
  *(p++) = 0;
  tm.tm_year = atoi(ps) - 1900;
  {
    while ((*p) && (*p == ' '))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  ps = p;
  {
    while ((*p) && (*p != ':'))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  *(p++) = 0;
  tm.tm_hour = atoi(ps);
  ps = p;
  {
    while ((*p) && (*p != ':'))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  *(p++) = 0;
  tm.tm_min = atoi(ps);
  ps = p;
  {
    while ((*p) && (*p != ' '))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  *(p++) = 0;
  tm.tm_sec = atoi(ps);
  {
    while ((*p) && (*p == ' '))
      p++;
  };
  {
    if (!*p)
      goto err;
  };
  ps = p;
  if (strlen(ps) < 5) {
    goto err;
  }
  sign = (ps[0] == '-') ? -1 : 1;
  ps++;
  offset = (ps[0] - '0') * 10 + (ps[1] - '0');
  ps += 2;
  offset = offset * 60 + (ps[0] - '0') * 10 + (ps[1] - '0');
  offset *= 60;
  result = timegm(&tm);
  if (result == -1) {
    goto err;
  }
  result = result - sign * offset;
err:
  return result;
}
```