user: What is the c source code of the assembly code below:

```asm
<socket_recv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  test   %rsi,%rsi
  je     L27
  mov    %edi,%ebp
  mov    $0x401,%edi
  mov    %rsi,%rbx
  mov    %edx,%r12d
  call   <malloc@plt>
  xor    %r14d,%r14d
  mov    %rax,(%rbx)
  mov    %rax,%rdi
  jmp    L16
  nopl   0x0(%rax,%rax,1)
L35:
  mov    (%rbx),%rdi
  test   %r13d,%r13d
  jle    L4
  lea    0x401(%r13),%esi
  call   <realloc@plt>
  mov    %rax,(%rbx)
  mov    %rax,%rdi
L4:
  mov    0xc(%rsp),%r14d
L16:
  movslq %r13d,%rax
  mov    %r12d,%ecx
  mov    $0x400,%edx
  lea    (%rdi,%rax,1),%rsi
  mov    %ebp,%edi
  call   <recv@plt>
  mov    %r14d,%esi
  lea    D39(%rip),%rdi
  mov    %eax,%r15d
  lea    0x1(%r14),%eax
  mov    %eax,0xc(%rsp)
  mov    %r15d,%edx
  xor    %eax,%eax
  add    %r15d,%r13d
  call   <printf@plt>
  mov    %r13d,%edx
  mov    %r15d,%esi
  xor    %eax,%eax
  lea    D12(%rip),%rdi
  call   <printf@plt>
  mov    (%rbx),%r14
  mov    %r14,%rdi
  call   <strlen@plt>
  mov    %r14,%rdx
  lea    D29(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  cmp    $0x3ff,%r15d
  jg     L35
  lea    0x1(%r13),%edi
  call   <malloc@plt>
  mov    (%rbx),%rsi
  mov    %r13d,%edx
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <strncpy@plt>
  movslq %r13d,%rax
  mov    %r13d,%esi
  lea    D20(%rip),%rdi
  movb   $0x0,(%r12,%rax,1)
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r12,%rdx
  lea    D6(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
L27:
  add    $0x18,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: tag: D39
data_type: string
name: parse_data
arguments: tag: D12
data_type: string
name: parse_data
arguments: tag: D29
data_type: string
name: parse_data
arguments: tag: D20
data_type: string
name: parse_data
arguments: tag: D6
data_type: string

tool: D39: socket_recv iteration #%d, nread = %zd


tool: D12: Read %ld bytes from socket.
Total bytes read so far: %ld.


tool: D29: socket_recv buffer (%lu): %s




tool: D20: End of socket_recv iteration, total_read_size = %ld


tool: D6: socket_recv string output result (%lu): %s




assistant: ```c
ssize_t socket_recv(int sockfd, char **buffer, int flag) {
  if (!buffer) {
    return 0;
  }
  ssize_t total_read_size = 0;
  ssize_t nread = 0;
  ssize_t buffer_default_size = 1024 * sizeof(char);
  *buffer = (char *)malloc(buffer_default_size + sizeof(char));
  int iteration = 0;
  while (nread >= 0) {
    if (total_read_size > 0) {
      *buffer = (char *)realloc(*buffer, total_read_size + buffer_default_size + sizeof(char));
    }
    nread = recv(sockfd, *buffer + total_read_size, 1024, flag);
    if (1)
      printf("socket_recv iteration #%d, nread = %zd\n", iteration++, nread);
    total_read_size += nread;
    if (1)
      printf("Read %ld bytes from socket.\nTotal bytes read so far: %ld.\n", nread, total_read_size);
    if (1)
      printf("socket_recv buffer (%lu): %s\n\n\n", strlen(*buffer), *buffer);
    if (nread < 1024) {
      break;
    }
  }
  char *str_result = (char *)malloc(total_read_size + sizeof(char));
  strncpy(str_result, *buffer, total_read_size);
  str_result[total_read_size] = '\0';
  if (1)
    printf("End of socket_recv iteration, total_read_size = %ld\n", total_read_size);
  if (1)
    printf("socket_recv string output result (%lu): %s\n\n\n", strlen(str_result), str_result);
  return total_read_size;
}
```