|The Biblical story of Cain and Abel, wherein Cain kills his brother Abel, after which Seth acquires the right to rule in god's eyes, is a rescript of the Egyptian mythology story of Set killing Osiris, after which Horus becomes the legitimate heir.|
Set and Osiris
The Biblical story of Adam's three male offspring, namely of Cain killing Abel and Seth gaining the right to rule is a monotheistic rescript of the Egyptian mythology story of Atum's three male offspring, namely of Set killing Osiris and Horus acquiring the right to rule; the gist of which is as follows:
Atum (father)astro-theological in basis; generally a tale of of the triumph of light over darkness, in respect to the yearly solar cycle, in short.
In 1907, Gerald Massey, in his Ancient Egypt: Light of the Modern World, summarized things as follows: 
“The battle in Amenta was not only fought betwixt the Apap [Apep] of darkness and the sun god Ra. When the two brothers Sut [Set] and Horus were repeated in the solar mythos, as the sons of Atum, the conflict was continued for possession of the garden. This was now the motive of the warfare. Previously it was for the water of the inundation or light in the moon. Now it was for the water and the tree of life in the Aarru-garden. In one version of the mythos, Sut [Set] is the murderer of the good brother as Osiris. In the other, Sut pierces and puts out the eye of Horus. This is represented as the contest between Cain and Abel, the two sons of Adam, in the book of Genesis. Sut and Horus represented two contending nature-powers. They fought each other as the two rehus or lions in the light and dark halves of the moon, with Taht as the adjudicator of the landmarks. They also fought as two dragons, or as the crocodile of water and the dragon of drought, both of which were rightly represented in the astronomical mythology. ‘Hydra’ remains for all time as the ‘hellish Apap’ who drank up the water. And ‘Draconis’ is a figure of the good dragon or Horus-crocodile. Lastly, the two opponent powers were portrayed as twin-brothers, fighting for the birth-right, or seeking to overcome each other. Thus they contended for possession of the garden in Amenta, where they fought upon the mount of glory or were constellated as the Gemini contending in the zodiac. The conflict of the brothers was continued in the garden of Eden, and Cain fulfils the character of the murderer Sut, the slayer of his brother. There is an attempt even to discriminate betwixt the two domains of Sut and Horus, when it is said that ‘Abel was a keeper of sheep, but Cain was a tiller of the ground’ (Genesis 4:2-3).”
In 1907, George St. Clair, in his The Secret of Genesis: an Astro-Religious Record, summarized things as follows: 
“Cain and Abel represent rival forms of the registration of time attempted next after the failure of the Adamic year. We may not unlikely find them associated with the seasons of autumn and spring, with the promise before them of winter or of summer. The divinities of the two hemispheres possess equal extent of domain, and have so much likeness as to be called twin brothers. Yet as one is dark and cold, the other warm and bright, they are a contrast; and as neither can brook the presence of the other, they are rivals. At the equinoxes they come face to face, and look over the boundary as though covetous of each other’s territory. Sometimes they seem to wrestle for the mastery. It can be shown that in the course of the Great Year of Precession they mutually occupy each other’s domain, and return to their own. They are also made to do so factitiously, by the Sothic Cycle of 1460 years; and may do so, in irregular ways, in any faulty calendar.
Cain and Abel are like Typhon [Set] and Osiris.—In Egypt the rival brothers were Typhon [Set] and Osiris. .Typhon got into his brother’s house and murdered him, and reigned in his stead. This reversed position of the hemispheres is set forth also in another way, by the statement that Osiris descended into the underworld and became the god of the dead. A new calendar was framed in which the god of light was Horus; and he, as the son of Osiris, assumed the task of avenging his father. It was not easily done, and for a long time the struggle went on between Horus and Set (Typhon is the Greek name for Set). It seems likely that this warfare, with alternate gain and loss, represents a troublesome experience of calendar mending before the seasons were accurately measured and adjusted.
Cain and Abel are like these Egyptian brothers, though with some differences. Cain seems to belong to the autumn equinox, the place and season of the fruits of the ground; and Abel to the spring, which is the place and season of the lambs of the flock. The vernal equinox is the more acceptable time for the beginning of the year; but the calendar is erroneous, and in some way the autumn proves to have the advantage. Cain kills his brother Abel, as Typhon murdered Osiris. Then, as the place of Osiris was taken by Horus, the place of Abel is taken by Seth; and we may look upon Seth as Abel redivivus without his weakness or defect. We are not favored, however, with any details of a struggle between Seth and Cain, like that which is chronicled concerning Horus and Set.
Jewish legends about Cain and Abel are of uncertain origin and doubtful meaning: yet some of them would admit of easy adaptation to the theory of rival calendars, and more than one looks like a fragment of astronomical tradition. In Egypt the twin brothers Typhon and Osiris had twin sisters, and were married to them (as the social custom of Egypt would allow)—Osiris to Isis, and Typhon to Nephthys. In the astronomic symbolism the sisters may have represented the solstices, or they may have stood by their brothers at the equinoxes as goddesses of New Year festivals. At all events, the error which brought one equinox to the place of the other and allowed Typhon to kill Osiris, brought each brother, in the same figurative way, to the couch of the other’s wife. Nephthys, in all innocence, bears a son to Osiris—there was something in the astronomic facts to justify this conception—and that son, Anubis the jackal, is no doubt a star of that name. It is very curious then to find Jewish legends declaring that Cain and Abel were twins; and again that each had a twin sister, and although Adam gave Cain’s sister to Abel, and Abel’s sister to Cain, Cain desired to marry his own sister Azrun. This is given as the cause of the quarrel which led to the murder. The fatal blow was dealt with a stone, or with a scythe or crooked hedging bill: and symbolism has meanings for fatal stones and murderous sickles.
The mark set upon Cain’s forehead is in one tradition a horn growing out of it. In the revised Old Testament the mark is a ‘sign’ appointed for Cain. The dog which guarded Abel‘s flock is said to have been given to Cain for a perpetual travelling companion. These details are too slight to build argument upon. Yet we may note that Cain the wanderer will be found bye and bye connected with the Dog-star [Sirius]. In the calendar of the ‘Vague Year’, i.e. the year of 365 days without intercalary, the Dog-star is caused to wander through all the months. Cain, like Typhon, gets more than his due—In our chapter on the Serpent we found that Typhon was rightly charged with the calendar mischief which displaced the equinox and the year’s beginning factitiously, or contrary to the facts of nature. He was also wrongly blamed for the real movement of precession which causes stars of autumn to fall away from the equinox and disappear below the equator. The analogy of Cain to Typhon is confirmed by the fact that certain traditions connect him with those “children of failure,” the fallen angels.”
In 2000, Gary Greenberg, in his 101 Myths of the Bible, argued similar to Massey and St. Clair, albeit without the astro-theology connections, but also added in the note that the Bible version had Sumerian mythology syncretized into the original Egyptian version: 
“The story of Cain and Abel had its origins in the conflict between Set and Osiris, but subsequently the story was influenced by Sumerian myths about a shepherd named Dumuzi.”
Greenberg elaborates on this via three pages of discussion.
1. Massey, Gerald. (1907). Ancient Egypt: The Light of the World: a Work of Reclamation and Restitution in Twelve Books, Volume One (pgs. 457-58). T. Fisher Unwin.
2. St. Clair, George. (1907). The Secret of Genesis: an Astro-Religious Record -- The Legends and Their Interpretation, from the Fall of the Angels to the Building of the Babel Tower (pg. 108-10). Publisher.
3. Greenberg, Gary. (2000). 101 Myths of the Bible: How Ancient Scribes Invented Biblical History (myth #30: Cain killed Abel, pgs. 68-70). Source Books.
● Cain and Able – Wikipedia.