user: What would the C source look like for the assembly code provided here?

```asm
<print_spectrum>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  lea    D141(%rip),%rdi
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x28,%rsp
  mov    %edx,0x1c(%rsp)
  call   <puts@plt>
  mov    %rbp,%rsi
  lea    D102(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r15,%rax
  lea    0x400(%r15),%rcx
  nopl   (%rax)
L24:
  mov    (%rax),%edx
  cmp    %edx,%ebx
  cmovl  %edx,%ebx
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L24
  movl   $0x0,0x8(%rsp)
  xor    %r14d,%r14d
  xor    %r12d,%r12d
  jmp    L92
  nopl   0x0(%rax,%rax,1)
L15:
  lea    D125(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movsd  (%rsp),%xmm2
L94:
  movapd %xmm2,%xmm0
  mov    $0x2,%eax
  movsd  D128(%rip),%xmm1
  lea    D50(%rip),%rdi
  movsd  %xmm2,0x10(%rsp)
  mulsd  %xmm2,%xmm1
  divsd  D38(%rip),%xmm1
  call   <printf@plt>
  mov    %r13d,%esi
  pxor   %xmm3,%xmm3
  cvtsi2sd %r13d,%xmm3
  movsd  D128(%rip),%xmm0
  mov    $0x1,%eax
  lea    D56(%rip),%rdi
  mulsd  %xmm3,%xmm0
  movsd  %xmm3,0x8(%rsp)
  divsd  D38(%rip),%xmm0
  call   <printf@plt>
  mov    %r14d,%esi
  pxor   %xmm1,%xmm1
  cvtsi2sd %r14d,%xmm1
  movsd  D128(%rip),%xmm0
  mov    $0x1,%eax
  lea    D43(%rip),%rdi
  mulsd  %xmm1,%xmm0
  movsd  %xmm1,(%rsp)
  divsd  D38(%rip),%xmm0
  call   <printf@plt>
  movsd  0x10(%rsp),%xmm2
  movsd  (%rsp),%xmm1
  movsd  0x8(%rsp),%xmm3
  lea    D76(%rip),%rdi
  mov    $0x1,%eax
  subsd  %xmm2,%xmm1
  movapd %xmm1,%xmm0
  movapd %xmm2,%xmm1
  subsd  %xmm3,%xmm1
  maxsd  %xmm0,%xmm1
  movsd  D122(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  divsd  %xmm2,%xmm0
  call   <printf@plt>
L27:
  add    $0x1,%r14
  movl   $0x0,0x8(%rsp)
  lea    0x2(%rbp),%r13d
  xor    %r12d,%r12d
  cmp    $0x63,%r14
  je     L82
L92:
  mov    0x4(%r15,%r14,4),%edx
  lea    0x1(%r14),%eax
  mov    %r14d,%ebp
  mov    %eax,0x10(%rsp)
  test   %edx,%edx
  jg     L65
  test   %r12d,%r12d
  jle    L27
  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    L15
  lea    D168(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movsd  (%rsp),%xmm2
  jmp    L94
  nop
L65:
  mov    %eax,%esi
  lea    D146(%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    L91
  xor    %ebp,%ebp
  nopl   0x0(%rax)
L16:
  mov    $0x6f,%edi
  add    $0x1,%ebp
  call   <putchar@plt>
  cmp    %ebp,(%rsp)
  jne    L16
  mov    0x4(%r15,%r14,4),%esi
L91:
  lea    D5(%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    $0x63,%r14
  jne    L92
L82:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: data_tag: D141
data_type: string
name: read_data
arguments: data_tag: D102
data_type: string
name: read_data
arguments: data_tag: D125
data_type: string
name: read_data
arguments: data_tag: D128
data_type: f64
name: read_data
arguments: data_tag: D50
data_type: string
name: read_data
arguments: data_tag: D38
data_type: f32[2]
name: read_data
arguments: data_tag: D56
data_type: string
name: read_data
arguments: data_tag: D43
data_type: string
name: read_data
arguments: data_tag: D76
data_type: string
name: read_data
arguments: data_tag: D122
data_type: f32[2]
name: read_data
arguments: data_tag: D168
data_type: string
name: read_data
arguments: data_tag: D146
data_type: string
name: read_data
arguments: data_tag: D5
data_type: string

tool: D141: -------------------------------------------------------------------------------

tool: D102: %s:


tool: D125: pulse 

tool: D128: 1000000

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

tool: {"D38": [0.0,6.41552734375]}

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

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

tool: D76: tol: %4.1f%%


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

tool: D168: pause 

tool: D146: %3d 

tool: D5:  %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 < 100; 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)15000);
        printf("min: %2d=%6.1f us, ", min, (1000000. * min) / (float)15000);
        printf("max: %2d=%6.1f us, ", max, (1000000. * max) / (float)15000);
        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;
    }
  }
}
```