knowing absolutely nothing about afl i still decided to take a look at your code (attachment). i do know my share of c/c++ however and since afl looks so familiar....
highlighted is the first switch statement, so the code breaks obviously here. that means the switch statement is not correct...