#include "omc_simulation_settings.h"
#include "NBFunctionAlias.h"
#define _OMC_LIT0_data "AUX"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT0,3,_OMC_LIT0_data);
#define _OMC_LIT0 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT0)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT1,1,5) {&NBEquation_Iterator_EMPTY__desc,}};
#define _OMC_LIT1 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT1)
#define _OMC_LIT2_data "integer"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT2,7,_OMC_LIT2_data);
#define _OMC_LIT2 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT2)
#define _OMC_LIT3_data "String"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT3,6,_OMC_LIT3_data);
#define _OMC_LIT3 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT3)
#define _OMC_LIT4_data "$OMC$PositiveMax"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT4,16,_OMC_LIT4_data);
#define _OMC_LIT4 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT4)
#define _OMC_LIT5_data "$OMC$inStreamDiv"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT5,16,_OMC_LIT5_data);
#define _OMC_LIT5 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT5)
#define _OMC_LIT6_data "cat"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT6,3,_OMC_LIT6_data);
#define _OMC_LIT6 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT6)
#define _OMC_LIT7_data "promote"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT7,7,_OMC_LIT7_data);
#define _OMC_LIT7 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT7)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT8,1,5) {&NFComponentRef_WILD__desc,}};
#define _OMC_LIT8 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT8)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT9,1,5) {&ErrorTypes_MessageType_TRANSLATION__desc,}};
#define _OMC_LIT9 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT9)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT10,1,4) {&ErrorTypes_Severity_ERROR__desc,}};
#define _OMC_LIT10 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT10)
#define _OMC_LIT11_data "Internal error %s"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT11,17,_OMC_LIT11_data);
#define _OMC_LIT11 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT11)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT12,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT11}};
#define _OMC_LIT12 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT12)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT13,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(63)),_OMC_LIT9,_OMC_LIT10,_OMC_LIT12}};
#define _OMC_LIT13 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT13)
#define _OMC_LIT14_data "NBFunctionAlias.introduceFunctionAlias failed to get subscripted tuple element: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT14,80,_OMC_LIT14_data);
#define _OMC_LIT14 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT14)
#define _OMC_LIT15_data "dumpCSE"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT15,7,_OMC_LIT15_data);
#define _OMC_LIT15 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT15)
#define _OMC_LIT16_data "Additional output for CSE module."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT16,33,_OMC_LIT16_data);
#define _OMC_LIT16 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT16)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT17,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT16}};
#define _OMC_LIT17 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT17)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT18,5,3) {&Flags_DebugFlag_DEBUG__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(118)),_OMC_LIT15,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),_OMC_LIT17}};
#define _OMC_LIT18 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT18)
#define _OMC_LIT19_data "Simulation Function Alias"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT19,25,_OMC_LIT19_data);
#define _OMC_LIT19 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT19)
#define _OMC_LIT20_data ""
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT20,0,_OMC_LIT20_data);
#define _OMC_LIT20 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT20)
#define _OMC_LIT21_data "  "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT21,2,_OMC_LIT21_data);
#define _OMC_LIT21 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT21)
#define _OMC_LIT22_data "\n  "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT22,3,_OMC_LIT22_data);
#define _OMC_LIT22 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT22)
#define _OMC_LIT23_data "\n\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT23,2,_OMC_LIT23_data);
#define _OMC_LIT23 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT23)
#define _OMC_LIT24_data "Initial Function Alias"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT24,22,_OMC_LIT24_data);
#define _OMC_LIT24 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT24)
#define _OMC_LIT25_data "Clocked Function Alias"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT25,22,_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 "."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT27,1,_OMC_LIT27_data);
#define _OMC_LIT27 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT27)
#define _OMC_LIT28_data "$FUN"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT28,4,_OMC_LIT28_data);
#define _OMC_LIT28 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT28)
#define _OMC_LIT29_data "/home/per/workspace/OpenModelica/OMCompiler/Compiler/NBackEnd/Modules/2_Pre/NBFunctionAlias.mo"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT29,94,_OMC_LIT29_data);
#define _OMC_LIT29 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT29)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT30_6,1.772102377e9);
#define _OMC_LIT30_6 MMC_REFREALLIT(_OMC_LIT_STRUCT30_6)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT30,8,3) {&SourceInfo_SOURCEINFO__desc,_OMC_LIT29,MMC_IMMEDIATE(MMC_TAGFIXNUM(0 /* false */)),MMC_IMMEDIATE(MMC_TAGFIXNUM(183)),MMC_IMMEDIATE(MMC_TAGFIXNUM(37)),MMC_IMMEDIATE(MMC_TAGFIXNUM(184)),MMC_IMMEDIATE(MMC_TAGFIXNUM(11)),_OMC_LIT30_6}};
#define _OMC_LIT30 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT30)
#define _OMC_LIT31_data "NBFunctionAlias.Call_Aux.getVars.getVarsExp failed because function alias auxilliary has a return type that currently cannot be parsed: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT31,136,_OMC_LIT31_data);
#define _OMC_LIT31 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT31)
#define _OMC_LIT32_data " ["
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT32,2,_OMC_LIT32_data);
#define _OMC_LIT32 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT32)
#define _OMC_LIT33_data "]"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT33,1,_OMC_LIT33_data);
#define _OMC_LIT33 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT33)
#define _OMC_LIT34_data "default"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT34,7,_OMC_LIT34_data);
#define _OMC_LIT34 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT34)
#define _OMC_LIT35_data "NBFunctionAlias.main failed."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT35,28,_OMC_LIT35_data);
#define _OMC_LIT35 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT35)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT36,2,1) {_OMC_LIT35,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT36 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT36)
#include "util/modelica.h"

#include "NBFunctionAlias_includes.h"


/* default, do not make protected functions static */
#if !defined(PROTECTED_FUNCTION_STATIC)
#define PROTECTED_FUNCTION_STATIC
#endif
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_addClockedAlias(threadData_t *threadData, modelica_metatype _equations, modelica_metatype _eqn_idx, modelica_metatype *out_clock_vars, modelica_metatype *out_collector);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_addClockedAlias,2,0) {(void*) boxptr_NBFunctionAlias_addClockedAlias,0}};
#define boxvar_NBFunctionAlias_addClockedAlias MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_addClockedAlias)
PROTECTED_FUNCTION_STATIC modelica_boolean omc_NBFunctionAlias_addAuxVar(threadData_t *threadData, modelica_metatype _new_var, modelica_boolean __omcQ_24in_5Fdisc, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Fdisc, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Fcont, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Finit, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Frecd, modelica_boolean _init, modelica_metatype *out_new_vars_disc, modelica_metatype *out_new_vars_cont, modelica_metatype *out_new_vars_init, modelica_metatype *out_new_vars_recd);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_addAuxVar(threadData_t *threadData, modelica_metatype _new_var, modelica_metatype __omcQ_24in_5Fdisc, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Fdisc, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Fcont, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Finit, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Frecd, modelica_metatype _init, modelica_metatype *out_new_vars_disc, modelica_metatype *out_new_vars_cont, modelica_metatype *out_new_vars_init, modelica_metatype *out_new_vars_recd);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_addAuxVar,2,0) {(void*) boxptr_NBFunctionAlias_addAuxVar,0}};
#define boxvar_NBFunctionAlias_addAuxVar MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_addAuxVar)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_filterFrames_collectFrames(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _frame_map, modelica_metatype _new_map);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_filterFrames_collectFrames,2,0) {(void*) boxptr_NBFunctionAlias_filterFrames_collectFrames,0}};
#define boxvar_NBFunctionAlias_filterFrames_collectFrames MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_filterFrames_collectFrames)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_filterFrames(threadData_t *threadData, modelica_metatype _exp, modelica_metatype _names, modelica_metatype _ranges, modelica_metatype _maps);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_filterFrames,2,0) {(void*) boxptr_NBFunctionAlias_filterFrames,0}};
#define boxvar_NBFunctionAlias_filterFrames MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_filterFrames)
PROTECTED_FUNCTION_STATIC modelica_boolean omc_NBFunctionAlias_replaceException(threadData_t *threadData, modelica_metatype _fn);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_replaceException(threadData_t *threadData, modelica_metatype _fn);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_replaceException,2,0) {(void*) boxptr_NBFunctionAlias_replaceException,0}};
#define boxvar_NBFunctionAlias_replaceException MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_replaceException)
PROTECTED_FUNCTION_STATIC modelica_boolean omc_NBFunctionAlias_forceReplacement(threadData_t *threadData, modelica_metatype _fn);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_forceReplacement(threadData_t *threadData, modelica_metatype _fn);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_forceReplacement,2,0) {(void*) boxptr_NBFunctionAlias_forceReplacement,0}};
#define boxvar_NBFunctionAlias_forceReplacement MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_forceReplacement)
PROTECTED_FUNCTION_STATIC modelica_boolean omc_NBFunctionAlias_checkCallReplacement(threadData_t *threadData, modelica_metatype _call);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_checkCallReplacement(threadData_t *threadData, modelica_metatype _call);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_checkCallReplacement,2,0) {(void*) boxptr_NBFunctionAlias_checkCallReplacement,0}};
#define boxvar_NBFunctionAlias_checkCallReplacement MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_checkCallReplacement)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_introduceAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_boolean _init);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_introduceAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_metatype _init);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_introduceAlias,2,0) {(void*) boxptr_NBFunctionAlias_introduceAlias,0}};
#define boxvar_NBFunctionAlias_introduceAlias MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_introduceAlias)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_introduceArrayConstructorAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_boolean _init);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_introduceArrayConstructorAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_metatype _init);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_introduceArrayConstructorAlias,2,0) {(void*) boxptr_NBFunctionAlias_introduceArrayConstructorAlias,0}};
#define boxvar_NBFunctionAlias_introduceArrayConstructorAlias MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_introduceArrayConstructorAlias)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_introduceFunctionAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_boolean _init);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_introduceFunctionAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_metatype _init);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_introduceFunctionAlias,2,0) {(void*) boxptr_NBFunctionAlias_introduceFunctionAlias,0}};
#define boxvar_NBFunctionAlias_introduceFunctionAlias MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_introduceFunctionAlias)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_introduceFunctionAliasEquation(threadData_t *threadData, modelica_metatype __omcQ_24in_5Feqn, modelica_metatype _map, modelica_metatype _variables, modelica_metatype _set, modelica_metatype _aux_index, modelica_metatype _eqn_index, modelica_boolean _init);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_introduceFunctionAliasEquation(threadData_t *threadData, modelica_metatype __omcQ_24in_5Feqn, modelica_metatype _map, modelica_metatype _variables, modelica_metatype _set, modelica_metatype _aux_index, modelica_metatype _eqn_index, modelica_metatype _init);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_introduceFunctionAliasEquation,2,0) {(void*) boxptr_NBFunctionAlias_introduceFunctionAliasEquation,0}};
#define boxvar_NBFunctionAlias_introduceFunctionAliasEquation MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_introduceFunctionAliasEquation)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_functionAliasDefault(threadData_t *threadData, modelica_metatype __omcQ_24in_5FvarData, modelica_metatype __omcQ_24in_5FeqData, modelica_integer _kind, modelica_metatype *out_eqData);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_functionAliasDefault(threadData_t *threadData, modelica_metatype __omcQ_24in_5FvarData, modelica_metatype __omcQ_24in_5FeqData, modelica_metatype _kind, modelica_metatype *out_eqData);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_functionAliasDefault,2,0) {(void*) boxptr_NBFunctionAlias_functionAliasDefault,0}};
#define boxvar_NBFunctionAlias_functionAliasDefault MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_functionAliasDefault)
PROTECTED_FUNCTION_STATIC modelica_string omc_NBFunctionAlias_functionAliasTplString(threadData_t *threadData, modelica_metatype _tpl, modelica_integer _max_length);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_functionAliasTplString(threadData_t *threadData, modelica_metatype _tpl, modelica_metatype _max_length);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_functionAliasTplString,2,0) {(void*) boxptr_NBFunctionAlias_functionAliasTplString,0}};
#define boxvar_NBFunctionAlias_functionAliasTplString MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_functionAliasTplString)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_Call__Aux_getVars_getVarsExp(threadData_t *threadData, modelica_metatype _exp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_NBFunctionAlias_Call__Aux_getVars_getVarsExp,2,0) {(void*) boxptr_NBFunctionAlias_Call__Aux_getVars_getVarsExp,0}};
#define boxvar_NBFunctionAlias_Call__Aux_getVars_getVarsExp MMC_REFSTRUCTLIT(boxvar_lit_NBFunctionAlias_Call__Aux_getVars_getVarsExp)

