#include "omc_simulation_settings.h"
#include "NFInstNode.h"
#define _OMC_LIT0_data "Protection"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT0,10,_OMC_LIT0_data);
#define _OMC_LIT0 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT0)
#define _OMC_LIT1_data "access"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT1,6,_OMC_LIT1_data);
#define _OMC_LIT1 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT1)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT2,1,16) {&NFRestriction_UNKNOWN__desc,}};
#define _OMC_LIT2 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT2)
#define _OMC_LIT3_data "Clock"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT3,5,_OMC_LIT3_data);
#define _OMC_LIT3 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT3)
#define _OMC_LIT4_data "NFInstNode.InstNode.getSections did not get an instanced class"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT4,62,_OMC_LIT4_data);
#define _OMC_LIT4 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT4)
#define _OMC_LIT5_data "/projects/OpenModelica-session2/OMCompiler/Compiler/NFFrontEnd/NFInstNode.mo"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT5,76,_OMC_LIT5_data);
#define _OMC_LIT5 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT5)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT6_6,1.782113391e9);
#define _OMC_LIT6_6 MMC_REFREALLIT(_OMC_LIT_STRUCT6_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT6,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(2177)),MMC_IMMEDIATE(MMC_TAGFIXNUM(11)),MMC_IMMEDIATE(MMC_TAGFIXNUM(2177)),MMC_IMMEDIATE(MMC_TAGFIXNUM(95)),_OMC_LIT6_6}};
#define _OMC_LIT6 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT7,1,11) {&NFInstNode_InstNode_EMPTY__NODE__desc,}};
#define _OMC_LIT7 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT7)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT8,1,5) {&NFModifier_Modifier_NOMOD__desc,}};
#define _OMC_LIT8 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT8)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT9,10,3) {&SCodeDump_SCodeDumpOptions_OPTIONS__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1 /* true */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1 /* true */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */))}};
#define _OMC_LIT9 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT9)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT10,1,5) {&ErrorTypes_MessageType_TRANSLATION__desc,}};
#define _OMC_LIT10 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT10)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT11,1,4) {&ErrorTypes_Severity_ERROR__desc,}};
#define _OMC_LIT11 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT11)
#define _OMC_LIT12_data "Duplicate elements (due to inherited elements) not identical:\n  first element is:  %s\n  second element is: %s"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT12,109,_OMC_LIT12_data);
#define _OMC_LIT12 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT12)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT13,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(90)),_OMC_LIT10,_OMC_LIT11,_OMC_LIT12}};
#define _OMC_LIT13 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT13)
#define _OMC_LIT14_data "NFInstNode.InstNode.clearPackageCache got node without cache"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT14,60,_OMC_LIT14_data);
#define _OMC_LIT14 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT14)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT15_6,1.782113391e9);
#define _OMC_LIT15_6 MMC_REFREALLIT(_OMC_LIT_STRUCT15_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT15,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1563)),MMC_IMMEDIATE(MMC_TAGFIXNUM(22)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1563)),MMC_IMMEDIATE(MMC_TAGFIXNUM(98)),_OMC_LIT15_6}};
#define _OMC_LIT15 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT15)
#define _OMC_LIT16_data "NFInstNode.InstNode.setPackageCache got node without cache"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT16,58,_OMC_LIT16_data);
#define _OMC_LIT16 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT16)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT17_6,1.782113391e9);
#define _OMC_LIT17_6 MMC_REFREALLIT(_OMC_LIT_STRUCT17_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT17,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1554)),MMC_IMMEDIATE(MMC_TAGFIXNUM(22)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1554)),MMC_IMMEDIATE(MMC_TAGFIXNUM(98)),_OMC_LIT17_6}};
#define _OMC_LIT17 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT17)
#define _OMC_LIT18_data "NFInstNode.InstNode.getPackageCache got node without cache"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT18,58,_OMC_LIT18_data);
#define _OMC_LIT18 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT18)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT19_6,1.782113391e9);
#define _OMC_LIT19_6 MMC_REFREALLIT(_OMC_LIT_STRUCT19_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT19,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1543)),MMC_IMMEDIATE(MMC_TAGFIXNUM(22)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1543)),MMC_IMMEDIATE(MMC_TAGFIXNUM(98)),_OMC_LIT19_6}};
#define _OMC_LIT19 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT19)
#define _OMC_LIT20_data "NFInstNode.InstNode.setFuncCache got node without cache"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT20,55,_OMC_LIT20_data);
#define _OMC_LIT20 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT20)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT21_6,1.782113391e9);
#define _OMC_LIT21_6 MMC_REFREALLIT(_OMC_LIT_STRUCT21_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT21,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1533)),MMC_IMMEDIATE(MMC_TAGFIXNUM(22)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1533)),MMC_IMMEDIATE(MMC_TAGFIXNUM(98)),_OMC_LIT21_6}};
#define _OMC_LIT21 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT21)
#define _OMC_LIT22_data "NFInstNode.InstNode.getFuncCache got node without cache"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT22,55,_OMC_LIT22_data);
#define _OMC_LIT22 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT22)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT23_6,1.782113391e9);
#define _OMC_LIT23_6 MMC_REFREALLIT(_OMC_LIT_STRUCT23_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT23,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1523)),MMC_IMMEDIATE(MMC_TAGFIXNUM(22)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1523)),MMC_IMMEDIATE(MMC_TAGFIXNUM(98)),_OMC_LIT23_6}};
#define _OMC_LIT23 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT23)
#define _OMC_LIT24_data "NFInstNode.InstNode.newFuncCache got node without cache"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT24,55,_OMC_LIT24_data);
#define _OMC_LIT24 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT24)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT25_6,1.782113391e9);
#define _OMC_LIT25_6 MMC_REFREALLIT(_OMC_LIT_STRUCT25_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT25,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1513)),MMC_IMMEDIATE(MMC_TAGFIXNUM(22)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1513)),MMC_IMMEDIATE(MMC_TAGFIXNUM(98)),_OMC_LIT25_6}};
#define _OMC_LIT25 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT25)
#define _OMC_LIT26_data "NFInstNode.InstNode.cacheAddFunc got node without cache"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT26,55,_OMC_LIT26_data);
#define _OMC_LIT26 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT26)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT27_6,1.782113391e9);
#define _OMC_LIT27_6 MMC_REFREALLIT(_OMC_LIT_STRUCT27_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT27,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1502)),MMC_IMMEDIATE(MMC_TAGFIXNUM(22)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1502)),MMC_IMMEDIATE(MMC_TAGFIXNUM(98)),_OMC_LIT27_6}};
#define _OMC_LIT27 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT27)
#define _OMC_LIT28_data "NFInstNode.InstNode.cacheInitFunc got node without cache"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT28,56,_OMC_LIT28_data);
#define _OMC_LIT28 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT28)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT29_6,1.782113391e9);
#define _OMC_LIT29_6 MMC_REFREALLIT(_OMC_LIT_STRUCT29_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT29,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1491)),MMC_IMMEDIATE(MMC_TAGFIXNUM(22)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1491)),MMC_IMMEDIATE(MMC_TAGFIXNUM(98)),_OMC_LIT29_6}};
#define _OMC_LIT29 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT29)
#define _OMC_LIT30_data "NFInstNode.InstNode.scopePathClass got unknown node type"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT30,56,_OMC_LIT30_data);
#define _OMC_LIT30 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT30)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT31_6,1.782113391e9);
#define _OMC_LIT31_6 MMC_REFREALLIT(_OMC_LIT_STRUCT31_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT31,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1380)),MMC_IMMEDIATE(MMC_TAGFIXNUM(11)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1380)),MMC_IMMEDIATE(MMC_TAGFIXNUM(86)),_OMC_LIT31_6}};
#define _OMC_LIT31 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT31)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT32,1,7) {&SCode_Mod_NOMOD__desc,}};
#define _OMC_LIT32 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT32)
#define _OMC_LIT33_data "NFInstNode.InstNode.scopeListClass got unknown node type"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT33,56,_OMC_LIT33_data);
#define _OMC_LIT33 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT33)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT34_6,1.782113391e9);
#define _OMC_LIT34_6 MMC_REFREALLIT(_OMC_LIT_STRUCT34_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT34,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1261)),MMC_IMMEDIATE(MMC_TAGFIXNUM(11)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1261)),MMC_IMMEDIATE(MMC_TAGFIXNUM(86)),_OMC_LIT34_6}};
#define _OMC_LIT34 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT34)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT35,1,13) {&NFType_UNKNOWN__desc,}};
#define _OMC_LIT35 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT35)
#define _OMC_LIT36_data ""
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT36,0,_OMC_LIT36_data);
#define _OMC_LIT36 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT36)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT37,0.0);
#define _OMC_LIT37 MMC_REFREALLIT(_OMC_LIT_STRUCT37)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT38,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT36,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_LIT37}};
#define _OMC_LIT38 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT38)
#define _OMC_LIT39_data "Internal error %s"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT39,17,_OMC_LIT39_data);
#define _OMC_LIT39 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT39)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT40,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(63)),_OMC_LIT10,_OMC_LIT11,_OMC_LIT39}};
#define _OMC_LIT40 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT40)
#define _OMC_LIT41_data "NFInstNode.InstNode.setComponentDirection failed for non component node: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT41,73,_OMC_LIT41_data);
#define _OMC_LIT41 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT41)
#define _OMC_LIT42_data "NFInstNode.InstNode.classDefinition failed for non class/component node: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT42,73,_OMC_LIT42_data);
#define _OMC_LIT42 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT42)
#define _OMC_LIT43_data "NFInstNode.InstNode.definition failed for non class/component node: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT43,68,_OMC_LIT43_data);
#define _OMC_LIT43 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT43)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT44,1,9) {&NFComponent_WILD__desc,}};
#define _OMC_LIT44 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT44)
#define _OMC_LIT45_data "class"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT45,5,_OMC_LIT45_data);
#define _OMC_LIT45 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT45)
#define _OMC_LIT46_data "component"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT46,9,_OMC_LIT46_data);
#define _OMC_LIT46 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT46)
#define _OMC_LIT47_data "ref node"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT47,8,_OMC_LIT47_data);
#define _OMC_LIT47 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT47)
#define _OMC_LIT48_data "name node"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT48,9,_OMC_LIT48_data);
#define _OMC_LIT48 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT48)
#define _OMC_LIT49_data "implicit scope"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT49,14,_OMC_LIT49_data);
#define _OMC_LIT49 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT49)
#define _OMC_LIT50_data "empty node"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT50,10,_OMC_LIT50_data);
#define _OMC_LIT50 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT50)
#define _OMC_LIT51_data "var node"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT51,8,_OMC_LIT51_data);
#define _OMC_LIT51 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT51)
#define _OMC_LIT52_data "$REF["
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT52,5,_OMC_LIT52_data);
#define _OMC_LIT52 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT52)
#define _OMC_LIT53_data "]"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT53,1,_OMC_LIT53_data);
#define _OMC_LIT53 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT53)
#define _OMC_LIT54_data "$IMPLICIT"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT54,9,_OMC_LIT54_data);
#define _OMC_LIT54 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT54)
#define _OMC_LIT55_data "$ITERATOR("
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT55,10,_OMC_LIT55_data);
#define _OMC_LIT55 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT55)
#define _OMC_LIT56_data ")"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT56,1,_OMC_LIT56_data);
#define _OMC_LIT56 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT56)
#define _OMC_LIT57_data "$EMPTY"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT57,6,_OMC_LIT57_data);
#define _OMC_LIT57 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT57)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT58,1,9) {&NFInstNode_InstNodeType_NORMAL__COMP__desc,}};
#define _OMC_LIT58 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT58)
#define _OMC_LIT59_data "i"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT59,1,_OMC_LIT59_data);
#define _OMC_LIT59 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT59)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT60,1,3) {&NFType_INTEGER__desc,}};
#define _OMC_LIT60 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT60)
#define _OMC_LIT61_data "$"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT61,1,_OMC_LIT61_data);
#define _OMC_LIT61 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT61)
#define _OMC_LIT62_data "$i"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT62,2,_OMC_LIT62_data);
#define _OMC_LIT62 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT62)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT63,1,3) {&NFClass_NOT__INSTANTIATED__desc,}};
#define _OMC_LIT63 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT63)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT64,1,3) {&NFInstNode_InstNodeType_NORMAL__CLASS__desc,}};
#define _OMC_LIT64 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT64)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT65,1,3) {&NFInstNode_CachedData_NO__CACHE__desc,}};
#define _OMC_LIT65 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT65)
#define _OMC_LIT66_data "NFInstNode.CachedData.addFunc: Invalid cache for function"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT66,57,_OMC_LIT66_data);
#define _OMC_LIT66 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT66)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT67_6,1.782113391e9);
#define _OMC_LIT67_6 MMC_REFREALLIT(_OMC_LIT_STRUCT67_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT67,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT5,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(186)),MMC_IMMEDIATE(MMC_TAGFIXNUM(11)),MMC_IMMEDIATE(MMC_TAGFIXNUM(186)),MMC_IMMEDIATE(MMC_TAGFIXNUM(92)),_OMC_LIT67_6}};
#define _OMC_LIT67 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT67)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT68,4,5) {&NFInstNode_CachedData_FUNCTION__desc,MMC_REFSTRUCTLIT(mmc_nil),MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */))}};
#define _OMC_LIT68 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT68)
#include "util/modelica.h"

#include "NFInstNode_includes.h"



DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getAccessLevel(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _access = NULL;
  modelica_metatype _scope = NULL;
  modelica_metatype _access_mod = NULL;
  modelica_metatype _access_exp = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _access = mmc_mk_none();
  // _scope has no default value.
  // _access_mod has no default value.
  // _access_exp has no default value.
  _scope = omc_NFInstNode_InstNode_classScope(threadData, omc_NFInstNode_InstNode_parent(threadData, omc_NFInstNode_InstNode_resolveInner(threadData, _node)));

  while(1)
  {
    if(!omc_NFInstNode_InstNode_isClass(threadData, _scope)) break;
    _access_mod = omc_SCodeUtil_lookupElementAnnotation(threadData, omc_NFInstNode_InstNode_definition(threadData, _scope), _OMC_LIT0);

    _access_mod = omc_SCodeUtil_lookupModInMod(threadData, _OMC_LIT1, _access_mod);

    _access_exp = omc_SCodeUtil_getModifierBinding(threadData, _access_mod);

    if(isSome(_access_exp))
    {
      _access = omc_NFPrefixes_accessLevelFromAbsyn(threadData, omc_Util_getOption(threadData, _access_exp));

      if(isSome(_access))
      {
        goto _return;
      }
    }

    _scope = omc_NFInstNode_InstNode_parent(threadData, _scope);
  }
  _return: OMC_LABEL_UNUSED
  return _access;
}

DLLDirection
void omc_NFInstNode_InstNode_clearGeneratedInners(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _inners = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _inners has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = omc_NFInstNode_InstNode_nodeType(threadData, omc_NFInstNode_InstNode_topScope(threadData, _node));
  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta1,4,2) == 0) MMC_THROW_INTERNAL();
  tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 3));
  _inners = tmpMeta2;

  omc_UnorderedMap_clear(threadData, _inners);
  _return: OMC_LABEL_UNUSED
  return;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isDiscreteClass(threadData_t *threadData, modelica_metatype _clsNode)
{
  modelica_boolean _isDiscrete;
  modelica_metatype _base_node = NULL;
  modelica_metatype _cls = NULL;
  modelica_metatype _exts = NULL;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isDiscrete has no default value.
  // _base_node has no default value.
  // _cls has no default value.
  // _exts has no default value.
  _base_node = omc_NFClass_lastBaseClass(threadData, _clsNode);

  _cls = omc_NFInstNode_InstNode_getClass(threadData, _base_node);

  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _cls;
    {
      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_boolean tmp8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,5) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 6));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,12,0) == 0) goto tmp3_end;
          /* Pattern matching succeeded */
          _exts = omc_NFClassTree_ClassTree_getExtends(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_cls), 2))));
          tmp7 = (modelica_boolean)(arrayLength(_exts) == ((modelica_integer) 1));
          if(tmp7)
          {
            /* Tail recursive call */
            _clsNode = arrayGet(_exts,((modelica_integer) 1)) /* DAE.ASUB */;
            goto _tailrecursive;
            /* TODO: Make sure any eventual dead code below is never generated */
          }
          else
          {
            tmp8 = 0 /* false */;
          }
          tmp1 = tmp8;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFType_isDiscrete(threadData, omc_NFClass_getType(threadData, _cls, _base_node));
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _isDiscrete = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isDiscrete;
}
modelica_metatype boxptr_NFInstNode_InstNode_isDiscreteClass(threadData_t *threadData, modelica_metatype _clsNode)
{
  modelica_boolean _isDiscrete;
  modelica_metatype out_isDiscrete;
  _isDiscrete = omc_NFInstNode_InstNode_isDiscreteClass(threadData, _clsNode);
  out_isDiscrete = mmc_mk_icon(_isDiscrete);
  return out_isDiscrete;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isExtends(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _res;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,1,5) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,1,3) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta7), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,5) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 2: {
          
          /* 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:;
    }
  }
  _res = tmp1;
  _return: OMC_LABEL_UNUSED
  return _res;
}
modelica_metatype boxptr_NFInstNode_InstNode_isExtends(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _res;
  modelica_metatype out_res;
  _res = omc_NFInstNode_InstNode_isExtends(threadData, _node);
  out_res = mmc_mk_icon(_res);
  return out_res;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_restriction(threadData_t *threadData, modelica_metatype _node)
{
  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 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFClass_restriction(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = omc_NFComponent_classInstance(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT2;
          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;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isClockType(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _clock;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _clock has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (5 != MMC_STRLEN(tmpMeta6) || strcmp(MMC_STRINGDATA(_OMC_LIT3), MMC_STRINGDATA(tmpMeta6)) != 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,3,0) == 0) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _clock = tmp1;
  _return: OMC_LABEL_UNUSED
  return _clock;
}
modelica_metatype boxptr_NFInstNode_InstNode_isClockType(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _clock;
  modelica_metatype out_clock;
  _clock = omc_NFInstNode_InstNode_isClockType(threadData, _node);
  out_clock = mmc_mk_icon(_clock);
  return out_clock;
}

DLLDirection
modelica_integer omc_NFInstNode_InstNode_dimensionCount(threadData_t *threadData, modelica_metatype _node)
{
  modelica_integer _count;
  modelica_integer tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _count has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_dimensionCount(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFClass_dimensionCount(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmp1 = ((modelica_integer) 0);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _count = tmp1;
  _return: OMC_LABEL_UNUSED
  return _count;
}
modelica_metatype boxptr_NFInstNode_InstNode_dimensionCount(threadData_t *threadData, modelica_metatype _node)
{
  modelica_integer _count;
  modelica_metatype out_count;
  _count = omc_NFInstNode_InstNode_dimensionCount(threadData, _node);
  out_count = mmc_mk_icon(_count);
  return out_count;
}

DLLDirection
modelica_integer omc_NFInstNode_InstNode_hashContinue(threadData_t *threadData, modelica_metatype _node, modelica_integer __omcQ_24in_5Fhash)
{
  modelica_integer _hash;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _hash = __omcQ_24in_5Fhash;
  _hash = stringHashDjb2Continue(omc_NFInstNode_InstNode_name(threadData, _node), _hash);
  _return: OMC_LABEL_UNUSED
  return _hash;
}
modelica_metatype boxptr_NFInstNode_InstNode_hashContinue(threadData_t *threadData, modelica_metatype _node, modelica_metatype __omcQ_24in_5Fhash)
{
  modelica_integer tmp1;
  modelica_integer _hash;
  modelica_metatype out_hash;
  tmp1 = mmc_unbox_integer(__omcQ_24in_5Fhash);
  _hash = omc_NFInstNode_InstNode_hashContinue(threadData, _node, tmp1);
  out_hash = mmc_mk_icon(_hash);
  return out_hash;
}

DLLDirection
modelica_integer omc_NFInstNode_InstNode_hash(threadData_t *threadData, modelica_metatype _node)
{
  modelica_integer _hash;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _hash = stringHashDjb2(omc_NFInstNode_InstNode_name(threadData, _node));
  _return: OMC_LABEL_UNUSED
  return _hash;
}
modelica_metatype boxptr_NFInstNode_InstNode_hash(threadData_t *threadData, modelica_metatype _node)
{
  modelica_integer _hash;
  modelica_metatype out_hash;
  _hash = omc_NFInstNode_InstNode_hash(threadData, _node);
  out_hash = mmc_mk_icon(_hash);
  return out_hash;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getSections(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _sections = NULL;
  modelica_metatype _cls = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _sections has no default value.
  _cls = omc_NFInstNode_InstNode_getClass(threadData, _node);
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _cls;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 8: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_cls), 4)));
          goto tmp3_done;
        }
        case 10: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_cls), 3)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(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:;
    }
  }
  _sections = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _sections;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getBindingExpOpt(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _binding_exp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _binding_exp has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      modelica_metatype _var = NULL;
      modelica_metatype _scope = NULL;
      int tmp4;
      // _var has no default value.
      // _scope has no default value.
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          _scope = omc_NFInstNode_InstNode_instanceParent(threadData, _node);

          { /* matchcontinue expression */
            {
              volatile mmc_switch_type tmp7;
              int tmp8;
              tmp7 = 0;
              MMC_TRY_INTERNAL(mmc_jumper)
              tmp6_top:
              threadData->mmc_jumper = &new_mmc_jumper;
              for (; tmp7 < 2; tmp7++) {
                switch (MMC_SWITCH_CAST(tmp7)) {
                case 0: {
                  /* Pattern matching succeeded */
                  _binding_exp = omc_NFBinding_getExpOpt(threadData, omc_NFComponent_getImplicitBinding(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))), _scope));
                  goto tmp6_done;
                }
                case 1: {
                  /* Pattern matching succeeded */
                  _binding_exp = omc_NFInstNode_InstNode_getBindingExpOpt(threadData, _scope);
                  goto tmp6_done;
                }
                }
                goto tmp6_end;
                tmp6_end: ;
              }
              goto goto_5;
              tmp6_done:
              (void)tmp7;
              MMC_RESTORE_INTERNAL(mmc_jumper);
              goto tmp6_done2;
              goto_5:;
              MMC_CATCH_INTERNAL(mmc_jumper);
              if (++tmp7 < 2) {
                goto tmp6_top;
              }
              goto goto_2;
              tmp6_done2:;
            }
          }
          ;
          tmpMeta1 = _binding_exp;
          goto tmp3_done;
        }
        case 10: {
          
          /* Pattern matching succeeded */
          _var = omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3))));
          tmpMeta1 = omc_NFBinding_getExpOpt(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_var), 4))));
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = mmc_mk_none();
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _binding_exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _binding_exp;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_hasBinding(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _hasBinding;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _hasBinding has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = (omc_NFComponent_hasBinding(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))), _OMC_LIT7) || omc_NFInstNode_InstNode_hasBinding(threadData, omc_NFInstNode_InstNode_instanceParent(threadData, _node)));
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _hasBinding = tmp1;
  _return: OMC_LABEL_UNUSED
  return _hasBinding;
}
modelica_metatype boxptr_NFInstNode_InstNode_hasBinding(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _hasBinding;
  modelica_metatype out_hasBinding;
  _hasBinding = omc_NFInstNode_InstNode_hasBinding(threadData, _node);
  out_hasBinding = mmc_mk_icon(_hasBinding);
  return out_hasBinding;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isEnumerationType(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isEnum;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _isEnum = (omc_NFInstNode_InstNode_isClass(threadData, _node) && omc_NFClass_isEnumeration(threadData, omc_NFInstNode_InstNode_getClass(threadData, omc_NFInstNode_InstNode_resolveInner(threadData, _node))));
  _return: OMC_LABEL_UNUSED
  return _isEnum;
}
modelica_metatype boxptr_NFInstNode_InstNode_isEnumerationType(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isEnum;
  modelica_metatype out_isEnum;
  _isEnum = omc_NFInstNode_InstNode_isEnumerationType(threadData, _node);
  out_isEnum = mmc_mk_icon(_isEnum);
  return out_isEnum;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isModel(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isModel;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isModel has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFRestriction_isModel(threadData, omc_NFClass_restriction(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = omc_NFComponent_classInstance(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          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:;
    }
  }
  _isModel = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isModel;
}
modelica_metatype boxptr_NFInstNode_InstNode_isModel(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isModel;
  modelica_metatype out_isModel;
  _isModel = omc_NFInstNode_InstNode_isModel(threadData, _node);
  out_isModel = mmc_mk_icon(_isModel);
  return out_isModel;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isRecord(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isRec;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isRec has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFRestriction_isRecord(threadData, omc_NFClass_restriction(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = omc_NFComponent_classInstance(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          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:;
    }
  }
  _isRec = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isRec;
}
modelica_metatype boxptr_NFInstNode_InstNode_isRecord(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isRec;
  modelica_metatype out_isRec;
  _isRec = omc_NFInstNode_InstNode_isRecord(threadData, _node);
  out_isRec = mmc_mk_icon(_isRec);
  return out_isRec;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_copyInstancePtr(threadData_t *threadData, modelica_metatype _srcNode, modelica_metatype __omcQ_24in_5FdstNode)
{
  modelica_metatype _dstNode = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _dstNode = __omcQ_24in_5FdstNode;
  { /* match expression */
    modelica_metatype tmp3_1;modelica_metatype tmp3_2;
    tmp3_1 = _srcNode;
    tmp3_2 = _dstNode;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,6) == 0) goto tmp2_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,6) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_dstNode), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[5] = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_srcNode), 5)));
          _dstNode = tmpMeta5;
          goto tmp2_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,7) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta6), MMC_UNTAGPTR(_dstNode), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta6))[5] = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_srcNode), 5)));
          _dstNode = tmpMeta6;
          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 _dstNode;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getComments(threadData_t *threadData, modelica_metatype _node, modelica_metatype _accumCmts)
{
  modelica_metatype _cmts = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _cmts has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      modelica_metatype _cmt = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _cmt 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,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,2,8) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 8));
          
          _cmt = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta8 = mmc_mk_cons(_cmt, omc_NFClass_getDerivedComments(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))), _accumCmts));
          tmpMeta1 = tmpMeta8;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _accumCmts;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _cmts = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _cmts;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_cloneComponent(threadData_t *threadData, modelica_metatype _component, modelica_metatype _newParent)
{
  modelica_metatype _outComponent = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outComponent has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _component;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 1; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_box7(4, &NFInstNode_InstNode_COMPONENT__NODE__desc, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_component), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_component), 3))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_component), 4))), omc_Pointer_create(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_component), 5))))), _newParent, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_component), 7))));
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outComponent = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outComponent;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_clone(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      modelica_metatype _cls = NULL;
      modelica_metatype _comp = NULL;
      int tmp3;
      // _cls has no default value.
      // _comp has no default value.
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
        case 3: {
          modelica_metatype tmpMeta4;
          modelica_metatype tmpMeta5;
          
          /* Pattern matching succeeded */
          _cls = omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))));

          _cls = omc_NFClass_classTreeApply(threadData, _cls, boxvar_NFClassTree_ClassTree_clone);

          tmpMeta4 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta4), MMC_UNTAGPTR(_node), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta4))[5] = omc_Pointer_create(threadData, _cls);
          _node = tmpMeta4;

          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_node), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[6] = omc_NFInstNode_CachedData_empty(threadData);
          _node = tmpMeta5;
          goto tmp2_done;
        }
        case 4: {
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          _comp = omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))));

          _comp = omc_NFComponent_setClassInstance(threadData, omc_NFInstNode_InstNode_clone(threadData, omc_NFComponent_classInstance(threadData, _comp)), _comp);

          tmpMeta6 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta6), MMC_UNTAGPTR(_node), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta6))[5] = omc_Pointer_create(threadData, _comp);
          _node = tmpMeta6;
          goto tmp2_done;
        }
        default:
        tmp2_default: OMC_LABEL_UNUSED; {
          
          /* 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 _node;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isPartial(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isPartial;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isPartial has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFClass_isPartial(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isPartial = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isPartial;
}
modelica_metatype boxptr_NFInstNode_InstNode_isPartial(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isPartial;
  modelica_metatype out_isPartial;
  _isPartial = omc_NFInstNode_InstNode_isPartial(threadData, _node);
  out_isPartial = mmc_mk_icon(_isPartial);
  return out_isPartial;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isBuiltinNodeType(threadData_t *threadData, modelica_metatype _nodeType)
{
  modelica_boolean _isBuiltin;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isBuiltin has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _nodeType;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 6: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _nodeType = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_nodeType), 4)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          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:;
    }
  }
  _isBuiltin = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isBuiltin;
}
modelica_metatype boxptr_NFInstNode_InstNode_isBuiltinNodeType(threadData_t *threadData, modelica_metatype _nodeType)
{
  modelica_boolean _isBuiltin;
  modelica_metatype out_isBuiltin;
  _isBuiltin = omc_NFInstNode_InstNode_isBuiltinNodeType(threadData, _nodeType);
  out_isBuiltin = mmc_mk_icon(_isBuiltin);
  return out_isBuiltin;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isBuiltin(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isBuiltin;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isBuiltin has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFInstNode_InstNode_isBuiltinNodeType(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 8))));
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isBuiltin = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isBuiltin;
}
modelica_metatype boxptr_NFInstNode_InstNode_isBuiltin(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isBuiltin;
  modelica_metatype out_isBuiltin;
  _isBuiltin = omc_NFInstNode_InstNode_isBuiltin(threadData, _node);
  out_isBuiltin = mmc_mk_icon(_isBuiltin);
  return out_isBuiltin;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_toFullDAEType(threadData_t *threadData, modelica_metatype _clsNode)
{
  modelica_metatype _outType = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outType has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _clsNode;
    {
      modelica_metatype _cls = NULL;
      modelica_metatype _vars = NULL;
      modelica_metatype _state = NULL;
      modelica_metatype _res = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _cls has no default value.
      // _vars has no default value.
      // _state has no default value.
      // _res has no default value.
      tmp4 = 0;
      for (; tmp4 < 1; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _cls = omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_clsNode), 5))));
          { /* match expression */
            modelica_metatype tmp9_1;
            tmp9_1 = _cls;
            {
              volatile mmc_switch_type tmp9;
              int tmp10;
              tmp9 = 0;
              for (; tmp9 < 2; tmp9++) {
                switch (MMC_SWITCH_CAST(tmp9)) {
                case 0: {
                  if (mmc__uniontype__metarecord__typedef__equal(tmp9_1,8,1) == 0) goto tmp8_end;
                  
                  /* Pattern matching succeeded */
                  tmpMeta6 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_cls), 2)));
                  goto tmp8_done;
                }
                case 1: {
                  modelica_metatype tmpMeta11;
                  modelica_metatype tmpMeta12;
                  
                  /* Pattern matching succeeded */
                  _res = omc_NFClass_restriction(threadData, _cls);

                  _state = omc_NFRestriction_toDAE(threadData, _res, omc_NFInstNode_InstNode_fullPath(threadData, _clsNode, 0 /* false */));

                  _vars = omc_NFConvertDAE_makeTypeVars(threadData, _clsNode);

                  tmpMeta11 = mmc_mk_box5(12, &DAE_Type_T__COMPLEX__desc, _state, _vars, mmc_mk_none(), mmc_mk_boolean(omc_NFRestriction_isExternalRecord(threadData, _res)));
                  _outType = tmpMeta11;

                  tmpMeta12 = mmc_mk_box2(11, &NFClass_DAE__TYPE__desc, _outType);
                  omc_Pointer_update(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_clsNode), 5))), tmpMeta12);
                  tmpMeta6 = _outType;
                  goto tmp8_done;
                }
                }
                goto tmp8_end;
                tmp8_end: ;
              }
              goto goto_7;
              goto_7:;
              goto goto_2;
              goto tmp8_done;
              tmp8_done:;
            }
          }tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outType = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outType;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_stripDAETypeVars(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fty)
{
  modelica_metatype _ty = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _ty = __omcQ_24in_5Fty;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _ty;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,9,4) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(6));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_ty), 6*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[3] = tmpMeta6;
          _ty = tmpMeta5;
          goto tmp2_done;
        }
        case 1: {
          
          /* 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 _ty;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_toPartialDAEType(threadData_t *threadData, modelica_metatype _clsNode)
{
  modelica_metatype _outType = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outType has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _clsNode;
    {
      modelica_metatype _cls = NULL;
      modelica_metatype _state = NULL;
      modelica_metatype _res = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _cls has no default value.
      // _state has no default value.
      // _res has no default value.
      tmp4 = 0;
      for (; tmp4 < 1; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _cls = omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_clsNode), 5))));
          { /* match expression */
            modelica_metatype tmp9_1;
            tmp9_1 = _cls;
            {
              volatile mmc_switch_type tmp9;
              int tmp10;
              tmp9 = 0;
              for (; tmp9 < 2; tmp9++) {
                switch (MMC_SWITCH_CAST(tmp9)) {
                case 0: {
                  if (mmc__uniontype__metarecord__typedef__equal(tmp9_1,8,1) == 0) goto tmp8_end;
                  
                  /* Pattern matching succeeded */
                  tmpMeta6 = omc_NFInstNode_InstNode_stripDAETypeVars(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_cls), 2))));
                  goto tmp8_done;
                }
                case 1: {
                  modelica_metatype tmpMeta11;
                  modelica_metatype tmpMeta12;
                  
                  /* Pattern matching succeeded */
                  _res = omc_NFClass_restriction(threadData, _cls);

                  _state = omc_NFRestriction_toDAE(threadData, _res, omc_NFInstNode_InstNode_fullPath(threadData, _clsNode, 0 /* false */));
                  tmpMeta11 = MMC_REFSTRUCTLIT(mmc_nil);
                  tmpMeta12 = mmc_mk_box5(12, &DAE_Type_T__COMPLEX__desc, _state, tmpMeta11, mmc_mk_none(), mmc_mk_boolean(omc_NFRestriction_isExternalRecord(threadData, _res)));
                  tmpMeta6 = tmpMeta12;
                  goto tmp8_done;
                }
                }
                goto tmp8_end;
                tmp8_end: ;
              }
              goto goto_7;
              goto_7:;
              goto goto_2;
              goto tmp8_done;
              tmp8_done:;
            }
          }tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outType = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outType;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_setModifier(threadData_t *threadData, modelica_metatype _mod, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      int tmp3;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          omc_Pointer_update(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))), omc_NFClass_setModifier(threadData, _mod, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))));
          goto tmp2_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          omc_Pointer_update(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))), omc_NFComponent_mergeModifier(threadData, _mod, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))));
          goto tmp2_done;
        }
        default:
        tmp2_default: OMC_LABEL_UNUSED; {
          
          /* 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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_mergeModifier(threadData_t *threadData, modelica_metatype _mod, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      int tmp3;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          omc_Pointer_update(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))), omc_NFClass_mergeModifier(threadData, _mod, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))));
          goto tmp2_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          omc_Pointer_update(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))), omc_NFComponent_mergeModifier(threadData, _mod, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))));
          goto tmp2_done;
        }
        default:
        tmp2_default: OMC_LABEL_UNUSED; {
          
          /* 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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getModifier(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _mod = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _mod has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFClass_getModifier(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFComponent_getModifier(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT8;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _mod = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _mod;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isEncapsulated(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _enc;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _enc has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFClass_isEncapsulated(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFClass_isEncapsulated(threadData, omc_NFInstNode_InstNode_getClass(threadData, _node));
          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:;
    }
  }
  _enc = tmp1;
  _return: OMC_LABEL_UNUSED
  return _enc;
}
modelica_metatype boxptr_NFInstNode_InstNode_isEncapsulated(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _enc;
  modelica_metatype out_enc;
  _enc = omc_NFInstNode_InstNode_isEncapsulated(threadData, _node);
  out_enc = mmc_mk_icon(_enc);
  return out_enc;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_protect(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 3; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          modelica_integer tmp6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,6) == 0) goto tmp2_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
          tmp6 = mmc_unbox_integer(tmpMeta5);
          if (1 != tmp6) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta7 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta7), MMC_UNTAGPTR(_node), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta7))[4] = mmc_mk_integer(2);
          _node = tmpMeta7;
          goto tmp2_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_integer tmp9;
          modelica_metatype tmpMeta10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
          tmp9 = mmc_unbox_integer(tmpMeta8);
          if (1 != tmp9) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta10 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta10), MMC_UNTAGPTR(_node), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta10))[4] = mmc_mk_integer(2);
          _node = tmpMeta10;
          goto tmp2_done;
        }
        case 2: {
          
          /* 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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_protectComponent(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fcomp)
{
  modelica_metatype _comp = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _comp = __omcQ_24in_5Fcomp;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _comp;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          modelica_integer tmp6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,6) == 0) goto tmp2_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
          tmp6 = mmc_unbox_integer(tmpMeta5);
          if (1 != tmp6) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta7 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta7), MMC_UNTAGPTR(_comp), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta7))[4] = mmc_mk_integer(2);
          _comp = tmpMeta7;
          goto tmp2_done;
        }
        case 1: {
          
          /* 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 _comp;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_protectClass(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fcls)
{
  modelica_metatype _cls = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _cls = __omcQ_24in_5Fcls;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _cls;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          modelica_integer tmp6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
          tmp6 = mmc_unbox_integer(tmpMeta5);
          if (1 != tmp6) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta7 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta7), MMC_UNTAGPTR(_cls), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta7))[4] = mmc_mk_integer(2);
          _cls = tmpMeta7;
          goto tmp2_done;
        }
        case 1: {
          
          /* 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 _cls;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isPublic(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isPublic;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _isPublic = (!omc_NFInstNode_InstNode_isProtected(threadData, _node));
  _return: OMC_LABEL_UNUSED
  return _isPublic;
}
modelica_metatype boxptr_NFInstNode_InstNode_isPublic(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isPublic;
  modelica_metatype out_isPublic;
  _isPublic = omc_NFInstNode_InstNode_isPublic(threadData, _node);
  out_isPublic = mmc_mk_icon(_isPublic);
  return out_isPublic;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isProtected(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isProtected;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isProtected has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_integer tmp7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmp7 = mmc_unbox_integer(tmpMeta6);
          if (2 != tmp7) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          modelica_integer tmp9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 4));
          tmp9 = mmc_unbox_integer(tmpMeta8);
          if (2 != tmp9) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 2: {
          
          /* 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:;
    }
  }
  _isProtected = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isProtected;
}
modelica_metatype boxptr_NFInstNode_InstNode_isProtected(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isProtected;
  modelica_metatype out_isProtected;
  _isProtected = omc_NFInstNode_InstNode_isProtected(threadData, _node);
  out_isProtected = mmc_mk_icon(_isProtected);
  return out_isProtected;
}

DLLDirection
modelica_integer omc_NFInstNode_InstNode_visibility(threadData_t *threadData, modelica_metatype _node)
{
  modelica_integer _vis;
  modelica_integer tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _vis has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 4))));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 4))));
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmp1 = 1;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _vis = tmp1;
  _return: OMC_LABEL_UNUSED
  return _vis;
}
modelica_metatype boxptr_NFInstNode_InstNode_visibility(threadData_t *threadData, modelica_metatype _node)
{
  modelica_integer _vis;
  modelica_metatype out_vis;
  _vis = omc_NFInstNode_InstNode_visibility(threadData, _node);
  out_vis = mmc_mk_icon(_vis);
  return out_vis;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isProtectedBaseClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isProtected;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isProtected has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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 (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,1,3) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,1,5) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta7), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta8,1,0) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isProtected = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isProtected;
}
modelica_metatype boxptr_NFInstNode_InstNode_isProtectedBaseClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isProtected;
  modelica_metatype out_isProtected;
  _isProtected = omc_NFInstNode_InstNode_isProtectedBaseClass(threadData, _node);
  out_isProtected = mmc_mk_icon(_isProtected);
  return out_isProtected;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isReplaceable(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _repl;
  modelica_metatype _elem = NULL;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _repl has no default value.
  // _elem has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = omc_SCodeUtil_isElementReplaceable(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3))));
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (optionNone(tmpMeta6)) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 1));
          
          _elem = tmpMeta7;
          /* Pattern matching succeeded */
          tmp1 = omc_SCodeUtil_isElementReplaceable(threadData, _elem);
          goto tmp3_done;
        }
        case 2: {
          
          /* 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:;
    }
  }
  _repl = tmp1;
  _return: OMC_LABEL_UNUSED
  return _repl;
}
modelica_metatype boxptr_NFInstNode_InstNode_isReplaceable(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _repl;
  modelica_metatype out_repl;
  _repl = omc_NFInstNode_InstNode_isReplaceable(threadData, _node);
  out_repl = mmc_mk_icon(_repl);
  return out_repl;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getRedeclaredNode(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _outNode = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outNode has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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 (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,8,3) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 4));
          if (optionNone(tmpMeta7)) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta7), 1));
          _outNode = tmpMeta8;
          /* Pattern matching succeeded */
          tmpMeta1 = _outNode;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outNode = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outNode;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isRedeclared(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _redeclared;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _redeclared has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = omc_NFInstNode_InstNode_nodeType(threadData, _node);
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 10: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 11: {
          
          /* 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:;
    }
  }
  _redeclared = tmp1;
  _return: OMC_LABEL_UNUSED
  return _redeclared;
}
modelica_metatype boxptr_NFInstNode_InstNode_isRedeclared(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _redeclared;
  modelica_metatype out_redeclared;
  _redeclared = omc_NFInstNode_InstNode_isRedeclared(threadData, _node);
  out_redeclared = mmc_mk_icon(_redeclared);
  return out_redeclared;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isRedeclare(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isRedeclare;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isRedeclare has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_SCodeUtil_isElementRedeclare(threadData, omc_NFInstNode_InstNode_definition(threadData, _node));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_isRedeclare(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          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:;
    }
  }
  _isRedeclare = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isRedeclare;
}
modelica_metatype boxptr_NFInstNode_InstNode_isRedeclare(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isRedeclare;
  modelica_metatype out_isRedeclare;
  _isRedeclare = omc_NFInstNode_InstNode_isRedeclare(threadData, _node);
  out_isRedeclare = mmc_mk_icon(_isRedeclare);
  return out_isRedeclare;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_toFlatStream(threadData_t *threadData, modelica_metatype _node, modelica_metatype _format, modelica_string _indent, modelica_metatype __omcQ_24in_5Fs)
{
  modelica_metatype _s = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _s = __omcQ_24in_5Fs;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFComponent_toFlatStream(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2))), omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))), _format, _indent, _s);
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFClass_toFlatStream(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))), _node, _format, _indent, _s);
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_IOStream_append(threadData, _s, omc_NFInstNode_InstNode_toFlatString(threadData, _node, _format, _indent));
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _s = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _s;
}

DLLDirection
modelica_string omc_NFInstNode_InstNode_toFlatString(threadData_t *threadData, modelica_metatype _node, modelica_metatype _format, modelica_string _indent)
{
  modelica_string _name = NULL;
  modelica_string tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _name has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_toFlatString(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2))), omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))), _format, _indent);
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFClass_toFlatString(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))), _node, _format, _indent);
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFInstNode_InstNode_name(threadData, _node);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _name = tmp1;
  _return: OMC_LABEL_UNUSED
  return _name;
}

DLLDirection
modelica_string omc_NFInstNode_InstNode_toString(threadData_t *threadData, modelica_metatype _node)
{
  modelica_string _name = NULL;
  modelica_string tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _name has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_toString(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2))), omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_SCodeDump_unparseElementStr(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3))), _OMC_LIT9);
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFInstNode_InstNode_name(threadData, _node);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _name = tmp1;
  _return: OMC_LABEL_UNUSED
  return _name;
}

DLLDirection
void omc_NFInstNode_InstNode_checkIdentical(threadData_t *threadData, modelica_metatype _node1, modelica_metatype _node2)
{
  jmp_buf *old_mmc_jumper = threadData->mmc_jumper;
  modelica_metatype _n1 = NULL;
  modelica_metatype _n2 = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _n1 = omc_NFInstNode_InstNode_resolveOuter(threadData, _node1);
  _n2 = omc_NFInstNode_InstNode_resolveOuter(threadData, _node2);
  if(referenceEq(_n1, _n2))
  {
    goto _return;
  }

  { /* matchcontinue expression */
    volatile modelica_metatype tmp3_1;volatile modelica_metatype tmp3_2;
    tmp3_1 = _n1;
    tmp3_2 = _n2;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp2_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp3 < 3; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,7) == 0) goto tmp2_end;
          
          tmp3 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          /* Check guard condition after assignments */
          if (!omc_NFClass_isIdentical(threadData, omc_NFInstNode_InstNode_getClass(threadData, _n1), omc_NFInstNode_InstNode_getClass(threadData, _n2))) goto tmp2_end;
          goto tmp2_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,6) == 0) goto tmp2_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,6) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_NFComponent_isIdentical(threadData, omc_NFInstNode_InstNode_component(threadData, _n1), omc_NFInstNode_InstNode_component(threadData, _n2))) goto tmp2_end;
          goto tmp2_done;
        }
        case 2: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          tmpMeta5 = mmc_mk_cons(omc_NFInstNode_InstNode_toString(threadData, _n1), mmc_mk_cons(omc_NFInstNode_InstNode_toString(threadData, _n2), MMC_REFSTRUCTLIT(mmc_nil)));
          tmpMeta6 = mmc_mk_cons(omc_NFInstNode_InstNode_info(threadData, _n1), mmc_mk_cons(omc_NFInstNode_InstNode_info(threadData, _n2), MMC_REFSTRUCTLIT(mmc_nil)));
          omc_Error_addMultiSourceMessage(threadData, _OMC_LIT13, tmpMeta5, tmpMeta6);
          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 < 3) {
        goto tmp2_top;
      }
      MMC_THROW_INTERNAL();
      tmp2_done2:;
    }
  }
  ;
  _return: OMC_LABEL_UNUSED
  threadData->mmc_jumper = old_mmc_jumper;
  return;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isSame(threadData_t *threadData, modelica_metatype _node1, modelica_metatype _node2)
{
  jmp_buf *old_mmc_jumper = threadData->mmc_jumper;
  modelica_boolean _same;
  modelica_metatype _n1 = NULL;
  modelica_metatype _n2 = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _same = 0 /* false */;
  _n1 = omc_NFInstNode_InstNode_resolveOuter(threadData, _node1);
  _n2 = omc_NFInstNode_InstNode_resolveOuter(threadData, _node2);
  if(referenceEq(_n1, _n2))
  {
    _same = 1 /* true */;

    goto _return;
  }

  { /* 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 */
          _same = referenceEq(omc_NFInstNode_InstNode_definition(threadData, _node1), omc_NFInstNode_InstNode_definition(threadData, _node2));
          goto tmp2_done;
        }
        case 1: {
          /* Pattern matching succeeded */
          _same = 0 /* false */;
          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
  threadData->mmc_jumper = old_mmc_jumper;
  return _same;
}
modelica_metatype boxptr_NFInstNode_InstNode_isSame(threadData_t *threadData, modelica_metatype _node1, modelica_metatype _node2)
{
  modelica_boolean _same;
  modelica_metatype out_same;
  _same = omc_NFInstNode_InstNode_isSame(threadData, _node1, _node2);
  out_same = mmc_mk_icon(_same);
  return out_same;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_nameEqual(threadData_t *threadData, modelica_metatype _node1, modelica_metatype _node2)
{
  modelica_boolean _equal;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _equal = (stringEqual(omc_NFInstNode_InstNode_name(threadData, _node1), omc_NFInstNode_InstNode_name(threadData, _node2)));
  _return: OMC_LABEL_UNUSED
  return _equal;
}
modelica_metatype boxptr_NFInstNode_InstNode_nameEqual(threadData_t *threadData, modelica_metatype _node1, modelica_metatype _node2)
{
  modelica_boolean _equal;
  modelica_metatype out_equal;
  _equal = omc_NFInstNode_InstNode_nameEqual(threadData, _node1, _node2);
  out_equal = mmc_mk_icon(_equal);
  return out_equal;
}

DLLDirection
modelica_integer omc_NFInstNode_InstNode_refCompare(threadData_t *threadData, modelica_metatype _node1, modelica_metatype _node2)
{
  modelica_integer _res;
  modelica_integer tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;
    tmp4_1 = _node1;
    tmp4_2 = _node2;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = omc_Util_referenceCompare(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node1), 5)))), omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node2), 5)))));
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = omc_Util_referenceCompare(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node1), 5)))), omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node2), 5)))));
          goto tmp3_done;
        }
        case 2: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = omc_Util_referenceCompare(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node1), 5)))), omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node2), 5)))));
          goto tmp3_done;
        }
        case 3: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = omc_Util_referenceCompare(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node1), 5)))), omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node2), 5)))));
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _res = tmp1;
  _return: OMC_LABEL_UNUSED
  return _res;
}
modelica_metatype boxptr_NFInstNode_InstNode_refCompare(threadData_t *threadData, modelica_metatype _node1, modelica_metatype _node2)
{
  modelica_integer _res;
  modelica_metatype out_res;
  _res = omc_NFInstNode_InstNode_refCompare(threadData, _node1, _node2);
  out_res = mmc_mk_icon(_res);
  return out_res;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_refEqual(threadData_t *threadData, modelica_metatype _node1, modelica_metatype _node2)
{
  modelica_boolean _refEqual;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _refEqual has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;
    tmp4_1 = _node1;
    tmp4_2 = _node2;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = referenceEq(omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node1), 5)))), omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node2), 5)))));
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = referenceEq(omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node1), 5)))), omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node2), 5)))));
          goto tmp3_done;
        }
        case 2: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,2) == 0) goto tmp3_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,7,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = referenceEq(omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node1), 3)))), omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node2), 3)))));
          goto tmp3_done;
        }
        case 3: {
          
          /* 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:;
    }
  }
  _refEqual = tmp1;
  _return: OMC_LABEL_UNUSED
  return _refEqual;
}
modelica_metatype boxptr_NFInstNode_InstNode_refEqual(threadData_t *threadData, modelica_metatype _node1, modelica_metatype _node2)
{
  modelica_boolean _refEqual;
  modelica_metatype out_refEqual;
  _refEqual = omc_NFInstNode_InstNode_refEqual(threadData, _node1, _node2);
  out_refEqual = mmc_mk_icon(_refEqual);
  return out_refEqual;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_addIterator(threadData_t *threadData, modelica_metatype _iterator, modelica_metatype __omcQ_24in_5Fscope)
{
  modelica_metatype _scope = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _scope = __omcQ_24in_5Fscope;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _scope;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 1; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_cons(_iterator, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_scope), 3))));
          tmpMeta7 = mmc_mk_box3(8, &NFInstNode_InstNode_IMPLICIT__SCOPE__desc, _scope, tmpMeta6);
          tmpMeta1 = tmpMeta7;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _scope = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _scope;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_explicitScope(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _scope = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _scope has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _scope = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _scope;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_openImplicitScope(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fscope)
{
  modelica_metatype _scope = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _scope = __omcQ_24in_5Fscope;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _scope;
    {
      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,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _scope;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          
          /* Pattern matching succeeded */
          tmpMeta6 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta7 = mmc_mk_box3(8, &NFInstNode_InstNode_IMPLICIT__SCOPE__desc, _scope, tmpMeta6);
          tmpMeta1 = tmpMeta7;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _scope = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _scope;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_clearPackageCache(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          omc_NFInstNode_CachedData_clearPackageCache(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6))));
          goto tmp2_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT14, _OMC_LIT15);
          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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_setPackageCache(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode, modelica_metatype _packageNode, modelica_integer _state)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta5 = mmc_mk_box3(4, &NFInstNode_CachedData_PACKAGE__desc, _packageNode, mmc_mk_integer((modelica_integer)_state));
          omc_NFInstNode_CachedData_setPackageCache(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6))), tmpMeta5);
          goto tmp2_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT16, _OMC_LIT17);
          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 _node;
}
modelica_metatype boxptr_NFInstNode_InstNode_setPackageCache(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode, modelica_metatype _packageNode, modelica_metatype _state)
{
  modelica_integer tmp1;
  modelica_metatype _node = NULL;
  tmp1 = mmc_unbox_integer(_state);
  _node = omc_NFInstNode_InstNode_setPackageCache(threadData, __omcQ_24in_5Fnode, _packageNode, tmp1);
  /* skip box _node; NFInstNode.InstNode */
  return _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getPackageCache(threadData_t *threadData, modelica_metatype _inNode)
{
  modelica_metatype _pack_cache = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _pack_cache has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inNode;
    {
      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,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_CachedData_getPackageCache(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inNode), 6))));
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT18, _OMC_LIT19);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _pack_cache = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _pack_cache;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_setFuncCache(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode, modelica_metatype _in_func_cache)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          omc_NFInstNode_CachedData_setFuncCache(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6))), _in_func_cache);
          goto tmp2_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT20, _OMC_LIT21);
          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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getFuncCache(threadData_t *threadData, modelica_metatype _inNode)
{
  modelica_metatype _func_cache = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _func_cache has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _inNode;
    {
      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,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_CachedData_getFuncCache(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inNode), 6))));
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT22, _OMC_LIT23);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _func_cache = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _func_cache;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_newFuncCache(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode, modelica_metatype _in_func_cache)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_node), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[6] = arrayCreate(((modelica_integer) 1), _in_func_cache);
          _node = tmpMeta5;
          goto tmp2_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT24, _OMC_LIT25);
          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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_cacheAddFunc(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode, modelica_metatype _fn, modelica_boolean _specialBuiltin)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          omc_NFInstNode_CachedData_addFunc(threadData, _fn, _specialBuiltin, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6))));
          goto tmp2_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT26, _OMC_LIT27);
          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 _node;
}
modelica_metatype boxptr_NFInstNode_InstNode_cacheAddFunc(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode, modelica_metatype _fn, modelica_metatype _specialBuiltin)
{
  modelica_integer tmp1;
  modelica_metatype _node = NULL;
  tmp1 = mmc_unbox_integer(_specialBuiltin);
  _node = omc_NFInstNode_InstNode_cacheAddFunc(threadData, __omcQ_24in_5Fnode, _fn, tmp1);
  /* skip box _node; NFInstNode.InstNode */
  return _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_cacheInitFunc(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          omc_NFInstNode_CachedData_initFunc(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6))));
          goto tmp2_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT28, _OMC_LIT29);
          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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_resolveOuter(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _outerNode = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outerNode has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,2,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3)));
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outerNode = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outerNode;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_resolveInner(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _innerNode = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _innerNode has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,2,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _innerNode = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _innerNode;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isGeneratedInner(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isInner;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isInner has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,9,0) == 0) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 7));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,9,0) == 0) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 2: {
          
          /* 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:;
    }
  }
  _isInner = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isInner;
}
modelica_metatype boxptr_NFInstNode_InstNode_isGeneratedInner(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isInner;
  modelica_metatype out_isInner;
  _isInner = omc_NFInstNode_InstNode_isGeneratedInner(threadData, _node);
  out_isInner = mmc_mk_icon(_isInner);
  return out_isInner;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isInnerOuterNode(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isIO;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isIO has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,2,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isIO = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isIO;
}
modelica_metatype boxptr_NFInstNode_InstNode_isInnerOuterNode(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isIO;
  modelica_metatype out_isIO;
  _isIO = omc_NFInstNode_InstNode_isInnerOuterNode(threadData, _node);
  out_isIO = mmc_mk_icon(_isIO);
  return out_isIO;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isOnlyOuter(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isOuter;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isOuter has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_isOnlyOuter(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_AbsynUtil_isOnlyOuter(threadData, omc_SCodeUtil_prefixesInnerOuter(threadData, omc_SCodeUtil_elementPrefixes(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3))))));
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          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:;
    }
  }
  _isOuter = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isOuter;
}
modelica_metatype boxptr_NFInstNode_InstNode_isOnlyOuter(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isOuter;
  modelica_metatype out_isOuter;
  _isOuter = omc_NFInstNode_InstNode_isOnlyOuter(threadData, _node);
  out_isOuter = mmc_mk_icon(_isOuter);
  return out_isOuter;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isOuter(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isOuter;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isOuter has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_isOuter(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_AbsynUtil_isOuter(threadData, omc_SCodeUtil_prefixesInnerOuter(threadData, omc_SCodeUtil_elementPrefixes(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3))))));
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          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:;
    }
  }
  _isOuter = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isOuter;
}
modelica_metatype boxptr_NFInstNode_InstNode_isOuter(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isOuter;
  modelica_metatype out_isOuter;
  _isOuter = omc_NFInstNode_InstNode_isOuter(threadData, _node);
  out_isOuter = mmc_mk_icon(_isOuter);
  return out_isOuter;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isInner(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isInner;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isInner has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_isInner(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_AbsynUtil_isInner(threadData, omc_SCodeUtil_prefixesInnerOuter(threadData, omc_SCodeUtil_elementPrefixes(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3))))));
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          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:;
    }
  }
  _isInner = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isInner;
}
modelica_metatype boxptr_NFInstNode_InstNode_isInner(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isInner;
  modelica_metatype out_isInner;
  _isInner = omc_NFInstNode_InstNode_isInner(threadData, _node);
  out_isInner = mmc_mk_icon(_isInner);
  return out_isInner;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isOutput(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isOutput;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isOutput has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_isOutput(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isOutput = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isOutput;
}
modelica_metatype boxptr_NFInstNode_InstNode_isOutput(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isOutput;
  modelica_metatype out_isOutput;
  _isOutput = omc_NFInstNode_InstNode_isOutput(threadData, _node);
  out_isOutput = mmc_mk_icon(_isOutput);
  return out_isOutput;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isInput(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isInput;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isInput has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_isInput(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isInput = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isInput;
}
modelica_metatype boxptr_NFInstNode_InstNode_isInput(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isInput;
  modelica_metatype out_isInput;
  _isInput = omc_NFInstNode_InstNode_isInput(threadData, _node);
  out_isInput = mmc_mk_icon(_isInput);
  return out_isInput;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_scopePathClass(threadData_t *threadData, modelica_metatype _node, modelica_metatype _ty, modelica_integer _scopeType, modelica_metatype _accumPath)
{
  modelica_metatype _path = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _path has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _ty;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          modelica_metatype tmpMeta5;
          
          /* Pattern matching succeeded */
          tmpMeta5 = mmc_mk_box3(3, &Absyn_Path_QUALIFIED__desc, omc_NFInstNode_InstNode_className(threadData, _node), _accumPath);
          tmpMeta1 = omc_NFInstNode_InstNode_scopePath2(threadData, omc_NFInstNode_InstNode_classParent(threadData, _node), (modelica_integer)_scopeType, tmpMeta5);
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_scopePath2(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2))), (modelica_integer)_scopeType, _accumPath);
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _ty = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2)));
          _scopeType = (modelica_integer)_scopeType;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_box3(3, &Absyn_Path_QUALIFIED__desc, omc_NFInstNode_InstNode_className(threadData, _node), _accumPath);
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 7: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _accumPath;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_boolean tmp9;
          modelica_metatype tmpMeta10;
          modelica_boolean tmp11;
          modelica_metatype tmpMeta12;
          
          /* Pattern matching succeeded */
          tmp11 = (modelica_boolean)((modelica_integer)_scopeType == 3);
          if(tmp11)
          {
            tmpMeta7 = mmc_mk_box3(3, &Absyn_Path_QUALIFIED__desc, omc_NFInstNode_InstNode_className(threadData, _node), _accumPath);
            tmpMeta12 = omc_NFInstNode_InstNode_scopePath2(threadData, omc_NFInstNode_InstNode_classParent(threadData, _node), (modelica_integer)_scopeType, tmpMeta7);
          }
          else
          {
            tmp9 = (modelica_boolean)((modelica_integer)_scopeType == 2);
            if(tmp9)
            {
              tmpMeta8 = mmc_mk_box3(3, &Absyn_Path_QUALIFIED__desc, omc_NFInstNode_InstNode_className(threadData, _node), _accumPath);
              tmpMeta10 = tmpMeta8;
            }
            else
            {
              tmpMeta10 = _accumPath;
            }
            tmpMeta12 = tmpMeta10;
          }
          tmpMeta1 = tmpMeta12;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta13;
          
          /* Pattern matching succeeded */
          tmpMeta13 = mmc_mk_box3(3, &Absyn_Path_QUALIFIED__desc, omc_NFInstNode_InstNode_className(threadData, _node), _accumPath);
          tmpMeta1 = omc_NFInstNode_InstNode_scopePath2(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2))), (modelica_integer)_scopeType, tmpMeta13);
          goto tmp3_done;
        }
        case 13: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_scopePath2(threadData, omc_NFInstNode_InstNode_classParent(threadData, _node), (modelica_integer)_scopeType, _accumPath);
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT30, _OMC_LIT31);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _path = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _path;
}
modelica_metatype boxptr_NFInstNode_InstNode_scopePathClass(threadData_t *threadData, modelica_metatype _node, modelica_metatype _ty, modelica_metatype _scopeType, modelica_metatype _accumPath)
{
  modelica_integer tmp1;
  modelica_metatype _path = NULL;
  tmp1 = mmc_unbox_integer(_scopeType);
  _path = omc_NFInstNode_InstNode_scopePathClass(threadData, _node, _ty, tmp1, _accumPath);
  /* skip box _path; Absyn.Path */
  return _path;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_scopePath2(threadData_t *threadData, modelica_metatype _node, modelica_integer _scopeType, modelica_metatype _accumPath)
{
  modelica_metatype _path = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _path has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_scopePathClass(threadData, _node, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 8))), (modelica_integer)_scopeType, _accumPath);
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_box3(3, &Absyn_Path_QUALIFIED__desc, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2))), _accumPath);
          /* Tail recursive call */
          tmpMeta5 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6)));
          _scopeType = (modelica_integer)_scopeType;
          _accumPath = tmpMeta6;
          _node = tmpMeta5;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _accumPath;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _path = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _path;
}
modelica_metatype boxptr_NFInstNode_InstNode_scopePath2(threadData_t *threadData, modelica_metatype _node, modelica_metatype _scopeType, modelica_metatype _accumPath)
{
  modelica_integer tmp1;
  modelica_metatype _path = NULL;
  tmp1 = mmc_unbox_integer(_scopeType);
  _path = omc_NFInstNode_InstNode_scopePath2(threadData, _node, tmp1, _accumPath);
  /* skip box _path; Absyn.Path */
  return _path;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_scopePath(threadData_t *threadData, modelica_metatype _node, modelica_integer _scopeType, modelica_boolean _ignoreBaseClass)
{
  modelica_metatype _path = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _path has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      modelica_metatype _it = NULL;
      int tmp4;
      // _it has no default value.
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          _it = tmpMeta5;
          /* Pattern matching succeeded */
          { /* match expression */
            modelica_metatype tmp9_1;
            tmp9_1 = _it;
            {
              volatile mmc_switch_type tmp9;
              int tmp10;
              tmp9 = 0;
              for (; tmp9 < 2; tmp9++) {
                switch (MMC_SWITCH_CAST(tmp9)) {
                case 0: {
                  if (mmc__uniontype__metarecord__typedef__equal(tmp9_1,1,3) == 0) goto tmp8_end;
                  
                  /* Pattern matching succeeded */
                  /* Check guard condition after assignments */
                  if (!(!_ignoreBaseClass)) goto tmp8_end;
                  /* Tail recursive call */
                  _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_it), 2)));
                  _scopeType = (modelica_integer)_scopeType;
                  _ignoreBaseClass = 0 /* false */;
                  goto _tailrecursive;
                  /* TODO: Make sure any eventual dead code below is never generated */
                  goto tmp8_done;
                }
                case 1: {
                  modelica_metatype tmpMeta11;
                  
                  /* Pattern matching succeeded */
                  tmpMeta11 = mmc_mk_box2(4, &Absyn_Path_IDENT__desc, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2))));
                  tmpMeta6 = omc_NFInstNode_InstNode_scopePath2(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 7))), (modelica_integer)_scopeType, tmpMeta11);
                  goto tmp8_done;
                }
                }
                goto tmp8_end;
                tmp8_end: ;
              }
              goto goto_7;
              goto_7:;
              goto goto_2;
              goto tmp8_done;
              tmp8_done:;
            }
          }tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 4: {
          modelica_metatype tmpMeta12;
          
          /* Pattern matching succeeded */
          tmpMeta12 = mmc_mk_box2(4, &Absyn_Path_IDENT__desc, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2))));
          tmpMeta1 = omc_NFInstNode_InstNode_scopePath2(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6))), (modelica_integer)_scopeType, tmpMeta12);
          goto tmp3_done;
        }
        case 8: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          _scopeType = (modelica_integer)_scopeType;
          _ignoreBaseClass = 0 /* false */;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          modelica_metatype tmpMeta13;
          
          /* Pattern matching succeeded */
          tmpMeta13 = mmc_mk_box2(4, &Absyn_Path_IDENT__desc, omc_NFInstNode_InstNode_name(threadData, _node));
          tmpMeta1 = tmpMeta13;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _path = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _path;
}
modelica_metatype boxptr_NFInstNode_InstNode_scopePath(threadData_t *threadData, modelica_metatype _node, modelica_metatype _scopeType, modelica_metatype _ignoreBaseClass)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _path = NULL;
  tmp1 = mmc_unbox_integer(_scopeType);
  tmp2 = mmc_unbox_integer(_ignoreBaseClass);
  _path = omc_NFInstNode_InstNode_scopePath(threadData, _node, tmp1, tmp2);
  /* skip box _path; Absyn.Path */
  return _path;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_fullPath(threadData_t *threadData, modelica_metatype _node, modelica_boolean _ignoreBaseClass)
{
  modelica_metatype _path = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _path = omc_NFInstNode_InstNode_scopePath(threadData, _node, 3, _ignoreBaseClass);
  _return: OMC_LABEL_UNUSED
  return _path;
}
modelica_metatype boxptr_NFInstNode_InstNode_fullPath(threadData_t *threadData, modelica_metatype _node, modelica_metatype _ignoreBaseClass)
{
  modelica_integer tmp1;
  modelica_metatype _path = NULL;
  tmp1 = mmc_unbox_integer(_ignoreBaseClass);
  _path = omc_NFInstNode_InstNode_fullPath(threadData, _node, tmp1);
  /* skip box _path; Absyn.Path */
  return _path;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_rootPath(threadData_t *threadData, modelica_metatype _node, modelica_boolean _ignoreBaseClass)
{
  modelica_metatype _path = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _path = omc_NFInstNode_InstNode_scopePath(threadData, _node, 2, _ignoreBaseClass);
  _return: OMC_LABEL_UNUSED
  return _path;
}
modelica_metatype boxptr_NFInstNode_InstNode_rootPath(threadData_t *threadData, modelica_metatype _node, modelica_metatype _ignoreBaseClass)
{
  modelica_integer tmp1;
  modelica_metatype _path = NULL;
  tmp1 = mmc_unbox_integer(_ignoreBaseClass);
  _path = omc_NFInstNode_InstNode_rootPath(threadData, _node, tmp1);
  /* skip box _path; Absyn.Path */
  return _path;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getAnnotation(threadData_t *threadData, modelica_string _name, modelica_metatype _node, modelica_metatype *out_scope)
{
  modelica_metatype _mod = NULL;
  modelica_metatype _scope = NULL;
  modelica_metatype _ann = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _mod has no default value.
  _scope = _node;
  // _ann has no default value.
  while(1)
  {
    if(!omc_NFInstNode_InstNode_isComponent(threadData, _scope)) break;
    _ann = omc_SCodeUtil_commentAnnotation(threadData, omc_NFComponent_comment(threadData, omc_NFInstNode_InstNode_component(threadData, _scope)));

    if(isSome(_ann))
    {
      _mod = omc_SCodeUtil_lookupAnnotation(threadData, omc_Util_getOption(threadData, _ann), _name);

      if((!omc_SCodeUtil_isEmptyMod(threadData, _mod)))
      {
        _scope = omc_NFInstNode_InstNode_instanceParent(threadData, _scope);

        goto _return;
      }
    }

    _scope = omc_NFInstNode_InstNode_instanceParent(threadData, _scope);
  }

  _mod = _OMC_LIT32;
  _return: OMC_LABEL_UNUSED
  if (out_scope) { *out_scope = _scope; }
  return _mod;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_scopeListClass(threadData_t *threadData, modelica_metatype _clsNode, modelica_metatype _ty, modelica_boolean _includeRoot, modelica_metatype _accumScopes)
{
  modelica_metatype _scopes = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _scopes has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _ty;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          modelica_metatype tmpMeta5;
          
          /* Pattern matching succeeded */
          tmpMeta5 = mmc_mk_cons(_clsNode, _accumScopes);
          tmpMeta1 = omc_NFInstNode_InstNode_scopeList(threadData, omc_NFInstNode_InstNode_parent(threadData, _clsNode), _includeRoot, tmpMeta5);
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_scopeList(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2))), _includeRoot, _accumScopes);
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _ty = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 6: {
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_cons(_clsNode, _accumScopes);
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 7: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _accumScopes;
          goto tmp3_done;
        }
        case 8: {
          modelica_metatype tmpMeta7;
          modelica_boolean tmp8;
          modelica_metatype tmpMeta9;
          
          /* Pattern matching succeeded */
          tmp8 = (modelica_boolean)_includeRoot;
          if(tmp8)
          {
            tmpMeta7 = mmc_mk_cons(_clsNode, _accumScopes);
            tmpMeta9 = omc_NFInstNode_InstNode_scopeList(threadData, omc_NFInstNode_InstNode_parent(threadData, _clsNode), _includeRoot, tmpMeta7);
          }
          else
          {
            tmpMeta9 = _accumScopes;
          }
          tmpMeta1 = tmpMeta9;
          goto tmp3_done;
        }
        case 11: {
          modelica_metatype tmpMeta10;
          
          /* Pattern matching succeeded */
          tmpMeta10 = mmc_mk_cons(omc_NFInstNode_InstNode_getDerivedNode(threadData, _clsNode, 1 /* true */), _accumScopes);
          tmpMeta1 = omc_NFInstNode_InstNode_scopeList(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2))), _includeRoot, tmpMeta10);
          goto tmp3_done;
        }
        case 13: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_scopeList(threadData, omc_NFInstNode_InstNode_parent(threadData, _clsNode), _includeRoot, _accumScopes);
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT33, _OMC_LIT34);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _scopes = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _scopes;
}
modelica_metatype boxptr_NFInstNode_InstNode_scopeListClass(threadData_t *threadData, modelica_metatype _clsNode, modelica_metatype _ty, modelica_metatype _includeRoot, modelica_metatype _accumScopes)
{
  modelica_integer tmp1;
  modelica_metatype _scopes = NULL;
  tmp1 = mmc_unbox_integer(_includeRoot);
  _scopes = omc_NFInstNode_InstNode_scopeListClass(threadData, _clsNode, _ty, tmp1, _accumScopes);
  /* skip box _scopes; list<NFInstNode.InstNode> */
  return _scopes;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_scopeList(threadData_t *threadData, modelica_metatype _node, modelica_boolean _includeRoot, modelica_metatype _accumScopes)
{
  modelica_metatype _scopes = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _scopes has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      modelica_metatype _parent = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _parent has no default value.
      tmp4 = 0;
      for (; tmp4 < 6; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_scopeListClass(threadData, _node, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 8))), _includeRoot, _accumScopes);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 6));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,8,0) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _accumScopes;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 7));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,7,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta7), 2));
          _parent = tmpMeta8;
          /* Pattern matching succeeded */
          tmpMeta10 = mmc_mk_cons(_node, _accumScopes);
          /* Tail recursive call */
          tmpMeta9 = _parent;
          _accumScopes = tmpMeta10;
          _node = tmpMeta9;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta12 = mmc_mk_cons(_node, _accumScopes);
          /* Tail recursive call */
          tmpMeta11 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6)));
          _accumScopes = tmpMeta12;
          _node = tmpMeta11;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 4: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _accumScopes;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _scopes = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _scopes;
}
modelica_metatype boxptr_NFInstNode_InstNode_scopeList(threadData_t *threadData, modelica_metatype _node, modelica_metatype _includeRoot, modelica_metatype _accumScopes)
{
  modelica_integer tmp1;
  modelica_metatype _scopes = NULL;
  tmp1 = mmc_unbox_integer(_includeRoot);
  _scopes = omc_NFInstNode_InstNode_scopeList(threadData, _node, tmp1, _accumScopes);
  /* skip box _scopes; list<NFInstNode.InstNode> */
  return _scopes;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_componentApply(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode, modelica_fnptr _func, modelica_metatype _arg)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 1; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,6) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          omc_Pointer_update(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 2))), _arg, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))) : ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 1)))) (threadData, _arg, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))));
          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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_classApply(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode, modelica_fnptr _func, modelica_metatype _arg)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 1; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          omc_Pointer_update(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 2))), _arg, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))) : ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 1)))) (threadData, _arg, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))));
          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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getType(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _ty = NULL;
  modelica_metatype _var = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _ty has no default value.
  // _var has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFClass_getType(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))), _node);
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFComponent_getType(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 10: {
          
          /* Pattern matching succeeded */
          _var = omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3))));
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_var), 3)));
          goto tmp3_done;
        }
        case 7: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT35;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _ty = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _ty;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_info(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _info = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _info has no default value.
  { /* matchcontinue expression */
    volatile modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      modelica_metatype _ty = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _ty 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;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,1,3) == 0) goto tmp3_end;
          
          _ty = tmpMeta6;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_SCodeUtil_elementInfo(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 3))));
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          
          tmp4 += 2; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta1 = omc_SCodeUtil_elementInfo(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3))));
          goto tmp3_done;
        }
        case 2: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFComponent_info(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 3: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_info(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6))));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT38;
          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:;
    }
  }
  _info = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _info;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_setComponentDirection(threadData_t *threadData, modelica_integer _direction, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta6), MMC_UNTAGPTR(_node), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta6))[5] = omc_Pointer_create(threadData, omc_NFComponent_setDirection(threadData, (modelica_integer)_direction, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))));
          _node = tmpMeta6;
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          
          /* Pattern matching succeeded */
          tmpMeta8 = stringAppend(_OMC_LIT41,omc_NFInstNode_InstNode_toString(threadData, _node));
          tmpMeta7 = mmc_mk_cons(tmpMeta8, MMC_REFSTRUCTLIT(mmc_nil));
          omc_Error_addMessage(threadData, _OMC_LIT40, tmpMeta7);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _node = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _node;
}
modelica_metatype boxptr_NFInstNode_InstNode_setComponentDirection(threadData_t *threadData, modelica_metatype _direction, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_integer tmp1;
  modelica_metatype _node = NULL;
  tmp1 = mmc_unbox_integer(_direction);
  _node = omc_NFInstNode_InstNode_setComponentDirection(threadData, tmp1, __omcQ_24in_5Fnode);
  /* skip box _node; NFInstNode.InstNode */
  return _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_setDefinition(threadData_t *threadData, modelica_metatype _definition, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_node), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[3] = _definition;
          _node = tmpMeta5;
          goto tmp2_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,6) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta6), MMC_UNTAGPTR(_node), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta6))[3] = mmc_mk_some(_definition);
          _node = tmpMeta6;
          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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_extendsDefinition(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _definition = NULL;
  modelica_metatype _ty = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _definition has no default value.
  // _ty has no default value.
  _ty = omc_NFInstNode_InstNode_derivedNodeType(threadData, _node);

  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _ty;
    {
      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,1,3) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = mmc_mk_some((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 3))));
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = mmc_mk_none();
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _definition = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _definition;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_classDefinition(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _definition = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _definition has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3)));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = omc_NFComponent_classInstance(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          tmpMeta6 = stringAppend(_OMC_LIT42,omc_NFInstNode_InstNode_toString(threadData, _node));
          tmpMeta5 = mmc_mk_cons(tmpMeta6, MMC_REFSTRUCTLIT(mmc_nil));
          omc_Error_addMessage(threadData, _OMC_LIT40, tmpMeta5);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _definition = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _definition;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_definition(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _definition = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _definition has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3)));
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (optionNone(tmpMeta6)) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 1));
          
          _definition = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta1 = _definition;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          
          /* Pattern matching succeeded */
          tmpMeta9 = stringAppend(_OMC_LIT43,omc_NFInstNode_InstNode_toString(threadData, _node));
          tmpMeta8 = mmc_mk_cons(tmpMeta9, MMC_REFSTRUCTLIT(mmc_nil));
          omc_Error_addMessage(threadData, _OMC_LIT40, tmpMeta8);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _definition = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _definition;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_setNodeType(threadData_t *threadData, modelica_metatype _nodeType, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      int tmp3;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
        case 3: {
          modelica_metatype tmpMeta4;
          
          /* Pattern matching succeeded */
          tmpMeta4 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta4), MMC_UNTAGPTR(_node), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta4))[8] = _nodeType;
          _node = tmpMeta4;
          goto tmp2_done;
        }
        case 4: {
          modelica_metatype tmpMeta5;
          
          /* Pattern matching succeeded */
          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_node), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[7] = _nodeType;
          _node = tmpMeta5;
          goto tmp2_done;
        }
        default:
        tmp2_default: OMC_LABEL_UNUSED; {
          
          /* 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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_derivedNodeType(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _ty = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _ty has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,2,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          _ty = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta1 = _ty;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_nodeType(threadData, _node);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _ty = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _ty;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_nodeType(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _nodeType = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _nodeType has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 8)));
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 7)));
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _nodeType = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _nodeType;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_replaceClass(threadData_t *threadData, modelica_metatype _cls, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 1; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_node), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[5] = omc_Pointer_create(threadData, _cls);
          _node = tmpMeta5;
          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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_replaceComponent(threadData_t *threadData, modelica_metatype _component, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 1; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,6) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_node), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[5] = omc_Pointer_create(threadData, _component);
          _node = tmpMeta5;
          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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_updateComponent(threadData_t *threadData, modelica_metatype _component, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 1; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          omc_Pointer_update(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))), _component);
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _node = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_component(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _component = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _component has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))));
          goto tmp3_done;
        }
        case 10: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT44;
          goto tmp3_done;
        }
        case 7: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT44;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _component = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _component;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_updateClass(threadData_t *threadData, modelica_metatype _cls, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 1; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          omc_Pointer_update(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))), _cls);
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _node = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getDerivedNode2(threadData_t *threadData, modelica_metatype _node, modelica_metatype _ty, modelica_boolean _recursive)
{
  modelica_metatype _derived = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _derived has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _ty;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = (_recursive?omc_NFInstNode_InstNode_getDerivedNode(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2))), 1 /* true */):(MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2))));
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _ty = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _derived = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _derived;
}
modelica_metatype boxptr_NFInstNode_InstNode_getDerivedNode2(threadData_t *threadData, modelica_metatype _node, modelica_metatype _ty, modelica_metatype _recursive)
{
  modelica_integer tmp1;
  modelica_metatype _derived = NULL;
  tmp1 = mmc_unbox_integer(_recursive);
  _derived = omc_NFInstNode_InstNode_getDerivedNode2(threadData, _node, _ty, tmp1);
  /* skip box _derived; NFInstNode.InstNode */
  return _derived;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getDerivedNode(threadData_t *threadData, modelica_metatype _node, modelica_boolean _recursive)
{
  modelica_metatype _derived = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _derived has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_getDerivedNode2(threadData, _node, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 8))), _recursive);
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _derived = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _derived;
}
modelica_metatype boxptr_NFInstNode_InstNode_getDerivedNode(threadData_t *threadData, modelica_metatype _node, modelica_metatype _recursive)
{
  modelica_integer tmp1;
  modelica_metatype _derived = NULL;
  tmp1 = mmc_unbox_integer(_recursive);
  _derived = omc_NFInstNode_InstNode_getDerivedNode(threadData, _node, tmp1);
  /* skip box _derived; NFInstNode.InstNode */
  return _derived;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getDerivedClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _cls = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _cls has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_getClass(threadData, omc_NFInstNode_InstNode_getDerivedNode(threadData, _node, 1 /* true */));
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_getClass(threadData, omc_NFInstNode_InstNode_getDerivedNode(threadData, omc_NFComponent_classInstance(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))))), 1 /* true */));
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _cls = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _cls;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_getClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _cls = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _cls has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5))));
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = omc_NFComponent_classInstance(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 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:;
    }
  }
  _cls = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _cls;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_setOrphanParent(threadData_t *threadData, modelica_metatype _parent, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      volatile mmc_switch_type tmp3;
      int tmp4;
      tmp3 = 0;
      for (; tmp3 < 3; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,7) == 0) goto tmp2_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 7));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta5,8,0) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta6), MMC_UNTAGPTR(_node), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta6))[7] = _parent;
          _node = tmpMeta6;
          goto tmp2_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,6) == 0) goto tmp2_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 6));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,8,0) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta8 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta8), MMC_UNTAGPTR(_node), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta8))[6] = _parent;
          _node = tmpMeta8;
          goto tmp2_done;
        }
        case 2: {
          
          /* 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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_setParent(threadData_t *threadData, modelica_metatype _parent, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      int tmp3;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
        case 3: {
          modelica_metatype tmpMeta4;
          
          /* Pattern matching succeeded */
          tmpMeta4 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta4), MMC_UNTAGPTR(_node), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta4))[7] = _parent;
          _node = tmpMeta4;
          goto tmp2_done;
        }
        case 4: {
          modelica_metatype tmpMeta5;
          
          /* Pattern matching succeeded */
          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_node), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[6] = _parent;
          _node = tmpMeta5;
          goto tmp2_done;
        }
        case 8: {
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          tmpMeta6 = MMC_TAGPTR(mmc_alloc_words(4));
          memcpy(MMC_UNTAGPTR(tmpMeta6), MMC_UNTAGPTR(_node), 4*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta6))[2] = _parent;
          _node = tmpMeta6;
          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 _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_topComponent(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _topComponent = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _topComponent has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 6));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,8,0) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6)));
          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:;
    }
  }
  _topComponent = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _topComponent;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isTopScope(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _res;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,4,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _res = tmp1;
  _return: OMC_LABEL_UNUSED
  return _res;
}
modelica_metatype boxptr_NFInstNode_InstNode_isTopScope(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _res;
  modelica_metatype out_res;
  _res = omc_NFInstNode_InstNode_isTopScope(threadData, _node);
  out_res = mmc_mk_icon(_res);
  return out_res;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_annotationScope(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _annScope = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _annScope has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,4,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          
          _annScope = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta1 = _annScope;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = omc_NFInstNode_InstNode_parentScope(threadData, _node, 0 /* false */);
          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:;
    }
  }
  _annScope = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _annScope;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_topScope(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _topScope = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _topScope has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,4,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = omc_NFInstNode_InstNode_parent(threadData, _node);
          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:;
    }
  }
  _topScope = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _topScope;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_libraryScope(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _lib = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _lib has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 7));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,0,7) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,4,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = omc_NFInstNode_InstNode_parentScope(threadData, _node, 0 /* false */);
          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:;
    }
  }
  _lib = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _lib;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_classScope(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _scope = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _scope has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFComponent_classInstance(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _node;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _scope = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _scope;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_enclosingScope(threadData_t *threadData, modelica_metatype _node, modelica_boolean _ignoreRedeclare, modelica_boolean _ignoreBaseClass)
{
  modelica_metatype _scope = NULL;
  modelica_metatype _orig_node = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _scope has no default value.
  // _orig_node has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 5; 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,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,8,3) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 4));
          if (optionNone(tmpMeta7)) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta7), 1));
          _orig_node = tmpMeta8;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!_ignoreRedeclare) goto tmp3_end;
          /* Tail recursive call */
          _node = _orig_node;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,8,3) == 0) goto tmp3_end;
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 2));
          
          _scope = tmpMeta10;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!_ignoreRedeclare) goto tmp3_end;
          tmpMeta1 = _scope;
          goto tmp3_done;
        }
        case 2: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = (_ignoreBaseClass?omc_NFInstNode_InstNode_getDerivedNode(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 7))), 1 /* true */):(MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 7))));
          goto tmp3_done;
        }
        case 3: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = omc_NFInstNode_InstNode_classScope(threadData, _node);
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 4: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _scope = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _scope;
}
modelica_metatype boxptr_NFInstNode_InstNode_enclosingScope(threadData_t *threadData, modelica_metatype _node, modelica_metatype _ignoreRedeclare, modelica_metatype _ignoreBaseClass)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _scope = NULL;
  tmp1 = mmc_unbox_integer(_ignoreRedeclare);
  tmp2 = mmc_unbox_integer(_ignoreBaseClass);
  _scope = omc_NFInstNode_InstNode_enclosingScope(threadData, _node, tmp1, tmp2);
  /* skip box _scope; NFInstNode.InstNode */
  return _scope;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_enclosingScopeList(threadData_t *threadData, modelica_metatype _node, modelica_boolean _ignoreRedeclare, modelica_boolean _ignoreBaseClass)
{
  modelica_metatype _res = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _scope = NULL;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _res = tmpMeta1;
  _scope = _node;
  while(1)
  {
    if(!(!omc_NFInstNode_InstNode_isTopScope(threadData, _scope))) break;
    tmpMeta2 = mmc_mk_cons(_scope, _res);
    _res = tmpMeta2;

    _scope = omc_NFInstNode_InstNode_enclosingScope(threadData, _scope, _ignoreRedeclare, _ignoreBaseClass);

    if(omc_NFInstNode_InstNode_isEmpty(threadData, _scope))
    {
      break;
    }

    _scope = omc_NFInstNode_InstNode_classScope(threadData, _scope);
  }
  _return: OMC_LABEL_UNUSED
  return _res;
}
modelica_metatype boxptr_NFInstNode_InstNode_enclosingScopeList(threadData_t *threadData, modelica_metatype _node, modelica_metatype _ignoreRedeclare, modelica_metatype _ignoreBaseClass)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _res = NULL;
  modelica_metatype tmpMeta3;
  tmp1 = mmc_unbox_integer(_ignoreRedeclare);
  tmp2 = mmc_unbox_integer(_ignoreBaseClass);
  _res = omc_NFInstNode_InstNode_enclosingScopeList(threadData, _node, tmp1, tmp2);
  /* skip box _res; list<NFInstNode.InstNode> */
  return _res;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_enclosingScopePath(threadData_t *threadData, modelica_metatype _node, modelica_boolean _ignoreRedeclare, modelica_boolean _ignoreBaseClass)
{
  modelica_metatype _path = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _path has no default value.
  {
    modelica_metatype __omcQ_24tmpVar1;
    modelica_metatype* tmp2;
    modelica_metatype tmpMeta3;
    modelica_string __omcQ_24tmpVar0;
    modelica_integer tmp4;
    modelica_metatype _n_loopVar = 0;
    modelica_metatype _n;
    _n_loopVar = omc_NFInstNode_InstNode_enclosingScopeList(threadData, _node, _ignoreRedeclare, _ignoreBaseClass);
    tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar1 = tmpMeta3; /* defaultValue */
    tmp2 = &__omcQ_24tmpVar1;
    while(1) {
      tmp4 = 1;
      if (!listEmpty(_n_loopVar)) {
        _n = MMC_CAR(_n_loopVar);
        _n_loopVar = MMC_CDR(_n_loopVar);
        tmp4--;
      }
      if (tmp4 == 0) {
        __omcQ_24tmpVar0 = omc_NFInstNode_InstNode_name(threadData, _n);
        *tmp2 = mmc_mk_cons(__omcQ_24tmpVar0,0);
        tmp2 = &MMC_CDR(*tmp2);
      } else if (tmp4 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp2 = mmc_mk_nil();
    tmpMeta1 = __omcQ_24tmpVar1;
  }
  _path = omc_AbsynUtil_stringListPath(threadData, tmpMeta1);
  _return: OMC_LABEL_UNUSED
  return _path;
}
modelica_metatype boxptr_NFInstNode_InstNode_enclosingScopePath(threadData_t *threadData, modelica_metatype _node, modelica_metatype _ignoreRedeclare, modelica_metatype _ignoreBaseClass)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _path = NULL;
  tmp1 = mmc_unbox_integer(_ignoreRedeclare);
  tmp2 = mmc_unbox_integer(_ignoreBaseClass);
  _path = omc_NFInstNode_InstNode_enclosingScopePath(threadData, _node, tmp1, tmp2);
  /* skip box _path; Absyn.Path */
  return _path;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_parentScope(threadData_t *threadData, modelica_metatype _node, modelica_boolean _ignoreRedeclare)
{
  modelica_metatype _scope = NULL;
  modelica_metatype _orig_node = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _scope has no default value.
  // _orig_node has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 6; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_boolean tmp7;
          modelica_metatype tmpMeta8;
          modelica_boolean tmp9;
          modelica_metatype tmpMeta10;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,2,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _scope = omc_NFClass_lastBaseClass(threadData, _node);
          tmp9 = (modelica_boolean)omc_NFInstNode_InstNode_isBuiltin(threadData, _scope);
          if(tmp9)
          {
            tmpMeta10 = omc_NFInstNode_InstNode_topScope(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 7))));
          }
          else
          {
            tmp7 = (modelica_boolean)referenceEq(_node, _scope);
            if(tmp7)
            {
              tmpMeta8 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 7)));
            }
            else
            {
              /* Tail recursive call */
              _node = _scope;
              _ignoreRedeclare = 0 /* false */;
              goto _tailrecursive;
              /* TODO: Make sure any eventual dead code below is never generated */
            }
            tmpMeta10 = tmpMeta8;
          }
          tmpMeta1 = tmpMeta10;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta11,8,3) == 0) goto tmp3_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta11), 4));
          if (optionNone(tmpMeta12)) goto tmp3_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta12), 1));
          _orig_node = tmpMeta13;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!_ignoreRedeclare) goto tmp3_end;
          /* Tail recursive call */
          _node = _orig_node;
          _ignoreRedeclare = 0 /* false */;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta14,8,3) == 0) goto tmp3_end;
          tmpMeta15 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta14), 2));
          
          _scope = tmpMeta15;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!_ignoreRedeclare) goto tmp3_end;
          tmpMeta1 = _scope;
          goto tmp3_done;
        }
        case 3: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 7)));
          goto tmp3_done;
        }
        case 4: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = omc_NFComponent_classInstance(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          _ignoreRedeclare = 0 /* false */;
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 5: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _scope = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _scope;
}
modelica_metatype boxptr_NFInstNode_InstNode_parentScope(threadData_t *threadData, modelica_metatype _node, modelica_metatype _ignoreRedeclare)
{
  modelica_integer tmp1;
  modelica_metatype _scope = NULL;
  tmp1 = mmc_unbox_integer(_ignoreRedeclare);
  _scope = omc_NFInstNode_InstNode_parentScope(threadData, _node, tmp1);
  /* skip box _scope; NFInstNode.InstNode */
  return _scope;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_rootTypeParent(threadData_t *threadData, modelica_metatype _nodeType, modelica_metatype _node)
{
  modelica_metatype _parent = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _parent has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _nodeType;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(!omc_NFInstNode_InstNode_isEmpty(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_nodeType), 2)))))) goto tmp3_end;
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_nodeType), 2)));
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _nodeType = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_nodeType), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 2: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_parent(threadData, _node);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _parent = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _parent;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_rootParent(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _parent = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _parent has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_rootTypeParent(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 8))), _node);
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_parent(threadData, _node);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _parent = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _parent;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_instanceParent(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _parent = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _parent has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 5; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_getDerivedNode(threadData, omc_NFInstNode_InstNode_parent(threadData, omc_NFInstNode_InstNode_getDerivedNode(threadData, _node, 1 /* true */)), 1 /* true */);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 7));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,7,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          _parent = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_getDerivedNode(threadData, _parent, 1 /* true */);
          goto tmp3_done;
        }
        case 2: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_getDerivedNode(threadData, omc_NFInstNode_InstNode_parent(threadData, omc_NFInstNode_InstNode_getDerivedNode(threadData, _node, 1 /* true */)), 1 /* true */);
          goto tmp3_done;
        }
        case 3: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_getDerivedNode(threadData, omc_NFInstNode_InstNode_parent(threadData, omc_NFInstNode_InstNode_getDerivedNode(threadData, _node, 1 /* true */)), 1 /* true */);
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT7;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _parent = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _parent;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_classParent(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _parent = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _parent has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _node;
  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta1,0,7) == 0) MMC_THROW_INTERNAL();
  tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 7));
  _parent = tmpMeta2;
  _return: OMC_LABEL_UNUSED
  return _parent;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_explicitParent(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _parentNode = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _parentNode = omc_NFInstNode_InstNode_explicitScope(threadData, omc_NFInstNode_InstNode_parent(threadData, _node));
  _return: OMC_LABEL_UNUSED
  return _parentNode;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_parent(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _parent = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _parent has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 7)));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 6)));
          goto tmp3_done;
        }
        case 8: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT7;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _parent = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _parent;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_rename(threadData_t *threadData, modelica_string _name, modelica_metatype __omcQ_24in_5Fnode)
{
  modelica_metatype _node = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _node;
    {
      int tmp3;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
        case 3: {
          modelica_metatype tmpMeta4;
          
          /* Pattern matching succeeded */
          tmpMeta4 = MMC_TAGPTR(mmc_alloc_words(9));
          memcpy(MMC_UNTAGPTR(tmpMeta4), MMC_UNTAGPTR(_node), 9*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta4))[2] = _name;
          _node = tmpMeta4;
          goto tmp2_done;
        }
        case 4: {
          modelica_metatype tmpMeta5;
          
          /* Pattern matching succeeded */
          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_node), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[2] = _name;
          _node = tmpMeta5;
          goto tmp2_done;
        }
        case 7: {
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          tmpMeta6 = MMC_TAGPTR(mmc_alloc_words(3));
          memcpy(MMC_UNTAGPTR(tmpMeta6), MMC_UNTAGPTR(_node), 3*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta6))[2] = _name;
          _node = tmpMeta6;
          goto tmp2_done;
        }
        case 10: {
          modelica_metatype tmpMeta7;
          
          /* Pattern matching succeeded */
          tmpMeta7 = MMC_TAGPTR(mmc_alloc_words(4));
          memcpy(MMC_UNTAGPTR(tmpMeta7), MMC_UNTAGPTR(_node), 4*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta7))[2] = _name;
          _node = tmpMeta7;
          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 _node;
}

