I like to split processing into several steps in series when the intermediate results are meaningful. You may end up with a lot of temporary storage and more code, but in some cases this method makes sense.
It would look something like this. Input and output data is passed on from each processing step to the next as Lists but that's just one way of doing it.
FirstWork(List inputdata1A, List inputdata1B...
out List outputdata1A, out List outdata1B...)
{
// 1st block of work
loop (whatever condition)
{
if (1st condition)
break;
if (2nd condition)
{
outdata1.Add(..)
outdata2.Add(..)
}
}
}
Main()
{
List inputdata1A, inputdata1B;
List intermed1A, intermed1B;
FirstWork(inputdata1A, inputdata1B,
out intermed1A, out intermed1B);
List intermed2A;
SecondWork(intermed1A, intermed1B,
out intermed2A);
List finaloutput;
ThirdWork(intermed2A,
out finaloutput);
}