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

```asm
<kernel_dgetrf_nn_4x4_lib4>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,-0x14(%rsp)
  mov    %r8d,-0x8(%rsp)
  mov    %r9,%r15
  mov    0x38(%rsp),%r14
  test   %edi,%edi
  jle    L25
  mov    %rsi,%rbx
  mov    %rdx,%r13
  cmp    $0x3,%edi
  jle    L48
  shl    $0x2,%ecx
  movslq %ecx,%rcx
  lea    0x0(,%rcx,8),%rax
  mov    %rax,-0x20(%rsp)
  lea    -0x4(%rdi),%eax
  shr    $0x2,%eax
  mov    %eax,-0x4(%rsp)
  add    $0x1,%eax
  mov    %eax,%eax
  mov    %rax,-0x10(%rsp)
  shl    $0x7,%rax
  lea    (%rsi,%rax,1),%r12
  mov    %rdx,%rbp
  pxor   %xmm11,%xmm11
  movq   %xmm11,%rax
  movapd %xmm11,%xmm15
  movapd %xmm11,%xmm10
  movsd  %xmm11,-0x28(%rsp)
  movq   %xmm11,%rdx
  movsd  %xmm11,-0x40(%rsp)
  movapd %xmm11,%xmm13
  movq   %xmm11,%rcx
  movapd %xmm11,%xmm12
  movapd %xmm11,%xmm14
  movq   %xmm11,%rsi
  movq   %xmm11,%r10
  movsd  %xmm11,-0x38(%rsp)
  movq   %xmm11,%rdi
  movsd  %xmm11,-0x30(%rsp)
  movq   %xmm11,%r11
L62:
  movsd  (%rbx),%xmm3
  movsd  0x8(%rbx),%xmm2
  movsd  0x10(%rbx),%xmm1
  movsd  0x18(%rbx),%xmm0
  movsd  0x0(%rbp),%xmm7
  movsd  0x20(%rbp),%xmm6
  movsd  0x40(%rbp),%xmm4
  movsd  0x60(%rbp),%xmm5
  movapd %xmm3,%xmm8
  mulsd  %xmm7,%xmm8
  movq   %r10,%xmm9
  subsd  %xmm8,%xmm9
  movq   %xmm9,%r10
  movapd %xmm2,%xmm8
  mulsd  %xmm7,%xmm8
  subsd  %xmm8,%xmm13
  movapd %xmm1,%xmm8
  mulsd  %xmm7,%xmm8
  subsd  %xmm8,%xmm14
  mulsd  %xmm0,%xmm7
  subsd  %xmm7,%xmm10
  movapd %xmm3,%xmm7
  mulsd  %xmm6,%xmm7
  movsd  -0x38(%rsp),%xmm9
  subsd  %xmm7,%xmm9
  movapd %xmm2,%xmm7
  mulsd  %xmm6,%xmm7
  subsd  %xmm7,%xmm12
  movapd %xmm12,%xmm8
  movapd %xmm1,%xmm12
  mulsd  %xmm6,%xmm12
  movsd  -0x40(%rsp),%xmm7
  subsd  %xmm12,%xmm7
  movsd  %xmm7,-0x40(%rsp)
  mulsd  %xmm0,%xmm6
  movq   %rdi,%xmm12
  subsd  %xmm6,%xmm12
  movq   %xmm12,%rdi
  movapd %xmm3,%xmm6
  mulsd  %xmm4,%xmm6
  movq   %rsi,%xmm12
  subsd  %xmm6,%xmm12
  movq   %xmm12,%rsi
  movapd %xmm2,%xmm6
  mulsd  %xmm4,%xmm6
  movq   %rcx,%xmm12
  subsd  %xmm6,%xmm12
  movq   %xmm12,%rcx
  movapd %xmm1,%xmm6
  mulsd  %xmm4,%xmm6
  movq   %rdx,%xmm12
  subsd  %xmm6,%xmm12
  movq   %xmm12,%rdx
  mulsd  %xmm0,%xmm4
  movq   %rax,%xmm6
  subsd  %xmm4,%xmm6
  movq   %xmm6,%rax
  mulsd  %xmm5,%xmm3
  movsd  -0x30(%rsp),%xmm4
  subsd  %xmm3,%xmm4
  movq   %xmm4,%r8
  mulsd  %xmm5,%xmm2
  movq   %r11,%xmm3
  subsd  %xmm2,%xmm3
  movq   %xmm3,%r11
  mulsd  %xmm5,%xmm1
  subsd  %xmm1,%xmm15
  movapd %xmm15,%xmm12
  mulsd  %xmm5,%xmm0
  subsd  %xmm0,%xmm11
  movq   %xmm11,%r9
  movsd  0x20(%rbx),%xmm3
  movsd  0x28(%rbx),%xmm2
  movsd  0x30(%rbx),%xmm1
  movsd  0x38(%rbx),%xmm0
  movsd  0x8(%rbp),%xmm6
  movsd  0x28(%rbp),%xmm5
  movsd  0x48(%rbp),%xmm4
  movsd  0x68(%rbp),%xmm11
  movapd %xmm3,%xmm15
  mulsd  %xmm6,%xmm15
  movq   %r10,%xmm7
  subsd  %xmm15,%xmm7
  movq   %xmm7,%r10
  movapd %xmm2,%xmm15
  mulsd  %xmm6,%xmm15
  subsd  %xmm15,%xmm13
  movapd %xmm1,%xmm15
  mulsd  %xmm6,%xmm15
  subsd  %xmm15,%xmm14
  mulsd  %xmm0,%xmm6
  subsd  %xmm6,%xmm10
  movapd %xmm3,%xmm6
  mulsd  %xmm5,%xmm6
  subsd  %xmm6,%xmm9
  movapd %xmm2,%xmm6
  mulsd  %xmm5,%xmm6
  subsd  %xmm6,%xmm8
  movapd %xmm1,%xmm6
  mulsd  %xmm5,%xmm6
  movsd  -0x40(%rsp),%xmm7
  subsd  %xmm6,%xmm7
  movsd  %xmm7,-0x40(%rsp)
  mulsd  %xmm0,%xmm5
  movq   %rdi,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rdi
  movapd %xmm3,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rsi,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rsi
  movapd %xmm2,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rcx,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rcx
  movapd %xmm1,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rdx,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rdx
  mulsd  %xmm0,%xmm4
  movq   %rax,%xmm5
  subsd  %xmm4,%xmm5
  movq   %xmm5,%rax
  mulsd  %xmm11,%xmm3
  movq   %r8,%xmm4
  subsd  %xmm3,%xmm4
  movq   %xmm4,%r8
  mulsd  %xmm11,%xmm2
  movq   %r11,%xmm3
  subsd  %xmm2,%xmm3
  movq   %xmm3,%r11
  mulsd  %xmm11,%xmm1
  movapd %xmm12,%xmm15
  subsd  %xmm1,%xmm15
  mulsd  %xmm11,%xmm0
  movq   %r9,%xmm2
  subsd  %xmm0,%xmm2
  movq   %xmm2,%r9
  movsd  0x40(%rbx),%xmm3
  movsd  0x48(%rbx),%xmm2
  movsd  0x50(%rbx),%xmm1
  movsd  0x58(%rbx),%xmm0
  movsd  0x10(%rbp),%xmm6
  movsd  0x30(%rbp),%xmm5
  movsd  0x50(%rbp),%xmm4
  movsd  0x70(%rbp),%xmm11
  movapd %xmm3,%xmm12
  mulsd  %xmm6,%xmm12
  movq   %r10,%xmm7
  subsd  %xmm12,%xmm7
  movq   %xmm7,%r10
  movapd %xmm2,%xmm12
  mulsd  %xmm6,%xmm12
  subsd  %xmm12,%xmm13
  movapd %xmm1,%xmm12
  mulsd  %xmm6,%xmm12
  subsd  %xmm12,%xmm14
  mulsd  %xmm0,%xmm6
  subsd  %xmm6,%xmm10
  movapd %xmm3,%xmm6
  mulsd  %xmm5,%xmm6
  subsd  %xmm6,%xmm9
  movapd %xmm2,%xmm6
  mulsd  %xmm5,%xmm6
  subsd  %xmm6,%xmm8
  movapd %xmm1,%xmm6
  mulsd  %xmm5,%xmm6
  movsd  -0x40(%rsp),%xmm7
  subsd  %xmm6,%xmm7
  movsd  %xmm7,-0x40(%rsp)
  mulsd  %xmm0,%xmm5
  movq   %rdi,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rdi
  movapd %xmm3,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rsi,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rsi
  movapd %xmm2,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rcx,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rcx
  movapd %xmm1,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rdx,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rdx
  mulsd  %xmm0,%xmm4
  movq   %rax,%xmm5
  subsd  %xmm4,%xmm5
  movq   %xmm5,%rax
  mulsd  %xmm11,%xmm3
  movq   %r8,%xmm4
  subsd  %xmm3,%xmm4
  movq   %xmm4,%r8
  mulsd  %xmm11,%xmm2
  movq   %r11,%xmm3
  subsd  %xmm2,%xmm3
  movq   %xmm3,%r11
  mulsd  %xmm11,%xmm1
  subsd  %xmm1,%xmm15
  mulsd  %xmm11,%xmm0
  movq   %r9,%xmm2
  subsd  %xmm0,%xmm2
  movq   %xmm2,%r9
  movsd  0x60(%rbx),%xmm3
  movsd  0x68(%rbx),%xmm2
  movsd  0x70(%rbx),%xmm1
  movsd  0x78(%rbx),%xmm0
  movsd  0x18(%rbp),%xmm6
  movsd  0x38(%rbp),%xmm5
  movsd  0x58(%rbp),%xmm4
  movsd  0x78(%rbp),%xmm11
  movapd %xmm3,%xmm12
  mulsd  %xmm6,%xmm12
  movq   %r10,%xmm7
  subsd  %xmm12,%xmm7
  movq   %xmm7,%r10
  movapd %xmm2,%xmm12
  mulsd  %xmm6,%xmm12
  subsd  %xmm12,%xmm13
  movapd %xmm1,%xmm12
  mulsd  %xmm6,%xmm12
  subsd  %xmm12,%xmm14
  mulsd  %xmm0,%xmm6
  subsd  %xmm6,%xmm10
  movapd %xmm3,%xmm6
  mulsd  %xmm5,%xmm6
  subsd  %xmm6,%xmm9
  movsd  %xmm9,-0x38(%rsp)
  movapd %xmm2,%xmm6
  mulsd  %xmm5,%xmm6
  subsd  %xmm6,%xmm8
  movapd %xmm8,%xmm12
  movapd %xmm1,%xmm6
  mulsd  %xmm5,%xmm6
  movsd  -0x40(%rsp),%xmm7
  subsd  %xmm6,%xmm7
  movsd  %xmm7,-0x40(%rsp)
  mulsd  %xmm0,%xmm5
  movq   %rdi,%xmm7
  subsd  %xmm5,%xmm7
  movq   %xmm7,%rdi
  movapd %xmm3,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rsi,%xmm7
  subsd  %xmm5,%xmm7
  movq   %xmm7,%rsi
  movapd %xmm2,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rcx,%xmm7
  subsd  %xmm5,%xmm7
  movq   %xmm7,%rcx
  movapd %xmm1,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rdx,%xmm7
  subsd  %xmm5,%xmm7
  movq   %xmm7,%rdx
  mulsd  %xmm0,%xmm4
  movq   %rax,%xmm7
  subsd  %xmm4,%xmm7
  movq   %xmm7,%rax
  mulsd  %xmm11,%xmm3
  movq   %r8,%xmm4
  subsd  %xmm3,%xmm4
  movsd  %xmm4,-0x30(%rsp)
  mulsd  %xmm11,%xmm2
  movq   %r11,%xmm3
  subsd  %xmm2,%xmm3
  movq   %xmm3,%r11
  mulsd  %xmm11,%xmm1
  subsd  %xmm1,%xmm15
  mulsd  %xmm11,%xmm0
  movq   %r9,%xmm11
  subsd  %xmm0,%xmm11
  sub    $0xffffffffffffff80,%rbx
  add    -0x20(%rsp),%rbp
  cmp    %r12,%rbx
  jne    L62
  movq   %xmm13,%r9
  movq   %xmm14,%r8
  movapd %xmm4,%xmm14
  movapd %xmm3,%xmm13
  movsd  %xmm15,-0x28(%rsp)
  movq   %rdi,%xmm15
  mov    -0x20(%rsp),%rdi
  imul   -0x10(%rsp),%rdi
  add    %rdi,%r13
  mov    -0x4(%rsp),%edi
  lea    0x4(,%rdi,4),%edi
  cmp    %edi,-0x14(%rsp)
  jle    L68
  movsd  %xmm9,-0x38(%rsp)
  movq   %xmm3,%rbx
  movapd %xmm8,%xmm13
  movq   %r9,%xmm12
  movq   %xmm11,%rbp
  movq   %r10,%xmm11
  mov    -0x14(%rsp),%r11d
L75:
  movsd  (%r12),%xmm3
  movsd  0x8(%r12),%xmm2
  movsd  0x10(%r12),%xmm1
  movsd  0x18(%r12),%xmm0
  movsd  0x0(%r13),%xmm6
  movsd  0x20(%r13),%xmm5
  movsd  0x40(%r13),%xmm4
  movsd  0x60(%r13),%xmm7
  movapd %xmm3,%xmm8
  mulsd  %xmm6,%xmm8
  subsd  %xmm8,%xmm11
  movapd %xmm2,%xmm8
  mulsd  %xmm6,%xmm8
  subsd  %xmm8,%xmm12
  movapd %xmm1,%xmm8
  mulsd  %xmm6,%xmm8
  movq   %r8,%xmm9
  subsd  %xmm8,%xmm9
  movq   %xmm9,%r8
  mulsd  %xmm0,%xmm6
  subsd  %xmm6,%xmm10
  movapd %xmm3,%xmm6
  mulsd  %xmm5,%xmm6
  movsd  -0x38(%rsp),%xmm9
  subsd  %xmm6,%xmm9
  movsd  %xmm9,-0x38(%rsp)
  movapd %xmm2,%xmm6
  mulsd  %xmm5,%xmm6
  subsd  %xmm6,%xmm13
  movapd %xmm1,%xmm6
  mulsd  %xmm5,%xmm6
  movsd  -0x40(%rsp),%xmm9
  subsd  %xmm6,%xmm9
  movsd  %xmm9,-0x40(%rsp)
  mulsd  %xmm0,%xmm5
  subsd  %xmm5,%xmm15
  movapd %xmm3,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rsi,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rsi
  movapd %xmm2,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rcx,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rcx
  movapd %xmm1,%xmm5
  mulsd  %xmm4,%xmm5
  movq   %rdx,%xmm6
  subsd  %xmm5,%xmm6
  movq   %xmm6,%rdx
  mulsd  %xmm0,%xmm4
  movq   %rax,%xmm5
  subsd  %xmm4,%xmm5
  movq   %xmm5,%rax
  mulsd  %xmm7,%xmm3
  subsd  %xmm3,%xmm14
  mulsd  %xmm7,%xmm2
  movq   %rbx,%xmm4
  subsd  %xmm2,%xmm4
  movq   %xmm4,%rbx
  mulsd  %xmm7,%xmm1
  movsd  -0x28(%rsp),%xmm2
  subsd  %xmm1,%xmm2
  movsd  %xmm2,-0x28(%rsp)
  mulsd  %xmm7,%xmm0
  movq   %rbp,%xmm1
  subsd  %xmm0,%xmm1
  movq   %xmm1,%rbp
  add    $0x20,%r12
  add    $0x8,%r13
  add    $0x1,%edi
  cmp    %edi,%r11d
  jg     L75
  movq   %xmm11,%r10
  movq   %xmm12,%r9
  movsd  -0x38(%rsp),%xmm9
  movapd %xmm13,%xmm12
  movapd %xmm4,%xmm13
  movapd %xmm1,%xmm11
L68:
  cmpl   $0x0,-0x8(%rsp)
  je     L38
  movq   %r10,%xmm0
  addsd  (%r15),%xmm0
  movq   %xmm0,%r10
  movq   %r9,%xmm0
  addsd  0x8(%r15),%xmm0
  movq   %xmm0,%r9
  movq   %r8,%xmm0
  addsd  0x10(%r15),%xmm0
  movq   %xmm0,%r8
  addsd  0x18(%r15),%xmm10
  addsd  0x20(%r15),%xmm9
  addsd  0x28(%r15),%xmm12
  movsd  -0x40(%rsp),%xmm0
  addsd  0x30(%r15),%xmm0
  movsd  %xmm0,-0x40(%rsp)
  addsd  0x38(%r15),%xmm15
  movq   %rsi,%xmm0
  addsd  0x40(%r15),%xmm0
  movq   %xmm0,%rsi
  movq   %rcx,%xmm0
  addsd  0x48(%r15),%xmm0
  movq   %xmm0,%rcx
  movq   %rdx,%xmm0
  addsd  0x50(%r15),%xmm0
  movq   %xmm0,%rdx
  movq   %rax,%xmm0
  addsd  0x58(%r15),%xmm0
  movq   %xmm0,%rax
  addsd  0x60(%r15),%xmm14
  addsd  0x68(%r15),%xmm13
  movsd  -0x28(%rsp),%xmm0
  addsd  0x70(%r15),%xmm0
  movsd  %xmm0,-0x28(%rsp)
  addsd  0x78(%r15),%xmm11
L38:
  movsd  D0(%rip),%xmm0
  movapd %xmm0,%xmm1
  movq   %r10,%xmm2
  divsd  %xmm2,%xmm1
  movq   %r9,%xmm8
  mulsd  %xmm1,%xmm8
  movq   %r8,%xmm7
  mulsd  %xmm1,%xmm7
  movapd %xmm10,%xmm6
  mulsd  %xmm1,%xmm6
  mov    0x40(%rsp),%rdi
  movsd  %xmm1,(%rdi)
  mov    %r10,(%r14)
  movsd  %xmm8,0x8(%r14)
  movsd  %xmm7,0x10(%r14)
  movsd  %xmm6,0x18(%r14)
  movapd %xmm9,%xmm1
  mulsd  %xmm8,%xmm1
  subsd  %xmm1,%xmm12
  movapd %xmm9,%xmm1
  mulsd  %xmm7,%xmm1
  movsd  -0x40(%rsp),%xmm3
  subsd  %xmm1,%xmm3
  movapd %xmm9,%xmm1
  mulsd  %xmm6,%xmm1
  movapd %xmm15,%xmm2
  subsd  %xmm1,%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm12,%xmm1
  mulsd  %xmm1,%xmm3
  mulsd  %xmm1,%xmm2
  movsd  %xmm1,0x8(%rdi)
  movsd  %xmm9,0x20(%r14)
  movsd  %xmm12,0x28(%r14)
  movsd  %xmm3,0x30(%r14)
  movsd  %xmm2,0x38(%r14)
  movq   %rsi,%xmm1
  mulsd  %xmm8,%xmm1
  movq   %rcx,%xmm5
  subsd  %xmm1,%xmm5
  movq   %rsi,%xmm1
  mulsd  %xmm7,%xmm1
  movq   %rdx,%xmm4
  subsd  %xmm1,%xmm4
  movq   %rsi,%xmm9
  mulsd  %xmm6,%xmm9
  movq   %rax,%xmm1
  subsd  %xmm9,%xmm1
  movapd %xmm3,%xmm9
  mulsd  %xmm5,%xmm9
  subsd  %xmm9,%xmm4
  movapd %xmm2,%xmm9
  mulsd  %xmm5,%xmm9
  subsd  %xmm9,%xmm1
  movapd %xmm0,%xmm9
  divsd  %xmm4,%xmm9
  mulsd  %xmm9,%xmm1
  movsd  %xmm9,0x10(%rdi)
  mov    %rsi,0x40(%r14)
  movsd  %xmm5,0x48(%r14)
  movsd  %xmm4,0x50(%r14)
  movsd  %xmm1,0x58(%r14)
  mulsd  %xmm14,%xmm8
  subsd  %xmm8,%xmm13
  mulsd  %xmm14,%xmm7
  movsd  -0x28(%rsp),%xmm15
  subsd  %xmm7,%xmm15
  mulsd  %xmm14,%xmm6
  subsd  %xmm6,%xmm11
  mulsd  %xmm13,%xmm3
  subsd  %xmm3,%xmm15
  mulsd  %xmm13,%xmm2
  subsd  %xmm2,%xmm11
  mulsd  %xmm15,%xmm1
  subsd  %xmm1,%xmm11
  divsd  %xmm11,%xmm0
  movsd  %xmm0,0x18(%rdi)
  movsd  %xmm14,0x60(%r14)
  movsd  %xmm13,0x68(%r14)
  movsd  %xmm15,0x70(%r14)
  movsd  %xmm11,0x78(%r14)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L48:
  mov    %rsi,%r12
  pxor   %xmm11,%xmm11
  movq   %xmm11,%rax
  movapd %xmm11,%xmm15
  movapd %xmm11,%xmm10
  movsd  %xmm11,-0x28(%rsp)
  movq   %xmm11,%rdx
  movsd  %xmm11,-0x40(%rsp)
  movq   %xmm11,%r8
  movapd %xmm11,%xmm13
  movq   %xmm11,%rcx
  movapd %xmm11,%xmm12
  movapd %xmm11,%xmm14
  movq   %xmm11,%rsi
  mov    $0x0,%edi
  movsd  %xmm11,-0x38(%rsp)
  movq   %xmm11,%rbx
  movq   %xmm11,%rbp
  mov    -0x14(%rsp),%r11d
  jmp    L75
L25:
  pxor   %xmm11,%xmm11
  movq   %xmm11,%rax
  movapd %xmm11,%xmm15
  movapd %xmm11,%xmm10
  movsd  %xmm11,-0x28(%rsp)
  movq   %xmm11,%rdx
  movsd  %xmm11,-0x40(%rsp)
  movq   %xmm11,%r8
  movapd %xmm11,%xmm13
  movq   %xmm11,%rcx
  movapd %xmm11,%xmm12
  movq   %xmm11,%r9
  movapd %xmm11,%xmm14
  movq   %xmm11,%rsi
  movapd %xmm11,%xmm9
  movq   %xmm11,%r10
  jmp    L68
```