DLLDirection
modelica_string omc_NFInstNode_InstNode_typeName(threadData_t *threadData, modelica_metatype _node)
{
  modelica_string _name = NULL;
  modelica_string tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _name has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = _OMC_LIT45;
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = _OMC_LIT46;
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 6: {
          
          /* Pattern matching succeeded */
          tmp1 = _OMC_LIT47;
          goto tmp3_done;
        }
        case 7: {
          
          /* Pattern matching succeeded */
          tmp1 = _OMC_LIT48;
          goto tmp3_done;
        }
        case 8: {
          
          /* Pattern matching succeeded */
          tmp1 = _OMC_LIT49;
          goto tmp3_done;
        }
        case 11: {
          
          /* Pattern matching succeeded */
          tmp1 = _OMC_LIT50;
          goto tmp3_done;
        }
        case 10: {
          
          /* Pattern matching succeeded */
          tmp1 = _OMC_LIT51;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _name = tmp1;
  _return: OMC_LABEL_UNUSED
  return _name;
}

DLLDirection
modelica_string omc_NFInstNode_InstNode_scopeName(threadData_t *threadData, modelica_metatype _node)
{
  modelica_string _outName = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _outName = omc_NFInstNode_InstNode_name(threadData, omc_NFInstNode_InstNode_classScope(threadData, omc_NFInstNode_InstNode_explicitScope(threadData, _node)));
  _return: OMC_LABEL_UNUSED
  return _outName;
}

DLLDirection
modelica_string omc_NFInstNode_InstNode_className(threadData_t *threadData, modelica_metatype _node)
{
  modelica_string _name = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _name has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _node;
  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta1,0,7) == 0) MMC_THROW_INTERNAL();
  tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 2));
  _name = tmpMeta2;
  _return: OMC_LABEL_UNUSED
  return _name;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isNamed(threadData_t *threadData, modelica_metatype _node, modelica_string _name)
{
  modelica_boolean _res;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = (stringEqual((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2))), _name));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = (stringEqual((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2))), _name));
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 10: {
          
          /* Pattern matching succeeded */
          tmp1 = (stringEqual((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2))), _name));
          goto tmp3_done;
        }
        case 7: {
          
          /* Pattern matching succeeded */
          tmp1 = (stringEqual((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2))), _name));
          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:;
    }
  }
  _res = tmp1;
  _return: OMC_LABEL_UNUSED
  return _res;
}
modelica_metatype boxptr_NFInstNode_InstNode_isNamed(threadData_t *threadData, modelica_metatype _node, modelica_metatype _name)
{
  modelica_boolean _res;
  modelica_metatype out_res;
  _res = omc_NFInstNode_InstNode_isNamed(threadData, _node, _name);
  out_res = mmc_mk_icon(_res);
  return out_res;
}

DLLDirection
modelica_string omc_NFInstNode_InstNode_name(threadData_t *threadData, modelica_metatype _node)
{
  modelica_string _name = NULL;
  modelica_string tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _name has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          goto tmp3_done;
        }
        case 10: {
          
          /* Pattern matching succeeded */
          tmp1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto tmp3_done;
        }
        case 6: {
          modelica_string tmp5;
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          
          /* Pattern matching succeeded */
          tmp5 = modelica_integer_to_modelica_string(mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)))), ((modelica_integer) 0), 1 /* true */);
          tmpMeta6 = stringAppend(_OMC_LIT52,tmp5);
          tmpMeta7 = stringAppend(tmpMeta6,_OMC_LIT53);
          tmp1 = tmpMeta7;
          goto tmp3_done;
        }
        case 7: {
          
          /* Pattern matching succeeded */
          tmp1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto tmp3_done;
        }
        case 8: {
          
          /* Pattern matching succeeded */
          tmp1 = _OMC_LIT54;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          
          /* Pattern matching succeeded */
          tmpMeta8 = stringAppend(_OMC_LIT55,omc_NFExpression_toString(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)))));
          tmpMeta9 = stringAppend(tmpMeta8,_OMC_LIT56);
          tmp1 = tmpMeta9;
          goto tmp3_done;
        }
        case 11: {
          
          /* Pattern matching succeeded */
          tmp1 = _OMC_LIT57;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _name = tmp1;
  _return: OMC_LABEL_UNUSED
  return _name;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isOperator(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _op;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _op has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_SCodeUtil_isOperator(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 3))));
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          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:;
    }
  }
  _op = tmp1;
  _return: OMC_LABEL_UNUSED
  return _op;
}
modelica_metatype boxptr_NFInstNode_InstNode_isOperator(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _op;
  modelica_metatype out_op;
  _op = omc_NFInstNode_InstNode_isOperator(threadData, _node);
  out_op = mmc_mk_icon(_op);
  return out_op;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_hasParentExpandableConnector(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _b;
  modelica_metatype _p = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _b = omc_NFInstNode_InstNode_isExpandableConnector(threadData, _node);
  // _p has no default value.
  _p = _node;

  while(1)
  {
    if(!(!omc_NFInstNode_InstNode_isEmpty(threadData, _p))) break;
    _p = omc_NFInstNode_InstNode_parent(threadData, _p);

    _b = (_b || omc_NFInstNode_InstNode_isExpandableConnector(threadData, _p));

    if(_b)
    {
      break;
    }
  }
  _return: OMC_LABEL_UNUSED
  return _b;
}
modelica_metatype boxptr_NFInstNode_InstNode_hasParentExpandableConnector(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _b;
  modelica_metatype out_b;
  _b = omc_NFInstNode_InstNode_hasParentExpandableConnector(threadData, _node);
  out_b = mmc_mk_icon(_b);
  return out_b;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isExpandableConnector(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isConnector;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isConnector has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,1,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_isExpandableConnector(threadData, omc_NFInstNode_InstNode_component(threadData, _node));
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isConnector = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isConnector;
}
modelica_metatype boxptr_NFInstNode_InstNode_isExpandableConnector(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isConnector;
  modelica_metatype out_isConnector;
  _isConnector = omc_NFInstNode_InstNode_isExpandableConnector(threadData, _node);
  out_isConnector = mmc_mk_icon(_isConnector);
  return out_isConnector;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isConnector(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isConnector;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isConnector has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFComponent_isConnector(threadData, omc_NFInstNode_InstNode_component(threadData, _node));
          goto tmp3_done;
        }
        case 7: {
          
          /* 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:;
    }
  }
  _isConnector = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isConnector;
}
modelica_metatype boxptr_NFInstNode_InstNode_isConnector(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isConnector;
  modelica_metatype out_isConnector;
  _isConnector = omc_NFInstNode_InstNode_isConnector(threadData, _node);
  out_isConnector = mmc_mk_icon(_isConnector);
  return out_isConnector;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isName(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isName;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isName has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,4,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isName = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isName;
}
modelica_metatype boxptr_NFInstNode_InstNode_isName(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isName;
  modelica_metatype out_isName;
  _isName = omc_NFInstNode_InstNode_isName(threadData, _node);
  out_isName = mmc_mk_icon(_isName);
  return out_isName;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isImplicit(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isImplicit;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isImplicit has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isImplicit = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isImplicit;
}
modelica_metatype boxptr_NFInstNode_InstNode_isImplicit(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isImplicit;
  modelica_metatype out_isImplicit;
  _isImplicit = omc_NFInstNode_InstNode_isImplicit(threadData, _node);
  out_isImplicit = mmc_mk_icon(_isImplicit);
  return out_isImplicit;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isEmpty(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isEmpty;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isEmpty has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,8,0) == 0) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isEmpty = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isEmpty;
}
modelica_metatype boxptr_NFInstNode_InstNode_isEmpty(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isEmpty;
  modelica_metatype out_isEmpty;
  _isEmpty = omc_NFInstNode_InstNode_isEmpty(threadData, _node);
  out_isEmpty = mmc_mk_icon(_isEmpty);
  return out_isEmpty;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isRef(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isRef;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isRef has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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,3,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isRef = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isRef;
}
modelica_metatype boxptr_NFInstNode_InstNode_isRef(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isRef;
  modelica_metatype out_isRef;
  _isRef = omc_NFInstNode_InstNode_isRef(threadData, _node);
  out_isRef = mmc_mk_icon(_isRef);
  return out_isRef;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isComponent(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isComponent;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isComponent has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          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:;
    }
  }
  _isComponent = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isComponent;
}
modelica_metatype boxptr_NFInstNode_InstNode_isComponent(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isComponent;
  modelica_metatype out_isComponent;
  _isComponent = omc_NFInstNode_InstNode_isComponent(threadData, _node);
  out_isComponent = mmc_mk_icon(_isComponent);
  return out_isComponent;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isFunction(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isFunc;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isFunc has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFClass_isFunction(threadData, omc_Pointer_access(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 5)))));
          goto tmp3_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFClass_isFunction(threadData, omc_NFInstNode_InstNode_getClass(threadData, _node));
          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:;
    }
  }
  _isFunc = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isFunc;
}
modelica_metatype boxptr_NFInstNode_InstNode_isFunction(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isFunc;
  modelica_metatype out_isFunc;
  _isFunc = omc_NFInstNode_InstNode_isFunction(threadData, _node);
  out_isFunc = mmc_mk_icon(_isFunc);
  return out_isFunc;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_rootClassContext(threadData_t *threadData, modelica_metatype _node)
{
  modelica_metatype _context = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _context has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,5,2) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 3));
          _context = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta1 = _context;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = mmc_mk_none();
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _context = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _context;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isRootClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _res;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _res has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _res = tmp1;
  _return: OMC_LABEL_UNUSED
  return _res;
}
modelica_metatype boxptr_NFInstNode_InstNode_isRootClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _res;
  modelica_metatype out_res;
  _res = omc_NFInstNode_InstNode_isRootClass(threadData, _node);
  out_res = mmc_mk_icon(_res);
  return out_res;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_makeRootClass(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fnode, modelica_metatype _parent, modelica_metatype _context)
{
  modelica_metatype _node = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _node = __omcQ_24in_5Fnode;
  tmpMeta1 = mmc_mk_box3(8, &NFInstNode_InstNodeType_ROOT__CLASS__desc, _parent, _context);
  _node = omc_NFInstNode_InstNode_setNodeType(threadData, tmpMeta1, _node);
  _return: OMC_LABEL_UNUSED
  return _node;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isDerivedClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isDerived;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isDerived has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,2,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isDerived = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isDerived;
}
modelica_metatype boxptr_NFInstNode_InstNode_isDerivedClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isDerived;
  modelica_metatype out_isDerived;
  _isDerived = omc_NFInstNode_InstNode_isDerivedClass(threadData, _node);
  out_isDerived = mmc_mk_icon(_isDerived);
  return out_isDerived;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isUserdefinedClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isUserdefined;
  modelica_metatype _ty = NULL;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isUserdefined has no default value.
  // _ty has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      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 = 0;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          _ty = tmpMeta6;
          /* Pattern matching succeeded */
          { /* match expression */
            modelica_metatype tmp10_1;
            tmp10_1 = _ty;
            {
              int tmp10;
              {
                switch (MMC_SWITCH_CAST(valueConstructor(tmp10_1))) {
                case 3: {
                  
                  /* Pattern matching succeeded */
                  tmp7 = 1 /* true */;
                  goto tmp9_done;
                }
                case 4: {
                  
                  /* Pattern matching succeeded */
                  tmp7 = 1 /* true */;
                  goto tmp9_done;
                }
                case 5: {
                  
                  /* Pattern matching succeeded */
                  tmp7 = 1 /* true */;
                  goto tmp9_done;
                }
                case 11: {
                  
                  /* Pattern matching succeeded */
                  /* Tail recursive call */
                  _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2)));
                  goto _tailrecursive;
                  /* TODO: Make sure any eventual dead code below is never generated */
                  goto tmp9_done;
                }
                default:
                tmp9_default: OMC_LABEL_UNUSED; {
                  
                  /* Pattern matching succeeded */
                  tmp7 = 0 /* false */;
                  goto tmp9_done;
                }
                }
                goto tmp9_end;
                tmp9_end: ;
              }
              goto goto_8;
              goto_8:;
              goto goto_2;
              goto tmp9_done;
              tmp9_done:;
            }
          }tmp1 = tmp7;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isUserdefined = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isUserdefined;
}
modelica_metatype boxptr_NFInstNode_InstNode_isUserdefinedClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isUserdefined;
  modelica_metatype out_isUserdefined;
  _isUserdefined = omc_NFInstNode_InstNode_isUserdefinedClass(threadData, _node);
  out_isUserdefined = mmc_mk_icon(_isUserdefined);
  return out_isUserdefined;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isBaseClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isBaseClass;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isBaseClass has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,7) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 8));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,1,3) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _isBaseClass = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isBaseClass;
}
modelica_metatype boxptr_NFInstNode_InstNode_isBaseClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isBaseClass;
  modelica_metatype out_isBaseClass;
  _isBaseClass = omc_NFInstNode_InstNode_isBaseClass(threadData, _node);
  out_isBaseClass = mmc_mk_icon(_isBaseClass);
  return out_isBaseClass;
}

