// File: /workspace/github_cpp_makefile_star2_O1/srajangarg[P]raytracer/src/core/Algebra3.hpp
// Function: Mat4::inverse() const
inline Mat4 Mat4::inverse() const    // Gauss-Jordan elimination with partial pivoting
{
  Mat4 a(*this),          // As a evolves from original mat into identity
       b(identity3D());   // b evolves from identity into inverse(a)
  int i, j, i1;

  // Loop over cols of a from left to right, eliminating above and below diag
  for (j=0; j<4; j++)   // Find largest pivot in column j among rows j..3
  {
    i1 = j;         // Row with largest pivot candidate
    for (i=j+1; i<4; i++)
      if (fabs(a.v[i].n[j]) > fabs(a.v[i1].n[j]))
        i1 = i;

    // Swap rows i1 and j in a and b to put pivot on diagonal
    swap(a.v[i1], a.v[j]);
    swap(b.v[i1], b.v[j]);

    // Scale row j to have a unit diagonal
    if (a.v[j].n[j]==0.)
      ALG3_ERROR("Mat4::inverse: singular matrix; can't invert\n");

    b.v[j] /= a.v[j].n[j];
    a.v[j] /= a.v[j].n[j];

    // Eliminate off-diagonal elems in col j of a, doing identical ops to b
    for (i=0; i<4; i++)
      if (i!=j)
      {
        b.v[i] -= a.v[i].n[j]*b.v[j];
        a.v[i] -= a.v[i].n[j]*a.v[j];
      }
  }

  return b;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x88, %rsp
leaq 0x8(%rsp), %rax
movsd (%rsi), %xmm0
movsd %xmm0, (%rax)
movsd 0x8(%rsi), %xmm0
movsd %xmm0, 0x8(%rax)
movsd 0x10(%rsi), %xmm0
movsd %xmm0, 0x10(%rax)
movsd 0x18(%rsi), %xmm0
movsd %xmm0, 0x18(%rax)
leaq 0x28(%rsp), %rcx
movsd 0x20(%rsi), %xmm0
movsd %xmm0, (%rcx)
movsd 0x28(%rsi), %xmm0
movsd %xmm0, 0x8(%rcx)
movsd 0x30(%rsi), %xmm0
movsd %xmm0, 0x10(%rcx)
movsd 0x38(%rsi), %xmm0
movsd %xmm0, 0x18(%rcx)
movsd 0x40(%rsi), %xmm0
movsd %xmm0, 0x20(%rcx)
movsd 0x48(%rsi), %xmm0
movsd %xmm0, 0x28(%rcx)
movsd 0x50(%rsi), %xmm0
movsd %xmm0, 0x30(%rcx)
movsd 0x58(%rsi), %xmm0
movsd %xmm0, 0x38(%rcx)
movsd 0x60(%rsi), %xmm0
movsd %xmm0, 0x40(%rcx)
movsd 0x68(%rsi), %xmm0
movsd %xmm0, 0x48(%rcx)
movsd 0x70(%rsi), %xmm0
movsd %xmm0, 0x50(%rcx)
movsd 0x78(%rsi), %xmm0
movsd %xmm0, 0x58(%rcx)
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rdx, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movups %xmm0, 0x18(%rdi)
movq %rdx, 0x28(%rdi)
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x40(%rdi)
movq %rdx, 0x50(%rdi)
movups %xmm0, 0x58(%rdi)
movups %xmm0, 0x68(%rdi)
movq %rdx, 0x78(%rdi)
movq $-0x3, %rdx
xorl %esi, %esi
movapd 0x4f7e(%rip), %xmm0     # 0x2ca40
xorpd %xmm1, %xmm1
movsd 0x4672(%rip), %xmm2     # 0x2c140
xorl %r8d, %r8d
movl %r8d, %r10d
cmpq $0x2, %r8
ja 0x27b17
leaq (%rsp,%r8,8), %r9
addq $0x8, %r9
movq %rdx, %r11
movq %rcx, %rbx
movl %r8d, %r10d
movsd (%rbx), %xmm3
andpd %xmm0, %xmm3
movslq %r10d, %r14
shlq $0x5, %r14
movsd (%r9,%r14), %xmm4
andpd %xmm0, %xmm4
ucomisd %xmm4, %xmm3
jbe 0x27b0e
leal 0x4(%r11), %r10d
addq $0x20, %rbx
incq %r11
jne 0x27aeb
movslq %r10d, %r11
shlq $0x5, %r11
movq %r8, %r9
shlq $0x5, %r9
leaq (%rsp,%r9), %r10
addq $0x8, %r10
movsd 0x8(%rsp,%r11), %xmm6
movsd 0x10(%rsp,%r11), %xmm5
movsd 0x18(%rsp,%r11), %xmm4
movsd 0x20(%rsp,%r11), %xmm3
movsd (%r10), %xmm7
movsd %xmm7, 0x8(%rsp,%r11)
movsd 0x8(%r10), %xmm7
movsd %xmm7, 0x10(%rsp,%r11)
movsd 0x10(%r10), %xmm7
movsd %xmm7, 0x18(%rsp,%r11)
movsd 0x18(%r10), %xmm7
movsd %xmm7, 0x20(%rsp,%r11)
movsd %xmm6, (%r10)
movsd %xmm5, 0x8(%r10)
movsd %xmm4, 0x10(%r10)
movsd %xmm3, 0x18(%r10)
movsd (%rdi,%r11), %xmm10
movsd 0x8(%rdi,%r11), %xmm9
movsd 0x10(%rdi,%r11), %xmm8
movsd 0x18(%rdi,%r11), %xmm7
movsd (%rdi,%r9), %xmm11
movsd %xmm11, (%rdi,%r11)
movsd 0x8(%rdi,%r9), %xmm11
movsd %xmm11, 0x8(%rdi,%r11)
movsd 0x10(%rdi,%r9), %xmm11
movsd %xmm11, 0x10(%rdi,%r11)
movsd 0x18(%rdi,%r9), %xmm11
movsd %xmm11, 0x18(%rdi,%r11)
movsd %xmm10, (%rdi,%r9)
movsd %xmm9, 0x8(%rdi,%r9)
movsd %xmm8, 0x10(%rdi,%r9)
movsd %xmm7, 0x18(%rdi,%r9)
movsd (%r10,%r8,8), %xmm11
ucomisd %xmm1, %xmm11
jne 0x27c12
jnp 0x27d9b
incq %r8
addq %rdi, %r9
movapd %xmm2, %xmm12
divsd %xmm11, %xmm12
mulsd %xmm12, %xmm10
movsd %xmm10, (%r9)
mulsd %xmm12, %xmm9
movsd %xmm9, 0x8(%r9)
mulsd %xmm12, %xmm8
movsd %xmm8, 0x10(%r9)
mulsd %xmm12, %xmm7
movsd %xmm7, 0x18(%r9)
mulsd %xmm12, %xmm6
movsd %xmm6, (%r10)
mulsd %xmm12, %xmm5
movsd %xmm5, 0x8(%r10)
mulsd %xmm12, %xmm4
movsd %xmm4, 0x10(%r10)
mulsd %xmm12, %xmm3
movsd %xmm3, 0x18(%r10)
xorl %r11d, %r11d
cmpq %r11, %rsi
je 0x27d63
movsd (%rax,%r11), %xmm3
movsd (%r9), %xmm4
mulsd %xmm3, %xmm4
movsd 0x8(%r9), %xmm5
mulsd %xmm3, %xmm5
movsd 0x10(%r9), %xmm6
mulsd %xmm3, %xmm6
movsd 0x18(%r9), %xmm7
mulsd %xmm3, %xmm7
movsd (%rdi,%r11), %xmm8
subsd %xmm4, %xmm8
movsd 0x8(%rdi,%r11), %xmm4
subsd %xmm5, %xmm4
movsd %xmm8, (%rdi,%r11)
movsd %xmm4, 0x8(%rdi,%r11)
movsd 0x10(%rdi,%r11), %xmm4
subsd %xmm6, %xmm4
movsd %xmm4, 0x10(%rdi,%r11)
movsd 0x18(%rdi,%r11), %xmm4
subsd %xmm7, %xmm4
movsd %xmm4, 0x18(%rdi,%r11)
movsd (%r10), %xmm4
mulsd %xmm3, %xmm4
movsd 0x8(%r10), %xmm5
mulsd %xmm3, %xmm5
movsd 0x10(%r10), %xmm6
mulsd %xmm3, %xmm6
mulsd 0x18(%r10), %xmm3
movsd 0x8(%rsp,%r11), %xmm7
subsd %xmm4, %xmm7
movsd 0x10(%rsp,%r11), %xmm4
subsd %xmm5, %xmm4
movsd %xmm7, 0x8(%rsp,%r11)
movsd %xmm4, 0x10(%rsp,%r11)
movsd 0x18(%rsp,%r11), %xmm4
subsd %xmm6, %xmm4
movsd %xmm4, 0x18(%rsp,%r11)
movsd 0x20(%rsp,%r11), %xmm4
subsd %xmm3, %xmm4
movsd %xmm4, 0x20(%rsp,%r11)
addq $0x20, %r11
cmpq $0x80, %r11
jne 0x27c7b
addq $0x28, %rcx
incq %rdx
addq $0x20, %rsi
addq $0x8, %rax
cmpq $0x4, %r8
jne 0x27ad1
movq %rdi, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
retq
leaq 0x65eb(%rip), %rdi      # 0x2e38d
leaq 0x4a36(%rip), %rsi      # 0x2c7df
leaq 0x65e3(%rip), %rcx      # 0x2e393
movl $0x4fc, %edx            # imm = 0x4FC
callq 0x4200