This is the tale of poor man Ali Baba and his rich brother Cassim. Ali overhears thieves as they reveal the magic words to open (Open Sesame in English) and close (Close Sesame in English) their treasure cavern. When they leave, Ali enters the cave and steals some of their treasure. When Cassim's wife learns of the treasure, she tells Cassim. Cassim goes to the cave and in his excitement and greed, forgets how to get out of the cave. The thieves find him and kill him.
Ali finds his brother dead and concocts a plan to convince everyone that Cassim died naturally by employing a slave girl and a blindfolded tailor. The thieves discover that Cassim's body has been removed, abduct the tailor that stitched the dead man's body back together, and plot to kill everyone in Cassim's household. The slave girl repeatedly foils the thieves' plot by marking all of the surrounding houses with their marks. In the end, the slave girl reveals her attempts to keep her owner's family safe and Ali frees the young woman and marries her to his son. Ali remains the only one who knows about the location of the cave and the magic words to get inside.
This tale is full of brutality, death, and vengeance. It is also a show of what happens to those consumed by greed. Cassim died when he couldn't remember the magic words. All 40 of the thieves died, either at the hand of the lead thief or by the slave girl. But, there is a happily ever after in the end, at least we presume for the freed slave.