// File: /workspace/github_c_makefile_star2_O1/markpeerdeman[P]mbemm/src/emath/solve.c
// Function: solve_gauss
void solve_gauss(const matrix A,const vector F )
{ int i,j,k,l,m,n = F->rows;
  double c,tmp;
  double fabsc, fabsM;
  evaluate_level(GREEN,38);
  tijdvalkje(0,A);
  check_dimensions(A, F);
  for (k=0; k<n; k++)
  { /* divide row by diagonal coefficient: */
    c = M(A,k,k); l=k;
    /* find largest coefficient for elimination: */
    for (m=k; m<n; m++)
    { fabsc=fabs(c);
	  fabsM=fabs(M(A,m,k));
	  /* if (fabs(M(A,m,k))>=fabs(c)) */
	  if (fabsM>=fabsc)
      { c = M(A,m,k);
	    l = m;
      }
    }
    /* if (fabs(c)<=TOL) 
      evaluate_level(RED,33); */
	/* change rows if nescessary: */
    if (k!=l)
    { 
      for (m=k; m<n; m++)
      { tmp = M(A,l,m);
	    M(A,l,m) = M(A,k,m);
	    M(A,k,m) = tmp;
      }
      tmp = V(F,l);
      V(F,l) = V(F,k);
      V(F,k) = tmp;
    }

    /* divide current row by diagonal coefficient: */
	M(A,k,k)=1.0;
	V(F,k) = V(F,k) / c;
    for (i=k+1; i<n; i++)
      {  M(A,k,i) = M(A,k,i) / c;
      }

    /* divide remaining rows by diagonal coefficient and eliminate: */
    for (j=k+1; j<n; j++)
    { c = M(A,j,k);
	  M(A,j,k)=0.0;
	  V(F,j)=V(F,j)-c*V(F,k);
      for (i=k+1; i<n; i++)
	  { M(A,j,i)=M(A,j,i)-c*M(A,k,i);
	  }
    }
	tijdvalkje(k+2,A);
  }

  /* apply backsubstitution to compute the remaining unknowns: */
  for (j=n-2; j>=0; j--)
  {
	for (i=n-1; i>j; i--)
	  { V(F,j) = V(F,j) - M(A,j,i) * V(F,i);
	  }
  }

  tijdvalkje(-1,A);

  evaluate_level(GREEN,34);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movslq (%rsi), %rbp
pushq $0x26
popq %rsi
xorl %edi, %edi
callq 0xbc50
xorl %edi, %edi
movq %rbx, %rsi
callq 0x366c
movq %rbx, %rdi
movq %r14, 0x8(%rsp)
movq %r14, %rsi
callq 0x11e0
testq %rbp, %rbp
jle 0x1d91
pushq $0x1
popq %r14
xorl %r13d, %r13d
movapd 0xc415(%rip), %xmm4     # 0xe010
movapd 0xc41d(%rip), %xmm5     # 0xe020
movq %rbp, %r15
movq %r14, %r11
xorl %edi, %edi
movq 0x8(%rbx), %rax
movq (%rax,%rdi,8), %rcx
movsd (%rcx,%rdi,8), %xmm0
movq %rdi, %rsi
movl %edi, %edx
movapd %xmm0, %xmm1
andpd %xmm4, %xmm1
movq (%rax,%rsi,8), %r8
movsd (%r8,%rdi,8), %xmm2
movapd %xmm2, %xmm3
andpd %xmm4, %xmm3
ucomisd %xmm1, %xmm3
cmovael %esi, %edx
cmpnlesd %xmm3, %xmm1
andpd %xmm1, %xmm0
andnpd %xmm2, %xmm1
orpd %xmm1, %xmm0
incq %rsi
cmpq %rsi, %rbp
jne 0x1c1d
movl %edx, %esi
cmpq %rsi, %rdi
je 0x1ca5
movslq %edx, %rdx
movq (%rax,%rdx,8), %rsi
movq %rdi, %r8
movsd (%rsi,%r8,8), %xmm1
movsd (%rcx,%r8,8), %xmm2
movsd %xmm2, (%rsi,%r8,8)
movsd %xmm1, (%rcx,%r8,8)
incq %r8
cmpq %r8, %rbp
jne 0x1c68
movq 0x8(%rsp), %rsi
movq 0x8(%rsi), %rsi
movsd (%rsi,%rdx,8), %xmm1
movsd (%rsi,%rdi,8), %xmm2
movsd %xmm2, (%rsi,%rdx,8)
movsd %xmm1, (%rsi,%rdi,8)
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rdx, (%rcx,%rdi,8)
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rdx
movsd (%rdx,%rdi,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rdx,%rdi,8)
leaq 0x1(%rdi), %r9
cmpq %rbp, %r9
jae 0x1cf2
leaq (%rcx,%r13), %rsi
movq %r14, %r8
movsd (%rsi,%r8,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsi,%r8,8)
incq %r8
cmpq %r8, %r15
jne 0x1cda
movq %r9, 0x10(%rsp)
cmpq %rbp, %r9
jae 0x1d58
addq %r13, %rcx
movq %r11, %rsi
movq (%rax,%rsi,8), %r8
movsd (%r8,%rdi,8), %xmm1
andq $0x0, (%r8,%rdi,8)
movsd (%rdx,%rsi,8), %xmm2
movapd %xmm1, %xmm0
xorpd %xmm5, %xmm0
mulsd (%rdx,%rdi,8), %xmm1
subsd %xmm1, %xmm2
movsd %xmm2, (%rdx,%rsi,8)
addq %r13, %r8
movq %r14, %r9
movsd (%rcx,%r9,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%r8,%r9,8), %xmm1
movsd %xmm1, (%r8,%r9,8)
incq %r9
cmpq %r9, %r15
jne 0x1d32
incq %rsi
cmpq %rbp, %rsi
jne 0x1d02
addl $0x2, %edi
movq %rbx, %rsi
movq %r11, %r12
callq 0x366c
movq %r12, %r11
movapd 0xc2af(%rip), %xmm5     # 0xe020
incq %r11
addq $0x8, %r13
decq %r15
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
movapd 0xc285(%rip), %xmm4     # 0xe010
jne 0x1c0b
cmpl $0x2, %ebp
jl 0x1de7
leal -0x2(%rbp), %eax
decq %rbp
cmpq %rbp, %rax
jge 0x1ddb
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq 0x8(%rbx), %rdx
movq (%rdx,%rax,8), %rdx
movsd (%rcx,%rax,8), %xmm0
movq %rbp, %rsi
movl %esi, %edi
shlq $0x3, %rdi
movsd (%rdx,%rdi), %xmm1
mulsd (%rcx,%rdi), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, (%rcx,%rax,8)
decq %rsi
cmpq %rsi, %rax
jl 0x1dba
leaq -0x1(%rax), %rcx
testq %rax, %rax
movq %rcx, %rax
jg 0x1d9c
movq 0x1320a(%rip), %rax     # 0x14ff8
movq (%rax), %rcx
leaq 0xc252(%rip), %rdi      # 0xe04a
pushq $0x44
popq %rsi
pushq $0x1
popq %rdx
callq 0x11a0
pushq $0x22
popq %rsi
xorl %edi, %edi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xbc50