Cost estimation emulator in c code