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

```asm
<print_spectrum>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  lea    D43(%rip),%rdi
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x28,%rsp
  mov    %edx,0x1c(%rsp)
  call   <puts@plt>
  mov    %rbp,%rsi
  lea    D148(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r15,%rax
  lea    0x400(%r15),%rcx
  nopl   (%rax)
L26:
  mov    (%rax),%edx
  cmp    %edx,%ebx
  cmovl  %edx,%ebx
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L26
  movl   $0x0,0x8(%rsp)
  xor    %r14d,%r14d
  xor    %r12d,%r12d
  jmp    L53
  nopl   0x0(%rax,%rax,1)
L7:
  lea    D68(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movsd  (%rsp),%xmm2
L31:
  movapd %xmm2,%xmm0
  mov    $0x2,%eax
  movsd  D156(%rip),%xmm1
  lea    D40(%rip),%rdi
  movsd  %xmm2,0x10(%rsp)
  mulsd  %xmm2,%xmm1
  divsd  D96(%rip),%xmm1
  call   <printf@plt>
  mov    %r13d,%esi
  pxor   %xmm3,%xmm3
  cvtsi2sd %r13d,%xmm3
  movsd  D156(%rip),%xmm0
  mov    $0x1,%eax
  lea    D91(%rip),%rdi
  mulsd  %xmm3,%xmm0
  movsd  %xmm3,0x8(%rsp)
  divsd  D96(%rip),%xmm0
  call   <printf@plt>
  mov    %r14d,%esi
  pxor   %xmm1,%xmm1
  cvtsi2sd %r14d,%xmm1
  movsd  D156(%rip),%xmm0
  mov    $0x1,%eax
  lea    D7(%rip),%rdi
  mulsd  %xmm1,%xmm0
  movsd  %xmm1,(%rsp)
  divsd  D96(%rip),%xmm0
  call   <printf@plt>
  movsd  0x10(%rsp),%xmm2
  movsd  (%rsp),%xmm1
  movsd  0x8(%rsp),%xmm3
  lea    D42(%rip),%rdi
  mov    $0x1,%eax
  subsd  %xmm2,%xmm1
  movapd %xmm1,%xmm0
  movapd %xmm2,%xmm1
  subsd  %xmm3,%xmm1
  maxsd  %xmm0,%xmm1
  movsd  D41(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  divsd  %xmm2,%xmm0
  call   <printf@plt>
L19:
  add    $0x1,%r14
  movl   $0x0,0x8(%rsp)
  lea    0x2(%rbp),%r13d
  xor    %r12d,%r12d
  cmp    $0xc7,%r14
  je     L85
L53:
  mov    0x4(%r15,%r14,4),%edx
  lea    0x1(%r14),%eax
  mov    %r14d,%ebp
  mov    %eax,0x10(%rsp)
  test   %edx,%edx
  jg     L56
  test   %r12d,%r12d
  jle    L19
  pxor   %xmm2,%xmm2
  pxor   %xmm0,%xmm0
  mov    0x1c(%rsp),%eax
  cvtsi2ssl 0x8(%rsp),%xmm2
  cvtsi2ss %r12d,%xmm0
  test   %eax,%eax
  divss  %xmm0,%xmm2
  cvtss2sd %xmm2,%xmm2
  movsd  %xmm2,(%rsp)
  jne    L7
  lea    D87(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movsd  (%rsp),%xmm2
  jmp    L31
  nopw   0x0(%rax,%rax,1)
L56:
  mov    %eax,%esi
  lea    D74(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x4(%r15,%r14,4),%esi
  imul   $0x3c,%esi,%eax
  cltd
  idiv   %ebx
  mov    %eax,(%rsp)
  test   %eax,%eax
  jle    L14
  xor    %ebp,%ebp
  nopl   0x0(%rax)
L55:
  mov    $0x6f,%edi
  add    $0x1,%ebp
  call   <putchar@plt>
  cmp    %ebp,(%rsp)
  jne    L55
  mov    0x4(%r15,%r14,4),%esi
L14:
  lea    D59(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x4(%r15,%r14,4),%edx
  mov    0x10(%rsp),%eax
  add    $0x1,%r14
  imul   %edx,%eax
  add    %edx,%r12d
  add    %eax,0x8(%rsp)
  cmp    $0xc7,%r14
  jne    L53
L85:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: data_tag: D43
type: string
name: read_data
arguments: data_tag: D148
type: string
name: read_data
arguments: data_tag: D68
type: string
name: read_data
arguments: data_tag: D156
type: f64
name: read_data
arguments: data_tag: D40
type: string
name: read_data
arguments: data_tag: D96
type: f32[2]
name: read_data
arguments: data_tag: D91
type: string
name: read_data
arguments: data_tag: D7
type: string
name: read_data
arguments: data_tag: D42
type: string
name: read_data
arguments: data_tag: D41
type: f32[2]
name: read_data
arguments: data_tag: D87
type: string
name: read_data
arguments: data_tag: D74
type: string
name: read_data
arguments: data_tag: D59
type: string

tool: D43: -------------------------------------------------------------------------------

tool: D148: %s:


tool: D68: pulse 

tool: D156: 1000000

tool: D40: avg: %4.1f=%6.1f us, 

tool: {"D96": [0.0,6.6103515625]}

tool: D91: min: %2d=%6.1f us, 

tool: D7: max: %2d=%6.1f us, 

tool: D42: tol: %4.1f%%


tool: {"D41": [0.0,3.390625]}

tool: D87: pause 

tool: D74: %3d 

tool: D59:  %d


assistant: ```c
void print_spectrum(char *text, int *buf, int is_pulse) {
  int i;
  int j;
  int min;
  int max;
  int max_value = 0;
  int value;
  int sum = 0;
  int counter = 0;
  double average = 0;
  double tolerance;
  puts("-------------------------------------------------------------------------------");
  printf("%s:\n", text);
  for (i = 0; i < 256; i++) {
    if (buf[i] > max_value) {
      max_value = buf[i];
    }
  }
  for (i = 1; i < 200; i++) {
    if (buf[i] > 0) {
      printf("%3d ", i);
      value = (buf[i] * 60) / max_value;
      for (j = 0; j < value; j++) {
        putchar('o');
      }
      printf(" %d\n", buf[i]);
      sum += i * buf[i];
      counter += buf[i];
    } else {
      max = i - 1;
      if (counter > 0) {
        average = (float)sum / (float)counter;
        if (is_pulse) {
          printf("pulse ");
        } else {
          printf("pause ");
        }
        printf("avg: %4.1f=%6.1f us, ", average, (1000000. * average) / (float)20000);
        printf("min: %2d=%6.1f us, ", min, (1000000. * min) / (float)20000);
        printf("max: %2d=%6.1f us, ", max, (1000000. * max) / (float)20000);
        tolerance = (max - average);
        if (average - min > tolerance) {
          tolerance = average - min;
        }
        tolerance = tolerance * 100 / average;
        printf("tol: %4.1f%%\n", tolerance);
      }
      counter = 0;
      sum = 0;
      min = i + 1;
    }
  }
}
```