# Path: pwnypack/shellcode/ops.py
# class SyscallInvoke(object):
#     def __init__(self, syscall_def, args):
#         self.syscall_def = syscall_def
#         self.args = args
# 
#     def __repr__(self):
#         return '%s(%s)' % (self.syscall_def.name, ', '.join(repr(a) for a in self.args))
# 
# class LoadRegister(object):
#     def __init__(self, register, value):
#         self.register = register
#         self.value = value
# 
#     def __repr__(self):
#         return 'LoadRegister(%r, %r)' % (self.register, self.value)
# 
# Path: pwnypack/shellcode/types.py
# class Register(object):
#     def __init__(self, name):
#         self.name = name
# 
#     def __str__(self):
#         return self.name
# 
#     def __repr__(self):
#         return '<Reg:%s>' % self.name.upper()
# 
# class Offset(int):
#     def __repr__(self):
#         return 'Offset(%d)' % self
# 
# class Buffer(object):
#     def __init__(self, offset, length):
#         self.offset = offset
#         self.length = length
# 
#     def __repr__(self):
#         return 'Buffer(%d@%d)' % (self.length, self.offset)
# 
# Path: pwnypack/bytecode.py
# class Label(object):
# class Op(object):
# class Block(object):
# class AnnotatedOp(object):
# class CodeObject(object):
#     def __repr__(self):
#     def __init__(self, name, arg=None):
#     def __repr__(self):
# def disassemble(code, origin=None):
# def assemble(ops, target=None):
#         def encode_op(output, op_code, op_arg=None):
#         def encode_op(output, op_code, op_arg=None):
#     def __init__(self, label=None):
# def blocks_from_ops(ops):
# def calculate_max_stack_depth(ops, target=None):
#     def walk(block=None, depth=0, max_depth=0):
#     def __init__(self, code_obj, name, arg):
#     def __repr__(self):
#     def __init__(self, co_argcount, co_kwonlyargcount, co_nlocals, co_stacksize, co_flags, co_code, co_consts,
#                  co_names, co_varnames, co_filename, co_name, co_firstlineno, co_lnotab, co_freevars, co_cellvars,
#                  origin=None):
#     def from_code(cls, code, co_argcount=BORROW, co_kwonlyargcount=BORROW, co_nlocals=BORROW, co_stacksize=BORROW,
#                   co_flags=BORROW, co_code=BORROW, co_consts=BORROW, co_names=BORROW, co_varnames=BORROW,
#                   co_filename=BORROW, co_name=BORROW, co_firstlineno=BORROW, co_lnotab=BORROW, co_freevars=BORROW,
#                   co_cellvars=BORROW):
#     def from_function(cls, f, *args, **kwargs):
#     def annotate_op(self, op):
#     def disassemble(self, annotate=False, blocks=False):
#     def assemble(self, ops, target=None):
#     def to_code(self):
#     def to_function(self):
#     def __call__(self, *args, **kwargs):
# BORROW = object()


import inspect
import six
from pwnypack.shellcode.ops import SyscallInvoke, LoadRegister
from pwnypack.shellcode.types import Register, Offset, Buffer
from pwnypack import bytecode as bc

        elif op.name == 'POP_TOP':
            value = stack.pop()
            if isinstance(value, SyscallInvoke):
                program.append(value)
            elif isinstance(value, list):
                program.extend(value)
            else:
                raise ValueError('No idea how to compile %s' % (value,))

        elif op.name == 'RETURN_VALUE':
            stack.pop()

        elif op.name == 'DUP_TOP':
            value = stack[-1]
            if isinstance(value, SyscallInvoke):
                stack.insert(-1, env.SYSCALL_RET_REG)
            else:
                stack.append(value)

        elif op.name == 'BINARY_SUBSCR':
            index = stack.pop()
            value = stack.pop()
            stack.append(value[index])

        elif op.name == 'STORE_SUBSCR':
            index = stack.pop()
            value = stack.pop()
            new_value = stack.pop()
            var = value[index]

