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

```asm
<readmessage>:
  endbr64
  push   %r15
  lea    D24(%rip),%r15
  push   %r14
  lea    D33(%rip),%r14
  push   %r13
  mov    %rdi,%r13
  mov    $0x1000,%edi
  push   %r12
  mov    $0x1000,%r12d
  push   %rbp
  push   %rbx
  sub    $0x428,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x418(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rbx
  call   <malloc@plt>
  movb   $0x0,(%rax)
  mov    %rax,%rbp
  nopl   0x0(%rax)
L149:
  mov    %r13,%rdx
  mov    $0x400,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L133
  mov    %r14,%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L116
  cmp    $0x4,%r12d
  jle    L77
L74:
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  jmp    L149
L116:
  mov    %rbx,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  je     L41
  lea    -0x1(%rax),%edx
  movslq %edx,%rdx
  cmpb   $0xa,0x10(%rsp,%rdx,1)
  je     L5
L41:
  cmp    %eax,%r12d
  jle    L17
L98:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  jmp    L149
  nop
L77:
  add    $0x1000,%r12d
  mov    %rbp,%rdi
  mov    %r12d,%esi
  call   <realloc@plt>
  mov    %rax,%rbp
  jmp    L74
  nopw   0x0(%rax,%rax,1)
L133:
  cmp    $0x3,%r12d
  jle    L90
L36:
  mov    %rbp,%rdi
  lea    D18(%rip),%rsi
  call   <strcat@plt>
  mov    %r13,%rdi
  call   <rewind@plt>
  mov    0x418(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L68
  add    $0x428,%rsp
  mov    %rbp,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L17:
  add    $0x1000,%r12d
  mov    %rbp,%rdi
  mov    %r12d,%esi
  call   <realloc@plt>
  mov    %rax,%rbp
  jmp    L98
  nopw   0x0(%rax,%rax,1)
L5:
  lea    -0x1(%r12),%ecx
  cmp    %eax,%ecx
  jle    L87
L6:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  movb   $0x0,0x10(%rsp,%rdx,1)
  call   <strcat@plt>
  lea    D34(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  jmp    L149
  nopl   (%rax)
L90:
  mov    %rbp,%rdi
  lea    0x1000(%r12),%esi
  call   <realloc@plt>
  mov    %rax,%rbp
  jmp    L36
  nopl   0x0(%rax,%rax,1)
L87:
  add    $0x1000,%r12d
  mov    %rbp,%rdi
  mov    %rdx,0x8(%rsp)
  mov    %r12d,%esi
  call   <realloc@plt>
  mov    0x8(%rsp),%rdx
  mov    %rax,%rbp
  jmp    L6
L68:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D24
type_infered: string
name: disassemble_data
arguments: data_label: D33
type_infered: string
name: disassemble_data
arguments: data_label: D18
type_infered: string
name: disassemble_data
arguments: data_label: D34
type_infered: string

tool: D24: ..


tool: D33: .


tool: D18: .


tool: D34: 


assistant: ```c
char *readmessage(FILE *file) {
  char *buffer = malloc(4096);
  ssize_t bufsize = 4096, used = 0;
  char linebuf[1024];
  int i;
  buffer[0] = '\0';
  while (fgets(linebuf, sizeof(linebuf), file)) {
    if (strcmp(linebuf, ".\n") == 0) {
      do {
        if (used + 4 > bufsize - 1) {
          buffer = realloc(buffer, bufsize += 4096);
        }
      } while (0);
      strcat(buffer, "..\r\n");
    } else {
      i = strlen(linebuf);
      if (i && linebuf[i - 1] == '\n') {
        do {
          if (used + i + 1 > bufsize - 1) {
            buffer = realloc(buffer, bufsize += 4096);
          }
        } while (0);
        linebuf[i - 1] = '\0';
        strcat(buffer, linebuf);
        strcat(buffer, "\r\n");
      } else {
        do {
          if (used + i > bufsize - 1) {
            buffer = realloc(buffer, bufsize += 4096);
          }
        } while (0);
        strcat(buffer, linebuf);
      }
    }
  }
  do {
    if (used + 3 > bufsize - 1) {
      buffer = realloc(buffer, bufsize += 4096);
    }
  } while (0);
  strcat(buffer, ".\r\n");
  rewind(file);
  return buffer;
}
```