Nabil R. Adam

135 papers A* 2A 6B 8C 13Misc 10Journal 33Unranked 52
YearRankTypeTitle / Venue / Authors
2022 J jnl
IEEE Trans. Serv. Comput.
Abeer Elahraf, Ayesha Afzal, Ahmed Akhtar, Basit Shafiq, Jaideep Vaidya, Shafay Shamail, Nabil R. Adam
2021 J jnl
IEEE Trans. Serv. Comput.
Ayesha Afzal, Basit Shafiq, Shafay Shamail, Abeer Elahraf, Jaideep Vaidya, Nabil R. Adam
2020 A conf
ICDCS
Ayesha Afzal, Muhammad Adeel Zahid, Ahmad Akhtar, Basit Shafiq, Shafay Shamail, Abeer Elahraf, Jaideep Vaidya, Nabil R. Adam
2020 J jnl
IEEE Trans. Big Data
Debopriya Ghosh, Javier Cabrera, Tarek N. Adam, Petros Levounis, Nabil R. Adam
2020 J jnl
Bus. Process. Manag. J.
Ayesha Afzal, Basit Shafiq, Shafay Shamail, Nabil R. Adam
2020 conf
DG.O
Soon Ae Chun, Roshan Singh, Pamela Morgan, Nabil R. Adam, Vijay Atluri
2019 conf
DG.O
Soon Ae Chun, Venkata Avinash Paturu, Shengcheng Yuan, Rohit Pathak, Vijayalakshmi Atluri, Nabil R. Adam
2019 conf
DG.O
Momna Anam, Basit Shafiq, Shafay Shamail, Soon Ae Chun, Nabil R. Adam
2018 conf
ICSE (Companion Volume)
Ayesha Afzal, Ahmad Akhtar, Nabila Ishfaq, Basit Shafiq, Shafay Shamail, Abeer Elahraf, Jaideep Vaidya, Nabil R. Adam
2018 J jnl
Int. J. Cooperative Inf. Syst.
Hafiz Salman Asif, Tanay Talukdar, Jaideep Vaidya, Basit Shafiq, Nabil R. Adam
2018 conf
DG.O
Ayesha Afzal, Basit Shafiq, Shafay Shamail, Abeer Elahraf, Jaideep Vaidya, Nabil R. Adam
2017 Misc conf
AMIA
Jaideep Vaidya, Basit Shafiq, Muazzam Asani, Nabil R. Adam, Xiaoqian Jiang, Lucila Ohno-Machado
2017 conf
DG.O
Daphna Shwartz-Asher, Soon Ae Chun, Nabil R. Adam
2017 ch.
Encyclopedia of GIS
Vandana P. Janeja, Nabil R. Adam
2017 Misc conf
SEC
Hafiz Salman Asif, Jaideep Vaidya, Basit Shafiq, Nabil R. Adam
2016 conf
DG.O
Debopriya Ghosh, Soon Ae Chun, Basit Shafiq, Nabil R. Adam
2016 conf
CIC
Hafiz Salman Asif, Tanay Talukdar, Jaideep Vaidya, Basit Shafiq, Nabil R. Adam
2016 conf
DG.O
Hui Zhang, Yi Liu, Nabil R. Adam
2016 ed.
JCDL
Nabil R. Adam, Lillian (Boots) Cassel, Yelena Yesha, Richard Furuta, Michele C. Weigle
2016 conf
DG.O
Daphna Shwartz-Asher, Soon Ae Chun, Nabil R. Adam
2015 conf
ICETE (Selected Papers)
Hassaan Irshad, Basit Shafiq, Jaideep Vaidya, Muhammad Ahmed Bashir, Hafiz Salman Asif, Sameera Ghayyur, Shafay Shamail, Nabil R. Adam
2015 Misc conf
WSC
Shengcheng Yuan, Yi Liu, Hui Zhang, Soon Ae Chun, Nabil R. Adam
2015 C conf
SECRYPT
Hassaan Irshad, Basit Shafiq, Jaideep Vaidya, Muhammad Ahmed Bashir, Shafay Shamail, Nabil R. Adam
2014 conf
DG.O
David Lorenzi, Jaideep Vaidya, Basit Shafiq, Soon Ae Chun, Neelima Vegesna, Zamil S. Alzamil, Nabil R. Adam, Seth Wainer, Vijayalakshmi Atluri
2013 conf
DG.O
David Lorenzi, Jaideep Vaidya, Soon Ae Chun, Basit Shafiq, Varuna Naik, Vijayalakshmi Atluri, Nabil R. Adam
2012 Misc conf
WSC
Andreas Tolk, Erdal Cayirci, Randall Shumaker, Nabil R. Adam, Stefan Pickl, Joseph A. Sullivan, William F. Waite
2012 conf
SocialCom/PASSAT
Xiaoyun He, Jaideep Vaidya, Basit Shafiq, Nabil R. Adam
2012 B conf
DBSec
Danish Mehmood, Basit Shafiq, Jaideep Vaidya, Yuan Hong, Nabil R. Adam, Vijayalakshmi Atluri
2012 C conf
CollaborateCom
Basit Shafiq, Soon Ae Chun, Jaideep Vaidya, Nazia Badar, Nabil R. Adam
2012 J jnl
IEEE Trans. Serv. Comput.
Aabhas V. Paliwal, Basit Shafiq, Jaideep Vaidya, Hui Xiong, Nabil R. Adam
2012 J jnl
IEEE Intell. Syst.
Nabil R. Adam, Basit Shafiq, Robin Staffin
2012 J jnl
Web Intell. Agent Syst.
Xiaoyun He, Jaideep Vaidya, Basit Shafiq, Nabil R. Adam, Vijayalakshmi Atluri
2011 conf
CTS
Nabil R. Adam
2011 J jnl
J. Comput. Secur.
Xiaoyun He, Haibing Lu, Jaideep Vaidya, Nabil R. Adam
2011 ch.
Encyclopedia of Cryptography and Security (2nd Ed.)
Nabil R. Adam, Haibing Lu, Jaideep Vaidya, Basit Shafiq
2010 conf
CSIIRW
Nabil R. Adam
2010 ch.
Complex Data Warehousing and Knowledge Discovery for Advanced Retrieval Development
Songmei Yu, Vijayalakshmi Atluri, Nabil R. Adam
2010 J jnl
Int. J. Comput. Model. Algorithms Medicine
Xiaoyun He, Jaideep Vaidya, Basit Shafiq, Nabil R. Adam, Tom White
2010 C conf
SACMAT
Jaideep Vaidya, Vijayalakshmi Atluri, Basit Shafiq, Nabil R. Adam
2010 conf
Web Intelligence
Xiaoyun He, Jaideep Vaidya, Basit Shafiq, Nabil R. Adam, Xiaodong Lin
2010 J jnl
Data Min. Knowl. Discov.
Vandana Pursnani Janeja, Nabil R. Adam, Vijayalakshmi Atluri, Jaideep Vaidya
2009 conf
CSIIRW
Nabil R. Adam
2009 A conf
CIKM
Yuan Hong, Xiaoyun He, Jaideep Vaidya, Nabil R. Adam, Vijayalakshmi Atluri
2009 B conf
PAKDD
Xiaoyun He, Jaideep Vaidya, Basit Shafiq, Nabil R. Adam, Evimaria Terzi, Tyrone Grandison
2009 J jnl
Knowl. Inf. Syst.
Dihua Guo, Hui Xiong, Vijayalakshmi Atluri, Nabil R. Adam
2009 conf
Web Intelligence
Xiaoyun He, Jaideep Vaidya, Basit Shafiq, Nabil R. Adam, Vijay Atluri
2008 ch.
Encyclopedia of GIS
Vandana Pursnani Janeja, Nabil R. Adam
2008 C conf
SACMAT
Jaideep Vaidya, Vijayalakshmi Atluri, Qi Guo, Nabil R. Adam
2008 Misc conf
SAC
Xiaoyun He, Basit Shafiq, Jaideep Vaidya, Nabil R. Adam
2008 B conf
DBSec
Haibing Lu, Xiaoyun He, Jaideep Vaidya, Nabil R. Adam
2008 conf
DG.O
Nabil R. Adam, Vijay Atluri, Soon Ae Chun, John Ellenberger, Basit Shafiq, Jaideep Vaidya, Hui Xiong
2008 ch.
Digital Government
Nabil R. Adam, Vandana P. Janeja, Aabhas V. Paliwal, Vijay Atluri, Soon Ae Chun, Jim Cooper, John Paczkowski, Christof Bornhövd, Joachim Schaper
2007 C conf
ISI
Nabil R. Adam, Vandana Pursnani Janeja, Aabhas V. Paliwal, Basit Shafiq, Cédric Ulmer, Volker Gersabeck, Anne Hardy, Christof Bornhövd, Joachim Schaper
2007 C conf
AICCSA
Nabil R. Adam
2007 conf
DG.O
Soon Ae Chun, Nabil R. Adam, Vijay Atluri
2007 conf
CEC/EEE
Aabhas V. Paliwal, Nabil R. Adam, Basit Shafiq, Christof Bornhövd
2007 Misc conf
AMIA
Nabil R. Adam, Tom White, Basit Shafiq, Jaideep Vaidya, Xiaoyun He
2007 B conf
PAKDD
Dihua Guo, Hui Xiong, Vijay Atluri, Nabil R. Adam
2007 conf
IEEE SCC
Aabhas V. Paliwal, Nabil R. Adam, Christof Bornhövd
2007 Misc conf
SAC
Aabhas V. Paliwal, Nabil R. Adam, Christof Bornhövd
2006 C conf
DEXA
Songmei Yu, Vijayalakshmi Atluri, Nabil R. Adam
2006 conf
DG.O
Soon Ae Chun, Yelena Yesha, Nabil R. Adam, Vijay Atluri
2006 conf
DG.O
Nabil R. Adam, Vijay Atluri, Soon Ae Chun, Francisco J. Artigas, Irfan Bora, Bob Ceberio
2006 conf
SWS
Nabil R. Adam, Ahmet Kozanoglu, Aabhas V. Paliwal, Mahmoud Youssef
2006 B conf
DaWaK
Songmei Yu, Vijayalakshmi Atluri, Nabil R. Adam
2006 conf
STM
Nabil R. Adam, Ahmet Kozanoglu, Aabhas V. Paliwal, Basit Shafiq
2006 conf
DG.O
Nabil R. Adam, Vijayalakshmi Atluri, Rey Koslowski, Robert Grossman, Vandana Pursnani Janeja, Janice Warner
2006 Misc conf
SAC
Mahmoud Youssef, Nabil R. Adam, Vijayalakshmi Atluri
2006 conf
DG.O
Nabil R. Adam, Vijayalakshmi Atluri, Vandana Pursnani Janeja, Aabhas V. Paliwal, Mahmoud Youssef, Soon Ae Chun, Jim Cooper, John Paczkowski, Christof Bornhövd, Ike Nassi, Joachim Schaper
2006 conf
Web Intelligence
Aabhas V. Paliwal, Nabil R. Adam, Hui Xiong, Christof Bornhövd
2005 C conf
IPCCC
Ahmed Gomaa, Nabil R. Adam, Vijayalakshmi Atluri
2005 conf
DG.O
Nabil R. Adam, Vijayalakshmi Atluri, Rey Koslowski, Vandana Pursnani Janeja, Janice Warner, Aabhas V. Paliwal
2005 C conf
ISI
Vandana Pursnani Janeja, Vijayalakshmi Atluri, Jaideep Vaidya, Nabil R. Adam
2005 B conf
MMM
Ahmed Gomaa, Nabil R. Adam, Vijayalakshmi Atluri
2005 conf
DG.O
Vandana Pursnani Janeja, Vijayalakshmi Atluri, Ahmed Gomaa, Nabil R. Adam, Christof Bornhövd, Tao Lin
2005 B conf
Mobile Data Management
Mahmoud Youssef, Vijayalakshmi Atluri, Nabil R. Adam
2005 B conf
DaWaK
Songmei Yu, Vijayalakshmi Atluri, Nabil R. Adam
2005 conf
DG.O
Nabil R. Adam, Vijayalakshmi Atluri, Soon Ae Chun, Patrizia Fariselli, Julia Culver-Hopper, Olana Bojic, Rick T. Stewart, Jim Fruscione, Nick Mannochio
2005 A conf
ICME
Dihua Guo, Vijayalakshmi Atluri, Nabil R. Adam
2005 J jnl
Distributed Parallel Databases
Soon Ae Chun, Vijayalakshmi Atluri, Nabil R. Adam
2004 conf
WIDM
Dong-Ho Kim, Il Im, Vijayalakshmi Atluri, Michael Bieber, Nabil R. Adam, Yelena Yesha
2004 conf
DG.O
Nabil R. Adam, Vijayalakshmi Atluri, Vandana Pursnani Janeja
2004 conf
DG.O
Vandana Pursnani Janeja, Vijayalakshmi Atluri, Nabil R. Adam
2004 conf
DG.O
Nabil R. Adam, Vijayalakshmi Atluri, Soon Ae Chun
2004 Misc conf
SAC
Nabil R. Adam, Vandana Pursnani Janeja, Vijayalakshmi Atluri
2004 conf
RIDE
Soon Ae Chun, Vijayalakshmi Atluri, Nabil R. Adam
2003 J jnl
Commun. ACM
Richard D. Holowczak, Nabil R. Adam, Francisco J. Artigas, Irfan Bora
2003 conf
DG.O
Aabhas V. Paliwal, Nabil R. Adam, Vijayalakshmi Atluri
2003 Misc conf
SAC
Vijayalakshmi Atluri, Nabil R. Adam, Ahmed Gomaa, Igg Adiwijaya
2002 J jnl
IEEE Trans. Knowl. Data Eng.
Nabil R. Adam, Vijayalakshmi Atluri, Elisa Bertino, Elena Ferrari
2002 J jnl
VLDB J.
Elena Ferrari, Nabil R. Adam, Vijayalakshmi Atluri, Elisa Bertino, Ugo Capuozzo
2002 ch.
Advances in Digital Government
Vijayalakshmi Atluri, Soon Ae Chun, Richard D. Holowczak, Nabil R. Adam
2002 C conf
DEXA
Soon Ae Chun, Vijayalakshmi Atluri, Nabil R. Adam
2002 conf
DG.O
Soon Ae Chun, Vijayalakshmi Atluri, Nabil R. Adam
2002 conf
DG.O
Vandana Pursnani Janeja, Vijayalakshmi Atluri, Nabil R. Adam
2001 J jnl
IEEE Trans. Knowl. Data Eng.
Nabil R. Adam, Vijayalakshmi Atluri, Igg Adiwijaya, Sujata Banerjee, Richard D. Holowczak
2001 conf
DEXA Workshop
Chiara Ghirardini, Soon Ae Chun, Vijayalakshmi Atluri, Ibrahim Kamel, Nabil R. Adam
2001 A* conf
ICDM
June-Suh Cho, Nabil R. Adam
2000 conf
ADL
Nabil R. Adam, Igg Adiwijaya, Terence Critchlow, Ron Musick
2000 conf
HICSS
Nabil R. Adam, Anant Jhingran
2000 J jnl
Commun. ACM
Nabil R. Adam, Vijayalakshmi Atluri, Igg Adiwijaya
1999 conf
ADL
Nabil R. Adam, J. H. Bredekamp, Alexander S. Szalay, George Djorgoski, George Lake
1998 J jnl
Computer
Nabil R. Adam, Aryya Gangopadhyay
1998 conf
HICSS (7)
Nabil R. Adam, Igg Adiwijaya, Vijay Atluri, Yelena Yesha
1998 conf
SIGMOD Conference
Nabil R. Adam, Yelena Yesha
1998 J jnl
J. Intell. Inf. Syst.
Nabil R. Adam, Vijayalakshmi Atluri, Wei-kuang Huang
1997 J jnl
IEEE Trans. Knowl. Data Eng.
Nabil R. Adam, Aryya Gangopadhyay
1997 book
Nabil R. Adam, Aryya Gangopadhyay
1997 J jnl
Commun. ACM
Nabil R. Adam, Baruch Awerbuch, Jacob Slonim, Peter Wegner, Yelena Yesha
1997 conf
AAAI/IAAI
Richard D. Holowczak, Nabil R. Adam
1996 ed.
ADL
Nabil R. Adam, Bharat K. Bhargava, Milton Halem, Yelena Yesha
1996 C ed.
Electronic Commerce
Nabil R. Adam, Yelena Yesha
1996 J jnl
IEEE Trans. Knowl. Data Eng.
Nabil R. Adam, Yelena Yesha
1996 J jnl
ACM Comput. Surv.
Nabil R. Adam, Yelena Yesha
1996 J jnl
ACM Comput. Surv.
Nabil R. Adam, Shamim A. Naqvi
1995 conf
HICSS (3)
Nabil R. Adam, Aryya Gangopadhyay
1995 ed.
DL
Nabil R. Adam, Bharat K. Bhargava, Yelena Yesha
1994 J jnl
IEEE Trans. Knowl. Data Eng.
Nabil R. Adam
1994 C conf
Electronic Commerce
Nabil R. Adam, Yelena Yesha
1994 C conf
Electronic Commerce
Nabil R. Adam, Yelena Yesha
1994 conf
DL
Nabil R. Adam, Milton Halem, Shamim A. Naqvi
1994 conf
DL
Nabil R. Adam, Bradley S. Fordham, Yelena Yesha
1993 ed.
Advanced Database Systems
Nabil R. Adam, Bharat K. Bhargava
1993 conf
Advanced Database Systems
Ramesh Subramanian, Nabil R. Adam
1993 J jnl
Int. J. Cooperative Inf. Syst.
Nabil R. Adam, Aryya Gangopadhyay, James Geller
1993 A* conf
ICDE
Nabil R. Adam, Aryya Gangopadhyay
1993 J jnl
IEEE Trans. Software Eng.
Nabil R. Adam, Rajiv Tewari
1993 A conf
CIKM
Ramesh Subramanian, Nabil R. Adam
1992 A conf
ICDCS
Raj Tewari, Nabil R. Adam
1992 J jnl
Inf. Syst.
Rajiv Tewari, Nabil R. Adam
1991 A conf
ICDCS
Nabil R. Adam, Rajiv Tewari
1989 J jnl
J. Manag. Inf. Syst.
Nabil R. Adam, Douglas H. Jones
1989 J jnl
ACM Comput. Surv.
Nabil R. Adam, John C. Wortmann
1987 J jnl
J. Manag. Inf. Syst.
Nabil R. Adam
1983 J jnl
Oper. Res.
Richard E. Nance, Nabil R. Adam, Robert G. Sargent
redb/extractors/decompiler/bninja/analysis/cfg_features.py
← Index redb/extractors/decompiler/bninja/analysis/cfg_features.py python
import struct
from collections import deque
from typing import Optional

import blake3
import mmh3


# ---------------------------------------------------------------------------
# Task 1.1: Core Graph Utilities
# ---------------------------------------------------------------------------

def bfs_order(successors: list[list[int]], n: int) -> list[int]:
    """
    BFS traversal from node 0 (entry block), returns node indices in visit order.
    Unreachable nodes appended at the end.
    """
    if n == 0:
        return []

    visited = set()
    order = []
    queue = deque([0])
    visited.add(0)

    while queue:
        idx = queue.popleft()
        order.append(idx)
        for target in successors[idx]:
            if target not in visited:
                visited.add(target)
                queue.append(target)

    # Append unreachable blocks (dead code)
    for i in range(n):
        if i not in visited:
            order.append(i)

    return order


def bfs_max_depth(successors: list[list[int]], n: int) -> int:
    """
    Maximum BFS depth from entry block (node 0).
    Replaces the per-block depth column with a single scalar.
    """
    if n == 0:
        return 0

    depth = {0: 0}
    max_d = 0
    queue = deque([0])

    while queue:
        node = queue.popleft()
        for s in successors[node]:
            if s not in depth:
                depth[s] = depth[node] + 1
                if depth[s] > max_d:
                    max_d = depth[s]
                queue.append(s)

    return max_d


# ---------------------------------------------------------------------------
# Task 1.2: Back-Edge Detection (Iterative DFS)
# ---------------------------------------------------------------------------

