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

```asm
<jerasure_generate_decoding_schedule>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %edi,-0x74(%rbp)
  mov    %esi,-0x78(%rbp)
  mov    %edx,-0x7c(%rbp)
  mov    %rcx,-0x88(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9d,-0x80(%rbp)
  movl   $0x0,-0x58(%rbp)
  movl   $0x0,-0x54(%rbp)
  movl   $0x0,-0x6c(%rbp)
  jmp    L169
L329:
  mov    -0x6c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x90(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x74(%rbp)
  jle    L156
  addl   $0x1,-0x58(%rbp)
  jmp    L141
L156:
  addl   $0x1,-0x54(%rbp)
L141:
  addl   $0x1,-0x6c(%rbp)
L169:
  mov    -0x6c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x90(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0xffffffff,%eax
  jne    L329
  mov    -0x74(%rbp),%edx
  mov    -0x78(%rbp),%eax
  add    %edx,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x38(%rbp)
  mov    -0x74(%rbp),%edx
  mov    -0x78(%rbp),%eax
  add    %edx,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x30(%rbp),%rdi
  mov    -0x38(%rbp),%rcx
  mov    -0x90(%rbp),%rdx
  mov    -0x78(%rbp),%esi
  mov    -0x74(%rbp),%eax
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <set_up_ids_for_scheduled_decoding@plt>
  test   %rax,%rax
  jns    L41
  mov    $0x0,%eax
  jmp    L330
L41:
  mov    -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  mov    -0x54(%rbp),%ecx
  mov    -0x58(%rbp),%edx
  add    %ecx,%edx
  imul   %edx,%eax
  imul   -0x7c(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x28(%rbp)
  cmpl   $0x0,-0x58(%rbp)
  jle    L323
  mov    -0x74(%rbp),%eax
  imul   %eax,%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x48(%rbp)
  movl   $0x0,-0x6c(%rbp)
  jmp    L89
L114:
  mov    -0x6c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x6c(%rbp)
  jne    L285
  mov    -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x48(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <bzero@plt>
  movl   $0x0,-0x64(%rbp)
  jmp    L134
L157:
  mov    -0x6c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x64(%rbp),%eax
  add    %eax,%edx
  mov    -0x64(%rbp),%eax
  imul   -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movl   $0x1,(%rax)
  addl   $0x1,-0x64(%rbp)
L134:
  mov    -0x64(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L157
  jmp    L300
L285:
  mov    -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%esi
  mov    -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x6c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  sub    -0x74(%rbp),%eax
  imul   %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x88(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x48(%rbp),%rax
  mov    %esi,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
L300:
  mov    -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x48(%rbp)
  addl   $0x1,-0x6c(%rbp)
L89:
  mov    -0x6c(%rbp),%eax
  cmp    -0x74(%rbp),%eax
  jl     L114
  mov    -0x74(%rbp),%eax
  imul   %eax,%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <jerasure_invert_bitmatrix@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x48(%rbp)
  movl   $0x0,-0x6c(%rbp)
  jmp    L46
L163:
  mov    -0x74(%rbp),%eax
  cltq
  mov    %eax,%edx
  mov    -0x7c(%rbp),%eax
  cltq
  imul   %edx,%eax
  mov    -0x7c(%rbp),%edx
  movslq %edx,%rdx
  imul   %edx,%eax
  shl    $0x2,%eax
  mov    %eax,%esi
  mov    -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x74(%rbp),%ecx
  mov    -0x6c(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  imul   %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x48(%rbp),%rax
  mov    %esi,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x48(%rbp)
  addl   $0x1,-0x6c(%rbp)
L46:
  mov    -0x6c(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L163
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L323:
  movl   $0x0,-0x64(%rbp)
  jmp    L50
L60:
  mov    -0x64(%rbp),%edx
  mov    -0x58(%rbp),%eax
  add    %eax,%edx
  mov    -0x74(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  sub    -0x74(%rbp),%eax
  mov    %eax,-0x50(%rbp)
  mov    -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  mov    -0x58(%rbp),%ecx
  mov    -0x64(%rbp),%edx
  add    %ecx,%edx
  imul   %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x48(%rbp)
  mov    -0x74(%rbp),%eax
  cltq
  mov    %eax,%edx
  mov    -0x7c(%rbp),%eax
  cltq
  imul   %edx,%eax
  mov    -0x7c(%rbp),%edx
  movslq %edx,%rdx
  imul   %edx,%eax
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x50(%rbp),%eax
  imul   -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x88(%rbp),%rax
  add    %rax,%rcx
  mov    -0x48(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  movl   $0x0,-0x6c(%rbp)
  jmp    L203
L48:
  mov    -0x6c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x6c(%rbp)
  je     L108
  movl   $0x0,-0x68(%rbp)
  jmp    L226
L224:
  mov    -0x7c(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x68(%rbp),%eax
  imul   -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x6c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cltq
  add    %rcx,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x48(%rbp),%rax
  add    %rcx,%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <bzero@plt>
  addl   $0x1,-0x68(%rbp)
L226:
  mov    -0x68(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L224
L108:
  addl   $0x1,-0x6c(%rbp)
L203:
  mov    -0x6c(%rbp),%eax
  cmp    -0x74(%rbp),%eax
  jl     L48
  mov    -0x50(%rbp),%eax
  imul   -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  mov    -0x7c(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,-0x4c(%rbp)
  movl   $0x0,-0x6c(%rbp)
  jmp    L184
L227:
  mov    -0x6c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x6c(%rbp)
  je     L131
  mov    -0x6c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  sub    -0x74(%rbp),%eax
  imul   -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x68(%rbp)
  jmp    L272
L206:
  mov    -0x68(%rbp),%eax
  imul   -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x60(%rbp)
  jmp    L19
L245:
  mov    -0x68(%rbp),%eax
  imul   -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x4c(%rbp),%eax
  add    %eax,%edx
  mov    -0x6c(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  add    %eax,%edx
  mov    -0x60(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x88(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L74
  movl   $0x0,-0x5c(%rbp)
  jmp    L159
L115:
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  mov    -0x60(%rbp),%eax
  imul   -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x5c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x8(%rbp),%rax
  add    %rsi,%rax
  xor    %ecx,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x5c(%rbp)
L159:
  mov    -0x74(%rbp),%eax
  imul   -0x7c(%rbp),%eax
  cmp    %eax,-0x5c(%rbp)
  jl     L115
L74:
  addl   $0x1,-0x60(%rbp)
L19:
  mov    -0x60(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L245
  addl   $0x1,-0x68(%rbp)
L272:
  mov    -0x68(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L206
L131:
  addl   $0x1,-0x6c(%rbp)
L184:
  mov    -0x6c(%rbp),%eax
  cmp    -0x74(%rbp),%eax
  jl     L227
  addl   $0x1,-0x64(%rbp)
L50:
  mov    -0x64(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L60
  cmpl   $0x0,-0x80(%rbp)
  je     L293
  mov    -0x58(%rbp),%edx
  mov    -0x54(%rbp),%eax
  lea    (%rdx,%rax,1),%esi
  mov    -0x28(%rbp),%rcx
  mov    -0x7c(%rbp),%edx
  mov    -0x74(%rbp),%eax
  mov    %eax,%edi
  call   <jerasure_smart_bitmatrix_to_schedule@plt>
  mov    %rax,-0x40(%rbp)
  jmp    L104
L293:
  mov    -0x58(%rbp),%edx
  mov    -0x54(%rbp),%eax
  lea    (%rdx,%rax,1),%esi
  mov    -0x28(%rbp),%rcx
  mov    -0x7c(%rbp),%edx
  mov    -0x74(%rbp),%eax
  mov    %eax,%edi
  call   <jerasure_dumb_bitmatrix_to_schedule@plt>
  mov    %rax,-0x40(%rbp)
L104:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x40(%rbp),%rax
L330:
  leave
  ret
```