static modelica_metatype closure0_NBPartitioning_extractClocks(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype collector = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  modelica_metatype new_clocks = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),2));
  modelica_metatype idx = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),3));
  return boxptr_NBPartitioning_extractClocks(thData, $in_exp, collector, new_clocks, idx);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_addClockedAlias(threadData_t *threadData, modelica_metatype _equations, modelica_metatype _eqn_idx, modelica_metatype *out_clock_vars, modelica_metatype *out_collector)
{
  modelica_metatype _clock_eqns = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _clock_vars = NULL;
  modelica_metatype _collector = NULL;
  modelica_metatype _new_clocks = NULL;
  modelica_metatype tmpMeta2;
  modelica_metatype _idx = NULL;
  modelica_metatype _clock = NULL;
  modelica_metatype _clock_name = NULL;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  modelica_metatype tmpMeta5;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  modelica_metatype tmpMeta8;
  modelica_metatype tmpMeta9;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _clock_eqns = tmpMeta1;
  // _clock_vars has no default value.
  _collector = omc_UnorderedMap_new(threadData, boxvar_NBPartitioning_BClock_hash, boxvar_NBPartitioning_BClock_isEqual, ((modelica_integer) 1));
  tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
  _new_clocks = omc_Pointer_create(threadData, tmpMeta2);
  _idx = omc_Pointer_create(threadData, mmc_mk_integer(((modelica_integer) 0)));
  // _clock has no default value.
  // _clock_name has no default value.
  tmpMeta3 = mmc_mk_box3(0, _collector, _new_clocks, _idx);
  omc_NBEquation_EquationPointers_mapExp(threadData, _equations, (modelica_fnptr) mmc_mk_box2(0,closure0_NBPartitioning_extractClocks,tmpMeta3), mmc_mk_none(), boxvar_NFExpression_map);

  _clock_vars = omc_Pointer_access(threadData, _new_clocks);

  {
    modelica_metatype _tpl;
    for (tmpMeta4 = omc_UnorderedMap_toList(threadData, _collector); !listEmpty(tmpMeta4); tmpMeta4=MMC_CDR(tmpMeta4))
    {
      _tpl = MMC_CAR(tmpMeta4);
      /* Pattern-matching assignment */
      tmpMeta5 = _tpl;
      tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta5), 1));
      tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta5), 2));
      _clock = tmpMeta6;
      _clock_name = tmpMeta7;

      tmpMeta8 = mmc_mk_cons(omc_NBEquation_Equation_makeAssignment(threadData, omc_NFExpression_fromCref(threadData, _clock_name, 0 /* false */), omc_NBPartitioning_BClock_toExp(threadData, _clock), _eqn_idx, _OMC_LIT0, _OMC_LIT1, omc_NBEquation_default(threadData, 3, 0 /* false */, mmc_mk_none(), mmc_mk_none())), _clock_eqns);
      _clock_eqns = tmpMeta8;
    }
  }
  _return: OMC_LABEL_UNUSED
  if (out_clock_vars) { *out_clock_vars = _clock_vars; }
  if (out_collector) { *out_collector = _collector; }
  return _clock_eqns;
}

PROTECTED_FUNCTION_STATIC modelica_boolean omc_NBFunctionAlias_addAuxVar(threadData_t *threadData, modelica_metatype _new_var, modelica_boolean __omcQ_24in_5Fdisc, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Fdisc, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Fcont, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Finit, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Frecd, modelica_boolean _init, modelica_metatype *out_new_vars_disc, modelica_metatype *out_new_vars_cont, modelica_metatype *out_new_vars_init, modelica_metatype *out_new_vars_recd)
{
  modelica_boolean _disc;
  modelica_metatype _new_vars_disc = NULL;
  modelica_metatype _new_vars_cont = NULL;
  modelica_metatype _new_vars_init = NULL;
  modelica_metatype _new_vars_recd = NULL;
  modelica_metatype _children = NULL;
  modelica_metatype _var_ptr = 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;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _disc = __omcQ_24in_5Fdisc;
  _new_vars_disc = __omcQ_24in_5Fnew_5Fvars_5Fdisc;
  _new_vars_cont = __omcQ_24in_5Fnew_5Fvars_5Fcont;
  _new_vars_init = __omcQ_24in_5Fnew_5Fvars_5Finit;
  _new_vars_recd = __omcQ_24in_5Fnew_5Fvars_5Frecd;
  // _children has no default value.
  // _var_ptr has no default value.
  if(omc_NBVariable_isRecord(threadData, _new_var))
  {
    tmpMeta1 = mmc_mk_cons(_new_var, _new_vars_recd);
    _new_vars_recd = tmpMeta1;

    /* Pattern-matching assignment */
    tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
    tmpMeta3 = omc_NFVariable_expandChildren(threadData, omc_Pointer_access(threadData, _new_var), tmpMeta2, 0 /* false */);
    if (listEmpty(tmpMeta3)) MMC_THROW_INTERNAL();
    tmpMeta4 = MMC_CAR(tmpMeta3);
    tmpMeta5 = MMC_CDR(tmpMeta3);
    _children = tmpMeta5;

    {
      modelica_metatype _child;
      for (tmpMeta6 = _children; !listEmpty(tmpMeta6); tmpMeta6=MMC_CDR(tmpMeta6))
      {
        _child = MMC_CAR(tmpMeta6);
        _disc = omc_NBFunctionAlias_addAuxVar(threadData, omc_NBVariable_makeVarPtrCyclic(threadData, _child, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_child), 2))), NULL), _disc, _new_vars_disc, _new_vars_cont, _new_vars_init, _new_vars_recd, _init ,&_new_vars_disc ,&_new_vars_cont ,&_new_vars_init ,&_new_vars_recd);
      }
    }
  }
  else
  {
    if(_init)
    {
      tmpMeta8 = mmc_mk_cons(omc_NBVariable_setFixed(threadData, _new_var, 0 /* false */, 0 /* false */), _new_vars_init);
      _new_vars_init = tmpMeta8;
    }
    else
    {
      if(omc_NBVariable_isContinuous(threadData, _new_var, 0 /* false */))
      {
        _disc = 0 /* false */;

        tmpMeta9 = mmc_mk_cons(_new_var, _new_vars_cont);
        _new_vars_cont = tmpMeta9;
      }
      else
      {
        tmpMeta10 = mmc_mk_cons(_new_var, _new_vars_disc);
        _new_vars_disc = tmpMeta10;
      }
    }
  }
  _return: OMC_LABEL_UNUSED
  if (out_new_vars_disc) { *out_new_vars_disc = _new_vars_disc; }
  if (out_new_vars_cont) { *out_new_vars_cont = _new_vars_cont; }
  if (out_new_vars_init) { *out_new_vars_init = _new_vars_init; }
  if (out_new_vars_recd) { *out_new_vars_recd = _new_vars_recd; }
  return _disc;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_addAuxVar(threadData_t *threadData, modelica_metatype _new_var, modelica_metatype __omcQ_24in_5Fdisc, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Fdisc, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Fcont, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Finit, modelica_metatype __omcQ_24in_5Fnew_5Fvars_5Frecd, modelica_metatype _init, modelica_metatype *out_new_vars_disc, modelica_metatype *out_new_vars_cont, modelica_metatype *out_new_vars_init, modelica_metatype *out_new_vars_recd)
{
  modelica_integer tmp1;
  modelica_integer tmp2;
  modelica_boolean _disc;
  modelica_metatype out_disc;
  tmp1 = mmc_unbox_integer(__omcQ_24in_5Fdisc);
  tmp2 = mmc_unbox_integer(_init);
  _disc = omc_NBFunctionAlias_addAuxVar(threadData, _new_var, tmp1, __omcQ_24in_5Fnew_5Fvars_5Fdisc, __omcQ_24in_5Fnew_5Fvars_5Fcont, __omcQ_24in_5Fnew_5Fvars_5Finit, __omcQ_24in_5Fnew_5Fvars_5Frecd, tmp2, out_new_vars_disc, out_new_vars_cont, out_new_vars_init, out_new_vars_recd);
  out_disc = mmc_mk_icon(_disc);
  /* skip box _new_vars_disc; list<Pointer<NFVariable>> */
  /* skip box _new_vars_cont; list<Pointer<NFVariable>> */
  /* skip box _new_vars_init; list<Pointer<NFVariable>> */
  /* skip box _new_vars_recd; list<Pointer<NFVariable>> */
  return out_disc;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_filterFrames_collectFrames(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _frame_map, modelica_metatype _new_map)
{
  modelica_metatype _exp = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _exp = __omcQ_24in_5Fexp;
  { /* match expression */
    modelica_metatype tmp3_1;
    tmp3_1 = _exp;
    {
      modelica_metatype _range = NULL;
      volatile mmc_switch_type tmp3;
      int tmp4;
      // _range has no default value.
      tmp3 = 0;
      for (; tmp3 < 2; tmp3++) {
        switch (MMC_SWITCH_CAST(tmp3)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,6,2) == 0) goto tmp2_end;
          
          /* Pattern matching succeeded */
          _range = omc_UnorderedMap_get(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 3))), _frame_map);

          if(isSome(_range))
          {
            omc_UnorderedMap_add(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 3))), omc_Util_getOption(threadData, _range), _new_map);
          }
          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;
}

static modelica_metatype closure1_NBFunctionAlias_filterFrames_collectFrames(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype frame_map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  modelica_metatype new_map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),2));
  return boxptr_NBFunctionAlias_filterFrames_collectFrames(thData, $in_exp, frame_map, new_map);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_filterFrames(threadData_t *threadData, modelica_metatype _exp, modelica_metatype _names, modelica_metatype _ranges, modelica_metatype _maps)
{
  modelica_metatype _frames = NULL;
  modelica_metatype _frame_map = NULL;
  modelica_metatype _new_map = NULL;
  modelica_metatype _names_acc = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _ranges_acc = NULL;
  modelica_metatype tmpMeta2;
  modelica_metatype _n = NULL;
  modelica_metatype _r = NULL;
  modelica_metatype _m = NULL;
  modelica_metatype tmpMeta3;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _frames has no default value.
  _frame_map = omc_UnorderedMap_fromLists(threadData, _names, _ranges, boxvar_NFComponentRef_hash, boxvar_NFComponentRef_isEqual);
  _new_map = omc_UnorderedMap_new(threadData, boxvar_NFComponentRef_hash, boxvar_NFComponentRef_isEqual, ((modelica_integer) 1));
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _names_acc = omc_Pointer_create(threadData, tmpMeta1);
  tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
  _ranges_acc = omc_Pointer_create(threadData, tmpMeta2);
  // _n has no default value.
  // _r has no default value.
  // _m has no default value.
  tmpMeta3 = mmc_mk_box2(0, _frame_map, _new_map);
  omc_NFExpression_map(threadData, _exp, (modelica_fnptr) mmc_mk_box2(0,closure1_NBFunctionAlias_filterFrames_collectFrames,tmpMeta3));

  _n = omc_UnorderedMap_keyList(threadData, _new_map);

  _r = omc_UnorderedMap_valueList(threadData, _new_map);

  _m = omc_List_fill(threadData, mmc_mk_none(), listLength(_n));

  _frames = omc_List_zip3(threadData, _n, _r, _m);
  _return: OMC_LABEL_UNUSED
  return _frames;
}

PROTECTED_FUNCTION_STATIC modelica_boolean omc_NBFunctionAlias_replaceException(threadData_t *threadData, modelica_metatype _fn)
{
  modelica_boolean _b;
  modelica_metatype _path = NULL;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _b has no default value.
  // _path has no default value.
  if((((omc_NFFunction_Function_isDefaultRecordConstructor(threadData, _fn) || omc_NFFunction_Function_isNonDefaultRecordConstructor(threadData, _fn)) || omc_NFFunction_Function_isImpure(threadData, _fn)) || listEmpty((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_fn), 5))))))
  {
    _b = 1 /* true */;

    goto _return;
  }

  if((!omc_NFFunction_Function_isBuiltin(threadData, _fn)))
  {
    _b = 0 /* false */;
  }
  else
  {
    _path = omc_NFFunction_Function_nameConsiderBuiltin(threadData, _fn);

    if((!omc_AbsynUtil_pathIsIdent(threadData, _path)))
    {
      _b = 0 /* false */;
    }
    else
    {
      { /* match expression */
        modelica_string tmp4_1;
        tmp4_1 = omc_AbsynUtil_pathFirstIdent(threadData, _path);
        {
          volatile mmc_switch_type tmp4;
          int tmp5;
          tmp4 = 0;
          for (; tmp4 < 5; tmp4++) {
            switch (MMC_SWITCH_CAST(tmp4)) {
            case 0: {
              if (7 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT2), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
              /* Pattern matching succeeded */
              tmp1 = 1 /* true */;
              goto tmp3_done;
            }
            case 1: {
              if (6 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT3), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
              /* Pattern matching succeeded */
              tmp1 = 1 /* true */;
              goto tmp3_done;
            }
            case 2: {
              if (16 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT4), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
              /* Pattern matching succeeded */
              tmp1 = 1 /* true */;
              goto tmp3_done;
            }
            case 3: {
              if (16 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT5), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
              /* Pattern matching succeeded */
              tmp1 = 1 /* true */;
              goto tmp3_done;
            }
            case 4: {
              
              /* Pattern matching succeeded */
              tmp1 = 0 /* false */;
              goto tmp3_done;
            }
            }
            goto tmp3_end;
            tmp3_end: ;
          }
          goto goto_2;
          goto_2:;
          MMC_THROW_INTERNAL();
          goto tmp3_done;
          tmp3_done:;
        }
      }
      _b = tmp1;
    }
  }
  _return: OMC_LABEL_UNUSED
  return _b;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_replaceException(threadData_t *threadData, modelica_metatype _fn)
{
  modelica_boolean _b;
  modelica_metatype out_b;
  _b = omc_NBFunctionAlias_replaceException(threadData, _fn);
  out_b = mmc_mk_icon(_b);
  return out_b;
}

