Unwinding Conditions for Security in Imperative Languages