DLLDirection
modelica_boolean omc_NFInstNode_InstNode_isClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isClass;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _isClass has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _node;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _node = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_node), 2)));
          goto _tailrecursive;
          /* TODO: Make sure any eventual dead code below is never generated */
          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:;
    }
  }
  _isClass = tmp1;
  _return: OMC_LABEL_UNUSED
  return _isClass;
}
modelica_metatype boxptr_NFInstNode_InstNode_isClass(threadData_t *threadData, modelica_metatype _node)
{
  modelica_boolean _isClass;
  modelica_metatype out_isClass;
  _isClass = omc_NFInstNode_InstNode_isClass(threadData, _node);
  out_isClass = mmc_mk_icon(_isClass);
  return out_isClass;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_fromComponent(threadData_t *threadData, modelica_string _name, modelica_metatype _component, modelica_metatype _parent)
{
  modelica_metatype _node = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _node has no default value.
  tmpMeta1 = mmc_mk_box7(4, &NFInstNode_InstNode_COMPONENT__NODE__desc, _name, mmc_mk_none(), mmc_mk_integer(1), omc_Pointer_create(threadData, _component), _parent, _OMC_LIT58);
  _node = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_newIndexedIterator(threadData_t *threadData, modelica_integer _index, modelica_string _name, modelica_metatype _info, modelica_metatype _ty)
{
  modelica_metatype _iterator = NULL;
  modelica_metatype tmpMeta1;
  modelica_string tmp2;
  modelica_metatype tmpMeta3;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _iterator has no default value.
  tmpMeta1 = stringAppend(_OMC_LIT61,_name);
  tmp2 = modelica_integer_to_modelica_string(_index, ((modelica_integer) 0), 1 /* true */);
  tmpMeta3 = stringAppend(tmpMeta1,tmp2);
  _iterator = omc_NFInstNode_InstNode_newIterator(threadData, tmpMeta3, _ty, _info);
  _return: OMC_LABEL_UNUSED
  return _iterator;
}
modelica_metatype boxptr_NFInstNode_InstNode_newIndexedIterator(threadData_t *threadData, modelica_metatype _index, modelica_metatype _name, modelica_metatype _info, modelica_metatype _ty)
{
  modelica_integer tmp1;
  modelica_metatype _iterator = NULL;
  tmp1 = mmc_unbox_integer(_index);
  _iterator = omc_NFInstNode_InstNode_newIndexedIterator(threadData, tmp1, _name, _info, _ty);
  /* skip box _iterator; NFInstNode.InstNode */
  return _iterator;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_newUniqueIterator(threadData_t *threadData, modelica_metatype _info, modelica_metatype _ty)
{
  modelica_metatype _iterator = NULL;
  modelica_string tmp1;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _iterator has no default value.
  tmp1 = modelica_integer_to_modelica_string(omc_System_tmpTickIndex(threadData, ((modelica_integer) 5)), ((modelica_integer) 0), 1 /* true */);
  tmpMeta2 = stringAppend(_OMC_LIT62,tmp1);
  _iterator = omc_NFInstNode_InstNode_newIterator(threadData, tmpMeta2, _ty, _info);
  _return: OMC_LABEL_UNUSED
  return _iterator;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_newIterator(threadData_t *threadData, modelica_string _name, modelica_metatype _ty, modelica_metatype _info)
{
  modelica_metatype _iterator = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _iterator has no default value.
  _iterator = omc_NFInstNode_InstNode_fromComponent(threadData, _name, omc_NFComponent_newIterator(threadData, _ty, _info), _OMC_LIT7);
  _return: OMC_LABEL_UNUSED
  return _iterator;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_newExtends(threadData_t *threadData, modelica_metatype _definition, modelica_metatype _parent)
{
  modelica_metatype _node = NULL;
  modelica_metatype _base_path = NULL;
  modelica_string _name = NULL;
  modelica_metatype _vis = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _node has no default value.
  // _base_path has no default value.
  // _name has no default value.
  // _vis has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _definition;
  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta1,1,5) == 0) MMC_THROW_INTERNAL();
  tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 2));
  tmpMeta3 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 3));
  _base_path = tmpMeta2;
  _vis = tmpMeta3;

  _name = omc_AbsynUtil_pathLastIdent(threadData, _base_path);

  tmpMeta4 = mmc_mk_box4(4, &NFInstNode_InstNodeType_BASE__CLASS__desc, _parent, _definition, omc_NFInstNode_InstNode_nodeType(threadData, _parent));
  tmpMeta5 = mmc_mk_box8(3, &NFInstNode_InstNode_CLASS__NODE__desc, _name, _definition, mmc_mk_integer(omc_NFPrefixes_visibilityFromSCode(threadData, _vis)), omc_Pointer_create(threadData, _OMC_LIT63), omc_NFInstNode_CachedData_empty(threadData), _parent, tmpMeta4);
  _node = tmpMeta5;
  _return: OMC_LABEL_UNUSED
  return _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_newComponent(threadData_t *threadData, modelica_metatype _definition, modelica_metatype _parent)
{
  modelica_metatype _node = NULL;
  modelica_string _name = NULL;
  modelica_metatype _vis = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _node has no default value.
  // _name has no default value.
  // _vis has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _definition;
  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta1,3,8) == 0) MMC_THROW_INTERNAL();
  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(tmpMeta3), 2));
  _name = tmpMeta2;
  _vis = tmpMeta4;

  tmpMeta5 = mmc_mk_box7(4, &NFInstNode_InstNode_COMPONENT__NODE__desc, _name, mmc_mk_some(_definition), mmc_mk_integer(omc_NFPrefixes_visibilityFromSCode(threadData, _vis)), omc_Pointer_create(threadData, omc_NFComponent_new(threadData, _definition)), _parent, _OMC_LIT58);
  _node = tmpMeta5;
  _return: OMC_LABEL_UNUSED
  return _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_newClass(threadData_t *threadData, modelica_metatype _definition, modelica_metatype _parent, modelica_metatype _nodeType)
{
  modelica_metatype _node = NULL;
  modelica_string _name = NULL;
  modelica_metatype _vis = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _node has no default value.
  // _name has no default value.
  // _vis has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = _definition;
  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta1,2,8) == 0) MMC_THROW_INTERNAL();
  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(tmpMeta3), 2));
  _name = tmpMeta2;
  _vis = tmpMeta4;

  tmpMeta5 = mmc_mk_box8(3, &NFInstNode_InstNode_CLASS__NODE__desc, _name, _definition, mmc_mk_integer(omc_NFPrefixes_visibilityFromSCode(threadData, _vis)), omc_Pointer_create(threadData, _OMC_LIT63), omc_NFInstNode_CachedData_empty(threadData), _parent, _nodeType);
  _node = tmpMeta5;
  _return: OMC_LABEL_UNUSED
  return _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_InstNode_new(threadData_t *threadData, modelica_metatype _definition, modelica_metatype _parent)
{
  modelica_metatype _node = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _node has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _definition;
    {
      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,2,8) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_newClass(threadData, _definition, _parent, _OMC_LIT64);
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,8) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFInstNode_InstNode_newComponent(threadData, _definition, _parent);
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _node = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _node;
}

