I saw (parts of) this movie around the early 80s. (I was too young to appreciate it.)
It was set in the future, and had the feel of Alice-in-Wonderland or Brazil; a world with a bizarre internal-logic that was hard for the hero to fathom.
The hero (time-traveller?) was an outsider trying to understand to odd society, and was brought before a panel of idiosyncratic bureaucrats as he needed an id card and didn't have one. He had trouble explaining why he didn't have one.
As part of the explanation, one of the bureaucrats told a story about a man he had met that had a mental condition that gave him a compulsion to say "Cockadoodle doo" at the end of every sentence. Somehow, if the hero had this same mental condition, it would explain his situation, so the hero seizes on it and says that he has the same problem. He starts saying cockadoodle doo at the end of every sentence.
The bureaucrats are satisfied, and he is told to state his name into the machine that produces id cards. He happily does so, and then realises that the bureaucrats are looking at him suspiciously, and he belatedly adds "Cockadoodle doo" to the end of the sentence.
He is dismayed to get an id card with "Cockadoodledoo" as his last name.