user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<equalization_meanx>:
  endbr64
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  mov    %r9d,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %r8d,%r12d
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x48,%rsp
  mov    %rdx,0x10(%rsp)
  mov    0x88(%rsp),%edx
  mov    0x80(%rsp),%ebp
  lea    0x0(,%rdx,4),%edi
  mov    %edx,0xc(%rsp)
  mov    %edi,(%rsp)
  call   <malloc@plt>
  mov    (%rsp),%edi
  mov    %rax,0x28(%rsp)
  call   <malloc@plt>
  mov    0xc(%rsp),%edx
  mov    0x10(%rsp),%rsi
  mov    %rax,0x20(%rsp)
  test   %edx,%edx
  jle    L207
  imul   %r14d,%ebp
  mov    0x28(%rsp),%rdi
  pxor   %xmm3,%xmm3
  mov    %rax,%rcx
  imul   %r15d,%r12d
  pxor   %xmm2,%xmm2
  mov    %rcx,0x30(%rsp)
  xor    %r8d,%r8d
  lea    0x0(,%rdx,4),%rax
  mov    %rdi,%r15
  mov    %rsi,0x38(%rsp)
  mov    %rdi,%rdx
  cvtsi2ss %ebp,%xmm2
  lea    -0x1(%rbp),%r9d
  mov    %rax,(%rsp)
  add    %rdi,%rax
  mov    %r9d,%r11d
  cvtsi2ss %r12d,%xmm3
  mov    %r15,0x18(%rsp)
  xor    %edi,%edi
  mov    %r11d,0xc(%rsp)
  pxor   %xmm1,%xmm1
  lea    -0x1(%r12),%r10d
  lea    0x4(%r13),%r9
  mov    %rax,0x10(%rsp)
  lea    0x4(%rbx),%rax
  mov    0x10(%rsp),%rsi
  mov    %rax,%r14
  xchg   %ax,%ax
L195:
  movl   $0x0,(%rdx)
  test   %r12d,%r12d
  jle    L7
  movslq %edi,%r15
  movaps %xmm1,%xmm0
  lea    0x0(%r13,%r15,4),%rax
  add    %r10,%r15
  lea    (%r9,%r15,4),%r15
  nopl   0x0(%rax)
L44:
  addss  (%rax),%xmm0
  add    $0x4,%rax
  movss  %xmm0,(%rdx)
  cmp    %r15,%rax
  jne    L44
L109:
  divss  %xmm3,%xmm0
  movss  %xmm0,(%rdx)
  movl   $0x0,(%rcx)
  test   %ebp,%ebp
  jle    L165
  movslq %r8d,%r15
  movaps %xmm1,%xmm0
  lea    (%rbx,%r15,4),%rax
  add    %r11,%r15
  lea    (%r14,%r15,4),%r15
L146:
  addss  (%rax),%xmm0
  add    $0x4,%rax
  movss  %xmm0,(%rcx)
  cmp    %r15,%rax
  jne    L146
L127:
  divss  %xmm2,%xmm0
  add    $0x4,%rdx
  add    $0x4,%rcx
  add    %r12d,%edi
  add    %ebp,%r8d
  movss  %xmm0,-0x4(%rcx)
  cmp    %rsi,%rdx
  jne    L195
  mov    (%rsp),%rax
  add    0x20(%rsp),%rax
  xor    %r13d,%r13d
  mov    0x18(%rsp),%r15
  mov    0x30(%rsp),%r14
  mov    %rax,(%rsp)
  mov    %ebp,%eax
  shr    $0x2,%eax
  mov    0x38(%rsp),%rsi
  lea    -0x1(%rax),%r8d
  mov    %ebp,%eax
  mov    %r15,%r12
  mov    %r14,%r15
  add    $0x1,%r8
  and    $0xfffffffc,%eax
  mov    %r13d,%r14d
  mov    %ebp,%r13d
  shl    $0x4,%r8
  mov    %eax,0x10(%rsp)
  mov    %rsi,%rbp
  mov    %r8,0x18(%rsp)
  xchg   %ax,%ax
L9:
  movss  (%r15),%xmm0
  call   <fabs@plt>
  movss  D8(%rip),%xmm0
  test   %eax,%eax
  jle    L190
  movss  (%r12),%xmm0
  divss  (%r15),%xmm0
