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

```asm
<nth>:
  endbr64
  movaps %xmm0,%xmm4
  lea    -0x1(%rdi),%eax
  pxor   %xmm0,%xmm0
  push   %rbx
  cvtsi2ss %eax,%xmm0
  mov    %edi,%r8d
  mov    %rsi,%rbx
  sub    $0x10,%rsp
  comiss %xmm0,%xmm4
  jae    L187
  cmp    $0x1,%edi
  je     L256
  pxor   %xmm3,%xmm3
  nopl   0x0(%rax,%rax,1)
L71:
  comiss %xmm4,%xmm3
  movss  (%rbx),%xmm1
  ja     L256
  cmp    $0x2,%r8d
  jle    L223
  mov    %r8d,%edx
  mov    $0x1,%edi
  mov    $0x1,%eax
  jmp    L249
  xchg   %ax,%ax
L166:
  movslq %edx,%rsi
  sub    $0x1,%edx
  lea    -0x4(%rbx,%rsi,4),%rsi
  movss  (%rsi),%xmm2
  movss  %xmm2,(%rcx)
  movss  %xmm0,(%rsi)
L58:
  cmp    %eax,%edx
  jle    L143
L249:
  movslq %eax,%rcx
  lea    (%rbx,%rcx,4),%rcx
  movss  (%rcx),%xmm0
  comiss %xmm1,%xmm0
  ja     L166
  add    $0x1,%eax
  ucomiss %xmm1,%xmm0
  jp     L58
  jne    L58
  movslq %edi,%rsi
  add    $0x1,%edi
  lea    (%rbx,%rsi,4),%rsi
  movss  (%rsi),%xmm2
  movss  %xmm2,(%rcx)
  movss  %xmm0,(%rsi)
  cmp    %eax,%edx
  jg     L249
L143:
  mov    %edx,%r9d
  sub    %edi,%r9d
  cmp    %r8d,%edx
  je     L210
  lea    -0x1(%r9),%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  comiss %xmm4,%xmm0
  jbe    L87
  movslq %edi,%rdi
  mov    %r9d,%r8d
  lea    (%rbx,%rdi,4),%rbx
L227:
  comiss %xmm0,%xmm4
  jae    L187
L102:
  cmp    $0x1,%r8d
  jne    L71
L256:
  movss  (%rbx),%xmm1
L44:
  add    $0x10,%rsp
  movaps %xmm1,%xmm0
  pop    %rbx
  ret
  nopl   0x0(%rax)
L210:
  pxor   %xmm0,%xmm0
  cvtsi2ss %r9d,%xmm0
  comiss %xmm0,%xmm4
  jae    L44
  lea    -0x1(%r9),%eax
  pxor   %xmm0,%xmm0
  movslq %edi,%rdi
  cvtsi2ss %eax,%xmm0
  lea    (%rbx,%rdi,4),%rsi
  comiss %xmm4,%xmm0
  jbe    L181
  comiss %xmm0,%xmm4
  mov    %rsi,%rbx
  mov    %r9d,%r8d
  jb     L102
L187:
  movslq %r8d,%r8
  movss  -0x4(%rbx,%r8,4),%xmm1
  add    $0x10,%rsp
  pop    %rbx
  movaps %xmm1,%xmm0
  ret
L87:
  pxor   %xmm2,%xmm2
  cvtsi2ss %r9d,%xmm2
  comiss %xmm4,%xmm2
  ja     L32
  lea    -0x1(%rdx),%eax
  pxor   %xmm2,%xmm2
  cvtsi2ss %eax,%xmm2
  comiss %xmm4,%xmm2
  jae    L44
  pxor   %xmm0,%xmm0
  sub    %edx,%r8d
  movslq %edx,%rax
  cvtsi2ss %edx,%xmm0
  lea    (%rbx,%rax,4),%rsi
  comiss %xmm4,%xmm0
  ja     L126
  subss  %xmm0,%xmm4
  lea    -0x1(%r8),%eax
  pxor   %xmm0,%xmm0
  mov    %rsi,%rbx
  cvtsi2ss %eax,%xmm0
  jmp    L227
L223:
  movss  0x4(%rbx),%xmm0
  movsd  D25(%rip),%xmm3
  pxor   %xmm2,%xmm2
  cvtss2sd %xmm4,%xmm2
  comiss %xmm1,%xmm0
  subsd  %xmm2,%xmm3
  jbe    L204
  mulss  %xmm4,%xmm0
  cvtss2sd %xmm1,%xmm1
  mulsd  %xmm3,%xmm1
  cvtss2sd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cvtsd2ss %xmm1,%xmm1
  jmp    L44
L204:
  mulss  %xmm4,%xmm1
  pxor   %xmm2,%xmm2
  cvtss2sd %xmm0,%xmm2
  mulsd  %xmm3,%xmm2
  cvtss2sd %xmm1,%xmm1
  addsd  %xmm2,%xmm1
  cvtsd2ss %xmm1,%xmm1
  jmp    L44
L181:
  subss  %xmm0,%xmm4
  movss  %xmm4,(%rsp)
L119:
  mov    %r9d,%edi
  call   <floatmax@plt>
  movss  (%rsp),%xmm1
  pxor   %xmm0,%xmm0
  movsd  D25(%rip),%xmm2
  cvtsi2sd %eax,%xmm0
  pxor   %xmm3,%xmm3
  cvtss2sd %xmm1,%xmm3
  subsd  %xmm3,%xmm2
  mulss  (%rbx),%xmm1
  add    $0x10,%rsp
  pop    %rbx
  mulsd  %xmm2,%xmm0
  cvtss2sd %xmm1,%xmm1
  addsd  %xmm0,%xmm1
  cvtsd2ss %xmm1,%xmm1
  movaps %xmm1,%xmm0
  ret
L32:
  subss  %xmm0,%xmm4
  movslq %edi,%rdi
  lea    (%rbx,%rdi,4),%rsi
  movss  %xmm4,(%rsp)
  jmp    L119
L126:
  subss  %xmm2,%xmm4
  pxor   %xmm3,%xmm3
  pxor   %xmm2,%xmm2
  mov    %r8d,%edi
  movsd  D25(%rip),%xmm0
  cvtss2sd (%rbx),%xmm2
  cvtss2sd %xmm4,%xmm3
  subsd  %xmm3,%xmm0
  movss  %xmm4,0xc(%rsp)
  mulsd  %xmm0,%xmm2
  movsd  %xmm2,(%rsp)
  call   <floatmin@plt>
  movss  0xc(%rsp),%xmm1
  mulss  %xmm0,%xmm1
  cvtss2sd %xmm1,%xmm1
  addsd  (%rsp),%xmm1
  cvtsd2ss %xmm1,%xmm1
  jmp    L44
```

