(last_stmt: ailment.Stmt.ConditionalJump)
return None
Check the last statement of the switch-case header node, and extract lower+upper bounds for the comparison.

    :param last_stmt:   The last statement of the switch-case header node.
    :return:            A tuple of (comparison expression, lower bound, upper bound), or None
Check the last statement of the switch-case header node, and extract lower+upper bounds for the comparison.
Check the last statement of the switch - case header node and extract lower + upper bounds for the comparison .
def switch_extract_cmp_bounds(last_stmt: ailment.Stmt.ConditionalJump) -> Optional[Tuple[Any,int,int]]:
    """
    Check the last statement of the switch-case header node, and extract lower+upper bounds for the comparison.

    :param last_stmt:   The last statement of the switch-case header node.
    :return:            A tuple of (comparison expression, lower bound, upper bound), or None
    """

    if not isinstance(last_stmt, ailment.Stmt.ConditionalJump):
        return None

    # TODO: Add more operations
    if last_stmt.condition.op == 'CmpLE':
        if not isinstance(last_stmt.condition.operands[1], ailment.Expr.Const):
            return None
        cmp_ub = last_stmt.condition.operands[1].value
        cmp_lb = 0
        cmp = last_stmt.condition.operands[0]
        if isinstance(cmp, ailment.Expr.BinaryOp) and \
                cmp.op == 'Sub' and \
                isinstance(cmp.operands[1], ailment.Expr.Const):
            cmp_ub += cmp.operands[1].value
            cmp_lb += cmp.operands[1].value
            cmp = cmp.operands[0]
        return cmp, cmp_lb, cmp_ub

    return None
def switch_extract_cmp_bounds ( last_stmt : ailment . Stmt . ConditionalJump ) -> Optional [ Tuple [ Any , int , int ] ] : if not isinstance ( last_stmt , ailment . Stmt . ConditionalJump ) : return None # TODO: Add more operations if last_stmt . condition . op == 'CmpLE' : if not isinstance ( last_stmt . condition . operands [ 1 ] , ailment . Expr . Const ) : return None cmp_ub = last_stmt . condition . operands [ 1 ] . value cmp_lb = 0 cmp = last_stmt . condition . operands [ 0 ] if isinstance ( cmp , ailment . Expr . BinaryOp ) and cmp . op == 'Sub' and isinstance ( cmp . operands [ 1 ] , ailment . Expr . Const ) : cmp_ub += cmp . operands [ 1 ] . value cmp_lb += cmp . operands [ 1 ] . value cmp = cmp . operands [ 0 ] return cmp , cmp_lb , cmp_ub return None