+class Arguments(tuple):
+ def __new__(cls, arguments, operands):
+ iterable = iter(tuple(arguments))
+ operands = iter(tuple(operands))
+ arguments = []
+
+ while True:
+ try:
+ operand = next(operands)
+ except StopIteration:
+ break
+
+ try:
+ argument = next(iterable)
+ except StopIteration:
+ raise ValueError("operands count mismatch")
+
+ if isinstance(operand, ImmediateOperand):
+ argument = argument.replace("(", " ").replace(")", "")
+ (imm_argument, _, argument) = argument.partition(" ")
+ try:
+ (imm_operand, operand) = (operand, next(operands))
+ except StopIteration:
+ raise ValueError("operands count mismatch")
+ arguments.append((imm_argument, imm_operand))
+ arguments.append((argument, operand))
+
+ try:
+ next(iterable)
+ except StopIteration:
+ pass
+ else:
+ raise ValueError("operands count mismatch")
+
+ return super().__new__(cls, arguments)
+
+