When a divide is a shift
The mirror of the multiply-shift: dividing an unsigned value by a constant power of two never needs divw. The compiler strength-reduces it to a logical right shift — srwi rD, rA, n computes rA >> n, which for an unsigned rA is rA ÷ 2ⁿ. (Signed division can't do this directly, which is why these arguments are u32 and the instruction is srwi, not srawi.)
Consider ratio(p, q), dividing two unsigned values by different powers of two and subtracting:
srwi r4, r4, 2 # r4 = q >> 2 = q / 4
srwi r0, r3, 3 # r0 = p >> 3 = p / 8
subf r3, r4, r0 # r3 = r0 - r4 = (p / 8) - (q / 4)
blr
Each srwi divides one argument independently, then subf combines them (subf rD, rA, rB is rB − rA). The shift amount is the exponent: shifting right by 2 divides by 4, by 3 divides by 8.
The target uses the same shift-as-divide idea with different shift amounts and a different combining instruction. Read each srwi's count, turn it into a divisor, and see how the two results are joined.
Your task
Write func_8006bff0 to reproduce the assembly above.