I hope you did not see my first attempt to answer your post because it was wrong - as indeed, to a lesser degree was my second.
I think your problem is not understanding the full generality of for loops.
In the compound statement
for ( e1; e2; e3 ) { loop body };
the expressions e1, e2 and e3 may be just abount any expressions, though usually they are quite simple. The expression e1 is evaluated only once. e2 is evaluated every time the loop executes and controls when the loop exits and e3 is likewise evaluted every time the loop executes but has no special meaning (though it is usually used to increment a variable used by e2). In effect e3 is the
last statement of the loop body and could indeed be placed there.
I do not know why the code has been written in the way it has. It is valid but very unusual to use e3 in this way - normally it is used as part of the "loop control" logic in order to distinguish loop control from loop body.
The way in which e2 has been written. ++i<99 is also unusual as it is both incrementing the loop counter, i, and testing it.
I would replace this obfuscated code with a "normal" for loop
for(float i=0.,g=0.,e,s; i<99.; i+=1.0)
{
...other stuff
O.xyz+=5e-5*abs(cos(vec3(3,2,1)+log(s*9.)))/dot(p,p)/e
}
though I would first check that this transformation exactly corresponds to the original. Without checking I am not sure if they execute the loop body 98, 99 or 100 times - but I suspect that in this particular piece of code that does not matter and that something in the "other stuff" actually controls when the loop is to exit either by a conditional goto, return or by setting i to 99 or 100 or some other large value.