You have exactly the right idea -- multiply by the desired output range, divide by the available input range, and add an offset to get it to start where you want.
I will give you two warnings. First, the OI doesn't really want to see a potentiometer giving it a voltage. It wants to see a variable resistance. You won't necessarily get the full 0-254 range of values in either case, so you might need to tweak your formula slightly to compensate.
Second, the compiler is notorious for overflowing intermediate results when you do things like multiplying values that each fit in eight bits. A bit of (int)-casting will force the code to do 16-bit arithmetic, and you should be fine.
Code:
pwm02 = (int)p3_aux * 154 / 254 + 100;