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

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

variable_types: nz int

variable_types:
Ti
int []

variable_types:
Tj
int []

variable_types:
Ap
int []

variable_types:
Ai
int []

variable_types:
Rp
int []

variable_types:
Rj
int []

variable_types:
W
int []

variable_types:
RowCount
int []

variable_types: j int

variable_types: k int

variable_types: p int

variable_types: cp int

variable_types: pdest int

variable_types: pj int


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

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

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

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

variable_types: e int

variable_types: nrows int

variable_types: ncols int

variable_types: nel int

variable_types:
Rows
int *

variable_types:
Cols
int *

variable_types: row int

variable_types: col int

variable_types:
E
int *

variable_types:
ep
struct Element { int cdeg; } *

variable_types:
tuple
struct Tuple { int e; }

variable_types:
tp
struct Tuple { int e; } *

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


decompiled_code:
__int64 __fastcall cholmod_symmetry(__int64 a1, int a2, _DWORD *a3, _DWORD *a4, _DWORD *a5, _DWORD *a6, __int64 a7)
{
unsigned int v7; // eax
int v8; // eax
__int64 v9; // rcx
__int64 result; // rax
int v11; // ebx
__int64 v12; // rbp
__int64 v13; // r15
int v14; // er14
__int64 v15; // rdi
__int64 v16; // rax
__int64 v17; // rdx
int v18; // eax
int v19; // er14
int v20; // edx
int v21; // eax
int v22; // eax
int v23; // er13
__int64 v24; // r13
int v25; // eax
int *v26; // rbp
_BOOL4 v27; // [rsp+8h] [rbp-100h]
_BOOL4 v28; // [rsp+Ch] [rbp-FCh]
__int64 v29; // [rsp+10h] [rbp-F8h]
__int64 v30; // [rsp+18h] [rbp-F0h]
int v31; // [rsp+20h] [rbp-E8h]
int v32; // [rsp+24h] [rbp-E4h]
__int64 v33; // [rsp+28h] [rbp-E0h]
int v34; // [rsp+30h] [rbp-D8h]
int v35; // [rsp+34h] [rbp-D4h]
int v36; // [rsp+38h] [rbp-D0h]
int v37; // [rsp+3Ch] [rbp-CCh]
__int64 v38; // [rsp+40h] [rbp-C8h]
int v39; // [rsp+48h] [rbp-C0h]
int v40; // [rsp+4Ch] [rbp-BCh]
__int64 v41; // [rsp+58h] [rbp-B0h]
__int64 v43; // [rsp+68h] [rbp-A0h]
int v44; // [rsp+70h] [rbp-98h]
int v45; // [rsp+74h] [rbp-94h]
int v49; // [rsp+98h] [rbp-70h]
int v50; // [rsp+9Ch] [rbp-6Ch]
int v52; // [rsp+A8h] [rbp-60h]
double v53; // [rsp+B0h] [rbp-58h] BYREF
double v54; // [rsp+B8h] [rbp-50h] BYREF
double v55; // [rsp+C0h] [rbp-48h] BYREF
__int64 v56[8]; // [rsp+C8h] [rbp-40h] BYREF

v35 = a2;
v56[0] = 0LL;
v55 = 0.0;
v54 = 0.0;
v53 = 0.0;
if ( !a7 )
return 0xFFFFFFFFLL;
if ( *(_QWORD *)(a7 + 2016) )
{
*(_DWORD *)(a7 + 2028) = -4;
return 0xFFFFFFFFLL;
}
if ( !a1 )
{
result = 0xFFFFFFFFLL;
if ( *(_DWORD *)(a7 + 2028) != -2 )
{
cholmod_error(4294967292LL, "../MatrixOps/cholmod_symmetry.c", 202LL, "argument missing", a7);
result = 0xFFFFFFFFLL;
}
return result;
}
v7 = *(_DWORD *)(a1 + 72);
if ( v7 > 3 || v7 && (!*(_QWORD *)(a1 + 48) || v7 == 3 && !*(_QWORD *)(a1 + 56)) )
{
result = 0xFFFFFFFFLL;
if ( *(_DWORD *)(a7 + 2028) != -2 )
{
cholmod_error(4294967292LL, "../MatrixOps/cholmod_symmetry.c", 203LL, "invalid xtype", a7);
result = 0xFFFFFFFFLL;
}
return result;
}
*(_DWORD *)(a7 + 2028) = 0;
if ( !a3 || !a4 || !a5 || !a6 )
{
v8 = 1;
if ( a2 > 0 )
v8 = a2;
v35 = v8;
}
v9 = *(_QWORD *)(a1 + 8);
v52 = v9;
v50 = v9;
result = 1LL;
v11 = v9;
if ( *(_DWORD *)a1 != (_DWORD)v9 )
return result;
if ( !*(_DWORD *)(a1 + 80) )
return 0xFFFFFFFFLL;
v36 = *(_DWORD *)(a1 + 64);
if ( v36 )
return 0xFFFFFFFFLL;
v12 = *(_QWORD *)(a1 + 24);
v41 = v12;
v13 = *(_QWORD *)(a1 + 32);
v29 = *(_QWORD *)(a1 + 48);
v30 = *(_QWORD *)(a1 + 56);
v43 = *(_QWORD *)(a1 + 40);
v44 = *(_DWORD *)(a1 + 84);
v14 = *(_DWORD *)(a1 + 72);
v32 = v14;
cholmod_allocate_work(0LL, (int)v9, 0LL, a7);
if ( *(int *)(a7 + 2028) < 0 )
return 0xFFFFFFFFLL;
v15 = *(_QWORD *)(a7 + 2008);
v28 = v14 > 1;
v27 = v14 != 0;
if ( v11 <= 0 )
{
v49 = 0;
v39 = 0;
v31 = 1;
v45 = 1;
LABEL_76:
if ( v35 > 1 )
{
*a3 = v36;
*a4 = v39;
*a5 = cholmod_nnz(a1, a7) - v49;
*a6 = v49;
}
if ( v28 )
return v45 == 0 ? 4 : 7;
if ( v31 )
return v45 == 0 ? 3 : 6;
return !v27 ? 2 : 5;
}
v16 = 0LL;
do
{
*(_DWORD *)(v15 + 4 * v16) = *(_DWORD *)(v12 + 4 * v16);
v17 = v16++;
}
while ( v11 - 1 != v17 );
v49 = 0;
v39 = 0;
v40 = 0;
v33 = 0LL;
v45 = 1;
v31 = 1;
while ( 1 )
{
LODWORD(v24) = *(_DWORD *)(v15 + 4 * v33);
v18 = v44 ? *(_DWORD *)(v41 + 4 * v33 + 4) : *(_DWORD *)(v41 + 4 * v33) + *(_DWORD *)(v43 + 4 * v33);
v37 = v18;
if ( v18 > (int)v24 )
break;
LABEL_62:
if ( v35 <= 0 && (!v45 || v50 > v49) )
return 2LL;
if ( v11 - 1 == v33 )
{
if ( v52 > v49 )
v45 = 0;
v36 = v40;
goto LABEL_76;
}
++v33;
}
v24 = (int)v24;
while ( 1 )
{
v34 = v24;
v25 = *(_DWORD *)(v13 + 4 * v24);
if ( v25 < (int)v33 )
goto LABEL_90;
if ( v25 != (_DWORD)v33 )
break;
get_value(v29, v30, v24, v32, v56, &v55);
if ( *(double *)v56 != 0.0 )
{
++v49;
if ( *(double *)v56 > 0.0 )
{
if ( v55 != 0.0 )
{
v45 = 0;
v28 = 0;
}
v27 = 0;
goto LABEL_58;
}
goto LABEL_100;
}
if ( v55 != 0.0 )
{
++v49;
LABEL_100:
v45 = 0;
if ( v55 != 0.0 )
v28 = 0;
v27 = 0;
goto LABEL_58;
}
v45 = 0;
LABEL_58:
if ( v35 <= 1 && !(v28 | v27 | v31) )
return 2LL;
LABEL_92:
if ( v37 <= (int)++v24 )
goto LABEL_62;
}
if ( v44 )
v19 = *(_DWORD *)(v41 + 4LL * v25 + 4);
else
v19 = *(_DWORD *)(v41 + 4LL * v25) + *(_DWORD *)(v43 + 4LL * v25);
v26 = (int *)(v15 + 4LL * v25);
v21 = *v26;
if ( v19 <= *v26 )
goto LABEL_90;
v20 = 0;
v38 = v24;
v23 = v39;
while ( 2 )
{
v22 = *(_DWORD *)(v13 + 4LL * v21);
if ( v22 < (int)v33 )
{
v28 = 0;
v27 = 0;
v31 = 0;
goto LABEL_46;
}
if ( v22 == (_DWORD)v33 )
{
v23 += 2;
get_value(v29, v30, v34, v32, v56, &v55);
get_value(v29, v30, *v26, v32, &v54, &v53);
if ( *(double *)v56 == v54 && v55 == v53 )
{
if ( *(double *)v56 != COERCE_DOUBLE(*(_QWORD *)&v54 ^ LC5) )
{
v27 = 0;
LABEL_53:
if ( COERCE_DOUBLE(*(_QWORD *)&v53 ^ LC5) == v55 )
v40 += 2;
else
v28 = 0;
v20 = 1;
goto LABEL_46;
}
}
else if ( *(double *)v56 == COERCE_DOUBLE(*(_QWORD *)&v54 ^ LC5) )
{
v31 = 0;
if ( v55 != v53 )
v27 = 0;
}
else
{
v31 = 0;
v27 = 0;
}
if ( *(double *)v56 == v54 )
goto LABEL_53;
v28 = 0;
v20 = 1;
LABEL_46:
v21 = *v26 + 1;
*v26 = v21;
if ( v21 >= v19 )
break;
continue;
}
break;
}
v39 = v23;
v24 = v38;
if ( v20 )
goto LABEL_58;
LABEL_90:
if ( v35 > 1 )
{
v28 = 0;
v27 = 0;
v31 = 0;
goto LABEL_92;
}
return 2LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, int a2, _DWORD *a3, _DWORD *a4, _DWORD *a5, _DWORD *a6, __int64 a7)
{
unsigned int v7; // eax
int v8; // eax
__int64 v9; // rcx
__int64 result; // rax
int v11; // ebx
__int64 v12; // rbp
__int64 v13; // r15
int v14; // er14
__int64 v15; // rdi
__int64 v16; // rax
__int64 v17; // rdx
int v18; // eax
int v19; // er14
int v20; // edx
int v21; // eax
int v22; // eax
int v23; // er13
__int64 v24; // r13
int v25; // eax
int *v26; // rbp
_BOOL4 v27; // [rsp+8h] [rbp-100h]
_BOOL4 v28; // [rsp+Ch] [rbp-FCh]
__int64 v29; // [rsp+10h] [rbp-F8h]
__int64 v30; // [rsp+18h] [rbp-F0h]
int v31; // [rsp+20h] [rbp-E8h]
int v32; // [rsp+24h] [rbp-E4h]
__int64 v33; // [rsp+28h] [rbp-E0h]
int v34; // [rsp+30h] [rbp-D8h]
int v35; // [rsp+34h] [rbp-D4h]
int v36; // [rsp+38h] [rbp-D0h]
int v37; // [rsp+3Ch] [rbp-CCh]
__int64 v38; // [rsp+40h] [rbp-C8h]
int v39; // [rsp+48h] [rbp-C0h]
int v40; // [rsp+4Ch] [rbp-BCh]
__int64 v41; // [rsp+58h] [rbp-B0h]
__int64 v43; // [rsp+68h] [rbp-A0h]
int v44; // [rsp+70h] [rbp-98h]
int v45; // [rsp+74h] [rbp-94h]
int v49; // [rsp+98h] [rbp-70h]
int v50; // [rsp+9Ch] [rbp-6Ch]
int v52; // [rsp+A8h] [rbp-60h]
double v53; // [rsp+B0h] [rbp-58h] BYREF
double v54; // [rsp+B8h] [rbp-50h] BYREF
double v55; // [rsp+C0h] [rbp-48h] BYREF
__int64 v56[8]; // [rsp+C8h] [rbp-40h] BYREF

v35 = a2;
v56[0] = 0LL;
v55 = 0.0;
v54 = 0.0;
v53 = 0.0;
if ( !a7 )
return 0xFFFFFFFFLL;
if ( *(_QWORD *)(a7 + 2016) )
{
*(_DWORD *)(a7 + 2028) = -4;
return 0xFFFFFFFFLL;
}
if ( !a1 )
{
result = 0xFFFFFFFFLL;
if ( *(_DWORD *)(a7 + 2028) != -2 )
{
cholmod_error(4294967292LL, "../MatrixOps/cholmod_symmetry.c", 202LL, "argument missing", a7);
result = 0xFFFFFFFFLL;
}
return result;
}
v7 = *(_DWORD *)(a1 + 72);
if ( v7 > 3 || v7 && (!*(_QWORD *)(a1 + 48) || v7 == 3 && !*(_QWORD *)(a1 + 56)) )
{
result = 0xFFFFFFFFLL;
if ( *(_DWORD *)(a7 + 2028) != -2 )
{
cholmod_error(4294967292LL, "../MatrixOps/cholmod_symmetry.c", 203LL, "invalid xtype", a7);
result = 0xFFFFFFFFLL;
}
return result;
}
*(_DWORD *)(a7 + 2028) = 0;
if ( !a3 || !a4 || !a5 || !a6 )
{
v8 = 1;
if ( a2 > 0 )
v8 = a2;
v35 = v8;
}
v9 = *(_QWORD *)(a1 + 8);
v52 = v9;
v50 = v9;
result = 1LL;
v11 = v9;
if ( *(_DWORD *)a1 != (_DWORD)v9 )
return result;
if ( !*(_DWORD *)(a1 + 80) )
return 0xFFFFFFFFLL;
v36 = *(_DWORD *)(a1 + 64);
if ( v36 )
return 0xFFFFFFFFLL;
v12 = *(_QWORD *)(a1 + 24);
v41 = v12;
v13 = *(_QWORD *)(a1 + 32);
v29 = *(_QWORD *)(a1 + 48);
v30 = *(_QWORD *)(a1 + 56);
v43 = *(_QWORD *)(a1 + 40);
v44 = *(_DWORD *)(a1 + 84);
v14 = *(_DWORD *)(a1 + 72);
v32 = v14;
cholmod_allocate_work(0LL, (int)v9, 0LL, a7);
if ( *(int *)(a7 + 2028) < 0 )
return 0xFFFFFFFFLL;
v15 = *(_QWORD *)(a7 + 2008);
v28 = v14 > 1;
v27 = v14 != 0;
if ( v11 <= 0 )
{
v49 = 0;
v39 = 0;
v31 = 1;
v45 = 1;
LABEL_76:
if ( v35 > 1 )
{
*a3 = v36;
*a4 = v39;
*a5 = cholmod_nnz(a1, a7) - v49;
*a6 = v49;
}
if ( v28 )
return v45 == 0 ? 4 : 7;
if ( v31 )
return v45 == 0 ? 3 : 6;
return !v27 ? 2 : 5;
}
v16 = 0LL;
do
{
*(_DWORD *)(v15 + 4 * v16) = *(_DWORD *)(v12 + 4 * v16);
v17 = v16++;
}
while ( v11 - 1 != v17 );
v49 = 0;
v39 = 0;
v40 = 0;
v33 = 0LL;
v45 = 1;
v31 = 1;
while ( 1 )
{
LODWORD(v24) = *(_DWORD *)(v15 + 4 * v33);
v18 = v44 ? *(_DWORD *)(v41 + 4 * v33 + 4) : *(_DWORD *)(v41 + 4 * v33) + *(_DWORD *)(v43 + 4 * v33);
v37 = v18;
if ( v18 > (int)v24 )
break;
LABEL_62:
if ( v35 <= 0 && (!v45 || v50 > v49) )
return 2LL;
if ( v11 - 1 == v33 )
{
if ( v52 > v49 )
v45 = 0;
v36 = v40;
goto LABEL_76;
}
++v33;
}
v24 = (int)v24;
while ( 1 )
{
v34 = v24;
v25 = *(_DWORD *)(v13 + 4 * v24);
if ( v25 < (int)v33 )
goto LABEL_90;
if ( v25 != (_DWORD)v33 )
break;
func0(v29, v30, v24, v32, v56, &v55);
if ( *(double *)v56 != 0.0 )
{
++v49;
if ( *(double *)v56 > 0.0 )
{
if ( v55 != 0.0 )
{
v45 = 0;
v28 = 0;
}
v27 = 0;
goto LABEL_58;
}
goto LABEL_100;
}
if ( v55 != 0.0 )
{
++v49;
LABEL_100:
v45 = 0;
if ( v55 != 0.0 )
v28 = 0;
v27 = 0;
goto LABEL_58;
}
v45 = 0;
LABEL_58:
if ( v35 <= 1 && !(v28 | v27 | v31) )
return 2LL;
LABEL_92:
if ( v37 <= (int)++v24 )
goto LABEL_62;
}
if ( v44 )
v19 = *(_DWORD *)(v41 + 4LL * v25 + 4);
else
v19 = *(_DWORD *)(v41 + 4LL * v25) + *(_DWORD *)(v43 + 4LL * v25);
v26 = (int *)(v15 + 4LL * v25);
v21 = *v26;
if ( v19 <= *v26 )
goto LABEL_90;
v20 = 0;
v38 = v24;
v23 = v39;
while ( 2 )
{
v22 = *(_DWORD *)(v13 + 4LL * v21);
if ( v22 < (int)v33 )
{
v28 = 0;
v27 = 0;
v31 = 0;
goto LABEL_46;
}
if ( v22 == (_DWORD)v33 )
{
v23 += 2;
func0(v29, v30, v34, v32, v56, &v55);
func0(v29, v30, *v26, v32, &v54, &v53);
if ( *(double *)v56 == v54 && v55 == v53 )
{
if ( *(double *)v56 != COERCE_DOUBLE(*(_QWORD *)&v54 ^ LC5) )
{
v27 = 0;
LABEL_53:
if ( COERCE_DOUBLE(*(_QWORD *)&v53 ^ LC5) == v55 )
v40 += 2;
else
v28 = 0;
v20 = 1;
goto LABEL_46;
}
}
else if ( *(double *)v56 == COERCE_DOUBLE(*(_QWORD *)&v54 ^ LC5) )
{
v31 = 0;
if ( v55 != v53 )
v27 = 0;
}
else
{
v31 = 0;
v27 = 0;
}
if ( *(double *)v56 == v54 )
goto LABEL_53;
v28 = 0;
v20 = 1;
LABEL_46:
v21 = *v26 + 1;
*v26 = v21;
if ( v21 >= v19 )
break;
continue;
}
break;
}
v39 = v23;
v24 = v38;
if ( v20 )
goto LABEL_58;
LABEL_90:
if ( v35 > 1 )
{
v28 = 0;
v27 = 0;
v31 = 0;
goto LABEL_92;
}
return 2LL;
}

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

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

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

variable_types: option int

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

variable_types:
Ax
double *

variable_types:
Az
double *

variable_types:
Ap
int *

variable_types:
Ai
int *

variable_types:
Anz
int *

variable_types:
munch
int *

variable_types: packed int

variable_types: nrow int

variable_types: ncol int

variable_types: xtype int

variable_types: posdiag int

variable_types: j int

variable_types: p int

variable_types: pend int

variable_types: i int

variable_types: piend int

variable_types: result int

variable_types: xmatched int

variable_types: pmatched int

variable_types: nzdiag int

variable_types: found int

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


decompiled_code:
__int64 __fastcall umf_l_is_permutation(__int64 a1, _QWORD *a2, __int64 a3, __int64 a4)
{
_QWORD *v7; // rax
_QWORD *v8; // rdx
__int64 v9; // rdx
__int64 v10; // rax
_QWORD *v11; // rax

if ( !a1 )
return 1LL;
if ( a3 > 0 )
{
v7 = a2;
v8 = &a2[a3];
do
*v7++ = 0LL;
while ( v7 != v8 );
}
if ( a4 <= 0 )
return 1LL;
v9 = 0LL;
while ( 1 )
{
v10 = *(_QWORD *)(a1 + 8 * v9);
if ( v10 < 0 || a3 <= v10 )
return 0LL;
v11 = &a2[v10];
if ( *v11 )
break;
*v11 = 1LL;
if ( a4 == ++v9 )
return 1LL;
}
return 0LL;
}

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

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

