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

```asm
<main_loop>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x450,%rsp
  mov    %edi,-0x444(%rbp)
  mov    %esi,-0x448(%rbp)
  mov    %edx,-0x44c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x438(%rbp)
  movl   $0x0,-0x434(%rbp)
  movl   $0x0,-0x430(%rbp)
  movl   $0xffffffff,-0x42c(%rbp)
  movl   $0xffffffff,-0x428(%rbp)
L255:
  lea    -0x43c(%rbp),%rax
  mov    %rax,%rdi
  call   <FD_ZERO@plt>
  mov    -0x42c(%rbp),%eax
  test   %eax,%eax
  jns    L120
  mov    -0x448(%rbp),%eax
  jmp    L70
L120:
  mov    -0x42c(%rbp),%eax
L70:
  lea    -0x43c(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
  mov    -0x428(%rbp),%eax
  test   %eax,%eax
  jns    L130
  mov    -0x44c(%rbp),%eax
  jmp    L197
L130:
  mov    -0x428(%rbp),%eax
L197:
  lea    -0x43c(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
  mov    -0x444(%rbp),%eax
  lea    -0x43c(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
  mov    -0x42c(%rbp),%eax
  mov    -0x448(%rbp),%edx
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,-0x424(%rbp)
  mov    -0x428(%rbp),%eax
  mov    -0x424(%rbp),%edx
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,-0x424(%rbp)
  mov    -0x424(%rbp),%edx
  mov    -0x44c(%rbp),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,-0x424(%rbp)
  mov    -0x444(%rbp),%eax
  mov    -0x424(%rbp),%edx
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,-0x424(%rbp)
  mov    -0x424(%rbp),%eax
  lea    0x1(%rax),%edi
  lea    -0x43c(%rbp),%rax
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rax,%rsi
  call   <select@plt>
  test   %rax,%rax
  jns    L215
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  jmp    L255
L215:
  lea    -0x43c(%rbp),%rdx
  mov    -0x448(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L290
  mov    -0x42c(%rbp),%eax
  shr    $0x1f,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x448(%rbp),%eax
  mov    %eax,%edi
  call   <accept_conn@plt>
  mov    %eax,-0x42c(%rbp)
L290:
  lea    -0x43c(%rbp),%rdx
  mov    -0x44c(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L174
  mov    -0x428(%rbp),%eax
  shr    $0x1f,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x44c(%rbp),%eax
  mov    %eax,%edi
  call   <accept_conn@plt>
  mov    %eax,-0x428(%rbp)
L174:
  mov    -0x438(%rbp),%eax
  test   %eax,%eax
  jne    L268
  mov    -0x42c(%rbp),%eax
  test   %eax,%eax
  js     L162
  mov    -0x42c(%rbp),%eax
  lea    -0x43c(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L162
L268:
  lea    -0x438(%rbp),%rdx
  lea    -0x410(%rbp),%rsi
  lea    -0x42c(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x400,%edx
  mov    %rax,%rdi
  call   <receive_data@plt>
  mov    %rax,-0x418(%rbp)
  cmpq   $0x0,-0x418(%rbp)
  je     L162
  mov    -0x418(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <clear_high_bit@plt>
  mov    -0x418(%rbp),%rax
  mov    %eax,%edx
  mov    -0x444(%rbp),%eax
  lea    -0x410(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  test   %rax,%rax
  jns    L162
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
L162:
  mov    -0x434(%rbp),%eax
  test   %eax,%eax
  jne    L283
  mov    -0x428(%rbp),%eax
  test   %eax,%eax
  js     L43
  mov    -0x428(%rbp),%eax
  lea    -0x43c(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L43
L283:
  lea    -0x434(%rbp),%rdx
  lea    -0x410(%rbp),%rsi
  lea    -0x428(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x400,%edx
  mov    %rax,%rdi
  call   <receive_data@plt>
  mov    %rax,-0x418(%rbp)
  cmpq   $0x0,-0x418(%rbp)
  je     L43
  mov    -0x418(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <set_high_bit@plt>
  mov    -0x418(%rbp),%rax
  mov    %eax,%edx
  mov    -0x444(%rbp),%eax
  lea    -0x410(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  test   %rax,%rax
  jns    L43
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
L43:
  mov    -0x430(%rbp),%eax
  test   %eax,%eax
  jne    L257
  mov    -0x444(%rbp),%eax
  lea    -0x43c(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L255
L257:
  lea    -0x430(%rbp),%rdx
  lea    -0x410(%rbp),%rsi
  lea    -0x444(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x400,%edx
  mov    %rax,%rdi
  call   <receive_data@plt>
  mov    %rax,-0x418(%rbp)
  cmpq   $0x0,-0x418(%rbp)
  je     L255
  movq   $0x0,-0x420(%rbp)
  jmp    L199
L170:
  lea    -0x410(%rbp),%rdx
  mov    -0x420(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jns    L179
  mov    -0x428(%rbp),%eax
  test   %eax,%eax
  js     L208
  lea    -0x410(%rbp),%rdx
  mov    -0x420(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  and    $0x7f,%eax
  mov    %eax,%edx
  lea    -0x410(%rbp),%rcx
  mov    -0x420(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
  lea    -0x410(%rbp),%rdx
  mov    -0x420(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x428(%rbp),%eax
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  test   %rax,%rax
  jns    L208
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  lea    -0x428(%rbp),%rax
  mov    %rax,%rdi
  call   <close_conn@plt>
  movl   $0x0,-0x434(%rbp)
  jmp    L208
L179:
  mov    -0x42c(%rbp),%eax
  test   %eax,%eax
  js     L208
  lea    -0x410(%rbp),%rdx
  mov    -0x420(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x42c(%rbp),%eax
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  test   %rax,%rax
  jns    L208
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  lea    -0x42c(%rbp),%rax
  mov    %rax,%rdi
  call   <close_conn@plt>
  movl   $0x0,-0x438(%rbp)
L208:
  addq   $0x1,-0x420(%rbp)
L199:
  mov    -0x420(%rbp),%rax
  cmp    -0x418(%rbp),%rax
  jb     L170
  jmp    L255
```

