private static CStatement ConditionCheck(Instruction i) { CStatement CtrCondition = null; CStatement CrCondition = null; if ((i.BO() & 4) == 0) { CtrCondition = new CStatement(); } if ((i.BO() & 0x10) == 0) { CrCondition = new CStatement(); CrCondition.Kind = CStatement.Kinds.Comparison; uint cr = i.BI() / 4; uint fld = i.BI() % 4; CrCondition.Op1 = new CStatement.COperand("cr" + cr); CrCondition.Op2 = new CStatement.COperand(0); bool bo = ((i.BO() >> 3) & 1) == 1; switch (fld) { case 0: if (bo) CrCondition.ConditionSign = CStatement.Conditions.LessThan; else CrCondition.ConditionSign = CStatement.Conditions.GreaterEqualThan; break; case 1: if (bo) CrCondition.ConditionSign = CStatement.Conditions.GreaterThan; else CrCondition.ConditionSign = CStatement.Conditions.LessEqualThan; break; case 2: if (bo) CrCondition.ConditionSign = CStatement.Conditions.Equal; else CrCondition.ConditionSign = CStatement.Conditions.NotEqual; break; case 3: if (bo) CrCondition.ConditionSign = CStatement.Conditions.Overflow; else CrCondition.ConditionSign = CStatement.Conditions.NotOverflow; break; } } CStatement final = null; if (CrCondition != null) { if (CtrCondition != null) { CStatement composite = new CStatement(CStatement.Kinds.CompositeCondition, CrCondition, CtrCondition); composite.ConditionSign = CStatement.Conditions.And; final = new CStatement(); final.Kind = CStatement.Kinds.Conditional; final.Condition = composite; } else { final = new CStatement(); final.Kind = CStatement.Kinds.Conditional; final.Condition = CrCondition; } } else if (CtrCondition != null) { final = new CStatement(); final.Kind = CStatement.Kinds.Conditional; final.Condition = CtrCondition; } return final; }