# -*- generated by 1.0.9b3 -*-
import da
PatternExpr_384 = da.pat.TuplePattern([da.pat.ConstantPattern('done')])
PatternExpr_404 = da.pat.TuplePattern([da.pat.ConstantPattern('request'), da.pat.FreePattern('p')])
PatternExpr_421 = da.pat.TuplePattern([da.pat.ConstantPattern('decision'), da.pat.FreePattern('s'), da.pat.FreePattern('p')])
PatternExpr_389 = da.pat.TuplePattern([da.pat.FreePattern(None), da.pat.TuplePattern([da.pat.FreePattern(None), da.pat.FreePattern(None), da.pat.FreePattern(None)]), da.pat.TuplePattern([da.pat.ConstantPattern('done')])])
PatternExpr_501 = da.pat.TuplePattern([da.pat.ConstantPattern('done')])
PatternExpr_521 = da.pat.FreePattern('m')
PatternExpr_539 = da.pat.TuplePattern([da.pat.ConstantPattern('p1a'), da.pat.FreePattern(None), da.pat.FreePattern('b')])
PatternExpr_563 = da.pat.TuplePattern([da.pat.ConstantPattern('p2a'), da.pat.FreePattern(None), da.pat.FreePattern('b'), da.pat.FreePattern(None), da.pat.FreePattern(None)])
PatternExpr_594 = da.pat.TuplePattern([da.pat.ConstantPattern('p1a'), da.pat.FreePattern('leader_scout'), da.pat.FreePattern('b')])
PatternExpr_618 = da.pat.TuplePattern([da.pat.ConstantPattern('p2a'), da.pat.FreePattern('leader_commander'), da.pat.FreePattern('b'), da.pat.FreePattern('s'), da.pat.FreePattern('p')])
PatternExpr_506 = da.pat.TuplePattern([da.pat.FreePattern(None), da.pat.TuplePattern([da.pat.FreePattern(None), da.pat.FreePattern(None), da.pat.FreePattern(None)]), da.pat.TuplePattern([da.pat.ConstantPattern('done')])])
PatternExpr_694 = da.pat.TuplePattern([da.pat.ConstantPattern('p2b'), da.pat.FreePattern('a'), da.pat.BoundPattern('_BoundPattern699_')])
PatternExpr_730 = da.pat.TuplePattern([da.pat.ConstantPattern('p2b'), da.pat.FreePattern(None), da.pat.FreePattern('b1')])
PatternExpr_804 = da.pat.TuplePattern([da.pat.ConstantPattern('p1b'), da.pat.FreePattern('a'), da.pat.BoundPattern('_BoundPattern809_'), da.pat.FreePattern(None)])
PatternExpr_836 = da.pat.TuplePattern([da.pat.ConstantPattern('p1b'), da.pat.FreePattern(None), da.pat.BoundPattern('_BoundPattern840_'), da.pat.FreePattern('r')])
PatternExpr_875 = da.pat.TuplePattern([da.pat.ConstantPattern('p1b'), da.pat.FreePattern('a'), da.pat.FreePattern('b1'), da.pat.FreePattern(None)])
PatternExpr_966 = da.pat.TuplePattern([da.pat.ConstantPattern('done')])
PatternExpr_986 = da.pat.TuplePattern([da.pat.ConstantPattern('propose'), da.pat.FreePattern('s'), da.pat.FreePattern('p')])
PatternExpr_1038 = da.pat.TuplePattern([da.pat.ConstantPattern('adopted'), da.pat.FreePattern('ballot_num'), da.pat.FreePattern('pvals')])
PatternExpr_1090 = da.pat.TuplePattern([da.pat.ConstantPattern('preempted'), da.pat.TuplePattern([da.pat.FreePattern('r1'), da.pat.FreePattern('leader1')])])
PatternExpr_971 = da.pat.TuplePattern([da.pat.FreePattern(None), da.pat.TuplePattern([da.pat.FreePattern(None), da.pat.FreePattern(None), da.pat.FreePattern(None)]), da.pat.TuplePattern([da.pat.ConstantPattern('done')])])
PatternExpr_1281 = da.pat.TuplePattern([da.pat.ConstantPattern('response'), da.pat.FreePattern('cid'), da.pat.FreePattern('result')])
PatternExpr_1482 = da.pat.TuplePattern([da.pat.ConstantPattern('done')])
PatternExpr_1487 = da.pat.BoundPattern('_BoundPattern1488_')
PatternExpr_1489 = da.pat.TuplePattern([da.pat.FreePattern(None), da.pat.TuplePattern([da.pat.FreePattern(None), da.pat.FreePattern(None), da.pat.BoundPattern('_BoundPattern1495_')]), da.pat.TuplePattern([da.pat.ConstantPattern('done')])])
_config_object = {}
import sys
import time
import random
NOPS = 10

