int32 count
bool32 gate
bool32 def1
bool32 def2
bool32 def3
bool32 def4
int32 count
bool32 gate
bool32 1
bool32 2
bool32 3
bool32 4
frac32.u.map white
frac32.u.map light
frac32.u.map dark
frac32.u.map black
int2x16 1
int2x16 2
int2x16 3
int2x16 4
int select[4];
int gate[4];
int prev;
select[0] = param_white;
select[1] = param_light;
select[2] = param_dark;
select[3] = param_black;
int32_t count = inlet_count;
outlet_count = count - 16;
if ((count >= 0) && (count < 16)) {
if (!(count == prev)) {
gate[0] = select[param_1 >> (inlet_count << 1) & 3] >
((int32_t)(GenerateRandomNumber() >> 5))
? 1
: 0;
gate[1] = select[param_2 >> (inlet_count << 1) & 3] >
((int32_t)(GenerateRandomNumber() >> 5))
? 1
: 0;
gate[2] = select[param_3 >> (inlet_count << 1) & 3] >
((int32_t)(GenerateRandomNumber() >> 5))
? 1
: 0;
gate[3] = select[param_4 >> (inlet_count << 1) & 3] >
((int32_t)(GenerateRandomNumber() >> 5))
? 1
: 0;
}
outlet_1 = (gate[0] && inlet_gate) || inlet_def1;
outlet_2 = (gate[1] && inlet_gate) || inlet_def2;
outlet_3 = (gate[2] && inlet_gate) || inlet_def3;
outlet_4 = (gate[3] && inlet_gate) || inlet_def4;
} else {
outlet_1 = inlet_def1;
outlet_2 = inlet_def2;
outlet_3 = inlet_def3;
outlet_4 = inlet_def4;
}
prev = count;
outlet_gate = inlet_gate;