/*

  This program is part of the TACLeBench benchmark suite.
  Version V 2.0

  Name: statemate

  Author: Friedhelm Stappert, C-LAB, Paderborn, Germany

  Function: This code was automatically generated by
            the STAtechart Real-time-Code generator STARC
            which was developed at C-LAB.

            The original StateChart specifies an experimental
            car window lift control.

  Source: MRTC
          http://www.mrtc.mdh.se/projects/wcet/wcet_bench/statemate/statemate.c

  Changes: no major functional changes

  License: may be used, modified, and re-distributed freely

*/

/*
  Macro definitions
*/

#define SYS_bit_get(a,b) (a)[ (b) ]
#define SYS_bit_clr(a,b) (a)[ (b) ] = 0
#define SYS_bit_set(a,b) (a)[ (b) ] = 1
#define SYS_bit_cpy(a1,i1,a2,i2) (a1)[ (i1) ] = (a2)[ (i2) ]

#define active_KINDERSICHERUNG_CTRL_IDX 10
#define active_KINDERSICHERUNG_CTRL_copy_IDX 11
#define active_KINDERSICHERUNG_CTRL_old_IDX 12
#define active_FH_TUERMODUL_CTRL_IDX 13
#define active_FH_TUERMODUL_CTRL_copy_IDX 14
#define active_FH_TUERMODUL_CTRL_old_IDX 15
#define active_EINKLEMMSCHUTZ_CTRL_IDX 16
#define active_EINKLEMMSCHUTZ_CTRL_copy_IDX 17
#define active_EINKLEMMSCHUTZ_CTRL_old_IDX 18
#define active_BLOCK_ERKENNUNG_CTRL_IDX 19
#define active_BLOCK_ERKENNUNG_CTRL_copy_IDX 20
#define active_BLOCK_ERKENNUNG_CTRL_old_IDX 21
#define entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRL_IDX 0

#define entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_IDX 4
#define entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_copy_IDX 5
#define exited_BEREIT_FH_TUERMODUL_CTRL_IDX 6
#define exited_BEREIT_FH_TUERMODUL_CTRL_copy_IDX 7

#define  FH_TUERMODUL_CTRL__END_REVERS_IDX 22
#define  FH_TUERMODUL_CTRL__END_REVERS_copy_IDX 23
#define  FH_TUERMODUL__EINKLEMMUNG_IDX 24


/*
  Forward declaration of functions
*/

void statemate_init( void );
void statemate_interface( void );
void statemate_generic_KINDERSICHERUNG_CTRL( void );
void statemate_generic_FH_TUERMODUL_CTRL( void );
void statemate_generic_EINKLEMMSCHUTZ_CTRL( void );
void statemate_generic_BLOCK_ERKENNUNG_CTRL( void );
void statemate_FH_DU( void );
void statemate_main( void );
int statemate_return ( void );


/*
  Declaration of global variables
*/

static char     statemate_bitlist[ 64 ];
unsigned long
statemate_tm_entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRLch_BLOCK_ERKENNUNG_CTRL__N_copy;
unsigned long
statemate_tm_entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRLexited_BEREIT_FH_TUERMODUL_CTRL;
unsigned long   statemate_tm_entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL;
unsigned long   statemate_sc_FH_TUERMODUL_CTRL_2375_2;
unsigned long   statemate_sc_FH_TUERMODUL_CTRL_2352_1;
unsigned long   statemate_sc_FH_TUERMODUL_CTRL_2329_1;
int             statemate_FH_TUERMODUL_CTRL__N;
int             statemate_FH_TUERMODUL_CTRL__N_old;
unsigned long   statemate_sc_FH_TUERMODUL_CTRL_1781_10;
unsigned long   statemate_sc_FH_TUERMODUL_CTRL_1739_10;
int             statemate_FH_TUERMODUL__POSITION;
int             statemate_FH_TUERMODUL__I_EIN;
int             statemate_FH_TUERMODUL__I_EIN_old;
int             statemate_FH_DU__MFH;
int             statemate_FH_DU__MFH_copy;
int             statemate_FH_DU__POSITION;
int             statemate_FH_DU__I_EIN;
int             statemate_FH_DU__I_EIN_old;
int             statemate_BLOCK_ERKENNUNG_CTRL__I_EIN_MAX;
int             statemate_BLOCK_ERKENNUNG_CTRL__N;
int             statemate_BLOCK_ERKENNUNG_CTRL__N_old;
char            statemate_FH_TUERMODUL_CTRL__INREVERS2;
char            statemate_FH_TUERMODUL_CTRL__INREVERS2_copy;
char            statemate_FH_TUERMODUL_CTRL__INREVERS1;
char            statemate_FH_TUERMODUL_CTRL__INREVERS1_copy;
char            statemate_FH_TUERMODUL__SFHZ_ZENTRAL;
char            statemate_FH_TUERMODUL__SFHZ_ZENTRAL_old;
char            statemate_FH_TUERMODUL__SFHZ_MEC;
char            statemate_FH_TUERMODUL__SFHZ_MEC_old;
char            statemate_FH_TUERMODUL__SFHA_ZENTRAL;
char            statemate_FH_TUERMODUL__SFHA_ZENTRAL_old;
char            statemate_FH_TUERMODUL__SFHA_MEC;
char            statemate_FH_TUERMODUL__SFHA_MEC_old;
char            statemate_FH_TUERMODUL__KL_50;
char            statemate_FH_TUERMODUL__BLOCK;
char            statemate_FH_TUERMODUL__BLOCK_copy;
char            statemate_FH_TUERMODUL__BLOCK_old;
char            statemate_FH_TUERMODUL__FT;
char            statemate_FH_TUERMODUL__SFHZ;
char            statemate_FH_TUERMODUL__SFHZ_copy;
char            statemate_FH_TUERMODUL__SFHZ_old;
char            statemate_FH_TUERMODUL__SFHA;
char            statemate_FH_TUERMODUL__SFHA_copy;
char            statemate_FH_TUERMODUL__SFHA_old;
char            statemate_FH_TUERMODUL__MFHZ;
char            statemate_FH_TUERMODUL__MFHZ_copy;
char            statemate_FH_TUERMODUL__MFHZ_old;
char            statemate_FH_TUERMODUL__MFHA;
char            statemate_FH_TUERMODUL__MFHA_copy;
char            statemate_FH_TUERMODUL__MFHA_old;
char            statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV;
char            statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV_old;
char            statemate_FH_DU__KL_50;
char            statemate_FH_DU__S_FH_FTZU;
char            statemate_FH_DU__S_FH_FTAUF;
char            statemate_FH_DU__FT;
char            statemate_FH_DU__EKS_LEISTE_AKTIV;
char            statemate_FH_DU__EKS_LEISTE_AKTIV_old;
char            statemate_FH_DU__S_FH_TMBFAUFCAN;
char            statemate_FH_DU__S_FH_TMBFAUFCAN_old;
char            statemate_FH_DU__S_FH_TMBFZUCAN;
char            statemate_FH_DU__S_FH_TMBFZUCAN_old;
char            statemate_FH_DU__S_FH_TMBFZUDISC;
char            statemate_FH_DU__S_FH_TMBFZUDISC_old;
char            statemate_FH_DU__S_FH_TMBFAUFDISC;
char            statemate_FH_DU__S_FH_TMBFAUFDISC_old;
char            statemate_FH_DU__S_FH_ZUDISC;
char            statemate_FH_DU__S_FH_AUFDISC;
char            statemate_FH_DU__DOOR_ID;
char            statemate_FH_DU__BLOCK;
char            statemate_FH_DU__BLOCK_copy;
char            statemate_FH_DU__BLOCK_old;
char            statemate_FH_DU__MFHZ;
char            statemate_FH_DU__MFHZ_copy;
char            statemate_FH_DU__MFHZ_old;
char            statemate_FH_DU__MFHA;
char            statemate_FH_DU__MFHA_copy;
char            statemate_FH_DU__MFHA_old;

unsigned long   statemate_time;
char            statemate_stable;
char            statemate_step;

