The way I know is to make a finite state diagram, (see also
finite state machine)- in this case the thread moves into three possible states controlled by the ifs in the subroutine, plus a 'final return' state and you would need to identify for each state what conditions result in movement between the states. The fact that branch three generates two calls - one that routes to branch two and one back to branch three means that a thread in state three cannot attain the 'final return' state for the example data. Use the possible data ranges to fill out the state transition table described in the link above to identify which boundary conditions lead to final exit and which not.