def operation(i):
    return (lambda state: ((state + [i]), ['result', i, 'on', state]))
operations = {i: operation(i) for i in range(NOPS)}

class Replica(da.DistProcess):

    def __init__(self, procimpl, props):
        super().__init__(procimpl, props)
        self._ReplicaReceivedEvent_0 = []
        self._events.extend([da.pat.EventPattern(da.pat.ReceivedEvent, '_ReplicaReceivedEvent_0', PatternExpr_384, sources=None, destinations=None, timestamps=None, record_history=True, handlers=[]), da.pat.EventPattern(da.pat.ReceivedEvent, '_ReplicaReceivedEvent_1', PatternExpr_404, sources=None, destinations=None, timestamps=None, record_history=None, handlers=[self._Replica_handler_403]), da.pat.EventPattern(da.pat.ReceivedEvent, '_ReplicaReceivedEvent_2', PatternExpr_421, sources=None, destinations=None, timestamps=None, record_history=None, handlers=[self._Replica_handler_420])])

    def setup(self, leaders, initial_state, **rest_1510):
        super().setup(leaders=leaders, initial_state=initial_state, **rest_1510)
        self._state.leaders = leaders
        self._state.initial_state = initial_state
        self._state.state = self._state.initial_state
        self._state.slot_num = 1
        self._state.proposals = set()
        self._state.decisions = set()

    def run(self):
        self.debug('### start')
        super()._label('_st_label_381', block=False)
        _st_label_381 = 0
        while (_st_label_381 == 0):
            _st_label_381 += 1
            if PatternExpr_389.match_iter(self._ReplicaReceivedEvent_0, SELF_ID=self._id):
                _st_label_381 += 1
            else:
                super()._label('_st_label_381', block=True)
                _st_label_381 -= 1
        self.output('terminating')

    def propose(self, p):

        def ExistentialOpExpr_243():
            for (_, _BoundPattern247_) in self._state.decisions:
                if (_BoundPattern247_ == p):
                    if True:
                        return True
            return False
        if (not ExistentialOpExpr_243()):
            maxs = max(({s for (s, _) in (self._state.proposals | self._state.decisions)} or {0}))

            def ExistentialOpExpr_285(s):
                for (_BoundPattern288_, _) in (self._state.proposals | self._state.decisions):
                    if (_BoundPattern288_ == s):
                        if True:
                            return True
                return False
            s1 = min({s for s in range(1, ((maxs + 1) + 1)) if (not ExistentialOpExpr_285(s=s))})
            self._state.proposals.add((s1, p))
            self.send(('propose', s1, p), to=self._state.leaders)

    def perform(self, p):
        self.debug('### perform', p)
        (client, cid, op) = p
        s = None

        def ExistentialOpExpr_329():
            nonlocal s
            for (s, _BoundPattern334_) in self._state.decisions:
                if (_BoundPattern334_ == p):
                    if (s < self._state.slot_num):
                        return True
            return False
        if ExistentialOpExpr_329():
            self._state.slot_num += 1
        else:
            self.debug('===', self._state.state, op)
            (next, result) = operations[op](self._state.state)
            self.debug('===', next, result)
            self._state.state = next
            self._state.slot_num += 1
            self.send(('response', cid, result), to=client)

    def _Replica_handler_403(self, p):
        self.debug('### request', p)
        self.propose(p)
    _Replica_handler_403._labels = None
    _Replica_handler_403._notlabels = None

    def _Replica_handler_420(self, s, p):
        self.debug('### decision', s, p)
        self._state.decisions.add((s, p))
        p1 = None

        def ExistentialOpExpr_443():
            nonlocal p1
            for (_BoundPattern446_, p1) in self._state.decisions:
                if (_BoundPattern446_ == self._state.slot_num):
                    if True:
                        return True
            return False
        while ExistentialOpExpr_443():
            p2 = None

            def ExistentialOpExpr_453():
                nonlocal p2
                for (_BoundPattern456_, p2) in self._state.proposals:
                    if (_BoundPattern456_ == self._state.slot_num):
                        if (not (p2 == p1)):
                            return True
                return False
            if ExistentialOpExpr_453():
                self.propose(p2)
            self.perform(p1)
    _Replica_handler_420._labels = None
    _Replica_handler_420._notlabels = None

