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

```asm
<ludcmp>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbx
  mov    %esi,%ebp
  mov    %rdx,0x10(%rsp)
  mov    %rcx,%r14
  mov    %rcx,0x18(%rsp)
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <vector@plt>
  mov    %rax,%r15
  mov    D37(%rip),%rax
  mov    %rax,(%r14)
  test   %ebp,%ebp
  jle    L116
  lea    -0x1(%rbp),%eax
  mov    %rax,0x8(%rsp)
  lea    0x0(,%rax,8),%r13
  mov    $0x1,%r12d
  lea    D65(%rip),%r14
  jmp    L216
L238:
  movsd  D37(%rip),%xmm0
  divsd  (%rsp),%xmm0
  movsd  %xmm0,(%r15,%r12,8)
  add    $0x1,%r12
  cmp    %r12d,%ebp
  jl     L14
L216:
  mov    (%rbx,%r12,8),%rdx
  lea    0x8(%rdx),%rax
  lea    0x10(%rdx,%r13,1),%rdx
  pxor   %xmm4,%xmm4
  movsd  %xmm4,(%rsp)
L96:
  movsd  (%rax),%xmm0
  andpd  D25(%rip),%xmm0
  maxsd  (%rsp),%xmm0
  movsd  %xmm0,(%rsp)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L96
  pxor   %xmm4,%xmm4
  ucomisd %xmm4,%xmm0
  jp     L238
  jne    L238
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <nrerror@plt>
  jmp    L238
L14:
  mov    0x8(%rsp),%rax
  lea    0x10(,%rax,8),%r14
  mov    $0x1,%r13d
  movl   $0xffffffff,(%rsp)
  mov    $0x8,%edx
  movl   $0x2,0x8(%rsp)
  mov    $0x0,%r12d
  pxor   %xmm6,%xmm6
  movq   D25(%rip),%xmm3
  movq   D43(%rip),%xmm9
  movapd %xmm6,%xmm5
  movapd %xmm6,%xmm4
  movsd  D41(%rip),%xmm8
  movsd  D37(%rip),%xmm7
  jmp    L92
L287:
  mov    (%rbx,%rsi,8),%rcx
  lea    (%rcx,%rdx,1),%r8
  movsd  (%r8),%xmm1
  cmp    $0x1,%esi
  jle    L177
  mov    $0x1,%eax
L134:
  mov    (%rbx,%rax,8),%rdi
  movsd  (%rdi,%rdx,1),%xmm0
  mulsd  (%rcx,%rax,8),%xmm0
  subsd  %xmm0,%xmm1
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L134
L177:
  add    $0x1,%rsi
L29:
  movsd  %xmm1,(%r8)
  cmp    %r9,%rsi
  jne    L287
L75:
  cmp    %r11d,%ebp
  jl     L85
  mov    %r13,%r8
  movapd %xmm6,%xmm2
  mov    (%rsp),%edi
  add    $0x2,%rdi
  jmp    L188
L35:
  add    $0x1,%r8
  cmp    %r8d,%ebp
  jl     L85
L188:
  mov    %r8d,%r10d
  mov    (%rbx,%r8,8),%rsi
  lea    (%rsi,%rdx,1),%r9
  movsd  (%r9),%xmm1
  cmp    $0x1,%r11d
  jle    L73
  mov    $0x1,%eax
L54:
  mov    (%rbx,%rax,8),%rcx
  movsd  (%rcx,%rdx,1),%xmm0
  mulsd  (%rsi,%rax,8),%xmm0
  subsd  %xmm0,%xmm1
  add    $0x1,%rax
  cmp    %rax,%rdi
  jne    L54
L73:
  movsd  %xmm1,(%r9)
  andpd  %xmm3,%xmm1
  mulsd  (%r15,%r8,8),%xmm1
  comisd %xmm2,%xmm1
  jb     L35
  movapd %xmm1,%xmm2
  mov    %r10d,%r12d
  jmp    L35
L85:
  cmp    %r11d,%r12d
  jne    L205
L43:
  mov    0x10(%rsp),%rax
  mov    %r12d,(%rax,%r13,4)
  mov    %rdx,%rax
  add    (%rbx,%rdx,1),%rax
  ucomisd (%rax),%xmm5
  jp     L3
  ucomisd (%rax),%xmm4
  jne    L3
  movsd  %xmm8,(%rax)
L3:
  cmp    %r11d,%ebp
  je     L26
  mov    (%rbx,%rdx,1),%rax
  movapd %xmm7,%xmm1
  divsd  (%rax,%rdx,1),%xmm1
  mov    0x8(%rsp),%eax
  cmp    %eax,%ebp
  jl     L116
  cltq
L179:
  mov    %rdx,%rcx
  add    (%rbx,%rax,8),%rcx
  movapd %xmm1,%xmm0
  mulsd  (%rcx),%xmm0
  movsd  %xmm0,(%rcx)
  add    $0x1,%rax
  cmp    %eax,%ebp
  jge    L179
L87:
  addl   $0x1,0x8(%rsp)
  add    $0x8,%rdx
  addl   $0x1,(%rsp)
  add    $0x1,%r13
L92:
  mov    %r13d,%r11d
  cmp    $0x1,%r13d
  jle    L75
  mov    %rdx,%r8
  add    0x8(%rbx),%r8
  movsd  (%r8),%xmm1
  mov    (%rsp),%r9d
  add    $0x2,%r9
  mov    $0x2,%esi
  jmp    L29
L205:
  movslq %r12d,%r8
  lea    (%rbx,%r8,8),%rdi
  mov    $0x8,%eax
L262:
  mov    %rax,%rcx
  add    (%rdi),%rcx
  movsd  (%rcx),%xmm0
  mov    (%rbx,%rdx,1),%rsi
  movsd  (%rsi,%rax,1),%xmm1
  movsd  %xmm1,(%rcx)
  mov    (%rbx,%rdx,1),%rcx
  movsd  %xmm0,(%rcx,%rax,1)
  add    $0x8,%rax
  cmp    %rax,%r14
  jne    L262
  mov    0x18(%rsp),%rax
  movsd  (%rax),%xmm0
  xorpd  %xmm9,%xmm0
  movsd  %xmm0,(%rax)
  movsd  (%r15,%rdx,1),%xmm0
  movsd  %xmm0,(%r15,%r8,8)
  jmp    L43
L26:
  cmp    0x8(%rsp),%ebp
  jge    L87
L116:
  mov    %ebp,%edx
  mov    $0x1,%esi
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <free_vector@plt>
  mov    $0x0,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D37
type: f64
name: disassemble_data
arguments: data_tag: D65
type: string
name: disassemble_data
arguments: data_tag: D25
type: qword[2]
name: disassemble_data
arguments: data_tag: D43
type: f32[2]
name: disassemble_data
arguments: data_tag: D41
type: byte[8]

tool: D37: 1

tool: D65: Singular matrix in routine LUDCMP

tool: {"D25": [0x7fffffffffffffff,0x0000000000000000]}

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

tool: {"D41": [0x23,0x42,0x92,0x0c,0xa1,0x9c,0xc7,0x3b]}

assistant: ```c
int ludcmp(a, n, indx, d)
int n, *indx;
double **a, *d;
{
  int i, imax, j, k;
  double big, dum, sum, temp;
  double *vv, *vector();
  void free_vector();
  imax = 0;
  vv = vector(1, n);
  (*d) = 1.0;
  for (i = 1; i <= n; i++) {
    big = 0.0;
    for (j = 1; j <= n; j++)
      if ((temp = fabs(a[i][j])) > big)
        big = temp;
    if (!big)
      nrerror("Singular matrix in routine LUDCMP");
    vv[i] = 1.0 / big;
  }
  for (j = 1; j <= n; j++) {
    for (i = 1; i < j; i++) {
      sum = a[i][j];
      for (k = 1; k < i; k++)
        sum -= a[i][k] * a[k][j];
      a[i][j] = sum;
    }
    big = 0.0;
    for (i = j; i <= n; i++) {
      sum = a[i][j];
      for (k = 1; k < j; k++)
        sum -= a[i][k] * a[k][j];
      a[i][j] = sum;
      if ((dum = vv[i] * fabs(sum)) >= big) {
        big = dum;
        imax = i;
      }
    }
    if (j != imax) {
      for (k = 1; k <= n; k++) {
        dum = a[imax][k];
        a[imax][k] = a[j][k];
        a[j][k] = dum;
      }
      (*d) = -(*d);
      vv[imax] = vv[j];
    }
    indx[j] = imax;
    if (!a[j][j]) {
      a[j][j] = 1.0e-20;
    }
    if (j != n) {
      dum = 1.0 / (a[j][j]);
      for (i = j + 1; i <= n; i++)
        a[i][j] *= dum;
    }
  }
  free_vector(vv, 1, n);
  return (0);
}
```