it is not realistic idea to prepare function because...
lots of names and lots of criteria...
how can you make this?
example... kiran it can be name of male or female
there are not rules that one of these gender name will start with some particular letter or end with some particular letter...
after some database is filled with name
if some one register with same name available in database then you can fire a query base on analysis summary.
example aarti it is already entry in database having same first name then fetch it's saved gender and set it...
check prefix for like Mr./Miss/Mrs.
and set related gender