original_code:
long umfpack_dl_report_symbolic
(
    void *SymbolicHandle,
    const double Control [20]
)
{
    long n_row, n_col, nz, nchains, nfr, maxnrows, maxncols, prl,
 k, chain, frontid, frontid1, frontid2, kk, *Chain_start, *W,
 *Chain_maxrows, *Chain_maxcols, *Front_npivcol, *Front_1strow,
 *Front_leftmostdesc, *Front_parent, done, status1, status2 ;
    SymbolicType *Symbolic ;
    prl = ((Control != (double *) ((void *)0)) ? (((Control [0]) != (Control [0])) ? 1 : Control [0]) : 1) ;
    if (prl <= 2)
    {
 return ((0)) ;
    }
    { if (amd_printf != ((void *)0)) (void) amd_printf ("Symbolic object: ") ; } ;
    Symbolic = (SymbolicType *) SymbolicHandle ;
    if (!umfdl_valid_symbolic (Symbolic))
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: invalid\n") ; } ;
 return ((-4)) ;
    }
    n_row = Symbolic->n_row ;
    n_col = Symbolic->n_col ;
    nz = Symbolic->nz ;
    nchains = Symbolic->nchains ;
    nfr = Symbolic->nfr ;
    maxnrows = Symbolic->maxnrows ;
    maxncols = Symbolic->maxncols ;
    Chain_start = Symbolic->Chain_start ;
    Chain_maxrows = Symbolic->Chain_maxrows ;
    Chain_maxcols = Symbolic->Chain_maxcols ;
    Front_npivcol = Symbolic->Front_npivcol ;
    Front_1strow = Symbolic->Front_1strow ;
    Front_leftmostdesc = Symbolic->Front_leftmostdesc ;
    Front_parent = Symbolic->Front_parent ;
    if (prl >= 4)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\n    matrix to be factorized:\n") ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tn_row: ""%" "ld"" n_col: ""%" "ld""\n", n_row, n_col) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tnumber of entries: ""%" "ld""\n", nz) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    block size used for dense matrix kernels:   ""%" "ld""\n", Symbolic->nb) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    strategy used:                              ") ; } ;
 if (Symbolic->strategy == 3)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("symmetric\n") ; } ;
            { if (amd_printf != ((void *)0)) (void) amd_printf ("    ordering used:                              ") ; } ;
            if (Symbolic->ordering == 1)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("amd on A\n") ; } ;
            }
            else if (Symbolic->ordering == 2)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("user permutation") ; } ;
            }
            else if (Symbolic->ordering == 6)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("user function") ; } ;
            }
            else if (Symbolic->ordering == 3)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("metis on A") ; } ;
            }
 }
 else
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("unsymmetric\n") ; } ;
            { if (amd_printf != ((void *)0)) (void) amd_printf ("    ordering used:                              ") ; } ;
            if (Symbolic->ordering == 1)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("colamd on A\n") ; } ;
            }
            else if (Symbolic->ordering == 2)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("user permutation") ; } ;
            }
            else if (Symbolic->ordering == 6)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("user function") ; } ;
            }
            else if (Symbolic->ordering == 3)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("metis on A'A") ; } ;
            }
 }
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    performn column etree postorder:            ") ; } ;
 if (Symbolic->fixQ)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("no\n") ; } ;
 }
 else
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("yes\n") ; } ;
 }
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    prefer diagonal pivoting (attempt P=Q):     ") ; } ;
 if (Symbolic->prefer_diagonal)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("yes\n") ; } ;
 }
 else
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("no\n") ; } ;
 }
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    variable-size part of Numeric object:\n") ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tminimum initial size (Units): %.20g  (MBytes): %.1f\n", Symbolic->dnum_mem_init_usage, (((Symbolic->dnum_mem_init_usage) * sizeof (Unit)) / 1048576.0)) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\testimated peak size (Units):  %.20g  (MBytes): %.1f\n", Symbolic->num_mem_usage_est, (((Symbolic->num_mem_usage_est) * sizeof (Unit)) / 1048576.0)) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\testimated final size (Units): %.20g  (MBytes): %.1f\n", Symbolic->num_mem_size_est, (((Symbolic->num_mem_size_est) * sizeof (Unit)) / 1048576.0)) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    symbolic factorization memory usage (Units):" " %.20g  (MBytes): %.1f\n", Symbolic->peak_sym_usage, (((Symbolic->peak_sym_usage) * sizeof (Unit)) / 1048576.0)) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    frontal matrices / supercolumns:\n") ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tnumber of frontal chains: ""%" "ld""\n", nchains) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tnumber of frontal matrices: ""%" "ld""\n", nfr) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tlargest frontal matrix row dimension: ""%" "ld""\n", maxnrows) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tlargest frontal matrix column dimension: ""%" "ld""\n",maxncols) ; };
    }
    k = 0 ;
    done = (0) ;
    for (chain = 0 ; chain < nchains ; chain++)
    {
 frontid1 = Chain_start [chain] ;
 frontid2 = Chain_start [chain+1] - 1 ;
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n    Frontal chain: ""%" "ld"".  Frontal matrices ""%" "ld"" to ""%" "ld""\n", (chain), (frontid1), (frontid2)) ; } ; } } ;
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\tLargest frontal matrix in Frontal chain: ""%" "ld""-by-""%" "ld""\n", Chain_maxrows [chain], Chain_maxcols [chain]) ; } ; } } ;
 for (frontid = frontid1 ; frontid <= frontid2 ; frontid++)
 {
     kk = Front_npivcol [frontid] ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\tFront: ""%" "ld""  pivot cols: ""%" "ld"" (pivot columns ""%" "ld"" to " "%" "ld"")\n", (frontid), kk, (k), (k+kk-1)) ; } ; } } ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t    pivot row candidates: ""%" "ld"" to ""%" "ld""\n", (Front_1strow [Front_leftmostdesc [frontid]]), (Front_1strow [frontid+1]-1)) ; } ; } } ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t    leftmost descendant: ""%" "ld""\n", (Front_leftmostdesc [frontid])) ; } ; } } ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t    1st new candidate row : ""%" "ld""\n", (Front_1strow [frontid])) ; } ; } } ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t    parent:") ; } ; } } ;
     if (Front_parent [frontid] == (-1))
     {
  { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" (none)\n") ; } ; } } ;
     }
     else
     {
  { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" ""%" "ld""\n", (Front_parent [frontid])) ; } ; } } ;
     }
     done = (frontid == 20 && frontid < nfr-1 && prl == 4) ;
     if (done)
     {
  { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t...\n") ; } ; } } ;
  break ;
     }
     k += kk ;
 }
 if (Front_npivcol [nfr] != 0)
 {
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\tFront: ""%" "ld"" placeholder for ""%" "ld"" empty columns\n", (nfr), Front_npivcol [nfr]) ; } ; } } ;
 }
 if (done)
 {
     break ;
 }
    }
    W = (long *) umf_l_malloc ((((n_row) > (n_col)) ? (n_row) : (n_col)), sizeof (long)) ;
    if (!W)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: out of memory to check Symbolic object\n\n") ; } ;
 return ((-1)) ;
    }
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\nInitial column permutation, Q1: ") ; } ; } } ;
    status1 = umf_l_report_perm (n_col, Symbolic->Cperm_init, W, prl, 0) ;
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\nInitial row permutation, P1: ") ; } ; } } ;
    status2 = umf_l_report_perm (n_row, Symbolic->Rperm_init, W, prl, 0) ;
    (void) umf_l_free ((void *) W) ;
    if (status1 != (0) || status2 != (0))
    {
 return ((-4)) ;
    }
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("    Symbolic object:  ") ; } ; } } ;
    { if (amd_printf != ((void *)0)) (void) amd_printf ("OK\n\n") ; } ;
    return ((0)) ;
}

canonical_original_code:
long umfpack_dl_report_symbolic(void *SymbolicHandle, double Control[20])
{
    long n_row; long n_col; long nz; long nchains; long nfr; long maxnrows; long maxncols; long prl; long k; long chain; long frontid; long frontid1; long frontid2; long kk; long *Chain_start; long *W; long *Chain_maxrows; long *Chain_maxcols; long *Front_npivcol; long *Front_1strow; long *Front_leftmostdesc; long *Front_parent; long done; long status1; long status2;
    struct SymbolicType *Symbolic;
    prl = ((Control != (double *) ((void *)0)) ? (((Control [0]) != (Control [0])) ? 1 : Control [0]) : 1) ;
    if (prl <= 2)
    {
 return ((0)) ;
    }
    { if (amd_printf != ((void *)0)) (void) amd_printf ("Symbolic object: ") ; } ;
    Symbolic = (struct SymbolicType *) SymbolicHandle ;
    if (!umfdl_valid_symbolic (Symbolic))
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: invalid\n") ; } ;
 return ((-4)) ;
    }
    n_row = Symbolic->n_row ;
    n_col = Symbolic->n_col ;
    nz = Symbolic->nz ;
    nchains = Symbolic->nchains ;
    nfr = Symbolic->nfr ;
    maxnrows = Symbolic->maxnrows ;
    maxncols = Symbolic->maxncols ;
    Chain_start = Symbolic->Chain_start ;
    Chain_maxrows = Symbolic->Chain_maxrows ;
    Chain_maxcols = Symbolic->Chain_maxcols ;
    Front_npivcol = Symbolic->Front_npivcol ;
    Front_1strow = Symbolic->Front_1strow ;
    Front_leftmostdesc = Symbolic->Front_leftmostdesc ;
    Front_parent = Symbolic->Front_parent ;
    if (prl >= 4)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\n    matrix to be factorized:\n") ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tn_row: ""%" "ld"" n_col: ""%" "ld""\n", n_row, n_col) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tnumber of entries: ""%" "ld""\n", nz) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    block size used for dense matrix kernels:   ""%" "ld""\n", Symbolic->nb) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    strategy used:                              ") ; } ;
 if (Symbolic->strategy == 3)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("symmetric\n") ; } ;
            { if (amd_printf != ((void *)0)) (void) amd_printf ("    ordering used:                              ") ; } ;
            if (Symbolic->ordering == 1)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("amd on A\n") ; } ;
            }
            else if (Symbolic->ordering == 2)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("user permutation") ; } ;
            }
            else if (Symbolic->ordering == 6)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("user function") ; } ;
            }
            else if (Symbolic->ordering == 3)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("metis on A") ; } ;
            }
 }
 else
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("unsymmetric\n") ; } ;
            { if (amd_printf != ((void *)0)) (void) amd_printf ("    ordering used:                              ") ; } ;
            if (Symbolic->ordering == 1)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("colamd on A\n") ; } ;
            }
            else if (Symbolic->ordering == 2)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("user permutation") ; } ;
            }
            else if (Symbolic->ordering == 6)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("user function") ; } ;
            }
            else if (Symbolic->ordering == 3)
            {
                { if (amd_printf != ((void *)0)) (void) amd_printf ("metis on A'A") ; } ;
            }
 }
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    performn column etree postorder:            ") ; } ;
 if (Symbolic->fixQ)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("no\n") ; } ;
 }
 else
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("yes\n") ; } ;
 }
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    prefer diagonal pivoting (attempt P=Q):     ") ; } ;
 if (Symbolic->prefer_diagonal)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("yes\n") ; } ;
 }
 else
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("no\n") ; } ;
 }
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    variable-size part of Numeric object:\n") ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tminimum initial size (Units): %.20g  (MBytes): %.1f\n", Symbolic->dnum_mem_init_usage, (((Symbolic->dnum_mem_init_usage) * sizeof (Unit)) / 1048576.0)) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\testimated peak size (Units):  %.20g  (MBytes): %.1f\n", Symbolic->num_mem_usage_est, (((Symbolic->num_mem_usage_est) * sizeof (Unit)) / 1048576.0)) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\testimated final size (Units): %.20g  (MBytes): %.1f\n", Symbolic->num_mem_size_est, (((Symbolic->num_mem_size_est) * sizeof (Unit)) / 1048576.0)) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    symbolic factorization memory usage (Units):" " %.20g  (MBytes): %.1f\n", Symbolic->peak_sym_usage, (((Symbolic->peak_sym_usage) * sizeof (Unit)) / 1048576.0)) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("    frontal matrices / supercolumns:\n") ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tnumber of frontal chains: ""%" "ld""\n", nchains) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tnumber of frontal matrices: ""%" "ld""\n", nfr) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tlargest frontal matrix row dimension: ""%" "ld""\n", maxnrows) ; } ;
 { if (amd_printf != ((void *)0)) (void) amd_printf ("\tlargest frontal matrix column dimension: ""%" "ld""\n",maxncols) ; };
    }
    k = 0 ;
    done = (0) ;
    for (chain = 0 ; chain < nchains ; chain++)
    {
 frontid1 = Chain_start [chain] ;
 frontid2 = Chain_start [chain+1] - 1 ;
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n    Frontal chain: ""%" "ld"".  Frontal matrices ""%" "ld"" to ""%" "ld""\n", (chain), (frontid1), (frontid2)) ; } ; } } ;
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\tLargest frontal matrix in Frontal chain: ""%" "ld""-by-""%" "ld""\n", Chain_maxrows [chain], Chain_maxcols [chain]) ; } ; } } ;
 for (frontid = frontid1 ; frontid <= frontid2 ; frontid++)
 {
     kk = Front_npivcol [frontid] ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\tFront: ""%" "ld""  pivot cols: ""%" "ld"" (pivot columns ""%" "ld"" to " "%" "ld"")\n", (frontid), kk, (k), (k+kk-1)) ; } ; } } ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t    pivot row candidates: ""%" "ld"" to ""%" "ld""\n", (Front_1strow [Front_leftmostdesc [frontid]]), (Front_1strow [frontid+1]-1)) ; } ; } } ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t    leftmost descendant: ""%" "ld""\n", (Front_leftmostdesc [frontid])) ; } ; } } ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t    1st new candidate row : ""%" "ld""\n", (Front_1strow [frontid])) ; } ; } } ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t    parent:") ; } ; } } ;
     if (Front_parent [frontid] == (-1))
     {
  { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" (none)\n") ; } ; } } ;
     }
     else
     {
  { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" ""%" "ld""\n", (Front_parent [frontid])) ; } ; } } ;
     }
     done = (frontid == 20 && frontid < nfr-1 && prl == 4) ;
     if (done)
     {
  { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t...\n") ; } ; } } ;
  break ;
     }
     k += kk ;
 }
 if (Front_npivcol [nfr] != 0)
 {
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\tFront: ""%" "ld"" placeholder for ""%" "ld"" empty columns\n", (nfr), Front_npivcol [nfr]) ; } ; } } ;
 }
 if (done)
 {
     break ;
 }
    }
    W = (long *) umf_l_malloc ((((n_row) > (n_col)) ? (n_row) : (n_col)), sizeof (long)) ;
    if (!W)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: out of memory to check Symbolic object\n\n") ; } ;
 return ((-1)) ;
    }
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\nInitial column permutation, Q1: ") ; } ; } } ;
    status1 = umf_l_report_perm (n_col, Symbolic->Cperm_init, W, prl, 0) ;
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\nInitial row permutation, P1: ") ; } ; } } ;
    status2 = umf_l_report_perm (n_row, Symbolic->Rperm_init, W, prl, 0) ;
    (void) umf_l_free ((void *) W) ;
    if (status1 != (0) || status2 != (0))
    {
 return ((-4)) ;
    }
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("    Symbolic object:  ") ; } ; } } ;
    { if (amd_printf != ((void *)0)) (void) amd_printf ("OK\n\n") ; } ;
    return ((0)) ;
}

variable_types:
SymbolicHandle
void *

variable_types:
Control
double [20]

variable_types: nz long

variable_types: nchains long

variable_types: nfr long

variable_types: maxnrows long

variable_types: maxncols long

variable_types: prl long

variable_types: k long

variable_types: chain long

variable_types: frontid long

variable_types: kk long

variable_types:
W
long *

variable_types: done long

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


