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

```asm
<jerasure_generate_schedule_cache>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %esi,-0x48(%rbp)
  mov    %edx,-0x4c(%rbp)
  mov    %rcx,-0x58(%rbp)
  mov    %r8d,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  cmpl   $0x2,-0x48(%rbp)
  je     L48
  mov    $0x0,%eax
  jmp    L41
L48:
  mov    -0x44(%rbp),%edx
  mov    -0x48(%rbp),%eax
  add    %eax,%edx
  mov    -0x44(%rbp),%ecx
  mov    -0x48(%rbp),%eax
  add    %ecx,%eax
  add    $0x1,%eax
  imul   %edx,%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L14
  mov    $0x0,%eax
  jmp    L41
L14:
  movl   $0x0,-0x38(%rbp)
  jmp    L32
L24:
  mov    -0x38(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  movl   $0x0,-0x34(%rbp)
  jmp    L81
L64:
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  movl   $0xffffffff,-0x1c(%rbp)
  mov    -0x44(%rbp),%edx
  mov    -0x48(%rbp),%eax
  add    %edx,%eax
  imul   -0x38(%rbp),%eax
  mov    %eax,%edx
  mov    -0x34(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    -0x50(%rbp),%r8d
  lea    -0x24(%rbp),%rdi
  mov    -0x58(%rbp),%rcx
  mov    -0x4c(%rbp),%edx
  mov    -0x48(%rbp),%esi
  mov    -0x44(%rbp),%eax
  mov    %r8d,%r9d
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <jerasure_generate_decoding_schedule@plt>
  mov    %rax,(%rbx)
  mov    -0x44(%rbp),%edx
  mov    -0x48(%rbp),%eax
  add    %edx,%eax
  imul   -0x38(%rbp),%eax
  mov    %eax,%edx
  mov    -0x34(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x44(%rbp),%ecx
  mov    -0x48(%rbp),%edx
  add    %ecx,%edx
  mov    %edx,%ecx
  imul   -0x34(%rbp),%ecx
  mov    -0x38(%rbp),%edx
  add    %ecx,%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  addl   $0x1,-0x34(%rbp)
L81:
  mov    -0x34(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jl     L64
  movl   $0xffffffff,-0x20(%rbp)
  mov    -0x44(%rbp),%edx
  mov    -0x48(%rbp),%eax
  add    %edx,%eax
  imul   -0x38(%rbp),%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    -0x50(%rbp),%r8d
  lea    -0x24(%rbp),%rdi
  mov    -0x58(%rbp),%rcx
  mov    -0x4c(%rbp),%edx
  mov    -0x48(%rbp),%esi
  mov    -0x44(%rbp),%eax
  mov    %r8d,%r9d
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <jerasure_generate_decoding_schedule@plt>
  mov    %rax,(%rbx)
  addl   $0x1,-0x38(%rbp)
L32:
  mov    -0x44(%rbp),%edx
  mov    -0x48(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x38(%rbp)
  jl     L24
  mov    -0x30(%rbp),%rax
L41:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L31
  call   <__stack_chk_fail@plt>
L31:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int ***jerasure_generate_schedule_cache(int k, int m, int w, int *bitmatrix, int smart) {
  int i, tdone;
  char **ptrs;
  int **schedule;
  int ***scache;
  int erasures[3];
  int e1, e2;
  if (m != 2)
    return NULL;
  scache = (int ***)malloc(sizeof(int **) * ((k + m) * (k + m + 1)));
  if (scache == NULL)
    return NULL;
  for (e1 = 0; e1 < k + m; e1++) {
    erasures[0] = e1;
    for (e2 = 0; e2 < e1; e2++) {
      erasures[1] = e2;
      erasures[2] = -1;
      scache[e1 * (k + m) + e2] = jerasure_generate_decoding_schedule(k, m, w, bitmatrix, erasures, smart);
      scache[e2 * (k + m) + e1] = scache[e1 * (k + m) + e2];
    }
    erasures[1] = -1;
    scache[e1 * (k + m) + e1] = jerasure_generate_decoding_schedule(k, m, w, bitmatrix, erasures, smart);
  }
  return scache;
}
```