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

```asm
<cmd_add>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0xffffffff,-0x30(%rbp)
  movl   $0xffffffff,-0x2c(%rbp)
  movl   $0xffffffff,-0x28(%rbp)
  movl   $0xffffffff,-0x24(%rbp)
  movl   $0xffffffff,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L197
  lea    D17(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L194
L197:
  lea    -0x24(%rbp),%r9
  lea    -0x28(%rbp),%r8
  lea    -0x2c(%rbp),%rcx
  lea    -0x30(%rbp),%rdx
  mov    -0x40(%rbp),%rsi
  mov    -0x34(%rbp),%eax
  sub    $0x8,%rsp
  lea    -0x20(%rbp),%rdi
  push   %rdi
  mov    %eax,%edi
  call   <check_option_add@plt>
  add    $0x10,%rsp
  mov    %eax,-0x34(%rbp)
  mov    -0x24(%rbp),%eax
  test   %eax,%eax
  js     L215
  mov    -0x34(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x34(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x24(%rbp),%eax
  cmp    %eax,%edx
  jle    L30
  mov    -0x24(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L3
L109:
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x3,%rdx
  lea    -0x8(%rdx),%rcx
  mov    -0x40(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  addl   $0x1,-0x1c(%rbp)
L3:
  mov    -0x1c(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L109
  mov    -0x30(%rbp),%edx
  mov    -0x24(%rbp),%eax
  cmp    %eax,%edx
  jle    L98
  mov    -0x30(%rbp),%eax
  sub    $0x1,%eax
  jmp    L63
L98:
  mov    -0x30(%rbp),%eax
L63:
  mov    %eax,-0x30(%rbp)
  mov    -0x2c(%rbp),%edx
  mov    -0x24(%rbp),%eax
  cmp    %eax,%edx
  jle    L67
  mov    -0x2c(%rbp),%eax
  sub    $0x1,%eax
  jmp    L121
L67:
  mov    -0x2c(%rbp),%eax
L121:
  mov    %eax,-0x2c(%rbp)
  mov    -0x20(%rbp),%edx
  mov    -0x24(%rbp),%eax
  cmp    %eax,%edx
  jle    L14
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  jmp    L10
L14:
  mov    -0x20(%rbp),%eax
L10:
  mov    %eax,-0x20(%rbp)
  mov    -0x28(%rbp),%edx
  mov    -0x24(%rbp),%eax
  cmp    %eax,%edx
  jle    L82
  mov    -0x28(%rbp),%eax
  sub    $0x1,%eax
  jmp    L239
L82:
  mov    -0x28(%rbp),%eax
L239:
  mov    %eax,-0x28(%rbp)
L30:
  subl   $0x1,-0x34(%rbp)
  mov    -0x28(%rbp),%ecx
  mov    -0x10(%rbp),%rdx
  mov    -0x18(%rbp),%rsi
  mov    -0x34(%rbp),%eax
  mov    %eax,%edi
  call   <check_type_args@plt>
  test   %rax,%rax
  jns    L205
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0xffffffff,%eax
  jmp    L194
L215:
  mov    -0x28(%rbp),%eax
  not    %eax
  shr    $0x1f,%eax
  movzbl %al,%edx
  mov    -0x20(%rbp),%eax
  not    %eax
  shr    $0x1f,%eax
  movzbl %al,%eax
  add    %edx,%eax
  cmp    %eax,-0x34(%rbp)
  jle    L205
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L194
L205:
  lea    -0x30(%rbp),%rdi
  lea    -0x2c(%rbp),%rcx
  lea    -0x28(%rbp),%rdx
  mov    -0x40(%rbp),%rsi
  mov    -0x34(%rbp),%eax
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <check_args@plt>
  test   %rax,%rax
  je     L101
  lea    D39(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L194
L101:
  mov    -0x20(%rbp),%r8d
  mov    -0x30(%rbp),%edi
  mov    -0x28(%rbp),%ecx
  mov    -0x2c(%rbp),%edx
  mov    -0x40(%rbp),%rsi
  mov    -0x34(%rbp),%eax
  push   -0x48(%rbp)
  push   -0x18(%rbp)
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <action_add@plt>
  add    $0x10,%rsp
  cmp    $0xffffffff,%eax
  jne    L182
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L194
L182:
  mov    -0x24(%rbp),%eax
  test   %eax,%eax
  js     L17
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L17:
  mov    $0x0,%eax
L194:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L61
  call   <__stack_chk_fail@plt>
L61:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D17
type: string
name: disassemble_data
arguments: label: D0
type: string
name: disassemble_data
arguments: label: D26
type: string
name: disassemble_data
arguments: label: D39
type: string
name: disassemble_data
arguments: label: D19
type: string

tool: D17: error no args for add


tool: D0: check_args_no_op failed


tool: D26: check_type_args failed


tool: D39: check path args failed


tool: D19: 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;
}
```