def guess_shape_and_submatrix_shape(dic):
    """
    Guess the data shape and the shape of the processed data submatrix.
    """
    if 'procs' not in dic:
        return None, None
    procs = dic['procs']
    if 'SI' not in procs or 'XDIM' not in procs:
        return None, None
    si_0 = procs['SI']
    xdim_0 = procs['XDIM']
    if 'proc2s' not in dic:
        return (si_0,), (xdim_0,)
    proc2s = dic['proc2s']
    if 'SI' not in proc2s or 'XDIM' not in proc2s:
        return None, None
    si_1 = proc2s['SI']
    xdim_1 = proc2s['XDIM']
    if 'proc3s' not in dic:
        return (si_1, si_0), (xdim_1, xdim_0)
    proc3s = dic['proc3s']
    if 'SI' not in proc3s or 'XDIM' not in proc3s:
        return None, None
    si_2 = proc3s['SI']
    xdim_2 = proc3s['XDIM']
    if 'proc4s' not in dic:
        return (si_2, si_1, si_0), (xdim_2, xdim_1, xdim_0)
    proc4s = dic['proc4s']
    if 'SI' not in proc4s or 'XDIM' not in proc4s:
        return None, None
    si_3 = proc4s['SI']
    xdim_3 = proc4s['XDIM']
    return (si_3, si_2, si_1, si_0), (xdim_3, xdim_2, xdim_1, xdim_0)
