// File: /workspace/github_c_makefile_star2_O2/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
movq 0x68(%rdi), %r8
movq 0x78(%rdi), %rax
movslq (%rax), %rcx
movq 0x88(%rdi), %rdx
movq %rdx, -0x8(%rsp)
movq 0x80(%rdi), %rsi
movq 0x10(%r8), %rdi
movq 0x18(%r8), %r8
xorl %r9d, %r9d
cmpq %rcx, %r9
jg 0xfef1
andl $0x0, (%rsi,%r9,4)
incq %r9
jmp 0xfee2
xorl %r9d, %r9d
testl %ecx, %ecx
cmovlel %r9d, %ecx
cmpq %rcx, %r9
je 0xffaa
movslq (%rdi,%r9,4), %r11
leaq 0x1(%r9), %r10
movslq (%rdi,%r10,4), %rbx
cmpq %rbx, %r11
jge 0xffa2
movl (%r8,%r11,4), %r14d
cmpq %r14, %r9
je 0xff9a
movslq (%rsi,%r10,4), %r15
testl %r15d, %r15d
movl $0x0, %r12d
cmovgl %r15d, %r12d
movq 0x18(%rax), %rbx
movq (%rbx,%r9,8), %r13
xorl %ebp, %ebp
cmpq %rbp, %r12
je 0xff51
leaq 0x1(%rbp), %rdx
cmpl %r14d, (%r13,%rbp,4)
movq %rdx, %rbp
jne 0xff3c
jmp 0xff5e
movl %r14d, (%r13,%r15,4)
incl (%rsi,%r10,4)
movl (%r8,%r11,4), %r14d
movslq %r14d, %r14
movslq 0x4(%rsi,%r14,4), %r15
testl %r15d, %r15d
movl $0x0, %r12d
cmovgl %r15d, %r12d
xorl %r13d, %r13d
cmpq %r13, %r12
je 0xff8d
movq (%rbx,%r14,8), %rdx
movl (%rdx,%r13,4), %edx
incq %r13
cmpq %rdx, %r9
jne 0xff76
jmp 0xff9a
movq (%rbx,%r14,8), %rdx
movl %r9d, (%rdx,%r15,4)
incl 0x4(%rsi,%r14,4)
incq %r11
jmp 0xff0b
movq %r10, %r9
jmp 0xfefa
xorl %r8d, %r8d
xorl %edi, %edi
cmpq %rcx, %r8
je 0xfff5
leaq 0x1(%r8), %r9
movslq %edi, %rdi
movq -0x8(%rsp), %rdx
leaq (%rdx,%rdi,4), %r11
xorl %r10d, %r10d
movslq (%rsi,%r9,4), %rbx
cmpq %rbx, %r10
jge 0xffe5
movq 0x18(%rax), %rdx
movq (%rdx,%r8,8), %rdx
movl (%rdx,%r10,4), %edx
movl %edx, (%r11,%r10,4)
incq %r10
jmp 0xffc7
addl (%rsi,%r8,4), %ebx
movl %ebx, (%rsi,%r9,4)
addq %r10, %rdi
movq %r9, %r8
jmp 0xffaf
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq