user: 下面的汇编指令对应的C源代码是什么:

```asm
<write_elements_to_socket>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %rdx,-0x30(%rbp)
  cmpl   $0x1770,-0x28(%rbp)
  jg     L15
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x28(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write_double_array_to_socket@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jns    L35
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <error@plt>
  jmp    L35
L15:
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x57619f1,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x7,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x57619f1,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x7,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x1770,%edx,%edx
  sub    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%edx
  mov    -0x14(%rbp),%eax
  mov    %eax,%esi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L40
L72:
  mov    $0xbb80,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L42
L65:
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x20(%rbp)
L42:
  cmpl   $0x176f,-0x20(%rbp)
  jle    L65
  mov    -0x8(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    $0xbb80,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write_double_array_to_socket@plt>
  mov    %eax,-0xc(%rbp)
  mov    $0x0,%eax
  call   <sleep_funct2@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  addl   $0x1,-0x18(%rbp)
L40:
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L72
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L63
L33:
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x20(%rbp)
L63:
  mov    -0x20(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jl     L33
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write_double_array_to_socket@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L35:
  nop
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D10
type: string
name: disassemble_data
arguments: label: D13
type: string
name: disassemble_data
arguments: label: D0
type: string

tool: D10: transfer all at once..

tool: D13: ERROR writing to socket

tool: D0: server: nchunks = %d and nleftover = %d


assistant: ```c
void write_elements_to_socket(int sockfd, int nelements, double *elements_all) {
  int i, ind, nlen, nchunks, nleftover, chunk_num;
  double *elements_local;
  if (nelements <= 6000) {
    printf("transfer all at once..\n");
    nlen = write_double_array_to_socket(sockfd, elements_all, nelements * sizeof(double));
    if (nlen < 0)
      error("ERROR writing to socket");
  } else {
    nchunks = nelements / 6000;
    nleftover = nelements % 6000;
    printf("server: nchunks = %d and nleftover = %d\n", nchunks, nleftover);
    ind = 0;
    for (chunk_num = 0; chunk_num < nchunks; chunk_num++) {
      elements_local = (double *)malloc(6000 * sizeof(double));
      for (i = 0; i < 6000; i++) {
        elements_local[i] = elements_all[ind++];
      }
      nlen = write_double_array_to_socket(sockfd, elements_local, 6000 * sizeof(double));
      sleep_funct2();
      free(elements_local);
    }
    elements_local = (double *)malloc(nleftover * sizeof(double));
    for (i = 0; i < nleftover; i++) {
      elements_local[i] = elements_all[ind++];
    }
    nlen = write_double_array_to_socket(sockfd, elements_local, nleftover * sizeof(double));
    free(elements_local);
  }
}
```