PROTECTED_FUNCTION_STATIC modelica_boolean omc_NBFunctionAlias_forceReplacement(threadData_t *threadData, modelica_metatype _fn)
{
  modelica_boolean _b;
  modelica_boolean tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _b has no default value.
  { /* match expression */
    modelica_string tmp4_1;
    tmp4_1 = omc_AbsynUtil_pathFirstIdent(threadData, omc_NFFunction_Function_nameConsiderBuiltin(threadData, _fn));
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 2; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (3 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT6), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = 1 /* true */;
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmp1 = 0 /* false */;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _b = tmp1;
  _return: OMC_LABEL_UNUSED
  return _b;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_forceReplacement(threadData_t *threadData, modelica_metatype _fn)
{
  modelica_boolean _b;
  modelica_metatype out_b;
  _b = omc_NBFunctionAlias_forceReplacement(threadData, _fn);
  out_b = mmc_mk_icon(_b);
  return out_b;
}

PROTECTED_FUNCTION_STATIC modelica_boolean omc_NBFunctionAlias_checkCallReplacement(threadData_t *threadData, modelica_metatype _call)
{
  modelica_boolean _b;
  modelica_metatype _fn = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _b has no default value.
  _fn = omc_NFCall_typedFunction(threadData, _call);
  _b = (omc_NBFunctionAlias_forceReplacement(threadData, _fn) || (!((omc_NBInline_functionInlineable(threadData, _fn) || omc_NFFunction_Function_isSpecialBuiltin(threadData, _fn)) || omc_NBFunctionAlias_replaceException(threadData, _fn))));
  _return: OMC_LABEL_UNUSED
  return _b;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_checkCallReplacement(threadData_t *threadData, modelica_metatype _call)
{
  modelica_boolean _b;
  modelica_metatype out_b;
  _b = omc_NBFunctionAlias_checkCallReplacement(threadData, _call);
  out_b = mmc_mk_icon(_b);
  return out_b;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_introduceAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_boolean _init)
{
  modelica_metatype _exp = NULL;
  modelica_metatype _names = NULL;
  modelica_metatype _ranges = NULL;
  modelica_metatype _maps = NULL;
  modelica_metatype _new_iter = NULL;
  modelica_metatype _id = NULL;
  modelica_metatype _name = NULL;
  modelica_metatype _ty = NULL;
  modelica_metatype _aux = NULL;
  modelica_metatype _aux_opt = NULL;
  modelica_metatype _tpl_lst = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta30;
  modelica_metatype tmpMeta45;
  modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _exp = __omcQ_24in_5Fexp;
  // _names has no default value.
  // _ranges has no default value.
  // _maps has no default value.
  // _new_iter has no default value.
  // _id has no default value.
  // _name has no default value.
  // _ty has no default value.
  // _aux has no default value.
  // _aux_opt has no default value.
  // _tpl_lst has no default value.
  if((!omc_NBEquation_Iterator_isEmpty(threadData, _iter)))
  {
    _names = omc_NBEquation_Iterator_getFrames(threadData, _iter ,&_ranges ,&_maps);

    _new_iter = omc_NBEquation_Iterator_fromFrames(threadData, omc_NBFunctionAlias_filterFrames(threadData, _exp, _names, _ranges, _maps));
  }
  else
  {
    _new_iter = _iter;
  }

  tmpMeta1 = mmc_mk_box3(3, &NBFunctionAlias_Call__Id_CALL__ID__desc, _exp, _new_iter);
  _id = tmpMeta1;

  _aux_opt = omc_UnorderedMap_get(threadData, _id, _map);

  if(isSome(_aux_opt))
  {
    _aux = omc_Util_getOption(threadData, _aux_opt);

    _exp = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_aux), 2)));
  }
  else
  {
    
    
    { /* match expression */
      modelica_metatype tmp5_1;
      tmp5_1 = _exp;
      {
        modelica_metatype _call = NULL;
        modelica_metatype _arg1 = NULL;
        modelica_metatype _arg2 = NULL;
        volatile mmc_switch_type tmp5;
        int tmp6;
        // _call has no default value.
        // _arg1 has no default value.
        // _arg2 has no default value.
        tmp5 = 0;
        for (; tmp5 < 2; tmp5++) {
          switch (MMC_SWITCH_CAST(tmp5)) {
          case 0: {
            modelica_metatype tmpMeta7;
            if (mmc__uniontype__metarecord__typedef__equal(tmp5_1,13,1) == 0) goto tmp4_end;
            tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp5_1), 2));
            if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,2,6) == 0) goto tmp4_end;
            
            _call = tmpMeta7;
            /* Pattern matching succeeded */
            { /* match expression */
              modelica_metatype tmp10_1;modelica_metatype tmp10_2;
              tmp10_1 = omc_NFCall_functionName(threadData, _call);
              tmp10_2 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_call), 6)));
              {
                volatile mmc_switch_type tmp10;
                int tmp11;
                tmp10 = 0;
                for (; tmp10 < 3; tmp10++) {
                  switch (MMC_SWITCH_CAST(tmp10)) {
                  case 0: {
                    modelica_metatype tmpMeta12;
                    modelica_metatype tmpMeta13;
                    modelica_metatype tmpMeta14;
                    modelica_metatype tmpMeta15;
                    modelica_metatype tmpMeta19;
                    modelica_metatype tmpMeta20;
                    if (mmc__uniontype__metarecord__typedef__equal(tmp10_1,1,1) == 0) goto tmp9_end;
                    tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp10_1), 2));
                    if (3 != MMC_STRLEN(tmpMeta12) || strcmp(MMC_STRINGDATA(_OMC_LIT6), MMC_STRINGDATA(tmpMeta12)) != 0) goto tmp9_end;
                    
                    /* Pattern matching succeeded */
                    {
                      modelica_metatype __omcQ_24tmpVar15;
                      modelica_metatype* tmp16;
                      modelica_metatype tmpMeta17;
                      modelica_metatype __omcQ_24tmpVar14;
                      modelica_integer tmp18;
                      modelica_metatype _arg_loopVar = 0;
                      modelica_metatype _arg;
                      _arg_loopVar = listRest((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_call), 6))));
                      tmpMeta17 = MMC_REFSTRUCTLIT(mmc_nil);
                      __omcQ_24tmpVar15 = tmpMeta17; /* defaultValue */
                      tmp16 = &__omcQ_24tmpVar15;
                      while(1) {
                        tmp18 = 1;
                        if (!listEmpty(_arg_loopVar)) {
                          _arg = MMC_CAR(_arg_loopVar);
                          _arg_loopVar = MMC_CDR(_arg_loopVar);
                          tmp18--;
                        }
                        if (tmp18 == 0) {
                          __omcQ_24tmpVar14 = ((omc_NFExpression_isLiteral(threadData, _arg) || omc_NFExpression_isCref(threadData, _arg))?_arg:omc_NBFunctionAlias_introduceAlias(threadData, _arg, _map, _aux_index, _iter, _init));
                          *tmp16 = mmc_mk_cons(__omcQ_24tmpVar14,0);
                          tmp16 = &MMC_CDR(*tmp16);
                        } else if (tmp18 == 1) {
                          break;
                        } else {
                          goto goto_8;
                        }
                      }
                      *tmp16 = mmc_mk_nil();
                      tmpMeta15 = __omcQ_24tmpVar15;
                    }
                    tmpMeta14 = mmc_mk_cons(listHead((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_call), 6)))), tmpMeta15);
                    tmpMeta13 = MMC_TAGPTR(mmc_alloc_words(8));
                    memcpy(MMC_UNTAGPTR(tmpMeta13), MMC_UNTAGPTR(_call), 8*sizeof(modelica_metatype));
                    ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta13))[6] = tmpMeta14;
                    _call = tmpMeta13;

                    tmpMeta19 = MMC_TAGPTR(mmc_alloc_words(3));
                    memcpy(MMC_UNTAGPTR(tmpMeta19), MMC_UNTAGPTR(_exp), 3*sizeof(modelica_metatype));
                    ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta19))[2] = _call;
                    _exp = tmpMeta19;

                    tmpMeta20 = mmc_mk_box3(3, &NBFunctionAlias_Call__Id_CALL__ID__desc, _exp, _new_iter);
                    _id = tmpMeta20;

                    _aux_opt = omc_UnorderedMap_get(threadData, _id, _map);
                    goto tmp9_done;
                  }
                  case 1: {
                    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;
                    if (mmc__uniontype__metarecord__typedef__equal(tmp10_1,1,1) == 0) goto tmp9_end;
                    tmpMeta21 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp10_1), 2));
                    if (7 != MMC_STRLEN(tmpMeta21) || strcmp(MMC_STRINGDATA(_OMC_LIT7), MMC_STRINGDATA(tmpMeta21)) != 0) goto tmp9_end;
                    if (listEmpty(tmp10_2)) goto tmp9_end;
                    tmpMeta22 = MMC_CAR(tmp10_2);
                    tmpMeta23 = MMC_CDR(tmp10_2);
                    if (listEmpty(tmpMeta23)) goto tmp9_end;
                    tmpMeta24 = MMC_CAR(tmpMeta23);
                    tmpMeta25 = MMC_CDR(tmpMeta23);
                    if (!listEmpty(tmpMeta25)) goto tmp9_end;
                    _arg1 = tmpMeta22;
                    _arg2 = tmpMeta24;
                    /* Pattern matching succeeded */
                    tmpMeta27 = mmc_mk_cons(((omc_NFExpression_isLiteral(threadData, _arg1) || omc_NFExpression_isCref(threadData, _arg1))?_arg1:omc_NBFunctionAlias_introduceAlias(threadData, _arg1, _map, _aux_index, _iter, _init)), mmc_mk_cons(_arg2, MMC_REFSTRUCTLIT(mmc_nil)));
                    tmpMeta26 = MMC_TAGPTR(mmc_alloc_words(8));
                    memcpy(MMC_UNTAGPTR(tmpMeta26), MMC_UNTAGPTR(_call), 8*sizeof(modelica_metatype));
                    ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta26))[6] = tmpMeta27;
                    _call = tmpMeta26;

                    tmpMeta28 = MMC_TAGPTR(mmc_alloc_words(3));
                    memcpy(MMC_UNTAGPTR(tmpMeta28), MMC_UNTAGPTR(_exp), 3*sizeof(modelica_metatype));
                    ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta28))[2] = _call;
                    _exp = tmpMeta28;

                    tmpMeta29 = mmc_mk_box3(3, &NBFunctionAlias_Call__Id_CALL__ID__desc, _exp, _new_iter);
                    _id = tmpMeta29;

                    _aux_opt = omc_UnorderedMap_get(threadData, _id, _map);
                    goto tmp9_done;
                  }
                  case 2: {
                    
                    /* Pattern matching succeeded */
                    goto tmp9_done;
                  }
                  }
                  goto tmp9_end;
                  tmp9_end: ;
                }
                goto goto_8;
                goto_8:;
                goto goto_3;
                goto tmp9_done;
                tmp9_done:;
              }
            }
            ;
            tmpMeta[0+0] = _exp;
            tmpMeta[0+1] = _aux_opt;
            goto tmp4_done;
          }
          case 1: {
            
            /* Pattern matching succeeded */
            tmpMeta[0+0] = _exp;
            tmpMeta[0+1] = _aux_opt;
            goto tmp4_done;
          }
          }
          goto tmp4_end;
          tmp4_end: ;
        }
        goto goto_3;
        goto_3:;
        MMC_THROW_INTERNAL();
        goto tmp4_done;
        tmp4_done:;
      }
    }
    _exp = tmpMeta[0+0];
    _aux_opt = tmpMeta[0+1];

    _ty = omc_NFExpression_typeOf(threadData, _exp);

    { /* match expression */
      modelica_metatype tmp33_1;modelica_metatype tmp33_2;
      tmp33_1 = _aux_opt;
      tmp33_2 = _ty;
      {
        volatile mmc_switch_type tmp33;
        int tmp34;
        tmp33 = 0;
        for (; tmp33 < 3; tmp33++) {
          switch (MMC_SWITCH_CAST(tmp33)) {
          case 0: {
            modelica_metatype tmpMeta35;
            if (optionNone(tmp33_1)) goto tmp32_end;
            tmpMeta35 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp33_1), 1));
            
            _aux = tmpMeta35;
            /* Pattern matching succeeded */
            tmpMeta30 = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_aux), 2)));
            goto tmp32_done;
          }
          case 1: {
            modelica_metatype tmpMeta36;
            modelica_metatype tmpMeta40;
            modelica_metatype tmpMeta44;
            if (mmc__uniontype__metarecord__typedef__equal(tmp33_2,8,2) == 0) goto tmp32_end;
            
            /* Pattern matching succeeded */
            {
              modelica_metatype __omcQ_24tmpVar17;
              modelica_metatype* tmp37;
              modelica_metatype tmpMeta38;
              modelica_metatype __omcQ_24tmpVar16;
              modelica_integer tmp39;
              modelica_metatype _sub_ty_loopVar = 0;
              modelica_metatype _sub_ty;
              _sub_ty_loopVar = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_ty), 2)));
              tmpMeta38 = MMC_REFSTRUCTLIT(mmc_nil);
              __omcQ_24tmpVar17 = tmpMeta38; /* defaultValue */
              tmp37 = &__omcQ_24tmpVar17;
              while(1) {
                tmp39 = 1;
                if (!listEmpty(_sub_ty_loopVar)) {
                  _sub_ty = MMC_CAR(_sub_ty_loopVar);
                  _sub_ty_loopVar = MMC_CDR(_sub_ty_loopVar);
                  tmp39--;
                }
                if (tmp39 == 0) {
                  __omcQ_24tmpVar16 = omc_NBFunctionAlias_Call__Aux_createName(threadData, _sub_ty, _new_iter, _aux_index, _init);
                  *tmp37 = mmc_mk_cons(__omcQ_24tmpVar16,0);
                  tmp37 = &MMC_CDR(*tmp37);
                } else if (tmp39 == 1) {
                  break;
                } else {
                  goto goto_31;
                }
              }
              *tmp37 = mmc_mk_nil();
              tmpMeta36 = __omcQ_24tmpVar17;
            }
            _names = tmpMeta36;

            {
              modelica_metatype __omcQ_24tmpVar19;
              modelica_metatype* tmp41;
              modelica_metatype tmpMeta42;
              modelica_metatype __omcQ_24tmpVar18;
              modelica_integer tmp43;
              modelica_metatype _cref_loopVar = 0;
              modelica_metatype _cref;
              _cref_loopVar = _names;
              tmpMeta42 = MMC_REFSTRUCTLIT(mmc_nil);
              __omcQ_24tmpVar19 = tmpMeta42; /* defaultValue */
              tmp41 = &__omcQ_24tmpVar19;
              while(1) {
                tmp43 = 1;
                if (!listEmpty(_cref_loopVar)) {
                  _cref = MMC_CAR(_cref_loopVar);
                  _cref_loopVar = MMC_CDR(_cref_loopVar);
                  tmp43--;
                }
                if (tmp43 == 0) {
                  __omcQ_24tmpVar18 = ((omc_NFComponentRef_size(threadData, _cref, 1 /* true */, 0 /* false */) == ((modelica_integer) 0))?omc_NFExpression_fromCref(threadData, _OMC_LIT8, 0 /* false */):omc_NFExpression_fromCref(threadData, _cref, 0 /* false */));
                  *tmp41 = mmc_mk_cons(__omcQ_24tmpVar18,0);
                  tmp41 = &MMC_CDR(*tmp41);
                } else if (tmp43 == 1) {
                  break;
                } else {
                  goto goto_31;
                }
              }
              *tmp41 = mmc_mk_nil();
              tmpMeta40 = __omcQ_24tmpVar19;
            }
            _tpl_lst = tmpMeta40;
            tmpMeta44 = mmc_mk_box3(14, &NFExpression_TUPLE__desc, _ty, _tpl_lst);
            tmpMeta30 = tmpMeta44;
            goto tmp32_done;
          }
          case 2: {
            
            /* Pattern matching succeeded */
            _name = omc_NBFunctionAlias_Call__Aux_createName(threadData, _ty, _new_iter, _aux_index, _init);
            tmpMeta30 = omc_NFExpression_fromCref(threadData, _name, 0 /* false */);
            goto tmp32_done;
          }
          }
          goto tmp32_end;
          tmp32_end: ;
        }
        goto goto_31;
        goto_31:;
        MMC_THROW_INTERNAL();
        goto tmp32_done;
        tmp32_done:;
      }
    }
    _exp = tmpMeta30;

    if(isNone(_aux_opt))
    {
      tmpMeta45 = mmc_mk_box4(3, &NBFunctionAlias_Call__Aux_CALL__AUX__desc, _exp, mmc_mk_integer((omc_NFType_isDiscrete(threadData, _ty)?2:1)), mmc_mk_boolean(0 /* false */));
      _aux = tmpMeta45;

      omc_UnorderedMap_add(threadData, _id, _aux, _map);
    }
  }
  _return: OMC_LABEL_UNUSED
  return _exp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_introduceAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_metatype _init)
{
  modelica_integer tmp1;
  modelica_metatype _exp = NULL;
  tmp1 = mmc_unbox_integer(_init);
  _exp = omc_NBFunctionAlias_introduceAlias(threadData, __omcQ_24in_5Fexp, _map, _aux_index, _iter, tmp1);
  /* skip box _exp; NFExpression */
  return _exp;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_introduceArrayConstructorAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_boolean _init)
{
  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;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 3; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          modelica_metatype tmpMeta6;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,1) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,4,5) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NBFunctionAlias_introduceAlias(threadData, _exp, _map, _aux_index, _iter, _init);
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta7;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,13,1) == 0) goto tmp3_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta7,6,8) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NBFunctionAlias_introduceAlias(threadData, _exp, _map, _aux_index, _iter, _init);
          goto tmp3_done;
        }
        case 2: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _exp;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _exp = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _exp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_introduceArrayConstructorAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_metatype _init)
{
  modelica_integer tmp1;
  modelica_metatype _exp = NULL;
  tmp1 = mmc_unbox_integer(_init);
  _exp = omc_NBFunctionAlias_introduceArrayConstructorAlias(threadData, __omcQ_24in_5Fexp, _map, _aux_index, _iter, tmp1);
  /* skip box _exp; NFExpression */
  return _exp;
}

