private static @Nullable Condition findCondition(PsiElement deadCode) {
        if (deadCode instanceof PsiExpression) {
          if (deadCode.getParent() instanceof PsiConditionalExpression ternary) {
            if (ternary.getElseExpression() == deadCode) {
              return new Condition(false, ternary.getCondition());
            }
            else if (ternary.getThenExpression() == deadCode) {
              return new Condition(true, ternary.getCondition());
            }
          }
        }
        if (deadCode instanceof PsiCodeBlock block && block.getParent() instanceof PsiBlockStatement blockStatement) {
          deadCode = blockStatement;
        }
        if (deadCode.getParent() instanceof PsiIfStatement ifStatement) {
          PsiExpression condition = ifStatement.getCondition();
          if (condition != null) {
            if (ifStatement.getThenBranch() == deadCode) {
              return new Condition(true, condition);
            }
            if (ifStatement.getElseBranch() == deadCode) {
              return new Condition(false, condition);
            }
          }
        }
        if (deadCode instanceof PsiStatement statement) {
          if (PsiTreeUtil.skipWhitespacesAndCommentsBackward(statement) instanceof PsiIfStatement prevIf) {
            if (prevIf.getElseBranch() == null && !ControlFlowUtils.statementMayCompleteNormally(prevIf.getThenBranch())) {
              PsiExpression condition = prevIf.getCondition();
              if (condition != null) {
                return new Condition(false, condition);
              }
            }
          }
        }
        return null;
      }
private static @Nullable Condition findCondition(PsiElement deadCode)