variable_types:
P
long []

variable_types:
W
long []

variable_types: n long

variable_types: r long

variable_types: i long

variable_types: k long

return_type: long


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

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

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

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

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

variable_types:
Pattern
long []

variable_types:
Pos
long []

variable_types:
pivrow
long [2]

variable_types:
rdeg
long [2]

variable_types:
Wxy
struct DoubleComplex []

variable_types: pivcol long

variable_types:
freebie
long []

variable_types: maxval double

variable_types: toler double

variable_types: value double

variable_types:
pivot
double [2]

variable_types: row long

variable_types: deg long

variable_types: col long

variable_types:
Frpos
long *

variable_types: fnrows long

variable_types:
E
long *

variable_types: j long

variable_types: ncols long

variable_types:
Cols
long *

variable_types:
Rows
long *

variable_types: e long

variable_types: f long

variable_types: Wrpflag long

variable_types:
Fcpos
long *

variable_types: fncols long

variable_types: tpi long

variable_types:
Wrp
long *

variable_types: found long

variable_types:
tp
struct Tuple { long e; } *

variable_types:
tpend
struct Tuple { long e; } *

variable_types:
ep
struct Element { long cdeg; } *

variable_types: a double

variable_types: fleftmost long

variable_types: nfr long

variable_types: frontid long

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


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

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

variable_types: nn int

variable_types:
Parent
int []

variable_types:
Nv
int []

variable_types:
Fsize
int []

variable_types:
Order
int []

variable_types:
Child
int []

variable_types:
Sibling
int []

variable_types:
Stack
int []

variable_types: i int

variable_types: j int

variable_types: k int

variable_types: parent int

variable_types: frsize int

variable_types: f int

variable_types: fprev int

variable_types: maxfrsize int

variable_types: bigfprev int

variable_types: bigf int

variable_types: fnext int

return_type: void


