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

```asm
<xcorr_range>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,%r12
  mov    %esi,0x4(%rsp)
  mov    %rdx,0x10(%rsp)
  mov    %ecx,%ebx
  mov    %r8,0x18(%rsp)
  mov    %r9d,%r14d
  movsd  %xmm0,0x8(%rsp)
  movsd  %xmm1,0x28(%rsp)
  lea    (%rcx,%r9,1),%ebp
  lea    -0x1(%rbp),%eax
  mov    %eax,(%rsp)
  cmp    %esi,%eax
  jg     L291
  mov    0x4(%rsp),%esi
  sub    (%rsp),%esi
  test   %esi,%esi
  jg     L54
L383:
  cmpl   $0x0,0x4(%rsp)
  jle    L6
  mov    %r12,%rdi
  mov    (%rsp),%r10d
  mov    0x10(%rsp),%rdx
  mov    %rdx,%rsi
  lea    -0x2(%rbp),%r11d
  lea    -0x1(%rbx),%eax
  not    %rax
  shl    $0x3,%rax
  mov    %rax,0x40(%rsp)
  movslq %ebx,%rax
  lea    0x0(,%rax,8),%rcx
  mov    %rcx,0x20(%rsp)
  add    %rcx,%rdx
  mov    %rdx,%r15
  movslq %r14d,%rdx
  lea    0x0(,%rdx,8),%r8
  mov    %r8,0x38(%rsp)
  add    %rdx,%rax
  mov    0x18(%rsp),%rcx
  mov    %rcx,%r9
  add    %r8,%r9
  lea    -0x1(%r14),%edx
  not    %rdx
  shl    $0x3,%rdx
  mov    %rdx,0x48(%rsp)
  mov    $0xfffffffffffffff8,%r8
  mov    $0x0,%edx
  movsd  D13(%rip),%xmm1
  movsd  D33(%rip),%xmm3
  movapd %xmm3,%xmm4
  movapd %xmm1,%xmm2
  lea    0x8(%rcx,%rax,8),%rax
  mov    %rax,0x30(%rsp)
  mov    %ebx,%r13d
  movsd  0x28(%rsp),%xmm5
  jmp    L37
L291:
  lea    D36(%rip),%rdi
  call   <puts@plt>
  jmp    L383
L54:
  lea    D14(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L383
L254:
  test   %edx,%edx
  js     L268
  mov    $0x0,%ecx
L324:
  movsd  (%rsi,%rcx,1),%xmm0
  mulsd  -0x8(%r9,%rcx,1),%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  sub    $0x8,%rcx
  cmp    %r8,%rcx
  jne    L324
  jmp    L268
L105:
  test   %r10d,%r10d
  jle    L268
  mov    %r11d,%ebp
  movslq %r10d,%rbx
  neg    %rbx
  shl    $0x3,%rbx
  mov    0x20(%rsp),%rcx
  lea    (%rbx,%rcx,1),%r12
  add    0x10(%rsp),%r12
  add    0x38(%rsp),%rbx
  add    0x18(%rsp),%rbx
  mov    $0x0,%ecx
  mov    %r9,0x28(%rsp)
L380:
  movsd  (%r12,%rcx,8),%xmm0
  mulsd  -0x8(%rbx,%rcx,8),%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  mov    %rcx,%r9
  add    $0x1,%rcx
  cmp    %rbp,%r9
  jne    L380
  mov    0x28(%rsp),%r9
L268:
  movsd  0x8(%rsp),%xmm6
  ucomisd %xmm1,%xmm6
  jp     L154
  ucomisd %xmm2,%xmm6
  jne    L154
L368:
  ucomisd %xmm3,%xmm5
  jp     L320
  ucomisd %xmm4,%xmm5
  jne    L320
L263:
  add    $0x1,%edx
  add    $0x8,%rdi
  sub    $0x1,%r10d
  add    $0x8,%rsi
  sub    $0x8,%r8
  sub    $0x1,%r11d
  cmp    %edx,0x4(%rsp)
  je     L245
L37:
  mov    %rdi,%rax
  movq   $0x0,(%rdi)
  cmp    %edx,(%rsp)
  jl     L263
  cmp    %r14d,%r13d
  jl     L221
  cmp    %edx,%r14d
  jg     L254
  cmp    %edx,%r13d
  jle    L105
  mov    $0x0,%ecx
  mov    0x48(%rsp),%rbx
  test   %r14d,%r14d
  jle    L268
L32:
  movsd  (%rsi,%rcx,1),%xmm0
  mulsd  -0x8(%r9,%rcx,1),%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  sub    $0x8,%rcx
  cmp    %rbx,%rcx
  jne    L32
  jmp    L268
L221:
  cmp    %edx,%r13d
  jg     L66
  cmp    %edx,%r14d
  jle    L187
  mov    0x30(%rsp),%rbx
  add    %r8,%rbx
  mov    $0x0,%ecx
  mov    0x40(%rsp),%rbp
  test   %r13d,%r13d
  jle    L268
L335:
  movsd  -0x8(%r15,%rcx,1),%xmm0
  mulsd  -0x10(%rbx,%rcx,1),%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  sub    $0x8,%rcx
  cmp    %rbp,%rcx
  jne    L335
  jmp    L268
L66:
  test   %edx,%edx
  js     L268
  mov    $0x0,%ecx
L147:
  movsd  (%rsi,%rcx,1),%xmm0
  mulsd  -0x8(%r9,%rcx,1),%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  sub    $0x8,%rcx
  cmp    %r8,%rcx
  jne    L147
  jmp    L268
L187:
  test   %r10d,%r10d
  jle    L268
  mov    %r11d,%r12d
  movslq %r10d,%rcx
  neg    %rcx
  mov    0x20(%rsp),%rbx
  lea    (%rbx,%rcx,8),%rbp
  add    0x10(%rsp),%rbp
  mov    $0x0,%ecx
  mov    %r9,0x28(%rsp)
  mov    0x18(%rsp),%rbx
L204:
  movsd  0x0(%rbp,%rcx,8),%xmm0
  mulsd  (%rbx,%rcx,8),%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  mov    %rcx,%r9
  add    $0x1,%rcx
  cmp    %r12,%r9
  jne    L204
  mov    0x28(%rsp),%r9
  jmp    L268
L154:
  movsd  (%rax),%xmm0
  comisd 0x8(%rsp),%xmm0
  jbe    L368
  jmp    L49
L320:
  comisd (%rax),%xmm5
  jbe    L263
  jmp    L49
L245:
  mov    $0x0,%edx
L49:
  mov    %edx,%eax
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L6:
  mov    $0x0,%edx
  jmp    L49
```