char
statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state; /** 2 bits **/
char
statemate_ZENTRAL_KINDERSICHERUNG_CTRL_next_state;  /** 1 bits **/
char            statemate_MEC_KINDERSICHERUNG_CTRL_next_state;  /** 1 bits **/
char
statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state; /** 2 bits **/
char            statemate_B_FH_TUERMODUL_CTRL_next_state; /** 2 bits **/
char            statemate_A_FH_TUERMODUL_CTRL_next_state; /** 1 bits **/
char
statemate_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_next_state; /** 1 bits **/
char
statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state; /** 2 bits **/
char
statemate_TIPP_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state; /** 2 bits **/
char
statemate_MANUELL_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state;  /** 2 bits **/
char            statemate_OEFFNEN_FH_TUERMODUL_CTRL_next_state; /** 2 bits **/
char
statemate_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state;  /** 2 bits **/
char
statemate_FH_STEUERUNG_DUMMY_FH_STEUERUNG_DUMMY_next_state; /** 2 bits **/
char
statemate_EINKLEMMSCHUTZ_CTRL_EINKLEMMSCHUTZ_CTRL_next_state; /** 2 bits **/
char
statemate_BEWEGUNG_BLOCK_ERKENNUNG_CTRL_next_state; /** 2 bits **/
char
statemate_BLOCK_ERKENNUNG_CTRL_BLOCK_ERKENNUNG_CTRL_next_state; /** 2 bits **/


/*
  Initialization-related functions
*/

void statemate_init( void )
{
  statemate_tm_entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRLch_BLOCK_ERKENNUNG_CTRL__N_copy
    = 0;
  statemate_tm_entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRLexited_BEREIT_FH_TUERMODUL_CTRL
    = 0;
  statemate_tm_entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL = 0;
  statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state = 0;
  statemate_ZENTRAL_KINDERSICHERUNG_CTRL_next_state = 0;
  statemate_MEC_KINDERSICHERUNG_CTRL_next_state = 0;
  statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 0;
  statemate_B_FH_TUERMODUL_CTRL_next_state = 0;
  statemate_A_FH_TUERMODUL_CTRL_next_state = 0;
  statemate_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_next_state = 0;
  statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 0;
  statemate_TIPP_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 0;
  statemate_MANUELL_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 0;
  statemate_OEFFNEN_FH_TUERMODUL_CTRL_next_state = 0;
  statemate_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 0;
  statemate_FH_STEUERUNG_DUMMY_FH_STEUERUNG_DUMMY_next_state = 0;
  statemate_EINKLEMMSCHUTZ_CTRL_EINKLEMMSCHUTZ_CTRL_next_state = 0;
  statemate_BEWEGUNG_BLOCK_ERKENNUNG_CTRL_next_state = 0;
  statemate_BLOCK_ERKENNUNG_CTRL_BLOCK_ERKENNUNG_CTRL_next_state = 0;

  statemate_interface();
}       /** statemate_init **/


void statemate_interface( void )
{
  if ( SYS_bit_get( statemate_bitlist,
                    entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_IDX ) )
    statemate_tm_entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL = statemate_time;
  if ( SYS_bit_get( statemate_bitlist,
                    entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_IDX ) ||
       SYS_bit_get( statemate_bitlist, exited_BEREIT_FH_TUERMODUL_CTRL_IDX ) )
    statemate_tm_entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRLexited_BEREIT_FH_TUERMODUL_CTRL
      = statemate_time;
  if ( ( statemate_sc_FH_TUERMODUL_CTRL_2375_2 != 0 ) &&
       ( statemate_time - statemate_sc_FH_TUERMODUL_CTRL_2375_2 >= 500 ) ) {
    statemate_FH_TUERMODUL__MFHA_copy = 0;
    statemate_sc_FH_TUERMODUL_CTRL_2375_2 = 0;
  }
  if ( ( statemate_sc_FH_TUERMODUL_CTRL_2352_1 != 0 ) &&
       ( statemate_time - statemate_sc_FH_TUERMODUL_CTRL_2352_1 >= 500 ) ) {
    statemate_FH_TUERMODUL__MFHZ_copy = 0;
    statemate_sc_FH_TUERMODUL_CTRL_2352_1 = 0;
  }
  if ( ( statemate_sc_FH_TUERMODUL_CTRL_2329_1 != 0 ) &&
       ( statemate_time - statemate_sc_FH_TUERMODUL_CTRL_2329_1 >= 500 ) ) {
    statemate_FH_TUERMODUL__MFHZ_copy = 0;
    statemate_sc_FH_TUERMODUL_CTRL_2329_1 = 0;
  }
  if ( ( statemate_sc_FH_TUERMODUL_CTRL_1781_10 != 0 ) &&
       ( statemate_time - statemate_sc_FH_TUERMODUL_CTRL_1781_10 >= 500 ) )
    statemate_sc_FH_TUERMODUL_CTRL_1781_10 = 0;

  if ( ( statemate_sc_FH_TUERMODUL_CTRL_1739_10 != 0 ) &&
       ( statemate_time - statemate_sc_FH_TUERMODUL_CTRL_1739_10 >= 500 ) )
    statemate_sc_FH_TUERMODUL_CTRL_1739_10 = 0;

  if ( ( SYS_bit_get( statemate_bitlist,
                      entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRL_IDX ) ||
         statemate_BLOCK_ERKENNUNG_CTRL__N != statemate_BLOCK_ERKENNUNG_CTRL__N_old ) )
    statemate_tm_entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRLch_BLOCK_ERKENNUNG_CTRL__N_copy
      = statemate_time;
}       /** statemate_interface **/


/*
  Algorithm core functions
*/

