I am not sure which folders are the “offiical” ones for the Rstan package.
all Stan interfaces use the core Stan services which are written in C++.
I suggest that instead of looking at the source code, you read the NUTS algorithm paper: https://jmlr.org/papers/volume15/hoffman14a/hoffman14a.pdf
and Michael Betancourt’s very beautiful introduction to HMC: https://arxiv.org/pdf/1701.02434.pdf
note that the latter ends with this:
Although Stan (Stan Development Team, 2017) was first developed around this original No-U-Turn sampler, more recent releases have adopted some modifications. In addition to the generalized No-U-Turn termination criterion, the Hamiltonian Monte Carlo implemen- tation in Stan uses multinomial sampling from each trajectory instead of slice sampling, which provides a significant improvement in overall performance.