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

```asm
<read_compressed_array>:
  endbr64
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  push   %r13
  mov    %rdx,%r13
  mov    %rsi,%rdx
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  mov    $0xa,%esi
  push   %rbx
  mov    %edi,%ebx
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  lea    0x3e(%rsp),%r12
  mov    %r12,%rdi
  call   <IO_Read_Str@plt>
  test   %eax,%eax
  jne    L244
L63:
  xor    %eax,%eax
L195:
  mov    0x48(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L261
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L244:
  mov    %r12,%rdi
  call   <ConvertFromIeeeExtended@plt>
  mov    %rbp,%rdx
  mov    $0xa,%esi
  mov    %r12,%rdi
  movsd  %xmm0,0x18(%rsp)
  call   <IO_Read_Str@plt>
  test   %eax,%eax
  je     L63
  mov    %r12,%rdi
  call   <ConvertFromIeeeExtended@plt>
  lea    -0x1(%r15),%eax
  cltd
  mov    %eax,0x20(%rsp)
  idiv   %ebx
  movsd  %xmm0,0x8(%rsp)
  mov    %eax,0x28(%rsp)
  cmp    $0x7,%eax
  jg     L241
  xor    %r14d,%r14d
  xor    %r8d,%r8d
  lea    0x3c(%rsp),%r12
  test   %r15d,%r15d
  jle    L249
  nopl   0x0(%rax)
L98:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    %r8d,0x10(%rsp)
  call   <vlq_read_short@plt>
  test   %eax,%eax
  je     L195
  add    0x3c(%rsp),%r14w
  pxor   %xmm0,%xmm0
  mov    0x10(%rsp),%r8d
  movswl %r14w,%eax
  cvtsi2sd %eax,%xmm0
  mulsd  0x8(%rsp),%xmm0
  divsd  D37(%rip),%xmm0
  cmp    %r8d,%r15d
  jle    L181
  test   %ebx,%ebx
  lea    0x1(%r8),%edx
  setg   %cl
  movslq %edx,%rdx
  xor    %eax,%eax
  test   %cl,%cl
  je     L181
  nopl   0x0(%rax)
L200:
  add    $0x1,%eax
  movsd  %xmm0,-0x8(%r13,%rdx,8)
  cmp    %eax,%ebx
  setg   %sil
  cmp    %edx,%r15d
  setg   %cl
  add    $0x1,%rdx
  test   %cl,%sil
  jne    L200
L181:
  lea    (%rbx,%r8,1),%eax
  cmp    %eax,%r15d
  jle    L161
  mov    %eax,%r8d
  jmp    L98
L241:
  mov    0x28(%rsp),%eax
  add    $0x1,%eax
  lea    0x0(,%rax,8),%edi
  mov    %eax,0x2c(%rsp)
  call   <malloc@plt>
  mov    %rax,0x20(%rsp)
  test   %r15d,%r15d
  jle    L230
  xor    %r14d,%r14d
  xor    %r11d,%r11d
  lea    0x3c(%rsp),%r12
  jmp    L185
  xchg   %ax,%ax
L178:
  mov    %eax,%r11d
L185:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    %r11d,0x10(%rsp)
  call   <vlq_read_short@plt>
  test   %eax,%eax
  je     L195
  mov    0x10(%rsp),%r11d
  add    0x3c(%rsp),%r14w
  pxor   %xmm0,%xmm0
  mov    0x20(%rsp),%rdi
  mov    %r11d,%eax
  cltd
  idiv   %ebx
  movswl %r14w,%edx
  cvtsi2sd %edx,%xmm0
  mulsd  0x8(%rsp),%xmm0
  divsd  D37(%rip),%xmm0
  addsd  0x18(%rsp),%xmm0
  cltq
  movsd  %xmm0,(%rdi,%rax,8)
  lea    (%rbx,%r11,1),%eax
  cmp    %eax,%r15d
  jg     L178
L64:
  mov    0x28(%rsp),%eax
  mov    0x2c(%rsp),%ecx
  mov    %r13,%rdi
  mov    %r11d,0x10(%rsp)
  mov    0x20(%rsp),%rdx
  imul   %ebx,%eax
  lea    0x1(%rax),%esi
  call   <filter_interp8@plt>
  movslq 0x10(%rsp),%r11
  lea    0x1(%r11),%eax
  cmp    %eax,%r15d
  jle    L62
  cltq
  lea    0x3c(%rsp),%r12
  lea    0x0(%r13,%rax,8),%rdx
  lea    -0x2(%r15),%eax
  sub    %r11d,%eax
  add    %r11,%rax
  lea    0x10(%r13,%rax,8),%rbx
  nopw   0x0(%rax,%rax,1)
L193:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    %rdx,0x10(%rsp)
  call   <vlq_read_short@plt>
  test   %eax,%eax
  je     L195
  add    0x3c(%rsp),%r14w
  pxor   %xmm0,%xmm0
  mov    0x10(%rsp),%rdx
  movswl %r14w,%eax
  cvtsi2sd %eax,%xmm0
  mulsd  0x8(%rsp),%xmm0
  add    $0x8,%rdx
  divsd  D37(%rip),%xmm0
  addsd  0x18(%rsp),%xmm0
  movsd  %xmm0,-0x8(%rdx)
  cmp    %rbx,%rdx
  jne    L193
L62:
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  test   %r15d,%r15d
  jle    L281
L84:
  xor    %eax,%eax
  pxor   %xmm0,%xmm0
  cs nopw 0x0(%rax,%rax,1)
L246:
  comisd 0x0(%r13,%rax,8),%xmm0
  jbe    L60
  movq   $0x0,0x0(%r13,%rax,8)
L60:
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L246
L281:
  mov    $0x1,%eax
  jmp    L195
L249:
  neg    %ebx
  mov    %ebx,%r8d
L161:
  lea    0x1(%r8),%eax
  cmp    %eax,%r15d
  jle    L204
  cltq
  movslq %r8d,%rdx
  lea    0x3c(%rsp),%r12
  lea    0x0(%r13,%rax,8),%rbx
  lea    -0x2(%r15),%eax
  sub    %r8d,%eax
  add    %rdx,%rax
  lea    0x10(%r13,%rax,8),%rax
  mov    %rax,0x10(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L257:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <vlq_read_short@plt>
  test   %eax,%eax
  je     L195
  add    0x3c(%rsp),%r14w
  pxor   %xmm0,%xmm0
  add    $0x8,%rbx
  movswl %r14w,%eax
  cvtsi2sd %eax,%xmm0
  mulsd  0x8(%rsp),%xmm0
  divsd  D37(%rip),%xmm0
  movsd  %xmm0,-0x8(%rbx)
  cmp    0x10(%rsp),%rbx
  jne    L257
L204:
  mov    %r15d,%esi
  mov    %r13,%rdi
  call   <filter_reduce8@plt>
  test   %r15d,%r15d
  jle    L281
  mov    0x20(%rsp),%edx
  mov    %r13,%rax
  lea    0x8(%r13,%rdx,8),%rdx
  nopl   0x0(%rax,%rax,1)
L188:
  movsd  0x18(%rsp),%xmm0
  addsd  (%rax),%xmm0
  add    $0x8,%rax
  movsd  %xmm0,-0x8(%rax)
  cmp    %rdx,%rax
  jne    L188
  jmp    L84
L230:
  mov    %ebx,%r11d
  xor    %r14d,%r14d
  neg    %r11d
  jmp    L64
L261:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D37
data_type: f64

tool: D37: 16383

assistant: ```c
int read_compressed_array(int ratio, FILE *fp, double *v, int n) {
  int i;
  char data[10];
  double base;
  double delta;
  short previous = 0;
  if (!IO_Read_Str(data, 10, fp))
    return 0;
  base = ConvertFromIeeeExtended(data);
  if (!IO_Read_Str(data, 10, fp))
    return 0;
  delta = ConvertFromIeeeExtended(data);
  if ((1 + (n - 1) / ratio) >= (2 * 4 + 1)) {
    double *sv;
    sv = ((double *)malloc((1 + (n - 1) / ratio) * sizeof(double)));
    for (i = 0; i < n; i += ratio) {
      short s;
      if (!vlq_read_short(fp, &s))
        return 0;
      s += previous;
      previous = s;
      sv[i / ratio] = base + (s * delta) / 16383.0;
    }
    filter_interp8(v, ((n - 1) / ratio) * ratio + 1, sv, 1 + (n - 1) / ratio);
    for (i = i - ratio + 1; i < n; i++) {
      short s;
      if (!vlq_read_short(fp, &s))
        return 0;
      s += previous;
      previous = s;
      v[i] = base + (s * delta) / 16383.0;
    }
    free(sv);
  } else {
    for (i = 0; i < n; i += ratio) {
      int j;
      short s;
      double value;
      if (!vlq_read_short(fp, &s))
        return 0;
      s += previous;
      previous = s;
      value = (s * delta) / 16383.0;
      for (j = 0; (((i + j) < n) && (j < ratio)); j++)
        v[i + j] = value;
    }
    for (i = i - ratio + 1; i < n; i++) {
      short s;
      if (!vlq_read_short(fp, &s))
        return 0;
      s += previous;
      previous = s;
      v[i] = (s * delta) / 16383.0;
    }
    filter_reduce8(v, n);
    for (i = 0; i < n; i++)
      v[i] += base;
  }
  for (i = 0; i < n; i++)
    if (v[i] < 0)
      v[i] = 0;
  return 1;
}
```