// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../tools/evolver_ndf15.c
// Function: new_linearisation
int new_linearisation(struct jacobian *jac,double hinvGak,int neq,ErrorMsg error_message){
  double luparity, *Ax;
  int i,j,*Ap,*Ai,funcreturn;
  if(jac->use_sparse==1){
    Ap = jac->spJ->Ap; Ai = jac->spJ->Ai; Ax = jac->spJ->Ax;
    /* Construct jac->spJ->Ax from jac->xjac, the jacobian:*/
    for(j=0;j<neq;j++){
      for(i=Ap[j];i<Ap[j+1];i++){
        if(Ai[i]==j){
          /* I'm at the diagonal */
          Ax[i] = 1.0-hinvGak*jac->xjac[i];
        }
        else{
          Ax[i] = -hinvGak*jac->xjac[i];
        }
      }
    }
    /* Matrix constructed... */
    if(jac->new_jacobian==_TRUE_){
      /*I have a new pattern, and I have not done a LU decomposition
        since the last jacobian calculation, so    I need to do a full
        sparse LU-decomposition: */
      /* Find the sparsity pattern C = J + J':*/
      calc_C(jac);
      /* Calculate the optimal ordering: */
      sp_amd(jac->Cp, jac->Ci, neq, jac->cnzmax,
         jac->Numerical->q,jac->Numerical->wamd);
      /* if the next line is uncomented, the code uses natural ordering instead of AMD ordering */
      /*jac->Numerical->q = NULL;*/
      funcreturn = sp_ludcmp(jac->Numerical, jac->spJ, 1e-3);
      class_test(funcreturn == _FAILURE_,error_message,
         "Failure in sp_ludcmp. Possibly singular matrix!");
      jac->new_jacobian = _FALSE_;
    }
    else{
      /* I have a repeated pattern, so I can just refactor:*/
      sp_refactor(jac->Numerical, jac->spJ);
    }
  }
  else{
    /* Normal calculation: */
    for(i=1;i<=neq;i++){
      for(j=1;j<=neq;j++){
    jac->LU[i][j] = - hinvGak * jac->dfdy[i][j];
    if(i==j) jac->LU[i][j] +=1.0;
      }
    }
    /*Dense LU decomposition: */
    funcreturn = ludcmp(jac->LU,neq,jac->luidx,&luparity,jac->LUw);
    class_test(funcreturn == _FAILURE_,error_message,
           "Failure in ludcmp. Possibly singular matrix!");
  }
  return _SUCCESS_;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1010, %rsp           # imm = 0x1010
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r14
cmpl $0x1, 0x28(%rdi)
jne 0xf803
movq 0x68(%r14), %rsi
movq 0x10(%rsi), %rax
movq 0x18(%rsi), %rcx
movq 0x20(%rsi), %rdx
xorpd 0xd5a93(%rip), %xmm0    # 0xe5230
xorl %edi, %edi
testl %r15d, %r15d
movl $0x0, %r8d
cmovgl %r15d, %r8d
movsd 0xd5aac(%rip), %xmm1    # 0xe5260
cmpq %r8, %rdi
je 0xf87c
movslq (%rax,%rdi,4), %r10
leaq 0x1(%rdi), %r9
movslq 0x4(%rax,%rdi,4), %r11
cmpq %r11, %r10
jge 0xf7fe
movl (%rcx,%r10,4), %r12d
movq 0x70(%r14), %r13
movsd (%r13,%r10,8), %xmm2
mulsd %xmm0, %xmm2
movapd %xmm2, %xmm3
addsd %xmm1, %xmm3
cmpq %r12, %rdi
je 0xf7f3
movapd %xmm2, %xmm3
movsd %xmm3, (%rdx,%r10,8)
incq %r10
jmp 0xf7ca
movq %r9, %rdi
jmp 0xf7b4
xorpd 0xd5a25(%rip), %xmm0    # 0xe5230
leal 0x1(%r15), %eax
xorl %ecx, %ecx
testl %r15d, %r15d
movl $0x0, %edx
cmovgl %r15d, %edx
incl %edx
decq %rax
pushq $0x1
popq %rsi
movsd 0xd5a33(%rip), %xmm1    # 0xe5260
cmpq %rdx, %rsi
je 0xf924
xorl %edi, %edi
cmpq %rdi, %rax
je 0xf874
movq (%r14), %r8
movq (%r8,%rsi,8), %r8
movsd 0x8(%r8,%rdi,8), %xmm2
mulsd %xmm0, %xmm2
movapd %xmm2, %xmm3
addsd %xmm1, %xmm3
cmpq %rdi, %rcx
je 0xf860
movapd %xmm2, %xmm3
movq 0x10(%r14), %r8
movq (%r8,%rsi,8), %r8
movsd %xmm3, 0x8(%r8,%rdi,8)
incq %rdi
jmp 0xf838
incq %rsi
incq %rcx
jmp 0xf82d
cmpl $0x1, 0x44(%r14)
jne 0xf99f
movq %r14, %rdi
callq 0xfeaf
movq 0x80(%r14), %rdi
movq 0x88(%r14), %rsi
movl 0x48(%r14), %ecx
movq 0x78(%r14), %rax
movq 0x38(%rax), %r8
movq 0x40(%rax), %r9
movl %r15d, %edx
callq 0xaae6
movq 0x68(%r14), %rsi
movq 0x78(%r14), %rdi
movsd 0xd6463(%rip), %xmm0    # 0xe5d28
callq 0xa41d
cmpl $0x1, %eax
jne 0xf9aa
leaq 0xd6891(%rip), %rsi     # 0xe616b
leaq 0x810(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0xd578f(%rip), %rsi     # 0xe5082
leaq 0xd665d(%rip), %rdx     # 0xe5f57
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xd5721(%rip), %rsi     # 0xe5034
leaq 0xd6881(%rip), %rdx     # 0xe619b
movq %rbx, %rdi
movl $0x3d4, %ecx            # imm = 0x3D4
jmp 0xf990
movq 0x20(%r14), %rdx
movq 0x10(%r14), %rdi
movq 0x18(%r14), %r8
leaq 0x8(%rsp), %rcx
movl %r15d, %esi
callq 0x102b1
testl %eax, %eax
je 0xf9af
leaq 0xd6865(%rip), %rsi     # 0xe61ad
leaq 0x810(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0xd5721(%rip), %rsi     # 0xe5082
leaq 0xd65ef(%rip), %rdx     # 0xe5f57
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xd56b3(%rip), %rsi     # 0xe5034
leaq 0xd6813(%rip), %rdx     # 0xe619b
movq %rbx, %rdi
movl $0x3e7, %ecx            # imm = 0x3E7
movq %r15, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
jmp 0xf9b1
movq 0x78(%r14), %rdi
callq 0xa826
jmp 0xf9af
andl $0x0, 0x44(%r14)
xorl %eax, %eax
addq $0x1010, %rsp           # imm = 0x1010
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq