user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r15
  mov    $0x101,%edi
  lea    D21(%rip),%r15
  push   %r14
  lea    D9(%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)
L113:
  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    L113
  mov    %rbx,%rdi
  call   <my_str2vect@plt>
  mov    %r14,%rsi
  mov    (%rax),%rdi
  mov    %rax,%r13
  call   <my_strcmp@plt>
  test   %eax,%eax
  jne    L4
  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    L113
  nopw   0x0(%rax,%rax,1)
L4:
  mov    0x0(%r13),%rdi
  lea    D43(%rip),%rsi
  call   <my_strcmp@plt>
  test   %eax,%eax
  jne    L47
  mov    0x8(%r13),%rdi
  call   <chdir@plt>
  jmp    L113
  nopw   0x0(%rax,%rax,1)
L47:
  xor    %eax,%eax
  call   <fork@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  js     L92
  jne    L50
  mov    0x0(%r13),%rdi
  mov    %r13,%rsi
  call   <execvp@plt>
  test   %rax,%rax
  jns    L113
  lea    D40(%rip),%rdi
  call   <my_str@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L113
  nopl   0x0(%rax,%rax,1)
L50:
  xor    %edi,%edi
  call   <wait@plt>
  cmp    0x8(%rsp),%rax
  jne    L50
  mov    %r13,%rdi
  call   <my_freevect@plt>
  jmp    L113
L92:
  lea    D27(%rip),%rdi
  call   <my_str@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L113
```

tool_calls: name: read_data
arguments: label: D21
type_infered: string
name: read_data
arguments: label: D9
type_infered: string
name: read_data
arguments: label: D43
type_infered: string
name: read_data
arguments: label: D40
type_infered: string
name: read_data
arguments: label: D27
type_infered: string

tool: D21: Exiting minishell. Goodbye!


tool: D9: exit

tool: D43: cd

tool: D40: ERROR: execvp failed.


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