bool32.rising i0
bool32.rising i1
bool32.rising i2
bool32.rising i3
int32.positive o0
int ntrig0;
int latch;
int ntrig1;
int ntrig2;
int ntrig3;
if ((inlet_i0 > 0) && !ntrig0) {
latch = 0;
}
if (!(inlet_i0 > 0))
ntrig0 = 0;
if ((inlet_i1 > 0) && !ntrig1) {
latch = 1;
}
if (!(inlet_i1 > 0))
ntrig1 = 0;
if ((inlet_i2 > 0) && !ntrig2) {
latch = 2;
}
if (!(inlet_i2 > 0))
ntrig2 = 0;
if ((inlet_i3 > 0) && !ntrig3) {
latch = 3;
}
if (!(inlet_i3 > 0))
ntrig3 = 0;
outlet_o0 = latch;