extern void __VERIFIER_error(); #include #include #define TRUE (1) #define FALSE (0) #define SIZE (5) #define OVERFLOW (-1) #define UNDERFLOW (-2) unsigned int __VERIFIER_nondet_uint(); static int top=0; static unsigned int arr[SIZE]; pthread_mutex_t m; _Bool flag=FALSE; void error(void) { ERROR: __VERIFIER_error(); return; } void inc_top(void) { top++; } void dec_top(void) { top--; } int get_top(void) { return top; } int stack_empty(void) { (top==0) ? TRUE : FALSE; } int push(unsigned int *stack, int x) { if (top==SIZE) { printf("stack overflow\n"); return OVERFLOW; } else { stack[get_top()] = x; inc_top(); } return 0; } int pop(unsigned int *stack) { if (get_top()==0) { printf("stack underflow\n"); return UNDERFLOW; } else { dec_top(); return stack[get_top()]; } return 0; } void *t1(void *arg) { int i; unsigned int tmp; for(i=0; i