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

```asm
<main>:
  endbr64
  push   %r15
  mov    $0x101,%edi
  lea    D8(%rip),%r15
  push   %r14
  lea    D24(%rip),%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <xmalloc@plt>
  mov    $0x41,%edi
  mov    %rax,%r12
  call   <xmalloc@plt>
  mov    $0x100,%edi
  mov    %rax,%rbp
  call   <xmalloc@plt>
  mov    %rax,%rbx
  nopw   0x0(%rax,%rax,1)
L44:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <writePrompt@plt>
  mov    $0x100,%edx
  mov    %rbx,%rsi
  xor    %edi,%edi
  call   <read@plt>
  sub    $0x1,%eax
  movslq %eax,%rdx
  movb   $0x0,(%rbx,%rdx,1)
  cmp    $0x1,%eax
  jle    L44
  mov    %rbx,%rdi
  call   <my_str2vect@plt>
  mov    %r14,%rsi
  mov    (%rax),%rdi
  mov    %rax,%r13
  call   <my_strcmp@plt>
  test   %eax,%eax
  jne    L116
  mov    %r15,%rdi
  call   <my_str@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L44
  nopw   0x0(%rax,%rax,1)
L116:
  mov    0x0(%r13),%rdi
  lea    D44(%rip),%rsi
  call   <my_strcmp@plt>
  test   %eax,%eax
  jne    L113
  mov    0x8(%r13),%rdi
  call   <chdir@plt>
  jmp    L44
  nopw   0x0(%rax,%rax,1)
L113:
  xor    %eax,%eax
  call   <fork@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  js     L40
  jne    L72
  mov    0x0(%r13),%rdi
  mov    %r13,%rsi
  call   <execvp@plt>
  test   %rax,%rax
  jns    L44
  lea    D12(%rip),%rdi
  call   <my_str@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L44
  nopl   0x0(%rax,%rax,1)
L72:
  xor    %edi,%edi
  call   <wait@plt>
  cmp    0x8(%rsp),%rax
  jne    L72
  mov    %r13,%rdi
  call   <my_freevect@plt>
  jmp    L44
L40:
  lea    D16(%rip),%rdi
  call   <my_str@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L44
```

tool_calls: name: retrieve_data
arguments: label: D8
type: string
name: retrieve_data
arguments: label: D24
type: string
name: retrieve_data
arguments: label: D44
type: string
name: retrieve_data
arguments: label: D12
type: string
name: retrieve_data
arguments: label: D16
type: string

tool: D8: Exiting minishell. Goodbye!


tool: D24: exit

tool: D44: cd

tool: D12: ERROR: execvp failed.


tool: D16: FORK ERROR

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);
          }
        }
      }
    }
  }
}
```