broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(code, addr, key):
    def s32(p):
        v = (code[p] << 24) | (code[p + 1] << 16) | (code[p + 2] << 8) | code[p + 3]
        return v - (1 << 32) if v & 0x80000000 else v
    def dispatch():
        op = code[addr]
        p = addr + 1
        p += (4 - p % 4) % 4
        default = s32(p)
        if op == 0xAA:
            low, high = s32(p + 4), s32(p + 8)
            if low > high:
                return ['VerifyError', 'low>high']
            if low <= key < high:
                return addr + s32(p + 12 + 4 * (key - low))
            return addr + default
        if op == 0xAB:
            npairs = s32(p + 4)
            if npairs < 0:
                return ['VerifyError', 'npairs']
            pairs = [(s32(p + 8 + 8 * i), s32(p + 12 + 8 * i)) for i in range(npairs)]
            if any(pairs[i][0] >= pairs[i + 1][0] for i in range(npairs - 1)):
                return ['VerifyError', 'unsorted']
            lo, hi = 0, npairs - 1
            while lo <= hi:
                mid = (lo + hi) // 2
                if pairs[mid][0] == key:
                    return addr + pairs[mid][1]
                if pairs[mid][0] < key:
                    lo = mid + 1
                else:
                    hi = mid - 1
            return addr + default
        return ['VerifyError', 'opcode']
    try:
        return dispatch()
    except IndexError:
        return ['VerifyError', 'truncated']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    7,
    0),
   47),
  ('tableswitch hit at the high bound',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    1),
   51),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    -2),
   22),
  ('tableswitch miss takes the backward default',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    5),
   -7),
  ('lookupswitch hit with negative offset',
   ([0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    1,
    100),
   -3),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    7,
    3),
   19),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 1, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 1, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    11,
    0),
   51),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    1),
   52),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    -2),
   23),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    5),
   -6),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     171,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    2,
    100),
   -2),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    11,
    3),
   23),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 171, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 2, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 170, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 2, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    15,
    0),
   55),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    1),
   53),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    -2),
   24),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    5),
   -5),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    3,
    100),
   -1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    15,
    3),
   27),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 171, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 3, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 170, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 3, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    19,
    0),
   59),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    1),
   54),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    -2),
   25),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    5),
   -4),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    4,
    100),
   0),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    19,
    3),
   31),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    4,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 4, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    23,
    0),
   63),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    1),
   55),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    6,
    -2),
   26),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    5),
   -3),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    5,
    100),
   1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    23,
    3),
   35),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    5,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 5, 3),
   ['VerifyError', 'low>high'])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(code, addr, key):
    def s32(p):
        v = (code[p] << 24) | (code[p + 1] << 16) | (code[p + 2] << 8) | code[p + 3]
        return v - (1 << 32) if v & 0x80000000 else v
    def dispatch():
        op = code[addr]
        p = addr + 1
        p += (4 - p % 4) % 4
        default = s32(p)
        if op == 0xAA:
            low, high = s32(p + 4), s32(p + 8)
            if low > high:
                return ['VerifyError', 'low>high']
            if low < key <= high:
                return addr + s32(p + 12 + 4 * (key - low))
            return addr + default
        if op == 0xAB:
            npairs = s32(p + 4)
            if npairs < 0:
                return ['VerifyError', 'npairs']
            pairs = [(s32(p + 8 + 8 * i), s32(p + 12 + 8 * i)) for i in range(npairs)]
            if any(pairs[i][0] >= pairs[i + 1][0] for i in range(npairs - 1)):
                return ['VerifyError', 'unsorted']
            lo, hi = 0, npairs - 1
            while lo <= hi:
                mid = (lo + hi) // 2
                if pairs[mid][0] == key:
                    return addr + pairs[mid][1]
                if pairs[mid][0] < key:
                    lo = mid + 1
                else:
                    hi = mid - 1
            return addr + default
        return ['VerifyError', 'opcode']
    try:
        return dispatch()
    except IndexError:
        return ['VerifyError', 'truncated']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    7,
    0),
   47),
  ('tableswitch hit at the high bound',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    1),
   51),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    -2),
   22),
  ('tableswitch miss takes the backward default',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    5),
   -7),
  ('lookupswitch hit with negative offset',
   ([0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    1,
    100),
   -3),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    7,
    3),
   19),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 1, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 1, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    11,
    0),
   51),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    1),
   52),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    -2),
   23),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    5),
   -6),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     171,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    2,
    100),
   -2),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    11,
    3),
   23),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 171, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 2, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 170, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 2, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    15,
    0),
   55),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    1),
   53),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    -2),
   24),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    5),
   -5),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    3,
    100),
   -1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    15,
    3),
   27),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 171, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 3, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 170, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 3, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    19,
    0),
   59),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    1),
   54),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    -2),
   25),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    5),
   -4),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    4,
    100),
   0),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    19,
    3),
   31),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    4,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 4, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    23,
    0),
   63),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    1),
   55),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    6,
    -2),
   26),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    5),
   -3),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    5,
    100),
   1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    23,
    3),
   35),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    5,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 5, 3),
   ['VerifyError', 'low>high'])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The last case of every tableswitch is unreachable.

