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

```asm
<my_lnsrch>:
  endbr64
  push   %r15
  movapd %xmm0,%xmm6
  mov    %rsi,%r15
  push   %r14
  mov    %edi,%r14d
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  push   %rbx
  mov    %r9,%rbx
  sub    $0x68,%rsp
  mov    0xa0(%rsp),%rax
  movl   $0x0,(%rax)
  test   %edi,%edi
  jle    L121
  lea    0x8(%rcx),%rsi
  lea    -0x1(%rdi),%edi
  pxor   %xmm7,%xmm7
  mov    %rdx,%rbp
  lea    0x10(%rcx),%rcx
  mov    %rdi,%r13
  mov    %rsi,%rax
  movsd  %xmm7,0x38(%rsp)
  lea    (%rcx,%rdi,8),%rdi
  movapd %xmm7,%xmm4
  xchg   %ax,%ax
L285:
  movsd  (%rax),%xmm0
  add    $0x8,%rax
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm4
  cmp    %rax,%rdi
  jne    L285
  movsd  0x38(%rsp),%xmm7
  ucomisd %xmm4,%xmm7
  ja     L203
  sqrtsd %xmm4,%xmm4
  comisd %xmm2,%xmm4
  ja     L26
L265:
  mov    $0x1,%eax
  pxor   %xmm4,%xmm4
  nopl   0x0(%rax)
L252:
  movsd  0x0(%rbp,%rax,8),%xmm0
  mulsd  (%r12,%rax,8),%xmm0
  add    $0x1,%rax
  addsd  %xmm0,%xmm4
  cmp    %eax,%r14d
  jge    L252
  movq   D42(%rip),%xmm8
  mov    $0x1,%eax
  pxor   %xmm7,%xmm7
  nopl   0x0(%rax,%rax,1)
L239:
  movsd  (%r15,%rax,8),%xmm2
  ucomisd 0x38(%rsp),%xmm2
  movsd  (%r12,%rax,8),%xmm0
  jp     L100
  je     L13
L100:
  divsd  %xmm2,%xmm0
L13:
  andpd  %xmm8,%xmm0
  add    $0x1,%rax
  maxsd  %xmm7,%xmm0
  movapd %xmm0,%xmm7
  cmp    %eax,%r14d
  jge    L239
L23:
  lea    0x8(%r15),%rax
  lea    0x8(%r8),%rbp
  mov    %rax,0x50(%rsp)
  mov    D99(%rip),%rax
  lea    0x1(%r14),%r13d
  movq   %rax,%xmm2
  divsd  %xmm7,%xmm1
  movsd  %xmm1,0x58(%rsp)
  nopw   0x0(%rax,%rax,1)
L66:
  mov    $0x1,%eax
  test   %r14d,%r14d
  jle    L310
  nopw   0x0(%rax,%rax,1)
L27:
  movsd  (%r12,%rax,8),%xmm1
  mulsd  %xmm2,%xmm1
  addsd  (%r15,%rax,8),%xmm1
  movsd  %xmm1,(%r8,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%r13
  jne    L27
L310:
  mov    0x50(%rsp),%rsi
  mov    %rbp,%rdi
  mov    %r8,0x30(%rsp)
  movsd  %xmm6,0x28(%rsp)
  movsd  %xmm4,0x20(%rsp)
  movsd  %xmm5,0x18(%rsp)
  movsd  %xmm3,0x10(%rsp)
  movsd  %xmm2,0x8(%rsp)
  call   <validate_x@plt>
  mov    %rbp,%rdi
  call   *0xa8(%rsp)
  movsd  %xmm0,(%rbx)
  call   <finite@plt>
  movsd  0x8(%rsp),%xmm2
  mov    0x30(%rsp),%r8
  test   %rax,%rax
  movsd  0x10(%rsp),%xmm3
  movsd  0x18(%rsp),%xmm5
  movsd  0x20(%rsp),%xmm4
  movsd  0x28(%rsp),%xmm6
  je     L232
  movsd  0x58(%rsp),%xmm7
  comisd %xmm2,%xmm7
  ja     L280
  movsd  D94(%rip),%xmm1
  movsd  (%rbx),%xmm7
  mulsd  %xmm2,%xmm1
  mulsd  %xmm4,%xmm1
  addsd  %xmm6,%xmm1
  comisd %xmm7,%xmm1
  jae    L21
  ucomisd D99(%rip),%xmm2
  jp     L253
  jne    L253
  movapd %xmm7,%xmm0
  movapd %xmm4,%xmm5
  xorpd  D10(%rip),%xmm5
  subsd  %xmm6,%xmm0
  subsd  %xmm4,%xmm0
  addsd  %xmm0,%xmm0
  divsd  %xmm0,%xmm5
L120:
  movsd  D11(%rip),%xmm0
  movapd %xmm2,%xmm3
  movsd  %xmm6,0x48(%rsp)
  movsd  %xmm7,0x40(%rsp)
  mulsd  %xmm2,%xmm0
  movapd %xmm5,%xmm2
  maxsd  %xmm0,%xmm2
  jmp    L66
  nopl   (%rax)
L253:
  movapd %xmm2,%xmm0
  movapd %xmm7,%xmm11
  movapd %xmm3,%xmm1
  mulsd  %xmm4,%xmm0
  subsd  %xmm6,%xmm11
  movapd %xmm3,%xmm9
  mulsd  %xmm4,%xmm1
  movapd %xmm2,%xmm10
  movapd %xmm2,%xmm8
  mulsd  %xmm3,%xmm9
  subsd  %xmm3,%xmm8
  xorpd  D10(%rip),%xmm3
  mulsd  %xmm2,%xmm10
  subsd  %xmm0,%xmm11
  movsd  0x40(%rsp),%xmm0
  subsd  0x48(%rsp),%xmm0
  subsd  %xmm1,%xmm0
  mulsd  %xmm11,%xmm3
  movapd %xmm11,%xmm1
  divsd  %xmm10,%xmm1
  movapd %xmm0,%xmm12
  mulsd  %xmm2,%xmm0
  divsd  %xmm9,%xmm12
  divsd  %xmm10,%xmm3
  subsd  %xmm12,%xmm1
  divsd  %xmm9,%xmm0
  divsd  %xmm8,%xmm1
  addsd  %xmm0,%xmm3
  divsd  %xmm8,%xmm3
  ucomisd 0x38(%rsp),%xmm1
  jp     L309
  jne    L309
  addsd  %xmm3,%xmm3
  movapd %xmm4,%xmm5
  xorpd  D10(%rip),%xmm5
  divsd  %xmm3,%xmm5
L2:
  movsd  D66(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  minsd  %xmm5,%xmm0
  movapd %xmm0,%xmm5
  jmp    L120
  xchg   %ax,%ax
L309:
  mulsd  D95(%rip),%xmm1
  movapd %xmm3,%xmm0
  movsd  0x38(%rsp),%xmm14
  mulsd  %xmm3,%xmm0
  movapd %xmm1,%xmm8
  mulsd  %xmm4,%xmm8
  subsd  %xmm8,%xmm0
  comisd %xmm0,%xmm14
  ja     L2
  ucomisd %xmm0,%xmm14
  ja     L43
  sqrtsd %xmm0,%xmm0
L222:
  subsd  %xmm3,%xmm0
  movapd %xmm0,%xmm5
  divsd  %xmm1,%xmm5
  jmp    L2
L232:
  mov    0xa0(%rsp),%rax
  movl   $0x2,(%rax)
L21:
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L26:
  test   %r14d,%r14d
  jle    L297
L301:
  divsd  %xmm4,%xmm2
  mov    %rsi,%rax
  lea    (%rcx,%r13,8),%rcx
  nopl   0x0(%rax,%rax,1)
L45:
  movsd  (%rax),%xmm0
  add    $0x8,%rax
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,-0x8(%rax)
  cmp    %rax,%rcx
  jne    L45
  jmp    L265
L280:
  lea    0x1(%r14),%edx
  mov    $0x1,%eax
  test   %r14d,%r14d
  jle    L211
  nopl   0x0(%rax)
L133:
  movsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,(%r8,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L133
L211:
  mov    0xa0(%rsp),%rax
  movl   $0x1,(%rax)
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L121:
  pxor   %xmm4,%xmm4
  movapd %xmm4,%xmm7
  movsd  %xmm4,0x38(%rsp)
  jmp    L23
L297:
  movsd  0x38(%rsp),%xmm7
  movapd %xmm7,%xmm4
  jmp    L23
L203:
  movapd %xmm4,%xmm0
  mov    %rcx,0x58(%rsp)
  mov    %rsi,0x50(%rsp)
  mov    %r8,0x20(%rsp)
  movsd  %xmm2,0x30(%rsp)
  movsd  %xmm1,0x28(%rsp)
  movsd  %xmm6,0x18(%rsp)
  movsd  %xmm5,0x10(%rsp)
  movsd  %xmm3,0x8(%rsp)
  call   <sqrt@plt>
  movsd  0x30(%rsp),%xmm2
  mov    0x20(%rsp),%r8
  movsd  0x8(%rsp),%xmm3
  movsd  0x10(%rsp),%xmm5
  movapd %xmm0,%xmm4
  comisd %xmm2,%xmm0
  movsd  0x18(%rsp),%xmm6
  movsd  0x28(%rsp),%xmm1
  mov    0x50(%rsp),%rsi
  mov    0x58(%rsp),%rcx
  ja     L301
  jmp    L265
L43:
  mov    %r8,0x40(%rsp)
  movsd  %xmm6,0x30(%rsp)
  movsd  %xmm4,0x28(%rsp)
  movsd  %xmm3,0x20(%rsp)
  movsd  %xmm2,0x18(%rsp)
  movsd  %xmm1,0x10(%rsp)
  movsd  %xmm7,0x8(%rsp)
  call   <sqrt@plt>
  mov    0x40(%rsp),%r8
  movsd  0x30(%rsp),%xmm6
  movsd  0x28(%rsp),%xmm4
  movsd  0x20(%rsp),%xmm3
  movsd  0x18(%rsp),%xmm2
  movsd  0x10(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm7
  jmp    L222
```