DLLDirection
modelica_metatype omc_NFInstNode_CachedData_clearPackageCache(threadData_t *threadData, modelica_metatype _in_caches)
{
  modelica_metatype _out_caches = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _out_caches = arrayUpdate(_in_caches, ((modelica_integer) 2), _OMC_LIT65);
  _return: OMC_LABEL_UNUSED
  return _out_caches;
}

DLLDirection
modelica_metatype omc_NFInstNode_CachedData_setPackageCache(threadData_t *threadData, modelica_metatype _in_caches, modelica_metatype _in_cache)
{
  modelica_metatype _out_caches = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _out_caches = arrayUpdate(_in_caches, ((modelica_integer) 2), _in_cache);
  _return: OMC_LABEL_UNUSED
  return _out_caches;
}

DLLDirection
modelica_metatype omc_NFInstNode_CachedData_getPackageCache(threadData_t *threadData, modelica_metatype _in_caches)
{
  modelica_metatype _out_cache = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _out_cache = arrayGet(_in_caches, ((modelica_integer) 2));
  _return: OMC_LABEL_UNUSED
  return _out_cache;
}

DLLDirection
void omc_NFInstNode_CachedData_setFuncCache(threadData_t *threadData, modelica_metatype _in_caches, modelica_metatype _in_cache)
{
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  arrayUpdate(_in_caches, ((modelica_integer) 1), _in_cache);
  _return: OMC_LABEL_UNUSED
  return;
}

