<commit_before>try:
    import capstone as _capstone
except ImportError:
    _capstone = None

#try:
#   import unicorn as _unicorn
#except ImportError:
#   _unicorn = None

from .arch import Arch, register_arch
from .tls import TLSArchInfo

# Note: PowerPC doesn't have pc, so guest_CIA is commented as IP (no arch visible register)
# PowerPC doesn't have stack base pointer, so bp_offset is set to -1 below
# Normally r1 is used as stack pointer

class ArchPPC32(Arch):
    def __init__(self, endness="Iend_LE"):
        super(ArchPPC32, self).__init__(endness)
        if endness == 'Iend_BE':
            self.function_prologs = {
                # stwu r1, -off(r1); mflr r0
                r"\x94\x21[\x00-\xff]{2}\x7c\x08\x02\xa6"
            }
            self.function_epilogs = {
                # mtlr reg; ... ; blr
                r"[\x00-\xff]{2}\x03\xa6([\x00-\xff]{4}){0,6}\x4e\x80\x00\x20"
            }

    bits = 32
    vex_arch = "VexArchPPC32"
    name = "PPC32"
    qemu_name = 'ppc'
    ida_processor = 'ppc'
    linux_name = 'ppc750'   # ?
    triplet = 'powerpc-linux-gnu'
    max_inst_bytes = 4
    ip_offset = 1160
    sp_offset = 20
    bp_offset = 140<commit_msg>Fixed ip_offset for PPC32<commit_after>try:
    import capstone as _capstone
except ImportError:
    _capstone = None

#try:
#   import unicorn as _unicorn
#except ImportError:
#   _unicorn = None

from .arch import Arch, register_arch
from .tls import TLSArchInfo

# Note: PowerPC doesn't have pc, so guest_CIA is commented as IP (no arch visible register)
# PowerPC doesn't have stack base pointer, so bp_offset is set to -1 below
# Normally r1 is used as stack pointer

class ArchPPC32(Arch):
    def __init__(self, endness="Iend_LE"):
        super(ArchPPC32, self).__init__(endness)
        if endness == 'Iend_BE':
            self.function_prologs = {
                # stwu r1, -off(r1); mflr r0
                r"\x94\x21[\x00-\xff]{2}\x7c\x08\x02\xa6"
            }
            self.function_epilogs = {
                # mtlr reg; ... ; blr
                r"[\x00-\xff]{2}\x03\xa6([\x00-\xff]{4}){0,6}\x4e\x80\x00\x20"
            }

    bits = 32
    vex_arch = "VexArchPPC32"
    name = "PPC32"
    qemu_name = 'ppc'
    ida_processor = 'ppc'
    linux_name = 'ppc750'   # ?
    triplet = 'powerpc-linux-gnu'
    max_inst_bytes = 4
    ip_offset = 1168
    sp_offset = 20
    bp_offset = 140
{'fraction_non_alphanumeric': 0.11426188490408674, 'fraction_numerical': 0.05004170141784821, 'mean_word_length': 2.2773224043715845, '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': '7183087', 'n_tokens_mistral': 959, 'n_tokens_neox': 871, 'n_words': 214}