#include "omc_simulation_settings.h"
#include "NFEvalFunction.h"
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT0,1,5) {&ErrorTypes_MessageType_TRANSLATION__desc,}};
#define _OMC_LIT0 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT0)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT1,1,4) {&ErrorTypes_Severity_ERROR__desc,}};
#define _OMC_LIT1 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT1)
#define _OMC_LIT2_data "The language feature %s is not supported. Suggested workaround: %s"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT2,66,_OMC_LIT2_data);
#define _OMC_LIT2 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT2)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT3,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT2}};
#define _OMC_LIT3 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT3)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT4,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(35)),_OMC_LIT0,_OMC_LIT1,_OMC_LIT3}};
#define _OMC_LIT4 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT4)
#define _OMC_LIT5_data "\"record return value in external function\""
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT5,42,_OMC_LIT5_data);
#define _OMC_LIT5 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT5)
#define _OMC_LIT6_data "Pass the record as an output parameter"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT6,38,_OMC_LIT6_data);
#define _OMC_LIT6 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT7,2,1) {_OMC_LIT6,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT7 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT7)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT8,2,1) {_OMC_LIT5,_OMC_LIT7}};
#define _OMC_LIT8 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT8)
#define _OMC_LIT9_data "NFEvalFunction.getExternalOutputResult failed to find return value for output "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT9,78,_OMC_LIT9_data);
#define _OMC_LIT9 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT9)
#define _OMC_LIT10_data "/home/per/workspace/OpenModelica/OMCompiler/Compiler/NFFrontEnd/NFEvalFunction.mo"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT10,81,_OMC_LIT10_data);
#define _OMC_LIT10 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT10)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT11_6,1.770631566e9);
#define _OMC_LIT11_6 MMC_REFREALLIT(_OMC_LIT_STRUCT11_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT11,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT10,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1560)),MMC_IMMEDIATE(MMC_TAGFIXNUM(5)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1561)),MMC_IMMEDIATE(MMC_TAGFIXNUM(92)),_OMC_LIT11_6}};
#define _OMC_LIT11 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT11)
#define _OMC_LIT12_data ""
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT12,0,_OMC_LIT12_data);
#define _OMC_LIT12 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT12)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT13,0.0);
#define _OMC_LIT13 MMC_REFREALLIT(_OMC_LIT_STRUCT13)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT14,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT12,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_LIT13}};
#define _OMC_LIT14 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT14)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT15,4,3) {&NFCeval_EvalTarget_EVAL__TARGET__desc,_OMC_LIT14,MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),MMC_REFSTRUCTLIT(mmc_none)}};
#define _OMC_LIT15 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT15)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT16,2,3) {&NFExpression_INTEGER__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(0))}};
#define _OMC_LIT16 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT16)
#define _OMC_LIT17_data "/lib/"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT17,5,_OMC_LIT17_data);
#define _OMC_LIT17 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT17)
#define _OMC_LIT18_data "/omc"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT18,4,_OMC_LIT18_data);
#define _OMC_LIT18 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT18)
#define _OMC_LIT19_data "Library"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT19,7,_OMC_LIT19_data);
#define _OMC_LIT19 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT19)
#define _OMC_LIT20_data "LibraryDirectory"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT20,16,_OMC_LIT20_data);
#define _OMC_LIT20 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT20)
#define _OMC_LIT21_data "modelica://"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT21,11,_OMC_LIT21_data);
#define _OMC_LIT21 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT21)
#define _OMC_LIT22_data "/Resources/Library"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT22,18,_OMC_LIT22_data);
#define _OMC_LIT22 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT22)
#define _OMC_LIT23_data "lib"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT23,3,_OMC_LIT23_data);
#define _OMC_LIT23 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT23)
#define _OMC_LIT24_data "/ffi/"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT24,5,_OMC_LIT24_data);
#define _OMC_LIT24 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT24)
#define _OMC_LIT25_data ".so"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT25,3,_OMC_LIT25_data);
#define _OMC_LIT25 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT25)
#define _OMC_LIT26_data "/"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT26,1,_OMC_LIT26_data);
#define _OMC_LIT26 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT26)
#define _OMC_LIT27_data "NFEvalFunction.loadLibraryFunction"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT27,34,_OMC_LIT27_data);
#define _OMC_LIT27 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT27)
#define _OMC_LIT28_data "  "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT28,2,_OMC_LIT28_data);
#define _OMC_LIT28 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT28)
#define _OMC_LIT29_data "External function '%s' could not be found in any of the given shared libraries:\n%s"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT29,82,_OMC_LIT29_data);
#define _OMC_LIT29 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT29)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT30,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT29}};
#define _OMC_LIT30 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT30)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT31,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(384)),_OMC_LIT0,_OMC_LIT1,_OMC_LIT30}};
#define _OMC_LIT31 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT31)
#define _OMC_LIT32_data "\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT32,1,_OMC_LIT32_data);
#define _OMC_LIT32 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT32)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT33,1,12) {&NFType_NORETCALL__desc,}};
#define _OMC_LIT33 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT33)
#define _OMC_LIT34_data "dgeev"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT34,5,_OMC_LIT34_data);
#define _OMC_LIT34 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT34)
#define _OMC_LIT35_data "dgegv"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT35,5,_OMC_LIT35_data);
#define _OMC_LIT35 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT35)
#define _OMC_LIT36_data "dgels"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT36,5,_OMC_LIT36_data);
#define _OMC_LIT36 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT36)
#define _OMC_LIT37_data "dgelsx"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT37,6,_OMC_LIT37_data);
#define _OMC_LIT37 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT37)
#define _OMC_LIT38_data "dgelsy"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT38,6,_OMC_LIT38_data);
#define _OMC_LIT38 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT38)
#define _OMC_LIT39_data "dgesv"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT39,5,_OMC_LIT39_data);
#define _OMC_LIT39 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT39)
#define _OMC_LIT40_data "dgglse"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT40,6,_OMC_LIT40_data);
#define _OMC_LIT40 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT40)
#define _OMC_LIT41_data "dgtsv"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT41,5,_OMC_LIT41_data);
#define _OMC_LIT41 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT41)
#define _OMC_LIT42_data "dgbsv"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT42,5,_OMC_LIT42_data);
#define _OMC_LIT42 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT42)
#define _OMC_LIT43_data "dgesvd"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT43,6,_OMC_LIT43_data);
#define _OMC_LIT43 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT43)
#define _OMC_LIT44_data "dgetrf"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT44,6,_OMC_LIT44_data);
#define _OMC_LIT44 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT44)
#define _OMC_LIT45_data "dgetrs"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT45,6,_OMC_LIT45_data);
#define _OMC_LIT45 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT45)
#define _OMC_LIT46_data "dgetri"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT46,6,_OMC_LIT46_data);
#define _OMC_LIT46 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT46)
#define _OMC_LIT47_data "dgeqpf"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT47,6,_OMC_LIT47_data);
#define _OMC_LIT47 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT47)
#define _OMC_LIT48_data "dorgqr"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT48,6,_OMC_LIT48_data);
#define _OMC_LIT48 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT48)
#define _OMC_LIT49_data "dhseqr"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT49,6,_OMC_LIT49_data);
#define _OMC_LIT49 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT49)
#define _OMC_LIT50_data "evalLoopLimit"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT50,13,_OMC_LIT50_data);
#define _OMC_LIT50 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT50)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT51,1,4) {&Flags_FlagVisibility_EXTERNAL__desc,}};
#define _OMC_LIT51 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT51)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT52,2,5) {&Flags_FlagData_INT__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(100000))}};
#define _OMC_LIT52 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT52)
#define _OMC_LIT53_data "The loop iteration limit used when evaluating constant function calls."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT53,70,_OMC_LIT53_data);
#define _OMC_LIT53 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT53)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT54,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT53}};
#define _OMC_LIT54 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT54)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT55,8,3) {&Flags_ConfigFlag_CONFIG__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(117)),_OMC_LIT50,MMC_REFSTRUCTLIT(mmc_none),_OMC_LIT51,_OMC_LIT52,MMC_REFSTRUCTLIT(mmc_none),_OMC_LIT54}};
#define _OMC_LIT55 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT55)
#define _OMC_LIT56_data "The loop iteration limit (--evalLoopLimit=%s) was exceeded during evaluation."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT56,77,_OMC_LIT56_data);
#define _OMC_LIT56 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT56)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT57,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT56}};
#define _OMC_LIT57 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT57)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT58,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(106)),_OMC_LIT0,_OMC_LIT1,_OMC_LIT57}};
#define _OMC_LIT58 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT58)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT59,1,5) {&ErrorTypes_Severity_WARNING__desc,}};
#define _OMC_LIT59 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT59)
#define _OMC_LIT60_data "assert triggered: %s"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT60,20,_OMC_LIT60_data);
#define _OMC_LIT60 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT60)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT61,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT60}};
#define _OMC_LIT61 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT61)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT62,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(331)),_OMC_LIT0,_OMC_LIT59,_OMC_LIT61}};
#define _OMC_LIT62 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT62)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT63,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(332)),_OMC_LIT0,_OMC_LIT1,_OMC_LIT61}};
#define _OMC_LIT63 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT63)
#define _OMC_LIT64_data "NFEvalFunction.evaluateAssert failed to evaluate assert(false, "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT64,63,_OMC_LIT64_data);
#define _OMC_LIT64 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT64)
#define _OMC_LIT65_data ", "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT65,2,_OMC_LIT65_data);
#define _OMC_LIT65 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT65)
#define _OMC_LIT66_data ")"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT66,1,_OMC_LIT66_data);
#define _OMC_LIT66 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT66)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT67_6,1.770631566e9);
#define _OMC_LIT67_6 MMC_REFREALLIT(_OMC_LIT_STRUCT67_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT67,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT10,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1070)),MMC_IMMEDIATE(MMC_TAGFIXNUM(11)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1071)),MMC_IMMEDIATE(MMC_TAGFIXNUM(92)),_OMC_LIT67_6}};
#define _OMC_LIT67 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT67)
#define _OMC_LIT68_data "warning"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT68,7,_OMC_LIT68_data);
#define _OMC_LIT68 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT68)
#define _OMC_LIT69_data "error"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT69,5,_OMC_LIT69_data);
#define _OMC_LIT69 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT69)
#define _OMC_LIT70_data "NFEvalFunction.assignArrayElement: unimplemented case for "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT70,58,_OMC_LIT70_data);
#define _OMC_LIT70 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT70)
#define _OMC_LIT71_data " = "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT71,3,_OMC_LIT71_data);
#define _OMC_LIT71 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT71)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT72_6,1.770631566e9);
#define _OMC_LIT72_6 MMC_REFREALLIT(_OMC_LIT_STRUCT72_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT72,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT10,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(902)),MMC_IMMEDIATE(MMC_TAGFIXNUM(9)),MMC_IMMEDIATE(MMC_TAGFIXNUM(905)),MMC_IMMEDIATE(MMC_TAGFIXNUM(52)),_OMC_LIT72_6}};
#define _OMC_LIT72 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT72)
#define _OMC_LIT73_data "NFEvalFunction.assignVariable failed on "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT73,40,_OMC_LIT73_data);
#define _OMC_LIT73 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT73)
#define _OMC_LIT74_data " := "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT74,4,_OMC_LIT74_data);
#define _OMC_LIT74 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT74)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT75_6,1.770631566e9);
#define _OMC_LIT75_6 MMC_REFREALLIT(_OMC_LIT_STRUCT75_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT75,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT10,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(816)),MMC_IMMEDIATE(MMC_TAGFIXNUM(9)),MMC_IMMEDIATE(MMC_TAGFIXNUM(817)),MMC_IMMEDIATE(MMC_TAGFIXNUM(93)),_OMC_LIT75_6}};
#define _OMC_LIT75 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT75)
#define _OMC_LIT76_data "NFEvalFunction.evaluateStatement failed on "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT76,43,_OMC_LIT76_data);
#define _OMC_LIT76 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT76)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT77_6,1.770631566e9);
#define _OMC_LIT77_6 MMC_REFREALLIT(_OMC_LIT_STRUCT77_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT77,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT10,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(753)),MMC_IMMEDIATE(MMC_TAGFIXNUM(9)),MMC_IMMEDIATE(MMC_TAGFIXNUM(753)),MMC_IMMEDIATE(MMC_TAGFIXNUM(105)),_OMC_LIT77_6}};
#define _OMC_LIT77 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT77)
#define _OMC_LIT78_data "Output parameter %s was not assigned a value"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT78,44,_OMC_LIT78_data);
#define _OMC_LIT78 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT78)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT79,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT78}};
#define _OMC_LIT79 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT79)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT80,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(335)),_OMC_LIT0,_OMC_LIT59,_OMC_LIT79}};
#define _OMC_LIT80 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT80)
#define _OMC_LIT81_data "NFEvalFunction.applyReplacementCref could not find replacement for "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT81,67,_OMC_LIT81_data);
#define _OMC_LIT81 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT81)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT82_6,1.770631566e9);
#define _OMC_LIT82_6 MMC_REFREALLIT(_OMC_LIT_STRUCT82_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT82,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT10,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(502)),MMC_IMMEDIATE(MMC_TAGFIXNUM(9)),MMC_IMMEDIATE(MMC_TAGFIXNUM(503)),MMC_IMMEDIATE(MMC_TAGFIXNUM(53)),_OMC_LIT82_6}};
#define _OMC_LIT82 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT82)
#define _OMC_LIT83_data "Failed to evaluate function: %s."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT83,32,_OMC_LIT83_data);
#define _OMC_LIT83 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT83)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT84,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT83}};
#define _OMC_LIT84 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT84)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT85,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(506)),_OMC_LIT0,_OMC_LIT1,_OMC_LIT84}};
#define _OMC_LIT85 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT85)
#define _OMC_LIT86_data "."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT86,1,_OMC_LIT86_data);
#define _OMC_LIT86 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT86)
#define _OMC_LIT87_data "builtin"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT87,7,_OMC_LIT87_data);
#define _OMC_LIT87 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT87)
#define _OMC_LIT88_data "FORTRAN 77"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT88,10,_OMC_LIT88_data);
#define _OMC_LIT88 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT88)
#define _OMC_LIT89_data "evalRecursionLimit"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT89,18,_OMC_LIT89_data);
#define _OMC_LIT89 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT89)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT90,2,5) {&Flags_FlagData_INT__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(256))}};
#define _OMC_LIT90 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT90)
#define _OMC_LIT91_data "The recursion limit used when evaluating constant function calls."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT91,65,_OMC_LIT91_data);
#define _OMC_LIT91 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT91)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT92,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT91}};
#define _OMC_LIT92 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT92)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT93,8,3) {&Flags_ConfigFlag_CONFIG__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(118)),_OMC_LIT89,MMC_REFSTRUCTLIT(mmc_none),_OMC_LIT51,_OMC_LIT90,MMC_REFSTRUCTLIT(mmc_none),_OMC_LIT92}};
#define _OMC_LIT93 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT93)
#define _OMC_LIT94_data "The recursion limit (--evalRecursionLimit=%s) was exceeded during evaluation of %s."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT94,83,_OMC_LIT94_data);
#define _OMC_LIT94 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT94)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT95,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT94}};
#define _OMC_LIT95 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT95)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT96,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(334)),_OMC_LIT0,_OMC_LIT1,_OMC_LIT95}};
#define _OMC_LIT96 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT96)
#define _OMC_LIT97_data " => "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT97,4,_OMC_LIT97_data);
#define _OMC_LIT97 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT97)
#define _OMC_LIT98_data "\nArguments:\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT98,12,_OMC_LIT98_data);
#define _OMC_LIT98 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT98)
#define _OMC_LIT99_data "evalFuncDump"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT99,12,_OMC_LIT99_data);
#define _OMC_LIT99 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT99)
#define _OMC_LIT100_data "dumps debug information about the function evaluation"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT100,53,_OMC_LIT100_data);
#define _OMC_LIT100 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT100)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT101,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT100}};
#define _OMC_LIT101 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT101)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT102,5,3) {&Flags_DebugFlag_DEBUG__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(99)),_OMC_LIT99,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),_OMC_LIT101}};
#define _OMC_LIT102 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT102)
#include "util/modelica.h"

#include "NFEvalFunction_includes.h"


/* default, do not make protected functions static */
#if !defined(PROTECTED_FUNCTION_STATIC)
#define PROTECTED_FUNCTION_STATIC
#endif
PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_checkExtReturnValue(threadData_t *threadData, modelica_metatype _cref, modelica_metatype _info);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_checkExtReturnValue,2,0) {(void*) boxptr_NFEvalFunction_checkExtReturnValue,0}};
#define boxvar_NFEvalFunction_checkExtReturnValue MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_checkExtReturnValue)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_getExternalOutputResult(threadData_t *threadData, modelica_metatype _outputNode, modelica_metatype _map);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_getExternalOutputResult,2,0) {(void*) boxptr_NFEvalFunction_getExternalOutputResult,0}};
#define boxvar_NFEvalFunction_getExternalOutputResult MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_getExternalOutputResult)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_makeExternalResult(threadData_t *threadData, modelica_metatype _values, modelica_metatype _outputRef, modelica_metatype _extArgs, modelica_metatype _outputs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_makeExternalResult,2,0) {(void*) boxptr_NFEvalFunction_makeExternalResult,0}};
#define boxvar_NFEvalFunction_makeExternalResult MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_makeExternalResult)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_mapExternalArg(threadData_t *threadData, modelica_metatype _extArg, modelica_metatype _argMap, modelica_metatype _fn, modelica_integer *out_spec);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_mapExternalArg(threadData_t *threadData, modelica_metatype _extArg, modelica_metatype _argMap, modelica_metatype _fn, modelica_metatype *out_spec);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_mapExternalArg,2,0) {(void*) boxptr_NFEvalFunction_mapExternalArg,0}};
#define boxvar_NFEvalFunction_mapExternalArg MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_mapExternalArg)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_makeExternalArg(threadData_t *threadData, modelica_metatype _arg);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_makeExternalArg,2,0) {(void*) boxptr_NFEvalFunction_makeExternalArg,0}};
#define boxvar_NFEvalFunction_makeExternalArg MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_makeExternalArg)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_mapExternalArgs(threadData_t *threadData, modelica_metatype _fn, modelica_metatype _inputArgs, modelica_metatype _extArgs, modelica_metatype *out_argSpecs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_mapExternalArgs,2,0) {(void*) boxptr_NFEvalFunction_mapExternalArgs,0}};
#define boxvar_NFEvalFunction_mapExternalArgs MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_mapExternalArgs)
PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_freeLibraryFunction(threadData_t *threadData, modelica_integer _fnHandle, modelica_boolean _debug);
PROTECTED_FUNCTION_STATIC void boxptr_NFEvalFunction_freeLibraryFunction(threadData_t *threadData, modelica_metatype _fnHandle, modelica_metatype _debug);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_freeLibraryFunction,2,0) {(void*) boxptr_NFEvalFunction_freeLibraryFunction,0}};
#define boxvar_NFEvalFunction_freeLibraryFunction MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_freeLibraryFunction)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_parseExternalAnnotationExp(threadData_t *threadData, modelica_metatype _exp, modelica_metatype __omcQ_24in_5Fstrl);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_parseExternalAnnotationExp,2,0) {(void*) boxptr_NFEvalFunction_parseExternalAnnotationExp,0}};
#define boxvar_NFEvalFunction_parseExternalAnnotationExp MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_parseExternalAnnotationExp)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_parseExternalAnnotation(threadData_t *threadData, modelica_string _name, modelica_metatype _ann);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_parseExternalAnnotation,2,0) {(void*) boxptr_NFEvalFunction_parseExternalAnnotation,0}};
#define boxvar_NFEvalFunction_parseExternalAnnotation MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_parseExternalAnnotation)
PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_loadLibraryFunction(threadData_t *threadData, modelica_string _libName, modelica_string _fnName, modelica_metatype _extAnnotation, modelica_boolean _debug, modelica_metatype _info);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_loadLibraryFunction(threadData_t *threadData, modelica_metatype _libName, modelica_metatype _fnName, modelica_metatype _extAnnotation, modelica_metatype _debug, modelica_metatype _info);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_loadLibraryFunction,2,0) {(void*) boxptr_NFEvalFunction_loadLibraryFunction,0}};
#define boxvar_NFEvalFunction_loadLibraryFunction MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_loadLibraryFunction)
PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_cacheLibrary(threadData_t *threadData, modelica_string _libName, modelica_integer _libHandle);
PROTECTED_FUNCTION_STATIC void boxptr_NFEvalFunction_cacheLibrary(threadData_t *threadData, modelica_metatype _libName, modelica_metatype _libHandle);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_cacheLibrary,2,0) {(void*) boxptr_NFEvalFunction_cacheLibrary,0}};
#define boxvar_NFEvalFunction_cacheLibrary MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_cacheLibrary)
PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_lookupLibraryInCache(threadData_t *threadData, modelica_string _libName);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_lookupLibraryInCache(threadData_t *threadData, modelica_metatype _libName);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_lookupLibraryInCache,2,0) {(void*) boxptr_NFEvalFunction_lookupLibraryInCache,0}};
#define boxvar_NFEvalFunction_lookupLibraryInCache MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_lookupLibraryInCache)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_callExternalFunction(threadData_t *threadData, modelica_string _extName, modelica_metatype _fn, modelica_metatype _args, modelica_metatype _extArgs, modelica_metatype _outputRef, modelica_metatype _extAnnotation, modelica_boolean _debug);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_callExternalFunction(threadData_t *threadData, modelica_metatype _extName, modelica_metatype _fn, modelica_metatype _args, modelica_metatype _extArgs, modelica_metatype _outputRef, modelica_metatype _extAnnotation, modelica_metatype _debug);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_callExternalFunction,2,0) {(void*) boxptr_NFEvalFunction_callExternalFunction,0}};
#define boxvar_NFEvalFunction_callExternalFunction MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_callExternalFunction)
PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_evaluateExternal3(threadData_t *threadData, modelica_string _name, modelica_metatype _args);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateExternal3,2,0) {(void*) boxptr_NFEvalFunction_evaluateExternal3,0}};
#define boxvar_NFEvalFunction_evaluateExternal3 MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateExternal3)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_evaluateExternal2(threadData_t *threadData, modelica_string _name, modelica_metatype _fn, modelica_metatype _args, modelica_metatype _extArgs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateExternal2,2,0) {(void*) boxptr_NFEvalFunction_evaluateExternal2,0}};
#define boxvar_NFEvalFunction_evaluateExternal2 MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateExternal2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_evalTargetFromSource(threadData_t *threadData, modelica_metatype _source, modelica_integer _context, modelica_integer _currentContext);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evalTargetFromSource(threadData_t *threadData, modelica_metatype _source, modelica_metatype _context, modelica_metatype _currentContext);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evalTargetFromSource,2,0) {(void*) boxptr_NFEvalFunction_evalTargetFromSource,0}};
#define boxvar_NFEvalFunction_evalTargetFromSource MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evalTargetFromSource)
PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateWhile(threadData_t *threadData, modelica_metatype _condition, modelica_metatype _body, modelica_metatype _source, modelica_integer _context);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateWhile(threadData_t *threadData, modelica_metatype _condition, modelica_metatype _body, modelica_metatype _source, modelica_metatype _context);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateWhile,2,0) {(void*) boxptr_NFEvalFunction_evaluateWhile,0}};
#define boxvar_NFEvalFunction_evaluateWhile MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateWhile)
PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateNoRetCall(threadData_t *threadData, modelica_metatype _callExp, modelica_metatype _source, modelica_integer _context);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateNoRetCall(threadData_t *threadData, modelica_metatype _callExp, modelica_metatype _source, modelica_metatype _context);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateNoRetCall,2,0) {(void*) boxptr_NFEvalFunction_evaluateNoRetCall,0}};
#define boxvar_NFEvalFunction_evaluateNoRetCall MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateNoRetCall)
PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateAssert(threadData_t *threadData, modelica_metatype _condition, modelica_metatype _assertStmt, modelica_metatype _source, modelica_integer _context);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateAssert(threadData_t *threadData, modelica_metatype _condition, modelica_metatype _assertStmt, modelica_metatype _source, modelica_metatype _context);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateAssert,2,0) {(void*) boxptr_NFEvalFunction_evaluateAssert,0}};
#define boxvar_NFEvalFunction_evaluateAssert MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateAssert)
PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateIf(threadData_t *threadData, modelica_metatype _branches, modelica_metatype _source, modelica_integer _context);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateIf(threadData_t *threadData, modelica_metatype _branches, modelica_metatype _source, modelica_metatype _context);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateIf,2,0) {(void*) boxptr_NFEvalFunction_evaluateIf,0}};
#define boxvar_NFEvalFunction_evaluateIf MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateIf)
PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateFor(threadData_t *threadData, modelica_metatype _iterator, modelica_metatype _range, modelica_metatype _forBody, modelica_metatype _source, modelica_integer _context);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateFor(threadData_t *threadData, modelica_metatype _iterator, modelica_metatype _range, modelica_metatype _forBody, modelica_metatype _source, modelica_metatype _context);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateFor,2,0) {(void*) boxptr_NFEvalFunction_evaluateFor,0}};
#define boxvar_NFEvalFunction_evaluateFor MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateFor)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_assignRecord(threadData_t *threadData, modelica_metatype _lhs, modelica_metatype _rhs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_assignRecord,2,0) {(void*) boxptr_NFEvalFunction_assignRecord,0}};
#define boxvar_NFEvalFunction_assignRecord MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_assignRecord)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_assignExp(threadData_t *threadData, modelica_metatype _lhs, modelica_metatype _rhs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_assignExp,2,0) {(void*) boxptr_NFEvalFunction_assignExp,0}};
#define boxvar_NFEvalFunction_assignExp MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_assignExp)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_assignArrayElement(threadData_t *threadData, modelica_metatype _arrayExp, modelica_metatype _subscripts, modelica_metatype _value);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_assignArrayElement,2,0) {(void*) boxptr_NFEvalFunction_assignArrayElement,0}};
#define boxvar_NFEvalFunction_assignArrayElement MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_assignArrayElement)
PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_assignSubscriptedVariable(threadData_t *threadData, modelica_metatype _variable, modelica_metatype _subscripts, modelica_metatype _value);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_assignSubscriptedVariable,2,0) {(void*) boxptr_NFEvalFunction_assignSubscriptedVariable,0}};
#define boxvar_NFEvalFunction_assignSubscriptedVariable MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_assignSubscriptedVariable)
PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateAssignment(threadData_t *threadData, modelica_metatype _lhsExp, modelica_metatype _rhsExp, modelica_metatype _source, modelica_integer _context);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateAssignment(threadData_t *threadData, modelica_metatype _lhsExp, modelica_metatype _rhsExp, modelica_metatype _source, modelica_metatype _context);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateAssignment,2,0) {(void*) boxptr_NFEvalFunction_evaluateAssignment,0}};
#define boxvar_NFEvalFunction_evaluateAssignment MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateAssignment)
PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateStatement(threadData_t *threadData, modelica_metatype _stmt, modelica_integer _context);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateStatement(threadData_t *threadData, modelica_metatype _stmt, modelica_metatype _context);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateStatement,2,0) {(void*) boxptr_NFEvalFunction_evaluateStatement,0}};
#define boxvar_NFEvalFunction_evaluateStatement MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateStatement)
PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateStatements(threadData_t *threadData, modelica_metatype _stmts, modelica_integer _context);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateStatements(threadData_t *threadData, modelica_metatype _stmts, modelica_metatype _context);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateStatements,2,0) {(void*) boxptr_NFEvalFunction_evaluateStatements,0}};
#define boxvar_NFEvalFunction_evaluateStatements MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateStatements)
PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_assertAssignedOutput(threadData_t *threadData, modelica_metatype _outputNode, modelica_metatype _value);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_assertAssignedOutput,2,0) {(void*) boxptr_NFEvalFunction_assertAssignedOutput,0}};
#define boxvar_NFEvalFunction_assertAssignedOutput MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_assertAssignedOutput)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_createResult(threadData_t *threadData, modelica_metatype _map, modelica_metatype _outputs);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_createResult,2,0) {(void*) boxptr_NFEvalFunction_createResult,0}};
#define boxvar_NFEvalFunction_createResult MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_createResult)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_optimizeStatement(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fstmt);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_optimizeStatement,2,0) {(void*) boxptr_NFEvalFunction_optimizeStatement,0}};
#define boxvar_NFEvalFunction_optimizeStatement MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_optimizeStatement)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_optimizeBody(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fbody);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_optimizeBody,2,0) {(void*) boxptr_NFEvalFunction_optimizeBody,0}};
#define boxvar_NFEvalFunction_optimizeBody MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_optimizeBody)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_mergeFunctionApplicationArgs(threadData_t *threadData, modelica_metatype _oldFn, modelica_metatype _oldArgs, modelica_metatype _newFn, modelica_metatype _newArgs, modelica_metatype _argNames);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_mergeFunctionApplicationArgs,2,0) {(void*) boxptr_NFEvalFunction_mergeFunctionApplicationArgs,0}};
#define boxvar_NFEvalFunction_mergeFunctionApplicationArgs MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_mergeFunctionApplicationArgs)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_evaluateReplacement2(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateReplacement2,2,0) {(void*) boxptr_NFEvalFunction_evaluateReplacement2,0}};
#define boxvar_NFEvalFunction_evaluateReplacement2 MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateReplacement2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_evaluateReplacement(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateReplacement,2,0) {(void*) boxptr_NFEvalFunction_evaluateReplacement,0}};
#define boxvar_NFEvalFunction_evaluateReplacement MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_evaluateReplacement)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyReplacementCall(threadData_t *threadData, modelica_metatype _map, modelica_metatype _call, modelica_metatype _exp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyReplacementCall,2,0) {(void*) boxptr_NFEvalFunction_applyReplacementCall,0}};
#define boxvar_NFEvalFunction_applyReplacementCall MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyReplacementCall)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyReplacementCref(threadData_t *threadData, modelica_metatype _map, modelica_metatype _cref, modelica_metatype _exp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyReplacementCref,2,0) {(void*) boxptr_NFEvalFunction_applyReplacementCref,0}};
#define boxvar_NFEvalFunction_applyReplacementCref MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyReplacementCref)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyReplacements2(threadData_t *threadData, modelica_metatype _map, modelica_metatype __omcQ_24in_5Fexp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyReplacements2,2,0) {(void*) boxptr_NFEvalFunction_applyReplacements2,0}};
#define boxvar_NFEvalFunction_applyReplacements2 MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyReplacements2)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyReplacements(threadData_t *threadData, modelica_metatype _map, modelica_metatype __omcQ_24in_5FfnBody);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyReplacements,2,0) {(void*) boxptr_NFEvalFunction_applyReplacements,0}};
#define boxvar_NFEvalFunction_applyReplacements MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyReplacements)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyBindingReplacement(threadData_t *threadData, modelica_metatype _exp, modelica_metatype _map);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyBindingReplacement,2,0) {(void*) boxptr_NFEvalFunction_applyBindingReplacement,0}};
#define boxvar_NFEvalFunction_applyBindingReplacement MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyBindingReplacement)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_buildRecordBinding(threadData_t *threadData, modelica_metatype _recordNode, modelica_metatype _map, modelica_boolean _mutableParams);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_buildRecordBinding(threadData_t *threadData, modelica_metatype _recordNode, modelica_metatype _map, modelica_metatype _mutableParams);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_buildRecordBinding,2,0) {(void*) boxptr_NFEvalFunction_buildRecordBinding,0}};
#define boxvar_NFEvalFunction_buildRecordBinding MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_buildRecordBinding)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyReplacementsDim(threadData_t *threadData, modelica_metatype _map, modelica_metatype __omcQ_24in_5Fdim);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyReplacementsDim,2,0) {(void*) boxptr_NFEvalFunction_applyReplacementsDim,0}};
#define boxvar_NFEvalFunction_applyReplacementsDim MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_applyReplacementsDim)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_buildBinding(threadData_t *threadData, modelica_metatype _node, modelica_metatype _map, modelica_boolean _mutableParams, modelica_boolean _buildArrayBinding);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_buildBinding(threadData_t *threadData, modelica_metatype _node, modelica_metatype _map, modelica_metatype _mutableParams, modelica_metatype _buildArrayBinding);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_buildBinding,2,0) {(void*) boxptr_NFEvalFunction_buildBinding,0}};
#define boxvar_NFEvalFunction_buildBinding MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_buildBinding)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_getBindingExp(threadData_t *threadData, modelica_metatype _node, modelica_metatype _map, modelica_boolean _mutableParams, modelica_boolean _buildArrayBinding);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_getBindingExp(threadData_t *threadData, modelica_metatype _node, modelica_metatype _map, modelica_metatype _mutableParams, modelica_metatype _buildArrayBinding);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_getBindingExp,2,0) {(void*) boxptr_NFEvalFunction_getBindingExp,0}};
#define boxvar_NFEvalFunction_getBindingExp MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_getBindingExp)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_addImmutableArgument(threadData_t *threadData, modelica_metatype _node, modelica_metatype __omcQ_24in_5Fmap, modelica_boolean _buildArrayBinding);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_addImmutableArgument(threadData_t *threadData, modelica_metatype _node, modelica_metatype __omcQ_24in_5Fmap, modelica_metatype _buildArrayBinding);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_addImmutableArgument,2,0) {(void*) boxptr_NFEvalFunction_addImmutableArgument,0}};
#define boxvar_NFEvalFunction_addImmutableArgument MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_addImmutableArgument)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_addMutableArgument(threadData_t *threadData, modelica_metatype _node, modelica_metatype __omcQ_24in_5Fmap, modelica_boolean _buildArrayBinding);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_addMutableArgument(threadData_t *threadData, modelica_metatype _node, modelica_metatype __omcQ_24in_5Fmap, modelica_metatype _buildArrayBinding);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_addMutableArgument,2,0) {(void*) boxptr_NFEvalFunction_addMutableArgument,0}};
#define boxvar_NFEvalFunction_addMutableArgument MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_addMutableArgument)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_createArgumentMap(threadData_t *threadData, modelica_metatype _inputs, modelica_metatype _outputs, modelica_metatype _locals, modelica_metatype _args, modelica_boolean _mutableParams, modelica_boolean _buildArrayBinding);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_createArgumentMap(threadData_t *threadData, modelica_metatype _inputs, modelica_metatype _outputs, modelica_metatype _locals, modelica_metatype _args, modelica_metatype _mutableParams, modelica_metatype _buildArrayBinding);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NFEvalFunction_createArgumentMap,2,0) {(void*) boxptr_NFEvalFunction_createArgumentMap,0}};
#define boxvar_NFEvalFunction_createArgumentMap MMC_REFSTRUCTLIT(boxvar_lit_NFEvalFunction_createArgumentMap)

PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_checkExtReturnValue(threadData_t *threadData, modelica_metatype _cref, modelica_metatype _info)
{
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  if((omc_NFComponentRef_isCref(threadData, _cref) && omc_NFType_isRecord(threadData, omc_NFComponentRef_nodeType(threadData, _cref))))
  {
    omc_Error_addSourceMessage(threadData, _OMC_LIT4, _OMC_LIT8, _info);

    MMC_THROW_INTERNAL();
  }
  _return: OMC_LABEL_UNUSED
  return;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_getExternalOutputResult(threadData_t *threadData, modelica_metatype _outputNode, modelica_metatype _map)
{
  modelica_metatype _exp = NULL;
  modelica_metatype _oexp = NULL;
  modelica_metatype _comps = NULL;
  modelica_metatype _expl = NULL;
  modelica_metatype _cls_node = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_integer tmp7;
  modelica_integer tmp8;
  modelica_metatype tmpMeta9;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  // _oexp has no default value.
  // _comps has no default value.
  // _expl has no default value.
  // _cls_node has no default value.
  _oexp = omc_UnorderedMap_get(threadData, _outputNode, _map);

  if(isSome(_oexp))
  {
    /* Pattern-matching assignment */
    tmpMeta1 = _oexp;
    if (optionNone(tmpMeta1)) MMC_THROW_INTERNAL();
    tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 1));
    _exp = tmpMeta2;
  }
  else
  {
    if(omc_NFInstNode_InstNode_isRecord(threadData, _outputNode))
    {
      _cls_node = omc_NFInstNode_InstNode_classScope(threadData, _outputNode);

      _comps = omc_NFClassTree_ClassTree_getComponents(threadData, omc_NFClass_classTree(threadData, omc_NFInstNode_InstNode_getClass(threadData, _cls_node)));

      tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
      _expl = tmpMeta3;

      {
        modelica_metatype _c;
        for (tmpMeta4 = _comps, tmp8 = arrayLength(tmpMeta4), tmp7 = 1; tmp7 <= tmp8; tmp7++)
        {
          _c = arrayGet(tmpMeta4,tmp7);
          tmpMeta5 = mmc_mk_cons(omc_NFEvalFunction_getExternalOutputResult(threadData, _c, _map), _expl);
          _expl = tmpMeta5;
        }
      }

      _exp = omc_NFExpression_makeRecord(threadData, omc_NFInstNode_InstNode_fullPath(threadData, _cls_node, 0 /* false */), omc_NFInstNode_InstNode_getType(threadData, _cls_node), listReverseInPlace(_expl));
    }
    else
    {
      tmpMeta9 = stringAppend(_OMC_LIT9,omc_NFInstNode_InstNode_name(threadData, _outputNode));
      omc_Error_assertion(threadData, 0 /* false */, tmpMeta9, _OMC_LIT11);
    }
  }
  _return: OMC_LABEL_UNUSED
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_makeExternalResult(threadData_t *threadData, modelica_metatype _values, modelica_metatype _outputRef, modelica_metatype _extArgs, modelica_metatype _outputs)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _arg_map = NULL;
  modelica_metatype _val = NULL;
  modelica_metatype _vals = NULL;
  modelica_metatype _ret_vals = NULL;
  modelica_metatype _ret_val = NULL;
  modelica_metatype _cref = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta12;
  modelica_metatype tmpMeta13;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _arg_map has no default value.
  // _val has no default value.
  // _vals has no default value.
  // _ret_vals has no default value.
  // _ret_val has no default value.
  // _cref has no default value.
  _arg_map = omc_UnorderedMap_new(threadData, boxvar_NFInstNode_InstNode_hash, boxvar_NFInstNode_InstNode_refEqual, ((modelica_integer) 1));

  /* Pattern-matching assignment */
  tmpMeta1 = _values;
  if (listEmpty(tmpMeta1)) MMC_THROW_INTERNAL();
  tmpMeta2 = MMC_CAR(tmpMeta1);
  tmpMeta3 = MMC_CDR(tmpMeta1);
  _val = tmpMeta2;
  _vals = tmpMeta3;

  if(omc_NFComponentRef_isCref(threadData, _outputRef))
  {
    omc_UnorderedMap_addUnique(threadData, omc_NFComponentRef_node(threadData, _outputRef), _val, _arg_map);
  }

  {
    modelica_metatype _ext_arg;
    for (tmpMeta4 = _extArgs; !listEmpty(tmpMeta4); tmpMeta4=MMC_CDR(tmpMeta4))
    {
      _ext_arg = MMC_CAR(tmpMeta4);
      { /* match expression */
        modelica_metatype tmp7_1;
        tmp7_1 = _ext_arg;
        {
          volatile mmc_switch_type tmp7;
          int tmp8;
          tmp7 = 0;
          for (; tmp7 < 2; tmp7++) {
            switch (MMC_SWITCH_CAST(tmp7)) {
            case 0: {
              modelica_metatype tmpMeta9;
              modelica_metatype tmpMeta10;
              modelica_metatype tmpMeta11;
              if (mmc__uniontype__metarecord__typedef__equal(tmp7_1,6,2) == 0) goto tmp6_end;
              
              /* Pattern matching succeeded */
              /* Check guard condition after assignments */
              if (!omc_NFInstNode_InstNode_isOutput(threadData, omc_NFComponentRef_node(threadData, omc_NFComponentRef_last(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ext_arg), 3))))))) goto tmp6_end;
              /* Pattern-matching assignment */
              tmpMeta9 = _vals;
              if (listEmpty(tmpMeta9)) goto goto_5;
              tmpMeta10 = MMC_CAR(tmpMeta9);
              tmpMeta11 = MMC_CDR(tmpMeta9);
              _val = tmpMeta10;
              _vals = tmpMeta11;

              omc_UnorderedMap_addUnique(threadData, omc_NFComponentRef_node(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ext_arg), 3)))), _val, _arg_map);
              goto tmp6_done;
            }
            case 1: {
              
              /* Pattern matching succeeded */
              goto tmp6_done;
            }
            }
            goto tmp6_end;
            tmp6_end: ;
          }
          goto goto_5;
          goto_5:;
          MMC_THROW_INTERNAL();
          goto tmp6_done;
          tmp6_done:;
        }
      }
      ;
    }
  }

  {
    modelica_metatype __omcQ_24tmpVar3;
    modelica_metatype* tmp14;
    modelica_metatype tmpMeta15;
    modelica_metatype __omcQ_24tmpVar2;
    modelica_integer tmp16;
    modelica_metatype _o_loopVar = 0;
    modelica_metatype _o;
    _o_loopVar = _outputs;
    tmpMeta15 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar3 = tmpMeta15; /* defaultValue */
    tmp14 = &__omcQ_24tmpVar3;
    while(1) {
      tmp16 = 1;
      if (!listEmpty(_o_loopVar)) {
        _o = MMC_CAR(_o_loopVar);
        _o_loopVar = MMC_CDR(_o_loopVar);
        tmp16--;
      }
      if (tmp16 == 0) {
        __omcQ_24tmpVar2 = omc_NFEvalFunction_getExternalOutputResult(threadData, _o, _arg_map);
        *tmp14 = mmc_mk_cons(__omcQ_24tmpVar2,0);
        tmp14 = &MMC_CDR(*tmp14);
      } else if (tmp16 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp14 = mmc_mk_nil();
    tmpMeta13 = __omcQ_24tmpVar3;
  }
  _ret_vals = tmpMeta13;

  _outExp = omc_NFExpression_makeTuple(threadData, _ret_vals);
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_mapExternalArg(threadData_t *threadData, modelica_metatype _extArg, modelica_metatype _argMap, modelica_metatype _fn, modelica_integer *out_spec)
{
  modelica_metatype _arg = NULL;
  modelica_integer _spec;
  modelica_metatype _cr_node = NULL;
  modelica_integer tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _arg has no default value.
  // _spec has no default value.
  // _cr_node has no default value.
  _arg = omc_NFEvalFunction_applyBindingReplacement(threadData, _extArg, _argMap);

  _arg = omc_NFCeval_evalExp(threadData, _arg, _OMC_LIT15);

  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _extArg;
    {
      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,6,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _cr_node = omc_NFComponentRef_node(threadData, omc_NFComponentRef_last(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_extArg), 3)))));

          if(omc_NFInstNode_InstNode_isProtected(threadData, _cr_node))
          {
            _spec = 3;
          }
          else
          {
            if(omc_NFInstNode_InstNode_isOutput(threadData, _cr_node))
            {
              _spec = 2;
            }
            else
            {
              _spec = 1;
            }
          }
          tmp1 = (modelica_integer)_spec;
          goto tmp3_done;
        }
        case 1: {
          
          /* 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:;
    }
  }
  _spec = tmp1;
  _return: OMC_LABEL_UNUSED
  if (out_spec) { *out_spec = _spec; }
  return _arg;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_mapExternalArg(threadData_t *threadData, modelica_metatype _extArg, modelica_metatype _argMap, modelica_metatype _fn, modelica_metatype *out_spec)
{
  modelica_integer _spec;
  modelica_metatype _arg = NULL;
  _arg = omc_NFEvalFunction_mapExternalArg(threadData, _extArg, _argMap, _fn, &_spec);
  /* skip box _arg; NFExpression */
  if (out_spec) { *out_spec = mmc_mk_icon(_spec); }
  return _arg;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_makeExternalArg(threadData_t *threadData, modelica_metatype _arg)
{
  modelica_metatype _extArg = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _extArg has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _arg;
    {
      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,32,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_box2(5, &NFExpression_STRING__desc, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_arg), 2))));
          tmpMeta1 = tmpMeta6;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _arg;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _extArg = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _extArg;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_mapExternalArgs(threadData_t *threadData, modelica_metatype _fn, modelica_metatype _inputArgs, modelica_metatype _extArgs, modelica_metatype *out_argSpecs)
{
  modelica_metatype _mappedArgs = NULL;
  modelica_metatype _argSpecs = NULL;
  modelica_metatype _arg_map = NULL;
  modelica_metatype _marg = NULL;
  modelica_integer _arg_spec;
  modelica_integer _args_len;
  modelica_integer _i;
  modelica_metatype _input_args = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _mappedArgs has no default value.
  // _argSpecs has no default value.
  // _arg_map has no default value.
  // _marg has no default value.
  // _arg_spec has no default value.
  // _args_len has no default value.
  _i = ((modelica_integer) 1);
  // _input_args has no default value.
  {
    modelica_metatype __omcQ_24tmpVar5;
    modelica_metatype* tmp2;
    modelica_metatype tmpMeta3;
    modelica_metatype __omcQ_24tmpVar4;
    modelica_integer tmp4;
    modelica_metatype _arg_loopVar = 0;
    modelica_metatype _arg;
    _arg_loopVar = _inputArgs;
    tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar5 = tmpMeta3; /* defaultValue */
    tmp2 = &__omcQ_24tmpVar5;
    while(1) {
      tmp4 = 1;
      if (!listEmpty(_arg_loopVar)) {
        _arg = MMC_CAR(_arg_loopVar);
        _arg_loopVar = MMC_CDR(_arg_loopVar);
        tmp4--;
      }
      if (tmp4 == 0) {
        __omcQ_24tmpVar4 = omc_NFEvalFunction_makeExternalArg(threadData, _arg);
        *tmp2 = mmc_mk_cons(__omcQ_24tmpVar4,0);
        tmp2 = &MMC_CDR(*tmp2);
      } else if (tmp4 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp2 = mmc_mk_nil();
    tmpMeta1 = __omcQ_24tmpVar5;
  }
  _input_args = tmpMeta1;

  _arg_map = omc_NFEvalFunction_createArgumentMap(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 4))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 5))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 6))), _input_args, 0 /* false */, 0 /* false */);

  _args_len = listLength(_extArgs);

  _mappedArgs = arrayCreateNoInit(_args_len, _OMC_LIT16);

  _argSpecs = arrayCreateNoInit(_args_len, mmc_mk_integer(1));

  {
    modelica_metatype _ext_arg;
    for (tmpMeta5 = _extArgs; !listEmpty(tmpMeta5); tmpMeta5=MMC_CDR(tmpMeta5))
    {
      _ext_arg = MMC_CAR(tmpMeta5);
      _marg = omc_NFEvalFunction_mapExternalArg(threadData, _ext_arg, _arg_map, _fn ,&_arg_spec);

      arrayUpdate(_mappedArgs,_i,_marg);

      arrayUpdate(_argSpecs,_i,mmc_mk_integer((modelica_integer)_arg_spec));

      _i = ((modelica_integer) 1) + _i;
    }
  }
  _return: OMC_LABEL_UNUSED
  if (out_argSpecs) { *out_argSpecs = _argSpecs; }
  return _mappedArgs;
}

PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_freeLibraryFunction(threadData_t *threadData, modelica_integer _fnHandle, modelica_boolean _debug)
{
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  omc_System_freeFunction(threadData, _fnHandle, _debug);
  _return: OMC_LABEL_UNUSED
  return;
}
PROTECTED_FUNCTION_STATIC void boxptr_NFEvalFunction_freeLibraryFunction(threadData_t *threadData, modelica_metatype _fnHandle, modelica_metatype _debug)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  tmp1 = mmc_unbox_integer(_fnHandle);
  tmp2 = mmc_unbox_integer(_debug);
  omc_NFEvalFunction_freeLibraryFunction(threadData, tmp1, tmp2);
  return;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_parseExternalAnnotationExp(threadData_t *threadData, modelica_metatype _exp, modelica_metatype __omcQ_24in_5Fstrl)
{
  modelica_metatype _strl = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _strl = __omcQ_24in_5Fstrl;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _exp;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 6: {
          modelica_metatype tmpMeta5;
          
          /* Pattern matching succeeded */
          tmpMeta5 = mmc_mk_cons((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 2))), _strl);
          tmpMeta1 = tmpMeta5;
          goto tmp3_done;
        }
        case 16: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_List_fold(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 2))), boxvar_NFEvalFunction_parseExternalAnnotationExp, _strl);
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _strl;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _strl = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _strl;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_parseExternalAnnotation(threadData_t *threadData, modelica_string _name, modelica_metatype _ann)
{
  modelica_metatype _strl = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _mods = NULL;
  modelica_metatype _exp = NULL;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta10;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _strl = tmpMeta1;
  // _mods has no default value.
  // _exp has no default value.
  _mods = omc_SCodeUtil_lookupAnnotations(threadData, _ann, _name);

  {
    modelica_metatype _m;
    for (tmpMeta2 = _mods; !listEmpty(tmpMeta2); tmpMeta2=MMC_CDR(tmpMeta2))
    {
      _m = MMC_CAR(tmpMeta2);
      { /* match expression */
        modelica_metatype tmp6_1;
        tmp6_1 = _m;
        {
          volatile mmc_switch_type tmp6;
          int tmp7;
          tmp6 = 0;
          for (; tmp6 < 2; tmp6++) {
            switch (MMC_SWITCH_CAST(tmp6)) {
            case 0: {
              modelica_metatype tmpMeta8;
              modelica_metatype tmpMeta9;
              if (mmc__uniontype__metarecord__typedef__equal(tmp6_1,0,6) == 0) goto tmp5_end;
              tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp6_1), 5));
              if (optionNone(tmpMeta8)) goto tmp5_end;
              tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 1));
              
              _exp = tmpMeta9;
              /* Pattern matching succeeded */
              tmpMeta3 = omc_NFEvalFunction_parseExternalAnnotationExp(threadData, _exp, _strl);
              goto tmp5_done;
            }
            case 1: {
              
              /* Pattern matching succeeded */
              tmpMeta3 = _strl;
              goto tmp5_done;
            }
            }
            goto tmp5_end;
            tmp5_end: ;
          }
          goto goto_4;
          goto_4:;
          MMC_THROW_INTERNAL();
          goto tmp5_done;
          tmp5_done:;
        }
      }
      _strl = tmpMeta3;
    }
  }
  _return: OMC_LABEL_UNUSED
  return _strl;
}

PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_loadLibraryFunction(threadData_t *threadData, modelica_string _libName, modelica_string _fnName, modelica_metatype _extAnnotation, modelica_boolean _debug, modelica_metatype _info)
{
  modelica_integer _fnHandle;
  modelica_integer _lib_handle;
  modelica_metatype _ann = NULL;
  modelica_metatype _libs = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _dirs = NULL;
  modelica_metatype tmpMeta2;
  modelica_metatype _paths = NULL;
  modelica_metatype tmpMeta3;
  modelica_metatype _libs2 = NULL;
  modelica_metatype tmpMeta4;
  modelica_boolean _found;
  modelica_string _installLibDir = NULL;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  modelica_metatype tmpMeta8;
  modelica_metatype tmpMeta9;
  modelica_metatype tmpMeta10;
  modelica_metatype tmpMeta11;
  modelica_metatype tmpMeta12;
  modelica_metatype tmpMeta13;
  modelica_metatype tmpMeta14;
  modelica_metatype tmpMeta15;
  modelica_metatype tmpMeta16;
  modelica_metatype tmpMeta17;
  modelica_metatype tmpMeta18;
  modelica_metatype tmpMeta19;
  modelica_metatype tmpMeta20;
  modelica_metatype tmpMeta21;
  modelica_metatype tmpMeta22;
  modelica_metatype tmpMeta23;
  modelica_metatype tmpMeta24;
  modelica_metatype tmpMeta25;
  modelica_metatype tmpMeta26;
  modelica_metatype tmpMeta27;
  modelica_metatype tmpMeta28;
  modelica_metatype tmpMeta29;
  modelica_metatype tmpMeta30;
  modelica_metatype tmpMeta31;
  modelica_metatype tmpMeta32;
  modelica_metatype tmpMeta33;
  modelica_metatype tmpMeta34;
  modelica_metatype tmpMeta35;
  modelica_metatype tmpMeta36;
  modelica_metatype tmpMeta37;
  modelica_metatype tmpMeta38;
  modelica_metatype tmpMeta39;
  modelica_metatype tmpMeta40;
  modelica_metatype tmpMeta41;
  modelica_metatype tmpMeta42;
  modelica_metatype tmpMeta47;
  modelica_metatype tmpMeta48;
  modelica_metatype tmpMeta53;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _fnHandle has no default value.
  // _lib_handle has no default value.
  // _ann has no default value.
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _libs = tmpMeta1;
  tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
  _dirs = tmpMeta2;
  tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
  _paths = tmpMeta3;
  tmpMeta4 = MMC_REFSTRUCTLIT(mmc_nil);
  _libs2 = tmpMeta4;
  _found = 0 /* false */;
  // _installLibDir has no default value.
  tmpMeta5 = stringAppend(omc_Settings_getInstallationDirectoryPath(threadData),_OMC_LIT17);
  tmpMeta6 = stringAppend(tmpMeta5,_OMC_LIT12);
  tmpMeta7 = stringAppend(tmpMeta6,_OMC_LIT18);
  _installLibDir = tmpMeta7;

  if(isSome(_extAnnotation))
  {
    /* Pattern-matching assignment */
    tmpMeta8 = _extAnnotation;
    if (optionNone(tmpMeta8)) MMC_THROW_INTERNAL();
    tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta8), 1));
    _ann = tmpMeta9;

    _libs = omc_NFEvalFunction_parseExternalAnnotation(threadData, _OMC_LIT19, _ann);

    _dirs = omc_NFEvalFunction_parseExternalAnnotation(threadData, _OMC_LIT20, _ann);
  }

  tmpMeta11 = stringAppend(_OMC_LIT21,_libName);
  tmpMeta12 = stringAppend(tmpMeta11,_OMC_LIT22);
  tmpMeta10 = mmc_mk_cons(tmpMeta12, _dirs);
  _dirs = tmpMeta10;

  _libs = omc_List_unique(threadData, _libs);

  _dirs = omc_List_unique(threadData, _dirs);

  {
    modelica_metatype _lib;
    for (tmpMeta13 = _libs; !listEmpty(tmpMeta13); tmpMeta13=MMC_CDR(tmpMeta13))
    {
      _lib = MMC_CAR(tmpMeta13);
      if((!(stringLength(_lib) == ((modelica_integer) 0))))
      {
        tmpMeta14 = mmc_mk_cons(_lib, _libs2);
        _libs2 = tmpMeta14;

        tmpMeta16 = stringAppend(_OMC_LIT23,_lib);
        tmpMeta15 = mmc_mk_cons(tmpMeta16, _libs2);
        _libs2 = tmpMeta15;
      }
    }
  }

  _libs = _libs2;

  {
    modelica_metatype _lib;
    for (tmpMeta18 = _libs; !listEmpty(tmpMeta18); tmpMeta18=MMC_CDR(tmpMeta18))
    {
      _lib = MMC_CAR(tmpMeta18);
      tmpMeta20 = stringAppend(_installLibDir,_OMC_LIT24);
      tmpMeta21 = stringAppend(tmpMeta20,_lib);
      tmpMeta22 = stringAppend(tmpMeta21,_OMC_LIT25);
      tmpMeta19 = mmc_mk_cons(tmpMeta22, _paths);
      _paths = tmpMeta19;
    }
  }

  {
    modelica_metatype _lib;
    for (tmpMeta24 = _libs; !listEmpty(tmpMeta24); tmpMeta24=MMC_CDR(tmpMeta24))
    {
      _lib = MMC_CAR(tmpMeta24);
      if((stringLength(_lib) == ((modelica_integer) 0)))
      {
        tmpMeta25 = mmc_mk_cons(_OMC_LIT12, _paths);
        _paths = tmpMeta25;

        continue;
      }

      tmpMeta26 = stringAppend(_lib,_OMC_LIT25);
      _lib = tmpMeta26;

      {
        modelica_metatype _dir;
        for (tmpMeta27 = _dirs; !listEmpty(tmpMeta27); tmpMeta27=MMC_CDR(tmpMeta27))
        {
          _dir = MMC_CAR(tmpMeta27);
          tmpMeta29 = stringAppend(_dir,_OMC_LIT26);
          tmpMeta30 = stringAppend(tmpMeta29,_lib);
          tmpMeta28 = mmc_mk_cons(tmpMeta30, _paths);
          _paths = tmpMeta28;

          tmpMeta32 = stringAppend(_dir,_OMC_LIT26);
          tmpMeta33 = stringAppend(tmpMeta32,omc_System_modelicaPlatform(threadData));
          tmpMeta34 = stringAppend(tmpMeta33,_OMC_LIT26);
          tmpMeta35 = stringAppend(tmpMeta34,_lib);
          tmpMeta31 = mmc_mk_cons(tmpMeta35, _paths);
          _paths = tmpMeta31;
        }
      }

      tmpMeta38 = stringAppend(_installLibDir,_OMC_LIT26);
      tmpMeta39 = stringAppend(tmpMeta38,_lib);
      tmpMeta37 = mmc_mk_cons(tmpMeta39, _paths);
      _paths = tmpMeta37;
    }
  }

  if(listEmpty(_libs))
  {
    tmpMeta41 = mmc_mk_cons(_OMC_LIT12, _paths);
    _paths = tmpMeta41;
  }

  omc_ErrorExt_setCheckpoint(threadData, _OMC_LIT27);

  {
    modelica_metatype _path;
    for (tmpMeta42 = _paths; !listEmpty(tmpMeta42); tmpMeta42=MMC_CDR(tmpMeta42))
    {
      _path = MMC_CAR(tmpMeta42);
      { /* matchcontinue expression */
        {
          volatile mmc_switch_type tmp45;
          int tmp46;
          tmp45 = 0;
          MMC_TRY_INTERNAL(mmc_jumper)
          tmp44_top:
          threadData->mmc_jumper = &new_mmc_jumper;
          for (; tmp45 < 2; tmp45++) {
            switch (MMC_SWITCH_CAST(tmp45)) {
            case 0: {
              /* Pattern matching succeeded */
              if((!(stringLength(_path) == ((modelica_integer) 0))))
              {
                _path = OpenModelica__uriToFilename(_path);
              }

              _lib_handle = omc_NFEvalFunction_lookupLibraryInCache(threadData, _path);

              if((_lib_handle == ((modelica_integer) -1)))
              {
                _lib_handle = omc_System_loadLibrary(threadData, _path, 0 /* false */, _debug);

                omc_NFEvalFunction_cacheLibrary(threadData, _path, _lib_handle);
              }

              _fnHandle = omc_System_lookupFunction(threadData, _lib_handle, _fnName);

              _found = 1 /* true */;
              goto tmp44_done;
            }
            case 1: {
              /* Pattern matching succeeded */
              goto tmp44_done;
            }
            }
            goto tmp44_end;
            tmp44_end: ;
          }
          goto goto_43;
          tmp44_done:
          (void)tmp45;
          MMC_RESTORE_INTERNAL(mmc_jumper);
          goto tmp44_done2;
          goto_43:;
          MMC_CATCH_INTERNAL(mmc_jumper);
          if (++tmp45 < 2) {
            goto tmp44_top;
          }
          MMC_THROW_INTERNAL();
          tmp44_done2:;
        }
      }
      ;

      if(_found)
      {
        break;
      }
    }
  }

  omc_ErrorExt_rollBack(threadData, _OMC_LIT27);

  if((!_found))
  {
    {
      modelica_metatype __omcQ_24tmpVar7;
      modelica_metatype* tmp49;
      modelica_metatype tmpMeta50;
      modelica_metatype tmpMeta51;
      modelica_string __omcQ_24tmpVar6;
      modelica_integer tmp52;
      modelica_metatype _p_loopVar = 0;
      modelica_metatype _p;
      _p_loopVar = _paths;
      tmpMeta50 = MMC_REFSTRUCTLIT(mmc_nil);
      __omcQ_24tmpVar7 = tmpMeta50; /* defaultValue */
      tmp49 = &__omcQ_24tmpVar7;
      while(1) {
        tmp52 = 1;
        while (!listEmpty(_p_loopVar)) {
          _p = MMC_CAR(_p_loopVar);
          _p_loopVar = MMC_CDR(_p_loopVar);
          if ((!(stringLength(_p) == ((modelica_integer) 0)))) {
            tmp52--;
            break;
          }
        }
        if (tmp52 == 0) {
          tmpMeta51 = stringAppend(_OMC_LIT28,omc_Testsuite_friendly(threadData, OpenModelica__uriToFilename(_p)));
          __omcQ_24tmpVar6 = tmpMeta51;
          *tmp49 = mmc_mk_cons(__omcQ_24tmpVar6,0);
          tmp49 = &MMC_CDR(*tmp49);
        } else if (tmp52 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      *tmp49 = mmc_mk_nil();
      tmpMeta48 = __omcQ_24tmpVar7;
    }
    _paths = tmpMeta48;

    tmpMeta53 = mmc_mk_cons(_fnName, mmc_mk_cons(stringDelimitList(_paths, _OMC_LIT32), MMC_REFSTRUCTLIT(mmc_nil)));
    omc_Error_addSourceMessage(threadData, _OMC_LIT31, tmpMeta53, _info);

    MMC_THROW_INTERNAL();
  }
  _return: OMC_LABEL_UNUSED
  return _fnHandle;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_loadLibraryFunction(threadData_t *threadData, modelica_metatype _libName, modelica_metatype _fnName, modelica_metatype _extAnnotation, modelica_metatype _debug, modelica_metatype _info)
{
  modelica_integer tmp1;
  modelica_integer _fnHandle;
  modelica_metatype out_fnHandle;
  tmp1 = mmc_unbox_integer(_debug);
  _fnHandle = omc_NFEvalFunction_loadLibraryFunction(threadData, _libName, _fnName, _extAnnotation, tmp1, _info);
  out_fnHandle = mmc_mk_icon(_fnHandle);
  return out_fnHandle;
}

DLLDirection
void omc_NFEvalFunction_clearLibraryCache(threadData_t *threadData)
{
  modelica_metatype _cache = NULL;
  modelica_integer _lib_handle;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_integer tmp4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _cache has no default value.
  // _lib_handle has no default value.
  _cache = getGlobalRoot(((modelica_integer) 30));

  {
    modelica_metatype _v;
    for (tmpMeta1 = _cache; !listEmpty(tmpMeta1); tmpMeta1=MMC_CDR(tmpMeta1))
    {
      _v = MMC_CAR(tmpMeta1);
      /* Pattern-matching assignment */
      tmpMeta2 = _v;
      tmpMeta3 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta2), 2));
      tmp4 = mmc_unbox_integer(tmpMeta3);
      _lib_handle = tmp4  /* pattern as ty=Integer */;

      omc_System_freeLibrary(threadData, _lib_handle, 0 /* false */);
    }
  }

  tmpMeta6 = MMC_REFSTRUCTLIT(mmc_nil);
  setGlobalRoot(((modelica_integer) 30), tmpMeta6);
  _return: OMC_LABEL_UNUSED
  return;
}

PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_cacheLibrary(threadData_t *threadData, modelica_string _libName, modelica_integer _libHandle)
{
  modelica_metatype _cache = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _cache has no default value.
  _cache = getGlobalRoot(((modelica_integer) 30));

  tmpMeta2 = mmc_mk_box2(0, _libName, mmc_mk_integer(_libHandle));
  tmpMeta1 = mmc_mk_cons(tmpMeta2, _cache);
  _cache = tmpMeta1;

  setGlobalRoot(((modelica_integer) 30), _cache);
  _return: OMC_LABEL_UNUSED
  return;
}
PROTECTED_FUNCTION_STATIC void boxptr_NFEvalFunction_cacheLibrary(threadData_t *threadData, modelica_metatype _libName, modelica_metatype _libHandle)
{
  modelica_integer tmp1;
  tmp1 = mmc_unbox_integer(_libHandle);
  omc_NFEvalFunction_cacheLibrary(threadData, _libName, tmp1);
  return;
}

PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_lookupLibraryInCache(threadData_t *threadData, modelica_string _libName)
{
  modelica_integer _libHandle;
  modelica_metatype _cache = NULL;
  modelica_string _name = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_integer tmp5;
  modelica_metatype tmpMeta6;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _libHandle has no default value.
  // _cache has no default value.
  // _name has no default value.
  _cache = getGlobalRoot(((modelica_integer) 30));

  {
    modelica_metatype _l;
    for (tmpMeta1 = _cache; !listEmpty(tmpMeta1); tmpMeta1=MMC_CDR(tmpMeta1))
    {
      _l = MMC_CAR(tmpMeta1);
      /* Pattern-matching assignment */
      tmpMeta2 = _l;
      tmpMeta3 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta2), 1));
      tmpMeta4 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta2), 2));
      tmp5 = mmc_unbox_integer(tmpMeta4);
      _name = tmpMeta3;
      _libHandle = tmp5  /* pattern as ty=Integer */;

      if((stringEqual(_name, _libName)))
      {
        goto _return;
      }
    }
  }

  _libHandle = ((modelica_integer) -1);
  _return: OMC_LABEL_UNUSED
  return _libHandle;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_lookupLibraryInCache(threadData_t *threadData, modelica_metatype _libName)
{
  modelica_integer _libHandle;
  modelica_metatype out_libHandle;
  _libHandle = omc_NFEvalFunction_lookupLibraryInCache(threadData, _libName);
  out_libHandle = mmc_mk_icon(_libHandle);
  return out_libHandle;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_callExternalFunction(threadData_t *threadData, modelica_string _extName, modelica_metatype _fn, modelica_metatype _args, modelica_metatype _extArgs, modelica_metatype _outputRef, modelica_metatype _extAnnotation, modelica_boolean _debug)
{
  modelica_metatype _result = NULL;
  modelica_metatype _info = NULL;
  modelica_string _pkg_name = NULL;
  modelica_metatype _mapped_args = NULL;
  modelica_metatype _specs = NULL;
  modelica_metatype _ret_ty = NULL;
  modelica_metatype _res = NULL;
  modelica_metatype _output_vals = NULL;
  modelica_integer _fn_handle;
  modelica_metatype tmpMeta5;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  // _info has no default value.
  // _pkg_name has no default value.
  // _mapped_args has no default value.
  // _specs has no default value.
  // _ret_ty has no default value.
  // _res has no default value.
  // _output_vals has no default value.
  // _fn_handle has no default value.
  _info = omc_NFInstNode_InstNode_info(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 3))));

  omc_NFEvalFunction_checkExtReturnValue(threadData, _outputRef, _info);

  _pkg_name = omc_NFInstNode_InstNode_name(threadData, omc_NFInstNode_InstNode_libraryScope(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 3)))));

  _fn_handle = omc_NFEvalFunction_loadLibraryFunction(threadData, _pkg_name, _extName, _extAnnotation, _debug, _info);

  { /* 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 */
          _mapped_args = omc_NFEvalFunction_mapExternalArgs(threadData, _fn, _args, _extArgs ,&_specs);

          _ret_ty = (omc_NFComponentRef_isCref(threadData, _outputRef)?omc_NFComponentRef_nodeType(threadData, _outputRef):_OMC_LIT33);

          _res = omc_FFI_callFunction(threadData, _fn_handle, _mapped_args, _specs, _ret_ty ,&_output_vals);

          omc_NFEvalFunction_freeLibraryFunction(threadData, _fn_handle, _debug);
          goto tmp2_done;
        }
        case 1: {
          /* Pattern matching succeeded */
          omc_NFEvalFunction_freeLibraryFunction(threadData, _fn_handle, _debug);

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

  if(listEmpty(_output_vals))
  {
    _result = _res;
  }
  else
  {
    tmpMeta5 = mmc_mk_cons(_res, _output_vals);
    _result = omc_NFEvalFunction_makeExternalResult(threadData, tmpMeta5, _outputRef, _extArgs, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 5))));
  }
  _return: OMC_LABEL_UNUSED
  return _result;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_callExternalFunction(threadData_t *threadData, modelica_metatype _extName, modelica_metatype _fn, modelica_metatype _args, modelica_metatype _extArgs, modelica_metatype _outputRef, modelica_metatype _extAnnotation, modelica_metatype _debug)
{
  modelica_integer tmp1;
  modelica_metatype _result = NULL;
  tmp1 = mmc_unbox_integer(_debug);
  _result = omc_NFEvalFunction_callExternalFunction(threadData, _extName, _fn, _args, _extArgs, _outputRef, _extAnnotation, tmp1);
  /* skip box _result; NFExpression */
  return _result;
}

PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_evaluateExternal3(threadData_t *threadData, modelica_string _name, modelica_metatype _args)
{
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  { /* match expression */
    modelica_string tmp3_1;
    tmp3_1 = _name;
    {
      int tmp3;
      {
        switch (MMC_SWITCH_CAST(stringHashDjb2Mod(tmp3_1,256))) {
        case 176 /* dgeev */: {
          if (5 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT34), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgeev(threadData, _args);
          goto tmp2_done;
        }
        case 242 /* dgegv */: {
          if (5 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT35), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgegv(threadData, _args);
          goto tmp2_done;
        }
        case 148 /* dgels */: {
          if (5 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT36), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgels(threadData, _args);
          goto tmp2_done;
        }
        case 140 /* dgelsx */: {
          if (6 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT37), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgelsx(threadData, _args);
          goto tmp2_done;
        }
        case 141 /* dgelsy */: {
          if (6 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT38), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgelsy(threadData, _args);
          goto tmp2_done;
        }
        case 126 /* dgesv */: {
          if (5 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT39), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgesv(threadData, _args);
          goto tmp2_done;
        }
        case 59 /* dgglse */: {
          if (6 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT40), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgglse(threadData, _args);
          goto tmp2_done;
        }
        case 77 /* dgtsv */: {
          if (5 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT41), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgtsv(threadData, _args);
          goto tmp2_done;
        }
        case 187 /* dgbsv */: {
          if (5 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT42), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgtsv(threadData, _args);
          goto tmp2_done;
        }
        case 162 /* dgesvd */: {
          if (6 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT43), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgesvd(threadData, _args);
          goto tmp2_done;
        }
        case 97 /* dgetrf */: {
          if (6 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT44), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgetrf(threadData, _args);
          goto tmp2_done;
        }
        case 110 /* dgetrs */: {
          if (6 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT45), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgetrs(threadData, _args);
          goto tmp2_done;
        }
        case 100 /* dgetri */: {
          if (6 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT46), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgetri(threadData, _args);
          goto tmp2_done;
        }
        case 92 /* dgeqpf */: {
          if (6 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT47), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dgeqpf(threadData, _args);
          goto tmp2_done;
        }
        case 244 /* dorgqr */: {
          if (6 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT48), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dorgqr(threadData, _args);
          goto tmp2_done;
        }
        case 76 /* dhseqr */: {
          if (6 != MMC_STRLEN(tmp3_1) || strcmp(MMC_STRINGDATA(_OMC_LIT49), MMC_STRINGDATA(tmp3_1)) != 0) goto tmp2_end;
          /* Pattern matching succeeded */
          omc_NFEvalFunctionExt_Lapack__dhseqr(threadData, _args);
          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;
}

static modelica_metatype closure0_NFEvalFunction_applyReplacements2(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_applyReplacements2(thData, map, $in_exp);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_evaluateExternal2(threadData_t *threadData, modelica_string _name, modelica_metatype _fn, modelica_metatype _args, modelica_metatype _extArgs)
{
  modelica_metatype _result = NULL;
  modelica_metatype _map = NULL;
  modelica_metatype _ext_args = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  // _map has no default value.
  // _ext_args has no default value.
  _map = omc_NFEvalFunction_createArgumentMap(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 4))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 5))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 6))), _args, 1 /* true */, 1 /* true */);

  {
    modelica_metatype __omcQ_24tmpVar9;
    modelica_metatype* tmp2;
    modelica_metatype tmpMeta3;
    modelica_metatype tmpMeta4;
    modelica_metatype __omcQ_24tmpVar8;
    modelica_integer tmp5;
    modelica_metatype _e_loopVar = 0;
    modelica_metatype _e;
    _e_loopVar = _extArgs;
    tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar9 = tmpMeta3; /* defaultValue */
    tmp2 = &__omcQ_24tmpVar9;
    while(1) {
      tmp5 = 1;
      if (!listEmpty(_e_loopVar)) {
        _e = MMC_CAR(_e_loopVar);
        _e_loopVar = MMC_CDR(_e_loopVar);
        tmp5--;
      }
      if (tmp5 == 0) {
        tmpMeta4 = mmc_mk_box1(0, _map);
        __omcQ_24tmpVar8 = omc_NFExpression_map(threadData, _e, (modelica_fnptr) mmc_mk_box2(0,closure0_NFEvalFunction_applyReplacements2,tmpMeta4));
        *tmp2 = mmc_mk_cons(__omcQ_24tmpVar8,0);
        tmp2 = &MMC_CDR(*tmp2);
      } else if (tmp5 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp2 = mmc_mk_nil();
    tmpMeta1 = __omcQ_24tmpVar9;
  }
  _ext_args = tmpMeta1;

  omc_NFEvalFunction_evaluateExternal3(threadData, _name, _ext_args);

  _result = omc_NFEvalFunction_createResult(threadData, _map, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 5))));
  _return: OMC_LABEL_UNUSED
  return _result;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_evalTargetFromSource(threadData_t *threadData, modelica_metatype _source, modelica_integer _context, modelica_integer _currentContext)
{
  modelica_metatype _target = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _target = omc_NFCeval_EvalTarget_new(threadData, omc_ElementSource_getInfo(threadData, _source), omc_NFInstContext_set(threadData, _context, _currentContext), mmc_mk_none());
  _return: OMC_LABEL_UNUSED
  return _target;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evalTargetFromSource(threadData_t *threadData, modelica_metatype _source, modelica_metatype _context, modelica_metatype _currentContext)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _target = NULL;
  tmp1 = mmc_unbox_integer(_context);
  tmp2 = mmc_unbox_integer(_currentContext);
  _target = omc_NFEvalFunction_evalTargetFromSource(threadData, _source, tmp1, tmp2);
  /* skip box _target; NFCeval.EvalTarget */
  return _target;
}

PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateWhile(threadData_t *threadData, modelica_metatype _condition, modelica_metatype _body, modelica_metatype _source, modelica_integer _context)
{
  modelica_integer _ctrl;
  modelica_integer _i;
  modelica_integer _limit;
  modelica_metatype _target = NULL;
  modelica_metatype tmpMeta1;
  modelica_string tmp2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _ctrl = 1;
  _i = ((modelica_integer) 0);
  _limit = omc_Flags_getConfigInt(threadData, _OMC_LIT55);
  _target = omc_NFEvalFunction_evalTargetFromSource(threadData, _source, ((modelica_integer) 80), _context);
  while(1)
  {
    if(!omc_NFExpression_isTrue(threadData, omc_NFCeval_evalExp(threadData, _condition, _target))) break;
    _ctrl = omc_NFEvalFunction_evaluateStatements(threadData, _body, _context);

    if(((modelica_integer)_ctrl != 1))
    {
      if(((modelica_integer)_ctrl == 3))
      {
        _ctrl = 1;
      }

      break;
    }

    _i = ((modelica_integer) 1) + _i;

    if((_i > _limit))
    {
      tmp2 = modelica_integer_to_modelica_string(_limit, ((modelica_integer) 0), 1 /* true */);
      tmpMeta1 = mmc_mk_cons(tmp2, MMC_REFSTRUCTLIT(mmc_nil));
      omc_Error_addSourceMessage(threadData, _OMC_LIT58, tmpMeta1, omc_ElementSource_getInfo(threadData, _source));

      MMC_THROW_INTERNAL();
    }
  }
  _return: OMC_LABEL_UNUSED
  return _ctrl;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateWhile(threadData_t *threadData, modelica_metatype _condition, modelica_metatype _body, modelica_metatype _source, modelica_metatype _context)
{
  modelica_integer tmp1;
  modelica_integer _ctrl;
  modelica_metatype out_ctrl;
  tmp1 = mmc_unbox_integer(_context);
  _ctrl = omc_NFEvalFunction_evaluateWhile(threadData, _condition, _body, _source, tmp1);
  out_ctrl = mmc_mk_icon(_ctrl);
  return out_ctrl;
}

PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateNoRetCall(threadData_t *threadData, modelica_metatype _callExp, modelica_metatype _source, modelica_integer _context)
{
  modelica_integer _ctrl;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _ctrl = 1;
  omc_NFCeval_evalExp(threadData, _callExp, omc_NFEvalFunction_evalTargetFromSource(threadData, _source, ((modelica_integer) 80), _context));
  _return: OMC_LABEL_UNUSED
  return _ctrl;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateNoRetCall(threadData_t *threadData, modelica_metatype _callExp, modelica_metatype _source, modelica_metatype _context)
{
  modelica_integer tmp1;
  modelica_integer _ctrl;
  modelica_metatype out_ctrl;
  tmp1 = mmc_unbox_integer(_context);
  _ctrl = omc_NFEvalFunction_evaluateNoRetCall(threadData, _callExp, _source, tmp1);
  out_ctrl = mmc_mk_icon(_ctrl);
  return out_ctrl;
}

PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateAssert(threadData_t *threadData, modelica_metatype _condition, modelica_metatype _assertStmt, modelica_metatype _source, modelica_integer _context)
{
  modelica_integer _ctrl;
  modelica_metatype _cond = NULL;
  modelica_metatype _msg = NULL;
  modelica_metatype _lvl = NULL;
  modelica_metatype _target = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _ctrl = 1;
  // _cond has no default value.
  // _msg has no default value.
  // _lvl has no default value.
  _target = omc_NFEvalFunction_evalTargetFromSource(threadData, _source, ((modelica_integer) 80), _context);
  if(omc_NFExpression_isFalse(threadData, omc_NFCeval_evalExp(threadData, _condition, _target)))
  {
    /* Pattern-matching assignment */
    tmpMeta1 = _assertStmt;
    if (mmc__uniontype__metarecord__typedef__equal(tmpMeta1,5,4) == 0) MMC_THROW_INTERNAL();
    tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 3));
    tmpMeta3 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 4));
    _msg = tmpMeta2;
    _lvl = tmpMeta3;

    _msg = omc_NFCeval_evalExp(threadData, _msg, _target);

    _lvl = omc_NFCeval_evalExp(threadData, _lvl, _target);

    { /* match expression */
      modelica_metatype tmp6_1;modelica_metatype tmp6_2;
      tmp6_1 = _msg;
      tmp6_2 = _lvl;
      {
        volatile mmc_switch_type tmp6;
        int tmp7;
        tmp6 = 0;
        for (; tmp6 < 3; tmp6++) {
          switch (MMC_SWITCH_CAST(tmp6)) {
          case 0: {
            modelica_metatype tmpMeta8;
            modelica_metatype tmpMeta9;
            if (mmc__uniontype__metarecord__typedef__equal(tmp6_1,2,1) == 0) goto tmp5_end;
            if (mmc__uniontype__metarecord__typedef__equal(tmp6_2,4,3) == 0) goto tmp5_end;
            tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp6_2), 3));
            if (7 != MMC_STRLEN(tmpMeta8) || strcmp(MMC_STRINGDATA(_OMC_LIT68), MMC_STRINGDATA(tmpMeta8)) != 0) goto tmp5_end;
            
            /* Pattern matching succeeded */
            tmpMeta9 = mmc_mk_cons((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_msg), 2))), MMC_REFSTRUCTLIT(mmc_nil));
            omc_Error_addSourceMessage(threadData, _OMC_LIT62, tmpMeta9, omc_NFCeval_EvalTarget_getInfo(threadData, _target));
            goto tmp5_done;
          }
          case 1: {
            modelica_metatype tmpMeta10;
            modelica_metatype tmpMeta11;
            if (mmc__uniontype__metarecord__typedef__equal(tmp6_1,2,1) == 0) goto tmp5_end;
            if (mmc__uniontype__metarecord__typedef__equal(tmp6_2,4,3) == 0) goto tmp5_end;
            tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp6_2), 3));
            if (5 != MMC_STRLEN(tmpMeta10) || strcmp(MMC_STRINGDATA(_OMC_LIT69), MMC_STRINGDATA(tmpMeta10)) != 0) goto tmp5_end;
            
            /* Pattern matching succeeded */
            tmpMeta11 = mmc_mk_cons((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_msg), 2))), MMC_REFSTRUCTLIT(mmc_nil));
            omc_Error_addSourceMessage(threadData, _OMC_LIT63, tmpMeta11, omc_NFCeval_EvalTarget_getInfo(threadData, _target));

            _ctrl = 5;
            goto tmp5_done;
          }
          case 2: {
            modelica_metatype tmpMeta12;
            modelica_metatype tmpMeta13;
            modelica_metatype tmpMeta14;
            modelica_metatype tmpMeta15;
            
            /* Pattern matching succeeded */
            tmpMeta12 = stringAppend(_OMC_LIT64,omc_NFExpression_toString(threadData, _msg));
            tmpMeta13 = stringAppend(tmpMeta12,_OMC_LIT65);
            tmpMeta14 = stringAppend(tmpMeta13,omc_NFExpression_toString(threadData, _lvl));
            tmpMeta15 = stringAppend(tmpMeta14,_OMC_LIT66);
            omc_Error_assertion(threadData, 0 /* false */, tmpMeta15, _OMC_LIT67);
            goto goto_4;
            goto tmp5_done;
          }
          }
          goto tmp5_end;
          tmp5_end: ;
        }
        goto goto_4;
        goto_4:;
        MMC_THROW_INTERNAL();
        goto tmp5_done;
        tmp5_done:;
      }
    }
    ;
  }
  _return: OMC_LABEL_UNUSED
  return _ctrl;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateAssert(threadData_t *threadData, modelica_metatype _condition, modelica_metatype _assertStmt, modelica_metatype _source, modelica_metatype _context)
{
  modelica_integer tmp1;
  modelica_integer _ctrl;
  modelica_metatype out_ctrl;
  tmp1 = mmc_unbox_integer(_context);
  _ctrl = omc_NFEvalFunction_evaluateAssert(threadData, _condition, _assertStmt, _source, tmp1);
  out_ctrl = mmc_mk_icon(_ctrl);
  return out_ctrl;
}

PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateIf(threadData_t *threadData, modelica_metatype _branches, modelica_metatype _source, modelica_integer _context)
{
  modelica_integer _ctrl;
  modelica_metatype _cond = NULL;
  modelica_metatype _body = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _ctrl has no default value.
  // _cond has no default value.
  // _body has no default value.
  {
    modelica_metatype _branch;
    for (tmpMeta1 = _branches; !listEmpty(tmpMeta1); tmpMeta1=MMC_CDR(tmpMeta1))
    {
      _branch = MMC_CAR(tmpMeta1);
      /* Pattern-matching assignment */
      tmpMeta2 = _branch;
      tmpMeta3 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta2), 1));
      tmpMeta4 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta2), 2));
      _cond = tmpMeta3;
      _body = tmpMeta4;

      if(omc_NFExpression_isTrue(threadData, omc_NFCeval_evalExp(threadData, _cond, omc_NFEvalFunction_evalTargetFromSource(threadData, _source, ((modelica_integer) 1065040), _context))))
      {
        _ctrl = omc_NFEvalFunction_evaluateStatements(threadData, _body, _context);

        goto _return;
      }
    }
  }

  _ctrl = 1;
  _return: OMC_LABEL_UNUSED
  return _ctrl;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateIf(threadData_t *threadData, modelica_metatype _branches, modelica_metatype _source, modelica_metatype _context)
{
  modelica_integer tmp1;
  modelica_integer _ctrl;
  modelica_metatype out_ctrl;
  tmp1 = mmc_unbox_integer(_context);
  _ctrl = omc_NFEvalFunction_evaluateIf(threadData, _branches, _source, tmp1);
  out_ctrl = mmc_mk_icon(_ctrl);
  return out_ctrl;
}

PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateFor(threadData_t *threadData, modelica_metatype _iterator, modelica_metatype _range, modelica_metatype _forBody, modelica_metatype _source, modelica_integer _context)
{
  modelica_integer _ctrl;
  modelica_metatype _range_iter = NULL;
  modelica_metatype _iter_exp = NULL;
  modelica_metatype _range_exp = NULL;
  modelica_metatype _value = NULL;
  modelica_metatype _body = NULL;
  modelica_integer _i;
  modelica_integer _limit;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_string tmp5;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _ctrl = 1;
  // _range_iter has no default value.
  // _iter_exp has no default value.
  // _range_exp has no default value.
  // _value has no default value.
  _body = _forBody;
  _i = ((modelica_integer) 0);
  _limit = omc_Flags_getConfigInt(threadData, _OMC_LIT55);
  _range_exp = omc_NFCeval_evalExp(threadData, omc_Util_getOption(threadData, _range), omc_NFEvalFunction_evalTargetFromSource(threadData, _source, ((modelica_integer) 80), _context));

  _range_iter = omc_NFRangeIterator_fromExp(threadData, _range_exp);

  if(omc_NFRangeIterator_hasNext(threadData, _range_iter))
  {
    /* Pattern-matching assignment */
    tmpMeta1 = _iterator;
    if (mmc__uniontype__metarecord__typedef__equal(tmpMeta1,6,1) == 0) MMC_THROW_INTERNAL();
    tmpMeta2 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 2));
    if (mmc__uniontype__metarecord__typedef__equal(tmpMeta2,29,1) == 0) MMC_THROW_INTERNAL();
    tmpMeta3 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta2), 2));
    _iter_exp = tmpMeta3;

    while(1)
    {
      if(!omc_NFRangeIterator_hasNext(threadData, _range_iter)) break;
      _range_iter = omc_NFRangeIterator_next(threadData, _range_iter ,&_value);

      omc_Mutable_update(threadData, _iter_exp, _value);

      _ctrl = omc_NFEvalFunction_evaluateStatements(threadData, _body, _context);

      if(((modelica_integer)_ctrl != 1))
      {
        if(((modelica_integer)_ctrl == 3))
        {
          _ctrl = 1;
        }

        break;
      }

      _i = ((modelica_integer) 1) + _i;

      if((_i > _limit))
      {
        tmp5 = modelica_integer_to_modelica_string(_limit, ((modelica_integer) 0), 1 /* true */);
        tmpMeta4 = mmc_mk_cons(tmp5, MMC_REFSTRUCTLIT(mmc_nil));
        omc_Error_addSourceMessage(threadData, _OMC_LIT58, tmpMeta4, omc_ElementSource_getInfo(threadData, _source));

        MMC_THROW_INTERNAL();
      }
    }
  }
  _return: OMC_LABEL_UNUSED
  return _ctrl;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateFor(threadData_t *threadData, modelica_metatype _iterator, modelica_metatype _range, modelica_metatype _forBody, modelica_metatype _source, modelica_metatype _context)
{
  modelica_integer tmp1;
  modelica_integer _ctrl;
  modelica_metatype out_ctrl;
  tmp1 = mmc_unbox_integer(_context);
  _ctrl = omc_NFEvalFunction_evaluateFor(threadData, _iterator, _range, _forBody, _source, tmp1);
  out_ctrl = mmc_mk_icon(_ctrl);
  return out_ctrl;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_assignRecord(threadData_t *threadData, modelica_metatype _lhs, modelica_metatype _rhs)
{
  modelica_metatype _result = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _rhs;
    {
      modelica_metatype _elems = NULL;
      modelica_metatype _e = NULL;
      modelica_metatype _val = NULL;
      modelica_metatype _cls_tree = NULL;
      modelica_metatype _comps = NULL;
      modelica_metatype _ty = NULL;
      int tmp4;
      // _elems has no default value.
      // _e has no default value.
      // _val has no default value.
      // _cls_tree has no default value.
      // _comps has no default value.
      // _ty has no default value.
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 15: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmpMeta5 = _lhs;
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta5,12,3) == 0) goto goto_2;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta5), 4));
          _elems = tmpMeta6;

          {
            modelica_metatype _v;
            for (tmpMeta7 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_rhs), 4))); !listEmpty(tmpMeta7); tmpMeta7=MMC_CDR(tmpMeta7))
            {
              _v = MMC_CAR(tmpMeta7);
              /* Pattern-matching assignment */
              tmpMeta8 = _elems;
              if (listEmpty(tmpMeta8)) goto goto_2;
              tmpMeta9 = MMC_CAR(tmpMeta8);
              tmpMeta10 = MMC_CDR(tmpMeta8);
              _e = tmpMeta9;
              _elems = tmpMeta10;

              omc_NFEvalFunction_assignVariable(threadData, _e, _v);
            }
          }
          tmpMeta1 = _lhs;
          goto tmp3_done;
        }
        case 9: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_integer tmp21;
          modelica_integer tmp22;
          
          /* Pattern matching succeeded */
          /* Pattern-matching assignment */
          tmpMeta12 = _lhs;
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta12,12,3) == 0) goto goto_2;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta12), 4));
          _elems = tmpMeta13;

          _cls_tree = omc_NFClass_classTree(threadData, omc_NFInstNode_InstNode_getClass(threadData, omc_NFComponentRef_node(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_rhs), 3))))));

          _comps = omc_NFClassTree_ClassTree_getComponents(threadData, _cls_tree);

          {
            modelica_metatype _c;
            for (tmpMeta14 = _comps, tmp22 = arrayLength(tmpMeta14), tmp21 = 1; tmp21 <= tmp22; tmp21++)
            {
              _c = arrayGet(tmpMeta14,tmp21);
              /* Pattern-matching assignment */
              tmpMeta15 = _elems;
              if (listEmpty(tmpMeta15)) goto goto_2;
              tmpMeta16 = MMC_CAR(tmpMeta15);
              tmpMeta17 = MMC_CDR(tmpMeta15);
              _e = tmpMeta16;
              _elems = tmpMeta17;

              _ty = omc_NFInstNode_InstNode_getType(threadData, _c);

              tmpMeta18 = MMC_REFSTRUCTLIT(mmc_nil);
              tmpMeta19 = mmc_mk_box3(9, &NFExpression_CREF__desc, omc_NFType_liftArrayLeftList(threadData, _ty, omc_NFType_arrayDims(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_rhs), 2))))), omc_NFComponentRef_prefixCref(threadData, _c, _ty, tmpMeta18, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_rhs), 3)))));
              _val = tmpMeta19;

              omc_NFEvalFunction_assignVariable(threadData, _e, _val);
            }
          }
          tmpMeta1 = _lhs;
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _rhs;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _result = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _result;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_assignExp(threadData_t *threadData, modelica_metatype _lhs, modelica_metatype _rhs)
{
  modelica_metatype _result = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _lhs;
    {
      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,12,3) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFEvalFunction_assignRecord(threadData, _lhs, _rhs);
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _rhs;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _result = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _result;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_assignArrayElement(threadData_t *threadData, modelica_metatype _arrayExp, modelica_metatype _subscripts, modelica_metatype _value)
{
  modelica_metatype _result = NULL;
  modelica_metatype _sub = NULL;
  modelica_metatype _val = NULL;
  modelica_metatype _rest_subs = NULL;
  modelica_integer _idx;
  modelica_metatype _subs = NULL;
  modelica_metatype _vals = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  // _sub has no default value.
  // _val has no default value.
  // _rest_subs has no default value.
  // _idx has no default value.
  // _subs has no default value.
  // _vals has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;modelica_metatype tmp4_2;
    tmp4_1 = _arrayExp;
    tmp4_2 = _subscripts;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 4; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,3) == 0) goto tmp3_end;
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta6 = MMC_CAR(tmp4_2);
          tmpMeta7 = MMC_CDR(tmp4_2);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,2,1) == 0) goto tmp3_end;
          tmpMeta8 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 2));
          _sub = tmpMeta8;
          _rest_subs = tmpMeta7;
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_NFExpression_isScalarLiteral(threadData, _sub)) goto tmp3_end;
          _idx = omc_NFExpression_toInteger(threadData, _sub);

          if(listEmpty(_rest_subs))
          {
            arrayUpdate((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_arrayExp), 3))), _idx, _value);
          }
          else
          {
            arrayUpdate((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_arrayExp), 3))), _idx, omc_NFEvalFunction_assignArrayElement(threadData, arrayGet((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_arrayExp), 3))), _idx), _rest_subs, _value));
          }
          tmpMeta1 = _arrayExp;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_integer tmp12;
          modelica_integer tmp13;
          modelica_integer tmp14;
          modelica_integer tmp15;
          modelica_integer tmp16;
          modelica_integer tmp17;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,3) == 0) goto tmp3_end;
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta9 = MMC_CAR(tmp4_2);
          tmpMeta10 = MMC_CDR(tmp4_2);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta9,3,1) == 0) goto tmp3_end;
          tmpMeta11 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta9), 2));
          _sub = tmpMeta11;
          _rest_subs = tmpMeta10;
          /* Pattern matching succeeded */
          _subs = omc_NFExpression_arrayElements(threadData, _sub);

          _vals = omc_NFExpression_arrayElements(threadData, _value);

          if((arrayLength(_subs) > arrayLength(_vals)))
          {
            goto goto_2;
          }

          if(listEmpty(_rest_subs))
          {
            tmp12 = ((modelica_integer) 1); tmp13 = 1; tmp14 = arrayLength(_subs);
            if(!(((tmp13 > 0) && (tmp12 > tmp14)) || ((tmp13 < 0) && (tmp12 < tmp14))))
            {
              modelica_integer _i;
              for(_i = ((modelica_integer) 1); in_range_integer(_i, tmp12, tmp14); _i += tmp13)
              {
                _sub = arrayGetNoBoundsChecking(_subs, _i);

                _val = arrayGetNoBoundsChecking(_vals, _i);

                _idx = omc_NFExpression_toInteger(threadData, _sub);

                arrayUpdate((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_arrayExp), 3))), _idx, _val);
              }
            }
          }
          else
          {
            tmp15 = ((modelica_integer) 1); tmp16 = 1; tmp17 = arrayLength(_subs);
            if(!(((tmp16 > 0) && (tmp15 > tmp17)) || ((tmp16 < 0) && (tmp15 < tmp17))))
            {
              modelica_integer _i;
              for(_i = ((modelica_integer) 1); in_range_integer(_i, tmp15, tmp17); _i += tmp16)
              {
                _sub = arrayGetNoBoundsChecking(_subs, _i);

                _val = arrayGetNoBoundsChecking(_vals, _i);

                _idx = omc_NFExpression_toInteger(threadData, _sub);

                arrayUpdate((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_arrayExp), 3))), _idx, omc_NFEvalFunction_assignArrayElement(threadData, arrayGet((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_arrayExp), 3))), _idx), _rest_subs, _val));
              }
            }
          }
          tmpMeta1 = _arrayExp;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta18;
          modelica_metatype tmpMeta19;
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,8,3) == 0) goto tmp3_end;
          if (listEmpty(tmp4_2)) goto tmp3_end;
          tmpMeta18 = MMC_CAR(tmp4_2);
          tmpMeta19 = MMC_CDR(tmp4_2);
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta18,5,0) == 0) goto tmp3_end;
          _rest_subs = tmpMeta19;
          /* Pattern matching succeeded */
          if(listEmpty(_rest_subs))
          {
            tmpMeta20 = MMC_TAGPTR(mmc_alloc_words(5));
            memcpy(MMC_UNTAGPTR(tmpMeta20), MMC_UNTAGPTR(_arrayExp), 5*sizeof(modelica_metatype));
            ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta20))[3] = arrayCopy(omc_NFExpression_arrayElements(threadData, _value));
            _arrayExp = tmpMeta20;
          }
          else
          {
            {
              modelica_metatype __omcQ_24tmpVar11;
              modelica_metatype* tmp23;
              modelica_metatype tmpMeta24;
              modelica_metatype __omcQ_24tmpVar10;
              modelica_integer tmp25;
              modelica_metatype _e_loopVar = 0;
              modelica_integer tmp26;
              modelica_metatype _e;
              modelica_metatype _v_loopVar = 0;
              modelica_integer tmp27;
              modelica_metatype _v;
              _e_loopVar = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_arrayExp), 3)));
              tmp26 = 1;
              _v_loopVar = omc_NFExpression_arrayElements(threadData, _value);
              tmp27 = 1;
              tmpMeta24 = MMC_REFSTRUCTLIT(mmc_nil);
              __omcQ_24tmpVar11 = tmpMeta24; /* defaultValue */
              tmp23 = &__omcQ_24tmpVar11;
              while(1) {
                tmp25 = 2;
                if (tmp26 <= arrayLength(_e_loopVar)) {
                  _e = arrayGet(_e_loopVar, tmp26++);
                  tmp25--;
                }if (tmp27 <= arrayLength(_v_loopVar)) {
                  _v = arrayGet(_v_loopVar, tmp27++);
                  tmp25--;
                }
                if (tmp25 == 0) {
                  __omcQ_24tmpVar10 = omc_NFEvalFunction_assignArrayElement(threadData, _e, _rest_subs, _v);
                  *tmp23 = mmc_mk_cons(__omcQ_24tmpVar10,0);
                  tmp23 = &MMC_CDR(*tmp23);
                } else if (tmp25 == 2) {
                  break;
                } else {
                  goto goto_2;
                }
              }
              *tmp23 = mmc_mk_nil();
              tmpMeta22 = __omcQ_24tmpVar11;
            }
            tmpMeta21 = MMC_TAGPTR(mmc_alloc_words(5));
            memcpy(MMC_UNTAGPTR(tmpMeta21), MMC_UNTAGPTR(_arrayExp), 5*sizeof(modelica_metatype));
            ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta21))[3] = listArray(tmpMeta22);
            _arrayExp = tmpMeta21;
          }
          tmpMeta1 = _arrayExp;
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta28;
          modelica_metatype tmpMeta29;
          modelica_metatype tmpMeta30;
          modelica_metatype tmpMeta31;
          
          /* Pattern matching succeeded */
          tmpMeta28 = stringAppend(_OMC_LIT70,omc_NFExpression_toString(threadData, _arrayExp));
          tmpMeta29 = stringAppend(tmpMeta28,omc_NFSubscript_toStringList(threadData, _subscripts));
          tmpMeta30 = stringAppend(tmpMeta29,_OMC_LIT71);
          tmpMeta31 = stringAppend(tmpMeta30,omc_NFExpression_toString(threadData, _value));
          omc_Error_assertion(threadData, 0 /* false */, tmpMeta31, _OMC_LIT72);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _result = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _result;
}

PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_assignSubscriptedVariable(threadData_t *threadData, modelica_metatype _variable, modelica_metatype _subscripts, modelica_metatype _value)
{
  modelica_metatype _subs = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _subs has no default value.
  {
    modelica_metatype __omcQ_24tmpVar13;
    modelica_metatype* tmp2;
    modelica_metatype tmpMeta3;
    modelica_metatype __omcQ_24tmpVar12;
    modelica_integer tmp4;
    modelica_metatype _s_loopVar = 0;
    modelica_metatype _s;
    _s_loopVar = _subscripts;
    tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar13 = tmpMeta3; /* defaultValue */
    tmp2 = &__omcQ_24tmpVar13;
    while(1) {
      tmp4 = 1;
      if (!listEmpty(_s_loopVar)) {
        _s = MMC_CAR(_s_loopVar);
        _s_loopVar = MMC_CDR(_s_loopVar);
        tmp4--;
      }
      if (tmp4 == 0) {
        __omcQ_24tmpVar12 = omc_NFSubscript_eval(threadData, _s, _OMC_LIT15);
        *tmp2 = mmc_mk_cons(__omcQ_24tmpVar12,0);
        tmp2 = &MMC_CDR(*tmp2);
      } else if (tmp4 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp2 = mmc_mk_nil();
    tmpMeta1 = __omcQ_24tmpVar13;
  }
  _subs = tmpMeta1;

  omc_Mutable_update(threadData, _variable, omc_NFEvalFunction_assignArrayElement(threadData, omc_Mutable_access(threadData, _variable), _subs, _value));
  _return: OMC_LABEL_UNUSED
  return;
}

DLLDirection
void omc_NFEvalFunction_assignVariable(threadData_t *threadData, modelica_metatype _variable, modelica_metatype _value)
{
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  { /* match expression */
    modelica_metatype tmp3_1;modelica_metatype tmp3_2;
    tmp3_1 = _variable;
    tmp3_2 = _value;
    {
      modelica_metatype _var = NULL;
      modelica_metatype _val = NULL;
      modelica_metatype _vals = NULL;
      modelica_metatype _var_ptr = NULL;
      volatile mmc_switch_type tmp3;
      int tmp4;
      // _var has no default value.
      // _val has no default value.
      // _vals has no default value.
      // _var_ptr has no default value.
      tmp3 = 0;
      for (; tmp3 < 5; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,29,1) == 0) goto tmp2_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
          
          _var_ptr = tmpMeta5;
          /* Pattern matching succeeded */
          omc_Mutable_update(threadData, _var_ptr, omc_NFEvalFunction_assignExp(threadData, omc_Mutable_access(threadData, _var_ptr), _value));
          goto tmp2_done;
        }
        case 1: {
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,11,2) == 0) goto tmp2_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,11,2) == 0) goto tmp2_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 3));
          _vals = tmpMeta6;
          /* Pattern matching succeeded */
          {
            modelica_metatype _var;
            for (tmpMeta7 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_variable), 3))); !listEmpty(tmpMeta7); tmpMeta7=MMC_CDR(tmpMeta7))
            {
              _var = MMC_CAR(tmpMeta7);
              /* Pattern-matching assignment */
              tmpMeta8 = _vals;
              if (listEmpty(tmpMeta8)) goto goto_1;
              tmpMeta9 = MMC_CAR(tmpMeta8);
              tmpMeta10 = MMC_CDR(tmpMeta8);
              _val = tmpMeta9;
              _vals = tmpMeta10;

              omc_NFEvalFunction_assignVariable(threadData, _var, _val);
            }
          }
          goto tmp2_done;
        }
        case 2: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,26,4) == 0) goto tmp2_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta12,29,1) == 0) goto tmp2_end;
          tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta12), 2));
          
          _var_ptr = tmpMeta13;
          /* Pattern matching succeeded */
          omc_NFEvalFunction_assignSubscriptedVariable(threadData, _var_ptr, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_variable), 3))), _value);
          goto tmp2_done;
        }
        case 3: {
          modelica_metatype tmpMeta14;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,6,2) == 0) goto tmp2_end;
          tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta14,2,0) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          goto tmp2_done;
        }
        case 4: {
          modelica_metatype tmpMeta15;
          modelica_metatype tmpMeta16;
          modelica_metatype tmpMeta17;
          
          /* Pattern matching succeeded */
          tmpMeta15 = stringAppend(_OMC_LIT73,omc_NFExpression_toString(threadData, _variable));
          tmpMeta16 = stringAppend(tmpMeta15,_OMC_LIT74);
          tmpMeta17 = stringAppend(tmpMeta16,omc_NFExpression_toString(threadData, _value));
          omc_Error_assertion(threadData, 0 /* false */, tmpMeta17, _OMC_LIT75);
          goto goto_1;
          goto tmp2_done;
        }
        }
        goto tmp2_end;
        tmp2_end: ;
      }
      goto goto_1;
      goto_1:;
      MMC_THROW_INTERNAL();
      goto tmp2_done;
      tmp2_done:;
    }
  }
  ;
  _return: OMC_LABEL_UNUSED
  return;
}

PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateAssignment(threadData_t *threadData, modelica_metatype _lhsExp, modelica_metatype _rhsExp, modelica_metatype _source, modelica_integer _context)
{
  modelica_integer _ctrl;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _ctrl = 1;
  omc_NFEvalFunction_assignVariable(threadData, _lhsExp, omc_NFCeval_evalExp(threadData, _rhsExp, omc_NFEvalFunction_evalTargetFromSource(threadData, _source, ((modelica_integer) 80), _context)));
  _return: OMC_LABEL_UNUSED
  return _ctrl;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateAssignment(threadData_t *threadData, modelica_metatype _lhsExp, modelica_metatype _rhsExp, modelica_metatype _source, modelica_metatype _context)
{
  modelica_integer tmp1;
  modelica_integer _ctrl;
  modelica_metatype out_ctrl;
  tmp1 = mmc_unbox_integer(_context);
  _ctrl = omc_NFEvalFunction_evaluateAssignment(threadData, _lhsExp, _rhsExp, _source, tmp1);
  out_ctrl = mmc_mk_icon(_ctrl);
  return out_ctrl;
}

PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateStatement(threadData_t *threadData, modelica_metatype _stmt, modelica_integer _context)
{
  modelica_integer _ctrl;
  modelica_integer tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _ctrl has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _stmt;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFEvalFunction_evaluateAssignment(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 3))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 5))), _context);
          goto tmp3_done;
        }
        case 5: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFEvalFunction_evaluateFor(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 3))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 4))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 6))), _context);
          goto tmp3_done;
        }
        case 6: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFEvalFunction_evaluateIf(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 3))), _context);
          goto tmp3_done;
        }
        case 8: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFEvalFunction_evaluateAssert(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 2))), _stmt, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 5))), _context);
          goto tmp3_done;
        }
        case 11: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFEvalFunction_evaluateNoRetCall(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 3))), _context);
          goto tmp3_done;
        }
        case 12: {
          
          /* Pattern matching succeeded */
          tmp1 = omc_NFEvalFunction_evaluateWhile(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 3))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 4))), _context);
          goto tmp3_done;
        }
        case 13: {
          
          /* Pattern matching succeeded */
          tmp1 = 4;
          goto tmp3_done;
        }
        case 14: {
          
          /* Pattern matching succeeded */
          tmp1 = 3;
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          tmpMeta5 = stringAppend(_OMC_LIT76,mmc_anyString(_stmt));
          tmpMeta6 = stringAppend(tmpMeta5,_OMC_LIT32);
          omc_Error_assertion(threadData, 0 /* false */, tmpMeta6, _OMC_LIT77);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _ctrl = tmp1;
  _return: OMC_LABEL_UNUSED
  return _ctrl;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateStatement(threadData_t *threadData, modelica_metatype _stmt, modelica_metatype _context)
{
  modelica_integer tmp1;
  modelica_integer _ctrl;
  modelica_metatype out_ctrl;
  tmp1 = mmc_unbox_integer(_context);
  _ctrl = omc_NFEvalFunction_evaluateStatement(threadData, _stmt, tmp1);
  out_ctrl = mmc_mk_icon(_ctrl);
  return out_ctrl;
}

PROTECTED_FUNCTION_STATIC modelica_integer omc_NFEvalFunction_evaluateStatements(threadData_t *threadData, modelica_metatype _stmts, modelica_integer _context)
{
  modelica_integer _ctrl;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _ctrl = 1;
  {
    modelica_metatype _s;
    for (tmpMeta1 = _stmts; !listEmpty(tmpMeta1); tmpMeta1=MMC_CDR(tmpMeta1))
    {
      _s = MMC_CAR(tmpMeta1);
      _ctrl = omc_NFEvalFunction_evaluateStatement(threadData, _s, _context);

      if(((modelica_integer)_ctrl != 1))
      {
        if(((modelica_integer)_ctrl == 2))
        {
          _ctrl = 1;
        }

        break;
      }
    }
  }
  _return: OMC_LABEL_UNUSED
  return _ctrl;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_evaluateStatements(threadData_t *threadData, modelica_metatype _stmts, modelica_metatype _context)
{
  modelica_integer tmp1;
  modelica_integer _ctrl;
  modelica_metatype out_ctrl;
  tmp1 = mmc_unbox_integer(_context);
  _ctrl = omc_NFEvalFunction_evaluateStatements(threadData, _stmts, tmp1);
  out_ctrl = mmc_mk_icon(_ctrl);
  return out_ctrl;
}

PROTECTED_FUNCTION_STATIC void omc_NFEvalFunction_assertAssignedOutput(threadData_t *threadData, modelica_metatype _outputNode, modelica_metatype _value)
{
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _value;
    {
      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,30,1) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta5 = mmc_mk_cons(omc_NFInstNode_InstNode_name(threadData, _outputNode), MMC_REFSTRUCTLIT(mmc_nil));
          omc_Error_addSourceMessageAsError(threadData, _OMC_LIT80, tmpMeta5, omc_NFInstNode_InstNode_info(threadData, _outputNode));
          goto goto_1;
          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;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_createResult(threadData_t *threadData, modelica_metatype _map, modelica_metatype _outputs)
{
  modelica_metatype _exp = NULL;
  modelica_metatype _expl = NULL;
  modelica_metatype _types = NULL;
  modelica_metatype _e = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta10;
  modelica_metatype tmpMeta11;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _exp has no default value.
  // _expl has no default value.
  // _types has no default value.
  // _e has no default value.
  if((listLength(_outputs) == ((modelica_integer) 1)))
  {
    _exp = omc_NFCeval_evalExp(threadData, omc_UnorderedMap_getOrFail(threadData, listHead(_outputs), _map), _OMC_LIT15);

    omc_NFEvalFunction_assertAssignedOutput(threadData, listHead(_outputs), _exp);
  }
  else
  {
    tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
    _expl = tmpMeta1;

    tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
    _types = tmpMeta2;

    {
      modelica_metatype _o;
      for (tmpMeta3 = _outputs; !listEmpty(tmpMeta3); tmpMeta3=MMC_CDR(tmpMeta3))
      {
        _o = MMC_CAR(tmpMeta3);
        _e = omc_NFCeval_evalExp(threadData, omc_UnorderedMap_getOrFail(threadData, _o, _map), _OMC_LIT15);

        omc_NFEvalFunction_assertAssignedOutput(threadData, _o, _e);

        tmpMeta4 = mmc_mk_cons(_e, _expl);
        _expl = tmpMeta4;
      }
    }

    _expl = listReverseInPlace(_expl);

    {
      modelica_metatype __omcQ_24tmpVar15;
      modelica_metatype* tmp7;
      modelica_metatype tmpMeta8;
      modelica_metatype __omcQ_24tmpVar14;
      modelica_integer tmp9;
      modelica_metatype _e_loopVar = 0;
      modelica_metatype _e;
      _e_loopVar = _expl;
      tmpMeta8 = MMC_REFSTRUCTLIT(mmc_nil);
      __omcQ_24tmpVar15 = tmpMeta8; /* defaultValue */
      tmp7 = &__omcQ_24tmpVar15;
      while(1) {
        tmp9 = 1;
        if (!listEmpty(_e_loopVar)) {
          _e = MMC_CAR(_e_loopVar);
          _e_loopVar = MMC_CDR(_e_loopVar);
          tmp9--;
        }
        if (tmp9 == 0) {
          __omcQ_24tmpVar14 = omc_NFExpression_typeOf(threadData, _e);
          *tmp7 = mmc_mk_cons(__omcQ_24tmpVar14,0);
          tmp7 = &MMC_CDR(*tmp7);
        } else if (tmp9 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      *tmp7 = mmc_mk_nil();
      tmpMeta6 = __omcQ_24tmpVar15;
    }
    _types = tmpMeta6;

    tmpMeta10 = mmc_mk_box3(11, &NFType_TUPLE__desc, _types, mmc_mk_none());
    tmpMeta11 = mmc_mk_box3(14, &NFExpression_TUPLE__desc, tmpMeta10, _expl);
    _exp = tmpMeta11;
  }
  _return: OMC_LABEL_UNUSED
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_optimizeStatement(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fstmt)
{
  modelica_metatype _stmt = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _stmt = __omcQ_24in_5Fstmt;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _stmt;
    {
      modelica_metatype _iter_exp = NULL;
      volatile mmc_switch_type tmp3;
      int tmp4;
      // _iter_exp has no default value.
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,2,5) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          tmpMeta5 = mmc_mk_box2(33, &NFExpression_EMPTY__desc, omc_NFInstNode_InstNode_getType(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 2)))));
          _iter_exp = omc_NFExpression_makeMutable(threadData, tmpMeta5);

          tmpMeta6 = MMC_TAGPTR(mmc_alloc_words(7));
          memcpy(MMC_UNTAGPTR(tmpMeta6), MMC_UNTAGPTR(_stmt), 7*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta6))[4] = omc_NFStatement_replaceIteratorList(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 4))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_stmt), 2))), _iter_exp);
          _stmt = tmpMeta6;

          tmpMeta8 = mmc_mk_box2(9, &NFInstNode_InstNode_ITERATOR__NODE__desc, _iter_exp);
          tmpMeta7 = MMC_TAGPTR(mmc_alloc_words(7));
          memcpy(MMC_UNTAGPTR(tmpMeta7), MMC_UNTAGPTR(_stmt), 7*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta7))[2] = tmpMeta8;
          _stmt = 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 _stmt;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_optimizeBody(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fbody)
{
  modelica_metatype _body = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _body = __omcQ_24in_5Fbody;
  {
    modelica_metatype __omcQ_24tmpVar17;
    modelica_metatype* tmp2;
    modelica_metatype tmpMeta3;
    modelica_metatype __omcQ_24tmpVar16;
    modelica_integer tmp4;
    modelica_metatype _s_loopVar = 0;
    modelica_metatype _s;
    _s_loopVar = _body;
    tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
    __omcQ_24tmpVar17 = tmpMeta3; /* defaultValue */
    tmp2 = &__omcQ_24tmpVar17;
    while(1) {
      tmp4 = 1;
      if (!listEmpty(_s_loopVar)) {
        _s = MMC_CAR(_s_loopVar);
        _s_loopVar = MMC_CDR(_s_loopVar);
        tmp4--;
      }
      if (tmp4 == 0) {
        __omcQ_24tmpVar16 = omc_NFStatement_map(threadData, _s, boxvar_NFEvalFunction_optimizeStatement);
        *tmp2 = mmc_mk_cons(__omcQ_24tmpVar16,0);
        tmp2 = &MMC_CDR(*tmp2);
      } else if (tmp4 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    *tmp2 = mmc_mk_nil();
    tmpMeta1 = __omcQ_24tmpVar17;
  }
  _body = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _body;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_mergeFunctionApplicationArgs(threadData_t *threadData, modelica_metatype _oldFn, modelica_metatype _oldArgs, modelica_metatype _newFn, modelica_metatype _newArgs, modelica_metatype _argNames)
{
  modelica_metatype _outArgs = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _arg_map = NULL;
  modelica_metatype _args = NULL;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  modelica_metatype tmpMeta8;
  modelica_metatype tmpMeta9;
  modelica_metatype tmpMeta10;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _outArgs = tmpMeta1;
  // _arg_map has no default value.
  // _args has no default value.
  _arg_map = omc_UnorderedMap_new(threadData, boxvar_stringHashDjb2, boxvar_stringEq, ((modelica_integer) 1));

  {
    modelica_metatype _s;
    for (tmpMeta2 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_newFn), 7))); !listEmpty(tmpMeta2); tmpMeta2=MMC_CDR(tmpMeta2))
    {
      _s = MMC_CAR(tmpMeta2);
      if(isSome((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_s), 4)))))
      {
        omc_UnorderedMap_add(threadData, omc_NFInstNode_InstNode_name(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_s), 2)))), omc_NFExpression_unbox(threadData, omc_Util_getOption(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_s), 4))))), _arg_map);
      }
    }
  }

  _args = _oldArgs;

  {
    modelica_metatype _i;
    for (tmpMeta4 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_oldFn), 4))); !listEmpty(tmpMeta4); tmpMeta4=MMC_CDR(tmpMeta4))
    {
      _i = MMC_CAR(tmpMeta4);
      omc_UnorderedMap_add(threadData, omc_NFInstNode_InstNode_name(threadData, _i), omc_NFExpression_unbox(threadData, listHead(_args)), _arg_map);

      _args = listRest(_args);
    }
  }

  _args = _newArgs;

  {
    modelica_metatype _n;
    for (tmpMeta6 = _argNames; !listEmpty(tmpMeta6); tmpMeta6=MMC_CDR(tmpMeta6))
    {
      _n = MMC_CAR(tmpMeta6);
      omc_UnorderedMap_add(threadData, _n, omc_NFExpression_unbox(threadData, listHead(_args)), _arg_map);

      _args = listRest(_args);
    }
  }

  {
    modelica_metatype _i;
    for (tmpMeta8 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_newFn), 4))); !listEmpty(tmpMeta8); tmpMeta8=MMC_CDR(tmpMeta8))
    {
      _i = MMC_CAR(tmpMeta8);
      tmpMeta9 = mmc_mk_cons(omc_UnorderedMap_getOrFail(threadData, omc_NFInstNode_InstNode_name(threadData, _i), _arg_map), _outArgs);
      _outArgs = tmpMeta9;
    }
  }

  _outArgs = listReverseInPlace(_outArgs);
  _return: OMC_LABEL_UNUSED
  return _outArgs;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_evaluateReplacement2(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp)
{
  modelica_metatype _exp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _exp = __omcQ_24in_5Fexp;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _exp;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 32: {
          
          /* Pattern matching succeeded */
          omc_NFExpression_applyMutable(threadData, _exp, boxvar_NFEvalFunction_evaluateReplacement2);
          tmpMeta1 = _exp;
          goto tmp3_done;
        }
        case 15: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          
          /* Pattern matching succeeded */
          {
            modelica_metatype __omcQ_24tmpVar19;
            modelica_metatype* tmp7;
            modelica_metatype tmpMeta8;
            modelica_metatype __omcQ_24tmpVar18;
            modelica_integer tmp9;
            modelica_metatype _e_loopVar = 0;
            modelica_metatype _e;
            _e_loopVar = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 4)));
            tmpMeta8 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar19 = tmpMeta8; /* defaultValue */
            tmp7 = &__omcQ_24tmpVar19;
            while(1) {
              tmp9 = 1;
              if (!listEmpty(_e_loopVar)) {
                _e = MMC_CAR(_e_loopVar);
                _e_loopVar = MMC_CDR(_e_loopVar);
                tmp9--;
              }
              if (tmp9 == 0) {
                __omcQ_24tmpVar18 = omc_NFEvalFunction_evaluateReplacement2(threadData, _e);
                *tmp7 = mmc_mk_cons(__omcQ_24tmpVar18,0);
                tmp7 = &MMC_CDR(*tmp7);
              } else if (tmp9 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp7 = mmc_mk_nil();
            tmpMeta6 = __omcQ_24tmpVar19;
          }
          tmpMeta5 = MMC_TAGPTR(mmc_alloc_words(5));
          memcpy(MMC_UNTAGPTR(tmpMeta5), MMC_UNTAGPTR(_exp), 5*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta5))[4] = tmpMeta6;
          _exp = tmpMeta5;
          tmpMeta1 = _exp;
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = (omc_NFExpression_contains(threadData, _exp, boxvar_NFExpression_isEmpty)?_exp:omc_NFCeval_evalExp(threadData, _exp, _OMC_LIT15));
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_evaluateReplacement(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp)
{
  modelica_metatype _exp = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _exp = __omcQ_24in_5Fexp;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _exp;
    {
      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,29,1) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          omc_NFExpression_applyMutable(threadData, _exp, boxvar_NFEvalFunction_evaluateReplacement2);
          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 _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyReplacementCall(threadData_t *threadData, modelica_metatype _map, modelica_metatype _call, modelica_metatype _exp)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype _repl_node = NULL;
  modelica_metatype _repl_oexp = NULL;
  modelica_metatype _repl_exp = NULL;
  modelica_metatype _args = NULL;
  modelica_metatype _names = NULL;
  modelica_metatype _fn = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _repl_node has no default value.
  // _repl_oexp has no default value.
  // _repl_exp has no default value.
  // _args has no default value.
  // _names has no default value.
  // _fn has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _call;
    {
      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,2,6) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          _repl_oexp = omc_UnorderedMap_get(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_call), 2)))), 3))), _map);

          if(isSome(_repl_oexp))
          {
            /* Pattern-matching assignment */
            tmpMeta6 = _repl_oexp;
            if (optionNone(tmpMeta6)) goto goto_2;
            tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 1));
            _repl_exp = tmpMeta7;

            { /* match expression */
              modelica_metatype tmp11_1;
              tmp11_1 = _repl_exp;
              {
                volatile mmc_switch_type tmp11;
                int tmp12;
                tmp11 = 0;
                for (; tmp11 < 3; tmp11++) {
                  switch (MMC_SWITCH_CAST(tmp11)) {
                  case 0: {
                    modelica_metatype tmpMeta13;
                    modelica_metatype tmpMeta14;
                    modelica_metatype tmpMeta15;
                    modelica_metatype tmpMeta16;
                    modelica_metatype tmpMeta17;
                    modelica_metatype tmpMeta18;
                    modelica_metatype tmpMeta19;
                    if (mmc__uniontype__metarecord__typedef__equal(tmp11_1,6,2) == 0) goto tmp10_end;
                    tmpMeta13 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp11_1), 2));
                    if (mmc__uniontype__metarecord__typedef__equal(tmpMeta13,12,2) == 0) goto tmp10_end;
                    tmpMeta14 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta13), 2));
                    
                    _fn = tmpMeta14;
                    /* Pattern matching succeeded */
                    tmpMeta16 = MMC_REFSTRUCTLIT(mmc_nil);
                    tmpMeta17 = MMC_REFSTRUCTLIT(mmc_nil);
                    tmpMeta15 = MMC_TAGPTR(mmc_alloc_words(8));
                    memcpy(MMC_UNTAGPTR(tmpMeta15), MMC_UNTAGPTR(_call), 8*sizeof(modelica_metatype));
                    ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta15))[6] = omc_NFEvalFunction_mergeFunctionApplicationArgs(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_call), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_call), 6))), _fn, tmpMeta16, tmpMeta17);
                    _call = tmpMeta15;

                    tmpMeta18 = MMC_TAGPTR(mmc_alloc_words(8));
                    memcpy(MMC_UNTAGPTR(tmpMeta18), MMC_UNTAGPTR(_call), 8*sizeof(modelica_metatype));
                    ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta18))[2] = _fn;
                    _call = tmpMeta18;
                    tmpMeta19 = mmc_mk_box2(16, &NFExpression_CALL__desc, _call);
                    tmpMeta8 = tmpMeta19;
                    goto tmp10_done;
                  }
                  case 1: {
                    modelica_metatype tmpMeta20;
                    modelica_metatype tmpMeta21;
                    modelica_metatype tmpMeta22;
                    if (mmc__uniontype__metarecord__typedef__equal(tmp11_1,31,4) == 0) goto tmp10_end;
                    
                    /* Pattern matching succeeded */
                    _fn = listHead(omc_NFFunction_Function_getCachedFuncs(threadData, omc_NFComponentRef_node(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_repl_exp), 2))))));

                    tmpMeta20 = MMC_TAGPTR(mmc_alloc_words(8));
                    memcpy(MMC_UNTAGPTR(tmpMeta20), MMC_UNTAGPTR(_call), 8*sizeof(modelica_metatype));
                    ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta20))[6] = omc_NFEvalFunction_mergeFunctionApplicationArgs(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_call), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_call), 6))), _fn, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_repl_exp), 3))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_repl_exp), 4))));
                    _call = tmpMeta20;

                    tmpMeta21 = MMC_TAGPTR(mmc_alloc_words(8));
                    memcpy(MMC_UNTAGPTR(tmpMeta21), MMC_UNTAGPTR(_call), 8*sizeof(modelica_metatype));
                    ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta21))[2] = _fn;
                    _call = tmpMeta21;
                    tmpMeta22 = mmc_mk_box2(16, &NFExpression_CALL__desc, _call);
                    tmpMeta8 = tmpMeta22;
                    goto tmp10_done;
                  }
                  case 2: {
                    
                    /* Pattern matching succeeded */
                    tmpMeta8 = _exp;
                    goto tmp10_done;
                  }
                  }
                  goto tmp10_end;
                  tmp10_end: ;
                }
                goto goto_9;
                goto_9:;
                goto goto_2;
                goto tmp10_done;
                tmp10_done:;
              }
            }
            _outExp = tmpMeta8;
          }
          else
          {
            _outExp = _exp;
          }
          tmpMeta1 = _outExp;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _exp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _outExp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

