user: 请将以下的汇编代码转换成C语言代码:

```asm
<parse_validity>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xf8,%rsp
  mov    %esi,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xe8(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L60
  cmpb   $0x0,(%rdi)
  mov    %rdi,%r12
  jne    L142
L60:
  mov    0xc(%rsp),%eax
L294:
  mov    0xe8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L298
  add    $0xf8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L142:
  mov    %rdi,%rcx
  mov    $0x64,%esi
  xor    %eax,%eax
  movb   $0x0,0x10(%rsp)
  lea    0x80(%rsp),%r15
  lea    D112(%rip),%rdx
  mov    %r15,%rdi
  call   <snprintf@plt>
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <cutspaces@plt>
  movsbl 0x80(%rsp),%edi
  test   %dil,%dil
  je     L181
  mov    %r15,%rbp
  xor    %ebx,%ebx
  xor    %r13d,%r13d
  mov    $0x1,%r14d
  jmp    L107
  nopl   (%rax)
L22:
  mov    %al,0x0(%rbp)
  movsbl %al,%eax
  sub    $0x30,%eax
  cmp    $0xa,%eax
  cmovae %r14d,%ebx
  cmovb  %r14d,%r13d
  movsbl 0x1(%rbp),%edi
  add    $0x1,%rbp
  test   %dil,%dil
  je     L385
L107:
  call   <tolower@plt>
  cmp    $0x9,%al
  jne    L22
  movb   $0x20,0x0(%rbp)
  movsbl 0x1(%rbp),%edi
  add    $0x1,%rbp
  mov    $0x1,%ebx
  test   %dil,%dil
  jne    L107
L385:
  xor    $0x1,%ebx
  test   %r13d,%ebx
  jne    L283
L181:
  mov    $0x20,%esi
  mov    %r15,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L217
  movb   $0x0,(%rax)
L217:
  mov    %r15,%rsi
  lea    D143(%rip),%rdi
  lea    0x10(%rsp),%rbx
  call   <strstr@plt>
  test   %rax,%rax
  je     L191
  mov    %r15,%rcx
  mov    $0x61,%edx
  mov    %rbx,%rdi
  xor    %eax,%eax
  lea    D61(%rip),%rsi
  call   <sprintf@plt>
L320:
  lea    D144(%rip),%r12
  lea    D163(%rip),%rbp
  lea    D4(%rip),%r13
  lea    D90(%rip),%r14
L35:
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <atoi@plt>
  mov    %eax,%r15d
  test   %eax,%eax
  jle    L60
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L395
  cmp    $0x2d0,%r15d
  jle    L262
  movslq %r15d,%rax
  mov    %r15d,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  imul   $0xffffffff88888889,%rax,%rax
  sar    $0x1f,%edx
  shr    $0x20,%rax
  add    %r15d,%eax
  sar    $0x5,%eax
  sub    %edx,%eax
  mov    %eax,%r15d
  mov    %eax,%edx
  xor    %eax,%eax
  call   <sprintf@plt>
L395:
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L12
  cmp    $0xc,%r15d
  jle    L348
  cmp    $0x18,%r15d
  jle    L87
  mov    %r15d,%ecx
  mov    $0xaaaaaaab,%eax
  lea    D136(%rip),%rsi
  mov    %rbx,%rdi
  imul   %rax,%rcx
  xor    %eax,%eax
  shr    $0x24,%rcx
  mov    %ecx,%edx
  mov    %rcx,%r15
  call   <sprintf@plt>
L12:
  mov    %r14,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L270
  cmp    $0x1,%r15d
  je     L120
  cmp    $0x22,%r15d
  jle    L332
  mov    %r15d,%eax
  mov    %r15d,%ecx
  lea    D155(%rip),%rsi
  mov    %rbx,%rdi
  imul   $0x24924925,%rax,%rax
  shr    $0x20,%rax
  sub    %eax,%ecx
  shr    %ecx
  add    %eax,%ecx
  xor    %eax,%eax
  shr    $0x2,%ecx
  mov    %ecx,%edx
  mov    %ecx,%r15d
  call   <sprintf@plt>
  lea    D54(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L174
L287:
  mov    $0x3f,%eax
  cmp    %eax,%r15d
  cmovle %r15d,%eax
  lea    0xc0(%rax),%eax
  jmp    L294
  nopl   0x0(%rax)
L270:
  lea    D54(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L174
  cmp    $0x4,%r15d
  jg     L287
  lea    0x0(,%r15,8),%edx
  lea    D136(%rip),%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  sub    %r15d,%edx
  call   <sprintf@plt>
  jmp    L35
  nopl   0x0(%rax,%rax,1)
L174:
  lea    D152(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L269
  mov    $0x16d,%edx
  cmp    $0xc,%r15d
  je     L369
  imul   $0x1e,%r15d,%edx
L369:
  lea    D136(%rip),%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L35
  nopl   0x0(%rax)
L191:
  mov    %r12,%rcx
  mov    $0x63,%edx
  mov    %rbx,%rdi
  xor    %eax,%eax
  lea    D64(%rip),%rsi
  call   <sprintf@plt>
  jmp    L320
  xchg   %ax,%ax
L283:
  xor    %eax,%eax
  mov    %r15,%rdi
  call   <atoi@plt>
  cmp    $0xff,%eax
  jbe    L294
  jmp    L60
  nopw   0x0(%rax,%rax,1)
L269:
  lea    D72(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L60
  cmp    $0x1,%r15d
  je     L377
  mov    $0xff,%eax
  jmp    L294
  nopl   0x0(%rax,%rax,1)
L348:
  imul   $0x3c,%r15d,%edx
  lea    D160(%rip),%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L35
L120:
  movabs $0x72756f68203432,%rax
  mov    %rax,(%rbx)
  jmp    L35
L377:
  movabs $0x6b656577203235,%rax
  mov    %rax,(%rbx)
  jmp    L35
L262:
  xor    %eax,%eax
  cmp    $0x4,%r15d
  jle    L294
  movslq %r15d,%rax
  mov    %r15d,%ecx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%ecx
  sar    $0x21,%rax
  sub    %ecx,%eax
  sub    $0x1,%eax
  jmp    L294
L87:
  lea    0x77(%r15,%r15,1),%eax
  jmp    L294
L332:
  mov    $0x1e,%eax
  cmp    %eax,%r15d
  cmovle %r15d,%eax
  add    $0xa6,%eax
  jmp    L294
L298:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D112
type_infered: string
name: parse_data
arguments: data_tag: D143
type_infered: string
name: parse_data
arguments: data_tag: D61
type_infered: string
name: parse_data
arguments: data_tag: D144
type_infered: string
name: parse_data
arguments: data_tag: D163
type_infered: string
name: parse_data
arguments: data_tag: D4
type_infered: string
name: parse_data
arguments: data_tag: D90
type_infered: string
name: parse_data
arguments: data_tag: D136
type_infered: string
name: parse_data
arguments: data_tag: D155
type_infered: string
name: parse_data
arguments: data_tag: D54
type_infered: string
name: parse_data
arguments: data_tag: D152
type_infered: string
name: parse_data
arguments: data_tag: D64
type_infered: string
name: parse_data
arguments: data_tag: D72
type_infered: string
name: parse_data
arguments: data_tag: D160
type_infered: string

tool: D112: %s

tool: D143: min hour day week month year

tool: D61: 1 %.*s

tool: D144: min

tool: D163: %i hour

tool: D4: hour

tool: D90: day

tool: D136: %i day

tool: D155: %i week

tool: D54: week

tool: D152: month

tool: D64: %.*s

tool: D72: year

tool: D160: %i min

assistant: ```c
int parse_validity(char *value, int defaultvalue) {
  int result = defaultvalue;
  char buffer[100];
  int i;
  char tmp[100];
  int got_numbers = 0;
  int got_letters = 0;
  int idx;
  char *p;
  if (value && *value) {
    *buffer = 0;
    snprintf(tmp, sizeof(tmp), "%s", value);
    cutspaces(tmp);
    for (idx = 0; tmp[idx]; idx++) {
      tmp[idx] = tolower((int)tmp[idx]);
      if (tmp[idx] == '\t')
        tmp[idx] = ' ';
      if (isdigit((int)(tmp[idx])))
        got_numbers = 1;
      else
        got_letters = 1;
    }
    if (got_numbers && !got_letters) {
      i = atoi(tmp);
      if (i >= 0 && i <= 255)
        result = i;
      return result;
    }
    if ((p = strchr(tmp, ' ')))
      *p = 0;
    if (strstr("min hour day week month year", tmp))
      sprintf(buffer, "1 %.*s", (int)sizeof(buffer) - 3, tmp);
    else
      sprintf(buffer, "%.*s", (int)sizeof(buffer) - 1, value);
    while ((i = atoi(buffer)) > 0) {
      if (strstr(buffer, "min")) {
        if (i <= 720) {
          result = (i < 5) ? 0 : i / 5 - 1;
          break;
        }
        sprintf(buffer, "%i hour", i /= 60);
      }
      if (strstr(buffer, "hour")) {
        if (i <= 12) {
          sprintf(buffer, "%i min", i * 60);
          continue;
        }
        if (i <= 24) {
          result = (i - 12) * 2 + 143;
          break;
        }
        sprintf(buffer, "%i day", i /= 24);
      }
      if (strstr(buffer, "day")) {
        if (i < 2) {
          sprintf(buffer, "24 hour");
          continue;
        }
        if (i <= 34) {
          result = (i <= 30) ? i + 166 : 30 + 166;
          break;
        }
        sprintf(buffer, "%i week", i /= 7);
      }
      if (strstr(buffer, "week")) {
        if (i < 5) {
          sprintf(buffer, "%i day", i * 7);
          continue;
        }
        result = (i <= 63) ? i + 192 : 255;
        break;
      }
      if (strstr(buffer, "month")) {
        sprintf(buffer, "%i day", (i == 12) ? 365 : i * 30);
        continue;
      }
      if (strstr(buffer, "year")) {
        if (i == 1) {
          sprintf(buffer, "52 week");
          continue;
        }
        result = 255;
      }
      break;
    }
  }
  return result;
}
```