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

```asm
<linsolve>:
  endbr64
  push   %r15
  movslq %esi,%rax
  push   %r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %rax,%rbx
  sub    $0x48,%rsp
  mov    %rdi,0x18(%rsp)
  lea    0x0(,%rax,8),%edi
  mov    %r8,0x28(%rsp)
  mov    %rax,0x20(%rsp)
  call   <malloc@plt>
  mov    %rax,%r13
  test   %ebx,%ebx
  jle    L3
  movslq %ebx,%rax
  mov    0x18(%rsp),%rcx
  mov    %ebx,0x34(%rsp)
  mov    %rbp,%rdx
  lea    0x8(,%rax,8),%r9
  mov    %ebx,%eax
  mov    %r12,0x38(%rsp)
  mov    %r13,%r15
  lea    0x0(%r13,%rax,8),%r8
  pxor   %xmm2,%xmm2
  mov    %rcx,%rbx
  mov    %r9,%rbp
  lea    D4(%rip),%r14
  mov    %r8,%r12
  jmp    L23
L81:
  add    $0x8,%r15
  add    %rbp,%rbx
  cmp    %r12,%r15
  je     L34
L23:
  mov    %rdx,%rax
  movq   $0x0,(%r15)
  sub    %r13,%rax
  movq   $0x0,(%rax,%r15,1)
  ucomisd (%rbx),%xmm2
  jp     L81
  jne    L81
  mov    %r14,%rdi
  mov    %rdx,0x8(%rsp)
  add    $0x8,%r15
  add    %rbp,%rbx
  movsd  %xmm2,0x10(%rsp)
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  movsd  0x10(%rsp),%xmm2
  mov    0x8(%rsp),%rdx
  cmp    %r12,%r15
  jne    L23
L34:
  mov    0x34(%rsp),%ebx
  mov    0x38(%rsp),%r12
  mov    %rdx,%rbp
L3:
  mov    0x28(%rsp),%rsi
  mov    0x20(%rsp),%r15
  lea    -0x2(%rbx),%r9d
  mov    0x18(%rsp),%r14
  movslq (%rsi),%rax
  shl    $0x3,%r15
  lea    -0x8(%r15),%rdi
  movsd  (%r12,%rax,8),%xmm0
  mov    %ebx,%eax
  lea    0x0(%r13,%rdi,1),%r11
  add    %rbp,%rdi
  imul   %ebx,%eax
  movsd  %xmm0,0x0(%r13)
  cltq
  lea    -0x8(%r14,%rax,8),%r10
  cmp    $0x1,%ebx
  jle    L159
  mov    %r15,%rcx
  add    $0x4,%rsi
  lea    0x8(%r13),%rdx
  mov    %r9d,%eax
  sub    %r13,%rcx
  mov    %rsi,%r8
  pxor   %xmm2,%xmm2
  add    %r14,%rcx
  lea    0x10(%r13,%rax,8),%r14
L89:
  mov    %r13,%rax
  movapd %xmm2,%xmm1
  jmp    L19
  nopl   0x0(%rax)
L91:
  movsd  (%rax),%xmm0
L19:
  mulsd  (%rcx,%rax,1),%xmm0
  add    $0x8,%rax
  addsd  %xmm0,%xmm1
  cmp    %rax,%rdx
  jne    L91
  movslq (%r8),%rax
  add    $0x8,%rdx
  add    $0x4,%r8
  add    %r15,%rcx
  movsd  (%r12,%rax,8),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rdx)
  cmp    %rdx,%r14
  je     L109
  movsd  0x0(%r13),%xmm0
  jmp    L89
L109:
  movsd  (%r11),%xmm0
  divsd  (%r10),%xmm0
  movsd  %xmm0,(%rdi)
L61:
  lea    0x1(%rbx),%edx
  mov    0x18(%rsp),%r10
  movslq %r9d,%rcx
  mov    %ebx,%edi
  imul   %r9d,%edx
  lea    0x0(,%rcx,8),%rax
  not    %edi
  movslq %edi,%rdi
  lea    0x0(%r13,%rax,1),%rsi
  shl    $0x3,%rdi
  movslq %edx,%rdx
  shl    $0x3,%rdx
  lea    (%r10,%rdx,1),%r8
  sub    %rax,%rdx
  add    %r10,%rdx
  cs nopw 0x0(%rax,%rax,1)
L138:
  lea    0x1(%rcx),%eax
  cmp    %eax,%ebx
  jle    L45
  cltq
  movapd %xmm2,%xmm1
  nopl   (%rax)
L85:
  movsd  (%rdx,%rax,8),%xmm0
  mulsd  0x0(%rbp,%rax,8),%xmm0
  add    $0x1,%rax
  addsd  %xmm0,%xmm1
  cmp    %eax,%ebx
  jg     L85
L164:
  movsd  (%rsi),%xmm0
  sub    %r15,%rdx
  sub    $0x8,%rsi
  subsd  %xmm1,%xmm0
  divsd  (%r8),%xmm0
  movsd  %xmm0,0x0(%rbp,%rcx,8)
  sub    $0x1,%rcx
  add    %rdi,%r8
  test   %ecx,%ecx
  jns    L138
L100:
  mov    %r13,%rdi
  call   <free@plt>
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L45:
  movapd %xmm2,%xmm1
  jmp    L164
L159:
  movsd  (%r11),%xmm0
  divsd  (%r10),%xmm0
  movsd  %xmm0,(%rdi)
  test   %r9d,%r9d
  js     L100
  pxor   %xmm2,%xmm2
  jmp    L61
```

tool_calls: name: unpack_data
arguments: label: D4
data_type: string

tool: D4: The Matrix system does not have a unique solution

assistant: ```c
int linsolve(double *A, int N, double *b, double *x, int *ipiv) {
  int i, j, c1, l;
  double *y;
  double sum, temp;
  y = (double *)malloc(sizeof(double) * N);
  for (i = 0; i < N; ++i) {
    y[i] = 0.;
    x[i] = 0.;
    if (A[i * N + i] == 0.) {
      printf("The Matrix system does not have a unique solution");
      exit(1);
    }
  }
  y[0] = b[ipiv[0]];
  for (i = 1; i < N; ++i) {
    sum = 0.;
    c1 = i * N;
    for (j = 0; j < i; ++j) {
      sum += y[j] * A[c1 + j];
    }
    y[i] = b[ipiv[i]] - sum;
  }
  x[N - 1] = y[N - 1] / A[N * N - 1];
  for (i = N - 2; i >= 0; i--) {
    sum = 0.;
    c1 = i * (N + 1);
    l = 0;
    for (j = i + 1; j < N; j++) {
      l++;
      sum += A[c1 + l] * x[j];
    }
    x[i] = (y[i] - sum) / A[c1];
  }
  free(y);
  return 0;
}
```