user: Please show me the C implementation that matches the assembly code listed below:

```asm
<do_it>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L23
L29:
  mov    -0x2c(%rbp),%eax
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <lseek@plt>
  test   %rax,%rax
  jns    L43
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L43:
  mov    -0x30(%rbp),%edx
  mov    -0x28(%rbp),%rcx
  mov    -0x2c(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  cmp    %eax,-0x30(%rbp)
  jbe    L21
  lea    D31(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L21:
  mov    -0x2c(%rbp),%eax
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <lseek@plt>
  test   %rax,%rax
  jns    L51
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L51:
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L80
L73:
  mov    -0x14(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  add    %eax,-0x18(%rbp)
L80:
  mov    -0x30(%rbp),%eax
  sub    -0x18(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x2c(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jg     L73
  mov    -0x18(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  jae    L83
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L83:
  mov    -0x30(%rbp),%edx
  mov    -0x28(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  je     L72
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L72:
  addl   $0x1,-0x1c(%rbp)
L23:
  cmpl   $0x3e7,-0x1c(%rbp)
  jle    L29
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D13
datatype: string
name: disassemble_data
arguments: data_label: D31
datatype: string
name: disassemble_data
arguments: data_label: D25
datatype: string
name: disassemble_data
arguments: data_label: D2
datatype: string

tool: D13: lseek

tool: D31: write

tool: D25: read

tool: D2: Data Mismatch


assistant: ```c
void do_it(int data[], int fd, unsigned len) {
  char *buf = (char *)malloc(len), *ptr;
  int i, bytes_read;
  unsigned count;
  for (i = 0; i < 1000; i++) {
    if (lseek(fd, 0, 0) < 0) {
      perror("lseek");
      exit(1);
    }
    if (write(fd, data, len) < len) {
      perror("write");
      exit(1);
    }
    if (lseek(fd, 0, 0) < 0) {
      perror("lseek");
      exit(1);
    }
    ptr = buf;
    count = 0;
    while ((bytes_read = read(fd, ptr, len - count)) > 0) {
      ptr += bytes_read;
      count += bytes_read;
    }
    if (count < len) {
      perror("read");
      exit(1);
    }
    if (memcmp(buf, data, len) != 0) {
      printf("Data Mismatch\n");
      exit(1);
    }
  }
  free(buf);
}
```