class Acceptor(da.DistProcess):

    def __init__(self, procimpl, props):
        super().__init__(procimpl, props)
        self._AcceptorReceivedEvent_0 = []
        self._AcceptorReceivedEvent_2 = []
        self._AcceptorReceivedEvent_3 = []
        self._events.extend([da.pat.EventPattern(da.pat.ReceivedEvent, '_AcceptorReceivedEvent_0', PatternExpr_501, sources=None, destinations=None, timestamps=None, record_history=True, handlers=[]), da.pat.EventPattern(da.pat.ReceivedEvent, '_AcceptorReceivedEvent_1', PatternExpr_521, sources=None, destinations=None, timestamps=None, record_history=None, handlers=[self._Acceptor_handler_520]), da.pat.EventPattern(da.pat.ReceivedEvent, '_AcceptorReceivedEvent_2', PatternExpr_539, sources=None, destinations=None, timestamps=None, record_history=True, handlers=[]), da.pat.EventPattern(da.pat.ReceivedEvent, '_AcceptorReceivedEvent_3', PatternExpr_563, sources=None, destinations=None, timestamps=None, record_history=True, handlers=[]), da.pat.EventPattern(da.pat.ReceivedEvent, '_AcceptorReceivedEvent_4', PatternExpr_594, sources=None, destinations=None, timestamps=None, record_history=None, handlers=[self._Acceptor_handler_593]), da.pat.EventPattern(da.pat.ReceivedEvent, '_AcceptorReceivedEvent_5', PatternExpr_618, sources=None, destinations=None, timestamps=None, record_history=None, handlers=[self._Acceptor_handler_617])])

    def setup(self, **rest_1510):
        super().setup(**rest_1510)
        self._state.ballot_num = None
        self._state.accepted = set()

    def run(self):
        self.debug('### start')
        super()._label('_st_label_498', block=False)
        _st_label_498 = 0
        while (_st_label_498 == 0):
            _st_label_498 += 1
            if PatternExpr_506.match_iter(self._AcceptorReceivedEvent_0, SELF_ID=self._id):
                _st_label_498 += 1
            else:
                super()._label('_st_label_498', block=True)
                _st_label_498 -= 1
        self.output('terminating')

    def _Acceptor_handler_520(self, m):
        BOTTOM = ((- 1), (- 1))
        self._state.ballot_num = max((({b for (_, _, (_ConstantPattern555_, _, b)) in self._AcceptorReceivedEvent_2 if (_ConstantPattern555_ == 'p1a')} | {b for (_, _, (_ConstantPattern581_, _, b, _, _)) in self._AcceptorReceivedEvent_3 if (_ConstantPattern581_ == 'p2a')}) or {BOTTOM}))
    _Acceptor_handler_520._labels = None
    _Acceptor_handler_520._notlabels = None

    def _Acceptor_handler_593(self, leader_scout, b):
        self.debug('### p1a', leader_scout, b)
        self.send(('p1b', self._id, self._state.ballot_num, self._state.accepted), to=leader_scout)
    _Acceptor_handler_593._labels = None
    _Acceptor_handler_593._notlabels = None

    def _Acceptor_handler_617(self, leader_commander, b, s, p):
        self.debug('### p2a', leader_commander, b, s, p)
        if (b == self._state.ballot_num):
            self._state.accepted.add((b, s, p))
        self.send(('p2b', self._id, self._state.ballot_num), to=leader_commander)
    _Acceptor_handler_617._labels = None
    _Acceptor_handler_617._notlabels = None

