// File: /workspace/github_cpp_makefile_star2_O1/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, %r12
movl %esi, %edi
movl $0x1, %esi
callq 0x4e6e4
movq %rax, -0x40(%rbp)
movl %r15d, %edi
movl %r15d, %esi
callq 0x4e5e2
movq %rax, %rbx
movslq %r15d, %r13
movq %r13, %rdx
imulq %r13, %rdx
shlq $0x3, %rdx
movq %rax, %rdi
movq %r12, -0x48(%rbp)
movq %r12, %rsi
callq 0x84f0
movl %r13d, %edi
movl $0x1, %esi
callq 0x4e5e2
testl %r13d, %r13d
movq %rbx, -0x30(%rbp)
jle 0x4edc8
movq %rbx, %r10
movl %r15d, %ecx
leaq (,%rcx,8), %rdx
xorl %esi, %esi
movapd 0x1ad9a(%rip), %xmm0    # 0x69930
xorpd %xmm2, %xmm2
movsd 0x1ad7e(%rip), %xmm1    # 0x69920
movq %rbx, %rdi
movq %rdi, %r8
movq %rcx, %r9
xorpd %xmm3, %xmm3
movapd %xmm3, %xmm4
movsd (%r8), %xmm3
andpd %xmm0, %xmm3
maxsd %xmm4, %xmm3
addq %rdx, %r8
decq %r9
jne 0x4ebaf
ucomisd %xmm2, %xmm3
jbe 0x4ef5a
movapd %xmm1, %xmm4
divsd %xmm3, %xmm4
movsd %xmm4, (%rax,%rsi,8)
incq %rsi
addq $0x8, %rdi
cmpq %rcx, %rsi
jne 0x4eba5
testl %r15d, %r15d
jle 0x4edc8
leal -0x1(%r15), %edx
movq %rdx, -0x50(%rbp)
leaq (,%rcx,8), %rsi
xorl %r8d, %r8d
xorpd %xmm2, %xmm2
movq %rcx, %r9
movq %r10, %rdx
xorl %edi, %edi
xorl %r11d, %r11d
movq %r9, -0x38(%rbp)
movq %r8, -0x58(%rbp)
movl %r8d, %r8d
leaq (%r10,%r8,8), %r12
testq %rdi, %rdi
je 0x4ec7e
movq %r8, %r9
movl %edi, %r8d
imull %ecx, %r8d
movq -0x30(%rbp), %r14
leaq (%r14,%r8,8), %r10
movq %r9, %r8
xorl %r13d, %r13d
movsd (%r10,%r13,8), %xmm3
testq %r13, %r13
je 0x4ec6c
movq %r14, %rbx
xorl %r9d, %r9d
movsd (%rbx), %xmm4
mulsd (%r12,%r9,8), %xmm4
subsd %xmm4, %xmm3
incq %r9
addq %rsi, %rbx
cmpq %r9, %r13
jne 0x4ec53
movsd %xmm3, (%r10,%r13,8)
incq %r13
addq $0x8, %r14
cmpq %rdi, %r13
jne 0x4ec42
leaq (%rdx,%r8,8), %rbx
movl %edi, %r8d
imull %ecx, %r8d
movq -0x30(%rbp), %r9
leaq (%r9,%r8,8), %r13
xorpd %xmm3, %xmm3
movq %rdx, %r9
movq %rdi, %r10
movsd (%r13,%r10,8), %xmm4
testq %rdi, %rdi
je 0x4ecc7
movq %r9, %r14
xorl %r8d, %r8d
movsd (%r14), %xmm5
mulsd (%r12,%r8,8), %xmm5
subsd %xmm5, %xmm4
incq %r8
addq %rsi, %r14
cmpq %r8, %rdi
jne 0x4ecad
movsd %xmm4, (%r13,%r10,8)
andpd %xmm0, %xmm4
mulsd (%rax,%r10,8), %xmm4
ucomisd %xmm3, %xmm4
movapd %xmm3, %xmm5
cmpnlesd %xmm4, %xmm5
movapd %xmm5, %xmm6
andnpd %xmm4, %xmm6
andpd %xmm3, %xmm5
orpd %xmm6, %xmm5
cmovael %r10d, %r11d
incq %r10
addq $0x8, %r9
movapd %xmm5, %xmm3
cmpq %rcx, %r10
jne 0x4ec9b
movl %r11d, %r8d
cmpq %r8, %rdi
je 0x4ed4d
movslq %r11d, %r9
movq -0x30(%rbp), %r8
leaq (%r8,%r9,8), %r8
xorl %r10d, %r10d
movq %rcx, %r14
movsd (%r8,%r10), %xmm3
movsd (%rdx,%r10), %xmm4
movsd %xmm4, (%r8,%r10)
movsd %xmm3, (%rdx,%r10)
addq %rsi, %r10
decq %r14
jne 0x4ed22
movsd (%rax,%rdi,8), %xmm3
movsd %xmm3, (%rax,%r9,8)
movq -0x40(%rbp), %r8
movl %r11d, (%r8,%rdi,4)
movl %edi, %r8d
imull %r15d, %r8d
addl %edi, %r8d
movq -0x30(%rbp), %r10
movsd (%r10,%r8,8), %xmm3
ucomisd %xmm2, %xmm3
jne 0x4ed75
jnp 0x4ef5a
cmpq -0x50(%rbp), %rdi
movq -0x38(%rbp), %r9
je 0x4edae
leaq 0x1(%rdi), %r8
cmpq %rcx, %r8
jae 0x4edae
movapd %xmm1, %xmm4
divsd %xmm3, %xmm4
movl $0x1, %r8d
movsd (%rbx,%r8,8), %xmm3
mulsd %xmm4, %xmm3
movsd %xmm3, (%rbx,%r8,8)
incq %r8
cmpq %r8, %r9
jne 0x4ed96
incq %rdi
movq -0x58(%rbp), %r8
addl %r15d, %r8d
addq $0x8, %rdx
decq %r9
cmpq %rcx, %rdi
jne 0x4ec16
movq %rax, %rdi
callq 0x87b0
testl %r15d, %r15d
jle 0x4ef55
movl %r15d, %ebx
leal 0x1(%r15), %r11d
leaq (,%rbx,8), %r13
movq -0x48(%rbp), %r12
leaq (%r12,%rbx,8), %rax
movq %rax, -0x68(%rbp)
movl %r15d, %eax
imull %r11d, %eax
decl %eax
movl %eax, -0x5c(%rbp)
movl %r15d, %eax
notl %eax
movl %eax, -0x58(%rbp)
xorl %r14d, %r14d
movl %r11d, -0x60(%rbp)
movl %r14d, %eax
imull %r15d, %eax
movq -0x48(%rbp), %rcx
leaq (%rcx,%rax,8), %rdi
movq %rdi, -0x50(%rbp)
xorl %esi, %esi
movq %r13, %rdx
callq 0x8390
movl -0x60(%rbp), %r11d
movq %r14, -0x38(%rbp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq -0x50(%rbp), %rcx
movq %rax, (%rcx,%r14,8)
testl %r15d, %r15d
movq -0x30(%rbp), %r10
jle 0x4ef3e
movq -0x38(%rbp), %rax
imulq %rbx, %rax
movq -0x48(%rbp), %rcx
leaq (%rcx,%rax,8), %rax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r10, %rcx
xorl %esi, %esi
movq -0x40(%rbp), %r9
xorpd %xmm2, %xmm2
movslq (%r9,%rsi,4), %rdi
movsd (%rax,%rdi,8), %xmm0
movsd (%rax,%rsi,8), %xmm1
movsd %xmm1, (%rax,%rdi,8)
testl %edx, %edx
js 0x4eeb9
movl %edx, %edi
cmpq %rdi, %rsi
jbe 0x4eec3
movq %r13, %r8
imulq %rdi, %r8
addq %rcx, %r8
movsd (%r8), %xmm1
mulsd (%r12,%rdi,8), %xmm1
subsd %xmm1, %xmm0
incq %rdi
addq %r13, %r8
cmpq %rdi, %rsi
jne 0x4ee9d
jmp 0x4eec3
ucomisd %xmm2, %xmm0
jne 0x4eec1
jnp 0x4eec3
movl %esi, %edx
movsd %xmm0, (%rax,%rsi,8)
incq %rsi
addq $0x8, %rcx
cmpq %rbx, %rsi
jne 0x4ee75
movl -0x5c(%rbp), %ecx
movq -0x68(%rbp), %rdx
movq %rbx, %rsi
testl %r15d, %r15d
jle 0x4ef3e
movsd -0x8(%rax,%rsi,8), %xmm0
cmpq %rbx, %rsi
jge 0x4ef15
movl %ecx, %edi
xorl %r8d, %r8d
movl %edi, %r9d
movsd (%r10,%r9,8), %xmm1
mulsd (%rdx,%r8,8), %xmm1
subsd %xmm1, %xmm0
incq %r8
leal (%r8,%rsi), %r9d
addl %r15d, %edi
cmpl %r15d, %r9d
jl 0x4eef3
leaq -0x1(%rsi), %rdi
movl %r11d, %r8d
imull %edi, %r8d
movslq %r8d, %r8
divsd (%r10,%r8,8), %xmm0
movsd %xmm0, (%rax,%rdi,8)
addq $-0x8, %rdx
addl -0x58(%rbp), %ecx
cmpq $0x1, %rsi
movq %rdi, %rsi
jg 0x4eee3
movq -0x38(%rbp), %r14
incq %r14
addq %r13, %r12
addq %r13, -0x68(%rbp)
cmpq %rbx, %r14
jne 0x4ee0f
xorl %r15d, %r15d
jmp 0x4ef68
movq %rax, %rdi
callq 0x87b0
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq -0x40(%rbp), %rdi
callq 0x87b0
movq -0x30(%rbp), %rdi
callq 0x87b0
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq