// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../tools/evolver_ndf15.c
// Function: calc_C
int calc_C(struct jacobian *jac){
  int nz, i, j, k, n, col, row;
  int duplicate;
  int *Ci, *Cp, *Ai, *Ap;
  n = jac->Numerical->n;Ci = jac->Ci;Cp = jac->Cp;
  Ai = jac->spJ->Ai; Ap = jac->spJ->Ap;
  /* Calculate sparse pattern for C = J + J'. We can use jac->Numerical->xi as
     storage, since we can't refactor when jac->repeated_pattern = 0. xi[0..n][0..n].
     At first, Cp[i+1] holds the number of elements in w[i].*/
  for (j=0;j<=n;j++) Cp[j] = 0; /* Clear Cp */
  for (j=0;j<n;j++){
    /* Loop over columns */
    for (i=Ap[j];i<Ap[j+1];i++){
      /* Loop over rows */
      if(Ai[i]!=j){
    /*Don't consider diagonal entries..*/
    /* Add (i,j) to sparsity pattern of C, if it does not exist: */
    duplicate = _FALSE_;
    col = j; row = Ai[i];
    for(k=0;k<Cp[col+1];k++){
      /* Check for duplicates in column col:*/
      if(jac->Numerical->xi[col][k]==row){
        duplicate = _TRUE_;
        break;
      }
    }
    if (!duplicate){
      jac->Numerical->xi[col][Cp[col+1]] = row;
      Cp[col+1]++;
    }
    /* Add (j,i) to sparsity pattern if it does not exist: */
    duplicate = _FALSE_;
    col = Ai[i]; row = j;
    for(k=0;k<Cp[col+1];k++){
      /* Check for dublicates in the Ai[i]'th column: */
      if(jac->Numerical->xi[col][k]==row){
        duplicate = _TRUE_;
        break;
      }
    }
    if (!duplicate){
      jac->Numerical->xi[col][Cp[col+1]] = row;
      Cp[col+1]++;
    }
      }
    }
  }
  /* wi prepared, write sparsity pattern in Ci and Cp:*/
  nz = 0;
  for(j=0;j<n;j++){
    for(k=0;k<Cp[j+1];k++){
      Ci[nz] = jac->Numerical->xi[j][k];
      nz++;
    }
    Cp[j+1] +=Cp[j]; /* We can update Cp here. */
  }
  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x68(%rdi), %rax
movq 0x78(%rdi), %r14
movl (%r14), %r15d
movq 0x88(%rdi), %r12
movq 0x80(%rdi), %rbx
movq 0x10(%rax), %r13
movq 0x18(%rax), %rbp
testl %r15d, %r15d
js 0x119cd
leaq 0x4(,%r15,4), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8200
testl %r15d, %r15d
jle 0x11a7d
xorl %eax, %eax
movq %rax, %rcx
movslq (%r13,%rax,4), %rdx
incq %rax
cmpl 0x4(%r13,%rcx,4), %edx
jge 0x11a74
movl (%rbp,%rdx,4), %esi
cmpq %rsi, %rcx
je 0x11a63
movslq (%rbx,%rax,4), %rdi
testq %rdi, %rdi
jle 0x11a19
movq 0x18(%r14), %r8
movq (%r8,%rcx,8), %r8
xorl %r9d, %r9d
cmpl %esi, (%r8,%r9,4)
je 0x11a28
incq %r9
cmpq %r9, %rdi
jne 0x11a0b
movq 0x18(%r14), %r8
movq (%r8,%rcx,8), %r8
movl %esi, (%r8,%rdi,4)
incl (%rbx,%rax,4)
movslq (%rbp,%rdx,4), %rsi
movslq 0x4(%rbx,%rsi,4), %rdi
testq %rdi, %rdi
jle 0x11a53
movq 0x18(%r14), %r8
movq (%r8,%rsi,8), %r8
xorl %r9d, %r9d
movl (%r8,%r9,4), %r10d
cmpq %r10, %rcx
je 0x11a63
incq %r9
cmpq %r9, %rdi
jne 0x11a42
movq 0x18(%r14), %r8
movq (%r8,%rsi,8), %r8
movl %ecx, (%r8,%rdi,4)
incl 0x4(%rbx,%rsi,4)
incq %rdx
movslq (%r13,%rax,4), %rsi
cmpq %rsi, %rdx
jl 0x119ee
cmpq %r15, %rax
jne 0x119d8
testl %r15d, %r15d
jle 0x11ac7
xorl %eax, %eax
xorl %ecx, %ecx
leaq 0x1(%rax), %rdx
movl 0x4(%rbx,%rax,4), %esi
testl %esi, %esi
jle 0x11ab9
movq 0x18(%r14), %rsi
movq (%rsi,%rax,8), %r8
movslq %ecx, %rsi
leaq (%r12,%rsi,4), %r9
xorl %edi, %edi
movl (%r8,%rdi,4), %esi
movl %esi, (%r9,%rdi,4)
incq %rdi
movslq (%rbx,%rdx,4), %rsi
cmpq %rsi, %rdi
jl 0x11aa3
addl %edi, %ecx
addl (%rbx,%rax,4), %esi
movl %esi, (%rbx,%rdx,4)
movq %rdx, %rax
cmpq %r15, %rdx
jne 0x11a86
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq