        func bytes_to_felt(len: felt, ptr: felt*) -> felt {
            if (len == 0) {
                return 0;
            }
            tempvar current = 0;

            // len, ptr, ?, ?, current
            // ?, ? are intermediate steps created by the compiler to unfold the
            // complex expression.
            loop:
            let len = [ap - 5];
            let ptr = cast([ap - 4], felt*);
            let current = [ap - 1];

            tempvar len = len - 1;
            tempvar ptr = ptr + 1;
            tempvar current = current * 256 + [ptr - 1];//@audit-info overflow if len>31

            static_assert len == [ap - 5];
            static_assert ptr == [ap - 4];
            static_assert current == [ap - 1];
            jmp loop if len != 0;

            return current;
        }
    assertassert_nn(31 - items[6].data_len);
