(self, labels=None, reset:bool=False)
Assign default names to all unified variables.

        :param labels:  Known labels in the binary.
        :param reset:   Reset all variable names or not.
        :return:        None
Assign default names to all unified variables.
Assign default names to all unified variables .
def assign_unified_variable_names(self, labels=None, reset:bool=False):
        """
        Assign default names to all unified variables.

        :param labels:  Known labels in the binary.
        :param reset:   Reset all variable names or not.
        :return:        None
        """

        if not self._unified_variables:
            return

        sorted_stack_variables = [ ]
        sorted_reg_variables = [ ]
        arg_vars = [ ]

        for var in self._unified_variables:
            if isinstance(var, SimStackVariable):
                if var.ident and var.ident.startswith('iarg_'):
                    arg_vars.append(var)
                else:
                    sorted_stack_variables.append(var)

            elif isinstance(var, SimRegisterVariable):
                if var.ident and var.ident.startswith('arg_'):
                    arg_vars.append(var)
                else:
                    sorted_reg_variables.append(var)

            elif isinstance(var, SimMemoryVariable):
                if not reset and var.name is not None:
                    continue
                # assign names directly
                if labels is not None and var.addr in labels:
                    var.name = labels[var.addr]
                    if "@@" in var.name:
                        var.name = var.name[:var.name.index("@@")]
                elif var.ident:
                    var.name = var.ident
                else:
                    var.name = f"g_{var.addr:x}"

        # rename variables in a fixed order
        var_ctr = count(0)

        sorted_stack_variables = sorted(sorted_stack_variables, key=lambda v: v.offset)
        sorted_reg_variables = sorted(sorted_reg_variables, key=lambda v: v.reg)

        for var in chain(sorted_stack_variables, sorted_reg_variables):
            idx = next(var_ctr)
            if var.name is not None and not reset:
                continue
            if isinstance(var, SimStackVariable):
                var.name = f'v{idx}'
            elif isinstance(var, SimRegisterVariable):
                var.name = f"v{idx}"
            # clear the hash cache
            var._hash = None

        # rename arguments but keeping the original order
        arg_ctr = count(0)
        arg_vars = sorted(arg_vars, key=lambda v: int(v.ident[v.ident.index("_")+1:]) if v.ident else 0)
        for var in arg_vars:
            idx = next(arg_ctr)
            if var.name is not None and not reset:
                continue
            var.name = f"a{idx}"
            var._hash = None
def assign_unified_variable_names ( self , labels = None , reset : bool = False ) : if not self . _unified_variables : return sorted_stack_variables = [ ] sorted_reg_variables = [ ] arg_vars = [ ] for var in self . _unified_variables : if isinstance ( var , SimStackVariable ) : if var . ident and var . ident . startswith ( 'iarg_' ) : arg_vars . append ( var ) else : sorted_stack_variables . append ( var ) elif isinstance ( var , SimRegisterVariable ) : if var . ident and var . ident . startswith ( 'arg_' ) : arg_vars . append ( var ) else : sorted_reg_variables . append ( var ) elif isinstance ( var , SimMemoryVariable ) : if not reset and var . name is not None : continue # assign names directly if labels is not None and var . addr in labels : var . name = labels [ var . addr ] if "@@" in var . name : var . name = var . name [ : var . name . index ( "@@" ) ] elif var . ident : var . name = var . ident else : var . name = f"g_{var.addr:x}" # rename variables in a fixed order var_ctr = count ( 0 ) sorted_stack_variables = sorted ( sorted_stack_variables , key = lambda v : v . offset ) sorted_reg_variables = sorted ( sorted_reg_variables , key = lambda v : v . reg ) for var in chain ( sorted_stack_variables , sorted_reg_variables ) : idx = next ( var_ctr ) if var . name is not None and not reset : continue if isinstance ( var , SimStackVariable ) : var . name = f'v{idx}' elif isinstance ( var , SimRegisterVariable ) : var . name = f"v{idx}" # clear the hash cache var . _hash = None # rename arguments but keeping the original order arg_ctr = count ( 0 ) arg_vars = sorted ( arg_vars , key = lambda v : int ( v . ident [ v . ident . index ( "_" ) + 1 : ] ) if v . ident else 0 ) for var in arg_vars : idx = next ( arg_ctr ) if var . name is not None and not reset : continue var . name = f"a{idx}" var . _hash = None