static modelica_metatype closure2_NBFunctionAlias_introduceFunctionAlias(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  modelica_metatype aux_index = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),2));
  modelica_metatype iter = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),3));
  modelica_metatype init = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),4));
  return boxptr_NBFunctionAlias_introduceFunctionAlias(thData, $in_exp, map, aux_index, iter, init);
}static modelica_metatype closure3_NBFunctionAlias_introduceArrayConstructorAlias(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  modelica_metatype aux_index = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),2));
  modelica_metatype iter = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),3));
  modelica_metatype init = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),4));
  return boxptr_NBFunctionAlias_introduceArrayConstructorAlias(thData, $in_exp, map, aux_index, iter, init);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_introduceFunctionAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_boolean _init)
{
  modelica_metatype _exp = NULL;
  modelica_metatype _deep_iter = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta6;
  modelica_metatype tmpMeta7;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _exp = __omcQ_24in_5Fexp;
  // _deep_iter has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _exp;
    {
      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,13,1) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta1 = omc_NBEquation_Iterator_expand(threadData, _iter, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 2))));
          goto tmp3_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          tmpMeta1 = _iter;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _deep_iter = tmpMeta1;

  tmpMeta6 = mmc_mk_box4(0, _map, _aux_index, _deep_iter, mmc_mk_boolean(_init));
  _exp = omc_NFExpression_mapShallow(threadData, _exp, (modelica_fnptr) mmc_mk_box2(0,closure2_NBFunctionAlias_introduceFunctionAlias,tmpMeta6));

  { /* match expression */
    modelica_metatype tmp10_1;
    tmp10_1 = _exp;
    {
      modelica_metatype _call = NULL;
      modelica_metatype _new_exp = NULL;
      modelica_metatype _sub_exp = NULL;
      volatile mmc_switch_type tmp10;
      int tmp11;
      // _call has no default value.
      // _new_exp has no default value.
      // _sub_exp has no default value.
      tmp10 = 0;
      for (; tmp10 < 4; tmp10++) {
        switch (MMC_SWITCH_CAST(tmp10)) {
        case 0: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp10_1,13,1) == 0) goto tmp9_end;
          
          /* Pattern matching succeeded */
          /* Check guard condition after assignments */
          if (!omc_NBFunctionAlias_checkCallReplacement(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 2))))) goto tmp9_end;
          tmpMeta7 = omc_NBFunctionAlias_introduceAlias(threadData, _exp, _map, _aux_index, _iter, _init);
          goto tmp9_done;
        }
        case 1: {
          modelica_metatype tmpMeta12;
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          modelica_metatype tmpMeta19;
          if (mmc__uniontype__metarecord__typedef__equal(tmp10_1,13,1) == 0) goto tmp9_end;
          tmpMeta12 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp10_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta12,2,6) == 0) goto tmp9_end;
          
          _new_exp = tmp10_1;
          _call = tmpMeta12;
          /* Pattern matching succeeded */
          {
            modelica_metatype __omcQ_24tmpVar21;
            modelica_metatype* tmp15;
            modelica_metatype tmpMeta16;
            modelica_metatype tmpMeta17;
            modelica_metatype __omcQ_24tmpVar20;
            modelica_integer tmp18;
            modelica_metatype _arg_loopVar = 0;
            modelica_metatype _arg;
            _arg_loopVar = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_call), 6)));
            tmpMeta16 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar21 = tmpMeta16; /* defaultValue */
            tmp15 = &__omcQ_24tmpVar21;
            while(1) {
              tmp18 = 1;
              if (!listEmpty(_arg_loopVar)) {
                _arg = MMC_CAR(_arg_loopVar);
                _arg_loopVar = MMC_CDR(_arg_loopVar);
                tmp18--;
              }
              if (tmp18 == 0) {
                tmpMeta17 = mmc_mk_box4(0, _map, _aux_index, _iter, mmc_mk_boolean(_init));
                __omcQ_24tmpVar20 = omc_NFExpression_map(threadData, _arg, (modelica_fnptr) mmc_mk_box2(0,closure3_NBFunctionAlias_introduceArrayConstructorAlias,tmpMeta17));
                *tmp15 = mmc_mk_cons(__omcQ_24tmpVar20,0);
                tmp15 = &MMC_CDR(*tmp15);
              } else if (tmp18 == 1) {
                break;
              } else {
                goto goto_8;
              }
            }
            *tmp15 = mmc_mk_nil();
            tmpMeta14 = __omcQ_24tmpVar21;
          }
          tmpMeta13 = MMC_TAGPTR(mmc_alloc_words(8));
          memcpy(MMC_UNTAGPTR(tmpMeta13), MMC_UNTAGPTR(_call), 8*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta13))[6] = tmpMeta14;
          _call = tmpMeta13;

          tmpMeta19 = MMC_TAGPTR(mmc_alloc_words(3));
          memcpy(MMC_UNTAGPTR(tmpMeta19), MMC_UNTAGPTR(_new_exp), 3*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta19))[2] = _call;
          _new_exp = tmpMeta19;
          tmpMeta7 = _new_exp;
          goto tmp9_done;
        }
        case 2: {
          modelica_metatype tmpMeta20;
          modelica_metatype tmpMeta21;
          modelica_metatype tmpMeta22;
          if (mmc__uniontype__metarecord__typedef__equal(tmp10_1,27,3) == 0) goto tmp9_end;
          tmpMeta20 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp10_1), 2));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta20,11,2) == 0) goto tmp9_end;
          
          _sub_exp = tmpMeta20;
          /* Pattern matching succeeded */
          if((mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 3)))) > listLength((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_sub_exp), 3))))))
          {
            tmpMeta22 = stringAppend(_OMC_LIT14,omc_NFExpression_toString(threadData, _exp));
            tmpMeta21 = mmc_mk_cons(tmpMeta22, MMC_REFSTRUCTLIT(mmc_nil));
            omc_Error_addMessage(threadData, _OMC_LIT13, tmpMeta21);

            goto goto_8;
          }
          else
          {
            _new_exp = listGet((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_sub_exp), 3))), mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 3)))));
          }
          tmpMeta7 = _new_exp;
          goto tmp9_done;
        }
        case 3: {
          
          /* Pattern matching succeeded */
          tmpMeta7 = _exp;
          goto tmp9_done;
        }
        }
        goto tmp9_end;
        tmp9_end: ;
      }
      goto goto_8;
      goto_8:;
      MMC_THROW_INTERNAL();
      goto tmp9_done;
      tmp9_done:;
    }
  }
  _exp = tmpMeta7;
  _return: OMC_LABEL_UNUSED
  return _exp;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_introduceFunctionAlias(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fexp, modelica_metatype _map, modelica_metatype _aux_index, modelica_metatype _iter, modelica_metatype _init)
{
  modelica_integer tmp1;
  modelica_metatype _exp = NULL;
  tmp1 = mmc_unbox_integer(_init);
  _exp = omc_NBFunctionAlias_introduceFunctionAlias(threadData, __omcQ_24in_5Fexp, _map, _aux_index, _iter, tmp1);
  /* skip box _exp; NFExpression */
  return _exp;
}

