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

```asm
<DecomposeHistogram>:
  endbr64
  push   %r14
  mov    %rcx,%r11
  movapd %xmm0,%xmm4
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  test   %esi,%esi
  jle    L54
  movss  D43(%rip),%xmm5
  lea    -0x1(%rsi),%r12d
  mov    %esi,%ebp
  xor    %ecx,%ecx
  movss  D13(%rip),%xmm6
  xor    %r10d,%r10d
  xor    %r13d,%r13d
  movss  D6(%rip),%xmm7
  jmp    L85
  cs nopw 0x0(%rax,%rax,1)
L62:
  subss  %xmm3,%xmm2
  xorps  %xmm7,%xmm2
L50:
  mulss  %xmm5,%xmm0
  pxor   %xmm1,%xmm1
  movslq %r10d,%rax
  add    $0x1,%r10d
  cvtsi2ss %r14d,%xmm1
  addss  %xmm2,%xmm1
  movss  %xmm1,(%rbx,%rax,4)
  movss  %xmm0,(%r11,%rax,4)
  pxor   %xmm0,%xmm0
  cvtsd2ss %xmm4,%xmm0
  movss  %xmm0,(%r8,%rax,4)
L163:
  add    $0x1,%rcx
  cmp    %rbp,%rcx
  je     L106
L85:
  lea    (%r12,%rcx,1),%eax
  movss  (%rdi,%rcx,4),%xmm0
  mov    %ecx,%r14d
  cltd
  idiv   %esi
  lea    0x1(%rcx),%eax
  movslq %edx,%rdx
  movss  (%rdi,%rdx,4),%xmm1
  comiss %xmm0,%xmm1
  ja     L163
  cltd
  idiv   %esi
  movslq %edx,%rdx
  movss  (%rdi,%rdx,4),%xmm2
  comiss %xmm0,%xmm2
  ja     L163
  ucomiss %xmm0,%xmm1
  setnp  %al
  cmovne %r13d,%eax
  test   %al,%al
  je     L94
  ucomiss %xmm2,%xmm0
  setnp  %al
  cmovne %r13d,%eax
  test   %al,%al
  jne    L163
L94:
  movaps %xmm0,%xmm3
  subss  %xmm1,%xmm3
  movaps %xmm0,%xmm1
  subss  %xmm2,%xmm1
  movaps %xmm3,%xmm2
  addss  %xmm1,%xmm2
  divss  %xmm2,%xmm3
  divss  %xmm2,%xmm1
  movaps %xmm6,%xmm2
  comiss %xmm3,%xmm1
  ja     L62
  subss  %xmm1,%xmm2
  jmp    L50
  nopw   0x0(%rax,%rax,1)
L54:
  xor    %r10d,%r10d
  nopl   0x0(%rax,%rax,1)
L106:
  cmp    %r10d,%r9d
  jle    L109
  movslq %r10d,%rax
  mov    %r9d,%ebp
  cvtsd2ss %xmm4,%xmm4
  lea    0x0(,%rax,4),%rdx
  sub    %r10d,%ebp
  lea    0x4(%rdx),%rcx
  lea    (%r8,%rdx,1),%rsi
  lea    (%rbx,%rcx,1),%r13
  mov    %rsi,%r12
  lea    (%r11,%rdx,1),%rdi
  sub    %r13,%r12
  mov    %rdi,%r14
  cmp    $0x8,%r12
  seta   %r12b
  sub    %r13,%r14
  cmp    $0x8,%r14
  seta   %r13b
  and    %r13d,%r12d
  lea    -0x1(%rbp),%r13d
  cmp    $0x2,%r13d
  seta   %r13b
  test   %r13b,%r12b
  je     L38
  add    %r11,%rcx
  mov    %rsi,%r12
  sub    %rcx,%r12
  cmp    $0x8,%r12
  jbe    L38
  mov    %ebp,%ecx
  movaps D15(%rip),%xmm2
  movaps %xmm4,%xmm3
  add    %rbx,%rdx
  shr    $0x2,%ecx
  xor    %eax,%eax
  pxor   %xmm1,%xmm1
  shufps $0x0,%xmm3,%xmm3
  shl    $0x4,%rcx
  nopl   (%rax)
L117:
  movups %xmm2,(%rdx,%rax,1)
  movups %xmm1,(%rdi,%rax,1)
  movups %xmm3,(%rsi,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rcx
  jne    L117
  mov    %ebp,%eax
  and    $0xfffffffc,%eax
  lea    (%rax,%r10,1),%edx
  cmp    %eax,%ebp
  je     L109
  movss  D15(%rip),%xmm1
  movslq %edx,%rax
  movss  %xmm1,(%rbx,%rax,4)
  movl   $0x0,(%r11,%rax,4)
  movss  %xmm4,(%r8,%rax,4)
  lea    0x1(%rdx),%eax
  cmp    %eax,%r9d
  jle    L109
  cltq
  add    $0x2,%edx
  movss  %xmm1,(%rbx,%rax,4)
  lea    0x0(,%rax,4),%rcx
  movl   $0x0,(%r11,%rax,4)
  movss  %xmm4,(%r8,%rax,4)
  cmp    %edx,%r9d
  jle    L109
  movss  %xmm1,0x4(%rbx,%rcx,1)
  movl   $0x0,0x4(%r11,%rcx,1)
  movss  %xmm4,0x4(%r8,%rcx,1)
L109:
  pop    %rbx
  mov    %r10d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L38:
  movss  D15(%rip),%xmm1
  nopl   0x0(%rax,%rax,1)
L86:
  movss  %xmm1,(%rbx,%rax,4)
  movl   $0x0,(%r11,%rax,4)
  movss  %xmm4,(%r8,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%r9d
  jg     L86
  pop    %rbx
  mov    %r10d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D43
datatype: byte[4]
name: parse_data
arguments: data_tag: D13
datatype: f32
name: parse_data
arguments: data_tag: D6
datatype: byte[4]
name: parse_data
arguments: data_tag: D15
datatype: byte[16]

tool: {"D43": [0x00,0x00,0x80,0x40]}

tool: D13: 0.5

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

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

assistant: ```c
int DecomposeHistogram(float *histogram, int bins, float *out_means, float *out_amps, float *out_sigmas, int max_dists, double default_sigma, int iterations) {
  int i;
  int peak = 0;
  for (i = 0; i < bins; i++) {
    float offset = 0;
    float prev = histogram[(i - 1 + bins) % bins];
    float this = histogram[i];
    float next = histogram[(i + 1) % bins];
    if (prev > this || next > this)
      continue;
    if (prev == this && next == this)
      continue;
    float totaldiff = ((this - prev) + (this - next));
    float porpdiffP = (this - prev) / totaldiff;
    float porpdiffN = (this - next) / totaldiff;
    if (porpdiffP < porpdiffN) {
      offset = -(0.5 - porpdiffP);
    } else {
      offset = (0.5 - porpdiffN);
    }
    out_means[peak] = i + offset;
    out_amps[peak] = this * 4;
    out_sigmas[peak] = default_sigma;
    peak++;
  }
  for (i = peak; i < max_dists; i++) {
    out_means[i] = -1;
    out_amps[i] = 0;
    out_sigmas[i] = default_sigma;
  }
  return peak;
}
```