static modelica_metatype closure1_NFEvalFunction_applyReplacements2(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_applyReplacements2(thData, map, $in_exp);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyReplacementCref(threadData_t *threadData, modelica_metatype _map, modelica_metatype _cref, modelica_metatype _exp)
{
  jmp_buf *old_mmc_jumper = threadData->mmc_jumper;
  modelica_metatype _outExp = NULL;
  modelica_metatype _cref_parts = NULL;
  modelica_metatype _repl_exp = NULL;
  modelica_metatype _parent = NULL;
  modelica_metatype _node = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta11;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  // _cref_parts has no default value.
  // _repl_exp has no default value.
  // _parent has no default value.
  // _node has no default value.
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _cref_parts = omc_NFComponentRef_toListReverse(threadData, _cref, 1 /* true */, tmpMeta1);

  if(listEmpty(_cref_parts))
  {
    _outExp = _exp;
  }
  else
  {
    _parent = omc_NFComponentRef_node(threadData, listHead(_cref_parts));

    _repl_exp = omc_UnorderedMap_get(threadData, _parent, _map);

    if(isSome(_repl_exp))
    {
      /* Pattern-matching assignment */
      tmpMeta2 = _repl_exp;
      if (optionNone(tmpMeta2)) MMC_THROW_INTERNAL();
      tmpMeta3 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta2), 1));
      _outExp = tmpMeta3;
    }
    else
    {
      _outExp = _exp;

      goto _return;
    }

    _outExp = omc_NFExpression_applySubscripts(threadData, omc_NFComponentRef_getSubscripts(threadData, listHead(_cref_parts)), _outExp, 0 /* false */);

    _cref_parts = listRest(_cref_parts);

    if((!listEmpty(_cref_parts)))
    {
      { /* matchcontinue expression */
        {
          volatile mmc_switch_type tmp6;
          int tmp7;
          tmp6 = 0;
          MMC_TRY_INTERNAL(mmc_jumper)
          tmp5_top:
          threadData->mmc_jumper = &new_mmc_jumper;
          for (; tmp6 < 2; tmp6++) {
            switch (MMC_SWITCH_CAST(tmp6)) {
            case 0: {
              modelica_metatype tmpMeta8;
              modelica_metatype tmpMeta9;
              /* Pattern matching succeeded */
              {
                modelica_metatype _cr;
                for (tmpMeta8 = _cref_parts; !listEmpty(tmpMeta8); tmpMeta8=MMC_CDR(tmpMeta8))
                {
                  _cr = MMC_CAR(tmpMeta8);
                  _node = omc_NFComponentRef_node(threadData, _cr);

                  _outExp = omc_NFExpression_makeImmutable(threadData, _outExp);

                  _outExp = omc_NFExpression_recordElement(threadData, omc_NFInstNode_InstNode_name(threadData, _node), _outExp);

                  _outExp = omc_NFExpression_applySubscripts(threadData, omc_NFComponentRef_getSubscripts(threadData, _cr), _outExp, 0 /* false */);
                }
              }
              goto tmp5_done;
            }
            case 1: {
              modelica_metatype tmpMeta10;
              /* Pattern matching succeeded */
              tmpMeta10 = stringAppend(_OMC_LIT81,omc_NFComponentRef_toString(threadData, _cref));
              omc_Error_assertion(threadData, 0 /* false */, tmpMeta10, _OMC_LIT82);
              goto tmp5_done;
            }
            }
            goto tmp5_end;
            tmp5_end: ;
          }
          goto goto_4;
          tmp5_done:
          (void)tmp6;
          MMC_RESTORE_INTERNAL(mmc_jumper);
          goto tmp5_done2;
          goto_4:;
          MMC_CATCH_INTERNAL(mmc_jumper);
          if (++tmp6 < 2) {
            goto tmp5_top;
          }
          MMC_THROW_INTERNAL();
          tmp5_done2:;
        }
      }
      ;
    }

    tmpMeta11 = mmc_mk_box1(0, _map);
    _outExp = omc_NFExpression_map(threadData, _outExp, (modelica_fnptr) mmc_mk_box2(0,closure1_NFEvalFunction_applyReplacements2,tmpMeta11));
  }
  _return: OMC_LABEL_UNUSED
  threadData->mmc_jumper = old_mmc_jumper;
  return _outExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyReplacements2(threadData_t *threadData, modelica_metatype _map, modelica_metatype __omcQ_24in_5Fexp)
{
  modelica_metatype _exp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _exp = __omcQ_24in_5Fexp;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _exp;
    {
      int tmp4;
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 9: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFEvalFunction_applyReplacementCref(threadData, _map, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 3))), _exp);
          goto tmp3_done;
        }
        case 16: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NFEvalFunction_applyReplacementCall(threadData, _map, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 2))), _exp);
          goto tmp3_done;
        }
        case 28: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 2)));
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _exp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _exp;
}

static modelica_metatype closure3_NFEvalFunction_applyReplacements2(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_applyReplacements2(thData, map, $in_exp);
}static modelica_metatype closure2_NFExpression_map(threadData_t *thData, modelica_metatype closure, modelica_metatype exp)
{
  modelica_fnptr func = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFExpression_map(thData, exp, func);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyReplacements(threadData_t *threadData, modelica_metatype _map, modelica_metatype __omcQ_24in_5FfnBody)
{
  modelica_metatype _fnBody = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _fnBody = __omcQ_24in_5FfnBody;
  tmpMeta2 = mmc_mk_box1(0, _map);
  tmpMeta1 = mmc_mk_box1(0, (modelica_fnptr) mmc_mk_box2(0,closure3_NFEvalFunction_applyReplacements2,tmpMeta2));
  _fnBody = omc_NFStatement_mapExpList(threadData, _fnBody, (modelica_fnptr) mmc_mk_box2(0,closure2_NFExpression_map,tmpMeta1));
  _return: OMC_LABEL_UNUSED
  return _fnBody;
}

static modelica_metatype closure4_NFEvalFunction_applyReplacements2(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_applyReplacements2(thData, map, $in_exp);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyBindingReplacement(threadData_t *threadData, modelica_metatype _exp, modelica_metatype _map)
{
  modelica_metatype _outExp = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _outExp has no default value.
  tmpMeta1 = mmc_mk_box1(0, _map);
  _outExp = omc_NFExpression_map(threadData, _exp, (modelica_fnptr) mmc_mk_box2(0,closure4_NFEvalFunction_applyReplacements2,tmpMeta1));
  _return: OMC_LABEL_UNUSED
  return _outExp;
}

static modelica_metatype closure5_NFEvalFunction_applyBindingReplacement(threadData_t *thData, modelica_metatype closure, modelica_metatype exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_applyBindingReplacement(thData, exp, map);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_buildRecordBinding(threadData_t *threadData, modelica_metatype _recordNode, modelica_metatype _map, modelica_boolean _mutableParams)
{
  modelica_metatype _result = NULL;
  modelica_metatype _cls_node = NULL;
  modelica_metatype _cls = NULL;
  modelica_metatype _comps = NULL;
  modelica_metatype _bindings = NULL;
  modelica_metatype _exp = NULL;
  modelica_metatype _local_map = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  _cls_node = omc_NFInstNode_InstNode_classScope(threadData, _recordNode);
  _cls = omc_NFInstNode_InstNode_getClass(threadData, _cls_node);
  // _comps has no default value.
  // _bindings has no default value.
  // _exp has no default value.
  // _local_map has no default value.
  { /* 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_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_integer tmp11;
          modelica_integer tmp12;
          modelica_metatype tmpMeta13;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,5) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,3,5) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta6), 4));
          
          _comps = tmpMeta7;
          /* Pattern matching succeeded */
          tmpMeta8 = MMC_REFSTRUCTLIT(mmc_nil);
          _bindings = tmpMeta8;

          _local_map = omc_UnorderedMap_new(threadData, boxvar_NFInstNode_InstNode_hash, boxvar_NFInstNode_InstNode_refEqual, ((modelica_integer) 1));

          {
            modelica_metatype _comp;
            for (tmpMeta9 = _comps, tmp12 = arrayLength(tmpMeta9), tmp11 = 1; tmp11 <= tmp12; tmp11++)
            {
              _comp = arrayGet(tmpMeta9,tmp11);
              _exp = omc_NFEvalFunction_getBindingExp(threadData, _comp, _map, _mutableParams, 1 /* true */);

              if(_mutableParams)
              {
                _exp = omc_NFExpression_makeMutable(threadData, _exp);
              }

              omc_UnorderedMap_add(threadData, _comp, _exp, _local_map);
            }
          }

          tmpMeta13 = mmc_mk_box1(0, _local_map);
          omc_UnorderedMap_apply(threadData, _local_map, (modelica_fnptr) mmc_mk_box2(0,closure5_NFEvalFunction_applyBindingReplacement,tmpMeta13));

          _bindings = omc_UnorderedMap_valueList(threadData, _local_map);
          tmpMeta1 = omc_NFExpression_makeRecord(threadData, omc_NFInstNode_InstNode_fullPath(threadData, _cls_node, 0 /* false */), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_cls), 2))), _bindings);
          goto tmp3_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,7,3) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          /* Tail recursive call */
          _recordNode = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_cls), 3)));
          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:;
    }
  }
  _result = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _result;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_buildRecordBinding(threadData_t *threadData, modelica_metatype _recordNode, modelica_metatype _map, modelica_metatype _mutableParams)
{
  modelica_integer tmp1;
  modelica_metatype _result = NULL;
  tmp1 = mmc_unbox_integer(_mutableParams);
  _result = omc_NFEvalFunction_buildRecordBinding(threadData, _recordNode, _map, tmp1);
  /* skip box _result; NFExpression */
  return _result;
}

static modelica_metatype closure6_NFEvalFunction_applyReplacements2(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_applyReplacements2(thData, map, $in_exp);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_applyReplacementsDim(threadData_t *threadData, modelica_metatype _map, modelica_metatype __omcQ_24in_5Fdim)
{
  modelica_metatype _dim = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _dim = __omcQ_24in_5Fdim;
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _dim;
    {
      modelica_metatype _exp = NULL;
      volatile mmc_switch_type tmp4;
      int tmp5;
      // _exp has no default value.
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta6 = mmc_mk_box1(0, _map);
          _exp = omc_NFExpression_map(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_dim), 2))), (modelica_fnptr) mmc_mk_box2(0,closure6_NFEvalFunction_applyReplacements2,tmpMeta6));

          _exp = omc_NFCeval_evalExp(threadData, _exp, _OMC_LIT15);
          tmpMeta1 = omc_NFDimension_fromExp(threadData, _exp, 1);
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _dim;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _dim = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _dim;
}

