// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/libsquish/maths.cpp
// Function: squish::ComputePrincipleComponent(squish::Sym3x3 const&)
Vec3 ComputePrincipleComponent( Sym3x3 const& matrix )
{
    Vec4 const row0( matrix[0], matrix[1], matrix[2], 0.0f );
    Vec4 const row1( matrix[1], matrix[3], matrix[4], 0.0f );
    Vec4 const row2( matrix[2], matrix[4], matrix[5], 0.0f );
    Vec4 v = VEC4_CONST( 1.0f );
    for( int i = 0; i < POWER_ITERATION_COUNT; ++i )
    {
        // matrix multiply
        Vec4 w = row0*v.SplatX();
        w = MultiplyAdd(row1, v.SplatY(), w);
        w = MultiplyAdd(row2, v.SplatZ(), w);

        // get max component from xyz in all channels
        Vec4 a = Max(w.SplatX(), Max(w.SplatY(), w.SplatZ()));

        // divide through and advance
        v = w*Reciprocal(a);
    }
    return v.GetVec3();
}

// Assembly:
subq $0x188, %rsp            # imm = 0x188
movq %rdi, 0x170(%rsp)
movq 0x170(%rsp), %rdi
xorl %esi, %esi
callq 0xad5c0
movss %xmm0, 0x1c(%rsp)
movq 0x170(%rsp), %rdi
movl $0x1, %esi
callq 0xad5c0
movss %xmm0, 0x18(%rsp)
movq 0x170(%rsp), %rdi
movl $0x2, %esi
callq 0xad5c0
movss 0x18(%rsp), %xmm1
movaps %xmm0, %xmm2
movss 0x1c(%rsp), %xmm0
leaq 0x160(%rsp), %rdi
xorps %xmm3, %xmm3
callq 0xab3c0
movq 0x170(%rsp), %rdi
movl $0x1, %esi
callq 0xad5c0
movss %xmm0, 0x24(%rsp)
movq 0x170(%rsp), %rdi
movl $0x3, %esi
callq 0xad5c0
movss %xmm0, 0x20(%rsp)
movq 0x170(%rsp), %rdi
movl $0x4, %esi
callq 0xad5c0
movss 0x20(%rsp), %xmm1
movaps %xmm0, %xmm2
movss 0x24(%rsp), %xmm0
leaq 0x150(%rsp), %rdi
xorps %xmm3, %xmm3
callq 0xab3c0
movq 0x170(%rsp), %rdi
movl $0x2, %esi
callq 0xad5c0
movss %xmm0, 0x2c(%rsp)
movq 0x170(%rsp), %rdi
movl $0x4, %esi
callq 0xad5c0
movss %xmm0, 0x28(%rsp)
movq 0x170(%rsp), %rdi
movl $0x5, %esi
callq 0xad5c0
movss 0x28(%rsp), %xmm1
movaps %xmm0, %xmm2
movss 0x2c(%rsp), %xmm0
leaq 0x140(%rsp), %rdi
xorps %xmm3, %xmm3
callq 0xab3c0
leaq 0x130(%rsp), %rdi
movss 0x5d01(%rip), %xmm0     # 0xb2e00
callq 0xab410
movl $0x0, 0x12c(%rsp)
cmpl $0x8, 0x12c(%rsp)
jge 0xad31d
leaq 0x130(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xabae0
movlpd %xmm0, 0x100(%rsp)
movlpd %xmm1, 0x108(%rsp)
leaq 0x160(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0xab580
movq 0x8(%rsp), %rdi
movlpd %xmm0, 0x110(%rsp)
movlpd %xmm1, 0x118(%rsp)
callq 0xabb10
movlpd %xmm0, 0xe0(%rsp)
movlpd %xmm1, 0xe8(%rsp)
leaq 0x150(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
leaq 0x110(%rsp), %rdx
movq %rdx, 0x10(%rsp)
callq 0xab660
movq 0x8(%rsp), %rdi
movlpd %xmm0, 0xf0(%rsp)
movlpd %xmm1, 0xf8(%rsp)
movups 0xf0(%rsp), %xmm0
movaps %xmm0, 0x110(%rsp)
callq 0xabb40
movq 0x10(%rsp), %rdx
movlpd %xmm0, 0xc0(%rsp)
movlpd %xmm1, 0xc8(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0xab660
movq 0x10(%rsp), %rdi
movlpd %xmm0, 0xd0(%rsp)
movlpd %xmm1, 0xd8(%rsp)
movups 0xd0(%rsp), %xmm0
movaps %xmm0, 0x110(%rsp)
callq 0xabae0
movq 0x10(%rsp), %rdi
movlpd %xmm0, 0xa0(%rsp)
movlpd %xmm1, 0xa8(%rsp)
callq 0xabb10
movq 0x10(%rsp), %rdi
movlpd %xmm0, 0x80(%rsp)
movlpd %xmm1, 0x88(%rsp)
callq 0xabb40
movlpd %xmm0, 0x70(%rsp)
movlpd %xmm1, 0x78(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xab880
movlpd %xmm0, 0x90(%rsp)
movlpd %xmm1, 0x98(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xab880
movlpd %xmm0, 0xb0(%rsp)
movlpd %xmm1, 0xb8(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0xab6f0
movq 0x10(%rsp), %rdi
movlpd %xmm0, 0x50(%rsp)
movlpd %xmm1, 0x58(%rsp)
leaq 0x50(%rsp), %rsi
callq 0xab580
movlpd %xmm0, 0x60(%rsp)
movlpd %xmm1, 0x68(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x130(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x138(%rsp)
movl 0x12c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x12c(%rsp)
jmp 0xad10f
leaq 0x130(%rsp), %rdi
callq 0xabc00
movss %xmm1, 0x48(%rsp)
movlpd %xmm0, 0x40(%rsp)
movl 0x48(%rsp), %eax
movl %eax, 0x180(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x178(%rsp)
movl 0x180(%rsp), %eax
movl %eax, 0x38(%rsp)
movq 0x178(%rsp), %rax
movq %rax, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
movss 0x38(%rsp), %xmm1
addq $0x188, %rsp            # imm = 0x188
retq
nopw (%rax,%rax)