{
    "allowed_reference_expressions_for_hint": [
        {
            "allowed_expressions": [
                {
                    "expr": "[cast(fp + (-5), starkware.cairo.common.cairo_builtins.BitwiseBuiltin**)]",
                    "name": "keccak.finalize_keccak.bitwise_ptr"
                },
                {
                    "expr": "[cast(fp + (-3), felt**)]",
                    "name": "keccak.finalize_keccak.keccak_ptr_end"
                },
                {
                    "expr": "[cast(fp + (-4), felt**)]",
                    "name": "keccak.finalize_keccak.keccak_ptr_start"
                },
                {
                    "expr": "[cast(ap + (-1), felt*)]",
                    "name": "keccak.finalize_keccak.n"
                },
                {
                    "expr": "[cast(fp + (-6), felt*)]",
                    "name": "keccak.finalize_keccak.range_check_ptr"
                }
            ],
            "hint_lines": [
                "# Add dummy pairs of input and output.",
                "_keccak_state_size_felts = int(ids.KECCAK_STATE_SIZE_FELTS)",
                "_block_size = int(ids.BLOCK_SIZE)",
                "assert 0 <= _keccak_state_size_felts < 100",
                "assert 0 <= _block_size < 1000",
                "inp = [0] * _keccak_state_size_felts",
                "padding = (inp + keccak_func(inp)) * _block_size",
                "segments.write_arg(ids.keccak_ptr_end, padding)"
            ]
        },
        {
            "allowed_expressions": [
                {
                    "expr": "[cast(fp + (-4), felt**)]",
                    "name": "keccak.keccak.input"
                },
                {
                    "expr": "cast([ap + (-10)] + 9, felt*)",
                    "name": "keccak.keccak.keccak_ptr"
                },
                {
                    "expr": "[cast(fp + (-5), felt**)]",
                    "name": "keccak.keccak.keccak_ptr_start"
                },
                {
                    "expr": "[cast(fp + (-3), felt*)]",
                    "name": "keccak.keccak.n_bytes"
                },
                {
                    "expr": "cast([ap + (-10)] + 9, felt*)",
                    "name": "keccak.keccak.output"
                },
                {
                    "expr": "[cast(ap + (-2), felt*)]",
                    "name": "keccak.keccak.range_check_ptr"
                }
            ],
            "hint_lines": [
                "from starkware.cairo.common.cairo_keccak.keccak_utils import keccak_func",
                "_keccak_state_size_felts = int(ids.KECCAK_STATE_SIZE_FELTS)",
                "assert 0 <= _keccak_state_size_felts < 100",
                "output_values = keccak_func(memory.get_range(",
                "    ids.keccak_ptr_start, _keccak_state_size_felts))",
                "segments.write_arg(ids.output, output_values)"
            ]
        },
        {
            "allowed_expressions": [
                {
                    "expr": "[cast(fp, felt*)]",
                    "name": "keccak._keccak_input.full_word"
                },
                {
                    "expr": "[cast(fp + (-5), felt**)]",
                    "name": "keccak._keccak_input.input"
                },
                {
                    "expr": "[cast(fp + (-6), felt**)]",
                    "name": "keccak._keccak_input.keccak_ptr"
                },
                {
                    "expr": "[cast(fp + (-4), felt*)]",
                    "name": "keccak._keccak_input.n_bytes"
                },
                {
                    "expr": "[cast(fp + (-3), felt*)]",
                    "name": "keccak._keccak_input.n_words"
                },
                {
                    "expr": "[cast(fp + (-7), felt*)]",
                    "name": "keccak._keccak_input.range_check_ptr"
                }
            ],
            "hint_lines": [
                "ids.full_word = int(ids.n_bytes >= 8)"
            ]
        },
        {
            "allowed_expressions": [
                {
                    "expr": "[cast(ap, felt*)]",
                    "name": "memset.memset.continue_loop"
                },
                {
                    "expr": "[cast(fp + (-5), felt**)]",
                    "name": "memset.memset.dst"
                },
                {
                    "expr": "[cast(ap + (-1), memset.memset.LoopFrame*)]",
                    "name": "memset.memset.frame"
                },
                {
                    "expr": "[cast(fp + (-3), felt*)]",
                    "name": "memset.memset.n"
                },
                {
                    "expr": "cast(ap + 1, memset.memset.LoopFrame*)",
                    "name": "memset.memset.next_frame"
                },
                {
                    "expr": "[cast(fp + (-4), felt*)]",
                    "name": "memset.memset.value"
                }
            ],
            "hint_lines": [
                "n -= 1",
                "ids.continue_loop = 1 if n > 0 else 0"
            ]
        },
        {
            "allowed_expressions": [
                {
                    "expr": "[cast(fp + (-5), felt**)]",
                    "name": "memset.memset.dst"
                },
                {
                    "expr": "[cast(fp + (-3), felt*)]",
                    "name": "memset.memset.n"
                },
                {
                    "expr": "[cast(fp + (-4), felt*)]",
                    "name": "memset.memset.value"
                }
            ],
            "hint_lines": [
                "vm_enter_scope({'n': ids.n})"
            ]
        },
        {
            "allowed_expressions": [
                {
                    "expr": "[cast(ap, felt*)]",
                    "name": "memset.memset.continue_loop"
                },
                {
                    "expr": "[cast(fp + (-5), felt**)]",
                    "name": "memset.memset.dst"
                },
                {
                    "expr": "[cast(ap + (-1), memset.memset.LoopFrame*)]",
                    "name": "memset.memset.frame"
                },
                {
                    "expr": "[cast(fp + (-3), felt*)]",
                    "name": "memset.memset.n"
                },
                {
                    "expr": "cast(ap + 1, memset.memset.LoopFrame*)",
                    "name": "memset.memset.next_frame"
                },
                {
                    "expr": "[cast(fp + (-4), felt*)]",
                    "name": "memset.memset.value"
                }
            ],
            "hint_lines": [
                "vm_exit_scope()"
            ]
        }
    ]
}
