They are not decoration. Ó means descendant of and Mac means son of, and together they make Irish surnames some of the oldest hereditary names in Europe — a claim of descent from a named ancestor, still being made a thousand years later.
From the 16th century, as English administration spread, the prefixes largely disappeared from written records — dropped under pressure, or simply lost by clerks writing down a name they had only heard. By the 19th century the great majority of Irish surnames were being written without them. The Gaelic revival around 1900 brought many back, deliberately and proudly, which is why one family can appear as Connor, O’Connor and Ó Conchobhair within three generations of the same parish register.
For the family historian this matters: searching Griffith’s Valuation or the censuses for O’Sullivan alone will miss the Sullivans, and vice versa. Always search both. See tracing your ancestors.
“descendant of” — Ó Murchadha is the descendant of Murchadh.
“son of” — Mac Cárthaigh is the son of Cárthach. Mc is simply a contraction of Mac, not a separate name and not a marker of religion.
Norman French fils de, “son of” — the same idea carried in by the invasion of 1169.