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

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

variable_types: struct NumericType { double flops; long scale; long valid; union Unit_union { struct { long size; } header; double xxxxxx; } *Memory; long ihead; long *Rperm; long ulen; 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: needunits long

variable_types: nsize double

variable_types: bsize double

variable_types: tsize double

variable_types: i long

variable_types: minsize long

variable_types: newsize long

variable_types: newmem long

variable_types: costly long

variable_types: row long

variable_types: col long

variable_types: nb long

variable_types: dr long

variable_types: dc long


original_code:
int cholmod_amd
(
    cholmod_sparse *A,
    int *fset,
    size_t fsize,
    int *Perm,
    cholmod_common *Common
)
{
    double Info [20], Control2 [5], *Control ;
    int *Cp, *Len, *Nv, *Head, *Elen, *Degree, *Wi, *Iwork, *Next ;
    cholmod_sparse *C ;
    int j, n, cnz ;
    size_t s ;
    int ok = 1 ;
    { if (Common == ((void *)0)) { return (0) ; } if (Common->itype != 0 || Common->dtype != 0) { Common->status = (-4) ; return (0) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../Cholesky/cholmod_amd.c", 71, "argument missing", Common) ; } return (0) ; } } ;
    n = A->nrow ;
    { if ((Perm) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../Cholesky/cholmod_amd.c", 74, "argument missing", Common) ; } return (0) ; } } ;
    { 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), "../Cholesky/cholmod_amd.c", 75, "invalid xtype", Common) ; } return (0) ; } } ;
    Common->status = 0 ;
    if (n == 0)
    {
 Common->fl = 0 ;
 Common->lnz = 0 ;
 Common->anz = 0 ;
 return (1) ;
    }
    s = cholmod_mult_size_t (n, 6, &ok) ;
    if (!ok)
    {
 cholmod_error ((-3), "../Cholesky/cholmod_amd.c", 99, "problem too large", Common) ;
 return (0) ;
    }
    s = (((s) > (A->ncol)) ? (s) : (A->ncol)) ;
    cholmod_allocate_work (n, s, 0, Common) ;
    if (Common->status < 0)
    {
 return (0) ;
    }
    Iwork = Common->Iwork ;
    Degree = Iwork ;
    Wi = Iwork + n ;
    Len = Iwork + 2*((size_t) n) ;
    Nv = Iwork + 3*((size_t) n) ;
    Next = Iwork + 4*((size_t) n) ;
    Elen = Iwork + 5*((size_t) n) ;
    Head = Common->Head ;
    if (A->stype == 0)
    {
 C = cholmod_aat (A, fset, fsize, -2, Common) ;
    }
    else
    {
 C = cholmod_copy (A, 0, -2, Common) ;
    }
    if (Common->status < 0)
    {
 return (0) ;
    }
    Cp = C->p ;
    for (j = 0 ; j < n ; j++)
    {
 Len [j] = Cp [j+1] - Cp [j] ;
    }
    cnz = Cp [n] ;
    Common->anz = cnz / 2 + n ;
    if (Common->current < 0 || Common->current >= 9)
    {
 Control = ((void *)0) ;
    }
    else
    {
 Control = Control2 ;
 Control [0] = Common->method [Common->current].prune_dense ;
 Control [1] = Common->method [Common->current].aggressive ;
    }
    amd_malloc = Common->malloc_memory ;
    amd_free = Common->free_memory ;
    amd_calloc = Common->calloc_memory ;
    amd_realloc = Common->realloc_memory ;
    amd_printf = Common->print_function ;
    amd_2 (n, C->p, C->i, Len, C->nzmax, cnz, Nv, Next, Perm, Head, Elen,
     Degree, Wi, Control, Info) ;
    Common->fl = Info [10] + 2 * Info [11] + n ;
    Common->lnz = n + Info [9] ;
    ;
    cholmod_free_sparse (&C, Common) ;
    for (j = 0 ; j <= n ; j++)
    {
 Head [j] = (-1) ;
    }
    return (1) ;
}

canonical_original_code:
int cholmod_amd(struct cholmod_sparse_struct *A, int *fset, unsigned long fsize, int *Perm, struct cholmod_common_struct *Common)
{
    double Info[20]; double Control2[5]; double *Control;
    int *Cp; int *Len; int *Nv; int *Head; int *Elen; int *Degree; int *Wi; int *Iwork; int *Next;
    struct cholmod_sparse_struct *C;
    int j; int n; int cnz;
    unsigned long s;
    int ok = 1;
    { if (Common == ((void *)0)) { return (0) ; } if (Common->itype != 0 || Common->dtype != 0) { Common->status = (-4) ; return (0) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../Cholesky/cholmod_amd.c", 71, "argument missing", Common) ; } return (0) ; } } ;
    n = A->nrow ;
    { if ((Perm) == ((void *)0)) { if (Common->status != (-2)) { cholmod_error ((-4), "../Cholesky/cholmod_amd.c", 74, "argument missing", Common) ; } return (0) ; } } ;
    { 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), "../Cholesky/cholmod_amd.c", 75, "invalid xtype", Common) ; } return (0) ; } } ;
    Common->status = 0 ;
    if (n == 0)
    {
 Common->fl = 0 ;
 Common->lnz = 0 ;
 Common->anz = 0 ;
 return (1) ;
    }
    s = cholmod_mult_size_t (n, 6, &ok) ;
    if (!ok)
    {
 cholmod_error ((-3), "../Cholesky/cholmod_amd.c", 99, "problem too large", Common) ;
 return (0) ;
    }
    s = (((s) > (A->ncol)) ? (s) : (A->ncol)) ;
    cholmod_allocate_work (n, s, 0, Common) ;
    if (Common->status < 0)
    {
 return (0) ;
    }
    Iwork = Common->Iwork ;
    Degree = Iwork ;
    Wi = Iwork + n ;
    Len = Iwork + 2*((unsigned long) n) ;
    Nv = Iwork + 3*((unsigned long) n) ;
    Next = Iwork + 4*((unsigned long) n) ;
    Elen = Iwork + 5*((unsigned long) n) ;
    Head = Common->Head ;
    if (A->stype == 0)
    {
 C = cholmod_aat (A, fset, fsize, -2, Common) ;
    }
    else
    {
 C = cholmod_copy (A, 0, -2, Common) ;
    }
    if (Common->status < 0)
    {
 return (0) ;
    }
    Cp = C->p ;
    for (j = 0 ; j < n ; j++)
    {
 Len [j] = Cp [j+1] - Cp [j] ;
    }
    cnz = Cp [n] ;
    Common->anz = cnz / 2 + n ;
    if (Common->current < 0 || Common->current >= 9)
    {
 Control = ((void *)0) ;
    }
    else
    {
 Control = Control2 ;
 Control [0] = Common->method [Common->current].prune_dense ;
 Control [1] = Common->method [Common->current].aggressive ;
    }
    amd_malloc = Common->malloc_memory ;
    amd_free = Common->free_memory ;
    amd_calloc = Common->calloc_memory ;
    amd_realloc = Common->realloc_memory ;
    amd_printf = Common->print_function ;
    amd_2 (n, C->p, C->i, Len, C->nzmax, cnz, Nv, Next, Perm, Head, Elen,
     Degree, Wi, Control, Info) ;
    Common->fl = Info [10] + 2 * Info [11] + n ;
    Common->lnz = n + Info [9] ;
    ;
    cholmod_free_sparse (&C, Common) ;
    for (j = 0 ; j <= n ; j++)
    {
 Head [j] = (-1) ;
    }
    return (1) ;
}

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:
fset
int *

variable_types:
fsize
unsigned long

variable_types:
Perm
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:
Info
double [20]

variable_types:
Control
double *

variable_types:
Cp
int *

variable_types:
Len
int *

variable_types:
Nv
int *

variable_types:
Head
int *

variable_types:
Elen
int *

variable_types:
Degree
int *

variable_types:
Wi
int *

variable_types:
Iwork
int *

variable_types:
Next
int *

variable_types: j int

variable_types: n int

variable_types: cnz int

variable_types:
s
unsigned long

variable_types: ok int

return_type: int

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


original_code:
long umfdl_transpose
(
    long n_row,
    long n_col,
    const long Ap [ ],
    const long Ai [ ],
    const double Ax [ ],
    const long P [ ],
    const long Q [ ],
    long nq,
    long Rp [ ],
    long Ri [ ],
    double Rx [ ],
    long W [ ],
    long check
)
{
    long i, j, k, p, bp, newj, do_values ;
    if (check)
    {
 if (!Ai || !Ap || !Ri || !Rp || !W)
 {
     return ((-5)) ;
 }
 if (n_row <= 0 || n_col <= 0)
 {
     return ((-6)) ;
 }
 if (!umf_l_is_permutation (P, W, n_row, n_row) ||
     !umf_l_is_permutation (Q, W, nq, nq))
 {
     return ((-15)) ;
 }
 if (amd_l_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 != (long *) ((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 != (long *) ((void *)0))
    {
 Rp [0] = 0 ;
 for (k = 0 ; k < n_row ; k++)
 {
     i = P [k] ;
     ;
     Rp [k+1] = Rp [k] + W [i] ;
 }
 for (k = 0 ; k < n_row ; k++)
 {
     i = P [k] ;
     ;
     W [i] = Rp [k] ;
 }
    }
    else
    {
 Rp [0] = 0 ;
 for (i = 0 ; i < n_row ; i++)
 {
     Rp [i+1] = Rp [i] + W [i] ;
 }
 for (i = 0 ; i < n_row ; i++)
 {
     W [i] = Rp [i] ;
 }
    }
    ;
    do_values = Ax && Rx ;
    {
 if (Q != (long *) ((void *)0))
 {
     if (do_values)
     {
  {
      for (newj = 0 ; newj < nq ; newj++)
      {
   j = Q [newj] ;
   ;
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = newj ;
       Rx [bp] = Ax [p] ;
   }
      }
  }
     }
     else
     {
  for (newj = 0 ; newj < nq ; newj++)
  {
      j = Q [newj] ;
      ;
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   Ri [W [Ai [p]]++] = newj ;
      }
  }
     }
 }
 else
 {
     if (do_values)
     {
  {
      for (j = 0 ; j < n_col ; j++)
      {
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = j ;
       Rx [bp] = Ax [p] ;
   }
      }
  }
     }
     else
     {
  for (j = 0 ; j < n_col ; j++)
  {
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   Ri [W [Ai [p]]++] = j ;
      }
  }
     }
 }
    }
    return ((0)) ;
}

canonical_original_code:
long umfdl_transpose(long n_row, long n_col, long Ap[], long Ai[], double Ax[], long P[], long Q[], long nq, long Rp[], long Ri[], double Rx[], long W[], long check)
{
    long i; long j; long k; long p; long bp; long newj; long do_values;
    if (check)
    {
 if (!Ai || !Ap || !Ri || !Rp || !W)
 {
     return ((-5)) ;
 }
 if (n_row <= 0 || n_col <= 0)
 {
     return ((-6)) ;
 }
 if (!umf_l_is_permutation (P, W, n_row, n_row) ||
     !umf_l_is_permutation (Q, W, nq, nq))
 {
     return ((-15)) ;
 }
 if (amd_l_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 != (long *) ((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 != (long *) ((void *)0))
    {
 Rp [0] = 0 ;
 for (k = 0 ; k < n_row ; k++)
 {
     i = P [k] ;
     ;
     Rp [k+1] = Rp [k] + W [i] ;
 }
 for (k = 0 ; k < n_row ; k++)
 {
     i = P [k] ;
     ;
     W [i] = Rp [k] ;
 }
    }
    else
    {
 Rp [0] = 0 ;
 for (i = 0 ; i < n_row ; i++)
 {
     Rp [i+1] = Rp [i] + W [i] ;
 }
 for (i = 0 ; i < n_row ; i++)
 {
     W [i] = Rp [i] ;
 }
    }
    ;
    do_values = Ax && Rx ;
    {
 if (Q != (long *) ((void *)0))
 {
     if (do_values)
     {
  {
      for (newj = 0 ; newj < nq ; newj++)
      {
   j = Q [newj] ;
   ;
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = newj ;
       Rx [bp] = Ax [p] ;
   }
      }
  }
     }
     else
     {
  for (newj = 0 ; newj < nq ; newj++)
  {
      j = Q [newj] ;
      ;
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   Ri [W [Ai [p]]++] = newj ;
      }
  }
     }
 }
 else
 {
     if (do_values)
     {
  {
      for (j = 0 ; j < n_col ; j++)
      {
   for (p = Ap [j] ; p < Ap [j+1] ; p++)
   {
       bp = W [Ai [p]]++ ;
       Ri [bp] = j ;
       Rx [bp] = Ax [p] ;
   }
      }
  }
     }
     else
     {
  for (j = 0 ; j < n_col ; j++)
  {
      for (p = Ap [j] ; p < Ap [j+1] ; p++)
      {
   Ri [W [Ai [p]]++] = j ;
      }
  }
     }
 }
    }
    return ((0)) ;
}

variable_types:
Ap
long []

variable_types:
Ai
long []

variable_types:
Ax
double []

variable_types:
P
long []

variable_types:
Q
long []

variable_types: nq long

variable_types:
Rp
long []

variable_types:
Ri
long []

variable_types:
Rx
double []

variable_types:
W
long []

variable_types: check long

variable_types: i long

variable_types: j long

variable_types: k long

variable_types: p long

variable_types: bp long

variable_types: newj long

return_type: long


decompiled_code:
__int64 __fastcall umfpack_zl_report_matrix(__int64 a1, __int64 i, __int64 (*a3)(const char *, ...), __int64 (*a4)(const char *, ...), __int64 a5, __int64 a6, double a7, double a8, double a9, double a10, __int64 a11, double *a12)
{
__int64 v12; // r12
double v14; // xmm0_8
__int64 v15; // r14
__int64 result; // rax
__int64 v17; // rbp
__int64 (*v18)(const char *, ...); // r8
__int64 v19; // rcx
__int64 v20; // rbx
__int64 v21; // rax
__int64 j; // rdx
__int64 v23; // rbp
__int64 v24; // r14
__int64 v25; // rdi
__int64 v26; // r15
__int64 v27; // rbx
__int64 v28; // r12
char v29; // al
__int64 v30; // r13
__int64 (*v31)(const char *, ...); // [rsp+8h] [rbp-A0h]
__int64 v32; // [rsp+10h] [rbp-98h]
__int64 v33; // [rsp+18h] [rbp-90h]
double v35; // [rsp+20h] [rbp-88h]
const char *v36; // [rsp+28h] [rbp-80h]
const char *v37; // [rsp+30h] [rbp-78h]
__int64 v38; // [rsp+48h] [rbp-60h]
__int64 v39; // [rsp+58h] [rbp-50h]
__int64 (*v40)(const char *, ...); // [rsp+60h] [rbp-48h]
__int64 v41; // [rsp+68h] [rbp-40h]

v31 = a4;
v32 = a6;
if ( !a12 )
return 0LL;
v12 = i;
v14 = *a12;
v15 = (unsigned int)(int)*a12;
result = 0LL;
if ( (unsigned __int64)v15 > 2 )
{
if ( a11 )
{
v33 = a1;
v17 = i;
v37 = (const char *)&LC0;
v36 = "column";
}
else
{
v33 = i;
v17 = a1;
v37 = "column";
v36 = (const char *)&LC0;
}
v18 = amd_printf;
if ( amd_printf )
{
v19 = i;
i = (__int64)v36;
amd_printf("%s-form matrix, n_row %ld n_col %ld, ", v36, a1, v19);
if ( a1 <= 0 || v12 <= 0 )
{
if ( amd_printf )
amd_printf("ERROR: n_row <= 0 or n_col <= 0\n\n");
return -6LL;
}
if ( !a3 )
{
if ( amd_printf )
amd_printf("ERROR: Ap missing\n\n");
return -5LL;
}
}
else
{
if ( a1 <= 0 || i <= 0 )
return -6LL;
if ( !a3 )
return -5LL;
}
v20 = *((_QWORD *)a3 + v17);
if ( amd_printf )
{
i = *((_QWORD *)a3 + v17);
amd_printf("nz = %ld. ", i);
if ( v20 < 0 )
{
if ( amd_printf )
amd_printf("ERROR: number of entries < 0\n\n");
return -8LL;
}
if ( *(_QWORD *)a3 )
{
if ( amd_printf )
amd_printf("ERROR: Ap [%ld] = %ld must be %ld\n\n", 0LL, *(_QWORD *)a3, 0LL);
return -8LL;
}
}
else
{
if ( v20 < 0 )
return -8LL;
if ( *(_QWORD *)a3 )
return -8LL;
}
if ( v31 )
{
if ( v15 <= 3 )
{
if ( v17 <= 0 )
goto LABEL_124;
}
else
{
if ( amd_printf )
amd_printf("\n");
if ( v17 <= 0 )
{
LABEL_103:
result = 0LL;
if ( !amd_printf )
return result;
i = (__int64)v36;
amd_printf(" %s-form matrix ", v36);
goto LABEL_124;
}
}
for ( i = 0LL; ; ++i )
{
v21 = *((_QWORD *)a3 + i);
if ( v21 < 0 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf("ERROR: Ap [%ld] < 0\n\n", i);
result = -8LL;
}
return result;
}
if ( v21 > v20 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf("ERROR: Ap [%ld] > size of Ai\n\n", i);
result = -8LL;
}
return result;
}
if ( v17 == i + 1 )
break;
}
for ( j = 0LL; (__int64)(*((_QWORD *)a3 + j + 1) - *((_QWORD *)a3 + j)) >= 0; ++j )
{
if ( i == j )
{
v23 = v15;
v38 = 0LL;
v39 = v15;
v41 = i + 1;
v40 = a3;
v24 = a5;
while ( 1 )
{
if ( v38 <= 9 )
v23 = v39;
a4 = v40;
v25 = *((_QWORD *)v40 + v38);
v26 = *((_QWORD *)v40 + v38 + 1);
a6 = v26 - v25;
if ( v23 > 3 && amd_printf )
{
i = (__int64)v36;
amd_printf("\n %s %ld: start: %ld end: %ld entries: %ld\n", v36, v38, v25, v26 - 1, a6);
}
if ( v25 < v26 )
break;
LABEL_95:
if ( v41 > 10 && v38 == 9 && v23 == 4 )
{
if ( amd_printf )
amd_printf("\n ...\n", i, amd_printf, a4, v18, a6);
v23 = 3LL;
}
else if ( v38 + 1 >= v41 )
{
if ( v39 > 3 )
goto LABEL_103;
LABEL_124:
if ( amd_printf )
amd_printf("OK\n\n", i, amd_printf, a4, v18, a6);
return 0LL;
}
++v38;
}
v27 = v25 + 1;
v28 = -1LL;
while ( 2 )
{
v30 = v28;
v28 = *((_QWORD *)v31 + v27 - 1);
v29 = 0;
if ( v23 > 3 )
{
a4 = amd_printf;
if ( amd_printf )
{
i = (__int64)v37;
amd_printf("\t%s %ld ", v37, *((_QWORD *)v31 + v27 - 1));
if ( v24 )
{
if ( amd_printf )
amd_printf(":");
LABEL_78:
if ( v32 )
{
v14 = *(double *)(v24 + 8 * v27 - 8);
v35 = *(double *)(v32 + 8 * v27 - 8);
}
else
{
v14 = *(double *)(v24 + 16 * v27 - 16);
v35 = *(double *)(v24 + 16 * v27 - 8);
}
if ( v14 == 0.0 )
{
if ( amd_printf )
amd_printf(" (0");
}
else if ( amd_printf )
{
amd_printf(" (%g", v14);
}
a9 = 0.0;
a8 = v35;
if ( v35 < 0.0 )
{
v29 = 1;
if ( amd_printf )
{
*(_QWORD *)&a8 = *(_QWORD *)&v35 ^ LC19;
*(_QWORD *)&v14 = *(_QWORD *)&v35 ^ LC19;
amd_printf(" - %gi)", COERCE_DOUBLE(*(_QWORD *)&v35 ^ LC19));
v29 = 1;
}
}
else
{
a10 = v35;
if ( v35 == 0.0 )
{
v29 = 1;
if ( amd_printf )
{
amd_printf(" + 0i)", v14, v35, 0.0, v35);
v29 = 1;
}
}
else
{
v29 = 1;
if ( amd_printf )
{
v14 = v35;
amd_printf(" + %gi)", v35);
v29 = 1;
}
}
}
}
else
{
v29 = 1;
}
}
else
{
if ( v24 )
goto LABEL_78;
v29 = 1;
}
}
if ( v28 < 0 || v33 <= v28 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf(" ERROR: %s index %ld out of range in %s %ld\n\n", v37, v28, v36, v38);
result = -8LL;
}
return result;
}
if ( v28 <= v30 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf(" ERROR: %s index %ld out of order (or duplicate) in %s %ld\n\n", v37, v28, v36, v38);
result = -8LL;
}
return result;
}
if ( v29 && amd_printf )
amd_printf("\n", v14, a8, a9, a10);
if ( v23 == 4 && v27 + ~v25 == 9 && v26 - v25 > 10 )
{
if ( amd_printf )
amd_printf("\t...\n", v14, a8, a9, a10);
v23 = 3LL;
}
if ( v27 == v26 )
goto LABEL_95;
++v27;
continue;
}
}
}
result = -8LL;
if ( amd_printf )
{
amd_printf("ERROR: # entries in %s %ld is < 0\n\n", v36, j);
result = -8LL;
}
}
else
{
result = -5LL;
if ( amd_printf )
{
amd_printf("ERROR: Ai missing\n\n");
result = -5LL;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 i, __int64 (*a3)(const char *, ...), __int64 (*a4)(const char *, ...), __int64 a5, __int64 a6, double a7, double a8, double a9, double a10, __int64 a11, double *a12)
{
__int64 v12; // r12
double v14; // xmm0_8
__int64 v15; // r14
__int64 result; // rax
__int64 v17; // rbp
__int64 (*v18)(const char *, ...); // r8
__int64 v19; // rcx
__int64 v20; // rbx
__int64 v21; // rax
__int64 j; // rdx
__int64 v23; // rbp
__int64 v24; // r14
__int64 v25; // rdi
__int64 v26; // r15
__int64 v27; // rbx
__int64 v28; // r12
char v29; // al
__int64 v30; // r13
__int64 (*v31)(const char *, ...); // [rsp+8h] [rbp-A0h]
__int64 v32; // [rsp+10h] [rbp-98h]
__int64 v33; // [rsp+18h] [rbp-90h]
double v35; // [rsp+20h] [rbp-88h]
const char *v36; // [rsp+28h] [rbp-80h]
const char *v37; // [rsp+30h] [rbp-78h]
__int64 v38; // [rsp+48h] [rbp-60h]
__int64 v39; // [rsp+58h] [rbp-50h]
__int64 (*v40)(const char *, ...); // [rsp+60h] [rbp-48h]
__int64 v41; // [rsp+68h] [rbp-40h]

v31 = a4;
v32 = a6;
if ( !a12 )
return 0LL;
v12 = i;
v14 = *a12;
v15 = (unsigned int)(int)*a12;
result = 0LL;
if ( (unsigned __int64)v15 > 2 )
{
if ( a11 )
{
v33 = a1;
v17 = i;
v37 = (const char *)&LC0;
v36 = "column";
}
else
{
v33 = i;
v17 = a1;
v37 = "column";
v36 = (const char *)&LC0;
}
v18 = amd_printf;
if ( amd_printf )
{
v19 = i;
i = (__int64)v36;
amd_printf("%s-form matrix, n_row %ld n_col %ld, ", v36, a1, v19);
if ( a1 <= 0 || v12 <= 0 )
{
if ( amd_printf )
amd_printf("ERROR: n_row <= 0 or n_col <= 0\n\n");
return -6LL;
}
if ( !a3 )
{
if ( amd_printf )
amd_printf("ERROR: Ap missing\n\n");
return -5LL;
}
}
else
{
if ( a1 <= 0 || i <= 0 )
return -6LL;
if ( !a3 )
return -5LL;
}
v20 = *((_QWORD *)a3 + v17);
if ( amd_printf )
{
i = *((_QWORD *)a3 + v17);
amd_printf("nz = %ld. ", i);
if ( v20 < 0 )
{
if ( amd_printf )
amd_printf("ERROR: number of entries < 0\n\n");
return -8LL;
}
if ( *(_QWORD *)a3 )
{
if ( amd_printf )
amd_printf("ERROR: Ap [%ld] = %ld must be %ld\n\n", 0LL, *(_QWORD *)a3, 0LL);
return -8LL;
}
}
else
{
if ( v20 < 0 )
return -8LL;
if ( *(_QWORD *)a3 )
return -8LL;
}
if ( v31 )
{
if ( v15 <= 3 )
{
if ( v17 <= 0 )
goto LABEL_124;
}
else
{
if ( amd_printf )
amd_printf("\n");
if ( v17 <= 0 )
{
LABEL_103:
result = 0LL;
if ( !amd_printf )
return result;
i = (__int64)v36;
amd_printf(" %s-form matrix ", v36);
goto LABEL_124;
}
}
for ( i = 0LL; ; ++i )
{
v21 = *((_QWORD *)a3 + i);
if ( v21 < 0 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf("ERROR: Ap [%ld] < 0\n\n", i);
result = -8LL;
}
return result;
}
if ( v21 > v20 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf("ERROR: Ap [%ld] > size of Ai\n\n", i);
result = -8LL;
}
return result;
}
if ( v17 == i + 1 )
break;
}
for ( j = 0LL; (__int64)(*((_QWORD *)a3 + j + 1) - *((_QWORD *)a3 + j)) >= 0; ++j )
{
if ( i == j )
{
v23 = v15;
v38 = 0LL;
v39 = v15;
v41 = i + 1;
v40 = a3;
v24 = a5;
while ( 1 )
{
if ( v38 <= 9 )
v23 = v39;
a4 = v40;
v25 = *((_QWORD *)v40 + v38);
v26 = *((_QWORD *)v40 + v38 + 1);
a6 = v26 - v25;
if ( v23 > 3 && amd_printf )
{
i = (__int64)v36;
amd_printf("\n %s %ld: start: %ld end: %ld entries: %ld\n", v36, v38, v25, v26 - 1, a6);
}
if ( v25 < v26 )
break;
LABEL_95:
if ( v41 > 10 && v38 == 9 && v23 == 4 )
{
if ( amd_printf )
amd_printf("\n ...\n", i, amd_printf, a4, v18, a6);
v23 = 3LL;
}
else if ( v38 + 1 >= v41 )
{
if ( v39 > 3 )
goto LABEL_103;
LABEL_124:
if ( amd_printf )
amd_printf("OK\n\n", i, amd_printf, a4, v18, a6);
return 0LL;
}
++v38;
}
v27 = v25 + 1;
v28 = -1LL;
while ( 2 )
{
v30 = v28;
v28 = *((_QWORD *)v31 + v27 - 1);
v29 = 0;
if ( v23 > 3 )
{
a4 = amd_printf;
if ( amd_printf )
{
i = (__int64)v37;
amd_printf("\t%s %ld ", v37, *((_QWORD *)v31 + v27 - 1));
if ( v24 )
{
if ( amd_printf )
amd_printf(":");
LABEL_78:
if ( v32 )
{
v14 = *(double *)(v24 + 8 * v27 - 8);
v35 = *(double *)(v32 + 8 * v27 - 8);
}
else
{
v14 = *(double *)(v24 + 16 * v27 - 16);
v35 = *(double *)(v24 + 16 * v27 - 8);
}
if ( v14 == 0.0 )
{
if ( amd_printf )
amd_printf(" (0");
}
else if ( amd_printf )
{
amd_printf(" (%g", v14);
}
a9 = 0.0;
a8 = v35;
if ( v35 < 0.0 )
{
v29 = 1;
if ( amd_printf )
{
*(_QWORD *)&a8 = *(_QWORD *)&v35 ^ LC19;
*(_QWORD *)&v14 = *(_QWORD *)&v35 ^ LC19;
amd_printf(" - %gi)", COERCE_DOUBLE(*(_QWORD *)&v35 ^ LC19));
v29 = 1;
}
}
else
{
a10 = v35;
if ( v35 == 0.0 )
{
v29 = 1;
if ( amd_printf )
{
amd_printf(" + 0i)", v14, v35, 0.0, v35);
v29 = 1;
}
}
else
{
v29 = 1;
if ( amd_printf )
{
v14 = v35;
amd_printf(" + %gi)", v35);
v29 = 1;
}
}
}
}
else
{
v29 = 1;
}
}
else
{
if ( v24 )
goto LABEL_78;
v29 = 1;
}
}
if ( v28 < 0 || v33 <= v28 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf(" ERROR: %s index %ld out of range in %s %ld\n\n", v37, v28, v36, v38);
result = -8LL;
}
return result;
}
if ( v28 <= v30 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf(" ERROR: %s index %ld out of order (or duplicate) in %s %ld\n\n", v37, v28, v36, v38);
result = -8LL;
}
return result;
}
if ( v29 && amd_printf )
amd_printf("\n", v14, a8, a9, a10);
if ( v23 == 4 && v27 + ~v25 == 9 && v26 - v25 > 10 )
{
if ( amd_printf )
amd_printf("\t...\n", v14, a8, a9, a10);
v23 = 3LL;
}
if ( v27 == v26 )
goto LABEL_95;
++v27;
continue;
}
}
}
result = -8LL;
if ( amd_printf )
{
amd_printf("ERROR: # entries in %s %ld is < 0\n\n", v36, j);
result = -8LL;
}
}
else
{
result = -5LL;
if ( amd_printf )
{
amd_printf("ERROR: Ai missing\n\n");
result = -5LL;
}
}
}
return result;
}

