original_code:
int umfdi_start_front
(
    int chain,
    NumericType *Numeric,
    WorkType *Work,
    SymbolicType *Symbolic
)
{
    double maxbytes ;
    int fnrows_max, fncols_max, fnr2, fnc2, fsize, fcurr_size, maxfrsize,
 overflow, nb, f, cdeg ;
    nb = Symbolic->nb ;
    fnrows_max = Symbolic->Chain_maxrows [chain] ;
    fncols_max = Symbolic->Chain_maxcols [chain] ;
    ;
    Work->fnrows_max = fnrows_max ;
    Work->fncols_max = fncols_max ;
    Work->any_skip = (0) ;
    maxbytes = sizeof (double) *
 (double) (fnrows_max + nb) * (double) (fncols_max + nb) ;
    fcurr_size = Work->fcurr_size ;
    if (Symbolic->prefer_diagonal)
    {
 int col, tpi, e, *E, *Col_tuples, *Col_tlen, *Cols ;
 Tuple *tp, *tpend ;
 Unit *Memory, *p ;
 Element *ep ;
 E = Work->E ;
 Memory = Numeric->Memory ;
 Col_tuples = Numeric->Lip ;
 Col_tlen = Numeric->Lilen ;
 col = Work->nextcand ;
 tpi = Col_tuples [col] ;
 tp = (Tuple *) Memory + tpi ;
 tpend = tp + Col_tlen [col] ;
 cdeg = 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 = (int *) p ;
     if (Cols [f] == (-1)) continue ;
     ;
     cdeg += ep->nrowsleft ;
 }
 if (Symbolic->amd_dmax > 0)
 {
     cdeg = (((cdeg) < (Symbolic->amd_dmax)) ? (cdeg) : (Symbolic->amd_dmax)) ;
 }
 cdeg += 2 ;
 cdeg = (((cdeg) < (fnrows_max)) ? (cdeg) : (fnrows_max)) ;
    }
    else
    {
 cdeg = 0 ;
    }
    ;
    ;
    ;
    ;
    overflow = ((!((maxbytes) * (1.0+1e-8) <= (double) 0x7fffffff)) || ((maxbytes) != (maxbytes))) ;
    if (overflow)
    {
 maxfrsize = 0x7fffffff / sizeof (double) ;
    }
    else
    {
 maxfrsize = (fnrows_max + nb) * (fncols_max + nb) ;
    }
    ;
    if (Numeric->front_alloc_init < 0)
    {
 fsize = -Numeric->front_alloc_init ;
 fsize = (((1) > (fsize)) ? (1) : (fsize)) ;
    }
    else
    {
 if (((!((Numeric->front_alloc_init * maxbytes) * (1.0+1e-8) <= (double) 0x7fffffff)) || ((Numeric->front_alloc_init * maxbytes) != (Numeric->front_alloc_init * maxbytes))))
 {
     fsize = 0x7fffffff / sizeof (double) ;
 }
 else
 {
     fsize = Numeric->front_alloc_init * maxfrsize ;
 }
 if (cdeg > 0)
 {
     int fsize2 ;
     cdeg += nb ;
     if (((!((((double) cdeg * (double) cdeg) * sizeof (double)) * (1.0+1e-8) <= (double) 0x7fffffff)) || ((((double) cdeg * (double) cdeg) * sizeof (double)) != (((double) cdeg * (double) cdeg) * sizeof (double)))))
     {
  fsize2 = 0x7fffffff / sizeof (double) ;
     }
     else
     {
  fsize2 = (((cdeg * cdeg) > (fcurr_size)) ? (cdeg * cdeg) : (fcurr_size)) ;
     }
     fsize = (((fsize) < (fsize2)) ? (fsize) : (fsize2)) ;
 }
    }
    fsize = (((fsize) > (2*nb*nb)) ? (fsize) : (2*nb*nb)) ;
    ;
    Work->fnrows_new = 0 ;
    Work->fncols_new = 0 ;
    ;
    ;
    if (fsize >= maxfrsize && !overflow)
    {
 fnr2 = fnrows_max + nb ;
 fnc2 = fncols_max + nb ;
 fsize = maxfrsize ;
 ;
    }
    else
    {
 if (fnrows_max <= fncols_max)
 {
     fnr2 = (int) sqrt ((double) fsize) ;
     fnr2 = (((fnr2) > (1)) ? (fnr2) : (1)) ;
     if (fnr2 % 2 == 0) fnr2++ ;
     fnr2 = (((fnr2) < (fnrows_max + nb)) ? (fnr2) : (fnrows_max + nb)) ;
     fnc2 = fsize / fnr2 ;
 }
 else
 {
     fnc2 = (int) sqrt ((double) fsize) ;
     fnc2 = (((fnc2) < (fncols_max + nb)) ? (fnc2) : (fncols_max + nb)) ;
     fnr2 = fsize / fnc2 ;
     fnr2 = (((fnr2) > (1)) ? (fnr2) : (1)) ;
     if (fnr2 % 2 == 0)
     {
  fnr2++ ;
  fnc2 = fsize / fnr2 ;
     }
 }
 ;
    }
    fnr2 = (((fnr2) < (fnrows_max + nb)) ? (fnr2) : (fnrows_max + nb)) ;
    fnc2 = (((fnc2) < (fncols_max + nb)) ? (fnc2) : (fncols_max + nb)) ;
    ;
    ;
    fnr2 -= nb ;
    fnc2 -= nb ;
    ;
    ;
    if (fsize > fcurr_size)
    {
 ;
 Work->do_grow = (1) ;
 if (!umfdi_grow_front (Numeric, fnr2, fnc2, Work, -1))
 {
     ;
     return ((0)) ;
 }
    }
    else
    {
 ;
 Work->fnr_curr = fnr2 ;
 Work->fnc_curr = fnc2 ;
 Work->Flblock = Work->Flublock + nb * nb ;
 Work->Fublock = Work->Flblock + nb * fnr2 ;
 Work->Fcblock = Work->Fublock + nb * fnc2 ;
    }
    ;
    ;
    ;
    return ((1)) ;
}

canonical_original_code:
int umfdi_start_front(int chain, struct NumericType *Numeric, struct WorkType *Work, struct SymbolicType *Symbolic)
{
    double maxbytes;
    int fnrows_max; int fncols_max; int fnr2; int fnc2; int fsize; int fcurr_size; int maxfrsize; int overflow; int nb; int f; int cdeg;
    nb = Symbolic->nb ;
    fnrows_max = Symbolic->Chain_maxrows [chain] ;
    fncols_max = Symbolic->Chain_maxcols [chain] ;
    ;
    Work->fnrows_max = fnrows_max ;
    Work->fncols_max = fncols_max ;
    Work->any_skip = (0) ;
    maxbytes = sizeof (double) *
 (double) (fnrows_max + nb) * (double) (fncols_max + nb) ;
    fcurr_size = Work->fcurr_size ;
    if (Symbolic->prefer_diagonal)
    {
 int col; int tpi; int e; int *E; int *Col_tuples; int *Col_tlen; int *Cols;
 struct Tuple *tp; struct Tuple *tpend;
 union Unit_union *Memory; union Unit_union *p;
 struct Element *ep;
 E = Work->E ;
 Memory = Numeric->Memory ;
 Col_tuples = Numeric->Lip ;
 Col_tlen = Numeric->Lilen ;
 col = Work->nextcand ;
 tpi = Col_tuples [col] ;
 tp = (struct Tuple *) Memory + tpi ;
 tpend = tp + Col_tlen [col] ;
 cdeg = 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 = (int *) p ;
     if (Cols [f] == (-1)) continue ;
     ;
     cdeg += ep->nrowsleft ;
 }
 if (Symbolic->amd_dmax > 0)
 {
     cdeg = (((cdeg) < (Symbolic->amd_dmax)) ? (cdeg) : (Symbolic->amd_dmax)) ;
 }
 cdeg += 2 ;
 cdeg = (((cdeg) < (fnrows_max)) ? (cdeg) : (fnrows_max)) ;
    }
    else
    {
 cdeg = 0 ;
    }
    ;
    ;
    ;
    ;
    overflow = ((!((maxbytes) * (1.0+1e-8) <= (double) 0x7fffffff)) || ((maxbytes) != (maxbytes))) ;
    if (overflow)
    {
 maxfrsize = 0x7fffffff / sizeof (double) ;
    }
    else
    {
 maxfrsize = (fnrows_max + nb) * (fncols_max + nb) ;
    }
    ;
    if (Numeric->front_alloc_init < 0)
    {
 fsize = -Numeric->front_alloc_init ;
 fsize = (((1) > (fsize)) ? (1) : (fsize)) ;
    }
    else
    {
 if (((!((Numeric->front_alloc_init * maxbytes) * (1.0+1e-8) <= (double) 0x7fffffff)) || ((Numeric->front_alloc_init * maxbytes) != (Numeric->front_alloc_init * maxbytes))))
 {
     fsize = 0x7fffffff / sizeof (double) ;
 }
 else
 {
     fsize = Numeric->front_alloc_init * maxfrsize ;
 }
 if (cdeg > 0)
 {
     int fsize2;
     cdeg += nb ;
     if (((!((((double) cdeg * (double) cdeg) * sizeof (double)) * (1.0+1e-8) <= (double) 0x7fffffff)) || ((((double) cdeg * (double) cdeg) * sizeof (double)) != (((double) cdeg * (double) cdeg) * sizeof (double)))))
     {
  fsize2 = 0x7fffffff / sizeof (double) ;
     }
     else
     {
  fsize2 = (((cdeg * cdeg) > (fcurr_size)) ? (cdeg * cdeg) : (fcurr_size)) ;
     }
     fsize = (((fsize) < (fsize2)) ? (fsize) : (fsize2)) ;
 }
    }
    fsize = (((fsize) > (2*nb*nb)) ? (fsize) : (2*nb*nb)) ;
    ;
    Work->fnrows_new = 0 ;
    Work->fncols_new = 0 ;
    ;
    ;
    if (fsize >= maxfrsize && !overflow)
    {
 fnr2 = fnrows_max + nb ;
 fnc2 = fncols_max + nb ;
 fsize = maxfrsize ;
 ;
    }
    else
    {
 if (fnrows_max <= fncols_max)
 {
     fnr2 = (int) sqrt ((double) fsize) ;
     fnr2 = (((fnr2) > (1)) ? (fnr2) : (1)) ;
     if (fnr2 % 2 == 0) fnr2++ ;
     fnr2 = (((fnr2) < (fnrows_max + nb)) ? (fnr2) : (fnrows_max + nb)) ;
     fnc2 = fsize / fnr2 ;
 }
 else
 {
     fnc2 = (int) sqrt ((double) fsize) ;
     fnc2 = (((fnc2) < (fncols_max + nb)) ? (fnc2) : (fncols_max + nb)) ;
     fnr2 = fsize / fnc2 ;
     fnr2 = (((fnr2) > (1)) ? (fnr2) : (1)) ;
     if (fnr2 % 2 == 0)
     {
  fnr2++ ;
  fnc2 = fsize / fnr2 ;
     }
 }
 ;
    }
    fnr2 = (((fnr2) < (fnrows_max + nb)) ? (fnr2) : (fnrows_max + nb)) ;
    fnc2 = (((fnc2) < (fncols_max + nb)) ? (fnc2) : (fncols_max + nb)) ;
    ;
    ;
    fnr2 -= nb ;
    fnc2 -= nb ;
    ;
    ;
    if (fsize > fcurr_size)
    {
 ;
 Work->do_grow = (1) ;
 if (!umfdi_grow_front (Numeric, fnr2, fnc2, Work, -1))
 {
     ;
     return ((0)) ;
 }
    }
    else
    {
 ;
 Work->fnr_curr = fnr2 ;
 Work->fnc_curr = fnc2 ;
 Work->Flblock = Work->Flublock + nb * nb ;
 Work->Fublock = Work->Flblock + nb * fnr2 ;
 Work->Fcblock = Work->Fublock + nb * fnc2 ;
    }
    ;
    ;
    ;
    return ((1)) ;
}

variable_types: chain int

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: struct SymbolicType { double num_mem_usage_est; int valid; } *

variable_types: maxbytes double

variable_types: fsize int

variable_types: maxfrsize int

variable_types: overflow int

variable_types: nb int

variable_types: f int

variable_types: cdeg int

variable_types: col int

variable_types: tpi int

variable_types: e int

variable_types:
E
int *

variable_types:
Cols
int *

variable_types:
tp
struct Tuple { int e; } *

variable_types:
tpend
struct Tuple { int e; } *

variable_types:
ep
struct Element { int cdeg; } *


