user: 请将以下的汇编代码转换成C语言代码:

```asm
<headsf>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,%ebp
  mov    %rsi,%rdx
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    $0x1,%ecx
  lea    D86(%rip),%rsi
  call   <sendRequest@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jg     L78
L156:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L89
  mov    %ebx,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L78:
  movq   $0x0,(%rsp)
  mov    %rsp,%rsi
  mov    $0x3a,%edx
  mov    %ebp,%edi
  call   <readField@plt>
  test   %eax,%eax
  jle    L141
  mov    (%rsp),%rsi
  lea    D7(%rip),%rdi
  call   <strcmpi@plt>
  test   %rax,%rax
  je     L1
L141:
  mov    (%rsp),%rdi
  call   <free@plt>
  mov    %rsp,%rsi
  mov    $0x3a,%edx
  mov    %ebp,%edi
  call   <readField@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jg     L26
L155:
  mov    (%rsp),%rdi
  call   <free@plt>
L53:
  test   %ebx,%ebx
  mov    $0xfffffffd,%eax
  cmovs  %eax,%ebx
  jmp    L156
L1:
  movq   $0x0,0x8(%rsp)
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x20(%rsp)
  mov    (%rsp),%rdi
  call   <free@plt>
  mov    %rsp,%rsi
  mov    $0x3a,%edx
  mov    %ebp,%edi
  call   <readField@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L53
  mov    $0xa,%edx
  mov    $0x0,%esi
  mov    (%rsp),%rdi
  call   <strtol@plt>
  mov    %eax,%r13d
  mov    (%rsp),%rdi
  call   <free@plt>
  lea    D62(%rip),%r8
  lea    D67(%rip),%rcx
  lea    D10(%rip),%rdx
  lea    D105(%rip),%rsi
  lea    D65(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D95(%rip),%rdi
  call   <puts@plt>
  lea    -0x1(%r13),%r12d
  test   %r13d,%r13d
  je     L88
  lea    D65(%rip),%r13
  jmp    L82
L101:
  lea    0x10(%rsp),%rsi
  mov    $0x3a,%edx
  mov    %ebp,%edi
  call   <readField@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L88
  lea    0x20(%rsp),%rsi
  mov    $0x3a,%edx
  mov    %ebp,%edi
  call   <readField@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L88
  lea    0x18(%rsp),%rsi
  mov    $0x3a,%edx
  mov    %ebp,%edi
  call   <readField@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L88
  mov    0x18(%rsp),%r8
  mov    0x20(%rsp),%rcx
  mov    0x10(%rsp),%rdx
  mov    0x8(%rsp),%rsi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  lea    -0x1(%r12),%eax
  test   %r12d,%r12d
  je     L88
  mov    %eax,%r12d
L82:
  lea    0x8(%rsp),%rsi
  mov    $0x3a,%edx
  mov    %ebp,%edi
  call   <readField@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jg     L101
L88:
  lea    D23(%rip),%rdi
  call   <puts@plt>
  jmp    L53
L26:
  mov    (%rsp),%rsi
  lea    D16(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L155
L89:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D86
type: string
name: retrieve_data
arguments: data_label: D7
type: string
name: retrieve_data
arguments: data_label: D62
type: string
name: retrieve_data
arguments: data_label: D67
type: string
name: retrieve_data
arguments: data_label: D10
type: string
name: retrieve_data
arguments: data_label: D105
type: string
name: retrieve_data
arguments: data_label: D65
type: string
name: retrieve_data
arguments: data_label: D95
type: string
name: retrieve_data
arguments: data_label: D23
type: string
name: retrieve_data
arguments: data_label: D16
type: string

tool: D86: HEADS

tool: D7: OK

tool: D62: SUBJECT

tool: D67: DATE

tool: D10: FROM

tool: D105: ID

tool: D65: %-3s	%-15s	%-20s	%s	


tool: D95: --------------------------------------------------------------------------------

tool: 

tool: D16: -%s


assistant: ```c
int headsf(int sd, char argv[]) {
  int status = sendRequest(sd, "HEADS", argv, 1);
  if (status > 0) {
    char *buf = NULL;
    if ((status = readField(sd, &buf, ':')) > 0 && strcmpi("OK", buf) == 0) {
      char *id = NULL;
      char *from = NULL;
      char *subject = NULL;
      char *date = NULL;
      int n;
      free(buf);
      if ((status = readField(sd, &buf, ':')) > 0) {
        n = strtol(buf, NULL, 10);
        free(buf);
        printf("%-3s\t%-15s\t%-20s\t%s\t\n", "ID", "FROM", "DATE", "SUBJECT");
        puts("--------------------------------------------------------------------------------");
        while (n-- && status > 0) {
          if ((status = readField(sd, &id, ':')) > 0 && (status = readField(sd, &from, ':')) > 0 && (status = readField(sd, &date, ':')) > 0 && (status = readField(sd, &subject, ':')) > 0) {
            printf("%-3s\t%-15s\t%-20s\t%s\t\n", id, from, date, subject);
            free(id);
            free(from);
            free(date);
            free(subject);
          }
        }
        puts("");
      }
    } else {
      free(buf);
      if ((status = readField(sd, &buf, ':')) > 0) {
        printf("-%s\n", buf);
      }
      free(buf);
    }
    if (status < 0)
      status = -3;
  }
  return status;
}
```