
/* This file was automatically generated by pclu.*/

#include "pclu_err.h"
#include "pclu_sys.h"


extern errcode c_envOPequates();
extern errcode c_applydefn();
extern errcode c_typedefn();

/**** BEGIN PROCEDURE c_definition ****/

errcode c_definition(e, def)
CLUREF e;
CLUREF def;
    {
    errcode err;
    errcode ecode2;
    CLUREF d;
    enter_proc(6);

  LINE(7);
    {
    switch (def.cell->tag) {
    case 4: 
         {CLUREF T_1_1;
        T_1_1.num = def.cell->value;
        d.num = T_1_1.num;

  LINE(9);
            {
            err = c_envOPequates(e, d);
            if (err != ERR_ok) goto ex_0;
            }
            break;
            }
    case 1: 
         {CLUREF T_1_2;
        T_1_2.num = def.cell->value;
        d.num = T_1_2.num;

  LINE(11);
            {
            err = c_applydefn(e, d);
            if (err != ERR_ok) goto ex_0;
            }
            break;
            }
    case 3: 
         {CLUREF T_1_3;
        T_1_3.num = def.cell->value;
        d.num = T_1_3.num;

  LINE(13);
            {
            err = c_typedefn(e, d, CLU_0);
            if (err != ERR_ok) goto ex_0;
            }
            break;
            }
    case 5: 
         {CLUREF T_1_4;
        T_1_4.num = def.cell->value;
        d.num = T_1_4.num;

  LINE(15);
            {
            err = c_typedefn(e, d, CLU_1);
            if (err != ERR_ok) goto ex_0;
            }
            break;
            }
    case 2: 
         {CLUREF T_1_5;
        T_1_5.num = def.cell->value;
        d.num = T_1_5.num;

  LINE(17);
            {
            err = c_typedefn(e, d, CLU_2);
            if (err != ERR_ok) goto ex_0;
            }
            break;
            }
    }
    }
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: {signal(ERR_ok);}
    }

/**** END PROCEDURE c_definition ****/


extern errcode c_envOPset_line();
extern errcode recordOPget_7();
extern errcode c_envOPset_varlist();
extern errcode recordOPget_12();
extern errcode recordOPget_5();
extern errcode sequenceOPempty();
extern errcode recordOPget_8();
extern errcode c_new_module();
extern errcode boolOPnot();
extern errcode stringOPequal();
extern errcode duOPget_unique();
extern errcode idnOPget_str();
extern errcode idnOPcreate();
extern errcode idnOPget_kind();
extern errcode recordOPset_5();
extern errcode c_apply_specs();
extern errcode recordOPget_1();
extern errcode recordOPcopy1();
extern errcode b_applyinfo();
extern errcode fixup_new_module();
extern errcode oneofOPmake_1();
extern errcode c_apply_main();

/**** BEGIN PROCEDURE c_applydefn ****/

errcode c_applydefn(e, def)
CLUREF e;
CLUREF def;
    {
    errcode err;
    errcode ecode2;
    CLUREF i;
    CLUREF want;
    CLUREF mod;
    CLUREF specs;
    CLUREF info;
    CLUREF ninfo;
    enter_proc(21);

  LINE(22);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[6];
    err = c_envOPset_line(e, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(23);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[11];
    err = c_envOPset_varlist(e, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(24);
    {
        {CLUREF T_1_1;
        T_1_1.num = def.vec->data[4];
        i.num = T_1_1.num;
        }
        }

  LINE(26);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    T_1_1.num = def.vec->data[7];
    err = sequenceOPempty(T_1_1, &T_1_2);
    if (err != ERR_ok) goto ex_0;
    if (T_1_2.num == true) {

  LINE(27);
        {
        want.num = 2;
        }
        }
    else {

  LINE(28);
        {
        want.num = 0;
        }
        }}/* end if */

  LINE(30);
    {
        {CLUREF T_1_1;
        CLUREF T_1_2;
        err = c_new_module(e, i, want, &T_1_1, &T_1_2);
        if (err != ERR_ok) goto ex_0;
        mod.num = T_1_1.num;
        specs.num = T_1_2.num;
        }
        }

  LINE(31);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
    CLUREF T_1_4;
    err = duOPget_unique(mod, &T_1_1);
    if (err != ERR_ok) goto ex_0;
    err = idnOPget_str(i, &T_1_2);
    if (err != ERR_ok) goto ex_0;
    T_1_3.num = ((T_1_1.str->size != T_1_2.str->size)? false :
        !(bcmp(T_1_1.str->data, T_1_2.str->data, T_1_1.str->size)));
    T_1_4.num = T_1_3.num ^ 1;
    if (T_1_4.num == true) {

  LINE(32);
        {
        CLUREF T_2_1;
        CLUREF T_2_2;
        CLUREF T_2_3;
        err = duOPget_unique(mod, &T_2_1);
        if (err != ERR_ok) goto ex_0;
        err = idnOPget_kind(i, &T_2_2);
        if (err != ERR_ok) goto ex_0;
        err = idnOPcreate(T_2_1, T_2_2, &T_2_3);
        if (err != ERR_ok) goto ex_0;
        i.num = T_2_3.num;
        }

  LINE(33);
        {
        def.vec->data[4]  = i.num;
        }
        }
        }/* end if */

  LINE(35);
    {
        {CLUREF T_1_1;
        err = c_apply_specs(e, def, &T_1_1);
        if (err != ERR_ok) goto ex_0;
        info.num = T_1_1.num;
        }
        }

  LINE(37);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    T_1_1.num = info.vec->data[0];
    err = sequenceOPempty(T_1_1, &T_1_2);
    if (err != ERR_ok) goto ex_0;
    if (T_1_2.num == true) {

  LINE(38);
        {
        CLUREF T_2_1;
        generic_CLU_proc.type_owns = 0;
        generic_CLU_proc.proc = recordOPcopy1;
        CUR_PROC_VAR.proc = &generic_CLU_proc;
        err = recordOPcopy1(info, &T_2_1);
        if (err != ERR_ok) goto ex_0;
        ninfo.num = T_2_1.num;
        }
        }
    else {

  LINE(39);
        {
        CLUREF T_2_1;
        err = b_applyinfo(e, info, &T_2_1);
        if (err != ERR_ok) goto ex_0;
        ninfo.num = T_2_1.num;
        }
        }}/* end if */

  LINE(41);
    {
    CLUREF T_1_1;
    CellAlloc(1, ninfo.num, T_1_1);
    err = fixup_new_module(e, i, mod, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(42);
    {
    CLUREF T_1_1;
    T_1_1.num = info.vec->data[0];
    err = c_apply_main(e, def, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: {signal(ERR_ok);}
    }

/**** END PROCEDURE c_applydefn ****/


extern errcode duOPset_mspecs();
extern errcode oneofOPmake_2();
extern errcode idnOPset_kind();
extern errcode sequenceOPnew();
extern errcode exprOPcreate();
extern errcode oneofOPmake_3();
extern errcode recordOPget_2();
extern errcode c_envOPget_type();
extern errcode oneofOPmake_25();
extern errcode c_envOPget_type_type();

/**** BEGIN PROCEDURE fixup_new_module ****/

errcode fixup_new_module(e, i, mod, specs)
CLUREF e;
CLUREF i;
CLUREF mod;
CLUREF specs;
    {
    errcode err;
    errcode ecode2;
    CLUREF info;
    CLUREF clut;
    CLUREF x;
    CLUREF t;
    enter_proc(45);

  LINE(46);
    {
    CLUREF T_1_1;
    CellAlloc(2, specs.num, T_1_1);
    err = duOPset_mspecs(mod, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(47);
    {
    switch (specs.cell->tag) {
    case 1: 
         {CLUREF T_1_1;
        T_1_1.num = specs.cell->value;
        info.num = T_1_1.num;

  LINE(49);
            {
            CLUREF T_2_1;
            CLUREF T_2_2;
            CLUREF T_2_3;
            T_2_1.num = info.vec->data[0];
            err = sequenceOPempty(T_2_1, &T_2_2);
            if (err != ERR_ok) goto ex_0;
            T_2_3.num = T_2_2.num ^ 1;
            if (T_2_3.num == true) {

  LINE(50);
                {
                CLUREF T_3_1;
                CellAlloc(2, mod.num, T_3_1);
                err = idnOPset_kind(i, T_3_1);
                if (err != ERR_ok) goto ex_0;
                }
                }
            else {

  LINE(51);
                {
                    {CLUREF T_3_1;
                    CLUREF T_3_2;
                    RecordAlloc(2, T_3_1);
                    T_3_1.vec->data[0]  = mod.num;
                    err = sequenceOPnew(&T_3_2);
                    if (err != ERR_ok) goto ex_0;
                    T_3_1.vec->data[1]  = T_3_2.num;
                    clut.num = T_3_1.num;
                    }
                    }

  LINE(53);
                {
                    {CLUREF T_3_1;
                    CLUREF T_3_2;
                    CLUREF T_3_3;
                    CellAlloc(3, clut.num, T_3_1);
                    T_3_2.num = info.vec->data[1];
                    err = exprOPcreate(T_3_1, T_3_2, &T_3_3);
                    if (err != ERR_ok) goto ex_0;
                    x.num = T_3_3.num;
                    }
                    }

  LINE(54);
                {
                CLUREF T_3_1;
                CellAlloc(1, x.num, T_3_1);
                err = idnOPset_kind(i, T_3_1);
                if (err != ERR_ok) goto ex_0;
                }
                }}/* end if */
            break;
            }
    case 3: 
         {CLUREF T_1_2;
        T_1_2.num = specs.cell->value;
        info.num = T_1_2.num;

  LINE(57);
            {
            CLUREF T_2_1;
            CLUREF T_2_2;
            CLUREF T_2_3;
            T_2_1.num = info.vec->data[1];
            err = sequenceOPempty(T_2_1, &T_2_2);
            if (err != ERR_ok) goto ex_0;
            T_2_3.num = T_2_2.num ^ 1;
            if (T_2_3.num == true) {

  LINE(58);
                {
                CLUREF T_3_1;
                CellAlloc(2, mod.num, T_3_1);
                err = idnOPset_kind(i, T_3_1);
                if (err != ERR_ok) goto ex_0;
                }
                }
            else {

  LINE(59);
                {
                    {CLUREF T_3_1;
                    CLUREF T_3_2;
                    RecordAlloc(2, T_3_1);
                    T_3_1.vec->data[0]  = mod.num;
                    err = sequenceOPnew(&T_3_2);
                    if (err != ERR_ok) goto ex_0;
                    T_3_1.vec->data[1]  = T_3_2.num;
                    clut.num = T_3_1.num;
                    }
                    }

  LINE(61);
                {
                    {CLUREF T_3_1;
                    CLUREF T_3_2;
                    CellAlloc(3, clut.num, T_3_1);
                    err = c_envOPget_type(e, T_3_1, &T_3_2);
                    if (err != ERR_ok) goto ex_0;
                    t.num = T_3_2.num;
                    }
                    }

  LINE(62);
                {
                    {CLUREF T_3_1;
                    CLUREF T_3_2;
                    CLUREF T_3_3;
                    CellAlloc(25, t.num, T_3_1);
                    err = c_envOPget_type_type(e, &T_3_2);
                    if (err != ERR_ok) goto ex_0;
                    err = exprOPcreate(T_3_1, T_3_2, &T_3_3);
                    if (err != ERR_ok) goto ex_0;
                    x.num = T_3_3.num;
                    }
                    }

  LINE(63);
                {
                CLUREF T_3_1;
                CellAlloc(1, x.num, T_3_1);
                err = idnOPset_kind(i, T_3_1);
                if (err != ERR_ok) goto ex_0;
                }
                }}/* end if */
            break;
            }
    case 5: 
    case 2: 
         {

  LINE(66);
            {
            CLUREF T_2_1;
            CellAlloc(2, mod.num, T_2_1);
            err = idnOPset_kind(i, T_2_1);
            if (err != ERR_ok) goto ex_0;
            }
            break;
            }
    default: {
    }
    }
    }
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: {signal(ERR_ok);}
    }

/**** END PROCEDURE fixup_new_module ****/


extern errcode recordOPget_9();
extern errcode recordOPget_13();
extern errcode c_envOPbegin_specs();
extern errcode c_envOPeval_parms();
extern errcode recordOPget_3();
extern errcode c_parameters();
extern errcode c_envOPeval_equates();
extern errcode c_decllist();
extern errcode c_typelist();
extern errcode recordOPget_11();
extern errcode recordOPset_11();
extern errcode c_exceptionlist();
extern errcode c_restrictlist();
extern errcode c_add_restricts();
extern errcode sequenceOPelements();
extern errcode sequenceOPaddh();
extern errcode recordOPget_4();
extern errcode recordOPset_10();
extern errcode c_envOPend_specs();

/**** BEGIN PROCEDURE c_apply_specs ****/

errcode c_apply_specs(e, def, ret_1)
CLUREF e;
CLUREF def;
CLUREF *ret_1;
    {
    errcode err;
    errcode ecode2;
    CLUREF dparms;
    CLUREF dargs;
    CLUREF sigs;
    CLUREF reqs;
    CLUREF nparms;
    CLUREF vals;
    CLUREF args;
    CLUREF d;
    CLUREF t;
    CLUREF i;
    CLUREF at;
    enter_proc(71);

  LINE(72);
    {
        {CLUREF T_1_1;
        T_1_1.num = def.vec->data[7];
        dparms.num = T_1_1.num;
        }
        }

  LINE(73);
    {
        {CLUREF T_1_1;
        T_1_1.num = def.vec->data[0];
        dargs.num = T_1_1.num;
        }
        }

  LINE(74);
    {
        {CLUREF T_1_1;
        T_1_1.num = def.vec->data[8];
        sigs.num = T_1_1.num;
        }
        }

  LINE(75);
    {
        {CLUREF T_1_1;
        T_1_1.num = def.vec->data[12];
        reqs.num = T_1_1.num;
        }
        }

  LINE(76);
    {
    err = c_envOPbegin_specs(e);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(77);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[2];
    err = c_envOPeval_parms(e, dparms, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(78);
    {
        {CLUREF T_1_1;
        err = c_parameters(e, dparms, &T_1_1);
        if (err != ERR_ok) goto ex_0;
        nparms.num = T_1_1.num;
        }
        }

  LINE(79);
    {
    err = c_envOPeval_equates(e);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(80);
    {
    err = c_decllist(e, dargs);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(81);
    {
        {CLUREF T_1_1;
        CLUREF T_1_2;
        T_1_1.num = def.vec->data[10];
        err = c_typelist(e, T_1_1, &T_1_2);
        if (err != ERR_ok) goto ex_0;
        vals.num = T_1_2.num;
        }
        }

  LINE(82);
    {
    def.vec->data[10]  = vals.num;
    }

  LINE(83);
    {
    err = c_exceptionlist(e, sigs);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(84);
    {
    err = c_restrictlist(e, reqs);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(85);
    {
    err = c_add_restricts(e, reqs);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(86);
    {
        {CLUREF T_1_1;
        err = sequenceOPnew(&T_1_1);
        if (err != ERR_ok) goto ex_0;
        args.num = T_1_1.num;
        }
        }

  LINE(87);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
        T_1_2.num = dargs.vec->size; 
        T_1_3 = dargs;
        for (T_1_1.num = 1; T_1_1.num <= T_1_2.num; T_1_1.num++) {
            d.num = T_1_3.vec->data[T_1_1.num - 1];

  LINE(88);
            {
                {CLUREF T_2_1;
                T_2_1.num = d.vec->data[1];
                t.num = T_2_1.num;
                }
                }

  LINE(89);
            {
            CLUREF T_2_1;
            CLUREF T_2_2;
            CLUREF T_2_3;
            CLUREF T_2_4;
                T_2_1.num = d.vec->data[0];
                T_2_3.num = T_2_1.vec->size; 
                T_2_4 = T_2_1;
                for (T_2_2.num = 1; T_2_2.num <= T_2_3.num; T_2_2.num++) {
                    i.num = T_2_4.vec->data[T_2_2.num - 1];

  LINE(90);
                    {
                    CLUREF T_3_1;
                    err = sequenceOPaddh(args, t, &T_3_1);
                    if (err != ERR_ok) goto ex_0;
                    args.num = T_3_1.num;
                    }
                }
            }
            end_inline_for_2:;
        }
    }
    end_inline_for_1:;

  LINE(93);
    {
        {CLUREF T_1_1;
        CLUREF T_1_2;
        RecordAlloc(4, T_1_1);
        T_1_2.num = def.vec->data[3];
        T_1_1.vec->data[1]  = T_1_2.num;
        T_1_1.vec->data[0]  = args.num;
        T_1_1.vec->data[3]  = vals.num;
        T_1_1.vec->data[2]  = sigs.num;
        at.num = T_1_1.num;
        }
        }

  LINE(97);
    {
        {CLUREF T_1_1;
        CLUREF T_1_2;
        CellAlloc(2, at.num, T_1_1);
        err = c_envOPget_type(e, T_1_1, &T_1_2);
        if (err != ERR_ok) goto ex_0;
        t.num = T_1_2.num;
        }
        }

  LINE(98);
    {
    def.vec->data[9]  = t.num;
    }

  LINE(99);
    {
    err = c_envOPend_specs(e);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(100);
    {
    {
    CLUREF T_1_1;
    RecordAlloc(2, T_1_1);
    T_1_1.vec->data[0]  = nparms.num;
    T_1_1.vec->data[1]  = t.num;
    ret_1->num = T_1_1.num;
    }
    {signal (ERR_ok);}}
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: elist[0].str = no_return_values_STRING;
        {signal(ERR_failure);}
    }

/**** END PROCEDURE c_apply_specs ****/


extern errcode b_get_idn();

/**** BEGIN PROCEDURE c_parameters ****/

errcode c_parameters(e, decls, ret_1)
CLUREF e;
CLUREF decls;
CLUREF *ret_1;
    {
    errcode err;
    errcode ecode2;
    CLUREF nparms;
    CLUREF d;
    CLUREF i;
    enter_proc(104);

  LINE(105);
    {
        {CLUREF T_1_1;
        err = sequenceOPnew(&T_1_1);
        if (err != ERR_ok) goto ex_0;
        nparms.num = T_1_1.num;
        }
        }

  LINE(106);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
        T_1_2.num = decls.vec->size; 
        T_1_3 = decls;
        for (T_1_1.num = 1; T_1_1.num <= T_1_2.num; T_1_1.num++) {
            d.num = T_1_3.vec->data[T_1_1.num - 1];

  LINE(107);
            {
            CLUREF T_2_1;
            CLUREF T_2_2;
            CLUREF T_2_3;
            CLUREF T_2_4;
                T_2_1.num = d.vec->data[0];
                T_2_3.num = T_2_1.vec->size; 
                T_2_4 = T_2_1;
                for (T_2_2.num = 1; T_2_2.num <= T_2_3.num; T_2_2.num++) {
                    i.num = T_2_4.vec->data[T_2_2.num - 1];

  LINE(108);
                    {
                    CLUREF T_3_1;
                    CLUREF T_3_2;
                    err = b_get_idn(e, i, &T_3_1);
                    if (err != ERR_ok) goto ex_0;
                    err = sequenceOPaddh(nparms, T_3_1, &T_3_2);
                    if (err != ERR_ok) goto ex_0;
                    nparms.num = T_3_2.num;
                    }
                }
            }
            end_inline_for_2:;
        }
    }
    end_inline_for_1:;

  LINE(111);
    {
    {
    ret_1->num = nparms.num;
    }
    {signal (ERR_ok);}}
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: elist[0].str = no_return_values_STRING;
        {signal(ERR_failure);}
    }

/**** END PROCEDURE c_parameters ****/


extern errcode c_envOPbegin_scope();
extern errcode c_push_parms();
extern errcode c_envOPbegin_recheck();
extern errcode c_type();
extern errcode recordOPget_10();
extern errcode typespecOPget_abs();
extern errcode c_envOPnew_apply();
extern errcode c_envOPend_recheck();
extern errcode c_initlist();
extern errcode recordOPget_6();
extern errcode arrayOPtrim();
extern errcode c_stmt();
extern errcode c_envOPend_scope();

/**** BEGIN PROCEDURE c_apply_main ****/

errcode c_apply_main(e, def, nparms)
CLUREF e;
CLUREF def;
CLUREF nparms;
    {
    errcode err;
    errcode ecode2;
    CLUREF at;
    CLUREF ta;
    CLUREF s;
    enter_proc(114);

  LINE(115);
    {
    err = c_envOPbegin_scope(e);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(116);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[7];
    err = c_push_parms(e, T_1_1, nparms);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(117);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    err = sequenceOPempty(nparms, &T_1_1);
    if (err != ERR_ok) goto ex_0;
    T_1_2.num = T_1_1.num ^ 1;
    err = c_envOPbegin_recheck(e, T_1_2);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(118);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[0];
    err = c_decllist(e, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(119);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    T_1_1.num = def.vec->data[10];
    err = c_typelist(e, T_1_1, &T_1_2);
    if (err != ERR_ok) goto ex_0;
    def.vec->data[10]  = T_1_2.num;
    }

  LINE(120);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[8];
    err = c_exceptionlist(e, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(121);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[12];
    err = c_restrictlist(e, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(122);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[2];
    err = c_envOPequates(e, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(123);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[6];
    err = c_envOPset_line(e, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(124);
    {
        {CLUREF T_1_1;
        CLUREF T_1_2;
        T_1_1.num = def.vec->data[9];
        err = c_type(e, T_1_1, &T_1_2);
        if (err != ERR_ok) goto ex_0;
        at.num = T_1_2.num;
        }
        }

  LINE(125);
    {
    def.vec->data[9]  = at.num;
    }

  LINE(126);
    {
    CLUREF T_1_1;
    err = typespecOPget_abs(at, &T_1_1);
    if (err != ERR_ok) goto ex_0;
    switch (T_1_1.cell->tag) {
    case 2: 
         {CLUREF T_1_2;
        T_1_2.num = T_1_1.cell->value;
        ta.num = T_1_2.num;

  LINE(128);
            {
            err = c_envOPnew_apply(e, ta);
            if (err != ERR_ok) goto ex_0;
            }
            break;
            }
    default: {
    }
    }
    }

  LINE(131);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    err = sequenceOPempty(nparms, &T_1_1);
    if (err != ERR_ok) goto ex_0;
    T_1_2.num = T_1_1.num ^ 1;
    err = c_envOPend_recheck(e, T_1_2);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(132);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[5];
    err = c_initlist(e, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(133);
    {
    CLUREF T_1_1;
    T_1_1.num = def.vec->data[11];
    err = arrayOPtrim(T_1_1, CLU_1, CLU_0);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(134);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
    CLUREF T_1_4;
        T_1_1.num = def.vec->data[1];
        T_1_3.num = T_1_1.vec->size; 
        T_1_4 = T_1_1;
        for (T_1_2.num = 1; T_1_2.num <= T_1_3.num; T_1_2.num++) {
            s.num = T_1_4.vec->data[T_1_2.num - 1];

  LINE(135);
            {
            err = c_stmt(e, s);
            if (err != ERR_ok) goto ex_0;
            }
        }
    }
    end_inline_for_1:;

  LINE(137);
    {
    err = c_envOPend_scope(e);
    if (err != ERR_ok) goto ex_0;
    }
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: {signal(ERR_ok);}
    }

/**** END PROCEDURE c_apply_main ****/


extern errcode sequenceOPfetch();
extern errcode c_envOPpush_parm();
extern errcode c_envOPscopify();
extern errcode intOPadd();
extern errcode recordOPset_1();

/**** BEGIN PROCEDURE c_push_parms ****/

errcode c_push_parms(e, decls, nparms)
CLUREF e;
CLUREF decls;
CLUREF nparms;
    {
    errcode err;
    errcode ecode2;
    CLUREF n;
    CLUREF d;
    CLUREF nidns;
    CLUREF i;
    CLUREF nparm;
    enter_proc(140);

  LINE(141);
    {
        {n.num = 1;
        }
        }

  LINE(142);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
        T_1_2.num = decls.vec->size; 
        T_1_3 = decls;
        for (T_1_1.num = 1; T_1_1.num <= T_1_2.num; T_1_1.num++) {
            d.num = T_1_3.vec->data[T_1_1.num - 1];

  LINE(143);
            {
                {CLUREF T_2_1;
                err = sequenceOPnew(&T_2_1);
                if (err != ERR_ok) goto ex_0;
                nidns.num = T_2_1.num;
                }
                }

  LINE(144);
            {
            CLUREF T_2_1;
            CLUREF T_2_2;
            CLUREF T_2_3;
            CLUREF T_2_4;
                T_2_1.num = d.vec->data[0];
                T_2_3.num = T_2_1.vec->size; 
                T_2_4 = T_2_1;
                for (T_2_2.num = 1; T_2_2.num <= T_2_3.num; T_2_2.num++) {
                    i.num = T_2_4.vec->data[T_2_2.num - 1];

  LINE(145);
                    {
                        {CLUREF T_3_1;
                        if (n.num < 1 || n.num > nparms.vec->size ) {
                            err = ERR_bounds;
                            goto ex_0;}
                        T_3_1.num = nparms.vec->data[n.num - 1];
                        nparm.num = T_3_1.num;
                        }
                        }

  LINE(146);
                    {
                    err = c_envOPpush_parm(e, i, nparm);
                    if (err != ERR_ok) goto ex_0;
                    }

  LINE(147);
                    {
                    CLUREF T_3_1;
                    err = sequenceOPaddh(nidns, nparm, &T_3_1);
                    if (err != ERR_ok) goto ex_0;
                    nidns.num = T_3_1.num;
                    }

  LINE(148);
                    {
                    err = c_envOPscopify(e, nparm);
                    if (err != ERR_ok) goto ex_0;
                    }

  LINE(149);
                    {
                    CLUREF T_3_1;
                    T_3_1.num = n.num + 1;
                     if ((T_3_1.num > 0 && n.num < 0 && 1 < 0) || 
                         (T_3_1.num < 0 && n.num > 0 && 1 > 0)) {
                        err = ERR_overflow;
                        goto ex_0;}
                    n.num = T_3_1.num;
                    }
                }
            }
            end_inline_for_2:;

  LINE(151);
            {
            d.vec->data[0]  = nidns.num;
            }
        }
    }
    end_inline_for_1:;
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: {signal(ERR_ok);}
    }

/**** END PROCEDURE c_push_parms ****/


extern errcode c_own_decls();
extern errcode sequenceOPe2s();
extern errcode c_declinit();
extern errcode c_envOPwarn1();
CLUREF STR_no_040own_040variables_040initialized_077;
static int c_initlist_own_init = 0;

/**** BEGIN PROCEDURE c_initlist ****/

errcode c_initlist(e, inits)
CLUREF e;
CLUREF inits;
    {
    errcode err;
    errcode ecode2;
    CLUREF ok;
    CLUREF i;
    CLUREF d;
    CLUREF di;
        if (c_initlist_own_init == 0) {
        stringOPcons("no own variables initialized?", CLU_1, CLU_29, &STR_no_040own_040variables_040initialized_077);
        c_initlist_own_init = 1;
    }
    enter_proc(155);

  LINE(156);
    {
        {ok.tf = false;
        }
        }

  LINE(157);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
        T_1_2.num = inits.vec->size; 
        T_1_3 = inits;
        for (T_1_1.num = 1; T_1_1.num <= T_1_2.num; T_1_1.num++) {
            i.num = T_1_3.vec->data[T_1_1.num - 1];

  LINE(158);
            {
            CLUREF T_2_1;
            T_2_1.num = i.vec->data[0];
            err = c_envOPset_line(e, T_2_1);
            if (err != ERR_ok) goto ex_0;
            }

  LINE(159);
            {
            CLUREF T_2_1;
            T_2_1.num = i.vec->data[1];
            switch (T_2_1.cell->tag) {
            case 1: 
                 {CLUREF T_2_2;
                T_2_2.num = T_2_1.cell->value;
                d.num = T_2_2.num;

  LINE(161);
                    {
                    CLUREF T_3_1;
                    err = sequenceOPe2s(d, &T_3_1);
                    if (err != ERR_ok) goto ex_0;
                    err = c_own_decls(e, T_3_1);
                    if (err != ERR_ok) goto ex_0;
                    }
                    break;
                    }
            case 2: 
                 {CLUREF T_2_3;
                T_2_3.num = T_2_1.cell->value;
                di.num = T_2_3.num;

  LINE(163);
                    {
                    ok.tf = true;
                    }

  LINE(164);
                    {
                    err = c_declinit(e, di, CLU_1);
                    if (err != ERR_ok) goto ex_0;
                    }
                    break;
                    }
            }
            }
        }
    }
    end_inline_for_1:;

  LINE(167);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
    T_1_1.num = ok.num;
    if (!ok.num) {
        err = sequenceOPempty(inits, &T_1_2);
        if (err != ERR_ok) goto ex_0;
        T_1_1.num = T_1_2.num;
    }
    T_1_3.num = T_1_1.num ^ 1;
    if (T_1_3.num == true) {

  LINE(168);
        {
        err = c_envOPwarn1(e, STR_no_040own_040variables_040initialized_077);
        if (err != ERR_ok) goto ex_0;
        }
        }
        }/* end if */
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: {signal(ERR_ok);}
    }

/**** END PROCEDURE c_initlist ****/


extern errcode c_operdecllist();
extern errcode recordOPset_2();
extern errcode c_idn_set();
extern errcode c_xtypeset();
extern errcode b_operdecllist();
extern errcode c_envOPerr();
CLUREF STR__047;
CLUREF STR__047_040not_040a_040type_040parameter;
static int c_restrictlist_own_init = 0;

/**** BEGIN PROCEDURE c_restrictlist ****/

errcode c_restrictlist(e, reqs)
CLUREF e;
CLUREF reqs;
    {
    errcode err;
    errcode ecode2;
    CLUREF req;
    CLUREF i;
    CLUREF rk;
    CLUREF ts;
        if (c_restrictlist_own_init == 0) {
        stringOPcons("\'", CLU_1, CLU_1, &STR__047);
        stringOPcons("\' not a type parameter", CLU_1, CLU_22, &STR__047_040not_040a_040type_040parameter);
        c_restrictlist_own_init = 1;
    }
    enter_proc(171);

  LINE(172);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
        T_1_2.num = reqs.vec->size; 
        T_1_3 = reqs;
        for (T_1_1.num = 1; T_1_1.num <= T_1_2.num; T_1_1.num++) {
            req.num = T_1_3.vec->data[T_1_1.num - 1];

  LINE(173);
            {
            CLUREF T_2_1;
            T_2_1.num = req.vec->data[2];
            err = c_envOPset_line(e, T_2_1);
            if (err != ERR_ok) goto ex_0;
            }

  LINE(174);
            {
                {CLUREF T_2_1;
                CLUREF T_2_2;
                T_2_1.num = req.vec->data[0];
                err = b_get_idn(e, T_2_1, &T_2_2);
                if (err != ERR_ok) goto ex_0;
                i.num = T_2_2.num;
                }
                }

  LINE(175);
            {
            req.vec->data[0]  = i.num;
            }

  LINE(176);
            {
            CLUREF T_2_1;
            err = idnOPget_kind(i, &T_2_1);
            if (err != ERR_ok) goto ex_0;
            switch (T_2_1.cell->tag) {
            case 6: 
            case 5: 
                 {

  LINE(178);
                    {
                    CLUREF T_3_1;
                    T_3_1.num = req.vec->data[1];
                    switch (T_3_1.cell->tag) {
                    case 1: 
                         {CLUREF T_3_2;
                        T_3_2.num = T_3_1.cell->value;
                        rk.num = T_3_2.num;

  LINE(180);
                            {
                            err = c_operdecllist(e, rk);
                            if (err != ERR_ok) goto ex_0;
                            }
                            break;
                            }
                    case 2: 
                         {CLUREF T_3_3;
                        T_3_3.num = T_3_1.cell->value;
                        rk.num = T_3_3.num;

  LINE(182);
                            {
                            CLUREF T_4_1;
                            CLUREF T_4_2;
                            err = c_idn_set(e, i, rk, &T_4_1);
                            if (err != ERR_ok) goto ex_0;
                            CellAlloc(1, T_4_1.num, T_4_2);
                            req.vec->data[1]  = T_4_2.num;
                            }
                            break;
                            }
                    case 3: 
                         {CLUREF T_3_4;
                        T_3_4.num = T_3_1.cell->value;
                        rk.num = T_3_4.num;

  LINE(184);
                            {
                                {CLUREF T_4_1;
                                err = c_xtypeset(e, rk, &T_4_1);
                                if (err != ERR_ok) goto ex_0;
                                ts.num = T_4_1.num;
                                }
                                }

  LINE(185);
                            {
                            CLUREF T_4_1;
                            CLUREF T_4_2;
                            err = b_operdecllist(e, i, ts, &T_4_1);
                            if (err != ERR_ok) goto ex_0;
                            CellAlloc(1, T_4_1.num, T_4_2);
                            req.vec->data[1]  = T_4_2.num;
                            }
                            break;
                            }
                    }
                    }
                    break;
                    }
            default: {

  LINE(188);
                {
                CLUREF T_3_1;
                CLUREF T_3_2;
                sequenceOPnew2(CLU_3, &T_3_1);
                T_3_1.vec->data[0] = STR__047.num;
                err = idnOPget_str(i, &T_3_2);
                if (err != ERR_ok) goto ex_0;
                T_3_1.vec->data[1] = T_3_2.num;
                T_3_1.vec->data[2] = STR__047_040not_040a_040type_040parameter.num;
                err = c_envOPerr(e, T_3_1);
                if (err != ERR_ok) goto ex_0;
                }
            }
            }
            }
        }
    }
    end_inline_for_1:;
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: {signal(ERR_ok);}
    }

/**** END PROCEDURE c_restrictlist ****/


extern errcode c_envOPlookup();
CLUREF STR__047_040does_040not_040name_040a_040type_137set;
static int c_idn_set_own_init = 0;

/**** BEGIN PROCEDURE c_idn_set ****/

errcode c_idn_set(e, i, set, ret_1)
CLUREF e;
CLUREF i;
CLUREF set;
CLUREF *ret_1;
    {
    errcode err;
    errcode ecode2;
    CLUREF k;
        if (c_idn_set_own_init == 0) {
        stringOPcons("\'", CLU_1, CLU_1, &STR__047);
        stringOPcons("\' does not name a type_set", CLU_1, CLU_26, &STR__047_040does_040not_040name_040a_040type_137set);
        c_idn_set_own_init = 1;
    }
    enter_proc(193);

  LINE(194);
    {
    CLUREF T_1_1;
    err = idnOPget_kind(set, &T_1_1);
    if (err != ERR_ok) goto ex_0;
    switch (T_1_1.cell->tag) {
    case 7: 
         {CLUREF T_1_2;
        T_1_2.num = T_1_1.cell->value;
        k.num = T_1_2.num;

  LINE(196);
            {
            {
            CLUREF T_2_1;
            err = b_operdecllist(e, i, k, &T_2_1);
            if (err != ERR_ok) goto ex_0;
            ret_1->num = T_2_1.num;
            }
            {signal (ERR_ok);}}
            break;
            }
    case 8: 
         {

  LINE(198);
            {
            err = c_envOPlookup(e, set, CLU_2);
            if (err != ERR_ok) goto ex_0;
            }

  LINE(199);
            {
            {
            CLUREF T_2_1;
            err = c_idn_set(e, i, set, &T_2_1);
            if (err != ERR_ok) goto ex_0;
            ret_1->num = T_2_1.num;
            }
            {signal (ERR_ok);}}
            break;
            }
    default: {
    }
    }
    }

  LINE(202);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    sequenceOPnew2(CLU_3, &T_1_1);
    T_1_1.vec->data[0] = STR__047.num;
    err = idnOPget_str(set, &T_1_2);
    if (err != ERR_ok) goto ex_0;
    T_1_1.vec->data[1] = T_1_2.num;
    T_1_1.vec->data[2] = STR__047_040does_040not_040name_040a_040type_137set.num;
    err = c_envOPerr(e, T_1_1);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(203);
    {
    {
    CLUREF T_1_1;
    err = sequenceOPnew(&T_1_1);
    if (err != ERR_ok) goto ex_0;
    ret_1->num = T_1_1.num;
    }
    {signal (ERR_ok);}}
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: elist[0].str = no_return_values_STRING;
        {signal(ERR_failure);}
    }

/**** END PROCEDURE c_idn_set ****/


extern errcode c_constlist();
extern errcode recordOPset_3();

/**** BEGIN PROCEDURE c_operdecllist ****/

errcode c_operdecllist(e, opers)
CLUREF e;
CLUREF opers;
    {
    errcode err;
    errcode ecode2;
    CLUREF opd;
    CLUREF ops;
    enter_proc(206);

  LINE(207);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
        T_1_2.num = opers.vec->size; 
        T_1_3 = opers;
        for (T_1_1.num = 1; T_1_1.num <= T_1_2.num; T_1_1.num++) {
            opd.num = T_1_3.vec->data[T_1_1.num - 1];

  LINE(208);
            {
            CLUREF T_2_1;
            T_2_1.num = opd.vec->data[0];
            err = c_envOPset_line(e, T_2_1);
            if (err != ERR_ok) goto ex_0;
            }

  LINE(209);
            {
            CLUREF T_2_1;
            CLUREF T_2_2;
            CLUREF T_2_3;
            CLUREF T_2_4;
                T_2_1.num = opd.vec->data[1];
                T_2_3.num = T_2_1.vec->size; 
                T_2_4 = T_2_1;
                for (T_2_2.num = 1; T_2_2.num <= T_2_3.num; T_2_2.num++) {
                    ops.num = T_2_4.vec->data[T_2_2.num - 1];

  LINE(210);
                    {
                    CLUREF T_3_1;
                    CLUREF T_3_2;
                    T_3_1.num = ops.vec->data[1];
                    err = c_constlist(e, T_3_1, &T_3_2);
                    if (err != ERR_ok) goto ex_0;
                    ops.vec->data[1]  = T_3_2.num;
                    }

  LINE(211);
                    {
                    CLUREF T_3_1;
                    CLUREF T_3_2;
                    T_3_1.num = ops.vec->data[2];
                    err = c_type(e, T_3_1, &T_3_2);
                    if (err != ERR_ok) goto ex_0;
                    ops.vec->data[2]  = T_3_2.num;
                    }
                }
            }
            end_inline_for_2:;
        }
    }
    end_inline_for_1:;
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: {signal(ERR_ok);}
    }

/**** END PROCEDURE c_operdecllist ****/


extern errcode c_add_opspecs();

/**** BEGIN PROCEDURE c_add_restricts ****/

errcode c_add_restricts(e, reqs)
CLUREF e;
CLUREF reqs;
    {
    errcode err;
    errcode ecode2;
    CLUREF rest;
    CLUREF rk;
    enter_proc(216);

  LINE(217);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
        T_1_2.num = reqs.vec->size; 
        T_1_3 = reqs;
        for (T_1_1.num = 1; T_1_1.num <= T_1_2.num; T_1_1.num++) {
            rest.num = T_1_3.vec->data[T_1_1.num - 1];

  LINE(218);
            {
            CLUREF T_2_1;
            T_2_1.num = rest.vec->data[1];
            switch (T_2_1.cell->tag) {
            case 1: 
                 {CLUREF T_2_2;
                T_2_2.num = T_2_1.cell->value;
                rk.num = T_2_2.num;

  LINE(220);
                    {
                    CLUREF T_3_1;
                    T_3_1.num = rest.vec->data[0];
                    err = c_add_opspecs(e, T_3_1, rk);
                    if (err != ERR_ok) goto ex_0;
                    }
                    break;
                    }
            default: {
            }
            }
            }
        }
    }
    end_inline_for_1:;
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: {signal(ERR_ok);}
    }

/**** END PROCEDURE c_add_restricts ****/


extern errcode oneofOPmake_6();
extern errcode c_new_requires();
extern errcode oneofOPmake_5();

/**** BEGIN PROCEDURE c_add_opspecs ****/

errcode c_add_opspecs(e, i, ops)
CLUREF e;
CLUREF i;
CLUREF ops;
    {
    errcode err;
    errcode ecode2;
    CLUREF k;
    enter_proc(226);

  LINE(227);
    {
    CLUREF T_1_1;
    err = idnOPget_kind(i, &T_1_1);
    if (err != ERR_ok) goto ex_0;
    switch (T_1_1.cell->tag) {
    case 6: 
         {CLUREF T_1_2;
        T_1_2.num = T_1_1.cell->value;
        k.num = T_1_2.num;

  LINE(229);
            {
            CLUREF T_2_1;
            CLUREF T_2_2;
            err = c_new_requires(k, ops, &T_2_1);
            if (err != ERR_ok) goto ex_0;
            CellAlloc(6, T_2_1.num, T_2_2);
            err = idnOPset_kind(i, T_2_2);
            if (err != ERR_ok) goto ex_0;
            }
            break;
            }
    case 5: 
         {CLUREF T_1_3;
        T_1_3.num = T_1_1.cell->value;
        k.num = T_1_3.num;

  LINE(231);
            {
            CLUREF T_2_1;
            CLUREF T_2_2;
            err = c_new_requires(k, ops, &T_2_1);
            if (err != ERR_ok) goto ex_0;
            CellAlloc(5, T_2_1.num, T_2_2);
            err = idnOPset_kind(i, T_2_2);
            if (err != ERR_ok) goto ex_0;
            }
            break;
            }
    default: {
    }
    }
    }
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: {signal(ERR_ok);}
    }

/**** END PROCEDURE c_add_opspecs ****/



/**** BEGIN PROCEDURE c_new_requires ****/

errcode c_new_requires(specs, opers, ret_1)
CLUREF specs;
CLUREF opers;
CLUREF *ret_1;
    {
    errcode err;
    errcode ecode2;
    CLUREF opd;
    CLUREF ops;
    enter_proc(236);

  LINE(238);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CLUREF T_1_3;
        T_1_2.num = opers.vec->size; 
        T_1_3 = opers;
        for (T_1_1.num = 1; T_1_1.num <= T_1_2.num; T_1_1.num++) {
            opd.num = T_1_3.vec->data[T_1_1.num - 1];

  LINE(239);
            {
            CLUREF T_2_1;
            CLUREF T_2_2;
            CLUREF T_2_3;
            CLUREF T_2_4;
                T_2_1.num = opd.vec->data[1];
                T_2_3.num = T_2_1.vec->size; 
                T_2_4 = T_2_1;
                for (T_2_2.num = 1; T_2_2.num <= T_2_3.num; T_2_2.num++) {
                    ops.num = T_2_4.vec->data[T_2_2.num - 1];

  LINE(240);
                    {
                    CLUREF T_3_1;
                    err = sequenceOPaddh(specs, ops, &T_3_1);
                    if (err != ERR_ok) goto ex_0;
                    specs.num = T_3_1.num;
                    }
                }
            }
            end_inline_for_2:;
        }
    }
    end_inline_for_1:;

  LINE(243);
    {
    {
    ret_1->num = specs.num;
    }
    {signal (ERR_ok);}}
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: elist[0].str = no_return_values_STRING;
        {signal(ERR_failure);}
    }

/**** END PROCEDURE c_new_requires ****/


extern errcode oneofOPis_8();
extern errcode c_envOPpop_undefined();
extern errcode c_module_idn();
extern errcode c_envOPget_du();
extern errcode xlibOPget_du();
extern errcode c_envOPdeclare();
extern errcode c_get_idnkind();
extern errcode c_envOPset_mod_gen();
extern errcode duOPget_mspecs();
extern errcode oneofOPmake_4();

/**** BEGIN PROCEDURE c_new_module ****/

errcode c_new_module(e, mod, want, ret_1, ret_2)
CLUREF e;
CLUREF mod;
CLUREF want;
CLUREF *ret_1;
CLUREF *ret_2;
    {
    errcode err;
    errcode ecode2;
    CLUREF gen;
    CLUREF specs;
    enter_proc(246);

  LINE(247);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    err = idnOPget_kind(mod, &T_1_1);
    if (err != ERR_ok) goto ex_0;
    if (T_1_1.cell->tag == 8) T_1_2.num = true; else T_1_2.num = false;
    if (T_1_2.num == true) {

  LINE(248);
        {
        err = c_envOPlookup(e, mod, want);
        if (err != ERR_ok) goto ex_0;
        }

  LINE(249);
        {
        CLUREF T_2_1;
        err = c_envOPpop_undefined(e, &T_2_1);
        if (err != ERR_ok) goto ex_0;
        }
        }
        }/* end if */

  LINE(251);
    {
        {CLUREF T_2_1;
        err = c_module_idn(mod, &T_2_1);
        if (err != ERR_ok) goto ex_1;
        gen.num = T_2_1.num;
        }
        }
        goto end_1;
        ex_1:
            if ((err == ERR_no_du)) {

  LINE(253);
                {
                CLUREF T_2_1;
                CLUREF T_2_2;
                CLUREF T_2_3;
                err = idnOPget_str(mod, &T_2_1);
                if (err != ERR_ok) goto ex_0;
                err = xlibOPget_du(T_2_1, &T_2_2);
                if (err != ERR_ok) goto ex_0;
                err = c_envOPget_du(e, T_2_2, &T_2_3);
                if (err != ERR_ok) goto ex_0;
                gen.num = T_2_3.num;
                }

  LINE(254);
                {
                CLUREF T_2_1;
                err = c_get_idnkind(e, gen, want, &T_2_1);
                if (err != ERR_ok) goto ex_0;
                err = c_envOPdeclare(e, mod, T_2_1);
                if (err != ERR_ok) goto ex_0;
                }
            }
            else {
                goto ex_0;
            }
        end_1:;

  LINE(256);
    {
    err = c_envOPset_mod_gen(e, gen);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(257);
    {
        {CLUREF T_1_1;
        err = duOPget_mspecs(gen, &T_1_1);
        if (err != ERR_ok) goto ex_0;
        specs.num = T_1_1.num;
        }
        }

  LINE(258);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    CellAlloc(4, nil, T_1_1);
    CellAlloc(2, T_1_1.num, T_1_2);
    err = duOPset_mspecs(gen, T_1_2);
    if (err != ERR_ok) goto ex_0;
    }

  LINE(259);
    {
    {
    ret_1->num = gen.num;
    }
    {
    ret_2->num = specs.num;
    }
    {signal (ERR_ok);}}
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: elist[0].str = no_return_values_STRING;
        {signal(ERR_failure);}
    }

/**** END PROCEDURE c_new_module ****/


extern errcode exprOPget_abs();

/**** BEGIN PROCEDURE c_module_idn ****/

errcode c_module_idn(mod, ret_1)
CLUREF mod;
CLUREF *ret_1;
    {
    errcode err;
    errcode ecode2;
    CLUREF k;
    CLUREF xa;
    CLUREF ta;
    enter_proc(262);

  LINE(263);
    {
    CLUREF T_1_1;
    err = idnOPget_kind(mod, &T_1_1);
    if (err != ERR_ok) goto ex_0;
    switch (T_1_1.cell->tag) {
    case 2: 
         {CLUREF T_1_2;
        T_1_2.num = T_1_1.cell->value;
        k.num = T_1_2.num;

  LINE(265);
            {
            {
            ret_1->num = k.num;
            }
            {signal (ERR_ok);}}
            break;
            }
    case 1: 
         {CLUREF T_1_3;
        T_1_3.num = T_1_1.cell->value;
        k.num = T_1_3.num;

  LINE(267);
            {
            CLUREF T_2_1;
            err = exprOPget_abs(k, &T_2_1);
            if (err != ERR_ok) goto ex_0;
            switch (T_2_1.cell->tag) {
            case 25: 
                 {CLUREF T_2_2;
                T_2_2.num = T_2_1.cell->value;
                xa.num = T_2_2.num;

  LINE(269);
                    {
                    CLUREF T_3_1;
                    err = typespecOPget_abs(xa, &T_3_1);
                    if (err != ERR_ok) goto ex_0;
                    switch (T_3_1.cell->tag) {
                    case 3: 
                         {CLUREF T_3_2;
                        T_3_2.num = T_3_1.cell->value;
                        ta.num = T_3_2.num;

  LINE(271);
                            {
                            CLUREF T_4_1;
                            CLUREF T_4_2;
                            T_4_1.num = ta.vec->data[1];
                            err = sequenceOPempty(T_4_1, &T_4_2);
                            if (err != ERR_ok) goto ex_0;
                            if (T_4_2.num == true) {

  LINE(272);
                                {
                                {
                                CLUREF T_5_1;
                                T_5_1.num = ta.vec->data[0];
                                ret_1->num = T_5_1.num;
                                }
                                {signal (ERR_ok);}}
                                }
                                }/* end if */
                            break;
                            }
                    default: {
                    }
                    }
                    }
                    break;
                    }
            case 3: 
                 {CLUREF T_2_3;
                T_2_3.num = T_2_1.cell->value;
                xa.num = T_2_3.num;

  LINE(276);
                    {
                    CLUREF T_3_1;
                    CLUREF T_3_2;
                    T_3_1.num = xa.vec->data[1];
                    err = sequenceOPempty(T_3_1, &T_3_2);
                    if (err != ERR_ok) goto ex_0;
                    if (T_3_2.num == true) {

  LINE(277);
                        {
                        {
                        CLUREF T_4_1;
                        T_4_1.num = xa.vec->data[0];
                        ret_1->num = T_4_1.num;
                        }
                        {signal (ERR_ok);}}
                        }
                        }/* end if */
                    break;
                    }
            default: {
            }
            }
            }
            break;
            }
    default: {
    }
    }
    }

  LINE(282);
    {
    {signal (ERR_no_du);}}
    goto end_0;
    ex_0:
        {
            if (err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(err);
            {signal(ERR_failure);}
        }
    end_0: elist[0].str = no_return_values_STRING;
        {signal(ERR_failure);}
    }

/**** END PROCEDURE c_module_idn ****/

