I have scenario when function A calls function B, and then A calls function C.
Assuming x64, when calling function B RCX is prepared, then B doesn’t spoil RCX so the compiler keep uses RCX in the call for function C. The decompiler is getting confused and not sure where the argument comes from.
Can I mark function B as “not spoiling RCX” in any way?
You can tell IDA/Hex-Rays that a function doesn’t spoil certain registers using the __spoils<…> specifier — just list only the registers that are spoiled and omit the ones you want preserved (like RCX).