assistant: ```c
int **jerasure_generate_decoding_schedule(int k, int m, int w, int *bitmatrix, int *erasures, int smart) {
  int i, j, x, drive, y, index, z;
  int *decoding_matrix, *inverse, *real_decoding_matrix;
  int *ptr;
  int *row_ids;
  int *ind_to_row;
  int ddf, cdf;
  int **schedule;
  int *b1, *b2;
  ddf = 0;
  cdf = 0;
  for (i = 0; erasures[i] != -1; i++) {
    if (erasures[i] < k)
      ddf++;
    else
      cdf++;
  }
  row_ids = (int *)malloc(sizeof(int) * (k + m));
  ind_to_row = (int *)malloc(sizeof(int) * (k + m));
  if (set_up_ids_for_scheduled_decoding(k, m, erasures, row_ids, ind_to_row) < 0)
    return NULL;
  real_decoding_matrix = (int *)malloc(sizeof(int) * (k * w * (cdf + ddf) * w));
  if (ddf > 0) {
    decoding_matrix = (int *)malloc(sizeof(int) * (k * k * w * w));
    ptr = decoding_matrix;
    for (i = 0; i < k; i++) {
      if (row_ids[i] == i) {
        bzero(ptr, k * w * w * sizeof(int));
        for (x = 0; x < w; x++) {
          ptr[x + i * w + x * k * w] = 1;
        }
      } else {
        memcpy(ptr, bitmatrix + k * w * w * (row_ids[i] - k), k * w * w * sizeof(int));
      }
      ptr += (k * w * w);
    }
    inverse = (int *)malloc(sizeof(int) * (k * k * w * w));
    jerasure_invert_bitmatrix(decoding_matrix, inverse, k * w);
    free(decoding_matrix);
    ptr = real_decoding_matrix;
    for (i = 0; i < ddf; i++) {
      memcpy(ptr, inverse + k * w * w * row_ids[k + i], sizeof(int) * k * w * w);
      ptr += (k * w * w);
    }
    free(inverse);
  }
  for (x = 0; x < cdf; x++) {
    drive = row_ids[x + ddf + k] - k;
    ptr = real_decoding_matrix + k * w * w * (ddf + x);
    memcpy(ptr, bitmatrix + drive * k * w * w, sizeof(int) * k * w * w);
    for (i = 0; i < k; i++) {
      if (row_ids[i] != i) {
        for (j = 0; j < w; j++) {
          bzero(ptr + j * k * w + i * w, sizeof(int) * w);
        }
      }
    }
    index = drive * k * w * w;
    for (i = 0; i < k; i++) {
      if (row_ids[i] != i) {
        b1 = real_decoding_matrix + (ind_to_row[i] - k) * k * w * w;
        for (j = 0; j < w; j++) {
          b2 = ptr + j * k * w;
          for (y = 0; y < w; y++) {
            if (bitmatrix[index + j * k * w + i * w + y]) {
              for (z = 0; z < k * w; z++) {
                b2[z] = b2[z] ^ b1[z + y * k * w];
              }
            }
          }
        }
      }
    }
  }
  if (smart) {
    schedule = jerasure_smart_bitmatrix_to_schedule(k, ddf + cdf, w, real_decoding_matrix);
  } else {
    schedule = jerasure_dumb_bitmatrix_to_schedule(k, ddf + cdf, w, real_decoding_matrix);
  }
  free(row_ids);
  free(ind_to_row);
  free(real_decoding_matrix);
  return schedule;
}
```