# Path: pyjvm/bytecode.py
# def bytecode(code):
#     def cl(func):
#         BYTECODE[hex(code)] = func
#         return func
# 
#     return cl
# 
# Path: pyjvm/jassert.py
# def jassert_ref(ref):
#     assert ref is None or (type(ref) is tuple and ref[0] in ("ref", "vm_ref"))
# 
# Path: pyjvm/thread.py
# class SkipThreadCycle(Exception):
#     '''Thread may skip his execution quota in case when a monitor
#     is busy or sleep was called
#     '''
#     pass
# 
# Path: pyjvm/utils.py
# def category_type(value):
#     '''Get category type of a variable according to jdk specs
# 
#     long, double are 2, others are 1'''
#     if type(value) is tuple and value[0] in ('long', 'double'):
#         return 2
#     else:
#         return 1


import struct
from pyjvm.bytecode import bytecode
from pyjvm.jassert import jassert_ref
from pyjvm.thread import SkipThreadCycle
from pyjvm.utils import category_type
def dup(frame):
    value = frame.stack.pop()
    assert category_type(value) == 1
    frame.stack.append(value)
    frame.stack.append(value)


@bytecode(code=0x5a)
def dup_x1(frame):
    value1 = frame.stack.pop()
    value2 = frame.stack.pop()
    assert category_type(value1) == 1
    assert category_type(value2) == 1
    frame.stack.append(value1)
    frame.stack.append(value2)
    frame.stack.append(value1)


@bytecode(code=0x5b)
def dup_x2(frame):
    value1 = frame.stack.pop()
    value2 = frame.stack.pop()
    if category_type(value1) == 1 and category_type(value2) == 2:
        # form2
        frame.stack.append(value1)
        frame.stack.append(value2)
        frame.stack.append(value1)
        return
    value3 = frame.stack.pop()
    if (category_type(value1) == 1 and category_type(value2) == 1 and

# Path: pyjvm/bytecode.py
# def bytecode(code):
#     def cl(func):
#         BYTECODE[hex(code)] = func
#         return func
# 
#     return cl
# 
# Path: pyjvm/jassert.py
# def jassert_ref(ref):
#     assert ref is None or (type(ref) is tuple and ref[0] in ("ref", "vm_ref"))
# 
# Path: pyjvm/thread.py
# class SkipThreadCycle(Exception):
#     '''Thread may skip his execution quota in case when a monitor
#     is busy or sleep was called
#     '''
#     pass
# 
# Path: pyjvm/utils.py
# def category_type(value):
#     '''Get category type of a variable according to jdk specs
# 
#     long, double are 2, others are 1'''
#     if type(value) is tuple and value[0] in ('long', 'double'):
#         return 2
#     else:
#         return 1


# Path: pyjvm/ops/ops_misc.py
import struct
from pyjvm.bytecode import bytecode
from pyjvm.jassert import jassert_ref
from pyjvm.thread import SkipThreadCycle
from pyjvm.utils import category_type

def dup(frame):
    value = frame.stack.pop()
    assert category_type(value) == 1
    frame.stack.append(value)
    frame.stack.append(value)


@bytecode(code=0x5a)
def dup_x1(frame):
    value1 = frame.stack.pop()
    value2 = frame.stack.pop()
    assert category_type(value1) == 1
    assert category_type(value2) == 1
    frame.stack.append(value1)
    frame.stack.append(value2)
    frame.stack.append(value1)


@bytecode(code=0x5b)
def dup_x2(frame):
    value1 = frame.stack.pop()
    value2 = frame.stack.pop()
    if category_type(value1) == 1 and category_type(value2) == 2:
        # form2
        frame.stack.append(value1)
        frame.stack.append(value2)
        frame.stack.append(value1)
        return
    value3 = frame.stack.pop()
    if (category_type(value1) == 1 and category_type(value2) == 1 and

            category_type(value3 == 1)):