Maximum number of ways to get out of check What is the maximum number of legal moves in a legal position, given that the player is in check?

It's easy to see that 43 is an upper bound. Let's suppose the white K is in check along a diagonal by a Q or B (other cases are similar or easier). Then White has at most 7 legal K moves; a white Q has at most 3 moves (interposition or capture); a white B of the right color has at most one move; and a white R, N, or P has at most 2 moves. Even if White has lost no pieces and has promoted all his pawns to queens, he has no more than 1*7 + 9*3 + 1*1 + 4*2 = 43 legal moves.

In fact it's easy to see that 43 cannot be attained. If White has 7 legal K moves, then one of them must be to capture the checking piece. But in that case no interposition is possible, the only legal non-K moves are captures, so White has at most 21 moves total.
Of course we can do better. We can always do better. 42 legal responses with a little trick.

[FEN "3rB2k/2P1P3/1NQ1QN2/2Q1QN2/2Q1Q3/1R3R2/3K1B2/8 w - - 0 1"]


My previous attempt, 40 legal responses:

[FEN "8/4N2R/3QQQQ1/1K5r/3QQQQ1/BB1NN2R/8/1k6 w - - 0 1"]


And 39 legal responses with a bishop check (and the position is legal, black's last move was ...h2-h1=B+):

[FEN "7k/1K6/4RN2/5QN1/B1R3QN/3Q3Q/3NQ3/4NQ1b w - - 0 1"]