'This scans through an objects imports and hooks them with simprocedures from our library whenever possible'

def _register_object(self, obj):

    missing_libs = []
    for lib_name in self.loader.missing_dependencies:
        try:
            missing_libs.append(SIM_LIBRARIES[lib_name])
        except KeyError:
            l.info('There    are    no    simprocedures    for    missing    library    %s    :(', lib_name)
    for reloc in obj.imports.itervalues():
        func = reloc.symbol
        if (func is None):
            continue
        if (not func.is_function):
            continue
        if (not reloc.resolved):
            l.debug("Ignoring    unresolved    import    '%s'    from    %s    ...?", func.name, reloc.owner_obj)
            continue
        if self.is_hooked(reloc.symbol.resolvedby.rebased_addr):
            l.debug('Already    hooked    %s    (%s)', func.name, reloc.owner_obj)
            continue
        if (func.resolved and (func.resolvedby.owner_obj is not self.loader.extern_object) and (func.name not in self._ignore_functions)):
            if self._check_user_blacklists(func.name):
                continue
            owner_name = func.resolvedby.owner_obj.provides
            if isinstance(self.loader.main_object, cle.backends.pe.PE):
                owner_name = owner_name.lower()
            if (owner_name not in SIM_LIBRARIES):
                continue
            sim_lib = SIM_LIBRARIES[owner_name]
            if (not sim_lib.has_implementation(func.name)):
                continue
            l.info('Using    builtin    SimProcedure    for    %s    from    %s', func.name, sim_lib.name)
            self.hook_symbol(func.name, sim_lib.get(func.name, self.arch))
        elif ((reloc.resolvewith is not None) and (reloc.resolvewith in SIM_LIBRARIES)):
            sim_lib = SIM_LIBRARIES[reloc.resolvewith]
            if self._check_user_blacklists(func.name):
                if (not func.is_weak):
                    l.info('Using    stub    SimProcedure    for    unresolved    %s    from    %s', func.name, sim_lib.name)
                    self.hook_symbol(func.name, sim_lib.get_stub(func.name, self.arch))
            else:
                l.info('Using    builtin    SimProcedure    for    unresolved    %s    from    %s', func.name, sim_lib.name)
                self.hook_symbol(func.name, sim_lib.get(func.name, self.arch))
        elif missing_libs:
            for sim_lib in missing_libs:
                if sim_lib.has_metadata(func.name):
                    if self._check_user_blacklists(func.name):
                        if (not func.is_weak):
                            l.info('Using    stub    SimProcedure    for    unresolved    %s    from    %s', func.name, sim_lib.name)
                            self.hook_symbol(func.name, sim_lib.get_stub(func.name, self.arch))
                    else:
                        l.info('Using    builtin    SimProcedure    for    unresolved    %s    from    %s', func.name, sim_lib.name)
                        self.hook_symbol(func.name, sim_lib.get(func.name, self.arch))
                    break
            else:
                if (not func.is_weak):
                    l.info('Using    stub    SimProcedure    for    unresolved    %s', func.name)
                    self.hook_symbol(func.name, missing_libs[0].get(func.name, self.arch))
        elif (not func.is_weak):
            l.info('Using    stub    SimProcedure    for    unresolved    %s', func.name)
            self.hook_symbol(func.name, SIM_PROCEDURES['stubs']['ReturnUnconstrained']())
