user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<cmd_add>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movl   $0xffffffff,0x4(%rsp)
  movl   $0xffffffff,0x8(%rsp)
  movl   $0xffffffff,0xc(%rsp)
  movl   $0xffffffff,0x10(%rsp)
  movl   $0xffffffff,0x14(%rsp)
  test   %edi,%edi
  js     L123
  mov    %rsi,%rbp
  mov    %rdx,%r13
  lea    0x8(%rsp),%rcx
  lea    0x4(%rsp),%rdx
  sub    $0x8,%rsp
  lea    0x1c(%rsp),%rax
  push   %rax
  lea    0x20(%rsp),%r9
  lea    0x1c(%rsp),%r8
  call   <check_option_add@plt>
  mov    %eax,%ebx
  add    $0x10,%rsp
  cmpl   $0x0,0x10(%rsp)
  jns    L66
  mov    0xc(%rsp),%eax
  not    %eax
  shr    $0x1f,%eax
  mov    0x14(%rsp),%edx
  not    %edx
  shr    $0x1f,%edx
  add    %edx,%eax
  cmp    %ebx,%eax
  jl     L84
  mov    $0x0,%r12d
L166:
  lea    0x8(%rsp),%rcx
  lea    0xc(%rsp),%rdx
  lea    0x4(%rsp),%r8
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <check_args@plt>
  test   %rax,%rax
  jne    L90
  push   %r13
  push   %r12
  mov    0x24(%rsp),%r9d
  mov    0x14(%rsp),%r8d
  mov    0x1c(%rsp),%ecx
  mov    0x18(%rsp),%edx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <action_add@plt>
  mov    %eax,%ebx
  add    $0x10,%rsp
  cmp    $0xffffffff,%eax
  je     L73
  mov    $0x0,%ebx
  cmpl   $0x0,0x10(%rsp)
  jns    L117
L149:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L152
  mov    %ebx,%eax
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L123:
  lea    D4(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%ebx
  jmp    L149
L66:
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    0x10(%rsp),%ecx
  movslq %ecx,%rdx
  lea    0x0(,%rdx,8),%rax
  mov    0x0(%rbp,%rdx,8),%rdi
  lea    -0x1(%rbx),%r14d
  cmp    %r14d,%ecx
  jge    L99
  lea    0x1(%rcx),%esi
  cmp    %esi,%ebx
  jle    L15
  lea    0x8(%rbp,%rax,1),%rax
  sub    %ecx,%ebx
  lea    -0x2(%rbx),%esi
  add    %rsi,%rdx
  lea    0x10(%rbp,%rdx,8),%rsi
L144:
  mov    (%rax),%rdx
  mov    %rdx,-0x8(%rax)
  add    $0x8,%rax
  cmp    %rsi,%rax
  jne    L144
L15:
  mov    0x4(%rsp),%eax
  cmp    %eax,%ecx
  setl   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  mov    %eax,0x4(%rsp)
  mov    0x8(%rsp),%eax
  cmp    %eax,%ecx
  setl   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  mov    %eax,0x8(%rsp)
  mov    0x14(%rsp),%eax
  cmp    %eax,%ecx
  setl   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  mov    %eax,0x14(%rsp)
  mov    0xc(%rsp),%eax
  cmp    %eax,%ecx
  setl   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  mov    %eax,0xc(%rsp)
L99:
  mov    0xc(%rsp),%ecx
  mov    %rdi,%rdx
  mov    %r12,%rsi
  mov    %r14d,%edi
  call   <check_type_args@plt>
  test   %rax,%rax
  js     L128
  mov    %r14d,%ebx
  jmp    L166
L128:
  lea    D2(%rip),%rdi
  call   <printf@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    $0xffffffff,%ebx
  jmp    L149
L84:
  lea    D11(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%ebx
  jmp    L149
L90:
  lea    D49(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%ebx
  jmp    L149
L73:
  lea    D37(%rip),%rdi
  call   <printf@plt>
  jmp    L149
L117:
  mov    %r12,%rdi
  call   <free@plt>
  jmp    L149
L152:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D4
data_type: string
name: retrieve_data
arguments: data_label: D2
data_type: string
name: retrieve_data
arguments: data_label: D11
data_type: string
name: retrieve_data
arguments: data_label: D49
data_type: string
name: retrieve_data
arguments: data_label: D37
data_type: string

tool: D4: error no args for add


tool: D2: check_args_no_op failed


tool: D11: check_type_args failed


tool: D49: check path args failed


tool: D37: error action add


assistant: ```c
int cmd_add(int argc, char **argv, char *daz) {
  int f_date = -1, f_compound = -1, f_dz = -1, f_type = -1, f_input = -1;
  char *type_args = NULL;
  if (argc < 0) {
    printf("error no args for add\n");
    return -1;
  }
  argc = check_option_add(argc, argv, &f_date, &f_compound, &f_dz, &f_type, &f_input);
  if (f_type >= 0) {
    type_args = (char *)malloc(sizeof(*type_args) * argc);
    char *tmp = argv[f_type];
    if (f_type < (argc - 1)) {
      int i;
      for (i = (f_type + 1); i < (argc); i++) {
        argv[i - 1] = argv[i];
      }
      f_date = (f_date > f_type ? f_date - 1 : f_date);
      f_compound = (f_compound > f_type ? f_compound - 1 : f_compound);
      f_input = (f_input > f_type ? f_input - 1 : f_input);
      f_dz = (f_dz > f_type ? f_dz - 1 : f_dz);
    }
    argc--;
    if (check_type_args(argc, type_args, tmp, f_dz) < 0) {
      printf("check_args_no_op failed\n");
      free(type_args);
      return -1;
    }
  } else if (argc > (f_dz >= 0 ? 1 : 0) + (f_input >= 0 ? 1 : 0)) {
    printf("check_type_args failed\n");
    return -1;
  }
  if (check_args(argc, argv, &f_dz, &f_compound, &f_date)) {
    printf("check path args failed\n");
    return -1;
  }
  if (action_add(argc, argv, f_compound, f_dz, f_date, f_input, type_args, daz) == -1) {
    printf("error action add\n");
    return -1;
  }
  if (f_type >= 0) {
    free(type_args);
  }
  return 0;
}
```