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

```asm
<rtsafe>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %rdi,%rbp
  movss  %xmm0,0x14(%rsp)
  movss  %xmm1,0x10(%rsp)
  movss  %xmm2,0x1c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x28(%rsp),%rbx
  lea    0x34(%rsp),%rdi
  mov    %rbx,%rsi
  call   *%rbp
  lea    0x30(%rsp),%rdi
  mov    %rbx,%rsi
  movss  0x10(%rsp),%xmm0
  call   *%rbp
  movss  0x34(%rsp),%xmm0
  comiss D35(%rip),%xmm0
  jbe    L180
  movss  0x30(%rsp),%xmm1
  comiss D35(%rip),%xmm1
  jbe    L132
L138:
  lea    D37(%rip),%rdi
  call   <nrerror@plt>
L238:
  movss  0x34(%rsp),%xmm0
  ucomiss D35(%rip),%xmm0
  jp     L86
  movss  0x14(%rsp),%xmm2
  movss  %xmm2,0x4(%rsp)
  je     L49
L86:
  pxor   %xmm1,%xmm1
  ucomiss 0x30(%rsp),%xmm1
  jp     L79
  movss  0x10(%rsp),%xmm3
  movss  %xmm3,0x4(%rsp)
  je     L49
L79:
  pxor   %xmm1,%xmm1
  comiss %xmm0,%xmm1
  ja     L42
  movss  0x10(%rsp),%xmm5
  movss  %xmm5,0xc(%rsp)
  movss  0x14(%rsp),%xmm3
  movss  %xmm3,0x8(%rsp)
L122:
  movss  0x14(%rsp),%xmm2
  movaps %xmm2,%xmm0
  movss  0x10(%rsp),%xmm5
  addss  %xmm5,%xmm0
  mulss  D56(%rip),%xmm0
  movss  %xmm0,0x4(%rsp)
  subss  %xmm2,%xmm5
  movaps %xmm5,%xmm0
  call   <fabs@plt>
  movss  %xmm0,0x14(%rsp)
  lea    0x28(%rsp),%rsi
  lea    0x2c(%rsp),%rdi
  movss  0x4(%rsp),%xmm0
  call   *%rbp
  movss  0x14(%rsp),%xmm2
  movss  %xmm2,0x18(%rsp)
  mov    $0x64,%ebx
  lea    0x28(%rsp),%r12
  jmp    L63
L180:
  pxor   %xmm1,%xmm1
  comiss %xmm0,%xmm1
  jbe    L238
L32:
  pxor   %xmm1,%xmm1
  comiss 0x30(%rsp),%xmm1
  jbe    L86
  jmp    L138
L42:
  movss  0x14(%rsp),%xmm5
  movss  %xmm5,0xc(%rsp)
  movss  0x10(%rsp),%xmm2
  movss  %xmm2,0x8(%rsp)
  jmp    L122
L74:
  movss  0x8(%rsp),%xmm0
  movss  0xc(%rsp),%xmm7
  subss  %xmm7,%xmm0
  mulss  D56(%rip),%xmm0
  movaps %xmm0,%xmm4
  movss  %xmm0,0x10(%rsp)
  addss  %xmm7,%xmm4
  movss  %xmm4,0x4(%rsp)
  ucomiss %xmm7,%xmm4
  jp     L148
  je     L49
L148:
  movss  0x10(%rsp),%xmm0
  call   <fabs@plt>
  movss  0x1c(%rsp),%xmm3
  comiss %xmm0,%xmm3
  ja     L49
  lea    0x2c(%rsp),%rdi
  mov    %r12,%rsi
  movss  0x4(%rsp),%xmm0
  call   *%rbp
  movss  0x2c(%rsp),%xmm0
  cmpltss D35(%rip),%xmm0
  movss  0x8(%rsp),%xmm1
  andps  %xmm0,%xmm1
  movss  0x4(%rsp),%xmm6
  andnps %xmm6,%xmm0
  orps   %xmm1,%xmm0
  movss  %xmm0,0x8(%rsp)
  movss  0x2c(%rsp),%xmm0
  cmpltss D35(%rip),%xmm0
  andps  %xmm0,%xmm6
  movss  0xc(%rsp),%xmm5
  andnps %xmm5,%xmm0
  orps   %xmm6,%xmm0
  movss  %xmm0,0xc(%rsp)
  movss  0x14(%rsp),%xmm3
  movss  %xmm3,0x18(%rsp)
  sub    $0x1,%ebx
  je     L112
  movss  0x10(%rsp),%xmm5
  movss  %xmm5,0x14(%rsp)
L63:
  movss  0x28(%rsp),%xmm3
  movss  0x2c(%rsp),%xmm0
  movss  0x4(%rsp),%xmm5
  movaps %xmm5,%xmm1
  subss  0x8(%rsp),%xmm1
  mulss  %xmm3,%xmm1
  subss  %xmm0,%xmm1
  subss  0xc(%rsp),%xmm5
  movaps %xmm5,%xmm2
  mulss  %xmm3,%xmm2
  subss  %xmm0,%xmm2
  mulss  %xmm2,%xmm1
  pxor   %xmm3,%xmm3
  comiss %xmm3,%xmm1
  ja     L74
  addss  %xmm0,%xmm0
  call   <fabs@plt>
  movss  %xmm0,0x10(%rsp)
  movss  0x18(%rsp),%xmm2
  mulss  0x28(%rsp),%xmm2
  movaps %xmm2,%xmm0
  call   <fabs@plt>
  movss  0x10(%rsp),%xmm2
  comiss %xmm0,%xmm2
  ja     L74
  movss  0x2c(%rsp),%xmm0
  movaps %xmm0,%xmm6
  divss  0x28(%rsp),%xmm6
  movss  %xmm6,0x10(%rsp)
  movss  0x4(%rsp),%xmm3
  movaps %xmm3,%xmm0
  subss  %xmm6,%xmm0
  ucomiss %xmm3,%xmm0
  jp     L173
  je     L142
L173:
  movss  %xmm0,0x4(%rsp)
  jmp    L148
L112:
  lea    D84(%rip),%rdi
  call   <nrerror@plt>
  pxor   %xmm3,%xmm3
  movss  %xmm3,0x4(%rsp)
L49:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L16
  movss  0x4(%rsp),%xmm0
  add    $0x40,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L142:
  movss  %xmm0,0x4(%rsp)
  jmp    L49
L132:
  pxor   %xmm1,%xmm1
  comiss %xmm0,%xmm1
  jbe    L86
  jmp    L32
L16:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D35
type: f32
name: disassemble_data
arguments: data_tag: D37
type: string
name: disassemble_data
arguments: data_tag: D56
type: f32
name: disassemble_data
arguments: data_tag: D84
type: string

tool: D35: 0

tool: D37: Root must be bracketed in rtsafe

tool: D56: 0.5

tool: D84: Maximum number of iterations exceeded in rtsafe

assistant: ```c
float rtsafe(void (*funcd)(float, float *, float *), float x1, float x2, float xacc) {
  void nrerror(char error_text[]);
  int j;
  float df, dx, dxold, f, fh, fl;
  float temp, xh, xl, rts;
  (*funcd)(x1, &fl, &df);
  (*funcd)(x2, &fh, &df);
  if ((fl > 0.0 && fh > 0.0) || (fl < 0.0 && fh < 0.0))
    nrerror("Root must be bracketed in rtsafe");
  if (fl == 0.0)
    return x1;
  if (fh == 0.0)
    return x2;
  if (fl < 0.0) {
    xl = x1;
    xh = x2;
  } else {
    xh = x1;
    xl = x2;
  }
  rts = 0.5 * (x1 + x2);
  dxold = fabs(x2 - x1);
  dx = dxold;
  (*funcd)(rts, &f, &df);
  for (j = 1; j <= 100; j++) {
    if ((((rts - xh) * df - f) * ((rts - xl) * df - f) > 0.0) || (fabs(2.0 * f) > fabs(dxold * df))) {
      dxold = dx;
      dx = 0.5 * (xh - xl);
      rts = xl + dx;
      if (xl == rts)
        return rts;
    } else {
      dxold = dx;
      dx = f / df;
      temp = rts;
      rts -= dx;
      if (temp == rts)
        return rts;
    }
    if (fabs(dx) < xacc)
      return rts;
    (*funcd)(rts, &f, &df);
    if (f < 0.0)
      xl = rts;
    else
      xh = rts;
  }
  nrerror("Maximum number of iterations exceeded in rtsafe");
  return 0.0;
}
```