def count_back_edges(successors: list[list[int]], n: int) -> int:
    """
    Count natural loops via iterative DFS back-edge detection.
    A back edge is an edge to a GRAY (in-stack) node.

    Iterative to avoid stack overflow on functions with 1000+ blocks
    (common in obfuscated malware, VM dispatchers, unrolled loops).
    """
    if n == 0:
        return 0

    WHITE, GRAY, BLACK = 0, 1, 2
    color = [WHITE] * n
    back_edges = 0

    stack = [(0, iter(successors[0]))]
    color[0] = GRAY

    while stack:
        u, children = stack[-1]
        try:
            v = next(children)
            if color[v] == GRAY:
                back_edges += 1
            elif color[v] == WHITE:
                color[v] = GRAY
                stack.append((v, iter(successors[v])))
        except StopIteration:
            color[u] = BLACK
            stack.pop()

    return back_edges


# ---------------------------------------------------------------------------
# Task 1.3: Topology Hash
# ---------------------------------------------------------------------------

def compute_topology_hash(
    successors: list[list[int]],
    bfs: list[int],
    n: int,
) -> bytes:
    """
    BLAKE3 hash of BFS-ordered canonical adjacency.
    Pure graph shape — ignores all block content.
    Two functions with identical control flow structure produce identical hashes.

    Returns 16 bytes (128-bit).
    """
    if n == 0:
        return b'\x00' * 16

    # Remap: original index -> BFS position
    remap = {original: position for position, original in enumerate(bfs)}

    canonical = bytearray()
    for position in range(n):
        original_idx = bfs[position]
        remapped_succs = sorted(
            remap[s] for s in successors[original_idx] if s in remap
        )
        # Pack: node_index (2 bytes) + num_successors (1 byte) + successor indices (2 bytes each)
        canonical.extend(struct.pack('<HB', position, len(remapped_succs)))
        for s in remapped_succs:
            canonical.extend(struct.pack('<H', s))

    return blake3.blake3(bytes(canonical)).digest(length=16)


# ---------------------------------------------------------------------------
# Task 1.4: MD-Index (Top-Down and Bottom-Up)
# ---------------------------------------------------------------------------

def compute_md_index_topdown(
    successors: list[list[int]],
    predecessors: list[list[int]],
    bfs: list[int],
) -> int:
    """
    BinDiff-style top-down MD-index.
    Hash of (in_degree, out_degree) sequence in BFS order from entry.
    Returns UInt64.
    """
    if not bfs:
        return 0

    degree_bytes = bytearray()
    for idx in bfs:
        in_deg = min(len(predecessors[idx]), 255)
        out_deg = min(len(successors[idx]), 255)
        degree_bytes.extend(struct.pack('<BB', in_deg, out_deg))

    h = blake3.blake3(bytes(degree_bytes)).digest(length=8)
    return struct.unpack('<Q', h)[0]


def compute_md_index_bottomup(
    successors: list[list[int]],
    predecessors: list[list[int]],
    n: int,
) -> int:
    """
    Bottom-up MD-index: BFS from exit blocks (no successors),
    traversing edges in reverse.
    Returns UInt64.
    """
    if n == 0:
        return 0

    exits = [i for i in range(n) if len(successors[i]) == 0]
    if not exits:
        exits = [n - 1]  # Fallback: use last block

    visited = set(exits)
    order = []
    queue = deque(exits)

    while queue:
        idx = queue.popleft()
        order.append(idx)
        for pred in predecessors[idx]:
            if pred not in visited:
                visited.add(pred)
                queue.append(pred)

    # Append unreachable blocks
    for i in range(n):
        if i not in visited:
            order.append(i)

    degree_bytes = bytearray()
    for idx in order:
        in_deg = min(len(predecessors[idx]), 255)
        out_deg = min(len(successors[idx]), 255)
        degree_bytes.extend(struct.pack('<BB', in_deg, out_deg))

    h = blake3.blake3(bytes(degree_bytes)).digest(length=8)
    return struct.unpack('<Q', h)[0]


# ---------------------------------------------------------------------------
# Task 1.5: Prime Product
# ---------------------------------------------------------------------------

# Small primes assigned to LLIL opcode categories.
# Keys are the integer values of binaryninja.LowLevelILOperation enum members.
# We use integer keys so this module doesn't import binaryninja.
#
# Mapping rationale: same operation class -> same prime.
# Using LLIL (not native asm) makes this architecture-independent.
#
# Populated at import time by cfg.py using the real LowLevelILOperation enum values.
# Unknown ops map to prime 1 (identity element) in compute_prime_product().
LLIL_OP_PRIMES: dict[int, int] = {}


def compute_prime_product(llil_operations: list[int]) -> int:
    """
    Product of small primes assigned to each LLIL opcode.
    Position-independent: block reordering doesn't change the result.
    Mod 2^64 for fixed-size storage.

    Args:
        llil_operations: flat list of LLIL operation enum integer values
                         for all instructions in the function.
    Returns:
        UInt64 prime product, or 0 if no instructions.
    """
    if not llil_operations:
        return 0

    product = 1
    for op in llil_operations:
        prime = LLIL_OP_PRIMES.get(op, 1)
        product = (product * prime) % (2**64)

    return product


# ---------------------------------------------------------------------------
# Task 1.6: ACFG Block Features
# ---------------------------------------------------------------------------

