def METHOD_NAME(
    self, METHOD_NAME: Callable[[], None], rom: NintendoDSRom, config: Pmd2Data
) -> None:
    if not self.is_applied(rom, config):
        if config.game_version == GAME_VERSION_EOS:
            if config.game_region == GAME_REGION_US:
                start_ov11 = START_OV11_US
                start_table = START_TABLE_US
                start_m_functions = START_M_FUNC_US
                end_m_functions = END_M_FUNC_US
            if config.game_region == GAME_REGION_EU:
                start_ov11 = START_OV11_EU
                start_table = START_TABLE_EU
                start_m_functions = START_M_FUNC_EU
                end_m_functions = END_M_FUNC_EU
    if SP_CODE_PATH not in rom.filenames:
        main_func = dict()
        data = rom.loadArm9Overlays([11])[11].data
        switch = AsmFunction(
            data[start_table - start_ov11 : start_m_functions - start_ov11],
            start_table,
        )
        switch.process()
        main_calls = switch.process_switch(5, (0, 64), {})
        unique_main_calls = list(sorted(set(main_calls)))
        unique_main_calls.append(end_m_functions)
        last_call = None
        for i in range(len(unique_main_calls) - 1):
            start = unique_main_calls[i]
            end = unique_main_calls[i + 1]
            func_data = data[start - start_ov11 : end - start_ov11]
            main_func[start] = AsmFunction(func_data, start)
            main_func[start].process()
            last_call = start
        nb_proc = len(main_calls)
        header = bytearray(4 + 2 * nb_proc + len(main_func) * 8)
        write_u32(header, u32_checked(4 + 2 * nb_proc), 0)
        code_data = bytearray(0)
        current_ptr = u32_checked(len(header))
        id_codes = dict()
        print(nb_proc)
        for i, t in enumerate(main_func.items()):
            k = t[0]
            x = t[1]
            id_codes[k] = i
            fdata = bytearray(x.compile(start_m_functions))
            if k == last_call:
                # Add a branch to the end for the last case since it doesn't have one
                fdata += bytearray([0x1C, 0x2, 0x00, 0xEA])
            write_u32(header, current_ptr, 4 + 2 * nb_proc + i * 8)
            write_u32(header, u32_checked(len(fdata)), 4 + 2 * nb_proc + i * 8 + 4)
            code_data += fdata
            current_ptr += len(fdata)  # type: ignore
        for i, y in enumerate(main_calls):
            write_u16(header, u16_checked(id_codes[y]), 4 + 2 * i)
        file_data = header + code_data
        create_file_in_rom(rom, SP_CODE_PATH, file_data)
    try:
        METHOD_NAME()
    except RuntimeError as ex:
        raise ex