static modelica_metatype closure4_NBFunctionAlias_introduceFunctionAlias(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  modelica_metatype aux_index = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),2));
  modelica_metatype iter = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),3));
  modelica_metatype init = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),4));
  return boxptr_NBFunctionAlias_introduceFunctionAlias(thData, $in_exp, map, aux_index, iter, init);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_introduceFunctionAliasEquation(threadData_t *threadData, modelica_metatype __omcQ_24in_5Feqn, modelica_metatype _map, modelica_metatype _variables, modelica_metatype _set, modelica_metatype _aux_index, modelica_metatype _eqn_index, modelica_boolean _init)
{
  modelica_metatype _eqn = NULL;
  modelica_metatype _iter = NULL;
  modelica_boolean _stop;
  modelica_metatype tmpMeta1;
  modelica_boolean tmp2_c1 __attribute__((unused)) = 0;
  modelica_metatype tmpMeta10;
  modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _eqn = __omcQ_24in_5Feqn;
  // _iter has no default value.
  // _stop has no default value.
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _eqn = omc_NBInline_inlineArrayConstructorSingle(threadData, _eqn, _OMC_LIT1, _variables, _set, _eqn_index, omc_Pointer_create(threadData, tmpMeta1), NULL);

  
  
  { /* match expression */
    modelica_metatype tmp5_1;
    tmp5_1 = _eqn;
    {
      modelica_metatype _body = NULL;
      volatile mmc_switch_type tmp5;
      int tmp6;
      // _body has no default value.
      tmp5 = 0;
      for (; tmp5 < 5; tmp5++) {
        switch (MMC_SWITCH_CAST(tmp5)) {
        case 0: {
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp5_1,5,5) == 0) goto tmp4_end;
          tmpMeta7 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp5_1), 4));
          if (listEmpty(tmpMeta7)) goto tmp4_end;
          tmpMeta8 = MMC_CAR(tmpMeta7);
          tmpMeta9 = MMC_CDR(tmpMeta7);
          if (!listEmpty(tmpMeta9)) goto tmp4_end;
          
          _body = tmpMeta8;
          /* Pattern matching succeeded */
          tmpMeta[0+0] = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_eqn), 3)));
          tmp2_c1 = (omc_NBEquation_Equation_isWhenEquation(threadData, omc_Pointer_create(threadData, _body)) || omc_NBEquation_Equation_isIfEquation(threadData, omc_Pointer_create(threadData, _body)));
          goto tmp4_done;
        }
        case 1: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp5_1,6,4) == 0) goto tmp4_end;
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _OMC_LIT1;
          tmp2_c1 = 1 /* true */;
          goto tmp4_done;
        }
        case 2: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp5_1,4,4) == 0) goto tmp4_end;
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _OMC_LIT1;
          tmp2_c1 = 1 /* true */;
          goto tmp4_done;
        }
        case 3: {
          if (mmc__uniontype__metarecord__typedef__equal(tmp5_1,3,5) == 0) goto tmp4_end;
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _OMC_LIT1;
          tmp2_c1 = 1 /* true */;
          goto tmp4_done;
        }
        case 4: {
          
          /* Pattern matching succeeded */
          tmpMeta[0+0] = _OMC_LIT1;
          tmp2_c1 = 0 /* false */;
          goto tmp4_done;
        }
        }
        goto tmp4_end;
        tmp4_end: ;
      }
      goto goto_3;
      goto_3:;
      MMC_THROW_INTERNAL();
      goto tmp4_done;
      tmp4_done:;
    }
  }
  _iter = tmpMeta[0+0];
  _stop = tmp2_c1;

  if((!_stop))
  {
    tmpMeta10 = mmc_mk_box4(0, _map, _aux_index, _iter, mmc_mk_boolean(_init));
    _eqn = omc_NBEquation_Equation_map(threadData, _eqn, (modelica_fnptr) mmc_mk_box2(0,closure4_NBFunctionAlias_introduceFunctionAlias,tmpMeta10), mmc_mk_none(), boxvar_NFExpression_fakeMap);
  }
  _return: OMC_LABEL_UNUSED
  return _eqn;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_introduceFunctionAliasEquation(threadData_t *threadData, modelica_metatype __omcQ_24in_5Feqn, modelica_metatype _map, modelica_metatype _variables, modelica_metatype _set, modelica_metatype _aux_index, modelica_metatype _eqn_index, modelica_metatype _init)
{
  modelica_integer tmp1;
  modelica_metatype _eqn = NULL;
  tmp1 = mmc_unbox_integer(_init);
  _eqn = omc_NBFunctionAlias_introduceFunctionAliasEquation(threadData, __omcQ_24in_5Feqn, _map, _variables, _set, _aux_index, _eqn_index, tmp1);
  /* skip box _eqn; NBEquation.Equation */
  return _eqn;
}