original_code:
long umfpack_zl_report_matrix
(
    long n_row,
    long n_col,
    const long Ap [ ],
    const long Ai [ ],
    const double Ax [ ],
    const double Az [ ],
    long col_form,
    const double Control [20]
)
{
    DoubleComplex a ;
    long prl, i, k, length, ilast, p, nz, prl1, p1, p2, n, n_i, do_values ;
    char *vector_kind, *index_kind ;
    long split = ((Az) != (double *) ((void *)0)) ;
    prl = ((Control != (double *) ((void *)0)) ? (((Control [0]) != (Control [0])) ? 1 : Control [0]) : 1) ;
    if (prl <= 2)
    {
 return ((0)) ;
    }
    if (col_form)
    {
 vector_kind = "column" ;
 index_kind = "row" ;
 n = n_col ;
 n_i = n_row ;
    }
    else
    {
 vector_kind = "row" ;
 index_kind = "column" ;
 n = n_row ;
 n_i = n_col ;
    }
    { if (amd_printf != ((void *)0)) (void) amd_printf ("%s-form matrix, n_row ""%" "ld"" n_col ""%" "ld"", ", vector_kind, n_row, n_col) ; } ;
    if (n_row <= 0 || n_col <= 0)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: n_row <= 0 or n_col <= 0\n\n") ; } ;
 return ((-6)) ;
    }
    if (!Ap)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: Ap missing\n\n") ; } ;
 return ((-5)) ;
    }
    nz = Ap [n] ;
    { if (amd_printf != ((void *)0)) (void) amd_printf ("nz = ""%" "ld"". ", nz) ; } ;
    if (nz < 0)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: number of entries < 0\n\n") ; } ;
 return ((-8)) ;
    }
    if (Ap [0] != 0)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: Ap [""%" "ld""] = ""%" "ld"" must be ""%" "ld""\n\n", (long) (0), (Ap [0]), (long) (0)) ; } ;
 return ((-8)) ;
    }
    if (!Ai)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: Ai missing\n\n") ; } ;
 return ((-5)) ;
    }
    do_values = Ax != (double *) ((void *)0) ;
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ; } } ;
    for (k = 0 ; k < n ; k++)
    {
 if (Ap [k] < 0)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: Ap [""%" "ld""] < 0\n\n", (k)) ; } ;
     return ((-8)) ;
 }
 if (Ap [k] > nz)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: Ap [""%" "ld""] > size of Ai\n\n", (k)) ; } ;
     return ((-8)) ;
 }
    }
    for (k = 0 ; k < n ; k++)
    {
 length = Ap [k+1] - Ap [k] ;
 if (length < 0)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: # entries in %s ""%" "ld"" is < 0\n\n", vector_kind, (k)) ; } ;
     return ((-8)) ;
 }
    }
    prl1 = prl ;
    for (k = 0 ; k < n ; k++)
    {
 if (k < 10)
 {
     prl = prl1 ;
 }
 p1 = Ap [k] ;
 p2 = Ap [k+1] ;
 length = p2 - p1 ;
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n    %s ""%" "ld"": start: ""%" "ld"" end: ""%" "ld"" entries: ""%" "ld""\n", vector_kind, (k), p1, p2-1, length) ; } ; } } ;
 ilast = (-1) ;
 for (p = p1 ; p < p2 ; p++)
 {
     i = Ai [p] ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t%s ""%" "ld"" ", index_kind, (i)) ; } ; } } ;
     if (do_values && prl >= 4)
     {
  { if (amd_printf != ((void *)0)) (void) amd_printf (":") ; } ;
  { if (split) { (a).component [0] = (Ax)[p] ; (a).component [1] = (Az)[p] ; } else { (a) = ((DoubleComplex *)(Ax))[p] ; } } ;
  { if ((((a).component [0]) != 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" (%g", (a).component [0]) ; } ; } else { { if (amd_printf != ((void *)0)) (void) amd_printf (" (0") ; } ; } if ((((a).component [1]) < 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" - %gi)", -(a).component [1]) ; } ; } else if ((((a).component [1]) == 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" + 0i)") ; } ; } else { { if (amd_printf != ((void *)0)) (void) amd_printf (" + %gi)", (a).component [1]) ; } ; } } ;
     }
     if (i < 0 || i >= n_i)
     {
  { if (amd_printf != ((void *)0)) (void) amd_printf (" ERROR: %s index ""%" "ld"" out of range in %s ""%" "ld""\n\n", index_kind, (i), vector_kind, (k)) ; } ;
  return ((-8)) ;
     }
     if (i <= ilast)
     {
  { if (amd_printf != ((void *)0)) (void) amd_printf (" ERROR: %s index ""%" "ld"" out of order (or duplicate) in " "%s ""%" "ld""\n\n", index_kind, (i), vector_kind, (k)) ; } ;
  return ((-8)) ;
     }
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ; } } ;
     if (prl == 4 && (p - p1) == 9 && length > 10)
     {
  { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t...\n") ; } ; } } ;
  prl-- ;
     }
     ilast = i ;
 }
 if (prl == 4 && k == 9 && n > 10)
 {
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n    ...\n") ; } ; } } ;
     prl-- ;
 }
    }
    prl = prl1 ;
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("    %s-form matrix ", vector_kind) ; } ; } } ;
    { if (amd_printf != ((void *)0)) (void) amd_printf ("OK\n\n") ; } ;
    return ((0)) ;
}

canonical_original_code:
long umfpack_zl_report_matrix(long n_row, long n_col, long Ap[], long Ai[], double Ax[], double Az[], long col_form, double Control[20])
{
    struct DoubleComplex a;
    long prl; long i; long k; long length; long ilast; long p; long nz; long prl1; long p1; long p2; long n; long n_i; long do_values;
    char *vector_kind; char *index_kind;
    long split = ((Az) != (double *) ((void *)0));
    prl = ((Control != (double *) ((void *)0)) ? (((Control [0]) != (Control [0])) ? 1 : Control [0]) : 1) ;
    if (prl <= 2)
    {
 return ((0)) ;
    }
    if (col_form)
    {
 vector_kind = "column" ;
 index_kind = "row" ;
 n = n_col ;
 n_i = n_row ;
    }
    else
    {
 vector_kind = "row" ;
 index_kind = "column" ;
 n = n_row ;
 n_i = n_col ;
    }
    { if (amd_printf != ((void *)0)) (void) amd_printf ("%s-form matrix, n_row ""%" "ld"" n_col ""%" "ld"", ", vector_kind, n_row, n_col) ; } ;
    if (n_row <= 0 || n_col <= 0)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: n_row <= 0 or n_col <= 0\n\n") ; } ;
 return ((-6)) ;
    }
    if (!Ap)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: Ap missing\n\n") ; } ;
 return ((-5)) ;
    }
    nz = Ap [n] ;
    { if (amd_printf != ((void *)0)) (void) amd_printf ("nz = ""%" "ld"". ", nz) ; } ;
    if (nz < 0)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: number of entries < 0\n\n") ; } ;
 return ((-8)) ;
    }
    if (Ap [0] != 0)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: Ap [""%" "ld""] = ""%" "ld"" must be ""%" "ld""\n\n", (long) (0), (Ap [0]), (long) (0)) ; } ;
 return ((-8)) ;
    }
    if (!Ai)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: Ai missing\n\n") ; } ;
 return ((-5)) ;
    }
    do_values = Ax != (double *) ((void *)0) ;
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ; } } ;
    for (k = 0 ; k < n ; k++)
    {
 if (Ap [k] < 0)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: Ap [""%" "ld""] < 0\n\n", (k)) ; } ;
     return ((-8)) ;
 }
 if (Ap [k] > nz)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: Ap [""%" "ld""] > size of Ai\n\n", (k)) ; } ;
     return ((-8)) ;
 }
    }
    for (k = 0 ; k < n ; k++)
    {
 length = Ap [k+1] - Ap [k] ;
 if (length < 0)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: # entries in %s ""%" "ld"" is < 0\n\n", vector_kind, (k)) ; } ;
     return ((-8)) ;
 }
    }
    prl1 = prl ;
    for (k = 0 ; k < n ; k++)
    {
 if (k < 10)
 {
     prl = prl1 ;
 }
 p1 = Ap [k] ;
 p2 = Ap [k+1] ;
 length = p2 - p1 ;
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n    %s ""%" "ld"": start: ""%" "ld"" end: ""%" "ld"" entries: ""%" "ld""\n", vector_kind, (k), p1, p2-1, length) ; } ; } } ;
 ilast = (-1) ;
 for (p = p1 ; p < p2 ; p++)
 {
     i = Ai [p] ;
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t%s ""%" "ld"" ", index_kind, (i)) ; } ; } } ;
     if (do_values && prl >= 4)
     {
  { if (amd_printf != ((void *)0)) (void) amd_printf (":") ; } ;
  { if (split) { (a).component [0] = (Ax)[p] ; (a).component [1] = (Az)[p] ; } else { (a) = ((struct DoubleComplex *)(Ax))[p] ; } } ;
  { if ((((a).component [0]) != 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" (%g", (a).component [0]) ; } ; } else { { if (amd_printf != ((void *)0)) (void) amd_printf (" (0") ; } ; } if ((((a).component [1]) < 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" - %gi)", -(a).component [1]) ; } ; } else if ((((a).component [1]) == 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" + 0i)") ; } ; } else { { if (amd_printf != ((void *)0)) (void) amd_printf (" + %gi)", (a).component [1]) ; } ; } } ;
     }
     if (i < 0 || i >= n_i)
     {
  { if (amd_printf != ((void *)0)) (void) amd_printf (" ERROR: %s index ""%" "ld"" out of range in %s ""%" "ld""\n\n", index_kind, (i), vector_kind, (k)) ; } ;
  return ((-8)) ;
     }
     if (i <= ilast)
     {
  { if (amd_printf != ((void *)0)) (void) amd_printf (" ERROR: %s index ""%" "ld"" out of order (or duplicate) in " "%s ""%" "ld""\n\n", index_kind, (i), vector_kind, (k)) ; } ;
  return ((-8)) ;
     }
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ; } } ;
     if (prl == 4 && (p - p1) == 9 && length > 10)
     {
  { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\t...\n") ; } ; } } ;
  prl-- ;
     }
     ilast = i ;
 }
 if (prl == 4 && k == 9 && n > 10)
 {
     { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n    ...\n") ; } ; } } ;
     prl-- ;
 }
    }
    prl = prl1 ;
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("    %s-form matrix ", vector_kind) ; } ; } } ;
    { if (amd_printf != ((void *)0)) (void) amd_printf ("OK\n\n") ; } ;
    return ((0)) ;
}

variable_types:
Ap
long []

variable_types:
Az
double []

variable_types:
Control
double [20]

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

variable_types: prl long

variable_types: length long

variable_types: ilast long

variable_types: nz long

variable_types: n long

variable_types: split long


original_code:
int umfdi_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] = umfdi_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] = umfdi_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 umfdi_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] = umfdi_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] = umfdi_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; double *D; int do_recip; double *Rs; int n_row; int tail_usage; int maxnrows; } *

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

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

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 umfpack_di_get_symbolic
(
    int *p_n_row,
    int *p_n_col,
    int *p_n1,
    int *p_nz,
    int *p_nfr,
    int *p_nchains,
    int P [ ],
    int Q [ ],
    int Front_npivcol [ ],
    int Front_parent [ ],
    int Front_1strow [ ],
    int Front_leftmostdesc [ ],
    int Chain_start [ ],
    int Chain_maxrows [ ],
    int Chain_maxcols [ ],
    void *SymbolicHandle
)
{
    SymbolicType *Symbolic ;
    int k, n_row, n_col, n1, nfr, nchains, *p ;
    Symbolic = (SymbolicType *) SymbolicHandle ;
    if (!umfdi_valid_symbolic (Symbolic))
    {
 return ((-4)) ;
    }
    n_row = Symbolic->n_row ;
    n_col = Symbolic->n_col ;
    n1 = Symbolic->n1 ;
    nfr = Symbolic->nfr ;
    nchains = Symbolic->nchains ;
    if (p_n_row)
    {
 *p_n_row = n_row ;
    }
    if (p_n_col)
    {
 *p_n_col = n_col ;
    }
    if (p_n1)
    {
 *p_n1 = n1 ;
    }
    if (p_nz)
    {
 *p_nz = Symbolic->nz ;
    }
    if (p_nfr)
    {
 *p_nfr = nfr ;
    }
    if (p_nchains)
    {
 *p_nchains = nchains ;
    }
    if (P != (int *) ((void *)0))
    {
 int *Rperm_init, *Diagonal_map ;
 Rperm_init = Symbolic->Rperm_init ;
 Diagonal_map = Symbolic->Diagonal_map ;
 if (Diagonal_map != (int *) ((void *)0))
 {
     ;
     for (k = 0 ; k < n_row ; k++)
     {
  P [k] = Rperm_init [Diagonal_map [k]] ;
     }
 }
 else
 {
     for (k = 0 ; k < n_row ; k++)
     {
  P [k] = Rperm_init [k] ;
     }
 }
    }
    if (Q != (int *) ((void *)0))
    {
 p = Symbolic->Cperm_init ;
 for (k = 0 ; k < n_col ; k++)
 {
     Q [k] = p [k] ;
 }
    }
    if (Front_npivcol != (int *) ((void *)0))
    {
 p = Symbolic->Front_npivcol ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_npivcol [k] = p [k] ;
 }
    }
    if (Front_parent != (int *) ((void *)0))
    {
 p = Symbolic->Front_parent ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_parent [k] = p [k] ;
 }
    }
    if (Front_1strow != (int *) ((void *)0))
    {
 p = Symbolic->Front_1strow ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_1strow [k] = p [k] ;
 }
    }
    if (Front_leftmostdesc != (int *) ((void *)0))
    {
 p = Symbolic->Front_leftmostdesc ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_leftmostdesc [k] = p [k] ;
 }
    }
    if (Chain_start != (int *) ((void *)0))
    {
 p = Symbolic->Chain_start ;
 for (k = 0 ; k <= nchains ; k++)
 {
     Chain_start [k] = p [k] ;
 }
    }
    if (Chain_maxrows != (int *) ((void *)0))
    {
 p = Symbolic->Chain_maxrows ;
 for (k = 0 ; k < nchains ; k++)
 {
     Chain_maxrows [k] = p [k] ;
 }
 Chain_maxrows [nchains] = 0 ;
    }
    if (Chain_maxcols != (int *) ((void *)0))
    {
 p = Symbolic->Chain_maxcols ;
 for (k = 0 ; k < nchains ; k++)
 {
     Chain_maxcols [k] = p [k] ;
 }
 Chain_maxcols [nchains] = 0 ;
    }
    return ((0)) ;
}

canonical_original_code:
int umfpack_di_get_symbolic(int *p_n_row, int *p_n_col, int *p_n1, int *p_nz, int *p_nfr, int *p_nchains, int P[], int Q[], int Front_npivcol[], int Front_parent[], int Front_1strow[], int Front_leftmostdesc[], int Chain_start[], int Chain_maxrows[], int Chain_maxcols[], void *SymbolicHandle)
{
    struct SymbolicType *Symbolic;
    int k; int n_row; int n_col; int n1; int nfr; int nchains; int *p;
    Symbolic = (struct SymbolicType *) SymbolicHandle ;
    if (!umfdi_valid_symbolic (Symbolic))
    {
 return ((-4)) ;
    }
    n_row = Symbolic->n_row ;
    n_col = Symbolic->n_col ;
    n1 = Symbolic->n1 ;
    nfr = Symbolic->nfr ;
    nchains = Symbolic->nchains ;
    if (p_n_row)
    {
 *p_n_row = n_row ;
    }
    if (p_n_col)
    {
 *p_n_col = n_col ;
    }
    if (p_n1)
    {
 *p_n1 = n1 ;
    }
    if (p_nz)
    {
 *p_nz = Symbolic->nz ;
    }
    if (p_nfr)
    {
 *p_nfr = nfr ;
    }
    if (p_nchains)
    {
 *p_nchains = nchains ;
    }
    if (P != (int *) ((void *)0))
    {
 int *Rperm_init; int *Diagonal_map;
 Rperm_init = Symbolic->Rperm_init ;
 Diagonal_map = Symbolic->Diagonal_map ;
 if (Diagonal_map != (int *) ((void *)0))
 {
     ;
     for (k = 0 ; k < n_row ; k++)
     {
  P [k] = Rperm_init [Diagonal_map [k]] ;
     }
 }
 else
 {
     for (k = 0 ; k < n_row ; k++)
     {
  P [k] = Rperm_init [k] ;
     }
 }
    }
    if (Q != (int *) ((void *)0))
    {
 p = Symbolic->Cperm_init ;
 for (k = 0 ; k < n_col ; k++)
 {
     Q [k] = p [k] ;
 }
    }
    if (Front_npivcol != (int *) ((void *)0))
    {
 p = Symbolic->Front_npivcol ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_npivcol [k] = p [k] ;
 }
    }
    if (Front_parent != (int *) ((void *)0))
    {
 p = Symbolic->Front_parent ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_parent [k] = p [k] ;
 }
    }
    if (Front_1strow != (int *) ((void *)0))
    {
 p = Symbolic->Front_1strow ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_1strow [k] = p [k] ;
 }
    }
    if (Front_leftmostdesc != (int *) ((void *)0))
    {
 p = Symbolic->Front_leftmostdesc ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_leftmostdesc [k] = p [k] ;
 }
    }
    if (Chain_start != (int *) ((void *)0))
    {
 p = Symbolic->Chain_start ;
 for (k = 0 ; k <= nchains ; k++)
 {
     Chain_start [k] = p [k] ;
 }
    }
    if (Chain_maxrows != (int *) ((void *)0))
    {
 p = Symbolic->Chain_maxrows ;
 for (k = 0 ; k < nchains ; k++)
 {
     Chain_maxrows [k] = p [k] ;
 }
 Chain_maxrows [nchains] = 0 ;
    }
    if (Chain_maxcols != (int *) ((void *)0))
    {
 p = Symbolic->Chain_maxcols ;
 for (k = 0 ; k < nchains ; k++)
 {
     Chain_maxcols [k] = p [k] ;
 }
 Chain_maxcols [nchains] = 0 ;
    }
    return ((0)) ;
}

variable_types:
P
int []

variable_types:
Q
int []

variable_types:
SymbolicHandle
void *

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

variable_types: k int

variable_types: nfr int

variable_types: nchains int

variable_types:
p
int *


original_code:
int
umfpack_zi_solve
(
    int sys,
    const int Ap [ ],
    const int 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]
)
{
    double Info2 [90], stats [2] ;
    double *Info ;
    NumericType *Numeric ;
    int n, i, irstep, status ;
    int *Pattern, wsize ;
    double *W ;
    umfpack_tic (stats) ;
    irstep = ((Control != (double *) ((void *)0)) ? (((Control [7]) != (Control [7])) ? 2 : Control [7]) : 2) ;
    if (User_Info != (double *) ((void *)0))
    {
 Info = User_Info ;
 for (i = 80 ; i <= 85 ; i++)
 {
     Info [i] = (-1) ;
 }
    }
    else
    {
 Info = Info2 ;
 for (i = 0 ; i < 90 ; i++)
 {
     Info [i] = (-1) ;
 }
    }
    Info [0] = (0) ;
    Info [84] = 0 ;
    Numeric = (NumericType *) NumericHandle ;
    if (!umfzi_valid_numeric (Numeric))
    {
 Info [0] = (-3) ;
 return ((-3)) ;
    }
    Info [1] = Numeric->n_row ;
    Info [16] = Numeric->n_col ;
    if (Numeric->n_row != Numeric->n_col)
    {
 Info [0] = (-13) ;
 return ((-13)) ;
    }
    n = Numeric->n_row ;
    if (Numeric->nnzpiv < n
 || ((Numeric->rcond) == 0.) || ((Numeric->rcond) != (Numeric->rcond)))
    {
 irstep = 0 ;
    }
    if (!Xx || !Bx)
    {
 Info [0] = (-5) ;
 return ((-5)) ;
    }
    if (sys >= (3))
    {
 irstep = 0 ;
    }
    if (irstep > 0)
    {
 wsize = 10*n ;
    }
    else
    {
 wsize = 4*n ;
    }
    Pattern = (int *) umf_i_malloc (n, sizeof (int)) ;
    W = (double *) umf_i_malloc (wsize, sizeof (double)) ;
    if (!W || !Pattern)
    {
 ;
 Info [0] = (-1) ;
 (void) umf_i_free ((void *) W) ;
 (void) umf_i_free ((void *) Pattern) ;
 return ((-1)) ;
    }
    status = umfzi_solve (sys, Ap, Ai, Ax, Xx, Bx,
 Az, Xz, Bz,
 Numeric, irstep, Info, Pattern, W) ;
    (void) umf_i_free ((void *) W) ;
    (void) umf_i_free ((void *) Pattern) ;
    ;
    Info [0] = status ;
    if (status >= 0)
    {
 umfpack_toc (stats) ;
 Info [86] = stats [0] ;
 Info [85] = stats [1] ;
    }
    return (status) ;
}

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

variable_types: sys int

variable_types:
Ap
int []

variable_types:
Ai
int []

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:
NumericHandle
void *

variable_types:
Control
double [20]

variable_types:
stats
double [2]

variable_types:
Info
double *

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

variable_types: i int

variable_types: irstep int

variable_types: status int

variable_types:
Pattern
int *

variable_types: wsize int

variable_types:
W
double *

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


decompiled_code:
__int64 __fastcall umfpack_zl_report_triplet(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, double a7, double a8, double a9, __int64 a10, double *a11)
{
double v14; // xmm0_8
__int64 result; // rax
__int64 v16; // r14
__int64 i; // rbx
__int64 v18; // rbp
__int64 v19; // r12
double v20; // [rsp+8h] [rbp-70h]
__int64 v21; // [rsp+18h] [rbp-60h]
__int64 v22; // [rsp+20h] [rbp-58h]
bool v24; // [rsp+37h] [rbp-41h]
__int64 v25; // [rsp+38h] [rbp-40h]

v21 = a4;
v22 = a5;
if ( !a11 )
return 0LL;
v14 = *a11;
v25 = (unsigned int)(int)*a11;
result = 0LL;
if ( (unsigned __int64)v25 > 2 )
{
if ( amd_printf )
{
amd_printf("triplet-form matrix, n_row = %ld, n_col = %ld nz = %ld. ", a1, a2, a3);
if ( !a4 || !a5 )
{
if ( amd_printf )
amd_printf("ERROR: indices not present\n\n");
return -5LL;
}
if ( a1 <= 0 || a2 <= 0 )
{
if ( amd_printf )
amd_printf("ERROR: n_row or n_col is <= 0\n\n");
return -6LL;
}
}
else
{
if ( !a4 || !a5 )
return -5LL;
if ( a1 <= 0 || a2 <= 0 )
return -6LL;
}
if ( a3 < 0 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf("ERROR: nz is < 0\n\n");
result = -8LL;
}
return result;
}
if ( v25 <= 3 )
{
v24 = a6 != 0;
if ( a3 <= 0 )
{
LABEL_60:
if ( amd_printf )
amd_printf("OK\n\n", v14, a8, a9);
return 0LL;
}
}
else
{
if ( amd_printf )
amd_printf("\n");
v24 = a6 != 0;
if ( a3 <= 0 )
goto LABEL_58;
}
v16 = v25;
for ( i = 1LL; ; ++i )
{
v18 = *(_QWORD *)(v21 + 8 * i - 8);
v19 = *(_QWORD *)(v22 + 8 * i - 8);
if ( v16 <= 3 )
goto LABEL_33;
if ( amd_printf )
amd_printf(" %ld : %ld %ld ", i - 1, *(_QWORD *)(v21 + 8 * i - 8), *(_QWORD *)(v22 + 8 * i - 8));
if ( v24 )
{
if ( a10 )
{
v14 = *(double *)(a6 + 8 * i - 8);
v20 = *(double *)(a10 + 8 * i - 8);
}
else
{
v14 = *(double *)(a6 + 16 * i - 16);
v20 = *(double *)(a6 + 16 * i - 8);
}
if ( v14 == 0.0 )
{
if ( amd_printf )
{
amd_printf(" (0");
LABEL_25:
v14 = 0.0;
a8 = v20;
if ( v20 < 0.0 )
{
if ( amd_printf )
{
*(_QWORD *)&a8 = *(_QWORD *)&v20 ^ LC9;
*(_QWORD *)&v14 = *(_QWORD *)&v20 ^ LC9;
amd_printf(" - %gi)", COERCE_DOUBLE(*(_QWORD *)&v20 ^ LC9));
}
goto LABEL_31;
}
LABEL_26:
a9 = v20;
if ( v20 == 0.0 )
{
if ( amd_printf )
amd_printf(" + 0i)", v14, a8, v20);
}
else if ( amd_printf )
{
v14 = v20;
amd_printf(" + %gi)", v20);
}
goto LABEL_31;
}
}
else if ( amd_printf )
{
amd_printf(" (%g", v14);
goto LABEL_25;
}
if ( v20 >= 0.0 )
goto LABEL_26;
}
LABEL_31:
if ( amd_printf )
amd_printf("\n", v14, a8, a9);
LABEL_33:
if ( v18 < 0 || a1 <= v18 || v19 < 0 || a2 <= v19 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf("ERROR: invalid triplet\n\n", v14, a8, a9);
result = -8LL;
}
return result;
}
if ( a3 > 10 && v16 == 4 && i == 10 )
{
if ( amd_printf )
amd_printf(" ...\n", v14, a8, a9);
v16 = 3LL;
}
else if ( a3 <= i )
{
if ( v25 <= 3 )
goto LABEL_60;
LABEL_58:
result = 0LL;
if ( amd_printf )
{
amd_printf(" triplet-form matrix ");
goto LABEL_60;
}
return result;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, double a7, double a8, double a9, __int64 a10, double *a11)
{
double v14; // xmm0_8
__int64 result; // rax
__int64 v16; // r14
__int64 i; // rbx
__int64 v18; // rbp
__int64 v19; // r12
double v20; // [rsp+8h] [rbp-70h]
__int64 v21; // [rsp+18h] [rbp-60h]
__int64 v22; // [rsp+20h] [rbp-58h]
bool v24; // [rsp+37h] [rbp-41h]
__int64 v25; // [rsp+38h] [rbp-40h]

v21 = a4;
v22 = a5;
if ( !a11 )
return 0LL;
v14 = *a11;
v25 = (unsigned int)(int)*a11;
result = 0LL;
if ( (unsigned __int64)v25 > 2 )
{
if ( amd_printf )
{
amd_printf("triplet-form matrix, n_row = %ld, n_col = %ld nz = %ld. ", a1, a2, a3);
if ( !a4 || !a5 )
{
if ( amd_printf )
amd_printf("ERROR: indices not present\n\n");
return -5LL;
}
if ( a1 <= 0 || a2 <= 0 )
{
if ( amd_printf )
amd_printf("ERROR: n_row or n_col is <= 0\n\n");
return -6LL;
}
}
else
{
if ( !a4 || !a5 )
return -5LL;
if ( a1 <= 0 || a2 <= 0 )
return -6LL;
}
if ( a3 < 0 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf("ERROR: nz is < 0\n\n");
result = -8LL;
}
return result;
}
if ( v25 <= 3 )
{
v24 = a6 != 0;
if ( a3 <= 0 )
{
LABEL_60:
if ( amd_printf )
amd_printf("OK\n\n", v14, a8, a9);
return 0LL;
}
}
else
{
if ( amd_printf )
amd_printf("\n");
v24 = a6 != 0;
if ( a3 <= 0 )
goto LABEL_58;
}
v16 = v25;
for ( i = 1LL; ; ++i )
{
v18 = *(_QWORD *)(v21 + 8 * i - 8);
v19 = *(_QWORD *)(v22 + 8 * i - 8);
if ( v16 <= 3 )
goto LABEL_33;
if ( amd_printf )
amd_printf(" %ld : %ld %ld ", i - 1, *(_QWORD *)(v21 + 8 * i - 8), *(_QWORD *)(v22 + 8 * i - 8));
if ( v24 )
{
if ( a10 )
{
v14 = *(double *)(a6 + 8 * i - 8);
v20 = *(double *)(a10 + 8 * i - 8);
}
else
{
v14 = *(double *)(a6 + 16 * i - 16);
v20 = *(double *)(a6 + 16 * i - 8);
}
if ( v14 == 0.0 )
{
if ( amd_printf )
{
amd_printf(" (0");
LABEL_25:
v14 = 0.0;
a8 = v20;
if ( v20 < 0.0 )
{
if ( amd_printf )
{
*(_QWORD *)&a8 = *(_QWORD *)&v20 ^ LC9;
*(_QWORD *)&v14 = *(_QWORD *)&v20 ^ LC9;
amd_printf(" - %gi)", COERCE_DOUBLE(*(_QWORD *)&v20 ^ LC9));
}
goto LABEL_31;
}
LABEL_26:
a9 = v20;
if ( v20 == 0.0 )
{
if ( amd_printf )
amd_printf(" + 0i)", v14, a8, v20);
}
else if ( amd_printf )
{
v14 = v20;
amd_printf(" + %gi)", v20);
}
goto LABEL_31;
}
}
else if ( amd_printf )
{
amd_printf(" (%g", v14);
goto LABEL_25;
}
if ( v20 >= 0.0 )
goto LABEL_26;
}
LABEL_31:
if ( amd_printf )
amd_printf("\n", v14, a8, a9);
LABEL_33:
if ( v18 < 0 || a1 <= v18 || v19 < 0 || a2 <= v19 )
{
result = -8LL;
if ( amd_printf )
{
amd_printf("ERROR: invalid triplet\n\n", v14, a8, a9);
result = -8LL;
}
return result;
}
if ( a3 > 10 && v16 == 4 && i == 10 )
{
if ( amd_printf )
amd_printf(" ...\n", v14, a8, a9);
v16 = 3LL;
}
else if ( a3 <= i )
{
if ( v25 <= 3 )
goto LABEL_60;
LABEL_58:
result = 0LL;
if ( amd_printf )
{
amd_printf(" triplet-form matrix ");
goto LABEL_60;
}
return result;
}
}
}
return result;
}

original_code:
long umfpack_zl_report_triplet
(
    long n_row,
    long n_col,
    long nz,
    const long Ti [ ],
    const long Tj [ ],
    const double Tx [ ],
    const double Tz [ ],
    const double Control [20]
)
{
    DoubleComplex t ;
    long prl, prl1, k, i, j, do_values ;
    long split = ((Tz) != (double *) ((void *)0)) ;
    prl = ((Control != (double *) ((void *)0)) ? (((Control [0]) != (Control [0])) ? 1 : Control [0]) : 1) ;
    if (prl <= 2)
    {
 return ((0)) ;
    }
    { if (amd_printf != ((void *)0)) (void) amd_printf ("triplet-form matrix, n_row = ""%" "ld"", n_col = ""%" "ld"" nz = ""%" "ld"". ", n_row, n_col, nz) ; } ;
    if (!Ti || !Tj)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: indices not present\n\n") ; } ;
 return ((-5)) ;
    }
    if (n_row <= 0 || n_col <= 0)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: n_row or n_col is <= 0\n\n") ; } ;
 return ((-6)) ;
    }
    if (nz < 0)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: nz is < 0\n\n") ; } ;
 return ((-8)) ;
    }
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ; } } ;
    do_values = Tx != (double *) ((void *)0) ;
    prl1 = prl ;
    for (k = 0 ; k < nz ; k++)
    {
 i = Ti [k] ;
 j = Tj [k] ;
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("    ""%" "ld"" : ""%" "ld"" ""%" "ld"" ", (k), (i), (j)) ; } ; } } ;
 if (do_values && prl >= 4)
 {
     { if (split) { (t).component [0] = (Tx)[k] ; (t).component [1] = (Tz)[k] ; } else { (t) = ((DoubleComplex *)(Tx))[k] ; } } ;
     { if ((((t).component [0]) != 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" (%g", (t).component [0]) ; } ; } else { { if (amd_printf != ((void *)0)) (void) amd_printf (" (0") ; } ; } if ((((t).component [1]) < 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" - %gi)", -(t).component [1]) ; } ; } else if ((((t).component [1]) == 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" + 0i)") ; } ; } else { { if (amd_printf != ((void *)0)) (void) amd_printf (" + %gi)", (t).component [1]) ; } ; } } ;
 }
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ; } } ;
 if (i < 0 || i >= n_row || j < 0 || j >= n_col)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: invalid triplet\n\n") ; } ;
     return ((-8)) ;
 }
 if (prl == 4 && k == 9 && nz > 10)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("    ...\n") ; } ;
     prl-- ;
 }
    }
    prl = prl1 ;
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("    triplet-form matrix ") ; } ; } } ;
    { if (amd_printf != ((void *)0)) (void) amd_printf ("OK\n\n") ; } ;
    return ((0)) ;
}

canonical_original_code:
long umfpack_zl_report_triplet(long n_row, long n_col, long nz, long Ti[], long Tj[], double Tx[], double Tz[], double Control[20])
{
    struct DoubleComplex t;
    long prl; long prl1; long k; long i; long j; long do_values;
    long split = ((Tz) != (double *) ((void *)0));
    prl = ((Control != (double *) ((void *)0)) ? (((Control [0]) != (Control [0])) ? 1 : Control [0]) : 1) ;
    if (prl <= 2)
    {
 return ((0)) ;
    }
    { if (amd_printf != ((void *)0)) (void) amd_printf ("triplet-form matrix, n_row = ""%" "ld"", n_col = ""%" "ld"" nz = ""%" "ld"". ", n_row, n_col, nz) ; } ;
    if (!Ti || !Tj)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: indices not present\n\n") ; } ;
 return ((-5)) ;
    }
    if (n_row <= 0 || n_col <= 0)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: n_row or n_col is <= 0\n\n") ; } ;
 return ((-6)) ;
    }
    if (nz < 0)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: nz is < 0\n\n") ; } ;
 return ((-8)) ;
    }
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ; } } ;
    do_values = Tx != (double *) ((void *)0) ;
    prl1 = prl ;
    for (k = 0 ; k < nz ; k++)
    {
 i = Ti [k] ;
 j = Tj [k] ;
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("    ""%" "ld"" : ""%" "ld"" ""%" "ld"" ", (k), (i), (j)) ; } ; } } ;
 if (do_values && prl >= 4)
 {
     { if (split) { (t).component [0] = (Tx)[k] ; (t).component [1] = (Tz)[k] ; } else { (t) = ((struct DoubleComplex *)(Tx))[k] ; } } ;
     { if ((((t).component [0]) != 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" (%g", (t).component [0]) ; } ; } else { { if (amd_printf != ((void *)0)) (void) amd_printf (" (0") ; } ; } if ((((t).component [1]) < 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" - %gi)", -(t).component [1]) ; } ; } else if ((((t).component [1]) == 0.)) { { if (amd_printf != ((void *)0)) (void) amd_printf (" + 0i)") ; } ; } else { { if (amd_printf != ((void *)0)) (void) amd_printf (" + %gi)", (t).component [1]) ; } ; } } ;
 }
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ; } } ;
 if (i < 0 || i >= n_row || j < 0 || j >= n_col)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: invalid triplet\n\n") ; } ;
     return ((-8)) ;
 }
 if (prl == 4 && k == 9 && nz > 10)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("    ...\n") ; } ;
     prl-- ;
 }
    }
    prl = prl1 ;
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("    triplet-form matrix ") ; } ; } } ;
    { if (amd_printf != ((void *)0)) (void) amd_printf ("OK\n\n") ; } ;
    return ((0)) ;
}

variable_types: nz long

variable_types:
Ti
long []

variable_types:
Tj
long []

variable_types:
Tx
double []

variable_types:
Tz
double []

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

variable_types: prl long

variable_types: k long

variable_types: i long

variable_types: j long

variable_types: split long


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

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

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

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

original_code:
void *umf_l_malloc
(
    long 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 > 0x7fffffffffffffffL / size_of_object)
    {
 return ((void *) ((void *)0)) ;
    }
    size *= size_of_object ;
    p = amd_malloc (size) ;
    ;
    return (p) ;
}

canonical_original_code:
void *umf_l_malloc(long 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 > 0x7fffffffffffffffL / 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 *

return_type: void *


original_code:
long umfpack_dl_get_symbolic
(
    long *p_n_row,
    long *p_n_col,
    long *p_n1,
    long *p_nz,
    long *p_nfr,
    long *p_nchains,
    long P [ ],
    long Q [ ],
    long Front_npivcol [ ],
    long Front_parent [ ],
    long Front_1strow [ ],
    long Front_leftmostdesc [ ],
    long Chain_start [ ],
    long Chain_maxrows [ ],
    long Chain_maxcols [ ],
    void *SymbolicHandle
)
{
    SymbolicType *Symbolic ;
    long k, n_row, n_col, n1, nfr, nchains, *p ;
    Symbolic = (SymbolicType *) SymbolicHandle ;
    if (!umfdl_valid_symbolic (Symbolic))
    {
 return ((-4)) ;
    }
    n_row = Symbolic->n_row ;
    n_col = Symbolic->n_col ;
    n1 = Symbolic->n1 ;
    nfr = Symbolic->nfr ;
    nchains = Symbolic->nchains ;
    if (p_n_row)
    {
 *p_n_row = n_row ;
    }
    if (p_n_col)
    {
 *p_n_col = n_col ;
    }
    if (p_n1)
    {
 *p_n1 = n1 ;
    }
    if (p_nz)
    {
 *p_nz = Symbolic->nz ;
    }
    if (p_nfr)
    {
 *p_nfr = nfr ;
    }
    if (p_nchains)
    {
 *p_nchains = nchains ;
    }
    if (P != (long *) ((void *)0))
    {
 long *Rperm_init, *Diagonal_map ;
 Rperm_init = Symbolic->Rperm_init ;
 Diagonal_map = Symbolic->Diagonal_map ;
 if (Diagonal_map != (long *) ((void *)0))
 {
     ;
     for (k = 0 ; k < n_row ; k++)
     {
  P [k] = Rperm_init [Diagonal_map [k]] ;
     }
 }
 else
 {
     for (k = 0 ; k < n_row ; k++)
     {
  P [k] = Rperm_init [k] ;
     }
 }
    }
    if (Q != (long *) ((void *)0))
    {
 p = Symbolic->Cperm_init ;
 for (k = 0 ; k < n_col ; k++)
 {
     Q [k] = p [k] ;
 }
    }
    if (Front_npivcol != (long *) ((void *)0))
    {
 p = Symbolic->Front_npivcol ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_npivcol [k] = p [k] ;
 }
    }
    if (Front_parent != (long *) ((void *)0))
    {
 p = Symbolic->Front_parent ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_parent [k] = p [k] ;
 }
    }
    if (Front_1strow != (long *) ((void *)0))
    {
 p = Symbolic->Front_1strow ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_1strow [k] = p [k] ;
 }
    }
    if (Front_leftmostdesc != (long *) ((void *)0))
    {
 p = Symbolic->Front_leftmostdesc ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_leftmostdesc [k] = p [k] ;
 }
    }
    if (Chain_start != (long *) ((void *)0))
    {
 p = Symbolic->Chain_start ;
 for (k = 0 ; k <= nchains ; k++)
 {
     Chain_start [k] = p [k] ;
 }
    }
    if (Chain_maxrows != (long *) ((void *)0))
    {
 p = Symbolic->Chain_maxrows ;
 for (k = 0 ; k < nchains ; k++)
 {
     Chain_maxrows [k] = p [k] ;
 }
 Chain_maxrows [nchains] = 0 ;
    }
    if (Chain_maxcols != (long *) ((void *)0))
    {
 p = Symbolic->Chain_maxcols ;
 for (k = 0 ; k < nchains ; k++)
 {
     Chain_maxcols [k] = p [k] ;
 }
 Chain_maxcols [nchains] = 0 ;
    }
    return ((0)) ;
}