void statemate_generic_KINDERSICHERUNG_CTRL( void )
{
  if ( SYS_bit_get( statemate_bitlist, active_KINDERSICHERUNG_CTRL_IDX ) ) {
    switch ( statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state ) {
      case 1: { /** state ZENTRAL in chart KINDERSICHERUNG_CTRL **/
          if ( !( statemate_FH_TUERMODUL__SFHA_ZENTRAL ||
                  statemate_FH_TUERMODUL__SFHZ_ZENTRAL ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__SFHZ_copy = 0;
            statemate_FH_TUERMODUL__SFHA_copy = 0;

            statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 3;
            statemate_ZENTRAL_KINDERSICHERUNG_CTRL_next_state = 0;
            break;
          }
          switch ( statemate_ZENTRAL_KINDERSICHERUNG_CTRL_next_state ) {
            case 1: { /** state IN_ZENTRAL in chart KINDERSICHERUNG_CTRL **/
                if ( ( statemate_FH_TUERMODUL__SFHA_ZENTRAL &&
                       !( statemate_FH_TUERMODUL__SFHA_ZENTRAL_old ) ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__SFHA_copy = 1;

                  statemate_ZENTRAL_KINDERSICHERUNG_CTRL_next_state = 1;
                  break;
                }
                if ( ( statemate_FH_TUERMODUL__SFHZ_ZENTRAL &&
                       !( statemate_FH_TUERMODUL__SFHZ_ZENTRAL_old ) ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__SFHZ_copy = 1;

                  statemate_ZENTRAL_KINDERSICHERUNG_CTRL_next_state = 1;
                  break;
                }
                if ( ( !( statemate_FH_TUERMODUL__SFHA_ZENTRAL ) &&
                       statemate_FH_TUERMODUL__SFHA_ZENTRAL_old ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__SFHA_copy = 0;

                  statemate_ZENTRAL_KINDERSICHERUNG_CTRL_next_state = 1;
                  break;
                }
                if ( ( !( statemate_FH_TUERMODUL__SFHZ_ZENTRAL ) &&
                       statemate_FH_TUERMODUL__SFHZ_ZENTRAL_old ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__SFHZ_copy = 0;

                  statemate_ZENTRAL_KINDERSICHERUNG_CTRL_next_state = 1;
                  break;
                }
                break;
              }
            default: {
                statemate_stable = 0;
                break;
              }
          } /** switch statemate_ZENTRAL_KINDERSICHERUNG_CTRL_next_state **/
          break;
        }
      case 2: { /** state MEC in chart KINDERSICHERUNG_CTRL **/
          if ( !( statemate_FH_TUERMODUL__SFHA_MEC ||
                  statemate_FH_TUERMODUL__SFHZ_MEC ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__SFHZ_copy = 0;
            statemate_FH_TUERMODUL__SFHA_copy = 0;

            statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 3;
            statemate_MEC_KINDERSICHERUNG_CTRL_next_state = 0;
            break;
          }
          switch ( statemate_MEC_KINDERSICHERUNG_CTRL_next_state ) {
            case 1: { /** state INMEC in chart KINDERSICHERUNG_CTRL **/
                if ( ( statemate_FH_TUERMODUL__SFHA_MEC &&
                       !( statemate_FH_TUERMODUL__SFHA_MEC_old ) ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__SFHA_copy = 1;

                  statemate_MEC_KINDERSICHERUNG_CTRL_next_state = 1;
                  break;
                }
                if ( ( statemate_FH_TUERMODUL__SFHZ_MEC &&
                       !( statemate_FH_TUERMODUL__SFHZ_MEC_old ) ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__SFHZ_copy = 1;

                  statemate_MEC_KINDERSICHERUNG_CTRL_next_state = 1;
                  break;
                }
                if ( ( !( statemate_FH_TUERMODUL__SFHA_MEC ) &&
                       statemate_FH_TUERMODUL__SFHA_MEC_old ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__SFHA_copy = 0;

                  statemate_MEC_KINDERSICHERUNG_CTRL_next_state = 1;
                  break;
                }
                if ( ( !( statemate_FH_TUERMODUL__SFHZ_MEC ) &&
                       statemate_FH_TUERMODUL__SFHZ_MEC_old ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__SFHZ_copy = 0;

                  statemate_MEC_KINDERSICHERUNG_CTRL_next_state = 1;
                  break;
                }
                break;
              }
            default: {
                statemate_stable = 0;
                break;
              }
          } /** switch statemate_MEC_KINDERSICHERUNG_CTRL_next_state **/
          break;
        }
      case 3: { /** state WAITING in chart KINDERSICHERUNG_CTRL **/
          if ( ( !statemate_FH_TUERMODUL__KL_50 ) && ( statemate_FH_TUERMODUL__SFHZ_MEC &&
               statemate_FH_TUERMODUL__SFHA_MEC ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__SFHZ_copy = 1;
            statemate_FH_TUERMODUL__SFHA_copy = 1;

            statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 2;
            break;
          }
          if ( ( !statemate_FH_TUERMODUL__KL_50 ) && ( statemate_FH_TUERMODUL__SFHZ_MEC &&
               !statemate_FH_TUERMODUL__SFHA_MEC ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__SFHZ_copy = 1;

            statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 2;
            break;
          }
          if ( ( !statemate_FH_TUERMODUL__KL_50 ) &&
               ( !statemate_FH_TUERMODUL__SFHZ_MEC &&
                 statemate_FH_TUERMODUL__SFHA_MEC ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__SFHA_copy = 1;

            statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 2;
            break;
          }
          if ( ( !statemate_FH_TUERMODUL__SFHZ_ZENTRAL &&
                 statemate_FH_TUERMODUL__SFHA_ZENTRAL &&
                 !statemate_FH_TUERMODUL__KL_50 ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__SFHA_copy = 1;

            statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 1;
            break;
          }
          if ( ( statemate_FH_TUERMODUL__SFHZ_ZENTRAL &&
                 statemate_FH_TUERMODUL__SFHA_ZENTRAL ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__SFHA_copy = 1;
            statemate_FH_TUERMODUL__SFHZ_copy = 1;

            statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 1;
            break;
          }
          if ( ( statemate_FH_TUERMODUL__SFHZ_ZENTRAL &&
                 !statemate_FH_TUERMODUL__SFHA_ZENTRAL &&
                 !statemate_FH_TUERMODUL__KL_50 ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__SFHZ_copy = 1;

            statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 1;
            break;
          }
          break;
        }
      default: {
          statemate_stable = 0;
          statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 3;
          break;
        }
    }   /** switch statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state **/
  }
}


void statemate_generic_FH_TUERMODUL_CTRL( void )
{
  if ( !SYS_bit_get( statemate_bitlist, active_FH_TUERMODUL_CTRL_IDX ) &&
       SYS_bit_get( statemate_bitlist, active_FH_TUERMODUL_CTRL_old_IDX ) &&
       !SYS_bit_get( statemate_bitlist, active_FH_TUERMODUL_CTRL_copy_IDX ) ) {
    SYS_bit_clr( statemate_bitlist, entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_IDX );
    SYS_bit_clr( statemate_bitlist, exited_BEREIT_FH_TUERMODUL_CTRL_IDX );
  }
  if ( SYS_bit_get( statemate_bitlist, active_FH_TUERMODUL_CTRL_IDX ) ) {
    if ( !SYS_bit_get( statemate_bitlist, active_KINDERSICHERUNG_CTRL_IDX ) )
      statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 3;
    SYS_bit_clr( statemate_bitlist, active_KINDERSICHERUNG_CTRL_copy_IDX );
    if ( !SYS_bit_get( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_IDX ) ) {
      SYS_bit_clr( statemate_bitlist,
                   entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRL_IDX );
      statemate_BLOCK_ERKENNUNG_CTRL_BLOCK_ERKENNUNG_CTRL_next_state = 1;
    }
    SYS_bit_clr( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_copy_IDX );
    SYS_bit_set( statemate_bitlist, active_KINDERSICHERUNG_CTRL_copy_IDX );
    SYS_bit_set( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_copy_IDX );
    switch ( statemate_B_FH_TUERMODUL_CTRL_next_state ) {
      case 1: { /** state ZAEHLER_WHSP_ZU_HOCH in chart FH_TUERMODUL_CTRL **/
          if ( ( statemate_FH_TUERMODUL_CTRL__N == 59 &&
                 !( statemate_FH_TUERMODUL_CTRL__N_old == 59 ) ) ) {
            statemate_stable = 0;

            statemate_B_FH_TUERMODUL_CTRL_next_state = 3;
            statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 3;
            break;
          }
          break;
        }
      case 2: { /** state NICHT_INITIALISIERT in chart FH_TUERMODUL_CTRL **/
          if ( ( ( statemate_FH_TUERMODUL__BLOCK &&
                   !( statemate_FH_TUERMODUL__BLOCK_old ) ) ) &&
               ( ( statemate_FH_TUERMODUL__MFHZ ) ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__MFHZ_copy = 0;
            statemate_sc_FH_TUERMODUL_CTRL_2329_1 = statemate_time;

            statemate_B_FH_TUERMODUL_CTRL_next_state = 3;
            statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 3;
            break;
          }
          switch ( statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state ) {
            case 1: { /** state SCHLIESSEN in chart NICHT_INITIALISIERT **/
                if ( !( statemate_FH_TUERMODUL__SFHZ ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__MFHZ_copy = 0;

                  statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state = 3;
                  break;
                }
                break;
              }
            case 2: { /** state OEFFNEN in chart NICHT_INITIALISIERT **/
                if ( !( statemate_FH_TUERMODUL__SFHA ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__MFHA_copy = 0;

                  statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state = 3;
                  break;
                }
                break;
              }
            case 3: { /** state BEREIT in chart NICHT_INITIALISIERT **/
                if ( ( statemate_FH_TUERMODUL__SFHA ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__MFHA_copy = 1;

                  statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state = 2;
                  break;
                }
                if ( ( statemate_FH_TUERMODUL__SFHZ ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__MFHZ_copy = 1;

                  statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state = 1;
                  break;
                }
                break;
              }
            default: {
                statemate_stable = 0;
                statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state = 3;
                break;
              }
          } /** switch statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state **/
          break;
        }
      case 3: { /** state INITIALISIERT in chart FH_TUERMODUL_CTRL **/
          if ( ( ( statemate_FH_TUERMODUL_CTRL__N > 60 &&
                   !( statemate_FH_TUERMODUL_CTRL__N_old > 60 ) ) ) &&
               ( ( !( statemate_FH_TUERMODUL_CTRL__INREVERS1 ||
                      statemate_FH_TUERMODUL_CTRL__INREVERS2 ) ) ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__MFHZ_copy = 0;
            statemate_FH_TUERMODUL__MFHA_copy = 0;

            statemate_B_FH_TUERMODUL_CTRL_next_state = 1;
            break;
          }
          if ( ( ( statemate_FH_TUERMODUL__BLOCK &&
                   !( statemate_FH_TUERMODUL__BLOCK_old ) ) ) &&
               ( ( statemate_FH_TUERMODUL__MFHA ) ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__MFHA_copy = 0;
            statemate_sc_FH_TUERMODUL_CTRL_2375_2 = statemate_time;

            statemate_B_FH_TUERMODUL_CTRL_next_state = 2;
            statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state = 3;
            break;
          }
          if ( ( ( statemate_FH_TUERMODUL__BLOCK &&
                   !( statemate_FH_TUERMODUL__BLOCK_old ) ) ) &&
               ( ( statemate_FH_TUERMODUL__MFHZ ) ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__MFHZ_copy = 0;
            statemate_sc_FH_TUERMODUL_CTRL_2352_1 = statemate_time;

            statemate_B_FH_TUERMODUL_CTRL_next_state = 2;
            statemate_NICHT_INITIALISIERT_NICHT_INITIALISIERT_next_state = 3;
            break;
          }
          switch ( statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state ) {
            case 1: { /** state OEFFNEN in chart FH_TUERMODUL_CTRL **/
                if ( ( statemate_FH_TUERMODUL__POSITION >= 405 ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__MFHA_copy = 0;

                  statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 3;
                  break;
                }
                switch ( statemate_OEFFNEN_FH_TUERMODUL_CTRL_next_state ) {
                  case 1: { /** state TIPP_OEFFNEN in chart FH_TUERMODUL_CTRL **/
                      if ( ( statemate_FH_TUERMODUL__SFHZ &&
                             !( statemate_FH_TUERMODUL__SFHZ_old ) ) ||
                           ( statemate_FH_TUERMODUL__SFHA && !( statemate_FH_TUERMODUL__SFHA_old ) ) ) {
                        statemate_stable = 0;
                        statemate_FH_TUERMODUL__MFHA_copy = 0;

                        statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 3;
                        statemate_OEFFNEN_FH_TUERMODUL_CTRL_next_state = 0;
                        break;
                      }
                      break;
                    }
                  case 2: { /** state MAN_OEFFNEN in chart FH_TUERMODUL_CTRL **/
                      if ( ( statemate_FH_TUERMODUL__SFHZ &&
                             !( statemate_FH_TUERMODUL__SFHZ_old ) ) ) {
                        statemate_stable = 0;

                        statemate_OEFFNEN_FH_TUERMODUL_CTRL_next_state = 1;
                        break;
                      }
                      if ( ( !( statemate_FH_TUERMODUL__SFHA ) &&
                             statemate_FH_TUERMODUL__SFHA_old ) ) {
                        statemate_stable = 0;
                        statemate_FH_TUERMODUL__MFHA_copy = 0;

                        statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 3;
                        statemate_OEFFNEN_FH_TUERMODUL_CTRL_next_state = 0;
                        break;
                      }
                      break;
                    }
                  default: {
                      statemate_stable = 0;
                      statemate_OEFFNEN_FH_TUERMODUL_CTRL_next_state = 2;
                      break;
                    }
                } /** switch statemate_OEFFNEN_FH_TUERMODUL_CTRL_next_state **/
                break;
              }
            case 2: { /** state SCHLIESSEN in chart FH_TUERMODUL_CTRL **/
                if ( ( statemate_FH_TUERMODUL__POSITION <= 0 ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__MFHZ_copy = 0;

                  statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 3;
                  break;
                }
                switch ( statemate_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state ) {
                  case 1: { /** state TIPP_SCHLIESSEN in chart FH_TUERMODUL_CTRL **/
                      if ( ( statemate_FH_TUERMODUL__SFHA &&
                             !( statemate_FH_TUERMODUL__SFHA_old ) ) ||
                           ( statemate_FH_TUERMODUL__SFHZ && !( statemate_FH_TUERMODUL__SFHZ_old ) ) ) {
                        statemate_stable = 0;
                        statemate_FH_TUERMODUL__MFHZ_copy = 0;

                        statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 3;
                        break;
                      }
                      switch ( statemate_TIPP_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state ) {
                        case 1: { /** state REVERSIEREN2 in chart FH_TUERMODUL_CTRL **/
                            SYS_bit_clr( statemate_bitlist, FH_TUERMODUL_CTRL__END_REVERS_copy_IDX );
                            if ( SYS_bit_get( statemate_bitlist, FH_TUERMODUL_CTRL__END_REVERS_IDX ) ) {
                              statemate_stable = 0;
                              statemate_FH_TUERMODUL__MFHZ_copy = 1;
                              statemate_FH_TUERMODUL_CTRL__INREVERS2_copy = 0;

                              statemate_TIPP_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 2;
                              statemate_FH_TUERMODUL__MFHA_copy = 0;

                              SYS_bit_set( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX );
                              break;
                            }
                            break;
                          }
                        case 2: { /** state TIPP_SCHLIESSEN1 in chart FH_TUERMODUL_CTRL **/
                            if ( SYS_bit_get( statemate_bitlist, FH_TUERMODUL__EINKLEMMUNG_IDX ) ) {
                              statemate_stable = 0;
                              statemate_FH_TUERMODUL_CTRL__INREVERS2_copy = 1;

                              SYS_bit_set( statemate_bitlist, FH_TUERMODUL_CTRL__END_REVERS_copy_IDX );
                              statemate_TIPP_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 1;
                              SYS_bit_clr( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX );
                              statemate_FH_TUERMODUL__MFHZ_copy = 0;

                              statemate_sc_FH_TUERMODUL_CTRL_1781_10 = statemate_time;
                              statemate_FH_TUERMODUL__MFHA_copy = 1;
                              break;
                            }
                            break;
                          }
                        default: {
                            statemate_stable = 0;
                            statemate_TIPP_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 2;
                            SYS_bit_set( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX );
                            break;
                          }
                      } /** switch statemate_TIPP_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state **/
                      break;
                    }
                  case 2: { /** state MANUELL_SCHLIESSEN in chart FH_TUERMODUL_CTRL **/
                      if ( ( !( statemate_FH_TUERMODUL__SFHZ ) &&
                             statemate_FH_TUERMODUL__SFHZ_old ) ) {
                        statemate_stable = 0;
                        statemate_FH_TUERMODUL__MFHZ_copy = 0;

                        statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 3;
                        break;
                      }
                      switch ( statemate_MANUELL_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state ) {
                        case 1: { /** state REVERSIEREN1 in chart FH_TUERMODUL_CTRL **/
                            SYS_bit_clr( statemate_bitlist, FH_TUERMODUL_CTRL__END_REVERS_copy_IDX );
                            if ( SYS_bit_get( statemate_bitlist, FH_TUERMODUL_CTRL__END_REVERS_IDX ) ) {
                              statemate_stable = 0;
                              statemate_FH_TUERMODUL_CTRL__INREVERS1_copy = 0;

                              statemate_MANUELL_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 2;
                              statemate_FH_TUERMODUL__MFHA_copy = 0;

                              SYS_bit_set( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX );
                              statemate_FH_TUERMODUL__MFHZ_copy = 1;
                              break;
                            }
                            break;
                          }
                        case 2: { /** state MAN_SCHLIESSEN in chart FH_TUERMODUL_CTRL **/
                            if ( SYS_bit_get( statemate_bitlist, FH_TUERMODUL__EINKLEMMUNG_IDX ) ) {
                              statemate_stable = 0;
                              statemate_FH_TUERMODUL__MFHZ_copy = 0;
                              statemate_FH_TUERMODUL_CTRL__INREVERS1_copy = 1;

                              SYS_bit_set( statemate_bitlist, FH_TUERMODUL_CTRL__END_REVERS_copy_IDX );
                              statemate_MANUELL_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 1;
                              SYS_bit_clr( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX );

                              statemate_sc_FH_TUERMODUL_CTRL_1739_10 = statemate_time;
                              statemate_FH_TUERMODUL__MFHA_copy = 1;
                              break;
                            }
                            if ( ( statemate_FH_TUERMODUL__SFHA &&
                                   !( statemate_FH_TUERMODUL__SFHA_old ) ) ) {
                              statemate_stable = 0;

                              statemate_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 1;
                              statemate_MANUELL_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 0;
                              break;
                            }
                            break;
                          }
                        default: {
                            statemate_stable = 0;
                            statemate_MANUELL_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 2;
                            SYS_bit_set( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX );
                            statemate_FH_TUERMODUL__MFHZ_copy = 1;
                            break;
                          }
                      } /** switch statemate_MANUELL_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state **/
                      break;
                    }
                  default: {
                      statemate_stable = 0;
                      statemate_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 2;
                      statemate_MANUELL_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 2;
                      SYS_bit_set( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX );
                      statemate_FH_TUERMODUL__MFHZ_copy = 1;
                      break;
                    }
                } /** switch statemate_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state **/
                break;
              }
            case 3: { /** state BEREIT in chart FH_TUERMODUL_CTRL **/
                if ( ( ( statemate_FH_TUERMODUL__SFHZ &&
                         !( statemate_FH_TUERMODUL__SFHZ_old ) ) ) &&
                     ( ( statemate_FH_TUERMODUL__POSITION > 0 ) ) ) {
                  statemate_stable = 0;

                  statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 2;
                  statemate_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 2;
                  statemate_MANUELL_SCHLIESSEN_FH_TUERMODUL_CTRL_next_state = 2;
                  SYS_bit_set( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX );
                  statemate_FH_TUERMODUL__MFHZ_copy = 1;
                  break;
                }
                if ( ( ( statemate_FH_TUERMODUL__SFHA &&
                         !( statemate_FH_TUERMODUL__SFHA_old ) ) ) &&
                     ( ( statemate_FH_TUERMODUL__POSITION < 405 ) ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__MFHA_copy = 1;

                  statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 1;
                  statemate_OEFFNEN_FH_TUERMODUL_CTRL_next_state = 2;
                  break;
                }
                break;
              }
            default: {
                statemate_stable = 0;
                statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state = 3;
                break;
              }
          } /** switch statemate_INITIALISIERT_FH_TUERMODUL_CTRL_next_state **/
          break;
        }
      default: {
          statemate_stable = 0;
          statemate_B_FH_TUERMODUL_CTRL_next_state = 2;
          break;
        }
    }   /** switch statemate_B_FH_TUERMODUL_CTRL_next_state **/
    switch ( statemate_A_FH_TUERMODUL_CTRL_next_state ) {
      case 1: { /** state WIEDERHOLSPERRE in chart FH_TUERMODUL_CTRL **/
          SYS_bit_clr( statemate_bitlist,
                       entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_copy_IDX );
          if ( ( statemate_step == 1 &&
                 statemate_tm_entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRLexited_BEREIT_FH_TUERMODUL_CTRL
                 != 0
                 && ( statemate_time -
                      statemate_tm_entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRLexited_BEREIT_FH_TUERMODUL_CTRL
                      ==
                      1 ) ) && ( ( statemate_FH_TUERMODUL__MFHZ ||
                                   statemate_FH_TUERMODUL__MFHA ) ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL_CTRL__N = statemate_FH_TUERMODUL_CTRL__N + 1;

            statemate_A_FH_TUERMODUL_CTRL_next_state = 1;
            SYS_bit_set( statemate_bitlist,
                         entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_copy_IDX );
            statemate_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_next_state = 1;
            break;
          }
          switch ( statemate_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_next_state ) {
            case 1: { /** state WDHSP in chart FH_TUERMODUL_CTRL **/
                if ( ( statemate_step == 1 &&
                       statemate_tm_entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL != 0 &&
                       ( statemate_time - statemate_tm_entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL ==
                         3 ) ) &&
                     ( ( ( !( statemate_FH_TUERMODUL__MFHZ || statemate_FH_TUERMODUL__MFHA ) ) &&
                         statemate_FH_TUERMODUL_CTRL__N > 0 ) ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL_CTRL__N = statemate_FH_TUERMODUL_CTRL__N - 1;

                  statemate_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_next_state = 1;
                  break;
                }
                break;
              }
            default: {
                statemate_stable = 0;
                SYS_bit_set( statemate_bitlist,
                             entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_copy_IDX );
                statemate_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_next_state = 1;
                break;
              }
          } /** switch statemate_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_next_state **/
          break;
        }
      default: {
          statemate_stable = 0;
          statemate_FH_TUERMODUL_CTRL__N = 0;
          statemate_A_FH_TUERMODUL_CTRL_next_state = 1;
          SYS_bit_set( statemate_bitlist,
                       entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_copy_IDX );
          statemate_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_next_state = 1;
          break;
        }
    }   /** switch statemate_A_FH_TUERMODUL_CTRL_next_state **/
    SYS_bit_cpy( statemate_bitlist,
                 entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_copy_IDX,
                 statemate_bitlist, entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_IDX );
    SYS_bit_cpy( statemate_bitlist, exited_BEREIT_FH_TUERMODUL_CTRL_copy_IDX,
                 statemate_bitlist,
                 exited_BEREIT_FH_TUERMODUL_CTRL_IDX );
  }
}


void statemate_generic_EINKLEMMSCHUTZ_CTRL( void )
{
  if ( SYS_bit_get( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_IDX ) ) {
    switch ( statemate_EINKLEMMSCHUTZ_CTRL_EINKLEMMSCHUTZ_CTRL_next_state ) {
      case 1: { /** state NORMALBETRIEB in chart EINKLEMMSCHUTZ_CTRL **/
          if ( ( ( statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV &&
                   !( statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV_old ) ) ) &&
               ( ( !( statemate_FH_TUERMODUL__SFHZ &&
                      statemate_FH_TUERMODUL__SFHA ) ) ) ) {
            statemate_stable = 0;

            SYS_bit_set( statemate_bitlist, FH_TUERMODUL__EINKLEMMUNG_IDX );
            statemate_EINKLEMMSCHUTZ_CTRL_EINKLEMMSCHUTZ_CTRL_next_state = 2;
            break;
          }
          break;
        }
      case 2: { /** state EINKLEMMUNG in chart EINKLEMMSCHUTZ_CTRL **/
          SYS_bit_clr( statemate_bitlist, FH_TUERMODUL__EINKLEMMUNG_IDX );
          if ( ( !( statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV ) &&
                 statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV_old ) ) {
            statemate_stable = 0;

            statemate_EINKLEMMSCHUTZ_CTRL_EINKLEMMSCHUTZ_CTRL_next_state = 1;
            break;
          }
          break;
        }
      default: {
          statemate_stable = 0;
          statemate_EINKLEMMSCHUTZ_CTRL_EINKLEMMSCHUTZ_CTRL_next_state = 1;
          break;
        }
    }   /** switch statemate_EINKLEMMSCHUTZ_CTRL_EINKLEMMSCHUTZ_CTRL_next_state **/
  }
}


void statemate_generic_BLOCK_ERKENNUNG_CTRL( void )
{
  if ( !SYS_bit_get( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_IDX ) &&
       SYS_bit_get( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_old_IDX ) &&
       !SYS_bit_get( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_copy_IDX ) )
    SYS_bit_clr( statemate_bitlist,
                 entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRL_IDX );
  if ( SYS_bit_get( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_IDX ) ) {
    switch ( statemate_BLOCK_ERKENNUNG_CTRL_BLOCK_ERKENNUNG_CTRL_next_state ) {
      case 1: { /** state KEINE_BEWEGUNG in chart BLOCK_ERKENNUNG_CTRL **/
          if ( ( statemate_FH_TUERMODUL__I_EIN != statemate_FH_TUERMODUL__I_EIN_old ) &&
               ( ( statemate_FH_TUERMODUL__I_EIN > 0 ) ) ) {
            statemate_stable = 0;
            statemate_FH_TUERMODUL__BLOCK_copy = 0;

            statemate_BLOCK_ERKENNUNG_CTRL_BLOCK_ERKENNUNG_CTRL_next_state = 2;
            statemate_BLOCK_ERKENNUNG_CTRL__N = 0;
            statemate_BLOCK_ERKENNUNG_CTRL__I_EIN_MAX = 2;
            statemate_BEWEGUNG_BLOCK_ERKENNUNG_CTRL_next_state = 3;
            SYS_bit_set( statemate_bitlist,
                         entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRL_IDX );
            break;
          }
          break;
        }
      case 2: { /** state BEWEGUNG in chart BLOCK_ERKENNUNG_CTRL **/
          if ( ( !( statemate_FH_TUERMODUL__MFHA ) &&
                 statemate_FH_TUERMODUL__MFHA_old ) ||
               ( !( statemate_FH_TUERMODUL__MFHZ ) && statemate_FH_TUERMODUL__MFHZ_old ) ) {
            statemate_stable = 0;

            statemate_BLOCK_ERKENNUNG_CTRL_BLOCK_ERKENNUNG_CTRL_next_state = 1;
            statemate_BEWEGUNG_BLOCK_ERKENNUNG_CTRL_next_state = 0;
            break;
          }
          switch ( statemate_BEWEGUNG_BLOCK_ERKENNUNG_CTRL_next_state ) {
            case 1: { /** state FENSTER_BLOCKIERT in chart BLOCK_ERKENNUNG_CTRL **/
                break;
              }
            case 2: { /** state FENSTER_BEWEGT_SICH in chart BLOCK_ERKENNUNG_CTRL **/
                if ( ( statemate_FH_TUERMODUL__I_EIN >
                       ( statemate_BLOCK_ERKENNUNG_CTRL__I_EIN_MAX - 2 ) ) ) {
                  statemate_stable = 0;
                  statemate_FH_TUERMODUL__BLOCK_copy = 1;

                  statemate_BEWEGUNG_BLOCK_ERKENNUNG_CTRL_next_state = 1;
                  break;
                }
                break;
              }
            case 3: { /** state EINSCHALTSTROM_MESSEN in chart BLOCK_ERKENNUNG_CTRL **/
                SYS_bit_clr( statemate_bitlist,
                             entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRL_IDX );
                if ( ( statemate_BLOCK_ERKENNUNG_CTRL__N == 11 &&
                       !( statemate_BLOCK_ERKENNUNG_CTRL__N_old == 11 ) ) ) {
                  statemate_stable = 0;

                  statemate_BEWEGUNG_BLOCK_ERKENNUNG_CTRL_next_state = 2;
                  break;
                }
                /** static reactions: **/
                if ( statemate_BEWEGUNG_BLOCK_ERKENNUNG_CTRL_next_state == 3 ) {
                  if ( statemate_step == 1 &&
                       statemate_tm_entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRLch_BLOCK_ERKENNUNG_CTRL__N_copy
                       != 0 && ( statemate_time -
                                 statemate_tm_entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRLch_BLOCK_ERKENNUNG_CTRL__N_copy
                                 == 2 ) ) {
                    statemate_BLOCK_ERKENNUNG_CTRL__N = statemate_BLOCK_ERKENNUNG_CTRL__N + 1;
                    if ( ( statemate_FH_TUERMODUL__I_EIN >
                           statemate_BLOCK_ERKENNUNG_CTRL__I_EIN_MAX ) )
                      statemate_BLOCK_ERKENNUNG_CTRL__I_EIN_MAX = statemate_FH_TUERMODUL__I_EIN;

                  }
                }
                /** end static reactions **/
                break;
              }
            default: {
                statemate_stable = 0;
                statemate_BLOCK_ERKENNUNG_CTRL__N = 0;
                statemate_BLOCK_ERKENNUNG_CTRL__I_EIN_MAX = 2;
                statemate_BEWEGUNG_BLOCK_ERKENNUNG_CTRL_next_state = 3;
                SYS_bit_set( statemate_bitlist,
                             entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRL_IDX );
                break;
              }
          } /** switch statemate_BEWEGUNG_BLOCK_ERKENNUNG_CTRL_next_state **/
          break;
        }
      default: {
          statemate_stable = 0;
          statemate_BLOCK_ERKENNUNG_CTRL_BLOCK_ERKENNUNG_CTRL_next_state = 1;
          break;
        }
    }   /** switch statemate_BLOCK_ERKENNUNG_CTRL_BLOCK_ERKENNUNG_CTRL_next_state **/
  }
}


void statemate_FH_DU( void )
{
  statemate_time = 1;   /**SYS_get_clock()**/
  statemate_stable = 0;
  statemate_step = 0;
  // patched for wcet: replacing while statement by for
  //while (!statemate_stable)
  int i;
  _Pragma( "loopbound min 100 max 100" )
  for ( i = 0; i < 100; i++ ) {
    statemate_stable = 1;
    statemate_step++;
    {
      switch ( statemate_FH_STEUERUNG_DUMMY_FH_STEUERUNG_DUMMY_next_state ) {
        case 1: { /** state SCHLIESSEN in chart FH_STEUERUNG_DUMMY **/
            if ( ( !( statemate_FH_DU__MFHZ ) && statemate_FH_DU__MFHZ_old ) ) {
              statemate_stable = 0;
              statemate_FH_DU__MFH = 0;

              statemate_FH_STEUERUNG_DUMMY_FH_STEUERUNG_DUMMY_next_state = 2;
              break;
            }
            break;
          }
        case 2: { /** state BEREIT in chart FH_STEUERUNG_DUMMY **/
            if ( ( statemate_FH_DU__MFHZ && !( statemate_FH_DU__MFHZ_old ) ) ) {
              statemate_stable = 0;
              statemate_FH_DU__MFH = -100;

              statemate_FH_STEUERUNG_DUMMY_FH_STEUERUNG_DUMMY_next_state = 1;
              break;
            }
            if ( ( statemate_FH_DU__MFHA && !( statemate_FH_DU__MFHA_old ) ) ) {
              statemate_stable = 0;
              statemate_FH_DU__MFH = 100;

              statemate_FH_STEUERUNG_DUMMY_FH_STEUERUNG_DUMMY_next_state = 3;
              break;
            }
            break;
          }
        case 3: { /** state OEFFNEN in chart FH_STEUERUNG_DUMMY **/
            if ( ( !( statemate_FH_DU__MFHA ) && statemate_FH_DU__MFHA_old ) ) {
              statemate_stable = 0;
              statemate_FH_DU__MFH = 0;

              statemate_FH_STEUERUNG_DUMMY_FH_STEUERUNG_DUMMY_next_state = 2;
              break;
            }
            break;
          }
        default: {
            statemate_stable = 0;
            statemate_FH_DU__MFH = 0;
            statemate_FH_STEUERUNG_DUMMY_FH_STEUERUNG_DUMMY_next_state = 2;
            break;
          }
      } /** switch statemate_FH_STEUERUNG_DUMMY_FH_STEUERUNG_DUMMY_next_state **/
    }
    {
      {
        if ( !SYS_bit_get( statemate_bitlist, active_KINDERSICHERUNG_CTRL_IDX ) )
          statemate_KINDERSICHERUNG_CTRL_KINDERSICHERUNG_CTRL_next_state = 3;
        SYS_bit_clr( statemate_bitlist, active_KINDERSICHERUNG_CTRL_copy_IDX );
        if ( !SYS_bit_get( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_IDX ) )
          statemate_EINKLEMMSCHUTZ_CTRL_EINKLEMMSCHUTZ_CTRL_next_state = 1;
        SYS_bit_clr( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX );
        if ( !SYS_bit_get( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_IDX ) ) {
          SYS_bit_clr( statemate_bitlist,
                       entered_EINSCHALTSTROM_MESSEN_BLOCK_ERKENNUNG_CTRL_IDX );
          statemate_BLOCK_ERKENNUNG_CTRL_BLOCK_ERKENNUNG_CTRL_next_state = 1;
        }
        SYS_bit_clr( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_copy_IDX );
        if ( !SYS_bit_get( statemate_bitlist, active_FH_TUERMODUL_CTRL_IDX ) ) {
          SYS_bit_clr( statemate_bitlist, entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_IDX );
          SYS_bit_clr( statemate_bitlist, exited_BEREIT_FH_TUERMODUL_CTRL_IDX );
          statemate_B_FH_TUERMODUL_CTRL_next_state = 2;
          statemate_FH_TUERMODUL_CTRL__N = 0;
          statemate_A_FH_TUERMODUL_CTRL_next_state = 1;
          SYS_bit_set( statemate_bitlist,
                       entered_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_copy_IDX );
          statemate_WIEDERHOLSPERRE_FH_TUERMODUL_CTRL_next_state = 1;
        }
        SYS_bit_clr( statemate_bitlist, active_FH_TUERMODUL_CTRL_copy_IDX );
        SYS_bit_set( statemate_bitlist, active_KINDERSICHERUNG_CTRL_copy_IDX );
        SYS_bit_set( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX );
        SYS_bit_set( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_copy_IDX );
        SYS_bit_set( statemate_bitlist, active_FH_TUERMODUL_CTRL_copy_IDX );
        /** static reactions: **/
        if ( statemate_FH_DU__S_FH_TMBFZUCAN != statemate_FH_DU__S_FH_TMBFZUCAN_old ) {
          if ( ( !statemate_FH_DU__DOOR_ID ) )
            statemate_FH_DU__S_FH_FTZU = statemate_FH_DU__S_FH_TMBFZUCAN;

        }
        if ( statemate_FH_DU__S_FH_TMBFZUDISC !=
             statemate_FH_DU__S_FH_TMBFZUDISC_old ) {
          if ( statemate_FH_DU__DOOR_ID )
            statemate_FH_DU__S_FH_TMBFZUCAN = statemate_FH_DU__S_FH_TMBFZUDISC;

        }
        if ( statemate_FH_DU__S_FH_TMBFAUFCAN !=
             statemate_FH_DU__S_FH_TMBFAUFCAN_old ) {
          if ( ( !statemate_FH_DU__DOOR_ID ) )
            statemate_FH_DU__S_FH_FTAUF = statemate_FH_DU__S_FH_TMBFAUFCAN;

        }
        if ( statemate_FH_DU__S_FH_TMBFAUFDISC !=
             statemate_FH_DU__S_FH_TMBFAUFDISC_old ) {
          if ( statemate_FH_DU__DOOR_ID )
            statemate_FH_DU__S_FH_TMBFAUFCAN = statemate_FH_DU__S_FH_TMBFAUFDISC;

        }
        /** end static reactions **/
      }
    }
    SYS_bit_cpy( statemate_bitlist, active_KINDERSICHERUNG_CTRL_IDX,
                 statemate_bitlist,
                 active_KINDERSICHERUNG_CTRL_old_IDX );
    SYS_bit_cpy( statemate_bitlist, active_FH_TUERMODUL_CTRL_IDX, statemate_bitlist,
                 active_FH_TUERMODUL_CTRL_old_IDX );
    SYS_bit_cpy( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_IDX,
                 statemate_bitlist,
                 active_EINKLEMMSCHUTZ_CTRL_old_IDX );
    SYS_bit_cpy( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_IDX,
                 statemate_bitlist,
                 active_BLOCK_ERKENNUNG_CTRL_old_IDX );
    statemate_FH_TUERMODUL__SFHA_MEC = statemate_FH_DU__S_FH_AUFDISC;
    statemate_FH_TUERMODUL__SFHA_ZENTRAL = statemate_FH_DU__S_FH_FTAUF;
    statemate_FH_TUERMODUL__SFHZ_MEC = statemate_FH_DU__S_FH_ZUDISC;
    statemate_FH_TUERMODUL__SFHZ_ZENTRAL = statemate_FH_DU__S_FH_FTZU;

    statemate_generic_KINDERSICHERUNG_CTRL();

    statemate_FH_DU__MFHA = statemate_FH_TUERMODUL__MFHA;
    statemate_FH_DU__MFHZ = statemate_FH_TUERMODUL__MFHZ;
    statemate_FH_DU__I_EIN = statemate_FH_TUERMODUL__I_EIN;
    statemate_FH_DU__EKS_LEISTE_AKTIV = statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV;
    statemate_FH_DU__POSITION = statemate_FH_TUERMODUL__POSITION;
    statemate_FH_DU__FT = statemate_FH_TUERMODUL__FT;
    statemate_FH_DU__S_FH_AUFDISC = statemate_FH_TUERMODUL__SFHA_MEC;
    statemate_FH_DU__S_FH_FTAUF = statemate_FH_TUERMODUL__SFHA_ZENTRAL;
    statemate_FH_DU__S_FH_ZUDISC = statemate_FH_TUERMODUL__SFHZ_MEC;
    statemate_FH_DU__S_FH_FTZU = statemate_FH_TUERMODUL__SFHZ_ZENTRAL;
    statemate_FH_DU__KL_50 = statemate_FH_TUERMODUL__KL_50;
    statemate_FH_DU__BLOCK = statemate_FH_TUERMODUL__BLOCK;

    statemate_FH_TUERMODUL__SFHA_MEC = statemate_FH_DU__S_FH_AUFDISC;
    statemate_FH_TUERMODUL__SFHA_ZENTRAL = statemate_FH_DU__S_FH_FTAUF;
    statemate_FH_TUERMODUL__SFHZ_MEC = statemate_FH_DU__S_FH_ZUDISC;
    statemate_FH_TUERMODUL__SFHZ_ZENTRAL = statemate_FH_DU__S_FH_FTZU;

    statemate_generic_FH_TUERMODUL_CTRL();

    statemate_FH_DU__MFHA = statemate_FH_TUERMODUL__MFHA;
    statemate_FH_DU__MFHZ = statemate_FH_TUERMODUL__MFHZ;
    statemate_FH_DU__I_EIN = statemate_FH_TUERMODUL__I_EIN;
    statemate_FH_DU__EKS_LEISTE_AKTIV = statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV;
    statemate_FH_DU__POSITION = statemate_FH_TUERMODUL__POSITION;
    statemate_FH_DU__FT = statemate_FH_TUERMODUL__FT;
    statemate_FH_DU__S_FH_AUFDISC = statemate_FH_TUERMODUL__SFHA_MEC;
    statemate_FH_DU__S_FH_FTAUF = statemate_FH_TUERMODUL__SFHA_ZENTRAL;
    statemate_FH_DU__S_FH_ZUDISC = statemate_FH_TUERMODUL__SFHZ_MEC;
    statemate_FH_DU__S_FH_FTZU = statemate_FH_TUERMODUL__SFHZ_ZENTRAL;
    statemate_FH_DU__KL_50 = statemate_FH_TUERMODUL__KL_50;
    statemate_FH_DU__BLOCK = statemate_FH_TUERMODUL__BLOCK;

    statemate_FH_TUERMODUL__SFHA_MEC = statemate_FH_DU__S_FH_AUFDISC;
    statemate_FH_TUERMODUL__SFHA_ZENTRAL = statemate_FH_DU__S_FH_FTAUF;
    statemate_FH_TUERMODUL__SFHZ_MEC = statemate_FH_DU__S_FH_ZUDISC;
    statemate_FH_TUERMODUL__SFHZ_ZENTRAL = statemate_FH_DU__S_FH_FTZU;

    statemate_generic_EINKLEMMSCHUTZ_CTRL();

    statemate_FH_DU__MFHA = statemate_FH_TUERMODUL__MFHA;
    statemate_FH_DU__MFHZ = statemate_FH_TUERMODUL__MFHZ;
    statemate_FH_DU__I_EIN = statemate_FH_TUERMODUL__I_EIN;
    statemate_FH_DU__EKS_LEISTE_AKTIV = statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV;
    statemate_FH_DU__POSITION = statemate_FH_TUERMODUL__POSITION;
    statemate_FH_DU__FT = statemate_FH_TUERMODUL__FT;
    statemate_FH_DU__S_FH_AUFDISC = statemate_FH_TUERMODUL__SFHA_MEC;
    statemate_FH_DU__S_FH_FTAUF = statemate_FH_TUERMODUL__SFHA_ZENTRAL;
    statemate_FH_DU__S_FH_ZUDISC = statemate_FH_TUERMODUL__SFHZ_MEC;
    statemate_FH_DU__S_FH_FTZU = statemate_FH_TUERMODUL__SFHZ_ZENTRAL;
    statemate_FH_DU__KL_50 = statemate_FH_TUERMODUL__KL_50;
    statemate_FH_DU__BLOCK = statemate_FH_TUERMODUL__BLOCK;

    statemate_FH_TUERMODUL__SFHA_MEC = statemate_FH_DU__S_FH_AUFDISC;
    statemate_FH_TUERMODUL__SFHA_ZENTRAL = statemate_FH_DU__S_FH_FTAUF;
    statemate_FH_TUERMODUL__SFHZ_MEC = statemate_FH_DU__S_FH_ZUDISC;
    statemate_FH_TUERMODUL__SFHZ_ZENTRAL = statemate_FH_DU__S_FH_FTZU;

    statemate_generic_BLOCK_ERKENNUNG_CTRL();

    statemate_FH_DU__MFHA = statemate_FH_TUERMODUL__MFHA;
    statemate_FH_DU__MFHZ = statemate_FH_TUERMODUL__MFHZ;
    statemate_FH_DU__I_EIN = statemate_FH_TUERMODUL__I_EIN;
    statemate_FH_DU__EKS_LEISTE_AKTIV = statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV;
    statemate_FH_DU__POSITION = statemate_FH_TUERMODUL__POSITION;
    statemate_FH_DU__FT = statemate_FH_TUERMODUL__FT;
    statemate_FH_DU__S_FH_AUFDISC = statemate_FH_TUERMODUL__SFHA_MEC;
    statemate_FH_DU__S_FH_FTAUF = statemate_FH_TUERMODUL__SFHA_ZENTRAL;
    statemate_FH_DU__S_FH_ZUDISC = statemate_FH_TUERMODUL__SFHZ_MEC;
    statemate_FH_DU__S_FH_FTZU = statemate_FH_TUERMODUL__SFHZ_ZENTRAL;
    statemate_FH_DU__KL_50 = statemate_FH_TUERMODUL__KL_50;
    statemate_FH_DU__BLOCK = statemate_FH_TUERMODUL__BLOCK;

    SYS_bit_cpy( statemate_bitlist, active_KINDERSICHERUNG_CTRL_copy_IDX,
                 statemate_bitlist,
                 active_KINDERSICHERUNG_CTRL_IDX );
    SYS_bit_cpy( statemate_bitlist, active_FH_TUERMODUL_CTRL_copy_IDX,
                 statemate_bitlist,
                 active_FH_TUERMODUL_CTRL_IDX );
    SYS_bit_cpy( statemate_bitlist, active_EINKLEMMSCHUTZ_CTRL_copy_IDX,
                 statemate_bitlist,
                 active_EINKLEMMSCHUTZ_CTRL_IDX );
    SYS_bit_cpy( statemate_bitlist, active_BLOCK_ERKENNUNG_CTRL_copy_IDX,
                 statemate_bitlist,
                 active_BLOCK_ERKENNUNG_CTRL_IDX );
    statemate_FH_TUERMODUL_CTRL__N_old = statemate_FH_TUERMODUL_CTRL__N;
    statemate_FH_TUERMODUL__I_EIN_old = statemate_FH_TUERMODUL__I_EIN;
    statemate_FH_DU__MFH = statemate_FH_DU__MFH_copy;
    statemate_FH_DU__I_EIN_old = statemate_FH_DU__I_EIN;
    statemate_BLOCK_ERKENNUNG_CTRL__N_old = statemate_BLOCK_ERKENNUNG_CTRL__N;
    statemate_FH_TUERMODUL__SFHZ_ZENTRAL_old = statemate_FH_TUERMODUL__SFHZ_ZENTRAL;
    statemate_FH_TUERMODUL__SFHZ_MEC_old = statemate_FH_TUERMODUL__SFHZ_MEC;
    statemate_FH_TUERMODUL__SFHA_ZENTRAL_old = statemate_FH_TUERMODUL__SFHA_ZENTRAL;
    statemate_FH_TUERMODUL__SFHA_MEC_old = statemate_FH_TUERMODUL__SFHA_MEC;
    statemate_FH_TUERMODUL__BLOCK = statemate_FH_TUERMODUL__BLOCK_copy;
    statemate_FH_TUERMODUL__BLOCK_old = statemate_FH_TUERMODUL__BLOCK;
    statemate_FH_TUERMODUL__SFHZ = statemate_FH_TUERMODUL__SFHZ_copy;
    statemate_FH_TUERMODUL__SFHZ_old = statemate_FH_TUERMODUL__SFHZ;
    statemate_FH_TUERMODUL__SFHA = statemate_FH_TUERMODUL__SFHA_copy;
    statemate_FH_TUERMODUL__SFHA_old = statemate_FH_TUERMODUL__SFHA;
    statemate_FH_TUERMODUL__MFHZ = statemate_FH_TUERMODUL__MFHZ_copy;
    statemate_FH_TUERMODUL__MFHZ_old = statemate_FH_TUERMODUL__MFHZ;
    statemate_FH_TUERMODUL__MFHA = statemate_FH_TUERMODUL__MFHA_copy;
    statemate_FH_TUERMODUL__MFHA_old = statemate_FH_TUERMODUL__MFHA;
    statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV_old =
      statemate_FH_TUERMODUL__EKS_LEISTE_AKTIV;
    statemate_FH_DU__EKS_LEISTE_AKTIV_old = statemate_FH_DU__EKS_LEISTE_AKTIV;
    statemate_FH_DU__S_FH_TMBFAUFCAN_old = statemate_FH_DU__S_FH_TMBFAUFCAN;
    statemate_FH_DU__S_FH_TMBFZUCAN_old = statemate_FH_DU__S_FH_TMBFZUCAN;
    statemate_FH_DU__S_FH_TMBFZUDISC_old = statemate_FH_DU__S_FH_TMBFZUDISC;
    statemate_FH_DU__S_FH_TMBFAUFDISC_old = statemate_FH_DU__S_FH_TMBFAUFDISC;
    statemate_FH_DU__BLOCK = statemate_FH_DU__BLOCK_copy;
    statemate_FH_DU__BLOCK_old = statemate_FH_DU__BLOCK;
    statemate_FH_DU__MFHZ = statemate_FH_DU__MFHZ_copy;
    statemate_FH_DU__MFHZ_old = statemate_FH_DU__MFHZ;
    statemate_FH_DU__MFHA = statemate_FH_DU__MFHA_copy;
    statemate_FH_DU__MFHA_old = statemate_FH_DU__MFHA;

  }     /** while(!statemate_stable) **/

}       /** statemate_FH_DU **/


/*
  Main functions
*/

int statemate_return()
{
  unsigned long int checksum = 0;
  int index;
  _Pragma( "loopbound min 64 max 64" )
  for ( index = 63 ; index >= 0 ; index-- )
    checksum += ( unsigned long ) ( statemate_bitlist[ index ] ) << index;
  return ( checksum != 32ul );
}

void _Pragma ( "entrypoint" ) statemate_main( void )
{
  statemate_FH_DU();
}


int main ( void )
{
  statemate_init();
  statemate_main();

  return statemate_return();
}