original_code:
int umfzi_grow_front
(
    NumericType *Numeric,
    int fnr2,
    int fnc2,
    WorkType *Work,
    int do_what
)
{
    double s ;
    DoubleComplex *Fcold, *Fcnew ;
    int j, i, col, *Fcpos, *Fcols, fnrows_max, fncols_max, fnr_curr, nb,
 fnrows_new, fncols_new, fnr_min, fnc_min, minsize,
 newsize, fnrows, fncols, *E, eloc ;
    Fcols = Work->Fcols ;
    Fcpos = Work->Fcpos ;
    E = Work->E ;
    nb = Work->nb ;
    fnrows_max = Work->fnrows_max + nb ;
    fncols_max = Work->fncols_max + nb ;
    ;
    ;
    ;
    ;
    ;
    fnrows_new = Work->fnrows_new + 1 ;
    fncols_new = Work->fncols_new + 1 ;
    ;
    if (fnrows_new % 2 == 0) fnrows_new++ ;
    fnrows_new += nb ;
    fncols_new += nb ;
    fnr_min = (((fnrows_new) < (fnrows_max)) ? (fnrows_new) : (fnrows_max)) ;
    fnc_min = (((fncols_new) < (fncols_max)) ? (fncols_new) : (fncols_max)) ;
    minsize = fnr_min * fnc_min ;
    if (((!(((double) fnr_min * (double) fnc_min * sizeof (DoubleComplex)) * (1.0+1e-8) <= (double) 0x7fffffff)) || (((double) fnr_min * (double) fnc_min * sizeof (DoubleComplex)) != ((double) fnr_min * (double) fnc_min * sizeof (DoubleComplex)))))
    {
 return ((0)) ;
    }
    ;
    ;
    ;
    ;
    fnr2 += nb ;
    fnc2 += nb ;
    ;
    if (fnr2 % 2 == 0) fnr2++ ;
    fnr2 = (((fnr2) > (fnr_min)) ? (fnr2) : (fnr_min)) ;
    fnc2 = (((fnc2) > (fnc_min)) ? (fnc2) : (fnc_min)) ;
    fnr2 = (((fnr2) < (fnrows_max)) ? (fnr2) : (fnrows_max)) ;
    fnc2 = (((fnc2) < (fncols_max)) ? (fnc2) : (fncols_max)) ;
    ;
    ;
    ;
    s = ((double) fnr2) * ((double) fnc2) ;
    if (((!((s * sizeof (DoubleComplex)) * (1.0+1e-8) <= (double) 0x7fffffff)) || ((s * sizeof (DoubleComplex)) != (s * sizeof (DoubleComplex)))))
    {
 double a = 0.9 * sqrt ((0x7fffffff / sizeof (DoubleComplex)) / s) ;
 fnr2 = (((fnr_min) > (a * fnr2)) ? (fnr_min) : (a * fnr2)) ;
 fnc2 = (((fnc_min) > (a * fnc2)) ? (fnc_min) : (a * fnc2)) ;
 newsize = fnr2 * fnc2 ;
 ;
 if (fnr2 % 2 == 0) fnr2++ ;
 fnc2 = newsize / fnr2 ;
    }
    fnr2 = (((fnr2) > (fnr_min)) ? (fnr2) : (fnr_min)) ;
    fnc2 = (((fnc2) > (fnc_min)) ? (fnc2) : (fnc_min)) ;
    newsize = fnr2 * fnc2 ;
    ;
    ;
    ;
    ;
    ;
    if (E [0] && do_what != 1)
    {
 ;
 umfzi_mem_free_tail_block (Numeric, E [0]) ;
 E [0] = 0 ;
 Work->Flublock = (DoubleComplex *) ((void *)0) ;
 Work->Flblock = (DoubleComplex *) ((void *)0) ;
 Work->Fublock = (DoubleComplex *) ((void *)0) ;
 Work->Fcblock = (DoubleComplex *) ((void *)0) ;
    }
    ;
    eloc = umfzi_mem_alloc_tail_block (Numeric, (((((sizeof (DoubleComplex) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    if (!eloc)
    {
 ;
 if (!umfzi_get_memory (Numeric, Work, 1 + (((((sizeof (DoubleComplex) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))),
     Work->fnrows, Work->fncols, (0)))
 {
     return ((0)) ;
 }
 ;
 eloc = umfzi_mem_alloc_tail_block (Numeric, (((((sizeof (DoubleComplex) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    }
    while ((fnr2 != fnr_min || fnc2 != fnc_min) && !eloc)
    {
 fnr2 = (((fnr2 - 2) < (fnr2 * (0.95))) ? (fnr2 - 2) : (fnr2 * (0.95))) ;
 fnc2 = (((fnc2 - 2) < (fnc2 * (0.95))) ? (fnc2 - 2) : (fnc2 * (0.95))) ;
 ;
 ;
 fnr2 = (((fnr_min) > (fnr2)) ? (fnr_min) : (fnr2)) ;
 fnc2 = (((fnc_min) > (fnc2)) ? (fnc_min) : (fnc2)) ;
 ;
 if (fnr2 % 2 == 0) fnr2++ ;
 newsize = fnr2 * fnc2 ;
 ;
 eloc = umfzi_mem_alloc_tail_block (Numeric, (((((sizeof (DoubleComplex) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    }
    if (!eloc)
    {
 fnr2 = fnr_min ;
 fnc2 = fnc_min ;
 newsize = minsize ;
 ;
 eloc = umfzi_mem_alloc_tail_block (Numeric, (((((sizeof (DoubleComplex) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    }
    if (!eloc)
    {
 return ((0)) ;
    }
    ;
    ;
    ;
    fnr_curr = Work->fnr_curr ;
    ;
    ;
    fnrows = Work->fnrows ;
    fncols = Work->fncols ;
    Fcold = Work->Fcblock ;
    fnr2 -= nb ;
    fnc2 -= nb ;
    Work->Flublock = (DoubleComplex *) (Numeric->Memory + eloc) ;
    Work->Flblock = Work->Flublock + nb * nb ;
    Work->Fublock = Work->Flblock + nb * fnr2 ;
    Work->Fcblock = Work->Fublock + nb * fnc2 ;
    Fcnew = Work->Fcblock ;
    if (E [0])
    {
 for (j = 0 ; j < fncols ; j++)
 {
     col = Fcols [j] ;
     ;
     ;
     for (i = 0 ; i < fnrows ; i++)
     {
  Fcnew [i] = Fcold [i] ;
     }
     Fcnew += fnr2 ;
     Fcold += fnr_curr ;
     ;
     Fcpos [col] = j * fnr2 ;
 }
    }
    else if (do_what == 2)
    {
 for (j = 0 ; j < fncols ; j++)
 {
     col = Fcols [j] ;
     ;
     Fcpos [col] = j * fnr2 ;
 }
    }
    umfzi_mem_free_tail_block (Numeric, E [0]) ;
    E [0] = eloc ;
    Work->fnr_curr = fnr2 ;
    Work->fnc_curr = fnc2 ;
    Work->fcurr_size = newsize ;
    Work->do_grow = (0) ;
    ;
    ;
    ;
    return ((1)) ;
}

canonical_original_code:
int umfzi_grow_front(struct NumericType *Numeric, int fnr2, int fnc2, struct WorkType *Work, int do_what)
{
    double s;
    struct DoubleComplex *Fcold; struct DoubleComplex *Fcnew;
    int j; int i; int col; int *Fcpos; int *Fcols; int fnrows_max; int fncols_max; int fnr_curr; int nb; int fnrows_new; int fncols_new; int fnr_min; int fnc_min; int minsize; int newsize; int fnrows; int fncols; int *E; int eloc;
    Fcols = Work->Fcols ;
    Fcpos = Work->Fcpos ;
    E = Work->E ;
    nb = Work->nb ;
    fnrows_max = Work->fnrows_max + nb ;
    fncols_max = Work->fncols_max + nb ;
    ;
    ;
    ;
    ;
    ;
    fnrows_new = Work->fnrows_new + 1 ;
    fncols_new = Work->fncols_new + 1 ;
    ;
    if (fnrows_new % 2 == 0) fnrows_new++ ;
    fnrows_new += nb ;
    fncols_new += nb ;
    fnr_min = (((fnrows_new) < (fnrows_max)) ? (fnrows_new) : (fnrows_max)) ;
    fnc_min = (((fncols_new) < (fncols_max)) ? (fncols_new) : (fncols_max)) ;
    minsize = fnr_min * fnc_min ;
    if (((!(((double) fnr_min * (double) fnc_min * sizeof (DoubleComplex)) * (1.0+1e-8) <= (double) 0x7fffffff)) || (((double) fnr_min * (double) fnc_min * sizeof (DoubleComplex)) != ((double) fnr_min * (double) fnc_min * sizeof (DoubleComplex)))))
    {
 return ((0)) ;
    }
    ;
    ;
    ;
    ;
    fnr2 += nb ;
    fnc2 += nb ;
    ;
    if (fnr2 % 2 == 0) fnr2++ ;
    fnr2 = (((fnr2) > (fnr_min)) ? (fnr2) : (fnr_min)) ;
    fnc2 = (((fnc2) > (fnc_min)) ? (fnc2) : (fnc_min)) ;
    fnr2 = (((fnr2) < (fnrows_max)) ? (fnr2) : (fnrows_max)) ;
    fnc2 = (((fnc2) < (fncols_max)) ? (fnc2) : (fncols_max)) ;
    ;
    ;
    ;
    s = ((double) fnr2) * ((double) fnc2) ;
    if (((!((s * sizeof (DoubleComplex)) * (1.0+1e-8) <= (double) 0x7fffffff)) || ((s * sizeof (DoubleComplex)) != (s * sizeof (DoubleComplex)))))
    {
 double a = 0.9 * sqrt ((0x7fffffff / sizeof (DoubleComplex)) / s);
 fnr2 = (((fnr_min) > (a * fnr2)) ? (fnr_min) : (a * fnr2)) ;
 fnc2 = (((fnc_min) > (a * fnc2)) ? (fnc_min) : (a * fnc2)) ;
 newsize = fnr2 * fnc2 ;
 ;
 if (fnr2 % 2 == 0) fnr2++ ;
 fnc2 = newsize / fnr2 ;
    }
    fnr2 = (((fnr2) > (fnr_min)) ? (fnr2) : (fnr_min)) ;
    fnc2 = (((fnc2) > (fnc_min)) ? (fnc2) : (fnc_min)) ;
    newsize = fnr2 * fnc2 ;
    ;
    ;
    ;
    ;
    ;
    if (E [0] && do_what != 1)
    {
 ;
 umfzi_mem_free_tail_block (Numeric, E [0]) ;
 E [0] = 0 ;
 Work->Flublock = (struct DoubleComplex *) ((void *)0) ;
 Work->Flblock = (struct DoubleComplex *) ((void *)0) ;
 Work->Fublock = (struct DoubleComplex *) ((void *)0) ;
 Work->Fcblock = (struct DoubleComplex *) ((void *)0) ;
    }
    ;
    eloc = umfzi_mem_alloc_tail_block (Numeric, (((((sizeof (DoubleComplex) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    if (!eloc)
    {
 ;
 if (!umfzi_get_memory (Numeric, Work, 1 + (((((sizeof (DoubleComplex) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))),
     Work->fnrows, Work->fncols, (0)))
 {
     return ((0)) ;
 }
 ;
 eloc = umfzi_mem_alloc_tail_block (Numeric, (((((sizeof (DoubleComplex) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    }
    while ((fnr2 != fnr_min || fnc2 != fnc_min) && !eloc)
    {
 fnr2 = (((fnr2 - 2) < (fnr2 * (0.95))) ? (fnr2 - 2) : (fnr2 * (0.95))) ;
 fnc2 = (((fnc2 - 2) < (fnc2 * (0.95))) ? (fnc2 - 2) : (fnc2 * (0.95))) ;
 ;
 ;
 fnr2 = (((fnr_min) > (fnr2)) ? (fnr_min) : (fnr2)) ;
 fnc2 = (((fnc_min) > (fnc2)) ? (fnc_min) : (fnc2)) ;
 ;
 if (fnr2 % 2 == 0) fnr2++ ;
 newsize = fnr2 * fnc2 ;
 ;
 eloc = umfzi_mem_alloc_tail_block (Numeric, (((((sizeof (DoubleComplex) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    }
    if (!eloc)
    {
 fnr2 = fnr_min ;
 fnc2 = fnc_min ;
 newsize = minsize ;
 ;
 eloc = umfzi_mem_alloc_tail_block (Numeric, (((((sizeof (DoubleComplex) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    }
    if (!eloc)
    {
 return ((0)) ;
    }
    ;
    ;
    ;
    fnr_curr = Work->fnr_curr ;
    ;
    ;
    fnrows = Work->fnrows ;
    fncols = Work->fncols ;
    Fcold = Work->Fcblock ;
    fnr2 -= nb ;
    fnc2 -= nb ;
    Work->Flublock = (struct DoubleComplex *) (Numeric->Memory + eloc) ;
    Work->Flblock = Work->Flublock + nb * nb ;
    Work->Fublock = Work->Flblock + nb * fnr2 ;
    Work->Fcblock = Work->Fublock + nb * fnc2 ;
    Fcnew = Work->Fcblock ;
    if (E [0])
    {
 for (j = 0 ; j < fncols ; j++)
 {
     col = Fcols [j] ;
     ;
     ;
     for (i = 0 ; i < fnrows ; i++)
     {
  Fcnew [i] = Fcold [i] ;
     }
     Fcnew += fnr2 ;
     Fcold += fnr_curr ;
     ;
     Fcpos [col] = j * fnr2 ;
 }
    }
    else if (do_what == 2)
    {
 for (j = 0 ; j < fncols ; j++)
 {
     col = Fcols [j] ;
     ;
     Fcpos [col] = j * fnr2 ;
 }
    }
    umfzi_mem_free_tail_block (Numeric, E [0]) ;
    E [0] = eloc ;
    Work->fnr_curr = fnr2 ;
    Work->fnc_curr = fnc2 ;
    Work->fcurr_size = newsize ;
    Work->do_grow = (0) ;
    ;
    ;
    ;
    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: s double

variable_types: j int

variable_types: i int

variable_types:
Fcpos
int *

variable_types:
Fcols
int *

variable_types: minsize int

variable_types: newsize int

variable_types: fnrows int

variable_types: fncols int

variable_types: eloc int

variable_types: a double

return_type: int

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_triplet_map_x
(
    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 [ ]
    , const double Tx [ ]
    , double Ax [ ]
    , double Rx [ ]
    , int Map [ ]
    , int Map2 [ ]
)
{
    int i, j, k, p, cp, p1, p2, pdest, pj ;
    int duplicates ;
    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] ;
 Rx [p] = Tx [k] ;
    }
    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) ;
  Rx [pj] += Rx [p] ;
     }
     else
     {
  W [j] = pdest ;
  Map2 [p] = pdest ;
  if (pdest != p)
  {
      Rj [pdest] = j ;
      Rx [pdest] = Rx [p] ;
  }
  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 ;
     Ax [cp] = Rx [p] ;
 }
    }
    for (k = 0 ; k < nz ; k++)
    {
 Map [k] = Map2 [Map [k]] ;
    }
    return ((0)) ;
}

canonical_original_code:
int umfdi_triplet_map_x(int n_row, int n_col, int nz, int Ti[], int Tj[], int Ap[], int Ai[], int Rp[], int Rj[], int W[], int RowCount[], double Tx[], double Ax[], double Rx[], int Map[], int Map2[])
{
    int i; int j; int k; int p; int cp; int p1; int p2; int pdest; int pj;
    int duplicates;
    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] ;
 Rx [p] = Tx [k] ;
    }
    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) ;
  Rx [pj] += Rx [p] ;
     }
     else
     {
  W [j] = pdest ;
  Map2 [p] = pdest ;
  if (pdest != p)
  {
      Rj [pdest] = j ;
      Rx [pdest] = Rx [p] ;
  }
  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 ;
     Ax [cp] = Rx [p] ;
 }
    }
    for (k = 0 ; k < nz ; k++)
    {
 Map [k] = Map2 [Map [k]] ;
    }
    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:
Tx
double []

variable_types:
Ax
double []

variable_types:
Rx
double []

variable_types:
Map
int []

variable_types: k int

variable_types: p int

variable_types: cp int

variable_types: pdest int

variable_types: pj int

variable_types: duplicates int


decompiled_code:
__int64 __fastcall umfdi_transpose(int a1, int a2, __int64 a3, __int64 a4, __int64 a5, size_t a6, __int64 a7, int a8, void *a9, __int64 a10, __int64 a11, void *s, int a13)
{
int v13; // er10
__int64 v17; // r11
_DWORD *v18; // r8
int v19; // eax
size_t v20; // rdx
_DWORD *v21; // rax
int *v22; // rsi
__int64 v23; // rax
int v24; // edx
_DWORD *v25; // rcx
__int64 v26; // rax
__int64 v27; // rdx
__int64 v28; // rax
int v29; // edx
__int64 v30; // rax
int v31; // ecx
__int64 v32; // rdx
bool v33; // al
__int64 k; // r8
__int64 v35; // rdx
int v36; // eax
_DWORD *v37; // rsi
__int64 v38; // rdx
__int64 v39; // rax
__int64 v40; // xmm0_8
int *v41; // rcx
__int64 v42; // rax
__int64 v44; // r8
__int64 v45; // rdx
int v46; // eax
_DWORD *v47; // rdi
__int64 v48; // rdx
__int64 v49; // rax
int *v50; // rcx
__int64 v51; // rax
_DWORD *v52; // rcx
__int64 v53; // rsi
__int64 i; // rax
__int64 v55; // rdx
__int64 v56; // rax
int v57; // edx
__int64 j; // rax
_DWORD *v59; // r13
int v60; // edi
__int64 l; // rdx
__int64 v62; // rax
__int64 v63; // xmm0_8
int *v64; // rcx
__int64 v65; // rax
_DWORD *v66; // r13
int v67; // edi
__int64 m; // rdx
__int64 v69; // rax
int *v70; // rcx
__int64 v71; // rax
__int64 v72; // rax
size_t n; // [rsp+8h] [rbp-50h]
size_t na; // [rsp+8h] [rbp-50h]
int v76; // [rsp+10h] [rbp-48h]
size_t v77; // [rsp+18h] [rbp-40h]
__int64 v78; // [rsp+60h] [rbp+8h]
void *v79; // [rsp+70h] [rbp+18h]

v13 = a1;
v17 = a7;
v18 = a9;
if ( a13 )
{
if ( !a4 || !a3 || a9 == 0LL || a10 == 0 || !s )
return 4294967291LL;
if ( a1 <= 0 || a2 <= 0 )
return 4294967290LL;
n = a6;
if ( !(unsigned int)umf_i_is_permutation(a6, s, (unsigned int)a1, (unsigned int)a1, a9)
|| !(unsigned int)umf_i_is_permutation(a7, s, (unsigned int)a8, (unsigned int)a8, a9) )
{
return 4294967281LL;
}
v19 = amd_valid((unsigned int)a1, (unsigned int)a2, a3, a4);
v13 = a1;
v17 = a7;
a6 = n;
v18 = a9;
if ( v19 )
return 4294967288LL;
}
else if ( a1 <= 0 )
{
goto LABEL_16;
}
v20 = 4LL * (unsigned int)(v13 - 1) + 4;
if ( v13 <= 0 )
v20 = 4LL;
if ( v18 < (_DWORD *)((char *)s + v20) && s < (char *)v18 + v20 )
{
v72 = 0LL;
do
{
*((_DWORD *)s + v72) = 0;
v18[v72++] = 0;
}
while ( v13 > (int)v72 );
}
else
{
v78 = v17;
v77 = a6;
v76 = v13;
v79 = v18;
na = v20;
memset(s, 0, v20);
v21 = memset(v79, 0, na);
v13 = v76;
a6 = v77;
v17 = v78;
v18 = v21;
}
LABEL_16:
if ( v17 )
{
if ( a8 > 0 )
{
v22 = (int *)v17;
do
{
v23 = *v22;
v24 = *(_DWORD *)(a3 + 4 * v23);
v25 = (_DWORD *)(a3 + 4 * v23 + 4);
v26 = v24;
if ( v24 < *v25 )
{
do
{
v27 = *(int *)(a4 + 4 * v26++);
++*((_DWORD *)s + v27);
}
while ( *v25 > (int)v26 );
}
++v22;
}
while ( (int *)(v17 + 4LL * (unsigned int)(a8 - 1) + 4) != v22 );
}
}
else if ( a2 > 0 )
{
v52 = (_DWORD *)(a3 + 4);
v53 = a3 + 4LL * (unsigned int)(a2 - 1) + 8;
do
{
for ( i = (int)*(v52 - 1); *v52 > (int)i; ++*((_DWORD *)s + v55) )
v55 = *(int *)(a4 + 4 * i++);
++v52;
}
while ( (_DWORD *)v53 != v52 );
if ( a6 )
goto LABEL_23;
LABEL_50:
*v18 = 0;
if ( v13 > 0 )
{
v56 = 0LL;
v57 = 0;
while ( 1 )
{
v57 += *(_DWORD *)((char *)s + v56 * 4);
v18[v56 + 1] = v57;
if ( v13 - 1 == v56 )
break;
++v56;
}
for ( j = 0LL; j != v13; ++j )
*((_DWORD *)s + j) = v18[j];
}
goto LABEL_29;
}
if ( !a6 )
goto LABEL_50;
LABEL_23:
*v18 = 0;
if ( v13 > 0 )
{
v28 = 0LL;
v29 = 0;
while ( 1 )
{
v29 += *((_DWORD *)s + *(int *)(a6 + v28 * 4));
v18[v28 + 1] = v29;
if ( v13 - 1 == v28 )
break;
++v28;
}
v30 = 0LL;
do
{
v31 = v18[v30];
v32 = *(int *)(a6 + 4 * v30++);
*((_DWORD *)s + v32) = v31;
}
while ( v13 != v30 );
}
LABEL_29:
v33 = a11 != 0 && a5 != 0;
if ( v17 )
{
if ( v33 )
{
if ( a8 > 0 )
{
for ( k = 0LL; k != a8; ++k )
{
v35 = *(int *)(v17 + 4 * k);
v36 = *(_DWORD *)(a3 + 4 * v35);
v37 = (_DWORD *)(a3 + 4 * v35 + 4);
v38 = v36;
if ( v36 < *v37 )
{
do
{
v39 = *(int *)(a4 + 4 * v38);
v40 = *(_QWORD *)(a5 + 8 * v38++);
v41 = (int *)((char *)s + 4 * v39);
v42 = *v41;
*v41 = v42 + 1;
*(_DWORD *)(a10 + 4 * v42) = k;
*(_QWORD *)(a11 + 8 * v42) = v40;
}
while ( *v37 > (int)v38 );
}
}
}
}
else
{
v44 = 0LL;
if ( a8 > 0 )
{
do
{
v45 = *(int *)(v17 + 4 * v44);
v46 = *(_DWORD *)(a3 + 4 * v45);
v47 = (_DWORD *)(a3 + 4 * v45 + 4);
v48 = v46;
if ( v46 < *v47 )
{
do
{
v49 = *(int *)(a4 + 4 * v48++);
v50 = (int *)((char *)s + 4 * v49);
v51 = *v50;
*v50 = v51 + 1;
*(_DWORD *)(a10 + 4 * v51) = v44;
}
while ( *v47 > (int)v48 );
}
++v44;
}
while ( a8 != v44 );
}
}
}
else if ( v33 )
{
if ( a2 > 0 )
{
v59 = (_DWORD *)(a3 + 4);
v60 = 0;
do
{
for ( l = (int)*(v59 - 1); *v59 > (int)l; *(_QWORD *)(a11 + 8 * v65) = v63 )
{
v62 = *(int *)(a4 + 4 * l);
v63 = *(_QWORD *)(a5 + 8 * l++);
v64 = (int *)((char *)s + 4 * v62);
v65 = *v64;
*v64 = v65 + 1;
*(_DWORD *)(a10 + 4 * v65) = v60;
}
++v60;
++v59;
}
while ( a2 != v60 );
}
}
else
{
v66 = (_DWORD *)(a3 + 4);
v67 = 0;
if ( a2 > 0 )
{
do
{
for ( m = (int)*(v66 - 1); *v66 > (int)m; *(_DWORD *)(a10 + 4 * v71) = v67 )
{
v69 = *(int *)(a4 + 4 * m++);
v70 = (int *)((char *)s + 4 * v69);
v71 = *v70;
*v70 = v71 + 1;
}
++v67;
++v66;
}
while ( a2 != v67 );
}
}
return 0LL;
}

original_code:
int umfdi_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
)
{
    int i, j, k, p, bp, newj, do_values ;
    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 ;
    {
 if (Q != (int *) ((void *)0))
 {
     if (do_values)
     {
  {
      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] ;
   }
      }
  }
     }
     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)
     {
  {
      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] ;
   }
      }
  }
     }
     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 umfdi_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)
{
    int i; int j; int k; int p; int bp; int newj; int do_values;
    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 ;
    {
 if (Q != (int *) ((void *)0))
 {
     if (do_values)
     {
  {
      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] ;
   }
      }
  }
     }
     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)
     {
  {
      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] ;
   }
      }
  }
     }
     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:
P
int []

variable_types:
Q
int []

variable_types: nq int

variable_types:
Ri
int []

variable_types: check int

variable_types: i int

variable_types: j int

variable_types: bp int

variable_types: newj int


decompiled_code:
void __fastcall umfpack_tic(double *a1)
{
double v1; // xmm0_8

v1 = SuiteSparse_time();
*a1 = v1;
a1[1] = v1;
}

canonical_decompiled_code:
void __fastcall func0(double *a1)
{
double v1; // xmm0_8

v1 = SuiteSparse_time();
*a1 = v1;
a1[1] = v1;
}

original_code:
void umfpack_tic (double stats [2])
{
    stats [0] = SuiteSparse_time ( ) ;
    stats [1] = stats [0] ;
}

canonical_original_code:
void umfpack_tic(double stats[2])
{
    stats [0] = SuiteSparse_time ( ) ;
    stats [1] = stats [0] ;
}

variable_types:
stats
double [2]

return_type: void


decompiled_code:
void __fastcall umfpack_toc(double *a1)
{
double v1; // xmm0_8

v1 = SuiteSparse_time() - *a1;
*a1 = v1;
a1[1] = v1;
}

canonical_decompiled_code:
void __fastcall func1(double *a1)
{
double v1; // xmm0_8

v1 = SuiteSparse_time() - *a1;
*a1 = v1;
a1[1] = v1;
}

original_code:
void umfpack_toc (double stats [2])
{
    stats [0] = SuiteSparse_time ( ) - stats [0] ;
    stats [1] = stats [0] ;
}

canonical_original_code:
void umfpack_toc(double stats[2])
{
    stats [0] = SuiteSparse_time ( ) - stats [0] ;
    stats [1] = stats [0] ;
}


original_code:
double umfzl_lsolve
(
    NumericType *Numeric,
    DoubleComplex X [ ],
    long Pattern [ ]
)
{
    DoubleComplex xk ;
    DoubleComplex *xp, *Lval ;
    long k, deg, *ip, j, row, *Lpos, *Lilen, *Lip, llen, lp, newLchain,
 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 ;
    n1 = Numeric->n1 ;
    for (k = 0 ; k < n1 ; k++)
    {
 ;
 xk = X [k] ;
 deg = Lilen [k] ;
 if (deg > 0 && ((((xk).component [0]) != 0.) || (((xk).component [1]) != 0.)))
 {
     lp = Lip [k] ;
     Li = (long *) (Numeric->Memory + lp) ;
     lp += (((((sizeof (long) * (deg))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))) ;
     Lval = (DoubleComplex *) (Numeric->Memory + lp) ;
     for (j = 0 ; j < deg ; j++)
     {
  ;
  ;
  ;
  { ; (X [Li [j]]).component [0] -= (xk).component [0] * (Lval [j]).component [0] - (xk).component [1] * (Lval [j]).component [1] ; (X [Li [j]]).component [1] -= (xk).component [1] * (Lval [j]).component [0] + (xk).component [0] * (Lval [j]).component [1] ; } ;
     }
 }
    }
    deg = 0 ;
    for (k = n1 ; k < npiv ; k++)
    {
 lp = Lip [k] ;
 newLchain = (lp < 0) ;
 if (newLchain)
 {
     lp = -lp ;
     deg = 0 ;
     ;
 }
 pos = Lpos [k] ;
 if (pos != (-1))
 {
     ;
     ;
     ;
     ;
     ;
     Pattern [pos] = Pattern [--deg] ;
 }
 ip = (long *) (Numeric->Memory + lp) ;
 llen = Lilen [k] ;
 for (j = 0 ; j < llen ; j++)
 {
     row = *ip++ ;
     ;
     ;
     Pattern [deg++] = row ;
 }
 xk = X [k] ;
 if (((((xk).component [0]) != 0.) || (((xk).component [1]) != 0.)))
 {
     xp = (DoubleComplex *) (Numeric->Memory + lp + (((((sizeof (long) * (llen))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
     for (j = 0 ; j < deg ; j++)
     {
  ;
  ;
  ;
  { ; (X [Pattern [j]]).component [0] -= (xk).component [0] * (*xp).component [0] - (xk).component [1] * (*xp).component [1] ; (X [Pattern [j]]).component [1] -= (xk).component [1] * (*xp).component [0] + (xk).component [0] * (*xp).component [1] ; } ;
  xp++ ;
     }
 }
    }
    return (8. * ((double) Numeric->lnz)) ;
}

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

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:
X
struct DoubleComplex []

variable_types:
Pattern
long []

variable_types: k long

variable_types: deg long

variable_types:
ip
long *

variable_types: j long

variable_types: row long

variable_types:
Lpos
long *

variable_types:
Lilen
long *

variable_types:
Lip
long *

variable_types: llen long

variable_types: lp long

variable_types: newLchain long

variable_types: pos long

variable_types: npiv long

variable_types:
Li
long *

return_type: double

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


decompiled_code:
__int64 __fastcall umfpack_zi_transpose(unsigned int a1, unsigned int a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, __int64 a9, __int64 a10, __int64 a11, __int64 a12, unsigned int a13)
{
bool v17; // cc
__int64 v18; // rdi
__int64 v19; // rax
__int64 v20; // r13
unsigned int v21; // er12

v17 = (int)a1 <= 0;
v18 = 1LL;
if ( !v17 )
v18 = a1;
if ( (int)v18 < (int)a2 )
v18 = a2;
v19 = umf_i_malloc(v18, 4LL);
if ( !v19 )
return (unsigned int)-1;
v20 = v19;
v21 = umfzi_transpose(a1, a2, a3, a4, a5, a7, a8, a2, a9, a10, a11, v19, 1LL, a6, a12, a13);
umf_i_free(v20);
return v21;
}

original_code:
int umfpack_zi_transpose
(
    int n_row,
    int n_col,
    const int Ap [ ],
    const int Ai [ ],
    const double Ax [ ],
    const double Az [ ],
    const int P [ ],
    const int Q [ ],
    int Rp [ ],
    int Ri [ ],
    double Rx [ ]
    , double Rz [ ]
    , int do_conjugate
)
{
    int status, *W, nn ;
    nn = (((n_row) > (n_col)) ? (n_row) : (n_col)) ;
    nn = (((nn) > (1)) ? (nn) : (1)) ;
    W = (int *) umf_i_malloc (nn, sizeof (int)) ;
    if (!W)
    {
 ;
 ;
 return ((-1)) ;
    }
    ;
    status = umfzi_transpose (n_row, n_col, Ap, Ai, Ax, P, Q, n_col, Rp, Ri, Rx,
 W, (1)
 , Az, Rz, do_conjugate
 ) ;
    (void) umf_i_free ((void *) W) ;
    ;
    return (status) ;
}

canonical_original_code:
int umfpack_zi_transpose(int n_row, int n_col, int Ap[], int Ai[], double Ax[], double Az[], int P[], int Q[], int Rp[], int Ri[], double Rx[], double Rz[], int do_conjugate)
{
    int status; int *W; int nn;
    nn = (((n_row) > (n_col)) ? (n_row) : (n_col)) ;
    nn = (((nn) > (1)) ? (nn) : (1)) ;
    W = (int *) umf_i_malloc (nn, sizeof (int)) ;
    if (!W)
    {
 ;
 ;
 return ((-1)) ;
    }
    ;
    status = umfzi_transpose (n_row, n_col, Ap, Ai, Ax, P, Q, n_col, Rp, Ri, Rx,
 W, (1)
 , Az, Rz, do_conjugate
 ) ;
    (void) umf_i_free ((void *) W) ;
    ;
    return (status) ;
}

variable_types:
Ap
int []

variable_types:
Ai
int []

variable_types:
Ax
double []

variable_types:
Az
double []

variable_types:
P
int []

variable_types:
Q
int []

variable_types:
Rp
int []

variable_types:
Ri
int []

variable_types:
Rx
double []

variable_types:
Rz
double []

variable_types: status int

variable_types:
W
int *

variable_types: nn int


original_code:
long amd_l_order
(
    long n,
    const long Ap [ ],
    const long Ai [ ],
    long P [ ],
    double Control [ ],
    double Info [ ]
)
{
    long *Len, *S, nz, i, *Pinv, info, status, *Rp, *Ri, *Cp, *Ci, ok ;
    size_t nzaat, slen ;
    double mem = 0 ;
    info = Info != (double *) ((void *)0) ;
    if (info)
    {
 for (i = 0 ; i < 20 ; i++)
 {
     Info [i] = (-1) ;
 }
 Info [1] = n ;
 Info [0] = 0 ;
    }
    if (Ai == (long *) ((void *)0) || Ap == (long *) ((void *)0) || P == (long *) ((void *)0) || n < 0)
    {
 if (info) Info [0] = -2 ;
 return (-2) ;
    }
    if (n == 0)
    {
 return (0) ;
    }
    nz = Ap [n] ;
    if (info)
    {
 Info [2] = nz ;
    }
    if (nz < 0)
    {
 if (info) Info [0] = -2 ;
 return (-2) ;
    }
    if (((size_t) n) >= ((size_t) (-1)) / sizeof (long)
     || ((size_t) nz) >= ((size_t) (-1)) / sizeof (long))
    {
 if (info) Info [0] = -1 ;
 return (-1) ;
    }
    status = amd_l_valid (n, n, Ap, Ai) ;
    if (status == -2)
    {
 if (info) Info [0] = -2 ;
 return (-2) ;
    }
    Len = amd_malloc (n * sizeof (long)) ;
    Pinv = amd_malloc (n * sizeof (long)) ;
    mem += n ;
    mem += n ;
    if (!Len || !Pinv)
    {
 amd_free (Len) ;
 amd_free (Pinv) ;
 if (info) Info [0] = -1 ;
 return (-1) ;
    }
    if (status == 1)
    {
 ;
 Rp = amd_malloc ((n+1) * sizeof (long)) ;
 Ri = amd_malloc ((((nz) > (1)) ? (nz) : (1)) * sizeof (long)) ;
 mem += (n+1) ;
 mem += (((nz) > (1)) ? (nz) : (1)) ;
 if (!Rp || !Ri)
 {
     amd_free (Rp) ;
     amd_free (Ri) ;
     amd_free (Len) ;
     amd_free (Pinv) ;
     if (info) Info [0] = -1 ;
     return (-1) ;
 }
 amd_l_preprocess (n, Ap, Ai, Rp, Ri, Len, Pinv) ;
 Cp = Rp ;
 Ci = Ri ;
    }
    else
    {
 Rp = ((void *)0) ;
 Ri = ((void *)0) ;
 Cp = (long *) Ap ;
 Ci = (long *) Ai ;
    }
    nzaat = amd_l_aat (n, Cp, Ci, Len, P, Info) ;
    ;
    ;
    S = ((void *)0) ;
    slen = nzaat ;
    ok = ((slen + nzaat/5) >= slen) ;
    slen += nzaat/5 ;
    for (i = 0 ; ok && i < 7 ; i++)
    {
 ok = ((slen + n) > slen) ;
 slen += n ;
    }
    mem += slen ;
    ok = ok && (slen < ((size_t) (-1)) / sizeof (long)) ;
    ok = ok && (slen < 0x7fffffffffffffffL) ;
    if (ok)
    {
 S = amd_malloc (slen * sizeof (long)) ;
    }
    ;
    if (!S)
    {
 amd_free (Rp) ;
 amd_free (Ri) ;
 amd_free (Len) ;
 amd_free (Pinv) ;
 if (info) Info [0] = -1 ;
 return (-1) ;
    }
    if (info)
    {
 Info [7] = mem * sizeof (long) ;
    }
    amd_l1 (n, Cp, Ci, P, Pinv, Len, slen, S, Control, Info) ;
    amd_free (Rp) ;
    amd_free (Ri) ;
    amd_free (Len) ;
    amd_free (Pinv) ;
    amd_free (S) ;
    if (info) Info [0] = status ;
    return (status) ;
}

canonical_original_code:
long amd_l_order(long n, long Ap[], long Ai[], long P[], double Control[], double Info[])
{
    long *Len; long *S; long nz; long i; long *Pinv; long info; long status; long *Rp; long *Ri; long *Cp; long *Ci; long ok;
    unsigned long nzaat; unsigned long slen;
    double mem = 0;
    info = Info != (double *) ((void *)0) ;
    if (info)
    {
 for (i = 0 ; i < 20 ; i++)
 {
     Info [i] = (-1) ;
 }
 Info [1] = n ;
 Info [0] = 0 ;
    }
    if (Ai == (long *) ((void *)0) || Ap == (long *) ((void *)0) || P == (long *) ((void *)0) || n < 0)
    {
 if (info) Info [0] = -2 ;
 return (-2) ;
    }
    if (n == 0)
    {
 return (0) ;
    }
    nz = Ap [n] ;
    if (info)
    {
 Info [2] = nz ;
    }
    if (nz < 0)
    {
 if (info) Info [0] = -2 ;
 return (-2) ;
    }
    if (((unsigned long) n) >= ((unsigned long) (-1)) / sizeof (long)
     || ((unsigned long) nz) >= ((unsigned long) (-1)) / sizeof (long))
    {
 if (info) Info [0] = -1 ;
 return (-1) ;
    }
    status = amd_l_valid (n, n, Ap, Ai) ;
    if (status == -2)
    {
 if (info) Info [0] = -2 ;
 return (-2) ;
    }
    Len = amd_malloc (n * sizeof (long)) ;
    Pinv = amd_malloc (n * sizeof (long)) ;
    mem += n ;
    mem += n ;
    if (!Len || !Pinv)
    {
 amd_free (Len) ;
 amd_free (Pinv) ;
 if (info) Info [0] = -1 ;
 return (-1) ;
    }
    if (status == 1)
    {
 ;
 Rp = amd_malloc ((n+1) * sizeof (long)) ;
 Ri = amd_malloc ((((nz) > (1)) ? (nz) : (1)) * sizeof (long)) ;
 mem += (n+1) ;
 mem += (((nz) > (1)) ? (nz) : (1)) ;
 if (!Rp || !Ri)
 {
     amd_free (Rp) ;
     amd_free (Ri) ;
     amd_free (Len) ;
     amd_free (Pinv) ;
     if (info) Info [0] = -1 ;
     return (-1) ;
 }
 amd_l_preprocess (n, Ap, Ai, Rp, Ri, Len, Pinv) ;
 Cp = Rp ;
 Ci = Ri ;
    }
    else
    {
 Rp = ((void *)0) ;
 Ri = ((void *)0) ;
 Cp = (long *) Ap ;
 Ci = (long *) Ai ;
    }
    nzaat = amd_l_aat (n, Cp, Ci, Len, P, Info) ;
    ;
    ;
    S = ((void *)0) ;
    slen = nzaat ;
    ok = ((slen + nzaat/5) >= slen) ;
    slen += nzaat/5 ;
    for (i = 0 ; ok && i < 7 ; i++)
    {
 ok = ((slen + n) > slen) ;
 slen += n ;
    }
    mem += slen ;
    ok = ok && (slen < ((unsigned long) (-1)) / sizeof (long)) ;
    ok = ok && (slen < 0x7fffffffffffffffL) ;
    if (ok)
    {
 S = amd_malloc (slen * sizeof (long)) ;
    }
    ;
    if (!S)
    {
 amd_free (Rp) ;
 amd_free (Ri) ;
 amd_free (Len) ;
 amd_free (Pinv) ;
 if (info) Info [0] = -1 ;
 return (-1) ;
    }
    if (info)
    {
 Info [7] = mem * sizeof (long) ;
    }
    amd_l1 (n, Cp, Ci, P, Pinv, Len, slen, S, Control, Info) ;
    amd_free (Rp) ;
    amd_free (Ri) ;
    amd_free (Len) ;
    amd_free (Pinv) ;
    amd_free (S) ;
    if (info) Info [0] = status ;
    return (status) ;
}

variable_types: n long

variable_types:
Ap
long []

variable_types:
Ai
long []

variable_types:
P
long []

variable_types:
Control
double []

variable_types:
Info
double []

variable_types:
Len
long *

variable_types:
S
long *

variable_types: nz long

variable_types: i long

variable_types:
Pinv
long *

variable_types: info long

variable_types: status long

variable_types:
Rp
long *

variable_types:
Ri
long *

variable_types:
Cp
long *

variable_types:
Ci
long *

variable_types: ok long

variable_types:
nzaat
unsigned long

variable_types:
slen
unsigned long

variable_types: mem double

return_type: long


decompiled_code:
int __fastcall verify_routed_net(__int64 *a1)
{
__int64 v2; // rax
_QWORD *v3; // rsi
int v4; // ecx
_QWORD *v5; // rdi
_QWORD *v6; // r12
_QWORD *v7; // rax
__int64 v8; // rbx
__int64 v9; // rcx
int v10; // ecx
_QWORD *v11; // rax
__int64 v12; // rcx
int v13; // ebx
_QWORD *v14; // r13
__int64 v15; // rax
__int64 v16; // r10
__int64 v17; // r9
__int64 v18; // r11
__int64 v19; // r8
int v20; // edi
_QWORD *v21; // r14
_QWORD *v22; // rdx
_QWORD *v23; // rax
_QWORD *v24; // rbp
const char *v25; // r12
const char *v26; // rax
_QWORD *v28; // [rsp+8h] [rbp-40h]

v2 = *a1;
v3 = (_QWORD *)a1[1];
v4 = *(_DWORD *)(*a1 + 24);
if ( v4 <= 0 )
goto LABEL_35;
v5 = (_QWORD *)a1[3];
v6 = 0LL;
v7 = *(_QWORD **)(v2 + 16);
v8 = *((int *)a1 + 8);
v9 = (__int64)&v7[(unsigned int)(v4 - 1) + 1];
do
{
while ( v5[v8 - 1] != *v7 )
{
if ( ++v7 == (_QWORD *)v9 )
goto LABEL_7;
}
if ( v6 )
_assert_fail("0", "SRC/base/verify.c", 0x39u, "verify_routed_net");
++v7;
v6 = (_QWORD *)v5[v8 - 1];
}
while ( v7 != (_QWORD *)v9 );
LABEL_7:
if ( !v6 )
{
LABEL_35:
LODWORD(v11) = printf("\tError: Could not find source wire segment for net '%d'\n", *((unsigned int *)a1 + 4));
return (int)v11;
}
v10 = *((_DWORD *)v3 + 6);
if ( v10 <= 0 )
{
v28 = 0LL;
v13 = v8 - 2;
LABEL_15:
v14 = 0LL;
while ( 1 )
{
v15 = find_all_adjacent_segs(v6);
v16 = *(int *)(v15 + 8);
v17 = v15;
if ( (int)v16 <= 0 )
goto LABEL_37;
v18 = *(_QWORD *)v15;
v19 = 0LL;
v20 = 0;
v21 = 0LL;
do
{
v22 = (_QWORD *)*(unsigned int *)(v18 + 4 * v19);
if ( (int)v22 > 0 )
{
v23 = *(_QWORD **)(*(_QWORD *)(v17 + 16) + 8 * v19);
v3 = &v23[(int)v22 - 1];
while ( 1 )
{
v24 = (_QWORD *)*v23;
if ( *v23 == (_QWORD)v14 || *v23 == (_QWORD)v6 || v24 == v21 || *(_QWORD **)(a1[3] + 8LL * v13) != v24 )
{
v22 = v23 + 1;
if ( v3 == v23 )
break;
}
else
{
if ( v20 )
{
v25 = (const char *)short_wire_name(v21, v3);
v26 = (const char *)short_wire_name(v24, v3);
printf("\n\tError, found multiple adjacent wires '%s' & '%s' with the same associated net\n", v26, v25);
_assert_fail("0", "SRC/base/verify.c", 0x7Du, "verify_routed_net");
}
if ( v13 < 0 )
_assert_fail("associated_wire_index - 1 >= -1", "SRC/base/verify.c", 0x79u, "verify_routed_net");
--v13;
v21 = (_QWORD *)*v23;
v22 = v23 + 1;
v20 = 1;
if ( v3 == v23 )
break;
}
v23 = v22;
}
}
++v19;
}
while ( v16 != v19 );
if ( !v20 )
{
LABEL_37:
printf("\n\tError: could not find next routing segment for net %d\n", *((unsigned int *)a1 + 4));
_assert_fail("0", "SRC/base/verify.c", 0x89u, "verify_routed_net");
}
v14 = v6;
LODWORD(v11) = free_adjacent_segs(v17, v3, v22);
if ( v28 == v21 )
return (int)v11;
v6 = v21;
}
}
v11 = (_QWORD *)v3[2];
v3 = 0LL;
v12 = (__int64)&v11[(unsigned int)(v10 - 1) + 1];
do
{
while ( *v5 != *v11 )
{
if ( ++v11 == (_QWORD *)v12 )
goto LABEL_14;
}
if ( v3 )
_assert_fail("0", "SRC/base/verify.c", 0x4Du, "verify_routed_net");
++v11;
v3 = (_QWORD *)*v5;
}
while ( v11 != (_QWORD *)v12 );
LABEL_14:
v28 = v3;
v13 = v8 - 2;
if ( v6 != v3 )
goto LABEL_15;
return (int)v11;
}

canonical_decompiled_code:
int __fastcall func0(__int64 *a1)
{
__int64 v2; // rax
_QWORD *v3; // rsi
int v4; // ecx
_QWORD *v5; // rdi
_QWORD *v6; // r12
_QWORD *v7; // rax
__int64 v8; // rbx
__int64 v9; // rcx
int v10; // ecx
_QWORD *v11; // rax
__int64 v12; // rcx
int v13; // ebx
_QWORD *v14; // r13
__int64 v15; // rax
__int64 v16; // r10
__int64 v17; // r9
__int64 v18; // r11
__int64 v19; // r8
int v20; // edi
_QWORD *v21; // r14
_QWORD *v22; // rdx
_QWORD *v23; // rax
_QWORD *v24; // rbp
const char *v25; // r12
const char *v26; // rax
_QWORD *v28; // [rsp+8h] [rbp-40h]

v2 = *a1;
v3 = (_QWORD *)a1[1];
v4 = *(_DWORD *)(*a1 + 24);
if ( v4 <= 0 )
goto LABEL_35;
v5 = (_QWORD *)a1[3];
v6 = 0LL;
v7 = *(_QWORD **)(v2 + 16);
v8 = *((int *)a1 + 8);
v9 = (__int64)&v7[(unsigned int)(v4 - 1) + 1];
do
{
while ( v5[v8 - 1] != *v7 )
{
if ( ++v7 == (_QWORD *)v9 )
goto LABEL_7;
}
if ( v6 )
_assert_fail("0", "SRC/base/verify.c", 0x39u, "verify_routed_net");
++v7;
v6 = (_QWORD *)v5[v8 - 1];
}
while ( v7 != (_QWORD *)v9 );
LABEL_7:
if ( !v6 )
{
LABEL_35:
LODWORD(v11) = printf("\tError: Could not find source wire segment for net '%d'\n", *((unsigned int *)a1 + 4));
return (int)v11;
}
v10 = *((_DWORD *)v3 + 6);
if ( v10 <= 0 )
{
v28 = 0LL;
v13 = v8 - 2;
LABEL_15:
v14 = 0LL;
while ( 1 )
{
v15 = find_all_adjacent_segs(v6);
v16 = *(int *)(v15 + 8);
v17 = v15;
if ( (int)v16 <= 0 )
goto LABEL_37;
v18 = *(_QWORD *)v15;
v19 = 0LL;
v20 = 0;
v21 = 0LL;
do
{
v22 = (_QWORD *)*(unsigned int *)(v18 + 4 * v19);
if ( (int)v22 > 0 )
{
v23 = *(_QWORD **)(*(_QWORD *)(v17 + 16) + 8 * v19);
v3 = &v23[(int)v22 - 1];
while ( 1 )
{
v24 = (_QWORD *)*v23;
if ( *v23 == (_QWORD)v14 || *v23 == (_QWORD)v6 || v24 == v21 || *(_QWORD **)(a1[3] + 8LL * v13) != v24 )
{
v22 = v23 + 1;
if ( v3 == v23 )
break;
}
else
{
if ( v20 )
{
v25 = (const char *)short_wire_name(v21, v3);
v26 = (const char *)short_wire_name(v24, v3);
printf("\n\tError, found multiple adjacent wires '%s' & '%s' with the same associated net\n", v26, v25);
_assert_fail("0", "SRC/base/verify.c", 0x7Du, "verify_routed_net");
}
if ( v13 < 0 )
_assert_fail("associated_wire_index - 1 >= -1", "SRC/base/verify.c", 0x79u, "verify_routed_net");
--v13;
v21 = (_QWORD *)*v23;
v22 = v23 + 1;
v20 = 1;
if ( v3 == v23 )
break;
}
v23 = v22;
}
}
++v19;
}
while ( v16 != v19 );
if ( !v20 )
{
LABEL_37:
printf("\n\tError: could not find next routing segment for net %d\n", *((unsigned int *)a1 + 4));
_assert_fail("0", "SRC/base/verify.c", 0x89u, "verify_routed_net");
}
v14 = v6;
LODWORD(v11) = free_adjacent_segs(v17, v3, v22);
if ( v28 == v21 )
return (int)v11;
v6 = v21;
}
}
v11 = (_QWORD *)v3[2];
v3 = 0LL;
v12 = (__int64)&v11[(unsigned int)(v10 - 1) + 1];
do
{
while ( *v5 != *v11 )
{
if ( ++v11 == (_QWORD *)v12 )
goto LABEL_14;
}
if ( v3 )
_assert_fail("0", "SRC/base/verify.c", 0x4Du, "verify_routed_net");
++v11;
v3 = (_QWORD *)*v5;
}
while ( v11 != (_QWORD *)v12 );
LABEL_14:
v28 = v3;
v13 = v8 - 2;
if ( v6 != v3 )
goto LABEL_15;
return (int)v11;
}

original_code:
void verify_routed_net(t_net* net) {
    t_pin* source_pin = net->source_pin;
    t_pin* sink_pin = net->sink_pin;
    t_wire* source_wire = ((void *)0);
    t_wire* sink_wire = ((void *)0);
    int source_net_index;
    for(source_net_index = 0; source_net_index < source_pin->num_adjacent_wires; source_net_index++) {
        t_wire* tmp_wire = source_pin->array_of_adjacent_wires[source_net_index];
        if(tmp_wire == net->associated_wires[net->num_associated_wires - 1]) {
            if(source_wire == ((void *)0)) {
                source_wire = tmp_wire;
            } else {
                ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "SRC/base/verify.c", 57, __extension__ __PRETTY_FUNCTION__); }));
            }
        }
    }
    if (source_wire == ((void *)0)) {
        printf("\tError: Could not find source wire segment for net '%d'\n", net->net_num);
        return;
    }
    int sink_net_index;
    for(sink_net_index = 0; sink_net_index < sink_pin->num_adjacent_wires; sink_net_index++) {
        t_wire* tmp_wire = sink_pin->array_of_adjacent_wires[sink_net_index];
        if(tmp_wire == net->associated_wires[0]) {
            if(sink_wire == ((void *)0)) {
                sink_wire = tmp_wire;
            } else {
                ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "SRC/base/verify.c", 77, __extension__ __PRETTY_FUNCTION__); }));
            }
        }
    }
    if (source_wire == ((void *)0)) {
        printf("\tError: Could not find sink wire segment for net '%d'\n", net->net_num);
        return;
    }
    int associated_wire_index = net->num_associated_wires - 2;
    t_wire* prev_seg = ((void *)0);
    t_wire* current_seg = source_wire;
    t_wire* next_seg = ((void *)0);
    while(current_seg != sink_wire) {
        t_boolean found_next_seg = FALSE;
        t_adjacent_segs* adjacent_segs = find_all_adjacent_segs(current_seg);
        int sb_index;
        int adjacent_wire_cnt;
        for(sb_index = 0; sb_index < adjacent_segs->num_sb; sb_index++) {
            for(adjacent_wire_cnt = 0; adjacent_wire_cnt < adjacent_segs->num_segs[sb_index]; adjacent_wire_cnt++) {
                t_wire* tmp_seg = adjacent_segs->array_of_segs[sb_index][adjacent_wire_cnt];
                if(tmp_seg == prev_seg) {
                    continue;
                }
                if(tmp_seg == current_seg) {
                    continue;
                }
                if(tmp_seg == next_seg) {
                    continue;
                }
                if(tmp_seg == net->associated_wires[associated_wire_index]) {
                    if(found_next_seg == FALSE) {
                        next_seg = tmp_seg;
                        found_next_seg = TRUE;
                        ((void) sizeof ((associated_wire_index - 1 >= -1) ? 1 : 0), __extension__ ({ if (associated_wire_index - 1 >= -1) ; else __assert_fail ("associated_wire_index - 1 >= -1", "SRC/base/verify.c", 121, __extension__ __PRETTY_FUNCTION__); }));
                        associated_wire_index--;
                    } else {
                        printf("\n\tError, found multiple adjacent wires '%s' & '%s' with the same associated net\n", short_wire_name(tmp_seg), short_wire_name(next_seg));
                        ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "SRC/base/verify.c", 125, __extension__ __PRETTY_FUNCTION__); }));
                    }
                }
            }
        }
        if(found_next_seg) {
            prev_seg = current_seg;
            current_seg = next_seg;
            next_seg = ((void *)0);
        } else {
            printf("\n\tError: could not find next routing segment for net %d\n", net->net_num);
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "SRC/base/verify.c", 137, __extension__ __PRETTY_FUNCTION__); }));
        }
        free_adjacent_segs(adjacent_segs);
    }
}

canonical_original_code:
void verify_routed_net(struct s_net *net) {
    struct s_pin *source_pin = net->source_pin;
    struct s_pin *sink_pin = net->sink_pin;
    struct s_wire *source_wire = ((void *)0);
    struct s_wire *sink_wire = ((void *)0);
    int source_net_index;
    for(source_net_index = 0; source_net_index < source_pin->num_adjacent_wires; source_net_index++) {
        struct s_wire *tmp_wire = source_pin->array_of_adjacent_wires[source_net_index];
        if(tmp_wire == net->associated_wires[net->num_associated_wires - 1]) {
            if(source_wire == ((void *)0)) {
                source_wire = tmp_wire;
            } else {
                ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "SRC/base/verify.c", 57, __extension__ __PRETTY_FUNCTION__); }));
            }
        }
    }
    if (source_wire == ((void *)0)) {
        printf("\tError: Could not find source wire segment for net '%d'\n", net->net_num);
        return;
    }
    int sink_net_index;
    for(sink_net_index = 0; sink_net_index < sink_pin->num_adjacent_wires; sink_net_index++) {
        struct s_wire *tmp_wire = sink_pin->array_of_adjacent_wires[sink_net_index];
        if(tmp_wire == net->associated_wires[0]) {
            if(sink_wire == ((void *)0)) {
                sink_wire = tmp_wire;
            } else {
                ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "SRC/base/verify.c", 77, __extension__ __PRETTY_FUNCTION__); }));
            }
        }
    }
    if (source_wire == ((void *)0)) {
        printf("\tError: Could not find sink wire segment for net '%d'\n", net->net_num);
        return;
    }
    int associated_wire_index = net->num_associated_wires - 2;
    struct s_wire *prev_seg = ((void *)0);
    struct s_wire *current_seg = source_wire;
    struct s_wire *next_seg = ((void *)0);
    while(current_seg != sink_wire) {
        enum e_boolean found_next_seg = FALSE;
        struct s_adjacent_segs *adjacent_segs = find_all_adjacent_segs(current_seg);
        int sb_index;
        int adjacent_wire_cnt;
        for(sb_index = 0; sb_index < adjacent_segs->num_sb; sb_index++) {
            for(adjacent_wire_cnt = 0; adjacent_wire_cnt < adjacent_segs->num_segs[sb_index]; adjacent_wire_cnt++) {
                struct s_wire *tmp_seg = adjacent_segs->array_of_segs[sb_index][adjacent_wire_cnt];
                if(tmp_seg == prev_seg) {
                    continue;
                }
                if(tmp_seg == current_seg) {
                    continue;
                }
                if(tmp_seg == next_seg) {
                    continue;
                }
                if(tmp_seg == net->associated_wires[associated_wire_index]) {
                    if(found_next_seg == FALSE) {
                        next_seg = tmp_seg;
                        found_next_seg = TRUE;
                        ((void) sizeof ((associated_wire_index - 1 >= -1) ? 1 : 0), __extension__ ({ if (associated_wire_index - 1 >= -1) ; else __assert_fail ("associated_wire_index - 1 >= -1", "SRC/base/verify.c", 121, __extension__ __PRETTY_FUNCTION__); }));
                        associated_wire_index--;
                    } else {
                        printf("\n\tError, found multiple adjacent wires '%s' & '%s' with the same associated net\n", short_wire_name(tmp_seg), short_wire_name(next_seg));
                        ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "SRC/base/verify.c", 125, __extension__ __PRETTY_FUNCTION__); }));
                    }
                }
            }
        }
        if(found_next_seg) {
            prev_seg = current_seg;
            current_seg = next_seg;
            next_seg = ((void *)0);
        } else {
            printf("\n\tError: could not find next routing segment for net %d\n", net->net_num);
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "SRC/base/verify.c", 137, __extension__ __PRETTY_FUNCTION__); }));
        }
        free_adjacent_segs(adjacent_segs);
    }
}

variable_types: struct s_net { struct s_pin { struct s_block { int x_coord; int y_coord; struct s_pin **array_of_pins; int num_pins; } *block; int pin_num; struct s_wire { int channel_x_coord; int channel_y_coord; struct s_switchblock { int x_coord; int y_coord; struct s_wire ***adjacency_list; int *num_adjacencies; int *occupancy_list; } **array_of_adjacent_switchblocks; int num_switchblocks; struct s_pin **array_of_adjacent_pins; int num_adjacent_pins; int channel_pair_num; struct s_wire *reservoir_wire; int wire_num; double occupancy; double present_cost; double history_cost; enum e_ROUTING_LABEL { NONE=-1, TARGET=0, SOURCE=1, USED=2, CURRENT_EXPANSION=3 } label_type; double label_value; int counted; } **array_of_adjacent_wires; int num_adjacent_wires; struct s_net *associated_net; } *source_pin; struct s_pin *sink_pin; int net_num; struct s_wire **associated_wires; int num_associated_wires; } *

variable_types: struct s_pin { struct s_block { int x_coord; int y_coord; struct s_pin **array_of_pins; int num_pins; } *block; int pin_num; struct s_wire { int channel_x_coord; int channel_y_coord; struct s_switchblock { int x_coord; int y_coord; struct s_wire ***adjacency_list; int *num_adjacencies; int *occupancy_list; } **array_of_adjacent_switchblocks; int num_switchblocks; struct s_pin **array_of_adjacent_pins; int num_adjacent_pins; int channel_pair_num; struct s_wire *reservoir_wire; int wire_num; double occupancy; double present_cost; double history_cost; enum e_ROUTING_LABEL { NONE=-1, TARGET=0, SOURCE=1, USED=2, CURRENT_EXPANSION=3 } label_type; double label_value; int counted; } **array_of_adjacent_wires; int num_adjacent_wires; struct s_net { struct s_pin *source_pin; struct s_pin *sink_pin; int net_num; struct s_wire **associated_wires; int num_associated_wires; } *associated_net; } *

variable_types: struct s_adjacent_segs { int *num_segs; int num_sb; struct s_wire { int channel_x_coord; int channel_y_coord; struct s_switchblock { int x_coord; int y_coord; struct s_wire ***adjacency_list; int *num_adjacencies; int *occupancy_list; } **array_of_adjacent_switchblocks; int num_switchblocks; struct s_pin { struct s_block { int x_coord; int y_coord; struct s_pin **array_of_pins; int num_pins; } *block; int pin_num; struct s_wire **array_of_adjacent_wires; int num_adjacent_wires; struct s_net { struct s_pin *source_pin; struct s_pin *sink_pin; int net_num; struct s_wire **associated_wires; int num_associated_wires; } *associated_net; } **array_of_adjacent_pins; int num_adjacent_pins; int channel_pair_num; struct s_wire *reservoir_wire; int wire_num; double occupancy; double present_cost; double history_cost; enum e_ROUTING_LABEL { NONE=-1, TARGET=0, SOURCE=1, USED=2, CURRENT_EXPANSION=3 } label_type; double label_value; int counted; } ***array_of_segs; } *

user_defined_types: struct s_pin { struct s_block *block; int pin_num; struct s_wire **array_of_adjacent_wires; int num_adjacent_wires; struct s_net *associated_net; }

user_defined_types: struct s_wire { int channel_x_coord; int channel_y_coord; struct s_switchblock **array_of_adjacent_switchblocks; int num_switchblocks; struct s_pin **array_of_adjacent_pins; int num_adjacent_pins; int channel_pair_num; struct s_wire *reservoir_wire; int wire_num; double occupancy; double present_cost; double history_cost; enum e_ROUTING_LABEL label_type; double label_value; int counted; }

user_defined_types: struct s_adjacent_segs { int *num_segs; int num_sb; struct s_wire ***array_of_segs; }


decompiled_code:
int verify_routed_netlist()
{
_QWORD *v0; // rbp
unsigned __int64 v1; // rbx
__int64 *v2; // rdi
int v3; // eax

puts("\nVerifying routed netlist connectivity...");
v0 = *(_QWORD **)(FPGA + 16LL);
if ( v0[1] )
{
v1 = 0LL;
do
{
v2 = *(__int64 **)(*v0 + 8 * v1++);
verify_routed_net(v2);
}
while ( v0[1] > v1 );
}
puts("DONE");
puts("\vVerifying no resource sharing occurs...");
v3 = count_overused_resources();
if ( v3 > 0 )
printf("\tError: %d resources overused\n", (unsigned int)v3);
return puts("DONE");
}

canonical_decompiled_code:
int func1()
{
_QWORD *v0; // rbp
unsigned __int64 v1; // rbx
__int64 *v2; // rdi
int v3; // eax

puts("\nVerifying routed netlist connectivity...");
v0 = *(_QWORD **)(FPGA + 16LL);
if ( v0[1] )
{
v1 = 0LL;
do
{
v2 = *(__int64 **)(*v0 + 8 * v1++);
func0(v2);
}
while ( v0[1] > v1 );
}
puts("DONE");
puts("\vVerifying no resource sharing occurs...");
v3 = count_overused_resources();
if ( v3 > 0 )
printf("\tError: %d resources overused\n", (unsigned int)v3);
return puts("DONE");
}

original_code:
void verify_routed_netlist(void) {
    printf("\nVerifying routed netlist connectivity...\n");
    int net_index;
    t_netlist* netlist = FPGA->netlist;
    for(net_index = 0; net_index < netlist->num_nets; net_index++) {
        t_net* net = netlist->array_of_nets[net_index];
        verify_routed_net(net);
    }
    printf("DONE\n");
    printf("\vVerifying no resource sharing occurs...\n");
    int overused_resource_count = count_overused_resources();
    if (overused_resource_count > 0) {
        printf("\tError: %d resources overused\n", overused_resource_count);
    }
    printf("DONE\n");
}

canonical_original_code:
void verify_routed_netlist() {
    printf("\nVerifying routed netlist connectivity...\n");
    int net_index;
    struct s_netlist *netlist = FPGA->netlist;
    for(net_index = 0; net_index < netlist->num_nets; net_index++) {
        struct s_net *net = netlist->array_of_nets[net_index];
        verify_routed_net(net);
    }
    printf("DONE\n");
    printf("\vVerifying no resource sharing occurs...\n");
    int overused_resource_count = count_overused_resources();
    if (overused_resource_count > 0) {
        printf("\tError: %d resources overused\n", overused_resource_count);
    }
    printf("DONE\n");
}

variable_types: struct s_netlist { struct s_net { struct s_pin { struct s_block { int x_coord; int y_coord; struct s_pin **array_of_pins; int num_pins; } *block; int pin_num; struct s_wire { int channel_x_coord; int channel_y_coord; struct s_switchblock { int x_coord; int y_coord; struct s_wire ***adjacency_list; int *num_adjacencies; int *occupancy_list; } **array_of_adjacent_switchblocks; int num_switchblocks; struct s_pin **array_of_adjacent_pins; int num_adjacent_pins; int channel_pair_num; struct s_wire *reservoir_wire; int wire_num; double occupancy; double present_cost; double history_cost; enum e_ROUTING_LABEL { NONE=-1, TARGET=0, SOURCE=1, USED=2, CURRENT_EXPANSION=3 } label_type; double label_value; int counted; } **array_of_adjacent_wires; int num_adjacent_wires; struct s_net *associated_net; } *source_pin; struct s_pin *sink_pin; int net_num; struct s_wire **associated_wires; int num_associated_wires; } **array_of_nets; unsigned long num_nets; struct s_net *tmp_net; } *

user_defined_types: struct s_netlist { struct s_net **array_of_nets; unsigned long num_nets; struct s_net *tmp_net; }

user_defined_types: struct s_net { struct s_pin *source_pin; struct s_pin *sink_pin; int net_num; struct s_wire **associated_wires; int num_associated_wires; }


decompiled_code:
__int64 print_wire_seg_stats()
{
__int64 *v0; // rbx
__int64 v1; // rdx
__int64 v2; // rax
unsigned int v3; // er12
unsigned int v4; // ebp
__int64 v5; // rcx
int v6; // edx
__int64 v7; // rax
float v8; // xmm1_4
__int64 v10; // rdx

v0 = *(__int64 **)(FPGA + 16LL);
v1 = v0[1];
if ( v1 )
{
v2 = *v0;
v3 = 0;
v4 = 0;
v5 = *v0 + 8 * v1;
do
{
v6 = *(_DWORD *)(*(_QWORD *)v2 + 32LL);
v3 += v6;
if ( (int)v4 < v6 )
v4 = *(_DWORD *)(*(_QWORD *)v2 + 32LL);
v2 += 8LL;
}
while ( v2 != v5 );
}
else
{
v3 = 0;
v4 = 0;
}
puts(" Segment Utilization");
printf("\tTotal # Segs: %d segs\n", v3);
v7 = v0[1];
if ( v7 < 0 )
{
v10 = v0[1] & 1 | ((unsigned __int64)v0[1] >> 1);
v8 = (float)(int)v10 + (float)(int)v10;
}
else
{
v8 = (float)(int)v7;
}
printf("\tAVG # Segs: %.1f segs\n", (float)((float)(int)v3 / v8));
printf("\tMAX # Segs: %d segs\n", v4);
return v3;
}

canonical_decompiled_code:
__int64 func2()
{
__int64 *v0; // rbx
__int64 v1; // rdx
__int64 v2; // rax
unsigned int v3; // er12
unsigned int v4; // ebp
__int64 v5; // rcx
int v6; // edx
__int64 v7; // rax
float v8; // xmm1_4
__int64 v10; // rdx

v0 = *(__int64 **)(FPGA + 16LL);
v1 = v0[1];
if ( v1 )
{
v2 = *v0;
v3 = 0;
v4 = 0;
v5 = *v0 + 8 * v1;
do
{
v6 = *(_DWORD *)(*(_QWORD *)v2 + 32LL);
v3 += v6;
if ( (int)v4 < v6 )
v4 = *(_DWORD *)(*(_QWORD *)v2 + 32LL);
v2 += 8LL;
}
while ( v2 != v5 );
}
else
{
v3 = 0;
v4 = 0;
}
puts(" Segment Utilization");
printf("\tTotal # Segs: %d segs\n", v3);
v7 = v0[1];
if ( v7 < 0 )
{
v10 = v0[1] & 1 | ((unsigned __int64)v0[1] >> 1);
v8 = (float)(int)v10 + (float)(int)v10;
}
else
{
v8 = (float)(int)v7;
}
printf("\tAVG # Segs: %.1f segs\n", (float)((float)(int)v3 / v8));
printf("\tMAX # Segs: %d segs\n", v4);
return v3;
}

original_code:
int print_wire_seg_stats(void) {
    t_netlist* netlist = FPGA->netlist;
    int max_num_segs = 0;
    int total_num_segs = 0;
    int net_index;
    for(net_index = 0; net_index < netlist->num_nets; net_index++) {
        t_net* net = netlist->array_of_nets[net_index];
        int net_length = net->num_associated_wires;
        total_num_segs += net_length;
        if (net_length > max_num_segs) {
            max_num_segs = net_length;
        }
    }
    printf("  Segment Utilization\n");
    printf("\tTotal # Segs: %d segs\n", total_num_segs);
    printf("\tAVG   # Segs: %.1f segs\n", total_num_segs / (float) netlist->num_nets);
    printf("\tMAX   # Segs: %d segs\n", max_num_segs);
    return total_num_segs;
}

canonical_original_code:
int print_wire_seg_stats() {
    struct s_netlist *netlist = FPGA->netlist;
    int max_num_segs = 0;
    int total_num_segs = 0;
    int net_index;
    for(net_index = 0; net_index < netlist->num_nets; net_index++) {
        struct s_net *net = netlist->array_of_nets[net_index];
        int net_length = net->num_associated_wires;
        total_num_segs += net_length;
        if (net_length > max_num_segs) {
            max_num_segs = net_length;
        }
    }
    printf("  Segment Utilization\n");
    printf("\tTotal # Segs: %d segs\n", total_num_segs);
    printf("\tAVG   # Segs: %.1f segs\n", total_num_segs / (float) netlist->num_nets);
    printf("\tMAX   # Segs: %d segs\n", max_num_segs);
    return total_num_segs;
}

user_defined_types: struct s_block { int x_coord; int y_coord; struct s_pin **array_of_pins; int num_pins; }

user_defined_types: enum e_ROUTING_LABEL { NONE=-1, TARGET=0, SOURCE=1, USED=2, CURRENT_EXPANSION=3 }

user_defined_types: struct s_switchblock { int x_coord; int y_coord; struct s_wire ***adjacency_list; int *num_adjacencies; int *occupancy_list; }


original_code:
float evaluate_phi(int total_num_segs) {
    int num_reservoir_segs;
    t_netlist* netlist = FPGA->netlist;
    int net_index;
    for(net_index = 0; net_index < netlist->num_nets; net_index++) {
        t_net* net = netlist->array_of_nets[net_index];
        int seg_index;
        for(seg_index = 0; seg_index < net->num_associated_wires; seg_index++) {
            t_wire* net_wire = net->associated_wires[seg_index];
            t_wire* reservoir_wire = get_reservoir_wire(net_wire);
            if(FPGA->W % 2 != 0 && reservoir_wire == ((void *)0)) {
                continue;
            }
            if (reservoir_wire->occupancy == 0) {
                num_reservoir_segs++;
            }
        }
    }
    float phi = (float) total_num_segs - (0.3 * (float) num_reservoir_segs);
    return phi;
}

canonical_original_code:
float evaluate_phi(int total_num_segs) {
    int num_reservoir_segs;
    struct s_netlist *netlist = FPGA->netlist;
    int net_index;
    for(net_index = 0; net_index < netlist->num_nets; net_index++) {
        struct s_net *net = netlist->array_of_nets[net_index];
        int seg_index;
        for(seg_index = 0; seg_index < net->num_associated_wires; seg_index++) {
            struct s_wire *net_wire = net->associated_wires[seg_index];
            struct s_wire *reservoir_wire = get_reservoir_wire(net_wire);
            if(FPGA->W % 2 != 0 && reservoir_wire == ((void *)0)) {
                continue;
            }
            if (reservoir_wire->occupancy == 0) {
                num_reservoir_segs++;
            }
        }
    }
    float phi = (float) total_num_segs - (0.3 * (float) num_reservoir_segs);
    return phi;
}

variable_types: struct s_wire { int channel_x_coord; int channel_y_coord; struct s_switchblock { int x_coord; int y_coord; struct s_wire ***adjacency_list; int *num_adjacencies; int *occupancy_list; } **array_of_adjacent_switchblocks; int num_switchblocks; struct s_pin { struct s_block { int x_coord; int y_coord; struct s_pin **array_of_pins; int num_pins; } *block; int pin_num; struct s_wire **array_of_adjacent_wires; int num_adjacent_wires; struct s_net { struct s_pin *source_pin; struct s_pin *sink_pin; int net_num; struct s_wire **associated_wires; int num_associated_wires; } *associated_net; } **array_of_adjacent_pins; int num_adjacent_pins; int channel_pair_num; struct s_wire *reservoir_wire; int wire_num; double occupancy; double present_cost; double history_cost; enum e_ROUTING_LABEL { NONE=-1, TARGET=0, SOURCE=1, USED=2, CURRENT_EXPANSION=3 } label_type; double label_value; int counted; } *

variable_types: phi float

return_type: float


decompiled_code:
int evaluate_qor()
{
int v0; // ebx
float v2; // [rsp+Ch] [rbp-Ch]

puts("\nQOR RESULTS:");
v0 = print_wire_seg_stats();
v2 = evaluate_phi(v0);
puts(" Reservoir Optimization:");
return printf("\tPHI: %.1f segs\t(%.2f of total # segs)\n", v2, (float)(v2 / (float)v0));
}

canonical_decompiled_code:
int func4()
{
int v0; // ebx
float v2; // [rsp+Ch] [rbp-Ch]

puts("\nQOR RESULTS:");
v0 = func2();
v2 = func3(v0);
puts(" Reservoir Optimization:");
return printf("\tPHI: %.1f segs\t(%.2f of total # segs)\n", v2, (float)(v2 / (float)v0));
}

original_code:
void evaluate_qor(void) {
    printf("\nQOR RESULTS:\n");
    int total_num_segs = print_wire_seg_stats();
    float phi = evaluate_phi(total_num_segs);
    printf("  Reservoir Optimization:\n");
    printf("\tPHI: %.1f segs\t(%.2f of total # segs)\n", phi, (phi/total_num_segs));
}

canonical_original_code:
void evaluate_qor() {
    printf("\nQOR RESULTS:\n");
    int total_num_segs = print_wire_seg_stats();
    float phi = evaluate_phi(total_num_segs);
    printf("  Reservoir Optimization:\n");
    printf("\tPHI: %.1f segs\t(%.2f of total # segs)\n", phi, (phi/total_num_segs));
}


original_code:
int umfzi_get_memory
(
    NumericType *Numeric,
    WorkType *Work,
    int needunits,
    int r2,
    int c2,
    int do_Fcpos
)
{
    double nsize, bsize, tsize ;
    int 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 += umfzi_tuple_lengths (Numeric, Work, &tsize) ;
    nsize += tsize ;
    needunits += 2 ;
    ;
    minsize = Numeric->size + needunits ;
    nsize += (double) Numeric->size ;
    bsize = ((double) 0x7fffffff) / sizeof (Unit) - 1 ;
    newsize = (int) ((1.2) * ((double) minsize)) ;
    nsize *= (1.2) ;
    nsize += 1 ;
    if (newsize < 0 || nsize > bsize)
    {
 ;
 newsize = (int) 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_i_realloc (Numeric->Memory, newsize, sizeof (Unit)) ;
 if (!mnew)
 {
     if (newsize == minsize)
     {
  mnew = Numeric->Memory ;
  newsize = Numeric->size ;
     }
     else
     {
  newsize = (int) ((0.95) * ((double) newsize)) ;
  newsize = (((minsize) > (newsize)) ? (minsize) : (newsize)) ;
     }
 }
    }
    ;
    costly = (mnew != Numeric->Memory) ;
    Numeric->Memory = mnew ;
    if (Work->E [0])
    {
 int nb, dr, dc ;
 nb = Work->nb ;
 dr = Work->fnr_curr ;
 dc = Work->fnc_curr ;
 Work->Flublock = (DoubleComplex *) (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 ;
 umfzi_mem_free_tail_block (Numeric, i) ;
 Numeric->nrealloc++ ;
 if (costly)
 {
     Numeric->ncostly++ ;
 }
    }
    ;
    umfzi_garbage_collection (Numeric, Work, r2, c2, do_Fcpos) ;
    return (umfzi_build_tuples (Numeric, Work)) ;
}

canonical_original_code:
int umfzi_get_memory(struct NumericType *Numeric, struct WorkType *Work, int needunits, int r2, int c2, int do_Fcpos)
{
    double nsize; double bsize; double tsize;
    int i; int minsize; int newsize; int newmem; int costly; int row; int col; int *Row_tlen; int *Col_tlen; int n_row; int n_col; int *Row_degree; int *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 += umfzi_tuple_lengths (Numeric, Work, &tsize) ;
    nsize += tsize ;
    needunits += 2 ;
    ;
    minsize = Numeric->size + needunits ;
    nsize += (double) Numeric->size ;
    bsize = ((double) 0x7fffffff) / sizeof (Unit) - 1 ;
    newsize = (int) ((1.2) * ((double) minsize)) ;
    nsize *= (1.2) ;
    nsize += 1 ;
    if (newsize < 0 || nsize > bsize)
    {
 ;
 newsize = (int) 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_i_realloc (Numeric->Memory, newsize, sizeof (Unit)) ;
 if (!mnew)
 {
     if (newsize == minsize)
     {
  mnew = Numeric->Memory ;
  newsize = Numeric->size ;
     }
     else
     {
  newsize = (int) ((0.95) * ((double) newsize)) ;
  newsize = (((minsize) > (newsize)) ? (minsize) : (newsize)) ;
     }
 }
    }
    ;
    costly = (mnew != Numeric->Memory) ;
    Numeric->Memory = mnew ;
    if (Work->E [0])
    {
 int nb; int dr; int dc;
 nb = Work->nb ;
 dr = Work->fnr_curr ;
 dc = Work->fnc_curr ;
 Work->Flublock = (struct DoubleComplex *) (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 ;
 umfzi_mem_free_tail_block (Numeric, i) ;
 Numeric->nrealloc++ ;
 if (costly)
 {
     Numeric->ncostly++ ;
 }
    }
    ;
    umfzi_garbage_collection (Numeric, Work, r2, c2, do_Fcpos) ;
    return (umfzi_build_tuples (Numeric, Work)) ;
}

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

variable_types: nsize double

variable_types: bsize double

variable_types: tsize double

variable_types: i int

variable_types: minsize int

variable_types: newsize int

variable_types: newmem int

variable_types: costly int

variable_types: row int

variable_types: col int

variable_types: nb int

variable_types: dr int

variable_types: dc int


original_code:
long
umfpack_dl_solve
(
    long sys,
    const long Ap [ ],
    const long Ai [ ],
    const double Ax [ ],
    double Xx [ ],
    const double Bx [ ],
    void *NumericHandle,
    const double Control [20],
    double User_Info [90]
)
{
    double Info2 [90], stats [2] ;
    double *Info ;
    NumericType *Numeric ;
    long n, i, irstep, status ;
    long *Pattern, wsize ;
    double *W ;
    umfpack_tic (stats) ;
    irstep = ((Control != (double *) ((void *)0)) ? (((Control [7]) != (Control [7])) ? 2 : Control [7]) : 2) ;
    if (User_Info != (double *) ((void *)0))
    {
 Info = User_Info ;
 for (i = 80 ; i <= 85 ; i++)
 {
     Info [i] = (-1) ;
 }
    }
    else
    {
 Info = Info2 ;
 for (i = 0 ; i < 90 ; i++)
 {
     Info [i] = (-1) ;
 }
    }
    Info [0] = (0) ;
    Info [84] = 0 ;
    Numeric = (NumericType *) NumericHandle ;
    if (!umfdl_valid_numeric (Numeric))
    {
 Info [0] = (-3) ;
 return ((-3)) ;
    }
    Info [1] = Numeric->n_row ;
    Info [16] = Numeric->n_col ;
    if (Numeric->n_row != Numeric->n_col)
    {
 Info [0] = (-13) ;
 return ((-13)) ;
    }
    n = Numeric->n_row ;
    if (Numeric->nnzpiv < n
 || ((Numeric->rcond) == 0.) || ((Numeric->rcond) != (Numeric->rcond)))
    {
 irstep = 0 ;
    }
    if (!Xx || !Bx)
    {
 Info [0] = (-5) ;
 return ((-5)) ;
    }
    if (sys >= (3))
    {
 irstep = 0 ;
    }
    if (irstep > 0)
    {
 wsize = 5*n ;
    }
    else
    {
 wsize = n ;
    }
    Pattern = (long *) umf_l_malloc (n, sizeof (long)) ;
    W = (double *) umf_l_malloc (wsize, sizeof (double)) ;
    if (!W || !Pattern)
    {
 ;
 Info [0] = (-1) ;
 (void) umf_l_free ((void *) W) ;
 (void) umf_l_free ((void *) Pattern) ;
 return ((-1)) ;
    }
    status = umfdl_solve (sys, Ap, Ai, Ax, Xx, Bx,
 Numeric, irstep, Info, Pattern, W) ;
    (void) umf_l_free ((void *) W) ;
    (void) umf_l_free ((void *) Pattern) ;
    ;
    Info [0] = status ;
    if (status >= 0)
    {
 umfpack_toc (stats) ;
 Info [86] = stats [0] ;
 Info [85] = stats [1] ;
    }
    return (status) ;
}

canonical_original_code:
long umfpack_dl_solve(long sys, long Ap[], long Ai[], double Ax[], double Xx[], double Bx[], void *NumericHandle, double Control[20], double User_Info[90])
{
    double Info2[90]; double stats[2];
    double *Info;
    struct NumericType *Numeric;
    long n; long i; long irstep; long status;
    long *Pattern; long wsize;
    double *W;
    umfpack_tic (stats) ;
    irstep = ((Control != (double *) ((void *)0)) ? (((Control [7]) != (Control [7])) ? 2 : Control [7]) : 2) ;
    if (User_Info != (double *) ((void *)0))
    {
 Info = User_Info ;
 for (i = 80 ; i <= 85 ; i++)
 {
     Info [i] = (-1) ;
 }
    }
    else
    {
 Info = Info2 ;
 for (i = 0 ; i < 90 ; i++)
 {
     Info [i] = (-1) ;
 }
    }
    Info [0] = (0) ;
    Info [84] = 0 ;
    Numeric = (struct NumericType *) NumericHandle ;
    if (!umfdl_valid_numeric (Numeric))
    {
 Info [0] = (-3) ;
 return ((-3)) ;
    }
    Info [1] = Numeric->n_row ;
    Info [16] = Numeric->n_col ;
    if (Numeric->n_row != Numeric->n_col)
    {
 Info [0] = (-13) ;
 return ((-13)) ;
    }
    n = Numeric->n_row ;
    if (Numeric->nnzpiv < n
 || ((Numeric->rcond) == 0.) || ((Numeric->rcond) != (Numeric->rcond)))
    {
 irstep = 0 ;
    }
    if (!Xx || !Bx)
    {
 Info [0] = (-5) ;
 return ((-5)) ;
    }
    if (sys >= (3))
    {
 irstep = 0 ;
    }
    if (irstep > 0)
    {
 wsize = 5*n ;
    }
    else
    {
 wsize = n ;
    }
    Pattern = (long *) umf_l_malloc (n, sizeof (long)) ;
    W = (double *) umf_l_malloc (wsize, sizeof (double)) ;
    if (!W || !Pattern)
    {
 ;
 Info [0] = (-1) ;
 (void) umf_l_free ((void *) W) ;
 (void) umf_l_free ((void *) Pattern) ;
 return ((-1)) ;
    }
    status = umfdl_solve (sys, Ap, Ai, Ax, Xx, Bx,
 Numeric, irstep, Info, Pattern, W) ;
    (void) umf_l_free ((void *) W) ;
    (void) umf_l_free ((void *) Pattern) ;
    ;
    Info [0] = status ;
    if (status >= 0)
    {
 umfpack_toc (stats) ;
 Info [86] = stats [0] ;
 Info [85] = stats [1] ;
    }
    return (status) ;
}

variable_types: sys long

variable_types:
Ap
long []

variable_types:
Ai
long []

variable_types:
Ax
double []

variable_types:
Xx
double []

variable_types:
Bx
double []

variable_types:
NumericHandle
void *

variable_types:
Control
double [20]

variable_types:
stats
double [2]

variable_types:
Info
double *

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

variable_types: i long

variable_types: irstep long

variable_types: status long

variable_types:
Pattern
long *

variable_types: wsize long

variable_types:
W
double *

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:
void umfzi_mem_free_tail_block
(
    NumericType *Numeric,
    int i
)
{
    Unit *pprev, *pnext, *p, *pbig ;
    int sprev ;
    ;
    ;
    if (i == (-1) || i == 0) return ;
    p = Numeric->Memory + i ;
    p-- ;
    ;
    ;
    ;
    ;
    ;
    Numeric->tail_usage -= p->header.size + 1 ;
    pnext = p + 1 + p->header.size ;
    ;
    ;
    ;
    ;
    if (pnext->header.size < 0)
    {
 p->header.size += (-(pnext->header.size)) + 1 ;
 ;
    }
    if (p > Numeric->Memory + Numeric->itail)
    {
 ;
 pprev = p - 1 - p->header.prevsize ;
 ;
 ;
 sprev = pprev->header.size ;
 if (sprev < 0)
 {
     ;
     pprev->header.size = p->header.size + (-sprev) + 1 ;
     p = pprev ;
     ;
 }
    }
    pnext = p + 1 + p->header.size ;
    ;
    if (p == Numeric->Memory + Numeric->itail)
    {
 Numeric->itail = pnext - Numeric->Memory ;
 pnext->header.prevsize = 0 ;
 ;
 ;
 if (Numeric->ibig != (-1) && Numeric->ibig <= Numeric->itail)
 {
     Numeric->ibig = (-1) ;
 }
    }
    else
    {
 if (Numeric->ibig == (-1))
 {
     Numeric->ibig = p - Numeric->Memory ;
 }
 else
 {
     pbig = Numeric->Memory + Numeric->ibig ;
     if (-(pbig->header.size) < p->header.size)
     {
  Numeric->ibig = p - Numeric->Memory ;
     }
 }
 pnext->header.prevsize = p->header.size ;
 p->header.size = -(p->header.size) ;
    }
    ;
}

canonical_original_code:
void umfzi_mem_free_tail_block(struct NumericType *Numeric, int i)
{
    union Unit_union *pprev; union Unit_union *pnext; union Unit_union *p; union Unit_union *pbig;
    int sprev;
    ;
    ;
    if (i == (-1) || i == 0) return ;
    p = Numeric->Memory + i ;
    p-- ;
    ;
    ;
    ;
    ;
    ;
    Numeric->tail_usage -= p->header.size + 1 ;
    pnext = p + 1 + p->header.size ;
    ;
    ;
    ;
    ;
    if (pnext->header.size < 0)
    {
 p->header.size += (-(pnext->header.size)) + 1 ;
 ;
    }
    if (p > Numeric->Memory + Numeric->itail)
    {
 ;
 pprev = p - 1 - p->header.prevsize ;
 ;
 ;
 sprev = pprev->header.size ;
 if (sprev < 0)
 {
     ;
     pprev->header.size = p->header.size + (-sprev) + 1 ;
     p = pprev ;
     ;
 }
    }
    pnext = p + 1 + p->header.size ;
    ;
    if (p == Numeric->Memory + Numeric->itail)
    {
 Numeric->itail = pnext - Numeric->Memory ;
 pnext->header.prevsize = 0 ;
 ;
 ;
 if (Numeric->ibig != (-1) && Numeric->ibig <= Numeric->itail)
 {
     Numeric->ibig = (-1) ;
 }
    }
    else
    {
 if (Numeric->ibig == (-1))
 {
     Numeric->ibig = p - Numeric->Memory ;
 }
 else
 {
     pbig = Numeric->Memory + Numeric->ibig ;
     if (-(pbig->header.size) < p->header.size)
     {
  Numeric->ibig = p - Numeric->Memory ;
     }
 }
 pnext->header.prevsize = p->header.size ;
 p->header.size = -(p->header.size) ;
    }
    ;
}

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

variable_types: sprev int


original_code:
int umfpack_di_get_lunz
(
    int *lnz,
    int *unz,
    int *n_row,
    int *n_col,
    int *nz_udiag,
    void *NumericHandle
)
{
    NumericType *Numeric ;
    Numeric = (NumericType *) NumericHandle ;
    if (!umfdi_valid_numeric (Numeric))
    {
 return ((-3)) ;
    }
    if (!lnz || !unz || !n_row || !n_col || !nz_udiag)
    {
 return ((-5)) ;
    }
    *n_row = Numeric->n_row ;
    *n_col = Numeric->n_col ;
    *lnz = Numeric->lnz + (((Numeric->n_row) < (Numeric->n_col)) ? (Numeric->n_row) : (Numeric->n_col)) ;
    *unz = Numeric->unz + Numeric->nnzpiv ;
    *nz_udiag = Numeric->nnzpiv ;
    return ((0)) ;
}

canonical_original_code:
int umfpack_di_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *NumericHandle)
{
    struct NumericType *Numeric;
    Numeric = (struct NumericType *) NumericHandle ;
    if (!umfdi_valid_numeric (Numeric))
    {
 return ((-3)) ;
    }
    if (!lnz || !unz || !n_row || !n_col || !nz_udiag)
    {
 return ((-5)) ;
    }
    *n_row = Numeric->n_row ;
    *n_col = Numeric->n_col ;
    *lnz = Numeric->lnz + (((Numeric->n_row) < (Numeric->n_col)) ? (Numeric->n_row) : (Numeric->n_col)) ;
    *unz = Numeric->unz + Numeric->nnzpiv ;
    *nz_udiag = Numeric->nnzpiv ;
    return ((0)) ;
}

variable_types:
lnz
int *

variable_types:
unz
int *

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

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