When the time came to pick a theme song for their feature debut, this year’s much-discussed Swiss Army Man, starring Daniel Radcliffe, filmmakers Daniel Scheinert and Daniel Kwan had a novel idea. “Hey, what if the whole movie was just scored by the worst song?” Scheinert told Inverse, recalling the conversation that naturally led them to "Cotton Eye Joe."

For those who don’t remember 1995, "Cotton Eye Joe" was a massive hit for Rednex—a group of Swedish techno musicians playing dress-up in straw hats and dirty overalls. The bizarre, fiddle-fueled novelty was actually a reworking of an old American folk song, and thanks to its undeniable catchiness, it do-si-doed all the way to No. 25 on the Billboard Hot 100.

Outside of sporting events, the Rednex tune is rarely heard these days, but there’s one line burned into everyone’s brains: "Where did you come from, Cotton Eye Joe?" Those words also appear in the haunting version that indie rockers Manchester Orchestra recorded for Swiss Army Man. With respect to the song itself (often titled "Cotton-Eyed Joe"), "Where did you come from?" is a fascinating question. As with many American folk tunes, the author and origins are unknown, yet there’s a lot historians do know about this enduring ditty.

The first known published version appeared in Alabama writer Louise Clarke Pyrnelle’s 1882 novel Diddie, Dumps, and Tot, or Plantation Child-Life, a nostalgic look at the antebellum South. Drawing heavily on her own childhood experiences on her father’s plantation, the novel gives credence to what most experts now hold as fact: "Cotton-Eyed Joe" originated with black slaves well before the Civil War. Pyrnelle’s version describes the titular character as an ugly man ("His eyes wuz crossed, an' his nose wuz flat / An' his teef wuz out, but wat uv dat?") who swoops into town and steals the narrator’s sweetheart.

"Ef it hadn't ben fur Cotton-eyed Joe," the jilted narrator sings, "I'd er ben married long ergo." That basic plot line—boy loses girl to mysterious charmer—drives most iterations of "Cotton-Eyed Joe," including the one Texas-born "song catcher" Dorothy Scarborough included in her 1925 book On the Trail of Negro Folk Songs. As Scarborough writes, she learned parts of the tune from "an old man in Louisiana," who picked it up from slaves on a plantation.

Three years earlier, in 1922, the noted black cultural historian and longtime Fisk University chemistry professor Thomas W. Talley shared a slightly different rendition in his book Negro Folk Rhymes. The son of former Mississippi slaves, Talley came across a version wherein "Cotton-Eyed Joe" isn’t just a person, but also a dance: "I'd a been dead some seben years ago / If I hadn't a danced dat Cotton Eyed Joe." The song ends by saying Joe has "been sol' down to Guinea Gall," which again implies he was a slave.

Regardless of where, exactly, the song was born, it spread quickly throughout the South, becoming a square-dance favorite. An 1875 issue of The Saturday Evening Post contains a story referencing the song, and in 1884, The Firemen’s Magazine dubbed the tune "an old, familiar air." The first 78 rpm recordings of "Cotton-Eyed Joe" began surfacing in 1927, when the string band Dykes Magic City Trio cut the earliest known version.

While the trio’s lively take contains the standard lover’s lament—"I'd a been married 40 years ago if it hadn't been for old Cotton-Eyed Joe"—it also borrows lines from "Old Dan Tucker," another folk classic with pre-Civil War roots.

Ol' Joe is nothing if not an adaptable character. Among the stories collected in Talley's posthumous 1993 book, The Negro Traditions, is "Cotton-Eyed Joe, or the Origin of the Weeping Willow." Here, Joe is a fiddler whose instrument was made from his dead son’s coffin. Generally, Joe is a villain, but legendary soul-jazz songstress Nina Simone doesn’t sound mad at the guy in her 1959 live version. Simone sings her gorgeous ballad from the perspective of a woman who loved Joe long ago and is now ready to marry another man. "I come for to show you my diamond ring," she sings—maybe out of spite, though her plaintive delivery suggests she still has feelings for the troublemaker.

One of the biggest mysteries of the song is what is meant by "cotton-eyed." As per the Random House Historical Dictionary of American Slang, the term describes "prominent whites of the eyes." Others believe old Joe was wasted on moonshine, blind from drinking wood alcohol, or suffering from a medical condition like trachoma, cataracts, glaucoma, or even syphilis. (Urban legend holds that "Cotton-Eyed Joe" is really about STDs in general, though there’s little evidence to support this theory.)

According to one online archive, there have been more than 130 recorded versions since 1950. It’s safe to say none are as cloying or culturally insensitive as the Rednex bastardization, but say this for the knee-slapping Swedes: They got the basic details right. American folk music is a democratic art form. Where "Cotton-Eyed Joe" goes now is completely up to the next person who feels like singing it.