user: 请将以下的汇编代码转换成C语言代码：

```asm
<BGBMID_NormalizeSample>:
  endbr64
  pxor   %xmm6,%xmm6
  push   %r15
  cvtsi2ss %edx,%xmm6
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  movss  %xmm6,0x2c(%rsp)
  test   %edx,%edx
  jle    L85
  lea    -0x1(%rdx),%eax
  lea    0x2(%rsi),%r14
  mov    %rdi,%r12
  mov    %rsi,%r15
  lea    (%r14,%rax,2),%rbp
  mov    %edx,%r13d
  mov    %rsi,%rbx
  mov    %rsi,%rax
  pxor   %xmm0,%xmm0
  cs nopw 0x0(%rax,%rax,1)
L158:
  movswl (%rax),%edx
  pxor   %xmm1,%xmm1
  add    $0x2,%rax
  cvtsi2ss %edx,%xmm1
  addss  %xmm1,%xmm0
  cmp    %rbp,%rax
  jne    L158
  divss  0x2c(%rsp),%xmm0
  pxor   %xmm1,%xmm1
  movss  %xmm0,0x28(%rsp)
  nopl   0x0(%rax,%rax,1)
L25:
  movswl (%rbx),%eax
  pxor   %xmm0,%xmm0
  movss  %xmm1,0x24(%rsp)
  add    $0x2,%rbx
  cvtsi2ss %eax,%xmm0
  subss  0x28(%rsp),%xmm0
  cvttss2si %xmm0,%edi
  movswl %di,%edi
  call   <fabs@plt>
  pxor   %xmm0,%xmm0
  movss  0x24(%rsp),%xmm1
  cvtsi2ss %rax,%xmm0
  addss  %xmm0,%xmm1
  cmp    %rbp,%rbx
  jne    L25
  movss  D12(%rip),%xmm0
  divss  0x2c(%rsp),%xmm1
  movsd  D30(%rip),%xmm6
  comiss %xmm1,%xmm0
  ja     L123
  cvtss2sd %xmm1,%xmm1
  divsd  %xmm1,%xmm6
L123:
  mov    %r12,%rax
  sub    %r14,%rax
  cmp    $0xc,%rax
  jbe    L152
  cmp    $0x7,%r13d
  jle    L152
  mov    $0x1,%esi
  movapd %xmm6,%xmm4
  pxor   %xmm7,%xmm7
  test   %r13d,%r13d
  cmovg  %r13d,%esi
  movss  0x28(%rsp),%xmm5
  unpcklpd %xmm4,%xmm4
  xor    %eax,%eax
  movdqa D28(%rip),%xmm3
  movdqa D36(%rip),%xmm2
  mov    %esi,%edx
  shufps $0x0,%xmm5,%xmm5
  shr    $0x3,%edx
  shl    $0x4,%rdx
  nopl   0x0(%rax)
L38:
  movdqu (%r15,%rax,1),%xmm1
  movdqa %xmm7,%xmm0
  pcmpgtw %xmm1,%xmm0
  movdqa %xmm1,%xmm8
  punpcklwd %xmm0,%xmm8
  punpckhwd %xmm0,%xmm1
  cvtdq2ps %xmm8,%xmm8
  subps  %xmm5,%xmm8
  movhps %xmm8,(%rsp)
  cvtdq2ps %xmm1,%xmm1
  subps  %xmm5,%xmm1
  movhps %xmm1,0x10(%rsp)
  cvtps2pd %xmm8,%xmm0
  cvtps2pd (%rsp),%xmm8
  mulpd  %xmm4,%xmm0
  mulpd  %xmm4,%xmm8
  cvttpd2dq %xmm0,%xmm0
  cvttpd2dq %xmm8,%xmm8
  punpcklqdq %xmm8,%xmm0
  movdqa %xmm2,%xmm8
  movdqa %xmm0,%xmm9
  pcmpgtd %xmm3,%xmm9
  pand   %xmm9,%xmm0
  pandn  %xmm3,%xmm9
  por    %xmm0,%xmm9
  movdqa %xmm9,%xmm0
  pcmpgtd %xmm2,%xmm0
  pand   %xmm0,%xmm8
  pandn  %xmm9,%xmm0
  movdqa %xmm2,%xmm9
  por    %xmm0,%xmm8
  cvtps2pd %xmm1,%xmm0
  cvtps2pd 0x10(%rsp),%xmm1
  mulpd  %xmm4,%xmm0
  mulpd  %xmm4,%xmm1
  cvttpd2dq %xmm0,%xmm0
  cvttpd2dq %xmm1,%xmm1
  punpcklqdq %xmm1,%xmm0
  movdqa %xmm0,%xmm1
  pcmpgtd %xmm3,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm3,%xmm1
  por    %xmm1,%xmm0
  movdqa %xmm0,%xmm1
  pcmpgtd %xmm2,%xmm1
  pand   %xmm1,%xmm9
  pandn  %xmm0,%xmm1
  movdqa %xmm8,%xmm0
  por    %xmm9,%xmm1
  movdqa %xmm8,%xmm9
  punpcklwd %xmm1,%xmm0
  punpckhwd %xmm1,%xmm9
  movdqa %xmm0,%xmm1
  punpcklwd %xmm9,%xmm0
  punpckhwd %xmm9,%xmm1
  punpcklwd %xmm1,%xmm0
  movups %xmm0,(%r12,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L38
  mov    %esi,%ecx
  and    $0xfffffff8,%ecx
  and    $0x7,%esi
  je     L85
  mov    %ecx,%esi
  pxor   %xmm0,%xmm0
  movss  0x28(%rsp),%xmm5
  mov    $0xffff8001,%edi
  movswl (%r15,%rsi,2),%edx
  lea    (%rsi,%rsi,1),%rax
  cvtsi2ss %edx,%xmm0
  subss  %xmm5,%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  %xmm6,%xmm0
  cvttsd2si %xmm0,%edx
  cmp    %edi,%edx
  cmovl  %edi,%edx
  mov    $0x7fff,%edi
  cmp    %edi,%edx
  cmovg  %edi,%edx
  mov    %dx,(%r12,%rsi,2)
  lea    0x1(%rcx),%edx
  cmp    %edx,%r13d
  jle    L85
  movswl 0x2(%r15,%rax,1),%edx
  pxor   %xmm0,%xmm0
  mov    $0xffff8001,%esi
  cvtsi2ss %edx,%xmm0
  subss  %xmm5,%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  %xmm6,%xmm0
  cvttsd2si %xmm0,%edx
  cmp    %esi,%edx
  cmovl  %esi,%edx
  mov    $0x7fff,%esi
  cmp    %esi,%edx
  cmovg  %esi,%edx
  mov    %dx,0x2(%r12,%rax,1)
  lea    0x2(%rcx),%edx
  cmp    %edx,%r13d
  jle    L85
  movswl 0x4(%r15,%rax,1),%edx
  pxor   %xmm0,%xmm0
  mov    $0xffff8001,%esi
  cvtsi2ss %edx,%xmm0
  subss  %xmm5,%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  %xmm6,%xmm0
  cvttsd2si %xmm0,%edx
  cmp    %esi,%edx
  cmovl  %esi,%edx
  mov    $0x7fff,%esi
  cmp    %esi,%edx
  cmovg  %esi,%edx
  mov    %dx,0x4(%r12,%rax,1)
  lea    0x3(%rcx),%edx
  cmp    %edx,%r13d
  jle    L85
  movswl 0x6(%r15,%rax,1),%edx
  pxor   %xmm0,%xmm0
  mov    $0xffff8001,%esi
  cvtsi2ss %edx,%xmm0
  subss  %xmm5,%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  %xmm6,%xmm0
  cvttsd2si %xmm0,%edx
  cmp    %esi,%edx
  cmovl  %esi,%edx
  mov    $0x7fff,%esi
  cmp    %esi,%edx
  cmovg  %esi,%edx
  mov    %dx,0x6(%r12,%rax,1)
  lea    0x4(%rcx),%edx
  cmp    %edx,%r13d
  jle    L85
  movswl 0x8(%r15,%rax,1),%edx
  pxor   %xmm0,%xmm0
  mov    $0xffff8001,%esi
  cvtsi2ss %edx,%xmm0
  subss  %xmm5,%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  %xmm6,%xmm0
  cvttsd2si %xmm0,%edx
  cmp    %esi,%edx
  cmovl  %esi,%edx
  mov    $0x7fff,%esi
  cmp    %esi,%edx
  cmovg  %esi,%edx
  mov    %dx,0x8(%r12,%rax,1)
  lea    0x5(%rcx),%edx
  cmp    %edx,%r13d
  jle    L85
  movswl 0xa(%r15,%rax,1),%edx
  pxor   %xmm0,%xmm0
  mov    $0xffff8001,%esi
  cvtsi2ss %edx,%xmm0
  subss  %xmm5,%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  %xmm6,%xmm0
  cvttsd2si %xmm0,%edx
  cmp    %esi,%edx
  cmovl  %esi,%edx
  mov    $0x7fff,%esi
  cmp    %esi,%edx
  cmovg  %esi,%edx
  add    $0x6,%ecx
  mov    %dx,0xa(%r12,%rax,1)
  cmp    %ecx,%r13d
  jle    L85
  movswl 0xc(%r15,%rax,1),%edx
  pxor   %xmm0,%xmm0
  mov    $0xffff8001,%ecx
  cvtsi2ss %edx,%xmm0
  subss  %xmm5,%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  %xmm6,%xmm0
  cvttsd2si %xmm0,%edx
  cmp    %ecx,%edx
  cmovl  %ecx,%edx
  mov    $0x7fff,%ecx
  cmp    %ecx,%edx
  cmovg  %ecx,%edx
  mov    %dx,0xc(%r12,%rax,1)
L85:
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L152:
  xor    %edx,%edx
  nopw   0x0(%rax,%rax,1)
L62:
  movswl (%r15,%rdx,2),%eax
  pxor   %xmm0,%xmm0
  mov    $0xffff8001,%ecx
  cvtsi2ss %eax,%xmm0
  subss  0x28(%rsp),%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  %xmm6,%xmm0
  cvttsd2si %xmm0,%eax
  cmp    %ecx,%eax
  cmovl  %ecx,%eax
  mov    $0x7fff,%ecx
  cmp    %ecx,%eax
  cmovg  %ecx,%eax
  mov    %ax,(%r12,%rdx,2)
  add    $0x1,%rdx
  cmp    %edx,%r13d
  jg     L62
  jmp    L85
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D12
type_infered: byte[4]
name: extract_symbolic_data
arguments: data_tag: D30
type_infered: f64
name: extract_symbolic_data
arguments: data_tag: D28
type_infered: byte[16]
name: extract_symbolic_data
arguments: data_tag: D36
type_infered: byte[16]

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

tool: D30: 4096

tool: {"D28": [0x01,0x80,0xff,0xff,0x01,0x80,0xff,0xff,0x01,0x80,0xff,0xff,0x01,0x80,0xff,0xff]}

tool: {"D36": [0xff,0x7f,0x00,0x00,0xff,0x7f,0x00,0x00,0xff,0x7f,0x00,0x00,0xff,0x7f,0x00,0x00]}

assistant: ```c
int BGBMID_NormalizeSample(short *dst, short *src, int len) {
  float c, r;
  int i, j, k;
  c = 0;
  for (i = 0; i < len; i++)
    c += src[i];
  c /= len;
  r = 0;
  for (i = 0; i < len; i++)
    r += fabs(src[i] - c);
  r /= len;
  if (r < 1)
    r = 1;
  for (i = 0; i < len; i++) {
    j = (src[i] - c) * (4096.0 / r);
    if (j > 32767)
      j = 32767;
    if (j < -32767)
      j = -32767;
    dst[i] = j;
  }
  return (0);
}
```