# Instruction category indices for ACFG feature vectors
CAT_ARITHMETIC = 0
CAT_LOGIC = 1
CAT_TRANSFER = 2
CAT_CALL = 3
CAT_COMPARISON = 4
CAT_MEMORY = 5
CAT_OTHER = 6

# Maps LLIL operation integer values to category indices.
# Populated at import time by cfg.py using the real LowLevelILOperation enum.
LLIL_OP_CATEGORIES: dict[int, int] = {}


def build_block_features(
    block_llil_ops: list[list[int]],
    successors: list[list[int]],
    n: int,
) -> list[list[int]]:
    """
    Extract Gemini-style ACFG features per block.

    Args:
        block_llil_ops: per-block list of LLIL operation integer values.
                        block_llil_ops[i] is the list of ops for block i.
                        Empty list if LLIL unavailable for that block.
        successors: index-based adjacency list.
        n: number of blocks.

    Returns:
        List of [instr_count, arithmetic, logic, transfer, call, comparison,
                 memory, successor_count] per block. All values capped at 65535.
    """
    features = []
    for i in range(n):
        cats = [0, 0, 0, 0, 0, 0, 0]
        ops = block_llil_ops[i] if i < len(block_llil_ops) else []
        for op in ops:
            cat = LLIL_OP_CATEGORIES.get(op, CAT_OTHER)
            cats[cat] += 1

        instr_count = len(ops)
        features.append([
            min(instr_count, 65535),
            min(cats[CAT_ARITHMETIC], 65535),
            min(cats[CAT_LOGIC], 65535),
            min(cats[CAT_TRANSFER], 65535),
            min(cats[CAT_CALL], 65535),
            min(cats[CAT_COMPARISON], 65535),
            min(cats[CAT_MEMORY], 65535),
            min(len(successors[i]), 65535),
        ])

    return features


