started generating while statement for IR