user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<solve>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %edx,-0x54(%rbp)
  mov    %ecx,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x54(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x58(%rbp),%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x54(%rbp),%eax
  mov    %eax,-0x38(%rbp)
  mov    -0x54(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x54(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x54(%rbp),%eax
  cltq
  mov    %eax,%edx
  mov    -0x54(%rbp),%eax
  cltq
  imul   %edx,%eax
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x54(%rbp),%eax
  cltq
  mov    %eax,%edx
  mov    -0x58(%rbp),%eax
  cltq
  imul   %edx,%eax
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L143
L52:
  movl   $0x0,-0x28(%rbp)
  jmp    L45
L71:
  mov    -0x54(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x54(%rbp),%eax
  imul   -0x28(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x2c(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x28(%rbp)
L45:
  mov    -0x54(%rbp),%eax
  cmp    %eax,-0x28(%rbp)
  jl     L71
  addl   $0x1,-0x2c(%rbp)
L143:
  mov    -0x54(%rbp),%eax
  cmp    %eax,-0x2c(%rbp)
  jl     L52
  cmpl   $0x1,-0x58(%rbp)
  jle    L55
  movl   $0x0,-0x2c(%rbp)
  jmp    L206
L90:
  movl   $0x0,-0x28(%rbp)
  jmp    L177
L89:
  mov    -0x54(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rax,%rdx
  mov    -0x54(%rbp),%eax
  imul   -0x28(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x2c(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x10(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x28(%rbp)
L177:
  mov    -0x54(%rbp),%eax
  cmp    %eax,-0x28(%rbp)
  jl     L89
  addl   $0x1,-0x2c(%rbp)
L206:
  mov    -0x54(%rbp),%eax
  cmp    %eax,-0x2c(%rbp)
  jl     L90
  jmp    L100
L55:
  movl   $0x0,-0x2c(%rbp)
  jmp    L187
L33:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x10(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x2c(%rbp)
L187:
  mov    -0x54(%rbp),%eax
  cmp    %eax,-0x2c(%rbp)
  jl     L33
L100:
  mov    -0x10(%rbp),%r9
  mov    -0x20(%rbp),%r8
  lea    -0x38(%rbp),%rcx
  mov    -0x18(%rbp),%rdx
  lea    -0x3c(%rbp),%rsi
  lea    -0x54(%rbp),%rax
  lea    -0x30(%rbp),%rdi
  push   %rdi
  lea    -0x34(%rbp),%rdi
  push   %rdi
  mov    %rax,%rdi
  call   <dgesv_@plt>
  add    $0x10,%rsp
  cmpl   $0x1,-0x58(%rbp)
  jle    L75
  movl   $0x0,-0x2c(%rbp)
  jmp    L197
L14:
  movl   $0x0,-0x28(%rbp)
  jmp    L119
L118:
  mov    -0x54(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rax,%rdx
  mov    -0x54(%rbp),%eax
  imul   -0x28(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x2c(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x50(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x28(%rbp)
L119:
  mov    -0x54(%rbp),%eax
  cmp    %eax,-0x28(%rbp)
  jl     L118
  addl   $0x1,-0x2c(%rbp)
L197:
  mov    -0x54(%rbp),%eax
  cmp    %eax,-0x2c(%rbp)
  jl     L14
  jmp    L6
L75:
  movl   $0x0,-0x2c(%rbp)
  jmp    L160
L202:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x50(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x2c(%rbp)
L160:
  mov    -0x54(%rbp),%eax
  cmp    %eax,-0x2c(%rbp)
  jl     L202
L6:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L47
  call   <__stack_chk_fail@plt>
L47:
  leave
  ret
```

assistant: ```c
void solve(double *A, double *B, int nA, int nRHS) {
  int N = nA;
  int NRHS = nRHS;
  int LDA = nA;
  int *IPIV = (int *)malloc(sizeof(int) * nA);
  int LDB = nA;
  int INFO;
  double *AT = (double *)malloc(sizeof(double) * nA * nA);
  double *BT = (double *)malloc(sizeof(double) * nA * nRHS);
  int i, j;
  for (i = 0; i < nA; i++) {
    for (j = 0; j < nA; j++) {
      AT[i + nA * j] = A[j + nA * i];
    }
  }
  if (nRHS > 1) {
    for (i = 0; i < nA; i++) {
      for (j = 0; j < nA; j++) {
        BT[i + nA * j] = B[j + nA * i];
      }
    }
  } else {
    for (i = 0; i < nA; i++)
      BT[i] = B[i];
  }
  dgesv_(&nA, &NRHS, AT, &LDA, IPIV, BT, &LDB, &INFO);
  if (nRHS > 1) {
    for (i = 0; i < nA; i++) {
      for (j = 0; j < nA; j++) {
        B[i + nA * j] = BT[j + nA * i];
      }
    }
  } else {
    for (i = 0; i < nA; i++)
      B[i] = BT[i];
  }
  free(AT);
  free(BT);
  return;
}
```