// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x2058, %rsp           # imm = 0x2058
movq %rdi, 0x2048(%rsp)
movsd %xmm0, 0x2040(%rsp)
movl %esi, 0x203c(%rsp)
movq %rdx, 0x2030(%rsp)
movq 0x2048(%rsp), %rax
cmpl $0x1, 0x28(%rax)
jne 0x16adb
movq 0x2048(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x2010(%rsp)
movq 0x2048(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, 0x2008(%rsp)
movq 0x2048(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, 0x2020(%rsp)
movl $0x0, 0x2018(%rsp)
movl 0x2018(%rsp), %eax
cmpl 0x203c(%rsp), %eax
jge 0x16989
movq 0x2010(%rsp), %rax
movslq 0x2018(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x201c(%rsp)
movl 0x201c(%rsp), %eax
movq 0x2010(%rsp), %rcx
movl 0x2018(%rsp), %edx
addl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x16971
movq 0x2008(%rsp), %rax
movslq 0x201c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x2018(%rsp), %eax
jne 0x1690b
movsd 0x2040(%rsp), %xmm0
movq 0x2048(%rsp), %rax
movq 0x70(%rax), %rax
movslq 0x201c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm1, %xmm0
movsd 0x1bb958(%rip), %xmm1   # 0x1d2248
addsd %xmm1, %xmm0
movq 0x2020(%rsp), %rax
movslq 0x201c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x16959
movsd 0x2040(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq 0x2048(%rsp), %rax
movq 0x70(%rax), %rax
movslq 0x201c(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movq 0x2020(%rsp), %rax
movslq 0x201c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1695b
movl 0x201c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x201c(%rsp)
jmp 0x1686a
jmp 0x16973
movl 0x2018(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2018(%rsp)
jmp 0x1683c
movq 0x2048(%rsp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x16ab9
movq 0x2048(%rsp), %rdi
callq 0x177b0
movq 0x2048(%rsp), %rax
movq 0x80(%rax), %rdi
movq 0x2048(%rsp), %rax
movq 0x88(%rax), %rsi
movl 0x203c(%rsp), %edx
movq 0x2048(%rsp), %rax
movl 0x48(%rax), %ecx
movq 0x2048(%rsp), %rax
movq 0x78(%rax), %rax
movq 0x38(%rax), %r8
movq 0x2048(%rsp), %rax
movq 0x78(%rax), %rax
movq 0x40(%rax), %r9
callq 0xce30
movq 0x2048(%rsp), %rax
movq 0x78(%rax), %rdi
movq 0x2048(%rsp), %rax
movq 0x68(%rax), %rsi
movsd 0x1bc2bb(%rip), %xmm0   # 0x1d2cd8
callq 0xbed0
movl %eax, 0x2004(%rsp)
cmpl $0x1, 0x2004(%rsp)
jne 0x16aa8
leaq 0x1800(%rsp), %rdi
leaq 0x1bc75e(%rip), %rsi    # 0x1d31a0
movb $0x0, %al
callq 0x5b9c0
leaq 0x1000(%rsp), %rdi
leaq 0x1800(%rsp), %rcx
leaq 0x1bb622(%rip), %rsi    # 0x1d2082
leaq 0x1bc4a7(%rip), %rdx    # 0x1d2f0e
movb $0x0, %al
callq 0x5b9c0
movq 0x2030(%rsp), %rdi
leaq 0x1000(%rsp), %r8
leaq 0x1bb5af(%rip), %rsi    # 0x1d2034
leaq 0x1bc744(%rip), %rdx    # 0x1d31d0
movl $0x3d4, %ecx            # imm = 0x3D4
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2054(%rsp)
jmp 0x16cb2
movq 0x2048(%rsp), %rax
movl $0x0, 0x44(%rax)
jmp 0x16ad6
movq 0x2048(%rsp), %rax
movq 0x78(%rax), %rdi
movq 0x2048(%rsp), %rax
movq 0x68(%rax), %rsi
callq 0xc810
jmp 0x16ca7
movl $0x1, 0x201c(%rsp)
movl 0x201c(%rsp), %eax
cmpl 0x203c(%rsp), %eax
jg 0x16bf4
movl $0x1, 0x2018(%rsp)
movl 0x2018(%rsp), %eax
cmpl 0x203c(%rsp), %eax
jg 0x16bdc
movsd 0x2040(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq 0x2048(%rsp), %rax
movq (%rax), %rax
movslq 0x201c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2018(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movq 0x2048(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x201c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2018(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x201c(%rsp), %eax
cmpl 0x2018(%rsp), %eax
jne 0x16bc4
movq 0x2048(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x201c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2018(%rsp), %rcx
movsd 0x1bb68e(%rip), %xmm0   # 0x1d2248
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x16bc6
movl 0x2018(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2018(%rsp)
jmp 0x16b05
jmp 0x16bde
movl 0x201c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x201c(%rsp)
jmp 0x16ae6
movq 0x2048(%rsp), %rax
movq 0x10(%rax), %rdi
movl 0x203c(%rsp), %esi
movq 0x2048(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x2048(%rsp), %rax
movq 0x18(%rax), %r8
leaq 0x2028(%rsp), %rcx
callq 0x18030
movl %eax, 0x2004(%rsp)
cmpl $0x1, 0x2004(%rsp)
jne 0x16ca5
leaq 0x800(%rsp), %rdi
leaq 0x1bc596(%rip), %rsi    # 0x1d31e2
movb $0x0, %al
callq 0x5b9c0
movq %rsp, %rdi
leaq 0x800(%rsp), %rcx
leaq 0x1bb41d(%rip), %rsi    # 0x1d2082
leaq 0x1bc2a2(%rip), %rdx    # 0x1d2f0e
movb $0x0, %al
callq 0x5b9c0
movq 0x2030(%rsp), %rdi
movq %rsp, %r8
leaq 0x1bb3af(%rip), %rsi    # 0x1d2034
leaq 0x1bc544(%rip), %rdx    # 0x1d31d0
movl $0x3e7, %ecx            # imm = 0x3E7
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2054(%rsp)
jmp 0x16cb2
jmp 0x16ca7
movl $0x0, 0x2054(%rsp)
movl 0x2054(%rsp), %eax
addq $0x2058, %rsp           # imm = 0x2058
retq
nopw %cs:(%rax,%rax)