L190:
  test   %r13d,%r13d
  jle    L35
  movslq %r14d,%r8
  lea    0x0(,%r8,4),%rax
  lea    0x0(%rbp,%rax,1),%rcx
  lea    0x4(%rax),%rdx
  lea    (%rbx,%rdx,1),%r11
  mov    %rcx,%r10
  sub    %r11,%r10
  cmp    $0x8,%r10
  jbe    L164
  cmp    $0x1,%r13d
  je     L164
  cmpl   $0x2,0xc(%rsp)
  jbe    L153
  mov    0x18(%rsp),%rdi
  movaps %xmm0,%xmm2
  add    %rbx,%rax
  xor    %edx,%edx
  shufps $0x0,%xmm2,%xmm2
  nopl   0x0(%rax,%rax,1)
L43:
  movups (%rax,%rdx,1),%xmm1
  mulps  %xmm2,%xmm1
  movups %xmm1,(%rcx,%rdx,1)
  add    $0x10,%rdx
  cmp    %rdx,%rdi
  jne    L43
  mov    0x10(%rsp),%eax
  cmp    %eax,%r13d
  je     L35
  mov    %r13d,%edx
  mov    %eax,%ecx
  sub    %ecx,%edx
  cmp    $0x1,%edx
  je     L3
L141:
  add    %r8,%rcx
  movaps %xmm0,%xmm2
  movq   (%rbx,%rcx,4),%xmm1
  shufps $0xe0,%xmm2,%xmm2
  mulps  %xmm2,%xmm1
  movlps %xmm1,0x0(%rbp,%rcx,4)
  mov    %edx,%ecx
  and    $0xfffffffe,%ecx
  add    %ecx,%eax
  cmp    %edx,%ecx
  je     L35
L3:
  add    %r14d,%eax
  cltq
  mulss  (%rbx,%rax,4),%xmm0
  movss  %xmm0,0x0(%rbp,%rax,4)
L35:
  add    $0x4,%r15
  add    %r13d,%r14d
  add    $0x4,%r12
  cmp    %r15,(%rsp)
  jne    L9
L207:
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  mov    0x20(%rsp),%rdi
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <free@plt>
  nopw   0x0(%rax,%rax,1)
L164:
  mov    0xc(%rsp),%ecx
  lea    0x1(%r8,%rcx,1),%rcx
  shl    $0x2,%rcx
  jmp    L176
  nopw   0x0(%rax,%rax,1)
L159:
  add    $0x4,%rdx
L176:
  movss  (%rbx,%rax,1),%xmm1
  mulss  %xmm0,%xmm1
  movss  %xmm1,0x0(%rbp,%rax,1)
  mov    %rdx,%rax
  cmp    %rcx,%rdx
  jne    L159
  jmp    L35
  nopl   (%rax)
L165:
  movaps %xmm1,%xmm0
  jmp    L127
  nopl   0x0(%rax,%rax,1)
L7:
  movaps %xmm1,%xmm0
  jmp    L109
L153:
  mov    %r13d,%edx
  xor    %eax,%eax
  xor    %ecx,%ecx
  jmp    L141
```

tool_calls: name: unpack_data
arguments: data_tag: D8
data_type: byte[4]

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

assistant: ```c
void equalization_meanx(float *ref, float *modified, float *out, int w, int h, int w2, int h2, int pd) {
  float *mean_ref = malloc(pd * sizeof(float));
  float *mean_modified = malloc(pd * sizeof(float));
  for (int l = 0; l < pd; l++) {
    mean_ref[l] = 0;
    for (int i = 0; i < w * h; i++)
      mean_ref[l] += ref[i + l * w * h];
    mean_ref[l] /= (float)(w * h);
    mean_modified[l] = 0;
    for (int i = 0; i < w2 * h2; i++)
      mean_modified[l] += modified[i + l * h2 * w2];
    mean_modified[l] /= (float)(w2 * h2);
  }
  float factor;
  for (int l = 0; l < pd; l++) {
    if (fabs(mean_modified[l]) < 1e-3)
      factor = 1;
    else
      factor = mean_ref[l] / mean_modified[l];
    for (int i = 0; i < w2 * h2; i++)
      out[i + l * w2 * h2] = modified[i + l * w2 * h2] * factor;
  }
  free(mean_ref);
  free(mean_modified);
}
```