#include "omc_simulation_settings.h"
#include "ExpressionSimplify.h"
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT0,1,5) {&ErrorTypes_MessageType_TRANSLATION__desc,}};
#define _OMC_LIT0 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT0)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT1,1,4) {&ErrorTypes_Severity_ERROR__desc,}};
#define _OMC_LIT1 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT1)
#define _OMC_LIT2_data "Internal error %s"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT2,17,_OMC_LIT2_data);
#define _OMC_LIT2 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT2)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT3,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT2}};
#define _OMC_LIT3 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT3)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT4,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(63)),_OMC_LIT0,_OMC_LIT1,_OMC_LIT3}};
#define _OMC_LIT4 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT4)
#define _OMC_LIT5_data "ExpressionSimplify.simplifyAddSymbolicOperation failed"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT5,54,_OMC_LIT5_data);
#define _OMC_LIT5 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT5)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT6,2,1) {_OMC_LIT5,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT6 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT6)
#define _OMC_LIT7_data "min"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT7,3,_OMC_LIT7_data);
#define _OMC_LIT7 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT7)
#define _OMC_LIT8_data "max"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT8,3,_OMC_LIT8_data);
#define _OMC_LIT8 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT8)
#define _OMC_LIT9_data "array"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT9,5,_OMC_LIT9_data);
#define _OMC_LIT9 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT9)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT10,1,18) {&Values_Value_META__FAIL__desc,}};
#define _OMC_LIT10 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT10)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT11,1,3) {&Absyn_ReductionIterType_COMBINE__desc,}};
#define _OMC_LIT11 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT11)
#define _OMC_LIT12_data ":"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT12,1,_OMC_LIT12_data);
#define _OMC_LIT12 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT12)
#define _OMC_LIT13_data "Step equals 0 in array constructor %s."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT13,38,_OMC_LIT13_data);
#define _OMC_LIT13 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT13)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT14,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT13}};
#define _OMC_LIT14 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT14)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT15,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(152)),_OMC_LIT0,_OMC_LIT1,_OMC_LIT14}};
#define _OMC_LIT15 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT15)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT16,2,1) {MMC_IMMEDIATE(MMC_TAGFIXNUM(1 /* true */)),MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT16 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT16)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT17,2,1) {MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),_OMC_LIT16}};
#define _OMC_LIT17 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT17)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT18,2,1) {MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT18 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT18)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT19,0.0);
#define _OMC_LIT19 MMC_REFREALLIT(_OMC_LIT_STRUCT19)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT20,2,4) {&DAE_Exp_RCONST__desc,_OMC_LIT19}};
#define _OMC_LIT20 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT20)
#define _OMC_LIT21_data "semiLinear"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT21,10,_OMC_LIT21_data);
#define _OMC_LIT21 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT21)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT22,2,6) {&DAE_Exp_BCONST__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */))}};
#define _OMC_LIT22 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT22)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT23,2,6) {&DAE_Exp_BCONST__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(1 /* true */))}};
#define _OMC_LIT23 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT23)
#define _OMC_LIT24_data "abs"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT24,3,_OMC_LIT24_data);
#define _OMC_LIT24 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT24)
#define _OMC_LIT25_data "exp"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT25,3,_OMC_LIT25_data);
#define _OMC_LIT25 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT25)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT26,1.0);
#define _OMC_LIT26 MMC_REFREALLIT(_OMC_LIT_STRUCT26)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT27,2,4) {&DAE_Exp_RCONST__desc,_OMC_LIT26}};
#define _OMC_LIT27 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT27)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT28,2.0);
#define _OMC_LIT28 MMC_REFREALLIT(_OMC_LIT_STRUCT28)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT29,2,4) {&DAE_Exp_RCONST__desc,_OMC_LIT28}};
#define _OMC_LIT29 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT29)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT30,2,4) {&DAE_Type_T__REAL__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT30 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT30)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT31,2,6) {&DAE_Operator_DIV__desc,_OMC_LIT30}};
#define _OMC_LIT31 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT31)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT32,0.5);
#define _OMC_LIT32 MMC_REFREALLIT(_OMC_LIT_STRUCT32)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT33,2,4) {&DAE_Exp_RCONST__desc,_OMC_LIT32}};
#define _OMC_LIT33 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT33)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT34,2,5) {&DAE_Operator_MUL__desc,_OMC_LIT30}};
#define _OMC_LIT34 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT34)
#define _OMC_LIT35_data "sqrt"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT35,4,_OMC_LIT35_data);
#define _OMC_LIT35 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT35)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT36,2,7) {&DAE_Operator_POW__desc,_OMC_LIT30}};
#define _OMC_LIT36 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT36)
#define _OMC_LIT37_data "tan"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT37,3,_OMC_LIT37_data);
#define _OMC_LIT37 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT37)
#define _OMC_LIT38_data "cos"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT38,3,_OMC_LIT38_data);
#define _OMC_LIT38 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT38)
#define _OMC_LIT39_data "sin"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT39,3,_OMC_LIT39_data);
#define _OMC_LIT39 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT39)
#define _OMC_LIT40_data "tanh"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT40,4,_OMC_LIT40_data);
#define _OMC_LIT40 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT40)
#define _OMC_LIT41_data "cosh"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT41,4,_OMC_LIT41_data);
#define _OMC_LIT41 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT41)
#define _OMC_LIT42_data "sinh"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT42,4,_OMC_LIT42_data);
#define _OMC_LIT42 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT42)
#define _OMC_LIT43_data "sign"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT43,4,_OMC_LIT43_data);
#define _OMC_LIT43 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT43)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT44,1.5);
#define _OMC_LIT44 MMC_REFREALLIT(_OMC_LIT_STRUCT44)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT45,2,4) {&DAE_Exp_RCONST__desc,_OMC_LIT44}};
#define _OMC_LIT45 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT45)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT46,2,3) {&DAE_Operator_ADD__desc,_OMC_LIT30}};
#define _OMC_LIT46 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT46)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT47,2,29) {&DAE_Operator_LESSEQ__desc,_OMC_LIT30}};
#define _OMC_LIT47 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT47)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT48,2,28) {&DAE_Operator_LESS__desc,_OMC_LIT30}};
#define _OMC_LIT48 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT48)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT49,2,32) {&DAE_Operator_EQUAL__desc,_OMC_LIT30}};
#define _OMC_LIT49 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT49)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT50,1,5) {&ExpressionSimplifyTypes_IntOp_ADDOP__desc,}};
#define _OMC_LIT50 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT50)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT51,1,6) {&ExpressionSimplifyTypes_IntOp_SUBOP__desc,}};
#define _OMC_LIT51 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT51)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT52,1,3) {&ExpressionSimplifyTypes_IntOp_MULOP__desc,}};
#define _OMC_LIT52 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT52)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT53,1,4) {&ExpressionSimplifyTypes_IntOp_DIVOP__desc,}};
#define _OMC_LIT53 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT53)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT54,2,3) {&DAE_Type_T__INTEGER__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT54 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT54)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT55,2,5) {&DAE_Operator_MUL__desc,_OMC_LIT54}};
#define _OMC_LIT55 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT55)
#define _OMC_LIT56_data "- ExpressionSimplify.simplifyAdd failed\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT56,40,_OMC_LIT56_data);
#define _OMC_LIT56 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT56)
#define _OMC_LIT57_data "failtrace"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT57,9,_OMC_LIT57_data);
#define _OMC_LIT57 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT57)
#define _OMC_LIT58_data "Sets whether to print a failtrace or not."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT58,41,_OMC_LIT58_data);
#define _OMC_LIT58 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT58)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT59,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT58}};
#define _OMC_LIT59 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT59)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT60,5,3) {&Flags_DebugFlag_DEBUG__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(1)),_OMC_LIT57,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),_OMC_LIT59}};
#define _OMC_LIT60 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT60)
#define _OMC_LIT61_data "Cpp"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT61,3,_OMC_LIT61_data);
#define _OMC_LIT61 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT61)
#define _OMC_LIT62_data "der"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT62,3,_OMC_LIT62_data);
#define _OMC_LIT62 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT62)
#define _OMC_LIT63_data "pre"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT63,3,_OMC_LIT63_data);
#define _OMC_LIT63 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT63)
#define _OMC_LIT64_data "previous"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT64,8,_OMC_LIT64_data);
#define _OMC_LIT64 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT64)
#define _OMC_LIT65_data "edge"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT65,4,_OMC_LIT65_data);
#define _OMC_LIT65 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT65)
#define _OMC_LIT66_data "change"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT66,6,_OMC_LIT66_data);
#define _OMC_LIT66 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT66)
#define _OMC_LIT67_data "asin"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT67,4,_OMC_LIT67_data);
#define _OMC_LIT67 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT67)
#define _OMC_LIT68_data "acos"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT68,4,_OMC_LIT68_data);
#define _OMC_LIT68 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT68)
#define _OMC_LIT69_data "log"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT69,3,_OMC_LIT69_data);
#define _OMC_LIT69 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT69)
#define _OMC_LIT70_data "log10"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT70,5,_OMC_LIT70_data);
#define _OMC_LIT70 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT70)
#define _OMC_LIT71_data ""
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT71,0,_OMC_LIT71_data);
#define _OMC_LIT71 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT71)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT72,2,5) {&DAE_Exp_SCONST__desc,_OMC_LIT71}};
#define _OMC_LIT72 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT72)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT73,2,5) {&DAE_Type_T__STRING__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT73 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT73)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT74,2,3) {&DAE_Operator_ADD__desc,_OMC_LIT73}};
#define _OMC_LIT74 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT74)
#define _OMC_LIT75_data "stringAppendList"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT75,16,_OMC_LIT75_data);
#define _OMC_LIT75 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT75)
#define _OMC_LIT76_data " "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT76,1,_OMC_LIT76_data);
#define _OMC_LIT76 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT76)
#define _OMC_LIT77_data "true"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT77,4,_OMC_LIT77_data);
#define _OMC_LIT77 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT77)
#define _OMC_LIT78_data "false"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT78,5,_OMC_LIT78_data);
#define _OMC_LIT78 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT78)
#define _OMC_LIT79_data "ExpressionSimplify.evalCatGetFlatArray: Got unbalanced array from "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT79,66,_OMC_LIT79_data);
#define _OMC_LIT79 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT79)
#define _OMC_LIT80_data "/home/per/workspace/OpenModelica/OMCompiler/Compiler/FrontEnd/ExpressionSimplify.mo"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT80,83,_OMC_LIT80_data);
#define _OMC_LIT80 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT80)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT81_6,1.770631566e9);
#define _OMC_LIT81_6 MMC_REFREALLIT(_OMC_LIT_STRUCT81_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT81,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT80,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1790)),MMC_IMMEDIATE(MMC_TAGFIXNUM(7)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1790)),MMC_IMMEDIATE(MMC_TAGFIXNUM(109)),_OMC_LIT81_6}};
#define _OMC_LIT81 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT81)
#define _OMC_LIT82_data "ExpressionSimplify.evalCat: cat got uneven dimensions for dim="
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT82,62,_OMC_LIT82_data);
#define _OMC_LIT82 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT82)
#define _OMC_LIT83_data ", "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT83,2,_OMC_LIT83_data);
#define _OMC_LIT83 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT83)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT84_6,1.770631566e9);
#define _OMC_LIT84_6 MMC_REFREALLIT(_OMC_LIT_STRUCT84_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT84,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT80,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1729)),MMC_IMMEDIATE(MMC_TAGFIXNUM(7)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1729)),MMC_IMMEDIATE(MMC_TAGFIXNUM(180)),_OMC_LIT84_6}};
#define _OMC_LIT84 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT84)
#define _OMC_LIT85_data "scalar"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT85,6,_OMC_LIT85_data);
#define _OMC_LIT85 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT85)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT86,2,3) {&DAE_Exp_ICONST__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(1))}};
#define _OMC_LIT86 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT86)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT87,1,1) {_OMC_LIT86}};
#define _OMC_LIT87 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT87)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT88,2,6) {&DAE_Type_T__BOOL__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT88 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT88)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT89,2,25) {&DAE_Operator_AND__desc,_OMC_LIT88}};
#define _OMC_LIT89 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT89)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT90,2,26) {&DAE_Operator_OR__desc,_OMC_LIT88}};
#define _OMC_LIT90 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT90)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT91,1,3) {&DAE_Const_C__CONST__desc,}};
#define _OMC_LIT91 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT91)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT92,1,3) {&DAE_Prefix_NOPRE__desc,}};
#define _OMC_LIT92 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT92)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT93,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT71,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),_OMC_LIT19}};
#define _OMC_LIT93 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT93)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT94,0.25);
#define _OMC_LIT94 MMC_REFREALLIT(_OMC_LIT_STRUCT94)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT95,2,4) {&DAE_Exp_RCONST__desc,_OMC_LIT94}};
#define _OMC_LIT95 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT95)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT96,2,8) {&DAE_Operator_UMINUS__desc,_OMC_LIT30}};
#define _OMC_LIT96 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT96)
#define _OMC_LIT97_data "delay"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT97,5,_OMC_LIT97_data);
#define _OMC_LIT97 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT97)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT98,1,7) {&DAE_Dimension_DIM__UNKNOWN__desc,}};
#define _OMC_LIT98 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT98)
#define _OMC_LIT99_data "sum"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT99,3,_OMC_LIT99_data);
#define _OMC_LIT99 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT99)
#define _OMC_LIT100_data "cat"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT100,3,_OMC_LIT100_data);
#define _OMC_LIT100 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT100)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT101,2,3) {&DAE_Dimension_DIM__INTEGER__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(1))}};
#define _OMC_LIT101 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT101)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT102,1,3) {&DAE_ClockKind_INFERRED__CLOCK__desc,}};
#define _OMC_LIT102 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT102)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT103,2,7) {&DAE_Exp_CLKCONST__desc,_OMC_LIT102}};
#define _OMC_LIT103 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT103)
#define _OMC_LIT104_data "OpenModelica_fmuLoadResource"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT104,28,_OMC_LIT104_data);
#define _OMC_LIT104 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT104)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT105,1,3) {&Flags_FlagVisibility_INTERNAL__desc,}};
#define _OMC_LIT105 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT105)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT106,2,4) {&Flags_FlagData_BOOL__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */))}};
#define _OMC_LIT106 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT106)
#define _OMC_LIT107_data "Is true when building an FMU (so the compiler can look for URIs to package as FMI resources)."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT107,93,_OMC_LIT107_data);
#define _OMC_LIT107 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT107)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT108,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT107}};
#define _OMC_LIT108 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT108)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT109,8,3) {&Flags_ConfigFlag_CONFIG__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(114)),_OMC_LIT71,MMC_REFSTRUCTLIT(mmc_none),_OMC_LIT105,_OMC_LIT106,MMC_REFSTRUCTLIT(mmc_none),_OMC_LIT108}};
#define _OMC_LIT109 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT109)
#define _OMC_LIT110_data "cross"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT110,5,_OMC_LIT110_data);
#define _OMC_LIT110 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT110)
#define _OMC_LIT111_data "skew"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT111,4,_OMC_LIT111_data);
#define _OMC_LIT111 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT111)
#define _OMC_LIT112_data "fill"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT112,4,_OMC_LIT112_data);
#define _OMC_LIT112 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT112)
#define _OMC_LIT113_data "String"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT113,6,_OMC_LIT113_data);
#define _OMC_LIT113 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT113)
#define _OMC_LIT114_data "smooth"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT114,6,_OMC_LIT114_data);
#define _OMC_LIT114 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT114)
#define _OMC_LIT115_data "$_DF$DER"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT115,8,_OMC_LIT115_data);
#define _OMC_LIT115 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT115)
#define _OMC_LIT116_data "promote"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT116,7,_OMC_LIT116_data);
#define _OMC_LIT116 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT116)
#define _OMC_LIT117_data "transpose"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT117,9,_OMC_LIT117_data);
#define _OMC_LIT117 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT117)
#define _OMC_LIT118_data "symmetric"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT118,9,_OMC_LIT118_data);
#define _OMC_LIT118 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT118)
#define _OMC_LIT119_data "vector"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT119,6,_OMC_LIT119_data);
#define _OMC_LIT119 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT119)
#define _OMC_LIT120_data "inferredClock"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT120,13,_OMC_LIT120_data);
#define _OMC_LIT120 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT120)
#define _OMC_LIT121_data "realClock"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT121,9,_OMC_LIT121_data);
#define _OMC_LIT121 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT121)
#define _OMC_LIT122_data "booleanClock"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT122,12,_OMC_LIT122_data);
#define _OMC_LIT122 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT122)
#define _OMC_LIT123_data "rationalClock"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT123,13,_OMC_LIT123_data);
#define _OMC_LIT123 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT123)
#define _OMC_LIT124_data "solverClock"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT124,11,_OMC_LIT124_data);
#define _OMC_LIT124 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT124)
#define _OMC_LIT125_data "OpenModelica_uriToFilename"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT125,26,_OMC_LIT125_data);
#define _OMC_LIT125 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT125)
#define _OMC_LIT126_data "product"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT126,7,_OMC_LIT126_data);
#define _OMC_LIT126 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT126)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT127,2,6) {&Values_Value_BOOL__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(1 /* true */))}};
#define _OMC_LIT127 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT127)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT128,2,6) {&Values_Value_BOOL__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */))}};
#define _OMC_LIT128 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT128)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT129,2,3) {&Values_Value_INTEGER__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(1))}};
#define _OMC_LIT129 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT129)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT130,2,4) {&Values_Value_REAL__desc,_OMC_LIT26}};
#define _OMC_LIT130 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT130)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT131,2,3) {&Values_Value_INTEGER__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(0))}};
#define _OMC_LIT131 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT131)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT132,2,4) {&Values_Value_REAL__desc,_OMC_LIT19}};
#define _OMC_LIT132 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT132)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT133,1,7) {&DAE_InlineType_NO__INLINE__desc,}};
#define _OMC_LIT133 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT133)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT134,1,3) {&DAE_TailCall_NO__TAIL__desc,}};
#define _OMC_LIT134 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT134)
#define _OMC_LIT135_data "listReverse"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT135,11,_OMC_LIT135_data);
#define _OMC_LIT135 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT135)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT136,2,4) {&Absyn_Path_IDENT__desc,_OMC_LIT135}};
#define _OMC_LIT136 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT136)
#define _OMC_LIT137_data "list"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT137,4,_OMC_LIT137_data);
#define _OMC_LIT137 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT137)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT138,2,4) {&Absyn_Path_IDENT__desc,_OMC_LIT137}};
#define _OMC_LIT138 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT138)
#define _OMC_LIT139_data "sourceInfo() - simplify?\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT139,25,_OMC_LIT139_data);
#define _OMC_LIT139 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT139)
#define _OMC_LIT140_data "listAppend"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT140,10,_OMC_LIT140_data);
#define _OMC_LIT140 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT140)
#define _OMC_LIT141_data "intString"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT141,9,_OMC_LIT141_data);
#define _OMC_LIT141 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT141)
#define _OMC_LIT142_data "realString"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT142,10,_OMC_LIT142_data);
#define _OMC_LIT142 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT142)
#define _OMC_LIT143_data "boolString"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT143,10,_OMC_LIT143_data);
#define _OMC_LIT143 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT143)
#define _OMC_LIT144_data "listLength"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT144,10,_OMC_LIT144_data);
#define _OMC_LIT144 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT144)
#define _OMC_LIT145_data "mmc_mk_some"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT145,11,_OMC_LIT145_data);
#define _OMC_LIT145 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT145)
#define _OMC_LIT146_data "sourceInfo"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT146,10,_OMC_LIT146_data);
#define _OMC_LIT146 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT146)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT147,2,27) {&DAE_Operator_NOT__desc,_OMC_LIT88}};
#define _OMC_LIT147 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT147)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT148,2,31) {&DAE_Exp_LIST__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT148 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT148)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT149,1,5) {&ErrorTypes_Severity_WARNING__desc,}};
#define _OMC_LIT149 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT149)
#define _OMC_LIT150_data "Expression simplification iterated to the fix-point maximum, which may be a performance bottleneck. The last two iterations were: %s, and %s."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT150,141,_OMC_LIT150_data);
#define _OMC_LIT150 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT150)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT151,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT150}};
#define _OMC_LIT151 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT151)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT152,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(209)),_OMC_LIT0,_OMC_LIT149,_OMC_LIT151}};
#define _OMC_LIT152 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT152)
#define _OMC_LIT153_data "ExpressionSimplify"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT153,18,_OMC_LIT153_data);
#define _OMC_LIT153 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT153)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT154,1,6) {&ErrorTypes_Severity_NOTIFICATION__desc,}};
#define _OMC_LIT154 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT154)
#define _OMC_LIT155_data "Expression simplification '%s' → '%s' changed the type from %s to %s."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT155,71,_OMC_LIT155_data);
#define _OMC_LIT155 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT155)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT156,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT155}};
#define _OMC_LIT156 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT156)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT157,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(273)),_OMC_LIT0,_OMC_LIT154,_OMC_LIT156}};
#define _OMC_LIT157 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT157)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT158,1,6) {&ErrorTypes_MessageType_SYMBOLIC__desc,}};
#define _OMC_LIT158 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT158)
#define _OMC_LIT159_data "Simplification produced a higher complexity (%s) than the original (%s). The simplification was: %s => %s."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT159,106,_OMC_LIT159_data);
#define _OMC_LIT159 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT159)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT160,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT159}};
#define _OMC_LIT160 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT160)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT161,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(523)),_OMC_LIT158,_OMC_LIT154,_OMC_LIT160}};
#define _OMC_LIT161 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT161)
#define _OMC_LIT162_data "checkSimplify"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT162,13,_OMC_LIT162_data);
#define _OMC_LIT162 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT162)
#define _OMC_LIT163_data "Enables checks for expression simplification and prints a notification whenever an undesirable transformation has been performed."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT163,129,_OMC_LIT163_data);
#define _OMC_LIT163 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT163)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT164,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT163}};
#define _OMC_LIT164 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT164)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT165,5,3) {&Flags_DebugFlag_DEBUG__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(65)),_OMC_LIT162,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),_OMC_LIT164}};
#define _OMC_LIT165 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT165)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT166,1,3) {&ExpressionSimplifyTypes_Evaluate_NO__EVAL__desc,}};
#define _OMC_LIT166 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT166)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT167,2,0) {MMC_REFSTRUCTLIT(mmc_none),_OMC_LIT166}};
#define _OMC_LIT167 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT167)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT168,2,1) {_OMC_LIT8,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT168 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT168)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT169,2,1) {_OMC_LIT7,_OMC_LIT168}};
#define _OMC_LIT169 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT169)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT170,2,1) {_OMC_LIT126,_OMC_LIT169}};
#define _OMC_LIT170 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT170)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT171,2,1) {_OMC_LIT99,_OMC_LIT170}};
#define _OMC_LIT171 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT171)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT172,2,4) {&Absyn_Path_IDENT__desc,_OMC_LIT62}};
#define _OMC_LIT172 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT172)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT173,2,3) {&DAE_Exp_ICONST__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(0))}};
#define _OMC_LIT173 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT173)
#define _OMC_LIT174_data "atan"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT174,4,_OMC_LIT174_data);
#define _OMC_LIT174 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT174)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT175,2,4) {&DAE_Operator_SUB__desc,_OMC_LIT30}};
#define _OMC_LIT175 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT175)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT176,1.5707963267948966);
#define _OMC_LIT176 MMC_REFREALLIT(_OMC_LIT_STRUCT176)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT177,2,4) {&DAE_Exp_RCONST__desc,_OMC_LIT176}};
#define _OMC_LIT177 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT177)
#define _OMC_LIT178_data "homotopy"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT178,8,_OMC_LIT178_data);
#define _OMC_LIT178 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT178)
#define _OMC_LIT179_data "noEvent"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT179,7,_OMC_LIT179_data);
#define _OMC_LIT179 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT179)
#define _OMC_LIT180_data "identity"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT180,8,_OMC_LIT180_data);
#define _OMC_LIT180 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT180)
#define _OMC_LIT181_data "diagonal"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT181,8,_OMC_LIT181_data);
#define _OMC_LIT181 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT181)
#define _OMC_LIT182_data "mod"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT182,3,_OMC_LIT182_data);
#define _OMC_LIT182 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT182)
#define _OMC_LIT183_data "integer"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT183,7,_OMC_LIT183_data);
#define _OMC_LIT183 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT183)
#define _OMC_LIT184_data "atan2"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT184,5,_OMC_LIT184_data);
#define _OMC_LIT184 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT184)
#define _OMC_LIT185_data "simplify1 took "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT185,15,_OMC_LIT185_data);
#define _OMC_LIT185 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT185)
#define _OMC_LIT186_data " seconds for exp: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT186,18,_OMC_LIT186_data);
#define _OMC_LIT186 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT186)
#define _OMC_LIT187_data " \nsimplified to :"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT187,17,_OMC_LIT187_data);
#define _OMC_LIT187 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT187)
#define _OMC_LIT188_data "\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT188,1,_OMC_LIT188_data);
#define _OMC_LIT188 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT188)
#define _OMC_LIT189_data "eval exp failed"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT189,15,_OMC_LIT189_data);
#define _OMC_LIT189 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT189)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT190,2,1) {_OMC_LIT189,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT190 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT190)
#include "util/modelica.h"

#include "ExpressionSimplify_includes.h"


/* default, do not make protected functions static */
#if !defined(PROTECTED_FUNCTION_STATIC)
#define PROTECTED_FUNCTION_STATIC
#endif
PROTECTED_FUNCTION_STATIC modelica_boolean omc_ExpressionSimplify_removeMinMaxFoldableValues(threadData_t *threadData, modelica_metatype _e);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_removeMinMaxFoldableValues(threadData_t *threadData, modelica_metatype _e);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_removeMinMaxFoldableValues,2,0) {(void*) boxptr_ExpressionSimplify_removeMinMaxFoldableValues,0}};
#define boxvar_ExpressionSimplify_removeMinMaxFoldableValues MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_removeMinMaxFoldableValues)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_minElement(threadData_t *threadData, modelica_metatype _e1, modelica_metatype _e2);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_minElement,2,0) {(void*) boxptr_ExpressionSimplify_minElement,0}};
#define boxvar_ExpressionSimplify_minElement MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_minElement)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_maxElement(threadData_t *threadData, modelica_metatype _e1, modelica_metatype _e2);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_maxElement,2,0) {(void*) boxptr_ExpressionSimplify_maxElement,0}};
#define boxvar_ExpressionSimplify_maxElement MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_maxElement)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyNoEvent(threadData_t *threadData, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyNoEvent,2,0) {(void*) boxptr_ExpressionSimplify_simplifyNoEvent,0}};
#define boxvar_ExpressionSimplify_simplifyNoEvent MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyNoEvent)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyTSub(threadData_t *threadData, modelica_metatype _origExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyTSub,2,0) {(void*) boxptr_ExpressionSimplify_simplifyTSub,0}};
#define boxvar_ExpressionSimplify_simplifyTSub MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyTSub)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifySize(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _exp, modelica_metatype _optDim);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifySize,2,0) {(void*) boxptr_ExpressionSimplify_simplifySize,0}};
#define boxvar_ExpressionSimplify_simplifySize MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifySize)
PROTECTED_FUNCTION_STATIC void omc_ExpressionSimplify_checkZeroLengthArrayOp(threadData_t *threadData, modelica_metatype _op);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_checkZeroLengthArrayOp,2,0) {(void*) boxptr_ExpressionSimplify_checkZeroLengthArrayOp,0}};
#define boxvar_ExpressionSimplify_checkZeroLengthArrayOp MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_checkZeroLengthArrayOp)
PROTECTED_FUNCTION_STATIC modelica_boolean omc_ExpressionSimplify_hasZeroLengthIterator(threadData_t *threadData, modelica_metatype _inIters);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_hasZeroLengthIterator(threadData_t *threadData, modelica_metatype _inIters);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_hasZeroLengthIterator,2,0) {(void*) boxptr_ExpressionSimplify_hasZeroLengthIterator,0}};
#define boxvar_ExpressionSimplify_hasZeroLengthIterator MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_hasZeroLengthIterator)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyReductionFoldPhase2(threadData_t *threadData, modelica_metatype _inExps, modelica_metatype _foldExp, modelica_string _foldName, modelica_string _resultName, modelica_metatype _acc);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyReductionFoldPhase2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyReductionFoldPhase2,0}};
#define boxvar_ExpressionSimplify_simplifyReductionFoldPhase2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyReductionFoldPhase2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyReductionFoldPhase(threadData_t *threadData, modelica_metatype _path, modelica_metatype _optFoldExp, modelica_string _foldName, modelica_string _resultName, modelica_metatype _ty, modelica_metatype _inExps, modelica_metatype _defaultValue);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyReductionFoldPhase,2,0) {(void*) boxptr_ExpressionSimplify_simplifyReductionFoldPhase,0}};
#define boxvar_ExpressionSimplify_simplifyReductionFoldPhase MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyReductionFoldPhase)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_replaceIteratorWithExpTraverser(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inTpl, modelica_metatype *out_outTpl);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_replaceIteratorWithExpTraverser,2,0) {(void*) boxptr_ExpressionSimplify_replaceIteratorWithExpTraverser,0}};
#define boxvar_ExpressionSimplify_replaceIteratorWithExpTraverser MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_replaceIteratorWithExpTraverser)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_replaceIteratorWithExp(threadData_t *threadData, modelica_metatype _iterExp, modelica_metatype _exp, modelica_string _name);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_replaceIteratorWithExp,2,0) {(void*) boxptr_ExpressionSimplify_replaceIteratorWithExp,0}};
#define boxvar_ExpressionSimplify_replaceIteratorWithExp MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_replaceIteratorWithExp)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_getIteratorValues(threadData_t *threadData, modelica_metatype _iter, modelica_metatype _inValues);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_getIteratorValues,2,0) {(void*) boxptr_ExpressionSimplify_getIteratorValues,0}};
#define boxvar_ExpressionSimplify_getIteratorValues MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_getIteratorValues)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyReduction(threadData_t *threadData, modelica_metatype _inReduction);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyReduction,2,0) {(void*) boxptr_ExpressionSimplify_simplifyReduction,0}};
#define boxvar_ExpressionSimplify_simplifyReduction MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyReduction)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyRangeReal2(threadData_t *threadData, modelica_real _inStart, modelica_real _inStep, modelica_integer _inSteps, modelica_metatype _inValues);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyRangeReal2(threadData_t *threadData, modelica_metatype _inStart, modelica_metatype _inStep, modelica_metatype _inSteps, modelica_metatype _inValues);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyRangeReal2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyRangeReal2,0}};
#define boxvar_ExpressionSimplify_simplifyRangeReal2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyRangeReal2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_removeOperatorDimension(threadData_t *threadData, modelica_metatype _inop);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_removeOperatorDimension,2,0) {(void*) boxptr_ExpressionSimplify_removeOperatorDimension,0}};
#define boxvar_ExpressionSimplify_removeOperatorDimension MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_removeOperatorDimension)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBuiltinConstantDer(threadData_t *threadData, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBuiltinConstantDer,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBuiltinConstantDer,0}};
#define boxvar_ExpressionSimplify_simplifyBuiltinConstantDer MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBuiltinConstantDer)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinarySortConstantsMul(threadData_t *threadData, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinarySortConstantsMul,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinarySortConstantsMul,0}};
#define boxvar_ExpressionSimplify_simplifyBinarySortConstantsMul MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinarySortConstantsMul)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyVectorScalarMatrix(threadData_t *threadData, modelica_metatype _imexpl, modelica_metatype _op, modelica_metatype _s1, modelica_boolean _arrayScalar);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyVectorScalarMatrix(threadData_t *threadData, modelica_metatype _imexpl, modelica_metatype _op, modelica_metatype _s1, modelica_metatype _arrayScalar);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyVectorScalarMatrix,2,0) {(void*) boxptr_ExpressionSimplify_simplifyVectorScalarMatrix,0}};
#define boxvar_ExpressionSimplify_simplifyVectorScalarMatrix MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyVectorScalarMatrix)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyUnary(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOperator2, modelica_metatype _inExp3);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyUnary,2,0) {(void*) boxptr_ExpressionSimplify_simplifyUnary,0}};
#define boxvar_ExpressionSimplify_simplifyUnary MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyUnary)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryDistributePow(threadData_t *threadData, modelica_metatype _inExpLst, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryDistributePow,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinaryDistributePow,0}};
#define boxvar_ExpressionSimplify_simplifyBinaryDistributePow MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryDistributePow)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyRelation2(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOp, modelica_metatype _lhs, modelica_metatype _rhs, modelica_integer _index, modelica_metatype _optionExpisASUB, modelica_fnptr _isPositive);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyRelation2(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOp, modelica_metatype _lhs, modelica_metatype _rhs, modelica_metatype _index, modelica_metatype _optionExpisASUB, modelica_fnptr _isPositive);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyRelation2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyRelation2,0}};
#define boxvar_ExpressionSimplify_simplifyRelation2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyRelation2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyRelation(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOperator2, modelica_metatype _inExp3, modelica_metatype _inExp4, modelica_integer _index, modelica_metatype _optionExpisASUB);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyRelation(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOperator2, modelica_metatype _inExp3, modelica_metatype _inExp4, modelica_metatype _index, modelica_metatype _optionExpisASUB);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyRelation,2,0) {(void*) boxptr_ExpressionSimplify_simplifyRelation,0}};
#define boxvar_ExpressionSimplify_simplifyRelation MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyRelation)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyLBinary(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOperator2, modelica_metatype _inExp3, modelica_metatype _inExp4);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyLBinary,2,0) {(void*) boxptr_ExpressionSimplify_simplifyLBinary,0}};
#define boxvar_ExpressionSimplify_simplifyLBinary MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyLBinary)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyTwoBinaryExpressions(threadData_t *threadData, modelica_metatype _e1, modelica_metatype _lhsOperator, modelica_metatype _e2, modelica_metatype _mainOperator, modelica_metatype _e3, modelica_metatype _rhsOperator, modelica_metatype _e4, modelica_boolean _expEqual_e1_e3, modelica_boolean _expEqual_e1_e4, modelica_boolean _expEqual_e2_e3, modelica_boolean _expEqual_e2_e4, modelica_boolean _isConst_e1, modelica_boolean _isConst_e2, modelica_boolean _isConst_e3, modelica_boolean _operatorEqualLhsRhs);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyTwoBinaryExpressions(threadData_t *threadData, modelica_metatype _e1, modelica_metatype _lhsOperator, modelica_metatype _e2, modelica_metatype _mainOperator, modelica_metatype _e3, modelica_metatype _rhsOperator, modelica_metatype _e4, modelica_metatype _expEqual_e1_e3, modelica_metatype _expEqual_e1_e4, modelica_metatype _expEqual_e2_e3, modelica_metatype _expEqual_e2_e4, modelica_metatype _isConst_e1, modelica_metatype _isConst_e2, modelica_metatype _isConst_e3, modelica_metatype _operatorEqualLhsRhs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyTwoBinaryExpressions,2,0) {(void*) boxptr_ExpressionSimplify_simplifyTwoBinaryExpressions,0}};
#define boxvar_ExpressionSimplify_simplifyTwoBinaryExpressions MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyTwoBinaryExpressions)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinary(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOperator2, modelica_metatype _lhs, modelica_metatype _rhs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinary,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinary,0}};
#define boxvar_ExpressionSimplify_simplifyBinary MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinary)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryCommutativeWork(threadData_t *threadData, modelica_metatype _op, modelica_metatype _lhs, modelica_metatype _rhs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryCommutativeWork,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinaryCommutativeWork,0}};
#define boxvar_ExpressionSimplify_simplifyBinaryCommutativeWork MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryCommutativeWork)
PROTECTED_FUNCTION_STATIC modelica_boolean omc_ExpressionSimplify_simplifyRelationConst(threadData_t *threadData, modelica_metatype _op, modelica_metatype _e1, modelica_metatype _e2);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyRelationConst(threadData_t *threadData, modelica_metatype _op, modelica_metatype _e1, modelica_metatype _e2);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyRelationConst,2,0) {(void*) boxptr_ExpressionSimplify_simplifyRelationConst,0}};
#define boxvar_ExpressionSimplify_simplifyRelationConst MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyRelationConst)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryConst(threadData_t *threadData, modelica_metatype _inOperator1, modelica_metatype _inExp2, modelica_metatype _inExp3);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryConst,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinaryConst,0}};
#define boxvar_ExpressionSimplify_simplifyBinaryConst MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryConst)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubSlicing2(threadData_t *threadData, modelica_metatype _inSubscripts, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubSlicing2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAsubSlicing2,0}};
#define boxvar_ExpressionSimplify_simplifyAsubSlicing2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubSlicing2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubSlicing(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inSubscripts);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubSlicing,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAsubSlicing,0}};
#define boxvar_ExpressionSimplify_simplifyAsubSlicing MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubSlicing)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubOperator(threadData_t *threadData, modelica_metatype _inExp1, modelica_metatype _inOperator2, modelica_metatype _inOperator3);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubOperator,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAsubOperator,0}};
#define boxvar_ExpressionSimplify_simplifyAsubOperator MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubOperator)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubArrayReduction(threadData_t *threadData, modelica_metatype _iter, modelica_metatype _sub, modelica_metatype _acc);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubArrayReduction,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAsubArrayReduction,0}};
#define boxvar_ExpressionSimplify_simplifyAsubArrayReduction MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubArrayReduction)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsub(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inSub);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsub,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAsub,0}};
#define boxvar_ExpressionSimplify_simplifyAsub MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsub)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubCref(threadData_t *threadData, modelica_metatype _cr, modelica_metatype _sub);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubCref,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAsubCref,0}};
#define boxvar_ExpressionSimplify_simplifyAsubCref MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubCref)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsub0(threadData_t *threadData, modelica_metatype _ie, modelica_integer _sub, modelica_metatype _inSubExp);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyAsub0(threadData_t *threadData, modelica_metatype _ie, modelica_metatype _sub, modelica_metatype _inSubExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsub0,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAsub0,0}};
#define boxvar_ExpressionSimplify_simplifyAsub0 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsub0)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryMulCoeff2(threadData_t *threadData, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryMulCoeff2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinaryMulCoeff2,0}};
#define boxvar_ExpressionSimplify_simplifyBinaryMulCoeff2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryMulCoeff2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryAddCoeff2(threadData_t *threadData, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryAddCoeff2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinaryAddCoeff2,0}};
#define boxvar_ExpressionSimplify_simplifyBinaryAddCoeff2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryAddCoeff2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAddMakeMul(threadData_t *threadData, modelica_metatype _inTplExpRealLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAddMakeMul,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAddMakeMul,0}};
#define boxvar_ExpressionSimplify_simplifyAddMakeMul MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAddMakeMul)
PROTECTED_FUNCTION_STATIC modelica_real omc_ExpressionSimplify_simplifyAddJoinTerms_addCoeff(threadData_t *threadData, modelica_metatype _oldCoeff, modelica_real _newCoeff);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyAddJoinTerms_addCoeff(threadData_t *threadData, modelica_metatype _oldCoeff, modelica_metatype _newCoeff);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAddJoinTerms_addCoeff,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAddJoinTerms_addCoeff,0}};
#define boxvar_ExpressionSimplify_simplifyAddJoinTerms_addCoeff MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAddJoinTerms_addCoeff)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAddJoinTerms(threadData_t *threadData, modelica_metatype _inTplExpRealLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAddJoinTerms,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAddJoinTerms,0}};
#define boxvar_ExpressionSimplify_simplifyAddJoinTerms MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAddJoinTerms)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAdd(threadData_t *threadData, modelica_metatype _inExpLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAdd,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAdd,0}};
#define boxvar_ExpressionSimplify_simplifyAdd MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAdd)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMulMakePow(threadData_t *threadData, modelica_metatype _inTplExpRealLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMulMakePow,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMulMakePow,0}};
#define boxvar_ExpressionSimplify_simplifyMulMakePow MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMulMakePow)
PROTECTED_FUNCTION_STATIC modelica_real omc_ExpressionSimplify_simplifyMulJoinFactorsFind(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inTplExpRealLst, modelica_metatype *out_outTplExpRealLst);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyMulJoinFactorsFind(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inTplExpRealLst, modelica_metatype *out_outTplExpRealLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMulJoinFactorsFind,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMulJoinFactorsFind,0}};
#define boxvar_ExpressionSimplify_simplifyMulJoinFactorsFind MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMulJoinFactorsFind)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMulJoinFactors(threadData_t *threadData, modelica_metatype _inTplExpRealLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMulJoinFactors,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMulJoinFactors,0}};
#define boxvar_ExpressionSimplify_simplifyMulJoinFactors MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMulJoinFactors)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMul(threadData_t *threadData, modelica_metatype _expl);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMul,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMul,0}};
#define boxvar_ExpressionSimplify_simplifyMul MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMul)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryMulConstants(threadData_t *threadData, modelica_metatype _inExpLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryMulConstants,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinaryMulConstants,0}};
#define boxvar_ExpressionSimplify_simplifyBinaryMulConstants MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryMulConstants)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryAddConstants(threadData_t *threadData, modelica_metatype _inExpLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryAddConstants,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinaryAddConstants,0}};
#define boxvar_ExpressionSimplify_simplifyBinaryAddConstants MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryAddConstants)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryCoeff(threadData_t *threadData, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryCoeff,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinaryCoeff,0}};
#define boxvar_ExpressionSimplify_simplifyBinaryCoeff MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryCoeff)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinarySortConstants(threadData_t *threadData, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinarySortConstants,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinarySortConstants,0}};
#define boxvar_ExpressionSimplify_simplifyBinarySortConstants MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinarySortConstants)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixProduct4(threadData_t *threadData, modelica_metatype _inMatrix1, modelica_metatype _inMatrix2);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixProduct4,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMatrixProduct4,0}};
#define boxvar_ExpressionSimplify_simplifyMatrixProduct4 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixProduct4)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixProduct3(threadData_t *threadData, modelica_metatype _inRow, modelica_metatype _inMatrix);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixProduct3,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMatrixProduct3,0}};
#define boxvar_ExpressionSimplify_simplifyMatrixProduct3 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixProduct3)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixProduct2(threadData_t *threadData, modelica_metatype _inMatrix1, modelica_metatype _inMatrix2);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixProduct2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMatrixProduct2,0}};
#define boxvar_ExpressionSimplify_simplifyMatrixProduct2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixProduct2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixProduct(threadData_t *threadData, modelica_metatype _inMatrix1, modelica_metatype _inMatrix2);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixProduct,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMatrixProduct,0}};
#define boxvar_ExpressionSimplify_simplifyMatrixProduct MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixProduct)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixPow1(threadData_t *threadData, modelica_metatype _inRange, modelica_metatype _inMatrix, modelica_metatype _inValue);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixPow1,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMatrixPow1,0}};
#define boxvar_ExpressionSimplify_simplifyMatrixPow1 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixPow1)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixPow(threadData_t *threadData, modelica_metatype _inExp1, modelica_metatype _inType, modelica_metatype _inExp2);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixPow,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMatrixPow,0}};
#define boxvar_ExpressionSimplify_simplifyMatrixPow MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixPow)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixBinary2(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inRhs, modelica_metatype _inOperator);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixBinary2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMatrixBinary2,0}};
#define boxvar_ExpressionSimplify_simplifyMatrixBinary2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixBinary2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixBinary1(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inRhs, modelica_metatype _inOperator);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixBinary1,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMatrixBinary1,0}};
#define boxvar_ExpressionSimplify_simplifyMatrixBinary1 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixBinary1)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixBinary(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inOperator, modelica_metatype _inRhs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixBinary,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMatrixBinary,0}};
#define boxvar_ExpressionSimplify_simplifyMatrixBinary MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatrixBinary)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyVectorBinary2(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inRhs, modelica_metatype _inOperator);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyVectorBinary2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyVectorBinary2,0}};
#define boxvar_ExpressionSimplify_simplifyVectorBinary2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyVectorBinary2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyVectorBinary(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inOperator, modelica_metatype _inRhs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyVectorBinary,2,0) {(void*) boxptr_ExpressionSimplify_simplifyVectorBinary,0}};
#define boxvar_ExpressionSimplify_simplifyVectorBinary MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyVectorBinary)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyVectorBinary0(threadData_t *threadData, modelica_metatype _e1, modelica_metatype _op, modelica_metatype _e2);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyVectorBinary0,2,0) {(void*) boxptr_ExpressionSimplify_simplifyVectorBinary0,0}};
#define boxvar_ExpressionSimplify_simplifyVectorBinary0 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyVectorBinary0)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyVectorScalar(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inOperator, modelica_metatype _inRhs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyVectorScalar,2,0) {(void*) boxptr_ExpressionSimplify_simplifyVectorScalar,0}};
#define boxvar_ExpressionSimplify_simplifyVectorScalar MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyVectorScalar)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_unliftOperator(threadData_t *threadData, modelica_metatype _inArray, modelica_metatype _inOperator);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_unliftOperator,2,0) {(void*) boxptr_ExpressionSimplify_unliftOperator,0}};
#define boxvar_ExpressionSimplify_unliftOperator MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_unliftOperator)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryArray(threadData_t *threadData, modelica_metatype _inExp1, modelica_metatype _inOperator2, modelica_metatype _inExp3);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryArray,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinaryArray,0}};
#define boxvar_ExpressionSimplify_simplifyBinaryArray MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryArray)
PROTECTED_FUNCTION_STATIC modelica_boolean omc_ExpressionSimplify_simplifyBinaryArrayOp(threadData_t *threadData, modelica_metatype _inOperator);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyBinaryArrayOp(threadData_t *threadData, modelica_metatype _inOperator);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryArrayOp,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBinaryArrayOp,0}};
#define boxvar_ExpressionSimplify_simplifyBinaryArrayOp MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBinaryArrayOp)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCrefMM1(threadData_t *threadData, modelica_string _ident, modelica_metatype _ty, modelica_metatype _ssl);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCrefMM1,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCrefMM1,0}};
#define boxvar_ExpressionSimplify_simplifyCrefMM1 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCrefMM1)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCrefMM(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inType, modelica_metatype _inCref);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCrefMM,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCrefMM,0}};
#define boxvar_ExpressionSimplify_simplifyCrefMM MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCrefMM)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCrefMM__index(threadData_t *threadData, modelica_metatype _inExp, modelica_string _ident, modelica_metatype _ty);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCrefMM__index,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCrefMM__index,0}};
#define boxvar_ExpressionSimplify_simplifyCrefMM__index MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCrefMM__index)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCref2(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inSsl);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCref2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCref2,0}};
#define boxvar_ExpressionSimplify_simplifyCref2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCref2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCref(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inCREF, modelica_metatype _inType);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCref,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCref,0}};
#define boxvar_ExpressionSimplify_simplifyCref MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCref)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBuiltinConstantCalls(threadData_t *threadData, modelica_string _name, modelica_metatype _exp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBuiltinConstantCalls,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBuiltinConstantCalls,0}};
#define boxvar_ExpressionSimplify_simplifyBuiltinConstantCalls MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBuiltinConstantCalls)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyStringAppendList(threadData_t *threadData, modelica_metatype _iexpl, modelica_metatype _iacc, modelica_boolean _ichange);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyStringAppendList(threadData_t *threadData, modelica_metatype _iexpl, modelica_metatype _iacc, modelica_metatype _ichange);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyStringAppendList,2,0) {(void*) boxptr_ExpressionSimplify_simplifyStringAppendList,0}};
#define boxvar_ExpressionSimplify_simplifyStringAppendList MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyStringAppendList)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBuiltinStringFormat(threadData_t *threadData, modelica_metatype _exp, modelica_metatype _len_exp, modelica_metatype _just_exp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBuiltinStringFormat,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBuiltinStringFormat,0}};
#define boxvar_ExpressionSimplify_simplifyBuiltinStringFormat MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBuiltinStringFormat)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_evalCatGetFlatArray(threadData_t *threadData, modelica_metatype _e, modelica_integer _dim, modelica_fnptr _getArrayContents, modelica_fnptr _toString, modelica_metatype *out_outDims);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_evalCatGetFlatArray(threadData_t *threadData, modelica_metatype _e, modelica_metatype _dim, modelica_fnptr _getArrayContents, modelica_fnptr _toString, modelica_metatype *out_outDims);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_evalCatGetFlatArray,2,0) {(void*) boxptr_ExpressionSimplify_evalCatGetFlatArray,0}};
#define boxvar_ExpressionSimplify_evalCatGetFlatArray MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_evalCatGetFlatArray)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCat2(threadData_t *threadData, modelica_integer _dim, modelica_metatype _ies, modelica_metatype _acc, modelica_boolean _changed);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyCat2(threadData_t *threadData, modelica_metatype _dim, modelica_metatype _ies, modelica_metatype _acc, modelica_metatype _changed);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCat2,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCat2,0}};
#define boxvar_ExpressionSimplify_simplifyCat2 MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCat2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCatArg(threadData_t *threadData, modelica_metatype _arg);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCatArg,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCatArg,0}};
#define boxvar_ExpressionSimplify_simplifyCatArg MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCatArg)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCat(threadData_t *threadData, modelica_integer _inDim, modelica_metatype _inExpList);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyCat(threadData_t *threadData, modelica_metatype _inDim, modelica_metatype _inExpList);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCat,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCat,0}};
#define boxvar_ExpressionSimplify_simplifyCat MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCat)
PROTECTED_FUNCTION_STATIC void omc_ExpressionSimplify_simplifySymmetric(threadData_t *threadData, modelica_metatype _marr, modelica_integer _i1, modelica_integer _i2);
PROTECTED_FUNCTION_STATIC void boxptr_ExpressionSimplify_simplifySymmetric(threadData_t *threadData, modelica_metatype _marr, modelica_metatype _i1, modelica_metatype _i2);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifySymmetric,2,0) {(void*) boxptr_ExpressionSimplify_simplifySymmetric,0}};
#define boxvar_ExpressionSimplify_simplifySymmetric MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifySymmetric)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_makeNestedReduction(threadData_t *threadData, modelica_metatype _inExp, modelica_string _inName, modelica_metatype _inType, modelica_metatype _inCall);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_makeNestedReduction,2,0) {(void*) boxptr_ExpressionSimplify_makeNestedReduction,0}};
#define boxvar_ExpressionSimplify_makeNestedReduction MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_makeNestedReduction)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyScalar(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _tp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyScalar,2,0) {(void*) boxptr_ExpressionSimplify_simplifyScalar,0}};
#define boxvar_ExpressionSimplify_simplifyScalar MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyScalar)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBuiltinCalls(threadData_t *threadData, modelica_metatype _exp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBuiltinCalls,2,0) {(void*) boxptr_ExpressionSimplify_simplifyBuiltinCalls,0}};
#define boxvar_ExpressionSimplify_simplifyBuiltinCalls MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyBuiltinCalls)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_reductionExpression(threadData_t *threadData, modelica_string _name, modelica_metatype _ty, modelica_string _foldName, modelica_string _resultName);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_reductionExpression,2,0) {(void*) boxptr_ExpressionSimplify_reductionExpression,0}};
#define boxvar_ExpressionSimplify_reductionExpression MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_reductionExpression)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_reductionDefaultValue(threadData_t *threadData, modelica_string _name, modelica_metatype _ty);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_reductionDefaultValue,2,0) {(void*) boxptr_ExpressionSimplify_reductionDefaultValue,0}};
#define boxvar_ExpressionSimplify_reductionDefaultValue MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_reductionDefaultValue)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_addCast(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inType);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_addCast,2,0) {(void*) boxptr_ExpressionSimplify_addCast,0}};
#define boxvar_ExpressionSimplify_addCast MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_addCast)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCast(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _exp, modelica_metatype _tp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCast,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCast,0}};
#define boxvar_ExpressionSimplify_simplifyCast MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCast)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatch(threadData_t *threadData, modelica_metatype _exp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatch,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMatch,0}};
#define boxvar_ExpressionSimplify_simplifyMatch MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMatch)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyUnbox(threadData_t *threadData, modelica_metatype _exp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyUnbox,2,0) {(void*) boxptr_ExpressionSimplify_simplifyUnbox,0}};
#define boxvar_ExpressionSimplify_simplifyUnbox MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyUnbox)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCons(threadData_t *threadData, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCons,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCons,0}};
#define boxvar_ExpressionSimplify_simplifyCons MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCons)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMetaModelicaCalls(threadData_t *threadData, modelica_metatype _exp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMetaModelicaCalls,2,0) {(void*) boxptr_ExpressionSimplify_simplifyMetaModelicaCalls,0}};
#define boxvar_ExpressionSimplify_simplifyMetaModelicaCalls MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyMetaModelicaCalls)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyIfExp(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _cond, modelica_metatype _tb, modelica_metatype _fb);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyIfExp,2,0) {(void*) boxptr_ExpressionSimplify_simplifyIfExp,0}};
#define boxvar_ExpressionSimplify_simplifyIfExp MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyIfExp)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyReductionIterators(threadData_t *threadData, modelica_metatype _inIters, modelica_metatype _inAcc, modelica_boolean _inChange, modelica_boolean *out_outChange);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyReductionIterators(threadData_t *threadData, modelica_metatype _inIters, modelica_metatype _inAcc, modelica_metatype _inChange, modelica_metatype *out_outChange);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyReductionIterators,2,0) {(void*) boxptr_ExpressionSimplify_simplifyReductionIterators,0}};
#define boxvar_ExpressionSimplify_simplifyReductionIterators MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyReductionIterators)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplify1FixP(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inOptions, modelica_integer _n, modelica_boolean _cont, modelica_boolean _hasChanged, modelica_boolean *out_outHasChanged);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplify1FixP(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inOptions, modelica_metatype _n, modelica_metatype _cont, modelica_metatype _hasChanged, modelica_metatype *out_outHasChanged);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplify1FixP,2,0) {(void*) boxptr_ExpressionSimplify_simplify1FixP,0}};
#define boxvar_ExpressionSimplify_simplify1FixP MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplify1FixP)
PROTECTED_FUNCTION_STATIC void omc_ExpressionSimplify_checkSimplify(threadData_t *threadData, modelica_boolean _check, modelica_metatype _before, modelica_metatype _after);
PROTECTED_FUNCTION_STATIC void boxptr_ExpressionSimplify_checkSimplify(threadData_t *threadData, modelica_metatype _check, modelica_metatype _before, modelica_metatype _after);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_checkSimplify,2,0) {(void*) boxptr_ExpressionSimplify_checkSimplify,0}};
#define boxvar_ExpressionSimplify_checkSimplify MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_checkSimplify)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_edgeCref(threadData_t *threadData, modelica_metatype _ie, modelica_boolean _ib, modelica_boolean *out_cont, modelica_boolean *out_ob);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_edgeCref(threadData_t *threadData, modelica_metatype _ie, modelica_metatype _ib, modelica_metatype *out_cont, modelica_metatype *out_ob);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_edgeCref,2,0) {(void*) boxptr_ExpressionSimplify_edgeCref,0}};
#define boxvar_ExpressionSimplify_edgeCref MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_edgeCref)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_changeCref(threadData_t *threadData, modelica_metatype _ie, modelica_boolean _ib, modelica_boolean *out_cont, modelica_boolean *out_ob);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_changeCref(threadData_t *threadData, modelica_metatype _ie, modelica_metatype _ib, modelica_metatype *out_cont, modelica_metatype *out_ob);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_changeCref,2,0) {(void*) boxptr_ExpressionSimplify_changeCref,0}};
#define boxvar_ExpressionSimplify_changeCref MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_changeCref)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_previousCref(threadData_t *threadData, modelica_metatype _ie, modelica_boolean _ib, modelica_boolean *out_cont, modelica_boolean *out_ob);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_previousCref(threadData_t *threadData, modelica_metatype _ie, modelica_metatype _ib, modelica_metatype *out_cont, modelica_metatype *out_ob);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_previousCref,2,0) {(void*) boxptr_ExpressionSimplify_previousCref,0}};
#define boxvar_ExpressionSimplify_previousCref MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_previousCref)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_preCref(threadData_t *threadData, modelica_metatype _ie, modelica_boolean _ib, modelica_boolean *out_cont, modelica_boolean *out_ob);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_preCref(threadData_t *threadData, modelica_metatype _ie, modelica_metatype _ib, modelica_metatype *out_cont, modelica_metatype *out_ob);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_preCref,2,0) {(void*) boxptr_ExpressionSimplify_preCref,0}};
#define boxvar_ExpressionSimplify_preCref MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_preCref)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCall(threadData_t *threadData, modelica_metatype _inExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCall,2,0) {(void*) boxptr_ExpressionSimplify_simplifyCall,0}};
#define boxvar_ExpressionSimplify_simplifyCall MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyCall)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubExp(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inExp, modelica_metatype _inSubs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubExp,2,0) {(void*) boxptr_ExpressionSimplify_simplifyAsubExp,0}};
#define boxvar_ExpressionSimplify_simplifyAsubExp MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyAsubExp)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyRSub(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fe);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyRSub,2,0) {(void*) boxptr_ExpressionSimplify_simplifyRSub,0}};
#define boxvar_ExpressionSimplify_simplifyRSub MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyRSub)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyWithOptions(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _options, modelica_boolean *out_hasChanged);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyWithOptions(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _options, modelica_metatype *out_hasChanged);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyWithOptions,2,0) {(void*) boxptr_ExpressionSimplify_simplifyWithOptions,0}};
#define boxvar_ExpressionSimplify_simplifyWithOptions MMC_REFSTRUCTLIT(boxvar_lit_ExpressionSimplify_simplifyWithOptions)

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyCross(threadData_t *threadData, modelica_metatype _v1, modelica_metatype _v2)
{
  modelica_metatype _res = NULL;
  modelica_metatype _x1 = NULL;
  modelica_metatype _x2 = NULL;
  modelica_metatype _x3 = NULL;
  modelica_metatype _y1 = NULL;
  modelica_metatype _y2 = NULL;
  modelica_metatype _y3 = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  modelica_metatype tmpMeta8;
  modelica_metatype tmpMeta9;
  modelica_metatype tmpMeta10;
  modelica_metatype tmpMeta11;
  modelica_metatype tmpMeta12;
  modelica_metatype tmpMeta13;
  modelica_metatype tmpMeta14;
  modelica_metatype tmpMeta15;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  // _x1 has no default value.
  // _x2 has no default value.
  // _x3 has no default value.
  // _y1 has no default value.
  // _y2 has no default value.
  // _y3 has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _v1;
  if (listEmpty(tmpMeta1)) MMC_THROW_INTERNAL();
  tmpMeta2 = MMC_CAR(tmpMeta1);
  tmpMeta3 = MMC_CDR(tmpMeta1);
  if (listEmpty(tmpMeta3)) MMC_THROW_INTERNAL();
  tmpMeta4 = MMC_CAR(tmpMeta3);
  tmpMeta5 = MMC_CDR(tmpMeta3);
  if (listEmpty(tmpMeta5)) MMC_THROW_INTERNAL();
  tmpMeta6 = MMC_CAR(tmpMeta5);
  tmpMeta7 = MMC_CDR(tmpMeta5);
  if (!listEmpty(tmpMeta7)) MMC_THROW_INTERNAL();
  _x1 = tmpMeta2;
  _x2 = tmpMeta4;
  _x3 = tmpMeta6;

  /* Pattern-matching assignment */
  tmpMeta8 = _v2;
  if (listEmpty(tmpMeta8)) MMC_THROW_INTERNAL();
  tmpMeta9 = MMC_CAR(tmpMeta8);
  tmpMeta10 = MMC_CDR(tmpMeta8);
  if (listEmpty(tmpMeta10)) MMC_THROW_INTERNAL();
  tmpMeta11 = MMC_CAR(tmpMeta10);
  tmpMeta12 = MMC_CDR(tmpMeta10);
  if (listEmpty(tmpMeta12)) MMC_THROW_INTERNAL();
  tmpMeta13 = MMC_CAR(tmpMeta12);
  tmpMeta14 = MMC_CDR(tmpMeta12);
  if (!listEmpty(tmpMeta14)) MMC_THROW_INTERNAL();
  _y1 = tmpMeta9;
  _y2 = tmpMeta11;
  _y3 = tmpMeta13;

  tmpMeta15 = mmc_mk_cons(omc_Expression_expSub(threadData, omc_Expression_makeProduct(threadData, _x2, _y3), omc_Expression_makeProduct(threadData, _x3, _y2)), mmc_mk_cons(omc_Expression_expSub(threadData, omc_Expression_makeProduct(threadData, _x3, _y1), omc_Expression_makeProduct(threadData, _x1, _y3)), mmc_mk_cons(omc_Expression_expSub(threadData, omc_Expression_makeProduct(threadData, _x1, _y2), omc_Expression_makeProduct(threadData, _x2, _y1)), MMC_REFSTRUCTLIT(mmc_nil))));
  _res = tmpMeta15;
  _return: OMC_LABEL_UNUSED
  return _res;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifySkew(threadData_t *threadData, modelica_metatype _v1)
{
  modelica_metatype _res = NULL;
  modelica_metatype _x1 = NULL;
  modelica_metatype _x2 = NULL;
  modelica_metatype _x3 = NULL;
  modelica_metatype _zero = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  modelica_metatype tmpMeta8;
  modelica_metatype tmpMeta9;
  modelica_metatype tmpMeta10;
  modelica_metatype tmpMeta11;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  // _x1 has no default value.
  // _x2 has no default value.
  // _x3 has no default value.
  // _zero has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _v1;
  if (listEmpty(tmpMeta1)) MMC_THROW_INTERNAL();
  tmpMeta2 = MMC_CAR(tmpMeta1);
  tmpMeta3 = MMC_CDR(tmpMeta1);
  if (listEmpty(tmpMeta3)) MMC_THROW_INTERNAL();
  tmpMeta4 = MMC_CAR(tmpMeta3);
  tmpMeta5 = MMC_CDR(tmpMeta3);
  if (listEmpty(tmpMeta5)) MMC_THROW_INTERNAL();
  tmpMeta6 = MMC_CAR(tmpMeta5);
  tmpMeta7 = MMC_CDR(tmpMeta5);
  if (!listEmpty(tmpMeta7)) MMC_THROW_INTERNAL();
  _x1 = tmpMeta2;
  _x2 = tmpMeta4;
  _x3 = tmpMeta6;

  _zero = omc_Expression_makeConstZero(threadData, omc_Expression_typeof(threadData, _x1));

  tmpMeta9 = mmc_mk_cons(_zero, mmc_mk_cons(omc_Expression_negate(threadData, _x3), mmc_mk_cons(_x2, MMC_REFSTRUCTLIT(mmc_nil))));
  tmpMeta10 = mmc_mk_cons(_x3, mmc_mk_cons(_zero, mmc_mk_cons(omc_Expression_negate(threadData, _x1), MMC_REFSTRUCTLIT(mmc_nil))));
  tmpMeta11 = mmc_mk_cons(omc_Expression_negate(threadData, _x2), mmc_mk_cons(_x1, mmc_mk_cons(_zero, MMC_REFSTRUCTLIT(mmc_nil))));
  tmpMeta8 = mmc_mk_cons(tmpMeta9, mmc_mk_cons(tmpMeta10, mmc_mk_cons(tmpMeta11, MMC_REFSTRUCTLIT(mmc_nil))));
  _res = tmpMeta8;
  _return: OMC_LABEL_UNUSED
  return _res;
}

PROTECTED_FUNCTION_STATIC modelica_boolean omc_ExpressionSimplify_removeMinMaxFoldableValues(threadData_t *threadData, modelica_metatype _e)
{
  modelica_boolean _filter;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _filter has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _e;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = 0 /* false */;
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = 0 /* false */;
          goto tmp3_done;
        }
        case 6: {
          
          /* Pattern matching succeeded */
          tmp1 = 0 /* false */;
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _filter = tmp1;
  _return: OMC_LABEL_UNUSED
  return _filter;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_removeMinMaxFoldableValues(threadData_t *threadData, modelica_metatype _e)
{
  modelica_boolean _filter;
  modelica_metatype out_filter;
  _filter = omc_ExpressionSimplify_removeMinMaxFoldableValues(threadData, _e);
  out_filter = mmc_mk_icon(_filter);
  return out_filter;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_minElement(threadData_t *threadData, modelica_metatype _e1, modelica_metatype _e2)
{
  modelica_metatype _elt = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _elt has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;
    tmp4_1 = _e1;
    tmp4_2 = _e2;
    {
      modelica_real _r1;
      modelica_real _r2;
      modelica_integer _i1;
      modelica_integer _i2;
      modelica_boolean _b1;
      modelica_boolean _b2;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _r1 has no default value.
      // _r2 has no default value.
      // _i1 has no default value.
      // _i2 has no default value.
      // _b1 has no default value.
      // _b2 has no default value.
      tmp4 = 0;
      for (; tmp4 < 7; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          if (!optionNone(tmp4_2)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta1 = mmc_mk_some(_e1);
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (!optionNone(tmp4_2)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta1 = mmc_mk_some(_e1);
          goto tmp3_done;
        }
        case 2: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (!optionNone(tmp4_2)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta1 = mmc_mk_some(_e1);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta6;
          modelica_real tmp7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_real tmp10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp7 = mmc_unbox_real(tmpMeta6);
          if (optionNone(tmp4_2)) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          tmp10 = mmc_unbox_real(tmpMeta9);
          _r1 = tmp7  /* pattern as ty=Real */;
          _r2 = tmp10  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          tmpMeta1 = ((_r1 < _r2)?mmc_mk_some(_e1):_e2);
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta11;
          modelica_integer tmp12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_integer tmp15;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp12 = mmc_unbox_integer(tmpMeta11);
          if (optionNone(tmp4_2)) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta13,0,1) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 2));
          tmp15 = mmc_unbox_integer(tmpMeta14);
          _i1 = tmp12  /* pattern as ty=Integer */;
          _i2 = tmp15  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          tmpMeta1 = ((_i1 < _i2)?mmc_mk_some(_e1):_e2);
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta16;
          modelica_integer tmp17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_integer tmp20;
          modelica_metatype tmpMeta21;
          modelica_boolean tmp22;
          modelica_metatype tmpMeta23;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp17 = mmc_unbox_integer(tmpMeta16);
          if (optionNone(tmp4_2)) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,3,1) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 2));
          tmp20 = mmc_unbox_integer(tmpMeta19);
          _b1 = tmp17  /* pattern as ty=Boolean */;
          _b2 = tmp20  /* pattern as ty=Boolean */;
          /* Pattern matching succeeded */
          tmp22 = (modelica_boolean)((!_b2) || (!_b1 == !_b2));
          if(tmp22)
          {
            tmpMeta23 = _e2;
          }
          else
          {
            tmpMeta21 = mmc_mk_box2(6, &DAE_Exp_BCONST__desc, mmc_mk_boolean(_b1));
            tmpMeta23 = mmc_mk_some(tmpMeta21);
          }
          tmpMeta1 = tmpMeta23;
          goto tmp3_done;
        }
        case 6: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _e2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _elt = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _elt;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_maxElement(threadData_t *threadData, modelica_metatype _e1, modelica_metatype _e2)
{
  modelica_metatype _elt = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _elt has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;
    tmp4_1 = _e1;
    tmp4_2 = _e2;
    {
      modelica_real _r1;
      modelica_real _r2;
      modelica_integer _i1;
      modelica_integer _i2;
      modelica_boolean _b1;
      modelica_boolean _b2;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _r1 has no default value.
      // _r2 has no default value.
      // _i1 has no default value.
      // _i2 has no default value.
      // _b1 has no default value.
      // _b2 has no default value.
      tmp4 = 0;
      for (; tmp4 < 7; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          if (!optionNone(tmp4_2)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta1 = mmc_mk_some(_e1);
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (!optionNone(tmp4_2)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta1 = mmc_mk_some(_e1);
          goto tmp3_done;
        }
        case 2: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (!optionNone(tmp4_2)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta1 = mmc_mk_some(_e1);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta6;
          modelica_real tmp7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_real tmp10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp7 = mmc_unbox_real(tmpMeta6);
          if (optionNone(tmp4_2)) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          tmp10 = mmc_unbox_real(tmpMeta9);
          _r1 = tmp7  /* pattern as ty=Real */;
          _r2 = tmp10  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          tmpMeta1 = ((_r1 > _r2)?mmc_mk_some(_e1):_e2);
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta11;
          modelica_integer tmp12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_integer tmp15;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp12 = mmc_unbox_integer(tmpMeta11);
          if (optionNone(tmp4_2)) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta13,0,1) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 2));
          tmp15 = mmc_unbox_integer(tmpMeta14);
          _i1 = tmp12  /* pattern as ty=Integer */;
          _i2 = tmp15  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          tmpMeta1 = ((_i1 > _i2)?mmc_mk_some(_e1):_e2);
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta16;
          modelica_integer tmp17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_integer tmp20;
          modelica_metatype tmpMeta21;
          modelica_boolean tmp22;
          modelica_metatype tmpMeta23;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp17 = mmc_unbox_integer(tmpMeta16);
          if (optionNone(tmp4_2)) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,3,1) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 2));
          tmp20 = mmc_unbox_integer(tmpMeta19);
          _b1 = tmp17  /* pattern as ty=Boolean */;
          _b2 = tmp20  /* pattern as ty=Boolean */;
          /* Pattern matching succeeded */
          tmp22 = (modelica_boolean)(_b2 || (!_b1 == !_b2));
          if(tmp22)
          {
            tmpMeta23 = _e2;
          }
          else
          {
            tmpMeta21 = mmc_mk_box2(6, &DAE_Exp_BCONST__desc, mmc_mk_boolean(_b1));
            tmpMeta23 = mmc_mk_some(tmpMeta21);
          }
          tmpMeta1 = tmpMeta23;
          goto tmp3_done;
        }
        case 6: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _e2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _elt = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _elt;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyNoEvent(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _e = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _e has no default value.
  _e = omc_Expression_addNoEventToEventTriggeringFunctions(threadData, omc_Expression_addNoEventToRelations(threadData, omc_Expression_stripNoEvent(threadData, _inExp)));
  _return: OMC_LABEL_UNUSED
  return _e;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyTSub(threadData_t *threadData, modelica_metatype _origExp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _origExp;
    {
      modelica_metatype _expl = NULL;
      modelica_integer _i;
      modelica_metatype _e = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _expl has no default value.
      // _i has no default value.
      // _e has no default value.
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_integer tmp10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,22,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,20,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,19,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta7), 2));
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp10 = mmc_unbox_integer(tmpMeta9);
          
          _expl = tmpMeta8;
          _i = tmp10  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          tmpMeta1 = listGet(_expl, _i);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_integer tmp14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,22,3) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta11,19,1) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta11), 2));
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp14 = mmc_unbox_integer(tmpMeta13);
          
          _expl = tmpMeta12;
          _i = tmp14  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          tmpMeta1 = listGet(_expl, _i);
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta15;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,22,3) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta15,1,1) == 0) goto tmp3_end;
          
          _e = tmpMeta15;
          /* Pattern matching succeeded */
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifySize(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _exp, modelica_metatype _optDim)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;
    tmp4_1 = _optDim;
    {
      modelica_integer _i;
      modelica_integer _n;
      modelica_metatype _t = NULL;
      modelica_metatype _dims = NULL;
      modelica_metatype _dim = NULL;
      modelica_metatype _dimExp = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _i has no default value.
      // _n has no default value.
      // _t has no default value.
      // _dims has no default value.
      // _dim has no default value.
      // _dimExp has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (optionNone(tmp4_1)) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 1));
          _dimExp = tmpMeta6;
          /* Pattern matching succeeded */
          _i = omc_Expression_expInt(threadData, _dimExp);

          _t = omc_Expression_typeof(threadData, _exp);

          _dims = omc_Expression_arrayDimension(threadData, _t);

          _dim = listGet(_dims, _i);

          _n = omc_Expression_dimensionSize(threadData, _dim);
          tmpMeta7 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_n));
          tmpMeta1 = tmpMeta7;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 2) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_condSimplifyAddSymbolicOperation(threadData_t *threadData, modelica_boolean _cond, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype __omcQ_24in_5Fsource, modelica_metatype *out_source)
{
  modelica_metatype _exp = NULL;
  modelica_metatype _source = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _exp = __omcQ_24in_5Fexp;
  _source = __omcQ_24in_5Fsource;
  if(_cond)
  {
    _exp = omc_ExpressionSimplify_simplifyAddSymbolicOperation(threadData, _exp, _source ,&_source);
  }
  _return: OMC_LABEL_UNUSED
  if (out_source) { *out_source = _source; }
  return _exp;
}
modelica_metatype boxptr_ExpressionSimplify_condSimplifyAddSymbolicOperation(threadData_t *threadData, modelica_metatype _cond, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype __omcQ_24in_5Fsource, modelica_metatype *out_source)
{
  modelica_integer tmp1;
  modelica_metatype _exp = NULL;
  tmp1 = mmc_unbox_integer(_cond);
  _exp = omc_ExpressionSimplify_condSimplifyAddSymbolicOperation(threadData, tmp1, __omcQ_24in_5Fexp, __omcQ_24in_5Fsource, out_source);
  /* skip box _exp; DAE.EquationExp */
  /* skip box _source; DAE.ElementSource */
  return _exp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyAddSymbolicOperation(threadData_t *threadData, modelica_metatype _exp, modelica_metatype _source, modelica_metatype *out_outSource)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _outSource = NULL;
  modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _outSource has no default value.
  
  
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _exp;
    {
      modelica_boolean _changed;
      modelica_boolean _changed1;
      modelica_boolean _changed2;
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      int tmp4;
      // _changed has no default value.
      // _changed1 has no default value.
      // _changed2 has no default value.
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          modelica_boolean tmp7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          _e = tmpMeta5;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplify(threadData, _e ,&_changed);

          tmp7 = (modelica_boolean)_changed;
          if(tmp7)
          {
            tmpMeta6 = mmc_mk_box2(3, &DAE_EquationExp_PARTIAL__EQUATION__desc, _e);
            tmpMeta8 = tmpMeta6;
          }
          else
          {
            tmpMeta8 = _exp;
          }
          _outExp = tmpMeta8;

          tmpMeta9 = mmc_mk_box3(4, &DAE_SymbolicOperation_SIMPLIFY__desc, _exp, _outExp);
          _outSource = omc_ElementSource_condAddSymbolicTransformation(threadData, _changed, _source, tmpMeta9);
          tmpMeta[0+0] = _outExp;
          tmpMeta[0+1] = _outSource;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_boolean tmp12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          _e = tmpMeta10;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplify(threadData, _e ,&_changed);

          tmp12 = (modelica_boolean)_changed;
          if(tmp12)
          {
            tmpMeta11 = mmc_mk_box2(4, &DAE_EquationExp_RESIDUAL__EXP__desc, _e);
            tmpMeta13 = tmpMeta11;
          }
          else
          {
            tmpMeta13 = _exp;
          }
          _outExp = tmpMeta13;

          tmpMeta14 = mmc_mk_box3(4, &DAE_SymbolicOperation_SIMPLIFY__desc, _exp, _outExp);
          _outSource = omc_ElementSource_condAddSymbolicTransformation(threadData, _changed, _source, tmpMeta14);
          tmpMeta[0+0] = _outExp;
          tmpMeta[0+1] = _outSource;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_boolean tmp18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,2) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _e1 = tmpMeta15;
          _e2 = tmpMeta16;
          /* Pattern matching succeeded */
          _e1 = omc_ExpressionSimplify_simplify(threadData, _e1 ,&_changed1);

          _e2 = omc_ExpressionSimplify_simplify(threadData, _e2 ,&_changed2);

          _changed = (_changed1 || _changed2);

          tmp18 = (modelica_boolean)_changed;
          if(tmp18)
          {
            tmpMeta17 = mmc_mk_box3(5, &DAE_EquationExp_EQUALITY__EXPS__desc, _e1, _e2);
            tmpMeta19 = tmpMeta17;
          }
          else
          {
            tmpMeta19 = _exp;
          }
          _outExp = tmpMeta19;

          tmpMeta20 = mmc_mk_box3(4, &DAE_SymbolicOperation_SIMPLIFY__desc, _exp, _outExp);
          _outSource = omc_ElementSource_condAddSymbolicTransformation(threadData, _changed, _source, tmpMeta20);
          tmpMeta[0+0] = _outExp;
          tmpMeta[0+1] = _outSource;
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          omc_Error_addMessage(threadData, _OMC_LIT4, _OMC_LIT6);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta[0+0];
  _outSource = tmpMeta[0+1];
  _return: OMC_LABEL_UNUSED
  if (out_outSource) { *out_outSource = _outSource; }
  return _outExp;
}

PROTECTED_FUNCTION_STATIC void omc_ExpressionSimplify_checkZeroLengthArrayOp(threadData_t *threadData, modelica_metatype _op)
{
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _op;
    {
      int tmp3;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
        case 10: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 11: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 12: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 13: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 23: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 24: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 14: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 15: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 19: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 16: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 20: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 18: {
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        }
        goto tmp2_end;
        tmp2_end: ;
      }
      goto goto_1;
      goto_1:;
      MMC_THROW_INTERNAL();
      goto tmp2_done;
      tmp2_done:;
    }
  }
  ;
  _return: OMC_LABEL_UNUSED
  return;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_condsimplifyList1(threadData_t *threadData, modelica_metatype _blst, modelica_metatype _expl, modelica_metatype *out_outBool)
{
  modelica_metatype _outExpl = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _outBool = NULL;
  modelica_metatype tmpMeta2;
  modelica_metatype _rest_expl = NULL;
  modelica_metatype _exp = NULL;
  modelica_boolean _b2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  modelica_metatype tmpMeta8;
  modelica_metatype tmpMeta9;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _outExpl = tmpMeta1;
  tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
  _outBool = tmpMeta2;
  _rest_expl = _expl;
  // _exp has no default value.
  // _b2 has no default value.
  {
    modelica_metatype _b;
    for (tmpMeta3 = _blst; !listEmpty(tmpMeta3); tmpMeta3=MMC_CDR(tmpMeta3))
    {
      _b = MMC_CAR(tmpMeta3);
      /* Pattern-matching assignment */
      tmpMeta4 = _rest_expl;
      if (listEmpty(tmpMeta4)) MMC_THROW_INTERNAL();
      tmpMeta5 = MMC_CAR(tmpMeta4);
      tmpMeta6 = MMC_CDR(tmpMeta4);
      _exp = tmpMeta5;
      _rest_expl = tmpMeta6;

      _exp = omc_ExpressionSimplify_condsimplify(threadData, mmc_unbox_boolean(_b), _exp ,&_b2);

      tmpMeta7 = mmc_mk_cons(_exp, _outExpl);
      _outExpl = tmpMeta7;

      tmpMeta8 = mmc_mk_cons(mmc_mk_boolean(_b2), _outBool);
      _outBool = tmpMeta8;
    }
  }

  _outExpl = listReverseInPlace(_outExpl);

  _outBool = listReverseInPlace(_outBool);
  _return: OMC_LABEL_UNUSED
  if (out_outBool) { *out_outBool = _outBool; }
  return _outExpl;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyList1(threadData_t *threadData, modelica_metatype _expl, modelica_metatype *out_outBool)
{
  modelica_metatype _outExpl = NULL;
  modelica_metatype _outBool = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExpl has no default value.
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _outBool = tmpMeta1;
  {
    modelica_metatype __omcQ_24tmpVar3;
    modelica_metatype* tmp3;
    modelica_metatype tmpMeta4;
    modelica_metatype tmpMeta5;
    modelica_metatype __omcQ_24tmpVar2;
    modelica_integer tmp11;
    modelica_metatype _exp_loopVar = 0;
    modelica_metatype _exp;
    _exp_loopVar = _expl;
    tmpMeta4 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar3 = tmpMeta4; /* defaultValue */
    tmp3 = &__omcQ_24tmpVar3;
    while(1) {
      tmp11 = 1;
      if (!listEmpty(_exp_loopVar)) {
        _exp = MMC_CAR(_exp_loopVar);
        _exp_loopVar = MMC_CDR(_exp_loopVar);
        tmp11--;
      }
      if (tmp11 == 0) {
        { /* match expression */
          {
            modelica_metatype _e = NULL;
            modelica_boolean _b2;
            volatile mmc_switch_type tmp8;
            int tmp9;
            // _e has no default value.
            // _b2 has no default value.
            tmp8 = 0;
            for (; tmp8 < 1; tmp8++) {
              switch (MMC_SWITCH_CAST(tmp8)) {
              case 0: {
                modelica_metatype tmpMeta10;
                /* Pattern matching succeeded */
                _e = omc_ExpressionSimplify_simplify(threadData, _exp ,&_b2);

                tmpMeta10 = mmc_mk_cons(mmc_mk_boolean(_b2), _outBool);
                _outBool = tmpMeta10;
                tmpMeta5 = _e;
                goto tmp7_done;
              }
              }
              goto tmp7_end;
              tmp7_end: ;
            }
            goto goto_6;
            goto_6:;
            MMC_THROW_INTERNAL();
            goto tmp7_done;
            tmp7_done:;
          }
        }__omcQ_24tmpVar2 = tmpMeta5;
        *tmp3 = mmc_mk_cons(__omcQ_24tmpVar2,0);
        tmp3 = &MMC_CDR(*tmp3);
      } else if (tmp11 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp3 = mmc_mk_nil();
    tmpMeta2 = __omcQ_24tmpVar3;
  }
  _outExpl = tmpMeta2;

  _outBool = listReverseInPlace(_outBool);
  _return: OMC_LABEL_UNUSED
  if (out_outBool) { *out_outBool = _outBool; }
  return _outExpl;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyList(threadData_t *threadData, modelica_metatype _expl)
{
  modelica_metatype _outExpl = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExpl has no default value.
  {
    modelica_metatype __omcQ_24tmpVar5;
    modelica_metatype* tmp2;
    modelica_metatype tmpMeta3;
    modelica_metatype __omcQ_24tmpVar4;
    modelica_integer tmp4;
    modelica_metatype _exp_loopVar = 0;
    modelica_metatype _exp;
    _exp_loopVar = _expl;
    tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar5 = tmpMeta3; /* defaultValue */
    tmp2 = &__omcQ_24tmpVar5;
    while(1) {
      tmp4 = 1;
      if (!listEmpty(_exp_loopVar)) {
        _exp = MMC_CAR(_exp_loopVar);
        _exp_loopVar = MMC_CDR(_exp_loopVar);
        tmp4--;
      }
      if (tmp4 == 0) {
        __omcQ_24tmpVar4 = omc_ExpressionSimplify_simplify1(threadData, _exp, NULL);
        *tmp2 = mmc_mk_cons(__omcQ_24tmpVar4,0);
        tmp2 = &MMC_CDR(*tmp2);
      } else if (tmp4 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp2 = mmc_mk_nil();
    tmpMeta1 = __omcQ_24tmpVar5;
  }
  _outExpl = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExpl;
}

PROTECTED_FUNCTION_STATIC modelica_boolean omc_ExpressionSimplify_hasZeroLengthIterator(threadData_t *threadData, modelica_metatype _inIters)
{
  modelica_boolean _b;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _b has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inIters;
    {
      modelica_metatype _iters = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _iters has no default value.
      tmp4 = 0;
      for (; tmp4 < 5; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (!listEmpty(tmp4_1)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = 0 /* false */;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_integer tmp11;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta6 = MMC_CAR(tmp4_1);
          tmpMeta7 = MMC_CDR(tmp4_1);
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 4));
          if (optionNone(tmpMeta8)) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,3,1) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 2));
          tmp11 = mmc_unbox_integer(tmpMeta10);
          if (0 /* false */ != tmp11) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta12 = MMC_CAR(tmp4_1);
          tmpMeta13 = MMC_CDR(tmp4_1);
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta12), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta14,28,1) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta14), 2));
          if (!listEmpty(tmpMeta15)) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta16 = MMC_CAR(tmp4_1);
          tmpMeta17 = MMC_CDR(tmp4_1);
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta16), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,16,3) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 4));
          if (!listEmpty(tmpMeta19)) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta20 = MMC_CAR(tmp4_1);
          tmpMeta21 = MMC_CDR(tmp4_1);
          _iters = tmpMeta21;
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _inIters = _iters;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _b = tmp1;
  _return: OMC_LABEL_UNUSED
  return _b;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_hasZeroLengthIterator(threadData_t *threadData, modelica_metatype _inIters)
{
  modelica_boolean _b;
  modelica_metatype out_b;
  _b = omc_ExpressionSimplify_hasZeroLengthIterator(threadData, _inIters);
  out_b = mmc_mk_icon(_b);
  return out_b;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyReductionFoldPhase2(threadData_t *threadData, modelica_metatype _inExps, modelica_metatype _foldExp, modelica_string _foldName, modelica_string _resultName, modelica_metatype _acc)
{
  modelica_metatype _exp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExps;
    {
      modelica_metatype _exps = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _exps has no default value.
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (!listEmpty(tmp4_1)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta1 = _acc;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta6 = MMC_CAR(tmp4_1);
          tmpMeta7 = MMC_CDR(tmp4_1);
          _exp = tmpMeta6;
          _exps = tmpMeta7;
          /* Pattern matching succeeded */
          _exp = omc_ExpressionSimplify_replaceIteratorWithExp(threadData, _exp, _foldExp, _foldName);

          _exp = omc_ExpressionSimplify_replaceIteratorWithExp(threadData, _acc, _exp, _resultName);
          /* Tail recursive call */
          _inExps = _exps;
          _acc = _exp;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyReductionFoldPhase(threadData_t *threadData, modelica_metatype _path, modelica_metatype _optFoldExp, modelica_string _foldName, modelica_string _resultName, modelica_metatype _ty, modelica_metatype _inExps, modelica_metatype _defaultValue)
{
  modelica_metatype _exp = NULL;
  modelica_boolean _checkForSimplifications;
  modelica_boolean tmp1_c1 __attribute__((unused)) = 0;
  modelica_boolean tmp19;
  modelica_metatype tmpMeta20;
  modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  // _checkForSimplifications has no default value.
  
  
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_metatype tmp4_3;modelica_metatype tmp4_4;
    tmp4_1 = _path;
    tmp4_2 = _optFoldExp;
    tmp4_3 = _inExps;
    tmp4_4 = _defaultValue;
    {
      modelica_metatype _val = NULL;
      modelica_metatype _arr_exp = NULL;
      modelica_metatype _foldExp = NULL;
      modelica_metatype _aty = NULL;
      modelica_metatype _ty2 = NULL;
      modelica_metatype _exps = NULL;
      modelica_integer _length;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _val has no default value.
      // _arr_exp has no default value.
      // _foldExp has no default value.
      // _aty has no default value.
      // _ty2 has no default value.
      // _exps has no default value.
      // _length has no default value.
      tmp4 = 0;
      for (; tmp4 < 7; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (5 != MMC_STRLEN(tmpMeta6) || strcmp(MMC_STRINGDATA(_OMC_LIT9), MMC_STRINGDATA(tmpMeta6)) != 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _aty = omc_Types_unliftArray(threadData, omc_Types_expTypetoTypesType(threadData, _ty));

          _length = listLength(_inExps);

          tmpMeta7 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_length));
          _ty2 = omc_Types_liftArray(threadData, _aty, tmpMeta7);

          _exp = omc_Expression_makeArray(threadData, _inExps, _ty2, (!omc_Types_isArray(threadData, _aty)));
          tmpMeta[0+0] = _exp;
          tmp1_c1 = 0 /* false */;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          if (!listEmpty(tmp4_3)) goto tmp3_end;
          if (optionNone(tmp4_4)) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_4), 1));
          
          _val = tmpMeta8;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = omc_ValuesUtil_valueExp(threadData, _val, mmc_mk_none());
          tmp1_c1 = 0 /* false */;
          goto tmp3_done;
        }
        case 2: {
          if (!listEmpty(tmp4_3)) goto tmp3_end;
          if (!optionNone(tmp4_4)) goto tmp3_end;
          
          /* Pattern matching succeeded */
          goto goto_2;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (3 != MMC_STRLEN(tmpMeta9) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmpMeta9)) != 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _arr_exp = omc_Expression_makeScalarArray(threadData, _inExps, _ty);
          tmpMeta10 = mmc_mk_cons(_arr_exp, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta[0+0] = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT7, tmpMeta10, _ty);
          tmp1_c1 = 1 /* true */;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (3 != MMC_STRLEN(tmpMeta11) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmpMeta11)) != 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _arr_exp = omc_Expression_makeScalarArray(threadData, _inExps, _ty);
          tmpMeta12 = mmc_mk_cons(_arr_exp, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta[0+0] = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT8, tmpMeta12, _ty);
          tmp1_c1 = 1 /* true */;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          if (optionNone(tmp4_2)) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          if (listEmpty(tmp4_3)) goto tmp3_end;
          tmpMeta14 = MMC_CAR(tmp4_3);
          tmpMeta15 = MMC_CDR(tmp4_3);
          if (!listEmpty(tmpMeta15)) goto tmp3_end;
          
          _exp = tmpMeta14;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _exp;
          tmp1_c1 = 0 /* false */;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          if (optionNone(tmp4_2)) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          if (listEmpty(tmp4_3)) goto tmp3_end;
          tmpMeta17 = MMC_CAR(tmp4_3);
          tmpMeta18 = MMC_CDR(tmp4_3);
          
          _foldExp = tmpMeta16;
          _exp = tmpMeta17;
          _exps = tmpMeta18;
          /* Pattern matching succeeded */
          _exp = omc_ExpressionSimplify_simplifyReductionFoldPhase2(threadData, _exps, _foldExp, _foldName, _resultName, _exp);
          tmpMeta[0+0] = _exp;
          tmp1_c1 = 0 /* false */;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _exp = tmpMeta[0+0];
  _checkForSimplifications = tmp1_c1;

  if(_checkForSimplifications)
  {
    /* Pattern-matching tuple assignment */
    tmpMeta20 = omc_ExpressionSimplify_simplify1(threadData, _exp, &tmp19);
    _exp = tmpMeta20;
    if (1 /* true */ != tmp19) MMC_THROW_INTERNAL();
  }
  _return: OMC_LABEL_UNUSED
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_replaceIteratorWithExpTraverser(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inTpl, modelica_metatype *out_outTpl)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _outTpl = NULL;
  modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _outTpl has no default value.
  
  
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;
    tmp4_1 = _inExp;
    tmp4_2 = _inTpl;
    {
      modelica_string _id = NULL;
      modelica_string _id2 = NULL;
      modelica_string _name = NULL;
      modelica_string _replName = NULL;
      modelica_metatype _iterExp = NULL;
      modelica_metatype _ty = NULL;
      modelica_metatype _ty1 = NULL;
      modelica_metatype _ss = NULL;
      modelica_metatype _cr = NULL;
      modelica_metatype _exp = NULL;
      modelica_metatype _tpl = NULL;
      modelica_metatype _callPath = NULL;
      modelica_metatype _recordPath = NULL;
      modelica_metatype _varLst = NULL;
      modelica_metatype _exps = NULL;
      modelica_integer _i;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _id has no default value.
      // _id2 has no default value.
      // _name has no default value.
      // _replName has no default value.
      // _iterExp has no default value.
      // _ty has no default value.
      // _ty1 has no default value.
      // _ss has no default value.
      // _cr has no default value.
      // _exp has no default value.
      // _tpl has no default value.
      // _callPath has no default value.
      // _recordPath has no default value.
      // _varLst has no default value.
      // _exps has no default value.
      // _i has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 8; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_integer tmp7;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmp7 = mmc_unbox_integer(tmpMeta6);
          if (0 /* false */ != tmp7) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _inExp;
          tmpMeta[0+1] = _inTpl;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,3) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 4));
          if (!listEmpty(tmpMeta10)) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          
          _id = tmpMeta9;
          _tpl = tmp4_2;
          _name = tmpMeta11;
          _iterExp = tmpMeta12;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(stringEqual(_name, _id))) goto tmp3_end;
          tmpMeta[0+0] = _iterExp;
          tmpMeta[0+1] = _tpl;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta13,1,3) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 2));
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          
          _exp = tmp4_1;
          _id = tmpMeta14;
          _name = tmpMeta15;
          _iterExp = tmpMeta16;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!(stringEqual(_name, _id))) goto tmp3_end;
          tmpMeta17 = mmc_mk_box3(0, _name, _iterExp, mmc_mk_boolean(0 /* false */));
          tmpMeta[0+0] = _exp;
          tmpMeta[0+1] = tmpMeta17;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,0,4) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 2));
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 3));
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 4));
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 5));
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta25,6,2) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta25), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta26,1,3) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta26), 2));
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta26), 4));
          if (!listEmpty(tmpMeta28)) goto tmp3_end;
          
          _id = tmpMeta19;
          _ty1 = tmpMeta20;
          _ss = tmpMeta21;
          _cr = tmpMeta22;
          _ty = tmpMeta23;
          _tpl = tmp4_2;
          _name = tmpMeta24;
          _replName = tmpMeta27;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(stringEqual(_name, _id))) goto tmp3_end;
          tmpMeta29 = mmc_mk_box5(3, &DAE_ComponentRef_CREF__QUAL__desc, _replName, _ty1, _ss, _cr);
          tmpMeta30 = mmc_mk_box3(9, &DAE_Exp_CREF__desc, tmpMeta29, _ty);
          tmpMeta[0+0] = tmpMeta30;
          tmpMeta[0+1] = _tpl;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta32,6,2) == 0) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta32), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta33,1,3) == 0) goto tmp3_end;
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta33), 2));
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta33), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta36,0,4) == 0) goto tmp3_end;
          tmpMeta37 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta36), 2));
          tmpMeta38 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta36), 3));
          tmpMeta39 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta36), 4));
          if (!listEmpty(tmpMeta39)) goto tmp3_end;
          tmpMeta40 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta36), 5));
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _tpl = tmp4_2;
          _name = tmpMeta31;
          _replName = tmpMeta34;
          _ss = tmpMeta35;
          _id = tmpMeta37;
          _ty1 = tmpMeta38;
          _cr = tmpMeta40;
          _ty = tmpMeta41;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!(stringEqual(_name, _id))) goto tmp3_end;
          tmpMeta42 = mmc_mk_box5(3, &DAE_ComponentRef_CREF__QUAL__desc, _replName, _ty1, _ss, _cr);
          tmpMeta43 = mmc_mk_box3(9, &DAE_Exp_CREF__desc, tmpMeta42, _ty);
          tmpMeta[0+0] = tmpMeta43;
          tmpMeta[0+1] = _tpl;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          modelica_boolean tmp59;
          modelica_boolean tmp60;
          modelica_boolean tmp61;
          tmpMeta44 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          tmpMeta45 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta45,13,3) == 0) goto tmp3_end;
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta45), 2));
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta45), 3));
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta45), 4));
          tmpMeta49 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta48), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta49,9,4) == 0) goto tmp3_end;
          tmpMeta50 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta49), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta50,3,1) == 0) goto tmp3_end;
          tmpMeta51 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta50), 2));
          tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta49), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta53,0,4) == 0) goto tmp3_end;
          tmpMeta54 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta53), 2));
          tmpMeta55 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta53), 4));
          if (!listEmpty(tmpMeta55)) goto tmp3_end;
          tmpMeta56 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta53), 5));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta56,1,3) == 0) goto tmp3_end;
          tmpMeta57 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta56), 2));
          tmpMeta58 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta56), 4));
          if (!listEmpty(tmpMeta58)) goto tmp3_end;
          
          _tpl = tmp4_2;
          _name = tmpMeta44;
          _callPath = tmpMeta46;
          _exps = tmpMeta47;
          _recordPath = tmpMeta51;
          _varLst = tmpMeta52;
          _id = tmpMeta54;
          _id2 = tmpMeta57;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp59 = (stringEqual(_name, _id));
          if (1 /* true */ != tmp59) goto goto_2;

          /* Pattern-matching assignment */
          tmp60 = omc_AbsynUtil_pathEqual(threadData, _callPath, _recordPath);
          if (1 /* true */ != tmp60) goto goto_2;

          /* Pattern-matching assignment */
          tmp61 = (listLength(_varLst) == listLength(_exps));
          if (1 /* true */ != tmp61) goto goto_2;

          _i = omc_List_position1OnTrue(threadData, _varLst, boxvar_DAEUtil_typeVarIdentEqual, _id2);

          _exp = listGet(_exps, _i);
          tmpMeta[0+0] = _exp;
          tmpMeta[0+1] = _tpl;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta62,0,4) == 0) goto tmp3_end;
          tmpMeta63 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta62), 2));
          tmpMeta64 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 1));
          tmpMeta65 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          
          _exp = tmp4_1;
          _id = tmpMeta63;
          _name = tmpMeta64;
          _iterExp = tmpMeta65;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(stringEqual(_name, _id))) goto tmp3_end;
          tmpMeta66 = mmc_mk_box3(0, _name, _iterExp, mmc_mk_boolean(0 /* false */));
          tmpMeta[0+0] = _exp;
          tmpMeta[0+1] = tmpMeta66;
          goto tmp3_done;
        }
        case 7: {
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _inExp;
          tmpMeta[0+1] = _inTpl;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 8) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta[0+0];
  _outTpl = tmpMeta[0+1];
  _return: OMC_LABEL_UNUSED
  if (out_outTpl) { *out_outTpl = _outTpl; }
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_replaceIteratorWithExp(threadData_t *threadData, modelica_metatype _iterExp, modelica_metatype _exp, modelica_string _name)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_integer tmp3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  /* Pattern-matching tuple assignment */
  tmpMeta4 = mmc_mk_box3(0, _name, _iterExp, mmc_mk_boolean(1 /* true */));
  tmpMeta5 = omc_Expression_traverseExpBottomUp(threadData, _exp, boxvar_ExpressionSimplify_replaceIteratorWithExpTraverser, tmpMeta4, &tmpMeta1);
  _outExp = tmpMeta5;
  tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 3));
  tmp3 = mmc_unbox_integer(tmpMeta2);
  if (1 /* true */ != tmp3) MMC_THROW_INTERNAL();
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_getIteratorValues(threadData_t *threadData, modelica_metatype _iter, modelica_metatype _inValues)
{
  modelica_metatype _values = NULL;
  modelica_string _iter_name = NULL;
  modelica_metatype _range = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _values has no default value.
  // _iter_name has no default value.
  // _range has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _iter;
  tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 2));
  tmpMeta3 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 3));
  tmpMeta4 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 4));
  if (!optionNone(tmpMeta4)) MMC_THROW_INTERNAL();
  _iter_name = tmpMeta2;
  _range = tmpMeta3;

  _values = omc_Expression_getArrayOrRangeContents(threadData, _range);

  _values = omc_List_threadMap1(threadData, _values, _inValues, boxvar_ExpressionSimplify_replaceIteratorWithExp, _iter_name);
  _return: OMC_LABEL_UNUSED
  return _values;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyReduction(threadData_t *threadData, modelica_metatype _inReduction)
{
  modelica_metatype _outValue = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outValue has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;
    tmp4_1 = _inReduction;
    {
      modelica_metatype _expr = NULL;
      modelica_metatype _range = NULL;
      modelica_metatype _foldExpr = NULL;
      modelica_metatype _foldExpr2 = NULL;
      modelica_string _iter_name = NULL;
      modelica_metatype _values = NULL;
      modelica_metatype _defaultValue = NULL;
      modelica_metatype _v = NULL;
      modelica_metatype _foldExp = NULL;
      modelica_metatype _ty = NULL;
      modelica_metatype _ty1 = NULL;
      modelica_metatype _ety = NULL;
      modelica_metatype _iter = NULL;
      modelica_metatype _iterators = NULL;
      modelica_string _foldName = NULL;
      modelica_string _resultName = NULL;
      modelica_string _foldName2 = NULL;
      modelica_string _resultName2 = NULL;
      modelica_metatype _path = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _expr has no default value.
      // _range has no default value.
      // _foldExpr has no default value.
      // _foldExpr2 has no default value.
      // _iter_name has no default value.
      // _values has no default value.
      // _defaultValue has no default value.
      // _v has no default value.
      // _foldExp has no default value.
      // _ty has no default value.
      // _ty1 has no default value.
      // _ety has no default value.
      // _iter has no default value.
      // _iterators has no default value.
      // _foldName has no default value.
      // _resultName has no default value.
      // _foldName2 has no default value.
      // _resultName2 has no default value.
      // _path has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 8; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_boolean tmp10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 5));
          if (optionNone(tmpMeta7)) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta7), 1));
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _v = tmpMeta8;
          _iterators = tmpMeta9;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp10 = omc_ExpressionSimplify_hasZeroLengthIterator(threadData, _iterators);
          if (1 /* true */ != tmp10) goto goto_2;
          tmpMeta1 = omc_ValuesUtil_valueExp(threadData, _v, mmc_mk_none());
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta11;
          modelica_boolean tmp12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,3) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _iterators = tmpMeta11;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp12 = omc_ExpressionSimplify_hasZeroLengthIterator(threadData, _iterators);
          if (1 /* true */ != tmp12) goto goto_2;
          tmpMeta1 = omc_ValuesUtil_valueExp(threadData, _OMC_LIT10, mmc_mk_none());
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,3) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 2));
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 4));
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 5));
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 6));
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 7));
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 8));
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (listEmpty(tmpMeta21)) goto tmp3_end;
          tmpMeta22 = MMC_CAR(tmpMeta21);
          tmpMeta23 = MMC_CDR(tmpMeta21);
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta22), 2));
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta22), 3));
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta22), 4));
          if (!optionNone(tmpMeta26)) goto tmp3_end;
          if (!listEmpty(tmpMeta23)) goto tmp3_end;
          _path = tmpMeta14;
          _ty = tmpMeta15;
          _defaultValue = tmpMeta16;
          _foldName = tmpMeta17;
          _resultName = tmpMeta18;
          _foldExp = tmpMeta19;
          _expr = tmpMeta20;
          _iter_name = tmpMeta24;
          _range = tmpMeta25;
          /* Pattern matching succeeded */
          _values = omc_Expression_getArrayOrRangeContents(threadData, _range);

          _ety = omc_Types_simplifyType(threadData, _ty);

          _values = omc_List_map2(threadData, _values, boxvar_ExpressionSimplify_replaceIteratorWithExp, _expr, _iter_name);
          tmpMeta1 = omc_ExpressionSimplify_simplifyReductionFoldPhase(threadData, _path, _foldExp, _foldName, _resultName, _ety, _values, _defaultValue);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,3) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 2));
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta29,1,0) == 0) goto tmp3_end;
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 4));
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 5));
          tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 6));
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 7));
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 8));
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _path = tmpMeta28;
          _ty = tmpMeta30;
          _defaultValue = tmpMeta31;
          _foldName = tmpMeta32;
          _resultName = tmpMeta33;
          _foldExp = tmpMeta34;
          _expr = tmpMeta35;
          _iterators = tmpMeta36;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmpMeta37 = _iterators;
          if (listEmpty(tmpMeta37)) goto goto_2;
          tmpMeta38 = MMC_CAR(tmpMeta37);
          tmpMeta39 = MMC_CDR(tmpMeta37);
          tmpMeta40 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta38), 2));
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta38), 3));
          tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta38), 4));
          if (!optionNone(tmpMeta42)) goto goto_2;
          _iter_name = tmpMeta40;
          _range = tmpMeta41;
          _iterators = tmpMeta39;

          _values = omc_Expression_getArrayOrRangeContents(threadData, _range);

          _ety = omc_Types_simplifyType(threadData, _ty);

          _values = omc_List_map2(threadData, _values, boxvar_ExpressionSimplify_replaceIteratorWithExp, _expr, _iter_name);

          _values = omc_List_fold(threadData, _iterators, boxvar_ExpressionSimplify_getIteratorValues, _values);
          tmpMeta1 = omc_ExpressionSimplify_simplifyReductionFoldPhase(threadData, _path, _foldExp, _foldName, _resultName, _ety, _values, _defaultValue);
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          modelica_metatype tmpMeta59;
          modelica_metatype tmpMeta60;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,3) == 0) goto tmp3_end;
          tmpMeta43 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta44 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta43), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta44,1,1) == 0) goto tmp3_end;
          tmpMeta45 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta44), 2));
          if (5 != MMC_STRLEN(tmpMeta45) || strcmp(MMC_STRINGDATA(_OMC_LIT9), MMC_STRINGDATA(tmpMeta45)) != 0) goto tmp3_end;
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta43), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta46,0,0) == 0) goto tmp3_end;
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta43), 4));
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta43), 6));
          tmpMeta49 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta43), 7));
          tmpMeta50 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta51 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (listEmpty(tmpMeta51)) goto tmp3_end;
          tmpMeta52 = MMC_CAR(tmpMeta51);
          tmpMeta53 = MMC_CDR(tmpMeta51);
          if (listEmpty(tmpMeta53)) goto tmp3_end;
          tmpMeta54 = MMC_CAR(tmpMeta53);
          tmpMeta55 = MMC_CDR(tmpMeta53);
          _path = tmpMeta44;
          _ty = tmpMeta47;
          _foldName = tmpMeta48;
          _resultName = tmpMeta49;
          _expr = tmpMeta50;
          _iter = tmpMeta52;
          _iterators = tmpMeta53;
          /* Pattern matching succeeded */
          _foldName2 = omc_Util_getTempVariableIndex(threadData);

          _resultName2 = omc_Util_getTempVariableIndex(threadData);

          _ty1 = omc_Expression_unliftArray(threadData, _ty);

          tmpMeta56 = mmc_mk_box8(3, &DAE_ReductionInfo_REDUCTIONINFO__desc, _path, _OMC_LIT11, _ty1, mmc_mk_none(), _foldName2, _resultName2, mmc_mk_none());
          tmpMeta57 = mmc_mk_cons(_iter, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta58 = mmc_mk_box4(30, &DAE_Exp_REDUCTION__desc, tmpMeta56, _expr, tmpMeta57);
          _expr = tmpMeta58;
          tmpMeta59 = mmc_mk_box8(3, &DAE_ReductionInfo_REDUCTIONINFO__desc, _path, _OMC_LIT11, _ty, mmc_mk_none(), _foldName, _resultName, mmc_mk_none());
          tmpMeta60 = mmc_mk_box4(30, &DAE_Exp_REDUCTION__desc, tmpMeta59, _expr, _iterators);
          tmpMeta1 = tmpMeta60;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta61;
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          modelica_metatype tmpMeta68;
          modelica_metatype tmpMeta69;
          modelica_metatype tmpMeta70;
          modelica_metatype tmpMeta71;
          modelica_metatype tmpMeta72;
          modelica_metatype tmpMeta73;
          modelica_metatype tmpMeta74;
          modelica_metatype tmpMeta75;
          modelica_metatype tmpMeta76;
          modelica_metatype tmpMeta77;
          modelica_metatype tmpMeta78;
          modelica_metatype tmpMeta79;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,3) == 0) goto tmp3_end;
          tmpMeta61 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta61), 2));
          tmpMeta63 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta61), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta63,0,0) == 0) goto tmp3_end;
          tmpMeta64 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta61), 4));
          tmpMeta65 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta61), 5));
          tmpMeta66 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta61), 6));
          tmpMeta67 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta61), 7));
          tmpMeta68 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta61), 8));
          if (!optionNone(tmpMeta68)) goto tmp3_end;
          tmpMeta69 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta70 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (listEmpty(tmpMeta70)) goto tmp3_end;
          tmpMeta71 = MMC_CAR(tmpMeta70);
          tmpMeta72 = MMC_CDR(tmpMeta70);
          if (listEmpty(tmpMeta72)) goto tmp3_end;
          tmpMeta73 = MMC_CAR(tmpMeta72);
          tmpMeta74 = MMC_CDR(tmpMeta72);
          _path = tmpMeta62;
          _ty = tmpMeta64;
          _defaultValue = tmpMeta65;
          _foldName = tmpMeta66;
          _resultName = tmpMeta67;
          _expr = tmpMeta69;
          _iter = tmpMeta71;
          _iterators = tmpMeta72;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          _foldName2 = omc_Util_getTempVariableIndex(threadData);

          _resultName2 = omc_Util_getTempVariableIndex(threadData);

          tmpMeta75 = mmc_mk_box8(3, &DAE_ReductionInfo_REDUCTIONINFO__desc, _path, _OMC_LIT11, _ty, _defaultValue, _foldName2, _resultName2, mmc_mk_none());
          tmpMeta76 = mmc_mk_cons(_iter, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta77 = mmc_mk_box4(30, &DAE_Exp_REDUCTION__desc, tmpMeta75, _expr, tmpMeta76);
          _expr = tmpMeta77;
          tmpMeta78 = mmc_mk_box8(3, &DAE_ReductionInfo_REDUCTIONINFO__desc, _path, _OMC_LIT11, _ty, _defaultValue, _foldName, _resultName, mmc_mk_none());
          tmpMeta79 = mmc_mk_box4(30, &DAE_Exp_REDUCTION__desc, tmpMeta78, _expr, _iterators);
          tmpMeta1 = tmpMeta79;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta80;
          modelica_metatype tmpMeta81;
          modelica_metatype tmpMeta82;
          modelica_metatype tmpMeta83;
          modelica_metatype tmpMeta84;
          modelica_metatype tmpMeta85;
          modelica_metatype tmpMeta86;
          modelica_metatype tmpMeta87;
          modelica_metatype tmpMeta88;
          modelica_metatype tmpMeta89;
          modelica_metatype tmpMeta90;
          modelica_metatype tmpMeta91;
          modelica_metatype tmpMeta92;
          modelica_metatype tmpMeta93;
          modelica_metatype tmpMeta94;
          modelica_metatype tmpMeta95;
          modelica_metatype tmpMeta96;
          modelica_metatype tmpMeta97;
          modelica_metatype tmpMeta98;
          modelica_metatype tmpMeta99;
          modelica_metatype tmpMeta100;
          modelica_metatype tmpMeta101;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,3) == 0) goto tmp3_end;
          tmpMeta80 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta81 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta80), 2));
          tmpMeta82 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta80), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta82,0,0) == 0) goto tmp3_end;
          tmpMeta83 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta80), 4));
          tmpMeta84 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta80), 5));
          tmpMeta85 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta80), 6));
          tmpMeta86 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta80), 7));
          tmpMeta87 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta80), 8));
          if (optionNone(tmpMeta87)) goto tmp3_end;
          tmpMeta88 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta87), 1));
          tmpMeta89 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta90 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (listEmpty(tmpMeta90)) goto tmp3_end;
          tmpMeta91 = MMC_CAR(tmpMeta90);
          tmpMeta92 = MMC_CDR(tmpMeta90);
          if (listEmpty(tmpMeta92)) goto tmp3_end;
          tmpMeta93 = MMC_CAR(tmpMeta92);
          tmpMeta94 = MMC_CDR(tmpMeta92);
          _path = tmpMeta81;
          _ty = tmpMeta83;
          _defaultValue = tmpMeta84;
          _foldName = tmpMeta85;
          _resultName = tmpMeta86;
          _foldExpr = tmpMeta88;
          _expr = tmpMeta89;
          _iter = tmpMeta91;
          _iterators = tmpMeta92;
          /* Pattern matching succeeded */
          _foldName2 = omc_Util_getTempVariableIndex(threadData);

          _resultName2 = omc_Util_getTempVariableIndex(threadData);

          tmpMeta95 = mmc_mk_box2(0, _foldName, _foldName2);
          _foldExpr2 = omc_Expression_traverseExpBottomUp(threadData, _foldExpr, boxvar_Expression_renameExpCrefIdent, tmpMeta95, NULL);

          tmpMeta96 = mmc_mk_box2(0, _resultName, _resultName2);
          _foldExpr2 = omc_Expression_traverseExpBottomUp(threadData, _foldExpr2, boxvar_Expression_renameExpCrefIdent, tmpMeta96, NULL);

          tmpMeta97 = mmc_mk_box8(3, &DAE_ReductionInfo_REDUCTIONINFO__desc, _path, _OMC_LIT11, _ty, _defaultValue, _foldName2, _resultName2, mmc_mk_some(_foldExpr2));
          tmpMeta98 = mmc_mk_cons(_iter, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta99 = mmc_mk_box4(30, &DAE_Exp_REDUCTION__desc, tmpMeta97, _expr, tmpMeta98);
          _expr = tmpMeta99;
          tmpMeta100 = mmc_mk_box8(3, &DAE_ReductionInfo_REDUCTIONINFO__desc, _path, _OMC_LIT11, _ty, _defaultValue, _foldName, _resultName, mmc_mk_some(_foldExpr));
          tmpMeta101 = mmc_mk_box4(30, &DAE_Exp_REDUCTION__desc, tmpMeta100, _expr, _iterators);
          tmpMeta1 = tmpMeta101;
          goto tmp3_done;
        }
        case 7: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inReduction;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 8) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outValue = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outValue;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyRangeReal2(threadData_t *threadData, modelica_real _inStart, modelica_real _inStep, modelica_integer _inSteps, modelica_metatype _inValues)
{
  modelica_metatype _outValues = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outValues has no default value.
  { /* match expression */
    modelica_integer tmp4_1;
    tmp4_1 = _inSteps;
    {
      modelica_real _next;
      modelica_metatype _vals = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _next has no default value.
      // _vals has no default value.
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (-1 != tmp4_1) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta1 = _inValues;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          _next = _inStart + (_inStep) * (((modelica_real)_inSteps));

          tmpMeta6 = mmc_mk_cons(mmc_mk_real(_next), _inValues);
          _vals = tmpMeta6;
          /* Tail recursive call */
          _inSteps = ((modelica_integer) -1) + _inSteps;
          _inValues = _vals;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outValues = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outValues;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyRangeReal2(threadData_t *threadData, modelica_metatype _inStart, modelica_metatype _inStep, modelica_metatype _inSteps, modelica_metatype _inValues)
{
  modelica_real tmp1;
  modelica_real tmp2;
  modelica_integer tmp3;
  modelica_metatype _outValues = NULL;
  tmp1 = mmc_unbox_real(_inStart);
  tmp2 = mmc_unbox_real(_inStep);
  tmp3 = mmc_unbox_integer(_inSteps);
  _outValues = omc_ExpressionSimplify_simplifyRangeReal2(threadData, tmp1, tmp2, tmp3, _inValues);
  /* skip box _outValues; list<#Real> */
  return _outValues;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyRangeReal(threadData_t *threadData, modelica_real _inStart, modelica_real _inStep, modelica_real _inStop)
{
  modelica_metatype _outValues = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outValues has no default value.
  { /* matchcontinue expression */
    {
      modelica_string _error_str = NULL;
      modelica_integer _steps;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _error_str has no default value.
      // _steps has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_boolean tmp6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp6 = (fabs(_inStep) <= 1e-14);
          if (1 /* true */ != tmp6) goto goto_2;

          tmpMeta7 = mmc_mk_cons(mmc_mk_real(_inStart), mmc_mk_cons(mmc_mk_real(_inStep), mmc_mk_cons(mmc_mk_real(_inStop), MMC_REFSTRUCTLIT(mmc_nil))));
          _error_str = stringDelimitList(omc_List_map(threadData, tmpMeta7, boxvar_realString), _OMC_LIT12);

          tmpMeta8 = mmc_mk_cons(_error_str, MMC_REFSTRUCTLIT(mmc_nil));
          omc_Error_addMessage(threadData, _OMC_LIT15, tmpMeta8);
          goto goto_2;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          /* Pattern matching succeeded */
          equality(mmc_mk_real(_inStart), mmc_mk_real(_inStop));
          tmpMeta9 = mmc_mk_cons(mmc_mk_real(_inStart), MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = tmpMeta9;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta10;
          /* Pattern matching succeeded */
          _steps = ((modelica_integer) -1) + omc_Util_realRangeSize(threadData, _inStart, _inStep, _inStop);
          tmpMeta10 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta1 = omc_ExpressionSimplify_simplifyRangeReal2(threadData, _inStart, _inStep, _steps, tmpMeta10);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 3) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outValues = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outValues;
}
modelica_metatype boxptr_ExpressionSimplify_simplifyRangeReal(threadData_t *threadData, modelica_metatype _inStart, modelica_metatype _inStep, modelica_metatype _inStop)
{
  modelica_real tmp1;
  modelica_real tmp2;
  modelica_real tmp3;
  modelica_metatype _outValues = NULL;
  tmp1 = mmc_unbox_real(_inStart);
  tmp2 = mmc_unbox_real(_inStep);
  tmp3 = mmc_unbox_real(_inStop);
  _outValues = omc_ExpressionSimplify_simplifyRangeReal(threadData, tmp1, tmp2, tmp3);
  /* skip box _outValues; list<#Real> */
  return _outValues;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyRange(threadData_t *threadData, modelica_integer _inStart, modelica_integer _inStep, modelica_integer _inStop)
{
  modelica_metatype _outValues = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outValues has no default value.
  _outValues = omc_List_intRange3(threadData, _inStart, _inStep, _inStop);
  _return: OMC_LABEL_UNUSED
  return _outValues;
}
modelica_metatype boxptr_ExpressionSimplify_simplifyRange(threadData_t *threadData, modelica_metatype _inStart, modelica_metatype _inStep, modelica_metatype _inStop)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_integer tmp3;
  modelica_metatype _outValues = NULL;
  tmp1 = mmc_unbox_integer(_inStart);
  tmp2 = mmc_unbox_integer(_inStep);
  tmp3 = mmc_unbox_integer(_inStop);
  _outValues = omc_ExpressionSimplify_simplifyRange(threadData, tmp1, tmp2, tmp3);
  /* skip box _outValues; list<#Integer> */
  return _outValues;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyRangeBool(threadData_t *threadData, modelica_boolean _inStart, modelica_boolean _inStop)
{
  modelica_metatype _outRange = NULL;
  modelica_metatype tmpMeta1;
  modelica_boolean tmp2;
  modelica_metatype tmpMeta3;
  modelica_boolean tmp4;
  modelica_metatype tmpMeta5;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outRange has no default value.
  tmp4 = (modelica_boolean)_inStart;
  if(tmp4)
  {
    tmp2 = (modelica_boolean)_inStop;
    if(tmp2)
    {
      tmpMeta3 = _OMC_LIT16;
    }
    else
    {
      tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
      tmpMeta3 = tmpMeta1;
    }
    tmpMeta5 = tmpMeta3;
  }
  else
  {
    tmpMeta5 = (_inStop?_OMC_LIT17:_OMC_LIT18);
  }
  _outRange = tmpMeta5;
  _return: OMC_LABEL_UNUSED
  return _outRange;
}
modelica_metatype boxptr_ExpressionSimplify_simplifyRangeBool(threadData_t *threadData, modelica_metatype _inStart, modelica_metatype _inStop)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _outRange = NULL;
  tmp1 = mmc_unbox_integer(_inStart);
  tmp2 = mmc_unbox_integer(_inStop);
  _outRange = omc_ExpressionSimplify_simplifyRangeBool(threadData, tmp1, tmp2);
  /* skip box _outRange; list<#Boolean> */
  return _outRange;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_removeOperatorDimension(threadData_t *threadData, modelica_metatype _inop)
{
  modelica_metatype _outop = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outop has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inop;
    {
      modelica_metatype _ty1 = NULL;
      modelica_metatype _ty2 = NULL;
      modelica_boolean _b;
      int tmp4;
      // _ty1 has no default value.
      // _ty2 has no default value.
      // _b has no default value.
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 10: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_boolean tmp8;
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,1) == 0) goto tmp3_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          _ty1 = tmpMeta5;
          /* Pattern matching succeeded */
          _ty2 = omc_Expression_unliftArray(threadData, _ty1);

          _b = omc_DAEUtil_expTypeArray(threadData, _ty2);
          tmp8 = (modelica_boolean)_b;
          if(tmp8)
          {
            tmpMeta6 = mmc_mk_box2(10, &DAE_Operator_ADD__ARR__desc, _ty2);
            tmpMeta9 = tmpMeta6;
          }
          else
          {
            tmpMeta7 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _ty2);
            tmpMeta9 = tmpMeta7;
          }
          tmpMeta1 = tmpMeta9;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_boolean tmp13;
          modelica_metatype tmpMeta14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,1) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          _ty1 = tmpMeta10;
          /* Pattern matching succeeded */
          _ty2 = omc_Expression_unliftArray(threadData, _ty1);

          _b = omc_DAEUtil_expTypeArray(threadData, _ty2);
          tmp13 = (modelica_boolean)_b;
          if(tmp13)
          {
            tmpMeta11 = mmc_mk_box2(11, &DAE_Operator_SUB__ARR__desc, _ty2);
            tmpMeta14 = tmpMeta11;
          }
          else
          {
            tmpMeta12 = mmc_mk_box2(4, &DAE_Operator_SUB__desc, _ty2);
            tmpMeta14 = tmpMeta12;
          }
          tmpMeta1 = tmpMeta14;
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_boolean tmp18;
          modelica_metatype tmpMeta19;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,10,1) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          _ty1 = tmpMeta15;
          /* Pattern matching succeeded */
          _ty2 = omc_Expression_unliftArray(threadData, _ty1);

          _b = omc_DAEUtil_expTypeArray(threadData, _ty2);
          tmp18 = (modelica_boolean)_b;
          if(tmp18)
          {
            tmpMeta16 = mmc_mk_box2(13, &DAE_Operator_DIV__ARR__desc, _ty2);
            tmpMeta19 = tmpMeta16;
          }
          else
          {
            tmpMeta17 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _ty2);
            tmpMeta19 = tmpMeta17;
          }
          tmpMeta1 = tmpMeta19;
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_boolean tmp23;
          modelica_metatype tmpMeta24;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,9,1) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          _ty1 = tmpMeta20;
          /* Pattern matching succeeded */
          _ty2 = omc_Expression_unliftArray(threadData, _ty1);

          _b = omc_DAEUtil_expTypeArray(threadData, _ty2);
          tmp23 = (modelica_boolean)_b;
          if(tmp23)
          {
            tmpMeta21 = mmc_mk_box2(12, &DAE_Operator_MUL__ARR__desc, _ty2);
            tmpMeta24 = tmpMeta21;
          }
          else
          {
            tmpMeta22 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _ty2);
            tmpMeta24 = tmpMeta22;
          }
          tmpMeta1 = tmpMeta24;
          goto tmp3_done;
        }
        case 24: {
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_boolean tmp28;
          modelica_metatype tmpMeta29;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,21,1) == 0) goto tmp3_end;
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          _ty1 = tmpMeta25;
          /* Pattern matching succeeded */
          _ty2 = omc_Expression_unliftArray(threadData, _ty1);

          _b = omc_DAEUtil_expTypeArray(threadData, _ty2);
          tmp28 = (modelica_boolean)_b;
          if(tmp28)
          {
            tmpMeta26 = mmc_mk_box2(24, &DAE_Operator_POW__ARR2__desc, _ty2);
            tmpMeta29 = tmpMeta26;
          }
          else
          {
            tmpMeta27 = mmc_mk_box2(7, &DAE_Operator_POW__desc, _ty2);
            tmpMeta29 = tmpMeta27;
          }
          tmpMeta1 = tmpMeta29;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outop = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outop;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBuiltinConstantDer(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _dims = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _dims has no default value.
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT20;
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT20;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,6,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,1,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 3));
          
          _dims = tmpMeta8;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_Expression_makeZeroExpression(threadData, _dims, NULL);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,6,2) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta10,0,1) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 3));
          
          _dims = tmpMeta11;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_Expression_makeZeroExpression(threadData, _dims, NULL);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinarySortConstantsMul(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _e_lst = NULL;
  modelica_metatype _e_lst_1 = NULL;
  modelica_metatype _const_es1 = NULL;
  modelica_metatype _const_es1_1 = NULL;
  modelica_metatype _notconst_es1 = NULL;
  modelica_metatype _res1 = NULL;
  modelica_metatype _res2 = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _e_lst has no default value.
  // _e_lst_1 has no default value.
  // _const_es1 has no default value.
  // _const_es1_1 has no default value.
  // _notconst_es1 has no default value.
  // _res1 has no default value.
  // _res2 has no default value.
  _e_lst = omc_Expression_factors(threadData, _inExp);

  _const_es1 = omc_List_splitOnTrue(threadData, _e_lst, boxvar_Expression_isConst ,&_notconst_es1);

  if((!listEmpty(_const_es1)))
  {
    _res1 = omc_ExpressionSimplify_simplifyBinaryMulConstants(threadData, _const_es1);

    _res1 = omc_ExpressionSimplify_simplify1(threadData, _res1, NULL);

    _res2 = omc_Expression_makeProductLst(threadData, _notconst_es1);

    _outExp = omc_Expression_expMul(threadData, _res1, _res2);
  }
  else
  {
    _outExp = _inExp;
  }
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyVectorScalarMatrix(threadData_t *threadData, modelica_metatype _imexpl, modelica_metatype _op, modelica_metatype _s1, modelica_boolean _arrayScalar)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta10;
  modelica_boolean tmp19;
  modelica_metatype tmpMeta20;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  tmp19 = (modelica_boolean)_arrayScalar;
  if(tmp19)
  {
    {
      modelica_metatype __omcQ_24tmpVar9;
      modelica_metatype* tmp2;
      modelica_metatype tmpMeta3;
      modelica_metatype tmpMeta4;
      modelica_metatype __omcQ_24tmpVar8;
      modelica_integer tmp9;
      modelica_metatype _row_loopVar = 0;
      modelica_metatype _row;
      _row_loopVar = _imexpl;
      tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
      __omcQ_24tmpVar9 = tmpMeta3; /* defaultValue */
      tmp2 = &__omcQ_24tmpVar9;
      while(1) {
        tmp9 = 1;
        if (!listEmpty(_row_loopVar)) {
          _row = MMC_CAR(_row_loopVar);
          _row_loopVar = MMC_CDR(_row_loopVar);
          tmp9--;
        }
        if (tmp9 == 0) {
          {
            modelica_metatype __omcQ_24tmpVar7;
            modelica_metatype* tmp5;
            modelica_metatype tmpMeta6;
            modelica_metatype tmpMeta7;
            modelica_metatype __omcQ_24tmpVar6;
            modelica_integer tmp8;
            modelica_metatype _e_loopVar = 0;
            modelica_metatype _e;
            _e_loopVar = _row;
            tmpMeta6 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar7 = tmpMeta6; /* defaultValue */
            tmp5 = &__omcQ_24tmpVar7;
            while(1) {
              tmp8 = 1;
              if (!listEmpty(_e_loopVar)) {
                _e = MMC_CAR(_e_loopVar);
                _e_loopVar = MMC_CDR(_e_loopVar);
                tmp8--;
              }
              if (tmp8 == 0) {
                tmpMeta7 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _op, _s1);
                __omcQ_24tmpVar6 = tmpMeta7;
                *tmp5 = mmc_mk_cons(__omcQ_24tmpVar6,0);
                tmp5 = &MMC_CDR(*tmp5);
              } else if (tmp8 == 1) {
                break;
              } else {
                MMC_THROW_INTERNAL();
              }
            }
            *tmp5 = mmc_mk_nil();
            tmpMeta4 = __omcQ_24tmpVar7;
          }
          __omcQ_24tmpVar8 = tmpMeta4;
          *tmp2 = mmc_mk_cons(__omcQ_24tmpVar8,0);
          tmp2 = &MMC_CDR(*tmp2);
        } else if (tmp9 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      *tmp2 = mmc_mk_nil();
      tmpMeta1 = __omcQ_24tmpVar9;
    }
    tmpMeta20 = tmpMeta1;
  }
  else
  {
    {
      modelica_metatype __omcQ_24tmpVar13;
      modelica_metatype* tmp11;
      modelica_metatype tmpMeta12;
      modelica_metatype tmpMeta13;
      modelica_metatype __omcQ_24tmpVar12;
      modelica_integer tmp18;
      modelica_metatype _row_loopVar = 0;
      modelica_metatype _row;
      _row_loopVar = _imexpl;
      tmpMeta12 = MMC_REFSTRUCTLIT(mmc_nil);
      __omcQ_24tmpVar13 = tmpMeta12; /* defaultValue */
      tmp11 = &__omcQ_24tmpVar13;
      while(1) {
        tmp18 = 1;
        if (!listEmpty(_row_loopVar)) {
          _row = MMC_CAR(_row_loopVar);
          _row_loopVar = MMC_CDR(_row_loopVar);
          tmp18--;
        }
        if (tmp18 == 0) {
          {
            modelica_metatype __omcQ_24tmpVar11;
            modelica_metatype* tmp14;
            modelica_metatype tmpMeta15;
            modelica_metatype tmpMeta16;
            modelica_metatype __omcQ_24tmpVar10;
            modelica_integer tmp17;
            modelica_metatype _e_loopVar = 0;
            modelica_metatype _e;
            _e_loopVar = _row;
            tmpMeta15 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar11 = tmpMeta15; /* defaultValue */
            tmp14 = &__omcQ_24tmpVar11;
            while(1) {
              tmp17 = 1;
              if (!listEmpty(_e_loopVar)) {
                _e = MMC_CAR(_e_loopVar);
                _e_loopVar = MMC_CDR(_e_loopVar);
                tmp17--;
              }
              if (tmp17 == 0) {
                tmpMeta16 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _s1, _op, _e);
                __omcQ_24tmpVar10 = tmpMeta16;
                *tmp14 = mmc_mk_cons(__omcQ_24tmpVar10,0);
                tmp14 = &MMC_CDR(*tmp14);
              } else if (tmp17 == 1) {
                break;
              } else {
                MMC_THROW_INTERNAL();
              }
            }
            *tmp14 = mmc_mk_nil();
            tmpMeta13 = __omcQ_24tmpVar11;
          }
          __omcQ_24tmpVar12 = tmpMeta13;
          *tmp11 = mmc_mk_cons(__omcQ_24tmpVar12,0);
          tmp11 = &MMC_CDR(*tmp11);
        } else if (tmp18 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      *tmp11 = mmc_mk_nil();
      tmpMeta10 = __omcQ_24tmpVar13;
    }
    tmpMeta20 = tmpMeta10;
  }
  _outExp = tmpMeta20;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyVectorScalarMatrix(threadData_t *threadData, modelica_metatype _imexpl, modelica_metatype _op, modelica_metatype _s1, modelica_metatype _arrayScalar)
{
  modelica_integer tmp1;
  modelica_metatype _outExp = NULL;
  tmp1 = mmc_unbox_integer(_arrayScalar);
  _outExp = omc_ExpressionSimplify_simplifyVectorScalarMatrix(threadData, _imexpl, _op, _s1, tmp1);
  /* skip box _outExp; list<list<DAE.Exp>> */
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyUnary(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOperator2, modelica_metatype _inExp3)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;
    tmp4_1 = _inOperator2;
    tmp4_2 = _inExp3;
    {
      modelica_metatype _ty1 = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e_1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _e3 = NULL;
      modelica_integer _i_1;
      modelica_integer _i;
      modelica_real _r_1;
      modelica_real _r;
      modelica_boolean _b1;
      modelica_metatype _attr = NULL;
      modelica_metatype _expl = NULL;
      modelica_metatype _mat = NULL;
      modelica_metatype _op = NULL;
      modelica_metatype _op2 = NULL;
      modelica_metatype _path = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _ty1 has no default value.
      // _e1 has no default value.
      // _e_1 has no default value.
      // _e2 has no default value.
      // _e3 has no default value.
      // _i_1 has no default value.
      // _i has no default value.
      // _r_1 has no default value.
      // _r has no default value.
      // _b1 has no default value.
      // _attr has no default value.
      // _expl has no default value.
      // _mat has no default value.
      // _op has no default value.
      // _op2 has no default value.
      // _path has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 20; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,24,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          _b1 = omc_Expression_toBool(threadData, _e1);

          _b1 = (!_b1);
          tmpMeta6 = mmc_mk_box2(6, &DAE_Exp_BCONST__desc, mmc_mk_boolean(_b1));
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,24,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,10,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,24,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          _e1 = tmpMeta8;
          tmp4 += 17; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta9;
          modelica_integer tmp10;
          modelica_metatype tmpMeta11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp10 = mmc_unbox_integer(tmpMeta9);
          _i = tmp10  /* pattern as ty=Integer */;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          _i_1 = (-_i);
          tmpMeta11 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_i_1));
          tmpMeta1 = tmpMeta11;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta12;
          modelica_real tmp13;
          modelica_metatype tmpMeta14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp13 = mmc_unbox_real(tmpMeta12);
          _r = tmp13  /* pattern as ty=Real */;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          _r_1 = (-_r);
          tmpMeta14 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r_1));
          tmpMeta1 = tmpMeta14;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta16,2,1) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _op2 = tmp4_1;
          _e1 = tmpMeta15;
          _op = tmpMeta16;
          _e2 = tmpMeta17;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta18 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op2, _e1);
          tmpMeta19 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta18, _op, _e2);
          tmpMeta1 = tmpMeta19;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta21,9,1) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _op2 = tmp4_1;
          _e1 = tmpMeta20;
          _op = tmpMeta21;
          _e2 = tmpMeta22;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta23 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op2, _e1);
          tmpMeta24 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta23, _op, _e2);
          tmpMeta1 = tmpMeta24;
          goto tmp3_done;
        }
        case 6: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_isZero(threadData, _e1)) goto tmp3_end;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 7: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_isZero(threadData, _e1)) goto tmp3_end;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta26,1,1) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _e1 = tmpMeta25;
          _op = tmpMeta26;
          _e2 = tmpMeta27;
          tmp4 += 10; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta28 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op, _e1);
          tmpMeta1 = tmpMeta28;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta30,8,1) == 0) goto tmp3_end;
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _e1 = tmpMeta29;
          _op = tmpMeta30;
          _e2 = tmpMeta31;
          tmp4 += 9; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta32 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op, _e1);
          tmpMeta1 = tmpMeta32;
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_boolean tmp36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta34,0,1) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _op2 = tmp4_1;
          _e1 = tmpMeta33;
          _op = tmpMeta34;
          _e2 = tmpMeta35;
          tmp4 += 8; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching tuple assignment */
          tmpMeta37 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op2, _e1);
          tmpMeta38 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op2, _e2);
          tmpMeta39 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta37, _op, tmpMeta38);
          tmpMeta40 = omc_ExpressionSimplify_simplify1(threadData, tmpMeta39, &tmp36);
          _e_1 = tmpMeta40;
          if (1 /* true */ != tmp36) goto goto_2;
          tmpMeta1 = _e_1;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta42,7,1) == 0) goto tmp3_end;
          tmpMeta43 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _op2 = tmp4_1;
          _e1 = tmpMeta41;
          _op = tmpMeta42;
          _e2 = tmpMeta43;
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta44 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op2, _e1);
          tmpMeta45 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op2, _e2);
          tmpMeta46 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta44, _op, tmpMeta45);
          tmpMeta1 = tmpMeta46;
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta48,3,1) == 0) goto tmp3_end;
          tmpMeta49 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _op2 = tmp4_1;
          _e1 = tmpMeta47;
          _op = tmpMeta48;
          _e2 = tmpMeta49;
          tmp4 += 6; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta50 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op2, _e1);
          tmpMeta51 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta50, _op, _e2);
          tmpMeta1 = tmpMeta51;
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta53,10,1) == 0) goto tmp3_end;
          tmpMeta54 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _op2 = tmp4_1;
          _e1 = tmpMeta52;
          _op = tmpMeta53;
          _e2 = tmpMeta54;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta55 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op2, _e1);
          tmpMeta56 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta55, _op, _e2);
          tmpMeta1 = tmpMeta56;
          goto tmp3_done;
        }
        case 14: {
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,8,2) == 0) goto tmp3_end;
          tmpMeta57 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta57,5,1) == 0) goto tmp3_end;
          tmpMeta58 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          _e1 = tmpMeta58;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta59;
          modelica_metatype tmpMeta60;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,8,2) == 0) goto tmp3_end;
          tmpMeta59 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta59,6,1) == 0) goto tmp3_end;
          tmpMeta60 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          _e1 = tmpMeta60;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 16: {
          modelica_metatype tmpMeta61;
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          modelica_metatype tmpMeta68;
          modelica_metatype tmpMeta69;
          modelica_metatype tmpMeta70;
          modelica_metatype tmpMeta71;
          modelica_metatype tmpMeta72;
          modelica_metatype tmpMeta73;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta61 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta61,1,1) == 0) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta61), 2));
          if (10 != MMC_STRLEN(tmpMeta62) || strcmp(MMC_STRINGDATA(_OMC_LIT21), MMC_STRINGDATA(tmpMeta62)) != 0) goto tmp3_end;
          tmpMeta63 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta63)) goto tmp3_end;
          tmpMeta64 = MMC_CAR(tmpMeta63);
          tmpMeta65 = MMC_CDR(tmpMeta63);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta64,8,2) == 0) goto tmp3_end;
          tmpMeta66 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta64), 3));
          if (listEmpty(tmpMeta65)) goto tmp3_end;
          tmpMeta67 = MMC_CAR(tmpMeta65);
          tmpMeta68 = MMC_CDR(tmpMeta65);
          if (listEmpty(tmpMeta68)) goto tmp3_end;
          tmpMeta69 = MMC_CAR(tmpMeta68);
          tmpMeta70 = MMC_CDR(tmpMeta68);
          if (!listEmpty(tmpMeta70)) goto tmp3_end;
          tmpMeta71 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _path = tmpMeta61;
          _e1 = tmpMeta66;
          _e2 = tmpMeta67;
          _e3 = tmpMeta69;
          _attr = tmpMeta71;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta72 = mmc_mk_cons(_e1, mmc_mk_cons(_e3, mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil))));
          tmpMeta73 = mmc_mk_box4(16, &DAE_Exp_CALL__desc, _path, tmpMeta72, _attr);
          tmpMeta1 = tmpMeta73;
          goto tmp3_done;
        }
        case 17: {
          modelica_metatype tmpMeta74;
          modelica_metatype tmpMeta75;
          modelica_integer tmp76;
          modelica_metatype tmpMeta77;
          modelica_metatype tmpMeta78;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          tmpMeta74 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta75 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmp76 = mmc_unbox_integer(tmpMeta75);
          tmpMeta77 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _ty1 = tmpMeta74;
          _b1 = tmp76  /* pattern as ty=Boolean */;
          _expl = tmpMeta77;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          _expl = omc_List_map(threadData, _expl, boxvar_Expression_negate);
          tmpMeta78 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _ty1, mmc_mk_boolean(_b1), _expl);
          tmpMeta1 = tmpMeta78;
          goto tmp3_done;
        }
        case 18: {
          modelica_metatype tmpMeta79;
          modelica_metatype tmpMeta80;
          modelica_integer tmp81;
          modelica_metatype tmpMeta82;
          modelica_metatype tmpMeta83;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,17,3) == 0) goto tmp3_end;
          tmpMeta79 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta80 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmp81 = mmc_unbox_integer(tmpMeta80);
          tmpMeta82 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _ty1 = tmpMeta79;
          _i = tmp81  /* pattern as ty=Integer */;
          _mat = tmpMeta82;
          /* Pattern matching succeeded */
          _mat = omc_List_mapList(threadData, _mat, boxvar_Expression_negate);
          tmpMeta83 = mmc_mk_box4(20, &DAE_Exp_MATRIX__desc, _ty1, mmc_mk_integer(_i), _mat);
          tmpMeta1 = tmpMeta83;
          goto tmp3_done;
        }
        case 19: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 20) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryDistributePow(threadData_t *threadData, modelica_metatype _inExpLst, modelica_metatype _inExp)
{
  modelica_metatype _outExpLst = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExpLst has no default value.
  {
    modelica_metatype __omcQ_24tmpVar15;
    modelica_metatype* tmp2;
    modelica_metatype tmpMeta3;
    modelica_metatype tmpMeta4;
    modelica_metatype tmpMeta5;
    modelica_metatype __omcQ_24tmpVar14;
    modelica_integer tmp6;
    modelica_metatype _e_loopVar = 0;
    modelica_metatype _e;
    _e_loopVar = _inExpLst;
    tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar15 = tmpMeta3; /* defaultValue */
    tmp2 = &__omcQ_24tmpVar15;
    while(1) {
      tmp6 = 1;
      while (!listEmpty(_e_loopVar)) {
        _e = MMC_CAR(_e_loopVar);
        _e_loopVar = MMC_CDR(_e_loopVar);
        if ((!omc_Expression_isConstOne(threadData, _e))) {
          tmp6--;
          break;
        }
      }
      if (tmp6 == 0) {
        tmpMeta4 = mmc_mk_box2(7, &DAE_Operator_POW__desc, omc_Expression_typeof(threadData, _e));
        tmpMeta5 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, tmpMeta4, _inExp);
        __omcQ_24tmpVar14 = tmpMeta5;
        *tmp2 = mmc_mk_cons(__omcQ_24tmpVar14,0);
        tmp2 = &MMC_CDR(*tmp2);
      } else if (tmp6 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp2 = mmc_mk_nil();
    tmpMeta1 = __omcQ_24tmpVar15;
  }
  _outExpLst = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExpLst;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyRelation2(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOp, modelica_metatype _lhs, modelica_metatype _rhs, modelica_integer _index, modelica_metatype _optionExpisASUB, modelica_fnptr _isPositive)
{
  modelica_metatype _oExp = NULL;
  modelica_boolean _b;
  modelica_metatype _tp = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _oExp has no default value.
  // _b has no default value.
  // _tp has no default value.
  _oExp = omc_Expression_expSub(threadData, _lhs, _rhs);

  _oExp = omc_ExpressionSimplify_simplify(threadData, _oExp ,&_b);

  if((omc_Expression_isGreatereqOrLesseq(threadData, _inOp) && mmc_unbox_boolean((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_isPositive), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_isPositive), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_isPositive), 2))), _oExp) : ((modelica_metatype(*)(threadData_t*, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_isPositive), 1)))) (threadData, _oExp))))
  {
    _oExp = _OMC_LIT23;
  }
  else
  {
    if(omc_Expression_isGreatereqOrLesseq(threadData, _inOp))
    {
      _oExp = _origExp;
    }
    else
    {
      _oExp = omc_Expression_negate(threadData, _oExp);

      _oExp = omc_ExpressionSimplify_simplify(threadData, _oExp, NULL);

      _oExp = (mmc_unbox_boolean((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_isPositive), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_isPositive), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_isPositive), 2))), _oExp) : ((modelica_metatype(*)(threadData_t*, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_isPositive), 1)))) (threadData, _oExp))?_OMC_LIT22:_origExp);
    }
  }
  _return: OMC_LABEL_UNUSED
  return _oExp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyRelation2(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOp, modelica_metatype _lhs, modelica_metatype _rhs, modelica_metatype _index, modelica_metatype _optionExpisASUB, modelica_fnptr _isPositive)
{
  modelica_integer tmp1;
  modelica_metatype _oExp = NULL;
  tmp1 = mmc_unbox_integer(_index);
  _oExp = omc_ExpressionSimplify_simplifyRelation2(threadData, _origExp, _inOp, _lhs, _rhs, tmp1, _optionExpisASUB, _isPositive);
  /* skip box _oExp; DAE.Exp */
  return _oExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyRelation(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOperator2, modelica_metatype _inExp3, modelica_metatype _inExp4, modelica_integer _index, modelica_metatype _optionExpisASUB)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;volatile modelica_metatype tmp4_3;
    tmp4_1 = _inOperator2;
    tmp4_2 = _inExp3;
    tmp4_3 = _inExp4;
    {
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _oper = NULL;
      modelica_metatype _cr1 = NULL;
      modelica_metatype _cr2 = NULL;
      modelica_boolean _b;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e1 has no default value.
      // _e2 has no default value.
      // _oper has no default value.
      // _cr1 has no default value.
      // _cr2 has no default value.
      // _b has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 8; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_boolean tmp6;
          modelica_boolean tmp7;
          modelica_metatype tmpMeta8;
          
          _oper = tmp4_1;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp6 = omc_Expression_isConstValue(threadData, _e1);
          if (1 /* true */ != tmp6) goto goto_2;

          /* Pattern-matching assignment */
          tmp7 = omc_Expression_isConstValue(threadData, _e2);
          if (1 /* true */ != tmp7) goto goto_2;

          _b = omc_ExpressionSimplify_simplifyRelationConst(threadData, _oper, _e1, _e2);
          tmpMeta8 = mmc_mk_box2(6, &DAE_Exp_BCONST__desc, mmc_mk_boolean(_b));
          tmpMeta1 = tmpMeta8;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_boolean tmp11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,29,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,6,2) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,6,2) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          
          _cr1 = tmpMeta9;
          _cr2 = tmpMeta10;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp11 = omc_ComponentReference_crefEqual(threadData, _cr1, _cr2);
          if (1 /* true */ != tmp11) goto goto_2;
          tmpMeta1 = _OMC_LIT23;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_boolean tmp14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,30,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,6,2) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,6,2) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          
          _cr1 = tmpMeta12;
          _cr2 = tmpMeta13;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp14 = omc_ComponentReference_crefEqual(threadData, _cr1, _cr2);
          if (1 /* true */ != tmp14) goto goto_2;
          tmpMeta1 = _OMC_LIT22;
          goto tmp3_done;
        }
        case 3: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,28,1) == 0) goto tmp3_end;
          
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyRelation2(threadData, _origExp, _inOperator2, _inExp3, _inExp4, _index, _optionExpisASUB, boxvar_Expression_isPositiveOrZero);
          goto tmp3_done;
        }
        case 4: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,1) == 0) goto tmp3_end;
          
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyRelation2(threadData, _origExp, _inOperator2, _inExp3, _inExp4, _index, _optionExpisASUB, boxvar_Expression_isPositiveOrZero);
          goto tmp3_done;
        }
        case 5: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,26,1) == 0) goto tmp3_end;
          
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyRelation2(threadData, _origExp, _inOperator2, _inExp4, _inExp3, _index, _optionExpisASUB, boxvar_Expression_isPositiveOrZero);
          goto tmp3_done;
        }
        case 6: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,25,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyRelation2(threadData, _origExp, _inOperator2, _inExp4, _inExp3, _index, _optionExpisASUB, boxvar_Expression_isPositiveOrZero);
          goto tmp3_done;
        }
        case 7: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 8) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyRelation(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOperator2, modelica_metatype _inExp3, modelica_metatype _inExp4, modelica_metatype _index, modelica_metatype _optionExpisASUB)
{
  modelica_integer tmp1;
  modelica_metatype _outExp = NULL;
  tmp1 = mmc_unbox_integer(_index);
  _outExp = omc_ExpressionSimplify_simplifyRelation(threadData, _origExp, _inOperator2, _inExp3, _inExp4, tmp1, _optionExpisASUB);
  /* skip box _outExp; DAE.Exp */
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyLBinary(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOperator2, modelica_metatype _inExp3, modelica_metatype _inExp4)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_metatype tmp4_3;
    tmp4_1 = _inOperator2;
    tmp4_2 = _inExp3;
    tmp4_3 = _inExp4;
    {
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_boolean _b;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e1 has no default value.
      // _e2 has no default value.
      // _b has no default value.
      tmp4 = 0;
      for (; tmp4 < 13; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (!listEmpty(tmpMeta6)) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,16,3) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (!listEmpty(tmpMeta7)) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,22,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,10,2) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,24,1) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _e2 = tmpMeta10;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta1 = _OMC_LIT22;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,22,1) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta11,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,10,2) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta12,24,1) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          
          _e1 = tmpMeta13;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta1 = _OMC_LIT22;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,23,1) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta14,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,10,2) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta15,24,1) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _e2 = tmpMeta16;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta1 = _OMC_LIT23;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,23,1) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta17,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,10,2) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,24,1) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          
          _e1 = tmpMeta19;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta1 = _OMC_LIT23;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta20;
          modelica_integer tmp21;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,22,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp21 = mmc_unbox_integer(tmpMeta20);
          
          _e1 = tmp4_2;
          _b = tmp21  /* pattern as ty=Boolean */;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          tmpMeta1 = (_b?_e2:_e1);
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta22;
          modelica_integer tmp23;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,22,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp23 = mmc_unbox_integer(tmpMeta22);
          
          _e2 = tmp4_3;
          _b = tmp23  /* pattern as ty=Boolean */;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta1 = (_b?_e1:_e2);
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta24;
          modelica_integer tmp25;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,23,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp25 = mmc_unbox_integer(tmpMeta24);
          
          _e1 = tmp4_2;
          _b = tmp25  /* pattern as ty=Boolean */;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          tmpMeta1 = (_b?_e1:_e2);
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta26;
          modelica_integer tmp27;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,23,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp27 = mmc_unbox_integer(tmpMeta26);
          
          _e2 = tmp4_3;
          _b = tmp27  /* pattern as ty=Boolean */;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta1 = (_b?_e2:_e1);
          goto tmp3_done;
        }
        case 10: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,22,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 11: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,23,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 12: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyTwoBinaryExpressions(threadData_t *threadData, modelica_metatype _e1, modelica_metatype _lhsOperator, modelica_metatype _e2, modelica_metatype _mainOperator, modelica_metatype _e3, modelica_metatype _rhsOperator, modelica_metatype _e4, modelica_boolean _expEqual_e1_e3, modelica_boolean _expEqual_e1_e4, modelica_boolean _expEqual_e2_e3, modelica_boolean _expEqual_e2_e4, modelica_boolean _isConst_e1, modelica_boolean _isConst_e2, modelica_boolean _isConst_e3, modelica_boolean _operatorEqualLhsRhs)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_metatype tmp4_3;modelica_metatype tmp4_4;modelica_metatype tmp4_5;modelica_metatype tmp4_6;modelica_metatype tmp4_7;modelica_boolean tmp4_8;modelica_boolean tmp4_9;modelica_boolean tmp4_10;modelica_boolean tmp4_11;modelica_boolean tmp4_12;modelica_boolean tmp4_13;modelica_boolean tmp4_14;
    tmp4_1 = _e1;
    tmp4_2 = _lhsOperator;
    tmp4_3 = _e2;
    tmp4_4 = _mainOperator;
    tmp4_5 = _e3;
    tmp4_6 = _rhsOperator;
    tmp4_7 = _e4;
    tmp4_8 = _expEqual_e1_e3;
    tmp4_9 = _expEqual_e1_e4;
    tmp4_10 = _expEqual_e2_e3;
    tmp4_11 = _expEqual_e2_e4;
    tmp4_12 = _isConst_e1;
    tmp4_13 = _isConst_e2;
    tmp4_14 = _operatorEqualLhsRhs;
    {
      modelica_metatype _e1_1 = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _e_1 = NULL;
      modelica_metatype _e_2 = NULL;
      modelica_metatype _e_3 = NULL;
      modelica_metatype _e_4 = NULL;
      modelica_metatype _e_5 = NULL;
      modelica_metatype _e_6 = NULL;
      modelica_metatype _res = NULL;
      modelica_metatype _one = NULL;
      modelica_metatype _op1 = NULL;
      modelica_metatype _op2 = NULL;
      modelica_metatype _op3 = NULL;
      modelica_metatype _op = NULL;
      modelica_metatype _ty = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e1_1 has no default value.
      // _e has no default value.
      // _e_1 has no default value.
      // _e_2 has no default value.
      // _e_3 has no default value.
      // _e_4 has no default value.
      // _e_5 has no default value.
      // _e_6 has no default value.
      // _res has no default value.
      // _one has no default value.
      // _op1 has no default value.
      // _op2 has no default value.
      // _op3 has no default value.
      // _op has no default value.
      // _ty has no default value.
      tmp4 = 0;
      for (; tmp4 < 17; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (1 /* true */ != tmp4_8) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_4,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,2,1) == 0) goto tmp3_end;
          
          _op2 = tmp4_2;
          _op1 = tmp4_4;
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e4);
          tmpMeta7 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, tmpMeta6);
          tmpMeta1 = tmpMeta7;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          if (1 /* true */ != tmp4_9) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_4,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,2,1) == 0) goto tmp3_end;
          
          _op2 = tmp4_2;
          _op1 = tmp4_4;
          /* Pattern matching succeeded */
          tmpMeta8 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e3);
          tmpMeta9 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, tmpMeta8);
          tmpMeta1 = tmpMeta9;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          if (1 /* true */ != tmp4_10) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_4,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,2,1) == 0) goto tmp3_end;
          
          _op2 = tmp4_2;
          _op1 = tmp4_4;
          /* Pattern matching succeeded */
          tmpMeta10 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, _e4);
          tmpMeta11 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op2, tmpMeta10);
          tmpMeta1 = tmpMeta11;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          if (1 /* true */ != tmp4_11) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_4,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,2,1) == 0) goto tmp3_end;
          
          _op2 = tmp4_2;
          _op1 = tmp4_4;
          /* Pattern matching succeeded */
          tmpMeta12 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, _e3);
          tmpMeta13 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op2, tmpMeta12);
          tmpMeta1 = tmpMeta13;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          if (1 /* true */ != tmp4_11) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_4,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,4,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta14 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _mainOperator, _e3);
          tmpMeta15 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta14, _lhsOperator, _e2);
          tmpMeta1 = tmpMeta15;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          if (1 /* true */ != tmp4_11) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_4,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,4,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta16 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _mainOperator, _e3);
          tmpMeta17 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta16, _lhsOperator, _e2);
          tmpMeta1 = tmpMeta17;
          goto tmp3_done;
        }
        case 6: {
          if (1 /* true */ != tmp4_8) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_4,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,4,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _res = omc_Expression_expAdd(threadData, _e2, _e4);
          tmpMeta1 = omc_Expression_expPow(threadData, _e1, _res);
          goto tmp3_done;
        }
        case 7: {
          if (1 /* true */ != tmp4_8) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_4,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,4,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _res = omc_Expression_expSub(threadData, _e2, _e4);
          tmpMeta1 = omc_Expression_expPow(threadData, _e1, _res);
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          if (1 /* true */ != tmp4_11) goto tmp3_end;
          if (0 /* false */ != tmp4_13) goto tmp3_end;
          if (1 /* true */ != tmp4_14) goto tmp3_end;
          
          _op2 = tmp4_2;
          _op1 = tmp4_4;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(omc_Expression_isAddOrSub(threadData, _op1) && omc_Expression_isMulOrDiv(threadData, _op2))) goto tmp3_end;
          tmpMeta18 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, _e3);
          tmpMeta19 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta18, _op2, _e4);
          tmpMeta1 = tmpMeta19;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          if (1 /* true */ != tmp4_8) goto tmp3_end;
          if (0 /* false */ != tmp4_12) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,3,1) == 0) goto tmp3_end;
          
          _op = tmp4_2;
          _ty = tmpMeta20;
          _op1 = tmp4_4;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isAddOrSub(threadData, _op1)) goto tmp3_end;
          _one = omc_Expression_makeConstOne(threadData, _ty);

          _e = omc_Expression_makeDiv(threadData, _one, _e4);
          tmpMeta21 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e);
          tmpMeta22 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta21, _op, _e1);
          tmpMeta1 = tmpMeta22;
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          if (1 /* true */ != tmp4_8) goto tmp3_end;
          if (0 /* false */ != tmp4_12) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,2,1) == 0) goto tmp3_end;
          
          _ty = tmpMeta23;
          _op1 = tmp4_4;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isAddOrSub(threadData, _op1)) goto tmp3_end;
          _one = omc_Expression_makeConstOne(threadData, _ty);

          _e = omc_Expression_makeDiv(threadData, _one, _e2);
          tmpMeta24 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _op1, _e4);
          tmpMeta25 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _ty);
          tmpMeta26 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta24, tmpMeta25, _e1);
          tmpMeta1 = tmpMeta26;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          if (1 /* true */ != tmp4_11) goto tmp3_end;
          if (0 /* false */ != tmp4_13) goto tmp3_end;
          if (1 /* true */ != tmp4_14) goto tmp3_end;
          
          _e1_1 = tmp4_1;
          _op2 = tmp4_2;
          _e_3 = tmp4_3;
          _op1 = tmp4_4;
          _e = tmp4_5;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(omc_Expression_isAddOrSub(threadData, _op1) && omc_Expression_isMulOrDiv(threadData, _op2))) goto tmp3_end;
          tmpMeta27 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op1, _e);
          _res = tmpMeta27;
          tmpMeta28 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _res, _op2, _e_3);
          tmpMeta1 = tmpMeta28;
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          
          _e_1 = tmpMeta29;
          _op2 = tmpMeta30;
          _e_2 = tmpMeta31;
          _op = tmp4_2;
          _e_3 = tmp4_3;
          _op1 = tmp4_4;
          _e = tmp4_5;
          _op3 = tmp4_6;
          _e_6 = tmp4_7;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(((((!omc_Expression_isConstValue(threadData, _e_2)) && omc_Expression_expEqual(threadData, _e_2, _e_6)) && omc_Expression_operatorEqual(threadData, _op2, _op3)) && omc_Expression_isAddOrSub(threadData, _op1)) && omc_Expression_isMulOrDiv(threadData, _op2))) goto tmp3_end;
          tmpMeta32 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e_1, _op, _e_3);
          _e1_1 = tmpMeta32;

          tmpMeta33 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op1, _e);
          _res = tmpMeta33;
          tmpMeta34 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _res, _op2, _e_2);
          tmpMeta1 = tmpMeta34;
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta37 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_5,7,3) == 0) goto tmp3_end;
          tmpMeta38 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_5), 2));
          tmpMeta39 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_5), 3));
          tmpMeta40 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_5), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,2,1) == 0) goto tmp3_end;
          
          _e_1 = tmpMeta35;
          _op2 = tmpMeta36;
          _e_2 = tmpMeta37;
          _op = tmp4_2;
          _e_4 = tmpMeta38;
          _op3 = tmpMeta39;
          _e_5 = tmpMeta40;
          _e_3 = tmp4_3;
          _op1 = tmp4_4;
          _e_6 = tmp4_7;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(((((!omc_Expression_isConstValue(threadData, _e_2)) && omc_Expression_expEqual(threadData, _e_2, _e_5)) && omc_Expression_operatorEqual(threadData, _op2, _op3)) && omc_Expression_isAddOrSub(threadData, _op1)) && omc_Expression_isMulOrDiv(threadData, _op2))) goto tmp3_end;
          tmpMeta41 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e_1, _op, _e_3);
          _e1_1 = tmpMeta41;

          tmpMeta42 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e_4, _op, _e_6);
          _e = tmpMeta42;

          tmpMeta43 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op1, _e);
          _res = tmpMeta43;
          tmpMeta44 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _res, _op2, _e_2);
          tmpMeta1 = tmpMeta44;
          goto tmp3_done;
        }
        case 14: {
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          if (0 /* false */ != tmp4_13) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_5,7,3) == 0) goto tmp3_end;
          tmpMeta45 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_5), 2));
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_5), 3));
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_5), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,2,1) == 0) goto tmp3_end;
          
          _e_4 = tmpMeta45;
          _op3 = tmpMeta46;
          _e_5 = tmpMeta47;
          _op = tmp4_6;
          _e_1 = tmp4_1;
          _op2 = tmp4_2;
          _e_3 = tmp4_3;
          _op1 = tmp4_4;
          _e_6 = tmp4_7;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(((omc_Expression_expEqual(threadData, _e_3, _e_5) && omc_Expression_operatorEqual(threadData, _op2, _op3)) && omc_Expression_isAddOrSub(threadData, _op1)) && omc_Expression_isMulOrDiv(threadData, _op2))) goto tmp3_end;
          tmpMeta48 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e_4, _op, _e_6);
          _e = tmpMeta48;

          tmpMeta49 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e_1, _op1, _e);
          _res = tmpMeta49;
          tmpMeta50 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _res, _op2, _e_3);
          tmpMeta1 = tmpMeta50;
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          if (1 /* true */ != tmp4_8) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_4,1,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,2,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta51 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _mainOperator, _e4);
          tmpMeta52 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _lhsOperator, tmpMeta51);
          tmpMeta1 = tmpMeta52;
          goto tmp3_done;
        }
        case 16: {
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          if (1 /* true */ != tmp4_9) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_4,1,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_6,2,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta53 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _mainOperator, _e3);
          tmpMeta54 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _lhsOperator, tmpMeta53);
          tmpMeta1 = tmpMeta54;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyTwoBinaryExpressions(threadData_t *threadData, modelica_metatype _e1, modelica_metatype _lhsOperator, modelica_metatype _e2, modelica_metatype _mainOperator, modelica_metatype _e3, modelica_metatype _rhsOperator, modelica_metatype _e4, modelica_metatype _expEqual_e1_e3, modelica_metatype _expEqual_e1_e4, modelica_metatype _expEqual_e2_e3, modelica_metatype _expEqual_e2_e4, modelica_metatype _isConst_e1, modelica_metatype _isConst_e2, modelica_metatype _isConst_e3, modelica_metatype _operatorEqualLhsRhs)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_integer tmp3;
  modelica_integer tmp4;
  modelica_integer tmp5;
  modelica_integer tmp6;
  modelica_integer tmp7;
  modelica_integer tmp8;
  modelica_metatype _outExp = NULL;
  tmp1 = mmc_unbox_integer(_expEqual_e1_e3);
  tmp2 = mmc_unbox_integer(_expEqual_e1_e4);
  tmp3 = mmc_unbox_integer(_expEqual_e2_e3);
  tmp4 = mmc_unbox_integer(_expEqual_e2_e4);
  tmp5 = mmc_unbox_integer(_isConst_e1);
  tmp6 = mmc_unbox_integer(_isConst_e2);
  tmp7 = mmc_unbox_integer(_isConst_e3);
  tmp8 = mmc_unbox_integer(_operatorEqualLhsRhs);
  _outExp = omc_ExpressionSimplify_simplifyTwoBinaryExpressions(threadData, _e1, _lhsOperator, _e2, _mainOperator, _e3, _rhsOperator, _e4, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8);
  /* skip box _outExp; DAE.Exp */
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinary(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inOperator2, modelica_metatype _lhs, modelica_metatype _rhs)
{
  modelica_metatype _outExp = NULL;
  modelica_boolean _lhsIsConstValue;
  modelica_boolean _rhsIsConstValue;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  _lhsIsConstValue = omc_Expression_isConstValue(threadData, _lhs);
  _rhsIsConstValue = omc_Expression_isConstValue(threadData, _rhs);
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;volatile modelica_metatype tmp4_3;volatile modelica_boolean tmp4_4;volatile modelica_boolean tmp4_5;
    tmp4_1 = _inOperator2;
    tmp4_2 = _lhs;
    tmp4_3 = _rhs;
    tmp4_4 = _lhsIsConstValue;
    tmp4_5 = _rhsIsConstValue;
    {
      modelica_metatype _e1_1 = NULL;
      modelica_metatype _e3 = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _e4 = NULL;
      modelica_metatype _e5 = NULL;
      modelica_metatype _e6 = NULL;
      modelica_metatype _res = NULL;
      modelica_metatype _one = NULL;
      modelica_metatype _oper = NULL;
      modelica_metatype _op1 = NULL;
      modelica_metatype _op2 = NULL;
      modelica_metatype _op3 = NULL;
      modelica_metatype _op = NULL;
      modelica_metatype _ty = NULL;
      modelica_metatype _ty2 = NULL;
      modelica_metatype _tp = NULL;
      modelica_metatype _tp2 = NULL;
      modelica_metatype _exp_lst = NULL;
      modelica_metatype _exp_lst_1 = NULL;
      modelica_boolean _b;
      modelica_boolean _b2;
      modelica_real _r;
      modelica_real _r1;
      modelica_metatype _oexp = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e1_1 has no default value.
      // _e3 has no default value.
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _e4 has no default value.
      // _e5 has no default value.
      // _e6 has no default value.
      // _res has no default value.
      // _one has no default value.
      // _oper has no default value.
      // _op1 has no default value.
      // _op2 has no default value.
      // _op3 has no default value.
      // _op has no default value.
      // _ty has no default value.
      // _ty2 has no default value.
      // _tp has no default value.
      // _tp2 has no default value.
      // _exp_lst has no default value.
      // _exp_lst_1 has no default value.
      // _b has no default value.
      // _b2 has no default value.
      // _r has no default value.
      // _r1 has no default value.
      // _oexp has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 86; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          
          _op = tmp4_1;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_ExpressionSimplify_simplifyBinaryArrayOp(threadData, _op)) goto tmp3_end;
          tmpMeta1 = omc_ExpressionSimplify_simplifyBinaryArray(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 1: {
          
          _op = tmp4_1;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyBinaryCommutativeWork(threadData, _op, _e1, _e2);
          goto tmp3_done;
        }
        case 2: {
          
          _op = tmp4_1;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyBinaryCommutativeWork(threadData, _op, _e2, _e1);
          goto tmp3_done;
        }
        case 3: {
          if (1 /* true */ != tmp4_4) goto tmp3_end;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          
          _oper = tmp4_1;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyBinaryConst(threadData, _oper, _e1, _e2);
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _e1 = tmpMeta6;
          _op1 = tmpMeta7;
          _e2 = tmpMeta8;
          _e3 = tmpMeta9;
          _op2 = tmpMeta10;
          _e4 = tmpMeta11;
          _oper = tmp4_1;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyTwoBinaryExpressions(threadData, _e1, _op1, _e2, _oper, _e3, _op2, _e4, omc_Expression_expEqual(threadData, _e1, _e3), omc_Expression_expEqual(threadData, _e1, _e4), omc_Expression_expEqual(threadData, _e2, _e3), omc_Expression_expEqual(threadData, _e2, _e4), omc_Expression_isConstValue(threadData, _e1), omc_Expression_isConstValue(threadData, _e2), omc_Expression_isConstValue(threadData, _e3), omc_Expression_operatorEqual(threadData, _op1, _op2));
          goto tmp3_done;
        }
        case 5: {
          modelica_boolean tmp12;
          
          _oper = tmp4_1;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp12 = (omc_Expression_isConstZeroLength(threadData, _e1) || omc_Expression_isConstZeroLength(threadData, _e2));
          if (1 /* true */ != tmp12) goto goto_2;

          omc_ExpressionSimplify_checkZeroLengthArrayOp(threadData, _oper);
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta14,4,1) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta14), 2));
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta16,8,2) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta16), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta17,5,1) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta16), 3));
          
          _e2 = tmpMeta13;
          _op1 = tmpMeta14;
          _ty2 = tmpMeta15;
          _e3 = tmpMeta18;
          _e1 = tmp4_2;
          tmp4 += 32; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta19 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _ty2);
          tmpMeta20 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e3);
          tmpMeta21 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta19, tmpMeta20);
          tmpMeta1 = tmpMeta21;
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta23,4,1) == 0) goto tmp3_end;
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta23), 2));
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta25,8,2) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta25), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta26,5,1) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta25), 3));
          
          _e2 = tmpMeta22;
          _op1 = tmpMeta23;
          _ty2 = tmpMeta24;
          _e3 = tmpMeta27;
          _e1 = tmp4_2;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta28 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _ty2);
          tmpMeta29 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e3);
          tmpMeta30 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta28, tmpMeta29);
          tmpMeta1 = tmpMeta30;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_real tmp36;
          modelica_boolean tmp37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta32,4,1) == 0) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta32), 2));
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta34,1,1) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta34), 2));
          tmp36 = mmc_unbox_real(tmpMeta35);
          
          _e2 = tmpMeta31;
          _op1 = tmpMeta32;
          _ty2 = tmpMeta33;
          _r = tmp36  /* pattern as ty=Real */;
          _e1 = tmp4_2;
          tmp4 += 30; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp37 = (_r < 0.0);
          if (1 /* true */ != tmp37) goto goto_2;

          _r = (-_r);
          tmpMeta38 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _ty2);
          tmpMeta39 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta40 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, tmpMeta39);
          tmpMeta41 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta38, tmpMeta40);
          tmpMeta1 = tmpMeta41;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_real tmp47;
          modelica_boolean tmp48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta43 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta43,4,1) == 0) goto tmp3_end;
          tmpMeta44 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta43), 2));
          tmpMeta45 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta45,1,1) == 0) goto tmp3_end;
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta45), 2));
          tmp47 = mmc_unbox_real(tmpMeta46);
          
          _e2 = tmpMeta42;
          _op1 = tmpMeta43;
          _ty2 = tmpMeta44;
          _r = tmp47  /* pattern as ty=Real */;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp48 = (_r < 0.0);
          if (1 /* true */ != tmp48) goto goto_2;

          _r = (-_r);
          tmpMeta49 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _ty2);
          tmpMeta50 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta51 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, tmpMeta50);
          tmpMeta52 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta49, tmpMeta51);
          tmpMeta1 = tmpMeta52;
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          modelica_boolean tmp59;
          modelica_boolean tmp60;
          modelica_metatype tmpMeta61;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta53,7,3) == 0) goto tmp3_end;
          tmpMeta54 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta53), 2));
          tmpMeta55 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta53), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta55,2,1) == 0) goto tmp3_end;
          tmpMeta56 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta53), 4));
          tmpMeta57 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmpMeta58 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e1 = tmpMeta54;
          _e2 = tmpMeta56;
          _op1 = tmpMeta57;
          _e3 = tmpMeta58;
          _e4 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp59 = omc_Expression_isAddOrSub(threadData, _op1);
          if (1 /* true */ != tmp59) goto goto_2;

          /* Pattern-matching assignment */
          tmp60 = omc_Expression_expEqual(threadData, _e2, _e4);
          if (1 /* true */ != tmp60) goto goto_2;

          _e = omc_Expression_makeDiv(threadData, _e3, _e4);
          tmpMeta61 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, _e);
          tmpMeta1 = tmpMeta61;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          modelica_boolean tmp68;
          modelica_boolean tmp69;
          modelica_metatype tmpMeta70;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta63 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmpMeta64 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta64,7,3) == 0) goto tmp3_end;
          tmpMeta65 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta64), 2));
          tmpMeta66 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta64), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta66,2,1) == 0) goto tmp3_end;
          tmpMeta67 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta64), 4));
          
          _e3 = tmpMeta62;
          _op1 = tmpMeta63;
          _e1 = tmpMeta65;
          _e2 = tmpMeta67;
          _e4 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp68 = omc_Expression_isAddOrSub(threadData, _op1);
          if (1 /* true */ != tmp68) goto goto_2;

          /* Pattern-matching assignment */
          tmp69 = omc_Expression_expEqual(threadData, _e2, _e4);
          if (1 /* true */ != tmp69) goto goto_2;

          _e = omc_Expression_makeDiv(threadData, _e3, _e4);
          tmpMeta70 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _op1, _e1);
          tmpMeta1 = tmpMeta70;
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta71;
          modelica_metatype tmpMeta72;
          modelica_metatype tmpMeta73;
          modelica_metatype tmpMeta74;
          modelica_metatype tmpMeta75;
          modelica_metatype tmpMeta76;
          modelica_metatype tmpMeta77;
          modelica_metatype tmpMeta78;
          modelica_metatype tmpMeta79;
          modelica_boolean tmp80;
          modelica_boolean tmp81;
          modelica_metatype tmpMeta82;
          modelica_metatype tmpMeta83;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta71 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta71,7,3) == 0) goto tmp3_end;
          tmpMeta72 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta71), 2));
          tmpMeta73 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta71), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta73,2,1) == 0) goto tmp3_end;
          tmpMeta74 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta71), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta74,7,3) == 0) goto tmp3_end;
          tmpMeta75 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta74), 2));
          tmpMeta76 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta74), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta76,2,1) == 0) goto tmp3_end;
          tmpMeta77 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta74), 4));
          tmpMeta78 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmpMeta79 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e1 = tmpMeta72;
          _op2 = tmpMeta73;
          _e2 = tmpMeta75;
          _e3 = tmpMeta77;
          _op1 = tmpMeta78;
          _e4 = tmpMeta79;
          _e5 = tmp4_3;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp80 = omc_Expression_isAddOrSub(threadData, _op1);
          if (1 /* true */ != tmp80) goto goto_2;

          /* Pattern-matching assignment */
          tmp81 = omc_Expression_expEqual(threadData, _e3, _e5);
          if (1 /* true */ != tmp81) goto goto_2;

          _e = omc_Expression_makeDiv(threadData, _e4, _e3);

          tmpMeta82 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, _e2);
          _e1_1 = tmpMeta82;
          tmpMeta83 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op1, _e);
          tmpMeta1 = tmpMeta83;
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta84;
          modelica_metatype tmpMeta85;
          modelica_metatype tmpMeta86;
          modelica_metatype tmpMeta87;
          modelica_metatype tmpMeta88;
          modelica_metatype tmpMeta89;
          modelica_metatype tmpMeta90;
          modelica_metatype tmpMeta91;
          modelica_metatype tmpMeta92;
          modelica_metatype tmpMeta93;
          modelica_boolean tmp94;
          modelica_metatype tmpMeta95;
          modelica_metatype tmpMeta96;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta84 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta84,1,1) == 0) goto tmp3_end;
          tmpMeta85 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta84), 2));
          if (3 != MMC_STRLEN(tmpMeta85) || strcmp(MMC_STRINGDATA(_OMC_LIT24), MMC_STRINGDATA(tmpMeta85)) != 0) goto tmp3_end;
          tmpMeta86 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta86)) goto tmp3_end;
          tmpMeta87 = MMC_CAR(tmpMeta86);
          tmpMeta88 = MMC_CDR(tmpMeta86);
          if (!listEmpty(tmpMeta88)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta89 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta89,1,1) == 0) goto tmp3_end;
          tmpMeta90 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta89), 2));
          if (3 != MMC_STRLEN(tmpMeta90) || strcmp(MMC_STRINGDATA(_OMC_LIT24), MMC_STRINGDATA(tmpMeta90)) != 0) goto tmp3_end;
          tmpMeta91 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta91)) goto tmp3_end;
          tmpMeta92 = MMC_CAR(tmpMeta91);
          tmpMeta93 = MMC_CDR(tmpMeta91);
          if (!listEmpty(tmpMeta93)) goto tmp3_end;
          
          _e1 = tmpMeta87;
          _e2 = tmpMeta92;
          _op2 = tmp4_1;
          tmp4 += 14; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp94 = omc_Expression_isMulOrDiv(threadData, _op2);
          if (1 /* true */ != tmp94) goto goto_2;

          _ty = omc_Expression_typeof(threadData, _e1);

          tmpMeta95 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, _e2);
          _res = tmpMeta95;
          tmpMeta96 = mmc_mk_cons(_res, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT24, tmpMeta96, _ty);
          goto tmp3_done;
        }
        case 14: {
          modelica_metatype tmpMeta97;
          modelica_metatype tmpMeta98;
          modelica_metatype tmpMeta99;
          modelica_metatype tmpMeta100;
          modelica_metatype tmpMeta101;
          modelica_metatype tmpMeta102;
          modelica_metatype tmpMeta103;
          modelica_metatype tmpMeta104;
          modelica_metatype tmpMeta105;
          modelica_metatype tmpMeta106;
          modelica_metatype tmpMeta107;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta97 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta98 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta98,1,1) == 0) goto tmp3_end;
          tmpMeta99 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta98), 2));
          if (3 != MMC_STRLEN(tmpMeta99) || strcmp(MMC_STRINGDATA(_OMC_LIT25), MMC_STRINGDATA(tmpMeta99)) != 0) goto tmp3_end;
          tmpMeta100 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta100)) goto tmp3_end;
          tmpMeta101 = MMC_CAR(tmpMeta100);
          tmpMeta102 = MMC_CDR(tmpMeta100);
          if (!listEmpty(tmpMeta102)) goto tmp3_end;
          
          _ty = tmpMeta97;
          _e2 = tmpMeta101;
          _e1 = tmp4_2;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta103 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _ty);
          tmpMeta104 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta103, _e2);
          _e = tmpMeta104;

          _e = omc_ExpressionSimplify_simplify1(threadData, _e, NULL);

          tmpMeta105 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          _e3 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT25, tmpMeta105, _ty);
          tmpMeta106 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _ty);
          tmpMeta107 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta106, _e3);
          tmpMeta1 = tmpMeta107;
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta108;
          modelica_metatype tmpMeta109;
          modelica_metatype tmpMeta110;
          modelica_metatype tmpMeta111;
          modelica_metatype tmpMeta112;
          modelica_metatype tmpMeta113;
          modelica_metatype tmpMeta114;
          modelica_metatype tmpMeta115;
          modelica_metatype tmpMeta116;
          modelica_metatype tmpMeta117;
          modelica_metatype tmpMeta118;
          modelica_boolean tmp119;
          modelica_metatype tmpMeta120;
          modelica_metatype tmpMeta121;
          modelica_metatype tmpMeta122;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          tmpMeta108 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta109 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta109,1,1) == 0) goto tmp3_end;
          tmpMeta110 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta109), 2));
          if (3 != MMC_STRLEN(tmpMeta110) || strcmp(MMC_STRINGDATA(_OMC_LIT25), MMC_STRINGDATA(tmpMeta110)) != 0) goto tmp3_end;
          tmpMeta111 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta111)) goto tmp3_end;
          tmpMeta112 = MMC_CAR(tmpMeta111);
          tmpMeta113 = MMC_CDR(tmpMeta111);
          if (!listEmpty(tmpMeta113)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta114 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta114,1,1) == 0) goto tmp3_end;
          tmpMeta115 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta114), 2));
          if (3 != MMC_STRLEN(tmpMeta115) || strcmp(MMC_STRINGDATA(_OMC_LIT25), MMC_STRINGDATA(tmpMeta115)) != 0) goto tmp3_end;
          tmpMeta116 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta116)) goto tmp3_end;
          tmpMeta117 = MMC_CAR(tmpMeta116);
          tmpMeta118 = MMC_CDR(tmpMeta116);
          if (!listEmpty(tmpMeta118)) goto tmp3_end;
          
          _ty = tmpMeta108;
          _e1 = tmpMeta112;
          _e2 = tmpMeta117;
          tmp4 += 23; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp119 = (omc_Expression_isConstValue(threadData, _e1) || omc_Expression_isConstValue(threadData, _e2));
          if (0 /* false */ != tmp119) goto goto_2;

          tmpMeta120 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _ty);
          tmpMeta121 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta120, _e2);
          _e = tmpMeta121;
          tmpMeta122 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT25, tmpMeta122, _ty);
          goto tmp3_done;
        }
        case 16: {
          modelica_metatype tmpMeta123;
          modelica_metatype tmpMeta124;
          modelica_metatype tmpMeta125;
          modelica_metatype tmpMeta126;
          modelica_metatype tmpMeta127;
          modelica_boolean tmp128;
          modelica_metatype tmpMeta129;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta123 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta124 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta124,0,1) == 0) goto tmp3_end;
          tmpMeta125 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _op1 = tmp4_1;
          _e1 = tmpMeta123;
          _op2 = tmpMeta124;
          _e2 = tmpMeta125;
          _e3 = tmp4_3;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta126 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, _e3);
          _e = omc_ExpressionSimplify_simplify1(threadData, tmpMeta126 ,&_b);

          tmpMeta127 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e3);
          _e4 = omc_ExpressionSimplify_simplify1(threadData, tmpMeta127 ,&_b2);

          /* Pattern-matching assignment */
          tmp128 = (_b || _b2);
          if (1 /* true */ != tmp128) goto goto_2;
          tmpMeta129 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _op2, _e4);
          tmpMeta1 = tmpMeta129;
          goto tmp3_done;
        }
        case 17: {
          modelica_metatype tmpMeta130;
          modelica_metatype tmpMeta131;
          modelica_metatype tmpMeta132;
          modelica_metatype tmpMeta133;
          modelica_metatype tmpMeta134;
          modelica_boolean tmp135;
          modelica_metatype tmpMeta136;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta130 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta131 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta131,1,1) == 0) goto tmp3_end;
          tmpMeta132 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _op1 = tmp4_1;
          _e1 = tmpMeta130;
          _op2 = tmpMeta131;
          _e2 = tmpMeta132;
          _e3 = tmp4_3;
          /* Pattern matching succeeded */
          tmpMeta133 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, _e3);
          _e = omc_ExpressionSimplify_simplify1(threadData, tmpMeta133 ,&_b);

          tmpMeta134 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e3);
          _e4 = omc_ExpressionSimplify_simplify1(threadData, tmpMeta134 ,&_b2);

          /* Pattern-matching assignment */
          tmp135 = (_b || _b2);
          if (1 /* true */ != tmp135) goto goto_2;
          tmpMeta136 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _op2, _e4);
          tmpMeta1 = tmpMeta136;
          goto tmp3_done;
        }
        case 18: {
          modelica_metatype tmpMeta137;
          modelica_metatype tmpMeta138;
          modelica_metatype tmpMeta139;
          modelica_metatype tmpMeta140;
          modelica_metatype tmpMeta141;
          modelica_metatype tmpMeta142;
          modelica_metatype tmpMeta143;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta137 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta138 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta139 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta139,3,1) == 0) goto tmp3_end;
          tmpMeta140 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _tp = tmpMeta137;
          _e2 = tmpMeta138;
          _op2 = tmpMeta139;
          _e3 = tmpMeta140;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta141 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _tp);
          tmpMeta142 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta141, _e3);
          tmpMeta143 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta142, _op2, _e2);
          tmpMeta1 = tmpMeta143;
          goto tmp3_done;
        }
        case 19: {
          modelica_metatype tmpMeta144;
          modelica_metatype tmpMeta145;
          modelica_metatype tmpMeta146;
          modelica_metatype tmpMeta147;
          modelica_metatype tmpMeta148;
          modelica_metatype tmpMeta149;
          modelica_metatype tmpMeta150;
          modelica_metatype tmpMeta151;
          modelica_metatype tmpMeta152;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta144 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta145 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta146 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta146,3,1) == 0) goto tmp3_end;
          tmpMeta147 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta146), 2));
          tmpMeta148 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _tp = tmpMeta144;
          _e1 = tmpMeta145;
          _tp2 = tmpMeta147;
          _e2 = tmpMeta148;
          _e3 = tmp4_3;
          /* Pattern matching succeeded */
          tmpMeta149 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _tp2);
          tmpMeta150 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _tp);
          tmpMeta151 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, tmpMeta150, _e3);
          tmpMeta152 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta149, tmpMeta151);
          tmpMeta1 = tmpMeta152;
          goto tmp3_done;
        }
        case 20: {
          modelica_metatype tmpMeta153;
          modelica_metatype tmpMeta154;
          modelica_metatype tmpMeta155;
          modelica_metatype tmpMeta156;
          modelica_boolean tmp157;
          modelica_metatype tmpMeta158;
          modelica_metatype tmpMeta159;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta153 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta154 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta154,2,1) == 0) goto tmp3_end;
          tmpMeta155 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta154), 2));
          tmpMeta156 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _e2 = tmpMeta153;
          _tp2 = tmpMeta155;
          _e3 = tmpMeta156;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp157 = omc_Expression_expEqual(threadData, _e1, _e3);
          if (1 /* true */ != tmp157) goto goto_2;
          tmpMeta158 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _tp2);
          tmpMeta159 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT27, tmpMeta158, _e2);
          tmpMeta1 = tmpMeta159;
          goto tmp3_done;
        }
        case 21: {
          modelica_metatype tmpMeta160;
          modelica_metatype tmpMeta161;
          modelica_metatype tmpMeta162;
          modelica_metatype tmpMeta163;
          modelica_boolean tmp164;
          modelica_metatype tmpMeta165;
          modelica_metatype tmpMeta166;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta160 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta161 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta161,2,1) == 0) goto tmp3_end;
          tmpMeta162 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta161), 2));
          tmpMeta163 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _e2 = tmpMeta160;
          _tp2 = tmpMeta162;
          _e3 = tmpMeta163;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp164 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp164) goto goto_2;
          tmpMeta165 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _tp2);
          tmpMeta166 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT27, tmpMeta165, _e3);
          tmpMeta1 = tmpMeta166;
          goto tmp3_done;
        }
        case 22: {
          modelica_metatype tmpMeta167;
          modelica_metatype tmpMeta168;
          modelica_metatype tmpMeta169;
          modelica_boolean tmp170;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta167 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta168 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta168,2,1) == 0) goto tmp3_end;
          tmpMeta169 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e1 = tmpMeta167;
          _e2 = tmpMeta169;
          _e3 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp170 = omc_Expression_expEqual(threadData, _e1, _e3);
          if (1 /* true */ != tmp170) goto goto_2;
          tmpMeta1 = _e2;
          goto tmp3_done;
        }
        case 23: {
          modelica_metatype tmpMeta171;
          modelica_metatype tmpMeta172;
          modelica_metatype tmpMeta173;
          modelica_boolean tmp174;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta171 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta172 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta172,2,1) == 0) goto tmp3_end;
          tmpMeta173 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e1 = tmpMeta171;
          _e2 = tmpMeta173;
          _e3 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp174 = omc_Expression_expEqual(threadData, _e2, _e3);
          if (1 /* true */ != tmp174) goto goto_2;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 24: {
          modelica_metatype tmpMeta175;
          modelica_metatype tmpMeta176;
          modelica_metatype tmpMeta177;
          modelica_metatype tmpMeta178;
          modelica_metatype tmpMeta179;
          modelica_boolean tmp180;
          modelica_metatype tmpMeta181;
          modelica_metatype tmpMeta182;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta175 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta175,8,2) == 0) goto tmp3_end;
          tmpMeta176 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta175), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta176,5,1) == 0) goto tmp3_end;
          tmpMeta177 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta175), 3));
          tmpMeta178 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta178,2,1) == 0) goto tmp3_end;
          tmpMeta179 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e1 = tmpMeta177;
          _e2 = tmpMeta179;
          _e3 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp180 = omc_Expression_expEqual(threadData, _e1, _e3);
          if (1 /* true */ != tmp180) goto goto_2;

          _tp2 = omc_Expression_typeof(threadData, _e2);
          tmpMeta181 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _tp2);
          tmpMeta182 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta181, _e2);
          tmpMeta1 = tmpMeta182;
          goto tmp3_done;
        }
        case 25: {
          modelica_metatype tmpMeta183;
          modelica_metatype tmpMeta184;
          modelica_metatype tmpMeta185;
          modelica_metatype tmpMeta186;
          modelica_metatype tmpMeta187;
          modelica_boolean tmp188;
          modelica_metatype tmpMeta189;
          modelica_metatype tmpMeta190;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta183 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta183,8,2) == 0) goto tmp3_end;
          tmpMeta184 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta183), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta184,5,1) == 0) goto tmp3_end;
          tmpMeta185 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta183), 3));
          tmpMeta186 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta186,2,1) == 0) goto tmp3_end;
          tmpMeta187 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e1 = tmpMeta185;
          _e2 = tmpMeta187;
          _e3 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp188 = omc_Expression_expEqual(threadData, _e2, _e3);
          if (1 /* true */ != tmp188) goto goto_2;

          _tp2 = omc_Expression_typeof(threadData, _e1);
          tmpMeta189 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _tp2);
          tmpMeta190 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta189, _e1);
          tmpMeta1 = tmpMeta190;
          goto tmp3_done;
        }
        case 26: {
          modelica_metatype tmpMeta191;
          modelica_metatype tmpMeta192;
          modelica_metatype tmpMeta193;
          modelica_metatype tmpMeta194;
          modelica_metatype tmpMeta195;
          modelica_boolean tmp196;
          modelica_metatype tmpMeta197;
          modelica_metatype tmpMeta198;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta191 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta192 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta192,2,1) == 0) goto tmp3_end;
          tmpMeta193 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,8,2) == 0) goto tmp3_end;
          tmpMeta194 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta194,5,1) == 0) goto tmp3_end;
          tmpMeta195 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _e1 = tmpMeta191;
          _e2 = tmpMeta193;
          _e3 = tmpMeta195;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp196 = omc_Expression_expEqual(threadData, _e2, _e3);
          if (1 /* true */ != tmp196) goto goto_2;

          _tp2 = omc_Expression_typeof(threadData, _e1);
          tmpMeta197 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _tp2);
          tmpMeta198 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta197, _e1);
          tmpMeta1 = tmpMeta198;
          goto tmp3_done;
        }
        case 27: {
          modelica_metatype tmpMeta199;
          modelica_metatype tmpMeta200;
          modelica_metatype tmpMeta201;
          modelica_metatype tmpMeta202;
          modelica_metatype tmpMeta203;
          modelica_boolean tmp204;
          modelica_metatype tmpMeta205;
          modelica_metatype tmpMeta206;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta199 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta200 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta200,2,1) == 0) goto tmp3_end;
          tmpMeta201 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,8,2) == 0) goto tmp3_end;
          tmpMeta202 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta202,5,1) == 0) goto tmp3_end;
          tmpMeta203 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _e1 = tmpMeta199;
          _e2 = tmpMeta201;
          _e3 = tmpMeta203;
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp204 = omc_Expression_expEqual(threadData, _e1, _e3);
          if (1 /* true */ != tmp204) goto goto_2;

          _tp2 = omc_Expression_typeof(threadData, _e2);
          tmpMeta205 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _tp2);
          tmpMeta206 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta205, _e2);
          tmpMeta1 = tmpMeta206;
          goto tmp3_done;
        }
        case 28: {
          modelica_metatype tmpMeta207;
          modelica_boolean tmp208;
          modelica_metatype tmpMeta209;
          modelica_metatype tmpMeta210;
          if (1 /* true */ != tmp4_4) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta207 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          
          _ty = tmpMeta207;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp208 = omc_Expression_isZero(threadData, _e1);
          if (1 /* true */ != tmp208) goto goto_2;
          tmpMeta209 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _ty);
          tmpMeta210 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta209, _e2);
          tmpMeta1 = tmpMeta210;
          goto tmp3_done;
        }
        case 29: {
          modelica_boolean tmp211;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp211 = omc_Expression_isZero(threadData, _e2);
          if (1 /* true */ != tmp211) goto goto_2;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 30: {
          modelica_metatype tmpMeta212;
          modelica_boolean tmp213;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta212 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          
          _ty = tmpMeta212;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp213 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp213) goto goto_2;
          tmpMeta1 = omc_Expression_makeConstZero(threadData, _ty);
          goto tmp3_done;
        }
        case 31: {
          modelica_metatype tmpMeta214;
          modelica_boolean tmp215;
          modelica_boolean tmp216;
          modelica_metatype tmpMeta217;
          modelica_metatype tmpMeta218;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          tmpMeta214 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          
          _ty = tmpMeta214;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          tmp4 += 30; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp215 = omc_Types_isRealOrSubTypeReal(threadData, _ty);
          if (1 /* true */ != tmp215) goto goto_2;

          /* Pattern-matching assignment */
          tmp216 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp216) goto goto_2;

          _e = omc_Expression_makeConstNumber(threadData, _ty, ((modelica_integer) 2));
          tmpMeta217 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _ty);
          tmpMeta218 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, tmpMeta217, _e1);
          tmpMeta1 = tmpMeta218;
          goto tmp3_done;
        }
        case 32: {
          modelica_metatype tmpMeta219;
          modelica_metatype tmpMeta220;
          modelica_metatype tmpMeta221;
          modelica_metatype tmpMeta222;
          modelica_metatype tmpMeta223;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta219 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,8,2) == 0) goto tmp3_end;
          tmpMeta220 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta220,5,1) == 0) goto tmp3_end;
          tmpMeta221 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _ty = tmpMeta219;
          _e2 = tmpMeta221;
          _e1 = tmp4_2;
          tmp4 += 50; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta222 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _ty);
          tmpMeta223 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta222, _e2);
          tmpMeta1 = tmpMeta223;
          goto tmp3_done;
        }
        case 33: {
          modelica_metatype tmpMeta224;
          modelica_metatype tmpMeta225;
          modelica_metatype tmpMeta226;
          modelica_metatype tmpMeta227;
          modelica_metatype tmpMeta228;
          modelica_metatype tmpMeta229;
          modelica_metatype tmpMeta230;
          modelica_metatype tmpMeta231;
          modelica_metatype tmpMeta232;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta224 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta225 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta225,8,2) == 0) goto tmp3_end;
          tmpMeta226 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta225), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta226,5,1) == 0) goto tmp3_end;
          tmpMeta227 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta225), 3));
          tmpMeta228 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta228,2,1) == 0) goto tmp3_end;
          tmpMeta229 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _ty = tmpMeta224;
          _e2 = tmpMeta227;
          _op1 = tmpMeta228;
          _e3 = tmpMeta229;
          _e1 = tmp4_2;
          tmp4 += 29; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta230 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _ty);
          tmpMeta231 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e3);
          tmpMeta232 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta230, tmpMeta231);
          tmpMeta1 = tmpMeta232;
          goto tmp3_done;
        }
        case 34: {
          modelica_metatype tmpMeta233;
          modelica_metatype tmpMeta234;
          modelica_metatype tmpMeta235;
          modelica_metatype tmpMeta236;
          modelica_metatype tmpMeta237;
          modelica_metatype tmpMeta238;
          modelica_metatype tmpMeta239;
          modelica_metatype tmpMeta240;
          modelica_metatype tmpMeta241;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta233 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta234 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta234,8,2) == 0) goto tmp3_end;
          tmpMeta235 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta234), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta235,5,1) == 0) goto tmp3_end;
          tmpMeta236 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta234), 3));
          tmpMeta237 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta237,3,1) == 0) goto tmp3_end;
          tmpMeta238 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _ty = tmpMeta233;
          _e2 = tmpMeta236;
          _op1 = tmpMeta237;
          _e3 = tmpMeta238;
          _e1 = tmp4_2;
          tmp4 += 29; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta239 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _ty);
          tmpMeta240 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e3);
          tmpMeta241 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta239, tmpMeta240);
          tmpMeta1 = tmpMeta241;
          goto tmp3_done;
        }
        case 35: {
          modelica_boolean tmp242;
          modelica_boolean tmp243;
          if (1 /* true */ != tmp4_4) goto tmp3_end;
          if (0 /* false */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp242 = omc_Expression_isZero(threadData, _e1);
          if (1 /* true */ != tmp242) goto goto_2;

          /* Pattern-matching assignment */
          tmp243 = omc_Expression_isZero(threadData, _e2);
          if (0 /* false */ != tmp243) goto goto_2;
          tmpMeta1 = _OMC_LIT20;
          goto tmp3_done;
        }
        case 36: {
          modelica_boolean tmp244;
          if (0 /* false */ != tmp4_4) goto tmp3_end;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp244 = omc_Expression_isConstOne(threadData, _e2);
          if (1 /* true */ != tmp244) goto goto_2;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 37: {
          modelica_metatype tmpMeta245;
          modelica_boolean tmp246;
          modelica_metatype tmpMeta247;
          modelica_metatype tmpMeta248;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta245 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          
          _ty = tmpMeta245;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp246 = omc_Expression_isConstMinusOne(threadData, _e2);
          if (1 /* true */ != tmp246) goto goto_2;
          tmpMeta247 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _ty);
          tmpMeta248 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta247, _e1);
          tmpMeta1 = tmpMeta248;
          goto tmp3_done;
        }
        case 38: {
          modelica_metatype tmpMeta249;
          modelica_boolean tmp250;
          modelica_boolean tmp251;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta249 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          
          _ty = tmpMeta249;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp250 = omc_Expression_isZero(threadData, _e2);
          if (0 /* false */ != tmp250) goto goto_2;

          /* Pattern-matching assignment */
          tmp251 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp251) goto goto_2;
          tmpMeta1 = omc_Expression_makeConstOne(threadData, _ty);
          goto tmp3_done;
        }
        case 39: {
          modelica_metatype tmpMeta252;
          modelica_boolean tmp253;
          modelica_boolean tmp254;
          modelica_boolean tmp255;
          modelica_metatype tmpMeta256;
          modelica_metatype tmpMeta257;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          tmpMeta252 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          
          _ty = tmpMeta252;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp253 = omc_Expression_isZero(threadData, _e2);
          if (0 /* false */ != tmp253) goto goto_2;

          /* Pattern-matching assignment */
          tmp254 = omc_Types_isRealOrSubTypeReal(threadData, _ty);
          if (1 /* true */ != tmp254) goto goto_2;

          /* Pattern-matching assignment */
          tmp255 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp255) goto goto_2;
          tmpMeta256 = mmc_mk_box2(7, &DAE_Operator_POW__desc, _ty);
          tmpMeta257 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta256, _OMC_LIT29);
          tmpMeta1 = tmpMeta257;
          goto tmp3_done;
        }
        case 40: {
          modelica_metatype tmpMeta258;
          modelica_metatype tmpMeta259;
          modelica_real tmp260;
          modelica_boolean tmp261;
          modelica_real tmp262;
          modelica_real tmp263;
          modelica_metatype tmpMeta264;
          modelica_metatype tmpMeta265;
          modelica_metatype tmpMeta266;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta258 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta259 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp260 = mmc_unbox_real(tmpMeta259);
          
          _tp = tmpMeta258;
          _r1 = tmp260  /* pattern as ty=Real */;
          _e1 = tmp4_2;
          tmp4 += 8; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp261 = (fabs(_r1) > 0.0);
          if (1 /* true */ != tmp261) goto goto_2;

          tmp262 = _r1;
          if (tmp262 == 0) {goto goto_2;}
          _r = (1.0) / tmp262;

          _r1 = (1e12) * (_r);

          /* Pattern-matching assignment */
          tmp263 = modelica_real_mod(_r1, 1.0);
          if (0.0 != tmp263) goto goto_2;
          tmpMeta264 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta265 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _tp);
          tmpMeta266 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta264, tmpMeta265, _e1);
          tmpMeta1 = tmpMeta266;
          goto tmp3_done;
        }
        case 41: {
          modelica_metatype tmpMeta267;
          modelica_metatype tmpMeta268;
          modelica_metatype tmpMeta269;
          modelica_real tmp270;
          modelica_metatype tmpMeta271;
          modelica_metatype tmpMeta272;
          modelica_boolean tmp273;
          modelica_real tmp274;
          modelica_real tmp275;
          modelica_metatype tmpMeta276;
          modelica_metatype tmpMeta277;
          modelica_metatype tmpMeta278;
          modelica_metatype tmpMeta279;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta267 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta268 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta268,1,1) == 0) goto tmp3_end;
          tmpMeta269 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta268), 2));
          tmp270 = mmc_unbox_real(tmpMeta269);
          tmpMeta271 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta271,2,1) == 0) goto tmp3_end;
          tmpMeta272 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _op2 = tmp4_1;
          _tp = tmpMeta267;
          _r1 = tmp270  /* pattern as ty=Real */;
          _e3 = tmpMeta272;
          _e1 = tmp4_2;
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp273 = (fabs(_r1) > 0.0);
          if (1 /* true */ != tmp273) goto goto_2;

          tmp274 = _r1;
          if (tmp274 == 0) {goto goto_2;}
          _r = (1.0) / tmp274;

          _r1 = (1e12) * (_r);

          /* Pattern-matching assignment */
          tmp275 = modelica_real_mod(_r1, 1.0);
          if (0.0 != tmp275) goto goto_2;
          tmpMeta276 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta277 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _tp);
          tmpMeta278 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta276, tmpMeta277, _e1);
          tmpMeta279 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta278, _op2, _e3);
          tmpMeta1 = tmpMeta279;
          goto tmp3_done;
        }
        case 42: {
          modelica_metatype tmpMeta280;
          modelica_metatype tmpMeta281;
          modelica_metatype tmpMeta282;
          modelica_metatype tmpMeta283;
          modelica_metatype tmpMeta284;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,8,2) == 0) goto tmp3_end;
          tmpMeta280 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta280,5,1) == 0) goto tmp3_end;
          tmpMeta281 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,8,2) == 0) goto tmp3_end;
          tmpMeta282 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta282,5,1) == 0) goto tmp3_end;
          tmpMeta283 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _op1 = tmp4_1;
          _e1 = tmpMeta281;
          _e2 = tmpMeta283;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta284 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, _e2);
          tmpMeta1 = tmpMeta284;
          goto tmp3_done;
        }
        case 43: {
          modelica_metatype tmpMeta285;
          modelica_metatype tmpMeta286;
          modelica_metatype tmpMeta287;
          modelica_metatype tmpMeta288;
          modelica_metatype tmpMeta289;
          modelica_metatype tmpMeta290;
          modelica_metatype tmpMeta291;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,8,2) == 0) goto tmp3_end;
          tmpMeta285 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta285,5,1) == 0) goto tmp3_end;
          tmpMeta286 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta287 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta288 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta288,1,1) == 0) goto tmp3_end;
          tmpMeta289 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _op2 = tmp4_1;
          _e1 = tmpMeta286;
          _e2 = tmpMeta287;
          _op1 = tmpMeta288;
          _e3 = tmpMeta289;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta290 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e3, _op1, _e2);
          tmpMeta291 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, tmpMeta290);
          tmpMeta1 = tmpMeta291;
          goto tmp3_done;
        }
        case 44: {
          modelica_metatype tmpMeta292;
          modelica_metatype tmpMeta293;
          modelica_metatype tmpMeta294;
          modelica_metatype tmpMeta295;
          modelica_metatype tmpMeta296;
          modelica_metatype tmpMeta297;
          modelica_metatype tmpMeta298;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,8,2) == 0) goto tmp3_end;
          tmpMeta292 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta292,5,1) == 0) goto tmp3_end;
          tmpMeta293 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta294 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta295 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta295,1,1) == 0) goto tmp3_end;
          tmpMeta296 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _op2 = tmp4_1;
          _e1 = tmpMeta293;
          _e2 = tmpMeta294;
          _op1 = tmpMeta295;
          _e3 = tmpMeta296;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta297 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e3, _op1, _e2);
          tmpMeta298 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, tmpMeta297);
          tmpMeta1 = tmpMeta298;
          goto tmp3_done;
        }
        case 45: {
          modelica_metatype tmpMeta299;
          modelica_metatype tmpMeta300;
          modelica_metatype tmpMeta301;
          modelica_metatype tmpMeta302;
          modelica_metatype tmpMeta303;
          modelica_metatype tmpMeta304;
          modelica_metatype tmpMeta305;
          modelica_metatype tmpMeta306;
          modelica_metatype tmpMeta307;
          modelica_metatype tmpMeta308;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta299 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta299,8,2) == 0) goto tmp3_end;
          tmpMeta300 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta299), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta300,5,1) == 0) goto tmp3_end;
          tmpMeta301 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta299), 3));
          tmpMeta302 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta302,1,1) == 0) goto tmp3_end;
          tmpMeta303 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta302), 2));
          tmpMeta304 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _op2 = tmp4_1;
          _op3 = tmpMeta300;
          _e2 = tmpMeta301;
          _ty = tmpMeta303;
          _e3 = tmpMeta304;
          _e1 = tmp4_2;
          tmp4 += 39; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta305 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op3, _e1);
          tmpMeta306 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _ty);
          tmpMeta307 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, tmpMeta306, _e3);
          tmpMeta308 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta305, _op2, tmpMeta307);
          tmpMeta1 = tmpMeta308;
          goto tmp3_done;
        }
        case 46: {
          modelica_metatype tmpMeta309;
          modelica_metatype tmpMeta310;
          modelica_metatype tmpMeta311;
          modelica_metatype tmpMeta312;
          modelica_metatype tmpMeta313;
          modelica_metatype tmpMeta314;
          modelica_metatype tmpMeta315;
          modelica_metatype tmpMeta316;
          modelica_metatype tmpMeta317;
          modelica_metatype tmpMeta318;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta309 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta309,8,2) == 0) goto tmp3_end;
          tmpMeta310 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta309), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta310,5,1) == 0) goto tmp3_end;
          tmpMeta311 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta309), 3));
          tmpMeta312 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta312,1,1) == 0) goto tmp3_end;
          tmpMeta313 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta312), 2));
          tmpMeta314 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _op2 = tmp4_1;
          _op3 = tmpMeta310;
          _e2 = tmpMeta311;
          _ty = tmpMeta313;
          _e3 = tmpMeta314;
          _e1 = tmp4_2;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta315 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op3, _e1);
          tmpMeta316 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _ty);
          tmpMeta317 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, tmpMeta316, _e3);
          tmpMeta318 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta315, _op2, tmpMeta317);
          tmpMeta1 = tmpMeta318;
          goto tmp3_done;
        }
        case 47: {
          modelica_metatype tmpMeta319;
          modelica_real tmp320;
          modelica_metatype tmpMeta321;
          modelica_metatype tmpMeta322;
          modelica_metatype tmpMeta323;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta319 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp320 = mmc_unbox_real(tmpMeta319);
          if (2.0 != tmp320) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,8,2) == 0) goto tmp3_end;
          tmpMeta321 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta321,5,1) == 0) goto tmp3_end;
          tmpMeta322 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          
          _op2 = tmp4_1;
          _e2 = tmp4_3;
          _e1 = tmpMeta322;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta323 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, _e2);
          tmpMeta1 = tmpMeta323;
          goto tmp3_done;
        }
        case 48: {
          modelica_metatype tmpMeta324;
          modelica_metatype tmpMeta325;
          modelica_metatype tmpMeta326;
          modelica_metatype tmpMeta327;
          modelica_metatype tmpMeta328;
          modelica_metatype tmpMeta329;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta324 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,8,2) == 0) goto tmp3_end;
          tmpMeta325 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta325,5,1) == 0) goto tmp3_end;
          tmpMeta326 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _op1 = tmp4_1;
          _ty = tmpMeta324;
          _e2 = tmpMeta326;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta327 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _ty);
          tmpMeta328 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta327, _e1);
          _e1_1 = tmpMeta328;
          tmpMeta329 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op1, _e2);
          tmpMeta1 = tmpMeta329;
          goto tmp3_done;
        }
        case 49: {
          modelica_metatype tmpMeta330;
          modelica_metatype tmpMeta331;
          modelica_metatype tmpMeta332;
          modelica_boolean tmp333;
          modelica_boolean tmp334;
          modelica_metatype tmpMeta335;
          modelica_metatype tmpMeta336;
          modelica_metatype tmpMeta337;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta330 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta331 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta331,2,1) == 0) goto tmp3_end;
          tmpMeta332 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _op1 = tmp4_1;
          _e2 = tmpMeta330;
          _op2 = tmpMeta331;
          _e3 = tmpMeta332;
          _e1 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp333 = omc_Expression_isConstValue(threadData, _e3);
          if (1 /* true */ != tmp333) goto goto_2;

          /* Pattern-matching tuple assignment */
          tmpMeta335 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e3, _op1, _e1);
          tmpMeta336 = omc_ExpressionSimplify_simplify1(threadData, tmpMeta335, &tmp334);
          _e = tmpMeta336;
          if (1 /* true */ != tmp334) goto goto_2;
          tmpMeta337 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _op2, _e2);
          tmpMeta1 = tmpMeta337;
          goto tmp3_done;
        }
        case 50: {
          modelica_metatype tmpMeta338;
          modelica_metatype tmpMeta339;
          modelica_metatype tmpMeta340;
          modelica_boolean tmp341;
          modelica_boolean tmp342;
          modelica_metatype tmpMeta343;
          modelica_metatype tmpMeta344;
          modelica_metatype tmpMeta345;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta338 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta339 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta339,2,1) == 0) goto tmp3_end;
          tmpMeta340 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _op1 = tmp4_1;
          _e2 = tmpMeta338;
          _op2 = tmpMeta339;
          _e3 = tmpMeta340;
          _e1 = tmp4_3;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp341 = omc_Expression_isConstValue(threadData, _e2);
          if (1 /* true */ != tmp341) goto goto_2;

          /* Pattern-matching tuple assignment */
          tmpMeta343 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e1);
          tmpMeta344 = omc_ExpressionSimplify_simplify1(threadData, tmpMeta343, &tmp342);
          _e = tmpMeta344;
          if (1 /* true */ != tmp342) goto goto_2;
          tmpMeta345 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _op2, _e3);
          tmpMeta1 = tmpMeta345;
          goto tmp3_done;
        }
        case 51: {
          modelica_boolean tmp346;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          _e = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp346 = omc_Expression_isConstOne(threadData, _e);
          if (1 /* true */ != tmp346) goto goto_2;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 52: {
          modelica_metatype tmpMeta347;
          modelica_boolean tmp348;
          modelica_metatype tmpMeta349;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          tmpMeta347 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          
          _tp = tmpMeta347;
          _e2 = tmp4_2;
          _e = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp348 = omc_Expression_isConstMinusOne(threadData, _e);
          if (1 /* true */ != tmp348) goto goto_2;

          _one = omc_Expression_makeConstOne(threadData, _tp);
          tmpMeta349 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _one, _OMC_LIT31, _e2);
          tmpMeta1 = tmpMeta349;
          goto tmp3_done;
        }
        case 53: {
          modelica_boolean tmp350;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          _e = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp350 = omc_Expression_isZero(threadData, _e);
          if (1 /* true */ != tmp350) goto goto_2;

          _tp = omc_Expression_typeof(threadData, _e1);
          tmpMeta1 = omc_Expression_makeConstOne(threadData, _tp);
          goto tmp3_done;
        }
        case 54: {
          modelica_metatype tmpMeta351;
          modelica_real tmp352;
          modelica_metatype tmpMeta353;
          modelica_metatype tmpMeta354;
          modelica_metatype tmpMeta355;
          modelica_metatype tmpMeta356;
          modelica_metatype tmpMeta357;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta351 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp352 = mmc_unbox_real(tmpMeta351);
          if (2.0 != tmp352) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta353 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta353,1,1) == 0) goto tmp3_end;
          tmpMeta354 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta353), 2));
          if (4 != MMC_STRLEN(tmpMeta354) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmpMeta354)) != 0) goto tmp3_end;
          tmpMeta355 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta355)) goto tmp3_end;
          tmpMeta356 = MMC_CAR(tmpMeta355);
          tmpMeta357 = MMC_CDR(tmpMeta355);
          if (!listEmpty(tmpMeta357)) goto tmp3_end;
          
          _e = tmpMeta356;
          /* Pattern matching succeeded */
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 55: {
          modelica_metatype tmpMeta358;
          modelica_metatype tmpMeta359;
          modelica_metatype tmpMeta360;
          modelica_metatype tmpMeta361;
          modelica_metatype tmpMeta362;
          modelica_metatype tmpMeta363;
          modelica_metatype tmpMeta364;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta358 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta358,1,1) == 0) goto tmp3_end;
          tmpMeta359 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta358), 2));
          if (4 != MMC_STRLEN(tmpMeta359) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmpMeta359)) != 0) goto tmp3_end;
          tmpMeta360 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta360)) goto tmp3_end;
          tmpMeta361 = MMC_CAR(tmpMeta360);
          tmpMeta362 = MMC_CDR(tmpMeta360);
          if (!listEmpty(tmpMeta362)) goto tmp3_end;
          
          _oper = tmp4_1;
          _e1 = tmpMeta361;
          _e = tmp4_3;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta363 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT33, _OMC_LIT34, _e);
          tmpMeta364 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _oper, tmpMeta363);
          tmpMeta1 = tmpMeta364;
          goto tmp3_done;
        }
        case 56: {
          modelica_metatype tmpMeta365;
          modelica_metatype tmpMeta366;
          modelica_metatype tmpMeta367;
          modelica_metatype tmpMeta368;
          modelica_metatype tmpMeta369;
          modelica_boolean tmp370;
          modelica_metatype tmpMeta371;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta365 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta365,1,1) == 0) goto tmp3_end;
          tmpMeta366 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta365), 2));
          if (4 != MMC_STRLEN(tmpMeta366) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmpMeta366)) != 0) goto tmp3_end;
          tmpMeta367 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta367)) goto tmp3_end;
          tmpMeta368 = MMC_CAR(tmpMeta367);
          tmpMeta369 = MMC_CDR(tmpMeta367);
          if (!listEmpty(tmpMeta369)) goto tmp3_end;
          
          _e2 = tmpMeta368;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp370 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp370) goto goto_2;
          tmpMeta371 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT35, tmpMeta371, _OMC_LIT30);
          goto tmp3_done;
        }
        case 57: {
          modelica_metatype tmpMeta372;
          modelica_metatype tmpMeta373;
          modelica_metatype tmpMeta374;
          modelica_metatype tmpMeta375;
          modelica_boolean tmp376;
          modelica_metatype tmpMeta377;
          modelica_metatype tmpMeta378;
          modelica_metatype tmpMeta379;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta372 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta373 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta373,4,1) == 0) goto tmp3_end;
          tmpMeta374 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta373), 2));
          tmpMeta375 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e1 = tmpMeta372;
          _op1 = tmpMeta373;
          _ty = tmpMeta374;
          _e2 = tmpMeta375;
          _e3 = tmp4_3;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp376 = omc_Expression_expEqual(threadData, _e1, _e3);
          if (1 /* true */ != tmp376) goto goto_2;

          _e4 = omc_Expression_makeConstOne(threadData, _ty);

          tmpMeta377 = mmc_mk_box2(4, &DAE_Operator_SUB__desc, _ty);
          tmpMeta378 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, tmpMeta377, _e4);
          _e4 = tmpMeta378;
          tmpMeta379 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, _e4);
          tmpMeta1 = tmpMeta379;
          goto tmp3_done;
        }
        case 58: {
          modelica_metatype tmpMeta380;
          modelica_metatype tmpMeta381;
          modelica_metatype tmpMeta382;
          modelica_metatype tmpMeta383;
          modelica_metatype tmpMeta384;
          modelica_metatype tmpMeta385;
          modelica_metatype tmpMeta386;
          modelica_boolean tmp387;
          modelica_metatype tmpMeta388;
          modelica_metatype tmpMeta389;
          modelica_metatype tmpMeta390;
          modelica_metatype tmpMeta391;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta380 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta380,7,3) == 0) goto tmp3_end;
          tmpMeta381 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta380), 2));
          tmpMeta382 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta380), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta382,4,1) == 0) goto tmp3_end;
          tmpMeta383 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta382), 2));
          tmpMeta384 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta380), 4));
          tmpMeta385 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta385,2,1) == 0) goto tmp3_end;
          tmpMeta386 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e1 = tmpMeta381;
          _op1 = tmpMeta382;
          _ty = tmpMeta383;
          _e2 = tmpMeta384;
          _op2 = tmpMeta385;
          _e5 = tmpMeta386;
          _e3 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp387 = omc_Expression_expEqual(threadData, _e1, _e3);
          if (1 /* true */ != tmp387) goto goto_2;

          _e4 = omc_Expression_makeConstOne(threadData, _ty);

          tmpMeta388 = mmc_mk_box2(4, &DAE_Operator_SUB__desc, _ty);
          tmpMeta389 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, tmpMeta388, _e4);
          _e4 = tmpMeta389;
          tmpMeta390 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, _e4);
          tmpMeta391 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta390, _op2, _e5);
          tmpMeta1 = tmpMeta391;
          goto tmp3_done;
        }
        case 59: {
          modelica_metatype tmpMeta392;
          modelica_metatype tmpMeta393;
          modelica_metatype tmpMeta394;
          modelica_metatype tmpMeta395;
          modelica_boolean tmp396;
          modelica_metatype tmpMeta397;
          modelica_metatype tmpMeta398;
          modelica_metatype tmpMeta399;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta392 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta393 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta393,4,1) == 0) goto tmp3_end;
          tmpMeta394 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta393), 2));
          tmpMeta395 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _e1 = tmpMeta392;
          _op1 = tmpMeta393;
          _ty = tmpMeta394;
          _e2 = tmpMeta395;
          _e3 = tmp4_2;
          tmp4 += 25; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp396 = omc_Expression_expEqual(threadData, _e1, _e3);
          if (1 /* true */ != tmp396) goto goto_2;

          _e4 = omc_Expression_makeConstOne(threadData, _ty);

          tmpMeta397 = mmc_mk_box2(4, &DAE_Operator_SUB__desc, _ty);
          tmpMeta398 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e4, tmpMeta397, _e2);
          _e4 = tmpMeta398;
          tmpMeta399 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, _e4);
          tmpMeta1 = tmpMeta399;
          goto tmp3_done;
        }
        case 60: {
          modelica_metatype tmpMeta400;
          modelica_real tmp401;
          modelica_metatype tmpMeta402;
          modelica_metatype tmpMeta403;
          modelica_metatype tmpMeta404;
          modelica_boolean tmp405;
          modelica_metatype tmpMeta406;
          modelica_metatype tmpMeta407;
          modelica_metatype tmpMeta408;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta400 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp401 = mmc_unbox_real(tmpMeta400);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta402 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta403 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta403,3,1) == 0) goto tmp3_end;
          tmpMeta404 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _op2 = tmp4_1;
          _r = tmp401  /* pattern as ty=Real */;
          _e1 = tmpMeta402;
          _op1 = tmpMeta403;
          _e2 = tmpMeta404;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp405 = (_r < 0.0);
          if (1 /* true */ != tmp405) goto goto_2;

          _r = (-_r);
          tmpMeta406 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e1);
          tmpMeta407 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta408 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta406, _op2, tmpMeta407);
          tmpMeta1 = tmpMeta408;
          goto tmp3_done;
        }
        case 61: {
          modelica_boolean tmp409;
          if (1 /* true */ != tmp4_4) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp409 = omc_Expression_isConstOne(threadData, _e1);
          if (1 /* true */ != tmp409) goto goto_2;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 62: {
          modelica_metatype tmpMeta410;
          modelica_metatype tmpMeta411;
          modelica_metatype tmpMeta412;
          modelica_metatype tmpMeta413;
          modelica_metatype tmpMeta414;
          modelica_metatype tmpMeta415;
          modelica_boolean tmp416;
          modelica_metatype tmpMeta417;
          modelica_metatype tmpMeta418;
          modelica_metatype tmpMeta419;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,12,3) == 0) goto tmp3_end;
          tmpMeta410 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta411 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmpMeta412 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,12,3) == 0) goto tmp3_end;
          tmpMeta413 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta414 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          tmpMeta415 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _e1 = tmpMeta410;
          _e2 = tmpMeta411;
          _e3 = tmpMeta412;
          _e4 = tmpMeta413;
          _e5 = tmpMeta414;
          _e6 = tmpMeta415;
          _op1 = tmp4_1;
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp416 = omc_Expression_expEqual(threadData, _e1, _e4);
          if (1 /* true */ != tmp416) goto goto_2;

          tmpMeta417 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, _e5);
          _e = tmpMeta417;

          tmpMeta418 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e3, _op1, _e6);
          _res = tmpMeta418;
          tmpMeta419 = mmc_mk_box4(15, &DAE_Exp_IFEXP__desc, _e1, _e, _res);
          tmpMeta1 = tmpMeta419;
          goto tmp3_done;
        }
        case 63: {
          modelica_metatype tmpMeta420;
          modelica_metatype tmpMeta421;
          modelica_metatype tmpMeta422;
          modelica_metatype tmpMeta423;
          modelica_metatype tmpMeta424;
          modelica_metatype tmpMeta425;
          modelica_metatype tmpMeta426;
          modelica_metatype tmpMeta427;
          modelica_metatype tmpMeta428;
          modelica_boolean tmp429;
          modelica_metatype tmpMeta430;
          modelica_metatype tmpMeta431;
          modelica_metatype tmpMeta432;
          if (0 /* false */ != tmp4_4) goto tmp3_end;
          if (0 /* false */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta420 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta421 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta422 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta422,2,1) == 0) goto tmp3_end;
          tmpMeta423 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta424 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta424,8,2) == 0) goto tmp3_end;
          tmpMeta425 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta424), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta425,5,1) == 0) goto tmp3_end;
          tmpMeta426 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta424), 3));
          tmpMeta427 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta427,2,1) == 0) goto tmp3_end;
          tmpMeta428 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _ty = tmpMeta420;
          _e3 = tmpMeta421;
          _e4 = tmpMeta423;
          _e = tmpMeta424;
          _e1 = tmpMeta426;
          _op2 = tmpMeta427;
          _e2 = tmpMeta428;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp429 = omc_Expression_expEqual(threadData, _e1, _e3);
          if (1 /* true */ != tmp429) goto goto_2;
          tmpMeta430 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _ty);
          tmpMeta431 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, tmpMeta430, _e4);
          tmpMeta432 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _op2, tmpMeta431);
          tmpMeta1 = tmpMeta432;
          goto tmp3_done;
        }
        case 64: {
          modelica_metatype tmpMeta433;
          modelica_metatype tmpMeta434;
          modelica_metatype tmpMeta435;
          modelica_metatype tmpMeta436;
          modelica_metatype tmpMeta437;
          modelica_metatype tmpMeta438;
          modelica_metatype tmpMeta439;
          modelica_metatype tmpMeta440;
          modelica_metatype tmpMeta441;
          modelica_boolean tmp442;
          modelica_metatype tmpMeta443;
          modelica_metatype tmpMeta444;
          modelica_metatype tmpMeta445;
          modelica_metatype tmpMeta446;
          if (0 /* false */ != tmp4_4) goto tmp3_end;
          if (0 /* false */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta433 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta434 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta435 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta435,3,1) == 0) goto tmp3_end;
          tmpMeta436 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta437 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta437,8,2) == 0) goto tmp3_end;
          tmpMeta438 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta437), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta438,5,1) == 0) goto tmp3_end;
          tmpMeta439 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta437), 3));
          tmpMeta440 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta440,3,1) == 0) goto tmp3_end;
          tmpMeta441 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _ty = tmpMeta433;
          _e3 = tmpMeta434;
          _e4 = tmpMeta436;
          _e = tmpMeta437;
          _e1 = tmpMeta439;
          _e2 = tmpMeta441;
          tmp4 += 20; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp442 = omc_Expression_expEqual(threadData, _e1, _e3);
          if (1 /* true */ != tmp442) goto goto_2;
          tmpMeta443 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _ty);
          tmpMeta444 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _ty);
          tmpMeta445 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, omc_Expression_inverseFactors(threadData, _e2), tmpMeta444, omc_Expression_inverseFactors(threadData, _e4));
          tmpMeta446 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, tmpMeta443, tmpMeta445);
          tmpMeta1 = tmpMeta446;
          goto tmp3_done;
        }
        case 65: {
          modelica_metatype tmpMeta447;
          modelica_metatype tmpMeta448;
          modelica_metatype tmpMeta449;
          modelica_metatype tmpMeta450;
          modelica_metatype tmpMeta451;
          modelica_metatype tmpMeta452;
          modelica_metatype tmpMeta453;
          modelica_metatype tmpMeta454;
          modelica_metatype tmpMeta455;
          modelica_metatype tmpMeta456;
          modelica_metatype tmpMeta457;
          modelica_metatype tmpMeta458;
          modelica_boolean tmp459;
          modelica_boolean tmp460;
          modelica_boolean tmp461;
          modelica_boolean tmp462;
          modelica_metatype tmpMeta463;
          modelica_metatype tmpMeta464;
          modelica_metatype tmpMeta465;
          modelica_metatype tmpMeta466;
          if (0 /* false */ != tmp4_4) goto tmp3_end;
          if (0 /* false */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta447 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta448 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta448,2,1) == 0) goto tmp3_end;
          tmpMeta449 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta449,7,3) == 0) goto tmp3_end;
          tmpMeta450 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta449), 2));
          tmpMeta451 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta449), 3));
          tmpMeta452 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta449), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta453 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta454 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta454,2,1) == 0) goto tmp3_end;
          tmpMeta455 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta455,7,3) == 0) goto tmp3_end;
          tmpMeta456 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta455), 2));
          tmpMeta457 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta455), 3));
          tmpMeta458 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta455), 4));
          
          _e1 = tmpMeta447;
          _oper = tmpMeta448;
          _e2 = tmpMeta450;
          _op2 = tmpMeta451;
          _e3 = tmpMeta452;
          _e4 = tmpMeta453;
          _e5 = tmpMeta456;
          _op3 = tmpMeta457;
          _e6 = tmpMeta458;
          _op1 = tmp4_1;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp459 = omc_Expression_isAddOrSub(threadData, _op1);
          if (1 /* true */ != tmp459) goto goto_2;

          /* Pattern-matching assignment */
          tmp460 = omc_Expression_isMulOrDiv(threadData, _op2);
          if (1 /* true */ != tmp460) goto goto_2;

          /* Pattern-matching assignment */
          tmp461 = omc_Expression_isMulOrDiv(threadData, _op3);
          if (1 /* true */ != tmp461) goto goto_2;

          /* Pattern-matching assignment */
          tmp462 = omc_Expression_expEqual(threadData, _e2, _e5);
          if (1 /* true */ != tmp462) goto goto_2;
          tmpMeta463 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, _e3);
          tmpMeta464 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e4, _op3, _e6);
          tmpMeta465 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta463, _op1, tmpMeta464);
          tmpMeta466 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e5, _oper, tmpMeta465);
          tmpMeta1 = tmpMeta466;
          goto tmp3_done;
        }
        case 66: {
          modelica_metatype tmpMeta467;
          modelica_metatype tmpMeta468;
          modelica_metatype tmpMeta469;
          modelica_metatype tmpMeta470;
          modelica_metatype tmpMeta471;
          modelica_metatype tmpMeta472;
          modelica_metatype tmpMeta473;
          modelica_metatype tmpMeta474;
          modelica_metatype tmpMeta475;
          modelica_boolean tmp476;
          modelica_boolean tmp477;
          modelica_boolean tmp478;
          modelica_metatype tmpMeta479;
          modelica_metatype tmpMeta480;
          modelica_metatype tmpMeta481;
          if (0 /* false */ != tmp4_4) goto tmp3_end;
          if (0 /* false */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta467 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta468 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta468,2,1) == 0) goto tmp3_end;
          tmpMeta469 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta470 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta471 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta471,2,1) == 0) goto tmp3_end;
          tmpMeta472 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta472,7,3) == 0) goto tmp3_end;
          tmpMeta473 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta472), 2));
          tmpMeta474 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta472), 3));
          tmpMeta475 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta472), 4));
          
          _e1 = tmpMeta467;
          _oper = tmpMeta468;
          _e2 = tmpMeta469;
          _e4 = tmpMeta470;
          _e5 = tmpMeta473;
          _op3 = tmpMeta474;
          _e6 = tmpMeta475;
          _op1 = tmp4_1;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp476 = omc_Expression_isAddOrSub(threadData, _op1);
          if (1 /* true */ != tmp476) goto goto_2;

          /* Pattern-matching assignment */
          tmp477 = omc_Expression_isMulOrDiv(threadData, _op3);
          if (1 /* true */ != tmp477) goto goto_2;

          /* Pattern-matching assignment */
          tmp478 = omc_Expression_expEqual(threadData, _e2, _e5);
          if (1 /* true */ != tmp478) goto goto_2;
          tmpMeta479 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e4, _op3, _e6);
          tmpMeta480 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, tmpMeta479);
          tmpMeta481 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e5, _oper, tmpMeta480);
          tmpMeta1 = tmpMeta481;
          goto tmp3_done;
        }
        case 67: {
          modelica_metatype tmpMeta482;
          modelica_metatype tmpMeta483;
          modelica_metatype tmpMeta484;
          modelica_metatype tmpMeta485;
          modelica_metatype tmpMeta486;
          modelica_metatype tmpMeta487;
          modelica_metatype tmpMeta488;
          modelica_metatype tmpMeta489;
          modelica_metatype tmpMeta490;
          modelica_boolean tmp491;
          modelica_boolean tmp492;
          modelica_metatype tmpMeta493;
          modelica_metatype tmpMeta494;
          modelica_metatype tmpMeta495;
          modelica_metatype tmpMeta496;
          modelica_metatype tmpMeta497;
          modelica_metatype tmpMeta498;
          if (0 /* false */ != tmp4_4) goto tmp3_end;
          if (0 /* false */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta482 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta483 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta483,2,1) == 0) goto tmp3_end;
          tmpMeta484 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta485 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta486 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta486,2,1) == 0) goto tmp3_end;
          tmpMeta487 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta487,7,3) == 0) goto tmp3_end;
          tmpMeta488 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta487), 2));
          tmpMeta489 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta487), 3));
          tmpMeta490 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta487), 4));
          
          _e4 = tmpMeta482;
          _e5 = tmpMeta484;
          _e1 = tmpMeta485;
          _oper = tmpMeta486;
          _e2 = tmpMeta488;
          _op2 = tmpMeta489;
          _e3 = tmpMeta490;
          _op1 = tmp4_1;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp491 = omc_Expression_isAddOrSub(threadData, _op1);
          if (1 /* true */ != tmp491) goto goto_2;

          /* Pattern-matching assignment */
          tmp492 = omc_Expression_isMulOrDiv(threadData, _op2);
          if (1 /* true */ != tmp492) goto goto_2;

          if(omc_Expression_expEqual(threadData, _e2, _e5))
          {
            tmpMeta493 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, _e3);
            tmpMeta494 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta493, _op1, _e4);
            tmpMeta495 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e5, _oper, tmpMeta494);
            _outExp = tmpMeta495;
          }
          else
          {
            if(omc_Expression_expEqual(threadData, _e2, _e4))
            {
              tmpMeta496 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, _e3);
              tmpMeta497 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta496, _op1, _e5);
              tmpMeta498 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e4, _oper, tmpMeta497);
              _outExp = tmpMeta498;
            }
            else
            {
              goto goto_2;
            }
          }
          tmpMeta1 = _outExp;
          goto tmp3_done;
        }
        case 68: {
          modelica_metatype tmpMeta499;
          modelica_metatype tmpMeta500;
          modelica_metatype tmpMeta501;
          modelica_metatype tmpMeta502;
          modelica_metatype tmpMeta503;
          modelica_metatype tmpMeta504;
          modelica_metatype tmpMeta505;
          modelica_metatype tmpMeta506;
          modelica_metatype tmpMeta507;
          modelica_boolean tmp508;
          modelica_boolean tmp509;
          modelica_metatype tmpMeta510;
          modelica_metatype tmpMeta511;
          modelica_metatype tmpMeta512;
          modelica_metatype tmpMeta513;
          modelica_metatype tmpMeta514;
          modelica_metatype tmpMeta515;
          if (0 /* false */ != tmp4_4) goto tmp3_end;
          if (0 /* false */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta499 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta500 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta500,2,1) == 0) goto tmp3_end;
          tmpMeta501 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta502 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta502,7,3) == 0) goto tmp3_end;
          tmpMeta503 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta502), 2));
          tmpMeta504 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta502), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta504,2,1) == 0) goto tmp3_end;
          tmpMeta505 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta502), 4));
          tmpMeta506 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmpMeta507 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e4 = tmpMeta499;
          _e5 = tmpMeta501;
          _e1 = tmpMeta503;
          _oper = tmpMeta504;
          _e2 = tmpMeta505;
          _op2 = tmpMeta506;
          _e3 = tmpMeta507;
          _op1 = tmp4_1;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp508 = omc_Expression_isAddOrSub(threadData, _op1);
          if (1 /* true */ != tmp508) goto goto_2;

          /* Pattern-matching assignment */
          tmp509 = omc_Expression_isMulOrDiv(threadData, _op2);
          if (1 /* true */ != tmp509) goto goto_2;

          if(omc_Expression_expEqual(threadData, _e2, _e5))
          {
            tmpMeta510 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, _e3);
            tmpMeta511 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta510, _op1, _e4);
            tmpMeta512 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e5, _oper, tmpMeta511);
            _outExp = tmpMeta512;
          }
          else
          {
            if(omc_Expression_expEqual(threadData, _e2, _e4))
            {
              tmpMeta513 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, _e3);
              tmpMeta514 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta513, _op1, _e5);
              tmpMeta515 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e4, _oper, tmpMeta514);
              _outExp = tmpMeta515;
            }
            else
            {
              goto goto_2;
            }
          }
          tmpMeta1 = _outExp;
          goto tmp3_done;
        }
        case 69: {
          modelica_metatype tmpMeta516;
          modelica_real tmp517;
          modelica_metatype tmpMeta518;
          modelica_metatype tmpMeta519;
          modelica_metatype tmpMeta520;
          modelica_metatype tmpMeta521;
          modelica_metatype tmpMeta522;
          modelica_metatype tmpMeta523;
          modelica_metatype tmpMeta524;
          modelica_boolean tmp525;
          modelica_metatype tmpMeta526;
          modelica_metatype tmpMeta527;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta516 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp517 = mmc_unbox_real(tmpMeta516);
          
          _e2 = tmp4_3;
          _r = tmp517  /* pattern as ty=Real */;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(_r != ((modelica_real)((modelica_integer)floor(_r))))) goto tmp3_end;
          /* Pattern-matching assignment */
          tmpMeta518 = omc_Expression_factors(threadData, _e1);
          if (listEmpty(tmpMeta518)) goto goto_2;
          tmpMeta519 = MMC_CAR(tmpMeta518);
          tmpMeta520 = MMC_CDR(tmpMeta518);
          if (listEmpty(tmpMeta520)) goto goto_2;
          tmpMeta521 = MMC_CAR(tmpMeta520);
          tmpMeta522 = MMC_CDR(tmpMeta520);
          if (listEmpty(tmpMeta522)) goto goto_2;
          tmpMeta523 = MMC_CAR(tmpMeta522);
          tmpMeta524 = MMC_CDR(tmpMeta522);
          _exp_lst = tmpMeta518;

          /* Pattern-matching assignment */
          tmp525 = omc_List_any(threadData, _exp_lst, boxvar_Expression_isEvaluatedConst);
          if (1 /* true */ != tmp525) goto goto_2;

          _exp_lst = omc_List_splitOnTrue(threadData, _exp_lst, boxvar_Expression_isPositiveOrZero ,&_exp_lst_1);

          _exp_lst = omc_ExpressionSimplify_simplifyBinaryDistributePow(threadData, _exp_lst, _e2);

          _e = omc_Expression_makeProductLst(threadData, _exp_lst_1);

          tmpMeta526 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _inOperator2, _e2);
          _e = tmpMeta526;
          tmpMeta527 = mmc_mk_cons(_e, _exp_lst);
          tmpMeta1 = omc_Expression_makeProductLst(threadData, tmpMeta527);
          goto tmp3_done;
        }
        case 70: {
          modelica_metatype tmpMeta528;
          modelica_metatype tmpMeta529;
          modelica_metatype tmpMeta530;
          modelica_metatype tmpMeta531;
          modelica_metatype tmpMeta532;
          modelica_metatype tmpMeta533;
          modelica_metatype tmpMeta534;
          modelica_boolean tmp535;
          if (1 /* true */ != tmp4_5) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isEvaluatedConst(threadData, _e2)) goto tmp3_end;
          /* Pattern-matching assignment */
          tmpMeta528 = omc_Expression_factors(threadData, _e1);
          if (listEmpty(tmpMeta528)) goto goto_2;
          tmpMeta529 = MMC_CAR(tmpMeta528);
          tmpMeta530 = MMC_CDR(tmpMeta528);
          if (listEmpty(tmpMeta530)) goto goto_2;
          tmpMeta531 = MMC_CAR(tmpMeta530);
          tmpMeta532 = MMC_CDR(tmpMeta530);
          if (listEmpty(tmpMeta532)) goto goto_2;
          tmpMeta533 = MMC_CAR(tmpMeta532);
          tmpMeta534 = MMC_CDR(tmpMeta532);
          _exp_lst = tmpMeta528;

          /* Pattern-matching assignment */
          tmp535 = omc_List_any(threadData, _exp_lst, boxvar_Expression_isEvaluatedConst);
          if (1 /* true */ != tmp535) goto goto_2;

          _exp_lst_1 = omc_ExpressionSimplify_simplifyBinaryDistributePow(threadData, _exp_lst, _e2);
          tmpMeta1 = omc_Expression_makeProductLst(threadData, _exp_lst_1);
          goto tmp3_done;
        }
        case 71: {
          modelica_metatype tmpMeta536;
          modelica_metatype tmpMeta537;
          modelica_metatype tmpMeta538;
          modelica_boolean tmp539;
          modelica_metatype tmpMeta540;
          modelica_metatype tmpMeta541;
          modelica_metatype tmpMeta542;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta536 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta537 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta537,4,1) == 0) goto tmp3_end;
          tmpMeta538 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e1 = tmpMeta536;
          _e2 = tmpMeta538;
          _e3 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isEven(threadData, _e2)) goto tmp3_end;
          if(omc_Expression_isEvaluatedConst(threadData, _e3))
          {
            _e = omc_ExpressionSimplify_simplifyBinaryConst(threadData, _OMC_LIT34, _e2, _e3);

            /* Pattern-matching assignment */
            tmp539 = omc_Expression_isEven(threadData, _e);
            if (0 /* false */ != tmp539) goto goto_2;
          }
          else
          {
            tmpMeta540 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _OMC_LIT34, _e3);
            _e = tmpMeta540;
          }
          tmpMeta541 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta542 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT24, tmpMeta541, omc_Expression_typeof(threadData, _e1)), _OMC_LIT36, _e);
          tmpMeta1 = tmpMeta542;
          goto tmp3_done;
        }
        case 72: {
          modelica_metatype tmpMeta543;
          modelica_metatype tmpMeta544;
          modelica_metatype tmpMeta545;
          modelica_metatype tmpMeta546;
          modelica_metatype tmpMeta547;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta543 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta544 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta544,4,1) == 0) goto tmp3_end;
          tmpMeta545 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e1 = tmpMeta543;
          _e2 = tmpMeta545;
          _e3 = tmp4_3;
          tmp4 += 12; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta546 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _OMC_LIT34, _e3);
          tmpMeta547 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _OMC_LIT36, tmpMeta546);
          tmpMeta1 = tmpMeta547;
          goto tmp3_done;
        }
        case 73: {
          modelica_metatype tmpMeta548;
          modelica_metatype tmpMeta549;
          modelica_metatype tmpMeta550;
          modelica_metatype tmpMeta551;
          modelica_metatype tmpMeta552;
          modelica_metatype tmpMeta553;
          modelica_metatype tmpMeta554;
          modelica_metatype tmpMeta555;
          modelica_metatype tmpMeta556;
          modelica_metatype tmpMeta557;
          modelica_metatype tmpMeta558;
          modelica_boolean tmp559;
          modelica_metatype tmpMeta560;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta548 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta549 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta549,1,1) == 0) goto tmp3_end;
          tmpMeta550 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta549), 2));
          if (3 != MMC_STRLEN(tmpMeta550) || strcmp(MMC_STRINGDATA(_OMC_LIT39), MMC_STRINGDATA(tmpMeta550)) != 0) goto tmp3_end;
          tmpMeta551 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta551)) goto tmp3_end;
          tmpMeta552 = MMC_CAR(tmpMeta551);
          tmpMeta553 = MMC_CDR(tmpMeta551);
          if (!listEmpty(tmpMeta553)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta554 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta554,1,1) == 0) goto tmp3_end;
          tmpMeta555 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta554), 2));
          if (3 != MMC_STRLEN(tmpMeta555) || strcmp(MMC_STRINGDATA(_OMC_LIT38), MMC_STRINGDATA(tmpMeta555)) != 0) goto tmp3_end;
          tmpMeta556 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta556)) goto tmp3_end;
          tmpMeta557 = MMC_CAR(tmpMeta556);
          tmpMeta558 = MMC_CDR(tmpMeta556);
          if (!listEmpty(tmpMeta558)) goto tmp3_end;
          
          _ty = tmpMeta548;
          _e1 = tmpMeta552;
          _e2 = tmpMeta557;
          tmp4 += 11; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp559 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp559) goto goto_2;
          tmpMeta560 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT37, tmpMeta560, _ty);
          goto tmp3_done;
        }
        case 74: {
          modelica_metatype tmpMeta561;
          modelica_metatype tmpMeta562;
          modelica_metatype tmpMeta563;
          modelica_metatype tmpMeta564;
          modelica_metatype tmpMeta565;
          modelica_metatype tmpMeta566;
          modelica_metatype tmpMeta567;
          modelica_metatype tmpMeta568;
          modelica_metatype tmpMeta569;
          modelica_metatype tmpMeta570;
          modelica_metatype tmpMeta571;
          modelica_boolean tmp572;
          modelica_metatype tmpMeta573;
          modelica_metatype tmpMeta574;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta561 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta562 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta562,1,1) == 0) goto tmp3_end;
          tmpMeta563 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta562), 2));
          if (3 != MMC_STRLEN(tmpMeta563) || strcmp(MMC_STRINGDATA(_OMC_LIT37), MMC_STRINGDATA(tmpMeta563)) != 0) goto tmp3_end;
          tmpMeta564 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta564)) goto tmp3_end;
          tmpMeta565 = MMC_CAR(tmpMeta564);
          tmpMeta566 = MMC_CDR(tmpMeta564);
          if (!listEmpty(tmpMeta566)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta567 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta567,1,1) == 0) goto tmp3_end;
          tmpMeta568 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta567), 2));
          if (3 != MMC_STRLEN(tmpMeta568) || strcmp(MMC_STRINGDATA(_OMC_LIT39), MMC_STRINGDATA(tmpMeta568)) != 0) goto tmp3_end;
          tmpMeta569 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta569)) goto tmp3_end;
          tmpMeta570 = MMC_CAR(tmpMeta569);
          tmpMeta571 = MMC_CDR(tmpMeta569);
          if (!listEmpty(tmpMeta571)) goto tmp3_end;
          
          _op2 = tmp4_1;
          _ty = tmpMeta561;
          _e1 = tmpMeta565;
          _e2 = tmpMeta570;
          tmp4 += 10; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp572 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp572) goto goto_2;

          _e3 = _OMC_LIT27;

          tmpMeta573 = mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil));
          _e4 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT38, tmpMeta573, _ty);
          tmpMeta574 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e3, _op2, _e4);
          tmpMeta1 = tmpMeta574;
          goto tmp3_done;
        }
        case 75: {
          modelica_metatype tmpMeta575;
          modelica_metatype tmpMeta576;
          modelica_metatype tmpMeta577;
          modelica_metatype tmpMeta578;
          modelica_metatype tmpMeta579;
          modelica_metatype tmpMeta580;
          modelica_metatype tmpMeta581;
          modelica_metatype tmpMeta582;
          modelica_metatype tmpMeta583;
          modelica_metatype tmpMeta584;
          modelica_metatype tmpMeta585;
          modelica_boolean tmp586;
          modelica_metatype tmpMeta587;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta575 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta576 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta576,1,1) == 0) goto tmp3_end;
          tmpMeta577 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta576), 2));
          if (3 != MMC_STRLEN(tmpMeta577) || strcmp(MMC_STRINGDATA(_OMC_LIT39), MMC_STRINGDATA(tmpMeta577)) != 0) goto tmp3_end;
          tmpMeta578 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta578)) goto tmp3_end;
          tmpMeta579 = MMC_CAR(tmpMeta578);
          tmpMeta580 = MMC_CDR(tmpMeta578);
          if (!listEmpty(tmpMeta580)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta581 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta581,1,1) == 0) goto tmp3_end;
          tmpMeta582 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta581), 2));
          if (3 != MMC_STRLEN(tmpMeta582) || strcmp(MMC_STRINGDATA(_OMC_LIT37), MMC_STRINGDATA(tmpMeta582)) != 0) goto tmp3_end;
          tmpMeta583 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta583)) goto tmp3_end;
          tmpMeta584 = MMC_CAR(tmpMeta583);
          tmpMeta585 = MMC_CDR(tmpMeta583);
          if (!listEmpty(tmpMeta585)) goto tmp3_end;
          
          _ty = tmpMeta575;
          _e1 = tmpMeta579;
          _e2 = tmpMeta584;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp586 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp586) goto goto_2;
          tmpMeta587 = mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT38, tmpMeta587, _ty);
          goto tmp3_done;
        }
        case 76: {
          modelica_metatype tmpMeta588;
          modelica_metatype tmpMeta589;
          modelica_metatype tmpMeta590;
          modelica_metatype tmpMeta591;
          modelica_metatype tmpMeta592;
          modelica_metatype tmpMeta593;
          modelica_metatype tmpMeta594;
          modelica_metatype tmpMeta595;
          modelica_metatype tmpMeta596;
          modelica_metatype tmpMeta597;
          modelica_metatype tmpMeta598;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta588 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta589 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta589,1,1) == 0) goto tmp3_end;
          tmpMeta590 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta589), 2));
          if (3 != MMC_STRLEN(tmpMeta590) || strcmp(MMC_STRINGDATA(_OMC_LIT37), MMC_STRINGDATA(tmpMeta590)) != 0) goto tmp3_end;
          tmpMeta591 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta591)) goto tmp3_end;
          tmpMeta592 = MMC_CAR(tmpMeta591);
          tmpMeta593 = MMC_CDR(tmpMeta591);
          if (!listEmpty(tmpMeta593)) goto tmp3_end;
          
          _op2 = tmp4_1;
          _ty = tmpMeta588;
          _e2 = tmpMeta592;
          _e1 = tmp4_2;
          tmp4 += 8; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta594 = mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil));
          _e3 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT39, tmpMeta594, _ty);

          tmpMeta595 = mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil));
          _e4 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT38, tmpMeta595, _ty);

          tmpMeta596 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e4, _op2, _e3);
          _e = tmpMeta596;
          tmpMeta597 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _ty);
          tmpMeta598 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta597, _e);
          tmpMeta1 = tmpMeta598;
          goto tmp3_done;
        }
        case 77: {
          modelica_metatype tmpMeta599;
          modelica_metatype tmpMeta600;
          modelica_metatype tmpMeta601;
          modelica_metatype tmpMeta602;
          modelica_metatype tmpMeta603;
          modelica_metatype tmpMeta604;
          modelica_metatype tmpMeta605;
          modelica_metatype tmpMeta606;
          modelica_metatype tmpMeta607;
          modelica_metatype tmpMeta608;
          modelica_metatype tmpMeta609;
          modelica_boolean tmp610;
          modelica_metatype tmpMeta611;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta599 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta600 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta600,1,1) == 0) goto tmp3_end;
          tmpMeta601 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta600), 2));
          if (4 != MMC_STRLEN(tmpMeta601) || strcmp(MMC_STRINGDATA(_OMC_LIT42), MMC_STRINGDATA(tmpMeta601)) != 0) goto tmp3_end;
          tmpMeta602 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta602)) goto tmp3_end;
          tmpMeta603 = MMC_CAR(tmpMeta602);
          tmpMeta604 = MMC_CDR(tmpMeta602);
          if (!listEmpty(tmpMeta604)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta605 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta605,1,1) == 0) goto tmp3_end;
          tmpMeta606 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta605), 2));
          if (4 != MMC_STRLEN(tmpMeta606) || strcmp(MMC_STRINGDATA(_OMC_LIT41), MMC_STRINGDATA(tmpMeta606)) != 0) goto tmp3_end;
          tmpMeta607 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta607)) goto tmp3_end;
          tmpMeta608 = MMC_CAR(tmpMeta607);
          tmpMeta609 = MMC_CDR(tmpMeta607);
          if (!listEmpty(tmpMeta609)) goto tmp3_end;
          
          _ty = tmpMeta599;
          _e1 = tmpMeta603;
          _e2 = tmpMeta608;
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp610 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp610) goto goto_2;
          tmpMeta611 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT40, tmpMeta611, _ty);
          goto tmp3_done;
        }
        case 78: {
          modelica_metatype tmpMeta612;
          modelica_metatype tmpMeta613;
          modelica_metatype tmpMeta614;
          modelica_metatype tmpMeta615;
          modelica_metatype tmpMeta616;
          modelica_metatype tmpMeta617;
          modelica_metatype tmpMeta618;
          modelica_metatype tmpMeta619;
          modelica_metatype tmpMeta620;
          modelica_metatype tmpMeta621;
          modelica_metatype tmpMeta622;
          modelica_boolean tmp623;
          modelica_metatype tmpMeta624;
          modelica_metatype tmpMeta625;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta612 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta613 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta613,1,1) == 0) goto tmp3_end;
          tmpMeta614 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta613), 2));
          if (4 != MMC_STRLEN(tmpMeta614) || strcmp(MMC_STRINGDATA(_OMC_LIT40), MMC_STRINGDATA(tmpMeta614)) != 0) goto tmp3_end;
          tmpMeta615 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta615)) goto tmp3_end;
          tmpMeta616 = MMC_CAR(tmpMeta615);
          tmpMeta617 = MMC_CDR(tmpMeta615);
          if (!listEmpty(tmpMeta617)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta618 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta618,1,1) == 0) goto tmp3_end;
          tmpMeta619 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta618), 2));
          if (4 != MMC_STRLEN(tmpMeta619) || strcmp(MMC_STRINGDATA(_OMC_LIT42), MMC_STRINGDATA(tmpMeta619)) != 0) goto tmp3_end;
          tmpMeta620 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta620)) goto tmp3_end;
          tmpMeta621 = MMC_CAR(tmpMeta620);
          tmpMeta622 = MMC_CDR(tmpMeta620);
          if (!listEmpty(tmpMeta622)) goto tmp3_end;
          
          _op2 = tmp4_1;
          _ty = tmpMeta612;
          _e1 = tmpMeta616;
          _e2 = tmpMeta621;
          tmp4 += 6; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp623 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp623) goto goto_2;

          _e3 = _OMC_LIT27;

          tmpMeta624 = mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil));
          _e4 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT41, tmpMeta624, _ty);
          tmpMeta625 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e3, _op2, _e4);
          tmpMeta1 = tmpMeta625;
          goto tmp3_done;
        }
        case 79: {
          modelica_metatype tmpMeta626;
          modelica_metatype tmpMeta627;
          modelica_metatype tmpMeta628;
          modelica_metatype tmpMeta629;
          modelica_metatype tmpMeta630;
          modelica_metatype tmpMeta631;
          modelica_metatype tmpMeta632;
          modelica_metatype tmpMeta633;
          modelica_metatype tmpMeta634;
          modelica_metatype tmpMeta635;
          modelica_metatype tmpMeta636;
          modelica_boolean tmp637;
          modelica_metatype tmpMeta638;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta626 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta627 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta627,1,1) == 0) goto tmp3_end;
          tmpMeta628 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta627), 2));
          if (4 != MMC_STRLEN(tmpMeta628) || strcmp(MMC_STRINGDATA(_OMC_LIT42), MMC_STRINGDATA(tmpMeta628)) != 0) goto tmp3_end;
          tmpMeta629 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta629)) goto tmp3_end;
          tmpMeta630 = MMC_CAR(tmpMeta629);
          tmpMeta631 = MMC_CDR(tmpMeta629);
          if (!listEmpty(tmpMeta631)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta632 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta632,1,1) == 0) goto tmp3_end;
          tmpMeta633 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta632), 2));
          if (4 != MMC_STRLEN(tmpMeta633) || strcmp(MMC_STRINGDATA(_OMC_LIT40), MMC_STRINGDATA(tmpMeta633)) != 0) goto tmp3_end;
          tmpMeta634 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta634)) goto tmp3_end;
          tmpMeta635 = MMC_CAR(tmpMeta634);
          tmpMeta636 = MMC_CDR(tmpMeta634);
          if (!listEmpty(tmpMeta636)) goto tmp3_end;
          
          _ty = tmpMeta626;
          _e1 = tmpMeta630;
          _e2 = tmpMeta635;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp637 = omc_Expression_expEqual(threadData, _e1, _e2);
          if (1 /* true */ != tmp637) goto goto_2;
          tmpMeta638 = mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT41, tmpMeta638, _ty);
          goto tmp3_done;
        }
        case 80: {
          modelica_metatype tmpMeta639;
          modelica_metatype tmpMeta640;
          modelica_metatype tmpMeta641;
          modelica_metatype tmpMeta642;
          modelica_metatype tmpMeta643;
          modelica_metatype tmpMeta644;
          modelica_metatype tmpMeta645;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          tmpMeta639 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,8,2) == 0) goto tmp3_end;
          tmpMeta640 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta640,5,1) == 0) goto tmp3_end;
          tmpMeta641 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _ty = tmpMeta639;
          _e2 = tmpMeta641;
          _e1 = tmp4_2;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta642 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _ty);
          tmpMeta643 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta642, _e1);
          _e1_1 = tmpMeta643;
          tmpMeta644 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _ty);
          tmpMeta645 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, tmpMeta644, _e2);
          tmpMeta1 = tmpMeta645;
          goto tmp3_done;
        }
        case 81: {
          modelica_metatype tmpMeta646;
          modelica_metatype tmpMeta647;
          modelica_metatype tmpMeta648;
          modelica_metatype tmpMeta649;
          modelica_metatype tmpMeta650;
          modelica_metatype tmpMeta651;
          modelica_metatype tmpMeta652;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,18,4) == 0) goto tmp3_end;
          tmpMeta646 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta647 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmpMeta648 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          tmpMeta649 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 5));
          
          _ty = tmpMeta646;
          _e1 = tmpMeta647;
          _oexp = tmpMeta648;
          _e2 = tmpMeta649;
          /* Pattern matching succeeded */
          tmpMeta650 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _inOperator2, _rhs);
          _e1 = omc_ExpressionSimplify_simplifyBinary(threadData, tmpMeta650, _inOperator2, _e1, _rhs);

          tmpMeta651 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _inOperator2, _rhs);
          _e2 = omc_ExpressionSimplify_simplifyBinary(threadData, tmpMeta651, _inOperator2, _e2, _rhs);
          tmpMeta652 = mmc_mk_box5(21, &DAE_Exp_RANGE__desc, _ty, _e1, _oexp, _e2);
          tmpMeta1 = tmpMeta652;
          goto tmp3_done;
        }
        case 82: {
          modelica_metatype tmpMeta653;
          modelica_metatype tmpMeta654;
          modelica_metatype tmpMeta655;
          modelica_metatype tmpMeta656;
          modelica_metatype tmpMeta657;
          modelica_metatype tmpMeta658;
          modelica_metatype tmpMeta659;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,18,4) == 0) goto tmp3_end;
          tmpMeta653 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta654 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          tmpMeta655 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          tmpMeta656 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 5));
          
          _ty = tmpMeta653;
          _e1 = tmpMeta654;
          _oexp = tmpMeta655;
          _e2 = tmpMeta656;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta657 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _lhs, _inOperator2, _e1);
          _e1 = omc_ExpressionSimplify_simplifyBinary(threadData, tmpMeta657, _inOperator2, _lhs, _e1);

          tmpMeta658 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _lhs, _inOperator2, _e1);
          _e2 = omc_ExpressionSimplify_simplifyBinary(threadData, tmpMeta658, _inOperator2, _lhs, _e2);
          tmpMeta659 = mmc_mk_box5(21, &DAE_Exp_RANGE__desc, _ty, _e1, _oexp, _e2);
          tmpMeta1 = tmpMeta659;
          goto tmp3_done;
        }
        case 83: {
          modelica_metatype tmpMeta660;
          modelica_metatype tmpMeta661;
          modelica_metatype tmpMeta662;
          modelica_metatype tmpMeta663;
          modelica_metatype tmpMeta664;
          modelica_metatype tmpMeta665;
          modelica_metatype tmpMeta666;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,18,4) == 0) goto tmp3_end;
          tmpMeta660 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta661 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          tmpMeta662 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          tmpMeta663 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 5));
          
          _ty = tmpMeta660;
          _e1 = tmpMeta661;
          _oexp = tmpMeta662;
          _e2 = tmpMeta663;
          /* Pattern matching succeeded */
          tmpMeta664 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _inOperator2, _rhs);
          _e1 = omc_ExpressionSimplify_simplifyBinary(threadData, tmpMeta664, _inOperator2, _e1, _rhs);

          tmpMeta665 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _inOperator2, _rhs);
          _e2 = omc_ExpressionSimplify_simplifyBinary(threadData, tmpMeta665, _inOperator2, _e2, _rhs);
          tmpMeta666 = mmc_mk_box5(21, &DAE_Exp_RANGE__desc, _ty, _e1, _oexp, _e2);
          tmpMeta1 = tmpMeta666;
          goto tmp3_done;
        }
        case 84: {
          modelica_metatype tmpMeta667;
          modelica_metatype tmpMeta668;
          modelica_metatype tmpMeta669;
          modelica_metatype tmpMeta670;
          modelica_metatype tmpMeta671;
          modelica_metatype tmpMeta672;
          modelica_metatype tmpMeta673;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,18,4) == 0) goto tmp3_end;
          tmpMeta667 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta668 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          tmpMeta669 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          tmpMeta670 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 5));
          
          _ty = tmpMeta667;
          _e1 = tmpMeta668;
          _oexp = tmpMeta669;
          _e2 = tmpMeta670;
          /* Pattern matching succeeded */
          tmpMeta671 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _lhs, _inOperator2, _e1);
          _e1 = omc_ExpressionSimplify_simplifyBinary(threadData, tmpMeta671, _inOperator2, _lhs, _e1);

          tmpMeta672 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _lhs, _inOperator2, _e1);
          _e2 = omc_ExpressionSimplify_simplifyBinary(threadData, tmpMeta672, _inOperator2, _lhs, _e2);
          tmpMeta673 = mmc_mk_box5(21, &DAE_Exp_RANGE__desc, _ty, _e1, _oexp, _e2);
          tmpMeta1 = tmpMeta673;
          goto tmp3_done;
        }
        case 85: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 86) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryCommutativeWork(threadData_t *threadData, modelica_metatype _op, modelica_metatype _lhs, modelica_metatype _rhs)
{
  modelica_metatype _exp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;volatile modelica_metatype tmp4_3;
    tmp4_1 = _op;
    tmp4_2 = _lhs;
    tmp4_3 = _rhs;
    {
      modelica_metatype _e3 = NULL;
      modelica_metatype _e4 = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _op1 = NULL;
      modelica_metatype _op2 = NULL;
      modelica_metatype _ty = NULL;
      modelica_metatype _tp = NULL;
      modelica_metatype _tp2 = NULL;
      modelica_real _r1;
      modelica_real _r2;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e3 has no default value.
      // _e4 has no default value.
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _op1 has no default value.
      // _op2 has no default value.
      // _ty has no default value.
      // _tp has no default value.
      // _tp2 has no default value.
      // _r1 has no default value.
      // _r2 has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 22; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,1,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          if (3 != MMC_STRLEN(tmpMeta7) || strcmp(MMC_STRINGDATA(_OMC_LIT39), MMC_STRINGDATA(tmpMeta7)) != 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta8)) goto tmp3_end;
          tmpMeta9 = MMC_CAR(tmpMeta8);
          tmpMeta10 = MMC_CDR(tmpMeta8);
          if (!listEmpty(tmpMeta10)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta11,1,1) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta11), 2));
          if (3 != MMC_STRLEN(tmpMeta12) || strcmp(MMC_STRINGDATA(_OMC_LIT38), MMC_STRINGDATA(tmpMeta12)) != 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta13)) goto tmp3_end;
          tmpMeta14 = MMC_CAR(tmpMeta13);
          tmpMeta15 = MMC_CDR(tmpMeta13);
          if (!listEmpty(tmpMeta15)) goto tmp3_end;
          
          _e1 = tmpMeta9;
          _e2 = tmpMeta14;
          tmp4 += 8; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          _op1 = _OMC_LIT34;

          tmpMeta16 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT29, _op1, _e1);
          _e = tmpMeta16;

          tmpMeta17 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          _e = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT39, tmpMeta17, _OMC_LIT30);
          tmpMeta18 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT33, _op1, _e);
          tmpMeta1 = tmpMeta18;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_real tmp29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_real tmp40;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta19,13,3) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta19), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta20,1,1) == 0) goto tmp3_end;
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta20), 2));
          if (3 != MMC_STRLEN(tmpMeta21) || strcmp(MMC_STRINGDATA(_OMC_LIT39), MMC_STRINGDATA(tmpMeta21)) != 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta19), 3));
          if (listEmpty(tmpMeta22)) goto tmp3_end;
          tmpMeta23 = MMC_CAR(tmpMeta22);
          tmpMeta24 = MMC_CDR(tmpMeta22);
          if (!listEmpty(tmpMeta24)) goto tmp3_end;
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta25,4,1) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta25), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta26,1,1) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta27,1,1) == 0) goto tmp3_end;
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 2));
          tmp29 = mmc_unbox_real(tmpMeta28);
          if (2.0 != tmp29) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta30,13,3) == 0) goto tmp3_end;
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta30), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta31,1,1) == 0) goto tmp3_end;
          tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta31), 2));
          if (3 != MMC_STRLEN(tmpMeta32) || strcmp(MMC_STRINGDATA(_OMC_LIT38), MMC_STRINGDATA(tmpMeta32)) != 0) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta30), 3));
          if (listEmpty(tmpMeta33)) goto tmp3_end;
          tmpMeta34 = MMC_CAR(tmpMeta33);
          tmpMeta35 = MMC_CDR(tmpMeta33);
          if (!listEmpty(tmpMeta35)) goto tmp3_end;
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta36,4,1) == 0) goto tmp3_end;
          tmpMeta37 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta36), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta37,1,1) == 0) goto tmp3_end;
          tmpMeta38 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta38,1,1) == 0) goto tmp3_end;
          tmpMeta39 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta38), 2));
          tmp40 = mmc_unbox_real(tmpMeta39);
          if (2.0 != tmp40) goto tmp3_end;
          _e1 = tmpMeta23;
          _e2 = tmpMeta34;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta1 = _OMC_LIT27;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta42,1,1) == 0) goto tmp3_end;
          tmpMeta43 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta42), 2));
          if (3 != MMC_STRLEN(tmpMeta43) || strcmp(MMC_STRINGDATA(_OMC_LIT37), MMC_STRINGDATA(tmpMeta43)) != 0) goto tmp3_end;
          tmpMeta44 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta44)) goto tmp3_end;
          tmpMeta45 = MMC_CAR(tmpMeta44);
          tmpMeta46 = MMC_CDR(tmpMeta44);
          if (!listEmpty(tmpMeta46)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta47,1,1) == 0) goto tmp3_end;
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta47), 2));
          if (3 != MMC_STRLEN(tmpMeta48) || strcmp(MMC_STRINGDATA(_OMC_LIT38), MMC_STRINGDATA(tmpMeta48)) != 0) goto tmp3_end;
          tmpMeta49 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta49)) goto tmp3_end;
          tmpMeta50 = MMC_CAR(tmpMeta49);
          tmpMeta51 = MMC_CDR(tmpMeta49);
          if (!listEmpty(tmpMeta51)) goto tmp3_end;
          
          _tp = tmpMeta41;
          _e1 = tmpMeta45;
          _e2 = tmpMeta50;
          tmp4 += 6; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta52 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT39, tmpMeta52, _tp);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          modelica_metatype tmpMeta59;
          modelica_metatype tmpMeta60;
          modelica_metatype tmpMeta61;
          modelica_metatype tmpMeta62;
          modelica_real tmp63;
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          modelica_metatype tmpMeta68;
          modelica_metatype tmpMeta69;
          modelica_metatype tmpMeta70;
          modelica_metatype tmpMeta71;
          modelica_metatype tmpMeta72;
          modelica_metatype tmpMeta73;
          modelica_metatype tmpMeta74;
          modelica_metatype tmpMeta75;
          modelica_real tmp76;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta53,13,3) == 0) goto tmp3_end;
          tmpMeta54 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta53), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta54,1,1) == 0) goto tmp3_end;
          tmpMeta55 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta54), 2));
          if (4 != MMC_STRLEN(tmpMeta55) || strcmp(MMC_STRINGDATA(_OMC_LIT41), MMC_STRINGDATA(tmpMeta55)) != 0) goto tmp3_end;
          tmpMeta56 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta53), 3));
          if (listEmpty(tmpMeta56)) goto tmp3_end;
          tmpMeta57 = MMC_CAR(tmpMeta56);
          tmpMeta58 = MMC_CDR(tmpMeta56);
          if (!listEmpty(tmpMeta58)) goto tmp3_end;
          tmpMeta59 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta59,4,1) == 0) goto tmp3_end;
          tmpMeta60 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta59), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta60,1,1) == 0) goto tmp3_end;
          tmpMeta61 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta61,1,1) == 0) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta61), 2));
          tmp63 = mmc_unbox_real(tmpMeta62);
          if (2.0 != tmp63) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,8,2) == 0) goto tmp3_end;
          tmpMeta64 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta64,5,1) == 0) goto tmp3_end;
          tmpMeta65 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta65,7,3) == 0) goto tmp3_end;
          tmpMeta66 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta65), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta66,13,3) == 0) goto tmp3_end;
          tmpMeta67 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta66), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta67,1,1) == 0) goto tmp3_end;
          tmpMeta68 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta67), 2));
          if (4 != MMC_STRLEN(tmpMeta68) || strcmp(MMC_STRINGDATA(_OMC_LIT42), MMC_STRINGDATA(tmpMeta68)) != 0) goto tmp3_end;
          tmpMeta69 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta66), 3));
          if (listEmpty(tmpMeta69)) goto tmp3_end;
          tmpMeta70 = MMC_CAR(tmpMeta69);
          tmpMeta71 = MMC_CDR(tmpMeta69);
          if (!listEmpty(tmpMeta71)) goto tmp3_end;
          tmpMeta72 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta65), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta72,4,1) == 0) goto tmp3_end;
          tmpMeta73 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta72), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta73,1,1) == 0) goto tmp3_end;
          tmpMeta74 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta65), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta74,1,1) == 0) goto tmp3_end;
          tmpMeta75 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta74), 2));
          tmp76 = mmc_unbox_real(tmpMeta75);
          if (2.0 != tmp76) goto tmp3_end;
          _e1 = tmpMeta57;
          _e2 = tmpMeta70;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta1 = _OMC_LIT27;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta77;
          modelica_metatype tmpMeta78;
          modelica_metatype tmpMeta79;
          modelica_metatype tmpMeta80;
          modelica_metatype tmpMeta81;
          modelica_metatype tmpMeta82;
          modelica_metatype tmpMeta83;
          modelica_metatype tmpMeta84;
          modelica_metatype tmpMeta85;
          modelica_metatype tmpMeta86;
          modelica_metatype tmpMeta87;
          modelica_metatype tmpMeta88;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          tmpMeta77 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta78 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta78,1,1) == 0) goto tmp3_end;
          tmpMeta79 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta78), 2));
          if (4 != MMC_STRLEN(tmpMeta79) || strcmp(MMC_STRINGDATA(_OMC_LIT40), MMC_STRINGDATA(tmpMeta79)) != 0) goto tmp3_end;
          tmpMeta80 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta80)) goto tmp3_end;
          tmpMeta81 = MMC_CAR(tmpMeta80);
          tmpMeta82 = MMC_CDR(tmpMeta80);
          if (!listEmpty(tmpMeta82)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,13,3) == 0) goto tmp3_end;
          tmpMeta83 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta83,1,1) == 0) goto tmp3_end;
          tmpMeta84 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta83), 2));
          if (4 != MMC_STRLEN(tmpMeta84) || strcmp(MMC_STRINGDATA(_OMC_LIT41), MMC_STRINGDATA(tmpMeta84)) != 0) goto tmp3_end;
          tmpMeta85 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (listEmpty(tmpMeta85)) goto tmp3_end;
          tmpMeta86 = MMC_CAR(tmpMeta85);
          tmpMeta87 = MMC_CDR(tmpMeta85);
          if (!listEmpty(tmpMeta87)) goto tmp3_end;
          
          _tp = tmpMeta77;
          _e1 = tmpMeta81;
          _e2 = tmpMeta86;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta88 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT42, tmpMeta88, _tp);
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta89;
          modelica_metatype tmpMeta90;
          modelica_metatype tmpMeta91;
          modelica_metatype tmpMeta92;
          modelica_metatype tmpMeta93;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          tmpMeta89 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,8,2) == 0) goto tmp3_end;
          tmpMeta90 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta90,5,1) == 0) goto tmp3_end;
          tmpMeta91 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _tp = tmpMeta89;
          _e2 = tmpMeta91;
          _e1 = tmp4_2;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta92 = mmc_mk_box2(4, &DAE_Operator_SUB__desc, _tp);
          tmpMeta93 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta92, _e2);
          tmpMeta1 = tmpMeta93;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta94;
          modelica_metatype tmpMeta95;
          modelica_metatype tmpMeta96;
          modelica_metatype tmpMeta97;
          modelica_metatype tmpMeta98;
          modelica_metatype tmpMeta99;
          modelica_metatype tmpMeta100;
          modelica_metatype tmpMeta101;
          modelica_metatype tmpMeta102;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          tmpMeta94 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta95 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta95,8,2) == 0) goto tmp3_end;
          tmpMeta96 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta95), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta96,5,1) == 0) goto tmp3_end;
          tmpMeta97 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta95), 3));
          tmpMeta98 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          tmpMeta99 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _tp = tmpMeta94;
          _e2 = tmpMeta97;
          _op2 = tmpMeta98;
          _e3 = tmpMeta99;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isMulOrDiv(threadData, _op2)) goto tmp3_end;
          tmpMeta100 = mmc_mk_box2(4, &DAE_Operator_SUB__desc, _tp);
          tmpMeta101 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op2, _e3);
          tmpMeta102 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta100, tmpMeta101);
          tmpMeta1 = tmpMeta102;
          goto tmp3_done;
        }
        case 7: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          tmp4 += 8; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_isZero(threadData, _e1)) goto tmp3_end;
          tmpMeta1 = _e2;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta103;
          modelica_metatype tmpMeta104;
          modelica_metatype tmpMeta105;
          modelica_metatype tmpMeta106;
          modelica_metatype tmpMeta107;
          modelica_boolean tmp108;
          modelica_metatype tmpMeta109;
          modelica_metatype tmpMeta110;
          modelica_metatype tmpMeta111;
          modelica_metatype tmpMeta112;
          modelica_metatype tmpMeta113;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          tmpMeta103 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta104 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta105 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta105,3,1) == 0) goto tmp3_end;
          tmpMeta106 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta105), 2));
          tmpMeta107 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _tp = tmpMeta103;
          _e2 = tmpMeta104;
          _tp2 = tmpMeta106;
          _e3 = tmpMeta107;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Pattern-matching tuple assignment */
          tmpMeta109 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _tp);
          tmpMeta110 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta109, _e2);
          tmpMeta111 = omc_ExpressionSimplify_simplify1(threadData, tmpMeta110, &tmp108);
          _e = tmpMeta111;
          if (1 /* true */ != tmp108) goto goto_2;
          tmpMeta112 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _tp2);
          tmpMeta113 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, tmpMeta112, _e3);
          tmpMeta1 = tmpMeta113;
          goto tmp3_done;
        }
        case 9: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isZero(threadData, _e2)) goto tmp3_end;
          tmpMeta1 = _e2;
          goto tmp3_done;
        }
        case 10: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isConstOne(threadData, _e2)) goto tmp3_end;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta114;
          modelica_metatype tmpMeta115;
          modelica_metatype tmpMeta116;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          tmpMeta114 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          
          _ty = tmpMeta114;
          _e1 = tmp4_2;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isConstMinusOne(threadData, _e2)) goto tmp3_end;
          tmpMeta115 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _ty);
          tmpMeta116 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta115, _e1);
          tmpMeta1 = tmpMeta116;
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta117;
          modelica_metatype tmpMeta118;
          modelica_metatype tmpMeta119;
          modelica_metatype tmpMeta120;
          modelica_metatype tmpMeta121;
          modelica_metatype tmpMeta122;
          modelica_metatype tmpMeta123;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,3) == 0) goto tmp3_end;
          tmpMeta117 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmpMeta118 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta118,2,1) == 0) goto tmp3_end;
          tmpMeta119 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta118), 2));
          tmpMeta120 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          
          _e2 = tmpMeta117;
          _op1 = tmpMeta118;
          _ty = tmpMeta119;
          _e3 = tmpMeta120;
          _e1 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(omc_Types_isScalarReal(threadData, _ty) && omc_Expression_expEqual(threadData, _e2, _e1))) goto tmp3_end;
          tmpMeta121 = mmc_mk_box2(7, &DAE_Operator_POW__desc, _ty);
          tmpMeta122 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta121, _OMC_LIT29);
          tmpMeta123 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e3, _op1, tmpMeta122);
          tmpMeta1 = tmpMeta123;
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta124;
          modelica_metatype tmpMeta125;
          modelica_metatype tmpMeta126;
          modelica_metatype tmpMeta127;
          modelica_metatype tmpMeta128;
          modelica_metatype tmpMeta129;
          modelica_metatype tmpMeta130;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta124 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta125 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta125,2,1) == 0) goto tmp3_end;
          tmpMeta126 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta125), 2));
          tmpMeta127 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _e2 = tmpMeta124;
          _op1 = tmpMeta125;
          _ty = tmpMeta126;
          _e3 = tmpMeta127;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(omc_Types_isScalarReal(threadData, _ty) && omc_Expression_expEqual(threadData, _e1, _e3))) goto tmp3_end;
          tmpMeta128 = mmc_mk_box2(7, &DAE_Operator_POW__desc, _ty);
          tmpMeta129 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta128, _OMC_LIT29);
          tmpMeta130 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op1, tmpMeta129);
          tmpMeta1 = tmpMeta130;
          goto tmp3_done;
        }
        case 14: {
          modelica_metatype tmpMeta131;
          modelica_real tmp132;
          modelica_metatype tmpMeta133;
          modelica_metatype tmpMeta134;
          modelica_real tmp135;
          modelica_metatype tmpMeta136;
          modelica_metatype tmpMeta137;
          modelica_metatype tmpMeta138;
          modelica_metatype tmpMeta139;
          modelica_metatype tmpMeta140;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta131 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp132 = mmc_unbox_real(tmpMeta131);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta133 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta133,1,1) == 0) goto tmp3_end;
          tmpMeta134 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta133), 2));
          tmp135 = mmc_unbox_real(tmpMeta134);
          tmpMeta136 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta136,2,1) == 0) goto tmp3_end;
          tmpMeta137 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta136), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta137,1,1) == 0) goto tmp3_end;
          tmpMeta138 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          _r1 = tmp132  /* pattern as ty=Real */;
          _r2 = tmp135  /* pattern as ty=Real */;
          _e2 = tmpMeta138;
          /* Pattern matching succeeded */
          tmpMeta139 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real((_r1) * (_r2)));
          tmpMeta140 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta139, _OMC_LIT34, _e2);
          tmpMeta1 = tmpMeta140;
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta141;
          modelica_real tmp142;
          modelica_metatype tmpMeta143;
          modelica_metatype tmpMeta144;
          modelica_metatype tmpMeta145;
          modelica_metatype tmpMeta146;
          modelica_metatype tmpMeta147;
          modelica_real tmp148;
          modelica_metatype tmpMeta149;
          modelica_metatype tmpMeta150;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta141 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp142 = mmc_unbox_real(tmpMeta141);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta143 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta144 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta144,2,1) == 0) goto tmp3_end;
          tmpMeta145 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta144), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta145,1,1) == 0) goto tmp3_end;
          tmpMeta146 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta146,1,1) == 0) goto tmp3_end;
          tmpMeta147 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta146), 2));
          tmp148 = mmc_unbox_real(tmpMeta147);
          _r1 = tmp142  /* pattern as ty=Real */;
          _e2 = tmpMeta143;
          _r2 = tmp148  /* pattern as ty=Real */;
          tmp4 += 6; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta149 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real((_r1) * (_r2)));
          tmpMeta150 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta149, _OMC_LIT34, _e2);
          tmpMeta1 = tmpMeta150;
          goto tmp3_done;
        }
        case 16: {
          modelica_metatype tmpMeta151;
          modelica_real tmp152;
          modelica_metatype tmpMeta153;
          modelica_metatype tmpMeta154;
          modelica_real tmp155;
          modelica_metatype tmpMeta156;
          modelica_metatype tmpMeta157;
          modelica_metatype tmpMeta158;
          modelica_metatype tmpMeta159;
          modelica_metatype tmpMeta160;
          modelica_metatype tmpMeta161;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta151 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp152 = mmc_unbox_real(tmpMeta151);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta153 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta153,1,1) == 0) goto tmp3_end;
          tmpMeta154 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta153), 2));
          tmp155 = mmc_unbox_real(tmpMeta154);
          tmpMeta156 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta156,1,1) == 0) goto tmp3_end;
          tmpMeta157 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta156), 2));
          tmpMeta158 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta158,6,2) == 0) goto tmp3_end;
          
          _r1 = tmp152  /* pattern as ty=Real */;
          _r2 = tmp155  /* pattern as ty=Real */;
          _ty = tmpMeta157;
          _e1 = tmpMeta158;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta159 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r1 + _r2));
          tmpMeta160 = mmc_mk_box2(4, &DAE_Operator_SUB__desc, _ty);
          tmpMeta161 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta159, tmpMeta160, _e1);
          tmpMeta1 = tmpMeta161;
          goto tmp3_done;
        }
        case 17: {
          modelica_metatype tmpMeta162;
          modelica_metatype tmpMeta163;
          modelica_metatype tmpMeta164;
          modelica_metatype tmpMeta165;
          modelica_metatype tmpMeta166;
          modelica_metatype tmpMeta167;
          modelica_metatype tmpMeta168;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta162 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta163 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta163,1,1) == 0) goto tmp3_end;
          tmpMeta164 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta163), 2));
          if (3 != MMC_STRLEN(tmpMeta164) || strcmp(MMC_STRINGDATA(_OMC_LIT24), MMC_STRINGDATA(tmpMeta164)) != 0) goto tmp3_end;
          tmpMeta165 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta165)) goto tmp3_end;
          tmpMeta166 = MMC_CAR(tmpMeta165);
          tmpMeta167 = MMC_CDR(tmpMeta165);
          if (!listEmpty(tmpMeta167)) goto tmp3_end;
          
          _ty = tmpMeta162;
          _e1 = tmpMeta166;
          _e2 = tmp4_3;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta168 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT43, tmpMeta168, _ty);
          goto tmp3_done;
        }
        case 18: {
          modelica_metatype tmpMeta169;
          modelica_metatype tmpMeta170;
          modelica_metatype tmpMeta171;
          modelica_metatype tmpMeta172;
          modelica_metatype tmpMeta173;
          modelica_metatype tmpMeta174;
          modelica_metatype tmpMeta175;
          modelica_metatype tmpMeta176;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          tmpMeta169 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta170 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta171 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta171,2,1) == 0) goto tmp3_end;
          tmpMeta172 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _op1 = tmp4_1;
          _ty = tmpMeta169;
          _e2 = tmpMeta170;
          _op2 = tmpMeta171;
          _e3 = tmpMeta172;
          _e1 = tmp4_2;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!(!omc_Expression_isConstValue(threadData, _e1))) goto tmp3_end;
          if(omc_Expression_expEqual(threadData, _e1, _e3))
          {
            tmpMeta173 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, omc_Expression_makeConstOne(threadData, _ty), _op1, _e2);
            tmpMeta174 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, tmpMeta173);
            _exp = tmpMeta174;
          }
          else
          {
            if(omc_Expression_expEqual(threadData, _e1, _e2))
            {
              tmpMeta175 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, omc_Expression_makeConstOne(threadData, _ty), _op1, _e3);
              tmpMeta176 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op2, tmpMeta175);
              _exp = tmpMeta176;
            }
            else
            {
              goto goto_2;
            }
          }
          tmpMeta1 = _exp;
          goto tmp3_done;
        }
        case 19: {
          modelica_metatype tmpMeta177;
          modelica_metatype tmpMeta178;
          modelica_metatype tmpMeta179;
          modelica_metatype tmpMeta180;
          modelica_metatype tmpMeta181;
          modelica_metatype tmpMeta182;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta177 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta177,1,1) == 0) goto tmp3_end;
          tmpMeta178 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta177), 2));
          if (4 != MMC_STRLEN(tmpMeta178) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmpMeta178)) != 0) goto tmp3_end;
          tmpMeta179 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta179)) goto tmp3_end;
          tmpMeta180 = MMC_CAR(tmpMeta179);
          tmpMeta181 = MMC_CDR(tmpMeta179);
          if (!listEmpty(tmpMeta181)) goto tmp3_end;
          
          _e1 = tmpMeta180;
          _e2 = tmp4_3;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta182 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _OMC_LIT36, _OMC_LIT45);
          tmpMeta1 = tmpMeta182;
          goto tmp3_done;
        }
        case 20: {
          modelica_metatype tmpMeta183;
          modelica_metatype tmpMeta184;
          modelica_metatype tmpMeta185;
          modelica_metatype tmpMeta186;
          modelica_metatype tmpMeta187;
          modelica_metatype tmpMeta188;
          modelica_metatype tmpMeta189;
          modelica_metatype tmpMeta190;
          modelica_metatype tmpMeta191;
          modelica_metatype tmpMeta192;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta183 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta184 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta184,4,1) == 0) goto tmp3_end;
          tmpMeta185 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta186 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta186,1,1) == 0) goto tmp3_end;
          tmpMeta187 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta186), 2));
          if (4 != MMC_STRLEN(tmpMeta187) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmpMeta187)) != 0) goto tmp3_end;
          tmpMeta188 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta188)) goto tmp3_end;
          tmpMeta189 = MMC_CAR(tmpMeta188);
          tmpMeta190 = MMC_CDR(tmpMeta188);
          if (!listEmpty(tmpMeta190)) goto tmp3_end;
          
          _e2 = tmpMeta183;
          _e = tmpMeta185;
          _e1 = tmpMeta189;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta191 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _OMC_LIT46, _OMC_LIT33);
          tmpMeta192 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _OMC_LIT36, tmpMeta191);
          tmpMeta1 = tmpMeta192;
          goto tmp3_done;
        }
        case 21: {
          modelica_metatype tmpMeta193;
          modelica_metatype tmpMeta194;
          modelica_metatype tmpMeta195;
          modelica_metatype tmpMeta196;
          modelica_metatype tmpMeta197;
          modelica_metatype tmpMeta198;
          modelica_metatype tmpMeta199;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,7,3) == 0) goto tmp3_end;
          tmpMeta193 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta194 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta194,4,1) == 0) goto tmp3_end;
          tmpMeta195 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta194), 2));
          tmpMeta196 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _e3 = tmpMeta193;
          _op1 = tmpMeta194;
          _tp = tmpMeta195;
          _e4 = tmpMeta196;
          _e1 = tmp4_2;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e3)) goto tmp3_end;
          _e = omc_Expression_makeConstOne(threadData, _tp);
          tmpMeta197 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _tp);
          tmpMeta198 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, tmpMeta197, _e4);
          tmpMeta199 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op1, tmpMeta198);
          tmpMeta1 = tmpMeta199;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 22) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _exp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_safeIntOp(threadData_t *threadData, modelica_integer _val1, modelica_integer _val2, modelica_metatype _op)
{
  modelica_metatype _outv = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outv has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _op;
    {
      modelica_real _rv1;
      modelica_real _rv2;
      modelica_real _rv3;
      modelica_integer _ires;
      int tmp4;
      // _rv1 has no default value.
      // _rv2 has no default value.
      // _rv3 has no default value.
      // _ires has no default value.
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          _rv1 = ((modelica_real)_val1);

          _rv2 = ((modelica_real)_val2);

          _rv3 = (_rv1) * (_rv2);
          tmpMeta1 = omc_Expression_realToIntIfPossible(threadData, _rv3);
          goto tmp3_done;
        }
        case 4: {
          modelica_integer tmp5;
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          tmp5 = _val2;
          if (tmp5 == 0) {goto goto_2;}
          _ires = modelica_div_integer(_val1,tmp5).quot;
          tmpMeta6 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_ires));
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 6: {
          
          /* Pattern matching succeeded */
          _rv1 = ((modelica_real)_val1);

          _rv2 = ((modelica_real)_val2);

          _rv3 = _rv1 - _rv2;
          tmpMeta1 = omc_Expression_realToIntIfPossible(threadData, _rv3);
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          _rv1 = ((modelica_real)_val1);

          _rv2 = ((modelica_real)_val2);

          _rv3 = _rv1 + _rv2;
          tmpMeta1 = omc_Expression_realToIntIfPossible(threadData, _rv3);
          goto tmp3_done;
        }
        case 7: {
          modelica_real tmp7;
          modelica_real tmp8;
          modelica_real tmp9;
          modelica_real tmp10;
          modelica_real tmp11;
          modelica_real tmp12;
          modelica_real tmp13;
          
          /* Pattern matching succeeded */
          _rv1 = ((modelica_real)_val1);

          _rv2 = ((modelica_real)_val2);

          tmp7 = _rv1;
          tmp8 = _rv2;
          if(tmp7 < 0.0 && tmp8 != 0.0)
          {
            tmp10 = modf(tmp8, &tmp11);
            
            if(tmp10 > 0.5)
            {
              tmp10 -= 1.0;
              tmp11 += 1.0;
            }
            else if(tmp10 < -0.5)
            {
              tmp10 += 1.0;
              tmp11 -= 1.0;
            }
            
            if(fabs(tmp10) < 1e-10)
              tmp9 = pow(tmp7, tmp11);
            else
            {
              tmp13 = modf(1.0/tmp8, &tmp12);
              if(tmp13 > 0.5)
              {
                tmp13 -= 1.0;
                tmp12 += 1.0;
              }
              else if(tmp13 < -0.5)
              {
                tmp13 += 1.0;
                tmp12 -= 1.0;
              }
              if(fabs(tmp13) < 1e-10 && ((unsigned long)tmp12 & 1))
              {
                tmp9 = -pow(-tmp7, tmp10)*pow(tmp7, tmp11);
              }
              else
              {
                goto goto_2;
              }
            }
          }
          else
          {
            tmp9 = pow(tmp7, tmp8);
          }
          if(isnan(tmp9) || isinf(tmp9))
          {
            goto goto_2;
          }
          _rv3 = tmp9;
          tmpMeta1 = omc_Expression_realToIntIfPossible(threadData, _rv3);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outv = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outv;
}
modelica_metatype boxptr_ExpressionSimplify_safeIntOp(threadData_t *threadData, modelica_metatype _val1, modelica_metatype _val2, modelica_metatype _op)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _outv = NULL;
  tmp1 = mmc_unbox_integer(_val1);
  tmp2 = mmc_unbox_integer(_val2);
  _outv = omc_ExpressionSimplify_safeIntOp(threadData, tmp1, tmp2, _op);
  /* skip box _outv; DAE.Exp */
  return _outv;
}

PROTECTED_FUNCTION_STATIC modelica_boolean omc_ExpressionSimplify_simplifyRelationConst(threadData_t *threadData, modelica_metatype _op, modelica_metatype _e1, modelica_metatype _e2)
{
  modelica_boolean _b;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _b has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_metatype tmp4_3;
    tmp4_1 = _op;
    tmp4_2 = _e1;
    tmp4_3 = _e2;
    {
      modelica_real _v1;
      modelica_real _v2;
      modelica_boolean _b1;
      modelica_boolean _b2;
      modelica_string _s1 = NULL;
      modelica_string _s2 = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _v1 has no default value.
      // _v2 has no default value.
      // _b1 has no default value.
      // _b2 has no default value.
      // _s1 has no default value.
      // _s2 has no default value.
      tmp4 = 0;
      for (; tmp4 < 14; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_integer tmp7;
          modelica_metatype tmpMeta8;
          modelica_integer tmp9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,25,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp7 = mmc_unbox_integer(tmpMeta6);
          if (0 /* false */ != tmp7) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp9 = mmc_unbox_integer(tmpMeta8);
          if (1 /* true */ != tmp9) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,25,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 0 /* false */;
          goto tmp3_done;
        }
        case 2: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,25,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _v1 = omc_Expression_toReal(threadData, _e1);

          _v2 = omc_Expression_toReal(threadData, _e2);
          tmp1 = (_v1 < _v2);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta10;
          modelica_integer tmp11;
          modelica_metatype tmpMeta12;
          modelica_integer tmp13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,26,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp11 = mmc_unbox_integer(tmpMeta10);
          if (1 /* true */ != tmp11) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp13 = mmc_unbox_integer(tmpMeta12);
          if (0 /* false */ != tmp13) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = 0 /* false */;
          goto tmp3_done;
        }
        case 4: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,26,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 5: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,26,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _v1 = omc_Expression_toReal(threadData, _e1);

          _v2 = omc_Expression_toReal(threadData, _e2);
          tmp1 = (_v1 <= _v2);
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta14;
          modelica_integer tmp15;
          modelica_metatype tmpMeta16;
          modelica_integer tmp17;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,29,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp15 = mmc_unbox_integer(tmpMeta14);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp17 = mmc_unbox_integer(tmpMeta16);
          _b1 = tmp15  /* pattern as ty=Boolean */;
          _b2 = tmp17  /* pattern as ty=Boolean */;
          /* Pattern matching succeeded */
          tmp1 = (!_b1 == !_b2);
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,29,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,2,1) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          _s1 = tmpMeta18;
          _s2 = tmpMeta19;
          /* Pattern matching succeeded */
          tmp1 = (stringEqual(_s1, _s2));
          goto tmp3_done;
        }
        case 8: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,29,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _v1 = omc_Expression_toReal(threadData, _e1);

          _v2 = omc_Expression_toReal(threadData, _e2);
          tmp1 = (_v1 == _v2);
          goto tmp3_done;
        }
        case 9: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = (!omc_ExpressionSimplify_simplifyRelationConst(threadData, _OMC_LIT47, _e1, _e2));
          goto tmp3_done;
        }
        case 10: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,28,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = (!omc_ExpressionSimplify_simplifyRelationConst(threadData, _OMC_LIT48, _e1, _e2));
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta20;
          modelica_integer tmp21;
          modelica_metatype tmpMeta22;
          modelica_integer tmp23;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp21 = mmc_unbox_integer(tmpMeta20);
          if (0 /* false */ != tmp21) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp23 = mmc_unbox_integer(tmpMeta22);
          if (1 /* true */ != tmp23) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = (!omc_ExpressionSimplify_simplifyRelationConst(threadData, _OMC_LIT47, _e1, _e2));
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta24;
          modelica_integer tmp25;
          modelica_metatype tmpMeta26;
          modelica_integer tmp27;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,28,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp25 = mmc_unbox_integer(tmpMeta24);
          if (0 /* false */ != tmp25) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp27 = mmc_unbox_integer(tmpMeta26);
          if (1 /* true */ != tmp27) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = (!omc_ExpressionSimplify_simplifyRelationConst(threadData, _OMC_LIT48, _e1, _e2));
          goto tmp3_done;
        }
        case 13: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,30,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = (!omc_ExpressionSimplify_simplifyRelationConst(threadData, _OMC_LIT49, _e1, _e2));
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _b = tmp1;
  _return: OMC_LABEL_UNUSED
  return _b;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyRelationConst(threadData_t *threadData, modelica_metatype _op, modelica_metatype _e1, modelica_metatype _e2)
{
  modelica_boolean _b;
  modelica_metatype out_b;
  _b = omc_ExpressionSimplify_simplifyRelationConst(threadData, _op, _e1, _e2);
  out_b = mmc_mk_icon(_b);
  return out_b;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryConst(threadData_t *threadData, modelica_metatype _inOperator1, modelica_metatype _inExp2, modelica_metatype _inExp3)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_metatype tmp4_3;
    tmp4_1 = _inOperator1;
    tmp4_2 = _inExp2;
    tmp4_3 = _inExp3;
    {
      modelica_integer _ie1;
      modelica_integer _ie2;
      modelica_real _e2_1;
      modelica_real _e1_1;
      modelica_real _re1;
      modelica_real _re2;
      modelica_real _re3;
      modelica_string _str = NULL;
      modelica_string _s1 = NULL;
      modelica_string _s2 = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _ie1 has no default value.
      // _ie2 has no default value.
      // _e2_1 has no default value.
      // _e1_1 has no default value.
      // _re1 has no default value.
      // _re2 has no default value.
      // _re3 has no default value.
      // _str has no default value.
      // _s1 has no default value.
      // _s2 has no default value.
      tmp4 = 0;
      for (; tmp4 < 18; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_integer tmp7;
          modelica_metatype tmpMeta8;
          modelica_integer tmp9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp7 = mmc_unbox_integer(tmpMeta6);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,0,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp9 = mmc_unbox_integer(tmpMeta8);
          _ie1 = tmp7  /* pattern as ty=Integer */;
          _ie2 = tmp9  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_safeIntOp(threadData, _ie1, _ie2, _OMC_LIT50);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta10;
          modelica_real tmp11;
          modelica_metatype tmpMeta12;
          modelica_real tmp13;
          modelica_metatype tmpMeta14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp11 = mmc_unbox_real(tmpMeta10);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp13 = mmc_unbox_real(tmpMeta12);
          _re1 = tmp11  /* pattern as ty=Real */;
          _re2 = tmp13  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _re3 = _re1 + _re2;
          tmpMeta14 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta14;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta15;
          modelica_real tmp16;
          modelica_metatype tmpMeta17;
          modelica_integer tmp18;
          modelica_metatype tmpMeta19;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp16 = mmc_unbox_real(tmpMeta15);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,0,1) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp18 = mmc_unbox_integer(tmpMeta17);
          _re1 = tmp16  /* pattern as ty=Real */;
          _ie2 = tmp18  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _e2_1 = ((modelica_real)_ie2);

          _re3 = _re1 + _e2_1;
          tmpMeta19 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta19;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta20;
          modelica_integer tmp21;
          modelica_metatype tmpMeta22;
          modelica_real tmp23;
          modelica_metatype tmpMeta24;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp21 = mmc_unbox_integer(tmpMeta20);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp23 = mmc_unbox_real(tmpMeta22);
          _ie1 = tmp21  /* pattern as ty=Integer */;
          _re2 = tmp23  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _e1_1 = ((modelica_real)_ie1);

          _re3 = _e1_1 + _re2;
          tmpMeta24 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta24;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,2,1) == 0) goto tmp3_end;
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,2,1) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          _s1 = tmpMeta25;
          _s2 = tmpMeta26;
          /* Pattern matching succeeded */
          tmpMeta27 = stringAppend(_s1,_s2);
          _str = tmpMeta27;
          tmpMeta28 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _str);
          tmpMeta1 = tmpMeta28;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta29;
          modelica_integer tmp30;
          modelica_metatype tmpMeta31;
          modelica_integer tmp32;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp30 = mmc_unbox_integer(tmpMeta29);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,0,1) == 0) goto tmp3_end;
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp32 = mmc_unbox_integer(tmpMeta31);
          _ie1 = tmp30  /* pattern as ty=Integer */;
          _ie2 = tmp32  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_safeIntOp(threadData, _ie1, _ie2, _OMC_LIT51);
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta33;
          modelica_real tmp34;
          modelica_metatype tmpMeta35;
          modelica_real tmp36;
          modelica_metatype tmpMeta37;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp34 = mmc_unbox_real(tmpMeta33);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp36 = mmc_unbox_real(tmpMeta35);
          _re1 = tmp34  /* pattern as ty=Real */;
          _re2 = tmp36  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _re3 = _re1 - _re2;
          tmpMeta37 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta37;
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta38;
          modelica_real tmp39;
          modelica_metatype tmpMeta40;
          modelica_integer tmp41;
          modelica_metatype tmpMeta42;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta38 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp39 = mmc_unbox_real(tmpMeta38);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,0,1) == 0) goto tmp3_end;
          tmpMeta40 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp41 = mmc_unbox_integer(tmpMeta40);
          _re1 = tmp39  /* pattern as ty=Real */;
          _ie2 = tmp41  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _e2_1 = ((modelica_real)_ie2);

          _re3 = _re1 - _e2_1;
          tmpMeta42 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta42;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta43;
          modelica_integer tmp44;
          modelica_metatype tmpMeta45;
          modelica_real tmp46;
          modelica_metatype tmpMeta47;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta43 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp44 = mmc_unbox_integer(tmpMeta43);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta45 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp46 = mmc_unbox_real(tmpMeta45);
          _ie1 = tmp44  /* pattern as ty=Integer */;
          _re2 = tmp46  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _e1_1 = ((modelica_real)_ie1);

          _re3 = _e1_1 - _re2;
          tmpMeta47 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta47;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta48;
          modelica_integer tmp49;
          modelica_metatype tmpMeta50;
          modelica_integer tmp51;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp49 = mmc_unbox_integer(tmpMeta48);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,0,1) == 0) goto tmp3_end;
          tmpMeta50 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp51 = mmc_unbox_integer(tmpMeta50);
          _ie1 = tmp49  /* pattern as ty=Integer */;
          _ie2 = tmp51  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_safeIntOp(threadData, _ie1, _ie2, _OMC_LIT52);
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta52;
          modelica_real tmp53;
          modelica_metatype tmpMeta54;
          modelica_real tmp55;
          modelica_metatype tmpMeta56;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp53 = mmc_unbox_real(tmpMeta52);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta54 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp55 = mmc_unbox_real(tmpMeta54);
          _re1 = tmp53  /* pattern as ty=Real */;
          _re2 = tmp55  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _re3 = (_re1) * (_re2);
          tmpMeta56 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta56;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta57;
          modelica_real tmp58;
          modelica_metatype tmpMeta59;
          modelica_integer tmp60;
          modelica_metatype tmpMeta61;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta57 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp58 = mmc_unbox_real(tmpMeta57);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,0,1) == 0) goto tmp3_end;
          tmpMeta59 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp60 = mmc_unbox_integer(tmpMeta59);
          _re1 = tmp58  /* pattern as ty=Real */;
          _ie2 = tmp60  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _e2_1 = ((modelica_real)_ie2);

          _re3 = (_re1) * (_e2_1);
          tmpMeta61 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta61;
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta62;
          modelica_integer tmp63;
          modelica_metatype tmpMeta64;
          modelica_real tmp65;
          modelica_metatype tmpMeta66;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp63 = mmc_unbox_integer(tmpMeta62);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta64 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp65 = mmc_unbox_real(tmpMeta64);
          _ie1 = tmp63  /* pattern as ty=Integer */;
          _re2 = tmp65  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _e1_1 = ((modelica_real)_ie1);

          _re3 = (_e1_1) * (_re2);
          tmpMeta66 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta66;
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta67;
          modelica_integer tmp68;
          modelica_metatype tmpMeta69;
          modelica_integer tmp70;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta67 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp68 = mmc_unbox_integer(tmpMeta67);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,0,1) == 0) goto tmp3_end;
          tmpMeta69 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp70 = mmc_unbox_integer(tmpMeta69);
          _ie1 = tmp68  /* pattern as ty=Integer */;
          _ie2 = tmp70  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_safeIntOp(threadData, _ie1, _ie2, _OMC_LIT53);
          goto tmp3_done;
        }
        case 14: {
          modelica_metatype tmpMeta71;
          modelica_real tmp72;
          modelica_metatype tmpMeta73;
          modelica_real tmp74;
          modelica_real tmp75;
          modelica_metatype tmpMeta76;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta71 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp72 = mmc_unbox_real(tmpMeta71);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta73 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp74 = mmc_unbox_real(tmpMeta73);
          _re1 = tmp72  /* pattern as ty=Real */;
          _re2 = tmp74  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          tmp75 = _re2;
          if (tmp75 == 0) {goto goto_2;}
          _re3 = (_re1) / tmp75;
          tmpMeta76 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta76;
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta77;
          modelica_real tmp78;
          modelica_metatype tmpMeta79;
          modelica_integer tmp80;
          modelica_real tmp81;
          modelica_metatype tmpMeta82;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta77 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp78 = mmc_unbox_real(tmpMeta77);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,0,1) == 0) goto tmp3_end;
          tmpMeta79 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp80 = mmc_unbox_integer(tmpMeta79);
          _re1 = tmp78  /* pattern as ty=Real */;
          _ie2 = tmp80  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _e2_1 = ((modelica_real)_ie2);

          tmp81 = _e2_1;
          if (tmp81 == 0) {goto goto_2;}
          _re3 = (_re1) / tmp81;
          tmpMeta82 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta82;
          goto tmp3_done;
        }
        case 16: {
          modelica_metatype tmpMeta83;
          modelica_integer tmp84;
          modelica_metatype tmpMeta85;
          modelica_real tmp86;
          modelica_real tmp87;
          modelica_metatype tmpMeta88;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta83 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp84 = mmc_unbox_integer(tmpMeta83);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta85 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp86 = mmc_unbox_real(tmpMeta85);
          _ie1 = tmp84  /* pattern as ty=Integer */;
          _re2 = tmp86  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _e1_1 = ((modelica_real)_ie1);

          tmp87 = _re2;
          if (tmp87 == 0) {goto goto_2;}
          _re3 = (_e1_1) / tmp87;
          tmpMeta88 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta88;
          goto tmp3_done;
        }
        case 17: {
          modelica_metatype tmpMeta89;
          modelica_real tmp90;
          modelica_metatype tmpMeta91;
          modelica_real tmp92;
          modelica_real tmp93;
          modelica_real tmp94;
          modelica_real tmp95;
          modelica_real tmp96;
          modelica_real tmp97;
          modelica_real tmp98;
          modelica_real tmp99;
          modelica_metatype tmpMeta100;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          tmpMeta89 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp90 = mmc_unbox_real(tmpMeta89);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,1,1) == 0) goto tmp3_end;
          tmpMeta91 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp92 = mmc_unbox_real(tmpMeta91);
          _re1 = tmp90  /* pattern as ty=Real */;
          _re2 = tmp92  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          tmp93 = _re1;
          tmp94 = _re2;
          if(tmp93 < 0.0 && tmp94 != 0.0)
          {
            tmp96 = modf(tmp94, &tmp97);
            
            if(tmp96 > 0.5)
            {
              tmp96 -= 1.0;
              tmp97 += 1.0;
            }
            else if(tmp96 < -0.5)
            {
              tmp96 += 1.0;
              tmp97 -= 1.0;
            }
            
            if(fabs(tmp96) < 1e-10)
              tmp95 = pow(tmp93, tmp97);
            else
            {
              tmp99 = modf(1.0/tmp94, &tmp98);
              if(tmp99 > 0.5)
              {
                tmp99 -= 1.0;
                tmp98 += 1.0;
              }
              else if(tmp99 < -0.5)
              {
                tmp99 += 1.0;
                tmp98 -= 1.0;
              }
              if(fabs(tmp99) < 1e-10 && ((unsigned long)tmp98 & 1))
              {
                tmp95 = -pow(-tmp93, tmp96)*pow(tmp93, tmp97);
              }
              else
              {
                goto goto_2;
              }
            }
          }
          else
          {
            tmp95 = pow(tmp93, tmp94);
          }
          if(isnan(tmp95) || isinf(tmp95))
          {
            goto goto_2;
          }
          _re3 = tmp95;
          tmpMeta100 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_re3));
          tmpMeta1 = tmpMeta100;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubSlicing2(threadData_t *threadData, modelica_metatype _inSubscripts, modelica_metatype _inExp)
{
  modelica_metatype _outAsub = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outAsub has no default value.
  _outAsub = omc_Expression_makeASUB(threadData, _inExp, _inSubscripts);
  _return: OMC_LABEL_UNUSED
  return _outAsub;
}

static modelica_metatype closure0_ExpressionSimplify_simplifyAsubSlicing2(threadData_t *thData, modelica_metatype closure, modelica_metatype inSubscripts)
{
  modelica_metatype inExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_ExpressionSimplify_simplifyAsubSlicing2(thData, inSubscripts, inExp);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubSlicing(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inSubscripts)
{
  modelica_metatype _outAsubArray = NULL;
  modelica_metatype _indices = NULL;
  modelica_metatype _asubs = NULL;
  modelica_metatype _es = NULL;
  modelica_integer _sz;
  modelica_metatype _elem = NULL;
  modelica_metatype _ty = NULL;
  modelica_boolean _didSplit;
  modelica_boolean _b;
  modelica_metatype tmpMeta1;
  modelica_boolean tmp10;
  modelica_metatype tmpMeta11;
  modelica_metatype tmpMeta12;
  modelica_metatype tmpMeta16;
  modelica_metatype tmpMeta17;
  modelica_metatype tmpMeta18;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outAsubArray has no default value.
  // _indices has no default value.
  // _asubs has no default value.
  // _es has no default value.
  // _sz has no default value.
  // _elem has no default value.
  // _ty has no default value.
  _didSplit = 0 /* false */;
  // _b has no default value.
  {
    modelica_metatype __omcQ_24tmpVar17;
    modelica_metatype* tmp2;
    modelica_metatype tmpMeta3;
    modelica_metatype tmpMeta4;
    modelica_metatype __omcQ_24tmpVar16;
    modelica_integer tmp9;
    modelica_metatype _e_loopVar = 0;
    modelica_metatype _e;
    _e_loopVar = _inSubscripts;
    tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar17 = tmpMeta3; /* defaultValue */
    tmp2 = &__omcQ_24tmpVar17;
    while(1) {
      tmp9 = 1;
      if (!listEmpty(_e_loopVar)) {
        _e = MMC_CAR(_e_loopVar);
        _e_loopVar = MMC_CDR(_e_loopVar);
        tmp9--;
      }
      if (tmp9 == 0) {
        { /* match expression */
          {
            volatile mmc_switch_type tmp7;
            int tmp8;
            tmp7 = 0;
            for (; tmp7 < 1; tmp7++) {
              switch (MMC_SWITCH_CAST(tmp7)) {
              case 0: {
                /* Pattern matching succeeded */
                _es = omc_Expression_splitArray(threadData, omc_ExpressionSimplify_simplify1(threadData, _e, NULL) ,&_b);

                _didSplit = (_didSplit || _b);
                tmpMeta4 = _es;
                goto tmp6_done;
              }
              }
              goto tmp6_end;
              tmp6_end: ;
            }
            goto goto_5;
            goto_5:;
            MMC_THROW_INTERNAL();
            goto tmp6_done;
            tmp6_done:;
          }
        }__omcQ_24tmpVar16 = tmpMeta4;
        *tmp2 = mmc_mk_cons(__omcQ_24tmpVar16,0);
        tmp2 = &MMC_CDR(*tmp2);
      } else if (tmp9 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp2 = mmc_mk_nil();
    tmpMeta1 = __omcQ_24tmpVar17;
  }
  _indices = tmpMeta1;

  /* Pattern-matching assignment */
  tmp10 = _didSplit;
  if (1 /* true */ != tmp10) MMC_THROW_INTERNAL();

  {
    modelica_metatype _is;
    for (tmpMeta11 = _indices; !listEmpty(tmpMeta11); tmpMeta11=MMC_CDR(tmpMeta11))
    {
      _is = MMC_CAR(tmpMeta11);
      {
        modelica_metatype _i;
        for (tmpMeta12 = _is; !listEmpty(tmpMeta12); tmpMeta12=MMC_CDR(tmpMeta12))
        {
          _i = MMC_CAR(tmpMeta12);
          { /* match expression */
            modelica_metatype tmp15_1;
            tmp15_1 = omc_Expression_typeof(threadData, _i);
            {
              int tmp15;
              {
                switch (MMC_SWITCH_CAST(valueConstructor(tmp15_1))) {
                case 3: {
                  
                  /* Pattern matching succeeded */
                  goto tmp14_done;
                }
                case 6: {
                  
                  /* Pattern matching succeeded */
                  goto tmp14_done;
                }
                case 8: {
                  
                  /* Pattern matching succeeded */
                  goto tmp14_done;
                }
                }
                goto tmp14_end;
                tmp14_end: ;
              }
              goto goto_13;
              goto_13:;
              MMC_THROW_INTERNAL();
              goto tmp14_done;
              tmp14_done:;
            }
          }
          ;
        }
      }
    }
  }

  tmpMeta18 = mmc_mk_box1(0, _inExp);
  _asubs = omc_List_combinationMap(threadData, _indices, (modelica_fnptr) mmc_mk_box2(0,closure0_ExpressionSimplify_simplifyAsubSlicing2,tmpMeta18));

  _outAsubArray = omc_Expression_makeScalarArray(threadData, _asubs, omc_Types_unliftArray(threadData, omc_Expression_typeof(threadData, _inExp)));
  _return: OMC_LABEL_UNUSED
  return _outAsubArray;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubOperator(threadData_t *threadData, modelica_metatype _inExp1, modelica_metatype _inOperator2, modelica_metatype _inOperator3)
{
  modelica_metatype _outOperator = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outOperator has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp1;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 19: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inOperator3;
          goto tmp3_done;
        }
        case 20: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inOperator3;
          goto tmp3_done;
        }
        case 21: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inOperator3;
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inOperator2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outOperator = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outOperator;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubArrayReduction(threadData_t *threadData, modelica_metatype _iter, modelica_metatype _sub, modelica_metatype _acc)
{
  modelica_metatype _res = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _iter;
    {
      modelica_metatype _exp = NULL;
      modelica_string _id = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _exp has no default value.
      // _id has no default value.
      tmp4 = 0;
      for (; tmp4 < 1; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (!optionNone(tmpMeta8)) goto tmp3_end;
          
          _id = tmpMeta6;
          _exp = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta9 = mmc_mk_cons(_sub, MMC_REFSTRUCTLIT(mmc_nil));
          _exp = omc_Expression_makeASUB(threadData, _exp, tmpMeta9);
          tmpMeta1 = omc_ExpressionSimplify_replaceIteratorWithExp(threadData, _exp, _acc, _id);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _res = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _res;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsub(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inSub)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;
    tmp4_1 = _inExp;
    tmp4_2 = _inSub;
    {
      modelica_metatype _e_1 = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _e1_1 = NULL;
      modelica_metatype _e2_1 = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _exp = NULL;
      modelica_metatype _cond = NULL;
      modelica_metatype _sub = NULL;
      modelica_metatype _t = NULL;
      modelica_metatype _t_1 = NULL;
      modelica_metatype _t2 = NULL;
      modelica_integer _indx;
      modelica_metatype _op = NULL;
      modelica_metatype _op2 = NULL;
      modelica_boolean _b;
      modelica_metatype _exps = NULL;
      modelica_metatype _expl = NULL;
      modelica_metatype _lstexps = NULL;
      modelica_metatype _iters = NULL;
      modelica_metatype _iter = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e_1 has no default value.
      // _e has no default value.
      // _e1_1 has no default value.
      // _e2_1 has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _exp has no default value.
      // _cond has no default value.
      // _sub has no default value.
      // _t has no default value.
      // _t_1 has no default value.
      // _t2 has no default value.
      // _indx has no default value.
      // _op has no default value.
      // _op2 has no default value.
      // _b has no default value.
      // _exps has no default value.
      // _expl has no default value.
      // _lstexps has no default value.
      // _iters has no default value.
      // _iter has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 22; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          
          _e = tmp4_1;
          _sub = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyAsub0(threadData, _e, omc_Expression_expInt(threadData, _sub), _inSub);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_boolean tmp10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,6,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _e = tmpMeta7;
          _sub = tmp4_2;
          tmp4 += 20; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e, _sub);

          _t2 = omc_Expression_typeof(threadData, _e_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp10 = (modelica_boolean)_b;
          if(tmp10)
          {
            tmpMeta8 = mmc_mk_box2(9, &DAE_Operator_UMINUS__ARR__desc, _t2);
            tmpMeta11 = tmpMeta8;
          }
          else
          {
            tmpMeta9 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _t2);
            tmpMeta11 = tmpMeta9;
          }
          _op2 = tmpMeta11;
          tmpMeta12 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op2, _e_1);
          tmpMeta1 = tmpMeta12;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,10,2) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta13,24,1) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _e = tmpMeta14;
          _sub = tmp4_2;
          tmp4 += 19; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e, _sub);

          _t2 = omc_Expression_typeof(threadData, _e_1);
          tmpMeta15 = mmc_mk_box2(27, &DAE_Operator_NOT__desc, _t2);
          tmpMeta16 = mmc_mk_box3(13, &DAE_Exp_LUNARY__desc, tmpMeta15, _e_1);
          tmpMeta1 = tmpMeta16;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_boolean tmp22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,8,1) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta17;
          _e2 = tmpMeta19;
          _sub = tmp4_2;
          tmp4 += 18; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _e2_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e2, _sub);

          _t2 = omc_Expression_typeof(threadData, _e1_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp22 = (modelica_boolean)_b;
          if(tmp22)
          {
            tmpMeta20 = mmc_mk_box2(11, &DAE_Operator_SUB__ARR__desc, _t2);
            tmpMeta23 = tmpMeta20;
          }
          else
          {
            tmpMeta21 = mmc_mk_box2(4, &DAE_Operator_SUB__desc, _t2);
            tmpMeta23 = tmpMeta21;
          }
          _op2 = tmpMeta23;
          tmpMeta24 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op2, _e2_1);
          tmpMeta1 = tmpMeta24;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_boolean tmp30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta26,11,1) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta25;
          _e2 = tmpMeta27;
          _sub = tmp4_2;
          tmp4 += 17; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _t2 = omc_Expression_typeof(threadData, _e1_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp30 = (modelica_boolean)_b;
          if(tmp30)
          {
            tmpMeta28 = mmc_mk_box2(14, &DAE_Operator_MUL__ARRAY__SCALAR__desc, _t2);
            tmpMeta31 = tmpMeta28;
          }
          else
          {
            tmpMeta29 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _t2);
            tmpMeta31 = tmpMeta29;
          }
          _op = tmpMeta31;
          tmpMeta32 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op, _e2);
          tmpMeta1 = tmpMeta32;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_boolean tmp38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta34,12,1) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta33;
          _e2 = tmpMeta35;
          _sub = tmp4_2;
          tmp4 += 16; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _t2 = omc_Expression_typeof(threadData, _e1_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp38 = (modelica_boolean)_b;
          if(tmp38)
          {
            tmpMeta36 = mmc_mk_box2(15, &DAE_Operator_ADD__ARRAY__SCALAR__desc, _t2);
            tmpMeta39 = tmpMeta36;
          }
          else
          {
            tmpMeta37 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _t2);
            tmpMeta39 = tmpMeta37;
          }
          _op = tmpMeta39;
          tmpMeta40 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op, _e2);
          tmpMeta1 = tmpMeta40;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_boolean tmp46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta42,13,1) == 0) goto tmp3_end;
          tmpMeta43 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta41;
          _e2 = tmpMeta43;
          _sub = tmp4_2;
          tmp4 += 15; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e2_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e2, _sub);

          _t2 = omc_Expression_typeof(threadData, _e2_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp46 = (modelica_boolean)_b;
          if(tmp46)
          {
            tmpMeta44 = mmc_mk_box2(16, &DAE_Operator_SUB__SCALAR__ARRAY__desc, _t2);
            tmpMeta47 = tmpMeta44;
          }
          else
          {
            tmpMeta45 = mmc_mk_box2(4, &DAE_Operator_SUB__desc, _t2);
            tmpMeta47 = tmpMeta45;
          }
          _op = tmpMeta47;
          tmpMeta48 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op, _e2_1);
          tmpMeta1 = tmpMeta48;
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta49 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta50 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta50,15,1) == 0) goto tmp3_end;
          tmpMeta51 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta49;
          _e2 = tmpMeta51;
          _sub = tmp4_2;
          tmp4 += 14; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e = omc_ExpressionSimplify_simplifyMatrixProduct(threadData, _e1, _e2);
          tmpMeta1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e, _sub);
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_boolean tmp57;
          modelica_metatype tmpMeta58;
          modelica_metatype tmpMeta59;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta53,17,1) == 0) goto tmp3_end;
          tmpMeta54 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta52;
          _e2 = tmpMeta54;
          _sub = tmp4_2;
          tmp4 += 13; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e2_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e2, _sub);

          _t2 = omc_Expression_typeof(threadData, _e2_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp57 = (modelica_boolean)_b;
          if(tmp57)
          {
            tmpMeta55 = mmc_mk_box2(20, &DAE_Operator_DIV__SCALAR__ARRAY__desc, _t2);
            tmpMeta58 = tmpMeta55;
          }
          else
          {
            tmpMeta56 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _t2);
            tmpMeta58 = tmpMeta56;
          }
          _op = tmpMeta58;
          tmpMeta59 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op, _e2_1);
          tmpMeta1 = tmpMeta59;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta60;
          modelica_metatype tmpMeta61;
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          modelica_boolean tmp65;
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta60 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta61 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta61,16,1) == 0) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta60;
          _e2 = tmpMeta62;
          _sub = tmp4_2;
          tmp4 += 12; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _t2 = omc_Expression_typeof(threadData, _e1_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp65 = (modelica_boolean)_b;
          if(tmp65)
          {
            tmpMeta63 = mmc_mk_box2(19, &DAE_Operator_DIV__ARRAY__SCALAR__desc, _t2);
            tmpMeta66 = tmpMeta63;
          }
          else
          {
            tmpMeta64 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _t2);
            tmpMeta66 = tmpMeta64;
          }
          _op = tmpMeta66;
          tmpMeta67 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op, _e2);
          tmpMeta1 = tmpMeta67;
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta68;
          modelica_metatype tmpMeta69;
          modelica_metatype tmpMeta70;
          modelica_metatype tmpMeta71;
          modelica_metatype tmpMeta72;
          modelica_boolean tmp73;
          modelica_metatype tmpMeta74;
          modelica_metatype tmpMeta75;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta68 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta69 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta69,19,1) == 0) goto tmp3_end;
          tmpMeta70 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta68;
          _e2 = tmpMeta70;
          _sub = tmp4_2;
          tmp4 += 11; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e2_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e2, _sub);

          _t2 = omc_Expression_typeof(threadData, _e2_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp73 = (modelica_boolean)_b;
          if(tmp73)
          {
            tmpMeta71 = mmc_mk_box2(22, &DAE_Operator_POW__SCALAR__ARRAY__desc, _t2);
            tmpMeta74 = tmpMeta71;
          }
          else
          {
            tmpMeta72 = mmc_mk_box2(7, &DAE_Operator_POW__desc, _t2);
            tmpMeta74 = tmpMeta72;
          }
          _op = tmpMeta74;
          tmpMeta75 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op, _e2_1);
          tmpMeta1 = tmpMeta75;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta76;
          modelica_metatype tmpMeta77;
          modelica_metatype tmpMeta78;
          modelica_metatype tmpMeta79;
          modelica_metatype tmpMeta80;
          modelica_boolean tmp81;
          modelica_metatype tmpMeta82;
          modelica_metatype tmpMeta83;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta76 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta77 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta77,18,1) == 0) goto tmp3_end;
          tmpMeta78 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta76;
          _e2 = tmpMeta78;
          _sub = tmp4_2;
          tmp4 += 10; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _t2 = omc_Expression_typeof(threadData, _e1_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp81 = (modelica_boolean)_b;
          if(tmp81)
          {
            tmpMeta79 = mmc_mk_box2(21, &DAE_Operator_POW__ARRAY__SCALAR__desc, _t2);
            tmpMeta82 = tmpMeta79;
          }
          else
          {
            tmpMeta80 = mmc_mk_box2(7, &DAE_Operator_POW__desc, _t2);
            tmpMeta82 = tmpMeta80;
          }
          _op = tmpMeta82;
          tmpMeta83 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op, _e2);
          tmpMeta1 = tmpMeta83;
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta84;
          modelica_metatype tmpMeta85;
          modelica_metatype tmpMeta86;
          modelica_metatype tmpMeta87;
          modelica_metatype tmpMeta88;
          modelica_boolean tmp89;
          modelica_metatype tmpMeta90;
          modelica_metatype tmpMeta91;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta84 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta85 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta85,7,1) == 0) goto tmp3_end;
          tmpMeta86 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta84;
          _e2 = tmpMeta86;
          _sub = tmp4_2;
          tmp4 += 9; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _e2_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e2, _sub);

          _t2 = omc_Expression_typeof(threadData, _e1_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp89 = (modelica_boolean)_b;
          if(tmp89)
          {
            tmpMeta87 = mmc_mk_box2(10, &DAE_Operator_ADD__ARR__desc, _t2);
            tmpMeta90 = tmpMeta87;
          }
          else
          {
            tmpMeta88 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _t2);
            tmpMeta90 = tmpMeta88;
          }
          _op2 = tmpMeta90;
          tmpMeta91 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op2, _e2_1);
          tmpMeta1 = tmpMeta91;
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta92;
          modelica_metatype tmpMeta93;
          modelica_metatype tmpMeta94;
          modelica_metatype tmpMeta95;
          modelica_metatype tmpMeta96;
          modelica_boolean tmp97;
          modelica_metatype tmpMeta98;
          modelica_metatype tmpMeta99;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta92 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta93 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta93,9,1) == 0) goto tmp3_end;
          tmpMeta94 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta92;
          _e2 = tmpMeta94;
          _sub = tmp4_2;
          tmp4 += 8; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _e2_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e2, _sub);

          _t2 = omc_Expression_typeof(threadData, _e1_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp97 = (modelica_boolean)_b;
          if(tmp97)
          {
            tmpMeta95 = mmc_mk_box2(12, &DAE_Operator_MUL__ARR__desc, _t2);
            tmpMeta98 = tmpMeta95;
          }
          else
          {
            tmpMeta96 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _t2);
            tmpMeta98 = tmpMeta96;
          }
          _op2 = tmpMeta98;
          tmpMeta99 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op2, _e2_1);
          tmpMeta1 = tmpMeta99;
          goto tmp3_done;
        }
        case 14: {
          modelica_metatype tmpMeta100;
          modelica_metatype tmpMeta101;
          modelica_metatype tmpMeta102;
          modelica_metatype tmpMeta103;
          modelica_metatype tmpMeta104;
          modelica_boolean tmp105;
          modelica_metatype tmpMeta106;
          modelica_metatype tmpMeta107;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta100 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta101 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta101,10,1) == 0) goto tmp3_end;
          tmpMeta102 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta100;
          _e2 = tmpMeta102;
          _sub = tmp4_2;
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _e2_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e2, _sub);

          _t2 = omc_Expression_typeof(threadData, _e1_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp105 = (modelica_boolean)_b;
          if(tmp105)
          {
            tmpMeta103 = mmc_mk_box2(13, &DAE_Operator_DIV__ARR__desc, _t2);
            tmpMeta106 = tmpMeta103;
          }
          else
          {
            tmpMeta104 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _t2);
            tmpMeta106 = tmpMeta104;
          }
          _op2 = tmpMeta106;
          tmpMeta107 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op2, _e2_1);
          tmpMeta1 = tmpMeta107;
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta108;
          modelica_metatype tmpMeta109;
          modelica_metatype tmpMeta110;
          modelica_metatype tmpMeta111;
          modelica_metatype tmpMeta112;
          modelica_boolean tmp113;
          modelica_metatype tmpMeta114;
          modelica_metatype tmpMeta115;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta108 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta109 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta109,21,1) == 0) goto tmp3_end;
          tmpMeta110 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta108;
          _e2 = tmpMeta110;
          _sub = tmp4_2;
          tmp4 += 6; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _e2_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e2, _sub);

          _t2 = omc_Expression_typeof(threadData, _e1_1);

          _b = omc_DAEUtil_expTypeArray(threadData, _t2);

          tmp113 = (modelica_boolean)_b;
          if(tmp113)
          {
            tmpMeta111 = mmc_mk_box2(24, &DAE_Operator_POW__ARR2__desc, _t2);
            tmpMeta114 = tmpMeta111;
          }
          else
          {
            tmpMeta112 = mmc_mk_box2(7, &DAE_Operator_POW__desc, _t2);
            tmpMeta114 = tmpMeta112;
          }
          _op2 = tmpMeta114;
          tmpMeta115 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1_1, _op2, _e2_1);
          tmpMeta1 = tmpMeta115;
          goto tmp3_done;
        }
        case 16: {
          modelica_metatype tmpMeta116;
          modelica_metatype tmpMeta117;
          modelica_metatype tmpMeta118;
          modelica_metatype tmpMeta119;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,9,3) == 0) goto tmp3_end;
          tmpMeta116 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta117 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta118 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e1 = tmpMeta116;
          _op = tmpMeta117;
          _e2 = tmpMeta118;
          _sub = tmp4_2;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _e2_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e2, _sub);

          _t2 = omc_Expression_typeof(threadData, _e1_1);

          _op = omc_Expression_setOpType(threadData, _op, _t2);
          tmpMeta119 = mmc_mk_box4(12, &DAE_Exp_LBINARY__desc, _e1_1, _op, _e2_1);
          tmpMeta1 = tmpMeta119;
          goto tmp3_done;
        }
        case 17: {
          modelica_metatype tmpMeta120;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta120 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _exps = tmpMeta120;
          _sub = tmp4_2;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          _indx = omc_Expression_expInt(threadData, _sub);
          tmpMeta1 = listGet(_exps, _indx);
          goto tmp3_done;
        }
        case 18: {
          modelica_metatype tmpMeta121;
          modelica_metatype tmpMeta122;
          modelica_metatype tmpMeta123;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          tmpMeta121 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta122 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _t = tmpMeta121;
          _lstexps = tmpMeta122;
          _sub = tmp4_2;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          _indx = omc_Expression_expInt(threadData, _sub);

          _expl = listGet(_lstexps, _indx);

          _t_1 = omc_Expression_unliftArray(threadData, _t);
          tmpMeta123 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _t_1, mmc_mk_boolean(1 /* true */), _expl);
          tmpMeta1 = tmpMeta123;
          goto tmp3_done;
        }
        case 19: {
          modelica_metatype tmpMeta124;
          modelica_metatype tmpMeta125;
          modelica_metatype tmpMeta126;
          modelica_metatype tmpMeta127;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,12,3) == 0) goto tmp3_end;
          tmpMeta124 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta125 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta126 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _cond = tmpMeta124;
          _e1 = tmpMeta125;
          _e2 = tmpMeta126;
          _sub = tmp4_2;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e1, _sub);

          _e2_1 = omc_ExpressionSimplify_simplifyAsub(threadData, _e2, _sub);
          tmpMeta127 = mmc_mk_box4(15, &DAE_Exp_IFEXP__desc, _cond, _e1_1, _e2_1);
          tmpMeta1 = tmpMeta127;
          goto tmp3_done;
        }
        case 20: {
          modelica_metatype tmpMeta128;
          modelica_metatype tmpMeta129;
          modelica_metatype tmpMeta130;
          modelica_metatype tmpMeta131;
          modelica_metatype tmpMeta132;
          modelica_metatype tmpMeta133;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,3) == 0) goto tmp3_end;
          tmpMeta128 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta129 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta128), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta129,1,1) == 0) goto tmp3_end;
          tmpMeta130 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta129), 2));
          if (5 != MMC_STRLEN(tmpMeta130) || strcmp(MMC_STRINGDATA(_OMC_LIT9), MMC_STRINGDATA(tmpMeta130)) != 0) goto tmp3_end;
          tmpMeta131 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta128), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta131,1,0) == 0) goto tmp3_end;
          tmpMeta132 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta133 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _exp = tmpMeta132;
          _iters = tmpMeta133;
          _sub = tmp4_2;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_List_fold1(threadData, _iters, boxvar_ExpressionSimplify_simplifyAsubArrayReduction, _sub, _exp);
          goto tmp3_done;
        }
        case 21: {
          modelica_metatype tmpMeta134;
          modelica_metatype tmpMeta135;
          modelica_metatype tmpMeta136;
          modelica_metatype tmpMeta137;
          modelica_metatype tmpMeta138;
          modelica_metatype tmpMeta139;
          modelica_metatype tmpMeta140;
          modelica_metatype tmpMeta141;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,3) == 0) goto tmp3_end;
          tmpMeta134 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta135 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta134), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta135,1,1) == 0) goto tmp3_end;
          tmpMeta136 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta135), 2));
          if (5 != MMC_STRLEN(tmpMeta136) || strcmp(MMC_STRINGDATA(_OMC_LIT9), MMC_STRINGDATA(tmpMeta136)) != 0) goto tmp3_end;
          tmpMeta137 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta134), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta137,0,0) == 0) goto tmp3_end;
          tmpMeta138 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta139 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (listEmpty(tmpMeta139)) goto tmp3_end;
          tmpMeta140 = MMC_CAR(tmpMeta139);
          tmpMeta141 = MMC_CDR(tmpMeta139);
          if (!listEmpty(tmpMeta141)) goto tmp3_end;
          
          _exp = tmpMeta138;
          _iter = tmpMeta140;
          _sub = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyAsubArrayReduction(threadData, _iter, _sub, _exp);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 22) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubCref(threadData_t *threadData, modelica_metatype _cr, modelica_metatype _sub)
{
  modelica_metatype _res = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;
    tmp4_1 = _cr;
    {
      modelica_metatype _t2 = NULL;
      modelica_metatype _c = NULL;
      modelica_metatype _c_1 = NULL;
      modelica_metatype _s = NULL;
      modelica_metatype _s_1 = NULL;
      modelica_string _idn = NULL;
      modelica_metatype _dims = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _t2 has no default value.
      // _c has no default value.
      // _c_1 has no default value.
      // _s has no default value.
      // _s_1 has no default value.
      // _idn has no default value.
      // _dims has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _idn = tmpMeta6;
          _t2 = tmpMeta7;
          _s = tmpMeta8;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          _s_1 = omc_Expression_subscriptsAppend(threadData, _s, _sub);
          tmpMeta1 = omc_ComponentReference_makeCrefIdent(threadData, _idn, _t2, _s_1);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_boolean tmp14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,4) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta10,6,2) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta10), 3));
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          _idn = tmpMeta9;
          _t2 = tmpMeta10;
          _dims = tmpMeta11;
          _s = tmpMeta12;
          _c = tmpMeta13;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp14 = (listLength(_dims) > listLength(_s));
          if (1 /* true */ != tmp14) goto goto_2;

          _s_1 = omc_Expression_subscriptsAppend(threadData, _s, _sub);
          tmpMeta1 = omc_ComponentReference_makeCrefQual(threadData, _idn, _t2, _s_1, _c);
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,4) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          _idn = tmpMeta15;
          _t2 = tmpMeta16;
          _s = tmpMeta17;
          _c = tmpMeta18;
          /* Pattern matching succeeded */
          tmpMeta19 = mmc_mk_box2(5, &DAE_Subscript_INDEX__desc, _sub);
          _s = omc_Expression_subscriptsReplaceSlice(threadData, _s, tmpMeta19);
          tmpMeta1 = omc_ComponentReference_makeCrefQual(threadData, _idn, _t2, _s, _c);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,4) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          _idn = tmpMeta20;
          _t2 = tmpMeta21;
          _s = tmpMeta22;
          _c = tmpMeta23;
          /* Pattern matching succeeded */
          _c_1 = omc_ExpressionSimplify_simplifyAsubCref(threadData, _c, _sub);
          tmpMeta1 = omc_ComponentReference_makeCrefQual(threadData, _idn, _t2, _s, _c_1);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 4) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _res = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _res;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsub0(threadData_t *threadData, modelica_metatype _ie, modelica_integer _sub, modelica_metatype _inSubExp)
{
  modelica_metatype _res = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _ie;
    {
      modelica_metatype _t = NULL;
      modelica_metatype _t1 = NULL;
      modelica_boolean _b;
      modelica_boolean _bstart;
      modelica_boolean _bstop;
      modelica_metatype _exps = NULL;
      modelica_metatype _mexps = NULL;
      modelica_metatype _mexpl = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _cond = NULL;
      modelica_integer _istart;
      modelica_integer _istop;
      modelica_integer _istep;
      modelica_integer _ival;
      modelica_real _rstart;
      modelica_real _rstop;
      modelica_real _rstep;
      modelica_real _rval;
      modelica_metatype _c = NULL;
      modelica_metatype _c_1 = NULL;
      modelica_metatype _op = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _t has no default value.
      // _t1 has no default value.
      // _b has no default value.
      // _bstart has no default value.
      // _bstop has no default value.
      // _exps has no default value.
      // _mexps has no default value.
      // _mexpl has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _cond has no default value.
      // _istart has no default value.
      // _istop has no default value.
      // _istep has no default value.
      // _ival has no default value.
      // _rstart has no default value.
      // _rstop has no default value.
      // _rstep has no default value.
      // _rval has no default value.
      // _c has no default value.
      // _c_1 has no default value.
      // _op has no default value.
      tmp4 = 0;
      for (; tmp4 < 10; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _exps = tmpMeta6;
          /* Pattern matching succeeded */
          tmpMeta1 = listGet(_exps, _sub);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_integer tmp9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_integer tmp12;
          modelica_metatype tmpMeta13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,18,4) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,3,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta7), 2));
          tmp9 = mmc_unbox_integer(tmpMeta8);
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta10,3,1) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta10), 2));
          tmp12 = mmc_unbox_integer(tmpMeta11);
          _bstart = tmp9  /* pattern as ty=Boolean */;
          _bstop = tmp12  /* pattern as ty=Boolean */;
          /* Pattern matching succeeded */
          _b = mmc_unbox_boolean(listGet(omc_ExpressionSimplify_simplifyRangeBool(threadData, _bstart, _bstop), _sub));
          tmpMeta13 = mmc_mk_box2(6, &DAE_Exp_BCONST__desc, mmc_mk_boolean(_b));
          tmpMeta1 = tmpMeta13;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_integer tmp16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_integer tmp20;
          modelica_metatype tmpMeta21;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,18,4) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta14,0,1) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta14), 2));
          tmp16 = mmc_unbox_integer(tmpMeta15);
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (!optionNone(tmpMeta17)) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,0,1) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 2));
          tmp20 = mmc_unbox_integer(tmpMeta19);
          _istart = tmp16  /* pattern as ty=Integer */;
          _istop = tmp20  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _ival = mmc_unbox_integer(listGet(omc_ExpressionSimplify_simplifyRange(threadData, _istart, ((modelica_integer) 1), _istop), _sub));
          tmpMeta21 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_ival));
          tmpMeta1 = tmpMeta21;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_integer tmp24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_integer tmp28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_integer tmp31;
          modelica_metatype tmpMeta32;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,18,4) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta22,0,1) == 0) goto tmp3_end;
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta22), 2));
          tmp24 = mmc_unbox_integer(tmpMeta23);
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (optionNone(tmpMeta25)) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta25), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta26,0,1) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta26), 2));
          tmp28 = mmc_unbox_integer(tmpMeta27);
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta29,0,1) == 0) goto tmp3_end;
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta29), 2));
          tmp31 = mmc_unbox_integer(tmpMeta30);
          _istart = tmp24  /* pattern as ty=Integer */;
          _istep = tmp28  /* pattern as ty=Integer */;
          _istop = tmp31  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _ival = mmc_unbox_integer(listGet(omc_ExpressionSimplify_simplifyRange(threadData, _istart, _istep, _istop), _sub));
          tmpMeta32 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_ival));
          tmpMeta1 = tmpMeta32;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_real tmp35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_real tmp39;
          modelica_metatype tmpMeta40;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,18,4) == 0) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta33,1,1) == 0) goto tmp3_end;
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta33), 2));
          tmp35 = mmc_unbox_real(tmpMeta34);
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (!optionNone(tmpMeta36)) goto tmp3_end;
          tmpMeta37 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta37,1,1) == 0) goto tmp3_end;
          tmpMeta38 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta37), 2));
          tmp39 = mmc_unbox_real(tmpMeta38);
          _rstart = tmp35  /* pattern as ty=Real */;
          _rstop = tmp39  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _rval = mmc_unbox_real(listGet(omc_ExpressionSimplify_simplifyRangeReal(threadData, _rstart, 1.0, _rstop), _sub));
          tmpMeta40 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_rval));
          tmpMeta1 = tmpMeta40;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_real tmp43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_real tmp47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_real tmp50;
          modelica_metatype tmpMeta51;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,18,4) == 0) goto tmp3_end;
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta41,1,1) == 0) goto tmp3_end;
          tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta41), 2));
          tmp43 = mmc_unbox_real(tmpMeta42);
          tmpMeta44 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (optionNone(tmpMeta44)) goto tmp3_end;
          tmpMeta45 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta44), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta45,1,1) == 0) goto tmp3_end;
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta45), 2));
          tmp47 = mmc_unbox_real(tmpMeta46);
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta48,1,1) == 0) goto tmp3_end;
          tmpMeta49 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta48), 2));
          tmp50 = mmc_unbox_real(tmpMeta49);
          _rstart = tmp43  /* pattern as ty=Real */;
          _rstep = tmp47  /* pattern as ty=Real */;
          _rstop = tmp50  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _rval = mmc_unbox_real(listGet(omc_ExpressionSimplify_simplifyRangeReal(threadData, _rstart, _rstep, _rstop), _sub));
          tmpMeta51 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_rval));
          tmpMeta1 = tmpMeta51;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _t = tmpMeta52;
          _mexps = tmpMeta53;
          /* Pattern matching succeeded */
          _t1 = omc_Expression_unliftArray(threadData, _t);

          _mexpl = listGet(_mexps, _sub);
          tmpMeta54 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _t1, mmc_mk_boolean(1 /* true */), _mexpl);
          tmpMeta1 = tmpMeta54;
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          modelica_metatype tmpMeta59;
          modelica_metatype tmpMeta60;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,12,3) == 0) goto tmp3_end;
          tmpMeta55 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta56 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta57 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _cond = tmpMeta55;
          _e1 = tmpMeta56;
          _e2 = tmpMeta57;
          /* Pattern matching succeeded */
          tmpMeta58 = mmc_mk_cons(_inSubExp, MMC_REFSTRUCTLIT(mmc_nil));
          _e1 = omc_Expression_makeASUB(threadData, _e1, tmpMeta58);

          tmpMeta59 = mmc_mk_cons(_inSubExp, MMC_REFSTRUCTLIT(mmc_nil));
          _e2 = omc_Expression_makeASUB(threadData, _e2, tmpMeta59);
          tmpMeta60 = mmc_mk_box4(15, &DAE_Exp_IFEXP__desc, _cond, _e1, _e2);
          tmpMeta1 = tmpMeta60;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta61;
          modelica_metatype tmpMeta62;
          modelica_boolean tmp63;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta61 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _c = tmpMeta61;
          _t = tmpMeta62;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp63 = omc_Types_isArray(threadData, _t);
          if (1 /* true */ != tmp63) goto goto_2;

          _t = omc_Expression_unliftArray(threadData, _t);

          _c_1 = omc_ExpressionSimplify_simplifyAsubCref(threadData, _c, _inSubExp);
          tmpMeta1 = omc_Expression_makeCrefExp(threadData, _c_1, _t);
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          modelica_metatype tmpMeta68;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta64 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta65 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta66 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta64;
          _op = tmpMeta65;
          _e2 = tmpMeta66;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(omc_Expression_isMulOrDiv(threadData, _op) || omc_Expression_isAddOrSub(threadData, _op))) goto tmp3_end;
          tmpMeta67 = mmc_mk_cons(_inSubExp, MMC_REFSTRUCTLIT(mmc_nil));
          _e1 = omc_Expression_makeASUB(threadData, _e1, tmpMeta67);

          tmpMeta68 = mmc_mk_cons(_inSubExp, MMC_REFSTRUCTLIT(mmc_nil));
          _e2 = omc_Expression_makeASUB(threadData, _e2, tmpMeta68);
          tmpMeta1 = (omc_Expression_isMul(threadData, _op)?omc_Expression_expMul(threadData, _e1, _e2):(omc_Expression_isDiv(threadData, _op)?omc_Expression_makeDiv(threadData, _e1, _e2):(omc_Expression_isAdd(threadData, _op)?omc_Expression_expAdd(threadData, _e1, _e2):omc_Expression_expSub(threadData, _e1, _e2))));
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _res = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _res;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyAsub0(threadData_t *threadData, modelica_metatype _ie, modelica_metatype _sub, modelica_metatype _inSubExp)
{
  modelica_integer tmp1;
  modelica_metatype _res = NULL;
  tmp1 = mmc_unbox_integer(_sub);
  _res = omc_ExpressionSimplify_simplifyAsub0(threadData, _ie, tmp1, _inSubExp);
  /* skip box _res; DAE.Exp */
  return _res;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifySumOperatorExpression(threadData_t *threadData, modelica_metatype _iSum, modelica_metatype _iop, modelica_metatype _iExp)
{
  modelica_metatype _oExp = NULL;
  modelica_metatype _T = NULL;
  modelica_boolean _b;
  modelica_metatype _e = NULL;
  modelica_metatype _newE = NULL;
  modelica_metatype _sE = NULL;
  modelica_metatype _tp = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _oExp has no default value.
  _T = omc_Expression_termsExpandUnary(threadData, _iSum);
  // _b has no default value.
  // _e has no default value.
  // _newE has no default value.
  // _sE has no default value.
  _tp = omc_Expression_typeofOp(threadData, _iop);
  _oExp = omc_Expression_makeConstZero(threadData, _tp);

  _sE = _oExp;

  {
    modelica_metatype _elem;
    for (tmpMeta1 = _T; !listEmpty(tmpMeta1); tmpMeta1=MMC_CDR(tmpMeta1))
    {
      _elem = MMC_CAR(tmpMeta1);
      tmpMeta2 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _elem, _iop, _iExp);
      _e = tmpMeta2;

      _newE = omc_ExpressionSimplify_simplifyBinaryCoeff(threadData, _e);

      _b = (!omc_Expression_expEqual(threadData, _e, _newE));

      if(_b)
      {
        _sE = omc_Expression_expAdd(threadData, _sE, _newE);
      }
      else
      {
        _oExp = omc_Expression_expAdd(threadData, _oExp, _elem);
      }
    }
  }

  tmpMeta4 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _oExp, _iop, _iExp);
  _e = tmpMeta4;

  _oExp = omc_Expression_expAdd(threadData, _sE, _e);
  _return: OMC_LABEL_UNUSED
  return _oExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryMulCoeff2(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outRes = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outRes has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_real _coeff;
      modelica_real _coeff_1;
      modelica_integer _icoeff;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _coeff has no default value.
      // _coeff_1 has no default value.
      // _icoeff has no default value.
      tmp4 = 0;
      for (; tmp4 < 7; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          
          _e = tmp4_1;
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_box2(0, _e, _OMC_LIT26);
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_real tmp11;
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,4,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,1,1) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 2));
          tmp11 = mmc_unbox_real(tmpMeta10);
          _e1 = tmpMeta7;
          _coeff = tmp11  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          tmpMeta12 = mmc_mk_box2(0, _e1, mmc_mk_real(_coeff));
          tmpMeta1 = tmpMeta12;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_real tmp19;
          modelica_metatype tmpMeta20;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta14,4,1) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta15,8,2) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta15), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta16,5,1) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta15), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta17,1,1) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta17), 2));
          tmp19 = mmc_unbox_real(tmpMeta18);
          _e1 = tmpMeta13;
          _coeff = tmp19  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _coeff_1 = (-_coeff);
          tmpMeta20 = mmc_mk_box2(0, _e1, mmc_mk_real(_coeff_1));
          tmpMeta1 = tmpMeta20;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_integer tmp25;
          modelica_metatype tmpMeta26;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta22,4,1) == 0) goto tmp3_end;
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta23,0,1) == 0) goto tmp3_end;
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta23), 2));
          tmp25 = mmc_unbox_integer(tmpMeta24);
          _e1 = tmpMeta21;
          _icoeff = tmp25  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _coeff_1 = ((modelica_real)_icoeff);
          tmpMeta26 = mmc_mk_box2(0, _e1, mmc_mk_real(_coeff_1));
          tmpMeta1 = tmpMeta26;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_integer tmp33;
          modelica_metatype tmpMeta34;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta28,4,1) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta29,8,2) == 0) goto tmp3_end;
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta29), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta30,5,1) == 0) goto tmp3_end;
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta29), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta31,0,1) == 0) goto tmp3_end;
          tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta31), 2));
          tmp33 = mmc_unbox_integer(tmpMeta32);
          _e1 = tmpMeta27;
          _icoeff = tmp33  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _coeff_1 = (-(((modelica_real)_icoeff)));
          tmpMeta34 = mmc_mk_box2(0, _e1, mmc_mk_real(_coeff_1));
          tmpMeta1 = tmpMeta34;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta36,2,1) == 0) goto tmp3_end;
          tmpMeta37 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta35;
          _e2 = tmpMeta37;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta38 = mmc_mk_box2(0, _e1, _OMC_LIT28);
          tmpMeta1 = tmpMeta38;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta39;
          
          /* Pattern matching succeeded */
          tmpMeta39 = mmc_mk_box2(0, _inExp, _OMC_LIT26);
          tmpMeta1 = tmpMeta39;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outRes = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outRes;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryAddCoeff2(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outRes = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outRes has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _exp = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_real _coeff;
      modelica_real _coeff_1;
      modelica_integer _icoeff;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _exp has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _coeff has no default value.
      // _coeff_1 has no default value.
      // _icoeff has no default value.
      tmp4 = 0;
      for (; tmp4 < 8; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_box2(0, _inExp, _OMC_LIT26);
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_real tmp13;
          modelica_metatype tmpMeta14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,5,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta7), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _exp = tmpMeta9;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmpMeta10 = omc_ExpressionSimplify_simplifyBinaryAddCoeff2(threadData, _exp);
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta10), 1));
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta10), 2));
          tmp13 = mmc_unbox_real(tmpMeta12);
          _exp = tmpMeta11;
          _coeff = tmp13  /* pattern as ty=Real */;

          _coeff = (-_coeff);
          tmpMeta14 = mmc_mk_box2(0, _exp, mmc_mk_real(_coeff));
          tmpMeta1 = tmpMeta14;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_real tmp17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta15,1,1) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta15), 2));
          tmp17 = mmc_unbox_real(tmpMeta16);
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,2,1) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _coeff = tmp17  /* pattern as ty=Real */;
          _e1 = tmpMeta19;
          /* Pattern matching succeeded */
          tmpMeta20 = mmc_mk_box2(0, _e1, mmc_mk_real(_coeff));
          tmpMeta1 = tmpMeta20;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_real tmp25;
          modelica_metatype tmpMeta26;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta22,2,1) == 0) goto tmp3_end;
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta23,1,1) == 0) goto tmp3_end;
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta23), 2));
          tmp25 = mmc_unbox_real(tmpMeta24);
          _e1 = tmpMeta21;
          _coeff = tmp25  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          tmpMeta26 = mmc_mk_box2(0, _e1, mmc_mk_real(_coeff));
          tmpMeta1 = tmpMeta26;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_integer tmp31;
          modelica_metatype tmpMeta32;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta28,2,1) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta29,0,1) == 0) goto tmp3_end;
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta29), 2));
          tmp31 = mmc_unbox_integer(tmpMeta30);
          _e1 = tmpMeta27;
          _icoeff = tmp31  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _coeff_1 = ((modelica_real)_icoeff);
          tmpMeta32 = mmc_mk_box2(0, _e1, mmc_mk_real(_coeff_1));
          tmpMeta1 = tmpMeta32;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_integer tmp35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta33,0,1) == 0) goto tmp3_end;
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta33), 2));
          tmp35 = mmc_unbox_integer(tmpMeta34);
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta36,2,1) == 0) goto tmp3_end;
          tmpMeta37 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _icoeff = tmp35  /* pattern as ty=Integer */;
          _e1 = tmpMeta37;
          /* Pattern matching succeeded */
          _coeff_1 = ((modelica_real)_icoeff);
          tmpMeta38 = mmc_mk_box2(0, _e1, mmc_mk_real(_coeff_1));
          tmpMeta1 = tmpMeta38;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta39 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta40 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta40,0,1) == 0) goto tmp3_end;
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta39;
          _e2 = tmpMeta41;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta42 = mmc_mk_box2(0, _e1, _OMC_LIT28);
          tmpMeta1 = tmpMeta42;
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta43;
          
          /* Pattern matching succeeded */
          tmpMeta43 = mmc_mk_box2(0, _inExp, _OMC_LIT26);
          tmpMeta1 = tmpMeta43;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outRes = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outRes;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAddMakeMul(threadData_t *threadData, modelica_metatype _inTplExpRealLst)
{
  modelica_metatype _outExpLst = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _outExpLst = tmpMeta1;
  {
    modelica_metatype __omcQ_24tmpVar19;
    modelica_metatype* tmp3;
    modelica_metatype tmpMeta4;
    modelica_metatype tmpMeta5;
    modelica_metatype __omcQ_24tmpVar18;
    modelica_integer tmp28;
    modelica_metatype _tplExpReal_loopVar = 0;
    modelica_metatype _tplExpReal;
    _tplExpReal_loopVar = _inTplExpRealLst;
    tmpMeta4 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar19 = tmpMeta4; /* defaultValue */
    tmp3 = &__omcQ_24tmpVar19;
    while(1) {
      tmp28 = 1;
      if (!listEmpty(_tplExpReal_loopVar)) {
        _tplExpReal = MMC_CAR(_tplExpReal_loopVar);
        _tplExpReal_loopVar = MMC_CDR(_tplExpReal_loopVar);
        tmp28--;
      }
      if (tmp28 == 0) {
        { /* match expression */
          modelica_metatype tmp8_1;
          tmp8_1 = _tplExpReal;
          {
            modelica_metatype _e = NULL;
            modelica_real _r;
            volatile mmc_switch_type tmp8;
            int tmp9;
            // _e has no default value.
            // _r has no default value.
            tmp8 = 0;
            for (; tmp8 < 3; tmp8++) {
              switch (MMC_SWITCH_CAST(tmp8)) {
              case 0: {
                modelica_metatype tmpMeta10;
                modelica_metatype tmpMeta11;
                modelica_real tmp12;
                tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp8_1), 1));
                tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp8_1), 2));
                tmp12 = mmc_unbox_real(tmpMeta11);
                if (1.0 != tmp12) goto tmp7_end;
                _e = tmpMeta10;
                /* Pattern matching succeeded */
                tmpMeta5 = _e;
                goto tmp7_done;
              }
              case 1: {
                modelica_metatype tmpMeta13;
                modelica_metatype tmpMeta14;
                modelica_real tmp15;
                tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp8_1), 1));
                tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp8_1), 2));
                tmp15 = mmc_unbox_real(tmpMeta14);
                if (-1.0 != tmp15) goto tmp7_end;
                _e = tmpMeta13;
                /* Pattern matching succeeded */
                tmpMeta5 = omc_Expression_negate(threadData, _e);
                goto tmp7_done;
              }
              case 2: {
                modelica_metatype tmpMeta16;
                modelica_metatype tmpMeta17;
                modelica_real tmp18;
                modelica_metatype tmpMeta19;
                tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp8_1), 1));
                tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp8_1), 2));
                tmp18 = mmc_unbox_real(tmpMeta17);
                _e = tmpMeta16;
                _r = tmp18  /* pattern as ty=Real */;
                /* Pattern matching succeeded */
                { /* match expression */
                  modelica_metatype tmp22_1;
                  tmp22_1 = omc_Expression_typeof(threadData, _e);
                  {
                    volatile mmc_switch_type tmp22;
                    int tmp23;
                    tmp22 = 0;
                    for (; tmp22 < 2; tmp22++) {
                      switch (MMC_SWITCH_CAST(tmp22)) {
                      case 0: {
                        modelica_metatype tmpMeta24;
                        modelica_metatype tmpMeta25;
                        if (mmc__uniontype__metarecord__typedef__equal(tmp22_1,0,1) == 0) goto tmp21_end;
                        
                        /* Pattern matching succeeded */
                        tmpMeta24 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(((modelica_integer)floor(_r))));
                        tmpMeta25 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta24, _OMC_LIT55, _e);
                        tmpMeta19 = tmpMeta25;
                        goto tmp21_done;
                      }
                      case 1: {
                        modelica_metatype tmpMeta26;
                        modelica_metatype tmpMeta27;
                        
                        /* Pattern matching succeeded */
                        tmpMeta26 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
                        tmpMeta27 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, tmpMeta26, _OMC_LIT34, _e);
                        tmpMeta19 = tmpMeta27;
                        goto tmp21_done;
                      }
                      }
                      goto tmp21_end;
                      tmp21_end: ;
                    }
                    goto goto_20;
                    goto_20:;
                    goto goto_6;
                    goto tmp21_done;
                    tmp21_done:;
                  }
                }tmpMeta5 = tmpMeta19;
                goto tmp7_done;
              }
              }
              goto tmp7_end;
              tmp7_end: ;
            }
            goto goto_6;
            goto_6:;
            MMC_THROW_INTERNAL();
            goto tmp7_done;
            tmp7_done:;
          }
        }__omcQ_24tmpVar18 = tmpMeta5;
        *tmp3 = mmc_mk_cons(__omcQ_24tmpVar18,0);
        tmp3 = &MMC_CDR(*tmp3);
      } else if (tmp28 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp3 = mmc_mk_nil();
    tmpMeta2 = __omcQ_24tmpVar19;
  }
  _outExpLst = tmpMeta2;
  _return: OMC_LABEL_UNUSED
  return _outExpLst;
}

PROTECTED_FUNCTION_STATIC modelica_real omc_ExpressionSimplify_simplifyAddJoinTerms_addCoeff(threadData_t *threadData, modelica_metatype _oldCoeff, modelica_real _newCoeff)
{
  modelica_real _coeff;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _coeff has no default value.
  _coeff = (isSome(_oldCoeff)?mmc_unbox_real(omc_Util_getOption(threadData, _oldCoeff)) + _newCoeff:_newCoeff);
  _return: OMC_LABEL_UNUSED
  return _coeff;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyAddJoinTerms_addCoeff(threadData_t *threadData, modelica_metatype _oldCoeff, modelica_metatype _newCoeff)
{
  modelica_real tmp1;
  modelica_real _coeff;
  modelica_metatype out_coeff;
  tmp1 = mmc_unbox_real(_newCoeff);
  _coeff = omc_ExpressionSimplify_simplifyAddJoinTerms_addCoeff(threadData, _oldCoeff, tmp1);
  out_coeff = mmc_mk_rcon(_coeff);
  return out_coeff;
}

static modelica_metatype closure1_ExpressionSimplify_simplifyAddJoinTerms_addCoeff(threadData_t *thData, modelica_metatype closure, modelica_metatype oldCoeff)
{
  modelica_metatype newCoeff = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_ExpressionSimplify_simplifyAddJoinTerms_addCoeff(thData, oldCoeff, newCoeff);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAddJoinTerms(threadData_t *threadData, modelica_metatype _inTplExpRealLst)
{
  modelica_metatype _outTplExpRealLst = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outTplExpRealLst has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inTplExpRealLst;
    {
      modelica_metatype _exp1 = NULL;
      modelica_metatype _exp2 = NULL;
      modelica_metatype _exp3 = NULL;
      modelica_real _coeff1;
      modelica_real _coeff2;
      modelica_real _coeff3;
      modelica_metatype _coeff_map = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _exp1 has no default value.
      // _exp2 has no default value.
      // _exp3 has no default value.
      // _coeff1 has no default value.
      // _coeff2 has no default value.
      // _coeff3 has no default value.
      // _coeff_map has no default value.
      tmp4 = 0;
      for (; tmp4 < 5; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (!listEmpty(tmp4_1)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta6 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta7 = MMC_CAR(tmp4_1);
          tmpMeta8 = MMC_CDR(tmp4_1);
          if (!listEmpty(tmpMeta8)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta1 = _inTplExpRealLst;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_real tmp13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_real tmp18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_boolean tmp21;
          modelica_metatype tmpMeta22;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta9 = MMC_CAR(tmp4_1);
          tmpMeta10 = MMC_CDR(tmp4_1);
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 1));
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 2));
          tmp13 = mmc_unbox_real(tmpMeta12);
          if (listEmpty(tmpMeta10)) goto tmp3_end;
          tmpMeta14 = MMC_CAR(tmpMeta10);
          tmpMeta15 = MMC_CDR(tmpMeta10);
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta14), 1));
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta14), 2));
          tmp18 = mmc_unbox_real(tmpMeta17);
          if (!listEmpty(tmpMeta15)) goto tmp3_end;
          _exp1 = tmpMeta11;
          _coeff1 = tmp13  /* pattern as ty=Real */;
          _exp2 = tmpMeta16;
          _coeff2 = tmp18  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          tmp21 = (modelica_boolean)omc_Expression_expEqual(threadData, _exp1, _exp2);
          if(tmp21)
          {
            tmpMeta20 = mmc_mk_box2(0, _exp1, mmc_mk_real(_coeff1 + _coeff2));
            tmpMeta19 = mmc_mk_cons(tmpMeta20, MMC_REFSTRUCTLIT(mmc_nil));
            tmpMeta22 = tmpMeta19;
          }
          else
          {
            tmpMeta22 = _inTplExpRealLst;
          }
          tmpMeta1 = tmpMeta22;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_real tmp27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_real tmp32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_real tmp37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta23 = MMC_CAR(tmp4_1);
          tmpMeta24 = MMC_CDR(tmp4_1);
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta23), 1));
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta23), 2));
          tmp27 = mmc_unbox_real(tmpMeta26);
          if (listEmpty(tmpMeta24)) goto tmp3_end;
          tmpMeta28 = MMC_CAR(tmpMeta24);
          tmpMeta29 = MMC_CDR(tmpMeta24);
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta28), 1));
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta28), 2));
          tmp32 = mmc_unbox_real(tmpMeta31);
          if (listEmpty(tmpMeta29)) goto tmp3_end;
          tmpMeta33 = MMC_CAR(tmpMeta29);
          tmpMeta34 = MMC_CDR(tmpMeta29);
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta33), 1));
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta33), 2));
          tmp37 = mmc_unbox_real(tmpMeta36);
          if (!listEmpty(tmpMeta34)) goto tmp3_end;
          _exp1 = tmpMeta25;
          _coeff1 = tmp27  /* pattern as ty=Real */;
          _exp2 = tmpMeta30;
          _coeff2 = tmp32  /* pattern as ty=Real */;
          _exp3 = tmpMeta35;
          _coeff3 = tmp37  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          if(omc_Expression_expEqual(threadData, _exp1, _exp2))
          {
            if(omc_Expression_expEqual(threadData, _exp1, _exp3))
            {
              tmpMeta39 = mmc_mk_box2(0, _exp1, mmc_mk_real(_coeff1 + _coeff2 + _coeff3));
              tmpMeta38 = mmc_mk_cons(tmpMeta39, MMC_REFSTRUCTLIT(mmc_nil));
              _outTplExpRealLst = tmpMeta38;
            }
            else
            {
              tmpMeta41 = mmc_mk_box2(0, _exp1, mmc_mk_real(_coeff1 + _coeff2));
              tmpMeta42 = mmc_mk_box2(0, _exp3, mmc_mk_real(_coeff3));
              tmpMeta40 = mmc_mk_cons(tmpMeta41, mmc_mk_cons(tmpMeta42, MMC_REFSTRUCTLIT(mmc_nil)));
              _outTplExpRealLst = tmpMeta40;
            }
          }
          else
          {
            if(omc_Expression_expEqual(threadData, _exp1, _exp3))
            {
              tmpMeta44 = mmc_mk_box2(0, _exp1, mmc_mk_real(_coeff1 + _coeff3));
              tmpMeta45 = mmc_mk_box2(0, _exp2, mmc_mk_real(_coeff2));
              tmpMeta43 = mmc_mk_cons(tmpMeta44, mmc_mk_cons(tmpMeta45, MMC_REFSTRUCTLIT(mmc_nil)));
              _outTplExpRealLst = tmpMeta43;
            }
            else
            {
              if(omc_Expression_expEqual(threadData, _exp2, _exp3))
              {
                tmpMeta47 = mmc_mk_box2(0, _exp1, mmc_mk_real(_coeff1));
                tmpMeta48 = mmc_mk_box2(0, _exp2, mmc_mk_real(_coeff2 + _coeff3));
                tmpMeta46 = mmc_mk_cons(tmpMeta47, mmc_mk_cons(tmpMeta48, MMC_REFSTRUCTLIT(mmc_nil)));
                _outTplExpRealLst = tmpMeta46;
              }
              else
              {
                _outTplExpRealLst = _inTplExpRealLst;
              }
            }
          }
          tmpMeta1 = _outTplExpRealLst;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          modelica_real tmp53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          
          /* Pattern matching succeeded */
          _coeff_map = omc_UnorderedMap_new(threadData, boxvar_Expression_hashExp, boxvar_Expression_expEqual, listLength(_inTplExpRealLst));

          {
            modelica_metatype _tpl;
            for (tmpMeta49 = _inTplExpRealLst; !listEmpty(tmpMeta49); tmpMeta49=MMC_CDR(tmpMeta49))
            {
              _tpl = MMC_CAR(tmpMeta49);
              /* Pattern-matching assignment */
              tmpMeta50 = _tpl;
              tmpMeta51 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta50), 1));
              tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta50), 2));
              tmp53 = mmc_unbox_real(tmpMeta52);
              _exp1 = tmpMeta51;
              _coeff1 = tmp53  /* pattern as ty=Real */;

              tmpMeta54 = mmc_mk_box1(0, mmc_mk_real(_coeff1));
              omc_UnorderedMap_addUpdate(threadData, _exp1, (modelica_fnptr) mmc_mk_box2(0,closure1_ExpressionSimplify_simplifyAddJoinTerms_addCoeff,tmpMeta54), _coeff_map);
            }
          }
          tmpMeta1 = omc_UnorderedMap_toList(threadData, _coeff_map);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outTplExpRealLst = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outTplExpRealLst;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAdd(threadData_t *threadData, modelica_metatype _inExpLst)
{
  modelica_metatype _outExpLst = NULL;
  modelica_metatype _coeffs = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExpLst has no default value.
  // _coeffs has no default value.
  { /* matchcontinue expression */
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp2_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          /* Pattern matching succeeded */
          _coeffs = omc_List_map(threadData, _inExpLst, boxvar_ExpressionSimplify_simplifyBinaryAddCoeff2);

          _coeffs = omc_ExpressionSimplify_simplifyAddJoinTerms(threadData, _coeffs);

          _outExpLst = omc_ExpressionSimplify_simplifyAddMakeMul(threadData, _coeffs);
          goto tmp2_done;
        }
        case 1: {
          /* Pattern matching succeeded */
          if(omc_Flags_isSet(threadData, _OMC_LIT60))
          {
            omc_Debug_trace(threadData, _OMC_LIT56);
          }

          goto goto_1;
          goto tmp2_done;
        }
        }
        goto tmp2_end;
        tmp2_end: ;
      }
      goto goto_1;
      tmp2_done:
      (void)tmp3;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp2_done2;
      goto_1:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp3 < 2) {
        goto tmp2_top;
      }
      MMC_THROW_INTERNAL();
      tmp2_done2:;
    }
  }
  ;
  _return: OMC_LABEL_UNUSED
  return _outExpLst;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMulMakePow(threadData_t *threadData, modelica_metatype _inTplExpRealLst)
{
  modelica_metatype _outExpLst = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _tplExpReal = NULL;
  modelica_metatype _e = NULL;
  modelica_real _r;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_real tmp6;
  modelica_metatype tmpMeta7;
  modelica_metatype tmpMeta8;
  modelica_metatype tmpMeta9;
  modelica_metatype tmpMeta10;
  modelica_boolean tmp11;
  modelica_metatype tmpMeta12;
  modelica_metatype tmpMeta13;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _outExpLst = tmpMeta1;
  // _tplExpReal has no default value.
  // _e has no default value.
  // _r has no default value.
  {
    modelica_metatype _tplExpReal;
    for (tmpMeta2 = _inTplExpRealLst; !listEmpty(tmpMeta2); tmpMeta2=MMC_CDR(tmpMeta2))
    {
      _tplExpReal = MMC_CAR(tmpMeta2);
      /* Pattern-matching assignment */
      tmpMeta3 = _tplExpReal;
      tmpMeta4 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta3), 1));
      tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta3), 2));
      tmp6 = mmc_unbox_real(tmpMeta5);
      _e = tmpMeta4;
      _r = tmp6  /* pattern as ty=Real */;

      tmp11 = (modelica_boolean)(_r == 1.0);
      if(tmp11)
      {
        tmpMeta7 = mmc_mk_cons(_e, _outExpLst);
        tmpMeta12 = tmpMeta7;
      }
      else
      {
        tmpMeta9 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
        tmpMeta10 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _OMC_LIT36, tmpMeta9);
        tmpMeta8 = mmc_mk_cons(tmpMeta10, _outExpLst);
        tmpMeta12 = tmpMeta8;
      }
      _outExpLst = tmpMeta12;
    }
  }
  _return: OMC_LABEL_UNUSED
  return _outExpLst;
}

PROTECTED_FUNCTION_STATIC modelica_real omc_ExpressionSimplify_simplifyMulJoinFactorsFind(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inTplExpRealLst, modelica_metatype *out_outTplExpRealLst)
{
  modelica_real _outReal;
  modelica_metatype _outTplExpRealLst = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _tplExpReal = NULL;
  modelica_metatype tmpMeta2;
  modelica_real tmp3_c0 __attribute__((unused)) = 0;
  modelica_metatype tmpMeta21;
  modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _outReal = 0.0;
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _outTplExpRealLst = tmpMeta1;
  // _tplExpReal has no default value.
  {
    modelica_metatype _tplExpReal;
    for (tmpMeta2 = _inTplExpRealLst; !listEmpty(tmpMeta2); tmpMeta2=MMC_CDR(tmpMeta2))
    {
      _tplExpReal = MMC_CAR(tmpMeta2);
      
      
      { /* match expression */
        modelica_metatype tmp6_1;
        tmp6_1 = _tplExpReal;
        {
          modelica_real _coeff;
          modelica_metatype _e2 = NULL;
          modelica_metatype _e1 = NULL;
          modelica_metatype _op = NULL;
          volatile mmc_switch_type tmp6;
          int tmp7;
          // _coeff has no default value.
          // _e2 has no default value.
          // _e1 has no default value.
          // _op has no default value.
          tmp6 = 0;
          for (; tmp6 < 3; tmp6++) {
            switch (MMC_SWITCH_CAST(tmp6)) {
            case 0: {
              modelica_metatype tmpMeta8;
              modelica_metatype tmpMeta9;
              modelica_real tmp10;
              tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp6_1), 1));
              tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp6_1), 2));
              tmp10 = mmc_unbox_real(tmpMeta9);
              _e2 = tmpMeta8;
              _coeff = tmp10  /* pattern as ty=Real */;
              /* Pattern matching succeeded */
              /* Check guard condition after assignments */
              if (!omc_Expression_expEqual(threadData, _inExp, _e2)) goto tmp5_end;
              tmp3_c0 = _coeff + _outReal;
              tmpMeta[0+1] = _outTplExpRealLst;
              goto tmp5_done;
            }
            case 1: {
              modelica_metatype tmpMeta11;
              modelica_metatype tmpMeta12;
              modelica_metatype tmpMeta13;
              modelica_metatype tmpMeta14;
              modelica_metatype tmpMeta15;
              modelica_real tmp16;
              modelica_metatype tmpMeta17;
              modelica_boolean tmp18;
              modelica_boolean tmp19;
              tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp6_1), 1));
              if (mmc__uniontype__metarecord__typedef__equal(tmpMeta11,7,3) == 0) goto tmp5_end;
              tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta11), 2));
              tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta11), 3));
              if (mmc__uniontype__metarecord__typedef__equal(tmpMeta13,3,1) == 0) goto tmp5_end;
              tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta11), 4));
              tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp6_1), 2));
              tmp16 = mmc_unbox_real(tmpMeta15);
              _e1 = tmpMeta12;
              _op = tmpMeta13;
              _e2 = tmpMeta14;
              _coeff = tmp16  /* pattern as ty=Real */;
              tmp18 = (modelica_boolean)omc_Expression_isOne(threadData, _e1);
              if(tmp18)
              {
                tmp19 = omc_Expression_expEqual(threadData, _inExp, _e2);
              }
              else
              {
                tmpMeta17 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e2, _op, _e1);
                tmp19 = omc_Expression_expEqual(threadData, _inExp, tmpMeta17);
              }
              /* Pattern matching succeeded */
              /* Check guard condition after assignments */
              if (!tmp19) goto tmp5_end;
              tmp3_c0 = _outReal - _coeff;
              tmpMeta[0+1] = _outTplExpRealLst;
              goto tmp5_done;
            }
            case 2: {
              modelica_metatype tmpMeta20;
              
              /* Pattern matching succeeded */
              tmpMeta20 = mmc_mk_cons(_tplExpReal, _outTplExpRealLst);
              tmp3_c0 = _outReal;
              tmpMeta[0+1] = tmpMeta20;
              goto tmp5_done;
            }
            }
            goto tmp5_end;
            tmp5_end: ;
          }
          goto goto_4;
          goto_4:;
          MMC_THROW_INTERNAL();
          goto tmp5_done;
          tmp5_done:;
        }
      }
      _outReal = tmp3_c0;
      _outTplExpRealLst = tmpMeta[0+1];
    }
  }

  _outTplExpRealLst = listReverse(_outTplExpRealLst);
  _return: OMC_LABEL_UNUSED
  if (out_outTplExpRealLst) { *out_outTplExpRealLst = _outTplExpRealLst; }
  return _outReal;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyMulJoinFactorsFind(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inTplExpRealLst, modelica_metatype *out_outTplExpRealLst)
{
  modelica_real _outReal;
  modelica_metatype out_outReal;
  _outReal = omc_ExpressionSimplify_simplifyMulJoinFactorsFind(threadData, _inExp, _inTplExpRealLst, out_outTplExpRealLst);
  out_outReal = mmc_mk_rcon(_outReal);
  /* skip box _outTplExpRealLst; list<tuple<DAE.Exp, #Real>> */
  return out_outReal;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMulJoinFactors(threadData_t *threadData, modelica_metatype _inTplExpRealLst)
{
  modelica_metatype _outTplExpRealLst = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _tplExpRealLst = NULL;
  modelica_metatype _e = NULL;
  modelica_real _coeff;
  modelica_real _coeff2;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_real tmp7;
  modelica_metatype tmpMeta8;
  modelica_metatype tmpMeta9;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _outTplExpRealLst = tmpMeta1;
  _tplExpRealLst = _inTplExpRealLst;
  // _e has no default value.
  // _coeff has no default value.
  // _coeff2 has no default value.
  while(1)
  {
    if(!(!listEmpty(_tplExpRealLst))) break;
    /* Pattern-matching assignment */
    tmpMeta2 = _tplExpRealLst;
    if (listEmpty(tmpMeta2)) MMC_THROW_INTERNAL();
    tmpMeta3 = MMC_CAR(tmpMeta2);
    tmpMeta4 = MMC_CDR(tmpMeta2);
    tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta3), 1));
    tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta3), 2));
    tmp7 = mmc_unbox_real(tmpMeta6);
    _e = tmpMeta5;
    _coeff = tmp7  /* pattern as ty=Real */;
    _tplExpRealLst = tmpMeta4;

    _coeff2 = omc_ExpressionSimplify_simplifyMulJoinFactorsFind(threadData, _e, _tplExpRealLst ,&_tplExpRealLst);

    _coeff = _coeff + _coeff2;

    tmpMeta9 = mmc_mk_box2(0, _e, mmc_mk_real(_coeff));
    tmpMeta8 = mmc_mk_cons(tmpMeta9, _outTplExpRealLst);
    _outTplExpRealLst = tmpMeta8;
  }
  _return: OMC_LABEL_UNUSED
  return _outTplExpRealLst;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMul(threadData_t *threadData, modelica_metatype _expl)
{
  modelica_metatype _expl_1 = NULL;
  modelica_metatype _exp_const = NULL;
  modelica_metatype _exp_const_1 = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _expl_1 has no default value.
  // _exp_const has no default value.
  // _exp_const_1 has no default value.
  _exp_const = omc_List_map(threadData, _expl, boxvar_ExpressionSimplify_simplifyBinaryMulCoeff2);

  _exp_const_1 = omc_ExpressionSimplify_simplifyMulJoinFactors(threadData, _exp_const);

  _expl_1 = omc_ExpressionSimplify_simplifyMulMakePow(threadData, _exp_const_1);
  _return: OMC_LABEL_UNUSED
  return _expl_1;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryMulConstants(threadData_t *threadData, modelica_metatype _inExpLst)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _es = NULL;
  modelica_metatype _tp = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _es has no default value.
  // _tp has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _inExpLst;
  if (listEmpty(tmpMeta1)) MMC_THROW_INTERNAL();
  tmpMeta2 = MMC_CAR(tmpMeta1);
  tmpMeta3 = MMC_CDR(tmpMeta1);
  _outExp = tmpMeta2;
  _es = tmpMeta3;

  _tp = omc_Expression_typeof(threadData, _outExp);

  {
    modelica_metatype _e;
    for (tmpMeta4 = _es; !listEmpty(tmpMeta4); tmpMeta4=MMC_CDR(tmpMeta4))
    {
      _e = MMC_CAR(tmpMeta4);
      tmpMeta5 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _tp);
      _outExp = omc_ExpressionSimplify_simplifyBinaryConst(threadData, tmpMeta5, _outExp, _e);
    }
  }
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryAddConstants(threadData_t *threadData, modelica_metatype _inExpLst)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _tp = NULL;
  modelica_metatype _es = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _tp has no default value.
  // _es has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _inExpLst;
  if (listEmpty(tmpMeta1)) MMC_THROW_INTERNAL();
  tmpMeta2 = MMC_CAR(tmpMeta1);
  tmpMeta3 = MMC_CDR(tmpMeta1);
  _outExp = tmpMeta2;
  _es = tmpMeta3;

  _tp = omc_Expression_typeof(threadData, _outExp);

  {
    modelica_metatype _e;
    for (tmpMeta4 = _es; !listEmpty(tmpMeta4); tmpMeta4=MMC_CDR(tmpMeta4))
    {
      _e = MMC_CAR(tmpMeta4);
      tmpMeta5 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _tp);
      _outExp = omc_ExpressionSimplify_simplifyBinaryConst(threadData, tmpMeta5, _outExp, _e);
    }
  }
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryCoeff(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _e_lst = NULL;
      modelica_metatype _e_lst_1 = NULL;
      modelica_metatype _e1_lst = NULL;
      modelica_metatype _e2_lst = NULL;
      modelica_metatype _e2_lst_1 = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _tp = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e_lst has no default value.
      // _e_lst_1 has no default value.
      // _e1_lst has no default value.
      // _e2_lst has no default value.
      // _e2_lst_1 has no default value.
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _tp has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 5; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,2,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          
          _e = tmp4_1;
          _tp = tmpMeta7;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Types_isScalarReal(threadData, _tp)) goto tmp3_end;
          _e_lst = omc_Expression_factors(threadData, _e);

          _e_lst_1 = omc_ExpressionSimplify_simplifyMul(threadData, _e_lst);
          tmpMeta1 = omc_Expression_makeProductLst(threadData, _e_lst_1);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_boolean tmp11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,3,1) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta8;
          _e2 = tmpMeta10;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp11 = omc_Expression_isZero(threadData, _e2);
          if (0 /* false */ != tmp11) goto goto_2;

          _e1_lst = omc_Expression_factors(threadData, _e1);

          _e2_lst = omc_Expression_factors(threadData, _e2);

          _e2_lst_1 = omc_List_map(threadData, _e2_lst, boxvar_Expression_inverseFactors);

          _e_lst = listAppend(_e1_lst, _e2_lst_1);

          _e_lst_1 = omc_ExpressionSimplify_simplifyMul(threadData, _e_lst);
          tmpMeta1 = omc_Expression_makeProductLst(threadData, _e_lst_1);
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta12,0,1) == 0) goto tmp3_end;
          
          _e = tmp4_1;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e_lst = omc_Expression_terms(threadData, _e);

          _e_lst_1 = omc_ExpressionSimplify_simplifyAdd(threadData, _e_lst);
          tmpMeta1 = omc_Expression_makeSum(threadData, _e_lst_1);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta14,1,1) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta13;
          _e2 = tmpMeta15;
          /* Pattern matching succeeded */
          _e1_lst = omc_Expression_terms(threadData, _e1);

          _e2_lst = omc_Expression_terms(threadData, _e2);

          _e2_lst = omc_List_map(threadData, _e2_lst, boxvar_Expression_negate);

          _e_lst = listAppend(_e1_lst, _e2_lst);

          _e_lst_1 = omc_ExpressionSimplify_simplifyAdd(threadData, _e_lst);
          tmpMeta1 = omc_Expression_makeSum(threadData, _e_lst_1);
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 5) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinarySortConstants(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _e_lst = NULL;
      modelica_metatype _const_es1 = NULL;
      modelica_metatype _notconst_es1 = NULL;
      modelica_metatype _res = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _res1 = NULL;
      modelica_metatype _res2 = NULL;
      modelica_metatype _tp = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e_lst has no default value.
      // _const_es1 has no default value.
      // _notconst_es1 has no default value.
      // _res has no default value.
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _res1 has no default value.
      // _res2 has no default value.
      // _tp has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,2,1) == 0) goto tmp3_end;
          
          _e = tmp4_1;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyBinarySortConstantsMul(threadData, _e);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,3,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta7;
          _tp = tmpMeta9;
          _e2 = tmpMeta10;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e1 = omc_ExpressionSimplify_simplifyBinarySortConstantsMul(threadData, _e1);

          _e2 = omc_ExpressionSimplify_simplifyBinarySortConstantsMul(threadData, _e2);
          tmpMeta11 = mmc_mk_box2(6, &DAE_Operator_DIV__desc, _tp);
          tmpMeta12 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta11, _e2);
          tmpMeta1 = tmpMeta12;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta13,0,1) == 0) goto tmp3_end;
          
          _e = tmp4_1;
          /* Pattern matching succeeded */
          _e_lst = omc_Expression_terms(threadData, _e);

          _const_es1 = omc_List_splitOnTrue(threadData, _e_lst, boxvar_Expression_isConstValue ,&_notconst_es1);

          if((!listEmpty(_const_es1)))
          {
            _res1 = omc_ExpressionSimplify_simplifyBinaryAddConstants(threadData, _const_es1);

            _res2 = omc_Expression_makeSum1(threadData, _notconst_es1, 0 /* false */);

            _res = omc_Expression_expAdd(threadData, _res1, _res2);
          }
          else
          {
            _res = _inExp;
          }
          tmpMeta1 = _res;
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 4) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixProduct4(threadData_t *threadData, modelica_metatype _inMatrix1, modelica_metatype _inMatrix2)
{
  modelica_metatype _outDimensions = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outDimensions has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;
    tmp4_1 = _inMatrix1;
    tmp4_2 = _inMatrix2;
    {
      modelica_metatype _n = NULL;
      modelica_metatype _m = NULL;
      modelica_metatype _p = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _n has no default value.
      // _m has no default value.
      // _p has no default value.
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,6,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 3));
          if (listEmpty(tmpMeta7)) goto tmp3_end;
          tmpMeta8 = MMC_CAR(tmpMeta7);
          tmpMeta9 = MMC_CDR(tmpMeta7);
          if (!listEmpty(tmpMeta9)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta10,6,2) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta10), 3));
          if (listEmpty(tmpMeta11)) goto tmp3_end;
          tmpMeta12 = MMC_CAR(tmpMeta11);
          tmpMeta13 = MMC_CDR(tmpMeta11);
          if (listEmpty(tmpMeta13)) goto tmp3_end;
          tmpMeta14 = MMC_CAR(tmpMeta13);
          tmpMeta15 = MMC_CDR(tmpMeta13);
          if (!listEmpty(tmpMeta15)) goto tmp3_end;
          
          _n = tmpMeta12;
          /* Pattern matching succeeded */
          tmpMeta16 = mmc_mk_cons(_n, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = tmpMeta16;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta17,6,2) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta17), 3));
          if (listEmpty(tmpMeta18)) goto tmp3_end;
          tmpMeta19 = MMC_CAR(tmpMeta18);
          tmpMeta20 = MMC_CDR(tmpMeta18);
          if (!listEmpty(tmpMeta20)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta21,6,2) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta21), 3));
          if (listEmpty(tmpMeta22)) goto tmp3_end;
          tmpMeta23 = MMC_CAR(tmpMeta22);
          tmpMeta24 = MMC_CDR(tmpMeta22);
          if (listEmpty(tmpMeta24)) goto tmp3_end;
          tmpMeta25 = MMC_CAR(tmpMeta24);
          tmpMeta26 = MMC_CDR(tmpMeta24);
          if (!listEmpty(tmpMeta26)) goto tmp3_end;
          
          _m = tmpMeta23;
          /* Pattern matching succeeded */
          tmpMeta27 = mmc_mk_cons(_m, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = tmpMeta27;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta28,6,2) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta28), 3));
          if (listEmpty(tmpMeta29)) goto tmp3_end;
          tmpMeta30 = MMC_CAR(tmpMeta29);
          tmpMeta31 = MMC_CDR(tmpMeta29);
          if (listEmpty(tmpMeta31)) goto tmp3_end;
          tmpMeta32 = MMC_CAR(tmpMeta31);
          tmpMeta33 = MMC_CDR(tmpMeta31);
          if (!listEmpty(tmpMeta33)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta34,6,2) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta34), 3));
          if (listEmpty(tmpMeta35)) goto tmp3_end;
          tmpMeta36 = MMC_CAR(tmpMeta35);
          tmpMeta37 = MMC_CDR(tmpMeta35);
          if (listEmpty(tmpMeta37)) goto tmp3_end;
          tmpMeta38 = MMC_CAR(tmpMeta37);
          tmpMeta39 = MMC_CDR(tmpMeta37);
          if (!listEmpty(tmpMeta39)) goto tmp3_end;
          
          _n = tmpMeta30;
          _p = tmpMeta36;
          /* Pattern matching succeeded */
          tmpMeta40 = mmc_mk_cons(_n, mmc_mk_cons(_p, MMC_REFSTRUCTLIT(mmc_nil)));
          tmpMeta1 = tmpMeta40;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outDimensions = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outDimensions;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixProduct3(threadData_t *threadData, modelica_metatype _inRow, modelica_metatype _inMatrix)
{
  modelica_metatype _outRow = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outRow has no default value.
  _outRow = omc_List_map1r(threadData, _inMatrix, boxvar_ExpressionSimplify_simplifyScalarProduct, _inRow);
  _return: OMC_LABEL_UNUSED
  return _outRow;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixProduct2(threadData_t *threadData, modelica_metatype _inMatrix1, modelica_metatype _inMatrix2)
{
  modelica_metatype _outProduct = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outProduct has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;
    tmp4_1 = _inMatrix1;
    tmp4_2 = _inMatrix2;
    {
      modelica_metatype _n = NULL;
      modelica_metatype _m = NULL;
      modelica_metatype _p = NULL;
      modelica_metatype _expl1 = NULL;
      modelica_metatype _expl2 = NULL;
      modelica_metatype _ty = NULL;
      modelica_metatype _row_ty = NULL;
      modelica_metatype _matrix = NULL;
      modelica_metatype _zero = NULL;
      modelica_metatype _dims = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _n has no default value.
      // _m has no default value.
      // _p has no default value.
      // _expl1 has no default value.
      // _expl2 has no default value.
      // _ty has no default value.
      // _row_ty has no default value.
      // _matrix has no default value.
      // _zero has no default value.
      // _dims has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_boolean tmp8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,6,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 3));
          
          _ty = tmpMeta6;
          _dims = tmpMeta7;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp8 = omc_Expression_arrayContainZeroDimension(threadData, _dims);
          if (1 /* true */ != tmp8) goto goto_2;

          _zero = omc_Expression_makeConstZero(threadData, _ty);

          _dims = omc_ExpressionSimplify_simplifyMatrixProduct4(threadData, _inMatrix1, _inMatrix2);
          tmpMeta1 = omc_Expression_arrayFill(threadData, _dims, _zero);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,6,2) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 3));
          if (listEmpty(tmpMeta10)) goto tmp3_end;
          tmpMeta11 = MMC_CAR(tmpMeta10);
          tmpMeta12 = MMC_CDR(tmpMeta10);
          if (!listEmpty(tmpMeta12)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta13,6,2) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 2));
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 3));
          if (listEmpty(tmpMeta15)) goto tmp3_end;
          tmpMeta16 = MMC_CAR(tmpMeta15);
          tmpMeta17 = MMC_CDR(tmpMeta15);
          if (listEmpty(tmpMeta17)) goto tmp3_end;
          tmpMeta18 = MMC_CAR(tmpMeta17);
          tmpMeta19 = MMC_CDR(tmpMeta17);
          if (!listEmpty(tmpMeta19)) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _ty = tmpMeta14;
          _n = tmpMeta16;
          _expl1 = tmpMeta20;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          _expl1 = omc_List_map1(threadData, _expl1, boxvar_ExpressionSimplify_simplifyScalarProduct, _inMatrix2);

          tmpMeta21 = mmc_mk_cons(_n, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta22 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _ty, tmpMeta21);
          _ty = tmpMeta22;
          tmpMeta23 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _ty, mmc_mk_boolean(1 /* true */), _expl1);
          tmpMeta1 = tmpMeta23;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta24,6,2) == 0) goto tmp3_end;
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta24), 3));
          if (listEmpty(tmpMeta25)) goto tmp3_end;
          tmpMeta26 = MMC_CAR(tmpMeta25);
          tmpMeta27 = MMC_CDR(tmpMeta25);
          if (!listEmpty(tmpMeta27)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta28,6,2) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta28), 2));
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta28), 3));
          if (listEmpty(tmpMeta30)) goto tmp3_end;
          tmpMeta31 = MMC_CAR(tmpMeta30);
          tmpMeta32 = MMC_CDR(tmpMeta30);
          if (listEmpty(tmpMeta32)) goto tmp3_end;
          tmpMeta33 = MMC_CAR(tmpMeta32);
          tmpMeta34 = MMC_CDR(tmpMeta32);
          if (!listEmpty(tmpMeta34)) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _ty = tmpMeta29;
          _m = tmpMeta31;
          _expl2 = tmpMeta35;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          _expl1 = omc_List_map1r(threadData, _expl2, boxvar_ExpressionSimplify_simplifyScalarProduct, _inMatrix1);

          tmpMeta36 = mmc_mk_cons(_m, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta37 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _ty, tmpMeta36);
          _ty = tmpMeta37;
          tmpMeta38 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _ty, mmc_mk_boolean(1 /* true */), _expl1);
          tmpMeta1 = tmpMeta38;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta39 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta39,6,2) == 0) goto tmp3_end;
          tmpMeta40 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta39), 2));
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta39), 3));
          if (listEmpty(tmpMeta41)) goto tmp3_end;
          tmpMeta42 = MMC_CAR(tmpMeta41);
          tmpMeta43 = MMC_CDR(tmpMeta41);
          if (listEmpty(tmpMeta43)) goto tmp3_end;
          tmpMeta44 = MMC_CAR(tmpMeta43);
          tmpMeta45 = MMC_CDR(tmpMeta43);
          if (!listEmpty(tmpMeta45)) goto tmp3_end;
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta47,6,2) == 0) goto tmp3_end;
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta47), 3));
          if (listEmpty(tmpMeta48)) goto tmp3_end;
          tmpMeta49 = MMC_CAR(tmpMeta48);
          tmpMeta50 = MMC_CDR(tmpMeta48);
          if (listEmpty(tmpMeta50)) goto tmp3_end;
          tmpMeta51 = MMC_CAR(tmpMeta50);
          tmpMeta52 = MMC_CDR(tmpMeta50);
          if (!listEmpty(tmpMeta52)) goto tmp3_end;
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _ty = tmpMeta40;
          _n = tmpMeta42;
          _expl1 = tmpMeta46;
          _p = tmpMeta49;
          _expl2 = tmpMeta53;
          /* Pattern matching succeeded */
          _matrix = omc_List_map1(threadData, _expl1, boxvar_ExpressionSimplify_simplifyMatrixProduct3, _expl2);

          tmpMeta54 = mmc_mk_cons(_p, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta55 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _ty, tmpMeta54);
          _row_ty = tmpMeta55;

          _expl1 = omc_List_map2(threadData, _matrix, boxvar_Expression_makeArray, _row_ty, mmc_mk_boolean(1 /* true */));
          tmpMeta56 = mmc_mk_cons(_n, mmc_mk_cons(_p, MMC_REFSTRUCTLIT(mmc_nil)));
          tmpMeta57 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _ty, tmpMeta56);
          tmpMeta58 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, tmpMeta57, mmc_mk_boolean(0 /* false */), _expl1);
          tmpMeta1 = tmpMeta58;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 4) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outProduct = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outProduct;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixProduct(threadData_t *threadData, modelica_metatype _inMatrix1, modelica_metatype _inMatrix2)
{
  modelica_metatype _outProduct = NULL;
  modelica_metatype _mat1 = NULL;
  modelica_metatype _mat2 = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outProduct has no default value.
  // _mat1 has no default value.
  // _mat2 has no default value.
  _mat1 = omc_Expression_matrixToArray(threadData, _inMatrix1);

  _mat2 = omc_Expression_matrixToArray(threadData, _inMatrix2);

  _mat2 = omc_Expression_transposeArray(threadData, _mat2, NULL);

  _outProduct = omc_ExpressionSimplify_simplifyMatrixProduct2(threadData, _mat1, _mat2);
  _return: OMC_LABEL_UNUSED
  return _outProduct;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixPow1(threadData_t *threadData, modelica_metatype _inRange, modelica_metatype _inMatrix, modelica_metatype _inValue)
{
  modelica_metatype _outMatrix = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outMatrix has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;volatile modelica_metatype tmp4_3;
    tmp4_1 = _inRange;
    tmp4_2 = _inMatrix;
    tmp4_3 = _inValue;
    {
      modelica_metatype _rm = NULL;
      modelica_metatype _rm1 = NULL;
      modelica_metatype _row = NULL;
      modelica_metatype _row1 = NULL;
      modelica_metatype _e = NULL;
      modelica_integer _i;
      modelica_metatype _rr = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _rm has no default value.
      // _rm1 has no default value.
      // _row has no default value.
      // _row1 has no default value.
      // _e has no default value.
      // _i has no default value.
      // _rr has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (!listEmpty(tmp4_1)) goto tmp3_end;
          if (!listEmpty(tmp4_2)) goto tmp3_end;
          
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta6 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_integer tmp9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta7 = MMC_CAR(tmp4_1);
          tmpMeta8 = MMC_CDR(tmp4_1);
          tmp9 = mmc_unbox_integer(tmpMeta7);
          if (!listEmpty(tmpMeta8)) goto tmp3_end;
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta10 = MMC_CAR(tmp4_2);
          tmpMeta11 = MMC_CDR(tmp4_2);
          if (!listEmpty(tmpMeta11)) goto tmp3_end;
          
          _i = tmp9  /* pattern as ty=Integer */;
          _row = tmpMeta10;
          _e = tmp4_3;
          /* Pattern matching succeeded */
          _row1 = omc_List_replaceAt(threadData, _e, ((modelica_integer) 1) + _i, _row);
          tmpMeta12 = mmc_mk_cons(_row1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = tmpMeta12;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_integer tmp15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta13 = MMC_CAR(tmp4_1);
          tmpMeta14 = MMC_CDR(tmp4_1);
          tmp15 = mmc_unbox_integer(tmpMeta13);
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta16 = MMC_CAR(tmp4_2);
          tmpMeta17 = MMC_CDR(tmp4_2);
          
          _i = tmp15  /* pattern as ty=Integer */;
          _rr = tmpMeta14;
          _row = tmpMeta16;
          _rm = tmpMeta17;
          _e = tmp4_3;
          /* Pattern matching succeeded */
          _row1 = omc_List_replaceAt(threadData, _e, ((modelica_integer) 1) + _i, _row);

          _rm1 = omc_ExpressionSimplify_simplifyMatrixPow1(threadData, _rr, _rm, _e);
          tmpMeta18 = mmc_mk_cons(_row1, _rm1);
          tmpMeta1 = tmpMeta18;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 3) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outMatrix = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outMatrix;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixPow(threadData_t *threadData, modelica_metatype _inExp1, modelica_metatype _inType, modelica_metatype _inExp2)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;
    tmp4_1 = _inExp1;
    tmp4_2 = _inExp2;
    {
      modelica_metatype _expl_1 = NULL;
      modelica_metatype _expl2 = NULL;
      modelica_metatype _el = NULL;
      modelica_metatype _tp1 = NULL;
      modelica_integer _size1;
      modelica_integer _i;
      modelica_integer _i_1;
      modelica_metatype _range = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _m = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _expl_1 has no default value.
      // _expl2 has no default value.
      // _el has no default value.
      // _tp1 has no default value.
      // _size1 has no default value.
      // _i has no default value.
      // _i_1 has no default value.
      // _range has no default value.
      // _e has no default value.
      // _m has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 5; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_integer tmp8;
          modelica_metatype tmpMeta9;
          modelica_integer tmp10;
          modelica_integer tmp11;
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp8 = mmc_unbox_integer(tmpMeta7);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp10 = mmc_unbox_integer(tmpMeta9);
          _tp1 = tmpMeta6;
          _size1 = tmp8  /* pattern as ty=Integer */;
          _i = tmp10  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp11 = _i;
          if (0 != tmp11) goto goto_2;

          _el = omc_List_fill(threadData, _OMC_LIT20, _size1);

          _expl2 = omc_List_fill(threadData, _el, _size1);

          _range = omc_List_intRange2(threadData, ((modelica_integer) 0), ((modelica_integer) -1) + _size1);

          _expl_1 = omc_ExpressionSimplify_simplifyMatrixPow1(threadData, _range, _expl2, _OMC_LIT27);
          tmpMeta12 = mmc_mk_box4(20, &DAE_Exp_MATRIX__desc, _tp1, mmc_mk_integer(_size1), _expl_1);
          tmpMeta1 = tmpMeta12;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta13;
          modelica_integer tmp14;
          modelica_integer tmp15;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp14 = mmc_unbox_integer(tmpMeta13);
          _m = tmp4_1;
          _i = tmp14  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp15 = _i;
          if (1 != tmp15) goto goto_2;
          tmpMeta1 = _m;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta16;
          modelica_integer tmp17;
          modelica_integer tmp18;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp17 = mmc_unbox_integer(tmpMeta16);
          _m = tmp4_1;
          _i = tmp17  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp18 = _i;
          if (2 != tmp18) goto goto_2;
          tmpMeta1 = omc_ExpressionSimplify_simplifyMatrixProduct(threadData, _m, _m);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_integer tmp21;
          modelica_boolean tmp22;
          modelica_integer tmp23;
          modelica_integer tmp24;
          modelica_metatype tmpMeta25;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp21 = mmc_unbox_integer(tmpMeta20);
          _m = tmp4_1;
          _tp1 = tmpMeta19;
          _i = tmp21  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp22 = (_i > ((modelica_integer) 3));
          if (1 /* true */ != tmp22) goto goto_2;

          /* Pattern-matching assignment */
          tmp23 = modelica_integer_mod(_i, ((modelica_integer) 2));
          if (0 != tmp23) goto goto_2;

          tmp24 = ((modelica_integer) 2);
          if (tmp24 == 0) {goto goto_2;}
          _i_1 = modelica_div_integer(_i,tmp24).quot;

          tmpMeta25 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_i_1));
          _e = omc_ExpressionSimplify_simplifyMatrixPow(threadData, _m, _tp1, tmpMeta25);
          tmpMeta1 = omc_ExpressionSimplify_simplifyMatrixProduct(threadData, _e, _e);
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_integer tmp28;
          modelica_boolean tmp29;
          modelica_metatype tmpMeta30;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp28 = mmc_unbox_integer(tmpMeta27);
          _m = tmp4_1;
          _tp1 = tmpMeta26;
          _i = tmp28  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp29 = (((modelica_integer) 1) < _i);
          if (1 /* true */ != tmp29) goto goto_2;

          _i_1 = ((modelica_integer) -1) + _i;

          tmpMeta30 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_i_1));
          _e = omc_ExpressionSimplify_simplifyMatrixPow(threadData, _m, _tp1, tmpMeta30);
          tmpMeta1 = omc_ExpressionSimplify_simplifyMatrixProduct(threadData, _m, _e);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 5) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixBinary2(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inRhs, modelica_metatype _inOperator)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _op = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _op has no default value.
  _op = omc_ExpressionSimplify_removeOperatorDimension(threadData, _inOperator);

  tmpMeta1 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _inLhs, _op, _inRhs);
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixBinary1(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inRhs, modelica_metatype _inOperator)
{
  modelica_metatype _outExpl = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExpl has no default value.
  _outExpl = omc_List_threadMap1(threadData, _inLhs, _inRhs, boxvar_ExpressionSimplify_simplifyMatrixBinary2, _inOperator);
  _return: OMC_LABEL_UNUSED
  return _outExpl;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatrixBinary(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inOperator, modelica_metatype _inRhs)
{
  modelica_metatype _outResult = NULL;
  modelica_metatype _lhs = NULL;
  modelica_metatype _rhs = NULL;
  modelica_metatype _res = NULL;
  modelica_metatype _op = NULL;
  modelica_integer _sz;
  modelica_metatype _ty = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outResult has no default value.
  // _lhs has no default value.
  // _rhs has no default value.
  // _res has no default value.
  // _op has no default value.
  // _sz has no default value.
  // _ty has no default value.
  _lhs = omc_Expression_get2dArrayOrMatrixContent(threadData, _inLhs);

  _rhs = omc_Expression_get2dArrayOrMatrixContent(threadData, _inRhs);

  _op = omc_ExpressionSimplify_removeOperatorDimension(threadData, _inOperator);

  _res = omc_List_threadMap1(threadData, _lhs, _rhs, boxvar_ExpressionSimplify_simplifyMatrixBinary1, _op);

  _sz = listLength(_res);

  _ty = omc_Expression_typeof(threadData, _inLhs);

  tmpMeta1 = mmc_mk_box4(20, &DAE_Exp_MATRIX__desc, _ty, mmc_mk_integer(_sz), _res);
  _outResult = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outResult;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyVectorBinary2(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inRhs, modelica_metatype _inOperator)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  tmpMeta1 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _inLhs, _inOperator, _inRhs);
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyVectorBinary(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inOperator, modelica_metatype _inRhs)
{
  modelica_metatype _outResult = NULL;
  modelica_metatype _ty = NULL;
  modelica_boolean _sc;
  modelica_metatype _lhs = NULL;
  modelica_metatype _rhs = NULL;
  modelica_metatype _res = NULL;
  modelica_metatype _op = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_integer tmp4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  modelica_metatype tmpMeta8;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outResult has no default value.
  // _ty has no default value.
  // _sc has no default value.
  // _lhs has no default value.
  // _rhs has no default value.
  // _res has no default value.
  // _op has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _inLhs;
  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta1,16,3) == 0) MMC_THROW_INTERNAL();
  tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 2));
  tmpMeta3 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 3));
  tmp4 = mmc_unbox_integer(tmpMeta3);
  tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 4));
  _ty = tmpMeta2;
  _sc = tmp4  /* pattern as ty=Boolean */;
  _lhs = tmpMeta5;

  /* Pattern-matching assignment */
  tmpMeta6 = _inRhs;
  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,16,3) == 0) MMC_THROW_INTERNAL();
  tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 4));
  _rhs = tmpMeta7;

  _op = omc_ExpressionSimplify_removeOperatorDimension(threadData, _inOperator);

  _res = omc_List_threadMap1(threadData, _lhs, _rhs, boxvar_ExpressionSimplify_simplifyVectorBinary2, _op);

  tmpMeta8 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _ty, mmc_mk_boolean(_sc), _res);
  _outResult = tmpMeta8;
  _return: OMC_LABEL_UNUSED
  return _outResult;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyVectorBinary0(threadData_t *threadData, modelica_metatype _e1, modelica_metatype _op, modelica_metatype _e2)
{
  modelica_metatype _res = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;
    tmp4_1 = _op;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 6; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyVectorBinary(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 1: {
          modelica_boolean tmp6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp6 = omc_Expression_isZero(threadData, _e1);
          if (1 /* true */ != tmp6) goto goto_2;
          tmpMeta1 = _e2;
          goto tmp3_done;
        }
        case 2: {
          modelica_boolean tmp7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,1) == 0) goto tmp3_end;
          
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp7 = omc_Expression_isZero(threadData, _e1);
          if (1 /* true */ != tmp7) goto goto_2;
          tmpMeta1 = _e2;
          goto tmp3_done;
        }
        case 3: {
          modelica_boolean tmp8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,1) == 0) goto tmp3_end;
          
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp8 = omc_Expression_isZero(threadData, _e1);
          if (1 /* true */ != tmp8) goto goto_2;
          tmpMeta1 = omc_Expression_negate(threadData, _e2);
          goto tmp3_done;
        }
        case 4: {
          modelica_boolean tmp9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp9 = omc_Expression_isZero(threadData, _e1);
          if (1 /* true */ != tmp9) goto goto_2;
          tmpMeta1 = omc_Expression_negate(threadData, _e2);
          goto tmp3_done;
        }
        case 5: {
          modelica_boolean tmp10;
          
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp10 = omc_Expression_isZero(threadData, _e2);
          if (1 /* true */ != tmp10) goto goto_2;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 6) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _res = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _res;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyVectorScalar(threadData_t *threadData, modelica_metatype _inLhs, modelica_metatype _inOperator, modelica_metatype _inRhs)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_metatype tmp4_3;
    tmp4_1 = _inLhs;
    tmp4_2 = _inOperator;
    tmp4_3 = _inRhs;
    {
      modelica_metatype _s1 = NULL;
      modelica_metatype _op = NULL;
      modelica_metatype _tp = NULL;
      modelica_boolean _sc;
      modelica_metatype _es = NULL;
      modelica_metatype _mexpl = NULL;
      modelica_integer _dims;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _s1 has no default value.
      // _op has no default value.
      // _tp has no default value.
      // _sc has no default value.
      // _es has no default value.
      // _mexpl has no default value.
      // _dims has no default value.
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_integer tmp8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,16,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          tmp8 = mmc_unbox_integer(tmpMeta7);
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _tp = tmpMeta6;
          _sc = tmp8  /* pattern as ty=Boolean */;
          _es = tmpMeta9;
          /* Pattern matching succeeded */
          {
            modelica_metatype __omcQ_24tmpVar25;
            modelica_metatype* tmp11;
            modelica_metatype tmpMeta12;
            modelica_metatype __omcQ_24tmpVar24;
            modelica_integer tmp13;
            modelica_metatype _e_loopVar = 0;
            modelica_metatype _e;
            _e_loopVar = _es;
            tmpMeta12 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar25 = tmpMeta12; /* defaultValue */
            tmp11 = &__omcQ_24tmpVar25;
            while(1) {
              tmp13 = 1;
              if (!listEmpty(_e_loopVar)) {
                _e = MMC_CAR(_e_loopVar);
                _e_loopVar = MMC_CDR(_e_loopVar);
                tmp13--;
              }
              if (tmp13 == 0) {
                __omcQ_24tmpVar24 = omc_Expression_makeBinaryExp(threadData, _inLhs, _inOperator, _e);
                *tmp11 = mmc_mk_cons(__omcQ_24tmpVar24,0);
                tmp11 = &MMC_CDR(*tmp11);
              } else if (tmp13 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp11 = mmc_mk_nil();
            tmpMeta10 = __omcQ_24tmpVar25;
          }
          _es = tmpMeta10;
          tmpMeta14 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _tp, mmc_mk_boolean(_sc), _es);
          tmpMeta1 = tmpMeta14;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_integer tmp17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,17,3) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          tmp17 = mmc_unbox_integer(tmpMeta16);
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 4));
          
          _tp = tmpMeta15;
          _dims = tmp17  /* pattern as ty=Integer */;
          _mexpl = tmpMeta18;
          _s1 = tmp4_1;
          _op = tmp4_2;
          /* Pattern matching succeeded */
          _mexpl = omc_ExpressionSimplify_simplifyVectorScalarMatrix(threadData, _mexpl, _op, _s1, 0 /* false */);
          tmpMeta19 = mmc_mk_box4(20, &DAE_Exp_MATRIX__desc, _tp, mmc_mk_integer(_dims), _mexpl);
          tmpMeta1 = tmpMeta19;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_integer tmp22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp22 = mmc_unbox_integer(tmpMeta21);
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _tp = tmpMeta20;
          _sc = tmp22  /* pattern as ty=Boolean */;
          _es = tmpMeta23;
          /* Pattern matching succeeded */
          _es = omc_List_map2(threadData, _es, boxvar_Expression_makeBinaryExp, _inOperator, _inRhs);
          tmpMeta24 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _tp, mmc_mk_boolean(_sc), _es);
          tmpMeta1 = tmpMeta24;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_integer tmp27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp27 = mmc_unbox_integer(tmpMeta26);
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _tp = tmpMeta25;
          _dims = tmp27  /* pattern as ty=Integer */;
          _mexpl = tmpMeta28;
          _op = tmp4_2;
          _s1 = tmp4_3;
          /* Pattern matching succeeded */
          _mexpl = omc_ExpressionSimplify_simplifyVectorScalarMatrix(threadData, _mexpl, _op, _s1, 1 /* true */);
          tmpMeta29 = mmc_mk_box4(20, &DAE_Exp_MATRIX__desc, _tp, mmc_mk_integer(_dims), _mexpl);
          tmpMeta1 = tmpMeta29;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_unliftOperator(threadData_t *threadData, modelica_metatype _inArray, modelica_metatype _inOperator)
{
  modelica_metatype _outOperator = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outOperator has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inArray;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_Expression_unliftOperatorX(threadData, _inOperator, ((modelica_integer) 2));
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_Expression_unliftOperator(threadData, _inOperator);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outOperator = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outOperator;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyScalarProduct(threadData_t *threadData, modelica_metatype _inVector1, modelica_metatype _inVector2)
{
  modelica_metatype _outProduct = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outProduct has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;
    tmp4_1 = _inVector1;
    tmp4_2 = _inVector2;
    {
      modelica_metatype _expl = NULL;
      modelica_metatype _expl1 = NULL;
      modelica_metatype _expl2 = NULL;
      modelica_metatype _tp = NULL;
      modelica_metatype _cr1 = NULL;
      modelica_metatype _cr2 = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _expl has no default value.
      // _expl1 has no default value.
      // _expl2 has no default value.
      // _tp has no default value.
      // _cr1 has no default value.
      // _cr2 has no default value.
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (!listEmpty(tmpMeta7)) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          if (!listEmpty(tmpMeta8)) goto tmp3_end;
          _tp = tmpMeta6;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_Expression_makeConstZero(threadData, _tp);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_boolean tmp11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,3) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          _expl1 = tmpMeta9;
          _expl2 = tmpMeta10;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp11 = (omc_Expression_isVector(threadData, _inVector1) && omc_Expression_isVector(threadData, _inVector2));
          if (1 /* true */ != tmp11) goto goto_2;

          _expl = omc_List_threadMap(threadData, _expl1, _expl2, boxvar_Expression_expMul);
          tmpMeta1 = omc_List_reduce(threadData, _expl, boxvar_Expression_expAdd);
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_boolean tmp18;
          modelica_metatype tmpMeta19;
          modelica_boolean tmp23;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,6,2) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          
          _cr1 = tmpMeta12;
          _cr2 = tmpMeta13;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(!stringEqual(omc_Config_simCodeTarget(threadData), _OMC_LIT61))) goto tmp3_end;
          {
            modelica_metatype __omcQ_24tmpVar21;
            modelica_metatype* tmp15;
            modelica_metatype tmpMeta16;
            modelica_metatype __omcQ_24tmpVar20;
            modelica_integer tmp17;
            modelica_metatype _c_loopVar = 0;
            modelica_metatype _c;
            _c_loopVar = omc_ComponentReference_expandCref(threadData, _cr1, 1 /* true */);
            tmpMeta16 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar21 = tmpMeta16; /* defaultValue */
            tmp15 = &__omcQ_24tmpVar21;
            while(1) {
              tmp17 = 1;
              if (!listEmpty(_c_loopVar)) {
                _c = MMC_CAR(_c_loopVar);
                _c_loopVar = MMC_CDR(_c_loopVar);
                tmp17--;
              }
              if (tmp17 == 0) {
                __omcQ_24tmpVar20 = omc_Expression_crefToExp(threadData, _c);
                *tmp15 = mmc_mk_cons(__omcQ_24tmpVar20,0);
                tmp15 = &MMC_CDR(*tmp15);
              } else if (tmp17 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp15 = mmc_mk_nil();
            tmpMeta14 = __omcQ_24tmpVar21;
          }
          _expl1 = tmpMeta14;

          /* Pattern-matching assignment */
          tmp18 = (listLength(_expl1) <= ((modelica_integer) 3));
          if (1 /* true */ != tmp18) goto goto_2;

          {
            modelica_metatype __omcQ_24tmpVar23;
            modelica_metatype* tmp20;
            modelica_metatype tmpMeta21;
            modelica_metatype __omcQ_24tmpVar22;
            modelica_integer tmp22;
            modelica_metatype _c_loopVar = 0;
            modelica_metatype _c;
            _c_loopVar = omc_ComponentReference_expandCref(threadData, _cr2, 1 /* true */);
            tmpMeta21 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar23 = tmpMeta21; /* defaultValue */
            tmp20 = &__omcQ_24tmpVar23;
            while(1) {
              tmp22 = 1;
              if (!listEmpty(_c_loopVar)) {
                _c = MMC_CAR(_c_loopVar);
                _c_loopVar = MMC_CDR(_c_loopVar);
                tmp22--;
              }
              if (tmp22 == 0) {
                __omcQ_24tmpVar22 = omc_Expression_crefToExp(threadData, _c);
                *tmp20 = mmc_mk_cons(__omcQ_24tmpVar22,0);
                tmp20 = &MMC_CDR(*tmp20);
              } else if (tmp22 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp20 = mmc_mk_nil();
            tmpMeta19 = __omcQ_24tmpVar23;
          }
          _expl2 = tmpMeta19;

          /* Pattern-matching assignment */
          tmp23 = (listLength(_expl1) == listLength(_expl2));
          if (1 /* true */ != tmp23) goto goto_2;

          _expl = omc_List_threadMap(threadData, _expl1, _expl2, boxvar_Expression_expMul);
          tmpMeta1 = omc_List_reduce(threadData, _expl, boxvar_Expression_expAdd);
          goto tmp3_done;
        }
        case 3: {
          modelica_boolean tmp24;
          
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp24 = (omc_Expression_isZero(threadData, _inVector1) || omc_Expression_isZero(threadData, _inVector2));
          if (1 /* true */ != tmp24) goto goto_2;
          tmpMeta1 = omc_Expression_makeConstZero(threadData, _OMC_LIT30);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outProduct = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outProduct;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBinaryArray(threadData_t *threadData, modelica_metatype _inExp1, modelica_metatype _inOperator2, modelica_metatype _inExp3)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;volatile modelica_metatype tmp4_3;
    tmp4_1 = _inExp1;
    tmp4_2 = _inOperator2;
    tmp4_3 = _inExp3;
    {
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _s1 = NULL;
      modelica_metatype _a1 = NULL;
      modelica_metatype _tp = NULL;
      modelica_metatype _op = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e1 has no default value.
      // _e2 has no default value.
      // _s1 has no default value.
      // _a1 has no default value.
      // _tp has no default value.
      // _op has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 20; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,15,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 8; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyMatrixProduct(threadData, _e1, _e2);
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,1) == 0) goto tmp3_end;
          
          _op = tmp4_2;
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 6; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyVectorBinary0(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 2: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,8,1) == 0) goto tmp3_end;
          
          _op = tmp4_2;
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyVectorBinary0(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 3: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,9,1) == 0) goto tmp3_end;
          
          _op = tmp4_2;
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyVectorBinary(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 4: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,10,1) == 0) goto tmp3_end;
          
          _op = tmp4_2;
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyVectorBinary(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 5: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,20,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          _tp = omc_Expression_typeof(threadData, _e1);
          tmpMeta1 = omc_ExpressionSimplify_simplifyMatrixPow(threadData, _e1, _tp, _e2);
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,21,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          _tp = omc_Expression_typeof(threadData, _e1);
          tmpMeta6 = mmc_mk_box2(24, &DAE_Operator_POW__ARR2__desc, _tp);
          tmpMeta1 = omc_ExpressionSimplify_simplifyVectorBinary(threadData, _e1, tmpMeta6, _e2);
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,8,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,8,2) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _tp = tmpMeta7;
          _e2 = tmpMeta8;
          _e1 = tmp4_1;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta9 = mmc_mk_box2(10, &DAE_Operator_ADD__ARR__desc, _tp);
          tmpMeta10 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta9, _e2);
          tmpMeta1 = tmpMeta10;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,1) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,8,2) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 3));
          
          _tp = tmpMeta11;
          _e2 = tmpMeta12;
          _e1 = tmp4_1;
          /* Pattern matching succeeded */
          tmpMeta13 = mmc_mk_box2(11, &DAE_Operator_SUB__ARR__desc, _tp);
          tmpMeta14 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, tmpMeta13, _e2);
          tmpMeta1 = tmpMeta14;
          goto tmp3_done;
        }
        case 9: {
          modelica_boolean tmp15;
          
          _a1 = tmp4_1;
          _op = tmp4_2;
          _s1 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp15 = omc_Expression_isArrayScalarOp(threadData, _op);
          if (1 /* true */ != tmp15) goto goto_2;

          _op = omc_ExpressionSimplify_unliftOperator(threadData, _a1, _op);
          tmpMeta1 = omc_ExpressionSimplify_simplifyVectorScalar(threadData, _a1, _op, _s1);
          goto tmp3_done;
        }
        case 10: {
          modelica_boolean tmp16;
          
          _s1 = tmp4_1;
          _op = tmp4_2;
          _a1 = tmp4_3;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp16 = omc_Expression_isScalarArrayOp(threadData, _op);
          if (1 /* true */ != tmp16) goto goto_2;

          _op = omc_ExpressionSimplify_unliftOperator(threadData, _a1, _op);
          tmpMeta1 = omc_ExpressionSimplify_simplifyVectorScalar(threadData, _s1, _op, _a1);
          goto tmp3_done;
        }
        case 11: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,14,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 8; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyScalarProduct(threadData, _e1, _e2);
          goto tmp3_done;
        }
        case 12: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,1) == 0) goto tmp3_end;
          
          _op = tmp4_2;
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyMatrixBinary(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 13: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,8,1) == 0) goto tmp3_end;
          
          _op = tmp4_2;
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 6; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyMatrixBinary(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 14: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,9,1) == 0) goto tmp3_end;
          
          _op = tmp4_2;
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyMatrixBinary(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 15: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,10,1) == 0) goto tmp3_end;
          
          _op = tmp4_2;
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyMatrixBinary(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 16: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,21,1) == 0) goto tmp3_end;
          
          _op = tmp4_2;
          _e1 = tmp4_1;
          _e2 = tmp4_3;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyMatrixBinary(threadData, _e1, _op, _e2);
          goto tmp3_done;
        }
        case 17: {
          modelica_metatype tmpMeta17;
          modelica_boolean tmp18;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,11,1) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          
          _tp = tmpMeta17;
          _e2 = tmp4_3;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp18 = omc_Expression_isZero(threadData, _e2);
          if (1 /* true */ != tmp18) goto goto_2;
          tmpMeta1 = omc_Expression_makeZeroExpression(threadData, omc_Expression_arrayDimension(threadData, _tp), NULL);
          goto tmp3_done;
        }
        case 18: {
          modelica_boolean tmp19;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,10,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_1;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp19 = omc_Expression_isZero(threadData, _e1);
          if (1 /* true */ != tmp19) goto goto_2;

          _tp = omc_Expression_typeof(threadData, _e1);
          tmpMeta1 = omc_Expression_makeZeroExpression(threadData, omc_Expression_arrayDimension(threadData, _tp), NULL);
          goto tmp3_done;
        }
        case 19: {
          modelica_boolean tmp20;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,16,1) == 0) goto tmp3_end;
          
          _e1 = tmp4_1;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp20 = omc_Expression_isZero(threadData, _e1);
          if (1 /* true */ != tmp20) goto goto_2;

          _tp = omc_Expression_typeof(threadData, _e1);
          tmpMeta1 = omc_Expression_makeZeroExpression(threadData, omc_Expression_arrayDimension(threadData, _tp), NULL);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 20) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_boolean omc_ExpressionSimplify_simplifyBinaryArrayOp(threadData_t *threadData, modelica_metatype _inOperator)
{
  modelica_boolean _found;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _found has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inOperator;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 18: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 10: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 11: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 12: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 13: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 23: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 24: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 14: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 15: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 19: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 21: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 16: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 20: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 22: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 17: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmp1 = 0 /* false */;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _found = tmp1;
  _return: OMC_LABEL_UNUSED
  return _found;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyBinaryArrayOp(threadData_t *threadData, modelica_metatype _inOperator)
{
  modelica_boolean _found;
  modelica_metatype out_found;
  _found = omc_ExpressionSimplify_simplifyBinaryArrayOp(threadData, _inOperator);
  out_found = mmc_mk_icon(_found);
  return out_found;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplify2(threadData_t *threadData, modelica_metatype _inExp, modelica_boolean _simplifyAddOrSub, modelica_boolean _simplifyMulOrDiv)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _ty = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _ty has no default value.
  _ty = omc_Expression_typeof(threadData, _inExp);

  if((!omc_Expression_isIntegerOrReal(threadData, _ty)))
  {
    _outExp = _inExp;

    goto _return;
  }

  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _exp_2 = NULL;
      modelica_metatype _exp_3 = NULL;
      modelica_metatype _resConst = NULL;
      modelica_metatype _lstConstExp = NULL;
      modelica_metatype _lstExp = NULL;
      modelica_metatype _op = NULL;
      modelica_boolean _hasConst;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e1 has no default value.
      // _e2 has no default value.
      // _exp_2 has no default value.
      // _exp_3 has no default value.
      // _resConst has no default value.
      // _lstConstExp has no default value.
      // _lstExp has no default value.
      // _op has no default value.
      // _hasConst has no default value.
      tmp4 = 0;
      for (; tmp4 < 7; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_boolean tmp7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _op = tmpMeta6;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(_simplifyAddOrSub && omc_Expression_isAddOrSub(threadData, _op))) goto tmp3_end;
          _lstExp = omc_Expression_terms(threadData, _inExp);

          _lstConstExp = omc_List_splitOnTrue(threadData, _lstExp, boxvar_Expression_isConstValue ,&_lstExp);

          _hasConst = (!listEmpty(_lstConstExp));

          _resConst = (_hasConst?omc_ExpressionSimplify_simplifyBinaryAddConstants(threadData, _lstConstExp):omc_Expression_makeConstZero(threadData, _ty));

          _exp_2 = (_hasConst?omc_Expression_makeSum1(threadData, _lstExp, 0 /* false */):_inExp);

          _exp_3 = omc_ExpressionSimplify_simplifyBinaryCoeff(threadData, _exp_2);
          tmp7 = (modelica_boolean)_hasConst;
          if(tmp7)
          {
            tmpMeta8 = omc_Expression_expAdd(threadData, _resConst, omc_ExpressionSimplify_simplify2(threadData, _exp_3, 0 /* false */, 1 /* true */));
          }
          else
          {
            /* Tail recursive call */
            _inExp = _exp_3;
            _simplifyAddOrSub = 0 /* false */;
            _simplifyMulOrDiv = 1 /* true */;
            goto _tailrecursive;
            /* TODO: Make sure any eventual dead code below is never generated */
          }
          tmpMeta1 = tmpMeta8;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta9;
          _op = tmpMeta10;
          _e2 = tmpMeta11;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isAddOrSub(threadData, _op)) goto tmp3_end;
          _e1 = omc_ExpressionSimplify_simplify2(threadData, _e1, 0 /* false */, 1 /* true */);

          _e2 = omc_ExpressionSimplify_simplify2(threadData, _e2, 0 /* false */, 1 /* true */);
          tmpMeta12 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op, _e2);
          tmpMeta1 = tmpMeta12;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _op = tmpMeta13;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(_simplifyMulOrDiv && omc_Expression_isMulOrDiv(threadData, _op))) goto tmp3_end;
          _lstExp = omc_Expression_factors(threadData, _inExp);

          _lstConstExp = omc_List_splitOnTrue(threadData, _lstExp, boxvar_Expression_isConst ,&_lstExp);

          if((!listEmpty(_lstConstExp)))
          {
            _resConst = omc_ExpressionSimplify_simplifyBinaryMulConstants(threadData, _lstConstExp);

            _exp_2 = omc_Expression_makeProductLst(threadData, (omc_Types_isScalarReal(threadData, omc_Expression_typeofOp(threadData, _op))?omc_ExpressionSimplify_simplifyMul(threadData, _lstExp):_lstExp));

            if(omc_Expression_isConstOne(threadData, _resConst))
            {
              _exp_3 = omc_ExpressionSimplify_simplify2(threadData, _exp_2, 1 /* true */, 0 /* false */);
            }
            else
            {
              if(omc_Expression_isConstMinusOne(threadData, _resConst))
              {
                _exp_3 = omc_Expression_negate(threadData, omc_ExpressionSimplify_simplify2(threadData, _exp_2, 1 /* true */, 0 /* false */));
              }
              else
              {
                _exp_3 = omc_Expression_expMul(threadData, _resConst, omc_ExpressionSimplify_simplify2(threadData, _exp_2, 1 /* true */, 0 /* false */));
              }
            }
          }
          else
          {
            _exp_2 = omc_ExpressionSimplify_simplifyBinaryCoeff(threadData, _inExp);

            _exp_3 = omc_ExpressionSimplify_simplify2(threadData, _exp_2, 1 /* true */, 0 /* false */);
          }
          tmpMeta1 = _exp_3;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta14;
          _op = tmpMeta15;
          _e2 = tmpMeta16;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isMulOrDiv(threadData, _op)) goto tmp3_end;
          _e1 = omc_ExpressionSimplify_simplify2(threadData, _e1, 1 /* true */, 0 /* false */);

          _e2 = omc_ExpressionSimplify_simplify2(threadData, _e2, 1 /* true */, 0 /* false */);
          tmpMeta17 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op, _e2);
          tmpMeta1 = tmpMeta17;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta18;
          _op = tmpMeta19;
          _e2 = tmpMeta20;
          /* Pattern matching succeeded */
          _e1 = omc_ExpressionSimplify_simplify2(threadData, _e1, 1 /* true */, 1 /* true */);

          _e2 = omc_ExpressionSimplify_simplify2(threadData, _e2, 1 /* true */, 1 /* true */);
          tmpMeta21 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op, _e2);
          tmpMeta1 = tmpMeta21;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,2) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _op = tmpMeta22;
          _e1 = tmpMeta23;
          /* Pattern matching succeeded */
          _e1 = omc_ExpressionSimplify_simplify2(threadData, _e1, 1 /* true */, 1 /* true */);
          tmpMeta24 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op, _e1);
          tmpMeta1 = tmpMeta24;
          goto tmp3_done;
        }
        case 6: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}
modelica_metatype boxptr_ExpressionSimplify_simplify2(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _simplifyAddOrSub, modelica_metatype _simplifyMulOrDiv)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _outExp = NULL;
  tmp1 = mmc_unbox_integer(_simplifyAddOrSub);
  tmp2 = mmc_unbox_integer(_simplifyMulOrDiv);
  _outExp = omc_ExpressionSimplify_simplify2(threadData, _inExp, tmp1, tmp2);
  /* skip box _outExp; DAE.Exp */
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCrefMM1(threadData_t *threadData, modelica_string _ident, modelica_metatype _ty, modelica_metatype _ssl)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _ssl;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (!listEmpty(tmp4_1)) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta6 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta7 = mmc_mk_box4(4, &DAE_ComponentRef_CREF__IDENT__desc, _ident, _ty, tmpMeta6);
          tmpMeta8 = mmc_mk_box3(9, &DAE_Exp_CREF__desc, tmpMeta7, _ty);
          tmpMeta1 = tmpMeta8;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          
          /* Pattern matching succeeded */
          tmpMeta9 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta10 = mmc_mk_box4(4, &DAE_ComponentRef_CREF__IDENT__desc, _ident, _ty, tmpMeta9);
          tmpMeta11 = mmc_mk_box3(9, &DAE_Exp_CREF__desc, tmpMeta10, _ty);
          tmpMeta12 = mmc_mk_box3(24, &DAE_Exp_ASUB__desc, tmpMeta11, _ssl);
          tmpMeta1 = tmpMeta12;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCrefMM(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inType, modelica_metatype _inCref)
{
  modelica_metatype _exp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inCref;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_boolean tmp7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,3) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _exp = omc_ExpressionSimplify_simplifyCrefMM__index(threadData, _inExp, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inCref), 2))), _inType);
          tmp7 = (modelica_boolean)listEmpty((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inCref), 4))));
          if(tmp7)
          {
            tmpMeta8 = _exp;
          }
          else
          {
            tmpMeta6 = mmc_mk_box3(24, &DAE_Exp_ASUB__desc, _exp, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inCref), 4))));
            tmpMeta8 = tmpMeta6;
          }
          tmpMeta1 = tmpMeta8;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_boolean tmp10;
          modelica_metatype tmpMeta11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,4) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _exp = omc_ExpressionSimplify_simplifyCrefMM__index(threadData, _inExp, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inCref), 2))), _inType);

          tmp10 = (modelica_boolean)listEmpty((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inCref), 4))));
          if(tmp10)
          {
            tmpMeta11 = _exp;
          }
          else
          {
            tmpMeta9 = mmc_mk_box3(24, &DAE_Exp_ASUB__desc, _exp, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inCref), 4))));
            tmpMeta11 = tmpMeta9;
          }
          _exp = tmpMeta11;
          /* Tail recursive call */
          _inExp = _exp;
          _inType = omc_Expression_typeof(threadData, _exp);
          _inCref = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inCref), 5)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCrefMM__index(threadData_t *threadData, modelica_metatype _inExp, modelica_string _ident, modelica_metatype _ty)
{
  modelica_metatype _exp = NULL;
  modelica_integer _index;
  modelica_metatype _nty = NULL;
  modelica_metatype _ty2 = NULL;
  modelica_metatype _fields = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  // _index has no default value.
  // _nty has no default value.
  // _ty2 has no default value.
  // _fields has no default value.
  _fields = omc_Types_getMetaRecordFields(threadData, _ty);

  _index = ((modelica_integer) 1) + omc_Types_findVarIndex(threadData, _ident, _fields);

  /* Pattern-matching assignment */
  tmpMeta1 = listGet(_fields, _index);
  tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 4));
  _nty = tmpMeta2;

  tmpMeta3 = mmc_mk_box5(26, &DAE_Exp_RSUB__desc, _inExp, mmc_mk_integer(_index), _ident, _nty);
  _exp = tmpMeta3;
  _return: OMC_LABEL_UNUSED
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCref2(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inSsl)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;
    tmp4_1 = _inExp;
    tmp4_2 = _inSsl;
    {
      modelica_metatype _t = NULL;
      modelica_metatype _tp = NULL;
      modelica_metatype _exp_1 = NULL;
      modelica_metatype _exp = NULL;
      modelica_metatype _expl_1 = NULL;
      modelica_metatype _expl = NULL;
      modelica_metatype _ss = NULL;
      modelica_metatype _ssl = NULL;
      modelica_metatype _subs = NULL;
      modelica_metatype _crefs = NULL;
      modelica_metatype _cr = NULL;
      modelica_integer _dim;
      modelica_boolean _sc;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _t has no default value.
      // _tp has no default value.
      // _exp_1 has no default value.
      // _exp has no default value.
      // _expl_1 has no default value.
      // _expl has no default value.
      // _ss has no default value.
      // _ssl has no default value.
      // _subs has no default value.
      // _crefs has no default value.
      // _cr has no default value.
      // _dim has no default value.
      // _sc has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (!listEmpty(tmp4_2)) goto tmp3_end;
          
          _exp_1 = tmp4_1;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _exp_1;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,1,3) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta8 = MMC_CAR(tmp4_2);
          tmpMeta9 = MMC_CDR(tmp4_2);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,1) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta10,16,3) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta10), 4));
          _cr = tmpMeta6;
          _t = tmpMeta7;
          _expl_1 = tmpMeta11;
          _ssl = tmpMeta9;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          _subs = omc_List_map(threadData, _expl_1, boxvar_Expression_makeIndexSubscript);

          _crefs = omc_List_map1r(threadData, omc_List_map(threadData, _subs, boxvar_List_create), boxvar_ComponentReference_subscriptCref, _cr);

          _t = omc_Types_unliftArray(threadData, _t);

          _expl = omc_List_map1(threadData, _crefs, boxvar_Expression_makeCrefExp, _t);

          _dim = listLength(_expl);
          tmpMeta13 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_dim));
          tmpMeta12 = mmc_mk_cons(tmpMeta13, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta14 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _t, tmpMeta12);
          tmpMeta15 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, tmpMeta14, mmc_mk_boolean(1 /* true */), _expl);
          tmpMeta1 = omc_ExpressionSimplify_simplifyCref2(threadData, tmpMeta15, _ssl);
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta16,1,3) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta18 = MMC_CAR(tmp4_2);
          tmpMeta19 = MMC_CDR(tmp4_2);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,1,1) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta20,18,4) == 0) goto tmp3_end;
          
          _cr = tmpMeta16;
          _t = tmpMeta17;
          _ss = tmpMeta18;
          _ssl = tmpMeta19;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          _subs = omc_Expression_expandSliceExp(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ss), 2))));

          {
            modelica_metatype __omcQ_24tmpVar27;
            modelica_metatype* tmp22;
            modelica_metatype tmpMeta23;
            modelica_metatype __omcQ_24tmpVar26;
            modelica_integer tmp24;
            modelica_metatype _s_loopVar = 0;
            modelica_metatype _s;
            _s_loopVar = _subs;
            tmpMeta23 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar27 = tmpMeta23; /* defaultValue */
            tmp22 = &__omcQ_24tmpVar27;
            while(1) {
              tmp24 = 1;
              if (!listEmpty(_s_loopVar)) {
                _s = MMC_CAR(_s_loopVar);
                _s_loopVar = MMC_CDR(_s_loopVar);
                tmp24--;
              }
              if (tmp24 == 0) {
                __omcQ_24tmpVar26 = omc_ComponentReference_subscriptCref(threadData, _cr, omc_List_create(threadData, _s));
                *tmp22 = mmc_mk_cons(__omcQ_24tmpVar26,0);
                tmp22 = &MMC_CDR(*tmp22);
              } else if (tmp24 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp22 = mmc_mk_nil();
            tmpMeta21 = __omcQ_24tmpVar27;
          }
          _crefs = tmpMeta21;

          _t = omc_Types_unliftArray(threadData, _t);

          {
            modelica_metatype __omcQ_24tmpVar29;
            modelica_metatype* tmp26;
            modelica_metatype tmpMeta27;
            modelica_metatype __omcQ_24tmpVar28;
            modelica_integer tmp28;
            modelica_metatype _cr_loopVar = 0;
            modelica_metatype _cr;
            _cr_loopVar = _crefs;
            tmpMeta27 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar29 = tmpMeta27; /* defaultValue */
            tmp26 = &__omcQ_24tmpVar29;
            while(1) {
              tmp28 = 1;
              if (!listEmpty(_cr_loopVar)) {
                _cr = MMC_CAR(_cr_loopVar);
                _cr_loopVar = MMC_CDR(_cr_loopVar);
                tmp28--;
              }
              if (tmp28 == 0) {
                __omcQ_24tmpVar28 = omc_Expression_makeCrefExp(threadData, _cr, _t);
                *tmp26 = mmc_mk_cons(__omcQ_24tmpVar28,0);
                tmp26 = &MMC_CDR(*tmp26);
              } else if (tmp28 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp26 = mmc_mk_nil();
            tmpMeta25 = __omcQ_24tmpVar29;
          }
          _expl = tmpMeta25;

          _dim = listLength(_expl);

          tmpMeta30 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_dim));
          tmpMeta29 = mmc_mk_cons(tmpMeta30, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta31 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _t, tmpMeta29);
          tmpMeta32 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, tmpMeta31, mmc_mk_boolean(1 /* true */), _expl);
          _exp = tmpMeta32;
          tmpMeta1 = omc_ExpressionSimplify_simplifyCref2(threadData, _exp, _ssl);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_integer tmp35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp35 = mmc_unbox_integer(tmpMeta34);
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _tp = tmpMeta33;
          _sc = tmp35  /* pattern as ty=Boolean */;
          _expl = tmpMeta36;
          _ssl = tmp4_2;
          /* Pattern matching succeeded */
          _expl = omc_List_map1(threadData, _expl, boxvar_ExpressionSimplify_simplifyCref2, _ssl);
          tmpMeta37 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _tp, mmc_mk_boolean(_sc), _expl);
          tmpMeta1 = tmpMeta37;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 4) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCref(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inCREF, modelica_metatype _inType)
{
  modelica_metatype _exp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;
    tmp4_1 = _inCREF;
    {
      modelica_metatype _t2 = NULL;
      modelica_metatype _ssl = NULL;
      modelica_metatype _cr = NULL;
      modelica_string _idn = NULL;
      modelica_metatype _expCref = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _t2 has no default value.
      // _ssl has no default value.
      // _cr has no default value.
      // _idn has no default value.
      // _expCref has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (listEmpty(tmpMeta8)) goto tmp3_end;
          tmpMeta9 = MMC_CAR(tmpMeta8);
          tmpMeta10 = MMC_CDR(tmpMeta8);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,1,1) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta11,16,3) == 0) goto tmp3_end;
          
          _idn = tmpMeta6;
          _t2 = tmpMeta7;
          _ssl = tmpMeta8;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta12 = MMC_REFSTRUCTLIT(mmc_nil);
          _cr = omc_ComponentReference_makeCrefIdent(threadData, _idn, _t2, tmpMeta12);

          _expCref = omc_Expression_makeCrefExp(threadData, _cr, _inType);
          tmpMeta1 = omc_ExpressionSimplify_simplifyCref2(threadData, _expCref, _ssl);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,3) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (listEmpty(tmpMeta13)) goto tmp3_end;
          tmpMeta14 = MMC_CAR(tmpMeta13);
          tmpMeta15 = MMC_CDR(tmpMeta13);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta14,1,1) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta14), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta16,18,4) == 0) goto tmp3_end;
          
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          _cr = omc_ComponentReference_crefStripSubs(threadData, _inCREF);

          _expCref = omc_Expression_makeCrefExp(threadData, _cr, _inType);
          tmpMeta1 = omc_ExpressionSimplify_simplifyCref2(threadData, _expCref, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inCREF), 4))));
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,4) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,25,1) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 2));
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          _idn = tmpMeta17;
          _t2 = tmpMeta19;
          _ssl = tmpMeta20;
          _cr = tmpMeta21;
          /* Pattern matching succeeded */
          _exp = omc_ExpressionSimplify_simplifyCrefMM1(threadData, _idn, _t2, _ssl);
          tmpMeta1 = omc_ExpressionSimplify_simplifyCrefMM(threadData, _exp, omc_Expression_typeof(threadData, _exp), _cr);
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 4) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBuiltinConstantCalls(threadData_t *threadData, modelica_string _name, modelica_metatype _exp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_string tmp4_1;volatile modelica_metatype tmp4_2;
    tmp4_1 = _name;
    tmp4_2 = _exp;
    {
      modelica_real _r;
      modelica_real _v1;
      modelica_real _v2;
      modelica_integer _i;
      modelica_integer _j;
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _r has no default value.
      // _v1 has no default value.
      // _v2 has no default value.
      // _i has no default value.
      // _j has no default value.
      // _e has no default value.
      // _e1 has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 23; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT62), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta6)) goto tmp3_end;
          tmpMeta7 = MMC_CAR(tmpMeta6);
          tmpMeta8 = MMC_CDR(tmpMeta6);
          if (!listEmpty(tmpMeta8)) goto tmp3_end;
          
          _e = tmpMeta7;
          tmp4 += 22; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyBuiltinConstantDer(threadData, _e);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT63), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta9)) goto tmp3_end;
          tmpMeta10 = MMC_CAR(tmpMeta9);
          tmpMeta11 = MMC_CDR(tmpMeta9);
          if (!listEmpty(tmpMeta11)) goto tmp3_end;
          
          _e = tmpMeta10;
          tmp4 += 21; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          if (8 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT64), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta12)) goto tmp3_end;
          tmpMeta13 = MMC_CAR(tmpMeta12);
          tmpMeta14 = MMC_CDR(tmpMeta12);
          if (!listEmpty(tmpMeta14)) goto tmp3_end;
          
          _e = tmpMeta13;
          tmp4 += 20; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          if (4 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT65), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta15)) goto tmp3_end;
          tmpMeta16 = MMC_CAR(tmpMeta15);
          tmpMeta17 = MMC_CDR(tmpMeta15);
          if (!listEmpty(tmpMeta17)) goto tmp3_end;
          
          tmp4 += 19; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _OMC_LIT22;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          if (6 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT66), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta18)) goto tmp3_end;
          tmpMeta19 = MMC_CAR(tmpMeta18);
          tmpMeta20 = MMC_CDR(tmpMeta18);
          if (!listEmpty(tmpMeta20)) goto tmp3_end;
          
          tmp4 += 18; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _OMC_LIT22;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_real tmp24;
          modelica_metatype tmpMeta25;
          if (4 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta21)) goto tmp3_end;
          tmpMeta22 = MMC_CAR(tmpMeta21);
          tmpMeta23 = MMC_CDR(tmpMeta21);
          if (!listEmpty(tmpMeta23)) goto tmp3_end;
          
          _e = tmpMeta22;
          tmp4 += 17; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmp24 = omc_Expression_toReal(threadData, _e);
          if(!(tmp24 >= 0.0))
          {
            FILE_INFO info = {"",0,0,0,0,0};
            omc_assert(threadData, info, "Model error: Argument of sqrt(Expression.toReal(e)) was %g should be >= 0", tmp24);
          }
          _r = sqrt(tmp24);
          tmpMeta25 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta25;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_real tmp30;
          modelica_metatype tmpMeta31;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT24), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta26)) goto tmp3_end;
          tmpMeta27 = MMC_CAR(tmpMeta26);
          tmpMeta28 = MMC_CDR(tmpMeta26);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta27,1,1) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 2));
          tmp30 = mmc_unbox_real(tmpMeta29);
          if (!listEmpty(tmpMeta28)) goto tmp3_end;
          
          _r = tmp30  /* pattern as ty=Real */;
          tmp4 += 16; /* Pattern matching succeeded; we may skip some cases if we fail */
          _r = fabs(_r);
          tmpMeta31 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta31;
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_integer tmp36;
          modelica_metatype tmpMeta37;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT24), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta32)) goto tmp3_end;
          tmpMeta33 = MMC_CAR(tmpMeta32);
          tmpMeta34 = MMC_CDR(tmpMeta32);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta33,0,1) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta33), 2));
          tmp36 = mmc_unbox_integer(tmpMeta35);
          if (!listEmpty(tmpMeta34)) goto tmp3_end;
          
          _i = tmp36  /* pattern as ty=Integer */;
          tmp4 += 15; /* Pattern matching succeeded; we may skip some cases if we fail */
          _i = labs(_i);
          tmpMeta37 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_i));
          tmpMeta1 = tmpMeta37;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT39), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta38 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta38)) goto tmp3_end;
          tmpMeta39 = MMC_CAR(tmpMeta38);
          tmpMeta40 = MMC_CDR(tmpMeta38);
          if (!listEmpty(tmpMeta40)) goto tmp3_end;
          
          _e = tmpMeta39;
          tmp4 += 14; /* Pattern matching succeeded; we may skip some cases if we fail */
          _r = sin(omc_Expression_toReal(threadData, _e));
          tmpMeta41 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta41;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT38), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta42)) goto tmp3_end;
          tmpMeta43 = MMC_CAR(tmpMeta42);
          tmpMeta44 = MMC_CDR(tmpMeta42);
          if (!listEmpty(tmpMeta44)) goto tmp3_end;
          
          _e = tmpMeta43;
          tmp4 += 13; /* Pattern matching succeeded; we may skip some cases if we fail */
          _r = cos(omc_Expression_toReal(threadData, _e));
          tmpMeta45 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta45;
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_boolean tmp49;
          modelica_real tmp50;
          modelica_metatype tmpMeta51;
          if (4 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT67), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta46)) goto tmp3_end;
          tmpMeta47 = MMC_CAR(tmpMeta46);
          tmpMeta48 = MMC_CDR(tmpMeta46);
          if (!listEmpty(tmpMeta48)) goto tmp3_end;
          
          _e = tmpMeta47;
          tmp4 += 12; /* Pattern matching succeeded; we may skip some cases if we fail */
          _r = omc_Expression_toReal(threadData, _e);

          /* Pattern-matching assignment */
          tmp49 = ((_r >= -1.0) && (_r <= 1.0));
          if (1 /* true */ != tmp49) goto goto_2;

          tmp50 = _r;
          if(!(tmp50 >= -1.0 && tmp50 <= 1.0))
          {
            FILE_INFO info = {"",0,0,0,0,0};
            omc_assert(threadData, info, "Model error: Argument of asin(r) outside the domain -1.0 <= %g <= 1.0", tmp50);
          }
          _r = asin(tmp50);
          tmpMeta51 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta51;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_boolean tmp55;
          modelica_real tmp56;
          modelica_metatype tmpMeta57;
          if (4 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT68), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta52)) goto tmp3_end;
          tmpMeta53 = MMC_CAR(tmpMeta52);
          tmpMeta54 = MMC_CDR(tmpMeta52);
          if (!listEmpty(tmpMeta54)) goto tmp3_end;
          
          _e = tmpMeta53;
          tmp4 += 11; /* Pattern matching succeeded; we may skip some cases if we fail */
          _r = omc_Expression_toReal(threadData, _e);

          /* Pattern-matching assignment */
          tmp55 = ((_r >= -1.0) && (_r <= 1.0));
          if (1 /* true */ != tmp55) goto goto_2;

          tmp56 = omc_Expression_toReal(threadData, _e);
          if(!(tmp56 >= -1.0 && tmp56 <= 1.0))
          {
            FILE_INFO info = {"",0,0,0,0,0};
            omc_assert(threadData, info, "Model error: Argument of acos(Expression.toReal(e)) outside the domain -1.0 <= %g <= 1.0", tmp56);
          }
          _r = acos(tmp56);
          tmpMeta57 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta57;
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta58;
          modelica_metatype tmpMeta59;
          modelica_metatype tmpMeta60;
          modelica_metatype tmpMeta61;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT37), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta58 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta58)) goto tmp3_end;
          tmpMeta59 = MMC_CAR(tmpMeta58);
          tmpMeta60 = MMC_CDR(tmpMeta58);
          if (!listEmpty(tmpMeta60)) goto tmp3_end;
          
          _e = tmpMeta59;
          tmp4 += 10; /* Pattern matching succeeded; we may skip some cases if we fail */
          _r = tan(omc_Expression_toReal(threadData, _e));
          tmpMeta61 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta61;
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT25), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta62)) goto tmp3_end;
          tmpMeta63 = MMC_CAR(tmpMeta62);
          tmpMeta64 = MMC_CDR(tmpMeta62);
          if (!listEmpty(tmpMeta64)) goto tmp3_end;
          
          _e = tmpMeta63;
          tmp4 += 9; /* Pattern matching succeeded; we may skip some cases if we fail */
          _r = exp(omc_Expression_toReal(threadData, _e));
          tmpMeta65 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta65;
          goto tmp3_done;
        }
        case 14: {
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          modelica_metatype tmpMeta68;
          modelica_boolean tmp69;
          modelica_real tmp70;
          modelica_metatype tmpMeta71;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT69), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta66 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta66)) goto tmp3_end;
          tmpMeta67 = MMC_CAR(tmpMeta66);
          tmpMeta68 = MMC_CDR(tmpMeta66);
          if (!listEmpty(tmpMeta68)) goto tmp3_end;
          
          _e = tmpMeta67;
          tmp4 += 8; /* Pattern matching succeeded; we may skip some cases if we fail */
          _r = omc_Expression_toReal(threadData, _e);

          /* Pattern-matching assignment */
          tmp69 = (_r > 0.0);
          if (1 /* true */ != tmp69) goto goto_2;

          tmp70 = _r;
          if(!(tmp70 > 0.0))
          {
            FILE_INFO info = {"",0,0,0,0,0};
            omc_assert(threadData, info, "Model error: Argument of log(r) was %g should be > 0", tmp70);
          }
          _r = log(tmp70);
          tmpMeta71 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta71;
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta72;
          modelica_metatype tmpMeta73;
          modelica_metatype tmpMeta74;
          modelica_boolean tmp75;
          modelica_real tmp76;
          modelica_metatype tmpMeta77;
          if (5 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT70), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta72 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta72)) goto tmp3_end;
          tmpMeta73 = MMC_CAR(tmpMeta72);
          tmpMeta74 = MMC_CDR(tmpMeta72);
          if (!listEmpty(tmpMeta74)) goto tmp3_end;
          
          _e = tmpMeta73;
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          _r = omc_Expression_toReal(threadData, _e);

          /* Pattern-matching assignment */
          tmp75 = (_r > 0.0);
          if (1 /* true */ != tmp75) goto goto_2;

          tmp76 = _r;
          if(!(tmp76 > 0.0))
          {
            FILE_INFO info = {"",0,0,0,0,0};
            omc_assert(threadData, info, "Model error: Argument of log10(r) was %g should be > 0", tmp76);
          }
          _r = log10(tmp76);
          tmpMeta77 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta77;
          goto tmp3_done;
        }
        case 16: {
          modelica_metatype tmpMeta78;
          modelica_metatype tmpMeta79;
          modelica_metatype tmpMeta80;
          modelica_metatype tmpMeta81;
          modelica_integer tmp82;
          modelica_metatype tmpMeta83;
          modelica_metatype tmpMeta84;
          modelica_metatype tmpMeta85;
          modelica_integer tmp86;
          modelica_metatype tmpMeta87;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta78 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta78)) goto tmp3_end;
          tmpMeta79 = MMC_CAR(tmpMeta78);
          tmpMeta80 = MMC_CDR(tmpMeta78);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta79,0,1) == 0) goto tmp3_end;
          tmpMeta81 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta79), 2));
          tmp82 = mmc_unbox_integer(tmpMeta81);
          if (listEmpty(tmpMeta80)) goto tmp3_end;
          tmpMeta83 = MMC_CAR(tmpMeta80);
          tmpMeta84 = MMC_CDR(tmpMeta80);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta83,0,1) == 0) goto tmp3_end;
          tmpMeta85 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta83), 2));
          tmp86 = mmc_unbox_integer(tmpMeta85);
          if (!listEmpty(tmpMeta84)) goto tmp3_end;
          
          _i = tmp82  /* pattern as ty=Integer */;
          _j = tmp86  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _i = modelica_integer_min((modelica_integer)(_i),(modelica_integer)(_j));
          tmpMeta87 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_i));
          tmpMeta1 = tmpMeta87;
          goto tmp3_done;
        }
        case 17: {
          modelica_metatype tmpMeta88;
          modelica_metatype tmpMeta89;
          modelica_metatype tmpMeta90;
          modelica_metatype tmpMeta91;
          modelica_metatype tmpMeta92;
          modelica_metatype tmpMeta93;
          modelica_metatype tmpMeta94;
          modelica_metatype tmpMeta95;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta88 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta88)) goto tmp3_end;
          tmpMeta89 = MMC_CAR(tmpMeta88);
          tmpMeta90 = MMC_CDR(tmpMeta88);
          if (listEmpty(tmpMeta90)) goto tmp3_end;
          tmpMeta91 = MMC_CAR(tmpMeta90);
          tmpMeta92 = MMC_CDR(tmpMeta90);
          if (!listEmpty(tmpMeta92)) goto tmp3_end;
          tmpMeta93 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          tmpMeta94 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta93), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta94,1,1) == 0) goto tmp3_end;
          
          _e = tmpMeta89;
          _e1 = tmpMeta91;
          /* Pattern matching succeeded */
          _v1 = omc_Expression_toReal(threadData, _e);

          _v2 = omc_Expression_toReal(threadData, _e1);

          _r = fmin(_v1,_v2);
          tmpMeta95 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta95;
          goto tmp3_done;
        }
        case 18: {
          modelica_metatype tmpMeta96;
          modelica_metatype tmpMeta97;
          modelica_metatype tmpMeta98;
          modelica_metatype tmpMeta99;
          modelica_integer tmp100;
          modelica_metatype tmpMeta101;
          modelica_metatype tmpMeta102;
          modelica_metatype tmpMeta103;
          modelica_integer tmp104;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta96 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta96)) goto tmp3_end;
          tmpMeta97 = MMC_CAR(tmpMeta96);
          tmpMeta98 = MMC_CDR(tmpMeta96);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta97,5,2) == 0) goto tmp3_end;
          tmpMeta99 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta97), 3));
          tmp100 = mmc_unbox_integer(tmpMeta99);
          if (listEmpty(tmpMeta98)) goto tmp3_end;
          tmpMeta101 = MMC_CAR(tmpMeta98);
          tmpMeta102 = MMC_CDR(tmpMeta98);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta101,5,2) == 0) goto tmp3_end;
          tmpMeta103 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta101), 3));
          tmp104 = mmc_unbox_integer(tmpMeta103);
          if (!listEmpty(tmpMeta102)) goto tmp3_end;
          
          _e = tmpMeta97;
          _i = tmp100  /* pattern as ty=Integer */;
          _e1 = tmpMeta101;
          _j = tmp104  /* pattern as ty=Integer */;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = ((_i < _j)?_e:_e1);
          goto tmp3_done;
        }
        case 19: {
          modelica_metatype tmpMeta105;
          modelica_metatype tmpMeta106;
          modelica_metatype tmpMeta107;
          modelica_metatype tmpMeta108;
          modelica_integer tmp109;
          modelica_metatype tmpMeta110;
          modelica_metatype tmpMeta111;
          modelica_metatype tmpMeta112;
          modelica_integer tmp113;
          modelica_metatype tmpMeta114;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta105 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta105)) goto tmp3_end;
          tmpMeta106 = MMC_CAR(tmpMeta105);
          tmpMeta107 = MMC_CDR(tmpMeta105);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta106,0,1) == 0) goto tmp3_end;
          tmpMeta108 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta106), 2));
          tmp109 = mmc_unbox_integer(tmpMeta108);
          if (listEmpty(tmpMeta107)) goto tmp3_end;
          tmpMeta110 = MMC_CAR(tmpMeta107);
          tmpMeta111 = MMC_CDR(tmpMeta107);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta110,0,1) == 0) goto tmp3_end;
          tmpMeta112 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta110), 2));
          tmp113 = mmc_unbox_integer(tmpMeta112);
          if (!listEmpty(tmpMeta111)) goto tmp3_end;
          
          _i = tmp109  /* pattern as ty=Integer */;
          _j = tmp113  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _i = modelica_integer_max((modelica_integer)(_i),(modelica_integer)(_j));
          tmpMeta114 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_i));
          tmpMeta1 = tmpMeta114;
          goto tmp3_done;
        }
        case 20: {
          modelica_metatype tmpMeta115;
          modelica_metatype tmpMeta116;
          modelica_metatype tmpMeta117;
          modelica_metatype tmpMeta118;
          modelica_metatype tmpMeta119;
          modelica_metatype tmpMeta120;
          modelica_metatype tmpMeta121;
          modelica_metatype tmpMeta122;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta115 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta115)) goto tmp3_end;
          tmpMeta116 = MMC_CAR(tmpMeta115);
          tmpMeta117 = MMC_CDR(tmpMeta115);
          if (listEmpty(tmpMeta117)) goto tmp3_end;
          tmpMeta118 = MMC_CAR(tmpMeta117);
          tmpMeta119 = MMC_CDR(tmpMeta117);
          if (!listEmpty(tmpMeta119)) goto tmp3_end;
          tmpMeta120 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 4));
          tmpMeta121 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta120), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta121,1,1) == 0) goto tmp3_end;
          
          _e = tmpMeta116;
          _e1 = tmpMeta118;
          /* Pattern matching succeeded */
          _v1 = omc_Expression_toReal(threadData, _e);

          _v2 = omc_Expression_toReal(threadData, _e1);

          _r = fmax(_v1,_v2);
          tmpMeta122 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta122;
          goto tmp3_done;
        }
        case 21: {
          modelica_metatype tmpMeta123;
          modelica_metatype tmpMeta124;
          modelica_metatype tmpMeta125;
          modelica_metatype tmpMeta126;
          modelica_integer tmp127;
          modelica_metatype tmpMeta128;
          modelica_metatype tmpMeta129;
          modelica_metatype tmpMeta130;
          modelica_integer tmp131;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta123 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta123)) goto tmp3_end;
          tmpMeta124 = MMC_CAR(tmpMeta123);
          tmpMeta125 = MMC_CDR(tmpMeta123);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta124,5,2) == 0) goto tmp3_end;
          tmpMeta126 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta124), 3));
          tmp127 = mmc_unbox_integer(tmpMeta126);
          if (listEmpty(tmpMeta125)) goto tmp3_end;
          tmpMeta128 = MMC_CAR(tmpMeta125);
          tmpMeta129 = MMC_CDR(tmpMeta125);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta128,5,2) == 0) goto tmp3_end;
          tmpMeta130 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta128), 3));
          tmp131 = mmc_unbox_integer(tmpMeta130);
          if (!listEmpty(tmpMeta129)) goto tmp3_end;
          
          _e = tmpMeta124;
          _i = tmp127  /* pattern as ty=Integer */;
          _e1 = tmpMeta128;
          _j = tmp131  /* pattern as ty=Integer */;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = ((_i > _j)?_e:_e1);
          goto tmp3_done;
        }
        case 22: {
          modelica_metatype tmpMeta132;
          modelica_metatype tmpMeta133;
          modelica_metatype tmpMeta134;
          modelica_metatype tmpMeta135;
          modelica_real tmp136;
          modelica_metatype tmpMeta137;
          if (4 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT43), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,13,3) == 0) goto tmp3_end;
          tmpMeta132 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (listEmpty(tmpMeta132)) goto tmp3_end;
          tmpMeta133 = MMC_CAR(tmpMeta132);
          tmpMeta134 = MMC_CDR(tmpMeta132);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta133,1,1) == 0) goto tmp3_end;
          tmpMeta135 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta133), 2));
          tmp136 = mmc_unbox_real(tmpMeta135);
          if (!listEmpty(tmpMeta134)) goto tmp3_end;
          
          _r = tmp136  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _i = ((_r == 0.0)?((modelica_integer) 0):((_r > 0.0)?((modelica_integer) 1):((modelica_integer) -1)));
          tmpMeta137 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_i));
          tmpMeta1 = tmpMeta137;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 23) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyStringAppendList(threadData_t *threadData, modelica_metatype _iexpl, modelica_metatype _iacc, modelica_boolean _ichange)
{
  modelica_metatype _exp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_boolean tmp4_3;
    tmp4_1 = _iexpl;
    tmp4_2 = _iacc;
    tmp4_3 = _ichange;
    {
      modelica_string _s1 = NULL;
      modelica_string _s2 = NULL;
      modelica_string _s = NULL;
      modelica_metatype _exp1 = NULL;
      modelica_metatype _exp2 = NULL;
      modelica_metatype _rest = NULL;
      modelica_metatype _acc = NULL;
      modelica_boolean _change;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _s1 has no default value.
      // _s2 has no default value.
      // _s has no default value.
      // _exp1 has no default value.
      // _exp2 has no default value.
      // _rest has no default value.
      // _acc has no default value.
      // _change has no default value.
      tmp4 = 0;
      for (; tmp4 < 6; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (!listEmpty(tmp4_1)) goto tmp3_end;
          if (!listEmpty(tmp4_2)) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT72;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (!listEmpty(tmp4_1)) goto tmp3_end;
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta6 = MMC_CAR(tmp4_2);
          tmpMeta7 = MMC_CDR(tmp4_2);
          if (!listEmpty(tmpMeta7)) goto tmp3_end;
          
          _exp = tmpMeta6;
          /* Pattern matching succeeded */
          tmpMeta1 = _exp;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          if (!listEmpty(tmp4_1)) goto tmp3_end;
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta8 = MMC_CAR(tmp4_2);
          tmpMeta9 = MMC_CDR(tmp4_2);
          if (listEmpty(tmpMeta9)) goto tmp3_end;
          tmpMeta10 = MMC_CAR(tmpMeta9);
          tmpMeta11 = MMC_CDR(tmpMeta9);
          if (!listEmpty(tmpMeta11)) goto tmp3_end;
          
          _exp1 = tmpMeta8;
          _exp2 = tmpMeta10;
          /* Pattern matching succeeded */
          tmpMeta12 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _exp2, _OMC_LIT74, _exp1);
          tmpMeta1 = tmpMeta12;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          if (1 /* true */ != tmp4_3) goto tmp3_end;
          if (!listEmpty(tmp4_1)) goto tmp3_end;
          
          _acc = tmp4_2;
          /* Pattern matching succeeded */
          _acc = listReverse(_acc);

          tmpMeta13 = mmc_mk_box2(31, &DAE_Exp_LIST__desc, _acc);
          _exp = tmpMeta13;
          tmpMeta14 = mmc_mk_cons(_exp, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT75, tmpMeta14, _OMC_LIT73);
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta15 = MMC_CAR(tmp4_1);
          tmpMeta16 = MMC_CDR(tmp4_1);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta15,2,1) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta15), 2));
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta18 = MMC_CAR(tmp4_2);
          tmpMeta19 = MMC_CDR(tmp4_2);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,2,1) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 2));
          
          _s1 = tmpMeta17;
          _rest = tmpMeta16;
          _s2 = tmpMeta20;
          _acc = tmpMeta19;
          /* Pattern matching succeeded */
          tmpMeta21 = stringAppend(_s2,_s1);
          _s = tmpMeta21;
          tmpMeta23 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _s);
          tmpMeta22 = mmc_mk_cons(tmpMeta23, _acc);
          /* Tail recursive call */
          _iexpl = _rest;
          _iacc = tmpMeta22;
          _ichange = 1 /* true */;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta24 = MMC_CAR(tmp4_1);
          tmpMeta25 = MMC_CDR(tmp4_1);
          
          _exp = tmpMeta24;
          _rest = tmpMeta25;
          _acc = tmp4_2;
          _change = tmp4_3;
          /* Pattern matching succeeded */
          tmpMeta26 = mmc_mk_cons(_exp, _acc);
          /* Tail recursive call */
          _iexpl = _rest;
          _iacc = tmpMeta26;
          _ichange = _change;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _exp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyStringAppendList(threadData_t *threadData, modelica_metatype _iexpl, modelica_metatype _iacc, modelica_metatype _ichange)
{
  modelica_integer tmp1;
  modelica_metatype _exp = NULL;
  tmp1 = mmc_unbox_integer(_ichange);
  _exp = omc_ExpressionSimplify_simplifyStringAppendList(threadData, _iexpl, _iacc, tmp1);
  /* skip box _exp; DAE.Exp */
  return _exp;
}

DLLDirection
modelica_string omc_ExpressionSimplify_cevalBuiltinStringFormat(threadData_t *threadData, modelica_string _inString, modelica_integer _stringLength, modelica_integer _minLength, modelica_boolean _leftJustified)
{
  modelica_string _outString = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_boolean tmp3;
  modelica_string tmp4;
  modelica_boolean tmp5;
  modelica_string tmp6;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outString has no default value.
  tmp5 = (modelica_boolean)(_stringLength >= _minLength);
  if(tmp5)
  {
    tmp6 = _inString;
  }
  else
  {
    tmp3 = (modelica_boolean)_leftJustified;
    if(tmp3)
    {
      tmpMeta1 = stringAppend(_inString,stringAppendList(omc_List_fill(threadData, _OMC_LIT76, _minLength - _stringLength)));
      tmp4 = tmpMeta1;
    }
    else
    {
      tmpMeta2 = stringAppend(stringAppendList(omc_List_fill(threadData, _OMC_LIT76, _minLength - _stringLength)),_inString);
      tmp4 = tmpMeta2;
    }
    tmp6 = tmp4;
  }
  _outString = tmp6;
  _return: OMC_LABEL_UNUSED
  return _outString;
}
modelica_metatype boxptr_ExpressionSimplify_cevalBuiltinStringFormat(threadData_t *threadData, modelica_metatype _inString, modelica_metatype _stringLength, modelica_metatype _minLength, modelica_metatype _leftJustified)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_integer tmp3;
  modelica_string _outString = NULL;
  tmp1 = mmc_unbox_integer(_stringLength);
  tmp2 = mmc_unbox_integer(_minLength);
  tmp3 = mmc_unbox_integer(_leftJustified);
  _outString = omc_ExpressionSimplify_cevalBuiltinStringFormat(threadData, _inString, tmp1, tmp2, tmp3);
  /* skip box _outString; String */
  return _outString;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBuiltinStringFormat(threadData_t *threadData, modelica_metatype _exp, modelica_metatype _len_exp, modelica_metatype _just_exp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_metatype tmp4_3;
    tmp4_1 = _exp;
    tmp4_2 = _len_exp;
    tmp4_3 = _just_exp;
    {
      modelica_integer _i;
      modelica_integer _len;
      modelica_real _r;
      modelica_boolean _b;
      modelica_boolean _just;
      modelica_string _str = NULL;
      modelica_metatype _name = NULL;
      int tmp4;
      // _i has no default value.
      // _len has no default value.
      // _r has no default value.
      // _b has no default value.
      // _just has no default value.
      // _str has no default value.
      // _name has no default value.
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          modelica_metatype tmpMeta5;
          modelica_integer tmp6;
          modelica_metatype tmpMeta7;
          modelica_integer tmp8;
          modelica_metatype tmpMeta9;
          modelica_integer tmp10;
          modelica_metatype tmpMeta11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp6 = mmc_unbox_integer(tmpMeta5);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp8 = mmc_unbox_integer(tmpMeta7);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp10 = mmc_unbox_integer(tmpMeta9);
          _i = tmp6  /* pattern as ty=Integer */;
          _len = tmp8  /* pattern as ty=Integer */;
          _just = tmp10  /* pattern as ty=Boolean */;
          /* Pattern matching succeeded */
          _str = intString(_i);

          _str = omc_ExpressionSimplify_cevalBuiltinStringFormat(threadData, _str, stringLength(_str), _len, _just);
          tmpMeta11 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _str);
          tmpMeta1 = tmpMeta11;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta12;
          modelica_real tmp13;
          modelica_metatype tmpMeta14;
          modelica_integer tmp15;
          modelica_metatype tmpMeta16;
          modelica_integer tmp17;
          modelica_metatype tmpMeta18;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp13 = mmc_unbox_real(tmpMeta12);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp15 = mmc_unbox_integer(tmpMeta14);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp17 = mmc_unbox_integer(tmpMeta16);
          _r = tmp13  /* pattern as ty=Real */;
          _len = tmp15  /* pattern as ty=Integer */;
          _just = tmp17  /* pattern as ty=Boolean */;
          /* Pattern matching succeeded */
          _str = realString(_r);

          _str = omc_ExpressionSimplify_cevalBuiltinStringFormat(threadData, _str, stringLength(_str), _len, _just);
          tmpMeta18 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _str);
          tmpMeta1 = tmpMeta18;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta19;
          modelica_integer tmp20;
          modelica_metatype tmpMeta21;
          modelica_integer tmp22;
          modelica_metatype tmpMeta23;
          modelica_integer tmp24;
          modelica_metatype tmpMeta25;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp20 = mmc_unbox_integer(tmpMeta19);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp22 = mmc_unbox_integer(tmpMeta21);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp24 = mmc_unbox_integer(tmpMeta23);
          _b = tmp20  /* pattern as ty=Boolean */;
          _len = tmp22  /* pattern as ty=Integer */;
          _just = tmp24  /* pattern as ty=Boolean */;
          /* Pattern matching succeeded */
          _str = (_b?_OMC_LIT77:_OMC_LIT78);

          _str = omc_ExpressionSimplify_cevalBuiltinStringFormat(threadData, _str, stringLength(_str), _len, _just);
          tmpMeta25 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _str);
          tmpMeta1 = tmpMeta25;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_integer tmp28;
          modelica_metatype tmpMeta29;
          modelica_integer tmp30;
          modelica_metatype tmpMeta31;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp28 = mmc_unbox_integer(tmpMeta27);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp30 = mmc_unbox_integer(tmpMeta29);
          _name = tmpMeta26;
          _len = tmp28  /* pattern as ty=Integer */;
          _just = tmp30  /* pattern as ty=Boolean */;
          /* Pattern matching succeeded */
          _str = omc_AbsynUtil_pathLastIdent(threadData, _name);

          _str = omc_ExpressionSimplify_cevalBuiltinStringFormat(threadData, _str, stringLength(_str), _len, _just);
          tmpMeta31 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _str);
          tmpMeta1 = tmpMeta31;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_evalCatGetFlatArray(threadData_t *threadData, modelica_metatype _e, modelica_integer _dim, modelica_fnptr _getArrayContents, modelica_fnptr _toString, modelica_metatype *out_outDims)
{
  modelica_metatype _outExps = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _outDims = NULL;
  modelica_metatype tmpMeta2;
  modelica_metatype _arr = NULL;
  modelica_metatype _dims = NULL;
  modelica_integer _i;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _outExps = tmpMeta1;
  tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
  _outDims = tmpMeta2;
  // _arr has no default value.
  // _dims has no default value.
  // _i has no default value.
  if((_dim == ((modelica_integer) 1)))
  {
    _outExps = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 2))), _e) : ((modelica_metatype(*)(threadData_t*, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 1)))) (threadData, _e);

    tmpMeta3 = mmc_mk_cons(mmc_mk_integer(listLength(_outExps)), MMC_REFSTRUCTLIT(mmc_nil));
    _outDims = tmpMeta3;

    goto _return;
  }

  _i = ((modelica_integer) 0);

  {
    modelica_metatype _exp;
    for (tmpMeta4 = listReverse((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 2))), _e) : ((modelica_metatype(*)(threadData_t*, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 1)))) (threadData, _e)); !listEmpty(tmpMeta4); tmpMeta4=MMC_CDR(tmpMeta4))
    {
      _exp = MMC_CAR(tmpMeta4);
      _arr = omc_ExpressionSimplify_evalCatGetFlatArray(threadData, _exp, ((modelica_integer) -1) + _dim, ((modelica_fnptr) _getArrayContents), ((modelica_fnptr) _toString) ,&_dims);

      if(listEmpty(_outDims))
      {
        _outDims = _dims;
      }
      else
      {
        if((!valueEq(_dims, _outDims)))
        {
          tmpMeta5 = stringAppend(_OMC_LIT79,(MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_toString), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_toString), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_toString), 2))), _e) : ((modelica_metatype(*)(threadData_t*, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_toString), 1)))) (threadData, _e));
          omc_Error_assertion(threadData, 0 /* false */, tmpMeta5, _OMC_LIT81);
        }
      }

      _outExps = listAppend(_arr, _outExps);

      _i = ((modelica_integer) 1) + _i;
    }
  }

  tmpMeta7 = mmc_mk_cons(mmc_mk_integer(_i), _outDims);
  _outDims = tmpMeta7;
  _return: OMC_LABEL_UNUSED
  if (out_outDims) { *out_outDims = _outDims; }
  return _outExps;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_evalCatGetFlatArray(threadData_t *threadData, modelica_metatype _e, modelica_metatype _dim, modelica_fnptr _getArrayContents, modelica_fnptr _toString, modelica_metatype *out_outDims)
{
  modelica_integer tmp1;
  modelica_metatype _outExps = NULL;
  modelica_metatype tmpMeta2;
  tmp1 = mmc_unbox_integer(_dim);
  _outExps = omc_ExpressionSimplify_evalCatGetFlatArray(threadData, _e, tmp1, _getArrayContents, _toString, out_outDims);
  /* skip box _outExps; list<polymorphic<Exp>> */
  /* skip box _outDims; list<#Integer> */
  return _outExps;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_evalCat(threadData_t *threadData, modelica_integer _dim, modelica_metatype _exps, modelica_fnptr _getArrayContents, modelica_fnptr _toString, modelica_metatype *out_outDims)
{
  modelica_metatype _outExps = NULL;
  modelica_metatype _outDims = NULL;
  modelica_metatype _arr = NULL;
  modelica_metatype _arrs = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _dims = NULL;
  modelica_metatype _firstDims = NULL;
  modelica_metatype tmpMeta2;
  modelica_metatype _lastDims = NULL;
  modelica_metatype _reverseDims = NULL;
  modelica_metatype _dimsLst = NULL;
  modelica_metatype tmpMeta3;
  modelica_integer _j;
  modelica_integer _k;
  modelica_integer _l;
  modelica_integer _thisDim;
  modelica_integer _lastDim;
  modelica_metatype _expArr = NULL;
  modelica_boolean tmp4;
  modelica_boolean tmp5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta9;
  modelica_metatype tmpMeta10;
  modelica_metatype tmpMeta11;
  modelica_metatype tmpMeta12;
  modelica_metatype tmpMeta13;
  modelica_integer tmp14;
  modelica_integer tmp16;
  modelica_string tmp18;
  modelica_metatype tmpMeta19;
  modelica_metatype tmpMeta20;
  modelica_metatype tmpMeta21;
  modelica_metatype tmpMeta25;
  modelica_metatype tmpMeta26;
  modelica_metatype tmpMeta27;
  modelica_integer tmp31;
  modelica_integer tmp32;
  modelica_integer tmp33;
  modelica_metatype tmpMeta34;
  modelica_integer tmp38;
  modelica_metatype tmpMeta40;
  modelica_integer tmp41;
  modelica_metatype tmpMeta43;
  modelica_metatype tmpMeta44;
  modelica_metatype tmpMeta45;
  modelica_metatype tmpMeta46;
  modelica_integer tmp47;
  modelica_metatype tmpMeta48;
  modelica_integer tmp49;
  modelica_metatype tmpMeta50;
  modelica_metatype tmpMeta51;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExps has no default value.
  // _outDims has no default value.
  // _arr has no default value.
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _arrs = tmpMeta1;
  // _dims has no default value.
  tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
  _firstDims = tmpMeta2;
  // _lastDims has no default value.
  // _reverseDims has no default value.
  tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
  _dimsLst = tmpMeta3;
  // _j has no default value.
  // _k has no default value.
  // _l has no default value.
  // _thisDim has no default value.
  // _lastDim has no default value.
  // _expArr has no default value.
  /* Pattern-matching assignment */
  tmp4 = (_dim >= ((modelica_integer) 1));
  if (1 /* true */ != tmp4) MMC_THROW_INTERNAL();

  /* Pattern-matching assignment */
  tmp5 = listEmpty(_exps);
  if (0 /* false */ != tmp5) MMC_THROW_INTERNAL();

  if((((modelica_integer) 1) == _dim))
  {
    {
      modelica_metatype __omcQ_24tmpVar31;
      modelica_metatype tmpMeta7;
      modelica_metatype __omcQ_24tmpVar30;
      modelica_integer tmp8;
      modelica_metatype _e_loopVar = 0;
      modelica_metatype _e;
      _e_loopVar = listReverse(_exps);
      tmpMeta7 = MMC_REFSTRUCTLIT(mmc_nil);
      __omcQ_24tmpVar31 = tmpMeta7; /* defaultValue */
      while(1) {
        tmp8 = 1;
        if (!listEmpty(_e_loopVar)) {
          _e = MMC_CAR(_e_loopVar);
          _e_loopVar = MMC_CDR(_e_loopVar);
          tmp8--;
        }
        if (tmp8 == 0) {
          __omcQ_24tmpVar30 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 2))), _e) : ((modelica_metatype(*)(threadData_t*, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_getArrayContents), 1)))) (threadData, _e);
          __omcQ_24tmpVar31 = listAppend(__omcQ_24tmpVar30, __omcQ_24tmpVar31);
        } else if (tmp8 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      tmpMeta6 = __omcQ_24tmpVar31;
    }
    _outExps = tmpMeta6;

    tmpMeta9 = mmc_mk_cons(mmc_mk_integer(listLength(_outExps)), MMC_REFSTRUCTLIT(mmc_nil));
    _outDims = tmpMeta9;

    goto _return;
  }

  {
    modelica_metatype _e;
    for (tmpMeta10 = listReverse(_exps); !listEmpty(tmpMeta10); tmpMeta10=MMC_CDR(tmpMeta10))
    {
      _e = MMC_CAR(tmpMeta10);
      _arr = omc_ExpressionSimplify_evalCatGetFlatArray(threadData, _e, _dim, ((modelica_fnptr) _getArrayContents), ((modelica_fnptr) _toString) ,&_dims);

      tmpMeta11 = mmc_mk_cons(_arr, _arrs);
      _arrs = tmpMeta11;

      tmpMeta12 = mmc_mk_cons(_dims, _dimsLst);
      _dimsLst = tmpMeta12;
    }
  }

  tmp31 = ((modelica_integer) 1); tmp32 = 1; tmp33 = ((modelica_integer) -1) + _dim;
  if(!(((tmp32 > 0) && (tmp31 > tmp33)) || ((tmp32 < 0) && (tmp31 < tmp33))))
  {
    modelica_integer _i;
    for(_i = ((modelica_integer) 1); in_range_integer(_i, tmp31, tmp33); _i += tmp32)
    {
      {
        modelica_integer __omcQ_24tmpVar33;
        modelica_integer __omcQ_24tmpVar32;
        modelica_integer tmp15;
        modelica_metatype _d_loopVar = 0;
        modelica_metatype _d;
        _d_loopVar = _dimsLst;
        __omcQ_24tmpVar33 = ((modelica_integer) 4611686018427387903); /* defaultValue */
        while(1) {
          tmp15 = 1;
          if (!listEmpty(_d_loopVar)) {
            _d = MMC_CAR(_d_loopVar);
            _d_loopVar = MMC_CDR(_d_loopVar);
            tmp15--;
          }
          if (tmp15 == 0) {
            __omcQ_24tmpVar32 = mmc_unbox_integer(listHead(_d));
            __omcQ_24tmpVar33 = modelica_integer_min((modelica_integer)(__omcQ_24tmpVar32),(modelica_integer)(__omcQ_24tmpVar33));
          } else if (tmp15 == 1) {
            break;
          } else {
            MMC_THROW_INTERNAL();
          }
        }
        tmp14 = __omcQ_24tmpVar33;
      }
      _j = tmp14;

      {
        modelica_integer __omcQ_24tmpVar35;
        modelica_integer __omcQ_24tmpVar34;
        modelica_integer tmp17;
        modelica_metatype _d_loopVar = 0;
        modelica_metatype _d;
        _d_loopVar = _dimsLst;
        __omcQ_24tmpVar35 = ((modelica_integer) -4611686018427387903); /* defaultValue */
        while(1) {
          tmp17 = 1;
          if (!listEmpty(_d_loopVar)) {
            _d = MMC_CAR(_d_loopVar);
            _d_loopVar = MMC_CDR(_d_loopVar);
            tmp17--;
          }
          if (tmp17 == 0) {
            __omcQ_24tmpVar34 = mmc_unbox_integer(listHead(_d));
            __omcQ_24tmpVar35 = modelica_integer_max((modelica_integer)(__omcQ_24tmpVar34),(modelica_integer)(__omcQ_24tmpVar35));
          } else if (tmp17 == 1) {
            break;
          } else {
            MMC_THROW_INTERNAL();
          }
        }
        tmp16 = __omcQ_24tmpVar35;
      }
      if((_j != tmp16))
      {
        tmp18 = modelica_integer_to_modelica_string(_i, ((modelica_integer) 0), 1 /* true */);
        tmpMeta19 = stringAppend(_OMC_LIT82,tmp18);
        tmpMeta20 = stringAppend(tmpMeta19,_OMC_LIT76);
        {
          modelica_metatype __omcQ_24tmpVar37;
          modelica_metatype* tmp22;
          modelica_metatype tmpMeta23;
          modelica_string __omcQ_24tmpVar36;
          modelica_integer tmp24;
          modelica_metatype _e_loopVar = 0;
          modelica_metatype _e;
          _e_loopVar = _exps;
          tmpMeta23 = MMC_REFSTRUCTLIT(mmc_nil);
          __omcQ_24tmpVar37 = tmpMeta23; /* defaultValue */
          tmp22 = &__omcQ_24tmpVar37;
          while(1) {
            tmp24 = 1;
            if (!listEmpty(_e_loopVar)) {
              _e = MMC_CAR(_e_loopVar);
              _e_loopVar = MMC_CDR(_e_loopVar);
              tmp24--;
            }
            if (tmp24 == 0) {
              __omcQ_24tmpVar36 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_toString), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_toString), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_toString), 2))), _e) : ((modelica_metatype(*)(threadData_t*, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_toString), 1)))) (threadData, _e);
              *tmp22 = mmc_mk_cons(__omcQ_24tmpVar36,0);
              tmp22 = &MMC_CDR(*tmp22);
            } else if (tmp24 == 1) {
              break;
            } else {
              MMC_THROW_INTERNAL();
            }
          }
          *tmp22 = mmc_mk_nil();
          tmpMeta21 = __omcQ_24tmpVar37;
        }
        tmpMeta25 = stringAppend(tmpMeta20,stringDelimitList(tmpMeta21, _OMC_LIT83));
        omc_Error_assertion(threadData, 0 /* false */, tmpMeta25, _OMC_LIT84);
      }

      tmpMeta26 = mmc_mk_cons(mmc_mk_integer(_j), _firstDims);
      _firstDims = tmpMeta26;

      {
        modelica_metatype __omcQ_24tmpVar39;
        modelica_metatype* tmp28;
        modelica_metatype tmpMeta29;
        modelica_metatype __omcQ_24tmpVar38;
        modelica_integer tmp30;
        modelica_metatype _d_loopVar = 0;
        modelica_metatype _d;
        _d_loopVar = _dimsLst;
        tmpMeta29 = MMC_REFSTRUCTLIT(mmc_nil);
        __omcQ_24tmpVar39 = tmpMeta29; /* defaultValue */
        tmp28 = &__omcQ_24tmpVar39;
        while(1) {
          tmp30 = 1;
          if (!listEmpty(_d_loopVar)) {
            _d = MMC_CAR(_d_loopVar);
            _d_loopVar = MMC_CDR(_d_loopVar);
            tmp30--;
          }
          if (tmp30 == 0) {
            __omcQ_24tmpVar38 = listRest(_d);
            *tmp28 = mmc_mk_cons(__omcQ_24tmpVar38,0);
            tmp28 = &MMC_CDR(*tmp28);
          } else if (tmp30 == 1) {
            break;
          } else {
            MMC_THROW_INTERNAL();
          }
        }
        *tmp28 = mmc_mk_nil();
        tmpMeta27 = __omcQ_24tmpVar39;
      }
      _dimsLst = tmpMeta27;
    }
  }

  _reverseDims = _firstDims;

  _firstDims = listReverse(_firstDims);

  {
    modelica_metatype __omcQ_24tmpVar41;
    modelica_metatype* tmp35;
    modelica_metatype tmpMeta36;
    modelica_metatype __omcQ_24tmpVar40;
    modelica_integer tmp37;
    modelica_metatype _d_loopVar = 0;
    modelica_metatype _d;
    _d_loopVar = _dimsLst;
    tmpMeta36 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar41 = tmpMeta36; /* defaultValue */
    tmp35 = &__omcQ_24tmpVar41;
    while(1) {
      tmp37 = 1;
      if (!listEmpty(_d_loopVar)) {
        _d = MMC_CAR(_d_loopVar);
        _d_loopVar = MMC_CDR(_d_loopVar);
        tmp37--;
      }
      if (tmp37 == 0) {
        __omcQ_24tmpVar40 = listHead(_d);
        *tmp35 = mmc_mk_cons(__omcQ_24tmpVar40,0);
        tmp35 = &MMC_CDR(*tmp35);
      } else if (tmp37 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp35 = mmc_mk_nil();
    tmpMeta34 = __omcQ_24tmpVar41;
  }
  _lastDims = tmpMeta34;

  {
    modelica_integer __omcQ_24tmpVar43;
    modelica_integer __omcQ_24tmpVar42;
    modelica_integer tmp39;
    modelica_metatype _d_loopVar = 0;
    modelica_metatype _d;
    _d_loopVar = _lastDims;
    __omcQ_24tmpVar43 = ((modelica_integer) 0); /* defaultValue */
    while(1) {
      tmp39 = 1;
      if (!listEmpty(_d_loopVar)) {
        _d = MMC_CAR(_d_loopVar);
        _d_loopVar = MMC_CDR(_d_loopVar);
        tmp39--;
      }
      if (tmp39 == 0) {
        __omcQ_24tmpVar42 = mmc_unbox_integer(_d);
        __omcQ_24tmpVar43 = __omcQ_24tmpVar43 + __omcQ_24tmpVar42;
      } else if (tmp39 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    tmp38 = __omcQ_24tmpVar43;
  }
  _lastDim = tmp38;

  tmpMeta40 = mmc_mk_cons(mmc_mk_integer(_lastDim), _reverseDims);
  _reverseDims = tmpMeta40;

  {
    modelica_integer __omcQ_24tmpVar45;
    modelica_integer __omcQ_24tmpVar44;
    modelica_integer tmp42;
    modelica_metatype _d_loopVar = 0;
    modelica_metatype _d;
    _d_loopVar = _firstDims;
    __omcQ_24tmpVar45 = ((modelica_integer) 1); /* defaultValue */
    while(1) {
      tmp42 = 1;
      if (!listEmpty(_d_loopVar)) {
        _d = MMC_CAR(_d_loopVar);
        _d_loopVar = MMC_CDR(_d_loopVar);
        tmp42--;
      }
      if (tmp42 == 0) {
        __omcQ_24tmpVar44 = mmc_unbox_integer(_d);
        __omcQ_24tmpVar45 = (__omcQ_24tmpVar45) * (__omcQ_24tmpVar44);
      } else if (tmp42 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    tmp41 = __omcQ_24tmpVar45;
  }
  _expArr = arrayCreateNoInit((_lastDim) * (tmp41), listHead(_exps));

  _k = ((modelica_integer) 1);

  {
    modelica_metatype _exps;
    for (tmpMeta43 = _arrs; !listEmpty(tmpMeta43); tmpMeta43=MMC_CDR(tmpMeta43))
    {
      _exps = MMC_CAR(tmpMeta43);
      /* Pattern-matching assignment */
      tmpMeta44 = _lastDims;
      if (listEmpty(tmpMeta44)) MMC_THROW_INTERNAL();
      tmpMeta45 = MMC_CAR(tmpMeta44);
      tmpMeta46 = MMC_CDR(tmpMeta44);
      tmp47 = mmc_unbox_integer(tmpMeta45);
      _thisDim = tmp47  /* pattern as ty=Integer */;
      _lastDims = tmpMeta46;

      _l = ((modelica_integer) 0);

      {
        modelica_metatype _e;
        for (tmpMeta48 = _exps; !listEmpty(tmpMeta48); tmpMeta48=MMC_CDR(tmpMeta48))
        {
          _e = MMC_CAR(tmpMeta48);
          tmp49 = _thisDim;
          if (tmp49 == 0) {MMC_THROW_INTERNAL();}
          arrayUpdate(_expArr, _k + modelica_integer_mod(_l, _thisDim) + (_lastDim) * (modelica_div_integer(_l,tmp49).quot), _e);

          _l = ((modelica_integer) 1) + _l;
        }
      }

      _k = _k + _thisDim;
    }
  }

  _outExps = arrayList(_expArr);

  _outDims = listReverse(_reverseDims);
  _return: OMC_LABEL_UNUSED
  if (out_outDims) { *out_outDims = _outDims; }
  return _outExps;
}
modelica_metatype boxptr_ExpressionSimplify_evalCat(threadData_t *threadData, modelica_metatype _dim, modelica_metatype _exps, modelica_fnptr _getArrayContents, modelica_fnptr _toString, modelica_metatype *out_outDims)
{
  modelica_integer tmp1;
  modelica_metatype _outExps = NULL;
  tmp1 = mmc_unbox_integer(_dim);
  _outExps = omc_ExpressionSimplify_evalCat(threadData, tmp1, _exps, _getArrayContents, _toString, out_outDims);
  /* skip box _outExps; list<polymorphic<Exp>> */
  /* skip box _outDims; list<#Integer> */
  return _outExps;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCat2(threadData_t *threadData, modelica_integer _dim, modelica_metatype _ies, modelica_metatype _acc, modelica_boolean _changed)
{
  modelica_metatype _oes = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _oes has no default value.
  { /* matchcontinue expression */
    volatile modelica_integer tmp4_1;volatile modelica_metatype tmp4_2;volatile modelica_boolean tmp4_3;
    tmp4_1 = _dim;
    tmp4_2 = _ies;
    tmp4_3 = _changed;
    {
      modelica_metatype _es1 = NULL;
      modelica_metatype _es2 = NULL;
      modelica_metatype _esn = NULL;
      modelica_metatype _es = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _ndim = NULL;
      modelica_metatype _dim1 = NULL;
      modelica_metatype _dim2 = NULL;
      modelica_metatype _dim11 = NULL;
      modelica_metatype _dims = NULL;
      modelica_metatype _etp = NULL;
      modelica_integer _i;
      modelica_metatype _ms1 = NULL;
      modelica_metatype _ms2 = NULL;
      modelica_metatype _mss = NULL;
      modelica_boolean _sc;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _es1 has no default value.
      // _es2 has no default value.
      // _esn has no default value.
      // _es has no default value.
      // _e has no default value.
      // _ndim has no default value.
      // _dim1 has no default value.
      // _dim2 has no default value.
      // _dim11 has no default value.
      // _dims has no default value.
      // _etp has no default value.
      // _i has no default value.
      // _ms1 has no default value.
      // _ms2 has no default value.
      // _mss has no default value.
      // _sc has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (1 /* true */ != tmp4_3) goto tmp3_end;
          if (!listEmpty(tmp4_2)) goto tmp3_end;
          
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = listReverse(_acc);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_integer tmp14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          if (1 != tmp4_1) goto tmp3_end;
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta6 = MMC_CAR(tmp4_2);
          tmpMeta7 = MMC_CDR(tmp4_2);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,16,3) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,6,2) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 3));
          if (listEmpty(tmpMeta10)) goto tmp3_end;
          tmpMeta11 = MMC_CAR(tmpMeta10);
          tmpMeta12 = MMC_CDR(tmpMeta10);
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 3));
          tmp14 = mmc_unbox_integer(tmpMeta13);
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 4));
          if (listEmpty(tmpMeta7)) goto tmp3_end;
          tmpMeta16 = MMC_CAR(tmpMeta7);
          tmpMeta17 = MMC_CDR(tmpMeta7);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta16,16,3) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta16), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,6,2) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 3));
          if (listEmpty(tmpMeta19)) goto tmp3_end;
          tmpMeta20 = MMC_CAR(tmpMeta19);
          tmpMeta21 = MMC_CDR(tmpMeta19);
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta16), 4));
          
          _etp = tmpMeta9;
          _dim1 = tmpMeta11;
          _dims = tmpMeta12;
          _sc = tmp14  /* pattern as ty=Boolean */;
          _es1 = tmpMeta15;
          _dim2 = tmpMeta20;
          _es2 = tmpMeta22;
          _es = tmpMeta17;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          _esn = listAppend(_es1, _es2);

          _ndim = omc_Expression_addDimensions(threadData, _dim1, _dim2);

          tmpMeta23 = mmc_mk_cons(_ndim, _dims);
          tmpMeta24 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _etp, tmpMeta23);
          _etp = tmpMeta24;

          tmpMeta25 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _etp, mmc_mk_boolean(_sc), _esn);
          _e = tmpMeta25;
          tmpMeta26 = mmc_mk_cons(_e, _es);
          tmpMeta1 = omc_ExpressionSimplify_simplifyCat2(threadData, _dim, tmpMeta26, _acc, 1 /* true */);
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_integer tmp37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          if (2 != tmp4_1) goto tmp3_end;
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta27 = MMC_CAR(tmp4_2);
          tmpMeta28 = MMC_CDR(tmp4_2);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta27,17,3) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta29,6,2) == 0) goto tmp3_end;
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta29), 2));
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta29), 3));
          if (listEmpty(tmpMeta31)) goto tmp3_end;
          tmpMeta32 = MMC_CAR(tmpMeta31);
          tmpMeta33 = MMC_CDR(tmpMeta31);
          if (listEmpty(tmpMeta33)) goto tmp3_end;
          tmpMeta34 = MMC_CAR(tmpMeta33);
          tmpMeta35 = MMC_CDR(tmpMeta33);
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 3));
          tmp37 = mmc_unbox_integer(tmpMeta36);
          tmpMeta38 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 4));
          if (listEmpty(tmpMeta28)) goto tmp3_end;
          tmpMeta39 = MMC_CAR(tmpMeta28);
          tmpMeta40 = MMC_CDR(tmpMeta28);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta39,17,3) == 0) goto tmp3_end;
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta39), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta41,6,2) == 0) goto tmp3_end;
          tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta41), 3));
          if (listEmpty(tmpMeta42)) goto tmp3_end;
          tmpMeta43 = MMC_CAR(tmpMeta42);
          tmpMeta44 = MMC_CDR(tmpMeta42);
          if (listEmpty(tmpMeta44)) goto tmp3_end;
          tmpMeta45 = MMC_CAR(tmpMeta44);
          tmpMeta46 = MMC_CDR(tmpMeta44);
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta39), 4));
          
          _etp = tmpMeta30;
          _dim11 = tmpMeta32;
          _dim1 = tmpMeta34;
          _dims = tmpMeta35;
          _i = tmp37  /* pattern as ty=Integer */;
          _ms1 = tmpMeta38;
          _dim2 = tmpMeta45;
          _ms2 = tmpMeta47;
          _es = tmpMeta40;
          /* Pattern matching succeeded */
          _mss = omc_List_threadMap(threadData, _ms1, _ms2, boxvar_listAppend);

          _ndim = omc_Expression_addDimensions(threadData, _dim1, _dim2);

          tmpMeta49 = mmc_mk_cons(_ndim, _dims);
          tmpMeta48 = mmc_mk_cons(_dim11, tmpMeta49);
          tmpMeta50 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _etp, tmpMeta48);
          _etp = tmpMeta50;

          tmpMeta51 = mmc_mk_box4(20, &DAE_Exp_MATRIX__desc, _etp, mmc_mk_integer(_i), _mss);
          _e = tmpMeta51;
          tmpMeta52 = mmc_mk_cons(_e, _es);
          tmpMeta1 = omc_ExpressionSimplify_simplifyCat2(threadData, _dim, tmpMeta52, _acc, 1 /* true */);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta53 = MMC_CAR(tmp4_2);
          tmpMeta54 = MMC_CDR(tmp4_2);
          
          _e = tmpMeta53;
          _es = tmpMeta54;
          /* Pattern matching succeeded */
          tmpMeta55 = mmc_mk_cons(_e, _acc);
          tmpMeta1 = omc_ExpressionSimplify_simplifyCat2(threadData, _dim, _es, tmpMeta55, _changed);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 4) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _oes = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _oes;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyCat2(threadData_t *threadData, modelica_metatype _dim, modelica_metatype _ies, modelica_metatype _acc, modelica_metatype _changed)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _oes = NULL;
  tmp1 = mmc_unbox_integer(_dim);
  tmp2 = mmc_unbox_integer(_changed);
  _oes = omc_ExpressionSimplify_simplifyCat2(threadData, tmp1, _ies, _acc, tmp2);
  /* skip box _oes; list<DAE.Exp> */
  return _oes;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCatArg(threadData_t *threadData, modelica_metatype _arg)
{
  modelica_metatype _outArg = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outArg has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _arg;
    {
      modelica_metatype _dim = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _dim has no default value.
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_Expression_matrixToArray(threadData, _arg);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,6,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 3));
          if (listEmpty(tmpMeta7)) goto tmp3_end;
          tmpMeta8 = MMC_CAR(tmpMeta7);
          tmpMeta9 = MMC_CDR(tmpMeta7);
          if (!listEmpty(tmpMeta9)) goto tmp3_end;
          _dim = tmpMeta8;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_dimensionKnown(threadData, _dim)) goto tmp3_end;
          tmpMeta10 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_arg), 3))), mmc_mk_boolean(1 /* true */), omc_Expression_expandExpression(threadData, _arg, 0 /* false */));
          tmpMeta1 = tmpMeta10;
          goto tmp3_done;
        }
        case 2: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _arg;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outArg = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outArg;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCat(threadData_t *threadData, modelica_integer _inDim, modelica_metatype _inExpList)
{
  modelica_metatype _outExpList = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExpList has no default value.
  { /* match expression */
    modelica_integer tmp4_1;
    tmp4_1 = _inDim;
    {
      modelica_metatype _expl = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _expl has no default value.
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (1 != tmp4_1) goto tmp3_end;
          /* Pattern matching succeeded */
          _expl = omc_List_map(threadData, _inExpList, boxvar_ExpressionSimplify_simplifyCatArg);
          tmpMeta6 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta1 = omc_ExpressionSimplify_simplifyCat2(threadData, _inDim, _expl, tmpMeta6, 0 /* false */);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          
          /* Pattern matching succeeded */
          tmpMeta7 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta1 = omc_ExpressionSimplify_simplifyCat2(threadData, _inDim, _inExpList, tmpMeta7, 0 /* false */);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExpList = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExpList;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyCat(threadData_t *threadData, modelica_metatype _inDim, modelica_metatype _inExpList)
{
  modelica_integer tmp1;
  modelica_metatype _outExpList = NULL;
  tmp1 = mmc_unbox_integer(_inDim);
  _outExpList = omc_ExpressionSimplify_simplifyCat(threadData, tmp1, _inExpList);
  /* skip box _outExpList; list<DAE.Exp> */
  return _outExpList;
}

PROTECTED_FUNCTION_STATIC void omc_ExpressionSimplify_simplifySymmetric(threadData_t *threadData, modelica_metatype _marr, modelica_integer _i1, modelica_integer _i2)
{
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  { /* match expression */
    modelica_integer tmp3_1;modelica_integer tmp3_2;
    tmp3_1 = _i1;
    tmp3_2 = _i2;
    {
      modelica_metatype _v1 = NULL;
      modelica_metatype _v2 = NULL;
      modelica_metatype _exp = NULL;
      volatile mmc_switch_type tmp3;
      int tmp4;
      // _v1 has no default value.
      // _v2 has no default value.
      // _exp has no default value.
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          if (0 != tmp3_1) goto tmp2_end;
          if (1 != tmp3_2) goto tmp2_end;
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 1: {
          modelica_integer tmp5;
          
          /* Pattern matching succeeded */
          _v1 = arrayGet(_marr, _i1);

          _v2 = arrayGet(_marr, _i2);

          _exp = arrayGet(_v1, _i2);

          arrayUpdate(_v2, _i1, _exp);

          /* Tail recursive call */
          tmp5 = ((_i1 == ((modelica_integer) 1))?((modelica_integer) -2) + _i2:((modelica_integer) -1) + _i1);
          _i2 = ((_i1 == ((modelica_integer) 1))?((modelica_integer) -1) + _i2:_i2);
          _i1 = tmp5;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          ;
          goto tmp2_done;
        }
        }
        goto tmp2_end;
        tmp2_end: ;
      }
      goto goto_1;
      goto_1:;
      MMC_THROW_INTERNAL();
      goto tmp2_done;
      tmp2_done:;
    }
  }
  ;
  _return: OMC_LABEL_UNUSED
  return;
}
PROTECTED_FUNCTION_STATIC void boxptr_ExpressionSimplify_simplifySymmetric(threadData_t *threadData, modelica_metatype _marr, modelica_metatype _i1, modelica_metatype _i2)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  tmp1 = mmc_unbox_integer(_i1);
  tmp2 = mmc_unbox_integer(_i2);
  omc_ExpressionSimplify_simplifySymmetric(threadData, _marr, tmp1, tmp2);
  return;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_makeNestedReduction(threadData_t *threadData, modelica_metatype _inExp, modelica_string _inName, modelica_metatype _inType, modelica_metatype _inCall)
{
  modelica_metatype _outCall = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outCall has no default value.
  tmpMeta1 = mmc_mk_cons(_inExp, mmc_mk_cons(_inCall, MMC_REFSTRUCTLIT(mmc_nil)));
  _outCall = omc_Expression_makePureBuiltinCall(threadData, _inName, tmpMeta1, _inType);
  _return: OMC_LABEL_UNUSED
  return _outCall;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyScalar(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _tp)
{
  modelica_metatype _exp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (listEmpty(tmpMeta6)) goto tmp3_end;
          tmpMeta7 = MMC_CAR(tmpMeta6);
          tmpMeta8 = MMC_CDR(tmpMeta6);
          if (!listEmpty(tmpMeta8)) goto tmp3_end;
          _exp = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta9 = mmc_mk_cons(_exp, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT85, tmpMeta9, _tp);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (listEmpty(tmpMeta10)) goto tmp3_end;
          tmpMeta11 = MMC_CAR(tmpMeta10);
          tmpMeta12 = MMC_CDR(tmpMeta10);
          if (listEmpty(tmpMeta11)) goto tmp3_end;
          tmpMeta13 = MMC_CAR(tmpMeta11);
          tmpMeta14 = MMC_CDR(tmpMeta11);
          if (!listEmpty(tmpMeta14)) goto tmp3_end;
          if (!listEmpty(tmpMeta12)) goto tmp3_end;
          _exp = tmpMeta13;
          /* Pattern matching succeeded */
          tmpMeta15 = mmc_mk_cons(_exp, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT85, tmpMeta15, _tp);
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,24,2) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (!optionNone(tmpMeta17)) goto tmp3_end;
          _exp = tmpMeta16;
          /* Pattern matching succeeded */
          /* Pattern-matching tuple assignment, wild first pattern */
          omc_Types_flattenArrayType(threadData, omc_Expression_typeof(threadData, _inExp), &tmpMeta18);
          if (listEmpty(tmpMeta18)) goto goto_2;
          tmpMeta19 = MMC_CAR(tmpMeta18);
          tmpMeta20 = MMC_CDR(tmpMeta18);
          if (!listEmpty(tmpMeta20)) goto goto_2;
          tmpMeta21 = mmc_mk_box3(27, &DAE_Exp_SIZE__desc, _exp, _OMC_LIT87);
          tmpMeta1 = tmpMeta21;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta22;
          
          /* Pattern matching succeeded */
          /* Pattern-matching tuple assignment, wild first pattern */
          omc_Types_flattenArrayType(threadData, omc_Expression_typeof(threadData, _inExp), &tmpMeta22);
          if (!listEmpty(tmpMeta22)) goto goto_2;
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyBuiltinCalls(threadData_t *threadData, modelica_metatype _exp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;
    tmp4_1 = _exp;
    {
      modelica_metatype _mexpl = NULL;
      modelica_metatype _es = NULL;
      modelica_metatype _expl = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _len_exp = NULL;
      modelica_metatype _just_exp = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _e3 = NULL;
      modelica_metatype _e4 = NULL;
      modelica_metatype _tp = NULL;
      modelica_metatype _tp1 = NULL;
      modelica_metatype _tp2 = NULL;
      modelica_metatype _op = NULL;
      modelica_metatype _v1 = NULL;
      modelica_metatype _v2 = NULL;
      modelica_boolean _scalar;
      modelica_boolean _sc;
      modelica_metatype _valueLst = NULL;
      modelica_integer _i;
      modelica_integer _i1;
      modelica_integer _i2;
      modelica_integer _dim;
      modelica_real _r1;
      modelica_metatype _marr = NULL;
      modelica_string _name = NULL;
      modelica_string _s1 = NULL;
      modelica_string _s2 = NULL;
      modelica_metatype _dims = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _mexpl has no default value.
      // _es has no default value.
      // _expl has no default value.
      // _e has no default value.
      // _len_exp has no default value.
      // _just_exp has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _e3 has no default value.
      // _e4 has no default value.
      // _tp has no default value.
      // _tp1 has no default value.
      // _tp2 has no default value.
      // _op has no default value.
      // _v1 has no default value.
      // _v2 has no default value.
      // _scalar has no default value.
      // _sc has no default value.
      // _valueLst has no default value.
      // _i has no default value.
      // _i1 has no default value.
      // _i2 has no default value.
      // _dim has no default value.
      // _r1 has no default value.
      // _marr has no default value.
      // _name has no default value.
      // _s1 has no default value.
      // _s2 has no default value.
      // _dims has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 57; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_boolean tmp13;
          modelica_metatype tmpMeta14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,1,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta8)) goto tmp3_end;
          tmpMeta9 = MMC_CAR(tmpMeta8);
          tmpMeta10 = MMC_CDR(tmpMeta8);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,16,3) == 0) goto tmp3_end;
          if (!listEmpty(tmpMeta10)) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta11), 2));
          
          _name = tmpMeta7;
          _e = tmpMeta9;
          _tp = tmpMeta12;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!((stringEqual(_name, _OMC_LIT8)) || (stringEqual(_name, _OMC_LIT7)))) goto tmp3_end;
          _expl = omc_Expression_flattenArrayExpToList(threadData, _e);

          _e1 = omc_Expression_makeScalarArray(threadData, _expl, _tp);

          /* Pattern-matching assignment */
          tmp13 = omc_Expression_expEqual(threadData, _e, _e1);
          if (0 /* false */ != tmp13) goto goto_2;
          tmpMeta14 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _name, tmpMeta14, _tp);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta15,1,1) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta15), 2));
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta17)) goto tmp3_end;
          tmpMeta18 = MMC_CAR(tmpMeta17);
          tmpMeta19 = MMC_CDR(tmpMeta17);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,16,3) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta18), 4));
          if (listEmpty(tmpMeta20)) goto tmp3_end;
          tmpMeta21 = MMC_CAR(tmpMeta20);
          tmpMeta22 = MMC_CDR(tmpMeta20);
          if (!listEmpty(tmpMeta22)) goto tmp3_end;
          if (!listEmpty(tmpMeta19)) goto tmp3_end;
          
          _name = tmpMeta16;
          _expl = tmpMeta20;
          _e = tmpMeta21;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!((stringEqual(_name, _OMC_LIT8)) || (stringEqual(_name, _OMC_LIT7)))) goto tmp3_end;
          if(omc_Expression_isArrayType(threadData, omc_Expression_typeof(threadData, _e)))
          {
            tmpMeta23 = MMC_TAGPTR(mmc_alloc_words(5));
            memcpy(MMC_UNTAGPTR(tmpMeta23), MMC_UNTAGPTR(_exp), 5*sizeof(modelica_metatype));
            ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta23))[3] = _expl;
            _exp = tmpMeta23;

            _e = _exp;
          }
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta24,1,1) == 0) goto tmp3_end;
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta24), 2));
          if (3 != MMC_STRLEN(tmpMeta25) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmpMeta25)) != 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta26)) goto tmp3_end;
          tmpMeta27 = MMC_CAR(tmpMeta26);
          tmpMeta28 = MMC_CDR(tmpMeta26);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta27,16,3) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 4));
          if (listEmpty(tmpMeta29)) goto tmp3_end;
          tmpMeta30 = MMC_CAR(tmpMeta29);
          tmpMeta31 = MMC_CDR(tmpMeta29);
          if (!listEmpty(tmpMeta31)) goto tmp3_end;
          if (!listEmpty(tmpMeta28)) goto tmp3_end;
          
          _e = tmpMeta30;
          /* Pattern matching succeeded */
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_boolean tmp44;
          modelica_metatype tmpMeta45;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta32,1,1) == 0) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta32), 2));
          if (3 != MMC_STRLEN(tmpMeta33) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmpMeta33)) != 0) goto tmp3_end;
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta34)) goto tmp3_end;
          tmpMeta35 = MMC_CAR(tmpMeta34);
          tmpMeta36 = MMC_CDR(tmpMeta34);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta35,16,3) == 0) goto tmp3_end;
          tmpMeta37 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta35), 4));
          if (!listEmpty(tmpMeta36)) goto tmp3_end;
          tmpMeta38 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta39 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta38), 2));
          
          _es = tmpMeta37;
          _tp = tmpMeta39;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          _i1 = listLength(_es);

          tmpMeta40 = MMC_REFSTRUCTLIT(mmc_nil);
          _es = omc_List_union(threadData, _es, tmpMeta40);

          _i2 = listLength(_es);

          if((_i1 == _i2))
          {
            /* Pattern-matching assignment */
            tmpMeta41 = omc_List_fold(threadData, _es, boxvar_ExpressionSimplify_maxElement, mmc_mk_none());
            if (optionNone(tmpMeta41)) goto goto_2;
            tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta41), 1));
            _e = tmpMeta42;

            _es = omc_List_select(threadData, _es, boxvar_ExpressionSimplify_removeMinMaxFoldableValues);

            tmpMeta43 = mmc_mk_cons(_e, _es);
            _es = tmpMeta43;

            _i2 = listLength(_es);

            /* Pattern-matching assignment */
            tmp44 = (_i2 < _i1);
            if (1 /* true */ != tmp44) goto goto_2;

            _e = omc_Expression_makeScalarArray(threadData, _es, _tp);
          }
          else
          {
            _e = omc_Expression_makeScalarArray(threadData, _es, _tp);
          }
          tmpMeta45 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT8, tmpMeta45, _tp);
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_boolean tmp58;
          modelica_metatype tmpMeta59;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta46,1,1) == 0) goto tmp3_end;
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta46), 2));
          if (3 != MMC_STRLEN(tmpMeta47) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmpMeta47)) != 0) goto tmp3_end;
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta48)) goto tmp3_end;
          tmpMeta49 = MMC_CAR(tmpMeta48);
          tmpMeta50 = MMC_CDR(tmpMeta48);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta49,16,3) == 0) goto tmp3_end;
          tmpMeta51 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta49), 4));
          if (!listEmpty(tmpMeta50)) goto tmp3_end;
          tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta52), 2));
          
          _es = tmpMeta51;
          _tp = tmpMeta53;
          /* Pattern matching succeeded */
          _i1 = listLength(_es);

          tmpMeta54 = MMC_REFSTRUCTLIT(mmc_nil);
          _es = omc_List_union(threadData, _es, tmpMeta54);

          _i2 = listLength(_es);

          if((_i1 == _i2))
          {
            /* Pattern-matching assignment */
            tmpMeta55 = omc_List_fold(threadData, _es, boxvar_ExpressionSimplify_minElement, mmc_mk_none());
            if (optionNone(tmpMeta55)) goto goto_2;
            tmpMeta56 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta55), 1));
            _e = tmpMeta56;

            _es = omc_List_select(threadData, _es, boxvar_ExpressionSimplify_removeMinMaxFoldableValues);

            tmpMeta57 = mmc_mk_cons(_e, _es);
            _es = tmpMeta57;

            _i2 = listLength(_es);

            /* Pattern-matching assignment */
            tmp58 = (_i2 < _i1);
            if (1 /* true */ != tmp58) goto goto_2;

            _e = omc_Expression_makeScalarArray(threadData, _es, _tp);
          }
          else
          {
            _e = omc_Expression_makeScalarArray(threadData, _es, _tp);
          }
          tmpMeta59 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT7, tmpMeta59, _tp);
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta60;
          modelica_metatype tmpMeta61;
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          modelica_metatype tmpMeta68;
          modelica_metatype tmpMeta69;
          modelica_metatype tmpMeta70;
          modelica_metatype tmpMeta71;
          modelica_metatype tmpMeta72;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta60 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta60,1,1) == 0) goto tmp3_end;
          tmpMeta61 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta60), 2));
          if (3 != MMC_STRLEN(tmpMeta61) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmpMeta61)) != 0) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta62)) goto tmp3_end;
          tmpMeta63 = MMC_CAR(tmpMeta62);
          tmpMeta64 = MMC_CDR(tmpMeta62);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta63,16,3) == 0) goto tmp3_end;
          tmpMeta65 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta63), 4));
          if (listEmpty(tmpMeta65)) goto tmp3_end;
          tmpMeta66 = MMC_CAR(tmpMeta65);
          tmpMeta67 = MMC_CDR(tmpMeta65);
          if (listEmpty(tmpMeta67)) goto tmp3_end;
          tmpMeta68 = MMC_CAR(tmpMeta67);
          tmpMeta69 = MMC_CDR(tmpMeta67);
          if (!listEmpty(tmpMeta69)) goto tmp3_end;
          if (!listEmpty(tmpMeta64)) goto tmp3_end;
          tmpMeta70 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta71 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta70), 2));
          
          _e1 = tmpMeta66;
          _e2 = tmpMeta68;
          _tp = tmpMeta71;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta72 = mmc_mk_cons(_e1, mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil)));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT7, tmpMeta72, _tp);
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta73;
          modelica_metatype tmpMeta74;
          modelica_metatype tmpMeta75;
          modelica_metatype tmpMeta76;
          modelica_metatype tmpMeta77;
          modelica_metatype tmpMeta78;
          modelica_metatype tmpMeta79;
          modelica_metatype tmpMeta80;
          modelica_metatype tmpMeta81;
          modelica_metatype tmpMeta82;
          modelica_metatype tmpMeta83;
          modelica_metatype tmpMeta84;
          modelica_metatype tmpMeta85;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta73 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta73,1,1) == 0) goto tmp3_end;
          tmpMeta74 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta73), 2));
          if (3 != MMC_STRLEN(tmpMeta74) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmpMeta74)) != 0) goto tmp3_end;
          tmpMeta75 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta75)) goto tmp3_end;
          tmpMeta76 = MMC_CAR(tmpMeta75);
          tmpMeta77 = MMC_CDR(tmpMeta75);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta76,16,3) == 0) goto tmp3_end;
          tmpMeta78 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta76), 4));
          if (listEmpty(tmpMeta78)) goto tmp3_end;
          tmpMeta79 = MMC_CAR(tmpMeta78);
          tmpMeta80 = MMC_CDR(tmpMeta78);
          if (listEmpty(tmpMeta80)) goto tmp3_end;
          tmpMeta81 = MMC_CAR(tmpMeta80);
          tmpMeta82 = MMC_CDR(tmpMeta80);
          if (!listEmpty(tmpMeta82)) goto tmp3_end;
          if (!listEmpty(tmpMeta77)) goto tmp3_end;
          tmpMeta83 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta84 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta83), 2));
          
          _e1 = tmpMeta79;
          _e2 = tmpMeta81;
          _tp = tmpMeta84;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta85 = mmc_mk_cons(_e1, mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil)));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT8, tmpMeta85, _tp);
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta86;
          modelica_metatype tmpMeta87;
          modelica_metatype tmpMeta88;
          modelica_metatype tmpMeta89;
          modelica_metatype tmpMeta90;
          modelica_metatype tmpMeta91;
          modelica_metatype tmpMeta92;
          modelica_metatype tmpMeta93;
          modelica_metatype tmpMeta94;
          modelica_metatype tmpMeta95;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta86 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta86,1,1) == 0) goto tmp3_end;
          tmpMeta87 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta86), 2));
          if (3 != MMC_STRLEN(tmpMeta87) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmpMeta87)) != 0) goto tmp3_end;
          tmpMeta88 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta88)) goto tmp3_end;
          tmpMeta89 = MMC_CAR(tmpMeta88);
          tmpMeta90 = MMC_CDR(tmpMeta88);
          if (listEmpty(tmpMeta90)) goto tmp3_end;
          tmpMeta91 = MMC_CAR(tmpMeta90);
          tmpMeta92 = MMC_CDR(tmpMeta90);
          if (!listEmpty(tmpMeta92)) goto tmp3_end;
          tmpMeta93 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta94 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta93), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta94,3,1) == 0) goto tmp3_end;
          
          _e1 = tmpMeta89;
          _e2 = tmpMeta91;
          tmp4 += 49; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta95 = mmc_mk_box4(12, &DAE_Exp_LBINARY__desc, _e1, _OMC_LIT89, _e2);
          tmpMeta1 = tmpMeta95;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta96;
          modelica_metatype tmpMeta97;
          modelica_metatype tmpMeta98;
          modelica_metatype tmpMeta99;
          modelica_metatype tmpMeta100;
          modelica_metatype tmpMeta101;
          modelica_metatype tmpMeta102;
          modelica_metatype tmpMeta103;
          modelica_metatype tmpMeta104;
          modelica_metatype tmpMeta105;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta96 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta96,1,1) == 0) goto tmp3_end;
          tmpMeta97 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta96), 2));
          if (3 != MMC_STRLEN(tmpMeta97) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmpMeta97)) != 0) goto tmp3_end;
          tmpMeta98 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta98)) goto tmp3_end;
          tmpMeta99 = MMC_CAR(tmpMeta98);
          tmpMeta100 = MMC_CDR(tmpMeta98);
          if (listEmpty(tmpMeta100)) goto tmp3_end;
          tmpMeta101 = MMC_CAR(tmpMeta100);
          tmpMeta102 = MMC_CDR(tmpMeta100);
          if (!listEmpty(tmpMeta102)) goto tmp3_end;
          tmpMeta103 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta104 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta103), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta104,3,1) == 0) goto tmp3_end;
          
          _e1 = tmpMeta99;
          _e2 = tmpMeta101;
          tmp4 += 48; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta105 = mmc_mk_box4(12, &DAE_Exp_LBINARY__desc, _e1, _OMC_LIT90, _e2);
          tmpMeta1 = tmpMeta105;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta106;
          modelica_metatype tmpMeta107;
          modelica_metatype tmpMeta108;
          modelica_metatype tmpMeta109;
          modelica_metatype tmpMeta110;
          modelica_metatype tmpMeta111;
          modelica_metatype tmpMeta112;
          modelica_metatype tmpMeta113;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta106 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta106,1,1) == 0) goto tmp3_end;
          tmpMeta107 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta106), 2));
          if (3 != MMC_STRLEN(tmpMeta107) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmpMeta107)) != 0) goto tmp3_end;
          tmpMeta108 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta108)) goto tmp3_end;
          tmpMeta109 = MMC_CAR(tmpMeta108);
          tmpMeta110 = MMC_CDR(tmpMeta108);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta109,16,3) == 0) goto tmp3_end;
          tmpMeta111 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta109), 4));
          if (!listEmpty(tmpMeta110)) goto tmp3_end;
          tmpMeta112 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta113 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta112), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta113,3,1) == 0) goto tmp3_end;
          
          _expl = tmpMeta111;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_Expression_makeLBinary(threadData, _expl, _OMC_LIT89);
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta114;
          modelica_metatype tmpMeta115;
          modelica_metatype tmpMeta116;
          modelica_metatype tmpMeta117;
          modelica_metatype tmpMeta118;
          modelica_metatype tmpMeta119;
          modelica_metatype tmpMeta120;
          modelica_metatype tmpMeta121;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta114 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta114,1,1) == 0) goto tmp3_end;
          tmpMeta115 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta114), 2));
          if (3 != MMC_STRLEN(tmpMeta115) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmpMeta115)) != 0) goto tmp3_end;
          tmpMeta116 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta116)) goto tmp3_end;
          tmpMeta117 = MMC_CAR(tmpMeta116);
          tmpMeta118 = MMC_CDR(tmpMeta116);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta117,16,3) == 0) goto tmp3_end;
          tmpMeta119 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta117), 4));
          if (!listEmpty(tmpMeta118)) goto tmp3_end;
          tmpMeta120 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta121 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta120), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta121,3,1) == 0) goto tmp3_end;
          
          _expl = tmpMeta119;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_Expression_makeLBinary(threadData, _expl, _OMC_LIT90);
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta122;
          modelica_metatype tmpMeta123;
          modelica_metatype tmpMeta124;
          modelica_metatype tmpMeta125;
          modelica_metatype tmpMeta126;
          modelica_metatype tmpMeta127;
          modelica_metatype tmpMeta128;
          modelica_metatype tmpMeta129;
          modelica_metatype tmpMeta130;
          modelica_metatype tmpMeta131;
          modelica_metatype tmpMeta132;
          modelica_metatype tmpMeta133;
          modelica_boolean tmp134;
          modelica_boolean tmp135;
          modelica_metatype tmpMeta136;
          modelica_metatype tmpMeta137;
          modelica_metatype tmpMeta138;
          modelica_metatype tmpMeta139;
          modelica_metatype tmpMeta140;
          modelica_metatype tmpMeta141;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta122 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta122,1,1) == 0) goto tmp3_end;
          tmpMeta123 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta122), 2));
          tmpMeta124 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta124)) goto tmp3_end;
          tmpMeta125 = MMC_CAR(tmpMeta124);
          tmpMeta126 = MMC_CDR(tmpMeta124);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta125,16,3) == 0) goto tmp3_end;
          tmpMeta127 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta125), 4));
          if (listEmpty(tmpMeta127)) goto tmp3_end;
          tmpMeta128 = MMC_CAR(tmpMeta127);
          tmpMeta129 = MMC_CDR(tmpMeta127);
          if (listEmpty(tmpMeta129)) goto tmp3_end;
          tmpMeta130 = MMC_CAR(tmpMeta129);
          tmpMeta131 = MMC_CDR(tmpMeta129);
          if (!listEmpty(tmpMeta126)) goto tmp3_end;
          tmpMeta132 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta133 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta132), 2));
          
          _name = tmpMeta123;
          _expl = tmpMeta127;
          _tp = tmpMeta133;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp134 = omc_Config_scalarizeMinMax(threadData);
          if (1 /* true */ != tmp134) goto goto_2;

          /* Pattern-matching assignment */
          tmp135 = ((stringEqual(_name, _OMC_LIT8)) || (stringEqual(_name, _OMC_LIT7)));
          if (1 /* true */ != tmp135) goto goto_2;

          /* Pattern-matching assignment */
          tmpMeta136 = listReverse(_expl);
          if (listEmpty(tmpMeta136)) goto goto_2;
          tmpMeta137 = MMC_CAR(tmpMeta136);
          tmpMeta138 = MMC_CDR(tmpMeta136);
          if (listEmpty(tmpMeta138)) goto goto_2;
          tmpMeta139 = MMC_CAR(tmpMeta138);
          tmpMeta140 = MMC_CDR(tmpMeta138);
          _e1 = tmpMeta137;
          _e2 = tmpMeta139;
          _expl = tmpMeta140;

          tmpMeta141 = mmc_mk_cons(_e2, mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil)));
          _e1 = omc_Expression_makePureBuiltinCall(threadData, _name, tmpMeta141, _tp);
          tmpMeta1 = omc_List_fold2(threadData, _expl, boxvar_ExpressionSimplify_makeNestedReduction, _name, _tp, _e1);
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta142;
          modelica_metatype tmpMeta143;
          modelica_metatype tmpMeta144;
          modelica_metatype tmpMeta145;
          modelica_metatype tmpMeta146;
          modelica_metatype tmpMeta147;
          modelica_metatype tmpMeta148;
          modelica_metatype tmpMeta149;
          modelica_metatype tmpMeta150;
          modelica_metatype tmpMeta151;
          modelica_metatype tmpMeta152;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta142 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta142,1,1) == 0) goto tmp3_end;
          tmpMeta143 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta142), 2));
          if (5 != MMC_STRLEN(tmpMeta143) || strcmp(MMC_STRINGDATA(_OMC_LIT110), MMC_STRINGDATA(tmpMeta143)) != 0) goto tmp3_end;
          tmpMeta144 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _e = tmp4_1;
          _expl = tmpMeta144;
          tmp4 += 44; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmpMeta145 = _expl;
          if (listEmpty(tmpMeta145)) goto goto_2;
          tmpMeta146 = MMC_CAR(tmpMeta145);
          tmpMeta147 = MMC_CDR(tmpMeta145);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta146,16,3) == 0) goto goto_2;
          tmpMeta148 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta146), 4));
          if (listEmpty(tmpMeta147)) goto goto_2;
          tmpMeta149 = MMC_CAR(tmpMeta147);
          tmpMeta150 = MMC_CDR(tmpMeta147);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta149,16,3) == 0) goto goto_2;
          tmpMeta151 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta149), 4));
          if (!listEmpty(tmpMeta150)) goto goto_2;
          _v1 = tmpMeta148;
          _v2 = tmpMeta151;

          _expl = omc_ExpressionSimplify_simplifyCross(threadData, _v1, _v2);

          _tp = omc_Expression_typeof(threadData, _e);

          _scalar = (!omc_Expression_isArrayType(threadData, omc_Expression_unliftArray(threadData, _tp)));
          tmpMeta152 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _tp, mmc_mk_boolean(_scalar), _expl);
          tmpMeta1 = tmpMeta152;
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta153;
          modelica_metatype tmpMeta154;
          modelica_metatype tmpMeta155;
          modelica_metatype tmpMeta156;
          modelica_metatype tmpMeta157;
          modelica_metatype tmpMeta158;
          modelica_metatype tmpMeta159;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta153 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta153,1,1) == 0) goto tmp3_end;
          tmpMeta154 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta153), 2));
          if (4 != MMC_STRLEN(tmpMeta154) || strcmp(MMC_STRINGDATA(_OMC_LIT111), MMC_STRINGDATA(tmpMeta154)) != 0) goto tmp3_end;
          tmpMeta155 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta155)) goto tmp3_end;
          tmpMeta156 = MMC_CAR(tmpMeta155);
          tmpMeta157 = MMC_CDR(tmpMeta155);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta156,16,3) == 0) goto tmp3_end;
          tmpMeta158 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta156), 4));
          if (!listEmpty(tmpMeta157)) goto tmp3_end;
          
          _e = tmp4_1;
          _v1 = tmpMeta158;
          tmp4 += 43; /* Pattern matching succeeded; we may skip some cases if we fail */
          _mexpl = omc_ExpressionSimplify_simplifySkew(threadData, _v1);

          _tp = omc_Expression_typeof(threadData, _e);
          tmpMeta159 = mmc_mk_box4(20, &DAE_Exp_MATRIX__desc, _tp, mmc_mk_integer(((modelica_integer) 3)), _mexpl);
          tmpMeta1 = tmpMeta159;
          goto tmp3_done;
        }
        case 14: {
          modelica_metatype tmpMeta160;
          modelica_metatype tmpMeta161;
          modelica_metatype tmpMeta162;
          modelica_metatype tmpMeta163;
          modelica_metatype tmpMeta164;
          modelica_metatype tmpMeta165;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta160 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta160,1,1) == 0) goto tmp3_end;
          tmpMeta161 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta160), 2));
          if (4 != MMC_STRLEN(tmpMeta161) || strcmp(MMC_STRINGDATA(_OMC_LIT112), MMC_STRINGDATA(tmpMeta161)) != 0) goto tmp3_end;
          tmpMeta162 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta162)) goto tmp3_end;
          tmpMeta163 = MMC_CAR(tmpMeta162);
          tmpMeta164 = MMC_CDR(tmpMeta162);
          
          _e = tmpMeta163;
          _expl = tmpMeta164;
          tmp4 += 42; /* Pattern matching succeeded; we may skip some cases if we fail */
          _valueLst = omc_List_map(threadData, _expl, boxvar_ValuesUtil_expValue);

          tmpMeta165 = MMC_REFSTRUCTLIT(mmc_nil);
          omc_Static_elabBuiltinFill2(threadData, omc_FCore_noCache(threadData), omc_FGraph_empty(threadData), _e, omc_Expression_typeof(threadData, _e), _valueLst, _OMC_LIT91, _OMC_LIT92, tmpMeta165, _OMC_LIT93 ,&_outExp ,NULL);
          tmpMeta1 = _outExp;
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta166;
          modelica_metatype tmpMeta167;
          modelica_metatype tmpMeta168;
          modelica_metatype tmpMeta169;
          modelica_metatype tmpMeta170;
          modelica_metatype tmpMeta171;
          modelica_metatype tmpMeta172;
          modelica_metatype tmpMeta173;
          modelica_metatype tmpMeta174;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta166 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta166,1,1) == 0) goto tmp3_end;
          tmpMeta167 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta166), 2));
          if (6 != MMC_STRLEN(tmpMeta167) || strcmp(MMC_STRINGDATA(_OMC_LIT113), MMC_STRINGDATA(tmpMeta167)) != 0) goto tmp3_end;
          tmpMeta168 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta168)) goto tmp3_end;
          tmpMeta169 = MMC_CAR(tmpMeta168);
          tmpMeta170 = MMC_CDR(tmpMeta168);
          if (listEmpty(tmpMeta170)) goto tmp3_end;
          tmpMeta171 = MMC_CAR(tmpMeta170);
          tmpMeta172 = MMC_CDR(tmpMeta170);
          if (listEmpty(tmpMeta172)) goto tmp3_end;
          tmpMeta173 = MMC_CAR(tmpMeta172);
          tmpMeta174 = MMC_CDR(tmpMeta172);
          if (!listEmpty(tmpMeta174)) goto tmp3_end;
          
          _e = tmpMeta169;
          _len_exp = tmpMeta171;
          _just_exp = tmpMeta173;
          tmp4 += 41; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyBuiltinStringFormat(threadData, _e, _len_exp, _just_exp);
          goto tmp3_done;
        }
        case 16: {
          modelica_metatype tmpMeta175;
          modelica_metatype tmpMeta176;
          modelica_metatype tmpMeta177;
          modelica_metatype tmpMeta178;
          modelica_metatype tmpMeta179;
          modelica_metatype tmpMeta180;
          modelica_metatype tmpMeta181;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta175 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta175,1,1) == 0) goto tmp3_end;
          tmpMeta176 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta175), 2));
          if (16 != MMC_STRLEN(tmpMeta176) || strcmp(MMC_STRINGDATA(_OMC_LIT75), MMC_STRINGDATA(tmpMeta176)) != 0) goto tmp3_end;
          tmpMeta177 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta177)) goto tmp3_end;
          tmpMeta178 = MMC_CAR(tmpMeta177);
          tmpMeta179 = MMC_CDR(tmpMeta177);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta178,28,1) == 0) goto tmp3_end;
          tmpMeta180 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta178), 2));
          if (!listEmpty(tmpMeta179)) goto tmp3_end;
          
          _expl = tmpMeta180;
          tmp4 += 40; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta181 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta1 = omc_ExpressionSimplify_simplifyStringAppendList(threadData, _expl, tmpMeta181, 0 /* false */);
          goto tmp3_done;
        }
        case 17: {
          modelica_metatype tmpMeta182;
          modelica_metatype tmpMeta183;
          modelica_metatype tmpMeta184;
          modelica_metatype tmpMeta185;
          modelica_metatype tmpMeta186;
          modelica_metatype tmpMeta187;
          modelica_metatype tmpMeta188;
          modelica_metatype tmpMeta189;
          modelica_metatype tmpMeta190;
          modelica_metatype tmpMeta191;
          modelica_metatype tmpMeta192;
          modelica_metatype tmpMeta193;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta182 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta182,1,1) == 0) goto tmp3_end;
          tmpMeta183 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta182), 2));
          if (4 != MMC_STRLEN(tmpMeta183) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmpMeta183)) != 0) goto tmp3_end;
          tmpMeta184 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta184)) goto tmp3_end;
          tmpMeta185 = MMC_CAR(tmpMeta184);
          tmpMeta186 = MMC_CDR(tmpMeta184);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta185,7,3) == 0) goto tmp3_end;
          tmpMeta187 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta185), 2));
          tmpMeta188 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta185), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta188,4,1) == 0) goto tmp3_end;
          tmpMeta189 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta188), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta189,1,1) == 0) goto tmp3_end;
          tmpMeta190 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta185), 4));
          if (!listEmpty(tmpMeta186)) goto tmp3_end;
          
          _e1 = tmpMeta187;
          _e2 = tmpMeta190;
          tmp4 += 39; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta191 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT33, _OMC_LIT34, _e2);
          tmpMeta192 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _OMC_LIT36, tmpMeta191);
          _e = tmpMeta192;
          tmpMeta193 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT24, tmpMeta193, _OMC_LIT30);
          goto tmp3_done;
        }
        case 18: {
          modelica_metatype tmpMeta194;
          modelica_metatype tmpMeta195;
          modelica_metatype tmpMeta196;
          modelica_metatype tmpMeta197;
          modelica_metatype tmpMeta198;
          modelica_metatype tmpMeta199;
          modelica_metatype tmpMeta200;
          modelica_metatype tmpMeta201;
          modelica_metatype tmpMeta202;
          modelica_metatype tmpMeta203;
          modelica_metatype tmpMeta204;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta194 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta194,1,1) == 0) goto tmp3_end;
          tmpMeta195 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta194), 2));
          if (4 != MMC_STRLEN(tmpMeta195) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmpMeta195)) != 0) goto tmp3_end;
          tmpMeta196 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta196)) goto tmp3_end;
          tmpMeta197 = MMC_CAR(tmpMeta196);
          tmpMeta198 = MMC_CDR(tmpMeta196);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta197,13,3) == 0) goto tmp3_end;
          tmpMeta199 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta197), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta199,1,1) == 0) goto tmp3_end;
          tmpMeta200 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta199), 2));
          if (4 != MMC_STRLEN(tmpMeta200) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmpMeta200)) != 0) goto tmp3_end;
          tmpMeta201 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta197), 3));
          if (listEmpty(tmpMeta201)) goto tmp3_end;
          tmpMeta202 = MMC_CAR(tmpMeta201);
          tmpMeta203 = MMC_CDR(tmpMeta201);
          if (!listEmpty(tmpMeta203)) goto tmp3_end;
          if (!listEmpty(tmpMeta198)) goto tmp3_end;
          
          _e1 = tmpMeta202;
          tmp4 += 38; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta204 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _OMC_LIT36, _OMC_LIT95);
          tmpMeta1 = tmpMeta204;
          goto tmp3_done;
        }
        case 19: {
          modelica_metatype tmpMeta205;
          modelica_metatype tmpMeta206;
          modelica_metatype tmpMeta207;
          modelica_metatype tmpMeta208;
          modelica_metatype tmpMeta209;
          modelica_metatype tmpMeta210;
          modelica_metatype tmpMeta211;
          modelica_real tmp212;
          modelica_metatype tmpMeta213;
          modelica_metatype tmpMeta214;
          modelica_metatype tmpMeta215;
          modelica_boolean tmp216;
          modelica_metatype tmpMeta217;
          modelica_metatype tmpMeta218;
          modelica_metatype tmpMeta219;
          modelica_metatype tmpMeta220;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta205 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta205,1,1) == 0) goto tmp3_end;
          tmpMeta206 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta205), 2));
          if (4 != MMC_STRLEN(tmpMeta206) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmpMeta206)) != 0) goto tmp3_end;
          tmpMeta207 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta207)) goto tmp3_end;
          tmpMeta208 = MMC_CAR(tmpMeta207);
          tmpMeta209 = MMC_CDR(tmpMeta207);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta208,7,3) == 0) goto tmp3_end;
          tmpMeta210 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta208), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta210,1,1) == 0) goto tmp3_end;
          tmpMeta211 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta210), 2));
          tmp212 = mmc_unbox_real(tmpMeta211);
          tmpMeta213 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta208), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta213,2,1) == 0) goto tmp3_end;
          tmpMeta214 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta213), 2));
          tmpMeta215 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta208), 4));
          if (!listEmpty(tmpMeta209)) goto tmp3_end;
          
          _e1 = tmpMeta210;
          _r1 = tmp212  /* pattern as ty=Real */;
          _tp = tmpMeta214;
          _e2 = tmpMeta215;
          tmp4 += 37; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp216 = (_r1 >= 0.0);
          if (1 /* true */ != tmp216) goto goto_2;

          tmpMeta217 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          _e = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT35, tmpMeta217, _OMC_LIT30);

          tmpMeta218 = mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil));
          _e3 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT35, tmpMeta218, _OMC_LIT30);
          tmpMeta219 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _tp);
          tmpMeta220 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, tmpMeta219, _e3);
          tmpMeta1 = tmpMeta220;
          goto tmp3_done;
        }
        case 20: {
          modelica_metatype tmpMeta221;
          modelica_metatype tmpMeta222;
          modelica_metatype tmpMeta223;
          modelica_metatype tmpMeta224;
          modelica_metatype tmpMeta225;
          modelica_metatype tmpMeta226;
          modelica_metatype tmpMeta227;
          modelica_metatype tmpMeta228;
          modelica_metatype tmpMeta229;
          modelica_metatype tmpMeta230;
          modelica_metatype tmpMeta231;
          modelica_metatype tmpMeta232;
          modelica_metatype tmpMeta233;
          modelica_metatype tmpMeta234;
          modelica_metatype tmpMeta235;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta221 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta221,1,1) == 0) goto tmp3_end;
          tmpMeta222 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta221), 2));
          if (3 != MMC_STRLEN(tmpMeta222) || strcmp(MMC_STRINGDATA(_OMC_LIT25), MMC_STRINGDATA(tmpMeta222)) != 0) goto tmp3_end;
          tmpMeta223 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta223)) goto tmp3_end;
          tmpMeta224 = MMC_CAR(tmpMeta223);
          tmpMeta225 = MMC_CDR(tmpMeta223);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta224,8,2) == 0) goto tmp3_end;
          tmpMeta226 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta224), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta226,5,1) == 0) goto tmp3_end;
          tmpMeta227 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta224), 3));
          if (!listEmpty(tmpMeta225)) goto tmp3_end;
          
          _e1 = tmpMeta227;
          /* Pattern matching succeeded */
          _expl = omc_Expression_expandFactors(threadData, _e1);

          /* Pattern-matching tuple assignment */
          tmpMeta229 = omc_List_split1OnTrue(threadData, _expl, boxvar_Expression_isFunCall, _OMC_LIT69, &tmpMeta228);
          if (listEmpty(tmpMeta229)) goto goto_2;
          tmpMeta230 = MMC_CAR(tmpMeta229);
          tmpMeta231 = MMC_CDR(tmpMeta229);
          if (!listEmpty(tmpMeta231)) goto goto_2;
          _e2 = tmpMeta230;
          _es = tmpMeta228;

          /* Pattern-matching assignment */
          tmpMeta232 = _e2;
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta232,13,3) == 0) goto goto_2;
          tmpMeta233 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta232), 3));
          if (listEmpty(tmpMeta233)) goto goto_2;
          tmpMeta234 = MMC_CAR(tmpMeta233);
          tmpMeta235 = MMC_CDR(tmpMeta233);
          if (!listEmpty(tmpMeta235)) goto goto_2;
          _e = tmpMeta234;

          _e3 = omc_Expression_makeProductLst(threadData, _es);
          tmpMeta1 = omc_Expression_expPow(threadData, _e, omc_Expression_negate(threadData, _e3));
          goto tmp3_done;
        }
        case 21: {
          modelica_metatype tmpMeta236;
          modelica_metatype tmpMeta237;
          modelica_metatype tmpMeta238;
          modelica_metatype tmpMeta239;
          modelica_metatype tmpMeta240;
          modelica_metatype tmpMeta241;
          modelica_metatype tmpMeta242;
          modelica_metatype tmpMeta243;
          modelica_metatype tmpMeta244;
          modelica_metatype tmpMeta245;
          modelica_metatype tmpMeta246;
          modelica_metatype tmpMeta247;
          modelica_metatype tmpMeta248;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta236 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta236,1,1) == 0) goto tmp3_end;
          tmpMeta237 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta236), 2));
          if (3 != MMC_STRLEN(tmpMeta237) || strcmp(MMC_STRINGDATA(_OMC_LIT25), MMC_STRINGDATA(tmpMeta237)) != 0) goto tmp3_end;
          tmpMeta238 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta238)) goto tmp3_end;
          tmpMeta239 = MMC_CAR(tmpMeta238);
          tmpMeta240 = MMC_CDR(tmpMeta238);
          if (!listEmpty(tmpMeta240)) goto tmp3_end;
          
          _e1 = tmpMeta239;
          tmp4 += 35; /* Pattern matching succeeded; we may skip some cases if we fail */
          _expl = omc_Expression_expandFactors(threadData, _e1);

          /* Pattern-matching tuple assignment */
          tmpMeta242 = omc_List_split1OnTrue(threadData, _expl, boxvar_Expression_isFunCall, _OMC_LIT69, &tmpMeta241);
          if (listEmpty(tmpMeta242)) goto goto_2;
          tmpMeta243 = MMC_CAR(tmpMeta242);
          tmpMeta244 = MMC_CDR(tmpMeta242);
          if (!listEmpty(tmpMeta244)) goto goto_2;
          _e2 = tmpMeta243;
          _es = tmpMeta241;

          /* Pattern-matching assignment */
          tmpMeta245 = _e2;
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta245,13,3) == 0) goto goto_2;
          tmpMeta246 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta245), 3));
          if (listEmpty(tmpMeta246)) goto goto_2;
          tmpMeta247 = MMC_CAR(tmpMeta246);
          tmpMeta248 = MMC_CDR(tmpMeta246);
          if (!listEmpty(tmpMeta248)) goto goto_2;
          _e = tmpMeta247;

          _e3 = omc_Expression_makeProductLst(threadData, _es);
          tmpMeta1 = omc_Expression_expPow(threadData, _e, _e3);
          goto tmp3_done;
        }
        case 22: {
          modelica_metatype tmpMeta249;
          modelica_metatype tmpMeta250;
          modelica_metatype tmpMeta251;
          modelica_metatype tmpMeta252;
          modelica_metatype tmpMeta253;
          modelica_metatype tmpMeta254;
          modelica_metatype tmpMeta255;
          modelica_metatype tmpMeta256;
          modelica_metatype tmpMeta257;
          modelica_metatype tmpMeta258;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta249 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta249,13,3) == 0) goto tmp3_end;
          tmpMeta250 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta249), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta250,1,1) == 0) goto tmp3_end;
          tmpMeta251 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta250), 2));
          if (3 != MMC_STRLEN(tmpMeta251) || strcmp(MMC_STRINGDATA(_OMC_LIT25), MMC_STRINGDATA(tmpMeta251)) != 0) goto tmp3_end;
          tmpMeta252 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta249), 3));
          if (listEmpty(tmpMeta252)) goto tmp3_end;
          tmpMeta253 = MMC_CAR(tmpMeta252);
          tmpMeta254 = MMC_CDR(tmpMeta252);
          if (!listEmpty(tmpMeta254)) goto tmp3_end;
          tmpMeta255 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta255,4,1) == 0) goto tmp3_end;
          tmpMeta256 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta255), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta256,1,1) == 0) goto tmp3_end;
          tmpMeta257 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e = tmpMeta253;
          _e2 = tmpMeta257;
          tmp4 += 34; /* Pattern matching succeeded; we may skip some cases if we fail */
          _e3 = omc_Expression_expMul(threadData, _e, _e2);
          tmpMeta258 = mmc_mk_cons(_e3, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT25, tmpMeta258, _OMC_LIT30);
          goto tmp3_done;
        }
        case 23: {
          modelica_metatype tmpMeta259;
          modelica_metatype tmpMeta260;
          modelica_metatype tmpMeta261;
          modelica_metatype tmpMeta262;
          modelica_metatype tmpMeta263;
          modelica_metatype tmpMeta264;
          modelica_metatype tmpMeta265;
          modelica_metatype tmpMeta266;
          modelica_metatype tmpMeta267;
          modelica_metatype tmpMeta268;
          modelica_real tmp269;
          modelica_real tmp270;
          modelica_metatype tmpMeta271;
          modelica_metatype tmpMeta272;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta259 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta259,1,1) == 0) goto tmp3_end;
          tmpMeta260 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta259), 2));
          if (3 != MMC_STRLEN(tmpMeta260) || strcmp(MMC_STRINGDATA(_OMC_LIT69), MMC_STRINGDATA(tmpMeta260)) != 0) goto tmp3_end;
          tmpMeta261 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta261)) goto tmp3_end;
          tmpMeta262 = MMC_CAR(tmpMeta261);
          tmpMeta263 = MMC_CDR(tmpMeta261);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta262,7,3) == 0) goto tmp3_end;
          tmpMeta264 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta262), 2));
          tmpMeta265 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta262), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta265,4,1) == 0) goto tmp3_end;
          tmpMeta266 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta265), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta266,1,1) == 0) goto tmp3_end;
          tmpMeta267 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta262), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta267,1,1) == 0) goto tmp3_end;
          tmpMeta268 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta267), 2));
          tmp269 = mmc_unbox_real(tmpMeta268);
          if (!listEmpty(tmpMeta263)) goto tmp3_end;
          
          _e1 = tmpMeta264;
          _r1 = tmp269  /* pattern as ty=Real */;
          tmp4 += 33; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp270 = modelica_real_mod(_r1, 2.0);
          if (1.0 != tmp270) goto goto_2;

          tmpMeta271 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          _e3 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT69, tmpMeta271, _OMC_LIT30);
          tmpMeta272 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r1));
          tmpMeta1 = omc_Expression_expMul(threadData, tmpMeta272, _e3);
          goto tmp3_done;
        }
        case 24: {
          modelica_metatype tmpMeta273;
          modelica_metatype tmpMeta274;
          modelica_metatype tmpMeta275;
          modelica_metatype tmpMeta276;
          modelica_metatype tmpMeta277;
          modelica_metatype tmpMeta278;
          modelica_metatype tmpMeta279;
          modelica_real tmp280;
          modelica_metatype tmpMeta281;
          modelica_metatype tmpMeta282;
          modelica_metatype tmpMeta283;
          modelica_metatype tmpMeta284;
          modelica_metatype tmpMeta285;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta273 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta273,1,1) == 0) goto tmp3_end;
          tmpMeta274 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta273), 2));
          if (3 != MMC_STRLEN(tmpMeta274) || strcmp(MMC_STRINGDATA(_OMC_LIT69), MMC_STRINGDATA(tmpMeta274)) != 0) goto tmp3_end;
          tmpMeta275 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta275)) goto tmp3_end;
          tmpMeta276 = MMC_CAR(tmpMeta275);
          tmpMeta277 = MMC_CDR(tmpMeta275);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta276,7,3) == 0) goto tmp3_end;
          tmpMeta278 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta276), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta278,1,1) == 0) goto tmp3_end;
          tmpMeta279 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta278), 2));
          tmp280 = mmc_unbox_real(tmpMeta279);
          if (1.0 != tmp280) goto tmp3_end;
          tmpMeta281 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta276), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta281,3,1) == 0) goto tmp3_end;
          tmpMeta282 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta281), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta282,1,1) == 0) goto tmp3_end;
          tmpMeta283 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta276), 4));
          if (!listEmpty(tmpMeta277)) goto tmp3_end;
          
          _e2 = tmpMeta283;
          tmp4 += 32; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta284 = mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil));
          _e3 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT69, tmpMeta284, _OMC_LIT30);
          tmpMeta285 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _OMC_LIT96, _e3);
          tmpMeta1 = tmpMeta285;
          goto tmp3_done;
        }
        case 25: {
          modelica_metatype tmpMeta286;
          modelica_metatype tmpMeta287;
          modelica_metatype tmpMeta288;
          modelica_metatype tmpMeta289;
          modelica_metatype tmpMeta290;
          modelica_metatype tmpMeta291;
          modelica_metatype tmpMeta292;
          modelica_metatype tmpMeta293;
          modelica_metatype tmpMeta294;
          modelica_metatype tmpMeta295;
          modelica_metatype tmpMeta296;
          modelica_metatype tmpMeta297;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta286 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta286,1,1) == 0) goto tmp3_end;
          tmpMeta287 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta286), 2));
          if (3 != MMC_STRLEN(tmpMeta287) || strcmp(MMC_STRINGDATA(_OMC_LIT69), MMC_STRINGDATA(tmpMeta287)) != 0) goto tmp3_end;
          tmpMeta288 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta288)) goto tmp3_end;
          tmpMeta289 = MMC_CAR(tmpMeta288);
          tmpMeta290 = MMC_CDR(tmpMeta288);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta289,13,3) == 0) goto tmp3_end;
          tmpMeta291 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta289), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta291,1,1) == 0) goto tmp3_end;
          tmpMeta292 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta291), 2));
          if (4 != MMC_STRLEN(tmpMeta292) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmpMeta292)) != 0) goto tmp3_end;
          tmpMeta293 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta289), 3));
          if (listEmpty(tmpMeta293)) goto tmp3_end;
          tmpMeta294 = MMC_CAR(tmpMeta293);
          tmpMeta295 = MMC_CDR(tmpMeta293);
          if (!listEmpty(tmpMeta295)) goto tmp3_end;
          if (!listEmpty(tmpMeta290)) goto tmp3_end;
          
          _e1 = tmpMeta294;
          tmp4 += 31; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta296 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          _e3 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT69, tmpMeta296, _OMC_LIT30);
          tmpMeta297 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT33, _OMC_LIT34, _e3);
          tmpMeta1 = tmpMeta297;
          goto tmp3_done;
        }
        case 26: {
          modelica_metatype tmpMeta298;
          modelica_metatype tmpMeta299;
          modelica_metatype tmpMeta300;
          modelica_metatype tmpMeta301;
          modelica_metatype tmpMeta302;
          modelica_metatype tmpMeta303;
          modelica_metatype tmpMeta304;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta298 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta298,1,1) == 0) goto tmp3_end;
          tmpMeta299 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta298), 2));
          if (6 != MMC_STRLEN(tmpMeta299) || strcmp(MMC_STRINGDATA(_OMC_LIT114), MMC_STRINGDATA(tmpMeta299)) != 0) goto tmp3_end;
          tmpMeta300 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta300)) goto tmp3_end;
          tmpMeta301 = MMC_CAR(tmpMeta300);
          tmpMeta302 = MMC_CDR(tmpMeta300);
          if (listEmpty(tmpMeta302)) goto tmp3_end;
          tmpMeta303 = MMC_CAR(tmpMeta302);
          tmpMeta304 = MMC_CDR(tmpMeta302);
          if (!listEmpty(tmpMeta304)) goto tmp3_end;
          
          _e1 = tmpMeta303;
          tmp4 += 30; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_isConst(threadData, _e1)) goto tmp3_end;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 27: {
          modelica_metatype tmpMeta305;
          modelica_metatype tmpMeta306;
          modelica_metatype tmpMeta307;
          modelica_metatype tmpMeta308;
          modelica_metatype tmpMeta309;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta305 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta305,1,1) == 0) goto tmp3_end;
          tmpMeta306 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta305), 2));
          if (8 != MMC_STRLEN(tmpMeta306) || strcmp(MMC_STRINGDATA(_OMC_LIT115), MMC_STRINGDATA(tmpMeta306)) != 0) goto tmp3_end;
          tmpMeta307 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta307)) goto tmp3_end;
          tmpMeta308 = MMC_CAR(tmpMeta307);
          tmpMeta309 = MMC_CDR(tmpMeta307);
          if (!listEmpty(tmpMeta309)) goto tmp3_end;
          
          _e1 = tmpMeta308;
          tmp4 += 29; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_isConst(threadData, _e1)) goto tmp3_end;
          tmpMeta1 = omc_Expression_makeConstZeroE(threadData, _e1);
          goto tmp3_done;
        }
        case 28: {
          modelica_metatype tmpMeta310;
          modelica_metatype tmpMeta311;
          modelica_metatype tmpMeta312;
          modelica_metatype tmpMeta313;
          modelica_metatype tmpMeta314;
          modelica_metatype tmpMeta315;
          modelica_metatype tmpMeta316;
          modelica_metatype tmpMeta317;
          modelica_metatype tmpMeta318;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta310 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta310,1,1) == 0) goto tmp3_end;
          tmpMeta311 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta310), 2));
          if (5 != MMC_STRLEN(tmpMeta311) || strcmp(MMC_STRINGDATA(_OMC_LIT97), MMC_STRINGDATA(tmpMeta311)) != 0) goto tmp3_end;
          tmpMeta312 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta312)) goto tmp3_end;
          tmpMeta313 = MMC_CAR(tmpMeta312);
          tmpMeta314 = MMC_CDR(tmpMeta312);
          if (listEmpty(tmpMeta314)) goto tmp3_end;
          tmpMeta315 = MMC_CAR(tmpMeta314);
          tmpMeta316 = MMC_CDR(tmpMeta314);
          if (!listEmpty(tmpMeta316)) goto tmp3_end;
          
          _e = tmp4_1;
          _e1 = tmpMeta313;
          _e2 = tmpMeta315;
          tmp4 += 28; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta318 = mmc_mk_cons(_e1, mmc_mk_cons(_e2, mmc_mk_cons(_e2, MMC_REFSTRUCTLIT(mmc_nil))));
          tmpMeta317 = MMC_TAGPTR(mmc_alloc_words(5));
          memcpy(MMC_UNTAGPTR(tmpMeta317), MMC_UNTAGPTR(_e), 5*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta317))[3] = tmpMeta318;
          _e = tmpMeta317;
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 29: {
          modelica_metatype tmpMeta319;
          modelica_metatype tmpMeta320;
          modelica_metatype tmpMeta321;
          modelica_metatype tmpMeta322;
          modelica_metatype tmpMeta323;
          modelica_metatype tmpMeta324;
          modelica_metatype tmpMeta325;
          modelica_metatype tmpMeta326;
          modelica_metatype tmpMeta327;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta319 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta319,1,1) == 0) goto tmp3_end;
          tmpMeta320 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta319), 2));
          if (5 != MMC_STRLEN(tmpMeta320) || strcmp(MMC_STRINGDATA(_OMC_LIT97), MMC_STRINGDATA(tmpMeta320)) != 0) goto tmp3_end;
          tmpMeta321 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta321)) goto tmp3_end;
          tmpMeta322 = MMC_CAR(tmpMeta321);
          tmpMeta323 = MMC_CDR(tmpMeta321);
          if (listEmpty(tmpMeta323)) goto tmp3_end;
          tmpMeta324 = MMC_CAR(tmpMeta323);
          tmpMeta325 = MMC_CDR(tmpMeta323);
          if (listEmpty(tmpMeta325)) goto tmp3_end;
          tmpMeta326 = MMC_CAR(tmpMeta325);
          tmpMeta327 = MMC_CDR(tmpMeta325);
          if (!listEmpty(tmpMeta327)) goto tmp3_end;
          
          _e1 = tmpMeta322;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isConst(threadData, _e1)) goto tmp3_end;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 30: {
          modelica_metatype tmpMeta328;
          modelica_metatype tmpMeta329;
          modelica_metatype tmpMeta330;
          modelica_metatype tmpMeta331;
          modelica_metatype tmpMeta332;
          modelica_metatype tmpMeta333;
          modelica_metatype tmpMeta334;
          modelica_metatype tmpMeta335;
          modelica_metatype tmpMeta336;
          modelica_metatype tmpMeta337;
          modelica_metatype tmpMeta338;
          modelica_metatype tmpMeta339;
          modelica_metatype tmpMeta340;
          modelica_metatype tmpMeta341;
          modelica_boolean tmp342;
          modelica_metatype tmpMeta343;
          modelica_metatype tmpMeta344;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta328 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta328,1,1) == 0) goto tmp3_end;
          tmpMeta329 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta328), 2));
          if (5 != MMC_STRLEN(tmpMeta329) || strcmp(MMC_STRINGDATA(_OMC_LIT97), MMC_STRINGDATA(tmpMeta329)) != 0) goto tmp3_end;
          tmpMeta330 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta330)) goto tmp3_end;
          tmpMeta331 = MMC_CAR(tmpMeta330);
          tmpMeta332 = MMC_CDR(tmpMeta330);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta331,7,3) == 0) goto tmp3_end;
          tmpMeta333 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta331), 2));
          tmpMeta334 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta331), 3));
          tmpMeta335 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta331), 4));
          if (listEmpty(tmpMeta332)) goto tmp3_end;
          tmpMeta336 = MMC_CAR(tmpMeta332);
          tmpMeta337 = MMC_CDR(tmpMeta332);
          if (listEmpty(tmpMeta337)) goto tmp3_end;
          tmpMeta338 = MMC_CAR(tmpMeta337);
          tmpMeta339 = MMC_CDR(tmpMeta337);
          if (!listEmpty(tmpMeta339)) goto tmp3_end;
          tmpMeta340 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta341 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta340), 2));
          
          _e1 = tmpMeta333;
          _op = tmpMeta334;
          _e2 = tmpMeta335;
          _e3 = tmpMeta336;
          _e4 = tmpMeta338;
          _tp = tmpMeta341;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp342 = omc_Expression_isConst(threadData, _e1);
          if (1 /* true */ != tmp342) goto goto_2;

          tmpMeta343 = mmc_mk_cons(_e2, mmc_mk_cons(_e3, mmc_mk_cons(_e4, MMC_REFSTRUCTLIT(mmc_nil))));
          _e = omc_Expression_makeImpureBuiltinCall(threadData, _OMC_LIT97, tmpMeta343, _tp);
          tmpMeta344 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e1, _op, _e);
          tmpMeta1 = tmpMeta344;
          goto tmp3_done;
        }
        case 31: {
          modelica_metatype tmpMeta345;
          modelica_metatype tmpMeta346;
          modelica_metatype tmpMeta347;
          modelica_metatype tmpMeta348;
          modelica_metatype tmpMeta349;
          modelica_metatype tmpMeta350;
          modelica_metatype tmpMeta351;
          modelica_metatype tmpMeta352;
          modelica_metatype tmpMeta353;
          modelica_metatype tmpMeta354;
          modelica_metatype tmpMeta355;
          modelica_metatype tmpMeta356;
          modelica_metatype tmpMeta357;
          modelica_metatype tmpMeta358;
          modelica_boolean tmp359;
          modelica_metatype tmpMeta360;
          modelica_metatype tmpMeta361;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta345 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta345,1,1) == 0) goto tmp3_end;
          tmpMeta346 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta345), 2));
          if (5 != MMC_STRLEN(tmpMeta346) || strcmp(MMC_STRINGDATA(_OMC_LIT97), MMC_STRINGDATA(tmpMeta346)) != 0) goto tmp3_end;
          tmpMeta347 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta347)) goto tmp3_end;
          tmpMeta348 = MMC_CAR(tmpMeta347);
          tmpMeta349 = MMC_CDR(tmpMeta347);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta348,7,3) == 0) goto tmp3_end;
          tmpMeta350 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta348), 2));
          tmpMeta351 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta348), 3));
          tmpMeta352 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta348), 4));
          if (listEmpty(tmpMeta349)) goto tmp3_end;
          tmpMeta353 = MMC_CAR(tmpMeta349);
          tmpMeta354 = MMC_CDR(tmpMeta349);
          if (listEmpty(tmpMeta354)) goto tmp3_end;
          tmpMeta355 = MMC_CAR(tmpMeta354);
          tmpMeta356 = MMC_CDR(tmpMeta354);
          if (!listEmpty(tmpMeta356)) goto tmp3_end;
          tmpMeta357 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta358 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta357), 2));
          
          _e1 = tmpMeta350;
          _op = tmpMeta351;
          _e2 = tmpMeta352;
          _e3 = tmpMeta353;
          _e4 = tmpMeta355;
          _tp = tmpMeta358;
          tmp4 += 25; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching assignment */
          tmp359 = omc_Expression_isConst(threadData, _e2);
          if (1 /* true */ != tmp359) goto goto_2;

          tmpMeta360 = mmc_mk_cons(_e1, mmc_mk_cons(_e3, mmc_mk_cons(_e4, MMC_REFSTRUCTLIT(mmc_nil))));
          _e = omc_Expression_makeImpureBuiltinCall(threadData, _OMC_LIT97, tmpMeta360, _tp);
          tmpMeta361 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _op, _e2);
          tmpMeta1 = tmpMeta361;
          goto tmp3_done;
        }
        case 32: {
          modelica_metatype tmpMeta362;
          modelica_metatype tmpMeta363;
          modelica_metatype tmpMeta364;
          modelica_metatype tmpMeta365;
          modelica_metatype tmpMeta366;
          modelica_metatype tmpMeta367;
          modelica_metatype tmpMeta368;
          modelica_metatype tmpMeta369;
          modelica_metatype tmpMeta370;
          modelica_metatype tmpMeta371;
          modelica_metatype tmpMeta372;
          modelica_metatype tmpMeta373;
          modelica_metatype tmpMeta374;
          modelica_metatype tmpMeta375;
          modelica_metatype tmpMeta376;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta362 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta362,1,1) == 0) goto tmp3_end;
          tmpMeta363 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta362), 2));
          if (5 != MMC_STRLEN(tmpMeta363) || strcmp(MMC_STRINGDATA(_OMC_LIT97), MMC_STRINGDATA(tmpMeta363)) != 0) goto tmp3_end;
          tmpMeta364 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta364)) goto tmp3_end;
          tmpMeta365 = MMC_CAR(tmpMeta364);
          tmpMeta366 = MMC_CDR(tmpMeta364);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta365,8,2) == 0) goto tmp3_end;
          tmpMeta367 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta365), 2));
          tmpMeta368 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta365), 3));
          if (listEmpty(tmpMeta366)) goto tmp3_end;
          tmpMeta369 = MMC_CAR(tmpMeta366);
          tmpMeta370 = MMC_CDR(tmpMeta366);
          if (listEmpty(tmpMeta370)) goto tmp3_end;
          tmpMeta371 = MMC_CAR(tmpMeta370);
          tmpMeta372 = MMC_CDR(tmpMeta370);
          if (!listEmpty(tmpMeta372)) goto tmp3_end;
          tmpMeta373 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta374 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta373), 2));
          
          _op = tmpMeta367;
          _e = tmpMeta368;
          _e3 = tmpMeta369;
          _e4 = tmpMeta371;
          _tp = tmpMeta374;
          tmp4 += 24; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta375 = mmc_mk_cons(_e, mmc_mk_cons(_e3, mmc_mk_cons(_e4, MMC_REFSTRUCTLIT(mmc_nil))));
          _e = omc_Expression_makeImpureBuiltinCall(threadData, _OMC_LIT97, tmpMeta375, _tp);
          tmpMeta376 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, _op, _e);
          tmpMeta1 = tmpMeta376;
          goto tmp3_done;
        }
        case 33: {
          modelica_metatype tmpMeta377;
          modelica_metatype tmpMeta378;
          modelica_metatype tmpMeta379;
          modelica_metatype tmpMeta380;
          modelica_metatype tmpMeta381;
          modelica_metatype tmpMeta382;
          modelica_metatype tmpMeta383;
          modelica_metatype tmpMeta384;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta377 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta377,1,1) == 0) goto tmp3_end;
          tmpMeta378 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta377), 2));
          if (3 != MMC_STRLEN(tmpMeta378) || strcmp(MMC_STRINGDATA(_OMC_LIT99), MMC_STRINGDATA(tmpMeta378)) != 0) goto tmp3_end;
          tmpMeta379 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta379)) goto tmp3_end;
          tmpMeta380 = MMC_CAR(tmpMeta379);
          tmpMeta381 = MMC_CDR(tmpMeta379);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta380,16,3) == 0) goto tmp3_end;
          tmpMeta382 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta380), 4));
          if (!listEmpty(tmpMeta382)) goto tmp3_end;
          if (!listEmpty(tmpMeta381)) goto tmp3_end;
          tmpMeta383 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta384 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta383), 2));
          
          _tp1 = tmpMeta384;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_Expression_makeConstZero(threadData, _tp1);
          goto tmp3_done;
        }
        case 34: {
          modelica_metatype tmpMeta385;
          modelica_metatype tmpMeta386;
          modelica_metatype tmpMeta387;
          modelica_metatype tmpMeta388;
          modelica_metatype tmpMeta389;
          modelica_metatype tmpMeta390;
          modelica_metatype tmpMeta391;
          modelica_metatype tmpMeta392;
          modelica_metatype tmpMeta393;
          modelica_metatype tmpMeta394;
          modelica_metatype tmpMeta395;
          modelica_metatype tmpMeta396;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta385 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta385,1,1) == 0) goto tmp3_end;
          tmpMeta386 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta385), 2));
          if (3 != MMC_STRLEN(tmpMeta386) || strcmp(MMC_STRINGDATA(_OMC_LIT99), MMC_STRINGDATA(tmpMeta386)) != 0) goto tmp3_end;
          tmpMeta387 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta387)) goto tmp3_end;
          tmpMeta388 = MMC_CAR(tmpMeta387);
          tmpMeta389 = MMC_CDR(tmpMeta387);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta388,17,3) == 0) goto tmp3_end;
          tmpMeta390 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta388), 2));
          tmpMeta391 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta388), 4));
          if (!listEmpty(tmpMeta389)) goto tmp3_end;
          tmpMeta392 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta393 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta392), 2));
          
          _tp1 = tmpMeta390;
          _mexpl = tmpMeta391;
          _tp2 = tmpMeta393;
          tmp4 += 22; /* Pattern matching succeeded; we may skip some cases if we fail */
          _es = omc_List_flatten(threadData, _mexpl);

          _tp1 = omc_Expression_unliftArray(threadData, omc_Expression_unliftArray(threadData, _tp1));

          _sc = (!omc_Expression_isArrayType(threadData, _tp1));

          _tp1 = (_sc?omc_Expression_unliftArray(threadData, _tp1):_tp1);

          _tp1 = (_sc?omc_Expression_liftArrayLeft(threadData, _tp1, _OMC_LIT98):_tp1);

          _dim = listLength(_es);

          tmpMeta394 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_dim));
          _tp1 = omc_Expression_liftArrayLeft(threadData, _tp1, tmpMeta394);

          tmpMeta395 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _tp1, mmc_mk_boolean(_sc), _es);
          _e = tmpMeta395;
          tmpMeta396 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT99, tmpMeta396, _tp2);
          goto tmp3_done;
        }
        case 35: {
          modelica_metatype tmpMeta397;
          modelica_metatype tmpMeta398;
          modelica_metatype tmpMeta399;
          modelica_metatype tmpMeta400;
          modelica_metatype tmpMeta401;
          modelica_metatype tmpMeta402;
          modelica_metatype tmpMeta403;
          modelica_integer tmp404;
          modelica_metatype tmpMeta405;
          modelica_metatype tmpMeta406;
          modelica_metatype tmpMeta407;
          modelica_metatype tmpMeta408;
          modelica_metatype tmpMeta409;
          modelica_metatype tmpMeta410;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta397 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta397,1,1) == 0) goto tmp3_end;
          tmpMeta398 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta397), 2));
          if (3 != MMC_STRLEN(tmpMeta398) || strcmp(MMC_STRINGDATA(_OMC_LIT99), MMC_STRINGDATA(tmpMeta398)) != 0) goto tmp3_end;
          tmpMeta399 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta399)) goto tmp3_end;
          tmpMeta400 = MMC_CAR(tmpMeta399);
          tmpMeta401 = MMC_CDR(tmpMeta399);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta400,16,3) == 0) goto tmp3_end;
          tmpMeta402 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta400), 2));
          tmpMeta403 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta400), 3));
          tmp404 = mmc_unbox_integer(tmpMeta403);
          if (0 /* false */ != tmp404) goto tmp3_end;
          tmpMeta405 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta400), 4));
          if (!listEmpty(tmpMeta401)) goto tmp3_end;
          tmpMeta406 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta407 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta406), 2));
          
          _tp1 = tmpMeta402;
          _es = tmpMeta405;
          _tp2 = tmpMeta407;
          /* Pattern matching succeeded */
          _es = omc_ExpressionSimplify_simplifyCat(threadData, ((modelica_integer) 1), _es);

          _tp1 = omc_Expression_unliftArray(threadData, _tp1);

          _sc = (!omc_Expression_isArrayType(threadData, _tp1));

          _tp1 = (_sc?omc_Expression_unliftArray(threadData, _tp1):_tp1);

          _tp1 = (_sc?omc_Expression_liftArrayLeft(threadData, _tp1, _OMC_LIT98):_tp1);

          _dim = listLength(_es);

          tmpMeta408 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_dim));
          _tp1 = omc_Expression_liftArrayLeft(threadData, _tp1, tmpMeta408);

          tmpMeta409 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _tp1, mmc_mk_boolean(_sc), _es);
          _e = tmpMeta409;
          tmpMeta410 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT99, tmpMeta410, _tp2);
          goto tmp3_done;
        }
        case 36: {
          modelica_metatype tmpMeta411;
          modelica_metatype tmpMeta412;
          modelica_metatype tmpMeta413;
          modelica_metatype tmpMeta414;
          modelica_metatype tmpMeta415;
          modelica_metatype tmpMeta416;
          modelica_integer tmp417;
          modelica_metatype tmpMeta418;
          modelica_metatype tmpMeta419;
          modelica_metatype tmpMeta420;
          modelica_metatype tmpMeta421;
          modelica_metatype tmpMeta422;
          modelica_metatype tmpMeta423;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta411 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta411,1,1) == 0) goto tmp3_end;
          tmpMeta412 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta411), 2));
          if (3 != MMC_STRLEN(tmpMeta412) || strcmp(MMC_STRINGDATA(_OMC_LIT99), MMC_STRINGDATA(tmpMeta412)) != 0) goto tmp3_end;
          tmpMeta413 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta413)) goto tmp3_end;
          tmpMeta414 = MMC_CAR(tmpMeta413);
          tmpMeta415 = MMC_CDR(tmpMeta413);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta414,16,3) == 0) goto tmp3_end;
          tmpMeta416 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta414), 3));
          tmp417 = mmc_unbox_integer(tmpMeta416);
          if (0 /* false */ != tmp417) goto tmp3_end;
          tmpMeta418 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta414), 4));
          if (listEmpty(tmpMeta418)) goto tmp3_end;
          tmpMeta419 = MMC_CAR(tmpMeta418);
          tmpMeta420 = MMC_CDR(tmpMeta418);
          if (!listEmpty(tmpMeta420)) goto tmp3_end;
          if (!listEmpty(tmpMeta415)) goto tmp3_end;
          tmpMeta421 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta422 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta421), 2));
          
          _e = tmpMeta419;
          _tp2 = tmpMeta422;
          tmp4 += 20; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta423 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT99, tmpMeta423, _tp2);
          goto tmp3_done;
        }
        case 37: {
          modelica_metatype tmpMeta424;
          modelica_metatype tmpMeta425;
          modelica_metatype tmpMeta426;
          modelica_metatype tmpMeta427;
          modelica_metatype tmpMeta428;
          modelica_metatype tmpMeta429;
          modelica_integer tmp430;
          modelica_metatype tmpMeta431;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta424 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta424,1,1) == 0) goto tmp3_end;
          tmpMeta425 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta424), 2));
          if (3 != MMC_STRLEN(tmpMeta425) || strcmp(MMC_STRINGDATA(_OMC_LIT99), MMC_STRINGDATA(tmpMeta425)) != 0) goto tmp3_end;
          tmpMeta426 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta426)) goto tmp3_end;
          tmpMeta427 = MMC_CAR(tmpMeta426);
          tmpMeta428 = MMC_CDR(tmpMeta426);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta427,16,3) == 0) goto tmp3_end;
          tmpMeta429 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta427), 3));
          tmp430 = mmc_unbox_integer(tmpMeta429);
          if (1 /* true */ != tmp430) goto tmp3_end;
          tmpMeta431 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta427), 4));
          if (!listEmpty(tmpMeta428)) goto tmp3_end;
          
          _es = tmpMeta431;
          tmp4 += 19; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_Expression_makeSum(threadData, _es);
          goto tmp3_done;
        }
        case 38: {
          modelica_metatype tmpMeta432;
          modelica_metatype tmpMeta433;
          modelica_metatype tmpMeta434;
          modelica_metatype tmpMeta435;
          modelica_metatype tmpMeta436;
          modelica_metatype tmpMeta437;
          modelica_metatype tmpMeta438;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta432 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta432,1,1) == 0) goto tmp3_end;
          tmpMeta433 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta432), 2));
          if (3 != MMC_STRLEN(tmpMeta433) || strcmp(MMC_STRINGDATA(_OMC_LIT100), MMC_STRINGDATA(tmpMeta433)) != 0) goto tmp3_end;
          tmpMeta434 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta434)) goto tmp3_end;
          tmpMeta435 = MMC_CAR(tmpMeta434);
          tmpMeta436 = MMC_CDR(tmpMeta434);
          if (listEmpty(tmpMeta436)) goto tmp3_end;
          tmpMeta437 = MMC_CAR(tmpMeta436);
          tmpMeta438 = MMC_CDR(tmpMeta436);
          if (!listEmpty(tmpMeta438)) goto tmp3_end;
          
          _e1 = tmpMeta437;
          /* Pattern matching succeeded */
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 39: {
          modelica_metatype tmpMeta439;
          modelica_metatype tmpMeta440;
          modelica_metatype tmpMeta441;
          modelica_metatype tmpMeta442;
          modelica_metatype tmpMeta443;
          modelica_metatype tmpMeta444;
          modelica_integer tmp445;
          modelica_metatype tmpMeta446;
          modelica_metatype tmpMeta447;
          modelica_metatype tmpMeta448;
          modelica_metatype tmpMeta449;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta439 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta439,1,1) == 0) goto tmp3_end;
          tmpMeta440 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta439), 2));
          if (3 != MMC_STRLEN(tmpMeta440) || strcmp(MMC_STRINGDATA(_OMC_LIT100), MMC_STRINGDATA(tmpMeta440)) != 0) goto tmp3_end;
          tmpMeta441 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta441)) goto tmp3_end;
          tmpMeta442 = MMC_CAR(tmpMeta441);
          tmpMeta443 = MMC_CDR(tmpMeta441);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta442,0,1) == 0) goto tmp3_end;
          tmpMeta444 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta442), 2));
          tmp445 = mmc_unbox_integer(tmpMeta444);
          tmpMeta446 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta447 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta446), 2));
          
          _i = tmp445  /* pattern as ty=Integer */;
          _es = tmpMeta443;
          _tp = tmpMeta447;
          /* Pattern matching succeeded */
          _es = omc_ExpressionSimplify_simplifyCat(threadData, _i, _es);
          tmpMeta449 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_i));
          tmpMeta448 = mmc_mk_cons(tmpMeta449, _es);
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT100, tmpMeta448, _tp);
          goto tmp3_done;
        }
        case 40: {
          modelica_metatype tmpMeta450;
          modelica_metatype tmpMeta451;
          modelica_metatype tmpMeta452;
          modelica_metatype tmpMeta453;
          modelica_metatype tmpMeta454;
          modelica_metatype tmpMeta455;
          modelica_integer tmp456;
          modelica_metatype tmpMeta457;
          modelica_metatype tmpMeta458;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta450 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta450,1,1) == 0) goto tmp3_end;
          tmpMeta451 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta450), 2));
          if (3 != MMC_STRLEN(tmpMeta451) || strcmp(MMC_STRINGDATA(_OMC_LIT100), MMC_STRINGDATA(tmpMeta451)) != 0) goto tmp3_end;
          tmpMeta452 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta452)) goto tmp3_end;
          tmpMeta453 = MMC_CAR(tmpMeta452);
          tmpMeta454 = MMC_CDR(tmpMeta452);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta453,0,1) == 0) goto tmp3_end;
          tmpMeta455 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta453), 2));
          tmp456 = mmc_unbox_integer(tmpMeta455);
          tmpMeta457 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _i = tmp456  /* pattern as ty=Integer */;
          _es = tmpMeta454;
          tmp4 += 16; /* Pattern matching succeeded; we may skip some cases if we fail */
          _es = omc_ExpressionSimplify_evalCat(threadData, _i, _es, boxvar_Expression_getArrayOrMatrixContents, boxvar_ExpressionDump_printExpStr ,&_dims);
          {
            modelica_metatype __omcQ_24tmpVar47;
            modelica_metatype* tmp459;
            modelica_metatype tmpMeta460;
            modelica_metatype tmpMeta461;
            modelica_metatype __omcQ_24tmpVar46;
            modelica_integer tmp462;
            modelica_metatype _d_loopVar = 0;
            modelica_metatype _d;
            _d_loopVar = _dims;
            tmpMeta460 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar47 = tmpMeta460; /* defaultValue */
            tmp459 = &__omcQ_24tmpVar47;
            while(1) {
              tmp462 = 1;
              if (!listEmpty(_d_loopVar)) {
                _d = MMC_CAR(_d_loopVar);
                _d_loopVar = MMC_CDR(_d_loopVar);
                tmp462--;
              }
              if (tmp462 == 0) {
                tmpMeta461 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, _d);
                __omcQ_24tmpVar46 = tmpMeta461;
                *tmp459 = mmc_mk_cons(__omcQ_24tmpVar46,0);
                tmp459 = &MMC_CDR(*tmp459);
              } else if (tmp462 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp459 = mmc_mk_nil();
            tmpMeta458 = __omcQ_24tmpVar47;
          }
          tmpMeta1 = omc_Expression_listToArray(threadData, _es, tmpMeta458);
          goto tmp3_done;
        }
        case 41: {
          modelica_metatype tmpMeta463;
          modelica_metatype tmpMeta464;
          modelica_metatype tmpMeta465;
          modelica_metatype tmpMeta466;
          modelica_metatype tmpMeta467;
          modelica_metatype tmpMeta468;
          modelica_metatype tmpMeta469;
          modelica_metatype tmpMeta470;
          modelica_integer tmp471;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta463 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta463,1,1) == 0) goto tmp3_end;
          tmpMeta464 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta463), 2));
          if (7 != MMC_STRLEN(tmpMeta464) || strcmp(MMC_STRINGDATA(_OMC_LIT116), MMC_STRINGDATA(tmpMeta464)) != 0) goto tmp3_end;
          tmpMeta465 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta465)) goto tmp3_end;
          tmpMeta466 = MMC_CAR(tmpMeta465);
          tmpMeta467 = MMC_CDR(tmpMeta465);
          if (listEmpty(tmpMeta467)) goto tmp3_end;
          tmpMeta468 = MMC_CAR(tmpMeta467);
          tmpMeta469 = MMC_CDR(tmpMeta467);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta468,0,1) == 0) goto tmp3_end;
          tmpMeta470 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta468), 2));
          tmp471 = mmc_unbox_integer(tmpMeta470);
          if (!listEmpty(tmpMeta469)) goto tmp3_end;
          
          _e1 = tmpMeta466;
          _i = tmp471  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(omc_Types_numberOfDimensions(threadData, omc_Expression_typeof(threadData, _e1)) == _i)) goto tmp3_end;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 42: {
          modelica_metatype tmpMeta472;
          modelica_metatype tmpMeta473;
          modelica_metatype tmpMeta474;
          modelica_metatype tmpMeta475;
          modelica_metatype tmpMeta476;
          modelica_metatype tmpMeta477;
          modelica_metatype tmpMeta478;
          modelica_metatype tmpMeta479;
          modelica_metatype tmpMeta480;
          modelica_metatype tmpMeta481;
          modelica_integer tmp482;
          modelica_metatype tmpMeta483;
          modelica_metatype tmpMeta484;
          modelica_metatype tmpMeta485;
          modelica_metatype tmpMeta486;
          modelica_integer tmp487;
          modelica_metatype tmpMeta488;
          modelica_metatype tmpMeta489;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta472 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta472,1,1) == 0) goto tmp3_end;
          tmpMeta473 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta472), 2));
          if (7 != MMC_STRLEN(tmpMeta473) || strcmp(MMC_STRINGDATA(_OMC_LIT116), MMC_STRINGDATA(tmpMeta473)) != 0) goto tmp3_end;
          tmpMeta474 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta474)) goto tmp3_end;
          tmpMeta475 = MMC_CAR(tmpMeta474);
          tmpMeta476 = MMC_CDR(tmpMeta474);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta475,16,3) == 0) goto tmp3_end;
          tmpMeta477 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta475), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta477,6,2) == 0) goto tmp3_end;
          tmpMeta478 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta477), 3));
          if (listEmpty(tmpMeta478)) goto tmp3_end;
          tmpMeta479 = MMC_CAR(tmpMeta478);
          tmpMeta480 = MMC_CDR(tmpMeta478);
          if (!listEmpty(tmpMeta480)) goto tmp3_end;
          tmpMeta481 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta475), 3));
          tmp482 = mmc_unbox_integer(tmpMeta481);
          tmpMeta483 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta475), 4));
          if (listEmpty(tmpMeta476)) goto tmp3_end;
          tmpMeta484 = MMC_CAR(tmpMeta476);
          tmpMeta485 = MMC_CDR(tmpMeta476);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta484,0,1) == 0) goto tmp3_end;
          tmpMeta486 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta484), 2));
          tmp487 = mmc_unbox_integer(tmpMeta486);
          if (2 != tmp487) goto tmp3_end;
          if (!listEmpty(tmpMeta485)) goto tmp3_end;
          
          _tp1 = tmpMeta477;
          _sc = tmp482  /* pattern as ty=Boolean */;
          _es = tmpMeta483;
          /* Pattern matching succeeded */
          _tp = omc_Types_liftArray(threadData, omc_Types_unliftArray(threadData, _tp1), _OMC_LIT101);

          _es = omc_List_map2(threadData, omc_List_map(threadData, _es, boxvar_List_create), boxvar_Expression_makeArray, _tp, mmc_mk_boolean(_sc));

          _i = listLength(_es);

          tmpMeta488 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_i));
          _tp = omc_Expression_liftArrayLeft(threadData, _tp, tmpMeta488);
          tmpMeta489 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _tp, mmc_mk_boolean(0 /* false */), _es);
          tmpMeta1 = tmpMeta489;
          goto tmp3_done;
        }
        case 43: {
          modelica_metatype tmpMeta490;
          modelica_metatype tmpMeta491;
          modelica_metatype tmpMeta492;
          modelica_metatype tmpMeta493;
          modelica_metatype tmpMeta494;
          modelica_metatype tmpMeta495;
          modelica_metatype tmpMeta496;
          modelica_metatype tmpMeta497;
          modelica_integer tmp498;
          modelica_metatype tmpMeta499;
          modelica_integer tmp500;
          modelica_integer tmp501;
          modelica_integer tmp502;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta490 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta490,1,1) == 0) goto tmp3_end;
          tmpMeta491 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta490), 2));
          if (7 != MMC_STRLEN(tmpMeta491) || strcmp(MMC_STRINGDATA(_OMC_LIT116), MMC_STRINGDATA(tmpMeta491)) != 0) goto tmp3_end;
          tmpMeta492 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta492)) goto tmp3_end;
          tmpMeta493 = MMC_CAR(tmpMeta492);
          tmpMeta494 = MMC_CDR(tmpMeta492);
          if (listEmpty(tmpMeta494)) goto tmp3_end;
          tmpMeta495 = MMC_CAR(tmpMeta494);
          tmpMeta496 = MMC_CDR(tmpMeta494);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta495,0,1) == 0) goto tmp3_end;
          tmpMeta497 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta495), 2));
          tmp498 = mmc_unbox_integer(tmpMeta497);
          if (!listEmpty(tmpMeta496)) goto tmp3_end;
          
          _e1 = tmpMeta493;
          _i = tmp498  /* pattern as ty=Integer */;
          tmp4 += 13; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!(!omc_Types_isArray(threadData, omc_Expression_typeof(threadData, _e1)))) goto tmp3_end;
          _tp = omc_Expression_typeof(threadData, _e1);

          tmp500 = ((modelica_integer) 1); tmp501 = 1; tmp502 = _i;
          if(!(((tmp501 > 0) && (tmp500 > tmp502)) || ((tmp501 < 0) && (tmp500 < tmp502))))
          {
            modelica_integer _j;
            for(_j = ((modelica_integer) 1); in_range_integer(_j, tmp500, tmp502); _j += tmp501)
            {
              _tp1 = omc_Types_liftArray(threadData, _tp, _OMC_LIT101);

              tmpMeta499 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
              _e1 = omc_Expression_makeArray(threadData, tmpMeta499, _tp1, (!omc_Types_isArray(threadData, _tp)));

              _tp = _tp1;
            }
          }
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 44: {
          modelica_metatype tmpMeta503;
          modelica_metatype tmpMeta504;
          modelica_metatype tmpMeta505;
          modelica_metatype tmpMeta506;
          modelica_metatype tmpMeta507;
          modelica_metatype tmpMeta508;
          modelica_boolean tmp509;
          modelica_metatype tmpMeta510;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta503 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta503,1,1) == 0) goto tmp3_end;
          tmpMeta504 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta503), 2));
          if (9 != MMC_STRLEN(tmpMeta504) || strcmp(MMC_STRINGDATA(_OMC_LIT117), MMC_STRINGDATA(tmpMeta504)) != 0) goto tmp3_end;
          tmpMeta505 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta505)) goto tmp3_end;
          tmpMeta506 = MMC_CAR(tmpMeta505);
          tmpMeta507 = MMC_CDR(tmpMeta505);
          if (!listEmpty(tmpMeta507)) goto tmp3_end;
          tmpMeta508 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e = tmpMeta506;
          tmp4 += 12; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Pattern-matching tuple assignment */
          tmpMeta510 = omc_Expression_transposeArray(threadData, _e, &tmp509);
          _e = tmpMeta510;
          if (1 /* true */ != tmp509) goto goto_2;
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 45: {
          modelica_metatype tmpMeta511;
          modelica_metatype tmpMeta512;
          modelica_metatype tmpMeta513;
          modelica_metatype tmpMeta514;
          modelica_metatype tmpMeta515;
          modelica_metatype tmpMeta516;
          modelica_metatype tmpMeta517;
          modelica_metatype tmpMeta518;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta511 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta511,1,1) == 0) goto tmp3_end;
          tmpMeta512 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta511), 2));
          if (9 != MMC_STRLEN(tmpMeta512) || strcmp(MMC_STRINGDATA(_OMC_LIT118), MMC_STRINGDATA(tmpMeta512)) != 0) goto tmp3_end;
          tmpMeta513 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta513)) goto tmp3_end;
          tmpMeta514 = MMC_CAR(tmpMeta513);
          tmpMeta515 = MMC_CDR(tmpMeta513);
          if (!listEmpty(tmpMeta515)) goto tmp3_end;
          tmpMeta516 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta517 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta516), 2));
          
          _e = tmpMeta514;
          _tp = tmpMeta517;
          tmp4 += 11; /* Pattern matching succeeded; we may skip some cases if we fail */
          _mexpl = omc_Expression_get2dArrayOrMatrixContent(threadData, _e);
          { /* match expression */
            modelica_metatype tmp521_1;
            tmp521_1 = _mexpl;
            {
              volatile mmc_switch_type tmp521;
              int tmp522;
              tmp521 = 0;
              for (; tmp521 < 3; tmp521++) {
                switch (MMC_SWITCH_CAST(tmp521)) {
                case 0: {
                  modelica_metatype tmpMeta523;
                  modelica_metatype tmpMeta524;
                  if (listEmpty(tmp521_1)) goto tmp520_end;
                  tmpMeta523 = MMC_CAR(tmp521_1);
                  tmpMeta524 = MMC_CDR(tmp521_1);
                  if (!listEmpty(tmpMeta523)) goto tmp520_end;
                  if (!listEmpty(tmpMeta524)) goto tmp520_end;
                  /* Pattern matching succeeded */
                  tmpMeta518 = _e;
                  goto tmp520_done;
                }
                case 1: {
                  modelica_metatype tmpMeta525;
                  modelica_metatype tmpMeta526;
                  modelica_metatype tmpMeta527;
                  modelica_metatype tmpMeta528;
                  if (listEmpty(tmp521_1)) goto tmp520_end;
                  tmpMeta525 = MMC_CAR(tmp521_1);
                  tmpMeta526 = MMC_CDR(tmp521_1);
                  if (listEmpty(tmpMeta525)) goto tmp520_end;
                  tmpMeta527 = MMC_CAR(tmpMeta525);
                  tmpMeta528 = MMC_CDR(tmpMeta525);
                  if (!listEmpty(tmpMeta528)) goto tmp520_end;
                  if (!listEmpty(tmpMeta526)) goto tmp520_end;
                  /* Pattern matching succeeded */
                  tmpMeta518 = _e;
                  goto tmp520_done;
                }
                case 2: {
                  modelica_boolean tmp529;
                  modelica_boolean tmp530;
                  
                  /* Pattern matching succeeded */
                  _marr = listArray(omc_List_map(threadData, _mexpl, boxvar_listArray));

                  /* Pattern-matching assignment */
                  tmp529 = (arrayLength(_marr) == arrayLength(arrayGet(_marr, ((modelica_integer) 1))));
                  if (1 /* true */ != tmp529) goto goto_519;

                  /* Pattern-matching assignment */
                  tmp530 = (arrayLength(_marr) > ((modelica_integer) 1));
                  if (1 /* true */ != tmp530) goto goto_519;

                  omc_ExpressionSimplify_simplifySymmetric(threadData, _marr, ((modelica_integer) -1) + arrayLength(_marr), arrayLength(_marr));

                  _mexpl = omc_List_mapArray(threadData, _marr, boxvar_arrayList);

                  _tp1 = omc_Expression_unliftArray(threadData, _tp);

                  _es = omc_List_map2(threadData, _mexpl, boxvar_Expression_makeArray, _tp1, mmc_mk_boolean((!omc_Types_isArray(threadData, _tp1))));
                  tmpMeta518 = omc_Expression_makeArray(threadData, _es, _tp, 0 /* false */);
                  goto tmp520_done;
                }
                }
                goto tmp520_end;
                tmp520_end: ;
              }
              goto goto_519;
              goto_519:;
              goto goto_2;
              goto tmp520_done;
              tmp520_done:;
            }
          }tmpMeta1 = tmpMeta518;
          goto tmp3_done;
        }
        case 46: {
          modelica_metatype tmpMeta531;
          modelica_metatype tmpMeta532;
          modelica_metatype tmpMeta533;
          modelica_metatype tmpMeta534;
          modelica_metatype tmpMeta535;
          modelica_metatype tmpMeta536;
          modelica_metatype tmpMeta537;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta531 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta531,1,1) == 0) goto tmp3_end;
          tmpMeta532 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta531), 2));
          if (6 != MMC_STRLEN(tmpMeta532) || strcmp(MMC_STRINGDATA(_OMC_LIT85), MMC_STRINGDATA(tmpMeta532)) != 0) goto tmp3_end;
          tmpMeta533 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta533)) goto tmp3_end;
          tmpMeta534 = MMC_CAR(tmpMeta533);
          tmpMeta535 = MMC_CDR(tmpMeta533);
          if (!listEmpty(tmpMeta535)) goto tmp3_end;
          tmpMeta536 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta537 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta536), 2));
          
          _e = tmpMeta534;
          _tp = tmpMeta537;
          tmp4 += 10; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_ExpressionSimplify_simplifyScalar(threadData, _e, _tp);
          goto tmp3_done;
        }
        case 47: {
          modelica_metatype tmpMeta538;
          modelica_metatype tmpMeta539;
          modelica_metatype tmpMeta540;
          modelica_metatype tmpMeta541;
          modelica_metatype tmpMeta542;
          modelica_metatype tmpMeta543;
          modelica_metatype tmpMeta544;
          modelica_metatype tmpMeta545;
          modelica_boolean tmp546;
          modelica_metatype tmpMeta547;
          modelica_metatype tmpMeta548;
          modelica_metatype tmpMeta549;
          modelica_metatype tmpMeta550;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta538 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta538,1,1) == 0) goto tmp3_end;
          tmpMeta539 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta538), 2));
          if (6 != MMC_STRLEN(tmpMeta539) || strcmp(MMC_STRINGDATA(_OMC_LIT119), MMC_STRINGDATA(tmpMeta539)) != 0) goto tmp3_end;
          tmpMeta540 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta540)) goto tmp3_end;
          tmpMeta541 = MMC_CAR(tmpMeta540);
          tmpMeta542 = MMC_CDR(tmpMeta540);
          tmpMeta543 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta544 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta543), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta544,6,2) == 0) goto tmp3_end;
          tmpMeta545 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta544), 2));
          
          _es = tmpMeta540;
          _e = tmpMeta541;
          _tp = tmpMeta545;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp546 = omc_Types_isArray(threadData, omc_Expression_typeof(threadData, _e));
          if (0 /* false */ != tmp546) goto goto_2;

          _i = listLength(_es);

          tmpMeta548 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_i));
          tmpMeta547 = mmc_mk_cons(tmpMeta548, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta549 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _tp, tmpMeta547);
          _tp = tmpMeta549;
          tmpMeta550 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _tp, mmc_mk_boolean(1 /* true */), _es);
          tmpMeta1 = tmpMeta550;
          goto tmp3_done;
        }
        case 48: {
          modelica_metatype tmpMeta551;
          modelica_metatype tmpMeta552;
          modelica_metatype tmpMeta553;
          modelica_metatype tmpMeta554;
          modelica_metatype tmpMeta555;
          modelica_metatype tmpMeta556;
          modelica_integer tmp557;
          modelica_metatype tmpMeta558;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta551 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta551,1,1) == 0) goto tmp3_end;
          tmpMeta552 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta551), 2));
          if (6 != MMC_STRLEN(tmpMeta552) || strcmp(MMC_STRINGDATA(_OMC_LIT119), MMC_STRINGDATA(tmpMeta552)) != 0) goto tmp3_end;
          tmpMeta553 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta553)) goto tmp3_end;
          tmpMeta554 = MMC_CAR(tmpMeta553);
          tmpMeta555 = MMC_CDR(tmpMeta553);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta554,16,3) == 0) goto tmp3_end;
          tmpMeta556 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta554), 3));
          tmp557 = mmc_unbox_integer(tmpMeta556);
          if (1 /* true */ != tmp557) goto tmp3_end;
          if (!listEmpty(tmpMeta555)) goto tmp3_end;
          tmpMeta558 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _e = tmpMeta554;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 49: {
          modelica_metatype tmpMeta559;
          modelica_metatype tmpMeta560;
          modelica_metatype tmpMeta561;
          modelica_metatype tmpMeta562;
          modelica_metatype tmpMeta563;
          modelica_metatype tmpMeta564;
          modelica_metatype tmpMeta565;
          modelica_metatype tmpMeta566;
          modelica_metatype tmpMeta567;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta559 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta559,1,1) == 0) goto tmp3_end;
          tmpMeta560 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta559), 2));
          if (6 != MMC_STRLEN(tmpMeta560) || strcmp(MMC_STRINGDATA(_OMC_LIT119), MMC_STRINGDATA(tmpMeta560)) != 0) goto tmp3_end;
          tmpMeta561 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta561)) goto tmp3_end;
          tmpMeta562 = MMC_CAR(tmpMeta561);
          tmpMeta563 = MMC_CDR(tmpMeta561);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta562,17,3) == 0) goto tmp3_end;
          tmpMeta564 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta562), 4));
          if (!listEmpty(tmpMeta563)) goto tmp3_end;
          tmpMeta565 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta566 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta565), 2));
          
          _mexpl = tmpMeta564;
          _tp = tmpMeta566;
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          _es = omc_List_flatten(threadData, _mexpl);

          _es = omc_List_map1(threadData, _es, boxvar_Expression_makeVectorCall, _tp);
          tmpMeta567 = mmc_mk_cons(_OMC_LIT86, _es);
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT100, tmpMeta567, _tp);
          goto tmp3_done;
        }
        case 50: {
          modelica_metatype tmpMeta568;
          modelica_metatype tmpMeta569;
          modelica_metatype tmpMeta570;
          modelica_metatype tmpMeta571;
          modelica_metatype tmpMeta572;
          modelica_metatype tmpMeta573;
          modelica_metatype tmpMeta574;
          modelica_metatype tmpMeta575;
          modelica_metatype tmpMeta576;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta568 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta568,1,1) == 0) goto tmp3_end;
          tmpMeta569 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta568), 2));
          if (6 != MMC_STRLEN(tmpMeta569) || strcmp(MMC_STRINGDATA(_OMC_LIT119), MMC_STRINGDATA(tmpMeta569)) != 0) goto tmp3_end;
          tmpMeta570 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta570)) goto tmp3_end;
          tmpMeta571 = MMC_CAR(tmpMeta570);
          tmpMeta572 = MMC_CDR(tmpMeta570);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta571,16,3) == 0) goto tmp3_end;
          tmpMeta573 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta571), 4));
          if (!listEmpty(tmpMeta572)) goto tmp3_end;
          tmpMeta574 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta575 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta574), 2));
          
          _es = tmpMeta573;
          _tp = tmpMeta575;
          tmp4 += 6; /* Pattern matching succeeded; we may skip some cases if we fail */
          _es = omc_List_map1(threadData, _es, boxvar_Expression_makeVectorCall, _tp);
          tmpMeta576 = mmc_mk_cons(_OMC_LIT86, _es);
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT100, tmpMeta576, _tp);
          goto tmp3_done;
        }
        case 51: {
          modelica_metatype tmpMeta577;
          modelica_metatype tmpMeta578;
          modelica_metatype tmpMeta579;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta577 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta577,1,1) == 0) goto tmp3_end;
          tmpMeta578 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta577), 2));
          if (13 != MMC_STRLEN(tmpMeta578) || strcmp(MMC_STRINGDATA(_OMC_LIT120), MMC_STRINGDATA(tmpMeta578)) != 0) goto tmp3_end;
          tmpMeta579 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (!listEmpty(tmpMeta579)) goto tmp3_end;
          
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _OMC_LIT103;
          goto tmp3_done;
        }
        case 52: {
          modelica_metatype tmpMeta580;
          modelica_metatype tmpMeta581;
          modelica_metatype tmpMeta582;
          modelica_metatype tmpMeta583;
          modelica_metatype tmpMeta584;
          modelica_metatype tmpMeta585;
          modelica_metatype tmpMeta586;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta580 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta580,1,1) == 0) goto tmp3_end;
          tmpMeta581 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta580), 2));
          if (9 != MMC_STRLEN(tmpMeta581) || strcmp(MMC_STRINGDATA(_OMC_LIT121), MMC_STRINGDATA(tmpMeta581)) != 0) goto tmp3_end;
          tmpMeta582 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta582)) goto tmp3_end;
          tmpMeta583 = MMC_CAR(tmpMeta582);
          tmpMeta584 = MMC_CDR(tmpMeta582);
          if (!listEmpty(tmpMeta584)) goto tmp3_end;
          
          _e1 = tmpMeta583;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta585 = mmc_mk_box2(5, &DAE_ClockKind_REAL__CLOCK__desc, _e1);
          tmpMeta586 = mmc_mk_box2(7, &DAE_Exp_CLKCONST__desc, tmpMeta585);
          tmpMeta1 = tmpMeta586;
          goto tmp3_done;
        }
        case 53: {
          modelica_metatype tmpMeta587;
          modelica_metatype tmpMeta588;
          modelica_metatype tmpMeta589;
          modelica_metatype tmpMeta590;
          modelica_metatype tmpMeta591;
          modelica_metatype tmpMeta592;
          modelica_metatype tmpMeta593;
          modelica_metatype tmpMeta594;
          modelica_metatype tmpMeta595;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta587 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta587,1,1) == 0) goto tmp3_end;
          tmpMeta588 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta587), 2));
          if (12 != MMC_STRLEN(tmpMeta588) || strcmp(MMC_STRINGDATA(_OMC_LIT122), MMC_STRINGDATA(tmpMeta588)) != 0) goto tmp3_end;
          tmpMeta589 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta589)) goto tmp3_end;
          tmpMeta590 = MMC_CAR(tmpMeta589);
          tmpMeta591 = MMC_CDR(tmpMeta589);
          if (listEmpty(tmpMeta591)) goto tmp3_end;
          tmpMeta592 = MMC_CAR(tmpMeta591);
          tmpMeta593 = MMC_CDR(tmpMeta591);
          if (!listEmpty(tmpMeta593)) goto tmp3_end;
          
          _e1 = tmpMeta590;
          _e2 = tmpMeta592;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta594 = mmc_mk_box3(6, &DAE_ClockKind_EVENT__CLOCK__desc, _e1, _e2);
          tmpMeta595 = mmc_mk_box2(7, &DAE_Exp_CLKCONST__desc, tmpMeta594);
          tmpMeta1 = tmpMeta595;
          goto tmp3_done;
        }
        case 54: {
          modelica_metatype tmpMeta596;
          modelica_metatype tmpMeta597;
          modelica_metatype tmpMeta598;
          modelica_metatype tmpMeta599;
          modelica_metatype tmpMeta600;
          modelica_metatype tmpMeta601;
          modelica_metatype tmpMeta602;
          modelica_metatype tmpMeta603;
          modelica_metatype tmpMeta604;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta596 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta596,1,1) == 0) goto tmp3_end;
          tmpMeta597 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta596), 2));
          if (13 != MMC_STRLEN(tmpMeta597) || strcmp(MMC_STRINGDATA(_OMC_LIT123), MMC_STRINGDATA(tmpMeta597)) != 0) goto tmp3_end;
          tmpMeta598 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta598)) goto tmp3_end;
          tmpMeta599 = MMC_CAR(tmpMeta598);
          tmpMeta600 = MMC_CDR(tmpMeta598);
          if (listEmpty(tmpMeta600)) goto tmp3_end;
          tmpMeta601 = MMC_CAR(tmpMeta600);
          tmpMeta602 = MMC_CDR(tmpMeta600);
          if (!listEmpty(tmpMeta602)) goto tmp3_end;
          
          _e1 = tmpMeta599;
          _e2 = tmpMeta601;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta603 = mmc_mk_box3(4, &DAE_ClockKind_RATIONAL__CLOCK__desc, _e1, _e2);
          tmpMeta604 = mmc_mk_box2(7, &DAE_Exp_CLKCONST__desc, tmpMeta603);
          tmpMeta1 = tmpMeta604;
          goto tmp3_done;
        }
        case 55: {
          modelica_metatype tmpMeta605;
          modelica_metatype tmpMeta606;
          modelica_metatype tmpMeta607;
          modelica_metatype tmpMeta608;
          modelica_metatype tmpMeta609;
          modelica_metatype tmpMeta610;
          modelica_metatype tmpMeta611;
          modelica_metatype tmpMeta612;
          modelica_metatype tmpMeta613;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta605 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta605,1,1) == 0) goto tmp3_end;
          tmpMeta606 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta605), 2));
          if (11 != MMC_STRLEN(tmpMeta606) || strcmp(MMC_STRINGDATA(_OMC_LIT124), MMC_STRINGDATA(tmpMeta606)) != 0) goto tmp3_end;
          tmpMeta607 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta607)) goto tmp3_end;
          tmpMeta608 = MMC_CAR(tmpMeta607);
          tmpMeta609 = MMC_CDR(tmpMeta607);
          if (listEmpty(tmpMeta609)) goto tmp3_end;
          tmpMeta610 = MMC_CAR(tmpMeta609);
          tmpMeta611 = MMC_CDR(tmpMeta609);
          if (!listEmpty(tmpMeta611)) goto tmp3_end;
          
          _e1 = tmpMeta608;
          _e2 = tmpMeta610;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta612 = mmc_mk_box3(7, &DAE_ClockKind_SOLVER__CLOCK__desc, _e1, _e2);
          tmpMeta613 = mmc_mk_box2(7, &DAE_Exp_CLKCONST__desc, tmpMeta612);
          tmpMeta1 = tmpMeta613;
          goto tmp3_done;
        }
        case 56: {
          modelica_metatype tmpMeta614;
          modelica_metatype tmpMeta615;
          modelica_metatype tmpMeta616;
          modelica_metatype tmpMeta617;
          modelica_metatype tmpMeta618;
          modelica_metatype tmpMeta619;
          modelica_metatype tmpMeta620;
          modelica_metatype tmpMeta621;
          modelica_metatype tmpMeta622;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta614 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta614,1,1) == 0) goto tmp3_end;
          tmpMeta615 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta614), 2));
          if (26 != MMC_STRLEN(tmpMeta615) || strcmp(MMC_STRINGDATA(_OMC_LIT125), MMC_STRINGDATA(tmpMeta615)) != 0) goto tmp3_end;
          tmpMeta616 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta616)) goto tmp3_end;
          tmpMeta617 = MMC_CAR(tmpMeta616);
          tmpMeta618 = MMC_CDR(tmpMeta616);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta617,2,1) == 0) goto tmp3_end;
          tmpMeta619 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta617), 2));
          if (!listEmpty(tmpMeta618)) goto tmp3_end;
          
          _s1 = tmpMeta619;
          /* Pattern matching succeeded */
          _s2 = OpenModelica__uriToFilename(_s1);

          if(omc_Flags_getConfigBool(threadData, _OMC_LIT109))
          {
            tmpMeta621 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _s2);
            tmpMeta620 = mmc_mk_cons(tmpMeta621, MMC_REFSTRUCTLIT(mmc_nil));
            _e = omc_Expression_makeImpureBuiltinCall(threadData, _OMC_LIT104, tmpMeta620, _OMC_LIT73);
          }
          else
          {
            tmpMeta622 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _s2);
            _e = tmpMeta622;
          }
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 57) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_reductionExpression(threadData_t *threadData, modelica_string _name, modelica_metatype _ty, modelica_string _foldName, modelica_string _resultName)
{
  modelica_metatype _foldExp = NULL;
  modelica_metatype _foldNameExp = NULL;
  modelica_metatype _resultNameExp = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _foldExp has no default value.
  // _foldNameExp has no default value.
  // _resultNameExp has no default value.
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _foldNameExp = omc_Expression_makeCrefExp(threadData, omc_ComponentReference_makeCrefIdent(threadData, _foldName, _ty, tmpMeta1), _ty);

  tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
  _resultNameExp = omc_Expression_makeCrefExp(threadData, omc_ComponentReference_makeCrefIdent(threadData, _resultName, _ty, tmpMeta2), _ty);

  { /* match expression */
    modelica_string tmp6_1;
    tmp6_1 = _name;
    {
      volatile mmc_switch_type tmp6;
      int tmp7;
      tmp6 = 0;
      for (; tmp6 < 4; tmp6++) {
        switch (MMC_SWITCH_CAST(tmp6)) {
        case 0: {
          modelica_metatype tmpMeta8;
          if (3 != MMC_STRLEN(tmp6_1) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmp6_1)) != 0) goto tmp5_end;
          /* Pattern matching succeeded */
          tmpMeta8 = mmc_mk_cons(_foldNameExp, mmc_mk_cons(_resultNameExp, MMC_REFSTRUCTLIT(mmc_nil)));
          tmpMeta3 = omc_Expression_makeBuiltinCall(threadData, _OMC_LIT7, tmpMeta8, _ty, 0 /* false */);
          goto tmp5_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          if (3 != MMC_STRLEN(tmp6_1) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmp6_1)) != 0) goto tmp5_end;
          /* Pattern matching succeeded */
          tmpMeta9 = mmc_mk_cons(_foldNameExp, mmc_mk_cons(_resultNameExp, MMC_REFSTRUCTLIT(mmc_nil)));
          tmpMeta3 = omc_Expression_makeBuiltinCall(threadData, _OMC_LIT8, tmpMeta9, _ty, 0 /* false */);
          goto tmp5_done;
        }
        case 2: {
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          if (7 != MMC_STRLEN(tmp6_1) || strcmp(MMC_STRINGDATA(_OMC_LIT126), MMC_STRINGDATA(tmp6_1)) != 0) goto tmp5_end;
          /* Pattern matching succeeded */
          tmpMeta10 = mmc_mk_box2(5, &DAE_Operator_MUL__desc, _ty);
          tmpMeta11 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _foldNameExp, tmpMeta10, _resultNameExp);
          tmpMeta3 = tmpMeta11;
          goto tmp5_done;
        }
        case 3: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          if (3 != MMC_STRLEN(tmp6_1) || strcmp(MMC_STRINGDATA(_OMC_LIT99), MMC_STRINGDATA(tmp6_1)) != 0) goto tmp5_end;
          /* Pattern matching succeeded */
          tmpMeta12 = mmc_mk_box2(3, &DAE_Operator_ADD__desc, _ty);
          tmpMeta13 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _foldNameExp, tmpMeta12, _resultNameExp);
          tmpMeta3 = tmpMeta13;
          goto tmp5_done;
        }
        }
        goto tmp5_end;
        tmp5_end: ;
      }
      goto goto_4;
      goto_4:;
      MMC_THROW_INTERNAL();
      goto tmp5_done;
      tmp5_done:;
    }
  }
  _foldExp = tmpMeta3;
  _return: OMC_LABEL_UNUSED
  return _foldExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_reductionDefaultValue(threadData_t *threadData, modelica_string _name, modelica_metatype _ty)
{
  modelica_metatype _defaultValue = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _defaultValue has no default value.
  { /* match expression */
    modelica_string tmp4_1;modelica_metatype tmp4_2;
    tmp4_1 = _name;
    tmp4_2 = _ty;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 12; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT127;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(intMaxLit()));
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta7;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta7 = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(realMaxLit()));
          tmpMeta1 = tmpMeta7;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta8;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,5,5) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta8 = mmc_mk_box3(7, &Values_Value_ENUM__LITERAL__desc, omc_AbsynUtil_suffixPath(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 3))), omc_List_last(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 4))))), mmc_mk_integer(listLength((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 4))))));
          tmpMeta1 = tmpMeta8;
          goto tmp3_done;
        }
        case 4: {
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT128;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta9;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta9 = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer((-intMaxLit())));
          tmpMeta1 = tmpMeta9;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta10;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta10 = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real((-realMaxLit())));
          tmpMeta1 = tmpMeta10;
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta11;
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT8), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,5,5) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta11 = mmc_mk_box3(7, &Values_Value_ENUM__LITERAL__desc, omc_AbsynUtil_suffixPath(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 3))), omc_List_last(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 4))))), mmc_mk_integer(((modelica_integer) 1)));
          tmpMeta1 = tmpMeta11;
          goto tmp3_done;
        }
        case 8: {
          if (7 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT126), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT129;
          goto tmp3_done;
        }
        case 9: {
          if (7 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT126), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT130;
          goto tmp3_done;
        }
        case 10: {
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT99), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT131;
          goto tmp3_done;
        }
        case 11: {
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT99), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT132;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _defaultValue = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _defaultValue;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_addCast(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inType)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  tmpMeta1 = mmc_mk_box3(23, &DAE_Exp_CAST__desc, _inType, _inExp);
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCast(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _exp, modelica_metatype _tp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;
    tmp4_1 = _exp;
    tmp4_2 = _tp;
    {
      modelica_real _r;
      modelica_integer _i;
      modelica_integer _n;
      modelica_boolean _b;
      modelica_metatype _exps = NULL;
      modelica_metatype _exps_1 = NULL;
      modelica_metatype _tp_1 = NULL;
      modelica_metatype _tp1 = NULL;
      modelica_metatype _tp2 = NULL;
      modelica_metatype _t1 = NULL;
      modelica_metatype _t2 = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _cond = NULL;
      modelica_metatype _e1_1 = NULL;
      modelica_metatype _e2_1 = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _mexps = NULL;
      modelica_metatype _mexps_1 = NULL;
      modelica_metatype _eo = NULL;
      modelica_metatype _dims = NULL;
      modelica_metatype _p1 = NULL;
      modelica_metatype _p2 = NULL;
      modelica_metatype _p3 = NULL;
      modelica_metatype _fieldNames = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _r has no default value.
      // _i has no default value.
      // _n has no default value.
      // _b has no default value.
      // _exps has no default value.
      // _exps_1 has no default value.
      // _tp_1 has no default value.
      // _tp1 has no default value.
      // _tp2 has no default value.
      // _t1 has no default value.
      // _t2 has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _cond has no default value.
      // _e1_1 has no default value.
      // _e2_1 has no default value.
      // _e has no default value.
      // _mexps has no default value.
      // _mexps_1 has no default value.
      // _eo has no default value.
      // _dims has no default value.
      // _p1 has no default value.
      // _p2 has no default value.
      // _p3 has no default value.
      // _fieldNames has no default value.
      tmp4 = 0;
      for (; tmp4 < 14; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_real tmp7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp7 = mmc_unbox_real(tmpMeta6);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          
          _r = tmp7  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          tmpMeta8 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta8;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_integer tmp10;
          modelica_metatype tmpMeta11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp10 = mmc_unbox_integer(tmpMeta9);
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
          
          _i = tmp10  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _r = ((modelica_real)_i);
          tmpMeta11 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
          tmpMeta1 = tmpMeta11;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,2) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta12,6,1) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _e = tmpMeta13;
          /* Pattern matching succeeded */
          tmpMeta14 = mmc_mk_box3(23, &DAE_Exp_CAST__desc, _tp, _e);
          _e = tmpMeta14;
          tmpMeta15 = mmc_mk_box2(9, &DAE_Operator_UMINUS__ARR__desc, _tp);
          tmpMeta16 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta15, _e);
          tmpMeta1 = tmpMeta16;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,2) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta17,5,1) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _e = tmpMeta18;
          /* Pattern matching succeeded */
          tmpMeta19 = mmc_mk_box3(23, &DAE_Exp_CAST__desc, _tp, _e);
          _e = tmpMeta19;
          tmpMeta20 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _tp);
          tmpMeta21 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta20, _e);
          tmpMeta1 = tmpMeta21;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta22;
          modelica_integer tmp23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,3) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp23 = mmc_unbox_integer(tmpMeta22);
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _b = tmp23  /* pattern as ty=Boolean */;
          _exps = tmpMeta24;
          /* Pattern matching succeeded */
          _tp_1 = omc_Expression_unliftArray(threadData, _tp);

          _exps_1 = omc_List_map1(threadData, _exps, boxvar_ExpressionSimplify_addCast, _tp_1);
          tmpMeta25 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _tp, mmc_mk_boolean(_b), _exps_1);
          tmpMeta1 = tmpMeta25;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,6,2) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta26,1,1) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,18,4) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta27,6,2) == 0) goto tmp3_end;
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta28,0,1) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          _tp2 = tmpMeta26;
          _e1 = tmpMeta29;
          _eo = tmpMeta30;
          _e2 = tmpMeta31;
          /* Pattern matching succeeded */
          tmpMeta32 = mmc_mk_box3(23, &DAE_Exp_CAST__desc, _tp2, _e1);
          _e1 = tmpMeta32;

          tmpMeta33 = mmc_mk_box3(23, &DAE_Exp_CAST__desc, _tp2, _e2);
          _e2 = tmpMeta33;

          _eo = omc_Util_applyOption1(threadData, _eo, boxvar_ExpressionSimplify_addCast, _tp2);
          tmpMeta34 = mmc_mk_box5(21, &DAE_Exp_RANGE__desc, _tp, _e1, _eo, _e2);
          tmpMeta1 = tmpMeta34;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,12,3) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta37 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _cond = tmpMeta35;
          _e1 = tmpMeta36;
          _e2 = tmpMeta37;
          /* Pattern matching succeeded */
          tmpMeta38 = mmc_mk_box3(23, &DAE_Exp_CAST__desc, _tp, _e1);
          _e1_1 = tmpMeta38;

          tmpMeta39 = mmc_mk_box3(23, &DAE_Exp_CAST__desc, _tp, _e2);
          _e2_1 = tmpMeta39;
          tmpMeta40 = mmc_mk_box4(15, &DAE_Exp_IFEXP__desc, _cond, _e1_1, _e2_1);
          tmpMeta1 = tmpMeta40;
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta41;
          modelica_integer tmp42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,17,3) == 0) goto tmp3_end;
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp42 = mmc_unbox_integer(tmpMeta41);
          tmpMeta43 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          
          _n = tmp42  /* pattern as ty=Integer */;
          _mexps = tmpMeta43;
          /* Pattern matching succeeded */
          _tp1 = omc_Expression_unliftArray(threadData, _tp);

          _tp2 = omc_Expression_unliftArray(threadData, _tp1);

          _mexps_1 = omc_List_map1List(threadData, _mexps, boxvar_ExpressionSimplify_addCast, _tp2);
          tmpMeta44 = mmc_mk_box4(20, &DAE_Exp_MATRIX__desc, _tp, mmc_mk_integer(_n), _mexps_1);
          tmpMeta1 = tmpMeta44;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,9,4) == 0) goto tmp3_end;
          tmpMeta45 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta45,3,1) == 0) goto tmp3_end;
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta45), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta49 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta50 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta49), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta50,9,4) == 0) goto tmp3_end;
          tmpMeta51 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta50), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta51,3,1) == 0) goto tmp3_end;
          tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta51), 2));
          
          _p3 = tmpMeta46;
          _p1 = tmpMeta47;
          _exps = tmpMeta48;
          _p2 = tmpMeta52;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_AbsynUtil_pathEqual(threadData, _p1, _p2)) goto tmp3_end;
          tmpMeta53 = mmc_mk_box8(3, &DAE_CallAttributes_CALL__ATTR__desc, _tp, mmc_mk_boolean(0 /* false */), mmc_mk_boolean(0 /* false */), mmc_mk_boolean(0 /* false */), mmc_mk_boolean(0 /* false */), _OMC_LIT133, _OMC_LIT134);
          tmpMeta54 = mmc_mk_box4(16, &DAE_Exp_CALL__desc, _p3, _exps, tmpMeta53);
          tmpMeta1 = tmpMeta54;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          modelica_metatype tmpMeta59;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,14,4) == 0) goto tmp3_end;
          tmpMeta55 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta56 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,9,4) == 0) goto tmp3_end;
          tmpMeta57 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta57,3,1) == 0) goto tmp3_end;
          tmpMeta58 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta57), 2));
          
          _exps = tmpMeta55;
          _fieldNames = tmpMeta56;
          _p3 = tmpMeta58;
          /* Pattern matching succeeded */
          tmpMeta59 = mmc_mk_box5(17, &DAE_Exp_RECORD__desc, _p3, _exps, _fieldNames, _tp);
          tmpMeta1 = tmpMeta59;
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta60;
          modelica_metatype tmpMeta61;
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta60 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta60,1,1) == 0) goto tmp3_end;
          tmpMeta61 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta60), 2));
          if (4 != MMC_STRLEN(tmpMeta61) || strcmp(MMC_STRINGDATA(_OMC_LIT112), MMC_STRINGDATA(tmpMeta61)) != 0) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta62)) goto tmp3_end;
          tmpMeta63 = MMC_CAR(tmpMeta62);
          tmpMeta64 = MMC_CDR(tmpMeta62);
          
          _e = tmpMeta63;
          _exps = tmpMeta64;
          /* Pattern matching succeeded */
          _tp_1 = omc_List_fold(threadData, _exps, boxvar_Expression_unliftArrayIgnoreFirst, _tp);

          tmpMeta65 = mmc_mk_box3(23, &DAE_Exp_CAST__desc, _tp_1, _e);
          _e = tmpMeta65;
          tmpMeta66 = mmc_mk_cons(_e, _exps);
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT112, tmpMeta66, _tp);
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta67;
          modelica_metatype tmpMeta68;
          modelica_metatype tmpMeta69;
          modelica_metatype tmpMeta70;
          modelica_metatype tmpMeta71;
          modelica_metatype tmpMeta72;
          modelica_metatype tmpMeta73;
          modelica_integer tmp74;
          modelica_metatype tmpMeta75;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,6,2) == 0) goto tmp3_end;
          tmpMeta67 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta68 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta68,1,1) == 0) goto tmp3_end;
          tmpMeta69 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta68), 2));
          if (3 != MMC_STRLEN(tmpMeta69) || strcmp(MMC_STRINGDATA(_OMC_LIT100), MMC_STRINGDATA(tmpMeta69)) != 0) goto tmp3_end;
          tmpMeta70 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta70)) goto tmp3_end;
          tmpMeta71 = MMC_CAR(tmpMeta70);
          tmpMeta72 = MMC_CDR(tmpMeta70);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta71,0,1) == 0) goto tmp3_end;
          tmpMeta73 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta71), 2));
          tmp74 = mmc_unbox_integer(tmpMeta73);
          
          _dims = tmpMeta67;
          _e = tmpMeta71;
          _n = tmp74  /* pattern as ty=Integer */;
          _exps = tmpMeta72;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_dimensionUnknown(threadData, listGet(_dims, _n))) goto tmp3_end;
          _exps = omc_List_map1(threadData, _exps, boxvar_ExpressionSimplify_addCast, _tp);
          tmpMeta75 = mmc_mk_cons(_e, _exps);
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT100, tmpMeta75, _tp);
          goto tmp3_done;
        }
        case 12: {
          
          _e = tmp4_1;
          /* Pattern matching succeeded */
          _t1 = omc_Expression_arrayEltType(threadData, _tp);

          _t2 = omc_Expression_arrayEltType(threadData, omc_Expression_typeof(threadData, _e));
          tmpMeta1 = (valueEq(_t1, _t2)?_e:_origExp);
          goto tmp3_done;
        }
        case 13: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMatch(threadData_t *threadData, modelica_metatype _exp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _exp;
    {
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _e1_1 = NULL;
      modelica_metatype _e2_1 = NULL;
      modelica_boolean _b1;
      modelica_boolean _b2;
      modelica_metatype _ty = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _e1_1 has no default value.
      // _e2_1 has no default value.
      // _b1 has no default value.
      // _b2 has no default value.
      // _ty has no default value.
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,33,6) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (!listEmpty(tmpMeta6)) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          if (!listEmpty(tmpMeta7)) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 6));
          if (listEmpty(tmpMeta8)) goto tmp3_end;
          tmpMeta9 = MMC_CAR(tmpMeta8);
          tmpMeta10 = MMC_CDR(tmpMeta8);
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 2));
          if (!listEmpty(tmpMeta11)) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 4));
          if (!listEmpty(tmpMeta12)) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 5));
          if (!listEmpty(tmpMeta13)) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 6));
          if (optionNone(tmpMeta14)) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta14), 1));
          if (!listEmpty(tmpMeta10)) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 7));
          _e = tmpMeta15;
          _ty = tmpMeta16;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(!omc_Types_isTuple(threadData, _ty))) goto tmp3_end;
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_integer tmp29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_integer tmp41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,33,6) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta17)) goto tmp3_end;
          tmpMeta18 = MMC_CAR(tmpMeta17);
          tmpMeta19 = MMC_CDR(tmpMeta17);
          if (!listEmpty(tmpMeta19)) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          if (!listEmpty(tmpMeta20)) goto tmp3_end;
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 6));
          if (listEmpty(tmpMeta21)) goto tmp3_end;
          tmpMeta22 = MMC_CAR(tmpMeta21);
          tmpMeta23 = MMC_CDR(tmpMeta21);
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta22), 2));
          if (listEmpty(tmpMeta24)) goto tmp3_end;
          tmpMeta25 = MMC_CAR(tmpMeta24);
          tmpMeta26 = MMC_CDR(tmpMeta24);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta25,1,2) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta25), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta27,3,1) == 0) goto tmp3_end;
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta27), 2));
          tmp29 = mmc_unbox_integer(tmpMeta28);
          if (!listEmpty(tmpMeta26)) goto tmp3_end;
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta22), 4));
          if (!listEmpty(tmpMeta30)) goto tmp3_end;
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta22), 5));
          if (!listEmpty(tmpMeta31)) goto tmp3_end;
          tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta22), 6));
          if (optionNone(tmpMeta32)) goto tmp3_end;
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta32), 1));
          if (listEmpty(tmpMeta23)) goto tmp3_end;
          tmpMeta34 = MMC_CAR(tmpMeta23);
          tmpMeta35 = MMC_CDR(tmpMeta23);
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta34), 2));
          if (listEmpty(tmpMeta36)) goto tmp3_end;
          tmpMeta37 = MMC_CAR(tmpMeta36);
          tmpMeta38 = MMC_CDR(tmpMeta36);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta37,1,2) == 0) goto tmp3_end;
          tmpMeta39 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta37), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta39,3,1) == 0) goto tmp3_end;
          tmpMeta40 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta39), 2));
          tmp41 = mmc_unbox_integer(tmpMeta40);
          if (!listEmpty(tmpMeta38)) goto tmp3_end;
          tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta34), 4));
          if (!listEmpty(tmpMeta42)) goto tmp3_end;
          tmpMeta43 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta34), 5));
          if (!listEmpty(tmpMeta43)) goto tmp3_end;
          tmpMeta44 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta34), 6));
          if (optionNone(tmpMeta44)) goto tmp3_end;
          tmpMeta45 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta44), 1));
          if (!listEmpty(tmpMeta35)) goto tmp3_end;
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 7));
          _e = tmpMeta18;
          _b1 = tmp29  /* pattern as ty=Boolean */;
          _e1 = tmpMeta33;
          _b2 = tmp41  /* pattern as ty=Boolean */;
          _e2 = tmpMeta45;
          _ty = tmpMeta46;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!((!(!_b1 == !_b2)) && (!omc_Types_isTuple(threadData, _ty)))) goto tmp3_end;
          _e1_1 = (_b1?_e1:_e2);

          _e2_1 = (_b1?_e2:_e1);
          tmpMeta47 = mmc_mk_box4(15, &DAE_Exp_IFEXP__desc, _e, _e1_1, _e2_1);
          tmpMeta1 = tmpMeta47;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          modelica_metatype tmpMeta59;
          modelica_metatype tmpMeta60;
          modelica_integer tmp61;
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          modelica_metatype tmpMeta68;
          modelica_metatype tmpMeta69;
          modelica_metatype tmpMeta70;
          modelica_metatype tmpMeta71;
          modelica_metatype tmpMeta72;
          modelica_metatype tmpMeta73;
          modelica_metatype tmpMeta74;
          modelica_metatype tmpMeta75;
          modelica_metatype tmpMeta76;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,33,6) == 0) goto tmp3_end;
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta48,2,1) == 0) goto tmp3_end;
          tmpMeta49 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta49)) goto tmp3_end;
          tmpMeta50 = MMC_CAR(tmpMeta49);
          tmpMeta51 = MMC_CDR(tmpMeta49);
          if (!listEmpty(tmpMeta51)) goto tmp3_end;
          tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          if (!listEmpty(tmpMeta52)) goto tmp3_end;
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 6));
          if (listEmpty(tmpMeta53)) goto tmp3_end;
          tmpMeta54 = MMC_CAR(tmpMeta53);
          tmpMeta55 = MMC_CDR(tmpMeta53);
          tmpMeta56 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta54), 2));
          if (listEmpty(tmpMeta56)) goto tmp3_end;
          tmpMeta57 = MMC_CAR(tmpMeta56);
          tmpMeta58 = MMC_CDR(tmpMeta56);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta57,1,2) == 0) goto tmp3_end;
          tmpMeta59 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta57), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta59,3,1) == 0) goto tmp3_end;
          tmpMeta60 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta59), 2));
          tmp61 = mmc_unbox_integer(tmpMeta60);
          if (!listEmpty(tmpMeta58)) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta54), 4));
          if (!listEmpty(tmpMeta62)) goto tmp3_end;
          tmpMeta63 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta54), 5));
          if (!listEmpty(tmpMeta63)) goto tmp3_end;
          tmpMeta64 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta54), 6));
          if (optionNone(tmpMeta64)) goto tmp3_end;
          tmpMeta65 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta64), 1));
          if (listEmpty(tmpMeta55)) goto tmp3_end;
          tmpMeta66 = MMC_CAR(tmpMeta55);
          tmpMeta67 = MMC_CDR(tmpMeta55);
          tmpMeta68 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta66), 2));
          if (listEmpty(tmpMeta68)) goto tmp3_end;
          tmpMeta69 = MMC_CAR(tmpMeta68);
          tmpMeta70 = MMC_CDR(tmpMeta68);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta69,0,0) == 0) goto tmp3_end;
          if (!listEmpty(tmpMeta70)) goto tmp3_end;
          tmpMeta71 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta66), 4));
          if (!listEmpty(tmpMeta71)) goto tmp3_end;
          tmpMeta72 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta66), 5));
          if (!listEmpty(tmpMeta72)) goto tmp3_end;
          tmpMeta73 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta66), 6));
          if (optionNone(tmpMeta73)) goto tmp3_end;
          tmpMeta74 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta73), 1));
          if (!listEmpty(tmpMeta67)) goto tmp3_end;
          tmpMeta75 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 7));
          _e = tmpMeta50;
          _b1 = tmp61  /* pattern as ty=Boolean */;
          _e1 = tmpMeta65;
          _e2 = tmpMeta74;
          _ty = tmpMeta75;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(!omc_Types_isTuple(threadData, _ty))) goto tmp3_end;
          _e1_1 = (_b1?_e1:_e2);

          _e2_1 = (_b1?_e2:_e1);
          tmpMeta76 = mmc_mk_box4(15, &DAE_Exp_IFEXP__desc, _e, _e1_1, _e2_1);
          tmpMeta1 = tmpMeta76;
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _exp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyUnbox(threadData_t *threadData, modelica_metatype _exp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _exp;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,35,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,34,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          
          _outExp = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta1 = _outExp;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,34,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,35,2) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          
          _outExp = tmpMeta9;
          /* Pattern matching succeeded */
          tmpMeta1 = _outExp;
          goto tmp3_done;
        }
        case 2: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _exp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCons(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _e = NULL;
      modelica_metatype _es = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _es has no default value.
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,29,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,28,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta7), 2));
          _e = tmpMeta6;
          _es = tmpMeta8;
          /* Pattern matching succeeded */
          tmpMeta9 = mmc_mk_cons(_e, _es);
          tmpMeta10 = mmc_mk_box2(31, &DAE_Exp_LIST__desc, tmpMeta9);
          tmpMeta1 = tmpMeta10;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyMetaModelicaCalls(threadData_t *threadData, modelica_metatype _exp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _exp;
    {
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_boolean _b;
      modelica_metatype _el = NULL;
      modelica_integer _i;
      modelica_real _r;
      modelica_string _s = NULL;
      modelica_metatype _foldExp = NULL;
      modelica_metatype _v = NULL;
      modelica_metatype _ty = NULL;
      modelica_metatype _riters = NULL;
      modelica_string _foldName = NULL;
      modelica_string _resultName = NULL;
      modelica_metatype _rit = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _b has no default value.
      // _el has no default value.
      // _i has no default value.
      // _r has no default value.
      // _s has no default value.
      // _foldExp has no default value.
      // _v has no default value.
      // _ty has no default value.
      // _riters has no default value.
      // _foldName has no default value.
      // _resultName has no default value.
      // _rit has no default value.
      tmp4 = 0;
      for (; tmp4 < 11; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,1,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          if (10 != MMC_STRLEN(tmpMeta7) || strcmp(MMC_STRINGDATA(_OMC_LIT140), MMC_STRINGDATA(tmpMeta7)) != 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta8)) goto tmp3_end;
          tmpMeta9 = MMC_CAR(tmpMeta8);
          tmpMeta10 = MMC_CDR(tmpMeta8);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,28,1) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 2));
          if (listEmpty(tmpMeta10)) goto tmp3_end;
          tmpMeta12 = MMC_CAR(tmpMeta10);
          tmpMeta13 = MMC_CDR(tmpMeta10);
          if (!listEmpty(tmpMeta13)) goto tmp3_end;
          
          _el = tmpMeta11;
          _e2 = tmpMeta12;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_List_fold(threadData, listReverse(_el), boxvar_Expression_makeCons, _e2);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta14,1,1) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta14), 2));
          if (10 != MMC_STRLEN(tmpMeta15) || strcmp(MMC_STRINGDATA(_OMC_LIT140), MMC_STRINGDATA(tmpMeta15)) != 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta16)) goto tmp3_end;
          tmpMeta17 = MMC_CAR(tmpMeta16);
          tmpMeta18 = MMC_CDR(tmpMeta16);
          if (listEmpty(tmpMeta18)) goto tmp3_end;
          tmpMeta19 = MMC_CAR(tmpMeta18);
          tmpMeta20 = MMC_CDR(tmpMeta18);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta19,28,1) == 0) goto tmp3_end;
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta19), 2));
          if (!listEmpty(tmpMeta21)) goto tmp3_end;
          if (!listEmpty(tmpMeta20)) goto tmp3_end;
          
          _e1 = tmpMeta17;
          /* Pattern matching succeeded */
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_integer tmp28;
          modelica_metatype tmpMeta29;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta22,1,1) == 0) goto tmp3_end;
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta22), 2));
          if (9 != MMC_STRLEN(tmpMeta23) || strcmp(MMC_STRINGDATA(_OMC_LIT141), MMC_STRINGDATA(tmpMeta23)) != 0) goto tmp3_end;
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta24)) goto tmp3_end;
          tmpMeta25 = MMC_CAR(tmpMeta24);
          tmpMeta26 = MMC_CDR(tmpMeta24);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta25,0,1) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta25), 2));
          tmp28 = mmc_unbox_integer(tmpMeta27);
          if (!listEmpty(tmpMeta26)) goto tmp3_end;
          
          _i = tmp28  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          _s = intString(_i);
          tmpMeta29 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _s);
          tmpMeta1 = tmpMeta29;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_real tmp36;
          modelica_metatype tmpMeta37;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta30,1,1) == 0) goto tmp3_end;
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta30), 2));
          if (10 != MMC_STRLEN(tmpMeta31) || strcmp(MMC_STRINGDATA(_OMC_LIT142), MMC_STRINGDATA(tmpMeta31)) != 0) goto tmp3_end;
          tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta32)) goto tmp3_end;
          tmpMeta33 = MMC_CAR(tmpMeta32);
          tmpMeta34 = MMC_CDR(tmpMeta32);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta33,1,1) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta33), 2));
          tmp36 = mmc_unbox_real(tmpMeta35);
          if (!listEmpty(tmpMeta34)) goto tmp3_end;
          
          _r = tmp36  /* pattern as ty=Real */;
          /* Pattern matching succeeded */
          _s = realString(_r);
          tmpMeta37 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _s);
          tmpMeta1 = tmpMeta37;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_integer tmp44;
          modelica_metatype tmpMeta45;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta38 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta38,1,1) == 0) goto tmp3_end;
          tmpMeta39 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta38), 2));
          if (10 != MMC_STRLEN(tmpMeta39) || strcmp(MMC_STRINGDATA(_OMC_LIT143), MMC_STRINGDATA(tmpMeta39)) != 0) goto tmp3_end;
          tmpMeta40 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta40)) goto tmp3_end;
          tmpMeta41 = MMC_CAR(tmpMeta40);
          tmpMeta42 = MMC_CDR(tmpMeta40);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta41,3,1) == 0) goto tmp3_end;
          tmpMeta43 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta41), 2));
          tmp44 = mmc_unbox_integer(tmpMeta43);
          if (!listEmpty(tmpMeta42)) goto tmp3_end;
          
          _b = tmp44  /* pattern as ty=Boolean */;
          /* Pattern matching succeeded */
          _s = (_b?_OMC_LIT77:_OMC_LIT78);
          tmpMeta45 = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _s);
          tmpMeta1 = tmpMeta45;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta46;
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta46,1,1) == 0) goto tmp3_end;
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta46), 2));
          if (11 != MMC_STRLEN(tmpMeta47) || strcmp(MMC_STRINGDATA(_OMC_LIT135), MMC_STRINGDATA(tmpMeta47)) != 0) goto tmp3_end;
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta48)) goto tmp3_end;
          tmpMeta49 = MMC_CAR(tmpMeta48);
          tmpMeta50 = MMC_CDR(tmpMeta48);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta49,28,1) == 0) goto tmp3_end;
          tmpMeta51 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta49), 2));
          if (!listEmpty(tmpMeta50)) goto tmp3_end;
          
          _el = tmpMeta51;
          /* Pattern matching succeeded */
          _el = listReverse(_el);
          tmpMeta52 = mmc_mk_box2(31, &DAE_Exp_LIST__desc, _el);
          tmpMeta1 = tmpMeta52;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          modelica_metatype tmpMeta59;
          modelica_metatype tmpMeta60;
          modelica_metatype tmpMeta61;
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          modelica_metatype tmpMeta68;
          modelica_metatype tmpMeta69;
          modelica_metatype tmpMeta70;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta53,1,1) == 0) goto tmp3_end;
          tmpMeta54 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta53), 2));
          if (11 != MMC_STRLEN(tmpMeta54) || strcmp(MMC_STRINGDATA(_OMC_LIT135), MMC_STRINGDATA(tmpMeta54)) != 0) goto tmp3_end;
          tmpMeta55 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta55)) goto tmp3_end;
          tmpMeta56 = MMC_CAR(tmpMeta55);
          tmpMeta57 = MMC_CDR(tmpMeta55);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta56,27,3) == 0) goto tmp3_end;
          tmpMeta58 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta56), 2));
          tmpMeta59 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta58), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta59,1,1) == 0) goto tmp3_end;
          tmpMeta60 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta59), 2));
          if (4 != MMC_STRLEN(tmpMeta60) || strcmp(MMC_STRINGDATA(_OMC_LIT137), MMC_STRINGDATA(tmpMeta60)) != 0) goto tmp3_end;
          tmpMeta61 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta58), 3));
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta58), 4));
          tmpMeta63 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta58), 5));
          tmpMeta64 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta58), 6));
          tmpMeta65 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta58), 7));
          tmpMeta66 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta58), 8));
          tmpMeta67 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta56), 3));
          tmpMeta68 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta56), 4));
          if (!listEmpty(tmpMeta57)) goto tmp3_end;
          
          _rit = tmpMeta61;
          _ty = tmpMeta62;
          _v = tmpMeta63;
          _foldName = tmpMeta64;
          _resultName = tmpMeta65;
          _foldExp = tmpMeta66;
          _e1 = tmpMeta67;
          _riters = tmpMeta68;
          /* Pattern matching succeeded */
          tmpMeta69 = mmc_mk_box8(3, &DAE_ReductionInfo_REDUCTIONINFO__desc, _OMC_LIT136, _rit, _ty, _v, _foldName, _resultName, _foldExp);
          tmpMeta70 = mmc_mk_box4(30, &DAE_Exp_REDUCTION__desc, tmpMeta69, _e1, _riters);
          tmpMeta1 = tmpMeta70;
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta71;
          modelica_metatype tmpMeta72;
          modelica_metatype tmpMeta73;
          modelica_metatype tmpMeta74;
          modelica_metatype tmpMeta75;
          modelica_metatype tmpMeta76;
          modelica_metatype tmpMeta77;
          modelica_metatype tmpMeta78;
          modelica_metatype tmpMeta79;
          modelica_metatype tmpMeta80;
          modelica_metatype tmpMeta81;
          modelica_metatype tmpMeta82;
          modelica_metatype tmpMeta83;
          modelica_metatype tmpMeta84;
          modelica_metatype tmpMeta85;
          modelica_metatype tmpMeta86;
          modelica_metatype tmpMeta87;
          modelica_metatype tmpMeta88;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta71 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta71,1,1) == 0) goto tmp3_end;
          tmpMeta72 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta71), 2));
          if (11 != MMC_STRLEN(tmpMeta72) || strcmp(MMC_STRINGDATA(_OMC_LIT135), MMC_STRINGDATA(tmpMeta72)) != 0) goto tmp3_end;
          tmpMeta73 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta73)) goto tmp3_end;
          tmpMeta74 = MMC_CAR(tmpMeta73);
          tmpMeta75 = MMC_CDR(tmpMeta73);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta74,27,3) == 0) goto tmp3_end;
          tmpMeta76 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta74), 2));
          tmpMeta77 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta76), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta77,1,1) == 0) goto tmp3_end;
          tmpMeta78 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta77), 2));
          if (11 != MMC_STRLEN(tmpMeta78) || strcmp(MMC_STRINGDATA(_OMC_LIT135), MMC_STRINGDATA(tmpMeta78)) != 0) goto tmp3_end;
          tmpMeta79 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta76), 3));
          tmpMeta80 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta76), 4));
          tmpMeta81 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta76), 5));
          tmpMeta82 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta76), 6));
          tmpMeta83 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta76), 7));
          tmpMeta84 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta76), 8));
          tmpMeta85 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta74), 3));
          tmpMeta86 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta74), 4));
          if (!listEmpty(tmpMeta75)) goto tmp3_end;
          
          _rit = tmpMeta79;
          _ty = tmpMeta80;
          _v = tmpMeta81;
          _foldName = tmpMeta82;
          _resultName = tmpMeta83;
          _foldExp = tmpMeta84;
          _e1 = tmpMeta85;
          _riters = tmpMeta86;
          /* Pattern matching succeeded */
          tmpMeta87 = mmc_mk_box8(3, &DAE_ReductionInfo_REDUCTIONINFO__desc, _OMC_LIT138, _rit, _ty, _v, _foldName, _resultName, _foldExp);
          tmpMeta88 = mmc_mk_box4(30, &DAE_Exp_REDUCTION__desc, tmpMeta87, _e1, _riters);
          tmpMeta1 = tmpMeta88;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta89;
          modelica_metatype tmpMeta90;
          modelica_metatype tmpMeta91;
          modelica_metatype tmpMeta92;
          modelica_metatype tmpMeta93;
          modelica_metatype tmpMeta94;
          modelica_metatype tmpMeta95;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta89 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta89,1,1) == 0) goto tmp3_end;
          tmpMeta90 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta89), 2));
          if (10 != MMC_STRLEN(tmpMeta90) || strcmp(MMC_STRINGDATA(_OMC_LIT144), MMC_STRINGDATA(tmpMeta90)) != 0) goto tmp3_end;
          tmpMeta91 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta91)) goto tmp3_end;
          tmpMeta92 = MMC_CAR(tmpMeta91);
          tmpMeta93 = MMC_CDR(tmpMeta91);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta92,28,1) == 0) goto tmp3_end;
          tmpMeta94 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta92), 2));
          if (!listEmpty(tmpMeta93)) goto tmp3_end;
          
          _el = tmpMeta94;
          /* Pattern matching succeeded */
          _i = listLength(_el);
          tmpMeta95 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_i));
          tmpMeta1 = tmpMeta95;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta96;
          modelica_metatype tmpMeta97;
          modelica_metatype tmpMeta98;
          modelica_metatype tmpMeta99;
          modelica_metatype tmpMeta100;
          modelica_metatype tmpMeta101;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta96 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta96,1,1) == 0) goto tmp3_end;
          tmpMeta97 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta96), 2));
          if (11 != MMC_STRLEN(tmpMeta97) || strcmp(MMC_STRINGDATA(_OMC_LIT145), MMC_STRINGDATA(tmpMeta97)) != 0) goto tmp3_end;
          tmpMeta98 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta98)) goto tmp3_end;
          tmpMeta99 = MMC_CAR(tmpMeta98);
          tmpMeta100 = MMC_CDR(tmpMeta98);
          if (!listEmpty(tmpMeta100)) goto tmp3_end;
          
          _e = tmpMeta99;
          /* Pattern matching succeeded */
          tmpMeta101 = mmc_mk_box2(34, &DAE_Exp_META__OPTION__desc, mmc_mk_some(_e));
          tmpMeta1 = tmpMeta101;
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta102;
          modelica_metatype tmpMeta103;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta102 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta102,1,1) == 0) goto tmp3_end;
          tmpMeta103 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta102), 2));
          if (10 != MMC_STRLEN(tmpMeta103) || strcmp(MMC_STRINGDATA(_OMC_LIT146), MMC_STRINGDATA(tmpMeta103)) != 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          fputs(MMC_STRINGDATA(_OMC_LIT139),stdout);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyIfExp(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _cond, modelica_metatype _tb, modelica_metatype _fb)
{
  modelica_metatype _exp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_metatype tmp4_3;
    tmp4_1 = _cond;
    tmp4_2 = _tb;
    tmp4_3 = _fb;
    {
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      tmp4 = 0;
      for (; tmp4 < 6; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_integer tmp7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp7 = mmc_unbox_integer(tmpMeta6);
          if (1 /* true */ != tmp7) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _tb;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_integer tmp9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmp9 = mmc_unbox_integer(tmpMeta8);
          if (0 /* false */ != tmp9) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _fb;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta10;
          modelica_integer tmp11;
          modelica_metatype tmpMeta12;
          modelica_integer tmp13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp11 = mmc_unbox_integer(tmpMeta10);
          if (1 /* true */ != tmp11) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp13 = mmc_unbox_integer(tmpMeta12);
          if (0 /* false */ != tmp13) goto tmp3_end;
          
          _exp = tmp4_1;
          /* Pattern matching succeeded */
          tmpMeta1 = _exp;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta14;
          modelica_integer tmp15;
          modelica_metatype tmpMeta16;
          modelica_integer tmp17;
          modelica_metatype tmpMeta18;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,3,1) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          tmp15 = mmc_unbox_integer(tmpMeta14);
          if (0 /* false */ != tmp15) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,3,1) == 0) goto tmp3_end;
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          tmp17 = mmc_unbox_integer(tmpMeta16);
          if (1 /* true */ != tmp17) goto tmp3_end;
          
          _exp = tmp4_1;
          /* Pattern matching succeeded */
          tmpMeta18 = mmc_mk_box3(13, &DAE_Exp_LUNARY__desc, _OMC_LIT147, _exp);
          tmpMeta1 = tmpMeta18;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,34,1) == 0) goto tmp3_end;
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_3,34,1) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_3), 2));
          
          _e1 = tmpMeta19;
          _e2 = tmpMeta20;
          _e = tmp4_1;
          /* Pattern matching succeeded */
          tmpMeta21 = mmc_mk_box4(15, &DAE_Exp_IFEXP__desc, _e, _e1, _e2);
          _e = tmpMeta21;
          tmpMeta22 = mmc_mk_box2(37, &DAE_Exp_BOX__desc, _e);
          tmpMeta1 = tmpMeta22;
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = (omc_Expression_expEqual(threadData, _tb, _fb)?_tb:_origExp);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyReductionIterators(threadData_t *threadData, modelica_metatype _inIters, modelica_metatype _inAcc, modelica_boolean _inChange, modelica_boolean *out_outChange)
{
  modelica_metatype _outIters = NULL;
  modelica_boolean _outChange;
  modelica_boolean tmp1_c1 __attribute__((unused)) = 0;
  modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outIters has no default value.
  // _outChange has no default value.
  
  
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_boolean tmp4_3;
    tmp4_1 = _inIters;
    tmp4_2 = _inAcc;
    tmp4_3 = _inChange;
    {
      modelica_string _id = NULL;
      modelica_metatype _exp = NULL;
      modelica_metatype _ty = NULL;
      modelica_metatype _iter = NULL;
      modelica_metatype _iters = NULL;
      modelica_metatype _acc = NULL;
      modelica_boolean _change;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _id has no default value.
      // _exp has no default value.
      // _ty has no default value.
      // _iter has no default value.
      // _iters has no default value.
      // _acc has no default value.
      // _change has no default value.
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (!listEmpty(tmp4_1)) goto tmp3_end;
          
          _acc = tmp4_2;
          _change = tmp4_3;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = listReverse(_acc);
          tmp1_c1 = _change;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_integer tmp13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta6 = MMC_CAR(tmp4_1);
          tmpMeta7 = MMC_CDR(tmp4_1);
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 3));
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 4));
          if (optionNone(tmpMeta10)) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta10), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta11,3,1) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta11), 2));
          tmp13 = mmc_unbox_integer(tmpMeta12);
          if (1 /* true */ != tmp13) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 5));
          
          _id = tmpMeta8;
          _exp = tmpMeta9;
          _ty = tmpMeta14;
          _iters = tmpMeta7;
          _acc = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta16 = mmc_mk_box5(3, &DAE_ReductionIterator_REDUCTIONITER__desc, _id, _exp, mmc_mk_none(), _ty);
          tmpMeta15 = mmc_mk_cons(tmpMeta16, _acc);
          /* Tail recursive call */
          _inIters = _iters;
          _inAcc = tmpMeta15;
          _inChange = 1 /* true */;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_integer tmp23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta17 = MMC_CAR(tmp4_1);
          tmpMeta18 = MMC_CDR(tmp4_1);
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta17), 2));
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta17), 4));
          if (optionNone(tmpMeta20)) goto tmp3_end;
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta20), 1));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta21,3,1) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta21), 2));
          tmp23 = mmc_unbox_integer(tmpMeta22);
          if (0 /* false */ != tmp23) goto tmp3_end;
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta17), 5));
          
          _id = tmpMeta19;
          _ty = tmpMeta24;
          /* Pattern matching succeeded */
          tmpMeta26 = mmc_mk_box5(3, &DAE_ReductionIterator_REDUCTIONITER__desc, _id, _OMC_LIT148, mmc_mk_none(), _ty);
          tmpMeta25 = mmc_mk_cons(tmpMeta26, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta[0+0] = tmpMeta25;
          tmp1_c1 = 1 /* true */;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          if (listEmpty(tmp4_1)) goto tmp3_end;
          tmpMeta27 = MMC_CAR(tmp4_1);
          tmpMeta28 = MMC_CDR(tmp4_1);
          
          _iter = tmpMeta27;
          _iters = tmpMeta28;
          _acc = tmp4_2;
          _change = tmp4_3;
          /* Pattern matching succeeded */
          tmpMeta29 = mmc_mk_cons(_iter, _acc);
          /* Tail recursive call */
          _inIters = _iters;
          _inAcc = tmpMeta29;
          _inChange = _change;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outIters = tmpMeta[0+0];
  _outChange = tmp1_c1;
  _return: OMC_LABEL_UNUSED
  if (out_outChange) { *out_outChange = _outChange; }
  return _outIters;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyReductionIterators(threadData_t *threadData, modelica_metatype _inIters, modelica_metatype _inAcc, modelica_metatype _inChange, modelica_metatype *out_outChange)
{
  modelica_integer tmp1;
  modelica_boolean _outChange;
  modelica_metatype _outIters = NULL;
  tmp1 = mmc_unbox_integer(_inChange);
  _outIters = omc_ExpressionSimplify_simplifyReductionIterators(threadData, _inIters, _inAcc, tmp1, &_outChange);
  /* skip box _outIters; list<DAE.ReductionIterator> */
  if (out_outChange) { *out_outChange = mmc_mk_icon(_outChange); }
  return _outIters;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplify1FixP(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inOptions, modelica_integer _n, modelica_boolean _cont, modelica_boolean _hasChanged, modelica_boolean *out_outHasChanged)
{
  modelica_metatype _outExp = NULL;
  modelica_boolean _outHasChanged;
  modelica_boolean tmp1_c1 __attribute__((unused)) = 0;
  modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _outHasChanged has no default value.
  
  
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;modelica_integer tmp4_3;modelica_boolean tmp4_4;
    tmp4_1 = _inExp;
    tmp4_2 = _inOptions;
    tmp4_3 = _n;
    tmp4_4 = _cont;
    {
      modelica_metatype _exp = NULL;
      modelica_metatype _expAfterSimplify = NULL;
      modelica_boolean _b;
      modelica_string _str1 = NULL;
      modelica_string _str2 = NULL;
      modelica_metatype _options = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _exp has no default value.
      // _expAfterSimplify has no default value.
      // _b has no default value.
      // _str1 has no default value.
      // _str2 has no default value.
      // _options has no default value.
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (0 /* false */ != tmp4_4) goto tmp3_end;
          
          _exp = tmp4_1;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _exp;
          tmp1_c1 = _hasChanged;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          if (0 != tmp4_3) goto tmp3_end;
          
          _exp = tmp4_1;
          _options = tmp4_2;
          /* Pattern matching succeeded */
          _str1 = omc_ExpressionDump_printExpStr(threadData, _exp);

          _exp = omc_Expression_traverseExpBottomUp(threadData, _exp, boxvar_ExpressionSimplify_simplifyWork, _options, NULL);

          _str2 = omc_ExpressionDump_printExpStr(threadData, _exp);

          tmpMeta6 = mmc_mk_cons(_str1, mmc_mk_cons(_str2, MMC_REFSTRUCTLIT(mmc_nil)));
          omc_Error_addMessage(threadData, _OMC_LIT152, tmpMeta6);
          tmpMeta[0+0] = _exp;
          tmp1_c1 = _hasChanged;
          goto tmp3_done;
        }
        case 2: {
          if (1 /* true */ != tmp4_4) goto tmp3_end;
          
          _exp = tmp4_1;
          _options = tmp4_2;
          /* Pattern matching succeeded */
          omc_ErrorExt_setCheckpoint(threadData, _OMC_LIT153);

          _expAfterSimplify = omc_Expression_traverseExpBottomUp(threadData, _exp, boxvar_ExpressionSimplify_simplifyWork, _options ,&_options);

          _b = (!referenceEq(_expAfterSimplify, _exp));

          if(_b)
          {
            omc_ErrorExt_rollBack(threadData, _OMC_LIT153);
          }
          else
          {
            omc_ErrorExt_delCheckpoint(threadData, _OMC_LIT153);
          }
          /* Tail recursive call */
          _inExp = _expAfterSimplify;
          _inOptions = _options;
          _n = ((modelica_integer) -1) + _n;
          _cont = _b;
          _hasChanged = (_b || _hasChanged);
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta[0+0];
  _outHasChanged = tmp1_c1;
  _return: OMC_LABEL_UNUSED
  if (out_outHasChanged) { *out_outHasChanged = _outHasChanged; }
  return _outExp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplify1FixP(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inOptions, modelica_metatype _n, modelica_metatype _cont, modelica_metatype _hasChanged, modelica_metatype *out_outHasChanged)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_integer tmp3;
  modelica_boolean _outHasChanged;
  modelica_metatype _outExp = NULL;
  tmp1 = mmc_unbox_integer(_n);
  tmp2 = mmc_unbox_integer(_cont);
  tmp3 = mmc_unbox_integer(_hasChanged);
  _outExp = omc_ExpressionSimplify_simplify1FixP(threadData, _inExp, _inOptions, tmp1, tmp2, tmp3, &_outHasChanged);
  /* skip box _outExp; DAE.Exp */
  if (out_outHasChanged) { *out_outHasChanged = mmc_mk_icon(_outHasChanged); }
  return _outExp;
}

PROTECTED_FUNCTION_STATIC void omc_ExpressionSimplify_checkSimplify(threadData_t *threadData, modelica_boolean _check, modelica_metatype _before, modelica_metatype _after)
{
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  { /* match expression */
    modelica_boolean tmp3_1;
    tmp3_1 = _check;
    {
      modelica_integer _c1;
      modelica_integer _c2;
      modelica_boolean _b;
      modelica_string _s1 = NULL;
      modelica_string _s2 = NULL;
      modelica_string _s3 = NULL;
      modelica_string _s4 = NULL;
      modelica_metatype _ty1 = NULL;
      modelica_metatype _ty2 = NULL;
      volatile mmc_switch_type tmp3;
      int tmp4;
      // _c1 has no default value.
      // _c2 has no default value.
      // _b has no default value.
      // _s1 has no default value.
      // _s2 has no default value.
      // _s3 has no default value.
      // _s4 has no default value.
      // _ty1 has no default value.
      // _ty2 has no default value.
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          if (0 /* false */ != tmp3_1) goto tmp2_end;
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 1: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          if (1 /* true */ != tmp3_1) goto tmp2_end;
          /* Pattern matching succeeded */
          _ty1 = omc_Expression_typeof(threadData, _before);

          _ty2 = omc_Expression_typeof(threadData, _after);

          _b = valueEq(_ty1, _ty2);

          if((!_b))
          {
            _s1 = omc_ExpressionDump_printExpStr(threadData, _before);

            _s2 = omc_ExpressionDump_printExpStr(threadData, _after);

            _s3 = omc_Types_unparseType(threadData, _ty1);

            _s4 = omc_Types_unparseType(threadData, _ty2);

            tmpMeta5 = mmc_mk_cons(_s1, mmc_mk_cons(_s2, mmc_mk_cons(_s3, mmc_mk_cons(_s4, MMC_REFSTRUCTLIT(mmc_nil)))));
            omc_Error_addMessage(threadData, _OMC_LIT157, tmpMeta5);

            goto goto_1;
          }

          _c1 = omc_Expression_complexity(threadData, _before);

          _c2 = omc_Expression_complexity(threadData, _after);

          _b = (_c1 < _c2);

          if(_b)
          {
            _s1 = intString(_c2);

            _s2 = intString(_c1);

            _s3 = omc_ExpressionDump_printExpStr(threadData, _before);

            _s4 = omc_ExpressionDump_printExpStr(threadData, _after);

            tmpMeta6 = mmc_mk_cons(_s1, mmc_mk_cons(_s2, mmc_mk_cons(_s3, mmc_mk_cons(_s4, MMC_REFSTRUCTLIT(mmc_nil)))));
            omc_Error_addMessage(threadData, _OMC_LIT161, tmpMeta6);

            goto goto_1;
          }
          goto tmp2_done;
        }
        }
        goto tmp2_end;
        tmp2_end: ;
      }
      goto goto_1;
      goto_1:;
      MMC_THROW_INTERNAL();
      goto tmp2_done;
      tmp2_done:;
    }
  }
  ;
  _return: OMC_LABEL_UNUSED
  return;
}
PROTECTED_FUNCTION_STATIC void boxptr_ExpressionSimplify_checkSimplify(threadData_t *threadData, modelica_metatype _check, modelica_metatype _before, modelica_metatype _after)
{
  modelica_integer tmp1;
  tmp1 = mmc_unbox_integer(_check);
  omc_ExpressionSimplify_checkSimplify(threadData, tmp1, _before, _after);
  return;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplify1WithOptions(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _options, modelica_boolean *out_hasChanged)
{
  modelica_metatype _outExp = NULL;
  modelica_boolean _hasChanged;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _hasChanged has no default value.
  _outExp = omc_ExpressionSimplify_simplify1FixP(threadData, _inExp, _options, ((modelica_integer) 100), 1 /* true */, 0 /* false */ ,&_hasChanged);

  omc_ExpressionSimplify_checkSimplify(threadData, omc_Flags_isSet(threadData, _OMC_LIT165), _inExp, _outExp);
  _return: OMC_LABEL_UNUSED
  if (out_hasChanged) { *out_hasChanged = _hasChanged; }
  return _outExp;
}
modelica_metatype boxptr_ExpressionSimplify_simplify1WithOptions(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _options, modelica_metatype *out_hasChanged)
{
  modelica_boolean _hasChanged;
  modelica_metatype _outExp = NULL;
  _outExp = omc_ExpressionSimplify_simplify1WithOptions(threadData, _inExp, _options, &_hasChanged);
  /* skip box _outExp; DAE.Exp */
  if (out_hasChanged) { *out_hasChanged = mmc_mk_icon(_hasChanged); }
  return _outExp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplify1o(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _e = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (optionNone(tmp4_1)) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 1));
          _e = tmpMeta6;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplify1WithOptions(threadData, _e, _OMC_LIT167, NULL);
          tmpMeta1 = mmc_mk_some(_e);
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplify1(threadData_t *threadData, modelica_metatype _inExp, modelica_boolean *out_hasChanged)
{
  modelica_metatype _outExp = NULL;
  modelica_boolean _hasChanged;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _hasChanged has no default value.
  _outExp = omc_ExpressionSimplify_simplify1WithOptions(threadData, _inExp, _OMC_LIT167 ,&_hasChanged);
  _return: OMC_LABEL_UNUSED
  if (out_hasChanged) { *out_hasChanged = _hasChanged; }
  return _outExp;
}
modelica_metatype boxptr_ExpressionSimplify_simplify1(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype *out_hasChanged)
{
  modelica_boolean _hasChanged;
  modelica_metatype _outExp = NULL;
  _outExp = omc_ExpressionSimplify_simplify1(threadData, _inExp, &_hasChanged);
  /* skip box _outExp; DAE.Exp */
  if (out_hasChanged) { *out_hasChanged = mmc_mk_icon(_hasChanged); }
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_edgeCref(threadData_t *threadData, modelica_metatype _ie, modelica_boolean _ib, modelica_boolean *out_cont, modelica_boolean *out_ob)
{
  modelica_metatype _oe = NULL;
  modelica_boolean _cont;
  modelica_boolean _ob;
  modelica_boolean tmp1_c1 __attribute__((unused)) = 0;
  modelica_boolean tmp1_c2 __attribute__((unused)) = 0;
  modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _oe has no default value.
  // _cont has no default value.
  // _ob has no default value.
  
  
  
  { /* match expression */
    modelica_metatype tmp4_1;modelica_boolean tmp4_2;
    tmp4_1 = _ie;
    tmp4_2 = _ib;
    {
      modelica_metatype _e = NULL;
      modelica_boolean _b;
      modelica_metatype _ty = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _b has no default value.
      // _ty has no default value.
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _e = tmp4_1;
          _ty = tmpMeta6;
          /* Pattern matching succeeded */
          tmpMeta7 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta[0+0] = omc_Expression_makeBuiltinCall(threadData, _OMC_LIT65, tmpMeta7, _ty, 0 /* false */);
          tmp1_c1 = 0 /* false */;
          tmp1_c2 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          if (4 != MMC_STRLEN(tmpMeta9) || strcmp(MMC_STRINGDATA(_OMC_LIT65), MMC_STRINGDATA(tmpMeta9)) != 0) goto tmp3_end;
          
          _e = tmp4_1;
          _b = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _e;
          tmp1_c1 = 0 /* false */;
          tmp1_c2 = _b;
          goto tmp3_done;
        }
        case 2: {
          
          _e = tmp4_1;
          _b = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _e;
          tmp1_c1 = (!_b);
          tmp1_c2 = _b;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _oe = tmpMeta[0+0];
  _cont = tmp1_c1;
  _ob = tmp1_c2;
  _return: OMC_LABEL_UNUSED
  if (out_cont) { *out_cont = _cont; }
  if (out_ob) { *out_ob = _ob; }
  return _oe;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_edgeCref(threadData_t *threadData, modelica_metatype _ie, modelica_metatype _ib, modelica_metatype *out_cont, modelica_metatype *out_ob)
{
  modelica_integer tmp1;
  modelica_boolean _cont;
  modelica_boolean _ob;
  modelica_metatype _oe = NULL;
  tmp1 = mmc_unbox_integer(_ib);
  _oe = omc_ExpressionSimplify_edgeCref(threadData, _ie, tmp1, &_cont, &_ob);
  /* skip box _oe; DAE.Exp */
  if (out_cont) { *out_cont = mmc_mk_icon(_cont); }
  if (out_ob) { *out_ob = mmc_mk_icon(_ob); }
  return _oe;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_changeCref(threadData_t *threadData, modelica_metatype _ie, modelica_boolean _ib, modelica_boolean *out_cont, modelica_boolean *out_ob)
{
  modelica_metatype _oe = NULL;
  modelica_boolean _cont;
  modelica_boolean _ob;
  modelica_boolean tmp1_c1 __attribute__((unused)) = 0;
  modelica_boolean tmp1_c2 __attribute__((unused)) = 0;
  modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _oe has no default value.
  // _cont has no default value.
  // _ob has no default value.
  
  
  
  { /* match expression */
    modelica_metatype tmp4_1;modelica_boolean tmp4_2;
    tmp4_1 = _ie;
    tmp4_2 = _ib;
    {
      modelica_metatype _e = NULL;
      modelica_boolean _b;
      modelica_metatype _ty = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _b has no default value.
      // _ty has no default value.
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _e = tmp4_1;
          _ty = tmpMeta6;
          /* Pattern matching succeeded */
          tmpMeta7 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta[0+0] = omc_Expression_makeBuiltinCall(threadData, _OMC_LIT66, tmpMeta7, _ty, 0 /* false */);
          tmp1_c1 = 0 /* false */;
          tmp1_c2 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          if (6 != MMC_STRLEN(tmpMeta9) || strcmp(MMC_STRINGDATA(_OMC_LIT66), MMC_STRINGDATA(tmpMeta9)) != 0) goto tmp3_end;
          
          _e = tmp4_1;
          _b = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _e;
          tmp1_c1 = 0 /* false */;
          tmp1_c2 = _b;
          goto tmp3_done;
        }
        case 2: {
          
          _e = tmp4_1;
          _b = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _e;
          tmp1_c1 = (!_b);
          tmp1_c2 = _b;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _oe = tmpMeta[0+0];
  _cont = tmp1_c1;
  _ob = tmp1_c2;
  _return: OMC_LABEL_UNUSED
  if (out_cont) { *out_cont = _cont; }
  if (out_ob) { *out_ob = _ob; }
  return _oe;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_changeCref(threadData_t *threadData, modelica_metatype _ie, modelica_metatype _ib, modelica_metatype *out_cont, modelica_metatype *out_ob)
{
  modelica_integer tmp1;
  modelica_boolean _cont;
  modelica_boolean _ob;
  modelica_metatype _oe = NULL;
  tmp1 = mmc_unbox_integer(_ib);
  _oe = omc_ExpressionSimplify_changeCref(threadData, _ie, tmp1, &_cont, &_ob);
  /* skip box _oe; DAE.Exp */
  if (out_cont) { *out_cont = mmc_mk_icon(_cont); }
  if (out_ob) { *out_ob = mmc_mk_icon(_ob); }
  return _oe;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_previousCref(threadData_t *threadData, modelica_metatype _ie, modelica_boolean _ib, modelica_boolean *out_cont, modelica_boolean *out_ob)
{
  modelica_metatype _oe = NULL;
  modelica_boolean _cont;
  modelica_boolean _ob;
  modelica_boolean tmp1_c1 __attribute__((unused)) = 0;
  modelica_boolean tmp1_c2 __attribute__((unused)) = 0;
  modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _oe has no default value.
  // _cont has no default value.
  // _ob has no default value.
  
  
  
  { /* match expression */
    modelica_metatype tmp4_1;modelica_boolean tmp4_2;
    tmp4_1 = _ie;
    tmp4_2 = _ib;
    {
      modelica_metatype _e = NULL;
      modelica_boolean _b;
      modelica_metatype _ty = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _b has no default value.
      // _ty has no default value.
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _e = tmp4_1;
          _ty = tmpMeta6;
          /* Pattern matching succeeded */
          tmpMeta7 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta[0+0] = omc_Expression_makeBuiltinCall(threadData, _OMC_LIT64, tmpMeta7, _ty, 0 /* false */);
          tmp1_c1 = 0 /* false */;
          tmp1_c2 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          if (8 != MMC_STRLEN(tmpMeta9) || strcmp(MMC_STRINGDATA(_OMC_LIT64), MMC_STRINGDATA(tmpMeta9)) != 0) goto tmp3_end;
          
          _e = tmp4_1;
          _b = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _e;
          tmp1_c1 = 0 /* false */;
          tmp1_c2 = _b;
          goto tmp3_done;
        }
        case 2: {
          
          _e = tmp4_1;
          _b = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _e;
          tmp1_c1 = (!_b);
          tmp1_c2 = _b;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _oe = tmpMeta[0+0];
  _cont = tmp1_c1;
  _ob = tmp1_c2;
  _return: OMC_LABEL_UNUSED
  if (out_cont) { *out_cont = _cont; }
  if (out_ob) { *out_ob = _ob; }
  return _oe;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_previousCref(threadData_t *threadData, modelica_metatype _ie, modelica_metatype _ib, modelica_metatype *out_cont, modelica_metatype *out_ob)
{
  modelica_integer tmp1;
  modelica_boolean _cont;
  modelica_boolean _ob;
  modelica_metatype _oe = NULL;
  tmp1 = mmc_unbox_integer(_ib);
  _oe = omc_ExpressionSimplify_previousCref(threadData, _ie, tmp1, &_cont, &_ob);
  /* skip box _oe; DAE.Exp */
  if (out_cont) { *out_cont = mmc_mk_icon(_cont); }
  if (out_ob) { *out_ob = mmc_mk_icon(_ob); }
  return _oe;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_preCref(threadData_t *threadData, modelica_metatype _ie, modelica_boolean _ib, modelica_boolean *out_cont, modelica_boolean *out_ob)
{
  modelica_metatype _oe = NULL;
  modelica_boolean _cont;
  modelica_boolean _ob;
  modelica_boolean tmp1_c1 __attribute__((unused)) = 0;
  modelica_boolean tmp1_c2 __attribute__((unused)) = 0;
  modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _oe has no default value.
  // _cont has no default value.
  // _ob has no default value.
  
  
  
  { /* match expression */
    modelica_metatype tmp4_1;modelica_boolean tmp4_2;
    tmp4_1 = _ie;
    tmp4_2 = _ib;
    {
      modelica_metatype _e = NULL;
      modelica_boolean _b;
      modelica_metatype _ty = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _b has no default value.
      // _ty has no default value.
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _e = tmp4_1;
          _ty = tmpMeta6;
          /* Pattern matching succeeded */
          tmpMeta7 = mmc_mk_cons(_e, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta[0+0] = omc_Expression_makeBuiltinCall(threadData, _OMC_LIT63, tmpMeta7, _ty, 0 /* false */);
          tmp1_c1 = 0 /* false */;
          tmp1_c2 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,1) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 2));
          if (3 != MMC_STRLEN(tmpMeta9) || strcmp(MMC_STRINGDATA(_OMC_LIT63), MMC_STRINGDATA(tmpMeta9)) != 0) goto tmp3_end;
          
          _e = tmp4_1;
          _b = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _e;
          tmp1_c1 = 0 /* false */;
          tmp1_c2 = _b;
          goto tmp3_done;
        }
        case 2: {
          
          _e = tmp4_1;
          _b = tmp4_2;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _e;
          tmp1_c1 = (!_b);
          tmp1_c2 = _b;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _oe = tmpMeta[0+0];
  _cont = tmp1_c1;
  _ob = tmp1_c2;
  _return: OMC_LABEL_UNUSED
  if (out_cont) { *out_cont = _cont; }
  if (out_ob) { *out_ob = _ob; }
  return _oe;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_preCref(threadData_t *threadData, modelica_metatype _ie, modelica_metatype _ib, modelica_metatype *out_cont, modelica_metatype *out_ob)
{
  modelica_integer tmp1;
  modelica_boolean _cont;
  modelica_boolean _ob;
  modelica_metatype _oe = NULL;
  tmp1 = mmc_unbox_integer(_ib);
  _oe = omc_ExpressionSimplify_preCref(threadData, _ie, tmp1, &_cont, &_ob);
  /* skip box _oe; DAE.Exp */
  if (out_cont) { *out_cont = mmc_mk_icon(_cont); }
  if (out_ob) { *out_ob = mmc_mk_icon(_ob); }
  return _oe;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyCall(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _exp = NULL;
      modelica_metatype _zero = NULL;
      modelica_metatype _matrix = NULL;
      modelica_metatype _expl = NULL;
      modelica_metatype _attr = NULL;
      modelica_metatype _tp = NULL;
      modelica_boolean _b2;
      modelica_real _r1;
      modelica_real _r2;
      modelica_string _idn = NULL;
      modelica_string _idn2 = NULL;
      modelica_string _name = NULL;
      modelica_integer _n;
      modelica_integer _i1;
      modelica_integer _i2;
      modelica_metatype _ri = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _exp has no default value.
      // _zero has no default value.
      // _matrix has no default value.
      // _expl has no default value.
      // _attr has no default value.
      // _tp has no default value.
      // _b2 has no default value.
      // _r1 has no default value.
      // _r2 has no default value.
      // _idn has no default value.
      // _idn2 has no default value.
      // _name has no default value.
      // _n has no default value.
      // _i1 has no default value.
      // _i2 has no default value.
      // _ri has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 35; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,1,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta8)) goto tmp3_end;
          tmpMeta9 = MMC_CAR(tmpMeta8);
          tmpMeta10 = MMC_CDR(tmpMeta8);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,27,3) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 2));
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta11), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta12,1,1) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta12), 2));
          if (5 != MMC_STRLEN(tmpMeta13) || strcmp(MMC_STRINGDATA(_OMC_LIT9), MMC_STRINGDATA(tmpMeta13)) != 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 4));
          if (listEmpty(tmpMeta14)) goto tmp3_end;
          tmpMeta15 = MMC_CAR(tmpMeta14);
          tmpMeta16 = MMC_CDR(tmpMeta14);
          if (!listEmpty(tmpMeta16)) goto tmp3_end;
          if (!listEmpty(tmpMeta10)) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta17), 2));
          
          _name = tmpMeta7;
          _e = tmpMeta9;
          _ri = tmpMeta11;
          _tp = tmpMeta18;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!listMember(_name, _OMC_LIT171)) goto tmp3_end;
          tmpMeta20 = mmc_mk_box2(4, &Absyn_Path_IDENT__desc, _name);
          tmpMeta21 = mmc_mk_box8(3, &DAE_ReductionInfo_REDUCTIONINFO__desc, tmpMeta20, _OMC_LIT11, _tp, mmc_mk_some(omc_ExpressionSimplify_reductionDefaultValue(threadData, _name, _tp)), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ri), 6))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ri), 7))), mmc_mk_some(omc_ExpressionSimplify_reductionExpression(threadData, _name, _tp, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ri), 6))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ri), 7))))));
          tmpMeta19 = MMC_TAGPTR(mmc_alloc_words(5));
          memcpy(MMC_UNTAGPTR(tmpMeta19), MMC_UNTAGPTR(_e), 5*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta19))[2] = tmpMeta21;
          _e = tmpMeta19;
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_metatype tmpMeta24;
          modelica_metatype tmpMeta25;
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta22,1,1) == 0) goto tmp3_end;
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta22), 2));
          if (8 != MMC_STRLEN(tmpMeta23) || strcmp(MMC_STRINGDATA(_OMC_LIT178), MMC_STRINGDATA(tmpMeta23)) != 0) goto tmp3_end;
          tmpMeta24 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta24)) goto tmp3_end;
          tmpMeta25 = MMC_CAR(tmpMeta24);
          tmpMeta26 = MMC_CDR(tmpMeta24);
          if (listEmpty(tmpMeta26)) goto tmp3_end;
          tmpMeta27 = MMC_CAR(tmpMeta26);
          tmpMeta28 = MMC_CDR(tmpMeta26);
          if (!listEmpty(tmpMeta28)) goto tmp3_end;
          
          _e1 = tmpMeta25;
          _e2 = tmpMeta27;
          tmp4 += 15; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_Expression_expEqual(threadData, _e1, _e2)) goto tmp3_end;
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta29,1,1) == 0) goto tmp3_end;
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta29), 2));
          if (7 != MMC_STRLEN(tmpMeta30) || strcmp(MMC_STRINGDATA(_OMC_LIT179), MMC_STRINGDATA(tmpMeta30)) != 0) goto tmp3_end;
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta31)) goto tmp3_end;
          tmpMeta32 = MMC_CAR(tmpMeta31);
          tmpMeta33 = MMC_CDR(tmpMeta31);
          if (!listEmpty(tmpMeta33)) goto tmp3_end;
          
          _e = tmpMeta32;
          tmp4 += 14; /* Pattern matching succeeded; we may skip some cases if we fail */
          _b2 = (omc_Expression_isRelation(threadData, _e) || omc_Expression_isEventTriggeringFunctionExp(threadData, _e));
          tmpMeta1 = ((!_b2)?omc_ExpressionSimplify_simplifyNoEvent(threadData, _e):_inExp);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_metatype tmpMeta41;
          modelica_metatype tmpMeta42;
          modelica_metatype tmpMeta43;
          modelica_metatype tmpMeta44;
          modelica_metatype tmpMeta45;
          modelica_metatype tmpMeta46;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta34,1,1) == 0) goto tmp3_end;
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta34), 2));
          if (3 != MMC_STRLEN(tmpMeta35) || strcmp(MMC_STRINGDATA(_OMC_LIT62), MMC_STRINGDATA(tmpMeta35)) != 0) goto tmp3_end;
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta36)) goto tmp3_end;
          tmpMeta37 = MMC_CAR(tmpMeta36);
          tmpMeta38 = MMC_CDR(tmpMeta36);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta37,8,2) == 0) goto tmp3_end;
          tmpMeta39 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta37), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta39,5,1) == 0) goto tmp3_end;
          tmpMeta40 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta39), 2));
          tmpMeta41 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta37), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta41,6,2) == 0) goto tmp3_end;
          if (!listEmpty(tmpMeta38)) goto tmp3_end;
          tmpMeta42 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _tp = tmpMeta40;
          _e1 = tmpMeta41;
          _attr = tmpMeta42;
          tmp4 += 13; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta43 = mmc_mk_box2(8, &DAE_Operator_UMINUS__desc, _tp);
          tmpMeta44 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta45 = mmc_mk_box4(16, &DAE_Exp_CALL__desc, _OMC_LIT172, tmpMeta44, _attr);
          tmpMeta46 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta43, tmpMeta45);
          tmpMeta1 = tmpMeta46;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta47;
          modelica_metatype tmpMeta48;
          modelica_metatype tmpMeta49;
          modelica_metatype tmpMeta50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta52;
          modelica_metatype tmpMeta53;
          modelica_metatype tmpMeta54;
          modelica_metatype tmpMeta55;
          modelica_metatype tmpMeta56;
          modelica_metatype tmpMeta57;
          modelica_metatype tmpMeta58;
          modelica_metatype tmpMeta59;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta47,1,1) == 0) goto tmp3_end;
          tmpMeta48 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta47), 2));
          if (3 != MMC_STRLEN(tmpMeta48) || strcmp(MMC_STRINGDATA(_OMC_LIT62), MMC_STRINGDATA(tmpMeta48)) != 0) goto tmp3_end;
          tmpMeta49 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta49)) goto tmp3_end;
          tmpMeta50 = MMC_CAR(tmpMeta49);
          tmpMeta51 = MMC_CDR(tmpMeta49);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta50,8,2) == 0) goto tmp3_end;
          tmpMeta52 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta50), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta52,6,1) == 0) goto tmp3_end;
          tmpMeta53 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta52), 2));
          tmpMeta54 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta50), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta54,6,2) == 0) goto tmp3_end;
          if (!listEmpty(tmpMeta51)) goto tmp3_end;
          tmpMeta55 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _tp = tmpMeta53;
          _e1 = tmpMeta54;
          _attr = tmpMeta55;
          tmp4 += 12; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta56 = mmc_mk_box2(9, &DAE_Operator_UMINUS__ARR__desc, _tp);
          tmpMeta57 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta58 = mmc_mk_box4(16, &DAE_Exp_CALL__desc, _OMC_LIT172, tmpMeta57, _attr);
          tmpMeta59 = mmc_mk_box3(11, &DAE_Exp_UNARY__desc, tmpMeta56, tmpMeta58);
          tmpMeta1 = tmpMeta59;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta60;
          modelica_metatype tmpMeta61;
          modelica_metatype tmpMeta62;
          modelica_metatype tmpMeta63;
          modelica_metatype tmpMeta64;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta60 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta60,1,1) == 0) goto tmp3_end;
          tmpMeta61 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta60), 2));
          if (3 != MMC_STRLEN(tmpMeta61) || strcmp(MMC_STRINGDATA(_OMC_LIT63), MMC_STRINGDATA(tmpMeta61)) != 0) goto tmp3_end;
          tmpMeta62 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta62)) goto tmp3_end;
          tmpMeta63 = MMC_CAR(tmpMeta62);
          tmpMeta64 = MMC_CDR(tmpMeta62);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta63,6,2) == 0) goto tmp3_end;
          if (!listEmpty(tmpMeta64)) goto tmp3_end;
          
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta65;
          modelica_metatype tmpMeta66;
          modelica_metatype tmpMeta67;
          modelica_metatype tmpMeta68;
          modelica_metatype tmpMeta69;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta65 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta65,1,1) == 0) goto tmp3_end;
          tmpMeta66 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta65), 2));
          if (8 != MMC_STRLEN(tmpMeta66) || strcmp(MMC_STRINGDATA(_OMC_LIT64), MMC_STRINGDATA(tmpMeta66)) != 0) goto tmp3_end;
          tmpMeta67 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta67)) goto tmp3_end;
          tmpMeta68 = MMC_CAR(tmpMeta67);
          tmpMeta69 = MMC_CDR(tmpMeta67);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta68,6,2) == 0) goto tmp3_end;
          if (!listEmpty(tmpMeta69)) goto tmp3_end;
          
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        case 7: {
          modelica_metatype tmpMeta70;
          modelica_metatype tmpMeta71;
          modelica_metatype tmpMeta72;
          modelica_metatype tmpMeta73;
          modelica_metatype tmpMeta74;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta70 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta70,1,1) == 0) goto tmp3_end;
          tmpMeta71 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta70), 2));
          if (6 != MMC_STRLEN(tmpMeta71) || strcmp(MMC_STRINGDATA(_OMC_LIT66), MMC_STRINGDATA(tmpMeta71)) != 0) goto tmp3_end;
          tmpMeta72 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta72)) goto tmp3_end;
          tmpMeta73 = MMC_CAR(tmpMeta72);
          tmpMeta74 = MMC_CDR(tmpMeta72);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta73,6,2) == 0) goto tmp3_end;
          if (!listEmpty(tmpMeta74)) goto tmp3_end;
          
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta75;
          modelica_metatype tmpMeta76;
          modelica_metatype tmpMeta77;
          modelica_metatype tmpMeta78;
          modelica_metatype tmpMeta79;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta75 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta75,1,1) == 0) goto tmp3_end;
          tmpMeta76 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta75), 2));
          if (4 != MMC_STRLEN(tmpMeta76) || strcmp(MMC_STRINGDATA(_OMC_LIT65), MMC_STRINGDATA(tmpMeta76)) != 0) goto tmp3_end;
          tmpMeta77 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta77)) goto tmp3_end;
          tmpMeta78 = MMC_CAR(tmpMeta77);
          tmpMeta79 = MMC_CDR(tmpMeta77);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta78,6,2) == 0) goto tmp3_end;
          if (!listEmpty(tmpMeta79)) goto tmp3_end;
          
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta80;
          modelica_metatype tmpMeta81;
          modelica_metatype tmpMeta82;
          modelica_metatype tmpMeta83;
          modelica_metatype tmpMeta84;
          modelica_metatype tmpMeta85;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta80 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta80,1,1) == 0) goto tmp3_end;
          tmpMeta81 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta80), 2));
          if (3 != MMC_STRLEN(tmpMeta81) || strcmp(MMC_STRINGDATA(_OMC_LIT63), MMC_STRINGDATA(tmpMeta81)) != 0) goto tmp3_end;
          tmpMeta82 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta82)) goto tmp3_end;
          tmpMeta83 = MMC_CAR(tmpMeta82);
          tmpMeta84 = MMC_CDR(tmpMeta82);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta83,21,2) == 0) goto tmp3_end;
          tmpMeta85 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta83), 2));
          if (!listEmpty(tmpMeta84)) goto tmp3_end;
          
          _e = tmpMeta83;
          _exp = tmpMeta85;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          _b2 = omc_Expression_isConst(threadData, _exp);
          tmpMeta1 = (_b2?_e:_inExp);
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta86;
          modelica_metatype tmpMeta87;
          modelica_metatype tmpMeta88;
          modelica_metatype tmpMeta89;
          modelica_metatype tmpMeta90;
          modelica_metatype tmpMeta91;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta86 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta86,1,1) == 0) goto tmp3_end;
          tmpMeta87 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta86), 2));
          if (8 != MMC_STRLEN(tmpMeta87) || strcmp(MMC_STRINGDATA(_OMC_LIT64), MMC_STRINGDATA(tmpMeta87)) != 0) goto tmp3_end;
          tmpMeta88 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta88)) goto tmp3_end;
          tmpMeta89 = MMC_CAR(tmpMeta88);
          tmpMeta90 = MMC_CDR(tmpMeta88);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta89,21,2) == 0) goto tmp3_end;
          tmpMeta91 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta89), 2));
          if (!listEmpty(tmpMeta90)) goto tmp3_end;
          
          _e = tmpMeta89;
          _exp = tmpMeta91;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          _b2 = omc_Expression_isConst(threadData, _exp);
          tmpMeta1 = (_b2?_e:_inExp);
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta92;
          modelica_metatype tmpMeta93;
          modelica_metatype tmpMeta94;
          modelica_metatype tmpMeta95;
          modelica_metatype tmpMeta96;
          modelica_metatype tmpMeta97;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta92 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta92,1,1) == 0) goto tmp3_end;
          tmpMeta93 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta92), 2));
          if (6 != MMC_STRLEN(tmpMeta93) || strcmp(MMC_STRINGDATA(_OMC_LIT66), MMC_STRINGDATA(tmpMeta93)) != 0) goto tmp3_end;
          tmpMeta94 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta94)) goto tmp3_end;
          tmpMeta95 = MMC_CAR(tmpMeta94);
          tmpMeta96 = MMC_CDR(tmpMeta94);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta95,21,2) == 0) goto tmp3_end;
          tmpMeta97 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta95), 2));
          if (!listEmpty(tmpMeta96)) goto tmp3_end;
          
          _exp = tmpMeta97;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          _b2 = omc_Expression_isConst(threadData, _exp);
          tmpMeta1 = (_b2?_OMC_LIT22:_inExp);
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta98;
          modelica_metatype tmpMeta99;
          modelica_metatype tmpMeta100;
          modelica_metatype tmpMeta101;
          modelica_metatype tmpMeta102;
          modelica_metatype tmpMeta103;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta98 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta98,1,1) == 0) goto tmp3_end;
          tmpMeta99 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta98), 2));
          if (4 != MMC_STRLEN(tmpMeta99) || strcmp(MMC_STRINGDATA(_OMC_LIT65), MMC_STRINGDATA(tmpMeta99)) != 0) goto tmp3_end;
          tmpMeta100 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta100)) goto tmp3_end;
          tmpMeta101 = MMC_CAR(tmpMeta100);
          tmpMeta102 = MMC_CDR(tmpMeta100);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta101,21,2) == 0) goto tmp3_end;
          tmpMeta103 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta101), 2));
          if (!listEmpty(tmpMeta102)) goto tmp3_end;
          
          _exp = tmpMeta103;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          _b2 = omc_Expression_isConst(threadData, _exp);
          tmpMeta1 = (_b2?_OMC_LIT22:_inExp);
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta104;
          modelica_metatype tmpMeta105;
          modelica_metatype tmpMeta106;
          modelica_metatype tmpMeta107;
          modelica_metatype tmpMeta108;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta104 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta104,1,1) == 0) goto tmp3_end;
          tmpMeta105 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta104), 2));
          if (3 != MMC_STRLEN(tmpMeta105) || strcmp(MMC_STRINGDATA(_OMC_LIT63), MMC_STRINGDATA(tmpMeta105)) != 0) goto tmp3_end;
          tmpMeta106 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta106)) goto tmp3_end;
          tmpMeta107 = MMC_CAR(tmpMeta106);
          tmpMeta108 = MMC_CDR(tmpMeta106);
          if (!listEmpty(tmpMeta108)) goto tmp3_end;
          
          _e = tmpMeta107;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_Expression_traverseExpTopDown(threadData, _e, boxvar_ExpressionSimplify_preCref, mmc_mk_boolean(0 /* false */), NULL);
          goto tmp3_done;
        }
        case 14: {
          modelica_metatype tmpMeta109;
          modelica_metatype tmpMeta110;
          modelica_metatype tmpMeta111;
          modelica_metatype tmpMeta112;
          modelica_metatype tmpMeta113;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta109 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta109,1,1) == 0) goto tmp3_end;
          tmpMeta110 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta109), 2));
          if (8 != MMC_STRLEN(tmpMeta110) || strcmp(MMC_STRINGDATA(_OMC_LIT64), MMC_STRINGDATA(tmpMeta110)) != 0) goto tmp3_end;
          tmpMeta111 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta111)) goto tmp3_end;
          tmpMeta112 = MMC_CAR(tmpMeta111);
          tmpMeta113 = MMC_CDR(tmpMeta111);
          if (!listEmpty(tmpMeta113)) goto tmp3_end;
          
          _e = tmpMeta112;
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_Expression_traverseExpTopDown(threadData, _e, boxvar_ExpressionSimplify_previousCref, mmc_mk_boolean(0 /* false */), NULL);
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta114;
          modelica_metatype tmpMeta115;
          modelica_metatype tmpMeta116;
          modelica_metatype tmpMeta117;
          modelica_metatype tmpMeta118;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta114 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta114,1,1) == 0) goto tmp3_end;
          tmpMeta115 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta114), 2));
          if (6 != MMC_STRLEN(tmpMeta115) || strcmp(MMC_STRINGDATA(_OMC_LIT66), MMC_STRINGDATA(tmpMeta115)) != 0) goto tmp3_end;
          tmpMeta116 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta116)) goto tmp3_end;
          tmpMeta117 = MMC_CAR(tmpMeta116);
          tmpMeta118 = MMC_CDR(tmpMeta116);
          if (!listEmpty(tmpMeta118)) goto tmp3_end;
          
          _e = tmpMeta117;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_Expression_traverseExpTopDown(threadData, _e, boxvar_ExpressionSimplify_changeCref, mmc_mk_boolean(0 /* false */), NULL);
          goto tmp3_done;
        }
        case 16: {
          modelica_metatype tmpMeta119;
          modelica_metatype tmpMeta120;
          modelica_metatype tmpMeta121;
          modelica_metatype tmpMeta122;
          modelica_metatype tmpMeta123;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta119 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta119,1,1) == 0) goto tmp3_end;
          tmpMeta120 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta119), 2));
          if (4 != MMC_STRLEN(tmpMeta120) || strcmp(MMC_STRINGDATA(_OMC_LIT65), MMC_STRINGDATA(tmpMeta120)) != 0) goto tmp3_end;
          tmpMeta121 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta121)) goto tmp3_end;
          tmpMeta122 = MMC_CAR(tmpMeta121);
          tmpMeta123 = MMC_CDR(tmpMeta121);
          if (!listEmpty(tmpMeta123)) goto tmp3_end;
          
          _e = tmpMeta122;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_Expression_traverseExpTopDown(threadData, _e, boxvar_ExpressionSimplify_edgeCref, mmc_mk_boolean(0 /* false */), NULL);
          goto tmp3_done;
        }
        case 17: {
          modelica_metatype tmpMeta124;
          modelica_metatype tmpMeta125;
          modelica_metatype tmpMeta126;
          modelica_metatype tmpMeta127;
          modelica_metatype tmpMeta128;
          modelica_integer tmp129;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta124 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta124,1,1) == 0) goto tmp3_end;
          tmpMeta125 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta124), 2));
          tmpMeta126 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta127 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta128 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta127), 5));
          tmp129 = mmc_unbox_integer(tmpMeta128);
          if (0 /* false */ != tmp129) goto tmp3_end;
          
          _idn = tmpMeta125;
          _expl = tmpMeta126;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isConstWorkList(threadData, _expl)) goto tmp3_end;
          tmpMeta1 = omc_ExpressionSimplify_simplifyBuiltinConstantCalls(threadData, _idn, _inExp);
          goto tmp3_done;
        }
        case 18: {
          modelica_metatype tmpMeta130;
          modelica_metatype tmpMeta131;
          modelica_integer tmp132;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta130 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta131 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta130), 4));
          tmp132 = mmc_unbox_integer(tmpMeta131);
          if (1 /* true */ != tmp132) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyBuiltinCalls(threadData, _inExp);
          goto tmp3_done;
        }
        case 19: {
          modelica_metatype tmpMeta133;
          modelica_metatype tmpMeta134;
          modelica_metatype tmpMeta135;
          modelica_metatype tmpMeta136;
          modelica_metatype tmpMeta137;
          modelica_metatype tmpMeta138;
          modelica_integer tmp139;
          modelica_metatype tmpMeta140;
          modelica_metatype tmpMeta156;
          modelica_metatype tmpMeta157;
          modelica_metatype tmpMeta158;
          modelica_metatype tmpMeta159;
          modelica_metatype tmpMeta160;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta133 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta133,1,1) == 0) goto tmp3_end;
          tmpMeta134 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta133), 2));
          if (8 != MMC_STRLEN(tmpMeta134) || strcmp(MMC_STRINGDATA(_OMC_LIT180), MMC_STRINGDATA(tmpMeta134)) != 0) goto tmp3_end;
          tmpMeta135 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta135)) goto tmp3_end;
          tmpMeta136 = MMC_CAR(tmpMeta135);
          tmpMeta137 = MMC_CDR(tmpMeta135);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta136,0,1) == 0) goto tmp3_end;
          tmpMeta138 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta136), 2));
          tmp139 = mmc_unbox_integer(tmpMeta138);
          if (!listEmpty(tmpMeta137)) goto tmp3_end;
          
          _n = tmp139  /* pattern as ty=Integer */;
          tmp4 += 13; /* Pattern matching succeeded; we may skip some cases if we fail */
          {
            modelica_metatype __omcQ_24tmpVar53;
            modelica_metatype* tmp141;
            modelica_metatype tmpMeta142;
            modelica_metatype tmpMeta143;
            modelica_metatype tmpMeta144;
            modelica_metatype tmpMeta145;
            modelica_metatype tmpMeta146;
            modelica_metatype tmpMeta152;
            modelica_metatype __omcQ_24tmpVar52;
            modelica_integer tmp153;
            modelica_integer tmp154;
            modelica_integer tmp155;
            modelica_integer _j;
            tmp154 = 1 /* Range step-value */;
            tmp155 = _n /* Range stop-value */;
            _j = ((modelica_integer) 1) /* Range start-value */;
            _j = (((modelica_integer) 1) /* Range start-value */)-tmp154;
            tmpMeta142 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar53 = tmpMeta142; /* defaultValue */
            tmp141 = &__omcQ_24tmpVar53;
            while(1) {
              tmp153 = 1;
              if (tmp154 > 0 ? _j+tmp154 <= tmp155 : _j+tmp154 >= tmp155) {
                _j += tmp154;
                tmp153--;
              }
              if (tmp153 == 0) {
                tmpMeta144 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_n));
                tmpMeta143 = mmc_mk_cons(tmpMeta144, MMC_REFSTRUCTLIT(mmc_nil));
                tmpMeta145 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _OMC_LIT54, tmpMeta143);
                {
                  modelica_metatype __omcQ_24tmpVar51;
                  modelica_metatype* tmp147;
                  modelica_metatype tmpMeta148;
                  modelica_metatype __omcQ_24tmpVar50;
                  modelica_integer tmp149;
                  modelica_integer tmp150;
                  modelica_integer tmp151;
                  modelica_integer _i;
                  tmp150 = 1 /* Range step-value */;
                  tmp151 = _n /* Range stop-value */;
                  _i = ((modelica_integer) 1) /* Range start-value */;
                  _i = (((modelica_integer) 1) /* Range start-value */)-tmp150;
                  tmpMeta148 = MMC_REFSTRUCTLIT(mmc_nil);
                  __omcQ_24tmpVar51 = tmpMeta148; /* defaultValue */
                  tmp147 = &__omcQ_24tmpVar51;
                  while(1) {
                    tmp149 = 1;
                    if (tmp150 > 0 ? _i+tmp150 <= tmp151 : _i+tmp150 >= tmp151) {
                      _i += tmp150;
                      tmp149--;
                    }
                    if (tmp149 == 0) {
                      __omcQ_24tmpVar50 = ((_i == _j)?_OMC_LIT86:_OMC_LIT173);
                      *tmp147 = mmc_mk_cons(__omcQ_24tmpVar50,0);
                      tmp147 = &MMC_CDR(*tmp147);
                    } else if (tmp149 == 1) {
                      break;
                    } else {
                      goto goto_2;
                    }
                  }
                  *tmp147 = mmc_mk_nil();
                  tmpMeta146 = __omcQ_24tmpVar51;
                }
                tmpMeta152 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, tmpMeta145, mmc_mk_boolean(1 /* true */), tmpMeta146);
                __omcQ_24tmpVar52 = tmpMeta152;
                *tmp141 = mmc_mk_cons(__omcQ_24tmpVar52,0);
                tmp141 = &MMC_CDR(*tmp141);
              } else if (tmp153 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp141 = mmc_mk_nil();
            tmpMeta140 = __omcQ_24tmpVar53;
          }
          _matrix = tmpMeta140;
          tmpMeta157 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_n));
          tmpMeta158 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_n));
          tmpMeta156 = mmc_mk_cons(tmpMeta157, mmc_mk_cons(tmpMeta158, MMC_REFSTRUCTLIT(mmc_nil)));
          tmpMeta159 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _OMC_LIT54, tmpMeta156);
          tmpMeta160 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, tmpMeta159, mmc_mk_boolean(0 /* false */), _matrix);
          tmpMeta1 = tmpMeta160;
          goto tmp3_done;
        }
        case 20: {
          modelica_metatype tmpMeta161;
          modelica_metatype tmpMeta162;
          modelica_metatype tmpMeta163;
          modelica_metatype tmpMeta164;
          modelica_metatype tmpMeta165;
          modelica_metatype tmpMeta166;
          modelica_metatype tmpMeta167;
          modelica_metatype tmpMeta168;
          modelica_metatype tmpMeta184;
          modelica_metatype tmpMeta185;
          modelica_metatype tmpMeta186;
          modelica_metatype tmpMeta187;
          modelica_metatype tmpMeta188;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta161 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta161,1,1) == 0) goto tmp3_end;
          tmpMeta162 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta161), 2));
          if (8 != MMC_STRLEN(tmpMeta162) || strcmp(MMC_STRINGDATA(_OMC_LIT181), MMC_STRINGDATA(tmpMeta162)) != 0) goto tmp3_end;
          tmpMeta163 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta163)) goto tmp3_end;
          tmpMeta164 = MMC_CAR(tmpMeta163);
          tmpMeta165 = MMC_CDR(tmpMeta163);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta164,16,3) == 0) goto tmp3_end;
          tmpMeta166 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta164), 2));
          tmpMeta167 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta164), 4));
          if (!listEmpty(tmpMeta165)) goto tmp3_end;
          
          _tp = tmpMeta166;
          _expl = tmpMeta167;
          tmp4 += 12; /* Pattern matching succeeded; we may skip some cases if we fail */
          _n = listLength(_expl);

          _tp = omc_Types_arrayElementType(threadData, _tp);

          _zero = omc_Expression_makeConstZero(threadData, _tp);

          {
            modelica_metatype __omcQ_24tmpVar57;
            modelica_metatype* tmp169;
            modelica_metatype tmpMeta170;
            modelica_metatype tmpMeta171;
            modelica_metatype tmpMeta172;
            modelica_metatype tmpMeta173;
            modelica_metatype tmpMeta174;
            modelica_metatype tmpMeta180;
            modelica_metatype __omcQ_24tmpVar56;
            modelica_integer tmp181;
            modelica_integer tmp182;
            modelica_integer tmp183;
            modelica_integer _j;
            tmp182 = 1 /* Range step-value */;
            tmp183 = _n /* Range stop-value */;
            _j = ((modelica_integer) 1) /* Range start-value */;
            _j = (((modelica_integer) 1) /* Range start-value */)-tmp182;
            tmpMeta170 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar57 = tmpMeta170; /* defaultValue */
            tmp169 = &__omcQ_24tmpVar57;
            while(1) {
              tmp181 = 1;
              if (tmp182 > 0 ? _j+tmp182 <= tmp183 : _j+tmp182 >= tmp183) {
                _j += tmp182;
                tmp181--;
              }
              if (tmp181 == 0) {
                tmpMeta172 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_n));
                tmpMeta171 = mmc_mk_cons(tmpMeta172, MMC_REFSTRUCTLIT(mmc_nil));
                tmpMeta173 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _tp, tmpMeta171);
                {
                  modelica_metatype __omcQ_24tmpVar55;
                  modelica_metatype* tmp175;
                  modelica_metatype tmpMeta176;
                  modelica_metatype __omcQ_24tmpVar54;
                  modelica_integer tmp177;
                  modelica_integer tmp178;
                  modelica_integer tmp179;
                  modelica_integer _i;
                  tmp178 = 1 /* Range step-value */;
                  tmp179 = _n /* Range stop-value */;
                  _i = ((modelica_integer) 1) /* Range start-value */;
                  _i = (((modelica_integer) 1) /* Range start-value */)-tmp178;
                  tmpMeta176 = MMC_REFSTRUCTLIT(mmc_nil);
                  __omcQ_24tmpVar55 = tmpMeta176; /* defaultValue */
                  tmp175 = &__omcQ_24tmpVar55;
                  while(1) {
                    tmp177 = 1;
                    if (tmp178 > 0 ? _i+tmp178 <= tmp179 : _i+tmp178 >= tmp179) {
                      _i += tmp178;
                      tmp177--;
                    }
                    if (tmp177 == 0) {
                      __omcQ_24tmpVar54 = ((_i == _j)?listGet(_expl, _i):_zero);
                      *tmp175 = mmc_mk_cons(__omcQ_24tmpVar54,0);
                      tmp175 = &MMC_CDR(*tmp175);
                    } else if (tmp177 == 1) {
                      break;
                    } else {
                      goto goto_2;
                    }
                  }
                  *tmp175 = mmc_mk_nil();
                  tmpMeta174 = __omcQ_24tmpVar55;
                }
                tmpMeta180 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, tmpMeta173, mmc_mk_boolean(1 /* true */), tmpMeta174);
                __omcQ_24tmpVar56 = tmpMeta180;
                *tmp169 = mmc_mk_cons(__omcQ_24tmpVar56,0);
                tmp169 = &MMC_CDR(*tmp169);
              } else if (tmp181 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp169 = mmc_mk_nil();
            tmpMeta168 = __omcQ_24tmpVar57;
          }
          _matrix = tmpMeta168;
          tmpMeta185 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_n));
          tmpMeta186 = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_n));
          tmpMeta184 = mmc_mk_cons(tmpMeta185, mmc_mk_cons(tmpMeta186, MMC_REFSTRUCTLIT(mmc_nil)));
          tmpMeta187 = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _tp, tmpMeta184);
          tmpMeta188 = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, tmpMeta187, mmc_mk_boolean(0 /* false */), _matrix);
          tmpMeta1 = tmpMeta188;
          goto tmp3_done;
        }
        case 21: {
          modelica_metatype tmpMeta189;
          modelica_metatype tmpMeta190;
          modelica_metatype tmpMeta191;
          modelica_metatype tmpMeta192;
          modelica_metatype tmpMeta193;
          modelica_metatype tmpMeta194;
          modelica_metatype tmpMeta195;
          modelica_metatype tmpMeta196;
          modelica_metatype tmpMeta197;
          modelica_metatype tmpMeta198;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta189 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta189,1,1) == 0) goto tmp3_end;
          tmpMeta190 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta189), 2));
          tmpMeta191 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta191)) goto tmp3_end;
          tmpMeta192 = MMC_CAR(tmpMeta191);
          tmpMeta193 = MMC_CDR(tmpMeta191);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta192,13,3) == 0) goto tmp3_end;
          tmpMeta194 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta192), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta194,1,1) == 0) goto tmp3_end;
          tmpMeta195 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta194), 2));
          tmpMeta196 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta192), 3));
          if (listEmpty(tmpMeta196)) goto tmp3_end;
          tmpMeta197 = MMC_CAR(tmpMeta196);
          tmpMeta198 = MMC_CDR(tmpMeta196);
          if (!listEmpty(tmpMeta198)) goto tmp3_end;
          if (!listEmpty(tmpMeta193)) goto tmp3_end;
          
          _idn = tmpMeta190;
          _idn2 = tmpMeta195;
          _e = tmpMeta197;
          tmp4 += 3; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!((stringEqual(_idn, _OMC_LIT37)) && (stringEqual(_idn2, _OMC_LIT174)))) goto tmp3_end;
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 22: {
          modelica_metatype tmpMeta199;
          modelica_metatype tmpMeta200;
          modelica_metatype tmpMeta201;
          modelica_metatype tmpMeta202;
          modelica_metatype tmpMeta203;
          modelica_metatype tmpMeta204;
          modelica_real tmp205;
          modelica_metatype tmpMeta206;
          modelica_metatype tmpMeta207;
          modelica_metatype tmpMeta208;
          modelica_real tmp209;
          modelica_metatype tmpMeta210;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta199 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta199,1,1) == 0) goto tmp3_end;
          tmpMeta200 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta199), 2));
          if (3 != MMC_STRLEN(tmpMeta200) || strcmp(MMC_STRINGDATA(_OMC_LIT182), MMC_STRINGDATA(tmpMeta200)) != 0) goto tmp3_end;
          tmpMeta201 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta201)) goto tmp3_end;
          tmpMeta202 = MMC_CAR(tmpMeta201);
          tmpMeta203 = MMC_CDR(tmpMeta201);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta202,1,1) == 0) goto tmp3_end;
          tmpMeta204 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta202), 2));
          tmp205 = mmc_unbox_real(tmpMeta204);
          if (listEmpty(tmpMeta203)) goto tmp3_end;
          tmpMeta206 = MMC_CAR(tmpMeta203);
          tmpMeta207 = MMC_CDR(tmpMeta203);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta206,1,1) == 0) goto tmp3_end;
          tmpMeta208 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta206), 2));
          tmp209 = mmc_unbox_real(tmpMeta208);
          if (!listEmpty(tmpMeta207)) goto tmp3_end;
          
          _r1 = tmp205  /* pattern as ty=Real */;
          _r2 = tmp209  /* pattern as ty=Real */;
          tmp4 += 10; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!(_r2 != 0.0)) goto tmp3_end;
          tmpMeta210 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(modelica_real_mod(_r1, _r2)));
          tmpMeta1 = tmpMeta210;
          goto tmp3_done;
        }
        case 23: {
          modelica_metatype tmpMeta211;
          modelica_metatype tmpMeta212;
          modelica_metatype tmpMeta213;
          modelica_metatype tmpMeta214;
          modelica_metatype tmpMeta215;
          modelica_metatype tmpMeta216;
          modelica_integer tmp217;
          modelica_metatype tmpMeta218;
          modelica_metatype tmpMeta219;
          modelica_metatype tmpMeta220;
          modelica_integer tmp221;
          modelica_metatype tmpMeta222;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta211 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta211,1,1) == 0) goto tmp3_end;
          tmpMeta212 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta211), 2));
          if (3 != MMC_STRLEN(tmpMeta212) || strcmp(MMC_STRINGDATA(_OMC_LIT182), MMC_STRINGDATA(tmpMeta212)) != 0) goto tmp3_end;
          tmpMeta213 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta213)) goto tmp3_end;
          tmpMeta214 = MMC_CAR(tmpMeta213);
          tmpMeta215 = MMC_CDR(tmpMeta213);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta214,0,1) == 0) goto tmp3_end;
          tmpMeta216 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta214), 2));
          tmp217 = mmc_unbox_integer(tmpMeta216);
          if (listEmpty(tmpMeta215)) goto tmp3_end;
          tmpMeta218 = MMC_CAR(tmpMeta215);
          tmpMeta219 = MMC_CDR(tmpMeta215);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta218,0,1) == 0) goto tmp3_end;
          tmpMeta220 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta218), 2));
          tmp221 = mmc_unbox_integer(tmpMeta220);
          if (!listEmpty(tmpMeta219)) goto tmp3_end;
          
          _i1 = tmp217  /* pattern as ty=Integer */;
          _i2 = tmp221  /* pattern as ty=Integer */;
          tmp4 += 9; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!(((modelica_real)_i2) != 0.0)) goto tmp3_end;
          tmpMeta222 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(modelica_integer_mod(_i1, _i2)));
          tmpMeta1 = tmpMeta222;
          goto tmp3_done;
        }
        case 24: {
          modelica_metatype tmpMeta223;
          modelica_metatype tmpMeta224;
          modelica_metatype tmpMeta225;
          modelica_metatype tmpMeta226;
          modelica_metatype tmpMeta227;
          modelica_metatype tmpMeta228;
          modelica_real tmp229;
          modelica_metatype tmpMeta230;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta223 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta223,1,1) == 0) goto tmp3_end;
          tmpMeta224 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta223), 2));
          if (7 != MMC_STRLEN(tmpMeta224) || strcmp(MMC_STRINGDATA(_OMC_LIT183), MMC_STRINGDATA(tmpMeta224)) != 0) goto tmp3_end;
          tmpMeta225 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta225)) goto tmp3_end;
          tmpMeta226 = MMC_CAR(tmpMeta225);
          tmpMeta227 = MMC_CDR(tmpMeta225);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta226,1,1) == 0) goto tmp3_end;
          tmpMeta228 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta226), 2));
          tmp229 = mmc_unbox_real(tmpMeta228);
          if (!listEmpty(tmpMeta227)) goto tmp3_end;
          
          _r1 = tmp229  /* pattern as ty=Real */;
          tmp4 += 8; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta230 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(((modelica_integer)floor(_r1))));
          tmpMeta1 = tmpMeta230;
          goto tmp3_done;
        }
        case 25: {
          modelica_metatype tmpMeta231;
          modelica_metatype tmpMeta232;
          modelica_metatype tmpMeta233;
          modelica_metatype tmpMeta234;
          modelica_metatype tmpMeta235;
          modelica_metatype tmpMeta236;
          modelica_metatype tmpMeta237;
          modelica_metatype tmpMeta238;
          modelica_metatype tmpMeta239;
          modelica_metatype tmpMeta240;
          modelica_metatype tmpMeta241;
          modelica_metatype tmpMeta242;
          modelica_metatype tmpMeta243;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta231 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta231,1,1) == 0) goto tmp3_end;
          tmpMeta232 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta231), 2));
          if (3 != MMC_STRLEN(tmpMeta232) || strcmp(MMC_STRINGDATA(_OMC_LIT39), MMC_STRINGDATA(tmpMeta232)) != 0) goto tmp3_end;
          tmpMeta233 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta233)) goto tmp3_end;
          tmpMeta234 = MMC_CAR(tmpMeta233);
          tmpMeta235 = MMC_CDR(tmpMeta233);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta234,13,3) == 0) goto tmp3_end;
          tmpMeta236 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta234), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta236,1,1) == 0) goto tmp3_end;
          tmpMeta237 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta236), 2));
          if (4 != MMC_STRLEN(tmpMeta237) || strcmp(MMC_STRINGDATA(_OMC_LIT68), MMC_STRINGDATA(tmpMeta237)) != 0) goto tmp3_end;
          tmpMeta238 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta234), 3));
          if (listEmpty(tmpMeta238)) goto tmp3_end;
          tmpMeta239 = MMC_CAR(tmpMeta238);
          tmpMeta240 = MMC_CDR(tmpMeta238);
          if (!listEmpty(tmpMeta240)) goto tmp3_end;
          if (!listEmpty(tmpMeta235)) goto tmp3_end;
          
          _e = tmpMeta239;
          tmp4 += 7; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta242 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _OMC_LIT34, _e);
          tmpMeta243 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT27, _OMC_LIT175, tmpMeta242);
          tmpMeta241 = mmc_mk_cons(tmpMeta243, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT35, tmpMeta241, _OMC_LIT30);
          goto tmp3_done;
        }
        case 26: {
          modelica_metatype tmpMeta244;
          modelica_metatype tmpMeta245;
          modelica_metatype tmpMeta246;
          modelica_metatype tmpMeta247;
          modelica_metatype tmpMeta248;
          modelica_metatype tmpMeta249;
          modelica_metatype tmpMeta250;
          modelica_metatype tmpMeta251;
          modelica_metatype tmpMeta252;
          modelica_metatype tmpMeta253;
          modelica_metatype tmpMeta254;
          modelica_metatype tmpMeta255;
          modelica_metatype tmpMeta256;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta244 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta244,1,1) == 0) goto tmp3_end;
          tmpMeta245 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta244), 2));
          if (3 != MMC_STRLEN(tmpMeta245) || strcmp(MMC_STRINGDATA(_OMC_LIT38), MMC_STRINGDATA(tmpMeta245)) != 0) goto tmp3_end;
          tmpMeta246 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta246)) goto tmp3_end;
          tmpMeta247 = MMC_CAR(tmpMeta246);
          tmpMeta248 = MMC_CDR(tmpMeta246);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta247,13,3) == 0) goto tmp3_end;
          tmpMeta249 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta247), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta249,1,1) == 0) goto tmp3_end;
          tmpMeta250 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta249), 2));
          if (4 != MMC_STRLEN(tmpMeta250) || strcmp(MMC_STRINGDATA(_OMC_LIT67), MMC_STRINGDATA(tmpMeta250)) != 0) goto tmp3_end;
          tmpMeta251 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta247), 3));
          if (listEmpty(tmpMeta251)) goto tmp3_end;
          tmpMeta252 = MMC_CAR(tmpMeta251);
          tmpMeta253 = MMC_CDR(tmpMeta251);
          if (!listEmpty(tmpMeta253)) goto tmp3_end;
          if (!listEmpty(tmpMeta248)) goto tmp3_end;
          
          _e = tmpMeta252;
          tmp4 += 6; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta255 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _OMC_LIT34, _e);
          tmpMeta256 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT27, _OMC_LIT175, tmpMeta255);
          tmpMeta254 = mmc_mk_cons(tmpMeta256, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT35, tmpMeta254, _OMC_LIT30);
          goto tmp3_done;
        }
        case 27: {
          modelica_metatype tmpMeta257;
          modelica_metatype tmpMeta258;
          modelica_metatype tmpMeta259;
          modelica_metatype tmpMeta260;
          modelica_metatype tmpMeta261;
          modelica_metatype tmpMeta262;
          modelica_metatype tmpMeta263;
          modelica_metatype tmpMeta264;
          modelica_metatype tmpMeta265;
          modelica_metatype tmpMeta266;
          modelica_metatype tmpMeta267;
          modelica_metatype tmpMeta268;
          modelica_metatype tmpMeta269;
          modelica_metatype tmpMeta270;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta257 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta257,1,1) == 0) goto tmp3_end;
          tmpMeta258 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta257), 2));
          if (3 != MMC_STRLEN(tmpMeta258) || strcmp(MMC_STRINGDATA(_OMC_LIT39), MMC_STRINGDATA(tmpMeta258)) != 0) goto tmp3_end;
          tmpMeta259 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta259)) goto tmp3_end;
          tmpMeta260 = MMC_CAR(tmpMeta259);
          tmpMeta261 = MMC_CDR(tmpMeta259);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta260,13,3) == 0) goto tmp3_end;
          tmpMeta262 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta260), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta262,1,1) == 0) goto tmp3_end;
          tmpMeta263 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta262), 2));
          if (4 != MMC_STRLEN(tmpMeta263) || strcmp(MMC_STRINGDATA(_OMC_LIT174), MMC_STRINGDATA(tmpMeta263)) != 0) goto tmp3_end;
          tmpMeta264 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta260), 3));
          if (listEmpty(tmpMeta264)) goto tmp3_end;
          tmpMeta265 = MMC_CAR(tmpMeta264);
          tmpMeta266 = MMC_CDR(tmpMeta264);
          if (!listEmpty(tmpMeta266)) goto tmp3_end;
          if (!listEmpty(tmpMeta261)) goto tmp3_end;
          
          _e = tmpMeta265;
          tmp4 += 5; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta268 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _OMC_LIT34, _e);
          tmpMeta269 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT27, _OMC_LIT46, tmpMeta268);
          tmpMeta267 = mmc_mk_cons(tmpMeta269, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta270 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _OMC_LIT31, omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT35, tmpMeta267, _OMC_LIT30));
          tmpMeta1 = tmpMeta270;
          goto tmp3_done;
        }
        case 28: {
          modelica_metatype tmpMeta271;
          modelica_metatype tmpMeta272;
          modelica_metatype tmpMeta273;
          modelica_metatype tmpMeta274;
          modelica_metatype tmpMeta275;
          modelica_metatype tmpMeta276;
          modelica_metatype tmpMeta277;
          modelica_metatype tmpMeta278;
          modelica_metatype tmpMeta279;
          modelica_metatype tmpMeta280;
          modelica_metatype tmpMeta281;
          modelica_metatype tmpMeta282;
          modelica_metatype tmpMeta283;
          modelica_metatype tmpMeta284;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta271 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta271,1,1) == 0) goto tmp3_end;
          tmpMeta272 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta271), 2));
          if (3 != MMC_STRLEN(tmpMeta272) || strcmp(MMC_STRINGDATA(_OMC_LIT38), MMC_STRINGDATA(tmpMeta272)) != 0) goto tmp3_end;
          tmpMeta273 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta273)) goto tmp3_end;
          tmpMeta274 = MMC_CAR(tmpMeta273);
          tmpMeta275 = MMC_CDR(tmpMeta273);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta274,13,3) == 0) goto tmp3_end;
          tmpMeta276 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta274), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta276,1,1) == 0) goto tmp3_end;
          tmpMeta277 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta276), 2));
          if (4 != MMC_STRLEN(tmpMeta277) || strcmp(MMC_STRINGDATA(_OMC_LIT174), MMC_STRINGDATA(tmpMeta277)) != 0) goto tmp3_end;
          tmpMeta278 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta274), 3));
          if (listEmpty(tmpMeta278)) goto tmp3_end;
          tmpMeta279 = MMC_CAR(tmpMeta278);
          tmpMeta280 = MMC_CDR(tmpMeta278);
          if (!listEmpty(tmpMeta280)) goto tmp3_end;
          if (!listEmpty(tmpMeta275)) goto tmp3_end;
          
          _e = tmpMeta279;
          tmp4 += 4; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta282 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _e, _OMC_LIT34, _e);
          tmpMeta283 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT27, _OMC_LIT46, tmpMeta282);
          tmpMeta281 = mmc_mk_cons(tmpMeta283, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta284 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT27, _OMC_LIT31, omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT35, tmpMeta281, _OMC_LIT30));
          tmpMeta1 = tmpMeta284;
          goto tmp3_done;
        }
        case 29: {
          modelica_metatype tmpMeta285;
          modelica_metatype tmpMeta286;
          modelica_metatype tmpMeta287;
          modelica_metatype tmpMeta288;
          modelica_metatype tmpMeta289;
          modelica_metatype tmpMeta290;
          modelica_metatype tmpMeta291;
          modelica_metatype tmpMeta292;
          modelica_metatype tmpMeta293;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta285 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta285,1,1) == 0) goto tmp3_end;
          tmpMeta286 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta285), 2));
          if (5 != MMC_STRLEN(tmpMeta286) || strcmp(MMC_STRINGDATA(_OMC_LIT184), MMC_STRINGDATA(tmpMeta286)) != 0) goto tmp3_end;
          tmpMeta287 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta287)) goto tmp3_end;
          tmpMeta288 = MMC_CAR(tmpMeta287);
          tmpMeta289 = MMC_CDR(tmpMeta287);
          if (listEmpty(tmpMeta289)) goto tmp3_end;
          tmpMeta290 = MMC_CAR(tmpMeta289);
          tmpMeta291 = MMC_CDR(tmpMeta289);
          if (!listEmpty(tmpMeta291)) goto tmp3_end;
          
          _e1 = tmpMeta288;
          _e2 = tmpMeta290;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Expression_isZero(threadData, _e2)) goto tmp3_end;
          tmpMeta292 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          _e = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT43, tmpMeta292, _OMC_LIT30);
          tmpMeta293 = mmc_mk_box4(10, &DAE_Exp_BINARY__desc, _OMC_LIT177, _OMC_LIT34, _e);
          tmpMeta1 = tmpMeta293;
          goto tmp3_done;
        }
        case 30: {
          modelica_metatype tmpMeta294;
          modelica_metatype tmpMeta295;
          modelica_metatype tmpMeta296;
          modelica_metatype tmpMeta297;
          modelica_metatype tmpMeta298;
          modelica_metatype tmpMeta299;
          modelica_real tmp300;
          modelica_metatype tmpMeta301;
          modelica_metatype tmpMeta302;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta294 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta294,1,1) == 0) goto tmp3_end;
          tmpMeta295 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta294), 2));
          if (5 != MMC_STRLEN(tmpMeta295) || strcmp(MMC_STRINGDATA(_OMC_LIT184), MMC_STRINGDATA(tmpMeta295)) != 0) goto tmp3_end;
          tmpMeta296 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta296)) goto tmp3_end;
          tmpMeta297 = MMC_CAR(tmpMeta296);
          tmpMeta298 = MMC_CDR(tmpMeta296);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta297,1,1) == 0) goto tmp3_end;
          tmpMeta299 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta297), 2));
          tmp300 = mmc_unbox_real(tmpMeta299);
          if (0.0 != tmp300) goto tmp3_end;
          if (listEmpty(tmpMeta298)) goto tmp3_end;
          tmpMeta301 = MMC_CAR(tmpMeta298);
          tmpMeta302 = MMC_CDR(tmpMeta298);
          if (!listEmpty(tmpMeta302)) goto tmp3_end;
          
          _e1 = tmpMeta297;
          /* Pattern matching succeeded */
          tmpMeta1 = _e1;
          goto tmp3_done;
        }
        case 31: {
          modelica_metatype tmpMeta303;
          modelica_metatype tmpMeta304;
          modelica_metatype tmpMeta305;
          modelica_metatype tmpMeta306;
          modelica_metatype tmpMeta307;
          modelica_metatype tmpMeta308;
          modelica_real tmp309;
          modelica_metatype tmpMeta310;
          modelica_metatype tmpMeta311;
          modelica_metatype tmpMeta312;
          modelica_real tmp313;
          modelica_metatype tmpMeta314;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta303 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta303,1,1) == 0) goto tmp3_end;
          tmpMeta304 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta303), 2));
          if (5 != MMC_STRLEN(tmpMeta304) || strcmp(MMC_STRINGDATA(_OMC_LIT184), MMC_STRINGDATA(tmpMeta304)) != 0) goto tmp3_end;
          tmpMeta305 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta305)) goto tmp3_end;
          tmpMeta306 = MMC_CAR(tmpMeta305);
          tmpMeta307 = MMC_CDR(tmpMeta305);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta306,1,1) == 0) goto tmp3_end;
          tmpMeta308 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta306), 2));
          tmp309 = mmc_unbox_real(tmpMeta308);
          if (listEmpty(tmpMeta307)) goto tmp3_end;
          tmpMeta310 = MMC_CAR(tmpMeta307);
          tmpMeta311 = MMC_CDR(tmpMeta307);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta310,1,1) == 0) goto tmp3_end;
          tmpMeta312 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta310), 2));
          tmp313 = mmc_unbox_real(tmpMeta312);
          if (!listEmpty(tmpMeta311)) goto tmp3_end;
          
          _r1 = tmp309  /* pattern as ty=Real */;
          _r2 = tmp313  /* pattern as ty=Real */;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta314 = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(atan2(_r1, _r2)));
          tmpMeta1 = tmpMeta314;
          goto tmp3_done;
        }
        case 32: {
          modelica_metatype tmpMeta315;
          modelica_metatype tmpMeta316;
          modelica_metatype tmpMeta317;
          modelica_metatype tmpMeta318;
          modelica_metatype tmpMeta319;
          modelica_metatype tmpMeta320;
          modelica_metatype tmpMeta321;
          modelica_metatype tmpMeta322;
          modelica_metatype tmpMeta323;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,3) == 0) goto tmp3_end;
          tmpMeta315 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta315,1,1) == 0) goto tmp3_end;
          tmpMeta316 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta315), 2));
          if (3 != MMC_STRLEN(tmpMeta316) || strcmp(MMC_STRINGDATA(_OMC_LIT24), MMC_STRINGDATA(tmpMeta316)) != 0) goto tmp3_end;
          tmpMeta317 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (listEmpty(tmpMeta317)) goto tmp3_end;
          tmpMeta318 = MMC_CAR(tmpMeta317);
          tmpMeta319 = MMC_CDR(tmpMeta317);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta318,8,2) == 0) goto tmp3_end;
          tmpMeta320 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta318), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta320,5,1) == 0) goto tmp3_end;
          tmpMeta321 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta320), 2));
          tmpMeta322 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta318), 3));
          if (!listEmpty(tmpMeta319)) goto tmp3_end;
          
          _tp = tmpMeta321;
          _e1 = tmpMeta322;
          /* Pattern matching succeeded */
          tmpMeta323 = mmc_mk_cons(_e1, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = omc_Expression_makePureBuiltinCall(threadData, _OMC_LIT24, tmpMeta323, _tp);
          goto tmp3_done;
        }
        case 33: {
          
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_Config_acceptMetaModelicaGrammar(threadData)) goto tmp3_end;
          tmpMeta1 = omc_ExpressionSimplify_simplifyMetaModelicaCalls(threadData, _inExp);
          goto tmp3_done;
        }
        case 34: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 35) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyAsubExp(threadData_t *threadData, modelica_metatype _origExp, modelica_metatype _inExp, modelica_metatype _inSubs)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;
    tmp4_1 = _inExp;
    tmp4_2 = _inSubs;
    {
      modelica_integer _sub;
      modelica_integer _istart;
      modelica_integer _istep;
      modelica_integer _istop;
      modelica_metatype _tp = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _eLst = NULL;
      modelica_metatype _subs = NULL;
      modelica_boolean _hasRange;
      modelica_metatype _step = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _sub has no default value.
      // _istart has no default value.
      // _istep has no default value.
      // _istop has no default value.
      // _tp has no default value.
      // _e has no default value.
      // _eLst has no default value.
      // _subs has no default value.
      // _hasRange has no default value.
      // _step has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 7; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (!listEmpty(tmp4_2)) goto tmp3_end;
          
          _e = tmp4_1;
          /* Pattern matching succeeded */
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,20,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          
          _tp = tmpMeta6;
          _e = tmpMeta7;
          tmp4 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          _tp = omc_Expression_unliftArray(threadData, _tp);
          {
            modelica_metatype __omcQ_24tmpVar59;
            modelica_metatype* tmp9;
            modelica_metatype tmpMeta10;
            modelica_metatype __omcQ_24tmpVar58;
            modelica_integer tmp11;
            modelica_metatype _s_loopVar = 0;
            modelica_metatype _s;
            _s_loopVar = _inSubs;
            tmpMeta10 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar59 = tmpMeta10; /* defaultValue */
            tmp9 = &__omcQ_24tmpVar59;
            while(1) {
              tmp11 = 1;
              if (!listEmpty(_s_loopVar)) {
                _s = MMC_CAR(_s_loopVar);
                _s_loopVar = MMC_CDR(_s_loopVar);
                tmp11--;
              }
              if (tmp11 == 0) {
                __omcQ_24tmpVar58 = omc_Expression_makeIndexSubscript(threadData, _s);
                *tmp9 = mmc_mk_cons(__omcQ_24tmpVar58,0);
                tmp9 = &MMC_CDR(*tmp9);
              } else if (tmp11 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp9 = mmc_mk_nil();
            tmpMeta8 = __omcQ_24tmpVar59;
          }
          tmpMeta12 = mmc_mk_box3(24, &DAE_Exp_ASUB__desc, _e, tmpMeta8);
          tmpMeta13 = mmc_mk_box3(23, &DAE_Exp_CAST__desc, _tp, tmpMeta12);
          tmpMeta1 = tmpMeta13;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_integer tmp18;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,19,1) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta15 = MMC_CAR(tmp4_2);
          tmpMeta16 = MMC_CDR(tmp4_2);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta15,0,1) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta15), 2));
          tmp18 = mmc_unbox_integer(tmpMeta17);
          if (!listEmpty(tmpMeta16)) goto tmp3_end;
          _eLst = tmpMeta14;
          _sub = tmp18  /* pattern as ty=Integer */;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(_sub <= listLength(_eLst))) goto tmp3_end;
          tmpMeta1 = listGet(_eLst, _sub);
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyAsubSlicing(threadData, _inExp, _inSubs);
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          
          /* Pattern matching succeeded */
          {
            modelica_metatype _exp;
            for (tmpMeta19 = _inSubs; !listEmpty(tmpMeta19); tmpMeta19=MMC_CDR(tmpMeta19))
            {
              _exp = MMC_CAR(tmpMeta19);
              omc_Expression_expInt(threadData, _exp);
            }
          }
          tmpMeta1 = omc_List_foldr(threadData, _inSubs, boxvar_ExpressionSimplify_simplifyAsub, _inExp);
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta21;
          modelica_boolean tmp50;
          modelica_metatype tmpMeta51;
          modelica_metatype tmpMeta55;
          
          /* Pattern matching succeeded */
          _hasRange = 0 /* false */;

          {
            modelica_metatype __omcQ_24tmpVar63;
            modelica_metatype* tmp22;
            modelica_metatype tmpMeta23;
            modelica_metatype tmpMeta24;
            modelica_metatype __omcQ_24tmpVar62;
            modelica_integer tmp49;
            modelica_metatype _exp_loopVar = 0;
            modelica_metatype _exp;
            _exp_loopVar = _inSubs;
            tmpMeta23 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar63 = tmpMeta23; /* defaultValue */
            tmp22 = &__omcQ_24tmpVar63;
            while(1) {
              tmp49 = 1;
              if (!listEmpty(_exp_loopVar)) {
                _exp = MMC_CAR(_exp_loopVar);
                _exp_loopVar = MMC_CDR(_exp_loopVar);
                tmp49--;
              }
              if (tmp49 == 0) {
                { /* match expression */
                  modelica_metatype tmp27_1;
                  tmp27_1 = _exp;
                  {
                    volatile mmc_switch_type tmp27;
                    int tmp28;
                    tmp27 = 0;
                    for (; tmp27 < 2; tmp27++) {
                      switch (MMC_SWITCH_CAST(tmp27)) {
                      case 0: {
                        modelica_metatype tmpMeta29;
                        modelica_metatype tmpMeta30;
                        modelica_integer tmp31;
                        modelica_metatype tmpMeta32;
                        modelica_metatype tmpMeta33;
                        modelica_metatype tmpMeta34;
                        modelica_integer tmp35;
                        modelica_metatype tmpMeta36;
                        if (mmc__uniontype__metarecord__typedef__equal(tmp27_1,18,4) == 0) goto tmp26_end;
                        tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp27_1), 3));
                        if (mmc__uniontype__metarecord__typedef__equal(tmpMeta29,0,1) == 0) goto tmp26_end;
                        tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta29), 2));
                        tmp31 = mmc_unbox_integer(tmpMeta30);
                        tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp27_1), 4));
                        tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp27_1), 5));
                        if (mmc__uniontype__metarecord__typedef__equal(tmpMeta33,0,1) == 0) goto tmp26_end;
                        tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta33), 2));
                        tmp35 = mmc_unbox_integer(tmpMeta34);
                        _istart = tmp31  /* pattern as ty=Integer */;
                        _step = tmpMeta32;
                        _istop = tmp35  /* pattern as ty=Integer */;
                        /* Pattern matching succeeded */
                        {
                          modelica_metatype __omcQ_24tmpVar61;
                          modelica_metatype* tmp37;
                          modelica_metatype tmpMeta38;
                          modelica_metatype tmpMeta39;
                          modelica_metatype __omcQ_24tmpVar60;
                          modelica_integer tmp40;
                          modelica_metatype _i_loopVar = 0;
                          modelica_integer tmp41 = 0;
                          modelica_metatype _i;
                          { /* match expression */
                            modelica_metatype tmp44_1;
                            tmp44_1 = _step;
                            {
                              volatile mmc_switch_type tmp44;
                              int tmp45;
                              tmp44 = 0;
                              for (; tmp44 < 2; tmp44++) {
                                switch (MMC_SWITCH_CAST(tmp44)) {
                                case 0: {
                                  if (!optionNone(tmp44_1)) goto tmp43_end;
                                  /* Pattern matching succeeded */
                                  tmp41 = ((modelica_integer) 1);
                                  goto tmp43_done;
                                }
                                case 1: {
                                  modelica_metatype tmpMeta46;
                                  modelica_metatype tmpMeta47;
                                  modelica_integer tmp48;
                                  if (optionNone(tmp44_1)) goto tmp43_end;
                                  tmpMeta46 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp44_1), 1));
                                  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta46,0,1) == 0) goto tmp43_end;
                                  tmpMeta47 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta46), 2));
                                  tmp48 = mmc_unbox_integer(tmpMeta47);
                                  _istep = tmp48  /* pattern as ty=Integer */;
                                  /* Pattern matching succeeded */
                                  tmp41 = _istep;
                                  goto tmp43_done;
                                }
                                }
                                goto tmp43_end;
                                tmp43_end: ;
                              }
                              goto goto_42;
                              goto_42:;
                              goto goto_25;
                              goto tmp43_done;
                              tmp43_done:;
                            }
                          }_i_loopVar = omc_ExpressionSimplify_simplifyRange(threadData, _istart, tmp41, _istop);
                          tmpMeta38 = MMC_REFSTRUCTLIT(mmc_nil);
                          __omcQ_24tmpVar61 = tmpMeta38; /* defaultValue */
                          tmp37 = &__omcQ_24tmpVar61;
                          while(1) {
                            tmp40 = 1;
                            if (!listEmpty(_i_loopVar)) {
                              _i = MMC_CAR(_i_loopVar);
                              _i_loopVar = MMC_CDR(_i_loopVar);
                              tmp40--;
                            }
                            if (tmp40 == 0) {
                              tmpMeta39 = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, _i);
                              __omcQ_24tmpVar60 = tmpMeta39;
                              *tmp37 = mmc_mk_cons(__omcQ_24tmpVar60,0);
                              tmp37 = &MMC_CDR(*tmp37);
                            } else if (tmp40 == 1) {
                              break;
                            } else {
                              goto goto_25;
                            }
                          }
                          *tmp37 = mmc_mk_nil();
                          tmpMeta36 = __omcQ_24tmpVar61;
                        }
                        _e = omc_Expression_makeArray(threadData, tmpMeta36, _OMC_LIT54, 1 /* true */);

                        _hasRange = 1 /* true */;
                        tmpMeta24 = _e;
                        goto tmp26_done;
                      }
                      case 1: {
                        
                        /* Pattern matching succeeded */
                        tmpMeta24 = _exp;
                        goto tmp26_done;
                      }
                      }
                      goto tmp26_end;
                      tmp26_end: ;
                    }
                    goto goto_25;
                    goto_25:;
                    goto goto_2;
                    goto tmp26_done;
                    tmp26_done:;
                  }
                }__omcQ_24tmpVar62 = tmpMeta24;
                *tmp22 = mmc_mk_cons(__omcQ_24tmpVar62,0);
                tmp22 = &MMC_CDR(*tmp22);
              } else if (tmp49 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp22 = mmc_mk_nil();
            tmpMeta21 = __omcQ_24tmpVar63;
          }
          _subs = tmpMeta21;

          /* Pattern-matching assignment */
          tmp50 = _hasRange;
          if (1 /* true */ != tmp50) goto goto_2;
          {
            modelica_metatype __omcQ_24tmpVar65;
            modelica_metatype* tmp52;
            modelica_metatype tmpMeta53;
            modelica_metatype __omcQ_24tmpVar64;
            modelica_integer tmp54;
            modelica_metatype _s_loopVar = 0;
            modelica_metatype _s;
            _s_loopVar = _subs;
            tmpMeta53 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar65 = tmpMeta53; /* defaultValue */
            tmp52 = &__omcQ_24tmpVar65;
            while(1) {
              tmp54 = 1;
              if (!listEmpty(_s_loopVar)) {
                _s = MMC_CAR(_s_loopVar);
                _s_loopVar = MMC_CDR(_s_loopVar);
                tmp54--;
              }
              if (tmp54 == 0) {
                __omcQ_24tmpVar64 = omc_Expression_makeIndexSubscript(threadData, _s);
                *tmp52 = mmc_mk_cons(__omcQ_24tmpVar64,0);
                tmp52 = &MMC_CDR(*tmp52);
              } else if (tmp54 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp52 = mmc_mk_nil();
            tmpMeta51 = __omcQ_24tmpVar65;
          }
          tmpMeta55 = mmc_mk_box3(24, &DAE_Exp_ASUB__desc, _inExp, tmpMeta51);
          tmpMeta1 = tmpMeta55;
          goto tmp3_done;
        }
        case 6: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _origExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 7) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyRSub(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fe)
{
  modelica_metatype _e = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _e = __omcQ_24in_5Fe;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _e;
    {
      modelica_metatype _cr = NULL;
      modelica_metatype _exps = NULL;
      modelica_metatype _comp = NULL;
      modelica_metatype _p1 = NULL;
      modelica_metatype _p2 = NULL;
      modelica_metatype _vars = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _cr has no default value.
      // _exps has no default value.
      // _comp has no default value.
      // _p1 has no default value.
      // _p2 has no default value.
      // _vars has no default value.
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_integer tmp9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,23,4) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,6,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp9 = mmc_unbox_integer(tmpMeta8);
          if (-1 != tmp9) goto tmp3_end;
          
          _cr = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta10 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta11 = mmc_mk_box3(9, &DAE_Exp_CREF__desc, omc_ComponentReference_joinCrefs(threadData, _cr, omc_ComponentReference_makeCrefIdent(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_e), 4))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_e), 5))), tmpMeta10)), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_e), 5))));
          tmpMeta1 = tmpMeta11;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_integer tmp21;
          modelica_metatype tmpMeta22;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,23,4) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta12,13,3) == 0) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta12), 2));
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta12), 3));
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta12), 4));
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta15), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta16,9,4) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta16), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta17,3,1) == 0) goto tmp3_end;
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta17), 2));
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta16), 3));
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp21 = mmc_unbox_integer(tmpMeta20);
          if (-1 != tmp21) goto tmp3_end;
          
          _p1 = tmpMeta13;
          _exps = tmpMeta14;
          _p2 = tmpMeta18;
          _vars = tmpMeta19;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_AbsynUtil_pathEqual(threadData, _p1, _p2)) goto tmp3_end;
          {
            modelica_metatype __omcQ_24tmpVar67;
            modelica_metatype* tmp23;
            modelica_metatype tmpMeta24;
            modelica_string __omcQ_24tmpVar66;
            modelica_integer tmp25;
            modelica_metatype _v_loopVar = 0;
            modelica_metatype _v;
            _v_loopVar = _vars;
            tmpMeta24 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar67 = tmpMeta24; /* defaultValue */
            tmp23 = &__omcQ_24tmpVar67;
            while(1) {
              tmp25 = 1;
              if (!listEmpty(_v_loopVar)) {
                _v = MMC_CAR(_v_loopVar);
                _v_loopVar = MMC_CDR(_v_loopVar);
                tmp25--;
              }
              if (tmp25 == 0) {
                __omcQ_24tmpVar66 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 2)));
                *tmp23 = mmc_mk_cons(__omcQ_24tmpVar66,0);
                tmp23 = &MMC_CDR(*tmp23);
              } else if (tmp25 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp23 = mmc_mk_nil();
            tmpMeta22 = __omcQ_24tmpVar67;
          }
          tmpMeta1 = listGet(_exps, omc_List_position1OnTrue(threadData, tmpMeta22, boxvar_stringEq, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_e), 4)))));
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_integer tmp30;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,23,4) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta26,14,4) == 0) goto tmp3_end;
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta26), 3));
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta26), 4));
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmp30 = mmc_unbox_integer(tmpMeta29);
          if (-1 != tmp30) goto tmp3_end;
          
          _exps = tmpMeta27;
          _comp = tmpMeta28;
          /* Pattern matching succeeded */
          tmpMeta1 = listGet(_exps, omc_List_position1OnTrue(threadData, _comp, boxvar_stringEq, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_e), 4)))));
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _e;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _e = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _e;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyWork(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _options, modelica_metatype *out_outOptions)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _outOptions = NULL;
  modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _outOptions has no default value.
  
  
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _e = NULL;
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _e3 = NULL;
      modelica_metatype _exp1 = NULL;
      modelica_metatype _t = NULL;
      modelica_metatype _tp = NULL;
      modelica_boolean _b2;
      modelica_metatype _expl = NULL;
      modelica_metatype _subs = NULL;
      modelica_metatype _c_1 = NULL;
      modelica_metatype _op = NULL;
      modelica_integer _index_;
      modelica_metatype _isExpisASUB = NULL;
      modelica_metatype _reductionInfo = NULL;
      modelica_metatype _riters = NULL;
      modelica_metatype _oe = NULL;
      int tmp4;
      // _e has no default value.
      // _e1 has no default value.
      // _e2 has no default value.
      // _e3 has no default value.
      // _exp1 has no default value.
      // _t has no default value.
      // _tp has no default value.
      // _b2 has no default value.
      // _expl has no default value.
      // _subs has no default value.
      // _c_1 has no default value.
      // _op has no default value.
      // _index_ has no default value.
      // _isExpisASUB has no default value.
      // _reductionInfo has no default value.
      // _riters has no default value.
      // _oe has no default value.
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 27: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,24,2) == 0) goto tmp3_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _e1 = tmpMeta5;
          _oe = tmpMeta6;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = omc_ExpressionSimplify_simplifySize(threadData, _inExp, _e1, _oe);
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 23: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,20,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _tp = tmpMeta7;
          _e = tmpMeta8;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplifyCast(threadData, _inExp, _e, _tp);
          tmpMeta[0+0] = _e;
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 24: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,21,2) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _e = tmpMeta9;
          _subs = tmpMeta10;
          /* Pattern matching succeeded */
          {
            modelica_metatype __omcQ_24tmpVar49;
            modelica_metatype* tmp12;
            modelica_metatype tmpMeta13;
            modelica_metatype __omcQ_24tmpVar48;
            modelica_integer tmp14;
            modelica_metatype _sub_loopVar = 0;
            modelica_metatype _sub;
            _sub_loopVar = _subs;
            tmpMeta13 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar49 = tmpMeta13; /* defaultValue */
            tmp12 = &__omcQ_24tmpVar49;
            while(1) {
              tmp14 = 1;
              if (!listEmpty(_sub_loopVar)) {
                _sub = MMC_CAR(_sub_loopVar);
                _sub_loopVar = MMC_CDR(_sub_loopVar);
                tmp14--;
              }
              if (tmp14 == 0) {
                __omcQ_24tmpVar48 = omc_Expression_getSubscriptExp(threadData, _sub);
                *tmp12 = mmc_mk_cons(__omcQ_24tmpVar48,0);
                tmp12 = &MMC_CDR(*tmp12);
              } else if (tmp14 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp12 = mmc_mk_nil();
            tmpMeta11 = __omcQ_24tmpVar49;
          }
          _expl = tmpMeta11;

          _e = omc_ExpressionSimplify_simplifyAsubExp(threadData, _inExp, _e, _expl);
          tmpMeta[0+0] = _e;
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 25: {
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = omc_ExpressionSimplify_simplifyTSub(threadData, _inExp);
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,2) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _op = tmpMeta15;
          _e1 = tmpMeta16;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplifyUnary(threadData, _inExp, _op, _e1);
          tmpMeta[0+0] = _e;
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 10: {
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta18 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta19 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta17;
          _op = tmpMeta18;
          _e2 = tmpMeta19;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplifyBinary(threadData, _inExp, _op, _e1, _e2);
          tmpMeta[0+0] = _e;
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 14: {
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          modelica_metatype tmpMeta23;
          modelica_integer tmp24;
          modelica_metatype tmpMeta25;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,11,5) == 0) goto tmp3_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta22 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmpMeta23 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 5));
          tmp24 = mmc_unbox_integer(tmpMeta23);
          tmpMeta25 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 6));
          _e1 = tmpMeta20;
          _op = tmpMeta21;
          _e2 = tmpMeta22;
          _index_ = tmp24  /* pattern as ty=Integer */;
          _isExpisASUB = tmpMeta25;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplifyRelation(threadData, _inExp, _op, _e1, _e2, _index_, _isExpisASUB);
          tmpMeta[0+0] = _e;
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 13: {
          modelica_metatype tmpMeta26;
          modelica_metatype tmpMeta27;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,10,2) == 0) goto tmp3_end;
          tmpMeta26 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta27 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _op = tmpMeta26;
          _e1 = tmpMeta27;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplifyUnary(threadData, _inExp, _op, _e1);
          tmpMeta[0+0] = _e;
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 12: {
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,9,3) == 0) goto tmp3_end;
          tmpMeta28 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta29 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta30 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta28;
          _op = tmpMeta29;
          _e2 = tmpMeta30;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplifyLBinary(threadData, _inExp, _op, _e1, _e2);
          tmpMeta[0+0] = _e;
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta31;
          modelica_metatype tmpMeta32;
          modelica_metatype tmpMeta33;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,12,3) == 0) goto tmp3_end;
          tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta33 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta31;
          _e2 = tmpMeta32;
          _e3 = tmpMeta33;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplifyIfExp(threadData, _inExp, _e1, _e2, _e3);
          tmpMeta[0+0] = _e;
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta34;
          modelica_metatype tmpMeta35;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta34 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _c_1 = tmpMeta34;
          _t = tmpMeta35;
          /* Pattern matching succeeded */
          _e = omc_ExpressionSimplify_simplifyCref(threadData, _inExp, _c_1, _t);
          tmpMeta[0+0] = _e;
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 30: {
          modelica_metatype tmpMeta36;
          modelica_metatype tmpMeta37;
          modelica_metatype tmpMeta38;
          modelica_metatype tmpMeta39;
          modelica_metatype tmpMeta40;
          modelica_boolean tmp41;
          modelica_metatype tmpMeta42;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,27,3) == 0) goto tmp3_end;
          tmpMeta36 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta37 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta38 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _reductionInfo = tmpMeta36;
          _e1 = tmpMeta37;
          _riters = tmpMeta38;
          /* Pattern matching succeeded */
          tmpMeta39 = MMC_REFSTRUCTLIT(mmc_nil);
          _riters = omc_ExpressionSimplify_simplifyReductionIterators(threadData, _riters, tmpMeta39, 0 /* false */ ,&_b2);

          tmp41 = (modelica_boolean)_b2;
          if(tmp41)
          {
            tmpMeta40 = mmc_mk_box4(30, &DAE_Exp_REDUCTION__desc, _reductionInfo, _e1, _riters);
            tmpMeta42 = tmpMeta40;
          }
          else
          {
            tmpMeta42 = _inExp;
          }
          _exp1 = tmpMeta42;
          tmpMeta[0+0] = omc_ExpressionSimplify_simplifyReduction(threadData, _exp1);
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 16: {
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = omc_ExpressionSimplify_simplifyCall(threadData, _inExp);
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 26: {
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = omc_ExpressionSimplify_simplifyRSub(threadData, _inExp);
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 36: {
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = omc_ExpressionSimplify_simplifyMatch(threadData, _inExp);
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 38: {
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = omc_ExpressionSimplify_simplifyUnbox(threadData, _inExp);
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 37: {
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = omc_ExpressionSimplify_simplifyUnbox(threadData, _inExp);
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        case 32: {
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = omc_ExpressionSimplify_simplifyCons(threadData, _inExp);
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _inExp;
          tmpMeta[0+1] = _options;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta[0+0];
  _outOptions = tmpMeta[0+1];
  _return: OMC_LABEL_UNUSED
  if (out_outOptions) { *out_outOptions = _outOptions; }
  return _outExp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplify1time(threadData_t *threadData, modelica_metatype _e)
{
  modelica_metatype _outE = NULL;
  modelica_real _t1;
  modelica_real _t2;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_boolean tmp7;
  modelica_string tmp8;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outE has no default value.
  // _t1 has no default value.
  // _t2 has no default value.
  _t1 = mmc_clock();

  _outE = omc_ExpressionSimplify_simplify1(threadData, _e, NULL);

  _t2 = mmc_clock();

  tmp7 = (modelica_boolean)(_t2 - _t1 > 0.01);
  if(tmp7)
  {
    tmpMeta1 = stringAppend(_OMC_LIT185,realString(_t2 - _t1));
    tmpMeta2 = stringAppend(tmpMeta1,_OMC_LIT186);
    tmpMeta3 = stringAppend(tmpMeta2,omc_ExpressionDump_printExpStr(threadData, _e));
    tmpMeta4 = stringAppend(tmpMeta3,_OMC_LIT187);
    tmpMeta5 = stringAppend(tmpMeta4,omc_ExpressionDump_printExpStr(threadData, _outE));
    tmpMeta6 = stringAppend(tmpMeta5,_OMC_LIT188);
    tmp8 = tmpMeta6;
  }
  else
  {
    tmp8 = _OMC_LIT71;
  }
  fputs(MMC_STRINGDATA(tmp8),stdout);
  _return: OMC_LABEL_UNUSED
  return _outE;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplify1TraverseHelper(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inA, modelica_metatype *out_a)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _a = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _a has no default value.
  _a = _inA;

  _outExp = omc_ExpressionSimplify_simplify1(threadData, _inExp, NULL);
  _return: OMC_LABEL_UNUSED
  if (out_a) { *out_a = _a; }
  return _outExp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyTraverseHelper(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _inA, modelica_metatype *out_a)
{
  modelica_metatype _exp = NULL;
  modelica_metatype _a = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  // _a has no default value.
  _a = _inA;

  _exp = omc_ExpressionSimplify_simplify(threadData, _inExp, NULL);
  _return: OMC_LABEL_UNUSED
  if (out_a) { *out_a = _a; }
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_ExpressionSimplify_simplifyWithOptions(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _options, modelica_boolean *out_hasChanged)
{
  modelica_metatype _outExp = NULL;
  modelica_boolean _hasChanged;
  modelica_boolean tmp1_c1 __attribute__((unused)) = 0;
  modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _hasChanged has no default value.
  
  
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;volatile modelica_metatype tmp4_2;
    tmp4_1 = _inExp;
    tmp4_2 = _options;
    {
      modelica_metatype _e = NULL;
      modelica_metatype _eNew = NULL;
      modelica_boolean _b;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e has no default value.
      // _eNew has no default value.
      // _b has no default value.
      tmp4 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp3_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,1,0) == 0) goto tmp3_end;
          
          _e = tmp4_1;
          /* Pattern matching succeeded */
          _eNew = omc_ExpressionSimplify_simplify1WithOptions(threadData, _e, _options, NULL);

          omc_Error_assertionOrAddSourceMessage(threadData, omc_Expression_isConstValue(threadData, _eNew), _OMC_LIT4, _OMC_LIT190, _OMC_LIT93);

          _b = (!omc_Expression_expEqual(threadData, _e, _eNew));
          tmpMeta[0+0] = _eNew;
          tmp1_c1 = _b;
          goto tmp3_done;
        }
        case 1: {
          modelica_boolean tmp7;
          
          _e = tmp4_1;
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmp7 = omc_Config_getNoSimplify(threadData);
          if (0 /* false */ != tmp7) goto goto_2;

          _eNew = omc_ExpressionSimplify_simplify1WithOptions(threadData, _e, _options, NULL);

          _eNew = omc_ExpressionSimplify_simplify2(threadData, _eNew, 1 /* true */, 1 /* true */);

          _eNew = omc_ExpressionSimplify_simplify1WithOptions(threadData, _eNew, _options, NULL);

          _b = (!omc_Expression_expEqual(threadData, _e, _eNew));
          tmpMeta[0+0] = _eNew;
          tmp1_c1 = _b;
          goto tmp3_done;
        }
        case 2: {
          
          _e = tmp4_1;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = omc_ExpressionSimplify_simplify1WithOptions(threadData, _e, _options, &tmp1_c1);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      tmp3_done:
      (void)tmp4;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp3_done2;
      goto_2:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp4 < 3) {
        goto tmp3_top;
      }
      MMC_THROW_INTERNAL();
      tmp3_done2:;
    }
  }
  _outExp = tmpMeta[0+0];
  _hasChanged = tmp1_c1;
  _return: OMC_LABEL_UNUSED
  if (out_hasChanged) { *out_hasChanged = _hasChanged; }
  return _outExp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ExpressionSimplify_simplifyWithOptions(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype _options, modelica_metatype *out_hasChanged)
{
  modelica_boolean _hasChanged;
  modelica_metatype _outExp = NULL;
  _outExp = omc_ExpressionSimplify_simplifyWithOptions(threadData, _inExp, _options, &_hasChanged);
  /* skip box _outExp; DAE.Exp */
  if (out_hasChanged) { *out_hasChanged = mmc_mk_icon(_hasChanged); }
  return _outExp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyUnaryExp(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _e1 = NULL;
      modelica_metatype _op = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e1 has no default value.
      // _op has no default value.
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _op = tmpMeta6;
          _e1 = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyUnary(threadData, _inExp, _op, _e1);
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplifyBinaryExp(threadData_t *threadData, modelica_metatype _inExp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inExp;
    {
      modelica_metatype _e1 = NULL;
      modelica_metatype _e2 = NULL;
      modelica_metatype _op = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _e1 has no default value.
      // _e2 has no default value.
      // _op has no default value.
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          _e1 = tmpMeta6;
          _op = tmpMeta7;
          _e2 = tmpMeta8;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_ExpressionSimplify_simplifyBinary(threadData, _inExp, _op, _e1, _e2);
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _inExp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_condsimplify(threadData_t *threadData, modelica_boolean _cond, modelica_metatype __omcQ_24in_5FioExp, modelica_boolean *out_hasChanged)
{
  modelica_metatype _ioExp = NULL;
  modelica_boolean _hasChanged;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _ioExp = __omcQ_24in_5FioExp;
  _hasChanged = 0 /* false */;
  if(_cond)
  {
    _ioExp = omc_ExpressionSimplify_simplifyWithOptions(threadData, _ioExp, _OMC_LIT167 ,&_hasChanged);
  }
  _return: OMC_LABEL_UNUSED
  if (out_hasChanged) { *out_hasChanged = _hasChanged; }
  return _ioExp;
}
modelica_metatype boxptr_ExpressionSimplify_condsimplify(threadData_t *threadData, modelica_metatype _cond, modelica_metatype __omcQ_24in_5FioExp, modelica_metatype *out_hasChanged)
{
  modelica_integer tmp1;
  modelica_boolean _hasChanged;
  modelica_metatype _ioExp = NULL;
  tmp1 = mmc_unbox_integer(_cond);
  _ioExp = omc_ExpressionSimplify_condsimplify(threadData, tmp1, __omcQ_24in_5FioExp, &_hasChanged);
  /* skip box _ioExp; DAE.Exp */
  if (out_hasChanged) { *out_hasChanged = mmc_mk_icon(_hasChanged); }
  return _ioExp;
}

DLLDirection
modelica_metatype omc_ExpressionSimplify_simplify(threadData_t *threadData, modelica_metatype _inExp, modelica_boolean *out_hasChanged)
{
  modelica_metatype _outExp = NULL;
  modelica_boolean _hasChanged;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _hasChanged has no default value.
  _outExp = omc_ExpressionSimplify_simplifyWithOptions(threadData, _inExp, _OMC_LIT167 ,&_hasChanged);
  _return: OMC_LABEL_UNUSED
  if (out_hasChanged) { *out_hasChanged = _hasChanged; }
  return _outExp;
}
modelica_metatype boxptr_ExpressionSimplify_simplify(threadData_t *threadData, modelica_metatype _inExp, modelica_metatype *out_hasChanged)
{
  modelica_boolean _hasChanged;
  modelica_metatype _outExp = NULL;
  _outExp = omc_ExpressionSimplify_simplify(threadData, _inExp, &_hasChanged);
  /* skip box _outExp; DAE.Exp */
  if (out_hasChanged) { *out_hasChanged = mmc_mk_icon(_hasChanged); }
  return _outExp;
}

