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

```asm
<jerasure_matrix_to_bitmatrix>:
  endbr64
  push   %r15
  mov    %esi,%r15d
  push   %r14
  mov    %edx,%r14d
  mov    %edi,%edx
  push   %r13
  imul   %esi,%edx
  push   %r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x68,%rsp
  mov    %edi,0x40(%rsp)
  mov    %edx,%edi
  imul   %r14d,%edi
  mov    %esi,0x58(%rsp)
  mov    %rcx,0x50(%rsp)
  imul   %r14d,%edi
  shl    $0x2,%edi
  call   <malloc@plt>
  mov    %rax,0x38(%rsp)
  test   %rbp,%rbp
  je     L19
  mov    %rax,%rdi
  mov    %ebx,%eax
  mov    %ebx,%edx
  imul   %r14d,%eax
  test   %r15d,%r15d
  jle    L67
  mov    %eax,%ebx
  movslq %r14d,%r13
  cltq
  mov    %rdi,0x28(%rsp)
  imul   %r14d,%ebx
  lea    0x0(,%rax,4),%r15
  movl   $0x0,0x34(%rsp)
  lea    -0x1(%rdx),%eax
  movl   $0x0,0x24(%rsp)
  movl   $0x0,0x30(%rsp)
  movslq %ebx,%rcx
  mov    %ebx,0x44(%rsp)
  lea    0x0(,%rcx,4),%rbx
  mov    %eax,0x5c(%rsp)
  mov    %rbx,0x48(%rsp)
  lea    0x0(,%r13,4),%rbx
  mov    %rbx,0x10(%rsp)
L61:
  mov    0x40(%rsp),%eax
  test   %eax,%eax
  jle    L22
  movslq 0x34(%rsp),%rcx
  mov    0x5c(%rsp),%eax
  mov    0x50(%rsp),%rdx
  mov    0x30(%rsp),%ebx
  add    %rcx,%rax
  lea    0x4(%rdx,%rax,4),%rax
  lea    (%rdx,%rcx,4),%rbp
  mov    %rax,0x18(%rsp)
  mov    0x28(%rsp),%rax
  mov    %rax,0x8(%rsp)
  nopl   0x0(%rax)
L80:
  mov    0x0(%rbp),%edi
  test   %r14d,%r14d
  jle    L72
  mov    0x8(%rsp),%r12
  mov    %ebx,%r13d
  lea    (%r14,%rbx,1),%ebx
L41:
  mov    %r12,%rsi
  xor    %ecx,%ecx
  nopl   (%rax)
L11:
  mov    %edi,%eax
  sar    %cl,%eax
  add    $0x1,%ecx
  and    $0x1,%eax
  mov    %eax,(%rsi)
  add    %r15,%rsi
  cmp    %ecx,%r14d
  jne    L11
  mov    %r14d,%edx
  mov    $0x2,%esi
  add    $0x1,%r13d
  add    $0x4,%r12
  call   <galois_single_multiply@plt>
  mov    %eax,%edi
  cmp    %ebx,%r13d
  jne    L41
L55:
  mov    0x10(%rsp),%rdx
  add    $0x4,%rbp
  add    %rdx,0x8(%rsp)
  cmp    0x18(%rsp),%rbp
  jne    L80
L22:
  mov    0x48(%rsp),%rbx
  addl   $0x1,0x24(%rsp)
  add    %rbx,0x28(%rsp)
  mov    0x44(%rsp),%edx
  mov    0x40(%rsp),%ebx
  add    %edx,0x30(%rsp)
  add    %ebx,0x34(%rsp)
  mov    0x24(%rsp),%eax
  cmp    %eax,0x58(%rsp)
  jne    L61
L67:
  mov    0x38(%rsp),%rax
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L72:
  add    %r14d,%ebx
  jmp    L55
L19:
  movq   $0x0,0x38(%rsp)
  jmp    L67
```

assistant: ```c
int *jerasure_matrix_to_bitmatrix(int k, int m, int w, int *matrix) {
  int *bitmatrix;
  int rowelts, rowindex, colindex, elt, i, j, l, x;
  bitmatrix = (int *)malloc(sizeof(int) * (k * m * w * w));
  if (matrix == NULL) {
    return NULL;
  }
  rowelts = k * w;
  rowindex = 0;
  for (i = 0; i < m; i++) {
    colindex = rowindex;
    for (j = 0; j < k; j++) {
      elt = matrix[i * k + j];
      for (x = 0; x < w; x++) {
        for (l = 0; l < w; l++) {
          bitmatrix[colindex + x + l * rowelts] = ((elt & (1 << l)) ? 1 : 0);
        }
        elt = galois_single_multiply(elt, 2, w);
      }
      colindex += w;
    }
    rowindex += rowelts * w;
  }
  return bitmatrix;
}
```