original_code:
long umf_l_analyze
(
    long n_row,
    long n_col,
    long Ai [ ],
    long Ap [ ],
    long Up [ ],
    long fixQ,
    long W [ ],
    long Link [ ],
    long Front_ncols [ ],
    long Front_nrows [ ],
    long Front_npivcol [ ],
    long Front_parent [ ],
    long *nfr_out,
    long *p_ncompactions
)
{
    long j, j3, col, k, row, parent, j2, pdest, p, p2, thickness, npivots, nfr,
 i, *Winv, kk, npiv, jnext, krow, knext, pfirst, jlast, ncompactions,
 *Front_stack, *Front_order, *Front_child, *Front_sibling,
 Wflag, npivcol, fallrows, fallcols, fpiv, frows, fcols, *Front_size ;
    nfr = 0 ;
    ;
#pragma ivdep
    for (j = 0 ; j < n_col ; j++)
    {
 Link [j] = (-1) ;
 W [j] = (-1) ;
 Up [j] = (-1) ;
 Front_npivcol [j] = 0 ;
 Front_nrows [j] = 0 ;
 Front_ncols [j] = 0 ;
 Front_parent [j] = (-1) ;
    }
    krow = 0 ;
    pfirst = Ap [0] ;
    jlast = (-1) ;
    jnext = (-1) ;
    Wflag = 0 ;
    ;
    pdest = 0 ;
    ncompactions = 0 ;
    for (j = 0 ; j < n_col ; j = jnext)
    {
 ;
 if (pdest + (n_col-j) > pfirst)
 {
     pdest = 0 ;
     ncompactions++ ;
     for (row = 0 ; row < j ; row++)
     {
  if (Up [row] != (-1))
  {
      ;
      ;
      p = Up [row] ;
      ;
      p2 = p + (Front_ncols [row] - Front_npivcol [row]) ;
      Up [row] = pdest ;
      for ( ; p < p2 ; p++)
      {
   ;
   ;
   ;
   Ai [pdest++] = Ai [p] ;
   ;
      }
      ;
  }
     }
 }
 if (pdest + (n_col-j) > pfirst)
 {
     return ((0)) ;
 }
 if (jlast != (-1) && Link [j] == jlast)
 {
     ;
     ;
     Up [j] = Up [jlast] ;
     Up [jlast] = (-1) ;
     parent = n_col ;
     for (p = Up [j] ; p < pdest ; )
     {
  j3 = Ai [p] ;
  ;
  ;
  ;
  ;
  if (j == j3)
  {
      ;
      Ai [p] = Ai [--pdest] ;
  }
  else
  {
      if (j3 < parent)
      {
   parent = j3 ;
      }
      p++ ;
  }
     }
     Link [j] = Link [jlast] ;
     ;
     thickness = (Front_nrows [jlast] - Front_npivcol [jlast]) ;
     ;
 }
 else
 {
     Up [j] = pdest ;
     parent = n_col ;
     thickness = 0 ;
     Wflag = j ;
 }
 ;
 W [j] = Wflag ;
 ;
 ;
 jnext = n_col ;
 for (knext = krow ; knext < n_row ; knext++)
 {
     ;
     ;
     jnext = Ai [Ap [knext]] ;
     ;
     if (jnext != j)
     {
  break ;
     }
 }
 if (knext == n_row)
 {
     jnext = n_col ;
 }
 ;
 ;
 for (k = krow ; k < knext ; k++)
 {
     p = Ap [k] ;
     p2 = Ap [k+1] ;
     ;
     ;
     ;
     ;
     ;
     ;
     ;
     for ( ; p < p2 ; p++)
     {
  col = Ai [p] ;
  ;
  ;
  if (W [col] != Wflag)
  {
      Ai [pdest++] = col ;
      ;
      W [col] = Wflag ;
      if (col < parent)
      {
   parent = col ;
      }
  }
     }
     ;
     thickness++ ;
 }
 krow = knext ;
 pfirst = Ap [knext] ;
 for (k = Link [j] ; k != (-1) ; k = Link [k])
 {
     ;
     ;
     ;
     p = Up [k] ;
     ;
     p2 = p + (Front_ncols [k] - Front_npivcol [k]) ;
     ;
     ;
     ;
     for ( ; p < p2 ; p++)
     {
  col = Ai [p] ;
  ;
  ;
  if (W [col] != Wflag)
  {
      Ai [pdest++] = col ;
      ;
      W [col] = Wflag ;
      if (col < parent)
      {
   parent = col ;
      }
  }
     }
     ;
     Up [k] = (-1) ;
     ;
     thickness += (Front_nrows [k] - Front_npivcol [k]) ;
     ;
 }
 for (j2 = j+1 ; j2 < jnext ; j2++)
 {
     ;
     if (W [j2] != Wflag || Link [j2] != (-1))
     {
  break ;
     }
 }
 ;
 ;
 jnext = j2 ;
 j2-- ;
 ;
 ;
 npivots = j2-j+1 ;
 ;
 if (j2 > j)
 {
     ;
     ;
     ;
     parent = n_col ;
     p2 = pdest ;
     pdest = Up [j] ;
     for (p = Up [j] ; p < p2 ; p++)
     {
  col = Ai [p] ;
  ;
  ;
  if (col > j2)
  {
      Ai [pdest++] = col ;
      if (col < parent)
      {
   parent = col ;
      }
  }
     }
 }
 ;
 ;
 if (parent == n_col)
 {
     parent = (-1) ;
 }
 npivcol = npivots ;
 fallrows = thickness ;
 fallcols = npivots + pdest - Up [j] ;
 fpiv = (((npivcol) < (fallrows)) ? (npivcol) : (fallrows)) ;
 frows = fallrows - fpiv ;
 fcols = fallcols - fpiv ;
 if (frows == 0 || fcols == 0)
 {
     ;
     Up [j] = (-1) ;
     parent = (-1) ;
 }
 Front_npivcol [j] = npivots ;
 Front_nrows [j] = fallrows ;
 Front_ncols [j] = fallcols ;
 Front_parent [j] = parent ;
 ;
 ;
 nfr++ ;
 if (parent != (-1))
 {
     Link [j] = Link [parent] ;
     Link [parent] = j ;
 }
 ;
 jlast = j ;
    }
    *nfr_out = nfr ;
    Front_order = W ;
    if (fixQ)
    {
 ;
 k = 0 ;
#pragma novector
 for (j = 0 ; j < n_col ; j++)
 {
     if (Front_npivcol [j] > 0)
     {
  Front_order [j] = k++ ;
  ;
     }
     else
     {
  Front_order [j] = (-1) ;
     }
 }
    }
    else
    {
 Front_child = Ap ;
 Front_sibling = Link ;
 Front_stack = Ai ;
 Front_size = Front_stack + n_col ;
 umf_l_fsize (n_col, Front_size, Front_nrows, Front_ncols,
     Front_parent, Front_npivcol) ;
 amd_l_postorder (n_col, Front_parent, Front_npivcol, Front_size,
     Front_order, Front_child, Front_sibling, Front_stack) ;
 Winv = Ai ;
 for (k = 0 ; k < nfr ; k++)
 {
     Winv [k] = (-1) ;
 }
 ;
 for (i = 0 ; i < n_col ; i++)
 {
     k = Front_order [i] ;
     if (k != (-1))
     {
  ;
  ;
  ;
  Winv [k] = i ;
     }
 }
 kk = 0 ;
 for (k = 0 ; k < nfr ; k++)
 {
     i = Winv [k] ;
     ;
     ;
     ;
     for (npiv = 0 ; npiv < Front_npivcol [i] ; npiv++)
     {
  Up [kk] = i + npiv ;
  ;
  kk++ ;
     }
 }
 ;
    }
    umf_l_apply_order (Front_npivcol, Front_order, Ai, n_col, nfr) ;
    umf_l_apply_order (Front_nrows, Front_order, Ai, n_col, nfr) ;
    umf_l_apply_order (Front_ncols, Front_order, Ai, n_col, nfr) ;
    umf_l_apply_order (Front_parent, Front_order, Ai, n_col, nfr) ;
    for (i = 0 ; i < nfr ; i++)
    {
 parent = Front_parent [i] ;
 if (parent != (-1))
 {
     ;
     ;
     Front_parent [i] = Front_order [parent] ;
 }
    }
    *p_ncompactions = ncompactions ;
    return ((1)) ;
}

