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

```asm
<liber8tion_coding_bitmatrix>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    $0x0,%r12d
  cmp    $0x8,%edi
  jg     L96
  mov    %edi,%ebp
  shl    $0x9,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L96
  mov    %rax,%r12
  mov    %ebp,%esi
  shl    $0x9,%esi
  mov    %rax,%rdi
  call   <bzero@plt>
  lea    0x0(,%rbp,8),%eax
  lea    0x1(%rax),%r8d
  movslq %r8d,%r8
  shl    $0x2,%r8
  mov    %rbx,%rdi
  lea    -0x1(%rbp),%ecx
  add    $0x1,%rcx
  shl    $0x5,%rcx
  add    %rbx,%rcx
  mov    $0x8,%esi
L101:
  test   %ebp,%ebp
  jle    L11
  mov    %rdi,%rdx
L109:
  movl   $0x1,(%rdx)
  add    $0x20,%rdx
  cmp    %rcx,%rdx
  jne    L109
L11:
  add    %r8,%rdi
  add    %r8,%rcx
  sub    $0x1,%esi
  jne    L101
  test   %ebp,%ebp
  je     L96
  mov    %ebp,%edx
  shl    $0x6,%edx
  movslq %edx,%rdi
  movl   $0x1,(%rbx,%rdi,4)
  lea    (%rdx,%rax,1),%esi
  lea    0x1(%rsi),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%r10
  movl   $0x1,(%rbx,%rdx,4)
  mov    %esi,0xc(%rsp)
  lea    (%rsi,%rax,1),%edx
  lea    0x2(%rdx),%ecx
  movslq %ecx,%rcx
  lea    0x0(,%rcx,4),%r14
  movl   $0x1,(%rbx,%rcx,4)
  lea    (%rdx,%rax,1),%ecx
  lea    0x3(%rcx),%esi
  movslq %esi,%rsi
  lea    0x0(,%rsi,4),%r13
  movl   $0x1,(%rbx,%rsi,4)
  lea    (%rcx,%rax,1),%esi
  lea    0x4(%rsi),%r8d
  movslq %r8d,%r8
  lea    0x0(,%r8,4),%r9
  movl   $0x1,(%rbx,%r8,4)
  lea    (%rsi,%rax,1),%r15d
  lea    0x5(%r15),%r11d
  movslq %r11d,%r11
  lea    0x0(,%r11,4),%r8
  movl   $0x1,(%rbx,%r11,4)
  lea    (%r15,%rax,1),%r11d
  mov    %r11d,0x4(%rsp)
  lea    0x6(%r11),%r15d
  movslq %r15d,%r15
  lea    0x0(,%r15,4),%r11
  movl   $0x1,(%rbx,%r15,4)
  add    0x4(%rsp),%eax
  mov    %eax,0x8(%rsp)
  lea    0x7(%rax),%r15d
  movslq %r15d,%r15
  lea    0x0(,%r15,4),%rax
  movl   $0x1,(%rbx,%r15,4)
  cmp    $0x1,%ebp
  je     L96
  add    $0xf,%rdi
  lea    0x0(,%rdi,4),%r15
  movl   $0x1,(%rbx,%rdi,4)
  movl   $0x1,0x28(%rbx,%r10,1)
  add    $0x8,%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rdi
  movl   $0x1,(%rbx,%rdx,4)
  movl   $0x1,0x1c(%rbx,%r13,1)
  movl   $0x1,0x28(%rbx,%r9,1)
  movl   $0x1,0x10(%rbx,%r8,1)
  movl   $0x1,0x1c(%rbx,%r11,1)
  movl   $0x1,0x14(%rbx,%rax,1)
  movl   $0x1,0x2c(%rbx,%r9,1)
  cmp    $0x2,%ebp
  je     L96
  movl   $0x1,0x1c(%rbx,%r15,1)
  movl   $0x1,0x44(%rbx,%r10,1)
  movl   $0x1,0x48(%rbx,%r14,1)
  lea    0x10(%rcx),%edx
  movslq %edx,%rdx
  movl   $0x1,(%rbx,%rdx,4)
  movl   $0x1,0x4c(%rbx,%r9,1)
  movl   $0x1,0x38(%rbx,%r8,1)
  movl   $0x1,0x2c(%rbx,%r11,1)
  movl   $0x1,0x38(%rbx,%rax,1)
  movl   $0x1,0x48(%rbx,%r10,1)
  cmp    $0x3,%ebp
  je     L96
  movl   $0x1,0x2c(%rbx,%r15,1)
  movl   $0x1,0x70(%rbx,%r10,1)
  movl   $0x1,0x74(%rbx,%r14,1)
  movl   $0x1,0x6c(%rbx,%r13,1)
  lea    0x18(%rsi),%edx
  movslq %edx,%rdx
  movl   $0x1,(%rbx,%rdx,4)
  movl   $0x1,0x58(%rbx,%r8,1)
  movl   $0x1,0x58(%rbx,%r11,1)
  movl   $0x1,0x48(%rbx,%rax,1)
  movl   $0x1,0x5c(%rbx,%r8,1)
  cmp    $0x4,%ebp
  je     L96
  movl   $0x1,0x58(%rbx,%r15,1)
  movl   $0x1,0x94(%rbx,%r10,1)
  movl   $0x1,0x7c(%rbx,%r14,1)
  movl   $0x1,0x90(%rbx,%r13,1)
  movl   $0x1,0x78(%rbx,%r9,1)
  movl   $0x1,0x7c(%rbx,%r8,1)
  movl   $0x1,0x74(%rbx,%r11,1)
  mov    0x8(%rsp),%edx
  add    $0x20,%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  movl   $0x1,(%rbx,%rdx,4)
  movl   $0x1,0x60(%rbx,%rdi,1)
  cmp    $0x5,%ebp
  je     L96
  movl   $0x1,0x68(%rbx,%r15,1)
  movl   $0x1,0xa4(%rbx,%r10,1)
  movl   $0x1,0xa4(%rbx,%r14,1)
  movl   $0x1,0xa4(%rbx,%r13,1)
  movl   $0x1,0xa4(%rbx,%r9,1)
  movl   $0x1,0xa4(%rbx,%r8,1)
  movl   $0x1,0xa4(%rbx,%r11,1)
  movl   $0x1,0x20(%rbx,%rcx,1)
  movl   $0x1,0x8c(%rbx,%rax,1)
  cmp    $0x6,%ebp
  je     L96
  movl   $0x1,0x90(%rbx,%r15,1)
  mov    0xc(%rsp),%esi
  add    $0x30,%esi
  movslq %esi,%rdx
  movl   $0x1,(%rbx,%rdx,4)
  movl   $0x1,0xd0(%rbx,%r14,1)
  movl   $0x1,0xc8(%rbx,%r13,1)
  movl   $0x1,0xb4(%rbx,%r9,1)
  movl   $0x1,0xc8(%rbx,%r8,1)
  movl   $0x1,0xb8(%rbx,%r11,1)
  movl   $0x1,0xac(%rbx,%rax,1)
  movl   $0x1,0xbc(%rbx,%r11,1)
  cmp    $0x7,%ebp
  je     L96
  movl   $0x1,0xb4(%rbx,%r15,1)
  movl   $0x1,0xf8(%rbx,%r10,1)
  movl   $0x1,0xdc(%rbx,%r14,1)
  movl   $0x1,0xe8(%rbx,%r13,1)
  movl   $0x1,0xdc(%rbx,%r9,1)
  movl   $0x1,0xd4(%rbx,%r8,1)
  mov    0x4(%rsp),%r11d
  add    $0x38,%r11d
  movslq %r11d,%rdx
  movl   $0x1,(%rbx,%rdx,4)
  movl   $0x1,0xdc(%rbx,%rax,1)
  movl   $0x1,0xd8(%rbx,%r13,1)
L96:
  mov    %r12,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int *liber8tion_coding_bitmatrix(int k) {
  int *matrix, i, j, index;
  int w;
  w = 8;
  if (k > w)
    return NULL;
  matrix = (int *)malloc(sizeof(int) * (2 * k * w * w));
  if (matrix == NULL)
    return NULL;
  bzero(matrix, sizeof(int) * 2 * k * w * w);
  for (i = 0; i < w; i++) {
    index = i * k * w + i;
    for (j = 0; j < k; j++) {
      matrix[index] = 1;
      index += w;
    }
  }
  index = k * w * w;
  if (k == 0)
    return matrix;
  matrix[index + 0 * k * w + 0 * w + 0] = 1;
  matrix[index + 1 * k * w + 0 * w + 1] = 1;
  matrix[index + 2 * k * w + 0 * w + 2] = 1;
  matrix[index + 3 * k * w + 0 * w + 3] = 1;
  matrix[index + 4 * k * w + 0 * w + 4] = 1;
  matrix[index + 5 * k * w + 0 * w + 5] = 1;
  matrix[index + 6 * k * w + 0 * w + 6] = 1;
  matrix[index + 7 * k * w + 0 * w + 7] = 1;
  if (k == 1)
    return matrix;
  matrix[index + 0 * k * w + 1 * w + 7] = 1;
  matrix[index + 1 * k * w + 1 * w + 3] = 1;
  matrix[index + 2 * k * w + 1 * w + 0] = 1;
  matrix[index + 3 * k * w + 1 * w + 2] = 1;
  matrix[index + 4 * k * w + 1 * w + 6] = 1;
  matrix[index + 5 * k * w + 1 * w + 1] = 1;
  matrix[index + 6 * k * w + 1 * w + 5] = 1;
  matrix[index + 7 * k * w + 1 * w + 4] = 1;
  matrix[index + 4 * k * w + 1 * w + 7] = 1;
  if (k == 2)
    return matrix;
  matrix[index + 0 * k * w + 2 * w + 6] = 1;
  matrix[index + 1 * k * w + 2 * w + 2] = 1;
  matrix[index + 2 * k * w + 2 * w + 4] = 1;
  matrix[index + 3 * k * w + 2 * w + 0] = 1;
  matrix[index + 4 * k * w + 2 * w + 7] = 1;
  matrix[index + 5 * k * w + 2 * w + 3] = 1;
  matrix[index + 6 * k * w + 2 * w + 1] = 1;
  matrix[index + 7 * k * w + 2 * w + 5] = 1;
  matrix[index + 1 * k * w + 2 * w + 3] = 1;
  if (k == 3)
    return matrix;
  matrix[index + 0 * k * w + 3 * w + 2] = 1;
  matrix[index + 1 * k * w + 3 * w + 5] = 1;
  matrix[index + 2 * k * w + 3 * w + 7] = 1;
  matrix[index + 3 * k * w + 3 * w + 6] = 1;
  matrix[index + 4 * k * w + 3 * w + 0] = 1;
  matrix[index + 5 * k * w + 3 * w + 3] = 1;
  matrix[index + 6 * k * w + 3 * w + 4] = 1;
  matrix[index + 7 * k * w + 3 * w + 1] = 1;
  matrix[index + 5 * k * w + 3 * w + 4] = 1;
  if (k == 4)
    return matrix;
  matrix[index + 0 * k * w + 4 * w + 5] = 1;
  matrix[index + 1 * k * w + 4 * w + 6] = 1;
  matrix[index + 2 * k * w + 4 * w + 1] = 1;
  matrix[index + 3 * k * w + 4 * w + 7] = 1;
  matrix[index + 4 * k * w + 4 * w + 2] = 1;
  matrix[index + 5 * k * w + 4 * w + 4] = 1;
  matrix[index + 6 * k * w + 4 * w + 3] = 1;
  matrix[index + 7 * k * w + 4 * w + 0] = 1;
  matrix[index + 2 * k * w + 4 * w + 0] = 1;
  if (k == 5)
    return matrix;
  matrix[index + 0 * k * w + 5 * w + 1] = 1;
  matrix[index + 1 * k * w + 5 * w + 2] = 1;
  matrix[index + 2 * k * w + 5 * w + 3] = 1;
  matrix[index + 3 * k * w + 5 * w + 4] = 1;
  matrix[index + 4 * k * w + 5 * w + 5] = 1;
  matrix[index + 5 * k * w + 5 * w + 6] = 1;
  matrix[index + 6 * k * w + 5 * w + 7] = 1;
  matrix[index + 7 * k * w + 5 * w + 0] = 1;
  matrix[index + 7 * k * w + 5 * w + 2] = 1;
  if (k == 6)
    return matrix;
  matrix[index + 0 * k * w + 6 * w + 3] = 1;
  matrix[index + 1 * k * w + 6 * w + 0] = 1;
  matrix[index + 2 * k * w + 6 * w + 6] = 1;
  matrix[index + 3 * k * w + 6 * w + 5] = 1;
  matrix[index + 4 * k * w + 6 * w + 1] = 1;
  matrix[index + 5 * k * w + 6 * w + 7] = 1;
  matrix[index + 6 * k * w + 6 * w + 4] = 1;
  matrix[index + 7 * k * w + 6 * w + 2] = 1;
  matrix[index + 6 * k * w + 6 * w + 5] = 1;
  if (k == 7)
    return matrix;
  matrix[index + 0 * k * w + 7 * w + 4] = 1;
  matrix[index + 1 * k * w + 7 * w + 7] = 1;
  matrix[index + 2 * k * w + 7 * w + 1] = 1;
  matrix[index + 3 * k * w + 7 * w + 5] = 1;
  matrix[index + 4 * k * w + 7 * w + 3] = 1;
  matrix[index + 5 * k * w + 7 * w + 2] = 1;
  matrix[index + 6 * k * w + 7 * w + 0] = 1;
  matrix[index + 7 * k * w + 7 * w + 6] = 1;
  matrix[index + 3 * k * w + 7 * w + 1] = 1;
  return matrix;
}
```