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

```asm
<f_set_date>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  mov    0xa0(%rsp),%r12
  test   %edi,%edi
  js     L105
  lea    0x40(%rsp),%r9
  lea    0x34(%rsp),%rdx
  mov    %rsi,%rbp
  lea    0x30(%rsp),%rsi
  mov    %r9,0x18(%rsp)
  lea    0x3c(%rsp),%r15
  mov    %rbp,%rdi
  mov    %rdx,0x10(%rsp)
  lea    0x38(%rsp),%r14
  sub    $0x8,%rsp
  mov    %r15,%r8
  mov    %rsi,0x10(%rsp)
  lea    0x4c(%rsp),%rax
  mov    %r14,%rcx
  mov    %rax,0x8(%rsp)
  push   %rax
  call   <reftime@plt>
  movzbl (%r12),%eax
  pop    %rsi
  pop    %rdi
  sub    $0x2b,%eax
  test   $0xfd,%al
  jne    L126
  lea    0x4e(%rsp),%r13
  xor    %eax,%eax
  lea    0x48(%rsp),%rdx
  lea    0x1(%r12),%rdi
  mov    %r13,%rcx
  lea    D26(%rip),%rsi
  call   <sscanf@plt>
  cmp    $0x2,%eax
  jne    L143
  mov    0x48(%rsp),%ecx
  test   %ecx,%ecx
  jns    L96
L143:
  lea    D126(%rip),%rsi
  lea    D65(%rip),%rdi
  call   <fatal_error@plt>
L96:
  lea    D108(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  mov    %rax,%r8
  mov    $0x1,%eax
  test   %r8,%r8
  jne    L302
L53:
  cmpb   $0x2b,(%r12)
  mov    0x48(%rsp),%edx
  je     L4
  push   %rax
  mov    %r15,%rcx
  push   %rdx
  mov    0x10(%rsp),%r9
  mov    %r14,%rdx
  mov    0x28(%rsp),%r8
  mov    0x20(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  call   <sub_dt@plt>
  mov    0x54(%rsp),%r9d
  mov    0x50(%rsp),%r8d
  mov    0x4c(%rsp),%ecx
  pop    %r12
  pop    %r13
  jmp    L119
  nopl   0x0(%rax,%rax,1)
L187:
  sub    $0x8,%rsp
  mov    0x30(%rsp),%rax
  add    0x20(%rbp),%rax
  push   %rax
  mov    0x54(%rsp),%r9d
  mov    0x50(%rsp),%r8d
  mov    0x4c(%rsp),%ecx
  mov    0x48(%rsp),%edx
  mov    0x44(%rsp),%esi
  mov    0x40(%rsp),%edi
  call   <save_time@plt>
  pop    %rcx
  pop    %rsi
L105:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L115
  add    $0x68,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L126:
  mov    %r12,%rdi
  call   <strlen@plt>
  lea    -0x4(%rax),%edx
  cmp    $0xa,%edx
  ja     L226
  test   $0x1,%al
  jne    L226
L260:
  push   (%rsp)
  mov    %r15,%r9
  mov    %r14,%r8
  lea    D80(%rip),%rsi
  push   0x20(%rsp)
  mov    %r12,%rdi
  xor    %eax,%eax
  mov    0x20(%rsp),%rcx
  mov    0x18(%rsp),%rdx
  call   <sscanf@plt>
  pop    %r11
  pop    %rbx
  test   %eax,%eax
  jle    L191
L216:
  mov    0x38(%rsp),%edx
  mov    0x34(%rsp),%esi
  mov    0x30(%rsp),%edi
  call   <check_datecode@plt>
  test   %rax,%rax
  jne    L57
  mov    0x3c(%rsp),%ecx
  cmp    $0x17,%ecx
  jbe    L262
L57:
  mov    %r12,%rsi
  lea    D38(%rip),%rdi
  call   <fatal_error@plt>
  mov    0x44(%rsp),%r9d
  mov    0x40(%rsp),%r8d
  mov    0x3c(%rsp),%ecx
L119:
  mov    0x8(%rbp),%rax
  sub    $0x8,%rsp
  add    $0xc,%rax
  push   %rax
  mov    0x48(%rsp),%edx
  mov    0x44(%rsp),%esi
  mov    0x40(%rsp),%edi
  call   <save_time@plt>
  mov    %rbp,%rdi
  call   <stat_proc_n_time_ranges_index@plt>
  pop    %r9
  pop    %r10
  mov    %eax,%r12d
  test   %eax,%eax
  js     L105
  movslq %eax,%rbx
  mov    0x20(%rbp),%rax
  mov    %rbp,%rdi
  movzbl (%rax,%rbx,1),%r11d
  mov    %r11b,0x20(%rsp)
  call   <code_table_4_4@plt>
  mov    %rbp,%rdi
  mov    %eax,%r13d
  call   <forecast_time_in_units@plt>
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %eax,0x48(%rsp)
  push   %r13
  push   %rax
  mov    0x10(%rsp),%r9
  mov    0x28(%rsp),%r8
  mov    0x20(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  call   <add_time@plt>
  lea    -0x7(%r12),%eax
  cltq
  mov    %rax,0x38(%rsp)
  pop    %rdi
  pop    %r8
  movzbl 0x20(%rsp),%r11d
  test   %r11b,%r11b
  je     L187
  lea    -0x1(%r11),%eax
  lea    0x6(%r12),%r10d
  mov    %r14,0x20(%rsp)
  lea    (%rax,%rax,2),%rax
  movslq %r10d,%r13
  lea    0x12(%rbx,%rax,4),%rax
  mov    %r13,%r14
  mov    %rax,%r13
  jmp    L165
  xchg   %ax,%ax
L14:
  lea    D72(%rip),%rdi
  call   <fatal_error_i@plt>
L174:
  add    $0xc,%r14
  cmp    %r13,%r14
  je     L187
L165:
  mov    0x20(%rbp),%rax
  movzbl (%rax,%r14,1),%ebx
  lea    0x2(%rax,%r14,1),%rdi
  movzbl 0x1(%rax,%r14,1),%r12d
  call   <int4@plt>
  movzbl %bl,%esi
  mov    %eax,0x48(%rsp)
  lea    -0x3(%rsi),%edx
  cmp    $0x1,%edx
  jbe    L174
  lea    -0x1(%rsi),%edx
  cmp    $0x1,%edx
  ja     L14
  push   %r12
  mov    %r15,%rcx
  push   %rax
  mov    0x10(%rsp),%r9
  mov    0x28(%rsp),%r8
  mov    0x30(%rsp),%rdx
  mov    0x20(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  call   <add_time@plt>
  pop    %rax
  pop    %rdx
  jmp    L174
  nopl   0x0(%rax)
L4:
  push   %rax
  mov    %r15,%rcx
  push   %rdx
  mov    0x10(%rsp),%r9
  mov    %r14,%rdx
  mov    0x28(%rsp),%r8
  mov    0x20(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  call   <add_dt@plt>
  mov    0x54(%rsp),%r9d
  mov    0x50(%rsp),%r8d
  mov    0x4c(%rsp),%ecx
  pop    %rax
  pop    %rdx
  jmp    L119
  xchg   %ax,%ax
L226:
  mov    %r12,%rsi
  lea    D38(%rip),%rdi
  call   <fatal_error@plt>
  jmp    L260
  nopl   0x0(%rax)
L302:
  lea    D23(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  mov    %rax,%r8
  mov    $0x2,%eax
  test   %r8,%r8
  je     L53
  lea    D128(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  mov    %rax,%r8
  mov    $0x3,%eax
  test   %r8,%r8
  je     L53
  lea    D100(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  mov    %rax,%r8
  mov    $0x4,%eax
  test   %r8,%r8
  je     L53
  lea    D121(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  je     L53
  mov    %r13,%rsi
  lea    D12(%rip),%rdi
  call   <fatal_error@plt>
  mov    $0xffffffff,%eax
  jmp    L53
  xchg   %ax,%ax
L191:
  mov    %r12,%rsi
  lea    D38(%rip),%rdi
  call   <fatal_error@plt>
  jmp    L216
  nopl   0x0(%rax)
L262:
  mov    0x40(%rsp),%r8d
  cmp    $0x3b,%r8d
  ja     L57
  mov    0x44(%rsp),%r9d
  cmp    $0x3b,%r9d
  ja     L57
  jmp    L119
L115:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D26
type_infered: string
name: unpack_data
arguments: data_tag: D126
type_infered: string
name: unpack_data
arguments: data_tag: D65
type_infered: string
name: unpack_data
arguments: data_tag: D108
type_infered: string
name: unpack_data
arguments: data_tag: D80
type_infered: string
name: unpack_data
arguments: data_tag: D38
type_infered: string
name: unpack_data
arguments: data_tag: D72
type_infered: string
name: unpack_data
arguments: data_tag: D23
type_infered: string
name: unpack_data
arguments: data_tag: D128
type_infered: string
name: unpack_data
arguments: data_tag: D100
type_infered: string
name: unpack_data
arguments: data_tag: D121
type_infered: string
name: unpack_data
arguments: data_tag: D12
type_infered: string

tool: D26: %d%2s

tool: 

tool: D65: set_date: delta-time: (+|-)(int)(hr|dy|mo|yr)

tool: D108: hr

tool: D80: %4d%2d%2d%2d%2d%2d

tool: D38: set_date: bad date code %s

tool: D72: set_date: code 4.11=%d is not supported

tool: D23: dy

tool: D128: mo

tool: D100: yr

tool: D121: mn

tool: D12: set_date: unsupported time unit %s

assistant: ```c
int f_set_date(int mode, unsigned char **sec, float *data, unsigned int ndata, char *inv_out, void **local, const char *arg1) {
  int year, month, day, hour, minute, second, i, j, units, n;
  int code_4_11, idx;
  int dtime, dt_unit;
  char string[10];
  if (mode < 0)
    return 0;
  reftime(sec, &year, &month, &day, &hour, &minute, &second);
  if (arg1[0] == '+' || arg1[0] == '-') {
    i = sscanf(arg1 + 1, "%d%2s", &dtime, string);
    if (i != 2 || dtime < 0)
      fatal_error("set_date: delta-time: (+|-)(int)(hr|dy|mo|yr)", "");
    dt_unit = -1;
    if (strcmp(string, "hr") == 0)
      dt_unit = 1;
    else if (strcmp(string, "dy") == 0)
      dt_unit = 2;
    else if (strcmp(string, "mo") == 0)
      dt_unit = 3;
    else if (strcmp(string, "yr") == 0)
      dt_unit = 4;
    else if (strcmp(string, "mn") == 0)
      dt_unit = 0;
    if (dt_unit == -1)
      fatal_error("set_date: unsupported time unit %s", string);
    if (arg1[0] == '+')
      i = add_dt(&year, &month, &day, &hour, &minute, &second, dtime, dt_unit);
    else
      i = sub_dt(&year, &month, &day, &hour, &minute, &second, dtime, dt_unit);
  } else {
    i = strlen(arg1);
    if (i < 4 || i > 14 || i % 2 == 1)
      fatal_error("set_date: bad date code %s", arg1);
    i = sscanf(arg1, "%4d%2d%2d%2d%2d%2d", &year, &month, &day, &hour, &minute, &second);
    if (i < 1)
      fatal_error("set_date: bad date code %s", arg1);
    if (check_datecode(year, month, day) != 0 || hour < 0 || hour >= 24 || minute < 0 || minute >= 60 || second < 0 || second >= 60)
      fatal_error("set_date: bad date code %s", arg1);
  }
  save_time(year, month, day, hour, minute, second, sec[1] + 12);
  idx = stat_proc_n_time_ranges_index(sec);
  if (idx < 0)
    return 0;
  n = (int)sec[4][idx];
  j = idx + 35 - 42;
  units = code_table_4_4(sec);
  dtime = forecast_time_in_units(sec);
  add_time(&year, &month, &day, &hour, &minute, &second, (unsigned int)dtime, units);
  for (i = 0; i < n; i++) {
    code_4_11 = (int)sec[4][47 - 34 + j + i * 12];
    units = (int)sec[4][48 - 34 + j + i * 12];
    dtime = int4(sec[4] + 49 - 34 + j + i * 12);
    if (code_4_11 == 3 || code_4_11 == 4)
      continue;
    if (code_4_11 == 1 || code_4_11 == 2) {
      add_time(&year, &month, &day, &hour, &minute, &second, (unsigned int)dtime, units);
    } else {
      fatal_error_i("set_date: code 4.11=%d is not supported", code_4_11);
    }
  }
  save_time(year, month, day, hour, minute, second, sec[4] + j);
  return 0;
}
```