canonical_original_code:
long umfpack_dl_get_symbolic(long *p_n_row, long *p_n_col, long *p_n1, long *p_nz, long *p_nfr, long *p_nchains, long P[], long Q[], long Front_npivcol[], long Front_parent[], long Front_1strow[], long Front_leftmostdesc[], long Chain_start[], long Chain_maxrows[], long Chain_maxcols[], void *SymbolicHandle)
{
    struct SymbolicType *Symbolic;
    long k; long n_row; long n_col; long n1; long nfr; long nchains; long *p;
    Symbolic = (struct SymbolicType *) SymbolicHandle ;
    if (!umfdl_valid_symbolic (Symbolic))
    {
 return ((-4)) ;
    }
    n_row = Symbolic->n_row ;
    n_col = Symbolic->n_col ;
    n1 = Symbolic->n1 ;
    nfr = Symbolic->nfr ;
    nchains = Symbolic->nchains ;
    if (p_n_row)
    {
 *p_n_row = n_row ;
    }
    if (p_n_col)
    {
 *p_n_col = n_col ;
    }
    if (p_n1)
    {
 *p_n1 = n1 ;
    }
    if (p_nz)
    {
 *p_nz = Symbolic->nz ;
    }
    if (p_nfr)
    {
 *p_nfr = nfr ;
    }
    if (p_nchains)
    {
 *p_nchains = nchains ;
    }
    if (P != (long *) ((void *)0))
    {
 long *Rperm_init; long *Diagonal_map;
 Rperm_init = Symbolic->Rperm_init ;
 Diagonal_map = Symbolic->Diagonal_map ;
 if (Diagonal_map != (long *) ((void *)0))
 {
     ;
     for (k = 0 ; k < n_row ; k++)
     {
  P [k] = Rperm_init [Diagonal_map [k]] ;
     }
 }
 else
 {
     for (k = 0 ; k < n_row ; k++)
     {
  P [k] = Rperm_init [k] ;
     }
 }
    }
    if (Q != (long *) ((void *)0))
    {
 p = Symbolic->Cperm_init ;
 for (k = 0 ; k < n_col ; k++)
 {
     Q [k] = p [k] ;
 }
    }
    if (Front_npivcol != (long *) ((void *)0))
    {
 p = Symbolic->Front_npivcol ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_npivcol [k] = p [k] ;
 }
    }
    if (Front_parent != (long *) ((void *)0))
    {
 p = Symbolic->Front_parent ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_parent [k] = p [k] ;
 }
    }
    if (Front_1strow != (long *) ((void *)0))
    {
 p = Symbolic->Front_1strow ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_1strow [k] = p [k] ;
 }
    }
    if (Front_leftmostdesc != (long *) ((void *)0))
    {
 p = Symbolic->Front_leftmostdesc ;
 for (k = 0 ; k <= nfr ; k++)
 {
     Front_leftmostdesc [k] = p [k] ;
 }
    }
    if (Chain_start != (long *) ((void *)0))
    {
 p = Symbolic->Chain_start ;
 for (k = 0 ; k <= nchains ; k++)
 {
     Chain_start [k] = p [k] ;
 }
    }
    if (Chain_maxrows != (long *) ((void *)0))
    {
 p = Symbolic->Chain_maxrows ;
 for (k = 0 ; k < nchains ; k++)
 {
     Chain_maxrows [k] = p [k] ;
 }
 Chain_maxrows [nchains] = 0 ;
    }
    if (Chain_maxcols != (long *) ((void *)0))
    {
 p = Symbolic->Chain_maxcols ;
 for (k = 0 ; k < nchains ; k++)
 {
     Chain_maxcols [k] = p [k] ;
 }
 Chain_maxcols [nchains] = 0 ;
    }
    return ((0)) ;
}

variable_types:
P
long []

variable_types:
Q
long []

variable_types:
SymbolicHandle
void *

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

variable_types: nfr long

variable_types: nchains long

variable_types:
p
long *


decompiled_code:
__int64 __fastcall umfzl_report_vector(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, double a7, double a8)
{
__int64 i; // rbx
__int64 result; // rax
__int64 v14; // r15
__int64 v15; // rbx
bool v16; // [rsp+Fh] [rbp-39h]

v16 = a4 > 3 || a5 != 0;
if ( !v16 )
goto LABEL_10;
if ( amd_printf )
amd_printf("dense vector, n = %ld. ", a1);
if ( !a5 )
{
LABEL_8:
if ( amd_printf )
amd_printf("\n");
LABEL_10:
if ( a4 == 4 )
{
v14 = 10LL;
if ( a1 <= 10 )
v14 = a1;
if ( a1 > 0 )
{
v15 = 0LL;
do
print_value(v15++, a2, a3, a6, a7, a8);
while ( v14 > v15 );
}
if ( a1 > v14 )
{
if ( amd_printf )
a7 = amd_printf(" ...\n");
print_value(a1 - 1, a2, a3, a6, a7, a8);
}
}
else
{
if ( a4 > 4 && a1 > 0 )
{
for ( i = 0LL; i != a1; ++i )
print_value(i, a2, a3, a6, a7, a8);
}
if ( a4 <= 3 )
{
if ( !v16 )
return 0LL;
LABEL_34:
if ( amd_printf )
amd_printf("OK\n\n");
return 0LL;
}
}
result = 0LL;
if ( !amd_printf )
return result;
amd_printf(" dense vector ");
goto LABEL_34;
}
if ( a2 )
{
if ( a1 >= 0 )
{
if ( a4 <= 3 )
goto LABEL_10;
goto LABEL_8;
}
result = -6LL;
if ( amd_printf )
{
amd_printf("ERROR: length of vector is < 0\n\n");
result = -6LL;
}
}
else
{
result = -5LL;
if ( amd_printf )
{
amd_printf("ERROR: vector not present\n\n");
result = -5LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, double a7, double a8)
{
__int64 i; // rbx
__int64 result; // rax
__int64 v14; // r15
__int64 v15; // rbx
bool v16; // [rsp+Fh] [rbp-39h]

v16 = a4 > 3 || a5 != 0;
if ( !v16 )
goto LABEL_10;
if ( amd_printf )
amd_printf("dense vector, n = %ld. ", a1);
if ( !a5 )
{
LABEL_8:
if ( amd_printf )
amd_printf("\n");
LABEL_10:
if ( a4 == 4 )
{
v14 = 10LL;
if ( a1 <= 10 )
v14 = a1;
if ( a1 > 0 )
{
v15 = 0LL;
do
print_value(v15++, a2, a3, a6, a7, a8);
while ( v14 > v15 );
}
if ( a1 > v14 )
{
if ( amd_printf )
a7 = amd_printf(" ...\n");
print_value(a1 - 1, a2, a3, a6, a7, a8);
}
}
else
{
if ( a4 > 4 && a1 > 0 )
{
for ( i = 0LL; i != a1; ++i )
print_value(i, a2, a3, a6, a7, a8);
}
if ( a4 <= 3 )
{
if ( !v16 )
return 0LL;
LABEL_34:
if ( amd_printf )
amd_printf("OK\n\n");
return 0LL;
}
}
result = 0LL;
if ( !amd_printf )
return result;
amd_printf(" dense vector ");
goto LABEL_34;
}
if ( a2 )
{
if ( a1 >= 0 )
{
if ( a4 <= 3 )
goto LABEL_10;
goto LABEL_8;
}
result = -6LL;
if ( amd_printf )
{
amd_printf("ERROR: length of vector is < 0\n\n");
result = -6LL;
}
}
else
{
result = -5LL;
if ( amd_printf )
{
amd_printf("ERROR: vector not present\n\n");
result = -5LL;
}
}
return result;
}

original_code:
long umfzl_report_vector
(
    long n,
    const double Xx [ ],
    const double Xz [ ],
    long prl,
    long user,
    long scalar
)
{
    long n2, i ;
    if (user || prl >= 4)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("dense vector, n = ""%" "ld"". ", n) ; } ;
    }
    if (user)
    {
 if (!Xx)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: vector not present\n\n") ; } ;
     return ((-5)) ;
 }
 if (n < 0)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: length of vector is < 0\n\n") ; } ;
     return ((-6)) ;
 }
    }
    if (user || prl >= 4)
    {
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ; } } ;
    }
    if (prl == 4)
    {
 n2 = (((10) < (n)) ? (10) : (n)) ;
 for (i = 0 ; i < n2 ; i++)
 {
     print_value (i, Xx, Xz, scalar) ;
 }
 if (n2 < n)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("    ...\n") ; } ;
     print_value (n-1, Xx, Xz, scalar) ;
 }
    }
    else if (prl > 4)
    {
 for (i = 0 ; i < n ; i++)
 {
     print_value (i, Xx, Xz, scalar) ;
 }
    }
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("    dense vector ") ; } ; } } ;
    if (user || prl >= 4)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("OK\n\n") ; } ;
    }
    return ((0)) ;
}

canonical_original_code:
long umfzl_report_vector(long n, double Xx[], double Xz[], long prl, long user, long scalar)
{
    long n2; long i;
    if (user || prl >= 4)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("dense vector, n = ""%" "ld"". ", n) ; } ;
    }
    if (user)
    {
 if (!Xx)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: vector not present\n\n") ; } ;
     return ((-5)) ;
 }
 if (n < 0)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("ERROR: length of vector is < 0\n\n") ; } ;
     return ((-6)) ;
 }
    }
    if (user || prl >= 4)
    {
 { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("\n") ; } ; } } ;
    }
    if (prl == 4)
    {
 n2 = (((10) < (n)) ? (10) : (n)) ;
 for (i = 0 ; i < n2 ; i++)
 {
     print_value (i, Xx, Xz, scalar) ;
 }
 if (n2 < n)
 {
     { if (amd_printf != ((void *)0)) (void) amd_printf ("    ...\n") ; } ;
     print_value (n-1, Xx, Xz, scalar) ;
 }
    }
    else if (prl > 4)
    {
 for (i = 0 ; i < n ; i++)
 {
     print_value (i, Xx, Xz, scalar) ;
 }
    }
    { if (prl >= (4)) { { if (amd_printf != ((void *)0)) (void) amd_printf ("    dense vector ") ; } ; } } ;
    if (user || prl >= 4)
    {
 { if (amd_printf != ((void *)0)) (void) amd_printf ("OK\n\n") ; } ;
    }
    return ((0)) ;
}

variable_types: n long

variable_types:
Xx
double []

variable_types:
Xz
double []

variable_types: user long

variable_types: scalar long


original_code:
int cholmod_l_amd
(
    cholmod_sparse *A,
    long *fset,
    size_t fsize,
    long *Perm,
    cholmod_common *Common
)
{
    double Info [20], Control2 [5], *Control ;
    long *Cp, *Len, *Nv, *Head, *Elen, *Degree, *Wi, *Iwork, *Next ;
    cholmod_sparse *C ;
    long j, n, cnz ;
    size_t s ;
    int ok = 1 ;
    { if (Common == ((void *)0)) { return (0) ; } if (Common->itype != 2 || Common->dtype != 0) { Common->status = (-4) ; return (0) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../Cholesky/cholmod_amd.c", 71, "argument missing", Common) ; } return (0) ; } } ;
    n = A->nrow ;
    { if ((Perm) == ((void *)0)) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../Cholesky/cholmod_amd.c", 74, "argument missing", Common) ; } return (0) ; } } ;
    { 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), "../Cholesky/cholmod_amd.c", 75, "invalid xtype", Common) ; } return (0) ; } } ;
    Common->status = 0 ;
    if (n == 0)
    {
 Common->fl = 0 ;
 Common->lnz = 0 ;
 Common->anz = 0 ;
 return (1) ;
    }
    s = cholmod_l_mult_size_t (n, 6, &ok) ;
    if (!ok)
    {
 cholmod_l_error ((-3), "../Cholesky/cholmod_amd.c", 99, "problem too large", Common) ;
 return (0) ;
    }
    s = (((s) > (A->ncol)) ? (s) : (A->ncol)) ;
    cholmod_l_allocate_work (n, s, 0, Common) ;
    if (Common->status < 0)
    {
 return (0) ;
    }
    Iwork = Common->Iwork ;
    Degree = Iwork ;
    Wi = Iwork + n ;
    Len = Iwork + 2*((size_t) n) ;
    Nv = Iwork + 3*((size_t) n) ;
    Next = Iwork + 4*((size_t) n) ;
    Elen = Iwork + 5*((size_t) n) ;
    Head = Common->Head ;
    if (A->stype == 0)
    {
 C = cholmod_l_aat (A, fset, fsize, -2, Common) ;
    }
    else
    {
 C = cholmod_l_copy (A, 0, -2, Common) ;
    }
    if (Common->status < 0)
    {
 return (0) ;
    }
    Cp = C->p ;
    for (j = 0 ; j < n ; j++)
    {
 Len [j] = Cp [j+1] - Cp [j] ;
    }
    cnz = Cp [n] ;
    Common->anz = cnz / 2 + n ;
    if (Common->current < 0 || Common->current >= 9)
    {
 Control = ((void *)0) ;
    }
    else
    {
 Control = Control2 ;
 Control [0] = Common->method [Common->current].prune_dense ;
 Control [1] = Common->method [Common->current].aggressive ;
    }
    amd_malloc = Common->malloc_memory ;
    amd_free = Common->free_memory ;
    amd_calloc = Common->calloc_memory ;
    amd_realloc = Common->realloc_memory ;
    amd_printf = Common->print_function ;
    amd_l2 (n, C->p, C->i, Len, C->nzmax, cnz, Nv, Next, Perm, Head, Elen,
     Degree, Wi, Control, Info) ;
    Common->fl = Info [10] + 2 * Info [11] + n ;
    Common->lnz = n + Info [9] ;
    ;
    cholmod_l_free_sparse (&C, Common) ;
    for (j = 0 ; j <= n ; j++)
    {
 Head [j] = (-1) ;
    }
    return (1) ;
}

