user: Converte this assembly snippet into its equivalent C code:

```asm
<dldperm>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1b8,%rsp
  mov    %edi,0x2c(%rsp)
  mov    %esi,%eax
  mov    %esi,0x28(%rsp)
  mov    %edx,0x24(%rsp)
  mov    %rcx,%rbp
  mov    %r8,%rbx
  mov    %r9,0x8(%rsp)
  mov    0x1f0(%rsp),%r12
  mov    0x1f8(%rsp),%rsi
  mov    %rsi,0x10(%rsp)
  mov    0x200(%rsp),%rsi
  mov    %rsi,0x18(%rsp)
  mov    %fs:0x28,%rdx
  mov    %rdx,0x1a8(%rsp)
  xor    %edx,%edx
  lea    (%rax,%rax,4),%edx
  mov    %edx,0x34(%rsp)
  cmp    $0x3,%edi
  je     L13
L12:
  mov    0x34(%rsp),%edi
  mov    $0x0,%eax
  call   <intMalloc@plt>
  movslq %eax,%r13
  test   %eax,%eax
  je     L66
L102:
  mov    0x28(%rsp),%eax
  lea    (%rax,%rax,2),%edi
  add    0x24(%rsp),%edi
  mov    %edi,0x38(%rsp)
  movslq %edi,%rdi
  shl    $0x3,%rdi
  mov    $0x0,%eax
  call   <superlu_malloc@plt>
  mov    %eax,0x20(%rsp)
  movslq %eax,%r14
  test   %eax,%eax
  je     L27
L166:
  mov    0x28(%rsp),%edx
  test   %edx,%edx
  js     L89
  mov    %rbp,%rax
  lea    0x1(%rdx),%edx
  lea    0x0(%rbp,%rdx,4),%rdx
L63:
  addl   $0x1,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L63
L89:
  mov    0x24(%rsp),%edx
  test   %edx,%edx
  jle    L61
  mov    %rbx,%rax
  mov    %edx,%edx
  lea    (%rbx,%rdx,4),%rdx
L219:
  addl   $0x1,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L219
L61:
  lea    0x40(%rsp),%r15
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <mc64id_@plt>
  lea    0x24(%rsp),%rdx
  lea    0x28(%rsp),%rsi
  lea    0x2c(%rsp),%rdi
  lea    0x70(%rsp),%rax
  push   %rax
  push   %r15
  push   %r14
  lea    0x50(%rsp),%rax
  push   %rax
  push   %r13
  lea    0x5c(%rsp),%rax
  push   %rax
  push   %r12
  lea    0x74(%rsp),%rax
  push   %rax
  mov    0x48(%rsp),%r9
  mov    %rbx,%r8
  mov    %rbp,%rcx
  mov    $0x0,%eax
  call   <mc64ad_@plt>
  add    $0x40,%rsp
  cmpl   $0x1,0x70(%rsp)
  je     L167
L60:
  mov    0x28(%rsp),%edx
  test   %edx,%edx
  js     L128
  mov    %rbp,%rax
  lea    0x1(%rdx),%ecx
  lea    0x0(%rbp,%rcx,4),%rcx
L36:
  subl   $0x1,(%rax)
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L36
L128:
  mov    0x24(%rsp),%ecx
  test   %ecx,%ecx
  jle    L144
  mov    %rbx,%rax
  mov    %ecx,%ecx
  lea    (%rbx,%rcx,4),%rcx
L135:
  subl   $0x1,(%rax)
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L135
L144:
  test   %edx,%edx
  jle    L212
  mov    %r12,%rax
  mov    %edx,%ecx
  lea    (%r12,%rcx,4),%rcx
L2:
  subl   $0x1,(%rax)
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L2
  cmpl   $0x5,0x2c(%rsp)
  je     L213
L212:
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <superlu_free@plt>
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <superlu_free@plt>
  mov    0x70(%rsp),%eax
  mov    0x1a8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L32
  add    $0x1b8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L13:
  mov    0x24(%rsp),%eax
  lea    (%rax,%rdx,2),%eax
  mov    %eax,0x34(%rsp)
  jmp    L12
L66:
  lea    0xa0(%rsp),%r14
  lea    D64(%rip),%r8
  mov    $0x61,%ecx
  lea    D73(%rip),%rdx
  lea    D29(%rip),%rsi
  mov    %r14,%rdi
  call   <sprintf@plt>
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <superlu_abort_and_exit@plt>
  jmp    L102
L27:
  lea    0xa0(%rsp),%r15
  lea    D64(%rip),%r8
  mov    $0x64,%ecx
  lea    D18(%rip),%rdx
  lea    D29(%rip),%rsi
  mov    %r15,%rdi
  call   <sprintf@plt>
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <superlu_abort_and_exit@plt>
  jmp    L166
L167:
  mov    0x28(%rsp),%esi
  sub    0x3c(%rsp),%esi
  lea    D13(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x3c(%rsp),%eax
  movslq %eax,%rdx
  lea    (%r12,%rdx,4),%rdx
  mov    0x28(%rsp),%esi
  sub    %eax,%esi
  lea    D66(%rip),%rdi
  mov    $0x0,%eax
  call   <slu_PrintInt10@plt>
  jmp    L60
L213:
  movslq 0x20(%rsp),%r8
  mov    %edx,%eax
  lea    (%r8,%rax,8),%rdi
  movslq %edx,%rdx
  shl    $0x3,%rdx
  mov    %r8,%rax
  mov    0x10(%rsp),%rsi
  sub    %r8,%rsi
  mov    0x18(%rsp),%rcx
  sub    %r8,%rcx
L149:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rsi,%rax,1)
  movsd  (%rdx,%rax,1),%xmm0
  movsd  %xmm0,(%rcx,%rax,1)
  add    $0x8,%rax
  cmp    %rdi,%rax
  jne    L149
  jmp    L212
L32:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D64
data_type: string
name: extract_symbolic_data
arguments: tag: D73
data_type: string
name: extract_symbolic_data
arguments: tag: D29
data_type: string
name: extract_symbolic_data
arguments: tag: D18
data_type: string
name: extract_symbolic_data
arguments: tag: D13
data_type: string
name: extract_symbolic_data
arguments: tag: D66
data_type: string

tool: D64: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/dribbroc/HONEI/refs/heads/master/honei/math/SuperLU_4.1/SRC/dldperm.c

tool: D73: Malloc fails for iw[]

tool: D29: %s at line %d in file %s


tool: D18: Malloc fails for dw[]

tool: D13: .. The last %d permutations:


tool: D66: perm

assistant: ```c
int dldperm(int job, int n, int nnz, int colptr[], int adjncy[], double nzval[], int *perm, double u[], double v[]) {
  int i, liw, ldw, num;
  int *iw, icntl[10], info[10];
  double *dw;
  liw = 5 * n;
  if (job == 3)
    liw = 10 * n + nnz;
  if (!(iw = intMalloc(liw))) {
    char msg[256];
    sprintf(msg, "%s at line %d in file %s\n", "Malloc fails for iw[]", 97, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/dribbroc/HONEI/refs/heads/master/honei/math/SuperLU_4.1/SRC/dldperm.c");
    superlu_abort_and_exit(msg);
  };
  ldw = 3 * n + nnz;
  if (!(dw = (double *)superlu_malloc(ldw * sizeof(double)))) {
    char msg[256];
    sprintf(msg, "%s at line %d in file %s\n", "Malloc fails for dw[]", 100, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/dribbroc/HONEI/refs/heads/master/honei/math/SuperLU_4.1/SRC/dldperm.c");
    superlu_abort_and_exit(msg);
  };
  for (i = 0; i <= n; ++i)
    ++colptr[i];
  for (i = 0; i < nnz; ++i)
    ++adjncy[i];
  mc64id_(icntl);
  mc64ad_(&job, &n, &nnz, colptr, adjncy, nzval, &num, perm, &liw, iw, &ldw, dw, icntl, info);
  if (info[0] == 1) {
    printf(".. The last %d permutations:\n", n - num);
    slu_PrintInt10("perm", n - num, &perm[num]);
  }
  for (i = 0; i <= n; ++i)
    --colptr[i];
  for (i = 0; i < nnz; ++i)
    --adjncy[i];
  for (i = 0; i < n; ++i)
    --perm[i];
  if (job == 5)
    for (i = 0; i < n; ++i) {
      u[i] = dw[i];
      v[i] = dw[n + i];
    }
  superlu_free(iw);
  superlu_free(dw);
  return info[0];
}
```