DLLDirection
modelica_metatype omc_NFInstNode_CachedData_getFuncCache(threadData_t *threadData, modelica_metatype _in_caches)
{
  modelica_metatype _out_cache = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _out_cache = arrayGet(_in_caches, ((modelica_integer) 1));
  _return: OMC_LABEL_UNUSED
  return _out_cache;
}

DLLDirection
void omc_NFInstNode_CachedData_addFunc(threadData_t *threadData, modelica_metatype _fn, modelica_boolean _specialBuiltin, modelica_metatype _caches)
{
  modelica_metatype _func_cache = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _func_cache has no default value.
  _func_cache = omc_NFInstNode_CachedData_getFuncCache(threadData, _caches);

  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _func_cache;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          tmpMeta5 = mmc_mk_cons(_fn, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta6 = mmc_mk_box4(5, &NFInstNode_CachedData_FUNCTION__desc, tmpMeta5, mmc_mk_boolean(0 /* false */), mmc_mk_boolean(_specialBuiltin));
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          
          /* Pattern matching succeeded */
          tmpMeta7 = mmc_mk_cons(_fn, MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta8 = mmc_mk_box4(5, &NFInstNode_CachedData_FUNCTION__desc, listAppend((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func_cache), 2))), tmpMeta7), mmc_mk_boolean(0 /* false */), mmc_mk_boolean((mmc_unbox_boolean((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func_cache), 4)))) || _specialBuiltin)));
          tmpMeta1 = tmpMeta8;
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          omc_Error_terminate(threadData, _OMC_LIT66, _OMC_LIT67);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _func_cache = tmpMeta1;

  omc_NFInstNode_CachedData_setFuncCache(threadData, _caches, _func_cache);
  _return: OMC_LABEL_UNUSED
  return;
}
void boxptr_NFInstNode_CachedData_addFunc(threadData_t *threadData, modelica_metatype _fn, modelica_metatype _specialBuiltin, modelica_metatype _caches)
{
  modelica_integer tmp1;
  tmp1 = mmc_unbox_integer(_specialBuiltin);
  omc_NFInstNode_CachedData_addFunc(threadData, _fn, tmp1, _caches);
  return;
}

DLLDirection
void omc_NFInstNode_CachedData_initFunc(threadData_t *threadData, modelica_metatype _caches)
{
  modelica_metatype _func_cache = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _func_cache has no default value.
  _func_cache = omc_NFInstNode_CachedData_getFuncCache(threadData, _caches);

  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _func_cache;
    {
      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,0,0) == 0) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta1 = _OMC_LIT68;
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,3) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = _func_cache;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _func_cache = tmpMeta1;

  omc_NFInstNode_CachedData_setFuncCache(threadData, _caches, _func_cache);
  _return: OMC_LABEL_UNUSED
  return;
}

DLLDirection
modelica_metatype omc_NFInstNode_CachedData_empty(threadData_t *threadData)
{
  modelica_metatype _cache = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _cache = arrayCreate(((modelica_integer) 2), _OMC_LIT65);
  _return: OMC_LABEL_UNUSED
  return _cache;
}

