void kernel_dpotrf_nt_4x4_lib4_new(int ksub, double *Am, double *Bm, int alg,
                                   double *C, double *D, double *inv_diag_D) {
  int ki_sub = ksub / 4;
  __asm__ volatile(
      "                                \n\t"
      "                                \n\t"
      "movq          %5, %%rax         \n\t"
      "movq          %6, %%rbx         \n\t"
      "                                \n\t"
      "                                \n\t"
      "xorpd     %%xmm3,  %%xmm3       \n\t"
      "movaps    %%xmm3,  %%xmm4       \n\t"
      "movaps    %%xmm3,  %%xmm5       \n\t"
      "movaps    %%xmm3,  %%xmm6       \n\t"
      "movaps    %%xmm3,  %%xmm7       \n\t"
      "movaps    %%xmm3,  %%xmm8       \n\t"
      "movaps    %%xmm3,  %%xmm9       \n\t"
      "movaps    %%xmm3, %%xmm12       \n\t"
      "movaps    %%xmm3, %%xmm13       \n\t"
      "movaps    %%xmm3, %%xmm14       \n\t"
      "movaps    %%xmm3, %%xmm15       \n\t"
      "                                \n\t"
      "                                \n\t"
      "movl   %0, %%esi                \n\t"
      "testl  %%esi, %%esi             \n\t"
      "je     .DPOSTACC_2                \n\t"
      "                                \n\t"
      "                                \n\t"
      "                                \n\t"
      "movaps        0(%%rax), %%xmm0  \n\t"
      "movaps       16(%%rax), %%xmm1  \n\t"
      "movaps        0(%%rbx), %%xmm2  \n\t"
      "                                \n\t"
      ".DLOOPSUB_2:                      \n\t"
      "                                \n\t"
      "movaps       16(%%rbx), %%xmm6  \n\t"
      "subpd   %%xmm3, %%xmm14         \n\t"
      "movaps  %%xmm2, %%xmm3          \n\t"
      "pshufd   $0x4e, %%xmm2, %%xmm7  \n\t"
      "mulpd   %%xmm0, %%xmm2          \n\t"
      "mulpd   %%xmm1, %%xmm3          \n\t"
      "                                \n\t"
      "subpd   %%xmm5, %%xmm15         \n\t"
      "movaps  %%xmm7, %%xmm5          \n\t"
      "mulpd   %%xmm0, %%xmm7          \n\t"
      "mulpd   %%xmm1, %%xmm5          \n\t"
      "                                \n\t"
      "subpd   %%xmm2, %%xmm8          \n\t"
      "movaps       32(%%rbx), %%xmm2  \n\t"
      "subpd   %%xmm3, %%xmm12         \n\t"
      "movaps  %%xmm6, %%xmm3          \n\t"
      "pshufd   $0x4e, %%xmm6, %%xmm4  \n\t"
      "mulpd   %%xmm1, %%xmm3          \n\t"
      "                                \n\t"
      "subpd   %%xmm7, %%xmm9          \n\t"
      "subpd   %%xmm5, %%xmm13         \n\t"
      "movaps  %%xmm4, %%xmm5          \n\t"
      "movaps       32(%%rax), %%xmm0  \n\t"
      "mulpd   %%xmm1, %%xmm5          \n\t"
      "movaps       48(%%rax), %%xmm1  \n\t"
      "                                \n\t"
      "                                \n\t"
      "movaps       48(%%rbx), %%xmm6  \n\t"
      "subpd   %%xmm3, %%xmm14         \n\t"
      "movaps  %%xmm2, %%xmm3          \n\t"
      "pshufd   $0x4e, %%xmm2, %%xmm7  \n\t"
      "mulpd   %%xmm0, %%xmm2          \n\t"
      "mulpd   %%xmm1, %%xmm3          \n\t"
      "                                \n\t"
      "subpd   %%xmm5, %%xmm15         \n\t"
      "movaps  %%xmm7, %%xmm5          \n\t"
      "mulpd   %%xmm0, %%xmm7          \n\t"
      "mulpd   %%xmm1, %%xmm5          \n\t"
      "                                \n\t"
      "subpd   %%xmm2, %%xmm8          \n\t"
      "movaps       64(%%rbx), %%xmm2  \n\t"
      "subpd   %%xmm3, %%xmm12         \n\t"
      "movaps  %%xmm6, %%xmm3          \n\t"
      "pshufd   $0x4e, %%xmm6, %%xmm4  \n\t"
      "mulpd   %%xmm1, %%xmm3          \n\t"
      "                                \n\t"
      "subpd   %%xmm7, %%xmm9          \n\t"
      "subpd   %%xmm5, %%xmm13         \n\t"
      "movaps  %%xmm4, %%xmm5          \n\t"
      "movaps       64(%%rax), %%xmm0  \n\t"
      "mulpd   %%xmm1, %%xmm5          \n\t"
      "movaps       80(%%rax), %%xmm1  \n\t"
      "                                \n\t"
      "                                \n\t"
      "movaps       80(%%rbx), %%xmm6  \n\t"
      "subpd   %%xmm3, %%xmm14         \n\t"
      "movaps  %%xmm2, %%xmm3          \n\t"
      "pshufd   $0x4e, %%xmm2, %%xmm7  \n\t"
      "mulpd   %%xmm0, %%xmm2          \n\t"
      "mulpd   %%xmm1, %%xmm3          \n\t"
      "                                \n\t"
      "subpd   %%xmm5, %%xmm15         \n\t"
      "movaps  %%xmm7, %%xmm5          \n\t"
      "mulpd   %%xmm0, %%xmm7          \n\t"
      "mulpd   %%xmm1, %%xmm5          \n\t"
      "                                \n\t"
      "subpd   %%xmm2, %%xmm8          \n\t"
      "movaps       96(%%rbx), %%xmm2  \n\t"
      "subpd   %%xmm3, %%xmm12         \n\t"
      "movaps  %%xmm6, %%xmm3          \n\t"
      "pshufd   $0x4e, %%xmm6, %%xmm4  \n\t"
      "mulpd   %%xmm1, %%xmm3          \n\t"
      "                                \n\t"
      "subpd   %%xmm7, %%xmm9          \n\t"
      "subpd   %%xmm5, %%xmm13         \n\t"
      "movaps  %%xmm4, %%xmm5          \n\t"
      "movaps       96(%%rax), %%xmm0  \n\t"
      "mulpd   %%xmm1, %%xmm5          \n\t"
      "movaps      112(%%rax), %%xmm1  \n\t"
      "                                \n\t"
      "                                \n\t"
      "movaps      112(%%rbx), %%xmm6  \n\t"
      "subpd   %%xmm3, %%xmm14         \n\t"
      "movaps  %%xmm2, %%xmm3          \n\t"
      "pshufd   $0x4e, %%xmm2, %%xmm7  \n\t"
      "mulpd   %%xmm0, %%xmm2          \n\t"
      "mulpd   %%xmm1, %%xmm3          \n\t"
      "                                \n\t"
      "addq      $128, %%rax           \n\t"
      "                                \n\t"
      "subpd   %%xmm5, %%xmm15         \n\t"
      "movaps  %%xmm7, %%xmm5          \n\t"
      "mulpd   %%xmm0, %%xmm7          \n\t"
      "mulpd   %%xmm1, %%xmm5          \n\t"
      "                                \n\t"
      "addq      $128, %%rbx           \n\t"
      "                                \n\t"
      "subpd   %%xmm2, %%xmm8          \n\t"
      "movaps         (%%rbx), %%xmm2  \n\t"
      "subpd   %%xmm3, %%xmm12         \n\t"
      "movaps  %%xmm6, %%xmm3          \n\t"
      "pshufd   $0x4e, %%xmm6, %%xmm4  \n\t"
      "mulpd   %%xmm1, %%xmm3          \n\t"
      "                                \n\t"
      "                                \n\t"
      "subpd   %%xmm7, %%xmm9          \n\t"
      "decl    %%esi                   \n\t"
      "subpd   %%xmm5, %%xmm13         \n\t"
      "movaps  %%xmm4, %%xmm5          \n\t"
      "movaps         (%%rax), %%xmm0  \n\t"
      "mulpd   %%xmm1, %%xmm5          \n\t"
      "movaps       16(%%rax), %%xmm1  \n\t"
      "                                \n\t"
      "                                \n\t"
      "jne    .DLOOPSUB_2                \n\t"
      "                                \n\t"
      "                                \n\t"
      "subpd   %%xmm3, %%xmm14         \n\t"
      "subpd   %%xmm5, %%xmm15         \n\t"
      "                                \n\t"
      "                                \n\t"
      ".DPOSTACC_2:                      \n\t"
      "                                \n\t"
      "                                \n\t"
      "                                \n\t"
      "movaps   %%xmm8,  %%xmm0        \n\t"
      "movsd    %%xmm9,  %%xmm8        \n\t"
      "movsd    %%xmm0,  %%xmm9        \n\t"
      "                                \n\t"
      "                                \n\t"
      "movaps  %%xmm12,  %%xmm0        \n\t"
      "movsd   %%xmm13, %%xmm12        \n\t"
      "movsd    %%xmm0, %%xmm13        \n\t"
      "                                \n\t"
      "movaps  %%xmm14,  %%xmm0        \n\t"
      "movsd   %%xmm15, %%xmm14        \n\t"
      "movsd    %%xmm0, %%xmm15        \n\t"
      "                                \n\t"
      "                                \n\t"
      "                                \n\t"
      "movl      %4, %%esi             \n\t"
      "testl  %%esi, %%esi             \n\t"
      "je     .DSOLVE_2                  \n\t"
      "                                \n\t"
      "                                \n\t"
      "movq   %2, %%rax                \n\t"
      "                                \n\t"
      "                                \n\t"
      "movaps  (%%rax),   %%xmm0       \n\t"
      "movaps  32(%%rax), %%xmm1       \n\t"
      "movaps  16(%%rax), %%xmm4       \n\t"
      "movaps  48(%%rax), %%xmm5       \n\t"
      "movaps  80(%%rax), %%xmm6       \n\t"
      "movaps 112(%%rax), %%xmm7       \n\t"
      "                                \n\t"
      "                                \n\t"
      "addpd  %%xmm0, %%xmm9           \n\t"
      "addpd  %%xmm1, %%xmm8           \n\t"
      "addpd  %%xmm4, %%xmm13          \n\t"
      "addpd  %%xmm5, %%xmm12          \n\t"
      "addpd  %%xmm6, %%xmm15          \n\t"
      "addpd  %%xmm7, %%xmm14          \n\t"
      "                                \n\t"
      "                                \n\t"
      ".DSOLVE_2:                        \n\t"
      "                                \n\t"
      "                                \n\t"
      "                                \n\t"
      "movq   %3, %%rax                \n\t"
      "movq   %1, %%rbx                \n\t"
      "                                \n\t"
      "                                \n\t"
      "                                \n\t"
      "movsd   .DTHR_2(%%rip), %%xmm7    \n\t"
      "movsd   .DONE_2(%%rip), %%xmm6    \n\t"
      "                                \n\t"
      "                                \n\t"
      ".DA00_2:                          \n\t"
      "movsd   %%xmm9, %%xmm0          \n\t"
      "ucomisd %%xmm7, %%xmm0          \n\t"
      "jbe     .DZERO0_2                 \n\t"
      "sqrtsd  %%xmm0, %%xmm0          \n\t"
      "movsd   %%xmm6, %%xmm5          \n\t"
      "divsd   %%xmm0, %%xmm5          \n\t"
      "movsd   %%xmm5, (%%rax)         \n\t"
      "movddup %%xmm5, %%xmm5          \n\t"
      "mulpd   %%xmm5, %%xmm9          \n\t"
      "mulpd   %%xmm5, %%xmm13         \n\t"
      ".DA00_END_2:                    \n\t"
      "movaps	 %%xmm9,  (%%rbx)        \n\t"
      "movaps	 %%xmm13, 16(%%rbx)      \n\t"
      "                                \n\t"
      ".DA11_2:                          \n\t"
      "movaps  %%xmm9, %%xmm0          \n\t"
      "shufpd  $3, %%xmm0, %%xmm0      \n\t"
      "movaps  %%xmm0,  %%xmm1         \n\t"
      "mulpd   %%xmm9, %%xmm0          \n\t"
      "mulpd   %%xmm13, %%xmm1         \n\t"
      "subpd   %%xmm0, %%xmm8          \n\t"
      "subpd   %%xmm1, %%xmm12         \n\t"
      "movaps  %%xmm8, %%xmm0          \n\t"
      "shufpd  $1, %%xmm0, %%xmm0      \n\t"
      "ucomisd %%xmm7, %%xmm0          \n\t"
      "jbe     .DZERO1_2                 \n\t"
      "sqrtsd  %%xmm0, %%xmm0          \n\t"
      "movsd   %%xmm6, %%xmm5          \n\t"
      "divsd   %%xmm0, %%xmm5          \n\t"
      "movsd   %%xmm5, 8(%%rax)        \n\t"
      "movddup %%xmm5, %%xmm5          \n\t"
      "mulpd   %%xmm5, %%xmm8          \n\t"
      "mulpd   %%xmm5, %%xmm12         \n\t"
      ".DA11_END_2:                    \n\t"
      "movhpd	 %%xmm8,  40(%%rbx)      \n\t"
      "movaps	 %%xmm12, 48(%%rbx)      \n\t"
      "                                \n\t"
      ".DA22_2:                          \n\t"
      "movddup %%xmm13, %%xmm0         \n\t"
      "movddup %%xmm12, %%xmm1         \n\t"
      "mulpd   %%xmm13, %%xmm0         \n\t"
      "mulpd   %%xmm12, %%xmm1         \n\t"
      "subpd   %%xmm0, %%xmm15         \n\t"
      "subpd   %%xmm1, %%xmm15         \n\t"
      "movsd   %%xmm15, %%xmm0         \n\t"
      "ucomisd %%xmm7, %%xmm0          \n\t"
      "jbe     .DZERO2_2                 \n\t"
      "sqrtsd  %%xmm0, %%xmm0          \n\t"
      "movsd   %%xmm6, %%xmm5          \n\t"
      "divsd   %%xmm0, %%xmm5          \n\t"
      "movsd   %%xmm5, 16(%%rax)       \n\t"
      "movddup %%xmm5, %%xmm5          \n\t"
      "mulpd   %%xmm5, %%xmm15         \n\t"
      ".DA22_END_2:                    \n\t"
      "movaps	 %%xmm15, 80(%%rbx)      \n\t"
      "                                \n\t"
      ".DA33_2:                          \n\t"
      "movaps  %%xmm13, %%xmm0         \n\t"
      "movaps  %%xmm12, %%xmm1         \n\t"
      "movaps  %%xmm15, %%xmm2         \n\t"
      "shufpd  $3, %%xmm0, %%xmm0      \n\t"
      "shufpd  $3, %%xmm1, %%xmm1      \n\t"
      "shufpd  $3, %%xmm2, %%xmm2      \n\t"
      "mulpd   %%xmm13, %%xmm0         \n\t"
      "mulpd   %%xmm12, %%xmm1         \n\t"
      "mulpd   %%xmm15, %%xmm2         \n\t"
      "subpd   %%xmm0, %%xmm14         \n\t"
      "subpd   %%xmm1, %%xmm14         \n\t"
      "subpd   %%xmm2, %%xmm14         \n\t"
      "movaps  %%xmm14, %%xmm0         \n\t"
      "shufpd  $1, %%xmm0, %%xmm0      \n\t"
      "ucomisd %%xmm7, %%xmm0          \n\t"
      "jbe     .DZERO3_2                 \n\t"
      "sqrtsd  %%xmm0, %%xmm0          \n\t"
      "movsd   %%xmm0, 120(%%rbx)      \n\t"
      "divsd   %%xmm0, %%xmm6          \n\t"
      "movsd   %%xmm6, 24(%%rax)       \n\t"
      "                                \n\t"
      "jmp    .DEND_2                    \n\t"
      "                                \n\t"
      "                                \n\t"
      ".DZERO0_2:                        \n\t"
      "xorpd  %%xmm9,  %%xmm9          \n\t"
      "movaps %%xmm9,  %%xmm13         \n\t"
      "movsd  %%xmm9,  (%%rax)         \n\t"
      "jmp    .DA00_END_2              \n\t"
      "                                \n\t"
      ".DZERO1_2:                        \n\t"
      "xorpd  %%xmm8,  %%xmm8          \n\t"
      "movaps %%xmm8,  %%xmm12         \n\t"
      "movsd  %%xmm8,  8(%%rax)       \n\t"
      "jmp    .DA11_END_2              \n\t"
      "                                \n\t"
      ".DZERO2_2:                        \n\t"
      "xorpd  %%xmm15, %%xmm15         \n\t"
      "movsd  %%xmm15, 16(%%rax)       \n\t"
      "jmp    .DA22_END_2              \n\t"
      "                                \n\t"
      ".DZERO3_2:                        \n\t"
      "xorpd  %%xmm14, %%xmm14         \n\t"
      "movsd  %%xmm14, 120(%%rbx)      \n\t"
      "movsd  %%xmm14, 24(%%rax)       \n\t"
      "                                \n\t"
      "                                \n\t"
      "                                \n\t"
      "                                \n\t"
      "jmp    .DEND_2                    \n\t"
      ".align 16                       \n\t"
      ".DONE_2:                          \n\t"
      ".long  0                        \n\t"
      ".long  1072693248               \n\t"
      ".long  0                        \n\t"
      ".long  0                        \n\t"
      ".align 16                       \n\t"
      ".DTHR_2:                          \n\t"
      ".long  2665960982               \n\t"
      ".long  1020396463               \n\t"
      ".long  0                        \n\t"
      ".long  0                        \n\t"
      "                                \n\t"
      "                                \n\t"
      ".DEND_2:                          \n\t"
      "                                \n\t"
      :
      : "m"(ki_sub), "m"(C), "m"(D), "m"(inv_diag_D), "m"(alg), "m"(Am), "m"(Bm)
      : "rax", "rbx", "rcx", "rdx", "rsi", "xmm0", "xmm1", "xmm2", "xmm3",
        "xmm4", "xmm5", "xmm6", "xmm7", "xmm8", "xmm9", "xmm10", "xmm11",
        "xmm12", "xmm13", "xmm14", "xmm15", "memory");
}