canonical_original_code:
long umf_l_analyze(long n_row, long n_col, long Ai[], long Ap[], long Up[], long fixQ, long W[], long Link[], long Front_ncols[], long Front_nrows[], long Front_npivcol[], long Front_parent[], long *nfr_out, long *p_ncompactions)
{
    long j; long j3; long col; long k; long row; long parent; long j2; long pdest; long p; long p2; long thickness; long npivots; long nfr; long i; long *Winv; long kk; long npiv; long jnext; long krow; long knext; long pfirst; long jlast; long ncompactions; long *Front_stack; long *Front_order; long *Front_child; long *Front_sibling; long Wflag; long npivcol; long fallrows; long fallcols; long fpiv; long frows; long fcols; long *Front_size;
    nfr = 0 ;
    ;
#pragma ivdep
    for (j = 0 ; j < n_col ; j++)
    {
 Link [j] = (-1) ;
 W [j] = (-1) ;
 Up [j] = (-1) ;
 Front_npivcol [j] = 0 ;
 Front_nrows [j] = 0 ;
 Front_ncols [j] = 0 ;
 Front_parent [j] = (-1) ;
    }
    krow = 0 ;
    pfirst = Ap [0] ;
    jlast = (-1) ;
    jnext = (-1) ;
    Wflag = 0 ;
    ;
    pdest = 0 ;
    ncompactions = 0 ;
    for (j = 0 ; j < n_col ; j = jnext)
    {
 ;
 if (pdest + (n_col-j) > pfirst)
 {
     pdest = 0 ;
     ncompactions++ ;
     for (row = 0 ; row < j ; row++)
     {
  if (Up [row] != (-1))
  {
      ;
      ;
      p = Up [row] ;
      ;
      p2 = p + (Front_ncols [row] - Front_npivcol [row]) ;
      Up [row] = pdest ;
      for ( ; p < p2 ; p++)
      {
   ;
   ;
   ;
   Ai [pdest++] = Ai [p] ;
   ;
      }
      ;
  }
     }
 }
 if (pdest + (n_col-j) > pfirst)
 {
     return ((0)) ;
 }
 if (jlast != (-1) && Link [j] == jlast)
 {
     ;
     ;
     Up [j] = Up [jlast] ;
     Up [jlast] = (-1) ;
     parent = n_col ;
     for (p = Up [j] ; p < pdest ; )
     {
  j3 = Ai [p] ;
  ;
  ;
  ;
  ;
  if (j == j3)
  {
      ;
      Ai [p] = Ai [--pdest] ;
  }
  else
  {
      if (j3 < parent)
      {
   parent = j3 ;
      }
      p++ ;
  }
     }
     Link [j] = Link [jlast] ;
     ;
     thickness = (Front_nrows [jlast] - Front_npivcol [jlast]) ;
     ;
 }
 else
 {
     Up [j] = pdest ;
     parent = n_col ;
     thickness = 0 ;
     Wflag = j ;
 }
 ;
 W [j] = Wflag ;
 ;
 ;
 jnext = n_col ;
 for (knext = krow ; knext < n_row ; knext++)
 {
     ;
     ;
     jnext = Ai [Ap [knext]] ;
     ;
     if (jnext != j)
     {
  break ;
     }
 }
 if (knext == n_row)
 {
     jnext = n_col ;
 }
 ;
 ;
 for (k = krow ; k < knext ; k++)
 {
     p = Ap [k] ;
     p2 = Ap [k+1] ;
     ;
     ;
     ;
     ;
     ;
     ;
     ;
     for ( ; p < p2 ; p++)
     {
  col = Ai [p] ;
  ;
  ;
  if (W [col] != Wflag)
  {
      Ai [pdest++] = col ;
      ;
      W [col] = Wflag ;
      if (col < parent)
      {
   parent = col ;
      }
  }
     }
     ;
     thickness++ ;
 }
 krow = knext ;
 pfirst = Ap [knext] ;
 for (k = Link [j] ; k != (-1) ; k = Link [k])
 {
     ;
     ;
     ;
     p = Up [k] ;
     ;
     p2 = p + (Front_ncols [k] - Front_npivcol [k]) ;
     ;
     ;
     ;
     for ( ; p < p2 ; p++)
     {
  col = Ai [p] ;
  ;
  ;
  if (W [col] != Wflag)
  {
      Ai [pdest++] = col ;
      ;
      W [col] = Wflag ;
      if (col < parent)
      {
   parent = col ;
      }
  }
     }
     ;
     Up [k] = (-1) ;
     ;
     thickness += (Front_nrows [k] - Front_npivcol [k]) ;
     ;
 }
 for (j2 = j+1 ; j2 < jnext ; j2++)
 {
     ;
     if (W [j2] != Wflag || Link [j2] != (-1))
     {
  break ;
     }
 }
 ;
 ;
 jnext = j2 ;
 j2-- ;
 ;
 ;
 npivots = j2-j+1 ;
 ;
 if (j2 > j)
 {
     ;
     ;
     ;
     parent = n_col ;
     p2 = pdest ;
     pdest = Up [j] ;
     for (p = Up [j] ; p < p2 ; p++)
     {
  col = Ai [p] ;
  ;
  ;
  if (col > j2)
  {
      Ai [pdest++] = col ;
      if (col < parent)
      {
   parent = col ;
      }
  }
     }
 }
 ;
 ;
 if (parent == n_col)
 {
     parent = (-1) ;
 }
 npivcol = npivots ;
 fallrows = thickness ;
 fallcols = npivots + pdest - Up [j] ;
 fpiv = (((npivcol) < (fallrows)) ? (npivcol) : (fallrows)) ;
 frows = fallrows - fpiv ;
 fcols = fallcols - fpiv ;
 if (frows == 0 || fcols == 0)
 {
     ;
     Up [j] = (-1) ;
     parent = (-1) ;
 }
 Front_npivcol [j] = npivots ;
 Front_nrows [j] = fallrows ;
 Front_ncols [j] = fallcols ;
 Front_parent [j] = parent ;
 ;
 ;
 nfr++ ;
 if (parent != (-1))
 {
     Link [j] = Link [parent] ;
     Link [parent] = j ;
 }
 ;
 jlast = j ;
    }
    *nfr_out = nfr ;
    Front_order = W ;
    if (fixQ)
    {
 ;
 k = 0 ;
#pragma novector
 for (j = 0 ; j < n_col ; j++)
 {
     if (Front_npivcol [j] > 0)
     {
  Front_order [j] = k++ ;
  ;
     }
     else
     {
  Front_order [j] = (-1) ;
     }
 }
    }
    else
    {
 Front_child = Ap ;
 Front_sibling = Link ;
 Front_stack = Ai ;
 Front_size = Front_stack + n_col ;
 umf_l_fsize (n_col, Front_size, Front_nrows, Front_ncols,
     Front_parent, Front_npivcol) ;
 amd_l_postorder (n_col, Front_parent, Front_npivcol, Front_size,
     Front_order, Front_child, Front_sibling, Front_stack) ;
 Winv = Ai ;
 for (k = 0 ; k < nfr ; k++)
 {
     Winv [k] = (-1) ;
 }
 ;
 for (i = 0 ; i < n_col ; i++)
 {
     k = Front_order [i] ;
     if (k != (-1))
     {
  ;
  ;
  ;
  Winv [k] = i ;
     }
 }
 kk = 0 ;
 for (k = 0 ; k < nfr ; k++)
 {
     i = Winv [k] ;
     ;
     ;
     ;
     for (npiv = 0 ; npiv < Front_npivcol [i] ; npiv++)
     {
  Up [kk] = i + npiv ;
  ;
  kk++ ;
     }
 }
 ;
    }
    umf_l_apply_order (Front_npivcol, Front_order, Ai, n_col, nfr) ;
    umf_l_apply_order (Front_nrows, Front_order, Ai, n_col, nfr) ;
    umf_l_apply_order (Front_ncols, Front_order, Ai, n_col, nfr) ;
    umf_l_apply_order (Front_parent, Front_order, Ai, n_col, nfr) ;
    for (i = 0 ; i < nfr ; i++)
    {
 parent = Front_parent [i] ;
 if (parent != (-1))
 {
     ;
     ;
     Front_parent [i] = Front_order [parent] ;
 }
    }
    *p_ncompactions = ncompactions ;
    return ((1)) ;
}

variable_types:
Ai
long []

variable_types:
Ap
long []

variable_types:
Up
long []

variable_types: fixQ long

variable_types:
W
long []

variable_types:
Link
long []

variable_types: j long

variable_types: col long

variable_types: k long

variable_types: row long

variable_types: parent long

variable_types: pdest long

variable_types: p long

variable_types: thickness long

variable_types: npivots long

