user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<find_optimal_freq>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x368,%rsp
  mov    %esi,0x1c(%rsp)
  mov    %r8d,0x18(%rsp)
  mov    %r9,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x358(%rsp)
  xor    %eax,%eax
  test   %esi,%esi
  jne    L25
  test   %r8d,%r8d
  jle    L95
  mov    %edi,%r14d
  movslq %r8d,%r15
  xor    %r13d,%r13d
  mov    $0x186a0,%ebp
  movl   $0x0,0x8(%rsp)
  jmp    L140
  nopl   (%rax)
L24:
  add    $0x1,%r13
  cmp    %r13,%r15
  je     L73
L140:
  mov    %r14d,%edi
  sub    (%rbx,%r13,4),%edi
  call   <fabs@plt>
  cmp    %ebp,%eax
  jge    L24
  mov    %r14d,%edi
  sub    (%rbx,%r13,4),%edi
  call   <fabs@plt>
  mov    %r13d,0x8(%rsp)
  add    $0x1,%r13
  mov    %eax,%ebp
  cmp    %r13,%r15
  jne    L140
L73:
  lea    0x50(%rsp),%rbp
  xor    %eax,%eax
  mov    $0x60,%ecx
  mov    %rbx,%rdx
  mov    %rbp,%rdi
  mov    0x18(%rsp),%r14d
  mov    %rbp,%r8
  lea    0x20(%rsp),%r15
  rep stos %rax,%es:(%rdi)
  mov    0x3a0(%rsp),%esi
  mov    0x10(%rsp),%rdi
  mov    %r14d,%ecx
  call   <compute_scatter_percentage@plt>
  mov    %r12d,%ecx
  mov    %r15,%rdx
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <average_scatter_percentages@plt>
L51:
  mov    0x18(%rsp),%edx
  movss  D61(%rip),%xmm1
  xor    %eax,%eax
  xor    %ecx,%ecx
  nopl   0x0(%rax)
L68:
  movss  (%r15,%rax,4),%xmm0
  comiss %xmm1,%xmm0
  jb     L18
  movslq %eax,%rcx
  movaps %xmm0,%xmm1
L18:
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L68
  pxor   %xmm2,%xmm2
  cvtss2sd %xmm1,%xmm2
L82:
  movslq 0x8(%rsp),%rax
  pxor   %xmm0,%xmm0
  movss  0x20(%rsp,%rax,4),%xmm3
  cvtss2sd %xmm3,%xmm0
  mulsd  D74(%rip),%xmm0
  comisd %xmm2,%xmm0
  ja     L158
  subss  %xmm3,%xmm1
  movss  D20(%rip),%xmm0
  ucomiss %xmm1,%xmm0
  cmovbe %rcx,%rax
L158:
  mov    (%rbx,%rax,4),%eax
  lea    D76(%rip),%rsi
  lea    D12(%rip),%rdi
  mov    %eax,0x10(%rsp)
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L76
  movslq 0x18(%rsp),%rsi
  xor    %r13d,%r13d
  lea    D71(%rip),%r14
  mov    %rsi,0x8(%rsp)
  test   %esi,%esi
  jle    L89
  nopl   0x0(%rax)
L118:
  movss  (%r15,%r13,4),%xmm0
  mov    (%rbx,%r13,4),%ecx
  mov    %r13d,%edx
  test   %r12d,%r12d
  je     L45
  pxor   %xmm1,%xmm1
  cvtsi2ss %r13d,%xmm1
  divss  %xmm1,%xmm0
L45:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  cvtss2sd %xmm0,%xmm0
  add    $0x1,%r13
  mov    $0x1,%eax
  call   <fprintf@plt>
  cmp    %r13,0x8(%rsp)
  jne    L118