x86 assembly (clang, -O0):
<kernel_dpotrf_nt_4x4_lib4_new>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    0x10(%rbp),%rax
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rbx
xorpd  %xmm3,%xmm3
movaps %xmm3,%xmm4
movaps %xmm3,%xmm5
movaps %xmm3,%xmm6
movaps %xmm3,%xmm7
movaps %xmm3,%xmm8
movaps %xmm3,%xmm9
movaps %xmm3,%xmm12
movaps %xmm3,%xmm13
movaps %xmm3,%xmm14
movaps %xmm3,%xmm15
mov    -0x3c(%rbp),%esi
test   %esi,%esi
je     12ff <.DPOSTACC_2>
movaps (%rax),%xmm0
movaps 0x10(%rax),%xmm1
movaps (%rbx),%xmm2

x86 assembly (clang, -O2):
<kernel_dpotrf_nt_4x4_lib4_new>:
push   %rbx
mov    %rsi,-0x8(%rsp)
mov    %rdx,-0x10(%rsp)
mov    %ecx,-0x24(%rsp)
mov    %r8,-0x18(%rsp)
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %r9,-0x20(%rsp)
sar    $0x2,%eax
mov    %eax,-0x28(%rsp)
mov    -0x8(%rsp),%rax
mov    -0x10(%rsp),%rbx
xorpd  %xmm3,%xmm3
movaps %xmm3,%xmm4
movaps %xmm3,%xmm5
movaps %xmm3,%xmm6
movaps %xmm3,%xmm7
movaps %xmm3,%xmm8
movaps %xmm3,%xmm9
movaps %xmm3,%xmm12
movaps %xmm3,%xmm13
movaps %xmm3,%xmm14
movaps %xmm3,%xmm15
mov    -0x28(%rsp),%esi
test   %esi,%esi
je     12fd <.DPOSTACC_2>
movaps (%rax),%xmm0
movaps 0x10(%rax),%xmm1
movaps (%rbx),%xmm2

LLVM IR (-O0):
define void @kernel_dpotrf_nt_4x4_lib4_new(i32 %0, double* %1, double* %2, i32 %3, double* %4, double* %5, double* %6) {
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
store i32 %0, i32* %8
store double* %1, double** %9
store double* %2, double** %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
store double* %6, double** %14
%16 = load i32, i32* %8
%17 = sdiv i32 %16, 4
store i32 %17, i32* %15
ret void
}

LLVM IR (-O2):
define void @kernel_dpotrf_nt_4x4_lib4_new(i32 %0, double* %1, double* %2, i32 %3, double* %4, double* %5, double* %6) {
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
store double* %1, double** %8
store double* %2, double** %9
store i32 %3, i32* %10
store double* %4, double** %11
store double* %5, double** %12
store double* %6, double** %13
%15 = bitcast i32* %14 to i8*
%16 = sdiv i32 %0, 4
store i32 %16, i32* %14
ret void
}