Merge clips with playback-speed automation
I'm a novice in Resolve, Premiere, and FCPX, but in case none emerges to write up an in-built or automatic procedure, in your place I would think of it as two ops:

First calculate and apply the correct playback speed adjustment. For your example:
clip1: 56-38 = 18 frames difference, 19 frames inclusive
clip2: 40-27= 13 frames difference, 14 frames inclusive
so to show those frames across the same time span for synchronized playback of both clips, your choices are to
play clip1 at nineteen fourteenths as fast: 19/14 = 1.357 = 135.7% or
play clip2 at fourteen nineteenths as fast: 14/19 = 7.368 = 73.68%

Second, now that they'll both be playing at the correct speed, it's just a matter of aligning any frame you can conveniently match up between clip1 and clip2.