code is a method's bytes; at addr is tableswitch (0xAA) or lookupswitch (0xAB). After the opcode, 0-3 padding bytes align the next byte to a multiple of 4 from the method start; then big-endian signed 32-bit words: default, and either low, high and high-low+1 offsets, or npairs followed by sorted (match, offset) pairs. Branch offsets are relative to the switch opcode address. Return the target address, or ["VerifyError", reason] for low > high, negative npairs, keys not strictly increasing, another opcode, or truncated operands.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(code, addr, key):
    def s32(p):
        v = (code[p] << 24) | (code[p + 1] << 16) | (code[p + 2] << 8) | code[p + 3]
        return v - (1 << 32) if v & 0x80000000 else v
    def dispatch():
        op = code[addr]
        p = addr + 1
        p += (4 - p % 4) % 4
        default = s32(p)
        if op == 0xAA:
            low, high = s32(p + 4), s32(p + 8)
            if low > high:
                return ['VerifyError', 'low>high']
            if low <= key <= high:
                return addr + s32(p + 12 + 4 * (key - low))
            return addr + default
        if op == 0xAB:
            npairs = s32(p + 4)
            if npairs < 0:
                return ['VerifyError', 'npairs']
            pairs = [(s32(p + 8 + 8 * i), s32(p + 12 + 8 * i)) for i in range(npairs)]
            if any(pairs[i][0] > pairs[i + 1][0] for i in range(npairs - 1)):
                return ['VerifyError', 'unsorted']
            lo, hi = 0, npairs - 1
            while lo <= hi:
                mid = (lo + hi) // 2
                if pairs[mid][0] == key:
                    return addr + pairs[mid][1]
                if pairs[mid][0] < key:
                    lo = mid + 1
                else:
                    hi = mid - 1
            return addr + default
        return ['VerifyError', 'opcode']
    try:
        return dispatch()
    except IndexError:
        return ['VerifyError', 'truncated']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    7,
    0),
   47),
  ('tableswitch hit at the high bound',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    1),
   51),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    -2),
   22),
  ('tableswitch miss takes the backward default',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    5),
   -7),
  ('lookupswitch hit with negative offset',
   ([0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    1,
    100),
   -3),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    7,
    3),
   19),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 1, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 1, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    11,
    0),
   51),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    1),
   52),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    -2),
   23),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    5),
   -6),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     171,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    2,
    100),
   -2),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    11,
    3),
   23),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 171, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 2, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 170, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 2, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    15,
    0),
   55),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    1),
   53),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    -2),
   24),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    5),
   -5),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    3,
    100),
   -1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    15,
    3),
   27),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 171, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 3, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 170, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 3, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    19,
    0),
   59),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    1),
   54),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    -2),
   25),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    5),
   -4),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    4,
    100),
   0),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    19,
    3),
   31),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    4,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 4, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    23,
    0),
   63),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    1),
   55),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    6,
    -2),
   26),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    5),
   -3),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    5,
    100),
   1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    23,
    3),
   35),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    5,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 5, 3),
   ['VerifyError', 'low>high'])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(code, addr, key):
    def s32(p):
        v = (code[p] << 24) | (code[p + 1] << 16) | (code[p + 2] << 8) | code[p + 3]
        return v - (1 << 32) if v & 0x80000000 else v
    def dispatch():
        op = code[addr]
        p = addr + 1
        p += (4 - p % 4) % 4
        default = s32(p)
        if op == 0xAA:
            low, high = s32(p + 4), s32(p + 8)
            if low > high:
                return ['VerifyError', 'low>high']
            if low <= key <= high:
                return addr + s32(p + 12 + 4 * (key - low))
            return addr + default
        if op == 0xAB:
            npairs = s32(p + 4)
            if npairs < 0:
                return ['VerifyError', 'npairs']
            pairs = [(s32(p + 8 + 8 * i), s32(p + 12 + 8 * i)) for i in range(npairs)]
            if pairs != sorted(pairs):
                return ['VerifyError', 'unsorted']
            lo, hi = 0, npairs - 1
            while lo <= hi:
                mid = (lo + hi) // 2
                if pairs[mid][0] == key:
                    return addr + pairs[mid][1]
                if pairs[mid][0] < key:
                    lo = mid + 1
                else:
                    hi = mid - 1
            return addr + default
        return ['VerifyError', 'opcode']
    try:
        return dispatch()
    except IndexError:
        return ['VerifyError', 'truncated']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    7,
    0),
   47),
  ('tableswitch hit at the high bound',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    1),
   51),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    -2),
   22),
  ('tableswitch miss takes the backward default',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    5),
   -7),
  ('lookupswitch hit with negative offset',
   ([0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    1,
    100),
   -3),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    7,
    3),
   19),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 1, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 1, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    11,
    0),
   51),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    1),
   52),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    -2),
   23),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    5),
   -6),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     171,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    2,
    100),
   -2),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    11,
    3),
   23),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 171, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 2, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 170, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 2, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    15,
    0),
   55),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    1),
   53),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    -2),
   24),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    5),
   -5),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    3,
    100),
   -1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    15,
    3),
   27),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 171, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 3, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 170, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 3, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    19,
    0),
   59),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    1),
   54),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    -2),
   25),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    5),
   -4),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    4,
    100),
   0),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    19,
    3),
   31),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    4,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 4, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    23,
    0),
   63),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    1),
   55),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    6,
    -2),
   26),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    5),
   -3),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    5,
    100),
   1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    23,
    3),
   35),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    5,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 5, 3),
   ['VerifyError', 'low>high'])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A lookupswitch with a repeated match value verifies and dispatches ambiguously.

