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

```asm
<canal_a_valores_t>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  mov    %rcx,-0x38(%rbp)
  mov    %r8,-0x40(%rbp)
  mov    %r9,-0x48(%rbp)
  mov    -0x30(%rbp),%edx
  mov    -0x2c(%rbp),%ecx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <generar_histograma@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L10
L29:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  imul   -0x20(%rbp),%eax
  add    %eax,-0x1c(%rbp)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,-0x18(%rbp)
  addl   $0x1,-0x20(%rbp)
L10:
  cmpl   $0xff,-0x20(%rbp)
  jle    L29
  mov    -0x1c(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L4
L21:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  imul   -0x20(%rbp),%eax
  add    %eax,-0x1c(%rbp)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,-0x18(%rbp)
  addl   $0x1,-0x20(%rbp)
L4:
  mov    -0x20(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L21
  mov    -0x1c(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    %eax,-0x10(%rbp)
  movl   $0x0,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  jmp    L51
L47:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  imul   -0x20(%rbp),%eax
  add    %eax,-0x1c(%rbp)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,-0x18(%rbp)
  addl   $0x1,-0x20(%rbp)
L51:
  cmpl   $0xff,-0x20(%rbp)
  jle    L47
  mov    -0x1c(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x10(%rbp),%xmm0
  movsd  D9(%rip),%xmm1
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  mov    -0x38(%rbp),%rax
  movss  %xmm0,(%rax)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x14(%rbp),%xmm0
  movsd  D9(%rip),%xmm1
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  mov    -0x40(%rbp),%rax
  movss  %xmm0,(%rax)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0xc(%rbp),%xmm0
  movsd  D9(%rip),%xmm1
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  mov    -0x48(%rbp),%rax
  movss  %xmm0,(%rax)
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D9
type: f64

tool: D9: 255

assistant: ```c
void canal_a_valores_t(unsigned char *canal, int w, int h, float *t0, float *t1, float *t2) {
  int i, a, b;
  int t0_tmp, t1_tmp, t2_tmp;
  int *histograma = generar_histograma(canal, w, h);
  a = b = 0;
  for (i = 0; i < 256; i++) {
    a = a + i * histograma[i];
    b = b + histograma[i];
  }
  t1_tmp = a / b;
  a = b = 0;
  for (i = 0; i < t1_tmp; i++) {
    a = a + i * histograma[i];
    b = b + histograma[i];
  }
  t0_tmp = a / b;
  a = b = 0;
  for (i = t1_tmp; i < 256; i++) {
    a = a + i * histograma[i];
    b = b + histograma[i];
  }
  t2_tmp = a / b;
  free(histograma);
  *t0 = t0_tmp / 255.0;
  *t1 = t1_tmp / 255.0;
  *t2 = t2_tmp / 255.0;
}
```