original_code:
long cholmod_l_postorder
(
    long *Parent,
    size_t n,
    long *Weight,
    long *Post,
    cholmod_common *Common
)
{
    long *Head, *Next, *Pstack, *Iwork ;
    long j, p, k, w, nextj ;
    size_t s ;
    int ok = 1 ;
    { if (Common == ((void *)0)) { return ((-1)) ; } if (Common->itype != 2 || Common->dtype != 0) { Common->status = (-4) ; return ((-1)) ; } } ;
    { if ((Parent) == ((void *)0)) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../Cholesky/cholmod_postorder.c", 163, "argument missing", Common) ; } return ((-1)) ; } } ;
    { if ((Post) == ((void *)0)) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../Cholesky/cholmod_postorder.c", 164, "argument missing", Common) ; } return ((-1)) ; } } ;
    Common->status = 0 ;
    s = cholmod_l_mult_size_t (n, 2, &ok) ;
    if (!ok)
    {
 cholmod_l_error ((-3), "../Cholesky/cholmod_postorder.c", 175, "problem too large", Common) ;
 return ((-1)) ;
    }
    cholmod_l_allocate_work (n, s, 0, Common) ;
    if (Common->status < 0)
    {
 return ((-1)) ;
    }
    ;
    Head = Common->Head ;
    Iwork = Common->Iwork ;
    Next = Iwork ;
    Pstack = Iwork + n ;
    if (Weight == ((void *)0))
    {
 for (j = n-1 ; j >= 0 ; j--)
 {
     p = Parent [j] ;
     if (p >= 0 && p < ((long) n))
     {
  Next [j] = Head [p] ;
  Head [p] = j ;
     }
 }
    }
    else
    {
 long *Whead = Pstack ;
 for (w = 0 ; w < ((long) n) ; w++)
 {
     Whead [w] = (-1) ;
 }
 for (j = 0 ; j < ((long) n) ; j++)
 {
     p = Parent [j] ;
     if (p >= 0 && p < ((long) n))
     {
  w = Weight [j] ;
  w = (((0) > (w)) ? (0) : (w)) ;
  w = (((w) < (((long) n) - 1)) ? (w) : (((long) n) - 1)) ;
  Next [j] = Whead [w] ;
  Whead [w] = j ;
     }
 }
 for (w = n-1 ; w >= 0 ; w--)
 {
     for (j = Whead [w] ; j != (-1) ; j = nextj)
     {
  nextj = Next [j] ;
  p = Parent [j] ;
  ;
  Next [j] = Head [p] ;
  Head [p] = j ;
     }
 }
    }
    k = 0 ;
    for (j = 0 ; j < ((long) n) ; j++)
    {
 if (Parent [j] == (-1))
 {
     k = dfs (j, k, Post, Head, Next, Pstack) ;
 }
    }
    for (j = 0 ; j < ((long) n) ; j++)
    {
 Head [j] = (-1) ;
    }
    ;
    ;
    return (k) ;
}

canonical_original_code:
long cholmod_l_postorder(long *Parent, unsigned long n, long *Weight, long *Post, struct cholmod_common_struct *Common)
{
    long *Head; long *Next; long *Pstack; long *Iwork;
    long j; long p; long k; long w; long nextj;
    unsigned long s;
    int ok = 1;
    { if (Common == ((void *)0)) { return ((-1)) ; } if (Common->itype != 2 || Common->dtype != 0) { Common->status = (-4) ; return ((-1)) ; } } ;
    { if ((Parent) == ((void *)0)) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../Cholesky/cholmod_postorder.c", 163, "argument missing", Common) ; } return ((-1)) ; } } ;
    { if ((Post) == ((void *)0)) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../Cholesky/cholmod_postorder.c", 164, "argument missing", Common) ; } return ((-1)) ; } } ;
    Common->status = 0 ;
    s = cholmod_l_mult_size_t (n, 2, &ok) ;
    if (!ok)
    {
 cholmod_l_error ((-3), "../Cholesky/cholmod_postorder.c", 175, "problem too large", Common) ;
 return ((-1)) ;
    }
    cholmod_l_allocate_work (n, s, 0, Common) ;
    if (Common->status < 0)
    {
 return ((-1)) ;
    }
    ;
    Head = Common->Head ;
    Iwork = Common->Iwork ;
    Next = Iwork ;
    Pstack = Iwork + n ;
    if (Weight == ((void *)0))
    {
 for (j = n-1 ; j >= 0 ; j--)
 {
     p = Parent [j] ;
     if (p >= 0 && p < ((long) n))
     {
  Next [j] = Head [p] ;
  Head [p] = j ;
     }
 }
    }
    else
    {
 long *Whead = Pstack;
 for (w = 0 ; w < ((long) n) ; w++)
 {
     Whead [w] = (-1) ;
 }
 for (j = 0 ; j < ((long) n) ; j++)
 {
     p = Parent [j] ;
     if (p >= 0 && p < ((long) n))
     {
  w = Weight [j] ;
  w = (((0) > (w)) ? (0) : (w)) ;
  w = (((w) < (((long) n) - 1)) ? (w) : (((long) n) - 1)) ;
  Next [j] = Whead [w] ;
  Whead [w] = j ;
     }
 }
 for (w = n-1 ; w >= 0 ; w--)
 {
     for (j = Whead [w] ; j != (-1) ; j = nextj)
     {
  nextj = Next [j] ;
  p = Parent [j] ;
  ;
  Next [j] = Head [p] ;
  Head [p] = j ;
     }
 }
    }
    k = 0 ;
    for (j = 0 ; j < ((long) n) ; j++)
    {
 if (Parent [j] == (-1))
 {
     k = dfs (j, k, Post, Head, Next, Pstack) ;
 }
    }
    for (j = 0 ; j < ((long) n) ; j++)
    {
 Head [j] = (-1) ;
    }
    ;
    ;
    return (k) ;
}

variable_types:
Parent
long *

variable_types:
n
unsigned long

variable_types:
Weight
long *

variable_types:
Post
long *

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:
Head
long *

variable_types:
Next
long *

variable_types:
Pstack
long *

variable_types:
Iwork
long *

variable_types: j long

variable_types: p long

variable_types: w long

variable_types: nextj long

variable_types:
s
unsigned long

variable_types: ok int

variable_types:
Whead
long *

return_type: long

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]; }


dfs

original_code:
static long dfs
(
    long p,
    long k,
    long Post [ ],
    long Head [ ],
    long Next [ ],
    long Pstack [ ]
)
{
    long j, phead ;
    Pstack [0] = p ;
    phead = 0 ;
    while (phead >= 0)
    {
 p = Pstack [phead] ;
 j = Head [p] ;
 if (j == (-1))
 {
     phead-- ;
     Post [k++] = p ;
 }
 else
 {
     Head [p] = Next [j] ;
     Pstack [++phead] = j ;
 }
    }
    return (k) ;
}

canonical_original_code:
static long dfs(long p, long k, long Post[], long Head[], long Next[], long Pstack[])
{
    long j; long phead;
    Pstack [0] = p ;
    phead = 0 ;
    while (phead >= 0)
    {
 p = Pstack [phead] ;
 j = Head [p] ;
 if (j == (-1))
 {
     phead-- ;
     Post [k++] = p ;
 }
 else
 {
     Head [p] = Next [j] ;
     Pstack [++phead] = j ;
 }
    }
    return (k) ;
}

variable_types: k long

variable_types:
Post
long []

variable_types:
Head
long []

variable_types:
Next
long []

variable_types:
Pstack
long []

variable_types: phead long


original_code:
cholmod_sparse *cholmod_ssmult
(
    cholmod_sparse *A,
    cholmod_sparse *B,
    int stype,
    int values,
    int sorted,
    cholmod_common *Common
)
{
    double bjt ;
    double *Ax, *Bx, *Cx, *W ;
    int *Ap, *Anz, *Ai, *Bp, *Bnz, *Bi, *Cp, *Ci, *Flag ;
    cholmod_sparse *C, *A2, *B2, *A3, *B3, *C2 ;
    int apacked, bpacked, j, i, pa, paend, pb, pbend, ncol, mark, cnz, t, p,
 nrow, anz, bnz, do_swap_and_transpose, n1, n2 ;
    { if (Common == ((void *)0)) { return (((void *)0)) ; } if (Common->itype != 0 || Common->dtype != 0) { Common->status = (-4) ; return (((void *)0)) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_ssmult.c", 71, "argument missing", Common) ; } return (((void *)0)) ; } } ;
    { if ((B) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_ssmult.c", 72, "argument missing", Common) ; } return (((void *)0)) ; } } ;
    values = values &&
 (A->xtype != 0) && (B->xtype != 0) ;
    { if ((A)->xtype < (0) || (A)->xtype > (values ? 1 : 3) || ((A)->xtype != 0 && ((A)->x) == ((void *)0)) || ((A)->xtype == 3 && ((A)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_ssmult.c", 75, "invalid xtype", Common) ; } return (((void *)0)) ; } } ;
    { if ((B)->xtype < (0) || (B)->xtype > (values ? 1 : 3) || ((B)->xtype != 0 && ((B)->x) == ((void *)0)) || ((B)->xtype == 3 && ((B)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_ssmult.c", 77, "invalid xtype", Common) ; } return (((void *)0)) ; } } ;
    if (A->ncol != B->nrow)
    {
 cholmod_error ((-4), "../MatrixOps/cholmod_ssmult.c", 82, "A and B inner dimensions must match", Common) ;
 return (((void *)0)) ;
    }
    Common->status = 0 ;
    if (A->nrow <= 1)
    {
 sorted = 0 ;
    }
    if (sorted)
    {
 n1 = (((A->nrow) > (B->ncol)) ? (A->nrow) : (B->ncol)) ;
    }
    else
    {
 n1 = A->nrow ;
    }
    n2 = (((A->ncol) > (A->nrow)) ? ((((A->ncol) > (B->nrow)) ? ((((A->ncol) > (B->ncol)) ? (A->ncol) : (B->ncol))) : ((((B->nrow) > (B->ncol)) ? (B->nrow) : (B->ncol))))) : ((((A->nrow) > (B->nrow)) ? ((((A->nrow) > (B->ncol)) ? (A->nrow) : (B->ncol))) : ((((B->nrow) > (B->ncol)) ? (B->nrow) : (B->ncol)))))) ;
    cholmod_allocate_work (n1, n2, values ? n1 : 0, Common) ;
    if (Common->status < 0)
    {
 return (((void *)0)) ;
    }
    ;
    A2 = ((void *)0) ;
    B2 = ((void *)0) ;
    if (A->stype)
    {
 A2 = cholmod_copy (A, 0, values, Common) ;
 if (Common->status < 0)
 {
     ;
     return (((void *)0)) ;
 }
 A = A2 ;
    }
    if (B->stype)
    {
 B2 = cholmod_copy (B, 0, values, Common) ;
 if (Common->status < 0)
 {
     cholmod_free_sparse (&A2, Common) ;
     ;
     return (((void *)0)) ;
 }
 B = B2 ;
    }
    ;
    ;
    Ap = A->p ;
    Anz = A->nz ;
    Ai = A->i ;
    Ax = A->x ;
    apacked = A->packed ;
    Bp = B->p ;
    Bnz = B->nz ;
    Bi = B->i ;
    Bx = B->x ;
    bpacked = B->packed ;
    nrow = A->nrow ;
    ncol = B->ncol ;
    W = Common->Xwork ;
    Flag = Common->Flag ;
    cnz = 0 ;
    for (j = 0 ; j < ncol ; j++)
    {
 { Common->mark++ ; if (Common->mark <= 0) { Common->mark = (-1) ; cholmod_clear_flag (Common) ; } } ;
 mark = Common->mark ;
 pb = Bp [j] ;
 pbend = (bpacked) ? (Bp [j+1]) : (pb + Bnz [j]) ;
 for ( ; pb < pbend ; pb++)
 {
     t = Bi [pb] ;
     pa = Ap [t] ;
     paend = (apacked) ? (Ap [t+1]) : (pa + Anz [t]) ;
     for ( ; pa < paend ; pa++)
     {
  i = Ai [pa] ;
  if (Flag [i] != mark)
  {
      Flag [i] = mark ;
      cnz++ ;
  }
     }
 }
 if (cnz < 0)
 {
     break ;
 }
    }
    { Common->mark++ ; if (Common->mark <= 0) { Common->mark = (-1) ; cholmod_clear_flag (Common) ; } } ;
    mark = Common->mark ;
    if (cnz < 0)
    {
 cholmod_error ((-3), "../MatrixOps/cholmod_ssmult.c", 224, "problem too large", Common) ;
 cholmod_free_sparse (&A2, Common) ;
 cholmod_free_sparse (&B2, Common) ;
 ;
 return (((void *)0)) ;
    }
    do_swap_and_transpose = 0 ;
    if (sorted)
    {
 anz = cholmod_nnz (A, Common) ;
 bnz = cholmod_nnz (B, Common) ;
 do_swap_and_transpose = (anz + bnz < cnz) ;
 if (do_swap_and_transpose)
 {
     A3 = cholmod_ptranspose (A, values, ((void *)0), ((void *)0), 0, Common) ;
     cholmod_free_sparse (&A2, Common) ;
     A2 = A3 ;
     if (Common->status < 0)
     {
  cholmod_free_sparse (&A2, Common) ;
  cholmod_free_sparse (&B2, Common) ;
  ;
  return (((void *)0)) ;
     }
     B3 = cholmod_ptranspose (B, values, ((void *)0), ((void *)0), 0, Common) ;
     cholmod_free_sparse (&B2, Common) ;
     B2 = B3 ;
     if (Common->status < 0)
     {
  cholmod_free_sparse (&A2, Common) ;
  cholmod_free_sparse (&B2, Common) ;
  ;
  return (((void *)0)) ;
     }
     A = B2 ;
     B = A2 ;
     Ap = A->p ;
     Anz = A->nz ;
     Ai = A->i ;
     Ax = A->x ;
     apacked = A->packed ;
     Bp = B->p ;
     Bnz = B->nz ;
     Bi = B->i ;
     Bx = B->x ;
     bpacked = B->packed ;
     nrow = A->nrow ;
     ncol = B->ncol ;
 }
    }
    C = cholmod_allocate_sparse (nrow, ncol, cnz, 0, 1, 0,
     values ? A->xtype : 0, Common) ;
    if (Common->status < 0)
    {
 cholmod_free_sparse (&A2, Common) ;
 cholmod_free_sparse (&B2, Common) ;
 ;
 return (((void *)0)) ;
    }
    Cp = C->p ;
    Ci = C->i ;
    Cx = C->x ;
    cnz = 0 ;
    if (values)
    {
 for (j = 0 ; j < ncol ; j++)
 {
     { Common->mark++ ; if (Common->mark <= 0) { Common->mark = (-1) ; cholmod_clear_flag (Common) ; } } ;
     mark = Common->mark ;
     Cp [j] = cnz ;
     pb = Bp [j] ;
     pbend = (bpacked) ? (Bp [j+1]) : (pb + Bnz [j]) ;
     for ( ; pb < pbend ; pb++)
     {
  t = Bi [pb] ;
  bjt = Bx [pb] ;
  pa = Ap [t] ;
  paend = (apacked) ? (Ap [t+1]) : (pa + Anz [t]) ;
  for ( ; pa < paend ; pa++)
  {
      i = Ai [pa] ;
      if (Flag [i] != mark)
      {
   Flag [i] = mark ;
   Ci [cnz++] = i ;
      }
      W [i] += Ax [pa] * bjt ;
  }
     }
     for (p = Cp [j] ; p < cnz ; p++)
     {
  i = Ci [p] ;
  Cx [p] = W [i] ;
  W [i] = 0 ;
     }
 }
    }
    else
    {
 for (j = 0 ; j < ncol ; j++)
 {
     { Common->mark++ ; if (Common->mark <= 0) { Common->mark = (-1) ; cholmod_clear_flag (Common) ; } } ;
     mark = Common->mark ;
     Cp [j] = cnz ;
     pb = Bp [j] ;
     pbend = (bpacked) ? (Bp [j+1]) : (pb + Bnz [j]) ;
     for ( ; pb < pbend ; pb++)
     {
  t = Bi [pb] ;
  pa = Ap [t] ;
  paend = (apacked) ? (Ap [t+1]) : (pa + Anz [t]) ;
  for ( ; pa < paend ; pa++)
  {
      i = Ai [pa] ;
      if (Flag [i] != mark)
      {
   Flag [i] = mark ;
   Ci [cnz++] = i ;
      }
  }
     }
 }
    }
    Cp [ncol] = cnz ;
    ;
    cholmod_free_sparse (&A2, Common) ;
    cholmod_free_sparse (&B2, Common) ;
    { Common->mark++ ; if (Common->mark <= 0) { Common->mark = (-1) ; cholmod_clear_flag (Common) ; } } ;
    ;
    if (stype > 0)
    {
 (void) cholmod_band_inplace (0, ncol, values, C, Common) ;
 C->stype = 1 ;
    }
    else if (stype < 0)
    {
 (void) cholmod_band_inplace (-nrow, 0, values, C, Common) ;
 C->stype = -1 ;
    }
    ;
    if (sorted)
    {
 if (do_swap_and_transpose)
 {
     C2 = cholmod_ptranspose (C, values, ((void *)0), ((void *)0), 0, Common) ;
     cholmod_free_sparse (&C, Common) ;
     if (Common->status < 0)
     {
  ;
  return (((void *)0)) ;
     }
     C = C2 ;
 }
 else
 {
     if (!cholmod_sort (C, Common))
     {
  cholmod_free_sparse (&C, Common) ;
  ;
  return (((void *)0)) ;
     }
 }
    }
    ;
    ;
    return (C) ;
}

canonical_original_code:
struct cholmod_sparse_struct *cholmod_ssmult(struct cholmod_sparse_struct *A, struct cholmod_sparse_struct *B, int stype, int values, int sorted, struct cholmod_common_struct *Common)
{
    double bjt;
    double *Ax; double *Bx; double *Cx; double *W;
    int *Ap; int *Anz; int *Ai; int *Bp; int *Bnz; int *Bi; int *Cp; int *Ci; int *Flag;
    struct cholmod_sparse_struct *C; struct cholmod_sparse_struct *A2; struct cholmod_sparse_struct *B2; struct cholmod_sparse_struct *A3; struct cholmod_sparse_struct *B3; struct cholmod_sparse_struct *C2;
    int apacked; int bpacked; int j; int i; int pa; int paend; int pb; int pbend; int ncol; int mark; int cnz; int t; int p; int nrow; int anz; int bnz; int do_swap_and_transpose; int n1; int n2;
    { if (Common == ((void *)0)) { return (((void *)0)) ; } if (Common->itype != 0 || Common->dtype != 0) { Common->status = (-4) ; return (((void *)0)) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_ssmult.c", 71, "argument missing", Common) ; } return (((void *)0)) ; } } ;
    { if ((B) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_ssmult.c", 72, "argument missing", Common) ; } return (((void *)0)) ; } } ;
    values = values &&
 (A->xtype != 0) && (B->xtype != 0) ;
    { if ((A)->xtype < (0) || (A)->xtype > (values ? 1 : 3) || ((A)->xtype != 0 && ((A)->x) == ((void *)0)) || ((A)->xtype == 3 && ((A)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_ssmult.c", 75, "invalid xtype", Common) ; } return (((void *)0)) ; } } ;
    { if ((B)->xtype < (0) || (B)->xtype > (values ? 1 : 3) || ((B)->xtype != 0 && ((B)->x) == ((void *)0)) || ((B)->xtype == 3 && ((B)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_ssmult.c", 77, "invalid xtype", Common) ; } return (((void *)0)) ; } } ;
    if (A->ncol != B->nrow)
    {
 cholmod_error ((-4), "../MatrixOps/cholmod_ssmult.c", 82, "A and B inner dimensions must match", Common) ;
 return (((void *)0)) ;
    }
    Common->status = 0 ;
    if (A->nrow <= 1)
    {
 sorted = 0 ;
    }
    if (sorted)
    {
 n1 = (((A->nrow) > (B->ncol)) ? (A->nrow) : (B->ncol)) ;
    }
    else
    {
 n1 = A->nrow ;
    }
    n2 = (((A->ncol) > (A->nrow)) ? ((((A->ncol) > (B->nrow)) ? ((((A->ncol) > (B->ncol)) ? (A->ncol) : (B->ncol))) : ((((B->nrow) > (B->ncol)) ? (B->nrow) : (B->ncol))))) : ((((A->nrow) > (B->nrow)) ? ((((A->nrow) > (B->ncol)) ? (A->nrow) : (B->ncol))) : ((((B->nrow) > (B->ncol)) ? (B->nrow) : (B->ncol)))))) ;
    cholmod_allocate_work (n1, n2, values ? n1 : 0, Common) ;
    if (Common->status < 0)
    {
 return (((void *)0)) ;
    }
    ;
    A2 = ((void *)0) ;
    B2 = ((void *)0) ;
    if (A->stype)
    {
 A2 = cholmod_copy (A, 0, values, Common) ;
 if (Common->status < 0)
 {
     ;
     return (((void *)0)) ;
 }
 A = A2 ;
    }
    if (B->stype)
    {
 B2 = cholmod_copy (B, 0, values, Common) ;
 if (Common->status < 0)
 {
     cholmod_free_sparse (&A2, Common) ;
     ;
     return (((void *)0)) ;
 }
 B = B2 ;
    }
    ;
    ;
    Ap = A->p ;
    Anz = A->nz ;
    Ai = A->i ;
    Ax = A->x ;
    apacked = A->packed ;
    Bp = B->p ;
    Bnz = B->nz ;
    Bi = B->i ;
    Bx = B->x ;
    bpacked = B->packed ;
    nrow = A->nrow ;
    ncol = B->ncol ;
    W = Common->Xwork ;
    Flag = Common->Flag ;
    cnz = 0 ;
    for (j = 0 ; j < ncol ; j++)
    {
 { Common->mark++ ; if (Common->mark <= 0) { Common->mark = (-1) ; cholmod_clear_flag (Common) ; } } ;
 mark = Common->mark ;
 pb = Bp [j] ;
 pbend = (bpacked) ? (Bp [j+1]) : (pb + Bnz [j]) ;
 for ( ; pb < pbend ; pb++)
 {
     t = Bi [pb] ;
     pa = Ap [t] ;
     paend = (apacked) ? (Ap [t+1]) : (pa + Anz [t]) ;
     for ( ; pa < paend ; pa++)
     {
  i = Ai [pa] ;
  if (Flag [i] != mark)
  {
      Flag [i] = mark ;
      cnz++ ;
  }
     }
 }
 if (cnz < 0)
 {
     break ;
 }
    }
    { Common->mark++ ; if (Common->mark <= 0) { Common->mark = (-1) ; cholmod_clear_flag (Common) ; } } ;
    mark = Common->mark ;
    if (cnz < 0)
    {
 cholmod_error ((-3), "../MatrixOps/cholmod_ssmult.c", 224, "problem too large", Common) ;
 cholmod_free_sparse (&A2, Common) ;
 cholmod_free_sparse (&B2, Common) ;
 ;
 return (((void *)0)) ;
    }
    do_swap_and_transpose = 0 ;
    if (sorted)
    {
 anz = cholmod_nnz (A, Common) ;
 bnz = cholmod_nnz (B, Common) ;
 do_swap_and_transpose = (anz + bnz < cnz) ;
 if (do_swap_and_transpose)
 {
     A3 = cholmod_ptranspose (A, values, ((void *)0), ((void *)0), 0, Common) ;
     cholmod_free_sparse (&A2, Common) ;
     A2 = A3 ;
     if (Common->status < 0)
     {
  cholmod_free_sparse (&A2, Common) ;
  cholmod_free_sparse (&B2, Common) ;
  ;
  return (((void *)0)) ;
     }
     B3 = cholmod_ptranspose (B, values, ((void *)0), ((void *)0), 0, Common) ;
     cholmod_free_sparse (&B2, Common) ;
     B2 = B3 ;
     if (Common->status < 0)
     {
  cholmod_free_sparse (&A2, Common) ;
  cholmod_free_sparse (&B2, Common) ;
  ;
  return (((void *)0)) ;
     }
     A = B2 ;
     B = A2 ;
     Ap = A->p ;
     Anz = A->nz ;
     Ai = A->i ;
     Ax = A->x ;
     apacked = A->packed ;
     Bp = B->p ;
     Bnz = B->nz ;
     Bi = B->i ;
     Bx = B->x ;
     bpacked = B->packed ;
     nrow = A->nrow ;
     ncol = B->ncol ;
 }
    }
    C = cholmod_allocate_sparse (nrow, ncol, cnz, 0, 1, 0,
     values ? A->xtype : 0, Common) ;
    if (Common->status < 0)
    {
 cholmod_free_sparse (&A2, Common) ;
 cholmod_free_sparse (&B2, Common) ;
 ;
 return (((void *)0)) ;
    }
    Cp = C->p ;
    Ci = C->i ;
    Cx = C->x ;
    cnz = 0 ;
    if (values)
    {
 for (j = 0 ; j < ncol ; j++)
 {
     { Common->mark++ ; if (Common->mark <= 0) { Common->mark = (-1) ; cholmod_clear_flag (Common) ; } } ;
     mark = Common->mark ;
     Cp [j] = cnz ;
     pb = Bp [j] ;
     pbend = (bpacked) ? (Bp [j+1]) : (pb + Bnz [j]) ;
     for ( ; pb < pbend ; pb++)
     {
  t = Bi [pb] ;
  bjt = Bx [pb] ;
  pa = Ap [t] ;
  paend = (apacked) ? (Ap [t+1]) : (pa + Anz [t]) ;
  for ( ; pa < paend ; pa++)
  {
      i = Ai [pa] ;
      if (Flag [i] != mark)
      {
   Flag [i] = mark ;
   Ci [cnz++] = i ;
      }
      W [i] += Ax [pa] * bjt ;
  }
     }
     for (p = Cp [j] ; p < cnz ; p++)
     {
  i = Ci [p] ;
  Cx [p] = W [i] ;
  W [i] = 0 ;
     }
 }
    }
    else
    {
 for (j = 0 ; j < ncol ; j++)
 {
     { Common->mark++ ; if (Common->mark <= 0) { Common->mark = (-1) ; cholmod_clear_flag (Common) ; } } ;
     mark = Common->mark ;
     Cp [j] = cnz ;
     pb = Bp [j] ;
     pbend = (bpacked) ? (Bp [j+1]) : (pb + Bnz [j]) ;
     for ( ; pb < pbend ; pb++)
     {
  t = Bi [pb] ;
  pa = Ap [t] ;
  paend = (apacked) ? (Ap [t+1]) : (pa + Anz [t]) ;
  for ( ; pa < paend ; pa++)
  {
      i = Ai [pa] ;
      if (Flag [i] != mark)
      {
   Flag [i] = mark ;
   Ci [cnz++] = i ;
      }
  }
     }
 }
    }
    Cp [ncol] = cnz ;
    ;
    cholmod_free_sparse (&A2, Common) ;
    cholmod_free_sparse (&B2, Common) ;
    { Common->mark++ ; if (Common->mark <= 0) { Common->mark = (-1) ; cholmod_clear_flag (Common) ; } } ;
    ;
    if (stype > 0)
    {
 (void) cholmod_band_inplace (0, ncol, values, C, Common) ;
 C->stype = 1 ;
    }
    else if (stype < 0)
    {
 (void) cholmod_band_inplace (-nrow, 0, values, C, Common) ;
 C->stype = -1 ;
    }
    ;
    if (sorted)
    {
 if (do_swap_and_transpose)
 {
     C2 = cholmod_ptranspose (C, values, ((void *)0), ((void *)0), 0, Common) ;
     cholmod_free_sparse (&C, Common) ;
     if (Common->status < 0)
     {
  ;
  return (((void *)0)) ;
     }
     C = C2 ;
 }
 else
 {
     if (!cholmod_sort (C, Common))
     {
  cholmod_free_sparse (&C, Common) ;
  ;
  return (((void *)0)) ;
     }
 }
    }
    ;
    ;
    return (C) ;
}

variable_types:
A
struct cholmod_sparse_struct *

variable_types:
B
struct cholmod_sparse_struct *

variable_types: stype int

variable_types: values int

variable_types: sorted 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: bjt double

variable_types:
Ax
double *

variable_types:
Bx
double *

variable_types:
Cx
double *

variable_types:
W
double *

variable_types:
Ap
int *

variable_types:
Anz
int *

variable_types:
Ai
int *

variable_types:
Bp
int *

variable_types:
Bnz
int *

variable_types:
Bi
int *

variable_types:
Cp
int *

variable_types:
Ci
int *

variable_types:
Flag
int *

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: apacked int

variable_types: bpacked int

variable_types: j int

variable_types: i int

variable_types: pa int

variable_types: paend int

variable_types: pb int

variable_types: pbend int

variable_types: ncol int

variable_types: mark int

variable_types: cnz int

variable_types: t int

variable_types: p int

variable_types: nrow int

variable_types: anz int

variable_types: bnz int


decompiled_code:
__int64 __fastcall umf_l_free(__int64 a1)
{
if ( a1 )
amd_free();
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
if ( a1 )
amd_free();
return 0LL;
}

original_code:
void *umf_l_free
(
    void *p
)
{
    ;
    if (p)
    {
 amd_free (p) ;
    }
    return ((void *) ((void *)0)) ;
}

canonical_original_code:
void *umf_l_free(void *p)
{
    ;
    if (p)
    {
 amd_free (p) ;
    }
    return ((void *) ((void *)0)) ;
}

variable_types:
p
void *

return_type: void *


original_code:
long umfdl_triplet_nomap_nox
(
    long n_row,
    long n_col,
    long nz,
    const long Ti [ ],
    const long Tj [ ],
    long Ap [ ],
    long Ai [ ],
    long Rp [ ],
    long Rj [ ],
    long W [ ],
    long RowCount [ ]
)
{
    long 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:
long umfdl_triplet_nomap_nox(long n_row, long n_col, long nz, long Ti[], long Tj[], long Ap[], long Ai[], long Rp[], long Rj[], long W[], long RowCount[])
{
    long i; long j; long k; long p; long cp; long p1; long p2; long pdest; long 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 long

variable_types:
Ti
long []

variable_types:
Tj
long []

variable_types:
Ap
long []

variable_types:
Ai
long []

variable_types:
Rp
long []

variable_types:
Rj
long []

variable_types:
W
long []

variable_types:
RowCount
long []

variable_types: i long

variable_types: j long

variable_types: k long

variable_types: p long

variable_types: cp long

variable_types: pdest long

variable_types: pj long


original_code:
long umfzl_mem_alloc_tail_block
(
    NumericType *Numeric,
    long nunits
)
{
    long bigsize, usage ;
    Unit *p, *pnext, *pbig ;
    ;
    ;
    bigsize = 0 ;
    pbig = (Unit *) ((void *)0) ;
    ;
    if (Numeric->ibig != (-1))
    {
 ;
 ;
 pbig = Numeric->Memory + Numeric->ibig ;
 bigsize = -pbig->header.size ;
 ;
 ;
    }
    if (pbig && bigsize >= nunits)
    {
 p = pbig ;
 pnext = p + 1 + bigsize ;
 ;
 ;
 ;
 bigsize -= nunits + 1 ;
 if (bigsize < 4)
 {
     p->header.size = -p->header.size ;
     ;
     Numeric->ibig = (-1) ;
 }
 else
 {
     p->header.size = nunits ;
     Numeric->ibig += nunits + 1 ;
     pbig = Numeric->Memory + Numeric->ibig ;
     pbig->header.size = -bigsize ;
     pbig->header.prevsize = nunits ;
     pnext->header.prevsize = bigsize ;
     ;
 }
    }
    else
    {
 pnext = Numeric->Memory + Numeric->itail ;
 ;
 if ((nunits + 1) > (Numeric->itail - Numeric->ihead))
 {
     ;
     return (0) ;
 }
 Numeric->itail -= (nunits + 1) ;
 p = Numeric->Memory + Numeric->itail ;
 p->header.size = nunits ;
 p->header.prevsize = 0 ;
 pnext->header.prevsize = nunits ;
 ;
    }
    Numeric->tail_usage += p->header.size + 1 ;
    usage = Numeric->ihead + Numeric->tail_usage ;
    Numeric->max_usage = (((Numeric->max_usage) > (usage)) ? (Numeric->max_usage) : (usage)) ;
    return ((p - Numeric->Memory) + 1) ;
}

canonical_original_code:
long umfzl_mem_alloc_tail_block(struct NumericType *Numeric, long nunits)
{
    long bigsize; long usage;
    union Unit_union *p; union Unit_union *pnext; union Unit_union *pbig;
    ;
    ;
    bigsize = 0 ;
    pbig = (union Unit_union *) ((void *)0) ;
    ;
    if (Numeric->ibig != (-1))
    {
 ;
 ;
 pbig = Numeric->Memory + Numeric->ibig ;
 bigsize = -pbig->header.size ;
 ;
 ;
    }
    if (pbig && bigsize >= nunits)
    {
 p = pbig ;
 pnext = p + 1 + bigsize ;
 ;
 ;
 ;
 bigsize -= nunits + 1 ;
 if (bigsize < 4)
 {
     p->header.size = -p->header.size ;
     ;
     Numeric->ibig = (-1) ;
 }
 else
 {
     p->header.size = nunits ;
     Numeric->ibig += nunits + 1 ;
     pbig = Numeric->Memory + Numeric->ibig ;
     pbig->header.size = -bigsize ;
     pbig->header.prevsize = nunits ;
     pnext->header.prevsize = bigsize ;
     ;
 }
    }
    else
    {
 pnext = Numeric->Memory + Numeric->itail ;
 ;
 if ((nunits + 1) > (Numeric->itail - Numeric->ihead))
 {
     ;
     return (0) ;
 }
 Numeric->itail -= (nunits + 1) ;
 p = Numeric->Memory + Numeric->itail ;
 p->header.size = nunits ;
 p->header.prevsize = 0 ;
 pnext->header.prevsize = nunits ;
 ;
    }
    Numeric->tail_usage += p->header.size + 1 ;
    usage = Numeric->ihead + Numeric->tail_usage ;
    Numeric->max_usage = (((Numeric->max_usage) > (usage)) ? (Numeric->max_usage) : (usage)) ;
    return ((p - Numeric->Memory) + 1) ;
}

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: nunits long

variable_types: bigsize long

variable_types: usage 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:
int cholmod_scale
(
    cholmod_dense *S,
    int scale,
    cholmod_sparse *A,
    cholmod_common *Common
)
{
    double t ;
    double *Ax, *s ;
    int *Ap, *Anz, *Ai ;
    int packed, j, ncol, nrow, p, pend, sncol, snrow, nn, ok ;
    { if (Common == ((void *)0)) { return (0) ; } if (Common->itype != 0 || Common->dtype != 0) { Common->status = (-4) ; return (0) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 85, "argument missing", Common) ; } return (0) ; } } ;
    { if ((S) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 86, "argument missing", Common) ; } return (0) ; } } ;
    { if ((A)->xtype < (1) || (A)->xtype > (1) || ((A)->xtype != 0 && ((A)->x) == ((void *)0)) || ((A)->xtype == 3 && ((A)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 87, "invalid xtype", Common) ; } return (0) ; } } ;
    { if ((S)->xtype < (1) || (S)->xtype > (1) || ((S)->xtype != 0 && ((S)->x) == ((void *)0)) || ((S)->xtype == 3 && ((S)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 88, "invalid xtype", Common) ; } return (0) ; } } ;
    ncol = A->ncol ;
    nrow = A->nrow ;
    sncol = S->ncol ;
    snrow = S->nrow ;
    if (scale == 0)
    {
 ok = (snrow == 1 && sncol == 1) ;
    }
    else if (scale == 1)
    {
 ok = (snrow == nrow && sncol == 1) || (snrow == 1 && sncol == nrow) ;
    }
    else if (scale == 2)
    {
 ok = (snrow == ncol && sncol == 1) || (snrow == 1 && sncol == ncol) ;
    }
    else if (scale == 3)
    {
 nn = (((nrow) > (ncol)) ? (nrow) : (ncol)) ;
 ok = (snrow == nn && sncol == 1) || (snrow == 1 && sncol == nn) ;
    }
    else
    {
 cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 113, "invalid scaling option", Common) ;
 return (0) ;
    }
    if (!ok)
    {
 cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 119, "invalid scale factors", Common) ;
 return (0) ;
    }
    Common->status = 0 ;
    Ap = A->p ;
    Anz = A->nz ;
    Ai = A->i ;
    Ax = A->x ;
    packed = A->packed ;
    s = S->x ;
    if (scale == 1)
    {
 for (j = 0 ; j < ncol ; j++)
 {
     p = Ap [j] ;
     pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
     for ( ; p < pend ; p++)
     {
  Ax [p] *= s [Ai [p]] ;
     }
 }
    }
    else if (scale == 2)
    {
 for (j = 0 ; j < ncol ; j++)
 {
     t = s [j] ;
     p = Ap [j] ;
     pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
     for ( ; p < pend ; p++)
     {
  Ax [p] *= t ;
     }
 }
    }
    else if (scale == 3)
    {
 for (j = 0 ; j < ncol ; j++)
 {
     t = s [j] ;
     p = Ap [j] ;
     pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
     for ( ; p < pend ; p++)
     {
  Ax [p] *= t * s [Ai [p]] ;
     }
 }
    }
    else if (scale == 0)
    {
 t = s [0] ;
 for (j = 0 ; j < ncol ; j++)
 {
     p = Ap [j] ;
     pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
     for ( ; p < pend ; p++)
     {
  Ax [p] *= t ;
     }
 }
    }
    ;
    return (1) ;
}

canonical_original_code:
int cholmod_scale(struct cholmod_dense_struct *S, int scale, struct cholmod_sparse_struct *A, struct cholmod_common_struct *Common)
{
    double t;
    double *Ax; double *s;
    int *Ap; int *Anz; int *Ai;
    int packed; int j; int ncol; int nrow; int p; int pend; int sncol; int snrow; int nn; int ok;
    { if (Common == ((void *)0)) { return (0) ; } if (Common->itype != 0 || Common->dtype != 0) { Common->status = (-4) ; return (0) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 85, "argument missing", Common) ; } return (0) ; } } ;
    { if ((S) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 86, "argument missing", Common) ; } return (0) ; } } ;
    { if ((A)->xtype < (1) || (A)->xtype > (1) || ((A)->xtype != 0 && ((A)->x) == ((void *)0)) || ((A)->xtype == 3 && ((A)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 87, "invalid xtype", Common) ; } return (0) ; } } ;
    { if ((S)->xtype < (1) || (S)->xtype > (1) || ((S)->xtype != 0 && ((S)->x) == ((void *)0)) || ((S)->xtype == 3 && ((S)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 88, "invalid xtype", Common) ; } return (0) ; } } ;
    ncol = A->ncol ;
    nrow = A->nrow ;
    sncol = S->ncol ;
    snrow = S->nrow ;
    if (scale == 0)
    {
 ok = (snrow == 1 && sncol == 1) ;
    }
    else if (scale == 1)
    {
 ok = (snrow == nrow && sncol == 1) || (snrow == 1 && sncol == nrow) ;
    }
    else if (scale == 2)
    {
 ok = (snrow == ncol && sncol == 1) || (snrow == 1 && sncol == ncol) ;
    }
    else if (scale == 3)
    {
 nn = (((nrow) > (ncol)) ? (nrow) : (ncol)) ;
 ok = (snrow == nn && sncol == 1) || (snrow == 1 && sncol == nn) ;
    }
    else
    {
 cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 113, "invalid scaling option", Common) ;
 return (0) ;
    }
    if (!ok)
    {
 cholmod_error ((-4), "../MatrixOps/cholmod_scale.c", 119, "invalid scale factors", Common) ;
 return (0) ;
    }
    Common->status = 0 ;
    Ap = A->p ;
    Anz = A->nz ;
    Ai = A->i ;
    Ax = A->x ;
    packed = A->packed ;
    s = S->x ;
    if (scale == 1)
    {
 for (j = 0 ; j < ncol ; j++)
 {
     p = Ap [j] ;
     pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
     for ( ; p < pend ; p++)
     {
  Ax [p] *= s [Ai [p]] ;
     }
 }
    }
    else if (scale == 2)
    {
 for (j = 0 ; j < ncol ; j++)
 {
     t = s [j] ;
     p = Ap [j] ;
     pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
     for ( ; p < pend ; p++)
     {
  Ax [p] *= t ;
     }
 }
    }
    else if (scale == 3)
    {
 for (j = 0 ; j < ncol ; j++)
 {
     t = s [j] ;
     p = Ap [j] ;
     pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
     for ( ; p < pend ; p++)
     {
  Ax [p] *= t * s [Ai [p]] ;
     }
 }
    }
    else if (scale == 0)
    {
 t = s [0] ;
 for (j = 0 ; j < ncol ; j++)
 {
     p = Ap [j] ;
     pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
     for ( ; p < pend ; p++)
     {
  Ax [p] *= t ;
     }
 }
    }
    ;
    return (1) ;
}

variable_types: struct cholmod_dense_struct { unsigned long nrow; unsigned long ncol; unsigned long nzmax; unsigned long d; void *x; void *z; int xtype; int dtype; } *

variable_types: scale int

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: 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: t double

variable_types:
Ax
double *

variable_types:
s
double *

variable_types:
Ap
int *

variable_types:
Anz
int *

variable_types:
Ai
int *

variable_types: packed int

variable_types: j int

variable_types: ncol int

variable_types: nrow int

variable_types: p int

variable_types: pend int

variable_types: sncol int

variable_types: snrow int

variable_types: nn int

variable_types: ok int

return_type: int


original_code:
long umfzl_triplet_map_x
(
    long n_row,
    long n_col,
    long nz,
    const long Ti [ ],
    const long Tj [ ],
    long Ap [ ],
    long Ai [ ],
    long Rp [ ],
    long Rj [ ],
    long W [ ],
    long RowCount [ ]
    , const double Tx [ ]
    , double Ax [ ]
    , double Rx [ ]
    , const double Tz [ ]
    , double Az [ ]
    , double Rz [ ]
    , long Map [ ]
    , long Map2 [ ]
)
{
    long i, j, k, p, cp, p1, p2, pdest, pj ;
    long duplicates ;
    long split = ((Tz) != (double *) ((void *)0)) && ((Az) != (double *) ((void *)0)) && ((Rz) != (double *) ((void *)0)) ;
    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]]++ ;
 Map [k] = p ;
 Rj [p] = Tj [k] ;
 if (split)
 {
     Rx [p] = Tx [k] ;
     Rz [p] = Tz [k] ;
 }
 else
 {
     Rx [2*p ] = Tx [2*k ] ;
     Rx [2*p+1] = Tx [2*k+1] ;
 }
    }
    for (j = 0 ; j < n_col ; j++)
    {
 W [j] = (-1) ;
    }
    duplicates = (0) ;
    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)
     {
  ;
  ;
  Map2 [p] = pj ;
  duplicates = (1) ;
  if (split)
  {
      Rx [pj] += Rx [p] ;
      Rz [pj] += Rz [p] ;
  }
  else
  {
      Rx[2*pj ] += Rx[2*p ] ;
      Rx[2*pj+1] += Rx[2*p+1] ;
  }
     }
     else
     {
  W [j] = pdest ;
  Map2 [p] = pdest ;
  if (pdest != p)
  {
      Rj [pdest] = j ;
      if (split)
      {
   Rx [pdest] = Rx [p] ;
   Rz [pdest] = Rz [p] ;
      }
      else
      {
   Rx [2*pdest ] = Rx [2*p ] ;
   Rx [2*pdest+1] = Rx [2*p+1] ;
      }
  }
  pdest++ ;
     }
 }
 RowCount [i] = pdest - p1 ;
    }
    if (duplicates)
    {
 for (k = 0 ; k < nz ; k++)
 {
     Map [k] = Map2 [Map [k]] ;
 }
    }
    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]]++ ;
     Map2 [p] = cp ;
     Ai [cp] = i ;
     if (split)
     {
  Ax [cp] = Rx [p] ;
  Az [cp] = Rz [p] ;
     }
     else
     {
  Ax [2*cp ] = Rx [2*p ] ;
  Ax [2*cp+1] = Rx [2*p+1] ;
     }
 }
    }
    for (k = 0 ; k < nz ; k++)
    {
 Map [k] = Map2 [Map [k]] ;
    }
    return ((0)) ;
}

canonical_original_code:
long umfzl_triplet_map_x(long n_row, long n_col, long nz, long Ti[], long Tj[], long Ap[], long Ai[], long Rp[], long Rj[], long W[], long RowCount[], double Tx[], double Ax[], double Rx[], double Tz[], double Az[], double Rz[], long Map[], long Map2[])
{
    long i; long j; long k; long p; long cp; long p1; long p2; long pdest; long pj;
    long duplicates;
    long split = ((Tz) != (double *) ((void *)0)) && ((Az) != (double *) ((void *)0)) && ((Rz) != (double *) ((void *)0));
    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]]++ ;
 Map [k] = p ;
 Rj [p] = Tj [k] ;
 if (split)
 {
     Rx [p] = Tx [k] ;
     Rz [p] = Tz [k] ;
 }
 else
 {
     Rx [2*p ] = Tx [2*k ] ;
     Rx [2*p+1] = Tx [2*k+1] ;
 }
    }
    for (j = 0 ; j < n_col ; j++)
    {
 W [j] = (-1) ;
    }
    duplicates = (0) ;
    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)
     {
  ;
  ;
  Map2 [p] = pj ;
  duplicates = (1) ;
  if (split)
  {
      Rx [pj] += Rx [p] ;
      Rz [pj] += Rz [p] ;
  }
  else
  {
      Rx[2*pj ] += Rx[2*p ] ;
      Rx[2*pj+1] += Rx[2*p+1] ;
  }
     }
     else
     {
  W [j] = pdest ;
  Map2 [p] = pdest ;
  if (pdest != p)
  {
      Rj [pdest] = j ;
      if (split)
      {
   Rx [pdest] = Rx [p] ;
   Rz [pdest] = Rz [p] ;
      }
      else
      {
   Rx [2*pdest ] = Rx [2*p ] ;
   Rx [2*pdest+1] = Rx [2*p+1] ;
      }
  }
  pdest++ ;
     }
 }
 RowCount [i] = pdest - p1 ;
    }
    if (duplicates)
    {
 for (k = 0 ; k < nz ; k++)
 {
     Map [k] = Map2 [Map [k]] ;
 }
    }
    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]]++ ;
     Map2 [p] = cp ;
     Ai [cp] = i ;
     if (split)
     {
  Ax [cp] = Rx [p] ;
  Az [cp] = Rz [p] ;
     }
     else
     {
  Ax [2*cp ] = Rx [2*p ] ;
  Ax [2*cp+1] = Rx [2*p+1] ;
     }
 }
    }
    for (k = 0 ; k < nz ; k++)
    {
 Map [k] = Map2 [Map [k]] ;
    }
    return ((0)) ;
}

