if (KjcOptions.decoupled) {
if (KjcOptions.decoupled || RawWorkEstimator.SIMULATING_WORK) {
    private void rawMainFunction(SIRFilter filter) {        JBlock statements = new JBlock();        //index variable for loop of work function in init stage        JVariableDefinition exeIndex1Var =             new JVariableDefinition(null,                                     0,                                     CStdType.Integer,                                    RawExecutionCode.exeIndex1,                                    null);        // create the params list, for some reason        // calling toArray() on the list breaks a later pass        System.out.println(filter.getParent());        List paramList = filter.getParams();        JExpression[] paramArray;        if (paramList == null || paramList.size() == 0)            paramArray = new JExpression[0];        else            paramArray = (JExpression[]) paramList.toArray(new JExpression[0]);        //get the init multiplicty        initMult = ssg.getMult(node, true);        //if we execute in the init stage, then create the local to index the for loop        if (initMult > 0) {            statements.addStatement                (new JVariableDeclarationStatement(null,                                                   exeIndex1Var,                                                   null));          }            //if standalone, add a field for the iteration counter...        JFieldDeclaration iterationCounter = null;        if (KjcOptions.standalone) {            iterationCounter =                 new JFieldDeclaration(new JVariableDefinition(0,                                                              CStdType.Integer,                                                               FlatIRToC.MAINMETHOD_COUNTER,                                                              new JIntLiteral(-1)));            filter.addField(iterationCounter);        }            // add the call to the init function        statements.addStatement(new JExpressionStatement(null,                                                         new JMethodCallExpression(null, new JThisExpression(null),                                                                                   filter.getInit().getName(), paramArray), null));            //if we execute in the init stage, then create the loop'ed work function        if (initMult > 0) {            //inline the work function in a while loop            JBlock workInitBlock = RawExecutionCode.executeWorkFunction(filter);                            //call work function for init stage????            statements.addStatement                (RawExecutionCode.makeForLoop(workInitBlock,                                               exeIndex1Var,                                              new JIntLiteral(initMult)));        }            if (!IMEMEstimation.TESTING_IMEM) {            //add call to raw_init2, only if not testing imem            statements.addStatement(new JExpressionStatement(null,                                                             new JMethodCallExpression                                                             (null,                                                               new JThisExpression(null),                                                              SwitchCode.SW_SS_TRIPS,                                                              new JExpression[0]),                                                             null));        }        // inline the work function in a while loop        JBlock workBlock = RawExecutionCode.executeWorkFunction(filter);        if (SpaceDynamicBackend.FILTER_DEBUG_MODE) {            statements.addStatement(new SIRPrintStatement(null,                                                          new JStringLiteral(null, filter.getName()                                                                             + " Starting Steady-State\\n"), null));        }        // if we are in decoupled mode do not put the work function in a for        // loop        // and add the print statements        if (KjcOptions.decoupled) {            workBlock.addStatementFirst(new SIRPrintStatement(null,                                                              new JIntLiteral(0), null));            workBlock.addStatement(workBlock.size(), new SIRPrintStatement(                                                                           null, new JIntLiteral(1), null));            statements.addStatement(workBlock);        } else {            statements.addStatement                (new JWhileStatement                 (null,                   KjcOptions.standalone ?                    (JExpression) new JPostfixExpression(null,                                                        Constants.OPE_POSTDEC,                                                        new JFieldAccessExpression(new JThisExpression(null),                                                                                   FlatIRToC.MAINMETHOD_COUNTER)) :                  (JExpression)new JBooleanLiteral(null, true),                  workBlock,                   null));        }        JMethodDeclaration rawMainFunct = new JMethodDeclaration(null,                                                                 at.dms.kjc.Constants.ACC_PUBLIC, CStdType.Void,                                                                 RawExecutionCode.rawMain, JFormalParameter.EMPTY,                                                                 CClassType.EMPTY, statements, null, null);        filter.addMethod(rawMainFunct);    }