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

```asm
<canal_a_valores_t>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %r8,%r12
  push   %rbp
  mov    %r9,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <generar_histograma@plt>
  movdqa D23(%rip),%xmm7
  pxor   %xmm4,%xmm4
  movdqa D21(%rip),%xmm6
  mov    %rax,%rdi
  mov    %rax,%rsi
  lea    0x400(%rax),%rdx
  movdqa %xmm4,%xmm5
  movdqa %xmm7,%xmm3
  nopl   0x0(%rax)
L173:
  movdqu (%rax),%xmm2
  movdqa %xmm3,%xmm0
  add    $0x10,%rax
  paddd  %xmm6,%xmm3
  movdqa %xmm0,%xmm1
  psrlq  $0x20,%xmm0
  movdqa %xmm2,%xmm8
  pmuludq %xmm2,%xmm1
  paddd  %xmm2,%xmm4
  psrlq  $0x20,%xmm8
  pmuludq %xmm8,%xmm0
  pshufd $0x8,%xmm1,%xmm1
  pshufd $0x8,%xmm0,%xmm0
  punpckldq %xmm0,%xmm1
  paddd  %xmm1,%xmm5
  cmp    %rdx,%rax
  jne    L173
  movdqa %xmm4,%xmm0
  psrldq $0x8,%xmm0
  paddd  %xmm0,%xmm4
  movdqa %xmm5,%xmm0
  psrldq $0x8,%xmm0
  paddd  %xmm0,%xmm5
  movdqa %xmm5,%xmm0
  psrldq $0x4,%xmm0
  paddd  %xmm0,%xmm5
  movdqa %xmm4,%xmm0
  psrldq $0x4,%xmm0
  movd   %xmm5,%eax
  paddd  %xmm0,%xmm4
  cltd
  movd   %xmm4,%ecx
  idiv   %ecx
  mov    %eax,%ebx
  test   %eax,%eax
  jle    1080 <canal_a_valores_t.cold>
  lea    -0x1(%rax),%eax
  cmp    $0x4,%eax
  jbe    L136
  mov    %ebx,%eax
  pxor   %xmm4,%xmm4
  movdqa %xmm7,%xmm5
  shr    $0x2,%eax
  movdqa %xmm4,%xmm3
  sub    $0x1,%eax
  shl    $0x4,%rax
  lea    0x10(%rdi,%rax,1),%rax
  nopw   0x0(%rax,%rax,1)
L143:
  movdqu (%rsi),%xmm2
  movdqa %xmm5,%xmm0
  add    $0x10,%rsi
  paddd  %xmm6,%xmm5
  movdqa %xmm0,%xmm1
  psrlq  $0x20,%xmm0
  movdqa %xmm2,%xmm8
  pmuludq %xmm2,%xmm1
  paddd  %xmm2,%xmm4
  psrlq  $0x20,%xmm8
  pmuludq %xmm8,%xmm0
  pshufd $0x8,%xmm1,%xmm1
  pshufd $0x8,%xmm0,%xmm0
  punpckldq %xmm0,%xmm1
  paddd  %xmm1,%xmm3
  cmp    %rax,%rsi
  jne    L143
  movdqa %xmm4,%xmm0
  mov    %ebx,%edx
  psrldq $0x8,%xmm0
  and    $0xfffffffc,%edx
  paddd  %xmm0,%xmm4
  movdqa %xmm4,%xmm0
  psrldq $0x4,%xmm0
  paddd  %xmm0,%xmm4
  movdqa %xmm3,%xmm0
  psrldq $0x8,%xmm0
  movd   %xmm4,%ecx
  paddd  %xmm0,%xmm3
  movdqa %xmm3,%xmm0
  psrldq $0x4,%xmm0
  paddd  %xmm0,%xmm3
  movd   %xmm3,%eax
  test   $0x3,%bl
  je     L95
L55:
  movslq %edx,%rsi
  mov    %edx,%r9d
  lea    0x0(,%rsi,4),%r8
  mov    (%rdi,%rsi,4),%esi
  imul   %esi,%r9d
  add    %esi,%ecx
  lea    0x1(%rdx),%esi
  add    %r9d,%eax
  cmp    %esi,%ebx
  jle    L95
  mov    0x4(%rdi,%r8,1),%r9d
  imul   %r9d,%esi
  add    %r9d,%ecx
  add    %esi,%eax
  lea    0x2(%rdx),%esi
  cmp    %esi,%ebx
  jle    L95
  mov    0x8(%rdi,%r8,1),%r9d
  imul   %r9d,%esi
  add    %r9d,%ecx
  add    %esi,%eax
  lea    0x3(%rdx),%esi
  cmp    %esi,%ebx
  jle    L95
  mov    0xc(%rdi,%r8,1),%r9d
  add    $0x4,%edx
  imul   %r9d,%esi
  add    %r9d,%ecx
  add    %esi,%eax
  cmp    %edx,%ebx
  jle    L95
  mov    0x10(%rdi,%r8,1),%esi
  imul   %esi,%edx
  add    %esi,%ecx
  add    %edx,%eax
L95:
  cltd
  idiv   %ecx
  mov    %eax,%r14d
  cmp    $0xff,%ebx
  jg     1080 <canal_a_valores_t.cold>
  mov    $0xff,%eax
  mov    $0x100,%esi
  sub    %ebx,%eax
  sub    %ebx,%esi
  cmp    $0x4,%eax
  jbe    L156
  movslq %ebx,%rax
  movd   %ebx,%xmm5
  lea    (%rdi,%rax,4),%rdx
  mov    %esi,%eax
  pshufd $0x0,%xmm5,%xmm3
  shr    $0x2,%eax
  pxor   %xmm5,%xmm5
  paddd  %xmm7,%xmm3
  lea    -0x1(%rax),%ecx
  lea    0x10(%rdx),%rax
  movdqa %xmm5,%xmm4
  shl    $0x4,%rcx
  add    %rax,%rcx
  jmp    L81
  nopl   0x0(%rax)
L44:
  add    $0x10,%rax
L81:
  movdqu (%rdx),%xmm2
  movdqa %xmm3,%xmm0
  mov    %rax,%rdx
  paddd  %xmm6,%xmm3
  movdqa %xmm0,%xmm1
  psrlq  $0x20,%xmm0
  movdqa %xmm2,%xmm7
  pmuludq %xmm2,%xmm1
  paddd  %xmm2,%xmm5
  psrlq  $0x20,%xmm7
  pmuludq %xmm7,%xmm0
  pshufd $0x8,%xmm1,%xmm1
  pshufd $0x8,%xmm0,%xmm0
  punpckldq %xmm0,%xmm1
  paddd  %xmm1,%xmm4
  cmp    %rax,%rcx
  jne    L44
  movdqa %xmm5,%xmm0
  mov    %esi,%r8d
  psrldq $0x8,%xmm0
  and    $0xfffffffc,%r8d
  paddd  %xmm0,%xmm5
  lea    (%r8,%rbx,1),%edx
  movdqa %xmm5,%xmm0
  psrldq $0x4,%xmm0
  paddd  %xmm0,%xmm5
  movdqa %xmm4,%xmm0
  psrldq $0x8,%xmm0
  movd   %xmm5,%ecx
  paddd  %xmm0,%xmm4
  movdqa %xmm4,%xmm0
  psrldq $0x4,%xmm0
  paddd  %xmm0,%xmm4
  movd   %xmm4,%eax
  cmp    %esi,%r8d
  je     L27
L58:
  movslq %edx,%r8
  lea    0x0(,%r8,4),%rsi
  mov    (%rdi,%r8,4),%r8d
  mov    %r8d,%r9d
  add    %r8d,%ecx
  lea    0x1(%rdx),%r8d
  imul   %edx,%r9d
  add    %r9d,%eax
  cmp    $0xff,%edx
  je     L27
  mov    0x4(%rdi,%rsi,1),%r9d
  imul   %r9d,%r8d
  add    %r9d,%ecx
  add    %r8d,%eax
  lea    0x2(%rdx),%r8d
  cmp    $0xfe,%edx
  je     L27
  mov    0x8(%rdi,%rsi,1),%r9d
  imul   %r9d,%r8d
  add    %r9d,%ecx
  add    %r8d,%eax
  lea    0x3(%rdx),%r8d
  cmp    $0xfd,%edx
  je     L27
  mov    0xc(%rdi,%rsi,1),%r9d
  imul   %r9d,%r8d
  add    %r9d,%ecx
  add    %r8d,%eax
  lea    0x4(%rdx),%r8d
  cmp    $0xfc,%edx
  je     L27
  mov    0x10(%rdi,%rsi,1),%esi
  mov    %r8d,%edx
  imul   %esi,%edx
  add    %esi,%ecx
  add    %edx,%eax
L27:
  cltd
  idiv   %ecx
  mov    %eax,%r15d
  call   <free@plt>
  pxor   %xmm0,%xmm0
  movsd  D29(%rip),%xmm1
  cvtsi2sd %r14d,%xmm0
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,0x0(%r13)
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebx,%xmm0
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%r12)
  pxor   %xmm0,%xmm0
  cvtsi2sd %r15d,%xmm0
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,0x0(%rbp)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L136:
  xor    %ecx,%ecx
  xor    %eax,%eax
  xor    %edx,%edx
  jmp    L55
L156:
  mov    %ebx,%edx
  xor    %ecx,%ecx
  xor    %eax,%eax
  jmp    L58
```

tool_calls: name: unpack_data
arguments: data_tag: D23
type_guessed: byte[16]
name: unpack_data
arguments: data_tag: D21
type_guessed: byte[16]
name: unpack_data
arguments: data_tag: D29
type_guessed: f64

tool: {"D23": [0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00]}

tool: {"D21": [0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: D29: 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;
}
```