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

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

variable_types:
Parent
int *

variable_types:
n
unsigned long

variable_types:
Weight
int *

variable_types:
Post
int *

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

variable_types:
Head
int *

variable_types:
Next
int *

variable_types:
Pstack
int *

variable_types:
Iwork
int *

variable_types: j int

variable_types: p int

variable_types: k int

variable_types: w int

variable_types: nextj int

variable_types:
s
unsigned long

variable_types: ok int

variable_types:
Whead
int *


dfs

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

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

variable_types:
Post
int []

variable_types:
Head
int []

variable_types:
Next
int []

variable_types:
Pstack
int []

variable_types: phead int

return_type: int


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

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

variable_types: nz int

variable_types:
Ti
int []

variable_types:
Tj
int []

variable_types:
Ap
int []

variable_types:
Ai
int []

variable_types:
Rp
int []

variable_types:
Rj
int []

variable_types:
W
int []

variable_types:
RowCount
int []

variable_types: i int

variable_types: cp int

variable_types: pdest int

variable_types: pj int


decompiled_code:
__int64 __fastcall umfzi_transpose(int a1, int a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int *a7, int a8, _DWORD *a9, __int64 a10, __int64 a11, __int64 a12, int a13, __int64 a14, __int64 a15, int a16)
{
__int64 v18; // rax
int *v19; // rsi
__int64 v20; // rdx
__int64 v21; // rax
_DWORD *v22; // rcx
__int64 i; // rax
__int64 j; // rax
bool v25; // al
bool v26; // dl
__int64 v27; // r8
__int64 result; // rax
__int64 v29; // rdx
int v30; // eax
_DWORD *v31; // r10
__int64 v32; // rcx
_QWORD *v33; // rdx
_DWORD *v34; // rsi
int v35; // eax
__int64 v36; // rax
_DWORD *v37; // rsi
__int64 v38; // rax
__int64 k; // rdx
__int64 l; // rdx
__int64 m; // r8
__int64 v42; // rax
__int64 v43; // rdx
_DWORD *v44; // rdi
_DWORD *v45; // rcx
int v46; // eax
_DWORD *v47; // r8
int v48; // esi
int v49; // eax
__int64 v50; // rcx
_QWORD *v51; // rdx
_DWORD *v52; // r10
int v53; // eax
__int64 v54; // rax
_DWORD *v55; // r9
int v56; // edi
__int64 v57; // rdx
_DWORD *v58; // r10
int v59; // eax
__int64 v60; // r8
__int64 v61; // rax
__int64 v62; // rdx
_DWORD *v63; // rdi
_DWORD *v64; // rcx
int v65; // eax
__int64 v66; // r8
__int64 v67; // rdx
int v68; // eax
_DWORD *v69; // r10
__int64 v70; // rcx
_QWORD *v71; // rdx
_DWORD *v72; // rsi
int v73; // eax
__int64 v74; // rax
__int64 n; // r9
__int64 v76; // rax
__int64 v77; // rdx
_DWORD *v78; // rdi
_DWORD *v79; // rcx
int v80; // eax
_DWORD *v81; // r9
int v82; // edi
__int64 v83; // rdx
_DWORD *v84; // rcx
int v85; // eax
_DWORD *v86; // r9
int v87; // edi
int v88; // eax
__int64 v89; // rcx
_QWORD *v90; // rdx
_DWORD *v91; // rsi
int v92; // eax
__int64 v93; // rax
_DWORD *v94; // r9
int v95; // edi
__int64 v96; // rdx
_DWORD *v97; // rcx
int v98; // eax

if ( a13 )
{
if ( !a4 || !a3 )
return 4294967291LL;
if ( a9 == 0LL || a10 == 0 || !a12 )
return 4294967291LL;
if ( a1 <= 0 || a2 <= 0 )
return 4294967290LL;
if ( !(unsigned int)umf_i_is_permutation(a6, a12, (unsigned int)a1, (unsigned int)a1) )
return 4294967281LL;
if ( !(unsigned int)umf_i_is_permutation(a7, a12, (unsigned int)a8, (unsigned int)a8) )
return 4294967281LL;
if ( (unsigned int)amd_valid((unsigned int)a1, (unsigned int)a2, a3, a4) )
return 4294967288LL;
goto LABEL_11;
}
if ( a1 > 0 )
{
LABEL_11:
v18 = 0LL;
do
{
*(_DWORD *)(a12 + 4 * v18) = 0;
a9[v18++] = 0;
}
while ( a1 > (int)v18 );
}
if ( a7 )
{
if ( a8 > 0 )
{
v19 = a7;
do
{
v20 = *v19;
LODWORD(v21) = *(_DWORD *)(a3 + 4 * v20);
v22 = (_DWORD *)(a3 + 4 * v20 + 4);
if ( (int)v21 < *v22 )
{
v21 = (int)v21;
do
++*(_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v21++));
while ( *v22 > (int)v21 );
}
++v19;
}
while ( v19 != &a7[a8 - 1 + 1] );
}
}
else if ( a2 > 0 )
{
v37 = (_DWORD *)(a3 + 4);
do
{
LODWORD(v38) = *(v37 - 1);
if ( (int)v38 < *v37 )
{
v38 = (int)v38;
do
++*(_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v38++));
while ( *v37 > (int)v38 );
}
++v37;
}
while ( v37 != (_DWORD *)(a3 + 4LL * (unsigned int)(a2 - 1) + 8) );
}
if ( a6 )
{
*a9 = 0;
if ( a1 > 0 )
{
for ( i = 0LL; i != a1; ++i )
a9[i + 1] = *(_DWORD *)(a12 + 4LL * *(int *)(a6 + 4 * i)) + a9[i];
for ( j = 0LL; j != a1; ++j )
*(_DWORD *)(a12 + 4LL * *(int *)(a6 + 4 * j)) = a9[j];
}
}
else
{
*a9 = 0;
if ( a1 > 0 )
{
for ( k = 0LL; k != a1; ++k )
a9[k + 1] = a9[k] + *(_DWORD *)(a12 + 4 * k);
for ( l = 0LL; l != a1; ++l )
*(_DWORD *)(a12 + 4 * l) = a9[l];
}
}
v25 = a11 != 0 && a5 != 0;
v26 = a15 != 0 && a14 != 0;
if ( a16 && v25 )
{
if ( a7 )
{
if ( v26 )
{
if ( a8 <= 0 )
{
result = 0LL;
}
else
{
for ( m = 0LL; m != a8; ++m )
{
v42 = a7[m];
LODWORD(v43) = *(_DWORD *)(a3 + 4 * v42);
v44 = (_DWORD *)(a3 + 4 * v42 + 4);
if ( (int)v43 < *v44 )
{
v43 = (int)v43;
do
{
v45 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v43));
v46 = (*v45)++;
*(_DWORD *)(a10 + 4LL * v46) = m;
*(_QWORD *)(a11 + 8LL * v46) = *(_QWORD *)(a5 + 8 * v43);
*(_QWORD *)(a15 + 8LL * v46) = *(_QWORD *)(a14 + 8 * v43++) ^ LC0;
}
while ( *v44 > (int)v43 );
}
}
result = 0LL;
}
}
else
{
v27 = 0LL;
result = 0LL;
if ( a8 > 0 )
{
do
{
v29 = a7[v27];
v30 = *(_DWORD *)(a3 + 4 * v29);
v31 = (_DWORD *)(a3 + 4 * v29 + 4);
if ( v30 < *v31 )
{
v32 = v30;
v33 = (_QWORD *)(a5 + 16LL * v30);
do
{
v34 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v32));
v35 = (*v34)++;
*(_DWORD *)(a10 + 4LL * v35) = v27;
v36 = 2 * v35;
*(_QWORD *)(a11 + 8 * v36) = *v33;
*(_QWORD *)(a11 + 8 * v36 + 8) = v33[1] ^ LC0;
++v32;
v33 += 2;
}
while ( *v31 > (int)v32 );
}
++v27;
}
while ( a8 != v27 );
result = 0LL;
}
}
}
else if ( v26 )
{
if ( a2 <= 0 )
{
result = 0LL;
}
else
{
v55 = (_DWORD *)(a3 + 4);
v56 = 0;
do
{
LODWORD(v57) = *(v55 - 1);
if ( (int)v57 < *v55 )
{
v57 = (int)v57;
do
{
v58 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v57));
v59 = (*v58)++;
*(_DWORD *)(a10 + 4LL * v59) = v56;
*(_QWORD *)(a11 + 8LL * v59) = *(_QWORD *)(a5 + 8 * v57);
*(_QWORD *)(a15 + 8LL * v59) = *(_QWORD *)(a14 + 8 * v57++) ^ LC0;
}
while ( *v55 > (int)v57 );
}
++v56;
++v55;
}
while ( a2 != v56 );
result = 0LL;
}
}
else
{
v47 = (_DWORD *)(a3 + 4);
v48 = 0;
result = 0LL;
if ( a2 > 0 )
{
do
{
v49 = *(v47 - 1);
if ( v49 < *v47 )
{
v50 = v49;
v51 = (_QWORD *)(a5 + 16LL * v49);
do
{
v52 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v50));
v53 = (*v52)++;
*(_DWORD *)(a10 + 4LL * v53) = v48;
v54 = 2 * v53;
*(_QWORD *)(a11 + 8 * v54) = *v51;
*(_QWORD *)(a11 + 8 * v54 + 8) = v51[1] ^ LC0;
++v50;
v51 += 2;
}
while ( *v47 > (int)v50 );
}
++v48;
++v47;
}
while ( a2 != v48 );
result = 0LL;
}
}
}
else if ( a7 )
{
if ( v25 )
{
if ( v26 )
{
if ( a8 <= 0 )
{
result = 0LL;
}
else
{
for ( n = 0LL; n != a8; ++n )
{
v76 = a7[n];
LODWORD(v77) = *(_DWORD *)(a3 + 4 * v76);
v78 = (_DWORD *)(a3 + 4 * v76 + 4);
if ( (int)v77 < *v78 )
{
v77 = (int)v77;
do
{
v79 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v77));
v80 = (*v79)++;
*(_DWORD *)(a10 + 4LL * v80) = n;
*(_QWORD *)(a11 + 8LL * v80) = *(_QWORD *)(a5 + 8 * v77);
*(_QWORD *)(a15 + 8LL * v80) = *(_QWORD *)(a14 + 8 * v77++);
}
while ( *v78 > (int)v77 );
}
}
result = 0LL;
}
}
else
{
v66 = 0LL;
result = 0LL;
if ( a8 > 0 )
{
do
{
v67 = a7[v66];
v68 = *(_DWORD *)(a3 + 4 * v67);
v69 = (_DWORD *)(a3 + 4 * v67 + 4);
if ( v68 < *v69 )
{
v70 = v68;
v71 = (_QWORD *)(a5 + 16LL * v68);
do
{
v72 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v70));
v73 = (*v72)++;
*(_DWORD *)(a10 + 4LL * v73) = v66;
v74 = 2 * v73;
*(_QWORD *)(a11 + 8 * v74) = *v71;
*(_QWORD *)(a11 + 8 * v74 + 8) = v71[1];
++v70;
v71 += 2;
}
while ( *v69 > (int)v70 );
}
++v66;
}
while ( a8 != v66 );
result = 0LL;
}
}
}
else
{
v60 = 0LL;
result = 0LL;
if ( a8 > 0 )
{
do
{
v61 = a7[v60];
LODWORD(v62) = *(_DWORD *)(a3 + 4 * v61);
v63 = (_DWORD *)(a3 + 4 * v61 + 4);
if ( (int)v62 < *v63 )
{
v62 = (int)v62;
do
{
v64 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v62));
v65 = (*v64)++;
*(_DWORD *)(a10 + 4LL * v65) = v60;
++v62;
}
while ( *v63 > (int)v62 );
}
++v60;
}
while ( v60 != a8 );
result = 0LL;
}
}
}
else if ( v25 )
{
if ( v26 )
{
if ( a2 <= 0 )
{
result = 0LL;
}
else
{
v94 = (_DWORD *)(a3 + 4);
v95 = 0;
do
{
LODWORD(v96) = *(v94 - 1);
if ( (int)v96 < *v94 )
{
v96 = (int)v96;
do
{
v97 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v96));
v98 = (*v97)++;
*(_DWORD *)(a10 + 4LL * v98) = v95;
*(_QWORD *)(a11 + 8LL * v98) = *(_QWORD *)(a5 + 8 * v96);
*(_QWORD *)(a15 + 8LL * v98) = *(_QWORD *)(a14 + 8 * v96++);
}
while ( *v94 > (int)v96 );
}
++v95;
++v94;
}
while ( a2 != v95 );
result = 0LL;
}
}
else
{
v86 = (_DWORD *)(a3 + 4);
v87 = 0;
result = 0LL;
if ( a2 > 0 )
{
do
{
v88 = *(v86 - 1);
if ( v88 < *v86 )
{
v89 = v88;
v90 = (_QWORD *)(a5 + 16LL * v88);
do
{
v91 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v89));
v92 = (*v91)++;
*(_DWORD *)(a10 + 4LL * v92) = v87;
v93 = 2 * v92;
*(_QWORD *)(a11 + 8 * v93) = *v90;
*(_QWORD *)(a11 + 8 * v93 + 8) = v90[1];
++v89;
v90 += 2;
}
while ( *v86 > (int)v89 );
}
++v87;
++v86;
}
while ( a2 != v87 );
result = 0LL;
}
}
}
else
{
v81 = (_DWORD *)(a3 + 4);
v82 = 0;
result = 0LL;
if ( a2 > 0 )
{
do
{
LODWORD(v83) = *(v81 - 1);
if ( (int)v83 < *v81 )
{
v83 = (int)v83;
do
{
v84 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v83));
v85 = (*v84)++;
*(_DWORD *)(a10 + 4LL * v85) = v82;
++v83;
}
while ( *v81 > (int)v83 );
}
++v82;
++v81;
}
while ( a2 != v82 );
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, int a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int *a7, int a8, _DWORD *a9, __int64 a10, __int64 a11, __int64 a12, int a13, __int64 a14, __int64 a15, int a16)
{
__int64 v18; // rax
int *v19; // rsi
__int64 v20; // rdx
__int64 v21; // rax
_DWORD *v22; // rcx
__int64 i; // rax
__int64 j; // rax
bool v25; // al
bool v26; // dl
__int64 v27; // r8
__int64 result; // rax
__int64 v29; // rdx
int v30; // eax
_DWORD *v31; // r10
__int64 v32; // rcx
_QWORD *v33; // rdx
_DWORD *v34; // rsi
int v35; // eax
__int64 v36; // rax
_DWORD *v37; // rsi
__int64 v38; // rax
__int64 k; // rdx
__int64 l; // rdx
__int64 m; // r8
__int64 v42; // rax
__int64 v43; // rdx
_DWORD *v44; // rdi
_DWORD *v45; // rcx
int v46; // eax
_DWORD *v47; // r8
int v48; // esi
int v49; // eax
__int64 v50; // rcx
_QWORD *v51; // rdx
_DWORD *v52; // r10
int v53; // eax
__int64 v54; // rax
_DWORD *v55; // r9
int v56; // edi
__int64 v57; // rdx
_DWORD *v58; // r10
int v59; // eax
__int64 v60; // r8
__int64 v61; // rax
__int64 v62; // rdx
_DWORD *v63; // rdi
_DWORD *v64; // rcx
int v65; // eax
__int64 v66; // r8
__int64 v67; // rdx
int v68; // eax
_DWORD *v69; // r10
__int64 v70; // rcx
_QWORD *v71; // rdx
_DWORD *v72; // rsi
int v73; // eax
__int64 v74; // rax
__int64 n; // r9
__int64 v76; // rax
__int64 v77; // rdx
_DWORD *v78; // rdi
_DWORD *v79; // rcx
int v80; // eax
_DWORD *v81; // r9
int v82; // edi
__int64 v83; // rdx
_DWORD *v84; // rcx
int v85; // eax
_DWORD *v86; // r9
int v87; // edi
int v88; // eax
__int64 v89; // rcx
_QWORD *v90; // rdx
_DWORD *v91; // rsi
int v92; // eax
__int64 v93; // rax
_DWORD *v94; // r9
int v95; // edi
__int64 v96; // rdx
_DWORD *v97; // rcx
int v98; // eax

if ( a13 )
{
if ( !a4 || !a3 )
return 4294967291LL;
if ( a9 == 0LL || a10 == 0 || !a12 )
return 4294967291LL;
if ( a1 <= 0 || a2 <= 0 )
return 4294967290LL;
if ( !(unsigned int)umf_i_is_permutation(a6, a12, (unsigned int)a1, (unsigned int)a1) )
return 4294967281LL;
if ( !(unsigned int)umf_i_is_permutation(a7, a12, (unsigned int)a8, (unsigned int)a8) )
return 4294967281LL;
if ( (unsigned int)amd_valid((unsigned int)a1, (unsigned int)a2, a3, a4) )
return 4294967288LL;
goto LABEL_11;
}
if ( a1 > 0 )
{
LABEL_11:
v18 = 0LL;
do
{
*(_DWORD *)(a12 + 4 * v18) = 0;
a9[v18++] = 0;
}
while ( a1 > (int)v18 );
}
if ( a7 )
{
if ( a8 > 0 )
{
v19 = a7;
do
{
v20 = *v19;
LODWORD(v21) = *(_DWORD *)(a3 + 4 * v20);
v22 = (_DWORD *)(a3 + 4 * v20 + 4);
if ( (int)v21 < *v22 )
{
v21 = (int)v21;
do
++*(_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v21++));
while ( *v22 > (int)v21 );
}
++v19;
}
while ( v19 != &a7[a8 - 1 + 1] );
}
}
else if ( a2 > 0 )
{
v37 = (_DWORD *)(a3 + 4);
do
{
LODWORD(v38) = *(v37 - 1);
if ( (int)v38 < *v37 )
{
v38 = (int)v38;
do
++*(_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v38++));
while ( *v37 > (int)v38 );
}
++v37;
}
while ( v37 != (_DWORD *)(a3 + 4LL * (unsigned int)(a2 - 1) + 8) );
}
if ( a6 )
{
*a9 = 0;
if ( a1 > 0 )
{
for ( i = 0LL; i != a1; ++i )
a9[i + 1] = *(_DWORD *)(a12 + 4LL * *(int *)(a6 + 4 * i)) + a9[i];
for ( j = 0LL; j != a1; ++j )
*(_DWORD *)(a12 + 4LL * *(int *)(a6 + 4 * j)) = a9[j];
}
}
else
{
*a9 = 0;
if ( a1 > 0 )
{
for ( k = 0LL; k != a1; ++k )
a9[k + 1] = a9[k] + *(_DWORD *)(a12 + 4 * k);
for ( l = 0LL; l != a1; ++l )
*(_DWORD *)(a12 + 4 * l) = a9[l];
}
}
v25 = a11 != 0 && a5 != 0;
v26 = a15 != 0 && a14 != 0;
if ( a16 && v25 )
{
if ( a7 )
{
if ( v26 )
{
if ( a8 <= 0 )
{
result = 0LL;
}
else
{
for ( m = 0LL; m != a8; ++m )
{
v42 = a7[m];
LODWORD(v43) = *(_DWORD *)(a3 + 4 * v42);
v44 = (_DWORD *)(a3 + 4 * v42 + 4);
if ( (int)v43 < *v44 )
{
v43 = (int)v43;
do
{
v45 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v43));
v46 = (*v45)++;
*(_DWORD *)(a10 + 4LL * v46) = m;
*(_QWORD *)(a11 + 8LL * v46) = *(_QWORD *)(a5 + 8 * v43);
*(_QWORD *)(a15 + 8LL * v46) = *(_QWORD *)(a14 + 8 * v43++) ^ LC0;
}
while ( *v44 > (int)v43 );
}
}
result = 0LL;
}
}
else
{
v27 = 0LL;
result = 0LL;
if ( a8 > 0 )
{
do
{
v29 = a7[v27];
v30 = *(_DWORD *)(a3 + 4 * v29);
v31 = (_DWORD *)(a3 + 4 * v29 + 4);
if ( v30 < *v31 )
{
v32 = v30;
v33 = (_QWORD *)(a5 + 16LL * v30);
do
{
v34 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v32));
v35 = (*v34)++;
*(_DWORD *)(a10 + 4LL * v35) = v27;
v36 = 2 * v35;
*(_QWORD *)(a11 + 8 * v36) = *v33;
*(_QWORD *)(a11 + 8 * v36 + 8) = v33[1] ^ LC0;
++v32;
v33 += 2;
}
while ( *v31 > (int)v32 );
}
++v27;
}
while ( a8 != v27 );
result = 0LL;
}
}
}
else if ( v26 )
{
if ( a2 <= 0 )
{
result = 0LL;
}
else
{
v55 = (_DWORD *)(a3 + 4);
v56 = 0;
do
{
LODWORD(v57) = *(v55 - 1);
if ( (int)v57 < *v55 )
{
v57 = (int)v57;
do
{
v58 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v57));
v59 = (*v58)++;
*(_DWORD *)(a10 + 4LL * v59) = v56;
*(_QWORD *)(a11 + 8LL * v59) = *(_QWORD *)(a5 + 8 * v57);
*(_QWORD *)(a15 + 8LL * v59) = *(_QWORD *)(a14 + 8 * v57++) ^ LC0;
}
while ( *v55 > (int)v57 );
}
++v56;
++v55;
}
while ( a2 != v56 );
result = 0LL;
}
}
else
{
v47 = (_DWORD *)(a3 + 4);
v48 = 0;
result = 0LL;
if ( a2 > 0 )
{
do
{
v49 = *(v47 - 1);
if ( v49 < *v47 )
{
v50 = v49;
v51 = (_QWORD *)(a5 + 16LL * v49);
do
{
v52 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v50));
v53 = (*v52)++;
*(_DWORD *)(a10 + 4LL * v53) = v48;
v54 = 2 * v53;
*(_QWORD *)(a11 + 8 * v54) = *v51;
*(_QWORD *)(a11 + 8 * v54 + 8) = v51[1] ^ LC0;
++v50;
v51 += 2;
}
while ( *v47 > (int)v50 );
}
++v48;
++v47;
}
while ( a2 != v48 );
result = 0LL;
}
}
}
else if ( a7 )
{
if ( v25 )
{
if ( v26 )
{
if ( a8 <= 0 )
{
result = 0LL;
}
else
{
for ( n = 0LL; n != a8; ++n )
{
v76 = a7[n];
LODWORD(v77) = *(_DWORD *)(a3 + 4 * v76);
v78 = (_DWORD *)(a3 + 4 * v76 + 4);
if ( (int)v77 < *v78 )
{
v77 = (int)v77;
do
{
v79 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v77));
v80 = (*v79)++;
*(_DWORD *)(a10 + 4LL * v80) = n;
*(_QWORD *)(a11 + 8LL * v80) = *(_QWORD *)(a5 + 8 * v77);
*(_QWORD *)(a15 + 8LL * v80) = *(_QWORD *)(a14 + 8 * v77++);
}
while ( *v78 > (int)v77 );
}
}
result = 0LL;
}
}
else
{
v66 = 0LL;
result = 0LL;
if ( a8 > 0 )
{
do
{
v67 = a7[v66];
v68 = *(_DWORD *)(a3 + 4 * v67);
v69 = (_DWORD *)(a3 + 4 * v67 + 4);
if ( v68 < *v69 )
{
v70 = v68;
v71 = (_QWORD *)(a5 + 16LL * v68);
do
{
v72 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v70));
v73 = (*v72)++;
*(_DWORD *)(a10 + 4LL * v73) = v66;
v74 = 2 * v73;
*(_QWORD *)(a11 + 8 * v74) = *v71;
*(_QWORD *)(a11 + 8 * v74 + 8) = v71[1];
++v70;
v71 += 2;
}
while ( *v69 > (int)v70 );
}
++v66;
}
while ( a8 != v66 );
result = 0LL;
}
}
}
else
{
v60 = 0LL;
result = 0LL;
if ( a8 > 0 )
{
do
{
v61 = a7[v60];
LODWORD(v62) = *(_DWORD *)(a3 + 4 * v61);
v63 = (_DWORD *)(a3 + 4 * v61 + 4);
if ( (int)v62 < *v63 )
{
v62 = (int)v62;
do
{
v64 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v62));
v65 = (*v64)++;
*(_DWORD *)(a10 + 4LL * v65) = v60;
++v62;
}
while ( *v63 > (int)v62 );
}
++v60;
}
while ( v60 != a8 );
result = 0LL;
}
}
}
else if ( v25 )
{
if ( v26 )
{
if ( a2 <= 0 )
{
result = 0LL;
}
else
{
v94 = (_DWORD *)(a3 + 4);
v95 = 0;
do
{
LODWORD(v96) = *(v94 - 1);
if ( (int)v96 < *v94 )
{
v96 = (int)v96;
do
{
v97 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v96));
v98 = (*v97)++;
*(_DWORD *)(a10 + 4LL * v98) = v95;
*(_QWORD *)(a11 + 8LL * v98) = *(_QWORD *)(a5 + 8 * v96);
*(_QWORD *)(a15 + 8LL * v98) = *(_QWORD *)(a14 + 8 * v96++);
}
while ( *v94 > (int)v96 );
}
++v95;
++v94;
}
while ( a2 != v95 );
result = 0LL;
}
}
else
{
v86 = (_DWORD *)(a3 + 4);
v87 = 0;
result = 0LL;
if ( a2 > 0 )
{
do
{
v88 = *(v86 - 1);
if ( v88 < *v86 )
{
v89 = v88;
v90 = (_QWORD *)(a5 + 16LL * v88);
do
{
v91 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v89));
v92 = (*v91)++;
*(_DWORD *)(a10 + 4LL * v92) = v87;
v93 = 2 * v92;
*(_QWORD *)(a11 + 8 * v93) = *v90;
*(_QWORD *)(a11 + 8 * v93 + 8) = v90[1];
++v89;
v90 += 2;
}
while ( *v86 > (int)v89 );
}
++v87;
++v86;
}
while ( a2 != v87 );
result = 0LL;
}
}
}
else
{
v81 = (_DWORD *)(a3 + 4);
v82 = 0;
result = 0LL;
if ( a2 > 0 )
{
do
{
LODWORD(v83) = *(v81 - 1);
if ( (int)v83 < *v81 )
{
v83 = (int)v83;
do
{
v84 = (_DWORD *)(a12 + 4LL * *(int *)(a4 + 4 * v83));
v85 = (*v84)++;
*(_DWORD *)(a10 + 4LL * v85) = v82;
++v83;
}
while ( *v81 > (int)v83 );
}
++v82;
++v81;
}
while ( a2 != v82 );
result = 0LL;
}
}
return result;
}

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

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

