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

```asm
<dataConnect>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x58,%rsp
  mov    %edi,-0x6c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  mov    %rsp,%rax
  cmp    %rax,%rsp
  je     L109
L121:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rax,%rsp
  jne    L121
L109:
  sub    $0x400,%rsp
  orq    $0x0,0x3f8(%rsp)
  mov    $0x100,%esi
  mov    %rsp,%rdi
  mov    %rsp,%r12
  call   <bzero@plt>
  test   %rbx,%rbx
  jne    L6
  lea    D59(%rip),%rdi
  call   <perror@plt>
L6:
  lea    D14(%rip),%rsi
  mov    %r13,%rdi
  call   <fopen@plt>
  mov    %rax,-0x68(%rbp)
  test   %rax,%rax
  je     L53
L147:
  lea    D12(%rip),%rdi
  lea    -0x54(%rbp),%r13
  call   <printf@plt>
  mov    %r13,%rdi
  lea    -0x50(%rbp),%r14
  call   <FD_ZERO@plt>
  mov    -0x6c(%rbp),%ebx
  mov    %r13,%rsi
  mov    %ebx,%edi
  lea    0x1(%rbx),%r15d
  mov    $0x3e8,%ebx
  call   <FD_SET@plt>
  jmp    L145
  nopl   0x0(%rax)
L32:
  mov    -0x6c(%rbp),%edi
  mov    $0x400,%edx
  xor    %ecx,%ecx
  mov    %r12,%rsi
  call   <recv@plt>
  mov    %rax,%rdx
  test   %rax,%rax
  js     L42
  jne    L35
L77:
  sub    $0x1,%ebx
  je     L55
L145:
  mov    $0x400,%esi
  mov    %r12,%rdi
  call   <bzero@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    %r14,%r8
  mov    %r13,%rsi
  mov    %r15d,%edi
  movl   $0x14,-0x50(%rbp)
  movq   $0x0,-0x48(%rbp)
  call   <select@plt>
  cmp    $0xffffffff,%eax
  je     L11
  test   %eax,%eax
  jne    L32
  mov    -0x68(%rbp),%rdi
  call   <fclose@plt>
  lea    D32(%rip),%rdi
  call   <perror@plt>
  sub    $0x1,%ebx
  jne    L145
L55:
  lea    D63(%rip),%rdi
  call   <printf@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L89
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax)
L11:
  mov    -0x68(%rbp),%rdi
  call   <fclose@plt>
  lea    D36(%rip),%rdi
  call   <perror@plt>
  jmp    L77
  nopw   0x0(%rax,%rax,1)
L42:
  lea    D9(%rip),%rdi
  mov    %rax,-0x78(%rbp)
  call   <perror@plt>
  mov    -0x78(%rbp),%rdx
L35:
  mov    -0x68(%rbp),%rcx
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <fwrite@plt>
  jmp    L77
L53:
  lea    D48(%rip),%rdi
  call   <perror@plt>
  jmp    L147
L89:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D59
datatype: string
name: parse_data
arguments: data_tag: D14
datatype: string
name: parse_data
arguments: data_tag: D12
datatype: string
name: parse_data
arguments: data_tag: D32
datatype: string
name: parse_data
arguments: data_tag: D63
datatype: string
name: parse_data
arguments: data_tag: D36
datatype: string
name: parse_data
arguments: data_tag: D9
datatype: string
name: parse_data
arguments: data_tag: D48
datatype: string

tool: D59: useless thing

tool: D14: w

tool: D12: In dataConnect.


tool: D32: Timeout

tool: D63: Out of loop


tool: D36: select()

tool: D9: ERROR reading from socket

tool: D48: Error creating file.

assistant: ```c
void dataConnect(int sock, struct sockaddr_in *client_addr, char *filename) {
  int maxfd;
  ssize_t n;
  size_t BUFFER_SIZE = 1024;
  char buffer[BUFFER_SIZE];
  bzero(buffer, 256);
  fd_set rfds;
  struct timeval tv;
  int retval;
  if (client_addr == NULL)
    perror("useless thing");
  FILE *fp = fopen(filename, "w");
  if (!fp)
    perror("Error creating file.");
  printf("In dataConnect.\n");
  FD_ZERO(&rfds);
  FD_SET(sock, &rfds);
  maxfd = sock + 1;
  int i = 0;
  while (i++ < 1000) {
    bzero(buffer, BUFFER_SIZE);
    tv.tv_sec = 20;
    tv.tv_usec = 0;
    retval = select(maxfd, &rfds, NULL, NULL, &tv);
    if (retval == -1) {
      fclose(fp);
      perror("select()");
    } else if (retval) {
      n = recv(sock, buffer, BUFFER_SIZE, 0);
      if (n < 0)
        perror("ERROR reading from socket");
      if (n != 0) {
        fwrite(buffer, 1, n, fp);
      }
    } else {
      fclose(fp);
      perror("Timeout");
    }
  }
  printf("Out of loop\n");
}
```