/* * Date: 2020 * Authors: Luca Di Stefano, Omar Inverso * Contact: luca <dot> distefano <at> gssi <dot> it */ extern int __VERIFIER_nondet_int(void); typedef char TYPEOFVALUES; typedef unsigned char TYPEOFPC; typedef unsigned char TYPEOFTIME; typedef unsigned char TYPEOFAGENTID; typedef unsigned char TYPEOFKEYIID; typedef unsigned char TYPEOFKEYLID; TYPEOFVALUES __abs(TYPEOFVALUES x) { return (x > 0) ? (x) : (-x); } TYPEOFVALUES I[3][1]; TYPEOFPC pc[3][1]; TYPEOFTIME __LABS_time; _Bool Hin[3][2]; _Bool Hout[3][2]; unsigned char HinCnt[3]; unsigned char HoutCnt[3]; TYPEOFTIME now(void) { return ++__LABS_time; } TYPEOFVALUES Lvalue[3][2]; TYPEOFTIME Ltstamp[3][2]; const TYPEOFKEYLID tupleStart[2] = {0, 1}; const TYPEOFKEYLID tupleEnd[2] = {0, 1}; _Bool link(TYPEOFAGENTID __LABS_link1, TYPEOFAGENTID __LABS_link2, TYPEOFKEYLID key) { _Bool __LABS_link = 0; if ((key >= 0) && (key <= 0)) { __LABS_link = ((I[__LABS_link1][0] - I[__LABS_link2][0]) >= 0) && ((I[__LABS_link1][0] - I[__LABS_link2][0]) <= 2); } else if ((key >= 1) && (key <= 1)) { __LABS_link = ((I[__LABS_link2][0] - I[__LABS_link1][0]) > 0) && ((I[__LABS_link2][0] - I[__LABS_link1][0]) <= 2); } return __LABS_link; } TYPEOFTIME timeof(TYPEOFAGENTID id, TYPEOFKEYLID key) { return Ltstamp[id][tupleStart[key]]; } void setHin(TYPEOFAGENTID id, TYPEOFKEYLID key) { HinCnt[id] = HinCnt[id] + (!Hin[id][tupleStart[key]]); Hin[id][tupleStart[key]] = 1; } void clearHin(TYPEOFAGENTID id, TYPEOFKEYLID key) { HinCnt[id] = HinCnt[id] - Hin[id][tupleStart[key]]; Hin[id][tupleStart[key]] = 0; } void setHout(TYPEOFAGENTID id, TYPEOFKEYLID key) { HoutCnt[id] = HoutCnt[id] + (!Hout[id][tupleStart[key]]); Hout[id][tupleStart[key]] = 1; } void clearHout(TYPEOFAGENTID id, TYPEOFKEYLID key) { HoutCnt[id] = HoutCnt[id] - Hout[id][tupleStart[key]]; Hout[id][tupleStart[key]] = 0; } void attr(TYPEOFAGENTID id, TYPEOFKEYIID key, TYPEOFVALUES value, _Bool check) { __VERIFIER_assume((!check) || (HoutCnt[id] == 0)); __VERIFIER_assume((!check) || (HinCnt[id] == 0)); I[id][key] = value; now(); } void lstig(TYPEOFAGENTID id, TYPEOFKEYLID key, TYPEOFVALUES value, _Bool check) { __VERIFIER_assume((!check) || (HoutCnt[id] == 0)); __VERIFIER_assume((!check) || (HinCnt[id] == 0)); Lvalue[id][key] = value; Ltstamp[id][tupleStart[key]] = now(); setHout(id, key); } void confirm(void) { TYPEOFAGENTID guessedcomp = __VERIFIER_nondet_int(); __VERIFIER_assume(guessedcomp < 3);
content may be truncated. 'popout' for larger text window.