# ---------------------------------------------------------------------------
# Task 1.7: CFG Feature TLSH
# ---------------------------------------------------------------------------

def compute_cfg_feature_tlsh(
    bb_features: list[list[int]],
    bfs: list[int],
) -> Optional[str]:
    """
    TLSH hash of BFS-ordered per-block feature vectors.
    Captures both structure (BFS ordering) and instruction distribution.

    Returns TLSH hex string or None if too few bytes for TLSH (< 50).
    """
    import tlsh as _tlsh

    feature_bytes = bytearray()
    for idx in bfs:
        feats = bb_features[idx]
        feature_bytes.extend(struct.pack(
            '<HBBBBBBB',
            min(feats[0], 65535),
            min(feats[1], 255),
            min(feats[2], 255),
            min(feats[3], 255),
            min(feats[4], 255),
            min(feats[5], 255),
            min(feats[6], 255),
            min(feats[7], 255),
        ))

    if len(feature_bytes) < 50:
        return None

    try:
        h = _tlsh.hash(bytes(feature_bytes))
        return h if h and h != 'TNULL' else None
    except Exception:
        return None


# ---------------------------------------------------------------------------
# Task 1.8: WL-MinHash
# ---------------------------------------------------------------------------

# Pre-computed seeds for MinHash permutations.
NUM_WL_MINHASH_PERMS = 128
_WL_MINHASH_SEEDS = list(range(NUM_WL_MINHASH_PERMS))  # Seeds 0..127