variable_types: nfr long

variable_types: i long

variable_types:
Winv
long *

variable_types: kk long

variable_types: npiv long

variable_types: jnext long

variable_types: krow long

variable_types: knext long

variable_types: pfirst long

variable_types: jlast long

variable_types: ncompactions long

variable_types: Wflag long

variable_types: npivcol long

variable_types: fallrows long

variable_types: fallcols long

variable_types: fpiv long

variable_types: frows long

variable_types: fcols long


decompiled_code:
__int64 __fastcall umf_l_realloc(__int64 a1, signed __int64 a2, unsigned __int64 a3)
{
__int64 result; // rax

if ( a2 <= 0 )
a2 = 1LL;
if ( 0x7FFFFFFFFFFFFFFFLL / a3 < a2 )
result = 0LL;
else
result = amd_realloc(a1, a3 * a2, 0x7FFFFFFFFFFFFFFFLL % a3);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, signed __int64 a2, unsigned __int64 a3)
{
__int64 result; // rax

if ( a2 <= 0 )
a2 = 1LL;
if ( 0x7FFFFFFFFFFFFFFFLL / a3 < a2 )
result = 0LL;
else
result = amd_realloc(a1, a3 * a2, 0x7FFFFFFFFFFFFFFFLL % a3);
return result;
}

original_code:
void *umf_l_realloc
(
    void *p,
    long n_objects,
    size_t size_of_object
)
{
    size_t size ;
    void *p2 ;
    n_objects = (((1) > (n_objects)) ? (1) : (n_objects)) ;
    size = (size_t) n_objects ;
    ;
    if (size > 0x7fffffffffffffffL / size_of_object)
    {
 return ((void *) ((void *)0)) ;
    }
    size *= size_of_object ;
    ;
    p2 = amd_realloc (p, size) ;
    ;
    return (p2) ;
}

canonical_original_code:
void *umf_l_realloc(void *p, long n_objects, unsigned long size_of_object)
{
    unsigned long size;
    void *p2;
    n_objects = (((1) > (n_objects)) ? (1) : (n_objects)) ;
    size = (unsigned long) n_objects ;
    ;
    if (size > 0x7fffffffffffffffL / size_of_object)
    {
 return ((void *) ((void *)0)) ;
    }
    size *= size_of_object ;
    ;
    p2 = amd_realloc (p, size) ;
    ;
    return (p2) ;
}

variable_types:
p
void *

variable_types:
size
unsigned long

return_type: void *


original_code:
int umfzi_valid_numeric
(
    NumericType *Numeric
)
{
    if (!Numeric)
    {
 return ((0)) ;
    }
    if (Numeric->valid != 17957)
    {
 return ((0)) ;
    }
    if (Numeric->n_row <= 0 || Numeric->n_col <= 0 || !Numeric->D ||
 !Numeric->Rperm || !Numeric->Cperm ||
 !Numeric->Lpos || !Numeric->Upos ||
 !Numeric->Lilen || !Numeric->Uilen || !Numeric->Lip || !Numeric->Uip ||
 !Numeric->Memory || (Numeric->ulen > 0 && !Numeric->Upattern))
    {
 return ((0)) ;
    }
    return ((1)) ;
}