code is a method's bytes; at addr is tableswitch (0xAA) or lookupswitch (0xAB). After the opcode, 0-3 padding bytes align the next byte to a multiple of 4 from the method start; then big-endian signed 32-bit words: default, and either low, high and high-low+1 offsets, or npairs followed by sorted (match, offset) pairs. Branch offsets are relative to the switch opcode address. Return the target address, or ["VerifyError", reason] for low > high, negative npairs, keys not strictly increasing, another opcode, or truncated operands.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None:
            start = off
        if op == 144:
            ext = arg << 8
            continue
        full = ext | arg
        ext = 0
        target = None
        if op == 110:
            target = off + 2 + full * 2
        elif op == 113:
            target = full * 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if start is not None:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None:
            start = off
        if op == 144:
            ext = (ext << 8) | arg
            continue
        full = ext | arg
        ext = 0
        target = None
        if op == 110:
            target = off + 2 + full * 2
        elif op == 113:
            target = full * 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if start is not None:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Arguments needing two or more prefixes lose their high bytes.

Two-byte wordcode (opcode, arg). EXTENDED_ARG (144) prefixes build wider arguments: each prefix ORs its byte into an accumulator that is then shifted left 8; the real instruction ORs its own byte in and resets the accumulator. Each decoded instruction reports [start of its first prefix, own offset, name, full arg, jump target in bytes]: JUMP_FORWARD (110) targets the next instruction plus 2*arg, JUMP_ABSOLUTE (113) targets 2*arg. A prefix at the end reports ["dangling-extended-arg", start]. A trailing odd byte is ignored.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None:
            start = off
        if op == 144:
            ext = (ext | arg) << 8
            continue
        full = ext | arg
        target = None
        if op == 110:
            target = off + 2 + full * 2
        elif op == 113:
            target = full * 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if start is not None:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None:
            start = off
        if op == 144:
            ext = (ext | arg) << 8
            continue
        full = ext | arg
        ext = 0 if op in (110, 113) else ext
        target = None
        if op == 110:
            target = off + 2 + full * 2
        elif op == 113:
            target = full * 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if start is not None:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Every instruction after a prefixed one gets an inflated argument.

Two-byte wordcode (opcode, arg). EXTENDED_ARG (144) prefixes build wider arguments: each prefix ORs its byte into an accumulator that is then shifted left 8; the real instruction ORs its own byte in and resets the accumulator. Each decoded instruction reports [start of its first prefix, own offset, name, full arg, jump target in bytes]: JUMP_FORWARD (110) targets the next instruction plus 2*arg, JUMP_ABSOLUTE (113) targets 2*arg. A prefix at the end reports ["dangling-extended-arg", start]. A trailing odd byte is ignored.

split: open-access