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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  lea    D92(%rip),%r14
  push   %r13
  lea    D1(%rip),%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x2b8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x2a8(%rsp)
  xor    %eax,%eax
  lea    0xa0(%rsp),%r12
  mov    %rsp,%rbx
  lea    0x50(%rsp),%rbp
  cs nopw 0x0(%rax,%rax,1)
L247:
  mov    %r12,%rdi
  call   <fgetwd@plt>
  mov    %r12,%rdi
  call   <iwrites@plt>
  mov    %r14,%rdi
  call   <iwrites@plt>
  mov    $0x50,%esi
  mov    %rbx,%rdi
  call   <ireads@plt>
  mov    $0x20,%esi
  mov    %rbx,%rdi
  call   <sfindc@plt>
  movslq %eax,%r15
  test   %r15d,%r15d
  js     L170
L14:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  mov    %r15d,%edx
  call   <scopy@plt>
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <scompare@plt>
  test   %eax,%eax
  jne    L18
  lea    D24(%rip),%rdi
  call   <iwrites@plt>
  jmp    L247
  nopl   (%rax)
L18:
  lea    D40(%rip),%rsi
  mov    %rbp,%rdi
  call   <scompare@plt>
  test   %eax,%eax
  jne    L157
  call   <ls@plt>
  jmp    L247
  nopl   (%rax)
L170:
  mov    %rbx,%rdi
  call   <slength@plt>
  movslq %eax,%r15
  jmp    L14
  nopl   (%rax)
L157:
  lea    D94(%rip),%rsi
  mov    %rbp,%rdi
  call   <scompare@plt>
  test   %eax,%eax
  jne    L7
  lea    0x1(%rbx,%r15,1),%rdi
  call   <cd@plt>
  jmp    L247
  nopw   0x0(%rax,%rax,1)
L7:
  lea    D104(%rip),%rsi
  mov    %rbp,%rdi
  call   <scompare@plt>
  test   %eax,%eax
  jne    L79
  lea    0x1(%rbx,%r15,1),%rdi
  call   <cat@plt>
  jmp    L247
  nopw   0x0(%rax,%rax,1)
L79:
  lea    D17(%rip),%rsi
  mov    %rbp,%rdi
  call   <scompare@plt>
  test   %eax,%eax
  jne    L55
  lea    0x1(%rbx,%r15,1),%rdi
  call   <echo@plt>
  jmp    L247
  nopw   0x0(%rax,%rax,1)
L55:
  lea    D20(%rip),%rsi
  mov    %rbp,%rdi
  call   <scompare@plt>
  test   %eax,%eax
  jne    L155
  lea    0x1(%rbx,%r15,1),%rdi
  call   <pwd@plt>
  jmp    L247
  nopw   0x0(%rax,%rax,1)
L155:
  lea    D43(%rip),%rsi
  mov    %rbp,%rdi
  call   <scompare@plt>
  test   %eax,%eax
  jne    L150
  call   <ireboot@plt>
  jmp    L247
L150:
  mov    $0x2f,%esi
  mov    %rbp,%rdi
  call   <sfindc@plt>
  add    $0x1,%eax
  je     L244
  mov    %rbp,%rdi
  call   <fget@plt>
  mov    %eax,%r15d
  test   %eax,%eax
  je     L8
L94:
  mov    %r15d,%edi
  call   <fgettype@plt>
  cmp    $0x2,%eax
  jne    L133
  mov    %r15d,%edi
  call   <iexec@plt>
  jmp    L247
L244:
  lea    D111(%rip),%rdi
  call   <fget@plt>
  mov    %eax,%edi
  test   %eax,%eax
  je     L42
  mov    %rbp,%rsi
  call   <ffind@plt>
  mov    %eax,%r15d
  test   %eax,%eax
  jne    L94
  lea    D130(%rip),%rdi
  call   <iwrites@plt>
  mov    %rbp,%rdi
  call   <iwrites@plt>
  lea    D84(%rip),%rdi
  call   <iwrites@plt>
  jmp    L247
