user: What would the C source look like for the assembly code provided here:

```asm
<_remove_trailing_whitespace>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x40,%rsp
  mov    %rdi,-0x2038(%rbp)
  mov    %esi,-0x203c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x2038(%rbp)
  jne    L30
  lea    -0x2010(%rbp),%rax
  mov    $0x2000,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    -0x2010(%rbp),%rax
  mov    $0xa6,%r9d
  lea    D29(%rip),%r8
  lea    D31(%rip),%rdx
  mov    %rdx,%rcx
  lea    D35(%rip),%rdx
  mov    $0x2000,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  mov    %eax,-0x2024(%rbp)
  cmpl   $0x1fff,-0x2024(%rbp)
  jg     L4
  lea    D23(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <_debug_msg_create@plt>
  cltq
  mov    %rax,-0x2018(%rbp)
  cmpq   $0x0,-0x2018(%rbp)
  je     L4
  mov    $0x1fff,%eax
  sub    -0x2024(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x2018(%rbp),%rcx
  lea    -0x2010(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
  mov    -0x2018(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    -0x2024(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x2024(%rbp)
  mov    -0x2018(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L4:
  lea    -0x2010(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <err_debug@plt>
  mov    $0xffffffff,%eax
  jmp    L44
L30:
  mov    -0x203c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x2038(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x2020(%rbp)
  subq   $0x1,-0x2020(%rbp)
  jmp    L23
L55:
  mov    -0x2020(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %eax,%eax
  je     L5
  mov    -0x2020(%rbp),%rax
  movb   $0x0,(%rax)
  subl   $0x1,-0x203c(%rbp)
  subq   $0x1,-0x2020(%rbp)
L23:
  mov    -0x2020(%rbp),%rax
  cmp    -0x2038(%rbp),%rax
  jae    L55
  jmp    L79
L5:
  nop
L79:
  mov    -0x203c(%rbp),%eax
L44:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L75
  call   <__stack_chk_fail@plt>
L75:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D29
data_type: string
name: disassemble_data
arguments: tag: D31
data_type: string
name: disassemble_data
arguments: tag: D35
data_type: string
name: disassemble_data
arguments: tag: D23
data_type: string

tool: D29: _remove_trailing_whitespace

tool: D31: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/chaos/whatsup/refs/heads/master/src/pingd/pingd_clusterlist_hostsfile.c

tool: D35: (%s, %s, %d): 

tool: D23: invalid parameters

assistant: ```c
int _remove_trailing_whitespace(char *buf, int buflen) {
  char *temp;
  if (!buf) {
    do {
      char __err[8192];
      int __len;
      memset(__err, '\0', 8192);
      __len = snprintf(__err, 8192, "(%s, %s, %d): ", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/chaos/whatsup/refs/heads/master/src/pingd/pingd_clusterlist_hostsfile.c", __FUNCTION__, 166);
      if (__len < 8192) {
        char *__str;
        if ((__str = _debug_msg_create("invalid parameters"))) {
          strncat(__err, __str, 8192 - __len - 1);
          __len += strlen(__str);
          free(__str);
        }
      }
      err_debug(__err);
    } while (0);
    return -1;
  }
  temp = buf + buflen;
  for (--temp; temp >= buf; temp--) {
    if (isspace(*temp))
      *temp = '\0';
    else
      break;
    buflen--;
  }
  return buflen;
}
```