Cuan hua Ocáin, 11th century Ireland
Annals of the Four Masters, AD 1024 (http://www.isos.dias.ie/libraries/RIA/RIA_MS_C_iii_3/small_jpgs/0856.jpg; Dublin, Royal Irish Academy, MS. C iii 3, fol. 409 v; line 3).
Annals of Ulster, Anno Domini M. XXiii http://image.ox.ac.uk/images/bodleian/msrawlb489/f38r.jpg (Oxford, Bodleian Library, MS. Rawl. B. 489, fol. 38r; column 1, last line).
Annals of Inisfallen, AD 1024
http://image.ox.ac.uk/images/bodleian/msrawlb503/22r.jpg (Bodleian Library, Oxford, MS. Rawl. B. 503, fol. 22r; column 2, line 1).
Annals of the Four Masters
The Annals of the Four Masters for the year 1081 (https://archive.org/stream/annalsofkingdomo02ocleuoft#page/916/mode/2up) shows the name as "Magrath Ua h-Ogain" in english and "Macrait Ua hOccáin" in Irish).
The original scan of the Annals of the Four Masters (http://www.isos.dias.ie/libraries/RIA/RIA_MS_C_iii_3/small_jpgs/0930.jpg; Dublin, Royal Irish Academy, MS. C iii 3, fol. 446 v; line 12) shows the same name as "Macrait ua hoccÁin" so no discrepancy there other than capitalizations. The entire document cannot be directly linked. To see it you can follow these steps:
Click “Royal Irish Academy”
Click “MS C iii 3”
Annals of Ulster
If you go to the translated version of the Annals of Ulster for the same year (http://www.ucc.ie/celt/published/T100001A/; U1081.2) you'll see the translated name as "Mac Craith ua Ócán".The Irish version of the same text (http://www.ucc.ie/celt/published/G100001A/index.html; U1081.2) shows the name as "M. Raith H. Ocan".
The original scan of the Irish Annals of Ulster (full document: http://image.ox.ac.uk/show?collection=bodleian&manuscript=msrawlb489; direct link to page: http://image.ox.ac.uk/images/bodleian/msrawlb489/f44r.jpg; Oxford, Bodleian Library, MS. Rawl. B. 489, fol. 44r; first column, 3rd section under Anno Domini M. LXXXi ) shows it more closely resembling "M raiṫ.h.hocĀ".
Annals of Inisfallen
If you go the the translated version of the Annals of Inisfallen for the year 1082 (http://www.ucc.ie/celt/published/T100004/; AI1082.3) you’ll see a similarly translated name as “Cenn Faelad Ua hÓcáin”. The Irish version of the same text (http://www.ucc.ie/celt/published/G100004/index.html; I1083.3) shows the same name as “Cend Faelad h-Ua Ócain”.
The original scan of the Annals of Inisfallen (full document: http://image.ox.ac.uk/show?collection=bodleian&manuscript=msrawlb503; direct link to page: http://image.ox.ac.uk/images/bodleian/msrawlb503/28v.jpg; Bodleian Library, Oxford, MS. Rawl. B. 503, fol. 22r; first column, line 9) shows it more closely resembling “Cend Fælad huaocaī”.
Because of the claimed historic authenticity of the documents (transcribed/original vs. compiled) I'm guessing the Ulster and Inisfallen versions are at least closer to what it would have appeared at the original date. If we make some further educated guesses we start to get close to what's in the ucc.ie Irish versions:
The ucc.ie Irish versions consistently replaces the “h.” and “hua” prefixes of surnames with “h-Ua ”.
As this site explains, there are many shorthands scribes used to ease the writing of longer letter combinations: http://www.akerbeltz.org/index.php?title=Scribes,_Shorthand_and_How_to_Save_on_Parchment. The Annals of Inisfallen used these shorthands liberally.
I believe the Irish ucc.ie version is turning Middle Irish characters and shorthands (specifically “ī”, “Ā”, “hua”, and “h.”) into something consistent to how it was pronounced or that can be typed without using the shorthands so I argue both should be seen as valid forms of the name.
There’s inconsistency between documents on the use of “h” (e.g. “hua” vs. “ua” and “hocain” vs. “ocain”), but during my research there were a couple of theories about his:
The first is that the “h” sound was used by Irish speakers of the time to lead into words beginning with vowels.
The second is that scribes with Latin background tended to dislike vowels from different syllables running into each other so used the silent “h” to break them up.
Because of these last few points the surnames from the 2 documents would be most likely be accurately written longhand as "hua hocáin" and "hua ocain" respectively, or if we assume the "h" wouldn't have been written by anyone other than Latin-background scribes then the most likely written form of these would be "ua ocáin" and "ua ocain" respectively.