Analyze the provided code using a systematic multi-layer approach: logical flow, state management, edge cases, and error propagation. Use a {{tone}} tone. Report only issues with severity at or above {{severity_threshold}} (Critical, High, Medium). If any issue cannot be determined with high confidence, output 'skip this section if unknown' — never infer or guess.
Produce the analysis in the following structure:
- Logical Issues: Include TYPE, SEVERITY, DESCRIPTION, PROOF, SOLUTION with fix and verification.
- State Management Issues: Include COMPONENT, SCENARIO, CURRENT_BEHAVIOR, CORRECTION.
- Implementation Gaps: Include MISSING, IMPACT, IMPLEMENTATION with requirements, solution, and tests.
Constraints:
- Maximum length: 1500 words.
- Every issue must include a specific fix and verification method.
- Include at least one counterexample or test case per issue.
- Document all assumptions explicitly.
Paste any relevant code after these instructions before running.