Hacker News new | ask | show | jobs
by isoprophlex 46 days ago
What the hell is up with that comparison at the end?! Seems... overly verbose?
2 comments

Most likely this is decompiled and not the way it was originally written.
Yep, and you can prompt something like "the function was a decompiled version, translate it into a readable version", if you don't like reading [probably] ghidra output.
The programmer probably wrote memcmp(pass, buf, 5) which compilers will often fold into an inlined loop, or a few comparisons if they know the 3rd arg.

The weird thing is it didn't emit a 32-bit load+compare for the first 4 bytes, this could probably be done with 2 comparsions. Idk. Maybe weird CPU with stricter alignment rules.

It's a fridge. Who knows what microcontroller CPU is there, and which toolchain they use.