// File: /workspace/github_c_makefile_star2_O3/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 0x78(%rdi), %r14
movl (%r14), %r15d
testl %r15d, %r15d
js 0x11c02
movq 0x68(%rdi), %rax
movq 0x88(%rdi), %r12
movq 0x80(%rdi), %rbx
movq 0x10(%rax), %r13
movq 0x18(%rax), %rbp
leaq 0x4(,%r15,4), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8200
testq %r15, %r15
je 0x11c02
movl (%r13), %edx
xorl %eax, %eax
movq %rax, %rcx
incq %rax
movl 0x4(%r13,%rcx,4), %esi
cmpl %esi, %edx
jge 0x11bad
movslq %edx, %rdx
movl (%rbp,%rdx,4), %esi
cmpq %rsi, %rcx
je 0x11ba0
movslq (%rbx,%rax,4), %r8
movq 0x18(%r14), %rdi
movq (%rdi,%rcx,8), %r9
testq %r8, %r8
jle 0x11b68
xorl %r10d, %r10d
cmpl %esi, (%r9,%r10,4)
je 0x11b73
incq %r10
cmpq %r10, %r8
jne 0x11b5a
movl %esi, (%r9,%r8,4)
incl (%rbx,%rax,4)
movl (%rbp,%rdx,4), %esi
movslq %esi, %rsi
movslq 0x4(%rbx,%rsi,4), %r8
movq (%rdi,%rsi,8), %rdi
testq %r8, %r8
jle 0x11b98
xorl %r9d, %r9d
movl (%rdi,%r9,4), %r10d
cmpq %r10, %rcx
je 0x11ba0
incq %r9
cmpq %r9, %r8
jne 0x11b87
movl %ecx, (%rdi,%r8,4)
incl 0x4(%rbx,%rsi,4)
incq %rdx
movslq (%r13,%rax,4), %rsi
cmpq %rsi, %rdx
jl 0x11b3d
movl %esi, %edx
cmpq %r15, %rax
jne 0x11b2b
testl %r15d, %r15d
je 0x11c02
xorl %eax, %eax
xorl %ecx, %ecx
leaq 0x1(%rax), %rdx
movl 0x4(%rbx,%rax,4), %esi
testl %esi, %esi
jle 0x11bf4
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 0x11bde
addl %edi, %ecx
addl (%rbx,%rax,4), %esi
movl %esi, (%rbx,%rdx,4)
movq %rdx, %rax
cmpq %r15, %rdx
jne 0x11bc1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq