

#include "BUILTIN.h"
extern OBJ __APartName_2;
extern OBJ _APartName_28(OBJ);extern OBJ __APartName_28;
extern OBJ __APartName_60;
extern OBJ __APartName_61;
extern OBJ _AAbsyFun2_4(OBJ,OBJ,OBJ);extern OBJ __AAbsyFun2_4;
extern OBJ _ACompose_4(OBJ,OBJ,OBJ);extern OBJ __ACompose_4;
extern OBJ _ADEBUG_2(OBJ,OBJ,OBJ);extern OBJ __ADEBUG_2;
extern OBJ _ADEBUG_10(OBJ);extern OBJ __ADEBUG_10;

#include "Denotation.h"
extern TUP2 _AGlobSig4SigAna_14(OBJ,OBJ);extern OBJ __AGlobSig4SigAna_14;
extern TUP2 _AGlobSig4SigAna_15(OBJ,OBJ);extern OBJ __AGlobSig4SigAna_15;
extern TUP2 _AGlobSig4SigAna_16(OBJ,OBJ);extern OBJ __AGlobSig4SigAna_16;
extern OBJ _AGlobSig4SigAna_17(OBJ,OBJ);extern OBJ __AGlobSig4SigAna_17;
extern OBJ _AImpDecl4SigAna_2(OBJ,OBJ,OBJ);extern OBJ __AImpDecl4SigAna_2;
extern OBJ _AImpDecl4SigAna_3(OBJ,OBJ,OBJ);extern OBJ __AImpDecl4SigAna_3;
extern OBJ _AImpDecl4SigAna_4(OBJ,OBJ,OBJ);extern OBJ __AImpDecl4SigAna_4;
extern OBJ _AImpDecl4SigAna_6(OBJ,OBJ,OBJ);extern OBJ __AImpDecl4SigAna_6;
extern OBJ _AImpDecl4SigAna_22(OBJ,OBJ,OBJ);extern OBJ __AImpDecl4SigAna_22;
extern OBJ _AImpDecl4SigAna_24(OBJ,OBJ,OBJ);extern OBJ __AImpDecl4SigAna_24;
extern TUP2 _AImpDecl4SigAna_26(OBJ,OBJ,OBJ);extern OBJ __AImpDecl4SigAna_26;
extern OBJ _AIsFlatInst_1(OBJ,OBJ,OBJ);extern OBJ __AIsFlatInst_1;
extern OBJ _APartNameEntry_12(OBJ);extern OBJ __APartNameEntry_12;
extern OBJ _APartNameEntry_58(OBJ);extern OBJ __APartNameEntry_58;
extern OBJ _APartNameEntry_59(OBJ);extern OBJ __APartNameEntry_59;
extern OBJ _AMySeqFun1_17(OBJ);extern OBJ __AMySeqFun1_17;
extern OBJ _AName4SigAna_35(OBJ,OBJ);extern OBJ __AName4SigAna_35;
extern OBJ _AName4SigAna_36(OBJ,OBJ);extern OBJ __AName4SigAna_36;
extern OBJ _AName4SigAna_37(OBJ,OBJ,OBJ);extern OBJ __AName4SigAna_37;
extern OBJ _AName4SigAna_43(OBJ,OBJ);extern OBJ __AName4SigAna_43;
extern OBJ _AName4SigAna_45(OBJ,OBJ);extern OBJ __AName4SigAna_45;
extern OBJ _AName4SigAna_46(OBJ,OBJ);extern OBJ __AName4SigAna_46;
extern OBJ _AName4SigAna_47(OBJ,OBJ);extern OBJ __AName4SigAna_47;
extern OBJ _AName4SigAna_48(OBJ,OBJ,OBJ);extern OBJ __AName4SigAna_48;
extern OBJ _AName4SigAna_52(OBJ);extern OBJ __AName4SigAna_52;
extern OBJ _AName4SigAna_53(OBJ);extern OBJ __AName4SigAna_53;
extern OBJ _AName4SigAna_56(OBJ,OBJ);extern OBJ __AName4SigAna_56;
extern OBJ __AObjects_30;
extern OBJ __AObjects_34;
extern OBJ _AObjects_37(OBJ,OBJ);extern OBJ __AObjects_37;
extern OBJ _ASeqConv_3(OBJ,OBJ,OBJ,OBJ,OBJ);extern OBJ __ASeqConv_3;
extern OBJ __ASeqConv_8;
extern OBJ _AName_12(OBJ);extern OBJ __AName_12;
extern OBJ _ASeqFilter_2(OBJ,OBJ);extern OBJ __ASeqFilter_2;
extern TUP2 _ASeqFilter_5(OBJ,OBJ);extern OBJ __ASeqFilter_5;
extern TUP2 _ASeqMapEnv_4(OBJ,OBJ,OBJ);extern OBJ __ASeqMapEnv_4;
extern OBJ __ARep_13;
extern OBJ __ARep_187;
extern OBJ _ASeqMap_3(OBJ,OBJ);extern OBJ __ASeqMap_3;
extern OBJ __APragma_5;
extern OBJ _ASeqOfSeq_2(OBJ);extern OBJ __ASeqOfSeq_2;
extern OBJ _ASeqZip_4(OBJ,OBJ,OBJ);extern OBJ __ASeqZip_4;
extern OBJ __AOcPos_35;
extern OBJ __AOption_5;
extern OBJ __APair_2;
extern OBJ __ASeq_6;
extern OBJ _ASeq_42(OBJ,OBJ);extern OBJ __ASeq_42;

#include "Nat.h"

#include "Int.h"

#include "Char.h"

#include "Bitset.h"

#include "Array.h"
extern OBJ _AFlattenCandidateSets_1(OBJ,OBJ);OBJ __AFlattenCandidateSets_1; /* flattenCandidateSets */
extern TUP2 _AFlattenCandidateSets_2(OBJ,OBJ);OBJ __AFlattenCandidateSets_2; /* h7 */
extern TUP3 _AFlattenCandidateSets_3(OBJ,OBJ,OBJ,OBJ);OBJ __AFlattenCandidateSets_3; /* flattenOnlyPN */
extern TUP2 _AFlattenCandidateSets_4(OBJ,OBJ);OBJ __AFlattenCandidateSets_4; /* h8 */
extern TUP2 _AFlattenCandidateSets_5(OBJ,OBJ);OBJ __AFlattenCandidateSets_5; /* flattenInstPN */
extern TUP2 _AFlattenCandidateSets_6(OBJ,OBJ);OBJ __AFlattenCandidateSets_6; /* flattenPN2 */
extern TUP3 _AFlattenCandidateSets_7(OBJ,OBJ,OBJ);OBJ __AFlattenCandidateSets_7; /* flattenPN */
extern TUP2 _AFlattenCandidateSets_8(OBJ,OBJ);OBJ __AFlattenCandidateSets_8; /* h1 */
extern TUP2 _AFlattenCandidateSets_9(OBJ,OBJ,OBJ);OBJ __AFlattenCandidateSets_9; /* h2 */
extern OBJ _AFlattenCandidateSets_10(OBJ,OBJ,OBJ);OBJ __AFlattenCandidateSets_10; /* h3 */
extern OBJ _AFlattenCandidateSets_11(OBJ);OBJ __AFlattenCandidateSets_11; /* h22 */
extern OBJ _AFlattenCandidateSets_12(OBJ,OBJ,OBJ);OBJ __AFlattenCandidateSets_12; /* treatGenerics */
extern OBJ _AFlattenCandidateSets_13(OBJ,OBJ);OBJ __AFlattenCandidateSets_13; /* isNotGenericInst */
extern OBJ _AFlattenCandidateSets_14(OBJ,OBJ,OBJ);OBJ __AFlattenCandidateSets_14; /* isNotGeneric */
extern OBJ _AFlattenCandidateSets_15(OBJ,OBJ);OBJ __AFlattenCandidateSets_15; /* flatSortPN */
extern OBJ _AFlattenCandidateSets_16(OBJ,OBJ,OBJ);OBJ __AFlattenCandidateSets_16; /* isNotGeneric'16 */
OBJ __AFlattenCandidateSets_17; /* flattenInstPN'17 */
extern OBJ _AFlattenCandidateSets_18(OBJ);OBJ __AFlattenCandidateSets_18; /* flattenInstPN'18 */
extern OBJ _AFlattenCandidateSets_19(OBJ);OBJ __AFlattenCandidateSets_19; /* flattenInstPN'19 */
OBJ __AFlattenCandidateSets_20; /* flattenInstPN'20 */
extern OBJ _AFlattenCandidateSets_21(OBJ,OBJ);OBJ __AFlattenCandidateSets_21; /* flattenInstPN'21 */
OBJ __AFlattenCandidateSets_22; /* flattenInstPN'22 */
extern OBJ _AFlattenCandidateSets_23(OBJ,OBJ);OBJ __AFlattenCandidateSets_23; /* flattenInstPN'23 */
extern OBJ _AFlattenCandidateSets_24(OBJ);OBJ __AFlattenCandidateSets_24; /* flattenInstPN'24 */
OBJ __AFlattenCandidateSets_25; /* flattenInstPN'25 */
OBJ __AFlattenCandidateSets_26; /* flattenInstPN'26 */
OBJ __AFlattenCandidateSets_27; /* flattenInstPN'27 */
extern OBJ _AFlattenCandidateSets_28(OBJ,OBJ);OBJ __AFlattenCandidateSets_28; /* flattenInstPN'28 */
OBJ __AFlattenCandidateSets_29; /* h7'29 */
OBJ __AFlattenCandidateSets_30; /* flattenOnlyPN'30 */

extern OBJ _AFlattenCandidateSets_1(OBJ x1,OBJ x2) /* flattenCandidateSets */
{OBJ r;
 CPCLS(__AFlattenCandidateSets_2,1);
 CPCLS(__AFlattenCandidateSets_3,1);
 CPCLS(__AFlattenCandidateSets_4,1);
 CPCLS(__AFlattenCandidateSets_5,1);
 {TUP2 x4;TUP2 x7;TUP2 x10;
  x4=_AGlobSig4SigAna_14(__AFlattenCandidateSets_4,x2);
  x7=_AGlobSig4SigAna_16(__AFlattenCandidateSets_3,x4.c1);
  x10=_AGlobSig4SigAna_15(__AFlattenCandidateSets_5,x7.c1);
  r=_AGlobSig4SigAna_17(__AFlattenCandidateSets_2,x10.c1);}
 return r;}

extern TUP2 _AFlattenCandidateSets_2(OBJ x1,OBJ x2) /* h7 */
{TUP2 r;
 {OBJ x14=FLD1(x2,1);OBJ x15;
  if(EXPRD(x2,1)){
   COPY(__AFlattenCandidateSets_29,1);
   {TUP3 x18;
    x18=_AFlattenCandidateSets_7(x1,x14,__AFlattenCandidateSets_29);r.c1=x18.c1;
    RSOME(x2,r.c2);FLD1(r.c2,1)=x18.c3;}
  }else{
   x15=FLD1(x2,2);CPPRD(x14,1);CPPRD(x15,1);
   COPY(__AFlattenCandidateSets_29,1);
   {TUP3 x18;
    x18=_AFlattenCandidateSets_7(x1,x14,__AFlattenCandidateSets_29);r.c1=x18.c1;
    FRPRD(x2,1);PRD1(2,r.c2);FLD1(r.c2,1)=x18.c3;FLD1(r.c2,2)=x15;}}}
 return r;}
