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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  movq   $0x0,-0x28(%rbp)
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  mov    $0x101,%edi
  call   <xmalloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    $0x41,%edi
  call   <xmalloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    $0x100,%edi
  call   <xmalloc@plt>
  mov    %rax,-0x28(%rbp)
L107:
  mov    -0x10(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <writePrompt@plt>
  mov    -0x28(%rbp),%rax
  mov    $0x100,%edx
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <read@plt>
  sub    $0x1,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  cmpl   $0x1,-0x2c(%rbp)
  jle    L107
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <my_str2vect@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  lea    D18(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <my_strcmp@plt>
  test   %eax,%eax
  jne    L49
  lea    D16(%rip),%rax
  mov    %rax,%rdi
  call   <my_str@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L107
L49:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  lea    D24(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <my_strcmp@plt>
  test   %eax,%eax
  jne    L111
  mov    -0x20(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <chdir@plt>
  jmp    L107
L111:
  mov    $0x0,%eax
  call   <fork@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jns    L64
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  call   <my_str@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L107
L64:
  cmpq   $0x0,-0x8(%rbp)
  jle    L42
  nop
L21:
  mov    $0x0,%edi
  call   <wait@plt>
  cmp    %rax,-0x8(%rbp)
  jne    L21
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <my_freevect@plt>
  jmp    L107
L42:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x20(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <execvp@plt>
  test   %rax,%rax
  jns    L107
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <my_str@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L107
```

tool_calls: name: extract_symbolic_data
arguments: tag: D18
datatype: string
name: extract_symbolic_data
arguments: tag: D16
datatype: string
name: extract_symbolic_data
arguments: tag: D24
datatype: string
name: extract_symbolic_data
arguments: tag: D22
datatype: string
name: extract_symbolic_data
arguments: tag: D7
datatype: string

tool: D18: exit

tool: D16: Exiting minishell. Goodbye!


tool: D24: cd

tool: D22: FORK ERROR

tool: D7: ERROR: execvp failed.


assistant: ```c
int main(int argc, char **argv) {
  pid_t pid;
  char *input = ((void *)0);
  int strLen;
  char **inputVect = ((void *)0);
  char *hostname = ((void *)0);
  char *cwd = ((void *)0);
  cwd = (char *)xmalloc(256 * sizeof(char) + 1);
  hostname = (char *)xmalloc(64 * sizeof(char) + 1);
  input = (char *)xmalloc(256 * sizeof(char));
  while (1) {
    writePrompt(hostname, cwd);
    strLen = read(0, input, 256 * sizeof(char)) - 1;
    input[strLen] = '\0';
    if (strLen >= 2) {
      inputVect = my_str2vect(input);
      if (!my_strcmp(inputVect[0], "exit")) {
        my_str("Exiting minishell. Goodbye!\n");
        free(cwd);
        free(hostname);
        exit(1);
      } else if (!my_strcmp(inputVect[0], "cd"))
        chdir(inputVect[1]);
      else {
        if ((pid = fork()) < 0) {
          my_str("FORK ERROR");
          exit(1);
        } else if (pid > 0) {
          while (wait(((void *)0)) != pid)
            ;
          my_freevect(inputVect);
        } else {
          if (execvp(inputVect[0], inputVect) < 0) {
            my_str("ERROR: execvp failed.\n");
            exit(1);
          }
        }
      }
    }
  }
}
```