static modelica_metatype closure5_NBFunctionAlias_introduceFunctionAliasEquation(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_eqn)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  modelica_metatype variables = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),2));
  modelica_metatype set = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),3));
  modelica_metatype aux_index = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),4));
  modelica_metatype eqn_index = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),5));
  modelica_metatype init = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),6));
  return boxptr_NBFunctionAlias_introduceFunctionAliasEquation(thData, $in_eqn, map, variables, set, aux_index, eqn_index, init);
}static modelica_metatype closure6_NBFunctionAlias_introduceFunctionAliasEquation(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_eqn)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  modelica_metatype variables = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),2));
  modelica_metatype set = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),3));
  modelica_metatype aux_index = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),4));
  modelica_metatype eqn_index = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),5));
  modelica_metatype init = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),6));
  return boxptr_NBFunctionAlias_introduceFunctionAliasEquation(thData, $in_eqn, map, variables, set, aux_index, eqn_index, init);
}static modelica_metatype closure8_NBFunctionAlias_introduceFunctionAlias(threadData_t *thData, modelica_metatype closure, modelica_metatype $in_exp)
{
  modelica_metatype map = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  modelica_metatype aux_index = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),2));
  modelica_metatype iter = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),3));
  modelica_metatype init = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),4));
  return boxptr_NBFunctionAlias_introduceFunctionAlias(thData, $in_exp, map, aux_index, iter, init);
}static void closure7_NBVariable_mapExp(threadData_t *thData, modelica_metatype closure, modelica_metatype var_ptr)
{
  modelica_fnptr funcExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  modelica_fnptr mapFunc = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),2));
  boxptr_NBVariable_mapExp(thData, var_ptr, funcExp, mapFunc);
}static modelica_metatype closure9_NBFunctionAlias_functionAliasTplString(threadData_t *thData, modelica_metatype closure, modelica_metatype tpl)
{
  modelica_metatype max_length = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NBFunctionAlias_functionAliasTplString(thData, tpl, max_length);
}static modelica_metatype closure10_NBFunctionAlias_functionAliasTplString(threadData_t *thData, modelica_metatype closure, modelica_metatype tpl)
{
  modelica_metatype max_length = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NBFunctionAlias_functionAliasTplString(thData, tpl, max_length);
}static modelica_metatype closure11_NBFunctionAlias_functionAliasTplString(threadData_t *thData, modelica_metatype closure, modelica_metatype tpl)
{
  modelica_metatype max_length = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
  return boxptr_NBFunctionAlias_functionAliasTplString(thData, tpl, max_length);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_functionAliasDefault(threadData_t *threadData, modelica_metatype __omcQ_24in_5FvarData, modelica_metatype __omcQ_24in_5FeqData, modelica_integer _kind, modelica_metatype *out_eqData)
{
  modelica_metatype _varData = NULL;
  modelica_metatype _eqData = NULL;
  modelica_metatype _map = NULL;
  modelica_metatype _variables = NULL;
  modelica_metatype _set = NULL;
  modelica_metatype _clock_map = NULL;
  modelica_metatype _aux_index = NULL;
  modelica_metatype _new_vars_disc = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype _new_vars_cont = NULL;
  modelica_metatype tmpMeta2;
  modelica_metatype _new_vars_init = NULL;
  modelica_metatype tmpMeta3;
  modelica_metatype _new_vars_recd = NULL;
  modelica_metatype tmpMeta4;
  modelica_metatype _new_vars_clck = NULL;
  modelica_metatype _new_eqns_disc = NULL;
  modelica_metatype tmpMeta5;
  modelica_metatype _new_eqns_cont = NULL;
  modelica_metatype tmpMeta6;
  modelica_metatype _new_eqns_init = NULL;
  modelica_metatype tmpMeta7;
  modelica_metatype _new_eqns_clck = NULL;
  modelica_metatype _debug_lst_sim = NULL;
  modelica_metatype _debug_lst_ini = NULL;
  modelica_metatype _debug_str = NULL;
  modelica_integer _debug_max_length;
  modelica_metatype tmpMeta38;
  modelica_metatype tmpMeta39;
  modelica_metatype tmpMeta40;
  modelica_metatype tmpMeta41;
  modelica_metatype tmpMeta42;
  modelica_integer tmp47;
  modelica_metatype tmpMeta49;
  modelica_metatype tmpMeta50;
  modelica_integer tmp55;
  modelica_metatype tmpMeta57;
  modelica_metatype tmpMeta58;
  modelica_integer tmp63;
  modelica_metatype tmpMeta65;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _varData = __omcQ_24in_5FvarData;
  _eqData = __omcQ_24in_5FeqData;
  _map = omc_UnorderedMap_new(threadData, boxvar_NBFunctionAlias_Call__Id_hash, boxvar_NBFunctionAlias_Call__Id_isEqual, ((modelica_integer) 1));
  _variables = omc_NBVariable_VarData_getVariables(threadData, _varData);
  _set = omc_UnorderedSet_new(threadData, boxvar_NBVariable_hash, boxvar_NBVariable_equalName, ((modelica_integer) 13));
  // _clock_map has no default value.
  _aux_index = omc_Pointer_create(threadData, mmc_mk_integer(((modelica_integer) 1)));
  tmpMeta1 = MMC_REFSTRUCTLIT(mmc_nil);
  _new_vars_disc = tmpMeta1;
  tmpMeta2 = MMC_REFSTRUCTLIT(mmc_nil);
  _new_vars_cont = tmpMeta2;
  tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
  _new_vars_init = tmpMeta3;
  tmpMeta4 = MMC_REFSTRUCTLIT(mmc_nil);
  _new_vars_recd = tmpMeta4;
  // _new_vars_clck has no default value.
  tmpMeta5 = MMC_REFSTRUCTLIT(mmc_nil);
  _new_eqns_disc = tmpMeta5;
  tmpMeta6 = MMC_REFSTRUCTLIT(mmc_nil);
  _new_eqns_cont = tmpMeta6;
  tmpMeta7 = MMC_REFSTRUCTLIT(mmc_nil);
  _new_eqns_init = tmpMeta7;
  // _new_eqns_clck has no default value.
  // _debug_lst_sim has no default value.
  // _debug_lst_ini has no default value.
  // _debug_str has no default value.
  // _debug_max_length has no default value.
  { /* match expression */
    modelica_metatype tmp10_1;modelica_metatype tmp10_2;
    tmp10_1 = _eqData;
    tmp10_2 = _varData;
    {
      modelica_metatype _id = NULL;
      modelica_metatype _aux = NULL;
      modelica_boolean _disc;
      modelica_metatype _new_eqn = NULL;
      modelica_metatype _new_vars = NULL;
      volatile mmc_switch_type tmp10;
      int tmp11;
      // _id has no default value.
      // _aux has no default value.
      // _disc has no default value.
      // _new_eqn has no default value.
      // _new_vars has no default value.
      tmp10 = 0;
      for (; tmp10 < 2; tmp10++) {
        switch (MMC_SWITCH_CAST(tmp10)) {
        case 0: {
          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;
          if (mmc__uniontype__metarecord__typedef__equal(tmp10_1,0,9) == 0) goto tmp9_end;
          if (mmc__uniontype__metarecord__typedef__equal(tmp10_2,0,23) == 0) goto tmp9_end;
          
          /* Pattern matching succeeded */
          tmpMeta13 = mmc_mk_box6(0, _map, _variables, _set, _aux_index, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_eqData), 2))), mmc_mk_boolean(0 /* false */));
          tmpMeta12 = MMC_TAGPTR(mmc_alloc_words(11));
          memcpy(MMC_UNTAGPTR(tmpMeta12), MMC_UNTAGPTR(_eqData), 11*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta12))[4] = omc_NBEquation_EquationPointers_map(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_eqData), 4))), (modelica_fnptr) mmc_mk_box2(0,closure5_NBFunctionAlias_introduceFunctionAliasEquation,tmpMeta13));
          _eqData = tmpMeta12;

          {
            modelica_metatype _tpl;
            for (tmpMeta14 = listReverse(omc_UnorderedMap_toList(threadData, _map)); !listEmpty(tmpMeta14); tmpMeta14=MMC_CDR(tmpMeta14))
            {
              _tpl = MMC_CAR(tmpMeta14);
              /* Pattern-matching assignment */
              tmpMeta15 = _tpl;
              tmpMeta16 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta15), 1));
              tmpMeta17 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta15), 2));
              _id = tmpMeta16;
              _aux = tmpMeta17;

              _new_vars = omc_NBFunctionAlias_Call__Aux_getVars(threadData, _aux);

              _disc = 1 /* true */;

              {
                modelica_metatype _new_var;
                for (tmpMeta18 = _new_vars; !listEmpty(tmpMeta18); tmpMeta18=MMC_CDR(tmpMeta18))
                {
                  _new_var = MMC_CAR(tmpMeta18);
                  _disc = omc_NBFunctionAlias_addAuxVar(threadData, _new_var, _disc, _new_vars_disc, _new_vars_cont, _new_vars_init, _new_vars_recd, 0 /* false */ ,&_new_vars_disc ,&_new_vars_cont ,&_new_vars_init ,&_new_vars_recd);
                }
              }

              _new_eqn = omc_NBEquation_Equation_makeAssignment(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_aux), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_eqData), 2))), _OMC_LIT0, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id), 3))), omc_NBEquation_default(threadData, mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_aux), 3)))), 0 /* false */, mmc_mk_none(), mmc_mk_none()));

              if(_disc)
              {
                tmpMeta20 = mmc_mk_cons(_new_eqn, _new_eqns_disc);
                _new_eqns_disc = tmpMeta20;
              }
              else
              {
                tmpMeta21 = mmc_mk_cons(_new_eqn, _new_eqns_cont);
                _new_eqns_cont = tmpMeta21;
              }

              tmpMeta22 = MMC_TAGPTR(mmc_alloc_words(5));
              memcpy(MMC_UNTAGPTR(tmpMeta22), MMC_UNTAGPTR(_aux), 5*sizeof(modelica_metatype));
              ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta22))[4] = mmc_mk_boolean(1 /* true */);
              _aux = tmpMeta22;

              omc_UnorderedMap_add(threadData, _id, _aux, _map);
            }
          }

          if(omc_Flags_isSet(threadData, _OMC_LIT18))
          {
            _debug_lst_sim = omc_UnorderedMap_toList(threadData, _map);
          }

          tmpMeta25 = mmc_mk_box6(0, _map, _variables, _set, _aux_index, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_eqData), 2))), mmc_mk_boolean(1 /* true */));
          tmpMeta24 = MMC_TAGPTR(mmc_alloc_words(11));
          memcpy(MMC_UNTAGPTR(tmpMeta24), MMC_UNTAGPTR(_eqData), 11*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta24))[8] = omc_NBEquation_EquationPointers_map(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_eqData), 8))), (modelica_fnptr) mmc_mk_box2(0,closure6_NBFunctionAlias_introduceFunctionAliasEquation,tmpMeta25));
          _eqData = tmpMeta24;

          tmpMeta28 = mmc_mk_box4(0, _map, _aux_index, _OMC_LIT1, mmc_mk_boolean(1 /* true */));
          tmpMeta27 = mmc_mk_box2(0, (modelica_fnptr) mmc_mk_box2(0,closure8_NBFunctionAlias_introduceFunctionAlias,tmpMeta28), boxvar_NFExpression_fakeMap);
          tmpMeta26 = MMC_TAGPTR(mmc_alloc_words(25));
          memcpy(MMC_UNTAGPTR(tmpMeta26), MMC_UNTAGPTR(_varData), 25*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta26))[19] = omc_NBVariable_VariablePointers_mapPtr(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_varData), 19))), (modelica_fnptr) mmc_mk_box2(0,closure7_NBVariable_mapExp,tmpMeta27));
          _varData = tmpMeta26;

          {
            modelica_metatype _tpl;
            for (tmpMeta29 = listReverse(omc_UnorderedMap_toList(threadData, _map)); !listEmpty(tmpMeta29); tmpMeta29=MMC_CDR(tmpMeta29))
            {
              _tpl = MMC_CAR(tmpMeta29);
              /* Pattern-matching assignment */
              tmpMeta30 = _tpl;
              tmpMeta31 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta30), 1));
              tmpMeta32 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta30), 2));
              _id = tmpMeta31;
              _aux = tmpMeta32;

              if((!mmc_unbox_boolean((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_aux), 4))))))
              {
                _new_vars = omc_NBFunctionAlias_Call__Aux_getVars(threadData, _aux);

                {
                  modelica_metatype _new_var;
                  for (tmpMeta33 = _new_vars; !listEmpty(tmpMeta33); tmpMeta33=MMC_CDR(tmpMeta33))
                  {
                    _new_var = MMC_CAR(tmpMeta33);
                    _disc = omc_NBFunctionAlias_addAuxVar(threadData, _new_var, _disc, _new_vars_disc, _new_vars_cont, _new_vars_init, _new_vars_recd, 1 /* true */ ,&_new_vars_disc ,&_new_vars_cont ,&_new_vars_init ,&_new_vars_recd);
                  }
                }

                _new_eqn = omc_NBEquation_Equation_makeAssignment(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_aux), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_eqData), 2))), _OMC_LIT0, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id), 3))), omc_NBEquation_default(threadData, mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_aux), 3)))), 1 /* true */, mmc_mk_none(), mmc_mk_none()));

                tmpMeta35 = mmc_mk_cons(_new_eqn, _new_eqns_init);
                _new_eqns_init = tmpMeta35;

                tmpMeta36 = MMC_TAGPTR(mmc_alloc_words(5));
                memcpy(MMC_UNTAGPTR(tmpMeta36), MMC_UNTAGPTR(_aux), 5*sizeof(modelica_metatype));
                ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta36))[4] = mmc_mk_boolean(1 /* true */);
                _aux = tmpMeta36;

                omc_UnorderedMap_add(threadData, _id, _aux, _map);
              }
            }
          }

          _new_eqns_clck = omc_NBFunctionAlias_addClockedAlias(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_eqData), 4))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_eqData), 2))) ,&_new_vars_clck ,&_clock_map);
          goto tmp9_done;
        }
        case 1: {
          
          /* Pattern matching succeeded */
          goto tmp9_done;
        }
        }
        goto tmp9_end;
        tmp9_end: ;
      }
      goto goto_8;
      goto_8:;
      MMC_THROW_INTERNAL();
      goto tmp9_done;
      tmp9_done:;
    }
  }
  ;

  _varData = omc_NBVariable_VarData_addTypedList(threadData, _varData, _new_vars_cont, 3);

  _varData = omc_NBVariable_VarData_addTypedList(threadData, _varData, _new_vars_disc, 4);

  _varData = omc_NBVariable_VarData_addTypedList(threadData, _varData, _new_vars_init, 8);

  _varData = omc_NBVariable_VarData_addTypedList(threadData, _varData, _new_vars_recd, 10);

  _varData = omc_NBVariable_VarData_addTypedList(threadData, _varData, _new_vars_clck, 11);

  _varData = omc_NBVariable_VarData_addTypedList(threadData, _varData, omc_UnorderedSet_toList(threadData, _set), 9);

  _eqData = omc_NBEquation_EqData_addTypedList(threadData, _eqData, _new_eqns_cont, 1, 0 /* false */);

  _eqData = omc_NBEquation_EqData_addTypedList(threadData, _eqData, _new_eqns_disc, 2, 0 /* false */);

  _eqData = omc_NBEquation_EqData_addTypedList(threadData, _eqData, _new_eqns_init, 4, 0 /* false */);

  _eqData = omc_NBEquation_EqData_addTypedList(threadData, _eqData, _new_eqns_clck, 3, 0 /* false */);

  {
    modelica_metatype _var;
    for (tmpMeta38 = _new_vars_recd; !listEmpty(tmpMeta38); tmpMeta38=MMC_CDR(tmpMeta38))
    {
      _var = MMC_CAR(tmpMeta38);
      omc_NBackendDAE_lowerRecordChildren(threadData, _var, omc_NBVariable_VarData_getVariables(threadData, _varData));
    }
  }

  if(omc_Flags_isSet(threadData, _OMC_LIT18))
  {
    {
      modelica_metatype _tpl;
      for (tmpMeta40 = _debug_lst_sim; !listEmpty(tmpMeta40); tmpMeta40=MMC_CDR(tmpMeta40))
      {
        _tpl = MMC_CAR(tmpMeta40);
        omc_UnorderedMap_remove(threadData, omc_Util_tuple21(threadData, _tpl), _map);
      }
    }

    _debug_lst_ini = omc_UnorderedMap_toList(threadData, _map);

    fputs(MMC_STRINGDATA(omc_StringUtil_headline__3(threadData, _OMC_LIT19)),stdout);

    {
      modelica_metatype __omcQ_24tmpVar23;
      modelica_metatype* tmp43;
      modelica_metatype tmpMeta44;
      modelica_metatype tmpMeta45;
      modelica_metatype __omcQ_24tmpVar22;
      modelica_integer tmp46;
      modelica_metatype _tpl_loopVar = 0;
      modelica_metatype _tpl;
      _tpl_loopVar = _debug_lst_sim;
      tmpMeta44 = MMC_REFSTRUCTLIT(mmc_nil);
      __omcQ_24tmpVar23 = tmpMeta44; /* defaultValue */
      tmp43 = &__omcQ_24tmpVar23;
      while(1) {
        tmp46 = 1;
        if (!listEmpty(_tpl_loopVar)) {
          _tpl = MMC_CAR(_tpl_loopVar);
          _tpl_loopVar = MMC_CDR(_tpl_loopVar);
          tmp46--;
        }
        if (tmp46 == 0) {
          tmpMeta45 = mmc_mk_box2(0, omc_NBFunctionAlias_Call__Aux_toString(threadData, omc_Util_tuple22(threadData, _tpl)), omc_NBFunctionAlias_Call__Id_toString(threadData, omc_Util_tuple21(threadData, _tpl)));
          __omcQ_24tmpVar22 = tmpMeta45;
          *tmp43 = mmc_mk_cons(__omcQ_24tmpVar22,0);
          tmp43 = &MMC_CDR(*tmp43);
        } else if (tmp46 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      *tmp43 = mmc_mk_nil();
      tmpMeta42 = __omcQ_24tmpVar23;
    }
    _debug_str = tmpMeta42;

    {
      modelica_integer __omcQ_24tmpVar25;
      modelica_integer __omcQ_24tmpVar24;
      modelica_integer tmp48;
      modelica_metatype _tpl_loopVar = 0;
      modelica_metatype _tpl;
      _tpl_loopVar = _debug_str;
      __omcQ_24tmpVar25 = ((modelica_integer) -4611686018427387903); /* defaultValue */
      while(1) {
        tmp48 = 1;
        if (!listEmpty(_tpl_loopVar)) {
          _tpl = MMC_CAR(_tpl_loopVar);
          _tpl_loopVar = MMC_CDR(_tpl_loopVar);
          tmp48--;
        }
        if (tmp48 == 0) {
          __omcQ_24tmpVar24 = stringLength(omc_Util_tuple21(threadData, _tpl));
          __omcQ_24tmpVar25 = modelica_integer_max((modelica_integer)(__omcQ_24tmpVar24),(modelica_integer)(__omcQ_24tmpVar25));
        } else if (tmp48 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      tmp47 = __omcQ_24tmpVar25;
    }
    _debug_max_length = ((modelica_integer) 3) + tmp47;

    tmpMeta49 = mmc_mk_box1(0, mmc_mk_integer(_debug_max_length));
    fputs(MMC_STRINGDATA(omc_List_toString(threadData, _debug_str, (modelica_fnptr) mmc_mk_box2(0,closure9_NBFunctionAlias_functionAliasTplString,tmpMeta49), _OMC_LIT20, _OMC_LIT21, _OMC_LIT22, _OMC_LIT23, 1 /* true */, ((modelica_integer) 0))),stdout);

    fputs(MMC_STRINGDATA(omc_StringUtil_headline__3(threadData, _OMC_LIT24)),stdout);

    {
      modelica_metatype __omcQ_24tmpVar27;
      modelica_metatype* tmp51;
      modelica_metatype tmpMeta52;
      modelica_metatype tmpMeta53;
      modelica_metatype __omcQ_24tmpVar26;
      modelica_integer tmp54;
      modelica_metatype _tpl_loopVar = 0;
      modelica_metatype _tpl;
      _tpl_loopVar = _debug_lst_ini;
      tmpMeta52 = MMC_REFSTRUCTLIT(mmc_nil);
      __omcQ_24tmpVar27 = tmpMeta52; /* defaultValue */
      tmp51 = &__omcQ_24tmpVar27;
      while(1) {
        tmp54 = 1;
        if (!listEmpty(_tpl_loopVar)) {
          _tpl = MMC_CAR(_tpl_loopVar);
          _tpl_loopVar = MMC_CDR(_tpl_loopVar);
          tmp54--;
        }
        if (tmp54 == 0) {
          tmpMeta53 = mmc_mk_box2(0, omc_NBFunctionAlias_Call__Aux_toString(threadData, omc_Util_tuple22(threadData, _tpl)), omc_NBFunctionAlias_Call__Id_toString(threadData, omc_Util_tuple21(threadData, _tpl)));
          __omcQ_24tmpVar26 = tmpMeta53;
          *tmp51 = mmc_mk_cons(__omcQ_24tmpVar26,0);
          tmp51 = &MMC_CDR(*tmp51);
        } else if (tmp54 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      *tmp51 = mmc_mk_nil();
      tmpMeta50 = __omcQ_24tmpVar27;
    }
    _debug_str = tmpMeta50;

    {
      modelica_integer __omcQ_24tmpVar29;
      modelica_integer __omcQ_24tmpVar28;
      modelica_integer tmp56;
      modelica_metatype _tpl_loopVar = 0;
      modelica_metatype _tpl;
      _tpl_loopVar = _debug_str;
      __omcQ_24tmpVar29 = ((modelica_integer) -4611686018427387903); /* defaultValue */
      while(1) {
        tmp56 = 1;
        if (!listEmpty(_tpl_loopVar)) {
          _tpl = MMC_CAR(_tpl_loopVar);
          _tpl_loopVar = MMC_CDR(_tpl_loopVar);
          tmp56--;
        }
        if (tmp56 == 0) {
          __omcQ_24tmpVar28 = stringLength(omc_Util_tuple21(threadData, _tpl));
          __omcQ_24tmpVar29 = modelica_integer_max((modelica_integer)(__omcQ_24tmpVar28),(modelica_integer)(__omcQ_24tmpVar29));
        } else if (tmp56 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      tmp55 = __omcQ_24tmpVar29;
    }
    _debug_max_length = ((modelica_integer) 3) + tmp55;

    tmpMeta57 = mmc_mk_box1(0, mmc_mk_integer(_debug_max_length));
    fputs(MMC_STRINGDATA(omc_List_toString(threadData, _debug_str, (modelica_fnptr) mmc_mk_box2(0,closure10_NBFunctionAlias_functionAliasTplString,tmpMeta57), _OMC_LIT20, _OMC_LIT21, _OMC_LIT22, _OMC_LIT23, 1 /* true */, ((modelica_integer) 0))),stdout);

    fputs(MMC_STRINGDATA(omc_StringUtil_headline__3(threadData, _OMC_LIT25)),stdout);

    {
      modelica_metatype __omcQ_24tmpVar31;
      modelica_metatype* tmp59;
      modelica_metatype tmpMeta60;
      modelica_metatype tmpMeta61;
      modelica_metatype __omcQ_24tmpVar30;
      modelica_integer tmp62;
      modelica_metatype _tpl_loopVar = 0;
      modelica_metatype _tpl;
      _tpl_loopVar = omc_UnorderedMap_toList(threadData, _clock_map);
      tmpMeta60 = MMC_REFSTRUCTLIT(mmc_nil);
      __omcQ_24tmpVar31 = tmpMeta60; /* defaultValue */
      tmp59 = &__omcQ_24tmpVar31;
      while(1) {
        tmp62 = 1;
        if (!listEmpty(_tpl_loopVar)) {
          _tpl = MMC_CAR(_tpl_loopVar);
          _tpl_loopVar = MMC_CDR(_tpl_loopVar);
          tmp62--;
        }
        if (tmp62 == 0) {
          tmpMeta61 = mmc_mk_box2(0, omc_NFComponentRef_toString(threadData, omc_Util_tuple22(threadData, _tpl)), omc_NBPartitioning_BClock_toString(threadData, omc_Util_tuple21(threadData, _tpl)));
          __omcQ_24tmpVar30 = tmpMeta61;
          *tmp59 = mmc_mk_cons(__omcQ_24tmpVar30,0);
          tmp59 = &MMC_CDR(*tmp59);
        } else if (tmp62 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      *tmp59 = mmc_mk_nil();
      tmpMeta58 = __omcQ_24tmpVar31;
    }
    _debug_str = tmpMeta58;

    {
      modelica_integer __omcQ_24tmpVar33;
      modelica_integer __omcQ_24tmpVar32;
      modelica_integer tmp64;
      modelica_metatype _tpl_loopVar = 0;
      modelica_metatype _tpl;
      _tpl_loopVar = _debug_str;
      __omcQ_24tmpVar33 = ((modelica_integer) -4611686018427387903); /* defaultValue */
      while(1) {
        tmp64 = 1;
        if (!listEmpty(_tpl_loopVar)) {
          _tpl = MMC_CAR(_tpl_loopVar);
          _tpl_loopVar = MMC_CDR(_tpl_loopVar);
          tmp64--;
        }
        if (tmp64 == 0) {
          __omcQ_24tmpVar32 = stringLength(omc_Util_tuple21(threadData, _tpl));
          __omcQ_24tmpVar33 = modelica_integer_max((modelica_integer)(__omcQ_24tmpVar32),(modelica_integer)(__omcQ_24tmpVar33));
        } else if (tmp64 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      tmp63 = __omcQ_24tmpVar33;
    }
    _debug_max_length = ((modelica_integer) 3) + tmp63;

    tmpMeta65 = mmc_mk_box1(0, mmc_mk_integer(_debug_max_length));
    fputs(MMC_STRINGDATA(omc_List_toString(threadData, _debug_str, (modelica_fnptr) mmc_mk_box2(0,closure11_NBFunctionAlias_functionAliasTplString,tmpMeta65), _OMC_LIT20, _OMC_LIT21, _OMC_LIT22, _OMC_LIT23, 1 /* true */, ((modelica_integer) 0))),stdout);
  }
  _return: OMC_LABEL_UNUSED
  if (out_eqData) { *out_eqData = _eqData; }
  return _varData;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_functionAliasDefault(threadData_t *threadData, modelica_metatype __omcQ_24in_5FvarData, modelica_metatype __omcQ_24in_5FeqData, modelica_metatype _kind, modelica_metatype *out_eqData)
{
  modelica_integer tmp1;
  modelica_metatype _varData = NULL;
  tmp1 = mmc_unbox_integer(_kind);
  _varData = omc_NBFunctionAlias_functionAliasDefault(threadData, __omcQ_24in_5FvarData, __omcQ_24in_5FeqData, tmp1, out_eqData);
  /* skip box _varData; NBVariable.VarData */
  /* skip box _eqData; NBEquation.EqData */
  return _varData;
}

PROTECTED_FUNCTION_STATIC modelica_string omc_NBFunctionAlias_functionAliasTplString(threadData_t *threadData, modelica_metatype _tpl, modelica_integer _max_length)
{
  modelica_string _str = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_metatype tmpMeta3;
  modelica_metatype tmpMeta4;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _str has no default value.
  tmpMeta1 = stringAppend(omc_Util_tuple21(threadData, _tpl),_OMC_LIT26);
  tmpMeta2 = stringAppend(tmpMeta1,omc_StringUtil_repeat(threadData, _OMC_LIT27, _max_length - stringLength(omc_Util_tuple21(threadData, _tpl))));
  tmpMeta3 = stringAppend(tmpMeta2,_OMC_LIT26);
  tmpMeta4 = stringAppend(tmpMeta3,omc_Util_tuple22(threadData, _tpl));
  _str = tmpMeta4;
  _return: OMC_LABEL_UNUSED
  return _str;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_NBFunctionAlias_functionAliasTplString(threadData_t *threadData, modelica_metatype _tpl, modelica_metatype _max_length)
{
  modelica_integer tmp1;
  modelica_string _str = NULL;
  tmp1 = mmc_unbox_integer(_max_length);
  _str = omc_NBFunctionAlias_functionAliasTplString(threadData, _tpl, tmp1);
  /* skip box _str; String */
  return _str;
}

DLLDirection
modelica_metatype omc_NBFunctionAlias_Call__Aux_createName(threadData_t *threadData, modelica_metatype _ty, modelica_metatype _iter, modelica_metatype _aux_index, modelica_boolean _init)
{
  modelica_metatype _name = NULL;
  modelica_metatype _new_ty = NULL;
  modelica_metatype _subs = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _name has no default value.
  _new_ty = _ty;
  // _subs has no default value.
  if((!omc_NBEquation_Iterator_isEmpty(threadData, _iter)))
  {
    {
      modelica_metatype __omcQ_24tmpVar35;
      modelica_metatype* tmp2;
      modelica_metatype tmpMeta3;
      modelica_metatype __omcQ_24tmpVar34;
      modelica_integer tmp4;
      modelica_metatype _i_loopVar = 0;
      modelica_metatype _i;
      _i_loopVar = omc_NBEquation_Iterator_sizes(threadData, _iter, 0 /* false */);
      tmpMeta3 = MMC_REFSTRUCTLIT(mmc_nil);
      __omcQ_24tmpVar35 = tmpMeta3; /* defaultValue */
      tmp2 = &__omcQ_24tmpVar35;
      while(1) {
        tmp4 = 1;
        if (!listEmpty(_i_loopVar)) {
          _i = MMC_CAR(_i_loopVar);
          _i_loopVar = MMC_CDR(_i_loopVar);
          tmp4--;
        }
        if (tmp4 == 0) {
          __omcQ_24tmpVar34 = omc_NFDimension_fromInteger(threadData, mmc_unbox_integer(_i), 1);
          *tmp2 = mmc_mk_cons(__omcQ_24tmpVar34,0);
          tmp2 = &MMC_CDR(*tmp2);
        } else if (tmp4 == 1) {
          break;
        } else {
          MMC_THROW_INTERNAL();
        }
      }
      *tmp2 = mmc_mk_nil();
      tmpMeta1 = __omcQ_24tmpVar35;
    }
    _new_ty = omc_NFType_liftArrayRightList(threadData, _ty, tmpMeta1);

    omc_NBVariable_makeAuxVar(threadData, _OMC_LIT28, mmc_unbox_integer(omc_Pointer_access(threadData, _aux_index)), _new_ty, _init ,&_name);

    _subs = omc_NBEquation_Iterator_normalizedSubscripts(threadData, _iter, omc_UnorderedMap_new(threadData, boxvar_NFComponentRef_hash, boxvar_NFComponentRef_isEqual, ((modelica_integer) 1)));

    _subs = omc_NFSubscript_fillWithWholeLeft(threadData, _subs, omc_NFType_dimensionCount(threadData, _new_ty));

    _name = omc_NFComponentRef_mergeSubscripts(threadData, _subs, _name, 1 /* true */, 1 /* true */, 0 /* false */);
  }
  else
  {
    omc_NBVariable_makeAuxVar(threadData, _OMC_LIT28, mmc_unbox_integer(omc_Pointer_access(threadData, _aux_index)), _new_ty, _init ,&_name);
  }

  omc_Pointer_update(threadData, _aux_index, mmc_mk_integer(((modelica_integer) 1) + mmc_unbox_integer(omc_Pointer_access(threadData, _aux_index))));
  _return: OMC_LABEL_UNUSED
  return _name;
}
modelica_metatype boxptr_NBFunctionAlias_Call__Aux_createName(threadData_t *threadData, modelica_metatype _ty, modelica_metatype _iter, modelica_metatype _aux_index, modelica_metatype _init)
{
  modelica_integer tmp1;
  modelica_metatype _name = NULL;
  tmp1 = mmc_unbox_integer(_init);
  _name = omc_NBFunctionAlias_Call__Aux_createName(threadData, _ty, _iter, _aux_index, tmp1);
  /* skip box _name; NFComponentRef */
  return _name;
}

PROTECTED_FUNCTION_STATIC modelica_metatype omc_NBFunctionAlias_Call__Aux_getVars_getVarsExp(threadData_t *threadData, modelica_metatype _exp)
{
  modelica_metatype _vars = NULL;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _vars has no default value.
  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _exp;
    {
      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;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          if (mmc__uniontype__metarecord__typedef__equal(tmpMeta6,2,0) == 0) goto tmp3_end;
          /* Pattern matching succeeded */
          tmpMeta7 = MMC_REFSTRUCTLIT(mmc_nil);
          tmpMeta1 = tmpMeta7;
          goto tmp3_done;
        }
        case 1: {
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,6,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          tmpMeta8 = mmc_mk_cons(omc_NBVariable_getVarPointer(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 3))), _OMC_LIT30), MMC_REFSTRUCTLIT(mmc_nil));
          tmpMeta1 = tmpMeta8;
          goto tmp3_done;
        }
        case 2: {
          modelica_metatype tmpMeta9;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,11,2) == 0) goto tmp3_end;
          
          /* Pattern matching succeeded */
          {
            modelica_metatype __omcQ_24tmpVar37;
            modelica_metatype* tmp10;
            modelica_metatype tmpMeta11;
            modelica_metatype __omcQ_24tmpVar36;
            modelica_integer tmp12;
            modelica_metatype _elem_loopVar = 0;
            modelica_metatype _elem;
            _elem_loopVar = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_exp), 3)));
            tmpMeta11 = MMC_REFSTRUCTLIT(mmc_nil);
            __omcQ_24tmpVar37 = tmpMeta11; /* defaultValue */
            tmp10 = &__omcQ_24tmpVar37;
            while(1) {
              tmp12 = 1;
              if (!listEmpty(_elem_loopVar)) {
                _elem = MMC_CAR(_elem_loopVar);
                _elem_loopVar = MMC_CDR(_elem_loopVar);
                tmp12--;
              }
              if (tmp12 == 0) {
                __omcQ_24tmpVar36 = omc_NBFunctionAlias_Call__Aux_getVars_getVarsExp(threadData, _elem);
                *tmp10 = mmc_mk_cons(__omcQ_24tmpVar36,0);
                tmp10 = &MMC_CDR(*tmp10);
              } else if (tmp12 == 1) {
                break;
              } else {
                goto goto_2;
              }
            }
            *tmp10 = mmc_mk_nil();
            tmpMeta9 = __omcQ_24tmpVar37;
          }
          tmpMeta1 = omc_List_flatten(threadData, tmpMeta9);
          goto tmp3_done;
        }
        case 3: {
          modelica_metatype tmpMeta13;
          modelica_metatype tmpMeta14;
          
          /* Pattern matching succeeded */
          tmpMeta14 = stringAppend(_OMC_LIT31,omc_NFExpression_toString(threadData, _exp));
          tmpMeta13 = mmc_mk_cons(tmpMeta14, MMC_REFSTRUCTLIT(mmc_nil));
          omc_Error_addMessage(threadData, _OMC_LIT13, tmpMeta13);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _vars = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _vars;
}

DLLDirection
modelica_metatype omc_NBFunctionAlias_Call__Aux_getVars(threadData_t *threadData, modelica_metatype _aux)
{
  modelica_metatype _vars = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _vars = omc_NBFunctionAlias_Call__Aux_getVars_getVarsExp(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_aux), 2))));
  _return: OMC_LABEL_UNUSED
  return _vars;
}

DLLDirection
modelica_string omc_NBFunctionAlias_Call__Aux_toString(threadData_t *threadData, modelica_metatype _aux)
{
  modelica_string _str = NULL;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _str = omc_NFExpression_toString(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_aux), 2))));
  _return: OMC_LABEL_UNUSED
  return _str;
}

