// tries to use all features

#define bool _Bool

// output states
bool state0 = 0;
bool state1 = 1;
bool state2 = 0;

// input variables
bool a0, a1, a2;

// case expressions
char case_in;
char new_case;

// for loop variables
int i;
int j;

// function prototypes

void f0();
void f1();
void interrupt();
extern void _user();


void main() {

while(1) {

if (a0 == a1) {
   f0();
   state0 = 1, state1 = 0;
   _user(0);
}

do { switch (case_in) {
   case 0: { f1(); continue; }
   case 1: { f0(); continue; }
   case 2: { state0 = 1, state1 = 0; continue; }
   case 3: {switch (new_case) {
            case 0: {state1 = 0; continue; }
            default: {break;}
           }
           }
   default:{ break;}
   }
  _user(1);
}
while (a2);

while((a1)) {
  for(i = 0; i<500; i++) state0 = 1;
  if (a0 == 1) {continue;} 
}
}
}

void f0() {
state0 = 1, state1 = 0;
interrupt();
return;
}

void f1() {
state1 = 0, state1 = 1;
f0();
return;
}

void interrupt() {
state0 = 0, state1 = 0;
return;
}
