user: Converte this assembly snippet into its equivalent C code:

```asm
<mix_mono_float>:
  endbr64
  cmp    $0x1,%esi
  jle    L161
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  test   %rdx,%rdx
  je     L189
  mov    %esi,%eax
  mov    %rdi,%rcx
  pxor   %xmm5,%xmm5
  movslq %esi,%r14
  mov    %eax,%edx
  lea    -0x1(%rax),%ebx
  mov    %eax,%r9d
  movss  D13(%rip),%xmm3
  lea    0x0(,%rdx,8),%r13
  lea    (%rdi,%rdx,4),%rdx
  mov    %eax,%edi
  and    $0xfffffffc,%r9d
  shr    $0x2,%edi
  cvtsi2ss %eax,%xmm5
  pxor   %xmm4,%xmm4
  mov    %r9d,%r10d
  lea    -0x1(%rdi),%r8d
  mov    %ebx,%edi
  lea    0x0(,%r14,4),%rsi
  shl    $0x2,%r10
  shl    $0x3,%rdi
  shl    $0x4,%r8
  sub    %rsi,%r13
  sub    %rsi,%rdx
  sub    %rsi,%rdi
  movss  D6(%rip),%xmm6
  xor    %esi,%esi
  lea    0x10(%r8),%rbp
  lea    0x8(%rdi),%r15
  lea    0x1(%r9),%edi
  nopl   0x0(%rax,%rax,1)
L89:
  cmp    $0x2,%ebx
  jbe    L55
  mov    %rcx,%r8
  lea    (%rcx,%rbp,1),%r11
  movaps %xmm4,%xmm0
  nopl   0x0(%rax,%rax,1)
L42:
  movups (%r8),%xmm2
  add    $0x10,%r8
  addss  %xmm2,%xmm0
  movaps %xmm2,%xmm1
  shufps $0x55,%xmm2,%xmm1
  addss  %xmm1,%xmm0
  movaps %xmm2,%xmm1
  unpckhps %xmm2,%xmm1
  shufps $0xff,%xmm2,%xmm2
  addss  %xmm1,%xmm0
  addss  %xmm2,%xmm0
  cmp    %r11,%r8
  jne    L42
  lea    (%rcx,%r10,1),%r8
  cmp    %r9d,%eax
  je     L139
  addss  (%r8),%xmm0
  lea    0x4(%r8),%r11
  mov    %edi,%r8d
  cmp    %edi,%eax
  jle    L139
L173:
  add    $0x1,%r8d
  addss  (%r11),%xmm0
  cmp    %r8d,%eax
  jle    L134
  addss  0x4(%r11),%xmm0
L134:
  divss  %xmm5,%xmm0
  comiss %xmm3,%xmm0
  jbe    L93
  movaps %xmm3,%xmm0
  cmp    $0x2,%ebx
  jbe    L143
L114:
  movaps %xmm0,%xmm1
  lea    0x0(%rbp,%rdx,1),%r11
  mov    %rdx,%r8
  shufps $0x0,%xmm1,%xmm1
  nop
L19:
  movups %xmm1,(%r8)
  add    $0x10,%r8
  cmp    %r8,%r11
  jne    L19
  lea    (%rdx,%r10,1),%r8
  cmp    %r9d,%eax
  je     L37
  lea    0x4(%r8),%r11
  movss  %xmm0,(%r8)
  mov    %edi,%r8d
  cmp    %edi,%eax
  jle    L37
L0:
  add    $0x1,%r8d
  movss  %xmm0,(%r11)
  cmp    %eax,%r8d
  jge    L37
  movss  %xmm0,0x4(%r11)
L37:
  add    %r14,%rsi
  add    %r15,%rcx
  add    %r13,%rdx
  cmp    %rsi,%r12
  ja     L89
L189:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L93:
  movaps %xmm6,%xmm7
  maxss  %xmm0,%xmm7
  movaps %xmm7,%xmm0
  cmp    $0x2,%ebx
  ja     L114
L143:
  lea    0x4(%rdx),%r11
  movss  %xmm0,(%rdx)
  mov    $0x1,%r8d
  jmp    L0
  nopl   0x0(%rax,%rax,1)
L139:
  divss  %xmm5,%xmm0
  comiss %xmm3,%xmm0
  jbe    L93
  movaps %xmm3,%xmm0
  jmp    L114
  nopl   0x0(%rax)
L55:
  movss  (%rcx),%xmm0
  lea    0x4(%rcx),%r11
  mov    $0x1,%r8d
  addss  %xmm4,%xmm0
  jmp    L173
L161:
  ret
```

tool_calls: name: read_data
arguments: data_label: D13
datatype: byte[4]
name: read_data
arguments: data_label: D6
datatype: byte[4]

tool: {"D13": [0x00,0x00,0x80,0x3f]}

tool: {"D6": [0x00,0x00,0x80,0xbf]}

assistant: ```c
void mix_mono_float(float *buf, int channels, size_t size) {
  int c;
  size_t i = 0;
  if (channels < 2)
    return;
  while (i < size) {
    float mono = 0.0f;
    for (c = 0; c < channels; c++)
      mono += *buf++;
    buf -= channels;
    mono /= channels;
    if (mono > 1.0f)
      mono = 1.0f;
    else if (mono < -1.0f)
      mono = -1.0f;
    for (c = 0; c < channels; c++)
      *buf++ = mono;
    i += channels;
  }
}
```