(args, prototype=None)
return result
Come up with a plausible SimTypeFunction for the given args (as would be passed to e.g. setup_callsite).

        You can pass a variadic function prototype in the `base_type` parameter and all its arguments will be used,
        only guessing types for the variadic arguments.
Come up with a plausible SimTypeFunction for the given args (as would be passed to e.g. setup_callsite).
Come up with a plausible SimTypeFunction for the given args ( as would be passed to e . g . setup_callsite ) .
def guess_prototype(args, prototype=None):
        """
        Come up with a plausible SimTypeFunction for the given args (as would be passed to e.g. setup_callsite).

        You can pass a variadic function prototype in the `base_type` parameter and all its arguments will be used,
        only guessing types for the variadic arguments.
        """
        if type(prototype) is str:
            prototype = parse_signature(prototype)
        elif prototype is None:
            l.warning("Guessing call prototype. Please specify prototype.")

        charp = SimTypePointer(SimTypeChar())
        result = prototype if prototype is not None else SimTypeFunction([], charp)
        for arg in args[len(result.args):]:
            if type(arg) in (int, bytes, PointerWrapper):
                result.args.append(charp)
            elif type(arg) is float:
                result.args.append(SimTypeDouble())
            elif isinstance(arg, claripy.ast.BV):
                result.args.append(SimTypeNum(len(arg), False))
            elif isinstance(arg, claripy.ast.FP):
                if arg.sort == claripy.FSORT_FLOAT:
                    result.args.append(SimTypeFloat())
                elif arg.sort == claripy.FSORT_DOUBLE:
                    result.args.append(SimTypeDouble())
                else:
                    raise TypeError("WHAT kind of floating point is this")
            else:
                raise TypeError("Cannot guess FFI type for %s" % type(arg))

        return result
def guess_prototype ( args , prototype = None ) : if type ( prototype ) is str : prototype = parse_signature ( prototype ) elif prototype is None : l . warning ( "Guessing call prototype. Please specify prototype." ) charp = SimTypePointer ( SimTypeChar ( ) ) result = prototype if prototype is not None else SimTypeFunction ( [ ] , charp ) for arg in args [ len ( result . args ) : ] : if type ( arg ) in ( int , bytes , PointerWrapper ) : result . args . append ( charp ) elif type ( arg ) is float : result . args . append ( SimTypeDouble ( ) ) elif isinstance ( arg , claripy . ast . BV ) : result . args . append ( SimTypeNum ( len ( arg ) , False ) ) elif isinstance ( arg , claripy . ast . FP ) : if arg . sort == claripy . FSORT_FLOAT : result . args . append ( SimTypeFloat ( ) ) elif arg . sort == claripy . FSORT_DOUBLE : result . args . append ( SimTypeDouble ( ) ) else : raise TypeError ( "WHAT kind of floating point is this" ) else : raise TypeError ( "Cannot guess FFI type for %s" % type ( arg ) ) return result