L133:
  lea    D127(%rip),%rdi
  call   <iwrites@plt>
  jmp    L247
L8:
  lea    D35(%rip),%rdi
  call   <iwrites@plt>
  jmp    L247
L42:
  lea    D114(%rip),%rdi
  call   <iwrites@plt>
  jmp    L247
```

tool_calls: name: retrieve_data
arguments: data_label: D92
type_guessed: string
name: retrieve_data
arguments: data_label: D1
type_guessed: string
name: retrieve_data
arguments: data_label: D24
type_guessed: string
name: retrieve_data
arguments: data_label: D40
type_guessed: string
name: retrieve_data
arguments: data_label: D94
type_guessed: string
name: retrieve_data
arguments: data_label: D104
type_guessed: string
name: retrieve_data
arguments: data_label: D17
type_guessed: string
name: retrieve_data
arguments: data_label: D20
type_guessed: string
name: retrieve_data
arguments: data_label: D43
type_guessed: string
name: retrieve_data
arguments: data_label: D111
type_guessed: string
name: retrieve_data
arguments: data_label: D130
type_guessed: string
name: retrieve_data
arguments: data_label: D84
type_guessed: string
name: retrieve_data
arguments: data_label: D127
type_guessed: string
name: retrieve_data
arguments: data_label: D35
type_guessed: string
name: retrieve_data
arguments: data_label: D114
type_guessed: string

tool: D92: > 

tool: D1: help

tool: D24: 
cat: print file contents
cd: change directories
echo: print a string
help: display this message
ls: list files
pwd: print current working directory



tool: D40: ls

tool: D94: cd

tool: D104: cat

tool: D17: echo

tool: D20: pwd

tool: D43: reboot

tool: D111: /bin/

tool: D130: Error: unrecognized command "

tool: D84: "


tool: D127: Error: file is not executable


tool: D35: Error: executable not found


tool: D114: Error: unable to locate bin directory


assistant: ```c
int main() {
  char buffer[80];
  char verb[80];
  char wd[512];
  int len;
  int prog;
  while (1) {
    fgetwd(wd);
    iwrites(wd);
    iwrites("> ");
    ireads(buffer, 80);
    len = sfindc(buffer, ' ');
    if (len < 0)
      len = slength(buffer);
    scopy(verb, buffer, len);
    if (!scompare(verb, "help")) {
      iwrites("\ncat: print file contents\ncd: change directories\necho: print a string\nhelp: display this message\nls: list files\npwd: print current working directory\n\n");
    } else if (!scompare(verb, "ls")) {
      ls();
    } else if (!scompare(verb, "cd")) {
      cd(buffer + len + 1);
    } else if (!scompare(verb, "cat")) {
      cat(buffer + len + 1);
    } else if (!scompare(verb, "echo")) {
      echo(buffer + len + 1);
    } else if (!scompare(verb, "pwd")) {
      pwd(buffer + len + 1);
    } else if (!scompare(verb, "reboot")) {
      ireboot();
    } else if (sfindc(verb, '/') == -1) {
      prog = fget("/bin/");
      if (!prog) {
        iwrites("Error: unable to locate bin directory\n");
        continue;
      }
      prog = ffind(prog, verb);
      if (!prog) {
        iwrites("Error: unrecognized command \"");
        iwrites(verb);
        iwrites("\"\n");
        continue;
      }
      if (fgettype(prog) == 2)
        iexec(prog);
      else {
        iwrites("Error: file is not executable\n");
        continue;
      }
    } else if (prog = fget(verb)) {
      if (fgettype(prog) == 2)
        iexec(prog);
      else {
        iwrites("Error: file is not executable\n");
        continue;
      }
    } else {
      iwrites("Error: executable not found\n");
      continue;
    }
  }
}
```