L89:
  mov    0x1c(%rsp),%edx
  lea    D119(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %r12d,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    D54(%rip),%rsi
  call   <fprintf@plt>
  mov    0x10(%rsp),%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    D97(%rip),%rsi
  call   <fprintf@plt>
  mov    $0xa,%edi
  mov    %rbp,%rsi
  call   <fputc@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
L76:
  mov    0x358(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L148
  mov    0x10(%rsp),%eax
  add    $0x368,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L25:
  lea    0x50(%rsp),%rbp
  xor    %eax,%eax
  mov    $0x60,%ecx
  mov    %rbx,%rdx
  mov    %rbp,%rdi
  mov    0x18(%rsp),%r14d
  mov    %rbp,%r8
  lea    0x20(%rsp),%r15
  rep stos %rax,%es:(%rdi)
  mov    0x3a0(%rsp),%esi
  mov    0x10(%rsp),%rdi
  mov    %r14d,%ecx
  call   <compute_scatter_percentage@plt>
  mov    %r12d,%ecx
  mov    %r15,%rdx
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <average_scatter_percentages@plt>
  movl   $0x0,0x8(%rsp)
  test   %r14d,%r14d
  jg     L51
  movsd  D0(%rip),%xmm2
  movss  D61(%rip),%xmm1
  xor    %ecx,%ecx
  jmp    L82
L95:
  lea    0x50(%rsp),%rbp
  xor    %eax,%eax
  mov    $0x60,%ecx
  mov    %rbx,%rdx
  mov    %rbp,%rdi
  mov    0x18(%rsp),%r14d
  mov    %rbp,%r8
  lea    0x20(%rsp),%r15
  rep stos %rax,%es:(%rdi)
  mov    0x3a0(%rsp),%esi
  mov    0x10(%rsp),%rdi
  mov    %r14d,%ecx
  call   <compute_scatter_percentage@plt>
  mov    %r12d,%ecx
  mov    %r15,%rdx
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <average_scatter_percentages@plt>
  movl   $0x0,0x8(%rsp)
  movsd  D0(%rip),%xmm2
  xor    %ecx,%ecx
  movss  D61(%rip),%xmm1
  jmp    L82
L148:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D61
type_infered: byte[4]
name: unpack_data
arguments: tag: D74
type_infered: f64
name: unpack_data
arguments: tag: D20
type_infered: f32
name: unpack_data
arguments: tag: D76
type_infered: string
name: unpack_data
arguments: tag: D12
type_infered: string
name: unpack_data
arguments: tag: D71
type_infered: string
name: unpack_data
arguments: tag: D119
type_infered: string
name: unpack_data
arguments: tag: D54
type_infered: string
name: unpack_data
arguments: tag: D97
type_infered: string
name: unpack_data
arguments: tag: D0
type_infered: byte[8]

tool: {"D61": [0x00,0x00,0x20,0xc1]}

tool: D74: 1.15

tool: D20: 0.75

tool: D76: w

tool: D12: /tmp/freq_search.out

tool: D71: 
%2d %d %10.7lf

tool: D119: 
Cutlass: %d

tool: D54: 
Freq Weighting: %d

tool: D97: 
Returned Frequency: %d kHz

tool: {"D0": [0x00,0x00,0x00,0x00,0x00,0x00,0x24,0xc0]}

assistant: ```c
int find_optimal_freq(int start_freq, int cutlass, int fw, int sounder_freqs[], int sft, struct sounder_struct *sounder_data, int act_snd_rec) {
  int i, j;
  int def_freq, def_freq_bin = 0;
  float iscat_percent[12][16];
  float average_iscat_percent[12];
  float max_scatter = -10;
  int max_freq_bin = 0;
  int dlf;
  FILE *out;
  if (!cutlass) {
    dlf = 100000;
    for (i = 0; i < sft; i++) {
      if (fabs(start_freq - sounder_freqs[i]) < dlf) {
        dlf = fabs(start_freq - sounder_freqs[i]);
        def_freq_bin = i;
      }
    }
  }
  for (i = 0; i < 12; i++)
    for (j = 0; j < 16; j++) {
      iscat_percent[i][j] = 0;
    }
  compute_scatter_percentage(sounder_data, act_snd_rec, sounder_freqs, sft, iscat_percent);
  average_scatter_percentages(iscat_percent, sft, average_iscat_percent, fw);
  max_scatter = -10;
  for (i = 0; i < sft; i++)
    if (average_iscat_percent[i] >= max_scatter) {
      max_scatter = average_iscat_percent[i];
      max_freq_bin = i;
    }
  if (max_scatter < 1.15 * average_iscat_percent[def_freq_bin] || (max_scatter - average_iscat_percent[def_freq_bin]) < 0.75)
    max_freq_bin = def_freq_bin;
  def_freq = sounder_freqs[max_freq_bin];
  out = fopen("/tmp/freq_search.out", "w");
  if (out != NULL) {
    for (i = 0; i < sft; i++) {
      if (!fw)
        fprintf(out, "\n%2d %d %10.7lf", i, sounder_freqs[i], average_iscat_percent[i]);
      else
        fprintf(out, "\n%2d %d %10.7lf", i, sounder_freqs[i], average_iscat_percent[i] / i);
    }
    fprintf(out, "\nCutlass: %d", cutlass);
    fprintf(out, "\nFreq Weighting: %d", fw);
    fprintf(out, "\nReturned Frequency: %d kHz", def_freq);
    fprintf(out, "\n");
    fclose(out);
  }
  return (def_freq);
}
```