tool_calls: name: retrieve_data
arguments: label: D25
type_guessed: f64

tool: D25: 1

assistant: ```c
float nth(int ndat, float *dat, float n) {
  float a, temp;
  int i, nmax;
  float s;
  int nsame;
  if (n >= ndat - 1)
    return dat[ndat - 1];
  if (ndat == 1 || n < 0)
    return dat[0];
  if (ndat <= 2) {
    if (dat[0] < dat[1])
      return (dat[0] * (1. - n) + n * dat[1]);
    else
      return (dat[1] * (1. - n) + n * dat[0]);
  }
  a = dat[0];
  nmax = ndat;
  nsame = 1;
  for (i = 1; i < nmax; i++) {
    if (dat[i] > a) {
      temp = dat[i];
      dat[i] = dat[nmax - 1];
      dat[nmax - 1] = temp;
      nmax--;
      i--;
    } else if (dat[i] == a) {
      temp = dat[i];
      dat[i] = dat[nsame];
      dat[nsame] = temp;
      nsame++;
    }
  }
  if (nmax == ndat) {
    if (nmax - nsame <= n) {
      return a;
    } else if (nmax - nsame - 1 > n) {
      return nth(nmax - nsame, dat + nsame, n);
    } else {
      s = n - (nmax - nsame - 1);
      return (floatmax(nmax - nsame, dat + nsame) * (1. - s) + s * dat[0]);
    }
  }
  if (n < nmax - nsame - 1) {
    return nth(nmax - nsame, dat + nsame, n);
  } else if (n < nmax - nsame) {
    s = n - (nmax - nsame - 1);
    return (floatmax(nmax - nsame, dat + nsame) * (1. - s) + s * dat[0]);
  } else if (n <= nmax - 1) {
    return a;
  } else if (n < nmax) {
    s = n - (nmax - 1);
    return (dat[0] * (1. - s) + s * floatmin(ndat - nmax, dat + nmax));
  } else {
    return nth(ndat - nmax, dat + nmax, n - nmax);
  }
}
```