tool_calls: name: parse_data
arguments: data_tag: D42
datatype: qword
name: parse_data
arguments: data_tag: D99
datatype: f64
name: parse_data
arguments: data_tag: D94
datatype: byte[8]
name: parse_data
arguments: data_tag: D10
datatype: f32[4]
name: parse_data
arguments: data_tag: D11
datatype: f64
name: parse_data
arguments: data_tag: D66
datatype: f64
name: parse_data
arguments: data_tag: D95
datatype: f64

tool: D42: 9223372036854775807

tool: D99: 1

tool: {"D94": [0x2d,0x43,0x1c,0xeb,0xe2,0x36,0x1a,0x3f]}

tool: {"D10": [0.0,-0.0,0.0,0.0]}

tool: D11: 0.1

tool: D66: 0.5

tool: D95: 3

assistant: ```c
void my_lnsrch(int n, double xold[], double fold, double g[], double p[], double x[], double *f, double TOLX, double stpmax, int *check, double (*func)(double[])) {
  int i;
  double a, alam, alam2, alamin, b, disc, f2, fold2, rhs1, rhs2, slope, sum, temp, test, tmplam;
  int icount = 0;
  int bad_step;
  double bad_step_factor = 2.0;
  const int ltrace = 0;
  *check = 0;
  for (sum = 0.0, i = 1; i <= n; i++)
    sum += p[i] * p[i];
  sum = sqrt(sum);
  if (sum > stpmax)
    for (i = 1; i <= n; i++)
      p[i] *= stpmax / sum;
  for (slope = 0.0, i = 1; i <= n; i++)
    slope += g[i] * p[i];
  test = 0.0;
  for (i = 1; i <= n; i++) {
    temp = (xold[i] == 0.) ? fabs(p[i]) : fabs(p[i] / xold[i]);
    if (temp > test)
      test = temp;
  }
  alamin = TOLX / test;
  alam = 1.0;
  for (;;) {
    for (i = 1; i <= n; i++)
      x[i] = xold[i] + alam * p[i];
    validate_x((x + 1), (xold + 1));
    *f = (*func)(x + 1);
    bad_step = 0;
    if (finite(*f) == 0) {
      bad_step = 1;
    }
    if (bad_step) {
      *check = 2;
      return;
    }
    if (alam < alamin) {
      for (i = 1; i <= n; i++)
        x[i] = xold[i];
      *check = 1;
      return;
    } else if (*f <= fold + 1.0e-4 * alam * slope) {
      return;
    } else {
      if (alam == 1.0) {
        tmplam = -slope / (2.0 * (*f - fold - slope));
      } else {
        rhs1 = *f - fold - alam * slope;
        rhs2 = f2 - fold2 - alam2 * slope;
        a = (rhs1 / (alam * alam) - rhs2 / (alam2 * alam2)) / (alam - alam2);
        b = (-alam2 * rhs1 / (alam * alam) + alam * rhs2 / (alam2 * alam2)) / (alam - alam2);
        if (a == 0.0)
          tmplam = -slope / (2.0 * b);
        else {
          disc = b * b - 3.0 * a * slope;
          if (disc < 0.0) {
            disc = 0.;
          } else
            tmplam = (-b + sqrt(disc)) / (3.0 * a);
        }
        if (tmplam > 0.5 * alam)
          tmplam = 0.5 * alam;
      }
    }
    alam2 = alam;
    f2 = *f;
    fold2 = fold;
    alam = (((tmplam) > (0.1 * alam)) ? (tmplam) : (0.1 * alam));
    icount++;
  }
}
```