Does voting mean that you accept the legitimacy of the State?

Short answer: No.

Longer answer: No, because choosing one master instead of another master does not mean that you want a master at all.

What it means is simply that you believe that the rule of one master would be less harsh than the rule of another, or in some other way would be preferable.

For example, if you were convinced that one candidate would be more likely than the other(s) to start WW III, it would be reasonable (and not a NAP violation) to vote for that candidate.

Of course, if I were given the choice of voting for having no President at all, and there were any possibility that such a choice would actually have an effect on the outcome, I would take it; otherwise I could hardly claim to be an anarchist. But such a choice was not available, so I picked the lesser of two evils.