Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) said: "When we narrate a hadith to you, we bring its confirmation before you from the Book of Allah: The sperm-drop remains in the womb for forty days, then it remains a clinging clot ('alaqah) for forty days, then it remains a lump of flesh (mudghah) for forty days. Then, when Allah, the Mighty and Majestic, intends to create the creation, an angel descends and he is told: Write. He says: O my Lord, what shall I write? It is said: Write whether he is wretched or fortunate, male or female, what his provision is, what his trace (deeds) is, and what his lifespan will be. Then Allah, the Mighty and Majestic, reveals to him whatever He wills, and the angel writes (it all) down." Then Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) recited this verse: "Indeed, We created man from a mingled sperm-drop, testing him" [Surah al-Insan: 2], and Sayyiduna Abdullah (may Allah be pleased with him) said: "Amshaj (mingled) refers to the veins."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 9114