In the unlikely situtation doA() and doB() don't use or change x,y,z there's always:
for(i = 0; i < x; i++)
{
if(v > 0 && doA())
{
doB()
}
else if(v <= 0 && doB())
{
doA()
}
}
z += ((x^2 + x)/2) + y*x + x
y += x + (x^2 + x)/2
x = 0