void step(Bres *b)
//@ requires bres_state(b, ?dx, ?dy, ?x, ?y, ?d, _) &*& x < dx;
//@ ensures bres_state(b, dx, dy, x+1, _, _, _);
{
//@ open bres_state(b, _, _, _, _, _, _);
if (b->d >= 0) {
b->x += 1;
b->y += 1;
b->d += (2 * b->dy) - (2 * b->dx);
b->signal = NoPulse;
//@ bres_NE_implies_y_lt_dy(dx, dy, x, y, d); // y < dy
//@ close bres_state(b, _, _, x+1, y+1, _, NoPulse);
} else {
b->x += 1;
b->d += 2 * b->dy;
b->signal = Pulse;
//@ close bres_state(b, _, _, x+1, y, _, Pulse);
}
}