DLLDirection
modelica_boolean omc_NBFunctionAlias_Call__Id_isEqual(threadData_t *threadData, modelica_metatype _id1, modelica_metatype _id2)
{
  modelica_boolean _b;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _b has no default value.
  _b = (omc_NFExpression_isEqual(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id1), 2))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id2), 2)))) && omc_NBEquation_Iterator_isEqual(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id1), 3))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id2), 3)))));
  _return: OMC_LABEL_UNUSED
  return _b;
}
modelica_metatype boxptr_NBFunctionAlias_Call__Id_isEqual(threadData_t *threadData, modelica_metatype _id1, modelica_metatype _id2)
{
  modelica_boolean _b;
  modelica_metatype out_b;
  _b = omc_NBFunctionAlias_Call__Id_isEqual(threadData, _id1, _id2);
  out_b = mmc_mk_icon(_b);
  return out_b;
}

DLLDirection
modelica_integer omc_NBFunctionAlias_Call__Id_hash(threadData_t *threadData, modelica_metatype _id)
{
  modelica_integer _hash;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _hash has no default value.
  _hash = stringHashDjb2(omc_NBFunctionAlias_Call__Id_toString(threadData, _id));
  _return: OMC_LABEL_UNUSED
  return _hash;
}
modelica_metatype boxptr_NBFunctionAlias_Call__Id_hash(threadData_t *threadData, modelica_metatype _id)
{
  modelica_integer _hash;
  modelica_metatype out_hash;
  _hash = omc_NBFunctionAlias_Call__Id_hash(threadData, _id);
  out_hash = mmc_mk_icon(_hash);
  return out_hash;
}