variable_types: nz long

variable_types:
Ti
long []

variable_types:
Tj
long []

variable_types:
Ap
long []

variable_types:
Ai
long []

variable_types:
Rp
long []

variable_types:
Rj
long []

variable_types:
W
long []

variable_types:
RowCount
long []

variable_types:
Tx
double []

variable_types:
Ax
double []

variable_types:
Rx
double []

variable_types:
Tz
double []

variable_types:
Az
double []

variable_types:
Rz
double []

variable_types:
Map
long []

variable_types: i long

variable_types: j long

variable_types: k long

variable_types: p long

variable_types: cp long

variable_types: pdest long

variable_types: pj long

variable_types: duplicates long

variable_types: split long


original_code:
long cholmod_postorder
(
    int *Parent,
    size_t n,
    int *Weight,
    int *Post,
    cholmod_common *Common
)
{
    int *Head, *Next, *Pstack, *Iwork ;
    int j, p, k, w, nextj ;
    size_t s ;
    int ok = 1 ;
    { if (Common == ((void *)0)) { return ((-1)) ; } if (Common->itype != 0 || Common->dtype != 0) { Common->status = (-4) ; return ((-1)) ; } } ;
    { if ((Parent) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../Cholesky/cholmod_postorder.c", 163, "argument missing", Common) ; } return ((-1)) ; } } ;
    { if ((Post) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../Cholesky/cholmod_postorder.c", 164, "argument missing", Common) ; } return ((-1)) ; } } ;
    Common->status = 0 ;
    s = cholmod_mult_size_t (n, 2, &ok) ;
    if (!ok)
    {
 cholmod_error ((-3), "../Cholesky/cholmod_postorder.c", 175, "problem too large", Common) ;
 return ((-1)) ;
    }
    cholmod_allocate_work (n, s, 0, Common) ;
    if (Common->status < 0)
    {
 return ((-1)) ;
    }
    ;
    Head = Common->Head ;
    Iwork = Common->Iwork ;
    Next = Iwork ;
    Pstack = Iwork + n ;
    if (Weight == ((void *)0))
    {
 for (j = n-1 ; j >= 0 ; j--)
 {
     p = Parent [j] ;
     if (p >= 0 && p < ((int) n))
     {
  Next [j] = Head [p] ;
  Head [p] = j ;
     }
 }
    }
    else
    {
 int *Whead = Pstack ;
 for (w = 0 ; w < ((int) n) ; w++)
 {
     Whead [w] = (-1) ;
 }
 for (j = 0 ; j < ((int) n) ; j++)
 {
     p = Parent [j] ;
     if (p >= 0 && p < ((int) n))
     {
  w = Weight [j] ;
  w = (((0) > (w)) ? (0) : (w)) ;
  w = (((w) < (((int) n) - 1)) ? (w) : (((int) n) - 1)) ;
  Next [j] = Whead [w] ;
  Whead [w] = j ;
     }
 }
 for (w = n-1 ; w >= 0 ; w--)
 {
     for (j = Whead [w] ; j != (-1) ; j = nextj)
     {
  nextj = Next [j] ;
  p = Parent [j] ;
  ;
  Next [j] = Head [p] ;
  Head [p] = j ;
     }
 }
    }
    k = 0 ;
    for (j = 0 ; j < ((int) n) ; j++)
    {
 if (Parent [j] == (-1))
 {
     k = dfs (j, k, Post, Head, Next, Pstack) ;
 }
    }
    for (j = 0 ; j < ((int) n) ; j++)
    {
 Head [j] = (-1) ;
    }
    ;
    ;
    return (k) ;
}

canonical_original_code:
long cholmod_postorder(int *Parent, unsigned long n, int *Weight, int *Post, struct cholmod_common_struct *Common)
{
    int *Head; int *Next; int *Pstack; int *Iwork;
    int j; int p; int k; int w; int nextj;
    unsigned long s;
    int ok = 1;
    { if (Common == ((void *)0)) { return ((-1)) ; } if (Common->itype != 0 || Common->dtype != 0) { Common->status = (-4) ; return ((-1)) ; } } ;
    { if ((Parent) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../Cholesky/cholmod_postorder.c", 163, "argument missing", Common) ; } return ((-1)) ; } } ;
    { if ((Post) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../Cholesky/cholmod_postorder.c", 164, "argument missing", Common) ; } return ((-1)) ; } } ;
    Common->status = 0 ;
    s = cholmod_mult_size_t (n, 2, &ok) ;
    if (!ok)
    {
 cholmod_error ((-3), "../Cholesky/cholmod_postorder.c", 175, "problem too large", Common) ;
 return ((-1)) ;
    }
    cholmod_allocate_work (n, s, 0, Common) ;
    if (Common->status < 0)
    {
 return ((-1)) ;
    }
    ;
    Head = Common->Head ;
    Iwork = Common->Iwork ;
    Next = Iwork ;
    Pstack = Iwork + n ;
    if (Weight == ((void *)0))
    {
 for (j = n-1 ; j >= 0 ; j--)
 {
     p = Parent [j] ;
     if (p >= 0 && p < ((int) n))
     {
  Next [j] = Head [p] ;
  Head [p] = j ;
     }
 }
    }
    else
    {
 int *Whead = Pstack;
 for (w = 0 ; w < ((int) n) ; w++)
 {
     Whead [w] = (-1) ;
 }
 for (j = 0 ; j < ((int) n) ; j++)
 {
     p = Parent [j] ;
     if (p >= 0 && p < ((int) n))
     {
  w = Weight [j] ;
  w = (((0) > (w)) ? (0) : (w)) ;
  w = (((w) < (((int) n) - 1)) ? (w) : (((int) n) - 1)) ;
  Next [j] = Whead [w] ;
  Whead [w] = j ;
     }
 }
 for (w = n-1 ; w >= 0 ; w--)
 {
     for (j = Whead [w] ; j != (-1) ; j = nextj)
     {
  nextj = Next [j] ;
  p = Parent [j] ;
  ;
  Next [j] = Head [p] ;
  Head [p] = j ;
     }
 }
    }
    k = 0 ;
    for (j = 0 ; j < ((int) n) ; j++)
    {
 if (Parent [j] == (-1))
 {
     k = dfs (j, k, Post, Head, Next, Pstack) ;
 }
    }
    for (j = 0 ; j < ((int) n) ; j++)
    {
 Head [j] = (-1) ;
    }
    ;
    ;
    return (k) ;
}

variable_types:
Parent
int *

variable_types:
n
unsigned long

variable_types:
Weight
int *

variable_types:
Post
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:
Head
int *

variable_types:
Next
int *

variable_types:
Pstack
int *

variable_types:
Iwork
int *

variable_types: j int

variable_types: p int

variable_types: k int

variable_types: w int

variable_types: nextj int

variable_types:
s
unsigned long

variable_types: ok int

variable_types:
Whead
int *


original_code:
static int dfs
(
    int p,
    int k,
    int Post [ ],
    int Head [ ],
    int Next [ ],
    int Pstack [ ]
)
{
    int j, phead ;
    Pstack [0] = p ;
    phead = 0 ;
    while (phead >= 0)
    {
 p = Pstack [phead] ;
 j = Head [p] ;
 if (j == (-1))
 {
     phead-- ;
     Post [k++] = p ;
 }
 else
 {
     Head [p] = Next [j] ;
     Pstack [++phead] = j ;
 }
    }
    return (k) ;
}

canonical_original_code:
static int dfs(int p, int k, int Post[], int Head[], int Next[], int Pstack[])
{
    int j; int phead;
    Pstack [0] = p ;
    phead = 0 ;
    while (phead >= 0)
    {
 p = Pstack [phead] ;
 j = Head [p] ;
 if (j == (-1))
 {
     phead-- ;
     Post [k++] = p ;
 }
 else
 {
     Head [p] = Next [j] ;
     Pstack [++phead] = j ;
 }
    }
    return (k) ;
}

variable_types:
Post
int []

variable_types:
Head
int []

variable_types:
Next
int []

variable_types:
Pstack
int []

variable_types: phead int


original_code:
int umfdi_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 umfdi_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: i int

variable_types: cp int

variable_types: pdest int

variable_types: pj int


original_code:
int umfzi_transpose
(
    int n_row,
    int n_col,
    const int Ap [ ],
    const int Ai [ ],
    const double Ax [ ],
    const int P [ ],
    const int Q [ ],
    int nq,
    int Rp [ ],
    int Ri [ ],
    double Rx [ ],
    int W [ ],
    int check
    , const double Az [ ]
    , double Rz [ ]
    , int do_conjugate
)
{
    int i, j, k, p, bp, newj, do_values ;
    int split ;
    if (check)
    {
 if (!Ai || !Ap || !Ri || !Rp || !W)
 {
     return ((-5)) ;
 }
 if (n_row <= 0 || n_col <= 0)
 {
     return ((-6)) ;
 }
 if (!umf_i_is_permutation (P, W, n_row, n_row) ||
     !umf_i_is_permutation (Q, W, nq, nq))
 {
     return ((-15)) ;
 }
 if (amd_valid (n_row, n_col, Ap, Ai) != 0)
 {
     return ((-8)) ;
 }
    }
    for (i = 0 ; i < n_row ; i++)
    {
 W [i] = 0 ;
 Rp [i] = 0 ;
    }
    if (Q != (int *) ((void *)0))
    {
 for (newj = 0 ; newj < nq ; newj++)
 {
     j = Q [newj] ;
     ;
     for (p = Ap [j] ; p < Ap [j+1] ; p++)
     {
  i = Ai [p] ;
  ;
  W [i]++ ;
     }
 }
    }
    else
    {
 for (j = 0 ; j < n_col ; j++)
 {
     for (p = Ap [j] ; p < Ap [j+1] ; p++)
     {
  i = Ai [p] ;
  ;
  W [i]++ ;
     }
 }
    }
    if (P != (int *) ((void *)0))
    {
 Rp [0] = 0 ;
 for (k = 0 ; k < n_row ; k++)
 {
     i = P [k] ;
     ;
     Rp [k+1] = Rp [k] + W [i] ;
 }
 for (k = 0 ; k < n_row ; k++)
 {
     i = P [k] ;
     ;
     W [i] = Rp [k] ;
 }
    }
    else
    {
 Rp [0] = 0 ;
 for (i = 0 ; i < n_row ; i++)
 {
     Rp [i+1] = Rp [i] + W [i] ;
 }
 for (i = 0 ; i < n_row ; i++)
 {
     W [i] = Rp [i] ;
 }
    }
    ;
    do_values = Ax && Rx ;
    split = ((Az) != (double *) ((void *)0)) && ((Rz) != (double *) ((void *)0)) ;
    if (do_conjugate && do_values)
    {
 if (Q != (int *) ((void *)0))
 {
     if (split)
     {
  for (newj = 0 ; newj < nq ; newj++)
  {
      j = Q [newj] ;
      ;
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   bp = W [Ai [p]]++ ;
   Ri [bp] = newj ;
   Rx [bp] = Ax [p] ;
   Rz [bp] = -Az [p] ;
      }
  }
     }
     else
     {
  for (newj = 0 ; newj < nq ; newj++)
  {
      j = Q [newj] ;
      ;
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   bp = W [Ai [p]]++ ;
   Ri [bp] = newj ;
   Rx [2*bp] = Ax [2*p] ;
   Rx [2*bp+1] = -Ax [2*p+1] ;
      }
  }
     }
 }
 else
 {
     if (split)
     {
  for (j = 0 ; j < n_col ; j++)
  {
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   bp = W [Ai [p]]++ ;
   Ri [bp] = j ;
   Rx [bp] = Ax [p] ;
   Rz [bp] = -Az [p] ;
      }
  }
     }
     else
     {
  for (j = 0 ; j < n_col ; j++)
  {
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   bp = W [Ai [p]]++ ;
   Ri [bp] = j ;
   Rx [2*bp] = Ax [2*p] ;
   Rx [2*bp+1] = -Ax [2*p+1] ;
      }
  }
     }
 }
    }
    else
    {
 if (Q != (int *) ((void *)0))
 {
     if (do_values)
     {
  if (split)
  {
      for (newj = 0 ; newj < nq ; newj++)
      {
   j = Q [newj] ;
   ;
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = newj ;
       Rx [bp] = Ax [p] ;
       Rz [bp] = Az [p] ;
   }
      }
  }
  else
  {
      for (newj = 0 ; newj < nq ; newj++)
      {
   j = Q [newj] ;
   ;
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = newj ;
       Rx [2*bp] = Ax [2*p] ;
       Rx [2*bp+1] = Ax [2*p+1] ;
   }
      }
  }
     }
     else
     {
  for (newj = 0 ; newj < nq ; newj++)
  {
      j = Q [newj] ;
      ;
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   Ri [W [Ai [p]]++] = newj ;
      }
  }
     }
 }
 else
 {
     if (do_values)
     {
  if (split)
  {
      for (j = 0 ; j < n_col ; j++)
      {
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = j ;
       Rx [bp] = Ax [p] ;
       Rz [bp] = Az [p] ;
   }
      }
  }
  else
  {
      for (j = 0 ; j < n_col ; j++)
      {
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = j ;
       Rx [2*bp] = Ax [2*p] ;
       Rx [2*bp+1] = Ax [2*p+1] ;
   }
      }
  }
     }
     else
     {
  for (j = 0 ; j < n_col ; j++)
  {
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   Ri [W [Ai [p]]++] = j ;
      }
  }
     }
 }
    }
    return ((0)) ;
}

