<commit_before>from libs.disasm import Disasmer
from tables import Table
from sets import HashSet

type
  StackStatus* = tuple
    depth: int
    retStruct: bool

proc interpretStack(disasmer: var Disasmer, madr: uint32,
                    regs: Table[string, int],
                    visited: var HashSet[uint32]): StackStatus
proc readProcedure*(disasmer: var Disasmer, madr: uint32): StackStatus

from strutils import split, parseHexInt, strip, toHex
from sets import initSet, incl, contains
from tables import `[]`, `[]=`, initTable, contains, del
from libs.disasm import parseInstructions

var stackprotector = 0'u32 # address of stack protector procedure

proc parseEA(s: string): tuple[register: string, offset: int] =
  ## Parses the effective address in format "0x[value]([register])" to
  ## the pair of register and value
  let splitted = s.split({'(', ')'})
  result.register = splitted[1]
  result.offset =
    if splitted[0].len == 0 or splitted[0][0] == '%':
      0<commit_msg>Fixed crash when effective address does not contain register<commit_after>from libs.disasm import Disasmer
from tables import Table
from sets import HashSet

type
  StackStatus* = tuple
    depth: int
    retStruct: bool

proc interpretStack(disasmer: var Disasmer, madr: uint32,
                    regs: Table[string, int],
                    visited: var HashSet[uint32]): StackStatus
proc readProcedure*(disasmer: var Disasmer, madr: uint32): StackStatus

from strutils import split, parseHexInt, strip, toHex
from sets import initSet, incl, contains
from tables import `[]`, `[]=`, initTable, contains, del
from libs.disasm import parseInstructions

var stackprotector = 0'u32 # address of stack protector procedure

proc parseEA(s: string): tuple[register: string, offset: int] =
  ## Parses the effective address in format "0x[value]([register])" to
  ## the pair of register and value
  let splitted = s.split({'(', ')'})
  if splitted.len == 1:
    return (register: "", offset: parseHexInt(s))
  result.register = splitted[1]
  result.offset =
    if splitted[0].len == 0 or splitted[0][0] == '%':
      0
{'fraction_non_alphanumeric': 0.10847939365229749, 'fraction_numerical': 0.015632401705352912, 'mean_word_length': 4.016627078384798, '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': '469106', 'n_tokens_mistral': 649, 'n_tokens_neox': 627, 'n_words': 220}