variable_types:
Ax
double []

variable_types:
P
int []

variable_types:
Q
int []

variable_types: nq int

variable_types:
Ri
int []

variable_types:
Rx
double []

variable_types: check int

variable_types:
Az
double []

variable_types:
Rz
double []

variable_types: j int

variable_types: k int

variable_types: p int

variable_types: bp int

variable_types: newj int

variable_types: split int


original_code:
long umfdl_grow_front
(
    NumericType *Numeric,
    long fnr2,
    long fnc2,
    WorkType *Work,
    long do_what
)
{
    double s ;
    double *Fcold, *Fcnew ;
    long 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 (double)) * (1.0+1e-8) <= (double) 0x7fffffffffffffffL)) || (((double) fnr_min * (double) fnc_min * sizeof (double)) != ((double) fnr_min * (double) fnc_min * sizeof (double)))))
    {
 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 (double)) * (1.0+1e-8) <= (double) 0x7fffffffffffffffL)) || ((s * sizeof (double)) != (s * sizeof (double)))))
    {
 double a = 0.9 * sqrt ((0x7fffffffffffffffL / sizeof (double)) / 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)
    {
 ;
 umfdl_mem_free_tail_block (Numeric, E [0]) ;
 E [0] = 0 ;
 Work->Flublock = (double *) ((void *)0) ;
 Work->Flblock = (double *) ((void *)0) ;
 Work->Fublock = (double *) ((void *)0) ;
 Work->Fcblock = (double *) ((void *)0) ;
    }
    ;
    eloc = umfdl_mem_alloc_tail_block (Numeric, (((((sizeof (double) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    if (!eloc)
    {
 ;
 if (!umfdl_get_memory (Numeric, Work, 1 + (((((sizeof (double) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))),
     Work->fnrows, Work->fncols, (0)))
 {
     return ((0)) ;
 }
 ;
 eloc = umfdl_mem_alloc_tail_block (Numeric, (((((sizeof (double) * (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 = umfdl_mem_alloc_tail_block (Numeric, (((((sizeof (double) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    }
    if (!eloc)
    {
 fnr2 = fnr_min ;
 fnc2 = fnc_min ;
 newsize = minsize ;
 ;
 eloc = umfdl_mem_alloc_tail_block (Numeric, (((((sizeof (double) * (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 = (double *) (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 ;
 }
    }
    umfdl_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:
long umfdl_grow_front(struct NumericType *Numeric, long fnr2, long fnc2, struct WorkType *Work, long do_what)
{
    double s;
    double *Fcold; double *Fcnew;
    long j; long i; long col; long *Fcpos; long *Fcols; long fnrows_max; long fncols_max; long fnr_curr; long nb; long fnrows_new; long fncols_new; long fnr_min; long fnc_min; long minsize; long newsize; long fnrows; long fncols; long *E; long 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 (double)) * (1.0+1e-8) <= (double) 0x7fffffffffffffffL)) || (((double) fnr_min * (double) fnc_min * sizeof (double)) != ((double) fnr_min * (double) fnc_min * sizeof (double)))))
    {
 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 (double)) * (1.0+1e-8) <= (double) 0x7fffffffffffffffL)) || ((s * sizeof (double)) != (s * sizeof (double)))))
    {
 double a = 0.9 * sqrt ((0x7fffffffffffffffL / sizeof (double)) / 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)
    {
 ;
 umfdl_mem_free_tail_block (Numeric, E [0]) ;
 E [0] = 0 ;
 Work->Flublock = (double *) ((void *)0) ;
 Work->Flblock = (double *) ((void *)0) ;
 Work->Fublock = (double *) ((void *)0) ;
 Work->Fcblock = (double *) ((void *)0) ;
    }
    ;
    eloc = umfdl_mem_alloc_tail_block (Numeric, (((((sizeof (double) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    if (!eloc)
    {
 ;
 if (!umfdl_get_memory (Numeric, Work, 1 + (((((sizeof (double) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit)))),
     Work->fnrows, Work->fncols, (0)))
 {
     return ((0)) ;
 }
 ;
 eloc = umfdl_mem_alloc_tail_block (Numeric, (((((sizeof (double) * (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 = umfdl_mem_alloc_tail_block (Numeric, (((((sizeof (double) * (newsize))) + (sizeof (Unit)) - 1) / (sizeof (Unit))))) ;
    }
    if (!eloc)
    {
 fnr2 = fnr_min ;
 fnc2 = fnc_min ;
 newsize = minsize ;
 ;
 eloc = umfdl_mem_alloc_tail_block (Numeric, (((((sizeof (double) * (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 = (double *) (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 ;
 }
    }
    umfdl_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; long scale; long valid; union Unit_union { struct { long size; } header; double xxxxxx; } *Memory; long ihead; long *Rperm; long ulen; double *D; long do_recip; double *Rs; long n_row; long tail_usage; long maxnrows; } *

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

variable_types: s double

variable_types:
Fcold
double *

variable_types:
Fcnew
double *

variable_types: j long

variable_types: i long

variable_types: col long

variable_types:
Fcpos
long *

variable_types:
Fcols
long *

variable_types: nb long

variable_types: minsize long

variable_types: newsize long

variable_types: fnrows long

variable_types: fncols long

variable_types:
E
long *

variable_types: eloc long

variable_types: a double

return_type: long

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


original_code:
long umfdl_triplet_map_nox
(
    long n_row,
    long n_col,
    long nz,
    const long Ti [ ],
    const long Tj [ ],
    long Ap [ ],
    long Ai [ ],
    long Rp [ ],
    long Rj [ ],
    long W [ ],
    long RowCount [ ]
    , long Map [ ]
    , long Map2 [ ]
)
{
    long i, j, k, p, cp, p1, p2, pdest, pj ;
    long 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] ;
    }
    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) ;
     }
     else
     {
  W [j] = pdest ;
  Map2 [p] = pdest ;
  if (pdest != p)
  {
      Rj [pdest] = j ;
  }
  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 ;
 }
    }
    for (k = 0 ; k < nz ; k++)
    {
 Map [k] = Map2 [Map [k]] ;
    }
    return ((0)) ;
}

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

variable_types: nz long

variable_types:
Ti
long []

variable_types:
Tj
long []

variable_types:
Ap
long []

variable_types:
Ai
long []

variable_types:
Rp
long []

variable_types:
Rj
long []

variable_types:
W
long []

variable_types:
RowCount
long []

variable_types:
Map
long []

variable_types: k long

variable_types: p long

variable_types: cp long

variable_types: pdest long

variable_types: pj long

variable_types: duplicates long


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

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

variable_types:
Tx
double []

variable_types:
Ax
double []

variable_types:
Rx
double []

variable_types: i long

variable_types: j long


decompiled_code:
__int64 __fastcall umfdi_mem_alloc_head_block(unsigned int *a1, int a2)
{
__int64 result; // rax
unsigned int v3; // esi
signed int v4; // esi

result = a1[26];
if ( (int)(a1[27] - result) < a2 )
return 0LL;
v3 = result + a2;
a1[26] = v3;
v4 = a1[61] + v3;
if ( v4 < (int)a1[63] )
v4 = a1[63];
a1[63] = v4;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int *a1, int a2)
{
__int64 result; // rax
unsigned int v3; // esi
signed int v4; // esi

result = a1[26];
if ( (int)(a1[27] - result) < a2 )
return 0LL;
v3 = result + a2;
a1[26] = v3;
v4 = a1[61] + v3;
if ( v4 < (int)a1[63] )
v4 = a1[63];
a1[63] = v4;
return result;
}

original_code:
int umfdi_mem_alloc_head_block
(
    NumericType *Numeric,
    int nunits
)
{
    int p, usage ;
    ;
    ;
    ;
    if (nunits > (Numeric->itail - Numeric->ihead))
    {
 ;
 return (0) ;
    }
    p = Numeric->ihead ;
    Numeric->ihead += nunits ;
    ;
    usage = Numeric->ihead + Numeric->tail_usage ;
    Numeric->max_usage = (((Numeric->max_usage) > (usage)) ? (Numeric->max_usage) : (usage)) ;
    return (p) ;
}

canonical_original_code:
int umfdi_mem_alloc_head_block(struct NumericType *Numeric, int nunits)
{
    int p; int usage;
    ;
    ;
    ;
    if (nunits > (Numeric->itail - Numeric->ihead))
    {
 ;
 return (0) ;
    }
    p = Numeric->ihead ;
    Numeric->ihead += nunits ;
    ;
    usage = Numeric->ihead + Numeric->tail_usage ;
    Numeric->max_usage = (((Numeric->max_usage) > (usage)) ? (Numeric->max_usage) : (usage)) ;
    return (p) ;
}

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

variable_types: p int

variable_types: usage int

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


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

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

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

variable_types: option int

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

variable_types:
Ax
double *

variable_types:
Az
double *

variable_types:
Ap
long *

variable_types:
Ai
long *

variable_types:
Anz
long *

variable_types:
munch
long *

variable_types: packed long

variable_types: nrow long

variable_types: ncol long

variable_types: xtype long

variable_types: posdiag long

variable_types: pend long

variable_types: piend long

variable_types: result long

variable_types: xmatched long

variable_types: pmatched long

variable_types: nzdiag long

variable_types: found long

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


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

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

variable_types:
Az
double []

variable_types:
Rz
double []

variable_types: i int

variable_types: j int

variable_types: k int

variable_types: p int

variable_types: cp int

variable_types: pdest int

variable_types: pj int

variable_types: split int


original_code:
long umfpack_zl_get_lunz
(
    long *lnz,
    long *unz,
    long *n_row,
    long *n_col,
    long *nz_udiag,
    void *NumericHandle
)
{
    NumericType *Numeric ;
    Numeric = (NumericType *) NumericHandle ;
    if (!umfzl_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:
long umfpack_zl_get_lunz(long *lnz, long *unz, long *n_row, long *n_col, long *nz_udiag, void *NumericHandle)
{
    struct NumericType *Numeric;
    Numeric = (struct NumericType *) NumericHandle ;
    if (!umfzl_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
long *

variable_types:
unz
long *

variable_types:
NumericHandle
void *

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

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


original_code:
double umfdi_symbolic_usage
(
    int n_row,
    int n_col,
    int nchains,
    int nfr,
    int esize,
    int prefer_diagonal
)
{
    double units ;
    units =
 (ceil ((sizeof (SymbolicType) * ((double) 1)) / sizeof (Unit)))
 + 2 * (ceil ((sizeof (int) * ((double) n_col+1)) / sizeof (Unit)))
 + 2 * (ceil ((sizeof (int) * ((double) n_row+1)) / sizeof (Unit)))
 + 3 * (ceil ((sizeof (int) * ((double) nchains+1)) / sizeof (Unit)))
 + 4 * (ceil ((sizeof (int) * ((double) nfr+1)) / sizeof (Unit))) ;
    units += (ceil ((sizeof (int) * ((double) esize)) / sizeof (Unit))) ;
    if (prefer_diagonal)
    {
 units += (ceil ((sizeof (int) * ((double) n_col+1)) / sizeof (Unit))) ;
    }
    return (units) ;
}

canonical_original_code:
double umfdi_symbolic_usage(int n_row, int n_col, int nchains, int nfr, int esize, int prefer_diagonal)
{
    double units;
    units =
 (ceil ((sizeof (SymbolicType) * ((double) 1)) / sizeof (Unit)))
 + 2 * (ceil ((sizeof (int) * ((double) n_col+1)) / sizeof (Unit)))
 + 2 * (ceil ((sizeof (int) * ((double) n_row+1)) / sizeof (Unit)))
 + 3 * (ceil ((sizeof (int) * ((double) nchains+1)) / sizeof (Unit)))
 + 4 * (ceil ((sizeof (int) * ((double) nfr+1)) / sizeof (Unit))) ;
    units += (ceil ((sizeof (int) * ((double) esize)) / sizeof (Unit))) ;
    if (prefer_diagonal)
    {
 units += (ceil ((sizeof (int) * ((double) n_col+1)) / sizeof (Unit))) ;
    }
    return (units) ;
}

variable_types: nchains int

variable_types: nfr int

variable_types: esize int

variable_types: units double

return_type: double


original_code:
long
umfpack_zl_wsolve
(
    long sys,
    const long Ap [ ],
    const long Ai [ ],
    const double Ax [ ],
    const double Az [ ],
    double Xx [ ],
    double Xz [ ],
    const double Bx [ ],
    const double Bz [ ],
    void *NumericHandle,
    const double Control [20],
    double User_Info [90]
    , long Pattern [ ],
    double W [ ]
)
{
    double Info2 [90], stats [2] ;
    double *Info ;
    NumericType *Numeric ;
    long n, i, irstep, status ;
    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 (!umfzl_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 (!W || !Pattern)
    {
 Info [0] = (-5) ;
 return ((-5)) ;
    }
    status = umfzl_solve (sys, Ap, Ai, Ax, Xx, Bx,
 Az, Xz, Bz,
 Numeric, irstep, Info, Pattern, W) ;
    Info [0] = status ;
    if (status >= 0)
    {
 umfpack_toc (stats) ;
 Info [86] = stats [0] ;
 Info [85] = stats [1] ;
    }
    return (status) ;
}

canonical_original_code:
long umfpack_zl_wsolve(long sys, long Ap[], long Ai[], double Ax[], double Az[], double Xx[], double Xz[], double Bx[], double Bz[], void *NumericHandle, double Control[20], double User_Info[90], long Pattern[], double W[])
{
    double Info2[90]; double stats[2];
    double *Info;
    struct NumericType *Numeric;
    long n; long i; long irstep; long status;
    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 (!umfzl_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 (!W || !Pattern)
    {
 Info [0] = (-5) ;
 return ((-5)) ;
    }
    status = umfzl_solve (sys, Ap, Ai, Ax, Xx, Bx,
 Az, Xz, Bz,
 Numeric, irstep, Info, Pattern, W) ;
    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:
Az
double []

variable_types:
Xx
double []

variable_types:
Xz
double []

variable_types:
Bx
double []

variable_types:
Bz
double []

variable_types:
Control
double [20]

variable_types:
Pattern
long []

variable_types:
W
double []

variable_types:
stats
double [2]

variable_types:
Info
double *

variable_types: n long

variable_types: i long

variable_types: irstep long

variable_types: status long

user_defined_types: union Unit_union { struct { long size; } header; double xxxxxx; }

user_defined_types: struct DoubleComplex { double component[2]; }