canonical_original_code:
int umfzi_transpose(int n_row, int n_col, int Ap[], int Ai[], double Ax[], int P[], int Q[], int nq, int Rp[], int Ri[], double Rx[], int W[], int check, double Az[], double Rz[], int do_conjugate)
{
    int i; int j; int k; int p; int bp; int newj; int do_values;
    int split;
    if (check)
    {
 if (!Ai || !Ap || !Ri || !Rp || !W)
 {
     return ((-5)) ;
 }
 if (n_row <= 0 || n_col <= 0)
 {
     return ((-6)) ;
 }
 if (!umf_i_is_permutation (P, W, n_row, n_row) ||
     !umf_i_is_permutation (Q, W, nq, nq))
 {
     return ((-15)) ;
 }
 if (amd_valid (n_row, n_col, Ap, Ai) != 0)
 {
     return ((-8)) ;
 }
    }
    for (i = 0 ; i < n_row ; i++)
    {
 W [i] = 0 ;
 Rp [i] = 0 ;
    }
    if (Q != (int *) ((void *)0))
    {
 for (newj = 0 ; newj < nq ; newj++)
 {
     j = Q [newj] ;
     ;
     for (p = Ap [j] ; p < Ap [j+1] ; p++)
     {
  i = Ai [p] ;
  ;
  W [i]++ ;
     }
 }
    }
    else
    {
 for (j = 0 ; j < n_col ; j++)
 {
     for (p = Ap [j] ; p < Ap [j+1] ; p++)
     {
  i = Ai [p] ;
  ;
  W [i]++ ;
     }
 }
    }
    if (P != (int *) ((void *)0))
    {
 Rp [0] = 0 ;
 for (k = 0 ; k < n_row ; k++)
 {
     i = P [k] ;
     ;
     Rp [k+1] = Rp [k] + W [i] ;
 }
 for (k = 0 ; k < n_row ; k++)
 {
     i = P [k] ;
     ;
     W [i] = Rp [k] ;
 }
    }
    else
    {
 Rp [0] = 0 ;
 for (i = 0 ; i < n_row ; i++)
 {
     Rp [i+1] = Rp [i] + W [i] ;
 }
 for (i = 0 ; i < n_row ; i++)
 {
     W [i] = Rp [i] ;
 }
    }
    ;
    do_values = Ax && Rx ;
    split = ((Az) != (double *) ((void *)0)) && ((Rz) != (double *) ((void *)0)) ;
    if (do_conjugate && do_values)
    {
 if (Q != (int *) ((void *)0))
 {
     if (split)
     {
  for (newj = 0 ; newj < nq ; newj++)
  {
      j = Q [newj] ;
      ;
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   bp = W [Ai [p]]++ ;
   Ri [bp] = newj ;
   Rx [bp] = Ax [p] ;
   Rz [bp] = -Az [p] ;
      }
  }
     }
     else
     {
  for (newj = 0 ; newj < nq ; newj++)
  {
      j = Q [newj] ;
      ;
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   bp = W [Ai [p]]++ ;
   Ri [bp] = newj ;
   Rx [2*bp] = Ax [2*p] ;
   Rx [2*bp+1] = -Ax [2*p+1] ;
      }
  }
     }
 }
 else
 {
     if (split)
     {
  for (j = 0 ; j < n_col ; j++)
  {
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   bp = W [Ai [p]]++ ;
   Ri [bp] = j ;
   Rx [bp] = Ax [p] ;
   Rz [bp] = -Az [p] ;
      }
  }
     }
     else
     {
  for (j = 0 ; j < n_col ; j++)
  {
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   bp = W [Ai [p]]++ ;
   Ri [bp] = j ;
   Rx [2*bp] = Ax [2*p] ;
   Rx [2*bp+1] = -Ax [2*p+1] ;
      }
  }
     }
 }
    }
    else
    {
 if (Q != (int *) ((void *)0))
 {
     if (do_values)
     {
  if (split)
  {
      for (newj = 0 ; newj < nq ; newj++)
      {
   j = Q [newj] ;
   ;
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = newj ;
       Rx [bp] = Ax [p] ;
       Rz [bp] = Az [p] ;
   }
      }
  }
  else
  {
      for (newj = 0 ; newj < nq ; newj++)
      {
   j = Q [newj] ;
   ;
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = newj ;
       Rx [2*bp] = Ax [2*p] ;
       Rx [2*bp+1] = Ax [2*p+1] ;
   }
      }
  }
     }
     else
     {
  for (newj = 0 ; newj < nq ; newj++)
  {
      j = Q [newj] ;
      ;
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   Ri [W [Ai [p]]++] = newj ;
      }
  }
     }
 }
 else
 {
     if (do_values)
     {
  if (split)
  {
      for (j = 0 ; j < n_col ; j++)
      {
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = j ;
       Rx [bp] = Ax [p] ;
       Rz [bp] = Az [p] ;
   }
      }
  }
  else
  {
      for (j = 0 ; j < n_col ; j++)
      {
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = j ;
       Rx [2*bp] = Ax [2*p] ;
       Rx [2*bp+1] = Ax [2*p+1] ;
   }
      }
  }
     }
     else
     {
  for (j = 0 ; j < n_col ; j++)
  {
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   Ri [W [Ai [p]]++] = j ;
      }
  }
     }
 }
    }
    return ((0)) ;
}

variable_types:
Ax
double []

variable_types:
P
int []

variable_types:
Q
int []

variable_types: nq int

variable_types:
Ri
int []

variable_types:
Rx
double []

variable_types: check int

variable_types:
Az
double []

variable_types:
Rz
double []

variable_types: j int

variable_types: k int

variable_types: p int

variable_types: bp int

variable_types: newj int

variable_types: split int