canonical_original_code:
int cholmod_l_amd(struct cholmod_sparse_struct *A, long *fset, unsigned long fsize, long *Perm, struct cholmod_common_struct *Common)
{
    double Info[20]; double Control2[5]; double *Control;
    long *Cp; long *Len; long *Nv; long *Head; long *Elen; long *Degree; long *Wi; long *Iwork; long *Next;
    struct cholmod_sparse_struct *C;
    long j; long n; long cnz;
    unsigned long s;
    int ok = 1;
    { if (Common == ((void *)0)) { return (0) ; } if (Common->itype != 2 || Common->dtype != 0) { Common->status = (-4) ; return (0) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../Cholesky/cholmod_amd.c", 71, "argument missing", Common) ; } return (0) ; } } ;
    n = A->nrow ;
    { if ((Perm) == ((void *)0)) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../Cholesky/cholmod_amd.c", 74, "argument missing", Common) ; } return (0) ; } } ;
    { 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), "../Cholesky/cholmod_amd.c", 75, "invalid xtype", Common) ; } return (0) ; } } ;
    Common->status = 0 ;
    if (n == 0)
    {
 Common->fl = 0 ;
 Common->lnz = 0 ;
 Common->anz = 0 ;
 return (1) ;
    }
    s = cholmod_l_mult_size_t (n, 6, &ok) ;
    if (!ok)
    {
 cholmod_l_error ((-3), "../Cholesky/cholmod_amd.c", 99, "problem too large", Common) ;
 return (0) ;
    }
    s = (((s) > (A->ncol)) ? (s) : (A->ncol)) ;
    cholmod_l_allocate_work (n, s, 0, Common) ;
    if (Common->status < 0)
    {
 return (0) ;
    }
    Iwork = Common->Iwork ;
    Degree = Iwork ;
    Wi = Iwork + n ;
    Len = Iwork + 2*((unsigned long) n) ;
    Nv = Iwork + 3*((unsigned long) n) ;
    Next = Iwork + 4*((unsigned long) n) ;
    Elen = Iwork + 5*((unsigned long) n) ;
    Head = Common->Head ;
    if (A->stype == 0)
    {
 C = cholmod_l_aat (A, fset, fsize, -2, Common) ;
    }
    else
    {
 C = cholmod_l_copy (A, 0, -2, Common) ;
    }
    if (Common->status < 0)
    {
 return (0) ;
    }
    Cp = C->p ;
    for (j = 0 ; j < n ; j++)
    {
 Len [j] = Cp [j+1] - Cp [j] ;
    }
    cnz = Cp [n] ;
    Common->anz = cnz / 2 + n ;
    if (Common->current < 0 || Common->current >= 9)
    {
 Control = ((void *)0) ;
    }
    else
    {
 Control = Control2 ;
 Control [0] = Common->method [Common->current].prune_dense ;
 Control [1] = Common->method [Common->current].aggressive ;
    }
    amd_malloc = Common->malloc_memory ;
    amd_free = Common->free_memory ;
    amd_calloc = Common->calloc_memory ;
    amd_realloc = Common->realloc_memory ;
    amd_printf = Common->print_function ;
    amd_l2 (n, C->p, C->i, Len, C->nzmax, cnz, Nv, Next, Perm, Head, Elen,
     Degree, Wi, Control, Info) ;
    Common->fl = Info [10] + 2 * Info [11] + n ;
    Common->lnz = n + Info [9] ;
    ;
    cholmod_l_free_sparse (&C, Common) ;
    for (j = 0 ; j <= n ; j++)
    {
 Head [j] = (-1) ;
    }
    return (1) ;
}

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

variable_types:
fsize
unsigned long

variable_types:
Perm
long *

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

variable_types:
Info
double [20]

variable_types:
Control
double *

variable_types:
Cp
long *

variable_types:
Len
long *

variable_types:
Nv
long *

variable_types:
Head
long *

variable_types:
Elen
long *

variable_types:
Degree
long *

variable_types:
Wi
long *

variable_types:
Iwork
long *

variable_types:
Next
long *

variable_types: cnz long

variable_types:
s
unsigned long

variable_types: ok int


original_code:
int cholmod_l_drop
(
    double tol,
    cholmod_sparse *A,
    cholmod_common *Common
)
{
    double aij ;
    double *Ax ;
    long *Ap, *Ai, *Anz ;
    long packed, i, j, nrow, ncol, p, pend, nz, values ;
    { if (Common == ((void *)0)) { return (0) ; } if (Common->itype != 2 || Common->dtype != 0) { Common->status = (-4) ; return (0) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../MatrixOps/cholmod_drop.c", 52, "argument missing", Common) ; } return (0) ; } } ;
    { if ((A)->xtype < (0) || (A)->xtype > (1) || ((A)->xtype != 0 && ((A)->x) == ((void *)0)) || ((A)->xtype == 3 && ((A)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../MatrixOps/cholmod_drop.c", 53, "invalid xtype", Common) ; } return (0) ; } } ;
    Common->status = 0 ;
    ;
    Ap = A->p ;
    Ai = A->i ;
    Ax = A->x ;
    Anz = A->nz ;
    packed = A->packed ;
    ncol = A->ncol ;
    nrow = A->nrow ;
    values = (A->xtype != 0) ;
    nz = 0 ;
    if (values)
    {
 if (A->stype > 0)
 {
     for (j = 0 ; j < ncol ; j++)
     {
  p = Ap [j] ;
  pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
  Ap [j] = nz ;
  for ( ; p < pend ; p++)
  {
      i = Ai [p] ;
      aij = Ax [p] ;
      if (i <= j && (fabs (aij) > tol || ((aij) != (aij))))
      {
   Ai [nz] = i ;
   Ax [nz] = aij ;
   nz++ ;
      }
  }
     }
 }
 else if (A->stype < 0)
 {
     for (j = 0 ; j < ncol ; j++)
     {
  p = Ap [j] ;
  pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
  Ap [j] = nz ;
  for ( ; p < pend ; p++)
  {
      i = Ai [p] ;
      aij = Ax [p] ;
      if (i >= j && (fabs (aij) > tol || ((aij) != (aij))))
      {
   Ai [nz] = i ;
   Ax [nz] = aij ;
   nz++ ;
      }
  }
     }
 }
 else
 {
     for (j = 0 ; j < ncol ; j++)
     {
  p = Ap [j] ;
  pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
  Ap [j] = nz ;
  for ( ; p < pend ; p++)
  {
      i = Ai [p] ;
      aij = Ax [p] ;
      if (fabs (aij) > tol || ((aij) != (aij)))
      {
   Ai [nz] = i ;
   Ax [nz] = aij ;
   nz++ ;
      }
  }
     }
 }
 Ap [ncol] = nz ;
 ;
 cholmod_l_reallocate_sparse (nz, A, Common) ;
 ;
    }
    else
    {
 if (A->stype > 0)
 {
     cholmod_l_band_inplace (0, ncol, 0, A, Common) ;
 }
 else if (A->stype < 0)
 {
     cholmod_l_band_inplace (-nrow, 0, 0, A, Common) ;
 }
    }
    ;
    return (1) ;
}

canonical_original_code:
int cholmod_l_drop(double tol, struct cholmod_sparse_struct *A, struct cholmod_common_struct *Common)
{
    double aij;
    double *Ax;
    long *Ap; long *Ai; long *Anz;
    long packed; long i; long j; long nrow; long ncol; long p; long pend; long nz; long values;
    { if (Common == ((void *)0)) { return (0) ; } if (Common->itype != 2 || Common->dtype != 0) { Common->status = (-4) ; return (0) ; } } ;
    { if ((A) == ((void *)0)) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../MatrixOps/cholmod_drop.c", 52, "argument missing", Common) ; } return (0) ; } } ;
    { if ((A)->xtype < (0) || (A)->xtype > (1) || ((A)->xtype != 0 && ((A)->x) == ((void *)0)) || ((A)->xtype == 3 && ((A)->z) == ((void *)0))) { if (Common->status != (-2)) { cholmod_l_error ((-4), "../MatrixOps/cholmod_drop.c", 53, "invalid xtype", Common) ; } return (0) ; } } ;
    Common->status = 0 ;
    ;
    Ap = A->p ;
    Ai = A->i ;
    Ax = A->x ;
    Anz = A->nz ;
    packed = A->packed ;
    ncol = A->ncol ;
    nrow = A->nrow ;
    values = (A->xtype != 0) ;
    nz = 0 ;
    if (values)
    {
 if (A->stype > 0)
 {
     for (j = 0 ; j < ncol ; j++)
     {
  p = Ap [j] ;
  pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
  Ap [j] = nz ;
  for ( ; p < pend ; p++)
  {
      i = Ai [p] ;
      aij = Ax [p] ;
      if (i <= j && (fabs (aij) > tol || ((aij) != (aij))))
      {
   Ai [nz] = i ;
   Ax [nz] = aij ;
   nz++ ;
      }
  }
     }
 }
 else if (A->stype < 0)
 {
     for (j = 0 ; j < ncol ; j++)
     {
  p = Ap [j] ;
  pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
  Ap [j] = nz ;
  for ( ; p < pend ; p++)
  {
      i = Ai [p] ;
      aij = Ax [p] ;
      if (i >= j && (fabs (aij) > tol || ((aij) != (aij))))
      {
   Ai [nz] = i ;
   Ax [nz] = aij ;
   nz++ ;
      }
  }
     }
 }
 else
 {
     for (j = 0 ; j < ncol ; j++)
     {
  p = Ap [j] ;
  pend = (packed) ? (Ap [j+1]) : (p + Anz [j]) ;
  Ap [j] = nz ;
  for ( ; p < pend ; p++)
  {
      i = Ai [p] ;
      aij = Ax [p] ;
      if (fabs (aij) > tol || ((aij) != (aij)))
      {
   Ai [nz] = i ;
   Ax [nz] = aij ;
   nz++ ;
      }
  }
     }
 }
 Ap [ncol] = nz ;
 ;
 cholmod_l_reallocate_sparse (nz, A, Common) ;
 ;
    }
    else
    {
 if (A->stype > 0)
 {
     cholmod_l_band_inplace (0, ncol, 0, A, Common) ;
 }
 else if (A->stype < 0)
 {
     cholmod_l_band_inplace (-nrow, 0, 0, A, Common) ;
 }
    }
    ;
    return (1) ;
}

variable_types: tol double

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

variable_types:
Ax
double *

variable_types:
Ap
long *

variable_types:
Ai
long *

variable_types:
Anz
long *

variable_types: packed long

variable_types: i long

variable_types: j long

variable_types: nrow long

variable_types: ncol long

variable_types: p long

variable_types: pend long

variable_types: nz long

variable_types: values long

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