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

```asm
<prompt>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x2d0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
L91:
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <fstat@plt>
  shr    $0x3f,%rax
  movzbl %al,%eax
  mov    $0x4c,%edx
  lea    D145(%rip),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <_assert@plt>
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <fstat@plt>
  shr    $0x3f,%rax
  movzbl %al,%eax
  mov    $0x4d,%edx
  lea    D145(%rip),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <_assert@plt>
  mov    $0x0,%esi
  mov    $0x2,%edi
  call   <fstat@plt>
  shr    $0x3f,%rax
  movzbl %al,%eax
  mov    $0x4e,%edx
  lea    D145(%rip),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <_assert@plt>
  lea    -0x2b0(%rbp),%rax
  mov    %rax,%rdi
  call   <getcwd@plt>
  lea    -0x260(%rbp),%rax
  mov    %rax,%rdi
  call   <gettty@plt>
  lea    -0x2b0(%rbp),%rdx
  lea    -0x260(%rbp),%rax
  mov    %rax,%rsi
  lea    D31(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    -0x210(%rbp),%rax
  mov    $0xff,%edx
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <get_line@plt>
  lea    -0x210(%rbp),%rax
  mov    $0x2,%edx
  lea    D96(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L16
  mov    $0x0,%eax
  call   <print_help@plt>
  jmp    L70
L16:
  lea    -0x210(%rbp),%rax
  mov    $0x7,%edx
  lea    D162(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L10
  mov    $0x0,%eax
  call   <logout@plt>
  jmp    L91
L10:
  lea    -0x210(%rbp),%rax
  mov    $0x1,%edx
  lea    D170(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L187
  call   <fork@plt>
  mov    %eax,-0x2c8(%rbp)
  cmpl   $0x0,-0x2c8(%rbp)
  jne    L186
  lea    -0x110(%rbp),%rax
  lea    D93(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  lea    -0x210(%rbp),%rax
  lea    D76(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strtok@plt>
  mov    %rax,-0x2c0(%rbp)
  jmp    L266
L97:
  mov    -0x2c0(%rbp),%rax
  mov    $0x3,%edx
  lea    D247(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L277
  lea    D76(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,-0x2c0(%rbp)
  cmpq   $0x0,-0x2c0(%rbp)
  jne    L104
  lea    D155(%rip),%rax
  mov    %rax,%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L104:
  mov    -0x2c0(%rbp),%rax
  mov    %rax,%rdi
  call   <creat@plt>
  mov    $0x1,%edi
  call   <close@plt>
  mov    -0x2c0(%rbp),%rax
  mov    $0x401,%esi
  mov    %rax,%rdi
  call   <open@plt>
  test   %rax,%rax
  jns    L196
  mov    -0x2c0(%rbp),%rax
  mov    %rax,%rdx
  lea    D225(%rip),%rax
  mov    %rax,%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  jmp    L196
L277:
  mov    -0x2c0(%rbp),%rax
  mov    $0x2,%edx
  lea    D129(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L167
  lea    D76(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,-0x2c0(%rbp)
  cmpq   $0x0,-0x2c0(%rbp)
  jne    L87
  lea    D155(%rip),%rax
  mov    %rax,%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L87:
  mov    $0x1,%edi
  call   <close@plt>
  mov    -0x2c0(%rbp),%rax
  mov    %rax,%rdi
  call   <creat@plt>
  mov    -0x2c0(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <open@plt>
  test   %rax,%rax
  jns    L196
  mov    -0x2c0(%rbp),%rax
  mov    %rax,%rdx
  lea    D225(%rip),%rax
  mov    %rax,%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  jmp    L196
L167:
  mov    -0x2c0(%rbp),%rax
  mov    $0x2,%edx
  lea    D153(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L5
  lea    D76(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,-0x2c0(%rbp)
  cmpq   $0x0,-0x2c0(%rbp)
  jne    L1
  lea    D155(%rip),%rax
  mov    %rax,%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L1:
  mov    -0x2c0(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jns    L120
  mov    -0x2c0(%rbp),%rax
  mov    %rax,%rdx
  lea    D91(%rip),%rax
  mov    %rax,%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L120:
  mov    $0x0,%edi
  call   <close@plt>
  mov    -0x2c0(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <open@plt>
  test   %rax,%rax
  jns    L196
  mov    -0x2c0(%rbp),%rax
  mov    %rax,%rdx
  lea    D91(%rip),%rax
  mov    %rax,%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  jmp    L196
L5:
  mov    -0x2c0(%rbp),%rax
  mov    $0x2,%edx
  lea    D44(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L152
  lea    -0x2b8(%rbp),%rax
  mov    %rax,%rdi
  call   <pipe@plt>
  call   <fork@plt>
  mov    %eax,-0x2c4(%rbp)
  cmpl   $0x0,-0x2c4(%rbp)
  jne    L107
  lea    -0x110(%rbp),%rax
  lea    D93(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x2b4(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    $0x0,%edi
  call   <close@plt>
  mov    -0x2b8(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <dup2@plt>
  jmp    L196
L107:
  movq   $0x0,-0x2c0(%rbp)
  mov    -0x2b8(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    $0x1,%edi
  call   <close@plt>
  mov    -0x2b4(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <dup2@plt>
  jmp    L266
L152:
  mov    -0x2c0(%rbp),%rdx
  lea    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  lea    -0x110(%rbp),%rax
  lea    D76(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
L196:
  lea    D76(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,-0x2c0(%rbp)
L266:
  cmpq   $0x0,-0x2c0(%rbp)
  jne    L97
  lea    -0x110(%rbp),%rax
  mov    %rax,%rdi
  call   <exec@plt>
  mov    $0x0,%eax
  call   <getpid@plt>
  mov    %eax,%edx
  lea    D190(%rip),%rax
  mov    %rax,%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  jmp    L91
L186:
  mov    $0x0,%eax
  call   <wait@plt>
  jmp    L91
L187:
  nop
L70:
  jmp    L91
```

