Users of LLVMBuildCast currently need to implement their own logic to determine the best cast opcode. In cases where the source value and destination type is known, LLVM already has the CastInst::getCastOpcode function to determine the opcode based on type combinations.
This simply exposes the existing function to users of the C API.