extern OBJ _AFlattenCandidateSets_2_c(OBJ x1,OBJ x2) /* h7 */
{OBJ r;
 {TUP2 t=_AFlattenCandidateSets_2(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern TUP3 _AFlattenCandidateSets_3(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* flattenOnlyPN */
{TUP3 r;
 {OBJ x16=FLD1(x4,1);OBJ x17;
  if(EXPRD(x4,1)){
   COPY(__AFlattenCandidateSets_30,1);
   {
    RSOME(x4,r.c3);
    {TUP3 t=_AFlattenCandidateSets_7(x1,x16,__AFlattenCandidateSets_30);
     r.c1=t.c1;
     r.c2=t.c2;
     FLD1(r.c3,1)=t.c3;}}
  }else{
   x17=FLD1(x4,2);CPPRD(x16,1);CPPRD(x17,1);
   COPY(__AFlattenCandidateSets_30,1);
   {
    FRPRD(x4,1);PRD1(2,r.c3);FLD1(r.c3,2)=x17;
    {TUP3 t=_AFlattenCandidateSets_7(x1,x16,__AFlattenCandidateSets_30);
     r.c1=t.c1;
     r.c2=t.c2;
     FLD1(r.c3,1)=t.c3;}}}}
 return r;}
extern OBJ _AFlattenCandidateSets_3_c(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* flattenOnlyPN */
{OBJ r;
 {TUP3 t=_AFlattenCandidateSets_3(x1,x2,x3,x4);
  PRD1(3,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;
  FLD1(r,3)=t.c3;}
 return r;}

extern TUP2 _AFlattenCandidateSets_4(OBJ x1,OBJ x2) /* h8 */
{TUP2 r;
 COPY(x1,2);
 CPPRD(x2,2);
 {OBJ x3;OBJ x4;TUP3 x6;
  x3=_AName4SigAna_35(x1,x2);
  x4=_AName4SigAna_36(x1,x2);
  x6=_AFlattenCandidateSets_7(x1,x3,x4);r.c2=x6.c2;
  r.c1=_AName4SigAna_37(x6.c1,x2,x6.c3);}
 return r;}
extern OBJ _AFlattenCandidateSets_4_c(OBJ x1,OBJ x2) /* h8 */
{OBJ r;
 {TUP2 t=_AFlattenCandidateSets_4(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern TUP2 _AFlattenCandidateSets_5(OBJ x1,OBJ x2) /* flattenInstPN */
{TUP2 r;
 COPY(x1,1);
 CPPRD(x2,1);
 {OBJ x3;
  x3=_AName4SigAna_47(x1,x2);
  if(ISTGPRM(x3,1)){
   FRPRD(x2,1);
   r.c1=x1;r.c2=__ABUILTIN_5;
  }else{
   COPY(x1,4);
   CPPRD(x2,3);
   CPCLS(__AFlattenCandidateSets_6,1);
   CPCLS(__AFlattenCandidateSets_18,1);
   CPCLS(__AFlattenCandidateSets_19,1);
   CPCLS(__AFlattenCandidateSets_21,1);
   CPCLS(__AFlattenCandidateSets_23,1);
   CPPRD(__APair_2,1);
   CPCLS(__ACompose_4,1);
   CPCLS(__AIsFlatInst_1,1);
   {OBJ x4;OBJ x5;OBJ x6;OBJ x7;OBJ x8;OBJ x9;OBJ x10;OBJ x11;OBJ x12;OBJ x13;OBJ x14;OBJ x15;TUP2 x17;OBJ x19;
    x4=_AName4SigAna_46(x1,x2);
    COPY(x4,1);
    x5=_AName4SigAna_43(x1,x2);
    COPY(x5,1);
    x6=(*(OBJ(*)(OBJ,OBJ))METHOD(__AFlattenCandidateSets_18,1))(__AFlattenCandidateSets_18,__ABUILTIN_20);
    PRD1(2,x7);FLD1(x7,1)=x1;FLD1(x7,2)=__ABUILTIN_5;
    x8=_AName4SigAna_45(x1,x2);
    x9=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__AIsFlatInst_1,2))(__AIsFlatInst_1,x1,x8);
    x10=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ACompose_4,2))(__ACompose_4,x9,__AFlattenCandidateSets_19);
    x11=(*(OBJ(*)(OBJ,OBJ))METHOD(__AFlattenCandidateSets_21,1))(__AFlattenCandidateSets_21,x5);
    x12=(*(OBJ(*)(OBJ,OBJ))METHOD(__AFlattenCandidateSets_23,1))(__AFlattenCandidateSets_23,x4);
    x13=_ADEBUG_2(x6,x11,x5);
    x14=_ADEBUG_2(x6,x12,x4);
    x15=_ASeqZip_4(__APair_2,x13,x14);
    x17=_ASeqMapEnv_4(__AFlattenCandidateSets_6,x7,x15);
    x19=_AMySeqFun1_17(x17.c2);
    {OBJ x30=FLD1(x17.c1,1);OBJ x31=FLD1(x17.c1,2);
     if(EXPRD(x17.c1,1)){
      r.c2=x31;
      DSPRDF(x17.c1);
     }else{
      COPY(x30,1);
      r.c2=x31;
      FRPRD(x17.c1,1);}
     CPCLS(__AFlattenCandidateSets_28,1);
     {OBJ x32;OBJ x33;OBJ x34;
      x32=_ASeqFilter_2(x10,x19);
      COPY(x32,1);
      x33=(*(OBJ(*)(OBJ,OBJ))METHOD(__AFlattenCandidateSets_28,1))(__AFlattenCandidateSets_28,x32);
      x34=_ADEBUG_2(x6,x33,x32);
      r.c1=_AName4SigAna_48(x30,x2,x34);}}}}}
 return r;}
extern OBJ _AFlattenCandidateSets_5_c(OBJ x1,OBJ x2) /* flattenInstPN */
{OBJ r;
 {TUP2 t=_AFlattenCandidateSets_5(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern TUP2 _AFlattenCandidateSets_6(OBJ x1,OBJ x2) /* flattenPN2 */
{TUP2 r;
 {OBJ x30=FLD1(x2,1);OBJ x31=FLD1(x2,2);FLAG x_x2=EXPRD(x2,1);
  if(x_x2){
  }else{
   CPPRD(x30,1);COPY(x31,1);}
  {OBJ x53=FLD1(x1,1);OBJ x54=FLD1(x1,2);
   if(EXPRD(x1,1)){
    DSPRDF(x1);
   }else{
    COPY(x53,1);
    FRPRD(x1,1);}
   {TUP3 x56;OBJ x67;OBJ x68;OBJ x69;
    x56=_AFlattenCandidateSets_7(x53,x30,x31);
    if(ISTGPRD(x56.c3,1)){
     {OBJ x60=FLD(x56.c3,2);
      if(EXPRD(x56.c3,1)){
       x67=x60;
       FRPRD(FLD(x56.c3,1),1);DSPRDF(x56.c3);
      }else{
       COPY(x60,1);
       x67=x60;
       FRPRD(x56.c3,1);}}
    }else{
     HLT("PartNameEntry at <unknown> : undefined selection flatPN\'PartNameEntry:pN->seq");}
    if(ISTGPRM(x56.c2,1)){
     x68=x54;r.c2=x67;
    }else{
     r.c2=x67;
     x68=__ABUILTIN_3;}
    if(x_x2){
     RSOME(x2,r.c1);FLD1(r.c1,1)=x56.c1;FLD1(r.c1,2)=x68;
    }else{
     FRPRD(x2,1);PRD1(2,r.c1);FLD1(r.c1,1)=x56.c1;FLD1(r.c1,2)=x68;}}}}
 return r;}
extern OBJ _AFlattenCandidateSets_6_c(OBJ x1,OBJ x2) /* flattenPN2 */
{OBJ r;
 {TUP2 t=_AFlattenCandidateSets_6(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern TUP3 _AFlattenCandidateSets_7(OBJ x1,OBJ x2,OBJ x3) /* flattenPN */
{TUP3 r;
 if(ISTGPRD(x2,1)){
  FREE(x3,1);
  r.c1=x1;r.c2=__ABUILTIN_5;r.c3=x2;
 }else{
  {OBJ x68=FLD(x2,1);OBJ x69=FLD(x2,2);
   CPPRD(x68,1);COPY(x69,1);
   COPY(x1,1);
   CPPRD(x2,1);
   CPCLS(__AFlattenCandidateSets_12,1);
   {OBJ x71;OBJ x72;OBJ x74;OBJ x73;OBJ x81;OBJ x82;OBJ x83;OBJ x84;OBJ x86;OBJ x87;OBJ x88;
    x71=_AName4SigAna_52(x2);
    x72=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__AFlattenCandidateSets_12,2))(__AFlattenCandidateSets_12,x1,x3);
    if(ISTGPRM(x71,1)){
     x74=__ABUILTIN_3;
    }else{
     x74=__ABUILTIN_5;}
    x73=_ASeqMap_3(x72,x69);
    if(ISTGPRM(x74,1)){
     CPCLS(__AFlattenCandidateSets_8,1);
     CPCLS(__AFlattenCandidateSets_10,1);
     x81=x1;x82=__AOption_5;
    }else{
     if(ISPRM(x73)){
      CPCLS(__AFlattenCandidateSets_8,1);
      CPCLS(__AFlattenCandidateSets_10,1);
      x81=x1;x82=__AOption_5;
     }else{
      CPPRD(x2,1);
      CPCLS(__AFlattenCandidateSets_8,1);
      CPCLS(__AFlattenCandidateSets_10,1);
      CPCLS(__AFlattenCandidateSets_15,1);
      {OBJ x77;
       x77=_AName4SigAna_53(x2);
       COPY(x77,1);
       x81=_AAbsyFun2_4(__AFlattenCandidateSets_15,x1,x77);
       PRD1(1,x82);FLD1(x82,1)=x77;}}}
    x83=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__AFlattenCandidateSets_10,2))(__AFlattenCandidateSets_10,x82,x68);
    PRD1(2,x84);FLD1(x84,1)=x81;FLD1(x84,2)=x74;
    {TUP2 t=_ASeqMapEnv_4(__AFlattenCandidateSets_8,x84,x73);
     x86=t.c1;
     x87=t.c2;}
    x88=_ASeqOfSeq_2(x87);
    {OBJ x89=FLD1(x86,1);OBJ x90=FLD1(x86,2);
     if(EXPRD(x86,1)){
      r.c1=x89;r.c2=x90;
      DSPRDF(x86);
     }else{
      COPY(x89,1);
      r.c1=x89;r.c2=x90;
      FRPRD(x86,1);}
     {OBJ x91;
      x91=_ASeqMap_3(x83,x88);
      r.c3=_AName4SigAna_56(x2,x91);}}}}}
 return r;}
extern OBJ _AFlattenCandidateSets_7_c(OBJ x1,OBJ x2,OBJ x3) /* flattenPN */
{OBJ r;
 {TUP3 t=_AFlattenCandidateSets_7(x1,x2,x3);
  PRD1(3,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;
  FLD1(r,3)=t.c3;}
 return r;}

extern TUP2 _AFlattenCandidateSets_8(OBJ x1,OBJ x2) /* h1 */
{TUP2 r;
 {OBJ x12=FLD1(x2,1);OBJ x13=FLD1(x2,2);
  if(EXPRD(x2,1)){
   CPPRD(x13,1);
   DSPRDF(x2);
  }else{
   COPY(x12,1);CPPRD(x13,2);
   FRPRD(x2,1);}
  CPPRD(__AObjects_34,1);
  {OBJ x14;
   x14=_AObjects_37(x13,__AObjects_34);
   if(ISTGPRM(x14,1)){
    FRPRD(x13,1);
    CPCLS(__AFlattenCandidateSets_11,1);
    r.c2=_ASeqMap_3(__AFlattenCandidateSets_11,x12);
    r.c1=x1;
   }else{
    CPCLS(__AFlattenCandidateSets_9,1);
    {OBJ x16;
     x16=(*(OBJ(*)(OBJ,OBJ))METHOD(__AFlattenCandidateSets_9,1))(__AFlattenCandidateSets_9,x13);
     r=_ASeqMapEnv_4(x16,x1,x12);}}}}
 return r;}
extern OBJ _AFlattenCandidateSets_8_c(OBJ x1,OBJ x2) /* h1 */
{OBJ r;
 {TUP2 t=_AFlattenCandidateSets_8(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern TUP2 _AFlattenCandidateSets_9(OBJ x1,OBJ x2,OBJ x3) /* h2 */
{TUP2 r;
 CPPRD(x1,1);
 {OBJ x10;
  PRD1(2,x10);FLD1(x10,1)=x3;FLD1(x10,2)=x1;
  {OBJ x16=FLD1(x2,1);OBJ x17=FLD1(x2,2);
   if(EXPRD(x2,1)){
    {TUP2 x19;OBJ x21;OBJ x22;
     x19=_AFlattenCandidateSets_5(x16,x1);
     if(ISTGPRM(x19.c2,1)){
      r.c2=x10;x21=x17;
     }else{
      r.c2=x10;
      x21=__ABUILTIN_3;}
     RSOME(x2,r.c1);FLD1(r.c1,1)=x19.c1;FLD1(r.c1,2)=x21;}
   }else{
    COPY(x16,1);
    {TUP2 x19;OBJ x21;OBJ x22;
     x19=_AFlattenCandidateSets_5(x16,x1);
     if(ISTGPRM(x19.c2,1)){
      r.c2=x10;x21=x17;
     }else{
      r.c2=x10;
      x21=__ABUILTIN_3;}
     FRPRD(x2,1);PRD1(2,r.c1);FLD1(r.c1,1)=x19.c1;FLD1(r.c1,2)=x21;}}}}
 return r;}
extern OBJ _AFlattenCandidateSets_9_c(OBJ x1,OBJ x2,OBJ x3) /* h2 */
{OBJ r;
 {TUP2 t=_AFlattenCandidateSets_9(x1,x2,x3);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _AFlattenCandidateSets_10(OBJ x1,OBJ x2,OBJ x3) /* h3 */
{OBJ r;
 {OBJ x10=FLD1(x3,1);OBJ x11=FLD1(x3,2);
  if(EXPRD(x3,1)){
   DSPRDF(x3);
  }else{
   COPY(x10,1);CPPRD(x11,1);
   FRPRD(x3,1);}
  PRD1(4,r);FLD1(r,1)=x10;FLD1(r,2)=x11;FLD1(r,3)=x1;FLD1(r,4)=x2;}
 return r;}

extern OBJ _AFlattenCandidateSets_11(OBJ x1) /* h22 */
{OBJ r;
 CPPRD(__AObjects_34,1);
 PRD1(2,r);FLD1(r,1)=x1;FLD1(r,2)=__AObjects_34;
 return r;}

extern OBJ _AFlattenCandidateSets_12(OBJ x1,OBJ x2,OBJ x3) /* treatGenerics */
{OBJ r;
 {OBJ x70=FLD1(x3,1);OBJ x71=FLD1(x3,2);
  if(EXPRD(x3,1)){
   {OBJ x79;OBJ x82;OBJ x96;
    if(ISPRM(x2)){
     HLT("PartName at <unknown> : undefined selection paramS\'PartName:partName->seq");
    }else{
     {OBJ x74=FLD1(x2,3);
      if(EXPRD(x2,1)){
       x79=x74;
       FLD1(x2,3)=NIL;DSPRD(x2);
      }else{
       COPY(x74,1);
       x79=x74;
       FRPRD(x2,1);}}}
    if(ISPRM(x79)){
     x82=__ABUILTIN_5;
    }else{
     if(EXPRD(x79,1)){
      DSPRD(x79);
     }else{
      DCPRD(x79,1);}
     x82=__ABUILTIN_3;}
    if(ISTGPRM(x82,1)){
     x96=x70;
     FREE(x1,1);
    }else{
     if(ISPRM(x70)){
      x96=x70;
      FREE(x1,1);
     }else{
      {OBJ x84=FLD1(x70,2);
       COPY(x84,1);
       if(ISPRM(x84)){
	x96=x70;
	FREE(x1,1);
       }else{
	CPCLS(__AFlattenCandidateSets_13,1);
	{OBJ x87;TUP2 x89;
	 x87=(*(OBJ(*)(OBJ,OBJ))METHOD(__AFlattenCandidateSets_13,1))(__AFlattenCandidateSets_13,x1);
	 x89=_ASeqFilter_5(x87,x70);
	 if(ISPRM(x89.c1)){
	  {OBJ x93;
	   if(ISPRM(x89.c2)){
	    HLT("Seq at <unknown> : undefined selection ft\'Seq:seq->data");
	   }else{
	    {OBJ x91=FLD1(x89.c2,1);
	     if(EXPRD(x89.c2,1)){
	      x93=x91;
	      FREE(FLD1(x89.c2,2),1);DSPRDF(x89.c2);
	     }else{
	      COPY(x91,1);
	      x93=x91;
	      FRPRD(x89.c2,1);}}}
	   if(EXPRD(x84,1)){
	    RSOME(x84,x96);FREE(FLD1(x96,1),1);FLD1(x96,1)=x93;FREE(FLD1(x96,2),1);FLD1(x96,2)=__ASeq_6;
	   }else{
	    DCPRD(x84,1);PRD1(2,x96);FLD1(x96,1)=x93;FLD1(x96,2)=__ASeq_6;}}
	 }else{
	  if(EXPRD(x84,1)){
	   DSPRD(x84);
	  }else{
	   DCPRD(x84,1);}
	  x96=x89.c1;
	  FREE(x89.c2,1);}}}}}}
    RSOME(x3,r);FLD1(r,1)=x96;}
  }else{
   COPY(x70,1);CPPRD(x71,1);
   {OBJ x79;OBJ x82;OBJ x96;
    if(ISPRM(x2)){
     HLT("PartName at <unknown> : undefined selection paramS\'PartName:partName->seq");
    }else{
     {OBJ x74=FLD1(x2,3);
      if(EXPRD(x2,1)){
       x79=x74;
       FLD1(x2,3)=NIL;DSPRD(x2);
      }else{
       COPY(x74,1);
       x79=x74;
       FRPRD(x2,1);}}}
    if(ISPRM(x79)){
     x82=__ABUILTIN_5;
    }else{
     if(EXPRD(x79,1)){
      DSPRD(x79);
     }else{
      DCPRD(x79,1);}
     x82=__ABUILTIN_3;}
    if(ISTGPRM(x82,1)){
     x96=x70;
     FREE(x1,1);
    }else{
     if(ISPRM(x70)){
      x96=x70;
      FREE(x1,1);
     }else{
      {OBJ x84=FLD1(x70,2);
       COPY(x84,1);
       if(ISPRM(x84)){
	x96=x70;
	FREE(x1,1);
       }else{
	CPCLS(__AFlattenCandidateSets_13,1);
	{OBJ x87;TUP2 x89;
	 x87=(*(OBJ(*)(OBJ,OBJ))METHOD(__AFlattenCandidateSets_13,1))(__AFlattenCandidateSets_13,x1);
	 x89=_ASeqFilter_5(x87,x70);
	 if(ISPRM(x89.c1)){
	  {OBJ x93;
	   if(ISPRM(x89.c2)){
	    HLT("Seq at <unknown> : undefined selection ft\'Seq:seq->data");
	   }else{
	    {OBJ x91=FLD1(x89.c2,1);
	     if(EXPRD(x89.c2,1)){
	      x93=x91;
	      FREE(FLD1(x89.c2,2),1);DSPRDF(x89.c2);
	     }else{
	      COPY(x91,1);
	      x93=x91;
	      FRPRD(x89.c2,1);}}}
	   if(EXPRD(x84,1)){
	    RSOME(x84,x96);FREE(FLD1(x96,1),1);FLD1(x96,1)=x93;FREE(FLD1(x96,2),1);FLD1(x96,2)=__ASeq_6;
	   }else{
	    DCPRD(x84,1);PRD1(2,x96);FLD1(x96,1)=x93;FLD1(x96,2)=__ASeq_6;}}
	 }else{
	  if(EXPRD(x84,1)){
	   DSPRD(x84);
	  }else{
	   DCPRD(x84,1);}
	  x96=x89.c1;
	  FREE(x89.c2,1);}}}}}}
    FRPRD(x3,1);PRD1(2,r);FLD1(r,1)=x96;FLD1(r,2)=x71;}}}
 return r;}

extern OBJ _AFlattenCandidateSets_13(OBJ x1,OBJ x2) /* isNotGenericInst */
{OBJ r;
 if(ISPRD(x2)&&(ISTGPRD(x2,1))){
  if(EXPRD(x2,1)){
   DSPRDF(x2);
  }else{
   DCPRD(x2,1);}
  FREE(x1,1);
  r=__ABUILTIN_5;
 }else{
  if(ISPRD(x2)&&(ISTGPRD(x2,2))){
   {OBJ x23=FLD(x2,3);
    {OBJ x24;
     ANat_76(x23,__AObjects_30,x24);
     if(ISTGPRM(x24,1)){
      FREE(x1,1);
      if(EXPRD(x2,1)){
       DSPRDF(x2);
      }else{
       DCPRD(x2,1);}
      r=__ABUILTIN_5;
     }else{
      {OBJ x25;
       x25=_AName_12(x2);
       r=_AFlattenCandidateSets_14(x1,x25,x23);}}}}
  }else{
   HLT("FlattenCandidateSets at <185,12-188,49> : missing else in isNotGenericInst\'FlattenCandidateSets:globSig->name->bool");}}
 return r;}

extern OBJ _AFlattenCandidateSets_14(register OBJ x1,register OBJ x2,register OBJ x3) /* isNotGeneric */
{OBJ r;
 for(;;){
  COPY(x1,1);
  {OBJ x4;
   x4=_AImpDecl4SigAna_4(x1,x2,x3);
   if(ISTGPRM(x4,1)){
    FREE(x1,1);
    r=__ABUILTIN_3;
   }else{
    COPY(x1,1);
    {OBJ x5;
     x5=_AImpDecl4SigAna_2(x1,x2,x3);
     if(ISTGPRM(x5,1)){
      COPY(x1,1);
      {TUP2 x13;
       x13=_AImpDecl4SigAna_26(x1,x2,x3);
       x2=x13.c1;x3=x13.c2;continue;}
     }else{
      COPY(x1,1);
      {OBJ x16;
       x16=_AImpDecl4SigAna_6(x1,x2,x3);
       if(ISTGPRM(x16,1)){
	COPY(x1,1);
	CPCLS(__AFlattenCandidateSets_13,1);
	{OBJ x17;OBJ x18;
	 x17=(*(OBJ(*)(OBJ,OBJ))METHOD(__AFlattenCandidateSets_13,1))(__AFlattenCandidateSets_13,x1);
	 x18=_AImpDecl4SigAna_22(x1,x2,x3);
	 r=_ASeq_42(x17,x18);}
       }else{
	COPY(x1,1);
	{OBJ x19;
	 x19=_AImpDecl4SigAna_3(x1,x2,x3);
	 if(ISTGPRM(x19,1)){
	  COPY(x1,1);
	  CPCLS(__AFlattenCandidateSets_16,1);
	  {OBJ x20;OBJ x21;
	   x20=_AImpDecl4SigAna_24(x1,x2,x3);
	   x21=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__AFlattenCandidateSets_16,2))(__AFlattenCandidateSets_16,x1,x2);
	   r=_ASeq_42(x21,x20);}
	 }else{
	  FREE(x1,1);
	  r=__ABUILTIN_5;}}}}}}}}
  break;}
 return r;}

extern OBJ _AFlattenCandidateSets_15(OBJ x1,OBJ x2) /* flatSortPN */
{OBJ r;
 CPPRD(x1,2);
 COPY(x2,2);
 {OBJ x3;OBJ x4;TUP3 x6;
  x3=_AName4SigAna_35(x2,x1);
  x4=_AName4SigAna_36(x2,x1);
  x6=_AFlattenCandidateSets_7(x2,x3,x4);
  r=_AName4SigAna_37(x6.c1,x1,x6.c3);}
 return r;}

extern OBJ _AFlattenCandidateSets_16(OBJ x1,OBJ x2,OBJ x3) /* isNotGeneric'16 */
{OBJ r;
 r=_AFlattenCandidateSets_14(x1,x2,x3);
 return r;}

extern OBJ _AFlattenCandidateSets_18(OBJ x1) /* flattenInstPN'18 */
{OBJ r;
 CPPRD(__AFlattenCandidateSets_17,1);
 r=_ADEBUG_10(__AFlattenCandidateSets_17);
 return r;}

extern OBJ _AFlattenCandidateSets_19(OBJ x1) /* flattenInstPN'19 */
{OBJ r;
 CPCLS(__APartNameEntry_12,1);
 r=_ASeqMap_3(__APartNameEntry_12,x1);
 return r;}

extern OBJ _AFlattenCandidateSets_21(OBJ x1,OBJ x2) /* flattenInstPN'21 */
{OBJ r;
 CPPRD(__AFlattenCandidateSets_20,1);
 CPCLS(__APartNameEntry_59,1);
 CPPRD(__APartName_60,1);
 CPPRD(__APartName_61,1);
 CPPRD(__ASeqConv_8,1);
 {OBJ x3;
  x3=_ASeqConv_3(__APartName_61,__ASeqConv_8,__APartName_60,__APartNameEntry_59,x1);
  ADenotation_4(__AFlattenCandidateSets_20,x3,r);}
 return r;}

extern OBJ _AFlattenCandidateSets_23(OBJ x1,OBJ x2) /* flattenInstPN'23 */
{OBJ r;
 CPPRD(__AFlattenCandidateSets_22,1);
 CPCLS(__APartName_28,1);
 CPPRD(__APartName_60,1);
 CPPRD(__APartName_61,1);
 CPPRD(__ASeqConv_8,1);
 {OBJ x3;
  x3=_ASeqConv_3(__APartName_61,__ASeqConv_8,__APartName_60,__APartName_28,x1);
  ADenotation_4(__AFlattenCandidateSets_22,x3,r);}
 return r;}

extern OBJ _AFlattenCandidateSets_24(OBJ x1) /* flattenInstPN'24 */
{OBJ r;
 CPCLS(__APartNameEntry_58,1);
 CPPRD(__APartName_60,1);
 CPPRD(__APartName_61,1);
 CPCLS(__ASeqConv_3,1);
 CPPRD(__ASeqConv_8,1);
 r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ,OBJ))METHOD(__ASeqConv_3,4))(__ASeqConv_3,__APartName_61,__ASeqConv_8,__APartName_60,__APartNameEntry_58);
 return r;}

extern OBJ _AFlattenCandidateSets_28(OBJ x1,OBJ x2) /* flattenInstPN'28 */
{OBJ r;
 CPCLS(__AFlattenCandidateSets_24,1);
 CPPRD(__AFlattenCandidateSets_25,1);
 CPPRD(__AFlattenCandidateSets_26,1);
 CPPRD(__AFlattenCandidateSets_27,1);
 CPPRD(__ARep_187,1);
 {OBJ x3;OBJ x4;
  x3=(*(OBJ(*)(OBJ,OBJ))METHOD(__AFlattenCandidateSets_24,1))(__AFlattenCandidateSets_24,__ABUILTIN_20);
  x4=_ASeqConv_3(__ARep_187,__AFlattenCandidateSets_25,__AFlattenCandidateSets_26,x3,x1);
  ADenotation_4(__AFlattenCandidateSets_27,x4,r);}
 return r;}



static OBJ _mt_1_0_2(OBJ t,OBJ t1,OBJ t2) 
{OBJ r;
 {OBJ t3;
  DCCLS(t,1);
  t3=(*(OBJ(*)(OBJ))ENTRY(t))(t1);
  r=(*(OBJ(*)(OBJ,OBJ))METHOD(t3,1))(t3,t2);}
 return r;}

init_AFlattenCandidateSets()
{
 static int visited=0; if(visited) return; visited=1;
 init_APartName();
 init_AAbsyFun2();
 init_ACompose();
 init_ADEBUG();
 init_AGlobSig();
 init_ADenotation();
 init_ATable();
 init_AGlobSig4SigAna();
 init_AUniqueTable();
 init_AImpDecl4SigAna();
 init_ADeclEntry();
 init_AIsFlatInst();
 init_APartNameEntry();
 init_AMySeqFun1();
 init_AImpExpEntry();
 init_AName4SigAna();
 init_AObjects();
 init_ASeqConv();
 init_AName();
 init_ASeqFilter();
 init_AGlobSigImpl();
 init_ASeqMapEnv();
 init_ARep();
 init_ASeqMap();
 init_APragma();
 init_ASeqOfSeq();
 init_AImpl();
 init_ASeqZip();
 init_AGlobPragma();
 init_AMaps4SigAna();
 init_AOcPos();
 init_ACom();
 init_AOption();
 init_AVoid();
 init_APair();
 init_ASetByBST();
 init_ASeq();
 init_ABSTree();
 init_ANat();
 init_ATree();
 init_AMap();
 init_AInt();
 init_ASet();
 init_ALexem();
 init_AChar();
 init_ASeqReduce();
 init_AFct();
 init_ABitset();
 init_APatterns();
 init_AAttributes();
 init_ADArray();
 init_ANatMap();
 init_AString();
 init_AArray();
 LCLS(2,_AFlattenCandidateSets_28,__AFlattenCandidateSets_28);
 DEN("Flat Cands: {\n",__AFlattenCandidateSets_27);
 DEN("}",__AFlattenCandidateSets_26);
 DEN("\n",__AFlattenCandidateSets_25);
 LCLS(1,_AFlattenCandidateSets_24,__AFlattenCandidateSets_24);
 LCLS(2,_AFlattenCandidateSets_23,__AFlattenCandidateSets_23);
 DEN("Instance: ",__AFlattenCandidateSets_22);
 LCLS(2,_AFlattenCandidateSets_21,__AFlattenCandidateSets_21);
 DEN("Deep Cands: ",__AFlattenCandidateSets_20);
 CLS(1,_AFlattenCandidateSets_19,__AFlattenCandidateSets_19);
 LCLS(1,_AFlattenCandidateSets_18,__AFlattenCandidateSets_18);
 DEN("-zflattenInstPN",__AFlattenCandidateSets_17);
 CLS(3,_AFlattenCandidateSets_16,__AFlattenCandidateSets_16);
 CLS(2,_AFlattenCandidateSets_15,__AFlattenCandidateSets_15);
 CLS(3,_AFlattenCandidateSets_14,__AFlattenCandidateSets_14);
 CLS(2,_AFlattenCandidateSets_13,__AFlattenCandidateSets_13);
 CLS(3,_AFlattenCandidateSets_12,__AFlattenCandidateSets_12);
 CLS(1,_AFlattenCandidateSets_11,__AFlattenCandidateSets_11);
 CLS(3,_AFlattenCandidateSets_10,__AFlattenCandidateSets_10);
 CLS(3,_AFlattenCandidateSets_9_c,__AFlattenCandidateSets_9);
 CLS(2,_AFlattenCandidateSets_8_c,__AFlattenCandidateSets_8);
 CLS(3,_AFlattenCandidateSets_7_c,__AFlattenCandidateSets_7);
 CLS(2,_AFlattenCandidateSets_6_c,__AFlattenCandidateSets_6);
 CLS(2,_AFlattenCandidateSets_5_c,__AFlattenCandidateSets_5);
 CLS(2,_AFlattenCandidateSets_4_c,__AFlattenCandidateSets_4);
 CLS(4,_AFlattenCandidateSets_3_c,__AFlattenCandidateSets_3);
 CLS(2,_AFlattenCandidateSets_2_c,__AFlattenCandidateSets_2);
 CLS(2,_AFlattenCandidateSets_1,__AFlattenCandidateSets_1);
 MTH(1,0,2,_mt_1_0_2);LZYMTH(1,0,2,_mt_1_0_2);
 CPPRD(__ARep_13,1);
 COPY(__APragma_5,1);
 COPY(__AOcPos_35,2);
 PRD1(7,__AFlattenCandidateSets_29);FLD1(__AFlattenCandidateSets_29,1)=__ARep_13;FLD1(__AFlattenCandidateSets_29,2)=__AOption_5;FLD1(__AFlattenCandidateSets_29,3)=__ASeq_6;FLD1(__AFlattenCandidateSets_29,4)=__AOcPos_35;FLD1(__AFlattenCandidateSets_29,5)=__APartName_2;FLD1(__AFlattenCandidateSets_29,6)=__APragma_5;FLD1(__AFlattenCandidateSets_29,7)=__AOcPos_35;
 CPPRD(__ARep_13,1);
 COPY(__APragma_5,1);
 COPY(__AOcPos_35,2);
 PRD1(7,__AFlattenCandidateSets_30);FLD1(__AFlattenCandidateSets_30,1)=__ARep_13;FLD1(__AFlattenCandidateSets_30,2)=__AOption_5;FLD1(__AFlattenCandidateSets_30,3)=__ASeq_6;FLD1(__AFlattenCandidateSets_30,4)=__AOcPos_35;FLD1(__AFlattenCandidateSets_30,5)=__APartName_2;FLD1(__AFlattenCandidateSets_30,6)=__APragma_5;FLD1(__AFlattenCandidateSets_30,7)=__AOcPos_35;}

