user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x420,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D53(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
L52:
  lea    D2(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
  lea    -0x410(%rbp),%rax
  mov    $0x3ff,%edx
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <ece391_read@plt>
  mov    %eax,-0x418(%rbp)
  cmpl   $0xffffffff,-0x418(%rbp)
  jne    L58
  lea    D4(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
  mov    $0x3,%eax
  jmp    L24
L58:
  cmpl   $0x0,-0x418(%rbp)
  jle    L101
  mov    -0x418(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movzbl -0x410(%rbp,%rax,1),%eax
  cmp    $0xa,%al
  jne    L101
  subl   $0x1,-0x418(%rbp)
L101:
  mov    -0x418(%rbp),%eax
  cltq
  movb   $0x0,-0x410(%rbp,%rax,1)
  lea    -0x410(%rbp),%rax
  lea    D44(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <ece391_strcmp@plt>
  test   %rax,%rax
  jne    L88
  mov    $0x0,%eax
  jmp    L24
L88:
  movzbl -0x410(%rbp),%eax
  test   %al,%al
  je     L146
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <ece391_execute@plt>
  mov    %eax,-0x414(%rbp)
  cmpl   $0xffffffff,-0x414(%rbp)
  jne    L118
  lea    D63(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
  jmp    L52
L118:
  cmpl   $0x100,-0x414(%rbp)
  jne    L117
  lea    D40(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
  jmp    L52
L117:
  cmpl   $0x0,-0x414(%rbp)
  je     L52
  lea    D56(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <ece391_fdputs@plt>
  jmp    L52
L146:
  nop
  jmp    L52
L24:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L18
  call   <__stack_chk_fail@plt>
L18:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D53
data_type: string
name: retrieve_data
arguments: data_tag: D2
data_type: string
name: retrieve_data
arguments: data_tag: D4
data_type: string
name: retrieve_data
arguments: data_tag: D44
data_type: string
name: retrieve_data
arguments: data_tag: D63
data_type: string
name: retrieve_data
arguments: data_tag: D40
data_type: string
name: retrieve_data
arguments: data_tag: D56
data_type: string

tool: D53: Starting 391 Shell


tool: D2: 391OS> 

tool: D4: read from keyboard failed


tool: D44: exit

tool: D63: no such command


tool: D40: program terminated by exception


tool: D56: program terminated abnormally


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