# Path: x86tokenizer.py
# class tokenizeError(Exception):pass
# REGISTER,OPCODE,COMMA,OPERAND,LBRACKET,RBRACKET,NUMBER,SYMBOL,STRING = range(1,10)
# def tokenizeString(s,reToProcess):
# def tokenizeInstDef(s):
# def tokenizeInst(s):


import logging
import struct
from pickle import decode_long, encode_long
from x86tokenizer import (tokenizeInstDef,tokenizeInst,
                          REGISTER,OPCODE,COMMA,OPERAND,
                          LBRACKET, RBRACKET,NUMBER,SYMBOL)
            return retVal
        if size >= 1:
            retVal += "%02X " % (data % 0xFF)
        return retVal

    def LoadConcreteValues(self, toks):
        if type(toks) == type(""):
            toks = tokenizeInst(toks)
        logging.info("%s => %s" % (self.Instruction.InstructionString, toks))
        tmpModRM = ModRM()
        firstDef, restDef = (self.Instruction.InstructionDef[0],self.Instruction.InstructionDef[1:])
        firstTok, restTok = toks[0],toks[1:]
        while 1:
            logging.info("TOK COMPARES: %s => %s" % (firstDef, firstTok))
            if firstDef[0] in (OPCODE, COMMA, REGISTER):
                #TODO: Can we handle this special case better?
                #      The special case is a m8/16/32 value that is constant
                #      and doesn't have an RM.
                if firstDef[0] == REGISTER and firstDef[1][0] == '[' and \
                   firstTok[0] == LBRACKET:
                    firstTok, restTok = restTok[0],restTok[1:]
                    if firstTok[1] == firstDef[1][1:-1]:
                        firstTok, restTok = restTok[0],restTok[1:]
                    else:
                        raise x86instError("TOKEN MISMATCH '%s' '%s'" % \
                                           (firstDef,firstTok))
                elif firstDef[0] != firstTok[0]:
                    raise x86instError("These should be equal '%s' '%s'" % \
                                       (firstDef, firstTok))
            elif firstDef[0] == NUMBER:

# Path: x86tokenizer.py
# class tokenizeError(Exception):pass
# REGISTER,OPCODE,COMMA,OPERAND,LBRACKET,RBRACKET,NUMBER,SYMBOL,STRING = range(1,10)
# def tokenizeString(s,reToProcess):
# def tokenizeInstDef(s):
# def tokenizeInst(s):


# Path: x86inst.py
import logging
import struct
from pickle import decode_long, encode_long
from x86tokenizer import (tokenizeInstDef,tokenizeInst,
                          REGISTER,OPCODE,COMMA,OPERAND,
                          LBRACKET, RBRACKET,NUMBER,SYMBOL)

            return retVal
        if size >= 1:
            retVal += "%02X " % (data % 0xFF)
        return retVal

    def LoadConcreteValues(self, toks):
        if type(toks) == type(""):
            toks = tokenizeInst(toks)
        logging.info("%s => %s" % (self.Instruction.InstructionString, toks))
        tmpModRM = ModRM()
        firstDef, restDef = (self.Instruction.InstructionDef[0],self.Instruction.InstructionDef[1:])
        firstTok, restTok = toks[0],toks[1:]
        while 1:
            logging.info("TOK COMPARES: %s => %s" % (firstDef, firstTok))
            if firstDef[0] in (OPCODE, COMMA, REGISTER):
                #TODO: Can we handle this special case better?
                #      The special case is a m8/16/32 value that is constant
                #      and doesn't have an RM.
                if firstDef[0] == REGISTER and firstDef[1][0] == '[' and \
                   firstTok[0] == LBRACKET:
                    firstTok, restTok = restTok[0],restTok[1:]
                    if firstTok[1] == firstDef[1][1:-1]:
                        firstTok, restTok = restTok[0],restTok[1:]
                    else:
                        raise x86instError("TOKEN MISMATCH '%s' '%s'" % \
                                           (firstDef,firstTok))
                elif firstDef[0] != firstTok[0]:
                    raise x86instError("These should be equal '%s' '%s'" % \
                                       (firstDef, firstTok))
            elif firstDef[0] == NUMBER:

                if firstTok[0] != NUMBER or firstTok[1] != firstDef[1]: