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

```asm
<c4matrix>:
  endbr64
  push   %r15
  mov    %esi,%eax
  push   %r14
  sub    %edi,%eax
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %r9d,%ebx
  sub    $0x58,%rsp
  mov    %edi,0x24(%rsp)
  lea    0x1(%rax),%edi
  movslq 0x90(%rsp),%r12
  shl    $0x3,%rdi
  mov    %esi,0x30(%rsp)
  mov    %edx,0x34(%rsp)
  mov    %ecx,0x8(%rsp)
  mov    %r8d,0xc(%rsp)
  call   <malloc@plt>
  test   %rax,%rax
  je     L106
  movslq 0x24(%rsp),%rdx
  mov    %rax,%rcx
  mov    %rdx,%rsi
  shl    $0x3,%rdx
  sub    %rdx,%rcx
  mov    %rcx,0x48(%rsp)
  cmp    %esi,0x30(%rsp)
  jl     L40
  mov    0x34(%rsp),%esi
  mov    0x8(%rsp),%edx
  mov    %rax,0x28(%rsp)
  mov    0x98(%rsp),%eax
  sub    %esi,%edx
  add    $0x1,%edx
  sub    %r12d,%eax
  shl    $0x3,%rdx
  add    $0x1,%eax
  mov    %rdx,0x38(%rsp)
  movslq %esi,%rdx
  mov    0xc(%rsp),%esi
  shl    $0x3,%rdx
  mov    %eax,0x20(%rsp)
  neg    %rdx
  mov    %rdx,0x40(%rsp)
  mov    %ebx,%edx
  sub    %esi,%edx
  add    $0x1,%edx
  shl    $0x3,%rdx
  mov    %rdx,0x10(%rsp)
  movslq %esi,%rdx
  shl    $0x3,%rdx
  neg    %rdx
  mov    %rdx,0x18(%rsp)
L112:
  mov    0x38(%rsp),%rdi
  call   <malloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L29
  mov    0x40(%rsp),%rax
  mov    0x28(%rsp),%rdx
  add    %r13,%rax
  mov    %rax,(%rdx)
  mov    0x34(%rsp),%eax
  mov    %eax,0x4(%rsp)
  cmp    %eax,0x8(%rsp)
  jl     L24
  xchg   %ax,%ax
L76:
  mov    0x10(%rsp),%rdi
  call   <malloc@plt>
  mov    %rax,%rcx
  test   %rax,%rax
  je     L30
  mov    0x18(%rsp),%rax
  mov    0x20(%rsp),%ebp
  mov    %rcx,%r15
  add    %rcx,%rax
  mov    %rax,0x0(%r13)
  mov    0xc(%rsp),%eax
  mov    %eax,%r14d
  cmp    %eax,%ebx
  jl     L25
  nopl   0x0(%rax)
L114:
  mov    %rbp,%rdi
  call   <malloc@plt>
  test   %rax,%rax
  je     L60
  sub    %r12,%rax
  add    $0x1,%r14d
  add    $0x8,%r15
  mov    %rax,-0x8(%r15)
  cmp    %r14d,%ebx
  jge    L114
L25:
  addl   $0x1,0x4(%rsp)
  add    $0x8,%r13
  mov    0x4(%rsp),%eax
  cmp    %eax,0x8(%rsp)
  jge    L76
L24:
  addl   $0x1,0x24(%rsp)
  mov    0x24(%rsp),%eax
  addq   $0x8,0x28(%rsp)
  cmp    %eax,0x30(%rsp)
  jge    L112
L40:
  mov    0x48(%rsp),%rax
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L60:
  movq   $0x0,(%r15)
L106:
  mov    $0x14,%edi
  call   <exit@plt>
L29:
  mov    0x28(%rsp),%rax
  movq   $0x0,(%rax)
  jmp    L106
  nopl   0x0(%rax,%rax,1)
L30:
  movq   $0x0,0x0(%r13)
  jmp    L106
```

assistant: ```c
unsigned char ****c4matrix(nql, nqh, nzl, nzh, nrl, nrh, ncl, nch)
int nrl, nrh, ncl, nch, nzl, nzh, nql, nqh;
{
  unsigned char ****m;
  int i, j, k;
  m = (unsigned char ****)malloc((unsigned)(nqh - nql + 1) * sizeof(unsigned char ***));
  if (!m)
    exit(20);
  m -= nql;
  for (k = nql; k <= nqh; k++) {
    m[k] = (unsigned char ***)malloc((unsigned)(nzh - nzl + 1) * sizeof(unsigned char **));
    if (!m[k])
      exit(20);
    m[k] -= nzl;
    for (i = nzl; i <= nzh; i++) {
      m[k][i] = (unsigned char **)malloc((unsigned)(nrh - nrl + 1) * sizeof(unsigned char *));
      if (!m[k][i])
        exit(20);
      m[k][i] -= nrl;
      for (j = nrl; j <= nrh; j++) {
        m[k][i][j] = (unsigned char *)malloc((unsigned)(nch - ncl + 1) * sizeof(unsigned char));
        if (!m[k][i][j])
          exit(20);
        m[k][i][j] -= ncl;
      }
    }
  }
  return m;
}
```