def compute_wl_minhash(
    successors: list[list[int]],
    predecessors: list[list[int]],
    bb_features: list[list[int]],
    n: int,
    iterations: int = 3,
) -> list[int]:
    """
    Weisfeiler-Leman MinHash for fuzzy topology similarity.

    Initial labels: mmh3 hash of per-block ACFG feature tuple (content-aware).
    WL refinement: incorporate sorted neighbor labels at each iteration.
    MinHash: 128-permutation signature over shingle set.

    Returns list of 128 uint8 values, or [255]*128 sentinel for empty functions.
    """
    if n == 0:
        return [255] * NUM_WL_MINHASH_PERMS

    # Initial labels: hash of instruction category tuple per block
    labels = []
    for i in range(n):
        feats = bb_features[i] if i < len(bb_features) else [0] * 8
        # mmh3 with seed=0 for initial labels
        label = mmh3.hash(str(tuple(feats)), 0) & 0xFFFFFFFF
        labels.append(label)

    # Collect shingles: (iteration, label) pairs as strings for mmh3
    shingles: set[str] = set()

    # Iteration 0: individual block labels
    for label in labels:
        shingles.add(f"0:{label}")

    # WL iterations: refine labels by neighborhood aggregation
    for iteration in range(1, iterations + 1):
        new_labels = []
        for i in range(n):
            succ_labels = tuple(sorted(labels[s] for s in successors[i]))
            pred_labels = tuple(sorted(labels[p] for p in predecessors[i]))
            composite = f"{labels[i]}|{succ_labels}|{pred_labels}"
            new_label = mmh3.hash(composite, 0) & 0xFFFFFFFF
            new_labels.append(new_label)
            shingles.add(f"{iteration}:{new_label}")
        labels = new_labels

    if not shingles:
        return [255] * NUM_WL_MINHASH_PERMS

    # Compute MinHash signature using mmh3 with different seeds
    shingle_list = list(shingles)
    signature = []
    for seed in _WL_MINHASH_SEEDS:
        min_val = 0xFFFFFFFF
        for s in shingle_list:
            h = mmh3.hash(s, seed) & 0xFFFFFFFF
            if h < min_val:
                min_val = h
        # Compress to uint8 for storage
        signature.append(min_val & 0xFF)

    return signature


# ---------------------------------------------------------------------------
# Task 1.9: Packed Adjacency
# ---------------------------------------------------------------------------

def pack_adjacency(successors: list[list[int]]) -> list[int]:
    """
    Pack CFG edges as Array(UInt32).
    Each UInt32 = (source_index << 16) | target_index.
    Supports up to 65,535 blocks per function.
    """
    edges = []
    for src, targets in enumerate(successors):
        for tgt in targets:
            if src < 65536 and tgt < 65536:
                edges.append((src << 16) | tgt)
    return edges