/* CIVL model of stdlib.c */ #ifndef __STDLIB_CIVL__ #define __STDLIB_CIVL__ #include #include //#define DEFAULT_SEED 99 //unsigned _rand_seed = DEFAULT_SEED; //unsigned _random_seed = DEFAULT_SEED; $atomic_f void free(void*ptr){ $free(ptr); } $atomic_f int rand(){ int tmp; $havoc(&tmp); return tmp; } $atomic_f void srand(unsigned int seed){ } $atomic_f void srandom(unsigned int seed){ } $atomic_f long int random(){ long int tmp; $havoc(&tmp); return tmp; } $atomic_f void exit(int status){ $assert(status == 0, "erroneous exit with code %d", status); $exit(); } $atomic_f _Noreturn void abort(void){ $exit(); } $atomic_f int abs(int x){ if(x >= 0) return x; return (-x); } int atoi(const char *nptr){ $abstract int _atoi(const char * ptr); return _atoi(nptr); } #ifdef _LINUX $atomic_f int rand_r(unsigned int *seedp){ int tmp; $havoc(&tmp); return tmp; } #endif #endif