user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %edi,-0x74(%rbp)
  mov    %rsi,-0x80(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x68(%rbp)
  movl   $0x0,-0x64(%rbp)
  movl   $0x0,-0x54(%rbp)
  movl   $0x0,-0x60(%rbp)
  movl   $0x0,-0x5c(%rbp)
  movl   $0x0,-0x58(%rbp)
  movq   $0x0,-0x28(%rbp)
  mov    -0x80(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x50(%rbp)
  movq   $0x0,-0x48(%rbp)
  movq   $0x0,-0x40(%rbp)
  movq   $0x0,-0x38(%rbp)
  movq   $0x0,-0x30(%rbp)
  cmpl   $0x2,-0x74(%rbp)
  jg     L67
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <usage@plt>
  movl   $0x1,-0x68(%rbp)
  jmp    L180
L67:
  movl   $0x1,-0x64(%rbp)
  mov    -0x74(%rbp),%eax
  mov    %eax,-0x54(%rbp)
  jmp    L50
L92:
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x64(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L131
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D71(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  movl   $0x1,-0x68(%rbp)
  jmp    L180
L131:
  mov    -0x18(%rbp),%rax
  lea    D6(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L64
  mov    -0x18(%rbp),%rax
  lea    D58(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L0
L64:
  movl   $0x1,-0x60(%rbp)
  movl   $0x0,-0x5c(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  jmp    L246
L0:
  mov    -0x18(%rbp),%rax
  lea    D62(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L214
  mov    -0x18(%rbp),%rax
  lea    D3(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L166
L214:
  movl   $0x1,-0x5c(%rbp)
  movl   $0x0,-0x60(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  jmp    L246
L166:
  mov    -0x18(%rbp),%rax
  lea    D85(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L34
  mov    -0x18(%rbp),%rax
  lea    D45(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L182
L34:
  movl   $0x1,-0x58(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  jmp    L246
L182:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D39(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  movl   $0x1,-0x68(%rbp)
  jmp    L180
L246:
  addl   $0x2,-0x64(%rbp)
L50:
  mov    -0x64(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L92
  cmpl   $0x0,-0x60(%rbp)
  je     L32
  mov    -0x38(%rbp),%rdx
  lea    -0x50(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <text2morse@plt>
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x48(%rbp)
  mov    -0x50(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x50(%rbp),%rax
  mov    %rax,%rsi
  lea    D90(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L32:
  cmpl   $0x0,-0x5c(%rbp)
  je     L98
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x48(%rbp)
  mov    -0x30(%rbp),%rdx
  lea    -0x50(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <morse2text@plt>
  mov    -0x50(%rbp),%rax
  mov    %rax,%rsi
  lea    D90(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L98:
  cmpl   $0x0,-0x58(%rbp)
  je     L79
  cmpl   $0x0,-0x60(%rbp)
  jne    L12
  cmpl   $0x0,-0x5c(%rbp)
  je     L209
L12:
  mov    -0x48(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <morse2wav@plt>
  cmpl   $0x0,-0x60(%rbp)
  je     L180
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  jmp    L180
L209:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <usage@plt>
  movl   $0x1,-0x68(%rbp)
  jmp    L180
L79:
  nop
L180:
  mov    -0x68(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L29
  call   <__stack_chk_fail@plt>
L29:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D71
data_type: string
name: parse_data
arguments: data_label: D6
data_type: string
name: parse_data
arguments: data_label: D58
data_type: string
name: parse_data
arguments: data_label: D62
data_type: string
name: parse_data
arguments: data_label: D3
data_type: string
name: parse_data
arguments: data_label: D85
data_type: string
name: parse_data
arguments: data_label: D45
data_type: string
name: parse_data
arguments: data_label: D39
data_type: string
name: parse_data
arguments: data_label: D90
data_type: string

tool: D71: Provide parameter for %s


tool: D6: -t

tool: D58: --text

tool: D62: -m

tool: D3: --morse

tool: D85: -w

tool: D45: --wav

tool: D39: Unknown action %s


tool: D90: %s


assistant: ```c
int main(int argc, char *argv[]) {
  int rc = 0, i = 0, l = 0;
  bool has_text = false, has_morse = false, has_wav = false;
  size_t length = 0;
  char *exec = argv[0], *action = NULL, *input = NULL, *output = NULL;
  char *morse = NULL, *filename = NULL, *text_input = NULL, *morse_input = NULL;
  if (argc < 3) {
    usage(exec);
    rc = 1;
    goto cleanup;
  }
  for (i = 1, l = argc; i < l; i += 2) {
    action = argv[i];
    input = argv[i + 1];
    if (!input) {
      printf("Provide parameter for %s\n", action);
      rc = 1;
      goto cleanup;
    }
    if (strcmp(action, "-t") == 0 || strcmp(action, "--text") == 0) {
      has_text = true;
      has_morse = false;
      text_input = input;
    } else if (strcmp(action, "-m") == 0 || strcmp(action, "--morse") == 0) {
      has_morse = true;
      has_text = false;
      morse_input = input;
    } else if (strcmp(action, "-w") == 0 || strcmp(action, "--wav") == 0) {
      has_wav = true;
      filename = input;
    } else {
      printf("Unknown action %s\n", action);
      rc = 1;
      goto cleanup;
    }
  }
  if (has_text) {
    text2morse(&output, text_input);
    length = strlen(output);
    morse = malloc(sizeof(char) * length + 1);
    strcpy(morse, output);
    printf("%s\n", output);
    free(output);
  }
  if (has_morse) {
    morse = morse_input;
    morse2text(&output, morse_input);
    printf("%s\n", output);
    free(output);
  }
  if (has_wav) {
    if (has_text || has_morse) {
      morse2wav(filename, morse);
      if (has_text) {
        free(morse);
      }
    } else {
      usage(exec);
      rc = 1;
      goto cleanup;
    }
  }
cleanup:
  return rc;
}
```