tool_calls: name: extract_symbolic_data
arguments: tag: D10
type_infered: string
name: extract_symbolic_data
arguments: tag: D3
type_infered: string

tool: D10: select

tool: D3: write

assistant: ```c
void main_loop(int serial_fd, int low_listener, int high_listener) {
  fd_set rdfds;
  int low_poll = 0, high_poll = 0, serial_poll = 0;
  int low_fd = -1, high_fd = -1;
  while (1) {
    char buf[1024];
    ssize_t bytes;
    int max;
    FD_ZERO(&rdfds);
    FD_SET(low_fd < 0 ? low_listener : low_fd, &rdfds);
    FD_SET(high_fd < 0 ? high_listener : high_fd, &rdfds);
    FD_SET(serial_fd, &rdfds);
    max = ((low_fd) < (low_listener) ? (low_listener) : (low_fd));
    max = ((max) < (high_fd) ? (high_fd) : (max));
    max = ((max) < (high_listener) ? (high_listener) : (max));
    max = ((max) < (serial_fd) ? (serial_fd) : (max));
    if (select(max + 1, &rdfds, NULL, NULL, NULL) < 0) {
      perror("select");
      continue;
    }
    if (FD_ISSET(low_listener, &rdfds)) {
      assert(low_fd < 0);
      low_fd = accept_conn(low_listener);
    }
    if (FD_ISSET(high_listener, &rdfds)) {
      assert(high_fd < 0);
      high_fd = accept_conn(high_listener);
    }
    if (low_poll || (low_fd >= 0 && FD_ISSET(low_fd, &rdfds))) {
      if ((bytes = receive_data(&low_fd, &buf[0], sizeof(buf), &low_poll)) > 0) {
        clear_high_bit(&buf[0], bytes);
        if (write(serial_fd, &buf[0], bytes) < 0)
          perror("write");
      }
    }
    if (high_poll || (high_fd >= 0 && FD_ISSET(high_fd, &rdfds))) {
      if ((bytes = receive_data(&high_fd, &buf[0], sizeof(buf), &high_poll)) > 0) {
        set_high_bit(&buf[0], bytes);
        if (write(serial_fd, &buf[0], bytes) < 0)
          perror("write");
      }
    }
    if (serial_poll || FD_ISSET(serial_fd, &rdfds)) {
      if ((bytes = receive_data(&serial_fd, &buf[0], sizeof(buf), &serial_poll)) > 0) {
        ssize_t i;
        for (i = 0; i < bytes; ++i) {
          if (buf[i] & 0x80) {
            if (high_fd >= 0) {
              buf[i] &= 0x7f;
              if ((write(high_fd, &buf[i], 1)) < 0) {
                perror("write");
                close_conn(&high_fd);
                high_poll = 0;
              }
            }
          } else {
            if (low_fd >= 0) {
              if ((write(low_fd, &buf[i], 1)) < 0) {
                perror("write");
                close_conn(&low_fd);
                low_poll = 0;
              }
            }
          }
        }
      }
    }
  }
}
```