uroboros-diversification/src/analysis/share_lib_helper.py
def scan(self):
        """
        Scan instruction list and modify PC relative code with labels
        """
        i = 0
        inlen = len(self.instrs) - 1
        while i < inlen:
            h1 = self.instrs[i]
            if get_loc(h1).loc_addr >= self.funcs[self.curr_func][1]:
                # It can be assumed that the base register is set only inside a single function
                self.curr_func += 1
                self.curr_regs.clear()
            if isinstance(h1, Types.TripleInstr) and (self.match_get_pc_thunk(h1) \
              or (h1[0].upper() == 'MOV' and isinstance(h1[2], Types.RegClass) \
              and h1[2].upper() in self.curr_regs and isinstance(h1[1], Types.RegClass))):
                # .got.plt address can also be copied to more than one register
                self.curr_regs.add(h1[1].upper())
            elif len(self.curr_regs) > 0:
                if isinstance(h1, Types.DoubleInstr):
                    self.instrs[i] = Types.DoubleInstr((h1[0], self.v_exp(h1[1]), h1[2], h1[3]))
                elif not isinstance(h1, Types.SingleInstr):
                    if isinstance(h1, Types.TripleInstr):
                        self.instrs[i] = Types.TripleInstr((h1[0], self.v_exp(h1[1]), self.v_exp(h1[2]), h1[3], h1[4]))
                    elif isinstance(h1, Types.FourInstr):
                        self.instrs[i] = Types.FourInstr((h1[0], h1[1], self.v_exp(h1[2]), h1[3], h1[4], h1[5]))
                    if isinstance(h1[1], Types.RegClass) and h1[1].upper() in self.curr_regs:
                        # Remove if overridden
                        self.curr_regs.remove(h1[1].upper())
            i += 1

        Scan instruction list and modify PC relative code with labels
        
Scan instruction list and modify PC relative code with labels
Scan instruction list and modify PC relative code with labels
def scan(self):
        i = 0
        inlen = len(self.instrs) - 1
        while i < inlen:
            h1 = self.instrs[i]
            if get_loc(h1).loc_addr >= self.funcs[self.curr_func][1]:
                self.curr_func += 1
                self.curr_regs.clear()
            if isinstance(h1, Types.TripleInstr) and (self.match_get_pc_thunk(h1) \
              or (h1[0].upper() == 'MOV' and isinstance(h1[2], Types.RegClass) \
              and h1[2].upper() in self.curr_regs and isinstance(h1[1], Types.RegClass))):
                self.curr_regs.add(h1[1].upper())
            elif len(self.curr_regs) > 0:
                if isinstance(h1, Types.DoubleInstr):
                    self.instrs[i] = Types.DoubleInstr((h1[0], self.v_exp(h1[1]), h1[2], h1[3]))
                elif not isinstance(h1, Types.SingleInstr):
                    if isinstance(h1, Types.TripleInstr):
                        self.instrs[i] = Types.TripleInstr((h1[0], self.v_exp(h1[1]), self.v_exp(h1[2]), h1[3], h1[4]))
                    elif isinstance(h1, Types.FourInstr):
                        self.instrs[i] = Types.FourInstr((h1[0], h1[1], self.v_exp(h1[2]), h1[3], h1[4], h1[5]))
                    if isinstance(h1[1], Types.RegClass) and h1[1].upper() in self.curr_regs:
                        self.curr_regs.remove(h1[1].upper())
            i += 1
def scan ( self ) : i = 0 inlen = len ( self . instrs ) - 1 while i < inlen : h1 = self . instrs [ i ] if get_loc ( h1 ) . loc_addr >= self . funcs [ self . curr_func ] [ 1 ] : self . curr_func += 1 self . curr_regs . clear ( ) if isinstance ( h1 , Types . TripleInstr ) and ( self . match_get_pc_thunk ( h1 ) or ( h1 [ 0 ] . upper ( ) == 'MOV' and isinstance ( h1 [ 2 ] , Types . RegClass ) and h1 [ 2 ] . upper ( ) in self . curr_regs and isinstance ( h1 [ 1 ] , Types . RegClass ) ) ) : self . curr_regs . add ( h1 [ 1 ] . upper ( ) ) elif len ( self . curr_regs ) > 0 : if isinstance ( h1 , Types . DoubleInstr ) : self . instrs [ i ] = Types . DoubleInstr ( ( h1 [ 0 ] , self . v_exp ( h1 [ 1 ] ) , h1 [ 2 ] , h1 [ 3 ] ) ) elif not isinstance ( h1 , Types . SingleInstr ) : if isinstance ( h1 , Types . TripleInstr ) : self . instrs [ i ] = Types . TripleInstr ( ( h1 [ 0 ] , self . v_exp ( h1 [ 1 ] ) , self . v_exp ( h1 [ 2 ] ) , h1 [ 3 ] , h1 [ 4 ] ) ) elif isinstance ( h1 , Types . FourInstr ) : self . instrs [ i ] = Types . FourInstr ( ( h1 [ 0 ] , h1 [ 1 ] , self . v_exp ( h1 [ 2 ] ) , h1 [ 3 ] , h1 [ 4 ] , h1 [ 5 ] ) ) if isinstance ( h1 [ 1 ] , Types . RegClass ) and h1 [ 1 ] . upper ( ) in self . curr_regs : self . curr_regs . remove ( h1 [ 1 ] . upper ( ) ) i += 1
Scan instruction list and modify PC relative code with labels
Scan instruction list and modify PC relative code with labels
"""
        Scan instruction list and modify PC relative code with labels
        """ # It can be assumed that the base register is set only inside a single function # .got.plt address can also be copied to more than one register # Remove if overridden
self