class Commander(da.DistProcess):

    def __init__(self, procimpl, props):
        super().__init__(procimpl, props)
        self._CommanderReceivedEvent_0 = []
        self._CommanderReceivedEvent_1 = []
        self._events.extend([da.pat.EventPattern(da.pat.ReceivedEvent, '_CommanderReceivedEvent_0', PatternExpr_694, sources=None, destinations=None, timestamps=None, record_history=True, handlers=[]), da.pat.EventPattern(da.pat.ReceivedEvent, '_CommanderReceivedEvent_1', PatternExpr_730, sources=None, destinations=None, timestamps=None, record_history=True, handlers=[])])

    def setup(self, leader, acceptors, replicas, b, s, p, **rest_1510):
        super().setup(leader=leader, acceptors=acceptors, replicas=replicas, b=b, s=s, p=p, **rest_1510)
        self._state.leader = leader
        self._state.acceptors = acceptors
        self._state.replicas = replicas
        self._state.b = b
        self._state.s = s
        self._state.p = p
        pass

    def run(self):
        self.debug('### start')
        self.send(('p2a', self._id, self._state.b, self._state.s, self._state.p), to=self._state.acceptors)
        super()._label('_st_label_689', block=False)
        b1 = None

        def ExistentialOpExpr_728():
            nonlocal b1
            for (_, _, (_ConstantPattern746_, _, b1)) in self._CommanderReceivedEvent_1:
                if (_ConstantPattern746_ == 'p2b'):
                    if (not (b1 == self._state.b)):
                        return True
            return False
        _st_label_689 = 0
        while (_st_label_689 == 0):
            _st_label_689 += 1
            if (len({a for (_, _, (_ConstantPattern710_, a, _BoundPattern713_)) in self._CommanderReceivedEvent_0 if (_ConstantPattern710_ == 'p2b') if (_BoundPattern713_ == self._state.b)}) > (len(self._state.acceptors) / 2)):
                self.send(('decision', self._state.s, self._state.p), to=self._state.replicas)
                _st_label_689 += 1
            elif ExistentialOpExpr_728():
                self.send(('preempted', b1), to=self._state.leader)
                _st_label_689 += 1
            else:
                super()._label('_st_label_689', block=True)
                _st_label_689 -= 1

class Scout(da.DistProcess):

    def __init__(self, procimpl, props):
        super().__init__(procimpl, props)
        self._ScoutReceivedEvent_0 = []
        self._ScoutReceivedEvent_1 = []
        self._ScoutReceivedEvent_2 = []
        self._events.extend([da.pat.EventPattern(da.pat.ReceivedEvent, '_ScoutReceivedEvent_0', PatternExpr_804, sources=None, destinations=None, timestamps=None, record_history=True, handlers=[]), da.pat.EventPattern(da.pat.ReceivedEvent, '_ScoutReceivedEvent_1', PatternExpr_836, sources=None, destinations=None, timestamps=None, record_history=True, handlers=[]), da.pat.EventPattern(da.pat.ReceivedEvent, '_ScoutReceivedEvent_2', PatternExpr_875, sources=None, destinations=None, timestamps=None, record_history=True, handlers=[])])

    def setup(self, leader, acceptors, b, **rest_1510):
        super().setup(leader=leader, acceptors=acceptors, b=b, **rest_1510)
        self._state.leader = leader
        self._state.acceptors = acceptors
        self._state.b = b
        self._state.pvalues = set()

    def run(self):
        self.debug('### start')
        time.sleep(random.random())
        self.send(('p1a', self._id, self._state.b), to=self._state.acceptors)
        super()._label('_st_label_799', block=False)
        b1 = a = None

        def ExistentialOpExpr_873():
            nonlocal b1, a
            for (_, _, (_ConstantPattern893_, a, b1, _)) in self._ScoutReceivedEvent_2:
                if (_ConstantPattern893_ == 'p1b'):
                    if (not (b1 == self._state.b)):
                        return True
            return False
        _st_label_799 = 0
        while (_st_label_799 == 0):
            _st_label_799 += 1
            if (len({a for (_, _, (_ConstantPattern821_, a, _BoundPattern824_, _)) in self._ScoutReceivedEvent_0 if (_ConstantPattern821_ == 'p1b') if (_BoundPattern824_ == self._state.b)}) > (len(self._state.acceptors) / 2)):
                self._state.pvalues = {v for (_, _, (_ConstantPattern853_, _, _BoundPattern856_, r)) in self._ScoutReceivedEvent_1 if (_ConstantPattern853_ == 'p1b') if (_BoundPattern856_ == self._state.b) for v in r}
                self.send(('adopted', self._state.b, self._state.pvalues), to=self._state.leader)
                _st_label_799 += 1
            elif ExistentialOpExpr_873():
                self.send(('preempted', b1), to=self._state.leader)
                _st_label_799 += 1
            else:
                super()._label('_st_label_799', block=True)
                _st_label_799 -= 1

class Leader(da.DistProcess):

    def __init__(self, procimpl, props):
        super().__init__(procimpl, props)
        self._LeaderReceivedEvent_0 = []
        self._events.extend([da.pat.EventPattern(da.pat.ReceivedEvent, '_LeaderReceivedEvent_0', PatternExpr_966, sources=None, destinations=None, timestamps=None, record_history=True, handlers=[]), da.pat.EventPattern(da.pat.ReceivedEvent, '_LeaderReceivedEvent_1', PatternExpr_986, sources=None, destinations=None, timestamps=None, record_history=None, handlers=[self._Leader_handler_985]), da.pat.EventPattern(da.pat.ReceivedEvent, '_LeaderReceivedEvent_2', PatternExpr_1038, sources=None, destinations=None, timestamps=None, record_history=None, handlers=[self._Leader_handler_1037]), da.pat.EventPattern(da.pat.ReceivedEvent, '_LeaderReceivedEvent_3', PatternExpr_1090, sources=None, destinations=None, timestamps=None, record_history=None, handlers=[self._Leader_handler_1089])])

    def setup(self, acceptors, replicas, **rest_1510):
        super().setup(acceptors=acceptors, replicas=replicas, **rest_1510)
        self._state.acceptors = acceptors
        self._state.replicas = replicas
        self._state.ballot_num = (0, self._id)
        self._state.active = False
        self._state.proposals = set()

    def run(self):
        self.debug('### start')
        sub = self.new(Scout, (self._id, self._state.acceptors, self._state.ballot_num), method='thread', daemon=True)
        self._start(sub)
        super()._label('_st_label_963', block=False)
        _st_label_963 = 0
        while (_st_label_963 == 0):
            _st_label_963 += 1
            if PatternExpr_971.match_iter(self._LeaderReceivedEvent_0, SELF_ID=self._id):
                _st_label_963 += 1
            else:
                super()._label('_st_label_963', block=True)
                _st_label_963 -= 1
        self.output('terminating')

    def circle_plus(self, x, y):

        def ExistentialOpExpr_1147(s):
            for (_BoundPattern1150_, _) in y:
                if (_BoundPattern1150_ == s):
                    if True:
                        return True
            return False
        return (y | {(s, p) for (s, p) in x if (not ExistentialOpExpr_1147(s=s))})

    def pmax(self, pvals):

        def UniversalOpExpr_1173(s, b):
            for (b1, _BoundPattern1178_, _) in pvals:
                if (_BoundPattern1178_ == s):
                    if (not (b1 <= b)):
                        return False
            return True
        return {(s, p) for (b, s, p) in pvals if UniversalOpExpr_1173(s=s, b=b)}

    def _Leader_handler_985(self, s, p):
        self.debug('### propose', s, p)

        def ExistentialOpExpr_1002():
            for (_BoundPattern1005_, _) in self._state.proposals:
                if (_BoundPattern1005_ == s):
                    if True:
                        return True
            return False
        if (not ExistentialOpExpr_1002()):
            self._state.proposals.add((s, p))
            if self._state.active:
                sub = self.new(Commander, (self._id, self._state.acceptors, self._state.replicas, self._state.ballot_num, s, p), method='thread', daemon=True)
                self._start(sub)
    _Leader_handler_985._labels = None
    _Leader_handler_985._notlabels = None

    def _Leader_handler_1037(self, ballot_num, pvals):
        self.debug('### adopted', ballot_num, pvals)
        self._state.proposals = self.circle_plus(self._state.proposals, self.pmax(pvals))
        for (s, p) in self._state.proposals:
            sub = self.new(Commander, (self._id, self._state.acceptors, self._state.replicas, ballot_num, s, p), method='thread', daemon=True)
            self._start(sub)
        self._state.active = True
    _Leader_handler_1037._labels = None
    _Leader_handler_1037._notlabels = None

    def _Leader_handler_1089(self, r1, leader1):
        if ((r1, leader1) > self._state.ballot_num):
            self._state.active = False
            self._state.ballot_num = ((r1 + 1), self._id)
            sub = self.new(Scout, (self._id, self._state.acceptors, self._state.ballot_num), method='thread', daemon=True)
            self._start(sub)
    _Leader_handler_1089._labels = None
    _Leader_handler_1089._notlabels = None