tool_calls: name: disassemble_data
arguments: label: D0
data_type: f64

tool: D0: 1

assistant: ```c
void kernel_dgetrf_nn_4x4_lib4(int kmax, double *A, double *B, int sdb, int alg, double *C, double *D, double *inv_diag_D) {
  const int bs = 4;
  int k;
  double tmp, a_0, a_1, a_2, a_3, b_0, b_1, b_2, b_3, d_00 = 0, d_01 = 0, d_02 = 0, d_03 = 0, d_10 = 0, d_11 = 0, d_12 = 0, d_13 = 0, d_20 = 0, d_21 = 0, d_22 = 0, d_23 = 0, d_30 = 0, d_31 = 0, d_32 = 0, d_33 = 0;
  if (kmax <= 0)
    goto add;
  for (k = 0; k < kmax - 3; k += 4) {
    a_0 = A[0 + bs * 0];
    a_1 = A[1 + bs * 0];
    a_2 = A[2 + bs * 0];
    a_3 = A[3 + bs * 0];
    b_0 = B[0 + bs * 0];
    b_1 = B[0 + bs * 1];
    b_2 = B[0 + bs * 2];
    b_3 = B[0 + bs * 3];
    d_00 -= a_0 * b_0;
    d_10 -= a_1 * b_0;
    d_20 -= a_2 * b_0;
    d_30 -= a_3 * b_0;
    d_01 -= a_0 * b_1;
    d_11 -= a_1 * b_1;
    d_21 -= a_2 * b_1;
    d_31 -= a_3 * b_1;
    d_02 -= a_0 * b_2;
    d_12 -= a_1 * b_2;
    d_22 -= a_2 * b_2;
    d_32 -= a_3 * b_2;
    d_03 -= a_0 * b_3;
    d_13 -= a_1 * b_3;
    d_23 -= a_2 * b_3;
    d_33 -= a_3 * b_3;
    a_0 = A[0 + bs * 1];
    a_1 = A[1 + bs * 1];
    a_2 = A[2 + bs * 1];
    a_3 = A[3 + bs * 1];
    b_0 = B[1 + bs * 0];
    b_1 = B[1 + bs * 1];
    b_2 = B[1 + bs * 2];
    b_3 = B[1 + bs * 3];
    d_00 -= a_0 * b_0;
    d_10 -= a_1 * b_0;
    d_20 -= a_2 * b_0;
    d_30 -= a_3 * b_0;
    d_01 -= a_0 * b_1;
    d_11 -= a_1 * b_1;
    d_21 -= a_2 * b_1;
    d_31 -= a_3 * b_1;
    d_02 -= a_0 * b_2;
    d_12 -= a_1 * b_2;
    d_22 -= a_2 * b_2;
    d_32 -= a_3 * b_2;
    d_03 -= a_0 * b_3;
    d_13 -= a_1 * b_3;
    d_23 -= a_2 * b_3;
    d_33 -= a_3 * b_3;
    a_0 = A[0 + bs * 2];
    a_1 = A[1 + bs * 2];
    a_2 = A[2 + bs * 2];
    a_3 = A[3 + bs * 2];
    b_0 = B[2 + bs * 0];
    b_1 = B[2 + bs * 1];
    b_2 = B[2 + bs * 2];
    b_3 = B[2 + bs * 3];
    d_00 -= a_0 * b_0;
    d_10 -= a_1 * b_0;
    d_20 -= a_2 * b_0;
    d_30 -= a_3 * b_0;
    d_01 -= a_0 * b_1;
    d_11 -= a_1 * b_1;
    d_21 -= a_2 * b_1;
    d_31 -= a_3 * b_1;
    d_02 -= a_0 * b_2;
    d_12 -= a_1 * b_2;
    d_22 -= a_2 * b_2;
    d_32 -= a_3 * b_2;
    d_03 -= a_0 * b_3;
    d_13 -= a_1 * b_3;
    d_23 -= a_2 * b_3;
    d_33 -= a_3 * b_3;
    a_0 = A[0 + bs * 3];
    a_1 = A[1 + bs * 3];
    a_2 = A[2 + bs * 3];
    a_3 = A[3 + bs * 3];
    b_0 = B[3 + bs * 0];
    b_1 = B[3 + bs * 1];
    b_2 = B[3 + bs * 2];
    b_3 = B[3 + bs * 3];
    d_00 -= a_0 * b_0;
    d_10 -= a_1 * b_0;
    d_20 -= a_2 * b_0;
    d_30 -= a_3 * b_0;
    d_01 -= a_0 * b_1;
    d_11 -= a_1 * b_1;
    d_21 -= a_2 * b_1;
    d_31 -= a_3 * b_1;
    d_02 -= a_0 * b_2;
    d_12 -= a_1 * b_2;
    d_22 -= a_2 * b_2;
    d_32 -= a_3 * b_2;
    d_03 -= a_0 * b_3;
    d_13 -= a_1 * b_3;
    d_23 -= a_2 * b_3;
    d_33 -= a_3 * b_3;
    A += 16;
    B += 4 * sdb;
  }
  for (; k < kmax; k++) {
    a_0 = A[0 + bs * 0];
    a_1 = A[1 + bs * 0];
    a_2 = A[2 + bs * 0];
    a_3 = A[3 + bs * 0];
    b_0 = B[0 + bs * 0];
    b_1 = B[0 + bs * 1];
    b_2 = B[0 + bs * 2];
    b_3 = B[0 + bs * 3];
    d_00 -= a_0 * b_0;
    d_10 -= a_1 * b_0;
    d_20 -= a_2 * b_0;
    d_30 -= a_3 * b_0;
    d_01 -= a_0 * b_1;
    d_11 -= a_1 * b_1;
    d_21 -= a_2 * b_1;
    d_31 -= a_3 * b_1;
    d_02 -= a_0 * b_2;
    d_12 -= a_1 * b_2;
    d_22 -= a_2 * b_2;
    d_32 -= a_3 * b_2;
    d_03 -= a_0 * b_3;
    d_13 -= a_1 * b_3;
    d_23 -= a_2 * b_3;
    d_33 -= a_3 * b_3;
    A += 4;
    B += 1;
  }
add:
  if (alg != 0) {
    d_00 += C[0 + bs * 0];
    d_10 += C[1 + bs * 0];
    d_20 += C[2 + bs * 0];
    d_30 += C[3 + bs * 0];
    d_01 += C[0 + bs * 1];
    d_11 += C[1 + bs * 1];
    d_21 += C[2 + bs * 1];
    d_31 += C[3 + bs * 1];
    d_02 += C[0 + bs * 2];
    d_12 += C[1 + bs * 2];
    d_22 += C[2 + bs * 2];
    d_32 += C[3 + bs * 2];
    d_03 += C[0 + bs * 3];
    d_13 += C[1 + bs * 3];
    d_23 += C[2 + bs * 3];
    d_33 += C[3 + bs * 3];
  }
  tmp = 1.0 / d_00;
  d_10 *= tmp;
  d_20 *= tmp;
  d_30 *= tmp;
  inv_diag_D[0] = tmp;
  D[0 + bs * 0] = d_00;
  D[1 + bs * 0] = d_10;
  D[2 + bs * 0] = d_20;
  D[3 + bs * 0] = d_30;
  d_11 -= d_10 * d_01;
  d_21 -= d_20 * d_01;
  d_31 -= d_30 * d_01;
  tmp = 1.0 / d_11;
  d_21 *= tmp;
  d_31 *= tmp;
  inv_diag_D[1] = tmp;
  D[0 + bs * 1] = d_01;
  D[1 + bs * 1] = d_11;
  D[2 + bs * 1] = d_21;
  D[3 + bs * 1] = d_31;
  d_12 -= d_10 * d_02;
  d_22 -= d_20 * d_02;
  d_32 -= d_30 * d_02;
  d_22 -= d_21 * d_12;
  d_32 -= d_31 * d_12;
  tmp = 1.0 / d_22;
  d_32 *= tmp;
  inv_diag_D[2] = tmp;
  D[0 + bs * 2] = d_02;
  D[1 + bs * 2] = d_12;
  D[2 + bs * 2] = d_22;
  D[3 + bs * 2] = d_32;
  d_13 -= d_10 * d_03;
  d_23 -= d_20 * d_03;
  d_33 -= d_30 * d_03;
  d_23 -= d_21 * d_13;
  d_33 -= d_31 * d_13;
  d_33 -= d_32 * d_23;
  tmp = 1.0 / d_33;
  inv_diag_D[3] = tmp;
  D[0 + bs * 3] = d_03;
  D[1 + bs * 3] = d_13;
  D[2 + bs * 3] = d_23;
  D[3 + bs * 3] = d_33;
  return;
}
```