user: Please show me the C implementation that matches the assembly code listed below:

```asm
<spectral_median>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %esi,-0x4c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0x4c(%rbp),%eax
  add    $0x1,%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x28(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  movslq %eax,%rdx
  mov    %rdx,%r8
  mov    $0x0,%r9d
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L66:
  cmp    %rdx,%rsp
  je     L98
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L66
L98:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L14
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L14:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x4c(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x48(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  movl   $0x0,-0x34(%rbp)
  jmp    L106
L109:
  mov    -0x34(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x30(%rbp)
  jmp    L24
L40:
  mov    -0x20(%rbp),%rax
  mov    -0x30(%rbp),%edx
  movslq %edx,%rdx
  movss  (%rax,%rdx,4),%xmm1
  mov    -0x20(%rbp),%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  movss  (%rax,%rdx,4),%xmm0
  comiss %xmm1,%xmm0
  jbe    L52
  mov    -0x20(%rbp),%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  movss  (%rax,%rdx,4),%xmm0
  movss  %xmm0,-0x2c(%rbp)
  mov    -0x20(%rbp),%rax
  mov    -0x30(%rbp),%edx
  movslq %edx,%rdx
  movss  (%rax,%rdx,4),%xmm0
  mov    -0x20(%rbp),%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  movss  %xmm0,(%rax,%rdx,4)
  mov    -0x20(%rbp),%rax
  mov    -0x30(%rbp),%edx
  movslq %edx,%rdx
  movss  -0x2c(%rbp),%xmm0
  movss  %xmm0,(%rax,%rdx,4)
L52:
  addl   $0x1,-0x30(%rbp)
L24:
  mov    -0x30(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jle    L40
  addl   $0x1,-0x34(%rbp)
L106:
  mov    -0x34(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L109
  mov    -0x4c(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L71
  mov    -0x4c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  movslq %edx,%rdx
  movss  (%rax,%rdx,4),%xmm1
  mov    -0x4c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  lea    -0x1(%rax),%edx
  mov    -0x20(%rbp),%rax
  movslq %edx,%rdx
  movss  (%rax,%rdx,4),%xmm0
  addss  %xmm1,%xmm0
  movss  D0(%rip),%xmm1
  divss  %xmm1,%xmm0
  jmp    L38
L71:
  mov    -0x4c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  movslq %edx,%rdx
  movss  (%rax,%rdx,4),%xmm0
L38:
  mov    %rbx,%rsp
  mov    -0x18(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L13
  call   <__stack_chk_fail@plt>
L13:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D0
datatype: byte[4]

tool: {"D0": [0x00,0x00,0x00,0x40]}

assistant: ```c
float spectral_median(float *x, int n) {
  float temp;
  int i, j;
  float tmp[n + 1];
  memcpy(tmp, x, sizeof(float) * (n + 1));
  for (i = 0; i < n; i++) {
    for (j = i + 1; j <= n; j++) {
      if (tmp[j] < tmp[i]) {
        temp = tmp[i];
        tmp[i] = tmp[j];
        tmp[j] = temp;
      }
    }
  }
  if (n % 2 == 0) {
    return ((tmp[n / 2] + tmp[n / 2 - 1]) / 2.f);
  } else {
    return tmp[n / 2];
  }
}
```