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

```asm
<jerasure_generate_schedule_cache>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %edx,0x8(%rsp)
  mov    %rcx,(%rsp)
  mov    %r8d,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x48(%rsp)
  cmp    $0x2,%esi
  jne    L59
  mov    %edi,%r13d
  lea    0x2(%rdi),%ebx
  mov    %ebx,0x2c(%rsp)
  lea    0x3(%rdi),%edi
  imul   %ebx,%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,0x30(%rsp)
  mov    %rax,0x48(%rsp)
  test   %rax,%rax
  je     L14
  test   %ebx,%ebx
  jle    L59
  movl   $0x0,0x5c(%rsp)
  mov    0x2c(%rsp),%esi
  movslq %esi,%rax
  lea    0x8(,%rax,8),%rdx
  mov    %rdx,0x40(%rsp)
  lea    0x1(%r13),%edx
  add    $0x1,%rdx
  mov    %rdx,0x38(%rsp)
  shl    $0x3,%rax
  mov    %rax,0x10(%rsp)
  mov    %esi,0x28(%rsp)
  mov    0x30(%rsp),%rax
  mov    %rax,0x20(%rsp)
  movq   $0x1,0x18(%rsp)
  lea    0x5c(%rsp),%r14
  jmp    L41
L83:
  mov    0x18(%rsp),%rcx
  mov    %ecx,0x5c(%rsp)
  mov    %ecx,%r15d
  test   %ecx,%ecx
  jle    L24
  movslq 0x28(%rsp),%rax
  mov    0x30(%rsp),%rsi
  lea    (%rsi,%rax,8),%r12
  lea    (%rsi,%rcx,8),%rbp
  mov    $0x0,%ebx
L76:
  mov    %ebx,0x60(%rsp)
  movl   $0xffffffff,0x64(%rsp)
  mov    0xc(%rsp),%r9d
  mov    %r14,%r8
  mov    (%rsp),%rcx
  mov    0x8(%rsp),%edx
  mov    $0x2,%esi
  mov    %r13d,%edi
  call   <jerasure_generate_decoding_schedule@plt>
  mov    %rax,(%r12)
  mov    %rax,0x0(%rbp)
  add    $0x1,%ebx
  add    $0x8,%r12
  add    0x10(%rsp),%rbp
  cmp    %r15d,%ebx
  jne    L76
L24:
  addq   $0x1,0x18(%rsp)
  mov    0x40(%rsp),%rdx
  add    %rdx,0x20(%rsp)
  mov    0x2c(%rsp),%edi
  add    %edi,0x28(%rsp)
L41:
  movl   $0xffffffff,0x60(%rsp)
  mov    0xc(%rsp),%r9d
  mov    %r14,%r8
  mov    (%rsp),%rcx
  mov    0x8(%rsp),%edx
  mov    $0x2,%esi
  mov    %r13d,%edi
  call   <jerasure_generate_decoding_schedule@plt>
  mov    0x20(%rsp),%rdx
  mov    %rax,(%rdx)
  mov    0x38(%rsp),%rdi
  cmp    %rdi,0x18(%rsp)
  jne    L83
L59:
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L47
  mov    0x48(%rsp),%rax
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L14:
  movq   $0x0,0x48(%rsp)
  jmp    L59
L47:
  call   <__stack_chk_fail@plt>
```

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;
}
```