original_code:
void umfzl_garbage_collection
(
    NumericType *Numeric,
    WorkType *Work,
    long drnew,
    long dcnew,
    long do_Fcpos
)
{
    long size, e, n_row, n_col, nrows, ncols, nrowsleft, ncolsleft, prevsize,
 csize, size2, i2, j2, i, j, cdeg, rdeg, *E, row, col,
 *Rows, *Cols, *Rows2, *Cols2, nel, e2, *Row_tuples, *Col_tuples,
 *Row_degree, *Col_degree ;
    DoubleComplex *C, *C1, *C3, *C2 ;
    Unit *psrc, *pdest, *p, *pnext ;
    Element *epsrc, *epdest ;
    Col_degree = Numeric->Cperm ;
    Row_degree = Numeric->Rperm ;
    Row_tuples = Numeric->Uip ;
    Col_tuples = Numeric->Lip ;
    E = Work->E ;
    n_row = Work->n_row ;
    n_col = Work->n_col ;
    Numeric->ngarbage++ ;
    for (row = 0 ; row < n_row ; row++)
    {
 if ((Row_degree [row] >= 0) && Row_tuples [row])
 {
     ;
     p = Numeric->Memory + Row_tuples [row] - 1 ;
     ;
     ;
     ;
     ;
     p->header.size = -p->header.size ;
     Row_tuples [row] = 0 ;
 }
    }
    for (col = 0 ; col < n_col ; col++)
    {
 if ((Col_degree [col] >= 0) && Col_tuples [col])
 {
     ;
     p = Numeric->Memory + Col_tuples [col] - 1 ;
     ;
     ;
     ;
     ;
     p->header.size = -p->header.size ;
     Col_tuples [col] = 0 ;
 }
    }
    nel = Work->nel ;
    ;
    e2 = 0 ;
    for (e = 0 ; e <= nel ; e++)
    {
 if (E [e])
 {
     psrc = Numeric->Memory + E [e] ;
     psrc-- ;
     if (e > 0)
     {
  e2++ ;
     }
     ;
     psrc->header.size = e2 ;
     ;
     E [e] = 0 ;
     if (e == Work->prior_element)
     {
  Work->prior_element = e2 ;
     }
 }
    }
    Work->nel = e2 ;
    nel = Work->nel ;
    psrc = Numeric->Memory + Numeric->size - 2 ;
    pdest = psrc ;
    prevsize = psrc->header.prevsize ;
    ;
    while (prevsize > 0)
    {
 size = prevsize ;
 psrc -= (size + 1) ;
 e = psrc->header.size ;
 prevsize = psrc->header.prevsize ;
 ;
 if (e == 0)
 {
     DoubleComplex *F1, *F2, *Fsrc, *Fdst ;
     long c, r, k, dr, dc, gap, gap1, gap2, nb ;
     F1 = (DoubleComplex *) (psrc + 1) ;
     k = Work->fnpiv ;
     dr = Work->fnr_curr ;
     dc = Work->fnc_curr ;
     r = Work->fnrows ;
     c = Work->fncols ;
     nb = Work->nb ;
     ;
     ;
     if (drnew % 2 == 0)
     {
  drnew++ ;
     }
     drnew = (((dr) < (drnew)) ? (dr) : (drnew)) ;
     ;
     pnext = pdest ;
     Fsrc = Work->Flblock ;
     Fdst = Work->Flblock ;
     ;
     gap1 = dr - r ;
     gap2 = drnew - r ;
     ;
     for (j = 0 ; j < k ; j++)
     {
  for (i = 0 ; i < r ; i++)
  {
      *Fdst++ = *Fsrc++ ;
  }
  Fsrc += gap1 ;
  Fdst += gap2 ;
     }
     ;
     Fdst += drnew * (nb - k) ;
     Fsrc = Work->Fublock ;
     ;
     gap1 = dc - c ;
     gap2 = dcnew - c ;
     for (i = 0 ; i < k ; i++)
     {
  for (j = 0 ; j < c ; j++)
  {
      *Fdst++ = *Fsrc++ ;
  }
  Fsrc += gap1 ;
  Fdst += gap2 ;
     }
     ;
     Fdst += dcnew * (nb - k) ;
     Fsrc = Work->Fcblock ;
     ;
     gap1 = dr - r ;
     gap2 = drnew - r ;
     for (j = 0 ; j < c ; j++)
     {
  for (i = 0 ; i < r ; i++)
  {
      *Fdst++ = *Fsrc++ ;
  }
  Fsrc += gap1 ;
  Fdst += gap2 ;
     }
     ;
     if (do_Fcpos)
     {
  long *Fcols, *Fcpos ;
  Fcols = Work->Fcols ;
  Fcpos = Work->Fcpos ;
  for (j = 0 ; j < c ; j++)
  {
      col = Fcols [j] ;
      ;
      ;
      Fcpos [col] = j * drnew ;
  }
     }
     Work->fnr_curr = drnew ;
     Work->fnc_curr = dcnew ;
     Work->fcurr_size = (drnew + nb) * (dcnew + nb) ;
     size = (((((sizeof (DoubleComplex) * (Work->fcurr_size))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     size = (((1) > (size)) ? (1) : (size)) ;
     pnext->header.prevsize = size ;
     pdest -= (size + 1) ;
     F2 = (DoubleComplex *) (pdest + 1) ;
     ;
     ;
     ;
     Fsrc = F1 + nb*nb + drnew*nb + nb*dcnew + drnew*c ;
     Fdst = F2 + nb*nb + drnew*nb + nb*dcnew + drnew*c ;
     gap = drnew - r ;
     for (j = c-1 ; j >= 0 ; j--)
     {
  Fsrc -= gap ;
  Fdst -= gap ;
  for (i = r-1 ; i >= 0 ; i--)
  {
      *--Fdst = *--Fsrc ;
  }
     }
     ;
     ;
     Fsrc -= dcnew * (nb - k) ;
     Fdst -= dcnew * (nb - k) ;
     ;
     ;
     gap = dcnew - c ;
     for (i = k-1 ; i >= 0 ; i--)
     {
  Fsrc -= gap ;
  Fdst -= gap ;
  for (j = c-1 ; j >= 0 ; j--)
  {
      *--Fdst = *--Fsrc ;
  }
     }
     ;
     ;
     Fsrc -= drnew * (nb - k) ;
     Fdst -= drnew * (nb - k) ;
     ;
     ;
     gap = drnew - r ;
     for (j = k-1 ; j >= 0 ; j--)
     {
  Fsrc -= gap ;
  Fdst -= gap ;
  for (i = r-1 ; i >= 0 ; i--)
  {
      *--Fdst = *--Fsrc ;
  }
     }
     ;
     ;
     Fsrc -= nb * (nb - k) ;
     Fdst -= nb * (nb - k) ;
     ;
     ;
     gap = nb - k ;
     for (j = k-1 ; j >= 0 ; j--)
     {
  Fsrc -= gap ;
  Fdst -= gap ;
  for (i = k-1 ; i >= 0 ; i--)
  {
      *--Fdst = *--Fsrc ;
  }
     }
     ;
     ;
     E [0] = (pdest + 1) - Numeric->Memory ;
     Work->Flublock = (DoubleComplex *) (Numeric->Memory + E [0]) ;
     ;
     Work->Flblock = Work->Flublock + nb * nb ;
     Work->Fublock = Work->Flblock + drnew * nb ;
     Work->Fcblock = Work->Fublock + nb * dcnew ;
     pdest->header.prevsize = 0 ;
     pdest->header.size = size ;
 }
 else if (e > 0)
 {
     p = psrc + 1 ;
     { { { ; ; ; epsrc = (Element *) p ; p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ; Cols = (long *) p ; } ; ncols = epsrc->ncols ; Rows = Cols + ncols ; } ; nrows = epsrc->nrows ; p += (((((sizeof (long) * (ncols + nrows))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ; C = (DoubleComplex *) p ; } ;
     nrowsleft = epsrc->nrowsleft ;
     ncolsleft = epsrc->ncolsleft ;
     cdeg = epsrc->cdeg ;
     rdeg = epsrc->rdeg ;
     csize = nrowsleft * ncolsleft ;
     size2 = (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))
    + (((((sizeof (long) * (nrowsleft + ncolsleft))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))
    + (((((sizeof (DoubleComplex) * (csize))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     ;
     pnext = pdest ;
     pnext->header.prevsize = size2 ;
     pdest -= (size2 + 1) ;
     ;
     ;
     ;
     p = pdest + 1 ;
     epdest = (Element *) p ;
     p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     Cols2 = (long *) p ;
     Rows2 = Cols2 + ncolsleft ;
     p += (((((sizeof (long) * (nrowsleft + ncolsleft))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     C2 = (DoubleComplex *) p ;
     ;
     ;
     ;
     ;
     ;
     if (nrowsleft < nrows || ncolsleft < ncols)
     {
  ;
  C1 = C ;
  C3 = C ;
  for (j = 0 ; j < ncols ; j++)
  {
      if (Cols [j] >= 0)
      {
   for (i = 0 ; i < nrows ; i++)
   {
       if (Rows [i] >= 0)
       {
    *C3++ = C1 [i] ;
       }
   }
      }
      C1 += nrows ;
  }
  ;
  ;
     }
     C += csize ;
     C2 += csize ;
     for (i = 0 ; i < csize ; i++)
     {
  *--C2 = *--C ;
     }
     i2 = nrowsleft ;
     for (i = nrows - 1 ; i >= 0 ; i--)
     {
  ;
  if (Rows [i] >= 0)
  {
      Rows2 [--i2] = Rows [i] ;
  }
     }
     ;
     j2 = ncolsleft ;
     for (j = ncols - 1 ; j >= 0 ; j--)
     {
  ;
  if (Cols [j] >= 0)
  {
      Cols2 [--j2] = Cols [j] ;
  }
     }
     ;
     E [e] = (pdest + 1) - Numeric->Memory ;
     epdest = (Element *) (pdest + 1) ;
     epdest->next = (-1) ;
     epdest->ncols = ncolsleft ;
     epdest->nrows = nrowsleft ;
     epdest->ncolsleft = ncolsleft ;
     epdest->nrowsleft = nrowsleft ;
     epdest->rdeg = rdeg ;
     epdest->cdeg = cdeg ;
     ;
     pdest->header.prevsize = 0 ;
     pdest->header.size = size2 ;
     ;
 }
 ;
    }
    ;
    ;
    ;
    Numeric->itail = pdest - Numeric->Memory ;
    pdest->header.prevsize = 0 ;
    Numeric->ibig = (-1) ;
    Numeric->tail_usage = Numeric->size - Numeric->itail ;
    for (e = nel+1 ; e < Work->elen ; e++)
    {
 E [e] = 0 ;
    }
    ;
}

canonical_original_code:
void umfzl_garbage_collection(struct NumericType *Numeric, struct WorkType *Work, long drnew, long dcnew, long do_Fcpos)
{
    long size; long e; long n_row; long n_col; long nrows; long ncols; long nrowsleft; long ncolsleft; long prevsize; long csize; long size2; long i2; long j2; long i; long j; long cdeg; long rdeg; long *E; long row; long col; long *Rows; long *Cols; long *Rows2; long *Cols2; long nel; long e2; long *Row_tuples; long *Col_tuples; long *Row_degree; long *Col_degree;
    struct DoubleComplex *C; struct DoubleComplex *C1; struct DoubleComplex *C3; struct DoubleComplex *C2;
    union Unit_union *psrc; union Unit_union *pdest; union Unit_union *p; union Unit_union *pnext;
    struct Element *epsrc; struct Element *epdest;
    Col_degree = Numeric->Cperm ;
    Row_degree = Numeric->Rperm ;
    Row_tuples = Numeric->Uip ;
    Col_tuples = Numeric->Lip ;
    E = Work->E ;
    n_row = Work->n_row ;
    n_col = Work->n_col ;
    Numeric->ngarbage++ ;
    for (row = 0 ; row < n_row ; row++)
    {
 if ((Row_degree [row] >= 0) && Row_tuples [row])
 {
     ;
     p = Numeric->Memory + Row_tuples [row] - 1 ;
     ;
     ;
     ;
     ;
     p->header.size = -p->header.size ;
     Row_tuples [row] = 0 ;
 }
    }
    for (col = 0 ; col < n_col ; col++)
    {
 if ((Col_degree [col] >= 0) && Col_tuples [col])
 {
     ;
     p = Numeric->Memory + Col_tuples [col] - 1 ;
     ;
     ;
     ;
     ;
     p->header.size = -p->header.size ;
     Col_tuples [col] = 0 ;
 }
    }
    nel = Work->nel ;
    ;
    e2 = 0 ;
    for (e = 0 ; e <= nel ; e++)
    {
 if (E [e])
 {
     psrc = Numeric->Memory + E [e] ;
     psrc-- ;
     if (e > 0)
     {
  e2++ ;
     }
     ;
     psrc->header.size = e2 ;
     ;
     E [e] = 0 ;
     if (e == Work->prior_element)
     {
  Work->prior_element = e2 ;
     }
 }
    }
    Work->nel = e2 ;
    nel = Work->nel ;
    psrc = Numeric->Memory + Numeric->size - 2 ;
    pdest = psrc ;
    prevsize = psrc->header.prevsize ;
    ;
    while (prevsize > 0)
    {
 size = prevsize ;
 psrc -= (size + 1) ;
 e = psrc->header.size ;
 prevsize = psrc->header.prevsize ;
 ;
 if (e == 0)
 {
     struct DoubleComplex *F1; struct DoubleComplex *F2; struct DoubleComplex *Fsrc; struct DoubleComplex *Fdst;
     long c; long r; long k; long dr; long dc; long gap; long gap1; long gap2; long nb;
     F1 = (struct DoubleComplex *) (psrc + 1) ;
     k = Work->fnpiv ;
     dr = Work->fnr_curr ;
     dc = Work->fnc_curr ;
     r = Work->fnrows ;
     c = Work->fncols ;
     nb = Work->nb ;
     ;
     ;
     if (drnew % 2 == 0)
     {
  drnew++ ;
     }
     drnew = (((dr) < (drnew)) ? (dr) : (drnew)) ;
     ;
     pnext = pdest ;
     Fsrc = Work->Flblock ;
     Fdst = Work->Flblock ;
     ;
     gap1 = dr - r ;
     gap2 = drnew - r ;
     ;
     for (j = 0 ; j < k ; j++)
     {
  for (i = 0 ; i < r ; i++)
  {
      *Fdst++ = *Fsrc++ ;
  }
  Fsrc += gap1 ;
  Fdst += gap2 ;
     }
     ;
     Fdst += drnew * (nb - k) ;
     Fsrc = Work->Fublock ;
     ;
     gap1 = dc - c ;
     gap2 = dcnew - c ;
     for (i = 0 ; i < k ; i++)
     {
  for (j = 0 ; j < c ; j++)
  {
      *Fdst++ = *Fsrc++ ;
  }
  Fsrc += gap1 ;
  Fdst += gap2 ;
     }
     ;
     Fdst += dcnew * (nb - k) ;
     Fsrc = Work->Fcblock ;
     ;
     gap1 = dr - r ;
     gap2 = drnew - r ;
     for (j = 0 ; j < c ; j++)
     {
  for (i = 0 ; i < r ; i++)
  {
      *Fdst++ = *Fsrc++ ;
  }
  Fsrc += gap1 ;
  Fdst += gap2 ;
     }
     ;
     if (do_Fcpos)
     {
  long *Fcols; long *Fcpos;
  Fcols = Work->Fcols ;
  Fcpos = Work->Fcpos ;
  for (j = 0 ; j < c ; j++)
  {
      col = Fcols [j] ;
      ;
      ;
      Fcpos [col] = j * drnew ;
  }
     }
     Work->fnr_curr = drnew ;
     Work->fnc_curr = dcnew ;
     Work->fcurr_size = (drnew + nb) * (dcnew + nb) ;
     size = (((((sizeof (DoubleComplex) * (Work->fcurr_size))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     size = (((1) > (size)) ? (1) : (size)) ;
     pnext->header.prevsize = size ;
     pdest -= (size + 1) ;
     F2 = (struct DoubleComplex *) (pdest + 1) ;
     ;
     ;
     ;
     Fsrc = F1 + nb*nb + drnew*nb + nb*dcnew + drnew*c ;
     Fdst = F2 + nb*nb + drnew*nb + nb*dcnew + drnew*c ;
     gap = drnew - r ;
     for (j = c-1 ; j >= 0 ; j--)
     {
  Fsrc -= gap ;
  Fdst -= gap ;
  for (i = r-1 ; i >= 0 ; i--)
  {
      *--Fdst = *--Fsrc ;
  }
     }
     ;
     ;
     Fsrc -= dcnew * (nb - k) ;
     Fdst -= dcnew * (nb - k) ;
     ;
     ;
     gap = dcnew - c ;
     for (i = k-1 ; i >= 0 ; i--)
     {
  Fsrc -= gap ;
  Fdst -= gap ;
  for (j = c-1 ; j >= 0 ; j--)
  {
      *--Fdst = *--Fsrc ;
  }
     }
     ;
     ;
     Fsrc -= drnew * (nb - k) ;
     Fdst -= drnew * (nb - k) ;
     ;
     ;
     gap = drnew - r ;
     for (j = k-1 ; j >= 0 ; j--)
     {
  Fsrc -= gap ;
  Fdst -= gap ;
  for (i = r-1 ; i >= 0 ; i--)
  {
      *--Fdst = *--Fsrc ;
  }
     }
     ;
     ;
     Fsrc -= nb * (nb - k) ;
     Fdst -= nb * (nb - k) ;
     ;
     ;
     gap = nb - k ;
     for (j = k-1 ; j >= 0 ; j--)
     {
  Fsrc -= gap ;
  Fdst -= gap ;
  for (i = k-1 ; i >= 0 ; i--)
  {
      *--Fdst = *--Fsrc ;
  }
     }
     ;
     ;
     E [0] = (pdest + 1) - Numeric->Memory ;
     Work->Flublock = (struct DoubleComplex *) (Numeric->Memory + E [0]) ;
     ;
     Work->Flblock = Work->Flublock + nb * nb ;
     Work->Fublock = Work->Flblock + drnew * nb ;
     Work->Fcblock = Work->Fublock + nb * dcnew ;
     pdest->header.prevsize = 0 ;
     pdest->header.size = size ;
 }
 else if (e > 0)
 {
     p = psrc + 1 ;
     { { { ; ; ; epsrc = (struct Element *) p ; p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ; Cols = (long *) p ; } ; ncols = epsrc->ncols ; Rows = Cols + ncols ; } ; nrows = epsrc->nrows ; p += (((((sizeof (long) * (ncols + nrows))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ; C = (struct DoubleComplex *) p ; } ;
     nrowsleft = epsrc->nrowsleft ;
     ncolsleft = epsrc->ncolsleft ;
     cdeg = epsrc->cdeg ;
     rdeg = epsrc->rdeg ;
     csize = nrowsleft * ncolsleft ;
     size2 = (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))
    + (((((sizeof (long) * (nrowsleft + ncolsleft))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))
    + (((((sizeof (DoubleComplex) * (csize))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     ;
     pnext = pdest ;
     pnext->header.prevsize = size2 ;
     pdest -= (size2 + 1) ;
     ;
     ;
     ;
     p = pdest + 1 ;
     epdest = (struct Element *) p ;
     p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     Cols2 = (long *) p ;
     Rows2 = Cols2 + ncolsleft ;
     p += (((((sizeof (long) * (nrowsleft + ncolsleft))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     C2 = (struct DoubleComplex *) p ;
     ;
     ;
     ;
     ;
     ;
     if (nrowsleft < nrows || ncolsleft < ncols)
     {
  ;
  C1 = C ;
  C3 = C ;
  for (j = 0 ; j < ncols ; j++)
  {
      if (Cols [j] >= 0)
      {
   for (i = 0 ; i < nrows ; i++)
   {
       if (Rows [i] >= 0)
       {
    *C3++ = C1 [i] ;
       }
   }
      }
      C1 += nrows ;
  }
  ;
  ;
     }
     C += csize ;
     C2 += csize ;
     for (i = 0 ; i < csize ; i++)
     {
  *--C2 = *--C ;
     }
     i2 = nrowsleft ;
     for (i = nrows - 1 ; i >= 0 ; i--)
     {
  ;
  if (Rows [i] >= 0)
  {
      Rows2 [--i2] = Rows [i] ;
  }
     }
     ;
     j2 = ncolsleft ;
     for (j = ncols - 1 ; j >= 0 ; j--)
     {
  ;
  if (Cols [j] >= 0)
  {
      Cols2 [--j2] = Cols [j] ;
  }
     }
     ;
     E [e] = (pdest + 1) - Numeric->Memory ;
     epdest = (struct Element *) (pdest + 1) ;
     epdest->next = (-1) ;
     epdest->ncols = ncolsleft ;
     epdest->nrows = nrowsleft ;
     epdest->ncolsleft = ncolsleft ;
     epdest->nrowsleft = nrowsleft ;
     epdest->rdeg = rdeg ;
     epdest->cdeg = cdeg ;
     ;
     pdest->header.prevsize = 0 ;
     pdest->header.size = size2 ;
     ;
 }
 ;
    }
    ;
    ;
    ;
    Numeric->itail = pdest - Numeric->Memory ;
    pdest->header.prevsize = 0 ;
    Numeric->ibig = (-1) ;
    Numeric->tail_usage = Numeric->size - Numeric->itail ;
    for (e = nel+1 ; e < Work->elen ; e++)
    {
 E [e] = 0 ;
    }
    ;
}

variable_types: struct NumericType { double flops; long scale; long valid; union Unit_union { struct { long size; } header; double xxxxxx; } *Memory; long ihead; long *Rperm; long ulen; struct DoubleComplex { double component[2]; } *D; long do_recip; double *Rs; long n_row; long tail_usage; long maxnrows; } *

variable_types: struct WorkType { long *E; struct DoubleComplex *Wx; long *Wp; long *Lpattern; long *Diagonal_map; long n_row; long *Front_new1strow; long Pivrow[64]; struct DoubleComplex *Flublock; long *Frows; } *

variable_types: drnew long

variable_types: dcnew long

variable_types: size long

variable_types: e long

variable_types: nrows long

variable_types: ncols long

variable_types: nrowsleft long

variable_types: ncolsleft long

variable_types: prevsize long

variable_types: csize long

variable_types: i long

variable_types: j long

variable_types: cdeg long

variable_types: rdeg long

variable_types:
E
long *

variable_types: row long

variable_types: col long

variable_types:
Rows
long *

variable_types:
Cols
long *

variable_types: nel long

variable_types:
epsrc
struct Element { long cdeg; } *

variable_types:
epdest
struct Element { long cdeg; } *

variable_types: c long

variable_types: r long

variable_types: k long

variable_types: dr long

variable_types: dc long

variable_types: gap long

variable_types: nb long

variable_types:
Fcols
long *

variable_types:
Fcpos
long *

return_type: void


decompiled_code:
__int64 __fastcall cholmod_l_error(int a1, __int64 a2, __int64 a3, const char *a4, __int64 a5)
{
__int64 result; // rax
int v7; // eax
void (*v8)(const char *, ...); // r8
int v9; // eax
void (__fastcall *v10)(_QWORD, __int64); // rax

if ( !a5 )
return 0LL;
if ( *(_QWORD *)(a5 + 2016) == 2LL )
{
v7 = *(_DWORD *)(a5 + 160);
*(_DWORD *)(a5 + 2028) = a1;
if ( !v7 )
{
v8 = *(void (**)(const char *, ...))(a5 + 152);
if ( v8 )
{
v9 = *(_DWORD *)(a5 + 140);
if ( a1 <= 0 || v9 <= 1 )
{
if ( v9 > 0 )
{
v8("CHOLMOD error: %s\n", a4);
fflush(stdout);
fflush(stderr);
}
}
else
{
v8("CHOLMOD warning: %s\n", a4);
fflush(stdout);
fflush(stderr);
}
}
v10 = *(void (__fastcall **)(_QWORD, __int64))(a5 + 168);
if ( v10 )
v10((unsigned int)a1, a2);
}
result = 1LL;
}
else
{
*(_DWORD *)(a5 + 2028) = -4;
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, __int64 a2, __int64 a3, const char *a4, __int64 a5)
{
__int64 result; // rax
int v7; // eax
void (*v8)(const char *, ...); // r8
int v9; // eax
void (__fastcall *v10)(_QWORD, __int64); // rax

if ( !a5 )
return 0LL;
if ( *(_QWORD *)(a5 + 2016) == 2LL )
{
v7 = *(_DWORD *)(a5 + 160);
*(_DWORD *)(a5 + 2028) = a1;
if ( !v7 )
{
v8 = *(void (**)(const char *, ...))(a5 + 152);
if ( v8 )
{
v9 = *(_DWORD *)(a5 + 140);
if ( a1 <= 0 || v9 <= 1 )
{
if ( v9 > 0 )
{
v8("CHOLMOD error: %s\n", a4);
fflush(stdout);
fflush(stderr);
}
}
else
{
v8("CHOLMOD warning: %s\n", a4);
fflush(stdout);
fflush(stderr);
}
}
v10 = *(void (__fastcall **)(_QWORD, __int64))(a5 + 168);
if ( v10 )
v10((unsigned int)a1, a2);
}
result = 1LL;
}
else
{
*(_DWORD *)(a5 + 2028) = -4;
result = 0LL;
}
return result;
}

original_code:
int cholmod_l_error
(
    int status,
    const char *file,
    int line,
    const char *message,
    cholmod_common *Common
)
{
    { if (Common == ((void *)0)) { return (0) ; } if (Common->itype != 2 || Common->dtype != 0) { Common->status = (-4) ; return (0) ; } } ;
    Common->status = status ;
    if (!(Common->try_catch))
    {
 if (Common->print_function != ((void *)0))
 {
     if (status > 0 && Common->print > 1)
     {
  (Common->print_function) ("CHOLMOD warning: %s\n", message) ;
  fflush (stdout) ;
  fflush (stderr) ;
     }
     else if (Common->print > 0)
     {
  (Common->print_function) ("CHOLMOD error: %s\n", message) ;
  fflush (stdout) ;
  fflush (stderr) ;
     }
 }
 if (Common->error_handler != ((void *)0))
 {
     Common->error_handler (status, file, line, message) ;
 }
    }
    return (1) ;
}

canonical_original_code:
int cholmod_l_error(int status, char *file, int line, char *message, struct cholmod_common_struct *Common)
{
    { if (Common == ((void *)0)) { return (0) ; } if (Common->itype != 2 || Common->dtype != 0) { Common->status = (-4) ; return (0) ; } } ;
    Common->status = status ;
    if (!(Common->try_catch))
    {
 if (Common->print_function != ((void *)0))
 {
     if (status > 0 && Common->print > 1)
     {
  (Common->print_function) ("CHOLMOD warning: %s\n", message) ;
  fflush (stdout) ;
  fflush (stderr) ;
     }
     else if (Common->print > 0)
     {
  (Common->print_function) ("CHOLMOD error: %s\n", message) ;
  fflush (stdout) ;
  fflush (stderr) ;
     }
 }
 if (Common->error_handler != ((void *)0))
 {
     Common->error_handler (status, file, line, message) ;
 }
    }
    return (1) ;
}

variable_types: status int

variable_types:
file
char *

variable_types: line int

variable_types:
message
char *

variable_types: struct cholmod_common_struct { double dbound; double grow0; double grow1; unsigned long grow2; unsigned long maxrank; double supernodal_switch; int supernodal; int final_asis; int final_super; int final_ll; int final_pack; int final_monotonic; int final_resymbol; double zrelax[3]; unsigned long nrelax[3]; int prefer_zomplex; int prefer_upper; int quick_return_if_not_posdef; int print; int precise; int (*print_function)(char *, ...); int try_catch; void (*error_handler)(int status, char *file, int line, char *message); int nmethods; int current; int selected; struct cholmod_method_struct { double lnz; double fl; double prune_dense; double prune_dense2; double nd_oksep; double other_1[4]; unsigned long nd_small; unsigned long other_2[4]; int aggressive; int order_for_lu; int nd_compress; int nd_camd; int nd_components; int ordering; unsigned long other_3[4]; } method[-1]; int postorder; void *(*malloc_memory)(unsigned long); void *(*realloc_memory)(void *, unsigned long); void (*free_memory)(void *); void *(*calloc_memory)(unsigned long, unsigned long); int (*complex_divide)(double ax, double az, double bx, double bz, double *cx, double *cz); double (*hypotenuse)(double x, double y); double metis_memory; double metis_dswitch; unsigned long metis_nswitch; unsigned long nrow; long mark; unsigned long iworksize; unsigned long xworksize; void *Flag; void *Head; void *Xwork; void *Iwork; int itype; int dtype; int no_workspace_reallocate; int status; double fl; double lnz; double anz; double modfl; unsigned long malloc_count; unsigned long memory_usage; unsigned long memory_inuse; double nrealloc_col; double nrealloc_factor; double ndbounds_hit; double rowfacfl; double aatfl; double other1[10]; double SPQR_xstat[4]; double SPQR_grain; double SPQR_small; long SPQR_istat[10]; long other2[6]; int other3[10]; int prefer_binary; int default_nesdis; int called_nd; int blas_ok; int SPQR_shrink; int SPQR_nthreads; unsigned long other4[16]; void *other5[16]; } *

return_type: int

user_defined_types: struct cholmod_common_struct { double dbound; double grow0; double grow1; unsigned long grow2; unsigned long maxrank; double supernodal_switch; int supernodal; int final_asis; int final_super; int final_ll; int final_pack; int final_monotonic; int final_resymbol; double zrelax[3]; unsigned long nrelax[3]; int prefer_zomplex; int prefer_upper; int quick_return_if_not_posdef; int print; int precise; int (*print_function)(char *, ...); int try_catch; void (*error_handler)(int status, char *file, int line, char *message); int nmethods; int current; int selected; struct cholmod_method_struct method[-1]; int postorder; void *(*malloc_memory)(unsigned long); void *(*realloc_memory)(void *, unsigned long); void (*free_memory)(void *); void *(*calloc_memory)(unsigned long, unsigned long); int (*complex_divide)(double ax, double az, double bx, double bz, double *cx, double *cz); double (*hypotenuse)(double x, double y); double metis_memory; double metis_dswitch; unsigned long metis_nswitch; unsigned long nrow; long mark; unsigned long iworksize; unsigned long xworksize; void *Flag; void *Head; void *Xwork; void *Iwork; int itype; int dtype; int no_workspace_reallocate; int status; double fl; double lnz; double anz; double modfl; unsigned long malloc_count; unsigned long memory_usage; unsigned long memory_inuse; double nrealloc_col; double nrealloc_factor; double ndbounds_hit; double rowfacfl; double aatfl; double other1[10]; double SPQR_xstat[4]; double SPQR_grain; double SPQR_small; long SPQR_istat[10]; long other2[6]; int other3[10]; int prefer_binary; int default_nesdis; int called_nd; int blas_ok; int SPQR_shrink; int SPQR_nthreads; unsigned long other4[16]; void *other5[16]; }


original_code:
long umfdl_get_memory
(
    NumericType *Numeric,
    WorkType *Work,
    long needunits,
    long r2,
    long c2,
    long do_Fcpos
)
{
    double nsize, bsize, tsize ;
    long i, minsize, newsize, newmem, costly, row, col, *Row_tlen, *Col_tlen,
 n_row, n_col, *Row_degree, *Col_degree ;
    Unit *mnew, *p ;
    n_row = Work->n_row ;
    n_col = Work->n_col ;
    Row_degree = Numeric->Rperm ;
    Col_degree = Numeric->Cperm ;
    Row_tlen = Numeric->Uilen ;
    Col_tlen = Numeric->Lilen ;
    for (row = 0 ; row < n_row ; row++)
    {
 if ((Row_degree [row] >= 0))
 {
     Row_tlen [row] = 0 ;
 }
    }
    for (col = 0 ; col < n_col ; col++)
    {
 if ((Col_degree [col] >= 0))
 {
     Col_tlen [col] = 0 ;
 }
    }
    nsize = (double) needunits + 2 ;
    needunits += umfdl_tuple_lengths (Numeric, Work, &tsize) ;
    nsize += tsize ;
    needunits += 2 ;
    ;
    minsize = Numeric->size + needunits ;
    nsize += (double) Numeric->size ;
    bsize = ((double) 0x7fffffffffffffffL) / sizeof (Unit) - 1 ;
    newsize = (long) ((1.2) * ((double) minsize)) ;
    nsize *= (1.2) ;
    nsize += 1 ;
    if (newsize < 0 || nsize > bsize)
    {
 ;
 newsize = (long) bsize ;
    }
    else
    {
 ;
 newsize = (((newsize) > (minsize)) ? (newsize) : (minsize)) ;
    }
    newsize = (((newsize) > (Numeric->size)) ? (newsize) : (Numeric->size)) ;
    ;
    Numeric->ibig = (-1) ;
    ;
    mnew = (Unit *) ((void *)0) ;
    while (!mnew)
    {
 mnew = (Unit *) umf_l_realloc (Numeric->Memory, newsize, sizeof (Unit)) ;
 if (!mnew)
 {
     if (newsize == minsize)
     {
  mnew = Numeric->Memory ;
  newsize = Numeric->size ;
     }
     else
     {
  newsize = (long) ((0.95) * ((double) newsize)) ;
  newsize = (((minsize) > (newsize)) ? (minsize) : (newsize)) ;
     }
 }
    }
    ;
    costly = (mnew != Numeric->Memory) ;
    Numeric->Memory = mnew ;
    if (Work->E [0])
    {
 long nb, dr, dc ;
 nb = Work->nb ;
 dr = Work->fnr_curr ;
 dc = Work->fnc_curr ;
 Work->Flublock = (double *) (Numeric->Memory + Work->E [0]) ;
 Work->Flblock = Work->Flublock + nb * nb ;
 Work->Fublock = Work->Flblock + dr * nb ;
 Work->Fcblock = Work->Fublock + nb * dc ;
 ;
    }
    ;
    newmem = newsize - Numeric->size ;
    ;
    if (newmem >= 2)
    {
 p = Numeric->Memory + Numeric->size - 2 ;
 p->header.size = newmem - 1 ;
 i = Numeric->size - 1 ;
 p += newmem ;
 p->header.prevsize = newmem - 1 ;
 p->header.size = 1 ;
 Numeric->size = newsize ;
 umfdl_mem_free_tail_block (Numeric, i) ;
 Numeric->nrealloc++ ;
 if (costly)
 {
     Numeric->ncostly++ ;
 }
    }
    ;
    umfdl_garbage_collection (Numeric, Work, r2, c2, do_Fcpos) ;
    return (umfdl_build_tuples (Numeric, Work)) ;
}

canonical_original_code:
long umfdl_get_memory(struct NumericType *Numeric, struct WorkType *Work, long needunits, long r2, long c2, long do_Fcpos)
{
    double nsize; double bsize; double tsize;
    long i; long minsize; long newsize; long newmem; long costly; long row; long col; long *Row_tlen; long *Col_tlen; long n_row; long n_col; long *Row_degree; long *Col_degree;
    union Unit_union *mnew; union Unit_union *p;
    n_row = Work->n_row ;
    n_col = Work->n_col ;
    Row_degree = Numeric->Rperm ;
    Col_degree = Numeric->Cperm ;
    Row_tlen = Numeric->Uilen ;
    Col_tlen = Numeric->Lilen ;
    for (row = 0 ; row < n_row ; row++)
    {
 if ((Row_degree [row] >= 0))
 {
     Row_tlen [row] = 0 ;
 }
    }
    for (col = 0 ; col < n_col ; col++)
    {
 if ((Col_degree [col] >= 0))
 {
     Col_tlen [col] = 0 ;
 }
    }
    nsize = (double) needunits + 2 ;
    needunits += umfdl_tuple_lengths (Numeric, Work, &tsize) ;
    nsize += tsize ;
    needunits += 2 ;
    ;
    minsize = Numeric->size + needunits ;
    nsize += (double) Numeric->size ;
    bsize = ((double) 0x7fffffffffffffffL) / sizeof (Unit) - 1 ;
    newsize = (long) ((1.2) * ((double) minsize)) ;
    nsize *= (1.2) ;
    nsize += 1 ;
    if (newsize < 0 || nsize > bsize)
    {
 ;
 newsize = (long) bsize ;
    }
    else
    {
 ;
 newsize = (((newsize) > (minsize)) ? (newsize) : (minsize)) ;
    }
    newsize = (((newsize) > (Numeric->size)) ? (newsize) : (Numeric->size)) ;
    ;
    Numeric->ibig = (-1) ;
    ;
    mnew = (union Unit_union *) ((void *)0) ;
    while (!mnew)
    {
 mnew = (union Unit_union *) umf_l_realloc (Numeric->Memory, newsize, sizeof (Unit)) ;
 if (!mnew)
 {
     if (newsize == minsize)
     {
  mnew = Numeric->Memory ;
  newsize = Numeric->size ;
     }
     else
     {
  newsize = (long) ((0.95) * ((double) newsize)) ;
  newsize = (((minsize) > (newsize)) ? (minsize) : (newsize)) ;
     }
 }
    }
    ;
    costly = (mnew != Numeric->Memory) ;
    Numeric->Memory = mnew ;
    if (Work->E [0])
    {
 long nb; long dr; long dc;
 nb = Work->nb ;
 dr = Work->fnr_curr ;
 dc = Work->fnc_curr ;
 Work->Flublock = (double *) (Numeric->Memory + Work->E [0]) ;
 Work->Flblock = Work->Flublock + nb * nb ;
 Work->Fublock = Work->Flblock + dr * nb ;
 Work->Fcblock = Work->Fublock + nb * dc ;
 ;
    }
    ;
    newmem = newsize - Numeric->size ;
    ;
    if (newmem >= 2)
    {
 p = Numeric->Memory + Numeric->size - 2 ;
 p->header.size = newmem - 1 ;
 i = Numeric->size - 1 ;
 p += newmem ;
 p->header.prevsize = newmem - 1 ;
 p->header.size = 1 ;
 Numeric->size = newsize ;
 umfdl_mem_free_tail_block (Numeric, i) ;
 Numeric->nrealloc++ ;
 if (costly)
 {
     Numeric->ncostly++ ;
 }
    }
    ;
    umfdl_garbage_collection (Numeric, Work, r2, c2, do_Fcpos) ;
    return (umfdl_build_tuples (Numeric, Work)) ;
}

variable_types: struct NumericType { double flops; long scale; long valid; union Unit_union { struct { long size; } header; double xxxxxx; } *Memory; long ihead; long *Rperm; long ulen; double *D; long do_recip; double *Rs; long n_row; long tail_usage; long maxnrows; } *

variable_types: struct WorkType { long *E; double *Wx; long *Wp; long *Lpattern; long *Diagonal_map; long n_row; long *Front_new1strow; long Pivrow[64]; double *Flublock; long *Frows; } *

variable_types: needunits long

variable_types: nsize double

variable_types: bsize double

variable_types: tsize double

variable_types: i long

variable_types: minsize long

variable_types: newsize long

variable_types: newmem long

variable_types: costly long

variable_types: row long

variable_types: col long

return_type: long

user_defined_types: struct NumericType { double flops; long scale; long valid; union Unit_union *Memory; long ihead; long *Rperm; long ulen; double *D; long do_recip; double *Rs; long n_row; long tail_usage; long maxnrows; }


original_code:
double
umfzi_ltsolve
(
    NumericType *Numeric,
    DoubleComplex X [ ],
    int Pattern [ ]
)
{
    DoubleComplex xk ;
    DoubleComplex *xp, *Lval ;
    int k, deg, *ip, j, row, *Lpos, *Lilen, kstart, kend, *Lip, llen,
 lp, pos, npiv, n1, *Li ;
    if (Numeric->n_row != Numeric->n_col) return (0.) ;
    npiv = Numeric->npiv ;
    Lpos = Numeric->Lpos ;
    Lilen = Numeric->Lilen ;
    Lip = Numeric->Lip ;
    kstart = npiv ;
    n1 = Numeric->n1 ;
    for (kend = npiv-1 ; kend >= n1 ; kend = kstart-1)
    {
 kstart = kend ;
 while (kstart >= 0 && Lip [kstart] > 0)
 {
     kstart-- ;
 }
 deg = 0 ;
 ;
 for (k = kstart ; k <= kend ; k++)
 {
     ;
     pos = Lpos [k] ;
     if (pos != (-1))
     {
  ;
  ;
  ;
  ;
  ;
  Pattern [pos] = Pattern [--deg] ;
     }
     lp = Lip [k] ;
     if (k == kstart)
     {
  lp = -lp ;
     }
     ;
     ip = (int *) (Numeric->Memory + lp) ;
     llen = Lilen [k] ;
     for (j = 0 ; j < llen ; j++)
     {
  row = *ip++ ;
  ;
  ;
  Pattern [deg++] = row ;
     }
 }
 ;
 for (k = kend ; k >= kstart ; k--)
 {
     ;
     lp = Lip [k] ;
     if (k == kstart)
     {
  lp = -lp ;
     }
     ;
     llen = Lilen [k] ;
     xp = (DoubleComplex *) (Numeric->Memory + lp + (((((sizeof (int) * (llen))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
     xk = X [k] ;
     for (j = 0 ; j < deg ; j++)
     {
  ;
  ;
  ;
  { ; (xk).component [0] -= (X [Pattern [j]]).component [0] * (*xp).component [0] - (X [Pattern [j]]).component [1] * (*xp).component [1] ; (xk).component [1] -= (X [Pattern [j]]).component [1] * (*xp).component [0] + (X [Pattern [j]]).component [0] * (*xp).component [1] ; } ;
  xp++ ;
     }
     X [k] = xk ;
     deg -= llen ;
     pos = Lpos [k] ;
     if (pos != (-1))
     {
  ;
  ;
  ;
  Pattern [deg++] = Pattern [pos] ;
  Pattern [pos] = k ;
     }
 }
    }
    for (k = n1 - 1 ; k >= 0 ; k--)
    {
 ;
 deg = Lilen [k] ;
 if (deg > 0)
 {
     xk = X [k] ;
     lp = Lip [k] ;
     Li = (int *) (Numeric->Memory + lp) ;
     lp += (((((sizeof (int) * (deg))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     Lval = (DoubleComplex *) (Numeric->Memory + lp) ;
     for (j = 0 ; j < deg ; j++)
     {
  ;
  ;
  ;
  { ; (xk).component [0] -= (X [Li [j]]).component [0] * (Lval [j]).component [0] - (X [Li [j]]).component [1] * (Lval [j]).component [1] ; (xk).component [1] -= (X [Li [j]]).component [1] * (Lval [j]).component [0] + (X [Li [j]]).component [0] * (Lval [j]).component [1] ; } ;
     }
     X [k] = xk ;
 }
    }
    return (8. * ((double) Numeric->lnz)) ;
}

canonical_original_code:
double umfzi_ltsolve(struct NumericType *Numeric, struct DoubleComplex X[], int Pattern[])
{
    struct DoubleComplex xk;
    struct DoubleComplex *xp; struct DoubleComplex *Lval;
    int k; int deg; int *ip; int j; int row; int *Lpos; int *Lilen; int kstart; int kend; int *Lip; int llen; int lp; int pos; int npiv; int n1; int *Li;
    if (Numeric->n_row != Numeric->n_col) return (0.) ;
    npiv = Numeric->npiv ;
    Lpos = Numeric->Lpos ;
    Lilen = Numeric->Lilen ;
    Lip = Numeric->Lip ;
    kstart = npiv ;
    n1 = Numeric->n1 ;
    for (kend = npiv-1 ; kend >= n1 ; kend = kstart-1)
    {
 kstart = kend ;
 while (kstart >= 0 && Lip [kstart] > 0)
 {
     kstart-- ;
 }
 deg = 0 ;
 ;
 for (k = kstart ; k <= kend ; k++)
 {
     ;
     pos = Lpos [k] ;
     if (pos != (-1))
     {
  ;
  ;
  ;
  ;
  ;
  Pattern [pos] = Pattern [--deg] ;
     }
     lp = Lip [k] ;
     if (k == kstart)
     {
  lp = -lp ;
     }
     ;
     ip = (int *) (Numeric->Memory + lp) ;
     llen = Lilen [k] ;
     for (j = 0 ; j < llen ; j++)
     {
  row = *ip++ ;
  ;
  ;
  Pattern [deg++] = row ;
     }
 }
 ;
 for (k = kend ; k >= kstart ; k--)
 {
     ;
     lp = Lip [k] ;
     if (k == kstart)
     {
  lp = -lp ;
     }
     ;
     llen = Lilen [k] ;
     xp = (struct DoubleComplex *) (Numeric->Memory + lp + (((((sizeof (int) * (llen))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
     xk = X [k] ;
     for (j = 0 ; j < deg ; j++)
     {
  ;
  ;
  ;
  { ; (xk).component [0] -= (X [Pattern [j]]).component [0] * (*xp).component [0] - (X [Pattern [j]]).component [1] * (*xp).component [1] ; (xk).component [1] -= (X [Pattern [j]]).component [1] * (*xp).component [0] + (X [Pattern [j]]).component [0] * (*xp).component [1] ; } ;
  xp++ ;
     }
     X [k] = xk ;
     deg -= llen ;
     pos = Lpos [k] ;
     if (pos != (-1))
     {
  ;
  ;
  ;
  Pattern [deg++] = Pattern [pos] ;
  Pattern [pos] = k ;
     }
 }
    }
    for (k = n1 - 1 ; k >= 0 ; k--)
    {
 ;
 deg = Lilen [k] ;
 if (deg > 0)
 {
     xk = X [k] ;
     lp = Lip [k] ;
     Li = (int *) (Numeric->Memory + lp) ;
     lp += (((((sizeof (int) * (deg))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     Lval = (struct DoubleComplex *) (Numeric->Memory + lp) ;
     for (j = 0 ; j < deg ; j++)
     {
  ;
  ;
  ;
  { ; (xk).component [0] -= (X [Li [j]]).component [0] * (Lval [j]).component [0] - (X [Li [j]]).component [1] * (Lval [j]).component [1] ; (xk).component [1] -= (X [Li [j]]).component [1] * (Lval [j]).component [0] + (X [Li [j]]).component [0] * (Lval [j]).component [1] ; } ;
     }
     X [k] = xk ;
 }
    }
    return (8. * ((double) Numeric->lnz)) ;
}

variable_types: struct NumericType { double flops; int scale; int valid; union Unit_union { struct { int size; } header; double xxxxxx; } *Memory; int ihead; int *Rperm; int ulen; struct DoubleComplex { double component[2]; } *D; int do_recip; double *Rs; int n_row; int tail_usage; int maxnrows; } *

variable_types:
X
struct DoubleComplex []

variable_types:
Pattern
int []

variable_types: k int

variable_types: deg int

variable_types:
ip
int *

variable_types: j int

variable_types: row int

variable_types:
Lpos
int *

variable_types:
Lilen
int *

variable_types: kstart int

variable_types: kend int

variable_types:
Lip
int *

variable_types: llen int

variable_types: lp int

variable_types: pos int

variable_types: npiv int

variable_types:
Li
int *

return_type: double

user_defined_types: struct NumericType { double flops; int scale; int valid; union Unit_union *Memory; int ihead; int *Rperm; int ulen; struct DoubleComplex *D; int do_recip; double *Rs; int n_row; int tail_usage; int maxnrows; }


original_code:
int umfdi_tuple_lengths
(
    NumericType *Numeric,
    WorkType *Work,
    double *p_dusage
)
{
    double dusage ;
    int e, nrows, ncols, nel, i, *Rows, *Cols, row, col, n_row, n_col, *E,
 *Row_degree, *Row_tlen, *Col_degree, *Col_tlen, usage, n1 ;
    Element *ep ;
    Unit *p ;
    E = Work->E ;
    Row_degree = Numeric->Rperm ;
    Col_degree = Numeric->Cperm ;
    Row_tlen = Numeric->Uilen ;
    Col_tlen = Numeric->Lilen ;
    n_row = Work->n_row ;
    n_col = Work->n_col ;
    n1 = Work->n1 ;
    nel = Work->nel ;
    ;
    ;
    for (e = 1 ; e <= nel ; e++)
    {
 if (E [e])
 {
     p = Numeric->Memory + E [e] ;
     { { ; ; ; ep = (Element *) p ; p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ; Cols = (int *) p ; } ; ncols = ep->ncols ; Rows = Cols + ncols ; } ;
     nrows = ep->nrows ;
     for (i = 0 ; i < nrows ; i++)
     {
  row = Rows [i] ;
  ;
  if (row >= n1)
  {
      ;
      Row_tlen [row] ++ ;
  }
     }
     for (i = 0 ; i < ncols ; i++)
     {
  col = Cols [i] ;
  ;
  if (col >= n1)
  {
      ;
      Col_tlen [col] ++ ;
  }
     }
 }
    }
    ;
    usage = 0 ;
    dusage = 0 ;
    ;
    for (col = n1 ; col < n_col ; col++)
    {
 if ((Col_degree [col] >= 0))
 {
     usage += 1 + (((((sizeof (Tuple) * ((((4) > ((Col_tlen [col]) + 1)) ? (4) : ((Col_tlen [col]) + 1))))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     dusage += 1 + (ceil ((sizeof (Tuple) * ((double) (((4) > ((Col_tlen [col]) + 1)) ? (4) : ((Col_tlen [col]) + 1)))) / sizeof (Unit))) ;
     ;
 }
    }
    ;
    for (row = n1 ; row < n_row ; row++)
    {
 if ((Row_degree [row] >= 0))
 {
     usage += 1 + (((((sizeof (Tuple) * ((((4) > ((Row_tlen [row]) + 1)) ? (4) : ((Row_tlen [row]) + 1))))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     dusage += 1 + (ceil ((sizeof (Tuple) * ((double) (((4) > ((Row_tlen [row]) + 1)) ? (4) : ((Row_tlen [row]) + 1)))) / sizeof (Unit))) ;
     ;
 }
    }
    ;
    *p_dusage = dusage ;
    return (usage) ;
}

canonical_original_code:
int umfdi_tuple_lengths(struct NumericType *Numeric, struct WorkType *Work, double *p_dusage)
{
    double dusage;
    int e; int nrows; int ncols; int nel; int i; int *Rows; int *Cols; int row; int col; int n_row; int n_col; int *E; int *Row_degree; int *Row_tlen; int *Col_degree; int *Col_tlen; int usage; int n1;
    struct Element *ep;
    union Unit_union *p;
    E = Work->E ;
    Row_degree = Numeric->Rperm ;
    Col_degree = Numeric->Cperm ;
    Row_tlen = Numeric->Uilen ;
    Col_tlen = Numeric->Lilen ;
    n_row = Work->n_row ;
    n_col = Work->n_col ;
    n1 = Work->n1 ;
    nel = Work->nel ;
    ;
    ;
    for (e = 1 ; e <= nel ; e++)
    {
 if (E [e])
 {
     p = Numeric->Memory + E [e] ;
     { { ; ; ; ep = (struct Element *) p ; p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ; Cols = (int *) p ; } ; ncols = ep->ncols ; Rows = Cols + ncols ; } ;
     nrows = ep->nrows ;
     for (i = 0 ; i < nrows ; i++)
     {
  row = Rows [i] ;
  ;
  if (row >= n1)
  {
      ;
      Row_tlen [row] ++ ;
  }
     }
     for (i = 0 ; i < ncols ; i++)
     {
  col = Cols [i] ;
  ;
  if (col >= n1)
  {
      ;
      Col_tlen [col] ++ ;
  }
     }
 }
    }
    ;
    usage = 0 ;
    dusage = 0 ;
    ;
    for (col = n1 ; col < n_col ; col++)
    {
 if ((Col_degree [col] >= 0))
 {
     usage += 1 + (((((sizeof (Tuple) * ((((4) > ((Col_tlen [col]) + 1)) ? (4) : ((Col_tlen [col]) + 1))))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     dusage += 1 + (ceil ((sizeof (Tuple) * ((double) (((4) > ((Col_tlen [col]) + 1)) ? (4) : ((Col_tlen [col]) + 1)))) / sizeof (Unit))) ;
     ;
 }
    }
    ;
    for (row = n1 ; row < n_row ; row++)
    {
 if ((Row_degree [row] >= 0))
 {
     usage += 1 + (((((sizeof (Tuple) * ((((4) > ((Row_tlen [row]) + 1)) ? (4) : ((Row_tlen [row]) + 1))))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     dusage += 1 + (ceil ((sizeof (Tuple) * ((double) (((4) > ((Row_tlen [row]) + 1)) ? (4) : ((Row_tlen [row]) + 1)))) / sizeof (Unit))) ;
     ;
 }
    }
    ;
    *p_dusage = dusage ;
    return (usage) ;
}

variable_types: struct NumericType { double flops; int scale; int valid; union Unit_union { struct { int size; } header; double xxxxxx; } *Memory; int ihead; int *Rperm; int ulen; double *D; int do_recip; double *Rs; int n_row; int tail_usage; int maxnrows; } *

variable_types: struct WorkType { int *E; double *Wx; int *Wp; int *Lpattern; int *Diagonal_map; int n_row; int *Front_new1strow; int Pivrow[64]; double *Flublock; int *Frows; } *

variable_types: dusage double

variable_types: e int

variable_types: nrows int

variable_types: ncols int

variable_types: nel int

variable_types: i int

variable_types:
Rows
int *

variable_types:
Cols
int *

variable_types: col int

variable_types:
E
int *

variable_types: usage int

variable_types:
ep
struct Element { int cdeg; } *

user_defined_types: struct NumericType { double flops; int scale; int valid; union Unit_union *Memory; int ihead; int *Rperm; int ulen; double *D; int do_recip; double *Rs; int n_row; int tail_usage; int maxnrows; }


original_code:
int umfzi_triplet_nomap_nox
(
    int n_row,
    int n_col,
    int nz,
    const int Ti [ ],
    const int Tj [ ],
    int Ap [ ],
    int Ai [ ],
    int Rp [ ],
    int Rj [ ],
    int W [ ],
    int RowCount [ ]
)
{
    int i, j, k, p, cp, p1, p2, pdest, pj ;
    for (i = 0 ; i < n_row ; i++)
    {
 W [i] = 0 ;
    }
    for (k = 0 ; k < nz ; k++)
    {
 i = Ti [k] ;
 j = Tj [k] ;
 if (i < 0 || i >= n_row || j < 0 || j >= n_col)
 {
     return ((-8)) ;
 }
 W [i]++ ;
    }
    Rp [0] = 0 ;
    for (i = 0 ; i < n_row ; i++)
    {
 Rp [i+1] = Rp [i] + W [i] ;
 W [i] = Rp [i] ;
    }
    for (k = 0 ; k < nz ; k++)
    {
 p = W [Ti [k]]++ ;
 Rj [p] = Tj [k] ;
    }
    for (j = 0 ; j < n_col ; j++)
    {
 W [j] = (-1) ;
    }
    for (i = 0 ; i < n_row ; i++)
    {
 p1 = Rp [i] ;
 p2 = Rp [i+1] ;
 pdest = p1 ;
 for (p = p1 ; p < p2 ; p++)
 {
     j = Rj [p] ;
     ;
     pj = W [j] ;
     if (pj >= p1)
     {
  ;
  ;
     }
     else
     {
  W [j] = pdest ;
  if (pdest != p)
  {
      Rj [pdest] = j ;
  }
  pdest++ ;
     }
 }
 RowCount [i] = pdest - p1 ;
    }
    for (j = 0 ; j < n_col ; j++)
    {
 W [j] = 0 ;
    }
    for (i = 0 ; i < n_row ; i++)
    {
 for (p = Rp [i] ; p < Rp [i] + RowCount [i] ; p++)
 {
     j = Rj [p] ;
     ;
     W [j]++ ;
 }
    }
    Ap [0] = 0 ;
    for (j = 0 ; j < n_col ; j++)
    {
 Ap [j+1] = Ap [j] + W [j] ;
    }
    for (j = 0 ; j < n_col ; j++)
    {
 W [j] = Ap [j] ;
    }
    for (i = 0 ; i < n_row ; i++)
    {
 for (p = Rp [i] ; p < Rp [i] + RowCount [i] ; p++)
 {
     cp = W [Rj [p]]++ ;
     Ai [cp] = i ;
 }
    }
    return ((0)) ;
}

canonical_original_code:
int umfzi_triplet_nomap_nox(int n_row, int n_col, int nz, int Ti[], int Tj[], int Ap[], int Ai[], int Rp[], int Rj[], int W[], int RowCount[])
{
    int i; int j; int k; int p; int cp; int p1; int p2; int pdest; int pj;
    for (i = 0 ; i < n_row ; i++)
    {
 W [i] = 0 ;
    }
    for (k = 0 ; k < nz ; k++)
    {
 i = Ti [k] ;
 j = Tj [k] ;
 if (i < 0 || i >= n_row || j < 0 || j >= n_col)
 {
     return ((-8)) ;
 }
 W [i]++ ;
    }
    Rp [0] = 0 ;
    for (i = 0 ; i < n_row ; i++)
    {
 Rp [i+1] = Rp [i] + W [i] ;
 W [i] = Rp [i] ;
    }
    for (k = 0 ; k < nz ; k++)
    {
 p = W [Ti [k]]++ ;
 Rj [p] = Tj [k] ;
    }
    for (j = 0 ; j < n_col ; j++)
    {
 W [j] = (-1) ;
    }
    for (i = 0 ; i < n_row ; i++)
    {
 p1 = Rp [i] ;
 p2 = Rp [i+1] ;
 pdest = p1 ;
 for (p = p1 ; p < p2 ; p++)
 {
     j = Rj [p] ;
     ;
     pj = W [j] ;
     if (pj >= p1)
     {
  ;
  ;
     }
     else
     {
  W [j] = pdest ;
  if (pdest != p)
  {
      Rj [pdest] = j ;
  }
  pdest++ ;
     }
 }
 RowCount [i] = pdest - p1 ;
    }
    for (j = 0 ; j < n_col ; j++)
    {
 W [j] = 0 ;
    }
    for (i = 0 ; i < n_row ; i++)
    {
 for (p = Rp [i] ; p < Rp [i] + RowCount [i] ; p++)
 {
     j = Rj [p] ;
     ;
     W [j]++ ;
 }
    }
    Ap [0] = 0 ;
    for (j = 0 ; j < n_col ; j++)
    {
 Ap [j+1] = Ap [j] + W [j] ;
    }
    for (j = 0 ; j < n_col ; j++)
    {
 W [j] = Ap [j] ;
    }
    for (i = 0 ; i < n_row ; i++)
    {
 for (p = Rp [i] ; p < Rp [i] + RowCount [i] ; p++)
 {
     cp = W [Rj [p]]++ ;
     Ai [cp] = i ;
 }
    }
    return ((0)) ;
}

variable_types: nz int

variable_types:
Ti
int []

variable_types:
Tj
int []

variable_types:
Ap
int []

variable_types:
Ai
int []

variable_types:
Rp
int []

variable_types:
Rj
int []

variable_types:
W
int []

variable_types:
RowCount
int []

variable_types: j int

variable_types: k int

variable_types: p int

variable_types: cp int

variable_types: pdest int

variable_types: pj int


original_code:
int umfzi_build_tuples
(
    NumericType *Numeric,
    WorkType *Work
)
{
    int e, nrows, ncols, nel, *Rows, *Cols, row, col, n_row, n_col, *E,
 *Row_tuples, *Row_degree, *Row_tlen,
 *Col_tuples, *Col_degree, *Col_tlen, n1 ;
    Element *ep ;
    Unit *p ;
    Tuple tuple, *tp ;
    E = Work->E ;
    Col_degree = Numeric->Cperm ;
    Row_degree = Numeric->Rperm ;
    Row_tuples = Numeric->Uip ;
    Row_tlen = Numeric->Uilen ;
    Col_tuples = Numeric->Lip ;
    Col_tlen = Numeric->Lilen ;
    n_row = Work->n_row ;
    n_col = Work->n_col ;
    nel = Work->nel ;
    n1 = Work->n1 ;
    ;
    for (row = n1 ; row < n_row ; row++)
    {
 if ((Row_degree [row] >= 0))
 {
     Row_tuples [row] = umfzi_mem_alloc_tail_block (Numeric,
  (((((sizeof (Tuple) * ((((4) > ((Row_tlen [row]) + 1)) ? (4) : ((Row_tlen [row]) + 1))))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
     if (!Row_tuples [row])
     {
  ;
  return ((0)) ;
     }
     Row_tlen [row] = 0 ;
 }
    }
    for (col = n_col-1 ; col >= n1 ; col--)
    {
 if ((Col_degree [col] >= 0))
 {
     Col_tuples [col] = umfzi_mem_alloc_tail_block (Numeric,
  (((((sizeof (Tuple) * ((((4) > ((Col_tlen [col]) + 1)) ? (4) : ((Col_tlen [col]) + 1))))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
     if (!Col_tuples [col])
     {
  ;
  return ((0)) ;
     }
     Col_tlen [col] = 0 ;
 }
    }
    for (e = 1 ; e <= nel ; e++)
    {
 ;
 ;
 p = Numeric->Memory + E [e] ;
 { { ; ; ; ep = (Element *) p ; p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ; Cols = (int *) p ; } ; ncols = ep->ncols ; Rows = Cols + ncols ; } ;
 nrows = ep->nrows ;
 ;
 ;
 ;
 tuple.e = e ;
 for (tuple.f = 0 ; tuple.f < ncols ; tuple.f++)
 {
     col = Cols [tuple.f] ;
     ;
     ;
     ;
     tp = ((Tuple *) (Numeric->Memory + Col_tuples [col]))
  + Col_tlen [col]++ ;
     *tp = tuple ;
 }
 for (tuple.f = 0 ; tuple.f < nrows ; tuple.f++)
 {
     row = Rows [tuple.f] ;
     ;
     ;
     ;
     tp = ((Tuple *) (Numeric->Memory + Row_tuples [row]))
  + Row_tlen [row]++ ;
     *tp = tuple ;
 }
    }
    ;
    return ((1)) ;
}

canonical_original_code:
int umfzi_build_tuples(struct NumericType *Numeric, struct WorkType *Work)
{
    int e; int nrows; int ncols; int nel; int *Rows; int *Cols; int row; int col; int n_row; int n_col; int *E; int *Row_tuples; int *Row_degree; int *Row_tlen; int *Col_tuples; int *Col_degree; int *Col_tlen; int n1;
    struct Element *ep;
    union Unit_union *p;
    struct Tuple tuple; struct Tuple *tp;
    E = Work->E ;
    Col_degree = Numeric->Cperm ;
    Row_degree = Numeric->Rperm ;
    Row_tuples = Numeric->Uip ;
    Row_tlen = Numeric->Uilen ;
    Col_tuples = Numeric->Lip ;
    Col_tlen = Numeric->Lilen ;
    n_row = Work->n_row ;
    n_col = Work->n_col ;
    nel = Work->nel ;
    n1 = Work->n1 ;
    ;
    for (row = n1 ; row < n_row ; row++)
    {
 if ((Row_degree [row] >= 0))
 {
     Row_tuples [row] = umfzi_mem_alloc_tail_block (Numeric,
  (((((sizeof (Tuple) * ((((4) > ((Row_tlen [row]) + 1)) ? (4) : ((Row_tlen [row]) + 1))))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
     if (!Row_tuples [row])
     {
  ;
  return ((0)) ;
     }
     Row_tlen [row] = 0 ;
 }
    }
    for (col = n_col-1 ; col >= n1 ; col--)
    {
 if ((Col_degree [col] >= 0))
 {
     Col_tuples [col] = umfzi_mem_alloc_tail_block (Numeric,
  (((((sizeof (Tuple) * ((((4) > ((Col_tlen [col]) + 1)) ? (4) : ((Col_tlen [col]) + 1))))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
     if (!Col_tuples [col])
     {
  ;
  return ((0)) ;
     }
     Col_tlen [col] = 0 ;
 }
    }
    for (e = 1 ; e <= nel ; e++)
    {
 ;
 ;
 p = Numeric->Memory + E [e] ;
 { { ; ; ; ep = (struct Element *) p ; p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ; Cols = (int *) p ; } ; ncols = ep->ncols ; Rows = Cols + ncols ; } ;
 nrows = ep->nrows ;
 ;
 ;
 ;
 tuple.e = e ;
 for (tuple.f = 0 ; tuple.f < ncols ; tuple.f++)
 {
     col = Cols [tuple.f] ;
     ;
     ;
     ;
     tp = ((struct Tuple *) (Numeric->Memory + Col_tuples [col]))
  + Col_tlen [col]++ ;
     *tp = tuple ;
 }
 for (tuple.f = 0 ; tuple.f < nrows ; tuple.f++)
 {
     row = Rows [tuple.f] ;
     ;
     ;
     ;
     tp = ((struct Tuple *) (Numeric->Memory + Row_tuples [row]))
  + Row_tlen [row]++ ;
     *tp = tuple ;
 }
    }
    ;
    return ((1)) ;
}

variable_types: struct NumericType { double flops; int scale; int valid; union Unit_union { struct { int size; } header; double xxxxxx; } *Memory; int ihead; int *Rperm; int ulen; struct DoubleComplex { double component[2]; } *D; int do_recip; double *Rs; int n_row; int tail_usage; int maxnrows; } *

variable_types: struct WorkType { int *E; struct DoubleComplex *Wx; int *Wp; int *Lpattern; int *Diagonal_map; int n_row; int *Front_new1strow; int Pivrow[64]; struct DoubleComplex *Flublock; int *Frows; } *

variable_types: e int

variable_types: nrows int

variable_types: ncols int

variable_types: nel int

variable_types:
Rows
int *

variable_types:
Cols
int *

variable_types: row int

variable_types: col int

variable_types:
E
int *

variable_types:
tuple
struct Tuple { int e; }

variable_types:
tp
struct Tuple { int e; } *


original_code:
int cholmod_symmetry
(
    cholmod_sparse *A,
    int option,
    int *p_xmatched,
    int *p_pmatched,
    int *p_nzoffdiag,
    int *p_nzdiag,
    cholmod_common *Common
)
{
    double aij_real = 0, aij_imag = 0, aji_real = 0, aji_imag = 0 ;
    double *Ax, *Az ;
    int *Ap, *Ai, *Anz, *munch ;
    int packed, nrow, ncol, xtype, is_symmetric, is_skew, is_hermitian, posdiag,
 j, p, pend, i, piend, result, xmatched, pmatched, nzdiag, i2, found ;
    { if (Common == ((void *)0)) { return ((-1)) ; } if (Common->itype != 0 || Common->dtype != 0) { Common->status = (-4) ; return ((-1)) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_symmetry.c", 202, "argument missing", Common) ; } return ((-1)) ; } } ;
    { if ((A)->xtype < (0) || (A)->xtype > (3) || ((A)->xtype != 0 && ((A)->x) == ((void *)0)) || ((A)->xtype == 3 && ((A)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_symmetry.c", 203, "invalid xtype", Common) ; } return ((-1)) ; } } ;
    Common->status = 0 ;
    ;
    if (p_xmatched == ((void *)0) || p_pmatched == ((void *)0)
 || p_nzoffdiag == ((void *)0) || p_nzdiag == ((void *)0))
    {
 option = (((option) > (1)) ? (option) : (1)) ;
    }
    Ap = A->p ;
    Ai = A->i ;
    Ax = A->x ;
    Az = A->z ;
    Anz = A->nz ;
    packed = A->packed ;
    ncol = A->ncol ;
    nrow = A->nrow ;
    xtype = A->xtype ;
    if (nrow != ncol)
    {
 return (1) ;
    }
    if (!(A->sorted) || A->stype != 0)
    {
 return ((-1)) ;
    }
    cholmod_allocate_work (0, ncol, 0, Common) ;
    if (Common->status < 0)
    {
 return ((-1)) ;
    }
    munch = Common->Iwork ;
    is_hermitian = (xtype >= 2) ;
    is_symmetric = 1 ;
    is_skew = (xtype != 0) ;
    posdiag = 1 ;
    for (j = 0 ; j < ncol ; j++)
    {
 munch [j] = Ap [j] ;
    }
    xmatched = 0 ;
    pmatched = 0 ;
    nzdiag = 0 ;
    for (j = 0 ; j < ncol ; j++)
    {
 p = munch [j] ;
 pend = (packed) ? (Ap [j+1]) : (Ap [j] + Anz [j]) ;
 for ( ; p < pend ; p++)
 {
     i = Ai [p] ;
     if (i < j)
     {
  is_hermitian = 0 ;
  is_symmetric = 0 ;
  is_skew = 0 ;
     }
     else if (i == j)
     {
  get_value (Ax, Az, p, xtype, &aij_real, &aij_imag) ;
  if (aij_real != 0. || aij_imag != 0.)
  {
      nzdiag++ ;
      is_skew = 0 ;
  }
  if (aij_real <= 0. || aij_imag != 0.)
  {
      posdiag = 0 ;
  }
  if (aij_imag != 0.)
  {
      is_hermitian = 0 ;
  }
     }
     else
     {
  piend = (packed) ? (Ap [i+1]) : (Ap [i] + Anz [i]) ;
  found = 0 ;
  for ( ; munch [i] < piend ; munch [i]++)
  {
      i2 = Ai [munch [i]] ;
      if (i2 < j)
      {
   is_hermitian = 0 ;
   is_symmetric = 0 ;
   is_skew = 0 ;
      }
      else if (i2 == j)
      {
   pmatched += 2 ;
   found = 1 ;
   get_value (Ax, Az, p, xtype, &aij_real, &aij_imag) ;
   get_value (Ax, Az, munch [i],
       xtype, &aji_real, &aji_imag) ;
   if (aij_real != aji_real || aij_imag != aji_imag)
   {
       is_symmetric = 0 ;
   }
   if (aij_real != -aji_real || aij_imag != aji_imag)
   {
       is_skew = 0 ;
   }
   if (aij_real != aji_real || aij_imag != -aji_imag)
   {
       is_hermitian = 0 ;
   }
   else
   {
       xmatched += 2 ;
   }
      }
      else
      {
   break ;
      }
  }
  if (!found)
  {
      is_hermitian = 0 ;
      is_symmetric = 0 ;
      is_skew = 0 ;
  }
     }
     if (option < 2 && !(is_symmetric || is_skew || is_hermitian))
     {
  return (2) ;
     }
 }
 if (option < 1 && (!posdiag || nzdiag < ncol))
 {
     return (2) ;
 }
    }
    if (nzdiag < ncol)
    {
        posdiag = 0 ;
    }
    if (option >= 2)
    {
 *p_xmatched = xmatched ;
 *p_pmatched = pmatched ;
 *p_nzoffdiag = cholmod_nnz (A, Common) - nzdiag ;
 *p_nzdiag = nzdiag ;
    }
    result = 2 ;
    if (is_hermitian)
    {
 result = posdiag ? 7 : 4 ;
    }
    else if (is_symmetric)
    {
 result = posdiag ? 6 : 3 ;
    }
    else if (is_skew)
    {
 result = 5 ;
    }
    return (result) ;
}

canonical_original_code:
int cholmod_symmetry(struct cholmod_sparse_struct *A, int option, int *p_xmatched, int *p_pmatched, int *p_nzoffdiag, int *p_nzdiag, struct cholmod_common_struct *Common)
{
    double aij_real = 0; double aij_imag = 0; double aji_real = 0; double aji_imag = 0;
    double *Ax; double *Az;
    int *Ap; int *Ai; int *Anz; int *munch;
    int packed; int nrow; int ncol; int xtype; int is_symmetric; int is_skew; int is_hermitian; int posdiag; int j; int p; int pend; int i; int piend; int result; int xmatched; int pmatched; int nzdiag; int i2; int found;
    { if (Common == ((void *)0)) { return ((-1)) ; } if (Common->itype != 0 || Common->dtype != 0) { Common->status = (-4) ; return ((-1)) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_symmetry.c", 202, "argument missing", Common) ; } return ((-1)) ; } } ;
    { if ((A)->xtype < (0) || (A)->xtype > (3) || ((A)->xtype != 0 && ((A)->x) == ((void *)0)) || ((A)->xtype == 3 && ((A)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_symmetry.c", 203, "invalid xtype", Common) ; } return ((-1)) ; } } ;
    Common->status = 0 ;
    ;
    if (p_xmatched == ((void *)0) || p_pmatched == ((void *)0)
 || p_nzoffdiag == ((void *)0) || p_nzdiag == ((void *)0))
    {
 option = (((option) > (1)) ? (option) : (1)) ;
    }
    Ap = A->p ;
    Ai = A->i ;
    Ax = A->x ;
    Az = A->z ;
    Anz = A->nz ;
    packed = A->packed ;
    ncol = A->ncol ;
    nrow = A->nrow ;
    xtype = A->xtype ;
    if (nrow != ncol)
    {
 return (1) ;
    }
    if (!(A->sorted) || A->stype != 0)
    {
 return ((-1)) ;
    }
    cholmod_allocate_work (0, ncol, 0, Common) ;
    if (Common->status < 0)
    {
 return ((-1)) ;
    }
    munch = Common->Iwork ;
    is_hermitian = (xtype >= 2) ;
    is_symmetric = 1 ;
    is_skew = (xtype != 0) ;
    posdiag = 1 ;
    for (j = 0 ; j < ncol ; j++)
    {
 munch [j] = Ap [j] ;
    }
    xmatched = 0 ;
    pmatched = 0 ;
    nzdiag = 0 ;
    for (j = 0 ; j < ncol ; j++)
    {
 p = munch [j] ;
 pend = (packed) ? (Ap [j+1]) : (Ap [j] + Anz [j]) ;
 for ( ; p < pend ; p++)
 {
     i = Ai [p] ;
     if (i < j)
     {
  is_hermitian = 0 ;
  is_symmetric = 0 ;
  is_skew = 0 ;
     }
     else if (i == j)
     {
  get_value (Ax, Az, p, xtype, &aij_real, &aij_imag) ;
  if (aij_real != 0. || aij_imag != 0.)
  {
      nzdiag++ ;
      is_skew = 0 ;
  }
  if (aij_real <= 0. || aij_imag != 0.)
  {
      posdiag = 0 ;
  }
  if (aij_imag != 0.)
  {
      is_hermitian = 0 ;
  }
     }
     else
     {
  piend = (packed) ? (Ap [i+1]) : (Ap [i] + Anz [i]) ;
  found = 0 ;
  for ( ; munch [i] < piend ; munch [i]++)
  {
      i2 = Ai [munch [i]] ;
      if (i2 < j)
      {
   is_hermitian = 0 ;
   is_symmetric = 0 ;
   is_skew = 0 ;
      }
      else if (i2 == j)
      {
   pmatched += 2 ;
   found = 1 ;
   get_value (Ax, Az, p, xtype, &aij_real, &aij_imag) ;
   get_value (Ax, Az, munch [i],
       xtype, &aji_real, &aji_imag) ;
   if (aij_real != aji_real || aij_imag != aji_imag)
   {
       is_symmetric = 0 ;
   }
   if (aij_real != -aji_real || aij_imag != aji_imag)
   {
       is_skew = 0 ;
   }
   if (aij_real != aji_real || aij_imag != -aji_imag)
   {
       is_hermitian = 0 ;
   }
   else
   {
       xmatched += 2 ;
   }
      }
      else
      {
   break ;
      }
  }
  if (!found)
  {
      is_hermitian = 0 ;
      is_symmetric = 0 ;
      is_skew = 0 ;
  }
     }
     if (option < 2 && !(is_symmetric || is_skew || is_hermitian))
     {
  return (2) ;
     }
 }
 if (option < 1 && (!posdiag || nzdiag < ncol))
 {
     return (2) ;
 }
    }
    if (nzdiag < ncol)
    {
        posdiag = 0 ;
    }
    if (option >= 2)
    {
 *p_xmatched = xmatched ;
 *p_pmatched = pmatched ;
 *p_nzoffdiag = cholmod_nnz (A, Common) - nzdiag ;
 *p_nzdiag = nzdiag ;
    }
    result = 2 ;
    if (is_hermitian)
    {
 result = posdiag ? 7 : 4 ;
    }
    else if (is_symmetric)
    {
 result = posdiag ? 6 : 3 ;
    }
    else if (is_skew)
    {
 result = 5 ;
    }
    return (result) ;
}

variable_types: struct cholmod_sparse_struct { unsigned long nrow; unsigned long ncol; unsigned long nzmax; void *p; void *i; void *nz; void *x; void *z; int stype; int itype; int xtype; int dtype; int sorted; int packed; } *

variable_types: option int

variable_types: struct cholmod_common_struct { double dbound; double grow0; double grow1; unsigned long grow2; unsigned long maxrank; double supernodal_switch; int supernodal; int final_asis; int final_super; int final_ll; int final_pack; int final_monotonic; int final_resymbol; double zrelax[3]; unsigned long nrelax[3]; int prefer_zomplex; int prefer_upper; int quick_return_if_not_posdef; int print; int precise; int (*print_function)(char *, ...); int try_catch; void (*error_handler)(int status, char *file, int line, char *message); int nmethods; int current; int selected; struct cholmod_method_struct { double lnz; double fl; double prune_dense; double prune_dense2; double nd_oksep; double other_1[4]; unsigned long nd_small; unsigned long other_2[4]; int aggressive; int order_for_lu; int nd_compress; int nd_camd; int nd_components; int ordering; unsigned long other_3[4]; } method[-1]; int postorder; void *(*malloc_memory)(unsigned long); void *(*realloc_memory)(void *, unsigned long); void (*free_memory)(void *); void *(*calloc_memory)(unsigned long, unsigned long); int (*complex_divide)(double ax, double az, double bx, double bz, double *cx, double *cz); double (*hypotenuse)(double x, double y); double metis_memory; double metis_dswitch; unsigned long metis_nswitch; unsigned long nrow; long mark; unsigned long iworksize; unsigned long xworksize; void *Flag; void *Head; void *Xwork; void *Iwork; int itype; int dtype; int no_workspace_reallocate; int status; double fl; double lnz; double anz; double modfl; unsigned long malloc_count; unsigned long memory_usage; unsigned long memory_inuse; double nrealloc_col; double nrealloc_factor; double ndbounds_hit; double rowfacfl; double aatfl; double other1[10]; double SPQR_xstat[4]; double SPQR_grain; double SPQR_small; long SPQR_istat[10]; long other2[6]; int other3[10]; int prefer_binary; int default_nesdis; int called_nd; int blas_ok; int SPQR_shrink; int SPQR_nthreads; unsigned long other4[16]; void *other5[16]; } *

variable_types:
Ax
double *

variable_types:
Az
double *

variable_types:
Ap
int *

variable_types:
Ai
int *

variable_types:
Anz
int *

variable_types:
munch
int *

variable_types: packed int

variable_types: nrow int

variable_types: ncol int

variable_types: xtype int

variable_types: posdiag int

variable_types: j int

variable_types: p int

variable_types: pend int

variable_types: i int

variable_types: piend int

variable_types: result int

variable_types: xmatched int

variable_types: pmatched int

variable_types: nzdiag int

variable_types: found int


decompiled_code:
__int64 __fastcall umf_l_is_permutation(__int64 a1, char *a2, __int64 a3, __int64 a4)
{
char *v5; // rdi
__int64 v8; // rdx
__int64 v9; // rax
char *v10; // rax

if ( !a1 )
return 1LL;
v5 = a2;
if ( a3 > 0 )
v5 = (char *)memset(a2, 0, 8 * a3);
if ( a4 <= 0 )
return 1LL;
v8 = 0LL;
while ( 1 )
{
v9 = *(_QWORD *)(a1 + 8 * v8);
if ( v9 < 0 )
break;
if ( a3 <= v9 )
break;
v10 = &v5[8 * v9];
if ( *(_QWORD *)v10 )
break;
++v8;
*(_QWORD *)v10 = 1LL;
if ( a4 == v8 )
return 1LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, char *a2, __int64 a3, __int64 a4)
{
char *v5; // rdi
__int64 v8; // rdx
__int64 v9; // rax
char *v10; // rax

if ( !a1 )
return 1LL;
v5 = a2;
if ( a3 > 0 )
v5 = (char *)memset(a2, 0, 8 * a3);
if ( a4 <= 0 )
return 1LL;
v8 = 0LL;
while ( 1 )
{
v9 = *(_QWORD *)(a1 + 8 * v8);
if ( v9 < 0 )
break;
if ( a3 <= v9 )
break;
v10 = &v5[8 * v9];
if ( *(_QWORD *)v10 )
break;
++v8;
*(_QWORD *)v10 = 1LL;
if ( a4 == v8 )
return 1LL;
}
return 0LL;
}

original_code:
long umf_l_is_permutation
(
    const long P [ ],
    long W [ ],
    long n,
    long r
)
{
    long i, k ;
    if (!P)
    {
 return ((1)) ;
    }
    ;
    for (i = 0 ; i < n ; i++)
    {
 W [i] = (0) ;
    }
    for (k = 0 ; k < r ; k++)
    {
 i = P [k] ;
 ;
 if (i < 0 || i >= n)
 {
     ;
     return ((0)) ;
 }
 if (W [i])
 {
     ;
     return ((0)) ;
 }
 W [i] = (1) ;
    }
    return ((1)) ;
}

canonical_original_code:
long umf_l_is_permutation(long P[], long W[], long n, long r)
{
    long i; long k;
    if (!P)
    {
 return ((1)) ;
    }
    ;
    for (i = 0 ; i < n ; i++)
    {
 W [i] = (0) ;
    }
    for (k = 0 ; k < r ; k++)
    {
 i = P [k] ;
 ;
 if (i < 0 || i >= n)
 {
     ;
     return ((0)) ;
 }
 if (W [i])
 {
     ;
     return ((0)) ;
 }
 W [i] = (1) ;
    }
    return ((1)) ;
}

variable_types:
P
long []

variable_types:
W
long []

variable_types: n long

variable_types: r long

variable_types: i long

variable_types: k long


original_code:
long umfzl_row_search
(
    NumericType *Numeric,
    WorkType *Work,
    SymbolicType *Symbolic,
    long cdeg0,
    long cdeg1,
    const long Pattern [ ],
    const long Pos [ ],
    long pivrow [2],
    long rdeg [2],
    long W_i [ ],
    long W_o [ ],
    long prior_pivrow [2],
    const DoubleComplex Wxy [ ],
    long pivcol,
    long freebie [ ]
)
{
    double maxval, toler, toler2, value, pivot [2] ;
    long i, row, deg, col, *Frpos, fnrows, *E, j, ncols, *Cols, *Rows,
 e, f, Wrpflag, *Fcpos, fncols, tpi, max_rdeg, nans_in_col, was_offdiag,
 diag_row, prefer_diagonal, *Wrp, found, *Diagonal_map ;
    Tuple *tp, *tpend, *tp1, *tp2 ;
    Unit *Memory, *p ;
    Element *ep ;
    long *Row_tuples, *Row_degree, *Row_tlen ;
    pivot [0] = 0. ;
    pivot [1] = 0. ;
    Row_degree = Numeric->Rperm ;
    Row_tuples = Numeric->Uip ;
    Row_tlen = Numeric->Uilen ;
    Wrp = Work->Wrp ;
    Frpos = Work->Frpos ;
    E = Work->E ;
    Memory = Numeric->Memory ;
    fnrows = Work->fnrows ;
    prefer_diagonal = Symbolic->prefer_diagonal ;
    Diagonal_map = Work->Diagonal_map ;
    if (Diagonal_map)
    {
 diag_row = Diagonal_map [pivcol] ;
 was_offdiag = diag_row < 0 ;
 if (was_offdiag)
 {
     diag_row = (-(diag_row)-2) ;
 }
 ;
    }
    else
    {
 diag_row = (-1) ;
 was_offdiag = (-1) ;
    }
    max_rdeg = Work->fncols_max ;
    maxval = 0.0 ;
    nans_in_col = (0) ;
    for (i = 0 ; i < cdeg1 ; i++)
    {
 { (value) = (((((Wxy [i]).component [0]) < 0.)) ? -((Wxy [i]).component [0]) : ((Wxy [i]).component [0])) + (((((Wxy [i]).component [1]) < 0.)) ? -((Wxy [i]).component [1]) : ((Wxy [i]).component [1])) ; } ;
 if (((value) != (value)))
 {
     nans_in_col = (1) ;
     maxval = value ;
     break ;
 }
 maxval = (((maxval) > (value)) ? (maxval) : (value)) ;
    }
    toler = Numeric->relpt * maxval ;
    toler2 = Numeric->relpt2 * maxval ;
    toler2 = was_offdiag ? toler : toler2 ;
    ;
    if (((toler) != (toler)) || ((toler2) != (toler2)))
    {
 nans_in_col = (1) ;
    }
    if (!nans_in_col)
    {
 found = (0) ;
 ;
 if (prefer_diagonal)
 {
     ;
     i = Pos [diag_row] ;
     if (i >= 0)
     {
  double a ;
  ;
  ;
  { (a) = (((((Wxy [i]).component [0]) < 0.)) ? -((Wxy [i]).component [0]) : ((Wxy [i]).component [0])) + (((((Wxy [i]).component [1]) < 0.)) ? -((Wxy [i]).component [1]) : ((Wxy [i]).component [1])) ; } ;
  ;
  ;
  if (((a) != 0.) && a >= toler2)
  {
      ;
      found = (1) ;
      if (Frpos [diag_row] >= 0 && Frpos [diag_row] < fnrows)
      {
   pivrow [0] = diag_row ;
   pivrow [1] = (-1) ;
      }
      else
      {
   pivrow [0] = (-1) ;
   pivrow [1] = diag_row ;
      }
  }
     }
 }
 if (!found)
 {
     if (cdeg0 > 0)
     {
  for (i = 0 ; i < cdeg0 ; i++)
  {
      double a ;
      { (a) = (((((Wxy [i]).component [0]) < 0.)) ? -((Wxy [i]).component [0]) : ((Wxy [i]).component [0])) + (((((Wxy [i]).component [1]) < 0.)) ? -((Wxy [i]).component [1]) : ((Wxy [i]).component [1])) ; } ;
      ;
      ;
      if (((a) != 0.) && a >= toler)
      {
   row = Pattern [i] ;
   deg = Row_degree [row] ;
   ;
   ;
   ;
   if (deg < rdeg [0]
          || (deg == rdeg [0] && a > pivot [0])
      )
   {
       pivrow [0] = row ;
       rdeg [0] = deg ;
       pivot [0] = a ;
   }
      }
  }
  for ( ; i < cdeg1 ; i++)
  {
      double a ;
      { (a) = (((((Wxy [i]).component [0]) < 0.)) ? -((Wxy [i]).component [0]) : ((Wxy [i]).component [0])) + (((((Wxy [i]).component [1]) < 0.)) ? -((Wxy [i]).component [1]) : ((Wxy [i]).component [1])) ; } ;
      ;
      ;
      if (((a) != 0.) && a >= toler)
      {
   row = Pattern [i] ;
   deg = Row_degree [row] ;
   ;
   ;
   if (deg < rdeg [1]
          || (deg == rdeg [1] && a > pivot [1])
      )
   {
       pivrow [1] = row ;
       rdeg [1] = deg ;
       pivot [1] = a ;
   }
      }
  }
     }
     else
     {
  for (i = 0 ; i < cdeg1 ; i++)
  {
      double a ;
      { (a) = (((((Wxy [i]).component [0]) < 0.)) ? -((Wxy [i]).component [0]) : ((Wxy [i]).component [0])) + (((((Wxy [i]).component [1]) < 0.)) ? -((Wxy [i]).component [1]) : ((Wxy [i]).component [1])) ; } ;
      ;
      ;
      if (((a) != 0.) && a >= toler)
      {
   row = Pattern [i] ;
   deg = Row_degree [row] ;
   if (Frpos [row] >= 0 && Frpos [row] < fnrows)
   {
       ;
       if (deg < rdeg [0]
          || (deg == rdeg [0] && a > pivot [0])
          )
       {
    pivrow [0] = row ;
    rdeg [0] = deg ;
    pivot [0] = a ;
       }
   }
   else
   {
       ;
       if (deg < rdeg [1]
          || (deg == rdeg[1] && a > pivot [1])
          )
       {
    pivrow [1] = row ;
    rdeg [1] = deg ;
    pivot [1] = a ;
       }
   }
      }
  }
     }
 }
    }
    if (cdeg1 > 0 && pivrow [0] == (-1) && pivrow [1] == (-1))
    {
 ;
 row = Pattern [0] ;
 deg = Row_degree [row] ;
 if (Frpos [row] >= 0 && Frpos [row] < fnrows)
 {
     ;
     pivrow [0] = row ;
     rdeg [0] = deg ;
 }
 else
 {
     ;
     pivrow [1] = row ;
     rdeg [1] = deg ;
 }
 for (i = 1 ; i < cdeg1 ; i++)
 {
     row = Pattern [i] ;
     deg = Row_degree [row] ;
     if (Frpos [row] >= 0 && Frpos [row] < fnrows)
     {
  ;
  if (deg < rdeg [0] || (deg == rdeg [0] && row == diag_row))
  {
      pivrow [0] = row ;
      rdeg [0] = deg ;
  }
     }
     else
     {
  ;
  if (deg < rdeg [1] || (deg == rdeg [1] && row == diag_row))
  {
      pivrow [1] = row ;
      rdeg [1] = deg ;
  }
     }
 }
    }
    ;
    ;
    if (cdeg1 == 0)
    {
 if (fnrows > 0)
 {
     pivrow [0] = Work->Frows [0] ;
     ;
 }
 else
 {
     long *Front_leftmostdesc, *Front_1strow, *Front_new1strow, row1,
  row2, fleftmost, nfr, n_row, frontid ;
     ;
     Front_leftmostdesc = Symbolic->Front_leftmostdesc ;
     Front_1strow = Symbolic->Front_1strow ;
     Front_new1strow = Work->Front_new1strow ;
     nfr = Symbolic->nfr ;
     n_row = Numeric->n_row ;
     frontid = Work->frontid ;
     ;
     fleftmost = Front_leftmostdesc [frontid] ;
     row1 = Front_new1strow [fleftmost] ;
     row2 = Front_1strow [frontid+1] - 1 ;
     ;
     for (row = row1 ; row <= row2 ; row++)
     {
  ;
  if ((Row_degree [row] >= 0))
  {
      ;
      ;
      pivrow [1] = row ;
      ;
      break ;
  }
     }
     Front_new1strow [fleftmost] = row ;
     if (pivrow [1] == (-1))
     {
  row1 = Front_new1strow [nfr] ;
  row2 = n_row-1 ;
  ;
  for (row = row1 ; row <= row2 ; row++)
  {
      ;
      if ((Row_degree [row] >= 0))
      {
   ;
   ;
   pivrow [1] = row ;
   ;
   break ;
      }
  }
  Front_new1strow [nfr] = row ;
     }
     if (pivrow [1] == (-1))
     {
  ;
  ;
  return ((1)) ;
     }
 }
    }
    if (pivrow [0] != (-1))
    {
 freebie [0] = (pivrow [0] == prior_pivrow [0]) && (cdeg1 > 0) ;
 ;
 if (!freebie [0])
 {
     Fcpos = Work->Fcpos ;
     fncols = Work->fncols ;
     Wrpflag = Work->Wrpflag ;
     rdeg [0] = fncols ;
     ;
     ;
     ;
     if (Fcpos [pivcol] < 0)
     {
  ;
  if (rdeg [0] >= max_rdeg)
  {
      return ((-11)) ;
  }
  Wrp [pivcol] = Wrpflag ;
  W_i [rdeg [0]++] = pivcol ;
     }
     tpi = Row_tuples [pivrow [0]] ;
     if (tpi)
     {
  tp = (Tuple *) (Memory + tpi) ;
  tp1 = tp ;
  tp2 = tp ;
  tpend = tp + Row_tlen [pivrow [0]] ;
  for ( ; tp < tpend ; tp++)
  {
      e = tp->e ;
      ;
      if (!E [e])
      {
   continue ;
      }
      f = tp->f ;
      p = Memory + E [e] ;
      ep = (Element *) p ;
      p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
      Cols = (long *) p ;
      ncols = ep->ncols ;
      Rows = Cols + ncols ;
      if (Rows [f] == (-1))
      {
   continue ;
      }
      ;
      for (j = 0 ; j < ncols ; j++)
      {
   col = Cols [j] ;
   ;
   if ((col >= 0) && (Wrp [col] != Wrpflag)
       && Fcpos [col] <0)
   {
       ;
       if (rdeg [0] >= max_rdeg)
       {
    ;
    return ((-11)) ;
       }
       Wrp [col] = Wrpflag ;
       W_i [rdeg [0]++] = col ;
   }
      }
      *tp2++ = *tp ;
  }
  Row_tlen [pivrow [0]] = tp2 - tp1 ;
     }
     Work->Wrpflag++ ;
 }
    }
    if (pivrow [1] != (-1))
    {
 freebie [1] = (pivrow [1] == prior_pivrow [1]) && cdeg1 > 0 ;
 ;
 if (!freebie [1])
 {
     Wrpflag = Work->Wrpflag ;
     rdeg [1] = 0 ;
     ;
     ;
     ;
     ;
     if (rdeg [1] >= max_rdeg)
     {
  return ((-11)) ;
     }
     Wrp [pivcol] = Wrpflag ;
     W_o [rdeg [1]++] = pivcol ;
     tpi = Row_tuples [pivrow [1]] ;
     if (tpi)
     {
  tp = (Tuple *) (Memory + tpi) ;
  tp1 = tp ;
  tp2 = tp ;
  tpend = tp + Row_tlen [pivrow [1]] ;
  for ( ; tp < tpend ; tp++)
  {
      e = tp->e ;
      ;
      if (!E [e])
      {
   continue ;
      }
      f = tp->f ;
      p = Memory + E [e] ;
      ep = (Element *) p ;
      p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
      Cols = (long *) p ;
      ncols = ep->ncols ;
      Rows = Cols + ncols ;
      if (Rows [f] == (-1))
      {
   continue ;
      }
      ;
      for (j = 0 ; j < ncols ; j++)
      {
   col = Cols [j] ;
   ;
   if ((col >= 0) && (Wrp [col] != Wrpflag))
   {
       ;
       if (rdeg [1] >= max_rdeg)
       {
    ;
    return ((-11)) ;
       }
       Wrp [col] = Wrpflag ;
       W_o [rdeg [1]++] = col ;
   }
      }
      *tp2++ = *tp ;
  }
  Row_tlen [pivrow [1]] = tp2 - tp1 ;
     }
     Work->Wrpflag++ ;
 }
    }
    ;
    return ((0)) ;
}

canonical_original_code:
long umfzl_row_search(struct NumericType *Numeric, struct WorkType *Work, struct SymbolicType *Symbolic, long cdeg0, long cdeg1, long Pattern[], long Pos[], long pivrow[2], long rdeg[2], long W_i[], long W_o[], long prior_pivrow[2], struct DoubleComplex Wxy[], long pivcol, long freebie[])
{
    double maxval; double toler; double toler2; double value; double pivot[2];
    long i; long row; long deg; long col; long *Frpos; long fnrows; long *E; long j; long ncols; long *Cols; long *Rows; long e; long f; long Wrpflag; long *Fcpos; long fncols; long tpi; long max_rdeg; long nans_in_col; long was_offdiag; long diag_row; long prefer_diagonal; long *Wrp; long found; long *Diagonal_map;
    struct Tuple *tp; struct Tuple *tpend; struct Tuple *tp1; struct Tuple *tp2;
    union Unit_union *Memory; union Unit_union *p;
    struct Element *ep;
    long *Row_tuples; long *Row_degree; long *Row_tlen;
    pivot [0] = 0. ;
    pivot [1] = 0. ;
    Row_degree = Numeric->Rperm ;
    Row_tuples = Numeric->Uip ;
    Row_tlen = Numeric->Uilen ;
    Wrp = Work->Wrp ;
    Frpos = Work->Frpos ;
    E = Work->E ;
    Memory = Numeric->Memory ;
    fnrows = Work->fnrows ;
    prefer_diagonal = Symbolic->prefer_diagonal ;
    Diagonal_map = Work->Diagonal_map ;
    if (Diagonal_map)
    {
 diag_row = Diagonal_map [pivcol] ;
 was_offdiag = diag_row < 0 ;
 if (was_offdiag)
 {
     diag_row = (-(diag_row)-2) ;
 }
 ;
    }
    else
    {
 diag_row = (-1) ;
 was_offdiag = (-1) ;
    }
    max_rdeg = Work->fncols_max ;
    maxval = 0.0 ;
    nans_in_col = (0) ;
    for (i = 0 ; i < cdeg1 ; i++)
    {
 { (value) = (((((Wxy [i]).component [0]) < 0.)) ? -((Wxy [i]).component [0]) : ((Wxy [i]).component [0])) + (((((Wxy [i]).component [1]) < 0.)) ? -((Wxy [i]).component [1]) : ((Wxy [i]).component [1])) ; } ;
 if (((value) != (value)))
 {
     nans_in_col = (1) ;
     maxval = value ;
     break ;
 }
 maxval = (((maxval) > (value)) ? (maxval) : (value)) ;
    }
    toler = Numeric->relpt * maxval ;
    toler2 = Numeric->relpt2 * maxval ;
    toler2 = was_offdiag ? toler : toler2 ;
    ;
    if (((toler) != (toler)) || ((toler2) != (toler2)))
    {
 nans_in_col = (1) ;
    }
    if (!nans_in_col)
    {
 found = (0) ;
 ;
 if (prefer_diagonal)
 {
     ;
     i = Pos [diag_row] ;
     if (i >= 0)
     {
  double a;
  ;
  ;
  { (a) = (((((Wxy [i]).component [0]) < 0.)) ? -((Wxy [i]).component [0]) : ((Wxy [i]).component [0])) + (((((Wxy [i]).component [1]) < 0.)) ? -((Wxy [i]).component [1]) : ((Wxy [i]).component [1])) ; } ;
  ;
  ;
  if (((a) != 0.) && a >= toler2)
  {
      ;
      found = (1) ;
      if (Frpos [diag_row] >= 0 && Frpos [diag_row] < fnrows)
      {
   pivrow [0] = diag_row ;
   pivrow [1] = (-1) ;
      }
      else
      {
   pivrow [0] = (-1) ;
   pivrow [1] = diag_row ;
      }
  }
     }
 }
 if (!found)
 {
     if (cdeg0 > 0)
     {
  for (i = 0 ; i < cdeg0 ; i++)
  {
      double a;
      { (a) = (((((Wxy [i]).component [0]) < 0.)) ? -((Wxy [i]).component [0]) : ((Wxy [i]).component [0])) + (((((Wxy [i]).component [1]) < 0.)) ? -((Wxy [i]).component [1]) : ((Wxy [i]).component [1])) ; } ;
      ;
      ;
      if (((a) != 0.) && a >= toler)
      {
   row = Pattern [i] ;
   deg = Row_degree [row] ;
   ;
   ;
   ;
   if (deg < rdeg [0]
          || (deg == rdeg [0] && a > pivot [0])
      )
   {
       pivrow [0] = row ;
       rdeg [0] = deg ;
       pivot [0] = a ;
   }
      }
  }
  for ( ; i < cdeg1 ; i++)
  {
      double a;
      { (a) = (((((Wxy [i]).component [0]) < 0.)) ? -((Wxy [i]).component [0]) : ((Wxy [i]).component [0])) + (((((Wxy [i]).component [1]) < 0.)) ? -((Wxy [i]).component [1]) : ((Wxy [i]).component [1])) ; } ;
      ;
      ;
      if (((a) != 0.) && a >= toler)
      {
   row = Pattern [i] ;
   deg = Row_degree [row] ;
   ;
   ;
   if (deg < rdeg [1]
          || (deg == rdeg [1] && a > pivot [1])
      )
   {
       pivrow [1] = row ;
       rdeg [1] = deg ;
       pivot [1] = a ;
   }
      }
  }
     }
     else
     {
  for (i = 0 ; i < cdeg1 ; i++)
  {
      double a;
      { (a) = (((((Wxy [i]).component [0]) < 0.)) ? -((Wxy [i]).component [0]) : ((Wxy [i]).component [0])) + (((((Wxy [i]).component [1]) < 0.)) ? -((Wxy [i]).component [1]) : ((Wxy [i]).component [1])) ; } ;
      ;
      ;
      if (((a) != 0.) && a >= toler)
      {
   row = Pattern [i] ;
   deg = Row_degree [row] ;
   if (Frpos [row] >= 0 && Frpos [row] < fnrows)
   {
       ;
       if (deg < rdeg [0]
          || (deg == rdeg [0] && a > pivot [0])
          )
       {
    pivrow [0] = row ;
    rdeg [0] = deg ;
    pivot [0] = a ;
       }
   }
   else
   {
       ;
       if (deg < rdeg [1]
          || (deg == rdeg[1] && a > pivot [1])
          )
       {
    pivrow [1] = row ;
    rdeg [1] = deg ;
    pivot [1] = a ;
       }
   }
      }
  }
     }
 }
    }
    if (cdeg1 > 0 && pivrow [0] == (-1) && pivrow [1] == (-1))
    {
 ;
 row = Pattern [0] ;
 deg = Row_degree [row] ;
 if (Frpos [row] >= 0 && Frpos [row] < fnrows)
 {
     ;
     pivrow [0] = row ;
     rdeg [0] = deg ;
 }
 else
 {
     ;
     pivrow [1] = row ;
     rdeg [1] = deg ;
 }
 for (i = 1 ; i < cdeg1 ; i++)
 {
     row = Pattern [i] ;
     deg = Row_degree [row] ;
     if (Frpos [row] >= 0 && Frpos [row] < fnrows)
     {
  ;
  if (deg < rdeg [0] || (deg == rdeg [0] && row == diag_row))
  {
      pivrow [0] = row ;
      rdeg [0] = deg ;
  }
     }
     else
     {
  ;
  if (deg < rdeg [1] || (deg == rdeg [1] && row == diag_row))
  {
      pivrow [1] = row ;
      rdeg [1] = deg ;
  }
     }
 }
    }
    ;
    ;
    if (cdeg1 == 0)
    {
 if (fnrows > 0)
 {
     pivrow [0] = Work->Frows [0] ;
     ;
 }
 else
 {
     long *Front_leftmostdesc; long *Front_1strow; long *Front_new1strow; long row1; long row2; long fleftmost; long nfr; long n_row; long frontid;
     ;
     Front_leftmostdesc = Symbolic->Front_leftmostdesc ;
     Front_1strow = Symbolic->Front_1strow ;
     Front_new1strow = Work->Front_new1strow ;
     nfr = Symbolic->nfr ;
     n_row = Numeric->n_row ;
     frontid = Work->frontid ;
     ;
     fleftmost = Front_leftmostdesc [frontid] ;
     row1 = Front_new1strow [fleftmost] ;
     row2 = Front_1strow [frontid+1] - 1 ;
     ;
     for (row = row1 ; row <= row2 ; row++)
     {
  ;
  if ((Row_degree [row] >= 0))
  {
      ;
      ;
      pivrow [1] = row ;
      ;
      break ;
  }
     }
     Front_new1strow [fleftmost] = row ;
     if (pivrow [1] == (-1))
     {
  row1 = Front_new1strow [nfr] ;
  row2 = n_row-1 ;
  ;
  for (row = row1 ; row <= row2 ; row++)
  {
      ;
      if ((Row_degree [row] >= 0))
      {
   ;
   ;
   pivrow [1] = row ;
   ;
   break ;
      }
  }
  Front_new1strow [nfr] = row ;
     }
     if (pivrow [1] == (-1))
     {
  ;
  ;
  return ((1)) ;
     }
 }
    }
    if (pivrow [0] != (-1))
    {
 freebie [0] = (pivrow [0] == prior_pivrow [0]) && (cdeg1 > 0) ;
 ;
 if (!freebie [0])
 {
     Fcpos = Work->Fcpos ;
     fncols = Work->fncols ;
     Wrpflag = Work->Wrpflag ;
     rdeg [0] = fncols ;
     ;
     ;
     ;
     if (Fcpos [pivcol] < 0)
     {
  ;
  if (rdeg [0] >= max_rdeg)
  {
      return ((-11)) ;
  }
  Wrp [pivcol] = Wrpflag ;
  W_i [rdeg [0]++] = pivcol ;
     }
     tpi = Row_tuples [pivrow [0]] ;
     if (tpi)
     {
  tp = (struct Tuple *) (Memory + tpi) ;
  tp1 = tp ;
  tp2 = tp ;
  tpend = tp + Row_tlen [pivrow [0]] ;
  for ( ; tp < tpend ; tp++)
  {
      e = tp->e ;
      ;
      if (!E [e])
      {
   continue ;
      }
      f = tp->f ;
      p = Memory + E [e] ;
      ep = (struct Element *) p ;
      p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
      Cols = (long *) p ;
      ncols = ep->ncols ;
      Rows = Cols + ncols ;
      if (Rows [f] == (-1))
      {
   continue ;
      }
      ;
      for (j = 0 ; j < ncols ; j++)
      {
   col = Cols [j] ;
   ;
   if ((col >= 0) && (Wrp [col] != Wrpflag)
       && Fcpos [col] <0)
   {
       ;
       if (rdeg [0] >= max_rdeg)
       {
    ;
    return ((-11)) ;
       }
       Wrp [col] = Wrpflag ;
       W_i [rdeg [0]++] = col ;
   }
      }
      *tp2++ = *tp ;
  }
  Row_tlen [pivrow [0]] = tp2 - tp1 ;
     }
     Work->Wrpflag++ ;
 }
    }
    if (pivrow [1] != (-1))
    {
 freebie [1] = (pivrow [1] == prior_pivrow [1]) && cdeg1 > 0 ;
 ;
 if (!freebie [1])
 {
     Wrpflag = Work->Wrpflag ;
     rdeg [1] = 0 ;
     ;
     ;
     ;
     ;
     if (rdeg [1] >= max_rdeg)
     {
  return ((-11)) ;
     }
     Wrp [pivcol] = Wrpflag ;
     W_o [rdeg [1]++] = pivcol ;
     tpi = Row_tuples [pivrow [1]] ;
     if (tpi)
     {
  tp = (struct Tuple *) (Memory + tpi) ;
  tp1 = tp ;
  tp2 = tp ;
  tpend = tp + Row_tlen [pivrow [1]] ;
  for ( ; tp < tpend ; tp++)
  {
      e = tp->e ;
      ;
      if (!E [e])
      {
   continue ;
      }
      f = tp->f ;
      p = Memory + E [e] ;
      ep = (struct Element *) p ;
      p += (((((sizeof (Element) * (1))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
      Cols = (long *) p ;
      ncols = ep->ncols ;
      Rows = Cols + ncols ;
      if (Rows [f] == (-1))
      {
   continue ;
      }
      ;
      for (j = 0 ; j < ncols ; j++)
      {
   col = Cols [j] ;
   ;
   if ((col >= 0) && (Wrp [col] != Wrpflag))
   {
       ;
       if (rdeg [1] >= max_rdeg)
       {
    ;
    return ((-11)) ;
       }
       Wrp [col] = Wrpflag ;
       W_o [rdeg [1]++] = col ;
   }
      }
      *tp2++ = *tp ;
  }
  Row_tlen [pivrow [1]] = tp2 - tp1 ;
     }
     Work->Wrpflag++ ;
 }
    }
    ;
    return ((0)) ;
}

variable_types: struct NumericType { double flops; long scale; long valid; union Unit_union { struct { long size; } header; double xxxxxx; } *Memory; long ihead; long *Rperm; long ulen; struct DoubleComplex { double component[2]; } *D; long do_recip; double *Rs; long n_row; long tail_usage; long maxnrows; } *

variable_types: struct WorkType { long *E; struct DoubleComplex *Wx; long *Wp; long *Lpattern; long *Diagonal_map; long n_row; long *Front_new1strow; long Pivrow[64]; struct DoubleComplex *Flublock; long *Frows; } *

variable_types: struct SymbolicType { double num_mem_usage_est; long valid; } *

variable_types:
Pattern
long []

variable_types:
Pos
long []

variable_types:
pivrow
long [2]

variable_types:
rdeg
long [2]

variable_types:
Wxy
struct DoubleComplex []

variable_types: pivcol long

variable_types:
freebie
long []

variable_types: maxval double

variable_types: toler double

variable_types: value double

variable_types:
pivot
double [2]

variable_types: row long

variable_types: deg long

variable_types: col long

variable_types:
Frpos
long *

variable_types: fnrows long

variable_types:
E
long *

variable_types: j long

variable_types: ncols long

variable_types:
Cols
long *

variable_types:
Rows
long *

variable_types: e long

variable_types: f long

variable_types: Wrpflag long

variable_types:
Fcpos
long *

variable_types: fncols long

variable_types: tpi long

variable_types:
Wrp
long *

variable_types: found long

variable_types:
tp
struct Tuple { long e; } *

variable_types:
tpend
struct Tuple { long e; } *

variable_types:
ep
struct Element { long cdeg; } *

variable_types: a double

variable_types: fleftmost long

variable_types: nfr long

variable_types: frontid long

user_defined_types: struct NumericType { double flops; long scale; long valid; union Unit_union *Memory; long ihead; long *Rperm; long ulen; struct DoubleComplex *D; long do_recip; double *Rs; long n_row; long tail_usage; long maxnrows; }


original_code:
void amd_postorder
(
    int nn,
    int Parent [ ],
    int Nv [ ],
    int Fsize [ ],
    int Order [ ],
    int Child [ ],
    int Sibling [ ],
    int Stack [ ]
)
{
    int i, j, k, parent, frsize, f, fprev, maxfrsize, bigfprev, bigf, fnext ;
    for (j = 0 ; j < nn ; j++)
    {
 Child [j] = (-1) ;
 Sibling [j] = (-1) ;
    }
    for (j = nn-1 ; j >= 0 ; j--)
    {
 if (Nv [j] > 0)
 {
     parent = Parent [j] ;
     if (parent != (-1))
     {
  Sibling [j] = Child [parent] ;
  Child [parent] = j ;
     }
 }
    }
    for (i = 0 ; i < nn ; i++)
    {
 if (Nv [i] > 0 && Child [i] != (-1))
 {
     fprev = (-1) ;
     maxfrsize = (-1) ;
     bigfprev = (-1) ;
     bigf = (-1) ;
     for (f = Child [i] ; f != (-1) ; f = Sibling [f])
     {
  ;
  frsize = Fsize [f] ;
  if (frsize >= maxfrsize)
  {
      maxfrsize = frsize ;
      bigfprev = fprev ;
      bigf = f ;
  }
  fprev = f ;
     }
     ;
     fnext = Sibling [bigf] ;
     ;
     if (fnext != (-1))
     {
  if (bigfprev == (-1))
  {
      Child [i] = fnext ;
  }
  else
  {
      Sibling [bigfprev] = fnext ;
  }
  Sibling [bigf] = (-1) ;
  ;
  ;
  ;
  Sibling [fprev] = bigf ;
     }
 }
    }
    for (i = 0 ; i < nn ; i++)
    {
 Order [i] = (-1) ;
    }
    k = 0 ;
    for (i = 0 ; i < nn ; i++)
    {
 if (Parent [i] == (-1) && Nv [i] > 0)
 {
     ;
     k = amd_post_tree (i, k, Child, Sibling, Order, Stack
  ) ;
 }
    }
}

canonical_original_code:
void amd_postorder(int nn, int Parent[], int Nv[], int Fsize[], int Order[], int Child[], int Sibling[], int Stack[])
{
    int i; int j; int k; int parent; int frsize; int f; int fprev; int maxfrsize; int bigfprev; int bigf; int fnext;
    for (j = 0 ; j < nn ; j++)
    {
 Child [j] = (-1) ;
 Sibling [j] = (-1) ;
    }
    for (j = nn-1 ; j >= 0 ; j--)
    {
 if (Nv [j] > 0)
 {
     parent = Parent [j] ;
     if (parent != (-1))
     {
  Sibling [j] = Child [parent] ;
  Child [parent] = j ;
     }
 }
    }
    for (i = 0 ; i < nn ; i++)
    {
 if (Nv [i] > 0 && Child [i] != (-1))
 {
     fprev = (-1) ;
     maxfrsize = (-1) ;
     bigfprev = (-1) ;
     bigf = (-1) ;
     for (f = Child [i] ; f != (-1) ; f = Sibling [f])
     {
  ;
  frsize = Fsize [f] ;
  if (frsize >= maxfrsize)
  {
      maxfrsize = frsize ;
      bigfprev = fprev ;
      bigf = f ;
  }
  fprev = f ;
     }
     ;
     fnext = Sibling [bigf] ;
     ;
     if (fnext != (-1))
     {
  if (bigfprev == (-1))
  {
      Child [i] = fnext ;
  }
  else
  {
      Sibling [bigfprev] = fnext ;
  }
  Sibling [bigf] = (-1) ;
  ;
  ;
  ;
  Sibling [fprev] = bigf ;
     }
 }
    }
    for (i = 0 ; i < nn ; i++)
    {
 Order [i] = (-1) ;
    }
    k = 0 ;
    for (i = 0 ; i < nn ; i++)
    {
 if (Parent [i] == (-1) && Nv [i] > 0)
 {
     ;
     k = amd_post_tree (i, k, Child, Sibling, Order, Stack
  ) ;
 }
    }
}

variable_types: nn int

variable_types:
Parent
int []

variable_types:
Nv
int []

variable_types:
Fsize
int []

variable_types:
Order
int []

variable_types:
Child
int []

variable_types:
Sibling
int []

variable_types:
Stack
int []

variable_types: i int

variable_types: j int

variable_types: k int

variable_types: parent int

variable_types: frsize int

variable_types: f int

variable_types: fprev int

variable_types: maxfrsize int

variable_types: bigfprev int

variable_types: bigf int

variable_types: fnext int