# Path: pwnypack/shellcode/ops.py
# class SyscallInvoke(object):
#     def __init__(self, syscall_def, args):
#         self.syscall_def = syscall_def
#         self.args = args
# 
#     def __repr__(self):
#         return '%s(%s)' % (self.syscall_def.name, ', '.join(repr(a) for a in self.args))
# 
# class LoadRegister(object):
#     def __init__(self, register, value):
#         self.register = register
#         self.value = value
# 
#     def __repr__(self):
#         return 'LoadRegister(%r, %r)' % (self.register, self.value)
# 
# Path: pwnypack/shellcode/types.py
# class Register(object):
#     def __init__(self, name):
#         self.name = name
# 
#     def __str__(self):
#         return self.name
# 
#     def __repr__(self):
#         return '<Reg:%s>' % self.name.upper()
# 
# class Offset(int):
#     def __repr__(self):
#         return 'Offset(%d)' % self
# 
# class Buffer(object):
#     def __init__(self, offset, length):
#         self.offset = offset
#         self.length = length
# 
#     def __repr__(self):
#         return 'Buffer(%d@%d)' % (self.length, self.offset)
# 
# Path: pwnypack/bytecode.py
# class Label(object):
# class Op(object):
# class Block(object):
# class AnnotatedOp(object):
# class CodeObject(object):
#     def __repr__(self):
#     def __init__(self, name, arg=None):
#     def __repr__(self):
# def disassemble(code, origin=None):
# def assemble(ops, target=None):
#         def encode_op(output, op_code, op_arg=None):
#         def encode_op(output, op_code, op_arg=None):
#     def __init__(self, label=None):
# def blocks_from_ops(ops):
# def calculate_max_stack_depth(ops, target=None):
#     def walk(block=None, depth=0, max_depth=0):
#     def __init__(self, code_obj, name, arg):
#     def __repr__(self):
#     def __init__(self, co_argcount, co_kwonlyargcount, co_nlocals, co_stacksize, co_flags, co_code, co_consts,
#                  co_names, co_varnames, co_filename, co_name, co_firstlineno, co_lnotab, co_freevars, co_cellvars,
#                  origin=None):
#     def from_code(cls, code, co_argcount=BORROW, co_kwonlyargcount=BORROW, co_nlocals=BORROW, co_stacksize=BORROW,
#                   co_flags=BORROW, co_code=BORROW, co_consts=BORROW, co_names=BORROW, co_varnames=BORROW,
#                   co_filename=BORROW, co_name=BORROW, co_firstlineno=BORROW, co_lnotab=BORROW, co_freevars=BORROW,
#                   co_cellvars=BORROW):
#     def from_function(cls, f, *args, **kwargs):
#     def annotate_op(self, op):
#     def disassemble(self, annotate=False, blocks=False):
#     def assemble(self, ops, target=None):
#     def to_code(self):
#     def to_function(self):
#     def __call__(self, *args, **kwargs):
# BORROW = object()


# Path: pwnypack/shellcode/translate.py
import inspect
import six
from pwnypack.shellcode.ops import SyscallInvoke, LoadRegister
from pwnypack.shellcode.types import Register, Offset, Buffer
from pwnypack import bytecode as bc


        elif op.name == 'POP_TOP':
            value = stack.pop()
            if isinstance(value, SyscallInvoke):
                program.append(value)
            elif isinstance(value, list):
                program.extend(value)
            else:
                raise ValueError('No idea how to compile %s' % (value,))

        elif op.name == 'RETURN_VALUE':
            stack.pop()

        elif op.name == 'DUP_TOP':
            value = stack[-1]
            if isinstance(value, SyscallInvoke):
                stack.insert(-1, env.SYSCALL_RET_REG)
            else:
                stack.append(value)

        elif op.name == 'BINARY_SUBSCR':
            index = stack.pop()
            value = stack.pop()
            stack.append(value[index])

        elif op.name == 'STORE_SUBSCR':
            index = stack.pop()
            value = stack.pop()
            new_value = stack.pop()
            var = value[index]

            if isinstance(var, Register):