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

```asm
<jerasure_generate_decoding_schedule>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  sub    $0xc8,%rsp
  mov    (%r8),%eax
  mov    %edi,0x34(%rsp)
  mov    %rcx,0x40(%rsp)
  mov    %r9d,0xb4(%rsp)
  cmp    $0xffffffff,%eax
  je     L156
  lea    0x4(%r8),%rdx
  xor    %ebp,%ebp
  xor    %ebx,%ebx
  jmp    L215
L228:
  mov    (%rdx),%eax
  add    $0x4,%rdx
  add    $0x1,%ebx
  cmp    $0xffffffff,%eax
  je     L194
L215:
  cmp    %eax,0x34(%rsp)
  jg     L228
  mov    (%rdx),%eax
  add    $0x4,%rdx
  add    $0x1,%ebp
  cmp    $0xffffffff,%eax
  jne    L215
L194:
  mov    0x34(%rsp),%r14d
  add    %r12d,%r14d
  shl    $0x2,%r14d
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %r14d,%edi
  mov    %rax,0x48(%rsp)
  call   <malloc@plt>
  mov    0x34(%rsp),%r14d
  mov    %r12d,%esi
  mov    %r13,%rdx
  mov    0x48(%rsp),%rcx
  mov    %rax,%r8
  mov    %rax,0x90(%rsp)
  xor    %r12d,%r12d
  mov    %r14d,%edi
  call   <set_up_ids_for_scheduled_decoding@plt>
  test   %rax,%rax
  js     L97
  mov    %r14d,%edi
  lea    0x0(%rbp,%rbx,1),%eax
  imul   %r15d,%edi
  mov    %eax,0x98(%rsp)
  mov    %edi,0x84(%rsp)
  imul   %eax,%edi
  imul   %r15d,%edi
  shl    $0x2,%edi
  call   <malloc@plt>
  mov    %rax,0x50(%rsp)
  test   %ebx,%ebx
  jne    L94
L84:
  test   %ebp,%ebp
  je     L81
  mov    %r15d,%edx
  movslq 0x34(%rsp),%rcx
  mov    0x48(%rsp),%r11
  imul   %r15d,%edx
  mov    0x84(%rsp),%edi
  mov    %rcx,%rsi
  mov    %edi,%eax
  imul   %ecx,%edx
  imul   %r15d,%eax
  shl    $0x2,%edx
  mov    %edx,0x9c(%rsp)
  lea    0x0(,%r15,4),%edx
  mov    %edx,0xb0(%rsp)
  movslq %ebx,%rdx
  add    %rcx,%rdx
  lea    (%r11,%rdx,4),%rcx
  mov    %rcx,0x88(%rsp)
  movslq %eax,%rcx
  imul   %ebx,%eax
  mov    0x50(%rsp),%rbx
  shl    $0x2,%rcx
  mov    %rcx,0xa0(%rsp)
  cltq
  lea    (%rbx,%rax,4),%r14
  lea    -0x1(%rbp),%eax
  mov    %esi,%ebx
  add    %rdx,%rax
  imul   %r15d,%ebx
  lea    0x4(%r11,%rax,4),%rax
  mov    %rax,0xa8(%rsp)
  movslq %edi,%rax
  lea    0x0(,%rax,4),%r12
  lea    -0x1(%rdi),%eax
  lea    0x4(,%rax,4),%rax
  mov    %rax,0xb8(%rsp)
  mov    0x90(%rsp),%rax
  sub    %r11,%rax
  mov    %rax,0x60(%rsp)
L89:
  mov    0x88(%rsp),%rax
  mov    0x34(%rsp),%ebp
  mov    0x40(%rsp),%rdi
  mov    0x9c(%rsp),%edx
  mov    (%rax),%eax
  mov    %eax,0x8(%rsp)
  sub    %ebp,%eax
  imul   %ebp,%eax
  imul   %r15d,%eax
  imul   %r15d,%eax
  cltq
  lea    (%rdi,%rax,4),%rsi
  mov    %r14,%rdi
  mov    %rax,0x58(%rsp)
  call   <memcpy@plt>
  mov    0x48(%rsp),%rax
  movl   $0x0,0x10(%rsp)
  movl   $0x0,0x3c(%rsp)
  mov    %rax,0x8(%rsp)
  test   %ebp,%ebp
  jle    L49
  mov    %ebx,0x20(%rsp)
  xor    %r13d,%r13d
  mov    0xb0(%rsp),%ebx
  mov    %r14,0x18(%rsp)
  jmp    L172
  nopl   0x0(%rax,%rax,1)
L155:
  addq   $0x4,0x8(%rsp)
  lea    0x1(%r13),%eax
  add    %r15d,0x10(%rsp)
  cmp    %eax,0x34(%rsp)
  je     L27
  mov    %eax,%r13d
L172:
  mov    0x8(%rsp),%rax
  cmp    %r13d,(%rax)
  je     L155
  test   %r15d,%r15d
  jle    L155
  movslq 0x10(%rsp),%rax
  mov    0x18(%rsp),%rdi
  xor    %r14d,%r14d
  lea    (%rdi,%rax,4),%rbp
  nopl   0x0(%rax)
L227:
  mov    %rbp,%rdi
  mov    %ebx,%esi
  add    $0x1,%r14d
  add    %r12,%rbp
  call   <bzero@plt>
  cmp    %r14d,%r15d
  jne    L227
  jmp    L155
L49:
  addq   $0x4,0x88(%rsp)
  add    0xa0(%rsp),%r14
  mov    0x88(%rsp),%rax
  cmp    0xa8(%rsp),%rax
  jne    L89
L81:
  mov    0xb4(%rsp),%edx
  test   %edx,%edx
  jne    L137
  mov    0x50(%rsp),%rcx
  mov    0x98(%rsp),%esi
  mov    %r15d,%edx
  mov    0x34(%rsp),%edi
  call   <jerasure_dumb_bitmatrix_to_schedule@plt>
  mov    %rax,%r12
L99:
  mov    0x48(%rsp),%rdi
  call   <free@plt>
  mov    0x90(%rsp),%rdi
  call   <free@plt>
  mov    0x50(%rsp),%rdi
  call   <free@plt>
L97:
  add    $0xc8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L27:
  mov    0x18(%rsp),%r14
  mov    0x20(%rsp),%ebx
  mov    %eax,0x80(%rsp)
  mov    0xb8(%rsp),%rax
  mov    %r13d,0x3c(%rsp)
  movl   $0x0,0x38(%rsp)
  mov    0x84(%rsp),%ebp
  add    %r14,%rax
  movl   $0x0,0x20(%rsp)
  mov    %rax,0x68(%rsp)
  mov    0x48(%rsp),%rax
  mov    %rax,0x28(%rsp)
  lea    -0x1(%r15),%eax
  add    0x58(%rsp),%rax
  mov    %rax,0x70(%rsp)
  mov    0x40(%rsp),%rax
  add    $0x4,%rax
  mov    %rax,0x78(%rsp)
  mov    0x50(%rsp),%rax
  sub    %r14,%rax
  mov    %rax,0x18(%rsp)
  jmp    L278
L202:
  mov    0x20(%rsp),%edi
  addq   $0x4,0x28(%rsp)
  add    %r15d,0x38(%rsp)
  lea    0x1(%rdi),%eax
  cmp    %edi,0x3c(%rsp)
  je     L49
  mov    %eax,0x20(%rsp)
L278:
  mov    0x28(%rsp),%rax
  mov    0x20(%rsp),%edi
  cmp    %edi,(%rax)
  je     L202
  mov    0x60(%rsp),%rax
  mov    0x28(%rsp),%rdi
  mov    (%rax,%rdi,1),%eax
  mov    %eax,%r10d
  mov    %eax,0x8(%rsp)
  mov    0x80(%rsp),%eax
  sub    %eax,%r10d
  imul   %eax,%r10d
  imul   %r15d,%r10d
  imul   %r15d,%r10d
  movslq %r10d,%r10
  test   %r15d,%r15d
  jle    L202
  movslq 0x38(%rsp),%rax
  mov    0x70(%rsp),%rdi
  xor    %r9d,%r9d
  xor    %r11d,%r11d
  mov    0x68(%rsp),%rcx
  lea    (%rdi,%rax,1),%rdx
  mov    0x78(%rsp),%rdi
  add    0x58(%rsp),%rax
  lea    (%rdi,%rdx,4),%r8
  mov    0x40(%rsp),%rdi
  lea    (%rdi,%rax,4),%rax
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax)
L69:
  mov    0x10(%rsp),%rax
  mov    0x18(%rsp),%r13
  xor    %edi,%edi
  lea    (%rax,%r9,1),%rdx
  sub    %r9,%r13
  jmp    L232
  nopl   (%rax)
L39:
  add    $0x4,%rdx
  add    %ebx,%edi
  cmp    %rdx,%r8
  je     L83
L232:
  mov    (%rdx),%eax
  test   %eax,%eax
  je     L39
  test   %ebp,%ebp
  jle    L39
  movslq %edi,%rsi
  mov    %rdx,0x8(%rsp)
  lea    (%r9,%r14,1),%rax
  add    %r10,%rsi
  lea    0x0(%r13,%rsi,4),%rsi
  nopl   0x0(%rax)
L197:
  mov    (%rax,%rsi,1),%edx
  xor    %edx,(%rax)
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L197
  mov    0x8(%rsp),%rdx
  add    %ebx,%edi
  add    $0x4,%rdx
  cmp    %rdx,%r8
  jne    L232
L83:
  add    $0x1,%r11d
  add    %r12,%r8
  add    %r12,%r9
  add    %r12,%rcx
  cmp    %r11d,%r15d
  jne    L69
  jmp    L202
L137:
  mov    0x50(%rsp),%rcx
  mov    0x98(%rsp),%esi
  mov    %r15d,%edx
  mov    0x34(%rsp),%edi
  call   <jerasure_smart_bitmatrix_to_schedule@plt>
  mov    %rax,%r12
  jmp    L99
L94:
  mov    %r14d,%eax
  imul   %r15d,%eax
  imul   %eax,%eax
  lea    0x0(,%rax,4),%r13d
  mov    %r13d,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %r14d,%r14d
  jle    L392
  mov    0x84(%rsp),%edi
  mov    %r12,%rcx
  xor    %r14d,%r14d
  mov    %ebx,0x38(%rsp)
  mov    %ebp,0x3c(%rsp)
  mov    %r14d,%ebp
  mov    %r12,%r14
  mov    %r15d,%r12d
  mov    %edi,%esi
  movl   $0x0,0x10(%rsp)
  imul   %r15d,%esi
  mov    %rcx,%r15
  movslq %esi,%rax
  lea    0x0(,%rsi,4),%edx
  mov    %esi,0x18(%rsp)
  shl    $0x2,%rax
  mov    %edx,%ebx
  mov    %rax,0x20(%rsp)
  mov    0x48(%rsp),%rax
  mov    %rax,0x8(%rsp)
  movslq %edi,%rax
  lea    0x4(,%rax,4),%rax
  mov    %rax,0x28(%rsp)
  jmp    L258
L106:
  sub    0x34(%rsp),%eax
  imul   0x18(%rsp),%eax
  mov    %ebx,%edx
  mov    0x40(%rsp),%rdi
  cltq
  lea    (%rdi,%rax,4),%rsi
  mov    %r15,%rdi
  call   <memcpy@plt>
L116:
  addq   $0x4,0x8(%rsp)
  add    0x20(%rsp),%r15
  add    $0x1,%ebp
  add    %r12d,0x10(%rsp)
  cmp    %ebp,0x34(%rsp)
  je     L357
L258:
  mov    0x8(%rsp),%rax
  mov    (%rax),%eax
  cmp    %ebp,%eax
  jne    L106
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <bzero@plt>
  test   %r12d,%r12d
  jle    L116
  movslq 0x10(%rsp),%rax
  lea    (%r15,%rax,4),%rsi
  xor    %eax,%eax
L289:
  add    $0x1,%eax
  movl   $0x1,(%rsi)
  add    0x28(%rsp),%rsi
  cmp    %eax,%r12d
  jne    L289
  jmp    L116
L357:
  mov    0x38(%rsp),%ebx
  mov    0x3c(%rsp),%ebp
  mov    %r12d,%r15d
  mov    %r14,%r12
L392:
  mov    %r13d,%edi
  call   <malloc@plt>
  mov    0x84(%rsp),%r13d
  mov    %r12,%rdi
  mov    %rax,%rsi
  mov    %rax,%r14
  mov    %r13d,%edx
  call   <jerasure_invert_bitmatrix@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    %r13d,%ecx
  mov    %r15d,%edx
  movslq 0x34(%rsp),%rax
  imul   %r15d,%ecx
  mov    0x50(%rsp),%r12
  mov    %ebp,0x18(%rsp)
  imul   %r15d,%edx
  mov    %r15d,0x20(%rsp)
  mov    %ebx,%r15d
  movslq %ecx,%rsi
  mov    %ecx,%ebp
  imul   %eax,%edx
  lea    0x0(,%rsi,4),%rdi
  mov    %rdi,0x8(%rsp)
  mov    0x48(%rsp),%rdi
  lea    -0x1(%rbx),%esi
  lea    (%rdi,%rax,4),%r13
  add    %rsi,%rax
  shl    $0x2,%edx
  lea    0x4(%rdi,%rax,4),%rax
  mov    %edx,%ebx
  mov    %rax,0x10(%rsp)
L30:
  mov    0x0(%r13),%eax
  mov    %r12,%rdi
  mov    %ebx,%edx
  add    $0x4,%r13
  imul   %ebp,%eax
  cltq
  lea    (%r14,%rax,4),%rsi
  call   <memcpy@plt>
  add    0x8(%rsp),%r12
  cmp    0x10(%rsp),%r13
  jne    L30
  mov    %r14,%rdi
  mov    %r15d,%ebx
  mov    0x18(%rsp),%ebp
  mov    0x20(%rsp),%r15d
  call   <free@plt>
  jmp    L84
L156:
  xor    %ebp,%ebp
  xor    %ebx,%ebx
  jmp    L194
```

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