tool_calls: name: retrieve_data
arguments: data_tag: D13
datatype: f32[2]
name: retrieve_data
arguments: data_tag: D33
datatype: f32[2]
name: retrieve_data
arguments: data_tag: D36
datatype: string
name: retrieve_data
arguments: data_tag: D14
datatype: string

tool: {"D13": [0.0,-7.499969482421875]}

tool: {"D33": [0.0,7.4999542236328125]}

tool: D36: [xcorr] output vector is shorter than which it was expected

tool: D14: [xcorr] output vector has %d dummy values at the end of it


assistant: ```c
int xcorr_range(double *output, int len_output, double *rev, int len_rev, double *local, int len_local, double max_threshold, double min_threshold) {
  int len_out = len_rev + len_local - 1;
  int oBuff;
  int len_win;
  int i;
  int len_dummy;
  if (len_output < len_out)
    printf("[xcorr] output vector is shorter than which it was expected\n");
  else if ((len_dummy = len_output - len_out) > 0)
    printf("[xcorr] output vector has %d dummy values at the end of it\n", len_dummy);
  for (oBuff = 0; oBuff < len_output; oBuff++) {
    output[oBuff] = 0.;
    if (oBuff > len_out)
      continue;
    if (len_rev >= len_local) {
      if (oBuff < len_local) {
        len_win = oBuff;
        for (i = 0; i <= oBuff; i++)
          output[oBuff] += rev[len_win - i] * local[len_local - 1 - i];
      } else if (oBuff >= len_rev) {
        len_win = len_out - oBuff;
        for (i = 0; i < len_win; i++)
          output[oBuff] += rev[len_rev - len_win + i] * local[len_local - len_win - 1 + i];
      } else {
        len_win = len_local;
        for (i = 0; i < len_win; i++)
          output[oBuff] += rev[oBuff - i] * local[len_win - 1 - i];
      }
    } else {
      if (oBuff < len_rev) {
        len_win = oBuff;
        for (i = 0; i <= len_win; i++)
          output[oBuff] += rev[len_win - i] * local[len_local - 1 - i];
      } else if (oBuff >= len_local) {
        len_win = len_out - oBuff;
        for (i = 0; i < len_win; i++)
          output[oBuff] += rev[len_rev - len_win + i] * local[i];
      } else {
        len_win = len_rev;
        for (i = 0; i < len_win; i++)
          output[oBuff] += rev[len_win - 1 - i] * local[len_local - 1 - (oBuff + 1 - len_rev) - i];
      }
    }
    if ((max_threshold != -65534 && output[oBuff] > max_threshold) || (min_threshold != 65533 && output[oBuff] < min_threshold))
      return oBuff;
  }
  return 0;
}
```