It really depends what the OP means by messy. If by messy he means fairly straightforward code but not built for easy extension and lacking proper layout/architecture then a few days is enough.
On the other hand if by messy he means complex code implementing requirements in a non-obvious way then it could take much longer. I've seen plenty of code that uses multiple layers of indirection when a simple switch statement would suffice. Where code that looks like a simple mistake is actually implementing a critical requirement. Where you have to keep multiple heavily abstracted domain models in your head at once to understand the code because there is no clean separation.
It depends on how well you need to understand the code to be able to make changes. Reasonably well written code can be skimmed at speeds of up to 2500 lines of code an hour and only the core domain objects and algorithms need more intense study.
On the other hand if you have to understand the entire codebase in order to change it then 100 lines of code an hour is an upper limit.
So anywhere from half a day to two weeks depending on what you mean by messy.