struct defs

typedefs

global vars

int main(int argc, char *argv[]);
double *init(int argc, char **argv);
SparseMatrix_t_st15 *buildMatrix();
void test2();
void test1();
long getRandomIntInRange(long upper);
double getRandomFloatInRange(long lower, long upper);
double cputime();
void error(char *msg);
SparseMatrix_t_st67 *sparseCreate();
SparseMatrix_t_st67 *sparseDup(SparseMatrix_t_st67 *sm);
void sparseFree(SparseMatrix_t_st67 *sm);
long sparseNumElements(SparseMatrix_t_st67 *sm);
Index_t_st66 sparseNumRows(SparseMatrix_t_st67 *sm);
Index_t_st66 sparseMaxRow(SparseMatrix_t_st67 *sm);
Index_t_st66 sparseNumCols(SparseMatrix_t_st67 *sm);
Index_t_st66 sparseMaxCol(SparseMatrix_t_st67 *sm);
boolean_st43 sparseGet(SparseMatrix_t_st67 *sm, Index_t_st66 row, 
                       Index_t_st66 col, double *valuep);
boolean_st43 sparsePut(SparseMatrix_t_st67 *sm, Index_t_st66 row, 
                       Index_t_st66 col, double value);
boolean_st43 sparseScale(SparseMatrix_t_st67 *sm);
boolean_st43 doScaling(SparseMatrix_t_st67 *sm, boolean_st43 rescale);
boolean_st43 sparseFactor(SparseMatrix_t_st67 *sm);
boolean_st43 sparseSolve(SparseMatrix_t_st67 *sm, double x[]);
void sparsePrint(SparseMatrix_t_st67 *sm);
RowHeader_t_st68 *getLastRowHPtr(SparseMatrix_t_st67 *sm);
ColHeader_t_st69 *getLastColHPtr(SparseMatrix_t_st67 *sm);
RowHeader_t_st68 *getThisRowHeader(SparseMatrix_t_st67 *sm, Index_t_st66 row);
ColHeader_t_st69 *getThisColHeader(SparseMatrix_t_st67 *sm, Index_t_st66 col);
void computeMarkowitzProducts(SparseMatrix_t_st67 *sm, RowHeader_t_st68 *pivotRH, 
                              ColHeader_t_st69 *pivotCH);
ElementNode_t_st70 *findBestPivotElement(SparseMatrix_t_st67 *sm, 
                                         RowHeader_t_st68 *pivotRH, 
                                         ColHeader_t_st69 *pivotCH);
void unlinkFromRow(RowHeader_t_st68 *rh, ElementNode_t_st70 *e);
void unlinkFromColumn(ColHeader_t_st69 *ch, ElementNode_t_st70 *e);
void insertIntoColumn(ColHeader_t_st69 *ch, ElementNode_t_st70 *newE);
void linkIntoColumnBetween(ColHeader_t_st69 *ch, ElementNode_t_st70 *prevE, 
                           ElementNode_t_st70 *curE, ElementNode_t_st70 *newE);
void insertIntoRow(RowHeader_t_st68 *rh, ElementNode_t_st70 *newE);
void linkIntoRowBetween(RowHeader_t_st68 *rh, ElementNode_t_st70 *prevE, 
                        ElementNode_t_st70 *curE, ElementNode_t_st70 *newE);
ElementNode_t_st70 *swapRowsAndCols(SparseMatrix_t_st67 *sm, RowHeader_t_st68 *pivotRH, 
                                    ColHeader_t_st69 *pivotCH, ElementNode_t_st70 *realPivotE);
void scaleRowsDueToPivot(ElementNode_t_st70 *pivotE);
boolean_st43 addFillIns(SparseMatrix_t_st67 *sm, ElementNode_t_st70 *pivotE);
void eliminateColUpdateRows(ElementNode_t_st70 *pivotE);
double findMaxInRow(RowHeader_t_st68 *rh);
double findMaxInCol(ColHeader_t_st69 *ch);
void scaleRowByDivisor(RowHeader_t_st68 *rh, double scaleF);
void scaleColByDivisor(ColHeader_t_st69 *ch, double scaleF);
ElementNode_t_st70 *newElement(Index_t_st66 row, Index_t_st66 col, 
                               double value);

int main(
int argc, 
char *argv[])
{
  local vars

  temp_141 = "starting...\n\n";
  printf(temp_141);
  x2 = init1(argc1, argv1);
  temp_151 = "building matrix...\n";
  printf(temp_151);
  sm2 = buildMatrix2();
  temp_161 = "Initial matrix has %ld elements (including RHS b).\n";
  temp_172 = sparseNumElements3(sm2);
  printf(temp_161, temp_172);
  temp_181 = "solving...\n";
  printf(temp_181);
  temp_191 = (&_iob[1]);
  fflush(temp_191);
  temp_202 = sparseScale4(sm2);
  temp_211 = (char ) temp_202;
  if ((temp_211 == 0))
  {
    /** error("scale failed in Main") **/
    temp_221 = "scale failed in Main";
    temp_231 = (char *) temp_221;
    error5(temp_231);
  }
  temp_242 = sparseFactor6(sm2);
  temp_251 = (char ) temp_242;
  if ((temp_251 == 0))
  {
    /** error("factor failed in Main") **/
    temp_261 = "factor failed in Main";
    temp_271 = (char *) temp_261;
    error7(temp_271);
  }
  temp_282 = sparseSolve8(sm2, x2);
  temp_291 = (char ) temp_282;
  if ((temp_291 == 0))
  {
    /** error("solve failed in Main") **/
    temp_301 = "solve failed in Main";
    temp_311 = (char *) temp_301;
    error9(temp_311);
  }
  temp_321 = "Solved matrix has %ld elements.\n";
  temp_332 = sparseNumElements10(sm2);
  printf(temp_321, temp_332);
  temp_341 = "\nSolution vector x:\n";
  printf(temp_341);
  for ( i1 = 0 ; (i2 <= g_maxCol_st401) ; i3 = (i2 + 1) )
  {
    /** printf("  x[%d] = %f\n", i, x[i]) **/
    temp_352 = "  x[%d] = %f\n";
    temp_362 = x2[i2];
    printf(temp_352, i2, temp_362);
  }
  free11(x2);
  sparseFree12(sm2);
  temp_371 = "\ndone.\n";
  printf(temp_371);
  return (0);
}

double *init(
int argc, 
char **argv)
{
  local vars

  g_maxRow_st392 = 500;
  g_maxCol_st402 = 500;
  g_numElems_st412 = 9000;
  g_maxVal_st422 = 1000;
  srandom(1);
  if ((argc1 == 1))
  {
    temp_381 = "Assuming default matrix size and number of elements...\n";
    printf(temp_381);
    temp_391 = "( options are: -r maxrow -c maxcol -n numelems -v maxval )\n";
    printf(temp_391);
  }
  else
  {
    argc1 = (argc1 - 1);
    while ( (argc2 > 0) )
    {
      temp_412 = (argc2 - 1);
      temp_402 = argv1[temp_412][1];
      switch (temp_402)
      {
        case 114 : 
          {
            temp_422 = argv1[argc2];
            temp_432 = "%ld";
            temp_442 = (&g_maxRow_st39);
            sscanf(temp_422, temp_432, temp_442);
            argc3 = (argc2 - 1);
            break; 
          }
        case 99 : 
          {
            temp_452 = argv1[argc2];
            temp_462 = "%ld";
            temp_472 = (&g_maxCol_st40);
            sscanf(temp_452, temp_462, temp_472);
            argc4 = (argc2 - 1);
            break; 
          }
        case 110 : 
          {
            temp_482 = argv1[argc2];
            temp_492 = "%ld";
            temp_502 = (&g_numElems_st41);
            sscanf(temp_482, temp_492, temp_502);
            argc5 = (argc2 - 1);
            break; 
          }
        case 118 : 
          {
            temp_512 = argv1[argc2];
            temp_522 = "%ld";
            temp_532 = (&g_maxVal_st42);
            sscanf(temp_512, temp_522, temp_532);
            argc6 = (argc2 - 1);
            break; 
          }
        default : 
          {
            temp_542 = "unknown option.\n";
            printf(temp_542);
            break; 
          }
      }
      argc8 = (argc7 - 1);
    }
  }
  temp_551 = "params: %ld rows, %ld cols, %ld elements, range %ld..%ld.\n\n";
  temp_561 = (g_maxRow_st397 + 1);
  temp_571 = (g_maxCol_st407 + 1);
  temp_581 = (-g_maxVal_st427);
  printf(temp_551, temp_561, temp_571, g_numElems_st417, temp_581, g_maxVal_st427);
  if ((g_maxRow_st397 != g_maxCol_st407))
  {
    /** error("init: max row != max col (error, matrix must be square)") **/
    temp_591 = "init: max row != max col (error, matrix must be square)";
    temp_601 = (char *) temp_591;
    error1(temp_601);
  }
  temp_621 = (2 * g_maxRow_st397);
  temp_611 = (temp_621 + g_maxCol_st407);
  if ((g_numElems_st417 < temp_611))
  {
    temp_631 = buf;
    temp_641 = "init: matrix must contain at least %ld elements";
    temp_661 = (2 * g_maxRow_st397);
    temp_651 = (temp_661 + g_maxCol_st407);
    sprintf2(temp_631, temp_641, temp_651);
    temp_671 = buf;
    error3(temp_671);
  }
  temp_691 = (g_maxCol_st407 + 1);
  temp_701 = (unsigned long ) temp_691;
  temp_681 = (8 * temp_701);
  temp_712 = malloc(temp_681);
  x1 = (double *) temp_712;
  if ((x1 == 0))
  {
    /** error("init: out of memory") **/
    temp_721 = "init: out of memory";
    temp_731 = (char *) temp_721;
    error4(temp_731);
  }
  return (x1);
}

SparseMatrix_t_st15 *buildMatrix()
{
  local vars

  sm2 = sparseCreate1();
  for ( i1 = 0 ; (i2 <= g_maxRow_st398) ; i3 = (i2 + 1) )
  {
    do 
    {
      col4 = getRandomIntInRange2(g_maxCol_st408);
      temp_743 = (short ) i2;
      temp_753 = (short ) col4;
      temp_763 = (&junk);
      temp_774 = sparseGet3(sm2, temp_743, temp_753, temp_763);
      temp_783 = (char ) temp_774;
    }
    while ( (temp_783 == 1) );
    temp_792 = (-g_maxVal_st428);
    val3 = getRandomFloatInRange4(temp_792, g_maxVal_st428);
    temp_802 = (short ) i2;
    temp_812 = (short ) col4;
    temp_823 = sparsePut5(sm2, temp_802, temp_812, val3);
    temp_832 = (char ) temp_823;
    if ((temp_832 == 0))
    {
      /** error("buildMatrix: sparsePut failed, out of memory") **/
      temp_842 = "buildMatrix: sparsePut failed, out of memory";
      temp_852 = (char *) temp_842;
      error6(temp_852);
    }
    do 
    {
      col7 = getRandomIntInRange7(g_maxCol_st408);
      temp_863 = (short ) i2;
      temp_873 = (short ) col7;
      temp_883 = (&junk);
      temp_894 = sparseGet8(sm2, temp_863, temp_873, temp_883);
      temp_903 = (char ) temp_894;
    }
    while ( (temp_903 == 1) );
    temp_912 = (-g_maxVal_st428);
    val5 = getRandomFloatInRange9(temp_912, g_maxVal_st428);
    temp_922 = (short ) i2;
    temp_932 = (short ) col7;
    temp_943 = sparsePut10(sm2, temp_922, temp_932, val5);
    temp_952 = (char ) temp_943;
    if ((temp_952 == 0))
    {
      /** error("buildMatrix: sparsePut failed, out of memory") **/
      temp_962 = "buildMatrix: sparsePut failed, out of memory";
      temp_972 = (char *) temp_962;
      error11(temp_972);
    }
  }
  for ( i5 = 0 ; (i6 <= g_maxCol_st408) ; i7 = (i6 + 1) )
  {
    do 
    {
      row4 = getRandomIntInRange12(g_maxCol_st408);
      temp_983 = (short ) row4;
      temp_993 = (short ) i6;
      temp_1003 = (&junk);
      temp_1014 = sparseGet13(sm2, temp_983, temp_993, temp_1003);
      temp_1023 = (char ) temp_1014;
    }
    while ( (temp_1023 == 1) );
    temp_1032 = (-g_maxVal_st428);
    val9 = getRandomFloatInRange14(temp_1032, g_maxVal_st428);
    temp_1042 = (short ) row4;
    temp_1052 = (short ) i6;
    temp_1063 = sparsePut15(sm2, temp_1042, temp_1052, val9);
    temp_1072 = (char ) temp_1063;
    if ((temp_1072 == 0))
    {
      /** error("buildMatrix: sparsePut failed, out of memory") **/
      temp_1082 = "buildMatrix: sparsePut failed, out of memory";
      temp_1092 = (char *) temp_1082;
      error16(temp_1092);
    }
  }
  temp_1111 = (g_numElems_st418 - 3);
  temp_1131 = (2 * g_maxRow_st398);
  temp_1121 = (temp_1131 + g_maxCol_st408);
  temp_1101 = (temp_1111 - temp_1121);
  for ( i9 = 0 ; (i10 < temp_1102) ; i11 = (i10 + 1) )
  {
    do 
    {
      row9 = getRandomIntInRange17(g_maxRow_st398);
      col12 = getRandomIntInRange18(g_maxCol_st408);
      temp_1143 = (short ) row9;
      temp_1153 = (short ) col12;
      temp_1163 = (&junk);
      temp_1174 = sparseGet19(sm2, temp_1143, temp_1153, temp_1163);
      temp_1183 = (char ) temp_1174;
    }
    while ( (temp_1183 == 1) );
    temp_1192 = (-g_maxVal_st428);
    val13 = getRandomFloatInRange20(temp_1192, g_maxVal_st428);
    temp_1202 = (short ) row9;
    temp_1212 = (short ) col12;
    temp_1223 = sparsePut21(sm2, temp_1202, temp_1212, val13);
    temp_1232 = (char ) temp_1223;
    if ((temp_1232 == 0))
    {
      /** error("buildMatrix: sparsePut failed, out of memory") **/
      temp_1242 = "buildMatrix: sparsePut failed, out of memory";
      temp_1252 = (char *) temp_1242;
      error22(temp_1252);
    }
    temp_1113 = (g_numElems_st418 - 3);
    temp_1133 = (2 * g_maxRow_st398);
    temp_1123 = (temp_1133 + g_maxCol_st408);
    temp_1103 = (temp_1113 - temp_1123);
  }
  for ( i13 = 0 ; (i14 <= g_maxRow_st398) ; i15 = (i14 + 1) )
  {
    temp_1262 = (-g_maxVal_st428);
    val17 = getRandomFloatInRange23(temp_1262, g_maxVal_st428);
    temp_1272 = (short ) i14;
    temp_1292 = (short ) g_maxCol_st408;
    temp_1282 = (temp_1292 + 1);
    temp_1303 = sparsePut24(sm2, temp_1272, temp_1282, val17);
    temp_1312 = (char ) temp_1303;
    if ((temp_1312 == 0))
    {
      /** error("buildMatrix: sparsePut failed, out of memory") **/
      temp_1322 = "buildMatrix: sparsePut failed, out of memory";
      temp_1332 = (char *) temp_1322;
      error25(temp_1332);
    }
  }
  return (sm2);
}

void test2()
{
  local vars

  sm = sparseCreate1();
  sparsePut2(sm, 0, 0, 2.00000000000000e+03);
  sparsePut3(sm, 0, 1, 4.00000000000000e+00);
  sparsePut4(sm, 0, 3, -3.00000000000000e+00);
  sparsePut5(sm, 0, 4, 1.00000000000000e+00);
  sparsePut6(sm, 0, 5, 4.80000000000000e+04);
  sparsePut7(sm, 1, 3, 2.00000000000000e+00);
  sparsePut8(sm, 1, 4, 5.00000000000000e+00);
  sparsePut9(sm, 1, 5, -2.00000000000000e+01);
  sparsePut10(sm, 2, 2, 1.00000000000000e+01);
  sparsePut11(sm, 2, 5, 1.00000000000000e+02);
  sparsePut12(sm, 3, 1, 2.00000000000000e+00);
  sparsePut13(sm, 3, 2, 1.00000000000000e+00);
  sparsePut14(sm, 3, 4, -4.00000000000000e+00);
  sparsePut15(sm, 3, 5, 2.40000000000000e+01);
  sparsePut16(sm, 4, 0, 1.00000000000000e+00);
  sparsePut17(sm, 4, 2, 3.00000000000000e+00);
  sparsePut18(sm, 4, 5, 1.50000000000000e+01);
  sparsePut19(sm, 0, 0, 2.00000000000000e+00);
  sparsePut20(sm, 0, 5, 4.80000000000000e+01);
  sparsePrint21(sm);
  temp_134 = "\n";
  printf(temp_134);
  temp_135 = sparseScale22(sm);
  temp_136 = (char ) temp_135;
  if ((temp_136 == 0))
  {
    /** printf("*!*! sparse scale failed...\n") **/
    temp_137 = "*!*! sparse scale failed...\n";
    printf(temp_137);
  }
  else
  {
    temp_138 = sparseFactor23(sm);
    temp_139 = (char ) temp_138;
    if ((temp_139 == 0))
    {
      /** printf("*!*! sparse factor failed...\n") **/
      temp_140 = "*!*! sparse factor failed...\n";
      printf(temp_140);
    }
    else
    {
      temp_141 = x;
      temp_142 = sparseSolve24(sm, temp_141);
      temp_143 = (char ) temp_142;
      if ((temp_143 == 0))
      {
        /** printf("*!*! attempt to solve matrix failed...\n") **/
        temp_144 = "*!*! attempt to solve matrix failed...\n";
        printf(temp_144);
      }
      else
      {
        temp_145 = "solution vector x:\n";
        printf(temp_145);
        i = 0;
        temp_146 = sparseMaxCol25(sm);
        temp_147 = (int ) temp_146;
        for ( temp_148 = (long ) temp_147 ; (i < temp_148) ; temp_148 = (long ) temp_147 )
        {
          temp_149 = "  x[%ld] = %e.\n";
          temp_150 = x[i];
          printf(temp_149, i, temp_150);
          i = (i + 1);
          temp_146 = sparseMaxCol26(sm);
          temp_147 = (int ) temp_146;
        }
      }
    }
  }
  sparseFree27(sm);
}

void test1()
{
  local vars

  sm = sparseCreate1();
  sparsePut2(sm, 3, 3, 1.00000000000000e+01);
  sparsePut3(sm, 3, 4, 1.00000000000000e+02);
  sparsePut4(sm, 2, 2, 9.00000000000000e+00);
  sparsePut5(sm, 2, 3, 2.70000000000000e+01);
  sparsePut6(sm, 2, 4, 2.79000000000000e+02);
  sparsePut7(sm, 1, 1, 2.00000000000000e+00);
  sparsePut8(sm, 1, 4, 1.00000000000000e+01);
  sparsePut9(sm, 0, 0, 3.00000000000000e+00);
  sparsePut10(sm, 0, 1, 9.00000000000000e+00);
  sparsePut11(sm, 0, 2, -3.00000000000000e+00);
  sparsePut12(sm, 0, 3, 9.00000000000000e+00);
  sparsePut13(sm, 0, 4, 1.29000000000000e+02);
  temp_151 = x;
  temp_152 = sparseSolve14(sm, temp_151);
  temp_153 = (char ) temp_152;
  if ((temp_153 == 0))
  {
    /** printf("*!*! attempt to solve matrix failed...\n") **/
    temp_154 = "*!*! attempt to solve matrix failed...\n";
    printf(temp_154);
  }
  else
  {
    temp_155 = "solution vector x:\n";
    printf(temp_155);
    i = 0;
    temp_156 = sparseMaxCol15(sm);
    temp_157 = (int ) temp_156;
    for ( temp_158 = (long ) temp_157 ; (i < temp_158) ; temp_158 = (long ) temp_157 )
    {
      temp_159 = "  x[%ld] = %e.\n";
      temp_160 = x[i];
      printf(temp_159, i, temp_160);
      i = (i + 1);
      temp_156 = sparseMaxCol16(sm);
      temp_157 = (int ) temp_156;
    }
  }
  sparseFree17(sm);
  temp_161 = "\n";
  printf(temp_161);
  sm = sparseCreate18();
  sparsePut19(sm, 0, 3, 1.00000000000000e+01);
  sparsePut20(sm, 0, 4, 1.00000000000000e+02);
  sparsePut21(sm, 1, 2, 9.00000000000000e+00);
  sparsePut22(sm, 1, 3, 2.70000000000000e+01);
  sparsePut23(sm, 1, 4, 2.79000000000000e+02);
  sparsePut24(sm, 2, 1, 2.00000000000000e+00);
  sparsePut25(sm, 2, 4, 1.00000000000000e+01);
  sparsePut26(sm, 3, 0, 3.00000000000000e+00);
  sparsePut27(sm, 3, 1, 9.00000000000000e+00);
  sparsePut28(sm, 3, 2, -3.00000000000000e+00);
  sparsePut29(sm, 3, 3, 9.00000000000000e+00);
  sparsePut30(sm, 3, 4, 1.29000000000000e+02);
  sparseScale31(sm);
  sparseFactor32(sm);
  sparsePrint33(sm);
  temp_162 = x;
  temp_163 = sparseSolve34(sm, temp_162);
  temp_164 = (char ) temp_163;
  if ((temp_164 == 0))
  {
    /** printf("*!*! attempt to solve matrix failed...\n") **/
    temp_165 = "*!*! attempt to solve matrix failed...\n";
    printf(temp_165);
  }
  else
  {
    temp_166 = "solution vector x:\n";
    printf(temp_166);
    i = 0;
    temp_167 = sparseMaxCol35(sm);
    temp_168 = (int ) temp_167;
    for ( temp_169 = (long ) temp_168 ; (i < temp_169) ; temp_169 = (long ) temp_168 )
    {
      temp_170 = "  x[%ld] = %e.\n";
      temp_171 = x[i];
      printf(temp_170, i, temp_171);
      i = (i + 1);
      temp_167 = sparseMaxCol36(sm);
      temp_168 = (int ) temp_167;
    }
  }
  temp_172 = "\n";
  printf(temp_172);
}

long getRandomIntInRange(
long upper)
{
  local vars

  lower1 = 0;
  temp_1732 = random();
  num1 = (long ) temp_1732;
  temp_1761 = (double ) num1;
  temp_1751 = (temp_1761 / 2.14748364700000e+09);
  temp_1771 = (upper1 - lower1);
  temp_1781 = (temp_1771 + 1);
  temp_1791 = (double ) temp_1781;
  temp_1741 = (temp_1751 * temp_1791);
  temp_1801 = (double ) lower1;
  temp_1811 = (temp_1741 + temp_1801);
  num2 = (long ) temp_1811;
  return (num2);
}

double getRandomFloatInRange(
long lower, 
long upper)
{
  local vars

  do 
  {
    num3 = getRandomIntInRange1(upper1);
  }
  while ( (num3 == 0) );
  fraction2 = getRandomIntInRange2(999);
  temp_1821 = (double ) num3;
  temp_1841 = (double ) fraction2;
  temp_1831 = (temp_1841 / 1.00000000000000e+03);
  d1 = (temp_1821 + temp_1831);
  if ((lower1 < 0))
  {
    temp_1852 = random();
    bit1 = (temp_1852 & 1);
    if ((bit1 == 1))
    {
      d2 = (-d1);
    }
  }
  return (d4);
}

double cputime()
{
  local vars

  temp_186 = (&usage);
  getrusage(0, temp_186);
  temp_187 = usage.ru_utime.tv_sec;
  temp_188 = (double ) temp_187;
  temp_190 = usage.ru_utime.tv_usec;
  temp_191 = (double ) temp_190;
  temp_189 = (temp_191 / 1.00000000000000e+06);
  time = (temp_188 + temp_189);
  return (time);
}

void error(
char *msg)
{
  local vars

  temp_1921 = (&_iob[2]);
  temp_1931 = "**ERROR: %s.\n";
  fprintf1(temp_1921, temp_1931, msg1);
  if ((errno1 != 0))
  {
    /** perror("Sys Error Msg:") **/
    temp_1941 = "Sys Error Msg:";
    perror(temp_1941);
  }
  exit(0);
}
extern double anint();
extern double exp2();
extern double log2();

SparseMatrix_t_st67 *sparseCreate()
{
  local vars

  temp_1952 = malloc(8);
  sm1 = (struct SparseMatrix *) temp_1952;
  if ((sm1 != 0))
  {
    (*sm1).rows = 0;
    (*sm1).cols = 0;
  }
  return (sm1);
}

SparseMatrix_t_st67 *sparseDup(
SparseMatrix_t_st67 *sm)
{
  local vars

  dup = sparseCreate1();
  if ((dup == 0))
  {
    temp_196 = "sparseDup: sparse create failed";
    temp_197 = (char *) temp_196;
    error2(temp_197);
    return (0);
  }
  rh = (*sm).rows;
  while ( (rh != 0) )
  {
    e = (*rh).relems;
    while ( (e != 0) )
    {
      temp_198 = (*e).row;
      temp_199 = (*e).col;
      temp_200 = (*e).value;
      temp_201 = sparsePut3(dup, temp_198, temp_199, temp_200);
      temp_202 = (char ) temp_201;
      if ((temp_202 == 0))
      {
        temp_203 = "sparseDup: sparse put failed";
        temp_204 = (char *) temp_203;
        error4(temp_204);
        sparseFree5(dup);
        return (0);
      }
      e = (*e).ncolE;
    }
    rh = (*rh).nrowH;
  }
  return (dup);
}

void sparseFree(
SparseMatrix_t_st67 *sm)
{
  local vars

  if ((sm1 == 0))
  {
    return;
  }
  ch1 = (*sm1).cols;
  while ( (ch2 != 0) )
  {
    tcH2 = ch2;
    ch3 = (*ch2).ncolH;
    free1(tcH2);
  }
  rh1 = (*sm1).rows;
  free2(sm1);
  while ( (rh2 != 0) )
  {
    trH2 = rh2;
    e2 = (*rh2).relems;
    rh3 = (*rh2).nrowH;
    free3(trH2);
    while ( (e3 != 0) )
    {
      tE3 = e3;
      e4 = (*e3).ncolE;
      free4(tE3);
    }
  }
}

long sparseNumElements(
SparseMatrix_t_st67 *sm)
{
  local vars

  rh1 = (*sm1).rows;
  count1 = 0;
  while ( (rh2 != 0) )
  {
    e2 = (*rh2).relems;
    while ( (e3 != 0) )
    {
      count4 = (count3 + 1);
      e4 = (*e3).ncolE;
    }
    rh3 = (*rh2).nrowH;
  }
  return (count6);
}

Index_t_st66 sparseNumRows(
SparseMatrix_t_st67 *sm)
{
  local vars

  rh1 = (*sm1).rows;
  count1 = 0;
  while ( (rh2 != 0) )
  {
    count3 = (count2 + 1);
    rh3 = (*rh2).nrowH;
  }
  return (count4);
}

Index_t_st66 sparseMaxRow(
SparseMatrix_t_st67 *sm)
{
  local vars

  rh = getLastRowHPtr1(sm);
  if ((rh == 0))
  {
    return (0);
  }
  temp_205 = (*rh).row;
  return (temp_205);
}

Index_t_st66 sparseNumCols(
SparseMatrix_t_st67 *sm)
{
  local vars

  ch1 = (*sm1).cols;
  count1 = 0;
  while ( (ch2 != 0) )
  {
    count3 = (count2 + 1);
    ch3 = (*ch2).ncolH;
  }
  return (count4);
}

Index_t_st66 sparseMaxCol(
SparseMatrix_t_st67 *sm)
{
  local vars

  ch2 = getLastColHPtr1(sm1);
  if ((ch2 == 0))
  {
    return (0);
  }
  temp_2061 = (*ch2).col;
  return (temp_2061);
}

boolean_st43 sparseGet(
SparseMatrix_t_st67 *sm, 
Index_t_st66 row, 
Index_t_st66 col, 
double *valuep)
{
  local vars

  rh2 = getThisRowHeader1(sm1, row1);
  if ((rh2 == 0))
  {
    (*valuep1) = 0.00000000000000e+00;
    return (0);
  }
  e1 = (*rh2).relems;
  temp_2071 = (e1 != 0);
  if ((temp_2071 != 0))
  {
    /** temp_207 = ((*e).col != col) **/
    temp_2081 = (*e1).col;
    temp_2072 = (temp_2081 != col1);
  }
  while ( (temp_2074 != 0) )
  {
    e3 = (*e2).ncolE;
    temp_2075 = (e3 != 0);
    if ((temp_2075 != 0))
    {
      _U_temp_208_02 = (*e3).col;
      temp_2076 = (_U_temp_208_02 != col1);
    }
  }
  if ((e4 == 0))
  {
    (*valuep1) = 0.00000000000000e+00;
    return (0);
  }
  (*valuep1) = (*e4).value;
  return (1);
}

boolean_st43 sparsePut(
SparseMatrix_t_st67 *sm, 
Index_t_st66 row, 
Index_t_st66 col, 
double value)
{
  local vars

  rh2 = getThisRowHeader1(sm1, row1);
  if ((rh2 != 0))
  {
    e1 = (*rh2).relems;
    temp_2091 = (e1 != 0);
    if ((temp_2091 != 0))
    {
      /** temp_209 = ((*e).col != col) **/
      temp_2101 = (*e1).col;
      temp_2092 = (temp_2101 != col1);
    }
    while ( (temp_2094 != 0) )
    {
      e3 = (*e2).ncolE;
      temp_2095 = (e3 != 0);
      if ((temp_2095 != 0))
      {
        _U_temp_210_12 = (*e3).col;
        temp_2096 = (_U_temp_210_12 != col1);
      }
    }
    if ((e4 != 0))
    {
      (*e4).value = value1;
      return (1);
    }
  }
  newE2 = newElement2(row1, col1, value1);
  if ((newE2 == 0))
  {
    temp_2111 = "sparsePut: out of memory";
    temp_2121 = (char *) temp_2111;
    error3(temp_2121);
    return (0);
  }
  rh3 = (*sm1).rows;
  prevRH1 = 0;
  temp_2131 = (rh3 != 0);
  if ((temp_2131 != 0))
  {
    /** temp_213 = ((*rh).row < row) **/
    temp_2141 = (*rh3).row;
    temp_2132 = (temp_2141 < row1);
  }
  while ( (temp_2134 != 0) )
  {
    prevRH3 = rh4;
    rh5 = (*rh4).nrowH;
    temp_2135 = (rh5 != 0);
    if ((temp_2135 != 0))
    {
      _U_temp_214_22 = (*rh5).row;
      temp_2136 = (_U_temp_214_22 < row1);
    }
  }
  temp_2151 = (rh6 == 0);
  if ((temp_2151 == 0))
  {
    /** temp_215 = ((*rh).row > row) **/
    temp_2161 = (*rh6).row;
    temp_2152 = (temp_2161 > row1);
  }
  if ((temp_2153 != 0))
  {
    temp_2172 = malloc(16);
    newRH1 = (struct RowHeader *) temp_2172;
    if ((newRH1 == 0))
    {
      temp_2181 = "sparsePut: out of memory";
      temp_2191 = (char *) temp_2181;
      error4(temp_2191);
      return (0);
    }
    if ((prevRH4 == 0))
    {
      (*sm1).rows = newRH1;
    }
    else
    {
      (*prevRH4).nrowH = newRH1;
    }
    (*newRH1).nrowH = rh6;
    (*newRH1).prowH = prevRH4;
    (*newRH1).relems = 0;
    (*newRH1).row = row1;
    if ((rh6 == 0));
    else
    {
      (*rh6).prowH = newRH1;
    }
    rh7 = newRH1;
  }
  insertIntoRow5(rh8, newE2);
  ch1 = (*sm1).cols;
  prevCH1 = 0;
  temp_2201 = (ch1 != 0);
  if ((temp_2201 != 0))
  {
    /** temp_220 = ((*ch).col < col) **/
    temp_2211 = (*ch1).col;
    temp_2202 = (temp_2211 < col1);
  }
  while ( (temp_2204 != 0) )
  {
    prevCH3 = ch2;
    ch3 = (*ch2).ncolH;
    temp_2205 = (ch3 != 0);
    if ((temp_2205 != 0))
    {
      _U_temp_221_32 = (*ch3).col;
      temp_2206 = (_U_temp_221_32 < col1);
    }
  }
  temp_2221 = (ch4 == 0);
  if ((temp_2221 == 0))
  {
    /** temp_222 = ((*ch).col > col) **/
    temp_2231 = (*ch4).col;
    temp_2222 = (temp_2231 > col1);
  }
  if ((temp_2223 != 0))
  {
    temp_2242 = malloc(32);
    newCH1 = (struct ColHeader *) temp_2242;
    if ((newCH1 == 0))
    {
      temp_2251 = "sparsePut: out of memory";
      temp_2261 = (char *) temp_2251;
      error6(temp_2261);
      return (0);
    }
    if ((prevCH4 == 0))
    {
      (*sm1).cols = newCH1;
    }
    else
    {
      (*prevCH4).ncolH = newCH1;
    }
    (*newCH1).ncolH = ch4;
    (*newCH1).pcolH = prevCH4;
    (*newCH1).celems = 0;
    (*newCH1).col = col1;
    (*newCH1).whichUnknown = col1;
    (*newCH1).colScaleFactor = 1.00000000000000e+00;
    if ((ch4 == 0));
    else
    {
      (*ch4).pcolH = newCH1;
    }
    ch5 = newCH1;
  }
  insertIntoColumn7(ch6, newE2);
  return (1);
}

boolean_st43 sparseScale(
SparseMatrix_t_st67 *sm)
{
  local vars

  temp_2272 = doScaling1(sm1, 0);
  return (temp_2272);
}

boolean_st43 doScaling(
SparseMatrix_t_st67 *sm, 
boolean_st43 rescale)
{
  local vars

  rh1 = (*sm1).rows;
  while ( (rh2 != 0) )
  {
    maxval3 = findMaxInRow1(rh2);
    if ((maxval3 > 0.00000000000000e+00))
    {
      exp3 = log2(maxval3);
      exp5 = anint(exp3);
      scaleF3 = exp2(exp5);
      scaleRowByDivisor2(rh2, scaleF3);
    }
    rh3 = (*rh2).nrowH;
  }
  ch1 = (*sm1).cols;
  temp_2281 = (*ch1).ncolH;
  while ( (temp_2282 != 0) )
  {
    maxval7 = findMaxInCol3(ch2);
    if ((maxval7 == 0.00000000000000e+00))
    {
      (*ch2).colScaleFactor = 1.00000000000000e+00;
    }
    else
    {
      exp10 = log2(maxval7);
      exp12 = anint(exp10);
      scaleF8 = exp2(exp12);
      temp_2292 = (char ) rescale1;
      if ((temp_2292 == 1))
      {
        /** (*ch).colScaleFactor = ((*ch).colScaleFactor * scaleF) **/
        temp_2302 = (*ch2).colScaleFactor;
        (*ch2).colScaleFactor = (temp_2302 * scaleF8);
      }
      else
      {
        (*ch2).colScaleFactor = scaleF8;
      }
      scaleColByDivisor4(ch2, scaleF8);
    }
    ch3 = (*ch2).ncolH;
    temp_2283 = (*ch3).ncolH;
  }
  return (1);
}

boolean_st43 sparseFactor(
SparseMatrix_t_st67 *sm)
{
  local vars

  temp_2312 = sparseNumRows1(sm1);
  temp_2321 = (int ) temp_2312;
  temp_2342 = sparseNumCols2(sm1);
  temp_2351 = (int ) temp_2342;
  temp_2331 = (temp_2351 - 1);
  if ((temp_2321 != temp_2331))
  {
    temp_2361 = "sparseFactor: matrix is not square";
    temp_2371 = (char *) temp_2361;
    error3(temp_2371);
    return (0);
  }
  pivotCH1 = (*sm1).cols;
  while ( (pivotCH2 != 0) )
  {
    (*pivotCH2).whichUnknown = (*pivotCH2).col;
    pivotCH3 = (*pivotCH2).ncolH;
  }
  pivotCH5 = (*sm1).cols;
  pivotRH1 = (*sm1).rows;
  temp_2381 = (*pivotCH5).ncolH;
  while ( (temp_2382 != 0) )
  {
    computeMarkowitzProducts4(sm1, pivotRH2, pivotCH6);
    pivotE3 = findBestPivotElement5(sm1, pivotRH2, pivotCH6);
    if ((pivotE3 == 0))
    {
      temp_2392 = "sparseFactor: no reasonable pivot exists";
      temp_2402 = (char *) temp_2392;
      error6(temp_2402);
      return (0);
    }
    pivotE5 = swapRowsAndCols7(sm1, pivotRH2, pivotCH6, pivotE3);
    scaleRowsDueToPivot8(pivotE5);
    temp_2413 = addFillIns9(sm1, pivotE5);
    temp_2422 = (char ) temp_2413;
    if ((temp_2422 == 0))
    {
      temp_2432 = "sparseFactor: adding of fillins failed";
      temp_2442 = (char *) temp_2432;
      error10(temp_2442);
      return (0);
    }
    eliminateColUpdateRows11(pivotE5);
    pivotCH7 = (*pivotCH6).ncolH;
    pivotRH3 = (*pivotRH2).nrowH;
    temp_2383 = (*pivotCH7).ncolH;
  }
  return (1);
}

boolean_st43 sparseSolve(
SparseMatrix_t_st67 *sm, 
double x[])
{
  local vars

  temp_2452 = sparseNumRows1(sm1);
  temp_2461 = (int ) temp_2452;
  temp_2482 = sparseNumCols2(sm1);
  temp_2491 = (int ) temp_2482;
  temp_2471 = (temp_2491 - 1);
  if ((temp_2461 != temp_2471))
  {
    temp_2501 = "sparseSolve: matrix is not square";
    temp_2511 = (char *) temp_2501;
    error3(temp_2511);
    return (0);
  }
  temp_2532 = sparseMaxCol4(sm1);
  temp_2541 = (int ) temp_2532;
  temp_2551 = (unsigned int ) temp_2541;
  temp_2521 = (2 * temp_2551);
  temp_2562 = malloc(temp_2521);
  mapUnk1 = (short *) temp_2562;
  if ((mapUnk1 == 0))
  {
    temp_2571 = "sparseSolve: out of memory";
    temp_2581 = (char *) temp_2571;
    error5(temp_2581);
    return (0);
  }
  ch1 = (*sm1).cols;
  temp_2591 = (*ch1).ncolH;
  while ( (temp_2592 != 0) )
  {
    temp_2602 = (*ch2).col;
    mapUnk1[temp_2602] = (*ch2).whichUnknown;
    ch3 = (*ch2).ncolH;
    temp_2593 = (*ch3).ncolH;
  }
  col2 = sparseMaxCol6(sm1);
  col3 = (col2 - 1);
  while ( (col4 >= 0) )
  {
    temp_2612 = (int ) col4;
    x1[temp_2612] = 0.00000000000000e+00;
    col5 = (col4 - 1);
  }
  rh2 = getLastRowHPtr7(sm1);
  e1 = (*rh2).relems;
  temp_2621 = (*e1).ncolE;
  while ( (temp_2622 != 0) )
  {
    e3 = (*e2).ncolE;
    temp_2623 = (*e3).ncolE;
  }
  bi1 = e4;
  ci1 = e4;
  do 
  {
    e6 = bi2;
    temp_2632 = (e6 != 0);
    if ((temp_2632 != 0))
    {
      /** temp_263 = ((*e).col >= (*ci).col) **/
      temp_2642 = (*e6).col;
      temp_2652 = (*ci2).col;
      temp_2633 = (temp_2642 >= temp_2652);
    }
    while ( (temp_2635 != 0) )
    {
      e8 = (*e7).pcolE;
      temp_2636 = (e8 != 0);
      if ((temp_2636 != 0))
      {
        _U_temp_264_53 = (*e8).col;
        _U_temp_265_43 = (*ci2).col;
        temp_2637 = (_U_temp_264_53 >= _U_temp_265_43);
      }
    }
    if ((e9 == 0))
    {
      temp_2662 = "sparseSolve: could not locate next unknown element";
      temp_2672 = (char *) temp_2662;
      error8(temp_2672);
      free9(mapUnk2);
      return (0);
    }
    ci3 = e9;
    divisor2 = (*ci3).value;
    if ((divisor2 == 0.00000000000000e+00))
    {
      temp_2682 = "sparseSolve: divisor is zero";
      temp_2692 = (char *) temp_2682;
      error10(temp_2692);
      free11(mapUnk4);
      return (0);
    }
    (*ci3).value = 1.00000000000000e+00;
    e10 = (*ci3).ncolE;
    while ( (e11 != 0) )
    {
      temp_2703 = (*e11).value;
      (*e11).value = (temp_2703 / divisor2);
      e12 = (*e11).ncolE;
    }
    temp_2712 = (*ci3).col;
    unk2 = mapUnk6[temp_2712];
    temp_2722 = (int ) unk2;
    x1[temp_2722] = (*bi2).value;
    e14 = ci3;
    e15 = (*e14).ncolE;
    while ( (e16 != bi2) )
    {
      temp_2733 = (int ) unk2;
      temp_2753 = (int ) unk2;
      temp_2743 = x1[temp_2753];
      temp_2773 = (*e16).value;
      temp_2793 = (*e16).col;
      temp_2803 = mapUnk6[temp_2793];
      temp_2813 = (int ) temp_2803;
      temp_2783 = x1[temp_2813];
      temp_2763 = (temp_2773 * temp_2783);
      x1[temp_2733] = (temp_2743 - temp_2763);
      e17 = (*e16).ncolE;
    }
    bi3 = (*bi2).prowE;
  }
  while ( (bi3 != 0) );
  ch5 = (*sm1).cols;
  temp_2821 = (*ch5).ncolH;
  while ( (temp_2822 != 0) )
  {
    temp_2832 = (*ch6).col;
    unk4 = mapUnk6[temp_2832];
    temp_2842 = (int ) unk4;
    temp_2862 = (int ) unk4;
    temp_2852 = x1[temp_2862];
    temp_2872 = (*ch6).colScaleFactor;
    x1[temp_2842] = (temp_2852 / temp_2872);
    ch7 = (*ch6).ncolH;
    temp_2823 = (*ch7).ncolH;
  }
  free12(mapUnk6);
  return (1);
}

void sparsePrint(
SparseMatrix_t_st67 *sm)
{
  local vars

  temp_288 = "\n** Dump of sparse matrix **\n";
  printf(temp_288);
  temp_289 = "\nRow-major order (%ld rows, max row = %ld, # elements %ld):\n";
  temp_290 = sparseNumRows1(sm);
  temp_291 = (int ) temp_290;
  temp_292 = (long ) temp_291;
  temp_293 = sparseMaxRow2(sm);
  temp_294 = (int ) temp_293;
  temp_295 = (long ) temp_294;
  temp_296 = sparseNumElements3(sm);
  printf(temp_289, temp_292, temp_295, temp_296);
  rh = (*sm).rows;
  while ( (rh != 0) )
  {
    temp_297 = " Row %ld:\n";
    temp_298 = (*rh).row;
    temp_299 = (int ) temp_298;
    temp_300 = (long ) temp_299;
    printf(temp_297, temp_300);
    e = (*rh).relems;
    while ( (e != 0) )
    {
      temp_301 = "   (%ld,%ld) = %e\n";
      temp_302 = (*e).row;
      temp_303 = (int ) temp_302;
      temp_304 = (long ) temp_303;
      temp_305 = (*e).col;
      temp_306 = (int ) temp_305;
      temp_307 = (long ) temp_306;
      temp_308 = (*e).value;
      printf(temp_301, temp_304, temp_307, temp_308);
      e = (*e).ncolE;
    }
    rh = (*rh).nrowH;
  }
  temp_309 = "\n** Done **\n";
  printf(temp_309);
  temp_310 = (&_iob[1]);
  fflush(temp_310);
}

RowHeader_t_st68 *getLastRowHPtr(
SparseMatrix_t_st67 *sm)
{
  local vars

  rh1 = (*sm1).rows;
  if ((rh1 == 0))
  {
    return (0);
  }
  temp_3111 = (*rh1).nrowH;
  while ( (temp_3112 != 0) )
  {
    rh3 = (*rh2).nrowH;
    temp_3113 = (*rh3).nrowH;
  }
  return (rh4);
}

ColHeader_t_st69 *getLastColHPtr(
SparseMatrix_t_st67 *sm)
{
  local vars

  ch1 = (*sm1).cols;
  if ((ch1 == 0))
  {
    return (0);
  }
  temp_3121 = (*ch1).ncolH;
  while ( (temp_3122 != 0) )
  {
    ch3 = (*ch2).ncolH;
    temp_3123 = (*ch3).ncolH;
  }
  return (ch4);
}

RowHeader_t_st68 *getThisRowHeader(
SparseMatrix_t_st67 *sm, 
Index_t_st66 row)
{
  local vars

  rh1 = (*sm1).rows;
  temp_3131 = (rh1 != 0);
  if ((temp_3131 != 0))
  {
    /** temp_313 = ((*rh).row != row) **/
    temp_3141 = (*rh1).row;
    temp_3132 = (temp_3141 != row1);
  }
  while ( (temp_3134 != 0) )
  {
    rh3 = (*rh2).nrowH;
    temp_3135 = (rh3 != 0);
    if ((temp_3135 != 0))
    {
      _U_temp_314_62 = (*rh3).row;
      temp_3136 = (_U_temp_314_62 != row1);
    }
  }
  return (rh4);
}

ColHeader_t_st69 *getThisColHeader(
SparseMatrix_t_st67 *sm, 
Index_t_st66 col)
{
  local vars

  ch = (*sm).cols;
  temp_315 = (ch != 0);
  if ((temp_315 != 0))
  {
    /** temp_315 = ((*ch).col != col) **/
    temp_316 = (*ch).col;
    temp_315 = (temp_316 != col);
  }
  while ( (temp_315 != 0) )
  {
    ch = (*ch).ncolH;
    temp_315 = (ch != 0);
    if ((temp_315 != 0))
    {
      _U_temp_316_7 = (*ch).col;
      temp_315 = (_U_temp_316_7 != col);
    }
  }
  return (ch);
}

void computeMarkowitzProducts(
SparseMatrix_t_st67 *sm, 
RowHeader_t_st68 *pivotRH, 
ColHeader_t_st69 *pivotCH)
{
  local vars

  rh1 = pivotRH1;
  while ( (rh2 != 0) )
  {
    e2 = (*rh2).relems;
    temp_3172 = (e2 != 0);
    if ((temp_3172 != 0))
    {
      /** temp_317 = ((*e).col < (*pivotCH).col) **/
      temp_3182 = (*e2).col;
      temp_3192 = (*pivotCH1).col;
      temp_3173 = (temp_3182 < temp_3192);
    }
    while ( (temp_3175 != 0) )
    {
      e4 = (*e3).ncolE;
      temp_3176 = (e4 != 0);
      if ((temp_3176 != 0))
      {
        _U_temp_318_93 = (*e4).col;
        _U_temp_319_83 = (*pivotCH1).col;
        temp_3177 = (_U_temp_318_93 < _U_temp_319_83);
      }
    }
    startE2 = e5;
    count2 = 0;
    while ( (e6 != 0) )
    {
      count4 = (count3 + 1);
      e7 = (*e6).ncolE;
    }
    e9 = startE2;
    temp_3202 = (*e9).ncolE;
    while ( (temp_3203 != 0) )
    {
      temp_3213 = (int ) count5;
      temp_3223 = (temp_3213 - 1);
      (*e10).markowitzProduct = (long ) temp_3223;
      e11 = (*e10).ncolE;
      temp_3204 = (*e11).ncolE;
    }
    rh3 = (*rh2).nrowH;
  }
  ch1 = pivotCH1;
  temp_3231 = (*ch1).ncolH;
  while ( (temp_3232 != 0) )
  {
    e15 = (*ch2).celems;
    temp_3242 = (e15 != 0);
    if ((temp_3242 != 0))
    {
      /** temp_324 = ((*e).row < (*pivotRH).row) **/
      temp_3252 = (*e15).row;
      temp_3262 = (*pivotRH1).row;
      temp_3243 = (temp_3252 < temp_3262);
    }
    while ( (temp_3245 != 0) )
    {
      e17 = (*e16).nrowE;
      temp_3246 = (e17 != 0);
      if ((temp_3246 != 0))
      {
        _U_temp_325_113 = (*e17).row;
        _U_temp_326_103 = (*pivotRH1).row;
        temp_3247 = (_U_temp_325_113 < _U_temp_326_103);
      }
    }
    startE5 = e18;
    count8 = 0;
    while ( (e19 != 0) )
    {
      count10 = (count9 + 1);
      e20 = (*e19).nrowE;
    }
    e22 = startE5;
    while ( (e23 != 0) )
    {
      temp_3273 = (*e23).markowitzProduct;
      temp_3283 = (int ) count11;
      temp_3293 = (temp_3283 - 1);
      temp_3303 = (long ) temp_3293;
      (*e23).markowitzProduct = (temp_3273 * temp_3303);
      e24 = (*e23).nrowE;
    }
    ch3 = (*ch2).ncolH;
    temp_3233 = (*ch3).ncolH;
  }
}

ElementNode_t_st70 *findBestPivotElement(
SparseMatrix_t_st67 *sm, 
RowHeader_t_st68 *pivotRH, 
ColHeader_t_st69 *pivotCH)
{
  local vars

  minMP1 = 2147483647;
  pivotE1 = 0;
  rh1 = pivotRH1;
  while ( (rh2 != 0) )
  {
    e2 = (*rh2).relems;
    temp_3312 = (e2 != 0);
    if ((temp_3312 != 0))
    {
      /** temp_331 = ((*e).col < (*pivotCH).col) **/
      temp_3322 = (*e2).col;
      temp_3332 = (*pivotCH1).col;
      temp_3313 = (temp_3322 < temp_3332);
    }
    while ( (temp_3315 != 0) )
    {
      e4 = (*e3).ncolE;
      temp_3316 = (e4 != 0);
      if ((temp_3316 != 0))
      {
        _U_temp_332_133 = (*e4).col;
        _U_temp_333_123 = (*pivotCH1).col;
        temp_3317 = (_U_temp_332_133 < _U_temp_333_123);
      }
    }
    temp_3342 = (*e5).ncolE;
    while ( (temp_3343 != 0) )
    {
      temp_3363 = (*e6).markowitzProduct;
      temp_3353 = (temp_3363 < minMP3);
      if ((temp_3353 != 0))
      {
        /** temp_335 = (fabs((*e).value) >= 1.00000000000000e-03) **/
        temp_3383 = (*e6).value;
        temp_3374 = fabs(temp_3383);
        temp_3354 = (temp_3374 >= 1.00000000000000e-03);
      }
      if ((temp_3355 != 0))
      {
        pivotE4 = e6;
        minMP4 = (*e6).markowitzProduct;
      }
      e7 = (*e6).ncolE;
      temp_3344 = (*e7).ncolE;
    }
    rh3 = (*rh2).nrowH;
  }
  if ((pivotE7 != 0))
  {
    return (pivotE7);
  }
  minMP8 = 2147483647;
  pivotE8 = 0;
  rh5 = pivotRH1;
  while ( (rh6 != 0) )
  {
    e11 = (*rh6).relems;
    temp_3392 = (e11 != 0);
    if ((temp_3392 != 0))
    {
      /** temp_339 = ((*e).col < (*pivotCH).col) **/
      temp_3402 = (*e11).col;
      temp_3412 = (*pivotCH1).col;
      temp_3393 = (temp_3402 < temp_3412);
    }
    while ( (temp_3395 != 0) )
    {
      e13 = (*e12).ncolE;
      temp_3396 = (e13 != 0);
      if ((temp_3396 != 0))
      {
        _U_temp_340_153 = (*e13).col;
        _U_temp_341_143 = (*pivotCH1).col;
        temp_3397 = (_U_temp_340_153 < _U_temp_341_143);
      }
    }
    temp_3422 = (*e14).ncolE;
    while ( (temp_3423 != 0) )
    {
      temp_3443 = (*e15).markowitzProduct;
      temp_3433 = (temp_3443 < minMP10);
      if ((temp_3433 != 0))
      {
        /** temp_343 = ((*e).value != 0.00000000000000e+00) **/
        temp_3453 = (*e15).value;
        temp_3434 = (temp_3453 != 0.00000000000000e+00);
      }
      if ((temp_3435 != 0))
      {
        pivotE11 = e15;
        minMP11 = (*e15).markowitzProduct;
      }
      e16 = (*e15).ncolE;
      temp_3424 = (*e16).ncolE;
    }
    rh7 = (*rh6).nrowH;
  }
  if ((pivotE14 != 0))
  {
    return (pivotE14);
  }
  temp_3461 = "findBestPivotElement: all possible pivots are zero, must fail";
  temp_3471 = (char *) temp_3461;
  error1(temp_3471);
  return (0);
}

void unlinkFromRow(
RowHeader_t_st68 *rh, 
ElementNode_t_st70 *e)
{
  local vars

  temp_3481 = (*e1).pcolE;
  if ((temp_3481 == 0))
  {
    (*rh1).relems = (*e1).ncolE;
  }
  else
  {
    /** (*(*e).pcolE).ncolE = (*e).ncolE **/
    temp_3491 = (*e1).pcolE;
    (*temp_3491).ncolE = (*e1).ncolE;
  }
  temp_3501 = (*e1).ncolE;
  if ((temp_3501 == 0));
  else
  {
    /** (*(*e).ncolE).pcolE = (*e).pcolE **/
    temp_3511 = (*e1).ncolE;
    (*temp_3511).pcolE = (*e1).pcolE;
  }
}

void unlinkFromColumn(
ColHeader_t_st69 *ch, 
ElementNode_t_st70 *e)
{
  local vars

  temp_3521 = (*e1).prowE;
  if ((temp_3521 == 0))
  {
    (*ch1).celems = (*e1).nrowE;
  }
  else
  {
    /** (*(*e).prowE).nrowE = (*e).nrowE **/
    temp_3531 = (*e1).prowE;
    (*temp_3531).nrowE = (*e1).nrowE;
  }
  temp_3541 = (*e1).nrowE;
  if ((temp_3541 == 0));
  else
  {
    /** (*(*e).nrowE).prowE = (*e).prowE **/
    temp_3551 = (*e1).nrowE;
    (*temp_3551).prowE = (*e1).prowE;
  }
}

void insertIntoColumn(
ColHeader_t_st69 *ch, 
ElementNode_t_st70 *newE)
{
  local vars

  e1 = (*ch1).celems;
  prevE1 = 0;
  temp_3561 = (e1 != 0);
  if ((temp_3561 != 0))
  {
    /** temp_356 = ((*e).row < (*newE).row) **/
    temp_3571 = (*e1).row;
    temp_3581 = (*newE1).row;
    temp_3562 = (temp_3571 < temp_3581);
  }
  while ( (temp_3564 != 0) )
  {
    prevE3 = e2;
    e3 = (*e2).nrowE;
    temp_3565 = (e3 != 0);
    if ((temp_3565 != 0))
    {
      _U_temp_357_172 = (*e3).row;
      _U_temp_358_162 = (*newE1).row;
      temp_3566 = (_U_temp_357_172 < _U_temp_358_162);
    }
  }
  if ((prevE4 == 0))
  {
    (*ch1).celems = newE1;
  }
  else
  {
    (*prevE4).nrowE = newE1;
  }
  (*newE1).nrowE = e4;
  (*newE1).prowE = prevE4;
  if ((e4 == 0));
  else
  {
    (*e4).prowE = newE1;
  }
}

void linkIntoColumnBetween(
ColHeader_t_st69 *ch, 
ElementNode_t_st70 *prevE, 
ElementNode_t_st70 *curE, 
ElementNode_t_st70 *newE)
{
  if ((prevE1 == 0))
  {
    (*ch1).celems = newE1;
  }
  else
  {
    (*prevE1).nrowE = newE1;
  }
  (*newE1).nrowE = curE1;
  (*newE1).prowE = prevE1;
  if ((curE1 == 0));
  else
  {
    (*curE1).prowE = newE1;
  }
}

void insertIntoRow(
RowHeader_t_st68 *rh, 
ElementNode_t_st70 *newE)
{
  local vars

  e1 = (*rh1).relems;
  prevE1 = 0;
  temp_3591 = (e1 != 0);
  if ((temp_3591 != 0))
  {
    /** temp_359 = ((*e).col < (*newE).col) **/
    temp_3601 = (*e1).col;
    temp_3611 = (*newE1).col;
    temp_3592 = (temp_3601 < temp_3611);
  }
  while ( (temp_3594 != 0) )
  {
    prevE3 = e2;
    e3 = (*e2).ncolE;
    temp_3595 = (e3 != 0);
    if ((temp_3595 != 0))
    {
      _U_temp_360_192 = (*e3).col;
      _U_temp_361_182 = (*newE1).col;
      temp_3596 = (_U_temp_360_192 < _U_temp_361_182);
    }
  }
  if ((prevE4 == 0))
  {
    (*rh1).relems = newE1;
  }
  else
  {
    (*prevE4).ncolE = newE1;
  }
  (*newE1).ncolE = e4;
  (*newE1).pcolE = prevE4;
  if ((e4 == 0));
  else
  {
    (*e4).pcolE = newE1;
  }
}

void linkIntoRowBetween(
RowHeader_t_st68 *rh, 
ElementNode_t_st70 *prevE, 
ElementNode_t_st70 *curE, 
ElementNode_t_st70 *newE)
{
  if ((prevE1 == 0))
  {
    (*rh1).relems = newE1;
  }
  else
  {
    (*prevE1).ncolE = newE1;
  }
  (*newE1).ncolE = curE1;
  (*newE1).pcolE = prevE1;
  if ((curE1 == 0));
  else
  {
    (*curE1).pcolE = newE1;
  }
}

ElementNode_t_st70 *swapRowsAndCols(
SparseMatrix_t_st67 *sm, 
RowHeader_t_st68 *pivotRH, 
ColHeader_t_st69 *pivotCH, 
ElementNode_t_st70 *realPivotE)
{
  local vars

  temp_3621 = (*realPivotE1).col;
  temp_3631 = (*pivotCH1).col;
  if ((temp_3621 != temp_3631))
  {
    leftCH1 = pivotCH1;
    rightCH1 = (*leftCH1).ncolH;
    temp_3641 = (*rightCH1).col;
    temp_3651 = (*realPivotE1).col;
    while ( (temp_3642 != temp_3652) )
    {
      rightCH3 = (*rightCH2).ncolH;
      temp_3643 = (*rightCH3).col;
      temp_3653 = (*realPivotE1).col;
    }
    leftE1 = (*leftCH1).celems;
    prevRightE1 = 0;
    rightE1 = (*rightCH4).celems;
    rh1 = (*sm1).rows;
    while ( (leftE2 != 0) )
    {
      temp_3662 = (*rh2).row;
      temp_3672 = (*leftE2).row;
      while ( (temp_3663 != temp_3673) )
      {
        rh4 = (*rh3).nrowH;
        temp_3664 = (*rh4).row;
        temp_3674 = (*leftE2).row;
      }
      temp_3682 = (rightE2 != 0);
      if ((temp_3682 != 0))
      {
        /** temp_368 = ((*rightE).row < (*leftE).row) **/
        temp_3692 = (*rightE2).row;
        temp_3702 = (*leftE2).row;
        temp_3683 = (temp_3692 < temp_3702);
      }
      while ( (temp_3685 != 0) )
      {
        prevRightE4 = rightE3;
        rightE4 = (*rightE3).nrowE;
        temp_3686 = (rightE4 != 0);
        if ((temp_3686 != 0))
        {
          _U_temp_369_213 = (*rightE4).row;
          _U_temp_370_203 = (*leftE2).row;
          temp_3687 = (_U_temp_369_213 < _U_temp_370_203);
        }
      }
      temp_3712 = (rightE5 != 0);
      if ((temp_3712 != 0))
      {
        /** temp_371 = ((*leftE).row == (*rightE).row) **/
        temp_3722 = (*leftE2).row;
        temp_3732 = (*rightE5).row;
        temp_3713 = (temp_3722 == temp_3732);
      }
      if ((temp_3714 != 0))
      {
        tval2 = (*leftE2).value;
        (*leftE2).value = (*rightE5).value;
        (*rightE5).value = tval2;
        (*rightE5).col = (*leftE2).col;
        if ((realPivotE1 == rightE5))
        {
          realPivotE2 = leftE2;
        }
        leftE3 = (*leftE2).nrowE;
      }
      else
      {
        prevE2 = leftE2;
        curE2 = (*leftE2).ncolE;
        temp_3742 = (curE2 != 0);
        if ((temp_3742 != 0))
        {
          /** temp_374 = ((*curE).col < (*rightCH).col) **/
          temp_3752 = (*curE2).col;
          temp_3762 = (*rightCH4).col;
          temp_3743 = (temp_3752 < temp_3762);
        }
        while ( (temp_3745 != 0) )
        {
          prevE4 = curE3;
          curE4 = (*curE3).ncolE;
          temp_3746 = (curE4 != 0);
          if ((temp_3746 != 0))
          {
            _U_temp_375_233 = (*curE4).col;
            _U_temp_376_223 = (*rightCH4).col;
            temp_3747 = (_U_temp_375_233 < _U_temp_376_223);
          }
        }
        if ((prevE5 == leftE2));
        else
        {
          unlinkFromRow1(rh5, leftE2);
          linkIntoRowBetween2(rh5, prevE5, curE5, leftE2);
        }
        nextLeftE2 = (*leftE2).nrowE;
        unlinkFromColumn3(leftCH1, leftE2);
        linkIntoColumnBetween4(rightCH4, prevRightE5, rightE5, leftE2);
        prevRightE6 = leftE2;
        leftE4 = nextLeftE2;
      }
    }
    rightE7 = (*rightCH4).celems;
    prevLeftE1 = 0;
    leftE7 = (*leftCH1).celems;
    rh7 = (*sm1).rows;
    while ( (rightE8 != 0) )
    {
      temp_3772 = (*rh8).row;
      temp_3782 = (*rightE8).row;
      while ( (temp_3773 != temp_3783) )
      {
        rh10 = (*rh9).nrowH;
        temp_3774 = (*rh10).row;
        temp_3784 = (*rightE8).row;
      }
      temp_3792 = (*rightE8).col;
      temp_3802 = (*rightCH4).col;
      if ((temp_3792 == temp_3802))
      {
        temp_3812 = (leftE8 != 0);
        if ((temp_3812 != 0))
        {
          /** temp_381 = ((*leftE).row < (*rightE).row) **/
          temp_3822 = (*leftE8).row;
          temp_3832 = (*rightE8).row;
          temp_3813 = (temp_3822 < temp_3832);
        }
        while ( (temp_3815 != 0) )
        {
          prevLeftE4 = leftE9;
          leftE10 = (*leftE9).nrowE;
          temp_3816 = (leftE10 != 0);
          if ((temp_3816 != 0))
          {
            _U_temp_382_253 = (*leftE10).row;
            _U_temp_383_243 = (*rightE8).row;
            temp_3817 = (_U_temp_382_253 < _U_temp_383_243);
          }
        }
        prevE9 = (*rightE8).pcolE;
        curE9 = rightE8;
        temp_3842 = (prevE9 != 0);
        if ((temp_3842 != 0))
        {
          /** temp_384 = ((*prevE).col > (*leftCH).col) **/
          temp_3852 = (*prevE9).col;
          temp_3862 = (*leftCH1).col;
          temp_3843 = (temp_3852 > temp_3862);
        }
        while ( (temp_3845 != 0) )
        {
          curE11 = prevE10;
          prevE11 = (*prevE10).pcolE;
          temp_3846 = (prevE11 != 0);
          if ((temp_3846 != 0))
          {
            _U_temp_385_273 = (*prevE11).col;
            _U_temp_386_263 = (*leftCH1).col;
            temp_3847 = (_U_temp_385_273 > _U_temp_386_263);
          }
        }
        if ((curE12 == rightE8));
        else
        {
          unlinkFromRow5(rh11, rightE8);
          linkIntoRowBetween6(rh11, prevE12, curE12, rightE8);
        }
        nextRightE2 = (*rightE8).nrowE;
        unlinkFromColumn7(rightCH4, rightE8);
        linkIntoColumnBetween8(leftCH1, prevLeftE5, leftE11, rightE8);
        (*rightE8).col = (*leftCH1).col;
        prevLeftE6 = rightE8;
        rightE9 = nextRightE2;
      }
      else
      {
        rightE10 = (*rightE8).nrowE;
      }
    }
    tval5 = (*leftCH1).colScaleFactor;
    (*leftCH1).colScaleFactor = (*rightCH4).colScaleFactor;
    (*rightCH4).colScaleFactor = tval5;
    tunk1 = (*leftCH1).whichUnknown;
    (*leftCH1).whichUnknown = (*rightCH4).whichUnknown;
    (*rightCH4).whichUnknown = tunk1;
    rightE13 = (*rightCH4).celems;
    while ( (rightE14 != 0) )
    {
      (*rightE14).col = (*rightCH4).col;
      rightE15 = (*rightE14).nrowE;
    }
  }
  temp_3871 = (*realPivotE6).row;
  temp_3881 = (*pivotRH1).row;
  if ((temp_3871 != temp_3881))
  {
    topRH1 = pivotRH1;
    botRH1 = (*topRH1).nrowH;
    temp_3891 = (*botRH1).row;
    temp_3901 = (*realPivotE6).row;
    while ( (temp_3892 != temp_3902) )
    {
      botRH3 = (*botRH2).nrowH;
      temp_3893 = (*botRH3).row;
      temp_3903 = (*realPivotE6).row;
    }
    topE1 = (*topRH1).relems;
    prevBotE1 = 0;
    botE1 = (*botRH4).relems;
    ch1 = (*sm1).cols;
    while ( (topE2 != 0) )
    {
      temp_3912 = (*ch2).col;
      temp_3922 = (*topE2).col;
      while ( (temp_3913 != temp_3923) )
      {
        ch4 = (*ch3).ncolH;
        temp_3914 = (*ch4).col;
        temp_3924 = (*topE2).col;
      }
      temp_3932 = (botE2 != 0);
      if ((temp_3932 != 0))
      {
        /** temp_393 = ((*botE).col < (*topE).col) **/
        temp_3942 = (*botE2).col;
        temp_3952 = (*topE2).col;
        temp_3933 = (temp_3942 < temp_3952);
      }
      while ( (temp_3935 != 0) )
      {
        prevBotE4 = botE3;
        botE4 = (*botE3).ncolE;
        temp_3936 = (botE4 != 0);
        if ((temp_3936 != 0))
        {
          _U_temp_394_293 = (*botE4).col;
          _U_temp_395_283 = (*topE2).col;
          temp_3937 = (_U_temp_394_293 < _U_temp_395_283);
        }
      }
      temp_3962 = (botE5 != 0);
      if ((temp_3962 != 0))
      {
        /** temp_396 = ((*topE).col == (*botE).col) **/
        temp_3972 = (*topE2).col;
        temp_3982 = (*botE5).col;
        temp_3963 = (temp_3972 == temp_3982);
      }
      if ((temp_3964 != 0))
      {
        tval8 = (*topE2).value;
        (*topE2).value = (*botE5).value;
        (*botE5).value = tval8;
        (*botE5).row = (*topE2).row;
        if ((realPivotE7 == botE5))
        {
          realPivotE8 = topE2;
        }
        topE3 = (*topE2).ncolE;
      }
      else
      {
        prevE17 = topE2;
        curE17 = (*topE2).nrowE;
        temp_3992 = (curE17 != 0);
        if ((temp_3992 != 0))
        {
          /** temp_399 = ((*curE).row < (*botRH).row) **/
          temp_4002 = (*curE17).row;
          temp_4012 = (*botRH4).row;
          temp_3993 = (temp_4002 < temp_4012);
        }
        while ( (temp_3995 != 0) )
        {
          prevE19 = curE18;
          curE19 = (*curE18).nrowE;
          temp_3996 = (curE19 != 0);
          if ((temp_3996 != 0))
          {
            _U_temp_400_313 = (*curE19).row;
            _U_temp_401_303 = (*botRH4).row;
            temp_3997 = (_U_temp_400_313 < _U_temp_401_303);
          }
        }
        if ((prevE20 == topE2));
        else
        {
          unlinkFromColumn9(ch5, topE2);
          linkIntoColumnBetween10(ch5, prevE20, curE20, topE2);
        }
        nextTopE2 = (*topE2).ncolE;
        unlinkFromRow11(topRH1, topE2);
        linkIntoRowBetween12(botRH4, prevBotE5, botE5, topE2);
        prevBotE6 = topE2;
        topE4 = nextTopE2;
      }
    }
    botE7 = (*botRH4).relems;
    prevTopE1 = 0;
    topE7 = (*topRH1).relems;
    ch7 = (*sm1).cols;
    while ( (botE8 != 0) )
    {
      temp_4022 = (*ch8).col;
      temp_4032 = (*botE8).col;
      while ( (temp_4023 != temp_4033) )
      {
        ch10 = (*ch9).ncolH;
        temp_4024 = (*ch10).col;
        temp_4034 = (*botE8).col;
      }
      temp_4042 = (*botE8).row;
      temp_4052 = (*botRH4).row;
      if ((temp_4042 == temp_4052))
      {
        temp_4062 = (topE8 != 0);
        if ((temp_4062 != 0))
        {
          /** temp_406 = ((*topE).col < (*botE).col) **/
          temp_4072 = (*topE8).col;
          temp_4082 = (*botE8).col;
          temp_4063 = (temp_4072 < temp_4082);
        }
        while ( (temp_4065 != 0) )
        {
          prevTopE4 = topE9;
          topE10 = (*topE9).ncolE;
          temp_4066 = (topE10 != 0);
          if ((temp_4066 != 0))
          {
            _U_temp_407_333 = (*topE10).col;
            _U_temp_408_323 = (*botE8).col;
            temp_4067 = (_U_temp_407_333 < _U_temp_408_323);
          }
        }
        prevE24 = (*botE8).prowE;
        curE24 = botE8;
        temp_4092 = (prevE24 != 0);
        if ((temp_4092 != 0))
        {
          /** temp_409 = ((*prevE).row > (*topRH).row) **/
          temp_4102 = (*prevE24).row;
          temp_4112 = (*topRH1).row;
          temp_4093 = (temp_4102 > temp_4112);
        }
        while ( (temp_4095 != 0) )
        {
          curE26 = prevE25;
          prevE26 = (*prevE25).prowE;
          temp_4096 = (prevE26 != 0);
          if ((temp_4096 != 0))
          {
            _U_temp_410_353 = (*prevE26).row;
            _U_temp_411_343 = (*topRH1).row;
            temp_4097 = (_U_temp_410_353 > _U_temp_411_343);
          }
        }
        if ((curE27 == botE8));
        else
        {
          unlinkFromColumn13(ch11, botE8);
          linkIntoColumnBetween14(ch11, prevE27, curE27, botE8);
        }
        nextBotE2 = (*botE8).ncolE;
        unlinkFromRow15(botRH4, botE8);
        linkIntoRowBetween16(topRH1, prevTopE5, topE11, botE8);
        (*botE8).row = (*topRH1).row;
        prevTopE6 = botE8;
        botE9 = nextBotE2;
      }
      else
      {
        botE10 = (*botE8).ncolE;
      }
    }
    botE13 = (*botRH4).relems;
    while ( (botE14 != 0) )
    {
      (*botE14).row = (*botRH4).row;
      botE15 = (*botE14).ncolE;
    }
  }
  return (realPivotE12);
}

void scaleRowsDueToPivot(
ElementNode_t_st70 *pivotE)
{
  local vars

  startE1 = (*pivotE1).nrowE;
  while ( (startE2 != 0) )
  {
    temp_4122 = (*startE2).value;
    if ((temp_4122 != 0.00000000000000e+00))
    {
      temp_4132 = (*pivotE1).value;
      temp_4142 = (*startE2).value;
      scaleF2 = (temp_4132 / temp_4142);
      e2 = (*startE2).ncolE;
      while ( (e3 != 0) )
      {
        temp_4153 = (*e3).value;
        (*e3).value = (temp_4153 * scaleF2);
        e4 = (*e3).ncolE;
      }
    }
    startE3 = (*startE2).nrowE;
  }
}

boolean_st43 addFillIns(
SparseMatrix_t_st67 *sm, 
ElementNode_t_st70 *pivotE)
{
  local vars

  otherPRE1 = (*pivotE1).ncolE;
  fillinList1 = 0;
  temp_4161 = (*otherPRE1).ncolE;
  while ( (temp_4162 != 0) )
  {
    startRE2 = (*pivotE1).nrowE;
    prevE2 = otherPRE2;
    curE2 = (*otherPRE2).nrowE;
    pFillin2 = 0;
    aFillin2 = fillinList2;
    while ( (startRE3 != 0) )
    {
      temp_4173 = (curE3 != 0);
      if ((temp_4173 != 0))
      {
        /** temp_417 = ((*curE).row < (*startRE).row) **/
        temp_4183 = (*curE3).row;
        temp_4193 = (*startRE3).row;
        temp_4174 = (temp_4183 < temp_4193);
      }
      while ( (temp_4176 != 0) )
      {
        prevE5 = curE4;
        curE5 = (*curE4).nrowE;
        temp_4177 = (curE5 != 0);
        if ((temp_4177 != 0))
        {
          _U_temp_418_374 = (*curE5).row;
          _U_temp_419_364 = (*startRE3).row;
          temp_4178 = (_U_temp_418_374 < _U_temp_419_364);
        }
      }
      temp_4203 = (curE6 == 0);
      if ((temp_4203 == 0))
      {
        /** temp_420 = ((*curE).row != (*startRE).row) **/
        temp_4213 = (*curE6).row;
        temp_4223 = (*startRE3).row;
        temp_4204 = (temp_4213 != temp_4223);
      }
      if ((temp_4205 != 0))
      {
        temp_4233 = (*startRE3).row;
        temp_4243 = (*otherPRE2).col;
        newE4 = newElement1(temp_4233, temp_4243, 0.00000000000000e+00);
        if ((newE4 == 0))
        {
          temp_4253 = "addFillIns: out of memory";
          temp_4263 = (char *) temp_4253;
          error2(temp_4263);
          return (0);
        }
        linkIntoColumnBetween3(0, prevE6, curE6, newE4);
        prevE7 = newE4;
        while ( (aFillin4 != 0) )
        {
          temp_4274 = (*newE4).row;
          temp_4284 = (*aFillin4).row;
          if ((temp_4274 > temp_4284))
          {
            pFillin5 = aFillin4;
            aFillin5 = (*aFillin4).ncolE;
          }
          else
          {
            /** ((*newE).row == (*aFillin).row) **/
            temp_4294 = (*newE4).row;
            temp_4304 = (*aFillin4).row;
            if ((temp_4294 == temp_4304))
            {
              /** ((*newE).col > (*aFillin).col) **/
              temp_4314 = (*newE4).col;
              temp_4324 = (*aFillin4).col;
              if ((temp_4314 > temp_4324))
              {
                pFillin6 = aFillin4;
                aFillin6 = (*aFillin4).ncolE;
              }
              else
              {
                break; 
              }
            }
            else
            {
              break; 
            }
          }
        }
        (*newE4).ncolE = aFillin10;
        if ((pFillin10 == 0))
        {
          fillinList4 = newE4;
        }
        else
        {
          (*pFillin10).ncolE = newE4;
        }
        aFillin11 = newE4;
      }
      startRE4 = (*startRE3).nrowE;
    }
    otherPRE3 = (*otherPRE2).ncolE;
    temp_4163 = (*otherPRE3).ncolE;
  }
  startRE7 = (*pivotE1).nrowE;
  while ( (fillinList9 != 0) )
  {
    temp_4332 = (*startRE8).row;
    temp_4342 = (*fillinList9).row;
    while ( (temp_4333 != temp_4343) )
    {
      startRE10 = (*startRE9).nrowE;
      temp_4334 = (*startRE10).row;
      temp_4344 = (*fillinList9).row;
    }
    prevE12 = startRE11;
    curE10 = (*startRE11).ncolE;
    temp_4352 = (fillinList9 != 0);
    if ((temp_4352 != 0))
    {
      /** temp_435 = ((*startRE).row == (*fillinList).row) **/
      temp_4362 = (*startRE11).row;
      temp_4372 = (*fillinList9).row;
      temp_4353 = (temp_4362 == temp_4372);
    }
    while ( (temp_4355 != 0) )
    {
      temp_4383 = (curE11 != 0);
      if ((temp_4383 != 0))
      {
        /** temp_438 = ((*curE).col < (*fillinList).col) **/
        temp_4393 = (*curE11).col;
        temp_4403 = (*fillinList10).col;
        temp_4384 = (temp_4393 < temp_4403);
      }
      while ( (temp_4386 != 0) )
      {
        prevE15 = curE12;
        curE13 = (*curE12).ncolE;
        temp_4387 = (curE13 != 0);
        if ((temp_4387 != 0))
        {
          _U_temp_439_394 = (*curE13).col;
          _U_temp_440_384 = (*fillinList10).col;
          temp_4388 = (_U_temp_439_394 < _U_temp_440_384);
        }
      }
      newE10 = fillinList10;
      fillinList11 = (*fillinList10).ncolE;
      linkIntoRowBetween4(0, prevE16, curE14, newE10);
      prevE17 = newE10;
      temp_4356 = (fillinList11 != 0);
      if ((temp_4356 != 0))
      {
        _U_temp_436_413 = (*startRE11).row;
        _U_temp_437_403 = (*fillinList11).row;
        temp_4357 = (_U_temp_436_413 == _U_temp_437_403);
      }
    }
  }
  return (1);
}

void eliminateColUpdateRows(
ElementNode_t_st70 *pivotE)
{
  local vars

  e1 = (*pivotE1).nrowE;
  while ( (e2 != 0) )
  {
    (*e2).value = 0.00000000000000e+00;
    e3 = (*e2).nrowE;
  }
  otherPRE1 = (*pivotE1).ncolE;
  while ( (otherPRE2 != 0) )
  {
    startE2 = (*pivotE1).nrowE;
    e6 = (*otherPRE2).nrowE;
    while ( (startE3 != 0) )
    {
      temp_4413 = (*e7).row;
      temp_4423 = (*startE3).row;
      while ( (temp_4414 != temp_4424) )
      {
        e9 = (*e8).nrowE;
        temp_4415 = (*e9).row;
        temp_4425 = (*startE3).row;
      }
      temp_4433 = (*e10).value;
      temp_4443 = (*otherPRE2).value;
      (*e10).value = (temp_4433 - temp_4443);
      startE4 = (*startE3).nrowE;
    }
    otherPRE3 = (*otherPRE2).ncolE;
  }
}

double findMaxInRow(
RowHeader_t_st68 *rh)
{
  local vars

  maxval1 = 0.00000000000000e+00;
  e1 = (*rh1).relems;
  while ( (e2 != 0) )
  {
    temp_4462 = (*e2).value;
    temp_4453 = fabs(temp_4462);
    if ((temp_4453 > maxval2))
    {
      /** maxval = fabs((*e).value) **/
      temp_4472 = (*e2).value;
      maxval4 = fabs(temp_4472);
    }
    e3 = (*e2).ncolE;
  }
  return (maxval6);
}

double findMaxInCol(
ColHeader_t_st69 *ch)
{
  local vars

  maxval1 = 0.00000000000000e+00;
  e1 = (*ch1).celems;
  while ( (e2 != 0) )
  {
    temp_4492 = (*e2).value;
    temp_4483 = fabs(temp_4492);
    if ((temp_4483 > maxval2))
    {
      /** maxval = fabs((*e).value) **/
      temp_4502 = (*e2).value;
      maxval4 = fabs(temp_4502);
    }
    e3 = (*e2).nrowE;
  }
  return (maxval6);
}

void scaleRowByDivisor(
RowHeader_t_st68 *rh, 
double scaleF)
{
  local vars

  e1 = (*rh1).relems;
  while ( (e2 != 0) )
  {
    temp_4512 = (*e2).value;
    (*e2).value = (temp_4512 / scaleF1);
    e3 = (*e2).ncolE;
  }
}

void scaleColByDivisor(
ColHeader_t_st69 *ch, 
double scaleF)
{
  local vars

  e1 = (*ch1).celems;
  while ( (e2 != 0) )
  {
    temp_4522 = (*e2).value;
    (*e2).value = (temp_4522 / scaleF1);
    e3 = (*e2).nrowE;
  }
}

ElementNode_t_st70 *newElement(
Index_t_st66 row, 
Index_t_st66 col, 
double value)
{
  local vars

  temp_4532 = malloc(32);
  newE1 = (struct ElementNode *) temp_4532;
  if ((newE1 == 0))
  {
    temp_4541 = "newElement: out of memory";
    temp_4551 = (char *) temp_4541;
    error1(temp_4551);
    return (0);
  }
  (*newE1).ncolE = 0;
  (*newE1).pcolE = 0;
  (*newE1).nrowE = 0;
  (*newE1).prowE = 0;
  (*newE1).row = row1;
  (*newE1).col = col1;
  (*newE1).value = value1;
  return (newE1);
}