// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::matinv(double*, int)
extern int matinv(double *A, int n)
{
    double d,*B;
    int i,j,*indx;
    
    indx=imat(n,1); B=mat(n,n); matcpy(B,A,n,n);
    if (ludcmp(B,n,indx,&d)) {free(indx); free(B); return -1;}
    for (j=0;j<n;j++) {
        for (i=0;i<n;i++) A[i+j*n]=0.0;
        A[j+j*n]=1.0;
        lubksb(B,n,indx,A+j*n);
    }
    free(indx); free(B);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %r15d
movq %rdi, -0x48(%rbp)
pushq $0x1
popq %rsi
movl %r15d, %edi
callq 0x45d3a
movq %rax, %rbx
movl %r15d, %edi
movl %r15d, %esi
callq 0x45c3a
movq %rax, %r14
movslq %r15d, %r13
leaq (,%r13,8), %r12
movq %r12, %rdx
imulq %r13, %rdx
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x84f0
movl %r13d, %edi
pushq $0x1
popq %rsi
callq 0x45c3a
xorl %ecx, %ecx
testl %r13d, %r13d
movl $0x0, %edx
cmovgl %r15d, %edx
movq %rdx, -0x40(%rbp)
movl %r13d, %edx
movq %rdx, -0x30(%rbp)
xorpd %xmm2, %xmm2
movsd 0x1979e(%rip), %xmm0    # 0x5f920
movapd 0x197a6(%rip), %xmm1    # 0x5f930
movq %r14, %rdx
cmpq -0x40(%rbp), %rcx
je 0x461d9
xorpd %xmm3, %xmm3
movq -0x30(%rbp), %rsi
movq %rdx, %rdi
subq $0x1, %rsi
jb 0x461b9
movsd (%rdi), %xmm4
andpd %xmm1, %xmm4
maxsd %xmm3, %xmm4
addq %r12, %rdi
movapd %xmm4, %xmm3
jmp 0x4619e
ucomisd %xmm2, %xmm3
jbe 0x4636d
movapd %xmm0, %xmm4
divsd %xmm3, %xmm4
movsd %xmm4, (%rax,%rcx,8)
incq %rcx
addq $0x8, %rdx
jmp 0x4618d
leal -0x1(%r13), %ecx
movq %rcx, -0x58(%rbp)
leaq 0x8(,%r13,8), %rcx
movq %rcx, -0x38(%rbp)
xorl %esi, %esi
xorpd %xmm2, %xmm2
movq %r14, %r8
movq %r14, %rcx
movq %r14, %r10
xorl %r11d, %r11d
movq %rbx, -0x68(%rbp)
movq %r13, -0x50(%rbp)
cmpq -0x40(%rbp), %rsi
je 0x4637e
movq %rsi, %rdx
imulq %r13, %rdx
leaq (%r14,%rdx,8), %rdi
movq %r14, %rdx
xorl %r9d, %r9d
cmpq %rsi, %r9
je 0x4625d
movsd (%rdi,%r9,8), %xmm3
movq %rdx, %rbx
xorl %r13d, %r13d
cmpq %r13, %r9
je 0x4624e
movsd (%rbx), %xmm4
mulsd (%r10,%r13,8), %xmm4
subsd %xmm4, %xmm3
incq %r13
addq %r12, %rbx
jmp 0x46233
movsd %xmm3, (%rdi,%r9,8)
incq %r9
addq $0x8, %rdx
jmp 0x46222
xorpd %xmm3, %xmm3
movq %rcx, %r9
movq %rsi, %rdx
cmpq -0x30(%rbp), %rdx
je 0x462cf
movsd (%rdi,%rdx,8), %xmm4
movq %r9, %rbx
xorl %r13d, %r13d
cmpq %r13, %rsi
je 0x46293
movsd (%rbx), %xmm5
mulsd (%r10,%r13,8), %xmm5
subsd %xmm5, %xmm4
incq %r13
addq %r12, %rbx
jmp 0x46278
movsd %xmm4, (%rdi,%rdx,8)
andpd %xmm1, %xmm4
mulsd (%rax,%rdx,8), %xmm4
ucomisd %xmm3, %xmm4
movapd %xmm3, %xmm5
cmpnlesd %xmm4, %xmm5
movapd %xmm5, %xmm6
andnpd %xmm4, %xmm6
andpd %xmm3, %xmm5
cmovael %edx, %r11d
orpd %xmm6, %xmm5
incq %rdx
addq $0x8, %r9
movapd %xmm5, %xmm3
jmp 0x46267
movl %r11d, %edx
cmpq %rdx, %rsi
je 0x46312
movslq %r11d, %rdx
leaq (%r14,%rdx,8), %r9
movq -0x30(%rbp), %rbx
xorl %r13d, %r13d
subq $0x1, %rbx
jb 0x46308
movsd (%r9,%r13), %xmm3
movsd (%rcx,%r13), %xmm4
movsd %xmm4, (%r9,%r13)
movsd %xmm3, (%rcx,%r13)
addq %r12, %r13
jmp 0x462e5
movsd (%rax,%rsi,8), %xmm3
movsd %xmm3, (%rax,%rdx,8)
movq -0x68(%rbp), %rbx
movl %r11d, (%rbx,%rsi,4)
movsd (%rdi,%rsi,8), %xmm4
ucomisd %xmm2, %xmm4
movq -0x50(%rbp), %r13
jne 0x4632b
jnp 0x4636d
cmpq -0x58(%rbp), %rsi
jne 0x46344
incq %rsi
addq %r12, %r10
addq $0x8, %rcx
addq -0x38(%rbp), %r8
jmp 0x46207
movapd %xmm0, %xmm3
divsd %xmm4, %xmm3
pushq $0x1
popq %rdx
leaq (%rsi,%rdx), %rdi
cmpq %r13, %rdi
jge 0x46331
movsd (%r8,%rdx,8), %xmm4
mulsd %xmm3, %xmm4
movsd %xmm4, (%r8,%rdx,8)
incq %rdx
jmp 0x4634f
movq %rax, %rdi
callq 0x8780
pushq $-0x1
popq %r15
jmp 0x464e2
movq %rax, %rdi
callq 0x8780
leal 0x1(%r15), %ecx
movq -0x48(%rbp), %r9
movq -0x30(%rbp), %rax
leaq (%r9,%rax,8), %rax
movq %rax, -0x38(%rbp)
movl %r15d, %eax
movl %ecx, -0x58(%rbp)
imull %ecx, %eax
decl %eax
movl %eax, -0x5c(%rbp)
movl %r15d, %esi
notl %esi
xorpd %xmm0, %xmm0
xorl %edi, %edi
cmpq -0x40(%rbp), %rdi
je 0x464df
movq %rdi, %rcx
imulq -0x50(%rbp), %rcx
xorl %edx, %edx
cmpq %rdx, -0x30(%rbp)
je 0x463d7
andq $0x0, (%r9,%rdx,8)
incq %rdx
jmp 0x463c7
movq -0x48(%rbp), %rax
leaq (%rax,%rcx,8), %r11
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rdi, -0x70(%rbp)
movq %rax, (%r11,%rdi,8)
movq %r14, %rdi
xorl %r8d, %r8d
pushq $-0x1
popq %rdx
cmpq -0x40(%rbp), %r8
je 0x4645c
movslq (%rbx,%r8,4), %rcx
movsd (%r11,%rcx,8), %xmm1
movsd (%r11,%r8,8), %xmm2
movsd %xmm2, (%r11,%rcx,8)
testl %edx, %edx
js 0x46442
movl %edx, %ecx
movq %r12, %r10
imulq %rcx, %r10
addq %rdi, %r10
cmpq %r8, %rcx
jae 0x4644d
movsd (%r10), %xmm2
mulsd (%r9,%rcx,8), %xmm2
subsd %xmm2, %xmm1
incq %rcx
addq %r12, %r10
jmp 0x46426
ucomisd %xmm0, %xmm1
jne 0x4644a
jnp 0x4644d
movl %r8d, %edx
movsd %xmm1, (%r11,%r8,8)
incq %r8
addq $0x8, %rdi
jmp 0x463fa
movl -0x5c(%rbp), %r10d
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %r8
movq -0x30(%rbp), %rbx
testq %r8, %r8
jle 0x464c8
decq %r8
leaq -0x1(%rbx), %rcx
movsd (%r11,%r8,8), %xmm1
movl %r10d, %edx
xorl %r13d, %r13d
leal (%rbx,%r13), %eax
cmpl %r15d, %eax
jge 0x464a7
movl %edx, %eax
movsd (%r14,%rax,8), %xmm2
mulsd (%rdi,%r13,8), %xmm2
subsd %xmm2, %xmm1
incq %r13
addl %r15d, %edx
jmp 0x46484
movl -0x58(%rbp), %eax
imull %r8d, %eax
cltq
divsd (%r14,%rax,8), %xmm1
movsd %xmm1, (%r11,%r8,8)
addq $-0x8, %rdi
addl %esi, %r10d
movq %rcx, %rbx
jmp 0x4646c
movq -0x70(%rbp), %rdi
incq %rdi
addq %r12, %r9
addq %r12, -0x38(%rbp)
movq -0x68(%rbp), %rbx
jmp 0x463b3
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x8780
movq %r14, %rdi
callq 0x8780
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq