#!/usr/bin/env python3
# This script reads instructions.txt and generates a list of AWK if statements
# for checking the return type.
import sys
seen = []
for line in sys.stdin:
line = [s.strip() for s in line.strip().split()]
if len(line) < 1:
continue
t=line[-1]
o=int(line[-2], 2)
if o in seen:
continue
seen.append(o)
print("if (opcode(v) == 0x{:x}) {{ return \"{}\" }}".format(o, t))