DLLDirection
modelica_string omc_NBFunctionAlias_Call__Id_toString(threadData_t *threadData, modelica_metatype _id)
{
  modelica_string _str = NULL;
  modelica_metatype tmpMeta1;
  modelica_metatype tmpMeta2;
  modelica_boolean tmp3;
  modelica_string tmp4;
  modelica_metatype tmpMeta5;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  // _str has no default value.
  tmp3 = (modelica_boolean)(!omc_NBEquation_Iterator_isEmpty(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id), 3)))));
  if(tmp3)
  {
    tmpMeta1 = stringAppend(_OMC_LIT32,omc_NBEquation_Iterator_toString(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id), 3)))));
    tmpMeta2 = stringAppend(tmpMeta1,_OMC_LIT33);
    tmp4 = tmpMeta2;
  }
  else
  {
    tmp4 = _OMC_LIT20;
  }
  _str = tmp4;

  tmpMeta5 = stringAppend(omc_NFExpression_toString(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_id), 2)))),_str);
  _str = tmpMeta5;
  _return: OMC_LABEL_UNUSED
  return _str;
}

DLLDirection
modelica_fnptr omc_NBFunctionAlias_getModule(threadData_t *threadData)
{
  modelica_fnptr _func;
  modelica_string _flag = NULL;
  modelica_fnptr tmp1 = 0;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _flag = _OMC_LIT34;
  { /* match expression */
    modelica_string tmp4_1;
    tmp4_1 = _flag;
    {
      volatile mmc_switch_type tmp4;
      int tmp5;
      tmp4 = 0;
      for (; tmp4 < 1; tmp4++) {
        switch (MMC_SWITCH_CAST(tmp4)) {
        case 0: {
          if (7 != MMC_STRLEN(tmp4_1) || strcmp(MMC_STRINGDATA(_OMC_LIT34), MMC_STRINGDATA(tmp4_1)) != 0) goto tmp3_end;
          /* Pattern matching succeeded */
          tmp1 = boxvar_NBFunctionAlias_functionAliasDefault;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _func = (modelica_fnptr) tmp1;
  _return: OMC_LABEL_UNUSED
  return _func;
}

DLLDirection
modelica_metatype omc_NBFunctionAlias_main(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fbdae, modelica_integer _kind)
{
  modelica_metatype _bdae = NULL;
  modelica_fnptr _func;
  modelica_metatype tmpMeta1;
  MMC_SO();
  _tailrecursive: OMC_LABEL_UNUSED
  _bdae = __omcQ_24in_5Fbdae;
  _func = (modelica_fnptr) omc_NBFunctionAlias_getModule(threadData);

  { /* match expression */
    modelica_metatype tmp4_1;
    tmp4_1 = _bdae;
    {
      modelica_metatype _varData = NULL;
      modelica_metatype _eqData = NULL;
      int tmp4;
      // _varData has no default value.
      // _eqData has no default value.
      {
        switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
        case 3: {
          modelica_metatype tmpMeta5;
          modelica_metatype tmpMeta6;
          modelica_metatype tmpMeta7;
          modelica_metatype tmpMeta8;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,13) == 0) goto tmp3_end;
          tmpMeta5 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 10));
          tmpMeta6 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 11));
          
          _varData = tmpMeta5;
          _eqData = tmpMeta6;
          /* Pattern matching succeeded */
          _varData = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype, modelica_metatype, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 2))), _varData, _eqData, mmc_mk_integer((modelica_integer)_kind) ,&_eqData) : ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 1)))) (threadData, _varData, _eqData, mmc_mk_integer((modelica_integer)_kind) ,&_eqData);

          tmpMeta7 = MMC_TAGPTR(mmc_alloc_words(15));
          memcpy(MMC_UNTAGPTR(tmpMeta7), MMC_UNTAGPTR(_bdae), 15*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta7))[10] = _varData;
          _bdae = tmpMeta7;

          tmpMeta8 = MMC_TAGPTR(mmc_alloc_words(15));
          memcpy(MMC_UNTAGPTR(tmpMeta8), MMC_UNTAGPTR(_bdae), 15*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta8))[11] = _eqData;
          _bdae = tmpMeta8;
          tmpMeta1 = _bdae;
          goto tmp3_done;
        }
        case 5: {
          modelica_metatype tmpMeta9;
          modelica_metatype tmpMeta10;
          modelica_metatype tmpMeta11;
          modelica_metatype tmpMeta12;
          if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,2,2) == 0) goto tmp3_end;
          tmpMeta9 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
          tmpMeta10 = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
          _varData = tmpMeta9;
          _eqData = tmpMeta10;
          /* Pattern matching succeeded */
          _varData = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 2))) ? ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype, modelica_metatype, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 1)))) (threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 2))), _varData, _eqData, mmc_mk_integer((modelica_integer)_kind) ,&_eqData) : ((modelica_metatype(*)(threadData_t*, modelica_metatype, modelica_metatype, modelica_metatype, modelica_metatype)) (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_func), 1)))) (threadData, _varData, _eqData, mmc_mk_integer((modelica_integer)_kind) ,&_eqData);

          tmpMeta11 = MMC_TAGPTR(mmc_alloc_words(4));
          memcpy(MMC_UNTAGPTR(tmpMeta11), MMC_UNTAGPTR(_bdae), 4*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta11))[2] = _varData;
          _bdae = tmpMeta11;

          tmpMeta12 = MMC_TAGPTR(mmc_alloc_words(4));
          memcpy(MMC_UNTAGPTR(tmpMeta12), MMC_UNTAGPTR(_bdae), 4*sizeof(modelica_metatype));
          ((modelica_metatype*)MMC_UNTAGPTR(tmpMeta12))[3] = _eqData;
          _bdae = tmpMeta12;
          tmpMeta1 = _bdae;
          goto tmp3_done;
        }
        default:
        tmp3_default: OMC_LABEL_UNUSED; {
          
          /* Pattern matching succeeded */
          omc_Error_addMessage(threadData, _OMC_LIT13, _OMC_LIT36);
          goto goto_2;
          goto tmp3_done;
        }
        }
        goto tmp3_end;
        tmp3_end: ;
      }
      goto goto_2;
      goto_2:;
      MMC_THROW_INTERNAL();
      goto tmp3_done;
      tmp3_done:;
    }
  }
  _bdae = tmpMeta1;
  _return: OMC_LABEL_UNUSED
  return _bdae;
}
modelica_metatype boxptr_NBFunctionAlias_main(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fbdae, modelica_metatype _kind)
{
  modelica_integer tmp1;
  modelica_metatype _bdae = NULL;
  tmp1 = mmc_unbox_integer(_kind);
  _bdae = omc_NBFunctionAlias_main(threadData, __omcQ_24in_5Fbdae, tmp1);
  /* skip box _bdae; NBackendDAE */
  return _bdae;
}

