factory.addStatement(new Assignment(length,
new Length((Expression)vector)));
// check the counter and potentially loop
factory.addLabel(counterLabel);
factory.addStatement(new IfStatement(new CmpGE(counter, length), exitLabel, bodyLabel));
// start the body here
factory.addLabel(bodyLabel);
factory.addStatement(new Assignment(elementVariable, new ElementAccess(vector, counter)));