tool_calls: name: extract_symbolic_data
arguments: label: D145
type_guessed: string
name: extract_symbolic_data
arguments: label: D31
type_guessed: string
name: extract_symbolic_data
arguments: label: D96
type_guessed: string
name: extract_symbolic_data
arguments: label: D162
type_guessed: string
name: extract_symbolic_data
arguments: label: D170
type_guessed: string
name: extract_symbolic_data
arguments: label: D93
type_guessed: string
name: extract_symbolic_data
arguments: label: D76
type_guessed: string
name: extract_symbolic_data
arguments: label: D247
type_guessed: string
name: extract_symbolic_data
arguments: label: D155
type_guessed: string
name: extract_symbolic_data
arguments: label: D225
type_guessed: string
name: extract_symbolic_data
arguments: label: D129
type_guessed: string
name: extract_symbolic_data
arguments: label: D153
type_guessed: string
name: extract_symbolic_data
arguments: label: D91
type_guessed: string
name: extract_symbolic_data
arguments: label: D44
type_guessed: string
name: extract_symbolic_data
arguments: label: D190
type_guessed: string

tool: D145: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/fsh.c

tool: D31: %s@%s$ 

tool: D96: ?

tool: D162: logout

tool: 

tool: D93: /bin/

tool: D76:  

tool: D247: >>

tool: D155: NULL output filename


tool: D225: %s: Could not open for writing


tool: D129: >

tool: D153: <

tool: D91: Could not open %s for reading


tool: D44: |

tool: D190: PID:%d failed to execute


assistant: ```c
int prompt() {
  int cid;
  char cwd[80], tty[80], request[255], command[255];
  while (1) {
    _assert(fstat(0, 0) < 0, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/fsh.c", 76);
    _assert(fstat(1, 0) < 0, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/fsh.c", 77);
    _assert(fstat(2, 0) < 0, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/fsh.c", 78);
    getcwd(cwd);
    gettty(tty);
    printf("%s@%s$ ", tty, cwd);
    get_line(0, request, 255);
    if (strncmp(request, "?", 2) == 0) {
      print_help();
      continue;
    } else if (strncmp(request, "logout", 7) == 0) {
      logout();
    } else if (strncmp(request, "", 1) == 0) {
      continue;
    } else {
      char *tok;
      cid = fork();
      if (!cid) {
        strcpy(command, "/bin/");
        tok = strtok(request, " ");
        while (tok != 0) {
          if (strncmp(tok, ">>", 3) == 0) {
            tok = strtok(0, " ");
            if (tok == 0) {
              fprintf(2, "NULL output filename\n");
              exit(-1);
            }
            creat(tok);
            close(1);
            if (open(tok, 01 | 02000) < 0) {
              fprintf(2, "%s: Could not open for writing\n", tok);
              exit(-1);
            }
          } else if (strncmp(tok, ">", 2) == 0) {
            tok = strtok(0, " ");
            if (tok == 0) {
              fprintf(2, "NULL output filename\n");
              exit(-1);
            }
            close(1);
            creat(tok);
            if (open(tok, 01) < 0) {
              fprintf(2, "%s: Could not open for writing\n", tok);
              exit(-1);
            }
          } else if (strncmp(tok, "<", 2) == 0) {
            tok = strtok(0, " ");
            if (tok == 0) {
              fprintf(2, "NULL output filename\n");
              exit(-1);
            }
            if (stat(tok, 0) < 0) {
              fprintf(2, "Could not open %s for reading\n", tok);
              exit(-1);
            }
            close(0);
            if (open(tok, 00) < 0) {
              fprintf(2, "Could not open %s for reading\n", tok);
              exit(-1);
            }
          } else if (strncmp(tok, "|", 2) == 0) {
            int new_pipe[2], pipe_pid;
            pipe(new_pipe);
            pipe_pid = fork();
            if (!pipe_pid) {
              strcpy(command, "/bin/");
              close(new_pipe[1]);
              close(0);
              dup2(new_pipe[0], 0);
            } else {
              tok = 0;
              close(new_pipe[0]);
              close(1);
              dup2(new_pipe[1], 1);
              continue;
            }
          } else {
            strcat(command, tok);
            strcat(command, " ");
          }
          tok = strtok(0, " ");
        }
        exec(command);
        fprintf(2, "PID:%d failed to execute\r\n", getpid());
        exit(-1);
      } else {
        wait();
      }
    }
  }
  return (-1);
}
```