private static boolean improvePatternTypes(Statement stat) {
    boolean res = false;
    for (Statement st : stat.getStats()) {
      res |= improvePatternTypes(st);
    }

    if (stat instanceof IfStatement ifSt) {
      Exprent cond = ifSt.getHeadexprent().getCondition();

      if (improvePatternType(ifSt.getHeadexprent(), cond, ifSt.getIfstat())) {
        res = true;
      }
    }

    return res;
  }
Gets the last guaranteed executed exprent in an expression.
@param ifTrue if true, gets the last executed exprent when the condition is true.
              if false, gets the last executed exprent when the condition is false.
@param onlyIfTrue if true, only returns the last executed exprent if the exprent had to return true for
                 the requested outcome to be selected.
@return the last executed exprent
src/org/jetbrains/java/decompiler/modules/decompiler/IfPatternMatchProcessor.java