canonical_original_code:
int umfzi_valid_numeric(struct NumericType *Numeric)
{
    if (!Numeric)
    {
 return ((0)) ;
    }
    if (Numeric->valid != 17957)
    {
 return ((0)) ;
    }
    if (Numeric->n_row <= 0 || Numeric->n_col <= 0 || !Numeric->D ||
 !Numeric->Rperm || !Numeric->Cperm ||
 !Numeric->Lpos || !Numeric->Upos ||
 !Numeric->Lilen || !Numeric->Uilen || !Numeric->Lip || !Numeric->Uip ||
 !Numeric->Memory || (Numeric->ulen > 0 && !Numeric->Upattern))
    {
 return ((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; } *


original_code:
void umfzi_scale_column
(
    NumericType *Numeric,
    WorkType *Work
)
{
    DoubleComplex pivot_value ;
    DoubleComplex *Fcol, *Flublock, *Flblock, *Fublock, *Fcblock ;
    int k, k1, fnr_curr, fnrows, fncols, *Frpos, *Fcpos, pivrow, pivcol,
 *Frows, *Fcols, fnc_curr, fnpiv, *Row_tuples, nb,
 *Col_tuples, *Rperm, *Cperm, fspos, col2, row2 ;
    fnrows = Work->fnrows ;
    fncols = Work->fncols ;
    fnpiv = Work->fnpiv ;
    Rperm = Numeric->Rperm ;
    Cperm = Numeric->Cperm ;
    Flublock = Work->Flublock ;
    Flblock = Work->Flblock ;
    Fublock = Work->Fublock ;
    Fcblock = Work->Fcblock ;
    fnr_curr = Work->fnr_curr ;
    fnc_curr = Work->fnc_curr ;
    Frpos = Work->Frpos ;
    Fcpos = Work->Fcpos ;
    Frows = Work->Frows ;
    Fcols = Work->Fcols ;
    pivrow = Work->pivrow ;
    pivcol = Work->pivcol ;
    ;
    ;
    Row_tuples = Numeric->Uip ;
    Col_tuples = Numeric->Lip ;
    nb = Work->nb ;
    fspos = Fcpos [pivcol] ;
    fncols = --(Work->fncols) ;
    if (fspos != fncols * fnr_curr)
    {
 int fs = fspos / fnr_curr ;
 ;
 ;
 {
     int i ;
     DoubleComplex *Fs, *Fe ;
     Fs = Fcblock + fspos ;
     Fe = Fcblock + fncols * fnr_curr ;
#pragma ivdep
     for (i = 0 ; i < fnrows ; i++)
     {
  Fs [i] = Fe [i] ;
     }
 }
 {
     int i ;
     DoubleComplex *Fs, *Fe ;
     Fs = Fublock + fs ;
     Fe = Fublock + fncols ;
#pragma ivdep
     for (i = 0 ; i < fnpiv ; i++)
     {
  Fs [i * fnc_curr] = Fe [i * fnc_curr] ;
     }
 }
 col2 = Fcols [fncols] ;
 Fcols [fs] = col2 ;
 Fcpos [col2] = fspos ;
    }
    Fcpos [pivcol] = (-1) ;
    fspos = Frpos [pivrow] ;
    fnrows = --(Work->fnrows) ;
    ;
    ;
    if (fspos == fnrows)
    {
 ;
 {
     int j ;
     DoubleComplex *Fd, *Fs ;
     Fd = Fublock + fnpiv * fnc_curr ;
     Fs = Fcblock + fspos ;
#pragma ivdep
     for (j = 0 ; j < fncols ; j++)
     {
  Fd [j] = Fs [j * fnr_curr] ;
     }
 }
 if (Work->pivrow_in_front)
 {
     int j ;
     DoubleComplex *Fd, *Fs ;
     Fd = Flublock + fnpiv ;
     Fs = Flblock + fspos ;
#pragma ivdep
     for (j = 0 ; j <= fnpiv ; j++)
     {
  Fd [j * nb] = Fs [j * fnr_curr] ;
     }
 }
 else
 {
     int j ;
     DoubleComplex *Fd, *Fs ;
     Fd = Flublock + fnpiv ;
     Fs = Flblock + fspos ;
#pragma ivdep
     for (j = 0 ; j < fnpiv ; j++)
     {
  ;
  { (Fd [j * nb]).component [0] = 0. ; (Fd [j * nb]).component [1] = 0. ; } ;
     }
     Fd [fnpiv * nb] = Fs [fnpiv * fnr_curr] ;
 }
    }
    else
    {
 ;
 {
     DoubleComplex *Fd, *Fs, *Fe ;
     Fd = Fublock + fnpiv * fnc_curr ;
     Fs = Fcblock + fspos ;
     Fe = Fcblock + fnrows ;
     shift_pivot_row (Fd, Fs, Fe, fncols, fnr_curr) ;
 }
 if (Work->pivrow_in_front)
 {
     int j ;
     DoubleComplex *Fd, *Fs, *Fe ;
     Fd = Flublock + fnpiv ;
     Fs = Flblock + fspos ;
     Fe = Flblock + fnrows ;
#pragma ivdep
     for (j = 0 ; j <= fnpiv ; j++)
     {
  Fd [j * nb] = Fs [j * fnr_curr] ;
  Fs [j * fnr_curr] = Fe [j * fnr_curr] ;
     }
 }
 else
 {
     int j ;
     DoubleComplex *Fd, *Fs, *Fe ;
     Fd = Flublock + fnpiv ;
     Fs = Flblock + fspos ;
     Fe = Flblock + fnrows ;
#pragma ivdep
     for (j = 0 ; j < fnpiv ; j++)
     {
  ;
  { (Fd [j * nb]).component [0] = 0. ; (Fd [j * nb]).component [1] = 0. ; } ;
  Fs [j * fnr_curr] = Fe [j * fnr_curr] ;
     }
     Fd [fnpiv * nb] = Fs [fnpiv * fnr_curr] ;
     Fs [fnpiv * fnr_curr] = Fe [fnpiv * fnr_curr] ;
 }
 row2 = Frows [fnrows] ;
 Frows [fspos] = row2 ;
 Frpos [row2] = fspos ;
    }
    Frpos [pivrow] = (-1) ;
    Fcol = Flblock + fnpiv * fnr_curr ;
    pivot_value = Flublock [fnpiv + fnpiv * nb] ;
    k = Work->npiv + fnpiv ;
    ;
    ;
    ;
    umfzi_scale (fnrows, pivot_value, Fcol) ;
    umfzi_mem_free_tail_block (Numeric, Row_tuples [pivrow]) ;
    umfzi_mem_free_tail_block (Numeric, Col_tuples [pivcol]) ;
    Row_tuples [pivrow] = 0 ;
    Col_tuples [pivcol] = 0 ;
    ;
    ;
    ;
    k1 = (-(k)-1) ;
    Rperm [pivrow] = k1 ;
    Cperm [pivcol] = k1 ;
    ;
    ;
    ;
    Work->Pivrow [fnpiv] = pivrow ;
    Work->Pivcol [fnpiv] = pivcol ;
    Work->fnpiv++ ;
}

canonical_original_code:
void umfzi_scale_column(struct NumericType *Numeric, struct WorkType *Work)
{
    struct DoubleComplex pivot_value;
    struct DoubleComplex *Fcol; struct DoubleComplex *Flublock; struct DoubleComplex *Flblock; struct DoubleComplex *Fublock; struct DoubleComplex *Fcblock;
    int k; int k1; int fnr_curr; int fnrows; int fncols; int *Frpos; int *Fcpos; int pivrow; int pivcol; int *Frows; int *Fcols; int fnc_curr; int fnpiv; int *Row_tuples; int nb; int *Col_tuples; int *Rperm; int *Cperm; int fspos; int col2; int row2;
    fnrows = Work->fnrows ;
    fncols = Work->fncols ;
    fnpiv = Work->fnpiv ;
    Rperm = Numeric->Rperm ;
    Cperm = Numeric->Cperm ;
    Flublock = Work->Flublock ;
    Flblock = Work->Flblock ;
    Fublock = Work->Fublock ;
    Fcblock = Work->Fcblock ;
    fnr_curr = Work->fnr_curr ;
    fnc_curr = Work->fnc_curr ;
    Frpos = Work->Frpos ;
    Fcpos = Work->Fcpos ;
    Frows = Work->Frows ;
    Fcols = Work->Fcols ;
    pivrow = Work->pivrow ;
    pivcol = Work->pivcol ;
    ;
    ;
    Row_tuples = Numeric->Uip ;
    Col_tuples = Numeric->Lip ;
    nb = Work->nb ;
    fspos = Fcpos [pivcol] ;
    fncols = --(Work->fncols) ;
    if (fspos != fncols * fnr_curr)
    {
 int fs = fspos / fnr_curr;
 ;
 ;
 {
     int i;
     struct DoubleComplex *Fs; struct DoubleComplex *Fe;
     Fs = Fcblock + fspos ;
     Fe = Fcblock + fncols * fnr_curr ;
#pragma ivdep
     for (i = 0 ; i < fnrows ; i++)
     {
  Fs [i] = Fe [i] ;
     }
 }
 {
     int i;
     struct DoubleComplex *Fs; struct DoubleComplex *Fe;
     Fs = Fublock + fs ;
     Fe = Fublock + fncols ;
#pragma ivdep
     for (i = 0 ; i < fnpiv ; i++)
     {
  Fs [i * fnc_curr] = Fe [i * fnc_curr] ;
     }
 }
 col2 = Fcols [fncols] ;
 Fcols [fs] = col2 ;
 Fcpos [col2] = fspos ;
    }
    Fcpos [pivcol] = (-1) ;
    fspos = Frpos [pivrow] ;
    fnrows = --(Work->fnrows) ;
    ;
    ;
    if (fspos == fnrows)
    {
 ;
 {
     int j;
     struct DoubleComplex *Fd; struct DoubleComplex *Fs;
     Fd = Fublock + fnpiv * fnc_curr ;
     Fs = Fcblock + fspos ;
#pragma ivdep
     for (j = 0 ; j < fncols ; j++)
     {
  Fd [j] = Fs [j * fnr_curr] ;
     }
 }
 if (Work->pivrow_in_front)
 {
     int j;
     struct DoubleComplex *Fd; struct DoubleComplex *Fs;
     Fd = Flublock + fnpiv ;
     Fs = Flblock + fspos ;
#pragma ivdep
     for (j = 0 ; j <= fnpiv ; j++)
     {
  Fd [j * nb] = Fs [j * fnr_curr] ;
     }
 }
 else
 {
     int j;
     struct DoubleComplex *Fd; struct DoubleComplex *Fs;
     Fd = Flublock + fnpiv ;
     Fs = Flblock + fspos ;
#pragma ivdep
     for (j = 0 ; j < fnpiv ; j++)
     {
  ;
  { (Fd [j * nb]).component [0] = 0. ; (Fd [j * nb]).component [1] = 0. ; } ;
     }
     Fd [fnpiv * nb] = Fs [fnpiv * fnr_curr] ;
 }
    }
    else
    {
 ;
 {
     struct DoubleComplex *Fd; struct DoubleComplex *Fs; struct DoubleComplex *Fe;
     Fd = Fublock + fnpiv * fnc_curr ;
     Fs = Fcblock + fspos ;
     Fe = Fcblock + fnrows ;
     shift_pivot_row (Fd, Fs, Fe, fncols, fnr_curr) ;
 }
 if (Work->pivrow_in_front)
 {
     int j;
     struct DoubleComplex *Fd; struct DoubleComplex *Fs; struct DoubleComplex *Fe;
     Fd = Flublock + fnpiv ;
     Fs = Flblock + fspos ;
     Fe = Flblock + fnrows ;
#pragma ivdep
     for (j = 0 ; j <= fnpiv ; j++)
     {
  Fd [j * nb] = Fs [j * fnr_curr] ;
  Fs [j * fnr_curr] = Fe [j * fnr_curr] ;
     }
 }
 else
 {
     int j;
     struct DoubleComplex *Fd; struct DoubleComplex *Fs; struct DoubleComplex *Fe;
     Fd = Flublock + fnpiv ;
     Fs = Flblock + fspos ;
     Fe = Flblock + fnrows ;
#pragma ivdep
     for (j = 0 ; j < fnpiv ; j++)
     {
  ;
  { (Fd [j * nb]).component [0] = 0. ; (Fd [j * nb]).component [1] = 0. ; } ;
  Fs [j * fnr_curr] = Fe [j * fnr_curr] ;
     }
     Fd [fnpiv * nb] = Fs [fnpiv * fnr_curr] ;
     Fs [fnpiv * fnr_curr] = Fe [fnpiv * fnr_curr] ;
 }
 row2 = Frows [fnrows] ;
 Frows [fspos] = row2 ;
 Frpos [row2] = fspos ;
    }
    Frpos [pivrow] = (-1) ;
    Fcol = Flblock + fnpiv * fnr_curr ;
    pivot_value = Flublock [fnpiv + fnpiv * nb] ;
    k = Work->npiv + fnpiv ;
    ;
    ;
    ;
    umfzi_scale (fnrows, pivot_value, Fcol) ;
    umfzi_mem_free_tail_block (Numeric, Row_tuples [pivrow]) ;
    umfzi_mem_free_tail_block (Numeric, Col_tuples [pivcol]) ;
    Row_tuples [pivrow] = 0 ;
    Col_tuples [pivcol] = 0 ;
    ;
    ;
    ;
    k1 = (-(k)-1) ;
    Rperm [pivrow] = k1 ;
    Cperm [pivcol] = k1 ;
    ;
    ;
    ;
    Work->Pivrow [fnpiv] = pivrow ;
    Work->Pivcol [fnpiv] = pivcol ;
    Work->fnpiv++ ;
}

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: struct DoubleComplex { double component[2]; } *

variable_types: k int

variable_types: fnrows int

variable_types: fncols int

variable_types:
Frpos
int *

variable_types:
Fcpos
int *

variable_types: pivrow int

variable_types: pivcol int

variable_types:
Frows
int *

variable_types:
Fcols
int *

variable_types: fnpiv int

variable_types: nb int

variable_types:
Rperm
int *

variable_types:
Cperm
int *

variable_types: fspos int

variable_types: fs int

variable_types: i int

variable_types: j int

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


decompiled_code:
__int64 __fastcall umf_i_malloc(int a1, unsigned __int64 a2)
{
__int64 result; // rax

if ( a1 <= 0 )
a1 = 1;
if ( 0x7FFFFFFF / a2 < a1 )
result = 0LL;
else
result = amd_malloc(a2 * a1);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, unsigned __int64 a2)
{
__int64 result; // rax

if ( a1 <= 0 )
a1 = 1;
if ( 0x7FFFFFFF / a2 < a1 )
result = 0LL;
else
result = amd_malloc(a2 * a1);
return result;
}

original_code:
void *umf_i_malloc
(
    int n_objects,
    size_t size_of_object
)
{
    size_t size ;
    void *p ;
    ;
    n_objects = (((1) > (n_objects)) ? (1) : (n_objects)) ;
    size = (size_t) n_objects ;
    ;
    if (size > 0x7fffffff / size_of_object)
    {
 return ((void *) ((void *)0)) ;
    }
    size *= size_of_object ;
    p = amd_malloc (size) ;
    ;
    return (p) ;
}

canonical_original_code:
void *umf_i_malloc(int n_objects, unsigned long size_of_object)
{
    unsigned long size;
    void *p;
    ;
    n_objects = (((1) > (n_objects)) ? (1) : (n_objects)) ;
    size = (unsigned long) n_objects ;
    ;
    if (size > 0x7fffffff / size_of_object)
    {
 return ((void *) ((void *)0)) ;
    }
    size *= size_of_object ;
    p = amd_malloc (size) ;
    ;
    return (p) ;
}

variable_types:
size
unsigned long

variable_types:
p
void *


decompiled_code:
__int64 __fastcall umfpack_di_transpose(unsigned int a1, unsigned int a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, __int64 a9, __int64 a10)
{
bool v14; // cc
__int64 v15; // rdi
__int64 v16; // rax
__int64 v17; // r12
unsigned int v18; // ebx

v14 = (int)a1 <= 0;
v15 = 1LL;
if ( !v14 )
v15 = a1;
if ( (int)v15 < (int)a2 )
v15 = a2;
v16 = umf_i_malloc(v15, 4LL);
if ( !v16 )
return (unsigned int)-1;
v17 = v16;
v18 = umfdi_transpose(a1, a2, a3, a4, a5, a6, a7, a2, a8, a9, a10, v16, 1LL);
umf_i_free(v17);
return v18;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1, unsigned int a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, __int64 a9, __int64 a10)
{
bool v14; // cc
__int64 v15; // rdi
__int64 v16; // rax
__int64 v17; // r12
unsigned int v18; // ebx

v14 = (int)a1 <= 0;
v15 = 1LL;
if ( !v14 )
v15 = a1;
if ( (int)v15 < (int)a2 )
v15 = a2;
v16 = umf_i_malloc(v15, 4LL);
if ( !v16 )
return (unsigned int)-1;
v17 = v16;
v18 = umfdi_transpose(a1, a2, a3, a4, a5, a6, a7, a2, a8, a9, a10, v16, 1LL);
umf_i_free(v17);
return v18;
}

original_code:
int umfpack_di_transpose
(
    int n_row,
    int n_col,
    const int Ap [ ],
    const int Ai [ ],
    const double Ax [ ],
    const int P [ ],
    const int Q [ ],
    int Rp [ ],
    int Ri [ ],
    double Rx [ ]
)
{
    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 = umfdi_transpose (n_row, n_col, Ap, Ai, Ax, P, Q, n_col, Rp, Ri, Rx,
 W, (1)
 ) ;
    (void) umf_i_free ((void *) W) ;
    ;
    return (status) ;
}

canonical_original_code:
int umfpack_di_transpose(int n_row, int n_col, int Ap[], int Ai[], double Ax[], int P[], int Q[], int Rp[], int Ri[], double Rx[])
{
    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 = umfdi_transpose (n_row, n_col, Ap, Ai, Ax, P, Q, n_col, Rp, Ri, Rx,
 W, (1)
 ) ;
    (void) umf_i_free ((void *) W) ;
    ;
    return (status) ;
}

variable_types:
Ap
int []

variable_types:
Ai
int []

variable_types:
Ax
double []

variable_types:
P
int []

variable_types:
Q
int []

variable_types:
Rp
int []

variable_types:
Ri
int []

variable_types:
Rx
double []

variable_types: status int

variable_types:
W
int *

variable_types: nn int


decompiled_code:
__int64 __fastcall umfpack_di_report_vector(__int64 a1, __int64 a2, double *a3)
{
__int64 v3; // rcx
__int64 result; // rax

if ( !a3 )
return 0LL;
v3 = (unsigned int)(int)*a3;
result = 0LL;
if ( (int)v3 > 2 )
result = umfdi_report_vector(a1, a2, 0LL, v3, 1LL, 0LL);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, double *a3)
{
__int64 v3; // rcx
__int64 result; // rax

if ( !a3 )
return 0LL;
v3 = (unsigned int)(int)*a3;
result = 0LL;
if ( (int)v3 > 2 )
result = umfdi_report_vector(a1, a2, 0LL, v3, 1LL, 0LL);
return result;
}

original_code:
int umfpack_di_report_vector
(
    int n,
    const double Xx [ ],
    const double Control [20]
)
{
    int prl ;
    double *Xz = (double *) ((void *)0) ;
    prl = ((Control != (double *) ((void *)0)) ? (((Control [0]) != (Control [0])) ? 1 : Control [0]) : 1) ;
    if (prl <= 2)
    {
 return ((0)) ;
    }
    return (umfdi_report_vector (n, Xx, Xz, prl, (1), (0))) ;
}

canonical_original_code:
int umfpack_di_report_vector(int n, double Xx[], double Control[20])
{
    int prl;
    double *Xz = (double *) ((void *)0);
    prl = ((Control != (double *) ((void *)0)) ? (((Control [0]) != (Control [0])) ? 1 : Control [0]) : 1) ;
    if (prl <= 2)
    {
 return ((0)) ;
    }
    return (umfdi_report_vector (n, Xx, Xz, prl, (1), (0))) ;
}

variable_types: n int

variable_types:
Xx
double []

variable_types:
Control
double [20]

variable_types: prl int

variable_types:
Xz
double *