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    $0x28,%rsp
  cmp    $0x8,%edi
  jg     L85
  mov    %edi,%r13d
  mov    %edi,%ebp
  shl    $0x9,%r13d
  mov    %r13d,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L85
  mov    %r13d,%esi
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <bzero@plt>
  lea    -0x1(%rbp),%ecx
  mov    %rbx,%rdi
  mov    $0x8,%esi
  lea    0x0(,%rbp,8),%eax
  add    $0x1,%rcx
  lea    0x1(%rax),%r8d
  shl    $0x5,%rcx
  movslq %r8d,%r8
  add    %rbx,%rcx
  shl    $0x2,%r8
  xchg   %ax,%ax
L29:
  test   %ebp,%ebp
  jle    L49
  mov    %rdi,%rdx
  nopw   0x0(%rax,%rax,1)
L4:
  movl   $0x1,(%rdx)
  add    $0x20,%rdx
  cmp    %rcx,%rdx
  jne    L4
L49:
  add    %r8,%rdi
  add    %r8,%rcx
  sub    $0x1,%esi
  jne    L29
  test   %ebp,%ebp
  je     L44
  mov    %ebp,%ecx
  shl    $0x6,%ecx
  movslq %ecx,%r8
  add    %eax,%ecx
  lea    0x1(%rcx),%edx
  movl   $0x1,(%rbx,%r8,4)
  movslq %edx,%rdx
  movl   $0x1,(%rbx,%rdx,4)
  lea    0x0(,%rdx,4),%r11
  lea    (%rcx,%rax,1),%edx
  lea    0x2(%rdx),%esi
  movslq %esi,%rsi
  movl   $0x1,(%rbx,%rsi,4)
  lea    0x0(,%rsi,4),%rdi
  lea    (%rdx,%rax,1),%esi
  mov    %rdi,0x10(%rsp)
  lea    0x3(%rsi),%edi
  movslq %edi,%rdi
  movl   $0x1,(%rbx,%rdi,4)
  lea    0x0(,%rdi,4),%r14
  lea    (%rsi,%rax,1),%edi
  lea    (%rdi,%rax,1),%r15d
  lea    0x4(%rdi),%r9d
  lea    0x5(%r15),%r13d
  add    %eax,%r15d
  movslq %r9d,%r9
  mov    %r15d,0x18(%rsp)
  add    0x18(%rsp),%eax
  add    $0x6,%r15d
  movslq %r13d,%r13
  mov    %eax,0x1c(%rsp)
  add    $0x7,%eax
  movslq %r15d,%r15
  lea    0x0(,%r9,4),%r10
  cltq
  movl   $0x1,(%rbx,%r9,4)
  lea    0x0(,%r13,4),%r9
  movl   $0x1,(%rbx,%r13,4)
  lea    0x0(,%r15,4),%r13
  movl   $0x1,(%rbx,%r15,4)
  lea    0x0(,%rax,4),%r15
  movl   $0x1,(%rbx,%rax,4)
  cmp    $0x1,%ebp
  je     L44
  add    $0xf,%r8
  lea    0x0(,%r8,4),%rax
  movl   $0x1,(%rbx,%r8,4)
  mov    %rax,0x8(%rsp)
  lea    0x8(%rdx),%eax
  movl   $0x1,0x28(%rbx,%r11,1)
  cltq
  movl   $0x1,(%rbx,%rax,4)
  lea    0x0(,%rax,4),%r8
  movl   $0x1,0x1c(%rbx,%r14,1)
  movl   $0x1,0x28(%rbx,%r10,1)
  movl   $0x1,0x10(%rbx,%r9,1)
  movl   $0x1,0x1c(%rbx,%r13,1)
  movl   $0x1,0x14(%rbx,%r15,1)
  movl   $0x1,0x2c(%rbx,%r10,1)
  cmp    $0x2,%ebp
  je     L44
  mov    0x8(%rsp),%rdx
  lea    0x10(%rsi),%eax
  cltq
  movl   $0x1,0x1c(%rbx,%rdx,1)
  mov    0x10(%rsp),%rdx
  movl   $0x1,0x44(%rbx,%r11,1)
  movl   $0x1,0x48(%rbx,%rdx,1)
  movl   $0x1,(%rbx,%rax,4)
  movl   $0x1,0x4c(%rbx,%r10,1)
  movl   $0x1,0x38(%rbx,%r9,1)
  movl   $0x1,0x2c(%rbx,%r13,1)
  movl   $0x1,0x38(%rbx,%r15,1)
  movl   $0x1,0x48(%rbx,%r11,1)
  cmp    $0x3,%ebp
  je     L44
  mov    0x8(%rsp),%rsi
  lea    0x18(%rdi),%eax
  cltq
  movl   $0x1,0x2c(%rbx,%rsi,1)
  mov    %rdx,%rsi
  movl   $0x1,0x70(%rbx,%r11,1)
  movl   $0x1,0x74(%rbx,%rdx,1)
  movl   $0x1,0x6c(%rbx,%r14,1)
  movl   $0x1,(%rbx,%rax,4)
  movl   $0x1,0x58(%rbx,%r9,1)
  movl   $0x1,0x58(%rbx,%r13,1)
  movl   $0x1,0x48(%rbx,%r15,1)
  movl   $0x1,0x5c(%rbx,%r9,1)
  cmp    $0x4,%ebp
  je     L44
  mov    0x1c(%rsp),%eax
  mov    0x8(%rsp),%rdi
  add    $0x20,%eax
  movl   $0x1,0x58(%rbx,%rdi,1)
  movl   $0x1,0x94(%rbx,%r11,1)
  cltq
  movl   $0x1,0x7c(%rbx,%rdx,1)
  lea    0x0(,%rax,4),%rdx
  movl   $0x1,0x90(%rbx,%r14,1)
  movl   $0x1,0x78(%rbx,%r10,1)
  movl   $0x1,0x7c(%rbx,%r9,1)
  movl   $0x1,0x74(%rbx,%r13,1)
  movl   $0x1,(%rbx,%rax,4)
  movl   $0x1,0x60(%rbx,%r8,1)
  cmp    $0x5,%ebp
  je     L44
  movl   $0x1,0x68(%rbx,%rdi,1)
  movl   $0x1,0xa4(%rbx,%r11,1)
  movl   $0x1,0xa4(%rbx,%rsi,1)
  movl   $0x1,0xa4(%rbx,%r14,1)
  movl   $0x1,0xa4(%rbx,%r10,1)
  movl   $0x1,0xa4(%rbx,%r9,1)
  movl   $0x1,0xa4(%rbx,%r13,1)
  movl   $0x1,0x20(%rbx,%rdx,1)
  movl   $0x1,0x8c(%rbx,%r15,1)
  cmp    $0x6,%ebp
  je     L44
  movl   $0x1,0x90(%rbx,%rdi,1)
  lea    0x30(%rcx),%eax
  cltq
  movl   $0x1,(%rbx,%rax,4)
  movl   $0x1,0xd0(%rbx,%rsi,1)
  movl   $0x1,0xc8(%rbx,%r14,1)
  movl   $0x1,0xb4(%rbx,%r10,1)
  movl   $0x1,0xc8(%rbx,%r9,1)
  movl   $0x1,0xb8(%rbx,%r13,1)
  movl   $0x1,0xac(%rbx,%r15,1)
  movl   $0x1,0xbc(%rbx,%r13,1)
  cmp    $0x7,%ebp
  je     L44
  movl   $0x1,0xb4(%rbx,%rdi,1)
  mov    0x18(%rsp),%eax
  movl   $0x1,0xf8(%rbx,%r11,1)
  movl   $0x1,0xdc(%rbx,%rsi,1)
  add    $0x38,%eax
  movl   $0x1,0xe8(%rbx,%r14,1)
  cltq
  movl   $0x1,0xdc(%rbx,%r10,1)
  movl   $0x1,0xd4(%rbx,%r9,1)
  movl   $0x1,(%rbx,%rax,4)
  movl   $0x1,0xdc(%rbx,%r15,1)
  movl   $0x1,0xd8(%rbx,%r14,1)
  jmp    L44
  nopl   0x0(%rax)
L85:
  xor    %r12d,%r12d
L44:
  add    $0x28,%rsp
  mov    %r12,%rax
  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;
}
```