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

```asm
<ftp>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0xfb0,%rsp
  mov    $0x3f2,%ecx
  pxor   %xmm0,%xmm0
  mov    $0x1fa0,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x1fa8(%rsp)
  xor    %eax,%eax
  mov    %edi,%ebp
  lea    0x10(%rsp),%rdi
  mov    %rsp,%r12
  mov    %esi,%r13d
  mov    %r12,%rsi
  movaps %xmm0,(%rsp)
  rep stos %rax,%es:(%rdi)
  movb   $0x0,(%rdi)
  mov    %ebp,%edi
  call   <read@plt>
  lea    0x1(%rax),%rdx
  cmp    $0x1,%rdx
  jbe    L105
  lea    -0x1(%rax),%rdx
  cmp    $0x1f9e,%rdx
  jbe    L251
  movb   $0x0,(%rsp)
  test   %rax,%rax
  jle    L76
  xor    %ecx,%ecx
L190:
  mov    $0x1,%esi
  mov    %r12,%rdx
  sub    %r12,%rsi
  jmp    L227
  nopl   (%rax)
L177:
  lea    (%rsi,%rdx,1),%rcx
  cmp    %rcx,%rax
  jle    L76
L18:
  movzbl 0x1(%rdx),%ecx
  add    $0x1,%rdx
L227:
  cmp    $0xd,%cl
  je     L198
  cmp    $0xa,%cl
  jne    L177
L198:
  lea    (%rsi,%rdx,1),%rcx
  movb   $0x2a,(%rdx)
  cmp    %rcx,%rax
  jg     L18
L76:
  mov    %r13d,%edx
  mov    %r12,%rsi
  lea    D53(%rip),%rdi
  call   <printf@plt>
  mov    $0x4,%edx
  lea    D69(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L61
  movzbl 0x5(%rsp),%eax
  cmp    $0x2e,%al
  je     L90
  cmp    $0x7c,%al
  jne    L132
L163:
  lea    D17(%rip),%rdx
  lea    D14(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  mov    %ebp,%edi
  mov    $0x1fa0,%edx
  mov    %r12,%rsi
  call   <write@plt>
  mov    %ebp,%edi
  call   <close@plt>
L249:
  mov    $0x1,%edi
  call   <sleep@plt>
  mov    %ebp,%edi
  call   <close@plt>
  xor    %eax,%eax
L16:
  mov    0x1fa8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L10
  add    $0x1fb0,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L251:
  movb   $0x0,(%rsp,%rax,1)
  movzbl (%rsp),%ecx
  jmp    L190
  nopl   (%rax)
L61:
  mov    $0x4,%edx
  lea    D3(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L211
  mov    $0x3,%edx
  lea    D34(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L7
  lea    0x3(%rsp),%rsi
  mov    %ebp,%edi
  call   <lsFunction@plt>
  jmp    L249
  nopl   0x0(%rax)
L90:
  cmpb   $0x2e,0x6(%rsp)
  je     L163
L132:
  lea    0x4(%rsp),%rsi
  mov    %ebp,%edi
  call   <getFunction@plt>
  jmp    L249
  nopl   0x0(%rax)
L211:
  lea    0x5(%rsp),%rsi
  mov    %ebp,%edi
  call   <putFunction@plt>
  jmp    L249
  nopl   0x0(%rax)
L105:
  mov    %ebp,%edi
  call   <close@plt>
  mov    $0x1,%eax
  jmp    L16
L7:
  mov    $0x4,%edx
  lea    D19(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L252
  mov    $0x3,%edx
  lea    D28(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L56
  lea    0x3(%rsp),%rsi
  mov    %ebp,%edi
  call   <cdFunction@plt>
  jmp    L249
L252:
  lea    0x5(%rsp),%rsi
  mov    %ebp,%edi
  call   <mgetFunction@plt>
  jmp    L249
L56:
  mov    $0x5,%edx
  lea    D22(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L249
  mov    %ebp,%edi
  call   <cdResetFunction@plt>
  jmp    L249
L10:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D53
data_type: string
name: retrieve_data
arguments: label: D69
data_type: string
name: retrieve_data
arguments: label: D17
data_type: string
name: retrieve_data
arguments: label: D14
data_type: string
name: retrieve_data
arguments: label: D3
data_type: string
name: retrieve_data
arguments: label: D34
data_type: string
name: retrieve_data
arguments: label: D19
data_type: string
name: retrieve_data
arguments: label: D28
data_type: string
name: retrieve_data
arguments: label: D22
data_type: string

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


tool: D69: get 

tool: D17: negado

tool: D14: %s

tool: D3: put 

tool: D34: ls 

tool: D19: mget 

tool: D28: cd 

tool: D22: 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;
}
```