Xialing Lin

12 papers A* 1Journal 11
YearRankTypeTitle / Venue / Authors
2024 J jnl
Comput. Hum. Behav. Artif. Humans
Matthew J. Craig, Xialing Lin, Chad Edwards, Autumn Edwards
2024 J jnl
J. Comput. Assist. Learn.
Bryan Abendschein, Xialing Lin, Chad Edwards, Autumn Edwards, Varun Rijhwani
2019 J jnl
Comput. Hum. Behav.
Chad Edwards, Autumn Edwards, Brett Stoll, Xialing Lin, Noelle Massey
2019 J jnl
Inf. Process. Manag.
Xialing Lin, Patric R. Spence
2019 A* conf
HRI
Patric R. Spence, Chad Edwards, Autumn Edwards, Xialing Lin
2016 J jnl
Comput. Hum. Behav.
Xialing Lin, Patric R. Spence, Timothy L. Sellnow, Kenneth A. Lachlan
2016 J jnl
Comput. Hum. Behav.
Xialing Lin, Kenneth A. Lachlan, Patric R. Spence
2016 J jnl
Comput. Hum. Behav.
Xialing Lin, Patric R. Spence, Kenneth A. Lachlan
2016 J jnl
Comput. Hum. Behav.
Kenneth A. Lachlan, Patric R. Spence, Xialing Lin, Kristy M. Najarian, Maria Del Greco
2014 J jnl
Comput. Hum. Behav.
Kenneth A. Lachlan, Patric R. Spence, Xialing Lin
2013 J jnl
Comput. Hum. Behav.
Patric R. Spence, Kenneth A. Lachlan, Stephen A. Spates, Ashleigh K. Shelton, Xialing Lin, Christina J. Gentile
2013 J jnl
Comput. Hum. Behav.
Patric R. Spence, Kenneth A. Lachlan, Stephen A. Spates, Xialing Lin
redb/extractors/decompiler/bninja/analysis/medium_level_normalization.py
← Index redb/extractors/decompiler/bninja/analysis/medium_level_normalization.py python
from binaryninja import (
    MediumLevelILInstruction,
    Variable, SSAVariable,
    ILIntrinsic,
)


class MediumLevelNormalization:
    def __init__(self):
        return

    def _collect_ops(self, il, ops):
        if il is None:
            return
        ops.append(int(il.operation))
        operands = getattr(il, "operands", None)
        if not operands:
            return
        for op in operands:
            if isinstance(op, MediumLevelILInstruction):
                self._collect_ops(op, ops)
            elif isinstance(op, (list, tuple)):
                for sub in op:
                    if isinstance(sub, MediumLevelILInstruction):
                        self._collect_ops(sub, ops)

    def normalize_instruction_all_levels(self, instr_il):
        ops = []
        self._collect_ops(instr_il, ops)
        return ops

    def _leaf_type(self, val):
        if isinstance(val, SSAVariable):
            return "SSA_VAR"
        if isinstance(val, Variable):
            return "VAR"
        if isinstance(val, ILIntrinsic):
            return "INTRINSIC"
        if isinstance(val, bool):
            return "BOOL"
        if isinstance(val, float):
            return "FLOAT_CONST"
        if isinstance(val, int):
            return "CONST"
        if isinstance(val, str):
            return "STR"
        return type(val).__name__.upper()

    def _collect(self, il, out_op):
        if il is None:
            return
        out_op.append(int(il.operation))
        operands = getattr(il, "operands", None)
        if not operands:
            return
        for op in operands:
            if isinstance(op, MediumLevelILInstruction):
                self._collect(op, out_op)
            elif isinstance(op, (list, tuple)):
                for sub in op:
                    if isinstance(sub, MediumLevelILInstruction):
                        self._collect(sub, out_op)
                    else:
                        out_op.append(self._leaf_type(sub))
            else:
                out_op.append(self._leaf_type(op))

    def normalize_instr_with_operands(self, instr_il):
        ops = []
        self._collect(instr_il, ops)
        return ops