Back in my very first professional assignment, I was a Jr. member of a team that was doing an Operational Test and Evaluation (OTE) suite for the Us Military (Army...IIRC. I was working on the second shift prepping our code to identify differences between what the code from several well-heeled Defense Contractors produced against what the "standard" said it should be producing. (The project was battlefield asset location -- this was waaay before GPS was a gleam in its developers' eye.) Our code was to compare the output from these Contractors' solutions in real time...we were the referee, as it were to define whch of these solutions was the most accurate.
A demo was scheduled for all the Contractors' wares at 0700. Sharp. Full military brass in attendance; never seen so much scrambled eggs in one place live. The sun was coming up and the Law of Demos was raising its ugly head...for us in particular. We had test suites to verify that our code was working correctly, and sure enough, it wasn't. The code was running on the Hewlett-Packard equivalent of a PDP-11 (an HP 26-sumpinornother) that was basically filled to the brim (64K address space; overlays were supported, but they weren't fast enough to do the real-time monitoring and evaluation for 5 separates sets of inputs).
Our team was huddled in our trailer (this was, of course, a field project) trying like hell to debug our code. At T-1hr, 30mins, we found what we think was the bug. But we couldn't fix it correctly. See, the code was in HP assembler, and we had long exhausted the assembler's symbol table space. (Back in the day, that was a thing.) So the "fix" had to be written without adding any symbols. And it had to be small. This meant PC-relative coding (i.e. using *+2 kinds of constructs. The fix required a loop, with two conditional exits at the bottom of the loop. I managed to draw the short straw, and ended up coding this abomination in 4 assembler statements. It just fit...and because the Coding Gods were smiling on us...actually worked! It passed the verification suites, as well as some we cobbled up to verify the conditional exits. With 15 minutes to spare, we submitted our code to the Powers that Be for the Demo...then went home to go to bed.
Word was that our OTE code worked properly throughout the Demo.
Fast forward several months, and I'm now back at the home office, readying for my next assignment. I received our code back from the field, and went to go print up the block of code cobbled up under sleep-deprived pressure, to post on my cubicle wall. I hand wrote on that printout the words: "Don't ever write code like this again!" Later that day, our resident Alpha Geek came in to offer congrats, and saw the code on the wall. He looked at it for a rather long while, then turned around with a big smile and, as he left the cube, said, "Good comment".