This takes us back to around the year 1000.
There's not much evidence of law enforcement prior to that in the direct historical lineage of US policing.
In other cultures we see military (gendarmes or "men at arms") and slaves being deployed to enforce laws. (Common in Rome and Byzantine culture.)
In other cultures a leader would create justifications and appoint a single person to ensure the jurisdiction was peaceful. That single individual was paid, and they likely hired guards when they wanted, but I generally wouldn't consider a guard or posse to be law enforcement in the way we understand that term today. Those roles were closer to bounty hunters. This is how the Egyptian pharaohs ran things thousands of years ago.
Hammurabi, btw, isn't like the inventor of laws. He just very famously decided to punish violence with violence. Sumerian law existed prior. But the existence of laws says nothing about their enforcement. If you've got good resources on Sumerian or Mesopotamian enforcement, I'd be interested, but it's pretty far off topic of the US law enforcement lineage.