static modelica_metatype closure7_NFEvalFunction_applyReplacementsDim(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_dim)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_applyReplacementsDim(thData, map, $in_dim);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_buildBinding(threadData_t *threadData, modelica_metatype _node, modelica_metatype _map, modelica_boolean _mutableParams, modelica_boolean _buildArrayBinding)
{
  modelica_metatype _result = NULL;
  modelica_metatype _ty = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  // _ty has no default value.
  _ty = omc_NFInstNode_InstNode_getType(threadData, _node);

  tmpMeta1 = mmc_mk_box1(0, _map);
  _ty = omc_NFType_mapDims(threadData, _ty, (modelica_fnptr) mmc_mk_box2(0,closure7_NFEvalFunction_applyReplacementsDim,tmpMeta1));

  { /* match expression */
    modelica_metatype tmp5_1;
    tmp5_1 = _ty;
    {
      volatile mmc_switch_type tmp5;
      int tmp6;
      tmp5 = 0;
      for (; tmp5 < 3; tmp5++) {
        switch (MMC_SWITCH_CAST(tmp5)) {
        case 0: {
          modelica_metatype tmpMeta7;
          modelica_boolean tmp8;
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp5_1,7,2) == 0) goto tmp4_end;
          
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!_buildArrayBinding) goto tmp4_end;
          tmp8 = (modelica_boolean)omc_NFType_hasKnownSize(threadData, _ty);
          if(tmp8)
          {
            tmpMeta7 = mmc_mk_box2(33, &NFExpression_EMPTY__desc, omc_NFType_arrayElementType(threadData, _ty));
            tmpMeta9 = omc_NFExpression_fillType(threadData, _ty, tmpMeta7);
          }
          else
          {
            tmpMeta9 = omc_NFExpression_makeEmptyArray(threadData, _ty);
          }
          tmpMeta2 = tmpMeta9;
          goto tmp4_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp5_1,11,2) == 0) goto tmp4_end;
          
          /* Pattern matching succeeded */
          tmpMeta2 = omc_NFEvalFunction_buildRecordBinding(threadData, _node, _map, _mutableParams);
          goto tmp4_done;
        }
        case 2: {
          modelica_metatype tmpMeta10;
          
          /* Pattern matching succeeded */
          tmpMeta10 = mmc_mk_box2(33, &NFExpression_EMPTY__desc, _ty);
          tmpMeta2 = tmpMeta10;
          goto tmp4_done;
        }
        }
        goto tmp4_end;
        tmp4_end: ;
      }
      goto goto_3;
      goto_3:;
      MMC_THROW_INTERNAL();
      goto tmp4_done;
      tmp4_done:;
    }
  }
  _result = tmpMeta2;
  _return: OMC_LABEL_UNUSED
  return _result;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_buildBinding(threadData_t *threadData, modelica_metatype _node, modelica_metatype _map, modelica_metatype _mutableParams, modelica_metatype _buildArrayBinding)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _result = NULL;
  tmp1 = mmc_unbox_integer(_mutableParams);
  tmp2 = mmc_unbox_integer(_buildArrayBinding);
  _result = omc_NFEvalFunction_buildBinding(threadData, _node, _map, tmp1, tmp2);
  /* skip box _result; NFExpression */
  return _result;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_getBindingExp(threadData_t *threadData, modelica_metatype _node, modelica_metatype _map, modelica_boolean _mutableParams, modelica_boolean _buildArrayBinding)
{
  modelica_metatype _bindingExp = NULL;
  modelica_metatype _comp = NULL;
  modelica_metatype _binding = NULL;
  modelica_metatype _ty = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _bindingExp has no default value.
  // _comp has no default value.
  // _binding has no default value.
  // _ty has no default value.
  _comp = omc_NFInstNode_InstNode_component(threadData, _node);

  _binding = omc_NFComponent_getBinding(threadData, _comp);

  if(omc_NFBinding_isBound(threadData, _binding))
  {
    _bindingExp = omc_NFBinding_getExp(threadData, _binding);

    _bindingExp = omc_NFExpression_map(threadData, _bindingExp, boxvar_NFExpression_clone);
  }
  else
  {
    _bindingExp = omc_NFEvalFunction_buildBinding(threadData, _node, _map, _mutableParams, _buildArrayBinding);
  }
  _return: OMC_LABEL_UNUSED
  return _bindingExp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_getBindingExp(threadData_t *threadData, modelica_metatype _node, modelica_metatype _map, modelica_metatype _mutableParams, modelica_metatype _buildArrayBinding)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _bindingExp = NULL;
  tmp1 = mmc_unbox_integer(_mutableParams);
  tmp2 = mmc_unbox_integer(_buildArrayBinding);
  _bindingExp = omc_NFEvalFunction_getBindingExp(threadData, _node, _map, tmp1, tmp2);
  /* skip box _bindingExp; NFExpression */
  return _bindingExp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_addImmutableArgument(threadData_t *threadData, modelica_metatype _node, modelica_metatype __omcQ_24in_5Fmap, modelica_boolean _buildArrayBinding)
{
  modelica_metatype _map = NULL;
  modelica_metatype _exp = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _map = __omcQ_24in_5Fmap;
  // _exp has no default value.
  _exp = omc_NFEvalFunction_getBindingExp(threadData, _node, _map, 0 /* false */, _buildArrayBinding);

  omc_UnorderedMap_add(threadData, _node, _exp, _map);
  _return: OMC_LABEL_UNUSED
  return _map;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_addImmutableArgument(threadData_t *threadData, modelica_metatype _node, modelica_metatype __omcQ_24in_5Fmap, modelica_metatype _buildArrayBinding)
{
  modelica_integer tmp1;
  modelica_metatype _map = NULL;
  tmp1 = mmc_unbox_integer(_buildArrayBinding);
  _map = omc_NFEvalFunction_addImmutableArgument(threadData, _node, __omcQ_24in_5Fmap, tmp1);
  /* skip box _map; UnorderedMap<NFInstNode.InstNode,NFExpression> */
  return _map;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_addMutableArgument(threadData_t *threadData, modelica_metatype _node, modelica_metatype __omcQ_24in_5Fmap, modelica_boolean _buildArrayBinding)
{
  modelica_metatype _map = NULL;
  modelica_metatype _exp = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _map = __omcQ_24in_5Fmap;
  // _exp has no default value.
  _exp = omc_NFEvalFunction_getBindingExp(threadData, _node, _map, 1 /* true */, _buildArrayBinding);

  _exp = omc_NFExpression_makeMutable(threadData, _exp);

  omc_UnorderedMap_add(threadData, _node, _exp, _map);
  _return: OMC_LABEL_UNUSED
  return _map;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_addMutableArgument(threadData_t *threadData, modelica_metatype _node, modelica_metatype __omcQ_24in_5Fmap, modelica_metatype _buildArrayBinding)
{
  modelica_integer tmp1;
  modelica_metatype _map = NULL;
  tmp1 = mmc_unbox_integer(_buildArrayBinding);
  _map = omc_NFEvalFunction_addMutableArgument(threadData, _node, __omcQ_24in_5Fmap, tmp1);
  /* skip box _map; UnorderedMap<NFInstNode.InstNode,NFExpression> */
  return _map;
}

static modelica_metatype closure8_NFEvalFunction_addMutableArgument(threadData_t *thData, modelica_metatype closure, modelica_metatype node, modelica_metatype $in_map)
{
  modelica_metatype buildArrayBinding = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_addMutableArgument(thData, node, $in_map, buildArrayBinding);
}static modelica_metatype closure9_NFEvalFunction_addMutableArgument(threadData_t *thData, modelica_metatype closure, modelica_metatype node, modelica_metatype $in_map)
{
  modelica_metatype buildArrayBinding = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_addMutableArgument(thData, node, $in_map, buildArrayBinding);
}static modelica_metatype closure10_NFEvalFunction_addImmutableArgument(threadData_t *thData, modelica_metatype closure, modelica_metatype node, modelica_metatype $in_map)
{
  modelica_metatype buildArrayBinding = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_addImmutableArgument(thData, node, $in_map, buildArrayBinding);
}static modelica_metatype closure11_NFEvalFunction_addImmutableArgument(threadData_t *thData, modelica_metatype closure, modelica_metatype node, modelica_metatype $in_map)
{
  modelica_metatype buildArrayBinding = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_addImmutableArgument(thData, node, $in_map, buildArrayBinding);
}static modelica_metatype closure12_NFEvalFunction_applyBindingReplacement(threadData_t *thData, modelica_metatype closure, modelica_metatype exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NFEvalFunction_applyBindingReplacement(thData, exp, map);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NFEvalFunction_createArgumentMap(threadData_t *threadData, modelica_metatype _inputs, modelica_metatype _outputs, modelica_metatype _locals, modelica_metatype _args, modelica_boolean _mutableParams, modelica_boolean _buildArrayBinding)
{
  modelica_metatype _map = NULL;
  modelica_metatype _arg = NULL;
  modelica_metatype _rest_args = NULL;
  modelica_metatype _fn = NULL;
  modelica_metatype _cache = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  modelica_metatype tmpMeta8;
  modelica_metatype tmpMeta9;
  modelica_metatype tmpMeta10;
  modelica_metatype tmpMeta11;
  modelica_metatype tmpMeta12;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _map has no default value.
  // _arg has no default value.
  _rest_args = _args;
  // _fn has no default value.
  // _cache has no default value.
  _map = omc_UnorderedMap_new(threadData, boxvar_NFInstNode_InstNode_hash, boxvar_NFInstNode_InstNode_refEqual, ((modelica_integer) 1));

  {
    modelica_metatype _i;
    for (tmpMeta1 = _inputs; !listEmpty(tmpMeta1); tmpMeta1=MMC_CDR(tmpMeta1))
    {
      _i = MMC_CAR(tmpMeta1);
      /* Pattern-matching assignment */
      tmpMeta2 = _rest_args;
      if (listEmpty(tmpMeta2)) MMC_THROW_INTERNAL();
      tmpMeta3 = MMC_CAR(tmpMeta2);
      tmpMeta4 = MMC_CDR(tmpMeta2);
      _arg = tmpMeta3;
      _rest_args = tmpMeta4;

      omc_UnorderedMap_add(threadData, _i, _arg, _map);

      if(omc_NFExpression_isFunctionPointer(threadData, _arg))
      {
        {
          modelica_metatype _fn;
          for (tmpMeta5 = omc_NFFunction_Function_getCachedFuncs(threadData, _i); !listEmpty(tmpMeta5); tmpMeta5=MMC_CDR(tmpMeta5))
          {
            _fn = MMC_CAR(tmpMeta5);
            omc_UnorderedMap_add(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 3))), _arg, _map);
          }
        }
      }
    }
  }

  if(_mutableParams)
  {
    tmpMeta8 = mmc_mk_box1(0, mmc_mk_boolean(_buildArrayBinding));
    omc_List_fold(threadData, _outputs, (modelica_fnptr) mmc_mk_box2(0,closure8_NFEvalFunction_addMutableArgument,tmpMeta8), _map);

    tmpMeta9 = mmc_mk_box1(0, mmc_mk_boolean(_buildArrayBinding));
    omc_List_fold(threadData, _locals, (modelica_fnptr) mmc_mk_box2(0,closure9_NFEvalFunction_addMutableArgument,tmpMeta9), _map);
  }
  else
  {
    tmpMeta10 = mmc_mk_box1(0, mmc_mk_boolean(_buildArrayBinding));
    omc_List_fold(threadData, _outputs, (modelica_fnptr) mmc_mk_box2(0,closure10_NFEvalFunction_addImmutableArgument,tmpMeta10), _map);

    tmpMeta11 = mmc_mk_box1(0, mmc_mk_boolean(_buildArrayBinding));
    omc_List_fold(threadData, _locals, (modelica_fnptr) mmc_mk_box2(0,closure11_NFEvalFunction_addImmutableArgument,tmpMeta11), _map);
  }

  tmpMeta12 = mmc_mk_box1(0, _map);
  omc_UnorderedMap_apply(threadData, _map, (modelica_fnptr) mmc_mk_box2(0,closure12_NFEvalFunction_applyBindingReplacement,tmpMeta12));

  omc_UnorderedMap_apply(threadData, _map, boxvar_NFEvalFunction_evaluateReplacement);
  _return: OMC_LABEL_UNUSED
  return _map;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NFEvalFunction_createArgumentMap(threadData_t *threadData, modelica_metatype _inputs, modelica_metatype _outputs, modelica_metatype _locals, modelica_metatype _args, modelica_metatype _mutableParams, modelica_metatype _buildArrayBinding)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_metatype _map = NULL;
  tmp1 = mmc_unbox_integer(_mutableParams);
  tmp2 = mmc_unbox_integer(_buildArrayBinding);
  _map = omc_NFEvalFunction_createArgumentMap(threadData, _inputs, _outputs, _locals, _args, tmp1, tmp2);
  /* skip box _map; UnorderedMap<NFInstNode.InstNode,NFExpression> */
  return _map;
}

DLLDirection
modelica_metatype omc_NFEvalFunction_evaluateRecordConstructor(threadData_t *threadData, modelica_metatype _fn, modelica_metatype _ty, modelica_metatype _args, modelica_boolean _evaluate)
{
  modelica_metatype _result = NULL;
  modelica_metatype _arg_map = NULL;
  modelica_metatype _expl = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _node = NULL;
  modelica_metatype _out_ty = NULL;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  modelica_integer tmp8;
  modelica_integer tmp9;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  // _arg_map has no default value.
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _expl = tmpMeta1;
  // _node has no default value.
  // _out_ty has no default value.
  tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
  _arg_map = omc_NFEvalFunction_createArgumentMap(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 4))), tmpMeta2, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 6))), _args, 0 /* false */, 1 /* true */);

  /* Pattern-matching assignment */
  tmpMeta3 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 8)));
  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta3,11,2) == 0) MMC_THROW_INTERNAL();
  tmpMeta4 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta3), 2));
  _out_ty = tmpMeta4;

  {
    modelica_metatype _c;
    for (tmpMeta5 = omc_NFClassTree_ClassTree_getComponents(threadData, omc_NFClass_classTree(threadData, omc_NFInstNode_InstNode_getClass(threadData, _out_ty))), tmp9 = arrayLength(tmpMeta5), tmp8 = 1; tmp8 <= tmp9; tmp8++)
    {
      _c = arrayGet(tmpMeta5,tmp8);
      tmpMeta6 = mmc_mk_cons(omc_UnorderedMap_getOrFail(threadData, _c, _arg_map), _expl);
      _expl = tmpMeta6;
    }
  }

  _result = omc_NFExpression_makeRecord(threadData, omc_NFFunction_Function_name(threadData, _fn), _ty, listReverseInPlace(_expl));

  if(_evaluate)
  {
    _result = omc_NFCeval_evalExp(threadData, _result, _OMC_LIT15);
  }
  _return: OMC_LABEL_UNUSED
  return _result;
}
modelica_metatype boxptr_NFEvalFunction_evaluateRecordConstructor(threadData_t *threadData, modelica_metatype _fn, modelica_metatype _ty, modelica_metatype _args, modelica_metatype _evaluate)
{
  modelica_integer tmp1;
  modelica_metatype _result = NULL;
  tmp1 = mmc_unbox_integer(_evaluate);
  _result = omc_NFEvalFunction_evaluateRecordConstructor(threadData, _fn, _ty, _args, tmp1);
  /* skip box _result; NFExpression */
  return _result;
}

DLLDirection
modelica_metatype omc_NFEvalFunction_evaluateExternal(threadData_t *threadData, modelica_metatype _fn, modelica_metatype _args, modelica_metatype _target)
{
  modelica_metatype _result = NULL;
  modelica_string _name = NULL;
  modelica_string _lang = NULL;
  modelica_metatype _output_ref = NULL;
  modelica_metatype _ann = NULL;
  modelica_metatype _ext_args = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  // _name has no default value.
  // _lang has no default value.
  // _output_ref has no default value.
  // _ann has no default value.
  // _ext_args has no default value.
  /* Pattern-matching assignment */
  tmpMeta1 = omc_NFClass_getSections(threadData, omc_NFInstNode_InstNode_getClass(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 3)))));
  if (mmc__uniontype__metarecord__typedef__equal(tmpMeta1,1,7) == 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(tmpMeta1), 4));
  tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 5));
  tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta1), 6));
  _name = tmpMeta2;
  _ext_args = tmpMeta3;
  _output_ref = tmpMeta4;
  _lang = tmpMeta5;
  _ann = tmpMeta6;

  { /* matchcontinue expression */
    volatile modelica_string tmp10_1;
    tmp10_1 = _lang;
    {
      volatile mmc_switch_type tmp10;
      int tmp11;
      tmp10 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp9_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp10 < 4; tmp10++) {
        switch (MMC_SWITCH_CAST(tmp10)) {
        case 0: {
          if (7 != MMC_STRLEN(tmp10_1) || strcmp(MMC_STRINGDATA(_OMC_LIT87), MMC_STRINGDATA(tmp10_1)) != 0) goto tmp9_end;
          tmp10 += 1; /* Pattern matching succeeded; we may skip some cases if we fail */
          tmpMeta7 = omc_NFCeval_evalBuiltinCall(threadData, _fn, _args, _OMC_LIT15);
          goto tmp9_done;
        }
        case 1: {
          if (10 != MMC_STRLEN(tmp10_1) || strcmp(MMC_STRINGDATA(_OMC_LIT88), MMC_STRINGDATA(tmp10_1)) != 0) goto tmp9_end;
          /* Pattern matching succeeded */
          tmpMeta7 = omc_NFEvalFunction_evaluateExternal2(threadData, _name, _fn, _args, _ext_args);
          goto tmp9_done;
        }
        case 2: {
          
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!(!omc_NFInstContext_inInstanceAPI(threadData, mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_target), 3))))))) goto tmp9_end;
          tmpMeta7 = omc_NFEvalFunction_callExternalFunction(threadData, _name, _fn, _args, _ext_args, _output_ref, _ann, 0 /* false */);
          goto tmp9_done;
        }
        case 3: {
          modelica_metatype tmpMeta12;
          
          /* Pattern matching succeeded */
          if(omc_NFCeval_EvalTarget_hasInfo(threadData, _target))
          {
            tmpMeta12 = mmc_mk_cons(omc_AbsynUtil_pathString(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 2))), _OMC_LIT86, 1 /* true */, 0 /* false */), MMC_REFSTRUCTLIT(mmc_nil));
            omc_Error_addSourceMessage(threadData, _OMC_LIT85, tmpMeta12, omc_NFCeval_EvalTarget_getInfo(threadData, _target));
          }
          goto goto_8;
          goto tmp9_done;
        }
        }
        goto tmp9_end;
        tmp9_end: ;
      }
      goto goto_8;
      tmp9_done:
      (void)tmp10;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp9_done2;
      goto_8:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp10 < 4) {
        goto tmp9_top;
      }
      MMC_THROW_INTERNAL();
      tmp9_done2:;
    }
  }
  _result = tmpMeta7;
  _return: OMC_LABEL_UNUSED
  return _result;
}

DLLDirection
modelica_metatype omc_NFEvalFunction_evaluateNormal(threadData_t *threadData, modelica_metatype _fn, modelica_metatype _args, modelica_integer _context)
{
  modelica_metatype _result = NULL;
  modelica_metatype _fn_body = NULL;
  modelica_metatype _bindings = NULL;
  modelica_metatype _arg_map = NULL;
  modelica_integer _call_count;
  modelica_integer _limit;
  modelica_metatype _call_counter = NULL;
  modelica_integer _ctrl;
  modelica_integer _body_context;
  modelica_metatype tmpMeta1;
  modelica_string tmp2;
  modelica_metatype tmpMeta7;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  // _fn_body has no default value.
  // _bindings has no default value.
  // _arg_map has no default value.
  // _call_count has no default value.
  // _limit has no default value.
  _call_counter = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 14)));
  // _ctrl has no default value.
  // _body_context has no default value.
  _call_count = ((modelica_integer) 1) + mmc_unbox_integer(omc_Pointer_access(threadData, _call_counter));

  _limit = omc_Flags_getConfigInt(threadData, _OMC_LIT93);

  if((_call_count > _limit))
  {
    omc_Pointer_update(threadData, _call_counter, mmc_mk_integer(((modelica_integer) 0)));

    tmp2 = modelica_integer_to_modelica_string(_limit, ((modelica_integer) 0), 1 /* true */);
    tmpMeta1 = mmc_mk_cons(tmp2, mmc_mk_cons(omc_AbsynUtil_pathString(threadData, omc_NFFunction_Function_name(threadData, _fn), _OMC_LIT86, 1 /* true */, 0 /* false */), MMC_REFSTRUCTLIT(mmc_nil)));
    omc_Error_addSourceMessage(threadData, _OMC_LIT96, tmpMeta1, omc_NFInstNode_InstNode_info(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 3)))));

    MMC_THROW_INTERNAL();
  }

  omc_Pointer_update(threadData, _call_counter, mmc_mk_integer(_call_count));

  _body_context = omc_NFInstContext_clearScopeFlags(threadData, _context);

  { /* matchcontinue expression */
    {
      volatile mmc_switch_type tmp5;
      int tmp6;
      tmp5 = 0;
      MMC_TRY_INTERNAL(mmc_jumper)
      tmp4_top:
      threadData->mmc_jumper = &new_mmc_jumper;
      for (; tmp5 < 2; tmp5++) {
        switch (MMC_SWITCH_CAST(tmp5)) {
        case 0: {
          /* Pattern matching succeeded */
          _fn_body = omc_NFFunction_Function_getBody(threadData, _fn);

          _arg_map = omc_NFEvalFunction_createArgumentMap(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 4))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 5))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 6))), _args, 1 /* true */, 1 /* true */);

          _fn_body = omc_NFEvalFunction_applyReplacements(threadData, _arg_map, _fn_body);

          _fn_body = omc_NFEvalFunction_optimizeBody(threadData, _fn_body);

          _ctrl = omc_NFEvalFunction_evaluateStatements(threadData, _fn_body, _body_context);

          if(((modelica_integer)_ctrl != 5))
          {
            _result = omc_NFEvalFunction_createResult(threadData, _arg_map, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 5))));
          }
          else
          {
            goto goto_3;
          }
          goto tmp4_done;
        }
        case 1: {
          /* Pattern matching succeeded */
          omc_Pointer_update(threadData, _call_counter, mmc_mk_integer(((modelica_integer) -1) + _call_count));

          goto goto_3;
          goto tmp4_done;
        }
        }
        goto tmp4_end;
        tmp4_end: ;
      }
      goto goto_3;
      tmp4_done:
      (void)tmp5;
      MMC_RESTORE_INTERNAL(mmc_jumper);
      goto tmp4_done2;
      goto_3:;
      MMC_CATCH_INTERNAL(mmc_jumper);
      if (++tmp5 < 2) {
        goto tmp4_top;
      }
      MMC_THROW_INTERNAL();
      tmp4_done2:;
    }
  }
  ;

  if(omc_Flags_isSet(threadData, _OMC_LIT102))
  {
    tmpMeta7 = stringAppend(omc_AbsynUtil_pathString(threadData, omc_NFFunction_Function_name(threadData, _fn), _OMC_LIT86, 1 /* true */, 0 /* false */),_OMC_LIT97);
    fputs(MMC_STRINGDATA(tmpMeta7),stdout);

    fputs(MMC_STRINGDATA(omc_NFExpression_toString(threadData, _result)),stdout);

    fputs(MMC_STRINGDATA(_OMC_LIT98),stdout);

    fputs(MMC_STRINGDATA(omc_UnorderedMap_toString(threadData, _arg_map, boxvar_NFInstNode_InstNode_name, boxvar_NFExpression_toString, _OMC_LIT32, _OMC_LIT65)),stdout);

    fputs(MMC_STRINGDATA(_OMC_LIT32),stdout);
  }

  omc_Pointer_update(threadData, _call_counter, mmc_mk_integer(((modelica_integer) -1) + _call_count));
  _return: OMC_LABEL_UNUSED
  return _result;
}
modelica_metatype boxptr_NFEvalFunction_evaluateNormal(threadData_t *threadData, modelica_metatype _fn, modelica_metatype _args, modelica_metatype _context)
{
  modelica_integer tmp1;
  modelica_metatype _result = NULL;
  tmp1 = mmc_unbox_integer(_context);
  _result = omc_NFEvalFunction_evaluateNormal(threadData, _fn, _args, tmp1);
  /* skip box _result; NFExpression */
  return _result;
}

DLLDirection
modelica_metatype omc_NFEvalFunction_evaluate(threadData_t *threadData, modelica_metatype _fn, modelica_metatype _args, modelica_metatype _target)
{
  modelica_metatype _result = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _result has no default value.
  if(omc_NFFunction_Function_isExternal(threadData, _fn))
  {
    _result = omc_NFEvalFunction_evaluateExternal(threadData, _fn, _args, _target);
  }
  else
  {
    if(omc_NFFunction_Function_isPartialDerivative(threadData, _fn))
    {
      MMC_THROW_INTERNAL();
    }
    else
    {
      _result = omc_NFEvalFunction_evaluateNormal(threadData, _fn, _args, mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_target), 3)))));
    }
  }
  _return: OMC_LABEL_UNUSED
  return _result;
}

