- volatile atomic_flag* __g__ = __atomic_flag_for_address__( __p__ );
- __atomic_flag_wait_explicit__( __g__, __x__ );
- void* __r__ = *__p__;
- *__p__ = (void*)((char*)(*__p__) + __m__);
- atomic_flag_clear_explicit( __g__, __x__ );
+ model->switch_to_master(new ModelAction(ATOMIC_READ, __x__, __p__));
+ void* __r__ = (void *) thread_current()->get_return_value();
+ model->switch_to_master(new ModelAction(ATOMIC_RMW, __x__, __p__, (void*)((char*)(*__p__) + __m__)));