def METHOD_NAME(vw, fva, emu, emumon, stkstart):
    # More than 40 args?  no way...
    argc = stackargs = (int(emumon.stackmax) >> 2)
    if argc > 40:
        emumon.logAnomaly(emu, fva, 'Crazy Stack Offset Touched: 0x%.8x' % emumon.stackmax)
        argc = 0
    callconv = "cdecl"  # Default to cdecl
    # see if we have stdcall return bytes
    if emumon.retbytes is not None:
        callconv = "stdcall"
        argc = emumon.retbytes >> 2
    stackidx = 0  # arg index of first *stack* arg
    # Log registers we used but didn't init
    # but don't take into account ebp and esp
    emu.uninit_use.pop(e_i386.REG_ESP, None)
    emu.uninit_use.pop(e_i386.REG_EBP, None)
    undefkeys = list(emu.uninit_use.keys())
    undefkeys.sort()
    undeflen = len(undefkeys)
    if undeflen:
        regcall = regcalls.get(tuple(undefkeys))
        if regcall is not None:
            callconv, addargc = regcall
            argc += addargc
        vw.setFunctionMeta(fva, "UndefRegUse", undefkeys)
    # if we're callee cleanup, make sure we *actually* clean up our space
    # otherwise, revert us to caller cleanup
    realcallconv = callconv
    if emumon.endstack:
        stkoff = (emumon.endstack - stkstart) >> 2
        if callconv in argnames:
            # do our stack args line up with what we cleaned up?
            if abs(stkoff) != stackargs:
                # we're probably caller cleanup then
                realcallconv = callconv + '_caller'
    if argc > 64:
        callconv = 'unkcall'
        argc = 0
    # Add argument indexes to our argument names
    funcargs = [ argcname(callconv, i) for i in range(argc) ]
    api = ('int',None,realcallconv,None,funcargs)
    vw.setFunctionApi(fva, api)
    return api