<commit_before>import os
import sys
import copy
import ctypes
import cffi # lmao
import threading
import itertools
import pkg_resources
import logging
import pyvex
import claripy
import time
import binascii
import archinfo

from ..sim_options import UNICORN_HANDLE_TRANSMIT_SYSCALL
from ..errors import SimValueError, SimUnicornUnsupport, SimSegfaultError, SimMemoryError, SimUnicornError
from .plugin import SimStatePlugin
from ..misc.testing import is_testing

l = logging.getLogger(name=__name__)
ffi = cffi.FFI()

try:
    import unicorn
except ImportError:
    l.warning("Unicorn is not installed. Support disabled.")
    unicorn = None

class MEM_PATCH(ctypes.Structure): # mem_update_t
    pass

MEM_PATCH._fields_ = [
        ('address', ctypes.c_uint64),
        ('length', ctypes.c_uint64),
        ('next', ctypes.POINTER(MEM_PATCH))
    ]

class TRANSMIT_RECORD(ctypes.Structure): # transmit_record_t
    pass

TRANSMIT_RECORD._fields_ = [
        ('data', ctypes.c_void_p),
        ('count', ctypes.c_uint32)
    ]

class TaintEntityEnum: # taint_entity_enum_t
    TAINT_ENTITY_REG = 0
    TAINT_ENTITY_TMP = 1
    TAINT_ENTITY_MEM = 2
    TAINT_ENTITY_NONE = 3

class MemoryValue(ctypes.Structure): # memory_value_t
    _MAX_MEM_ACCESS_SIZE = 8

    _fields_ = [
        ('address', ctypes.c_uint64),
        ('value', ctypes.c_uint8 * _MAX_MEM_ACCESS_SIZE),
        ('size', ctypes.c_uint64)
    ]

class RegisterValue(ctypes.Structure): # register_value_t
    _MAX_REGISTER_BYTE_SIZE = 32

    _fields_ = [
        ('offset', ctypes.c_uint64),
        ('value', ctypes.c_uint8 * _MAX_REGISTER_BYTE_SIZE),
        ('size', ctypes.c_int64)
    ]
class InstrDetails(ctypes.Structure): # sym_instr_details_t
    _fields_ = [
        ('instr_addr', ctypes.c_uint64),
        ('has_memory_dep', ctypes.c_bool),
        ('memory_values', ctypes.POINTER(MemoryValue)),
        ('memory_values_count', ctypes.c_uint64),
    ]

class BlockDetails(ctypes.Structure): # sym_block_details_ret_t
    _fields_ = [
        ('block_addr', ctypes.c_uint64),
        ('block_size', ctypes.c_uint64),
        ('symbolic_instrs', ctypes.POINTER(InstrDetails)),
        ('symbolic_instrs_count', ctypes.c_uint64),
        ('register_values', ctypes.POINTER(RegisterValue)),
        ('register_values_count', ctypes.c_uint64),
    ]

class STOP:  # stop_t<commit_msg>Updated MemoryValue fields to match the native interface struct (#2819)<commit_after>import os
import sys
import copy
import ctypes
import cffi # lmao
import threading
import itertools
import pkg_resources
import logging
import pyvex
import claripy
import time
import binascii
import archinfo

from ..sim_options import UNICORN_HANDLE_TRANSMIT_SYSCALL
from ..errors import SimValueError, SimUnicornUnsupport, SimSegfaultError, SimMemoryError, SimUnicornError
from .plugin import SimStatePlugin
from ..misc.testing import is_testing

l = logging.getLogger(name=__name__)
ffi = cffi.FFI()

try:
    import unicorn
except ImportError:
    l.warning("Unicorn is not installed. Support disabled.")
    unicorn = None

class MEM_PATCH(ctypes.Structure): # mem_update_t
    pass

MEM_PATCH._fields_ = [
        ('address', ctypes.c_uint64),
        ('length', ctypes.c_uint64),
        ('next', ctypes.POINTER(MEM_PATCH))
    ]

class TRANSMIT_RECORD(ctypes.Structure): # transmit_record_t
    pass

TRANSMIT_RECORD._fields_ = [
        ('data', ctypes.c_void_p),
        ('count', ctypes.c_uint32)
    ]

class TaintEntityEnum: # taint_entity_enum_t
    TAINT_ENTITY_REG = 0
    TAINT_ENTITY_TMP = 1
    TAINT_ENTITY_MEM = 2
    TAINT_ENTITY_NONE = 3

class MemoryValue(ctypes.Structure): # memory_value_t
    _MAX_MEM_ACCESS_SIZE = 8

    _fields_ = [
        ('address', ctypes.c_uint64),
        ('value', ctypes.c_uint8 * _MAX_MEM_ACCESS_SIZE),
        ('size', ctypes.c_uint64),
        ('is_value_symbolic', ctypes.c_bool)
    ]

class RegisterValue(ctypes.Structure): # register_value_t
    _MAX_REGISTER_BYTE_SIZE = 32

    _fields_ = [
        ('offset', ctypes.c_uint64),
        ('value', ctypes.c_uint8 * _MAX_REGISTER_BYTE_SIZE),
        ('size', ctypes.c_int64)
    ]
class InstrDetails(ctypes.Structure): # sym_instr_details_t
    _fields_ = [
        ('instr_addr', ctypes.c_uint64),
        ('has_memory_dep', ctypes.c_bool),
        ('memory_values', ctypes.POINTER(MemoryValue)),
        ('memory_values_count', ctypes.c_uint64),
    ]

class BlockDetails(ctypes.Structure): # sym_block_details_ret_t
    _fields_ = [
        ('block_addr', ctypes.c_uint64),
        ('block_size', ctypes.c_uint64),
        ('symbolic_instrs', ctypes.POINTER(InstrDetails)),
        ('symbolic_instrs_count', ctypes.c_uint64),
        ('register_values', ctypes.POINTER(RegisterValue)),
        ('register_values_count', ctypes.c_uint64),
    ]

class STOP:  # stop_t
{'fraction_non_alphanumeric': 0.10489220563847429, 'fraction_numerical': 0.015339966832504145, 'mean_word_length': 3.725759059745348, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1867177', 'n_tokens_mistral': 1730, 'n_tokens_neox': 1668, 'n_words': 318}