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

```asm
<hist_img>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    -0x4000(%rsp),%r11
L71:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L71
  sub    $0x60,%rsp
  mov    %rdi,-0x4058(%rbp)
  mov    %esi,-0x405c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x4040(%rbp)
  movl   $0x0,-0x403c(%rbp)
  movl   $0x0,-0x4038(%rbp)
  movl   $0x0,-0x4034(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x4030(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x4028(%rbp)
  movl   $0x0,-0x4048(%rbp)
  jmp    L94
L117:
  mov    -0x4048(%rbp),%eax
  cltq
  movl   $0x0,-0x4010(%rbp,%rax,4)
  addl   $0x1,-0x4048(%rbp)
L94:
  cmpl   $0xfff,-0x4048(%rbp)
  jle    L117
  movl   $0x0,-0x4048(%rbp)
  jmp    L18
L33:
  mov    -0x4058(%rbp),%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  jns    L100
  addl   $0x1,-0x403c(%rbp)
  jmp    L19
L100:
  mov    -0x4058(%rbp),%rax
  movzwl (%rax),%eax
  cmp    $0xfff,%ax
  jle    L16
  addl   $0x1,-0x4038(%rbp)
  jmp    L19
L16:
  mov    -0x4058(%rbp),%rax
  movzwl (%rax),%eax
  cwtl
  movslq %eax,%rdx
  mov    -0x4010(%rbp,%rdx,4),%edx
  add    $0x1,%edx
  cltq
  mov    %edx,-0x4010(%rbp,%rax,4)
L19:
  addq   $0x2,-0x4058(%rbp)
  addl   $0x1,-0x4048(%rbp)
L18:
  mov    -0x4048(%rbp),%eax
  cmp    -0x405c(%rbp),%eax
  jl     L33
  movl   $0x0,-0x4048(%rbp)
  jmp    L1
L38:
  mov    -0x4048(%rbp),%eax
  cltq
  mov    -0x4010(%rbp,%rax,4),%eax
  imul   -0x4048(%rbp),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  -0x4030(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x4030(%rbp)
  mov    -0x4048(%rbp),%eax
  cltq
  mov    -0x4010(%rbp,%rax,4),%eax
  imul   -0x4048(%rbp),%eax
  imul   -0x4048(%rbp),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  -0x4028(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x4028(%rbp)
  mov    -0x4048(%rbp),%eax
  cltq
  mov    -0x4010(%rbp,%rax,4),%eax
  cmp    %eax,-0x4040(%rbp)
  jge    L65
  mov    -0x4048(%rbp),%eax
  mov    %eax,-0x4044(%rbp)
  mov    -0x4048(%rbp),%eax
  cltq
  mov    -0x4010(%rbp,%rax,4),%eax
  mov    %eax,-0x4040(%rbp)
L65:
  mov    -0x4048(%rbp),%eax
  cltq
  mov    -0x4010(%rbp,%rax,4),%eax
  test   %eax,%eax
  je     L109
  mov    -0x4048(%rbp),%eax
  mov    %eax,-0x4034(%rbp)
L109:
  addl   $0x1,-0x4048(%rbp)
L1:
  cmpl   $0xfff,-0x4048(%rbp)
  jle    L38
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x405c(%rbp),%xmm1
  movsd  -0x4030(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x4020(%rbp)
  pxor   %xmm2,%xmm2
  cvtsi2sdl -0x405c(%rbp),%xmm2
  movsd  -0x4028(%rbp),%xmm0
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  -0x4020(%rbp),%xmm0
  movapd %xmm0,%xmm2
  mulsd  %xmm0,%xmm2
  subsd  %xmm2,%xmm1
  movapd %xmm1,%xmm0
  movsd  %xmm0,-0x4018(%rbp)
  mov    -0x4038(%rbp),%edi
  mov    -0x403c(%rbp),%ecx
  movsd  -0x4018(%rbp),%xmm0
  mov    -0x4020(%rbp),%rsi
  mov    -0x4040(%rbp),%edx
  mov    -0x4044(%rbp),%eax
  mov    %edi,%r8d
  movapd %xmm0,%xmm1
  movq   %rsi,%xmm0
  mov    %eax,%esi
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    -0x4010(%rbp),%rax
  mov    $0x2710,%esi
  mov    %rax,%rdi
  call   <draw_hist@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L3
  call   <__stack_chk_fail@plt>
L3:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D3
type_infered: string

tool: D3: hist max bin[%d]=%d avg=%10.3f var=%10.3f under=%d over=%d


assistant: ```c
void hist_img(short int *img, int npix) {
  int i, imax, max = 0, ufbin = 0, ofbin = 0, high = 0;
  int bins[4096];
  double sum = 0.0, sum2 = 0.0, avg, var;
  for (i = 0; i < 4096; ++i)
    bins[i] = 0;
  for (i = 0; i < npix; ++i) {
    if (*img < 0)
      ++ufbin;
    else if (*img >= 4096)
      ++ofbin;
    else
      bins[(int)*img]++;
    ++img;
  }
  for (i = 0; i < 4096; ++i) {
    sum += bins[i] * i;
    sum2 += bins[i] * i * i;
    if (bins[i] > max) {
      imax = i;
      max = bins[i];
    }
    if (bins[i] != 0)
      high = i;
  }
  avg = sum / npix;
  var = sum2 / npix - avg * avg;
  printf("hist max bin[%d]=%d avg=%10.3f var=%10.3f under=%d over=%d\n", imax, max, avg, var, ufbin, ofbin);
  draw_hist(bins, 10000);
}
```