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

```asm
<main>:
  endbr64
  push   %r15
  lea    D45(%rip),%rsi
  mov    $0x1,%edi
  lea    D11(%rip),%r15
  push   %r14
  lea    D4(%rip),%r14
  push   %r13
  lea    D58(%rip),%r13
  push   %r12
  lea    D37(%rip),%r12
  push   %rbp
  lea    D48(%rip),%rbp
  push   %rbx
  sub    $0x418,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  call   <ece391_fdputs@plt>
  nop
L25:
  mov    %rbp,%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
  xor    %edi,%edi
  mov    $0x3ff,%edx
  mov    %rbx,%rsi
  call   <ece391_read@plt>
  cmp    $0xffffffff,%eax
  je     L45
  test   %eax,%eax
  jle    L84
  lea    -0x1(%rax),%edx
  movslq %edx,%rcx
  cmpb   $0xa,(%rsp,%rcx,1)
  cmove  %edx,%eax
L84:
  cltq
  mov    %r12,%rsi
  mov    %rbx,%rdi
  movb   $0x0,(%rsp,%rax,1)
  call   <ece391_strcmp@plt>
  test   %rax,%rax
  je     L106
  cmpb   $0x0,(%rsp)
  je     L25
  mov    %rbx,%rdi
  call   <ece391_execute@plt>
  cmp    $0xffffffff,%eax
  je     L90
  cmp    $0x100,%eax
  je     L73
  test   %eax,%eax
  je     L25
  mov    %r13,%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
  jmp    L25
  nopl   (%rax)
L90:
  mov    %r14,%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
  jmp    L25
  nopw   0x0(%rax,%rax,1)
L73:
  mov    %r15,%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
  jmp    L25
L45:
  lea    D56(%rip),%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
  mov    $0x3,%eax
L68:
  mov    0x408(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L115
  add    $0x418,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L106:
  xor    %eax,%eax
  jmp    L68
L115:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D45
datatype: string
name: extract_symbolic_data
arguments: data_label: D11
datatype: string
name: extract_symbolic_data
arguments: data_label: D4
datatype: string
name: extract_symbolic_data
arguments: data_label: D58
datatype: string
name: extract_symbolic_data
arguments: data_label: D37
datatype: string
name: extract_symbolic_data
arguments: data_label: D48
datatype: string
name: extract_symbolic_data
arguments: data_label: D56
datatype: string

tool: D45: Starting 391 Shell


tool: D11: program terminated by exception


tool: D4: no such command


tool: D58: program terminated abnormally


tool: D37: exit

tool: D48: 391OS> 

tool: D56: read from keyboard failed


assistant: ```c
int main() {
  int32_t cnt, rval;
  uint8_t buf[1024];
  ece391_fdputs(1, (uint8_t *)"Starting 391 Shell\n");
  while (1) {
    ece391_fdputs(1, (uint8_t *)"391OS> ");
    if (-1 == (cnt = ece391_read(0, buf, 1024 - 1))) {
      ece391_fdputs(1, (uint8_t *)"read from keyboard failed\n");
      return 3;
    }
    if (cnt > 0 && '\n' == buf[cnt - 1])
      cnt--;
    buf[cnt] = '\0';
    if (0 == ece391_strcmp(buf, (uint8_t *)"exit"))
      return 0;
    if ('\0' == buf[0])
      continue;
    rval = ece391_execute(buf);
    if (-1 == rval)
      ece391_fdputs(1, (uint8_t *)"no such command\n");
    else if (256 == rval)
      ece391_fdputs(1, (uint8_t *)"program terminated by exception\n");
    else if (0 != rval)
      ece391_fdputs(1, (uint8_t *)"program terminated abnormally\n");
  }
}
```