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

```asm
<ftp>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0xfb0,%rsp
  mov    %edi,%ebx
  mov    %esi,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x1fa8(%rsp)
  xor    %eax,%eax
  movq   $0x0,(%rsp)
  movq   $0x0,0x8(%rsp)
  lea    0x10(%rsp),%rdi
  mov    $0x3f2,%ecx
  rep stos %rax,%es:(%rdi)
  movb   $0x0,(%rdi)
  mov    %rsp,%rsi
  mov    $0x1fa0,%edx
  mov    %ebx,%edi
  call   <read@plt>
  lea    0x1(%rax),%rdx
  cmp    $0x1,%rdx
  jbe    L193
  lea    -0x1(%rax),%rdx
  cmp    $0x1f9e,%rdx
  ja     L89
  movb   $0x0,(%rsp,%rax,1)
L110:
  mov    $0x0,%edx
  jmp    L210
L193:
  mov    %ebx,%edi
  call   <close@plt>
  mov    $0x1,%eax
  jmp    L219
L89:
  movb   $0x0,(%rsp)
  test   %rax,%rax
  jg     L110
L233:
  mov    %rsp,%r12
  mov    %ebp,%edx
  mov    %r12,%rsi
  lea    D83(%rip),%rdi
  call   <printf@plt>
  mov    $0x4,%edx
  lea    D76(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L68
  movzbl 0x5(%rsp),%eax
  cmp    $0x2e,%al
  je     L34
  cmp    $0x7c,%al
  jne    L107
L197:
  mov    %rsp,%rbp
  lea    D81(%rip),%rdx
  lea    D31(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    $0x1fa0,%edx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <write@plt>
  mov    %ebx,%edi
  call   <close@plt>
L160:
  mov    $0x1,%edi
  call   <sleep@plt>
  mov    %ebx,%edi
  call   <close@plt>
  mov    $0x0,%eax
L219:
  mov    0x1fa8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L130
  add    $0x1fb0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L202:
  movb   $0x2a,(%rsp,%rsi,1)
L120:
  add    $0x1,%rdx
  cmp    %rdx,%rax
  jle    L233
L210:
  mov    %rdx,%rsi
  movzbl (%rsp,%rdx,1),%ecx
  cmp    $0xd,%cl
  je     L202
  cmp    $0xa,%cl
  jne    L120
  jmp    L202
L34:
  cmpb   $0x2e,0x6(%rsp)
  je     L197
L107:
  lea    0x4(%rsp),%rsi
  mov    %ebx,%edi
  call   <getFunction@plt>
  jmp    L160
L68:
  mov    %rsp,%rdi
  mov    $0x4,%edx
  lea    D38(%rip),%rsi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L224
  lea    0x5(%rsp),%rsi
  mov    %ebx,%edi
  call   <putFunction@plt>
  jmp    L160
L224:
  mov    %rsp,%rdi
  mov    $0x3,%edx
  lea    D47(%rip),%rsi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L171
  lea    0x3(%rsp),%rsi
  mov    %ebx,%edi
  call   <lsFunction@plt>
  jmp    L160
L171:
  mov    %rsp,%rdi
  mov    $0x4,%edx
  lea    D41(%rip),%rsi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L143
  lea    0x5(%rsp),%rsi
  mov    %ebx,%edi
  call   <mgetFunction@plt>
  jmp    L160
L143:
  mov    %rsp,%rdi
  mov    $0x3,%edx
  lea    D7(%rip),%rsi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L67
  lea    0x3(%rsp),%rsi
  mov    %ebx,%edi
  call   <cdFunction@plt>
  jmp    L160
L67:
  mov    %rsp,%rdi
  mov    $0x5,%edx
  lea    D11(%rip),%rsi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L160
  mov    %ebx,%edi
  call   <cdResetFunction@plt>
  jmp    L160
L130:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D83
data_type: string
name: parse_data
arguments: tag: D76
data_type: string
name: parse_data
arguments: tag: D81
data_type: string
name: parse_data
arguments: tag: D31
data_type: string
name: parse_data
arguments: tag: D38
data_type: string
name: parse_data
arguments: tag: D47
data_type: string
name: parse_data
arguments: tag: D41
data_type: string
name: parse_data
arguments: tag: D7
data_type: string
name: parse_data
arguments: tag: D11
data_type: string

tool: D83: LOG request %s - hit %d


tool: D76: get 

tool: D81: negado

tool: D31: %s

tool: D38: put 

tool: D47: ls 

tool: D41: mget 

tool: D7: cd 

tool: D11: reset 

assistant: ```c
int ftp(int fd, int hit) {
  int j, file_fd, filedesc;
  long i, ret, len;
  char *fstr;
  char buffer[8096 + 1] = {0};
  ret = read(fd, buffer, 8096);
  if (ret == 0 || ret == -1) {
    close(fd);
    return 1;
  }
  if (ret > 0 && ret < 8096)
    buffer[ret] = 0;
  else
    buffer[0] = 0;
  for (i = 0; i < ret; i++)
    if (buffer[i] == '\r' || buffer[i] == '\n')
      buffer[i] = '*';
  printf("LOG request %s - hit %d\n", buffer, hit);
  if (!strncmp(buffer, "get ", 4)) {
    if ((buffer[5] == '.' && buffer[6] == '.') || buffer[5] == '|') {
      sprintf(buffer, "%s", "negado");
      write(fd, buffer, 8096);
      close(fd);
    } else {
      getFunction(fd, &buffer[4]);
    }
  } else if (!strncmp(buffer, "put ", 4)) {
    putFunction(fd, &buffer[5]);
  } else if (!strncmp(buffer, "ls ", 3)) {
    lsFunction(fd, &buffer[3]);
  } else if (!strncmp(buffer, "mget ", 4)) {
    mgetFunction(fd, &buffer[5]);
  } else if (!strncmp(buffer, "cd ", 3)) {
    cdFunction(fd, &buffer[3]);
  } else if (!strncmp(buffer, "reset ", 5)) {
    cdResetFunction(fd);
  }
  sleep(1);
  close(fd);
  return 0;
}
```