class Client(da.DistProcess):

    def __init__(self, procimpl, props):
        super().__init__(procimpl, props)
        self._events.extend([da.pat.EventPattern(da.pat.ReceivedEvent, '_ClientReceivedEvent_0', PatternExpr_1281, sources=None, destinations=None, timestamps=None, record_history=None, handlers=[self._Client_handler_1280])])

    def setup(self, replicas, nops, **rest_1510):
        super().setup(replicas=replicas, nops=nops, **rest_1510)
        self._state.replicas = replicas
        self._state.nops = nops
        self._state.cid = 0
        self._state.results = dict()
        self._state.count = dict()

    def run(self):
        for i in range(self._state.nops):
            self.send(('request', (self._id, self._state.cid, random.randint(0, (NOPS - 1)))), to=self._state.replicas)
            super()._label('_st_label_1243', block=False)
            _st_label_1243 = 0
            while (_st_label_1243 == 0):
                _st_label_1243 += 1
                if (self._state.cid in self._state.results):
                    _st_label_1243 += 1
                else:
                    super()._label('_st_label_1243', block=True)
                    _st_label_1243 -= 1
            else:
                if (_st_label_1243 != 2):
                    continue
            if (_st_label_1243 != 2):
                break
            self.output('received result', self._state.cid, self._state.results[self._state.cid])
            self._state.cid += 1
        super()._label('_st_label_1257', block=False)
        cid = None

        def UniversalOpExpr_1258():
            nonlocal cid
            for self._state.cid in range(self._state.nops):
                if (not (self._state.count[self._state.cid] == len(self._state.replicas))):
                    return False
            return True
        _st_label_1257 = 0
        while (_st_label_1257 == 0):
            _st_label_1257 += 1
            if UniversalOpExpr_1258():
                _st_label_1257 += 1
            else:
                super()._label('_st_label_1257', block=True)
                _st_label_1257 -= 1
        self.output('terminating')
        self.send(('done',), to=self.parent())

    def _Client_handler_1280(self, cid, result):
        self.debug('### response', cid, result)
        if (not (cid in self._state.results)):
            self._state.results[cid] = result
        elif (not (self._state.results[cid] == result)):
            self.error('different result', cid, result, 'than', self._state.results[cid])
        self._state.count[cid] = (1 if (not (cid in self._state.count)) else (self._state.count[cid] + 1))
    _Client_handler_1280._labels = None
    _Client_handler_1280._notlabels = None

class Node_(da.NodeProcess):

    def __init__(self, procimpl, props):
        super().__init__(procimpl, props)
        self._Node_ReceivedEvent_0 = []
        self._events.extend([da.pat.EventPattern(da.pat.ReceivedEvent, '_Node_ReceivedEvent_0', PatternExpr_1482, sources=[PatternExpr_1487], destinations=None, timestamps=None, record_history=True, handlers=[])])

    def run(self):
        nacceptors = (int(sys.argv[1]) if (len(sys.argv) > 1) else 5)
        nreplicas = (int(sys.argv[2]) if (len(sys.argv) > 2) else 4)
        nleaders = (int(sys.argv[3]) if (len(sys.argv) > 3) else 2)
        nclients = (int(sys.argv[4]) if (len(sys.argv) > 4) else 3)
        nops = (int(sys.argv[5]) if (len(sys.argv) > 5) else 3)
        acceptors = self.new(Acceptor, (), num=nacceptors)
        replicas = self.new(Replica, num=nreplicas)
        leaders = self.new(Leader, (acceptors, replicas), num=nleaders)
        initial_state = []
        self._setup(replicas, (leaders, initial_state))
        clients = self.new(Client, (replicas, nops), num=nclients)
        self._start(acceptors)
        self._start((replicas | leaders))
        self._start(clients)
        super()._label('_st_label_1473', block=False)
        c = None

        def UniversalOpExpr_1474():
            nonlocal c
            for c in clients:
                if (not PatternExpr_1489.match_iter(self._Node_ReceivedEvent_0, _BoundPattern1495_=c)):
                    return False
            return True
        _st_label_1473 = 0
        while (_st_label_1473 == 0):
            _st_label_1473 += 1
            if UniversalOpExpr_1474():
                _st_label_1473 += 1
            else:
                super()._label('_st_label_1473', block=True)
                _st_label_1473 -= 1
        self.output('All clients done.')
        self.send(('done',), to=((acceptors | replicas) | leaders))
