diff --git a/.ECOOP-2024-artifact/Dockerfile b/.ECOOP-2024-artifact/Dockerfile new file mode 100644 index 000000000..7d10b4359 --- /dev/null +++ b/.ECOOP-2024-artifact/Dockerfile @@ -0,0 +1,73 @@ +# Ubuntu 22 +FROM ubuntu:22.04 +ARG DEBIAN_FRONTEND=noninteractive +ENV USERNAME=root + + +# install dependencies +RUN apt-get update && \ + apt-get -y install --no-install-recommends software-properties-common && \ + apt-get -y install --no-install-recommends \ + libgc-dev \ + python3 python3-dev python3-setuptools python-is-python3 python3-pip \ + libgmp-dev \ + build-essential \ + uthash-dev \ + vim \ + wget \ + curl + +RUN wget --no-check-certificate https://mirror.racket-lang.org/installers/7.5/racket-7.5-x86_64-linux.sh +RUN chmod +x racket-7.5-x86_64-linux.sh +RUN ./racket-7.5-x86_64-linux.sh + + +# update path +USER ${USERNAME} +WORKDIR /${USERNAME} +ENV PATH="/${USERNAME}/.local/bin:/${USERNAME}/.cabal/bin:/${USERNAME}/.ghcup/bin:$PATH" +RUN echo "export PATH=${PATH}" >> /${USERNAME}/.profile + +#install ghcup +RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.4.6 BOOTSTRAP_HASKELL_CABAL_VERSION=3.8.1.0 BOOTSTRAP_HASKELL_INSTALL_STACK=1 BOOTSTRAP_HASKELL_INSTALL_HLS=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=P sh + +# update cabal package list +RUN cabal update + +ARG RUST=1.71.0 + +# install rustup, rustc, and cargo +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${RUST} + +RUN . "$HOME/.cargo/env" + +ADD . /gibbon + +RUN rm /gibbon/gibbon-rts/build/gibbon_rts.h + +ENV PATH="$PATH:/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.0.1/gibbon-0.3/x/gibbon/build/gibbon" + +#Python dependencies +RUN pip install cplex +RUN pip install docplex +RUN pip install statistics +RUN pip install numpy as np +RUN pip install scipy +RUN pip install re + + +#Install PAPI +RUN wget https://github.com/icl-utk-edu/papi/archive/refs/tags/papi-7-1-0-t.tar.gz +RUN mkdir papi +RUN tar -xvzf papi-7-1-0-t.tar.gz -C papi +RUN cd papi +RUN cd papi-papi-7-1-0-t +RUN cd src +RUN ./configure +RUN make -j10 +RUN make install + + + + +CMD ["bash"] diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 5950d8820..70a784920 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -28,9 +28,9 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.4.6 + - compiler: ghc-9.6.2 compilerKind: ghc - compilerVersion: 9.4.6 + compilerVersion: 9.6.2 setup-method: ghcup allow-failure: false - compiler: ghc-9.4.5 diff --git a/README.md b/README.md index 7a819add3..d24bb970c 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,12 @@ similar to Typed Racket, and a small subset of Haskell. ## Building Gibbon -Gibbon is implemented in Haskell, and is set up to be built with -[Cabal](https://cabal.readthedocs.io/en/3.4/). +### Getting Dependencies -Follow the instructions below to have all dependencies. +Gibbon is implemented in Haskell, and is set up to be built with +[Cabal](https://cabal.readthedocs.io/en/latest/), but it has a number of native dependencies. +Follow the instructions below to get all dependencies or enter the Nix shell +with `nix-shell` to get them via [Nix](https://nix.dev/). - Ubuntu 22.04: (Parallelism support temporarily not available with ubuntu 22.04 as Cilk support is not avaiable with newer gcc) @@ -77,24 +79,25 @@ Others require a few extra steps: 2. [uthash](https://github.com/troydhanson/uthash): Clone the [repository](https://github.com/troydhanson/uthash) and copy all the `.h` files in `src` to `/usr/local/include` +### Actually Building Gibbon After you have both Cabal and all the dependencies installed, you can build Gibbon from source: $ git clone https://github.com/iu-parfunc/gibbon $ cd gibbon && source set_env.sh - $ cd gibbon-compiler && cabal v2-build . -w ghc-9.4.6 + $ cd gibbon-compiler && cabal v2-build At this point you can run the Gibbon executable: - $ cabal v2-exec -w ghc-9.4.6 gibbon -- -h + $ cabal v2-run gibbon -- -h If you'd like to run the testsuite, you can do so with: - $ cd $GIBBONDIR && ./run_all_tests.sh + $ ./run_all_tests.sh -## Building a Developement docker container for Gibbon +### Building a Developement docker container for Gibbon To build the Dockerfile for dev purposes run the command below from the gibbon directory. diff --git a/gibbon-compiler/PAPI_BINARIES/papi_stats2.py b/gibbon-compiler/PAPI_BINARIES/papi_stats2.py new file mode 100644 index 000000000..d99e084d7 --- /dev/null +++ b/gibbon-compiler/PAPI_BINARIES/papi_stats2.py @@ -0,0 +1,135 @@ +import os +import subprocess +import re +import numpy as np +import scipy.stats +import json + + +rootdir="/local/scratch/a/singhav/gibbon/gibbon-compiler/PAPI_BINARIES/" +papi_dir = "/local/scratch/a/singhav/gibbon/gibbon-compiler/PAPI_BINARIES/papi_hl_output/" + +iterations = 9 + +for subdir, dirs, files in os.walk(rootdir): + + # subdirectories where the c++ compilation occurs have dirs == [] + #if dirs == []: + + # Opening JSON file + + papi_tot_ins = 0 + papi_tot_cyc = 0 + papi_l3 = 0 + papi_l2_dcm = 0 + papi_l3_accesses = 0 + for f in files: + if "." not in f: + + #print(subdir) + #print(f) + + cmd2 = ["rm", "-rf", papi_dir] + c1 = subprocess.Popen(cmd2, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + c1.wait() + + + #if "Solver" in f and "Filter" not in f: + # cmd = ["./" + f , "--inf-buffer-size", "10000000000", "--biginf-buffer-size", "1000000000", "--iterate", "9"] + #else: + # cmd = ["./" + f , "--iterate", "9"] + + #c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + #c.wait() + cmd = ["./" + f , "--inf-buffer-size", "10000000000", "--iterate", "9"] + + #print(cmd) + #writeFileHandle = open(runtimeFile, "w") + + try: + c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + c.wait() + output, error = c.communicate() + #if error is not None: + # cmd = ["./" + f , "--iterate", "9"] + # c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + # c.wait() + except: + print("ERROR!") + print(e.message) + #cmd = ["./" + f , "--iterate", "9"] + #c = subprocess.Popen(cmd, stdout=writeFileHandle, stderr=subprocess.PIPE, universal_newlines=True) + #c.wait() + + #if error is not None: + # cmd = ["./" + f , "--iterate", "9"] + # c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + # c.wait() + + if not os.path.exists(papi_dir): + cmd = ["./" + f , "--iterate", "9"] + c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + c.wait() + + + file_name = os.listdir(papi_dir)[0] + file_path = os.path.join(papi_dir, file_name) + fl = open(file_path) + + # returns JSON object as + # a dictionary + data = json.load(fl) + + # Iterating through the json + # list + + #for key in data: + # print(key) + # print(data[key]) + # print() + + #print(data['threads']) + + stats = data['threads']['0']['regions'] + #print(stats) + if len(stats) == iterations: + for i in range(0, iterations): + #print(i) + #print(stats[str(i)]) + #print() + + iter_stats = stats[str(i)] + #print(iter_stats['PAPI_TOT_INS']) + #print(iter_stats['PAPI_TOT_CYC']) + #print(iter_stats['PAPI_L2_DCM']) + #print() + + papi_tot_ins += int(iter_stats['PAPI_TOT_INS']) + papi_tot_cyc += int(iter_stats['PAPI_TOT_CYC']) + #papi_l3 += int(iter_stats['PAPI_L3_TCM']) + #papi_l3_accesses += int(iter_stats['PAPI_L3_DCA']) + papi_l2_dcm += int(iter_stats['PAPI_L2_DCM']) + + tot_ins_avg = papi_tot_ins / iterations + papi_tot_cyc = papi_tot_cyc / iterations + #papi_l3_avg = papi_l3 / iterations + #papi_l3_accesses_avg = papi_l3_accesses / iterations + papi_l2_dcm_avg = papi_l2_dcm / iterations + + #print(f + " : " + "ins : {}, cyc : {}, l3 misses : {}, l3 accesses : {}, miss rate : {}".format(tot_ins_avg, papi_tot_cyc, papi_l3_avg, papi_l3_accesses_avg, float(papi_l3_avg/papi_l3_accesses_avg))) + print(f + " : " + "ins : {}, cyc : {}, l2 dcm : {}".format(tot_ins_avg, papi_tot_cyc, papi_l2_dcm_avg)) + + #print(tot_ins_avg) + #print(papi_tot_cyc) + #print(papi_l2_avg) + + papi_tot_ins = 0 + papi_tot_cyc = 0 + papi_l3 = 0 + papi_l3_accesses = 0 + papi_l2_dcm = 0 + + + # Closing file + fl.close() + diff --git a/gibbon-compiler/examples/layout_bench/Basics.hs b/gibbon-compiler/examples/layout_bench/Basics.hs index 6c5926bf8..f16837f85 100644 --- a/gibbon-compiler/examples/layout_bench/Basics.hs +++ b/gibbon-compiler/examples/layout_bench/Basics.hs @@ -455,7 +455,7 @@ mkContentFromText f = -- This creates all the base cases for the inline type mkInlineBaseCase :: Int -> Inline mkInlineBaseCase option = - if option == 0 then (Str (getRandomString 5)) -- get a random word + if option == 0 then (Str (getRandomString 1)) -- get a random word else Space -- Make a list of Inline data Type. @@ -482,7 +482,7 @@ mkInlineList' length index words = mkRandomInlineList :: Int -> (PList Inline) mkRandomInlineList len = if len <= 0 then Nil - else let word = Str (getRandomString 1) + else let word = Str (getRandomString 5) rst = mkRandomInlineList (len - 1) in Cons word rst diff --git a/gibbon-compiler/examples/layout_bench/DecisionTree.hs b/gibbon-compiler/examples/layout_bench/DecisionTree.hs new file mode 100644 index 000000000..da137f638 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/DecisionTree.hs @@ -0,0 +1,79 @@ +module Bench where + +import Basics +import Gibbon.Vector +import Gibbon.PList + +type String = Vector Char + +data PackedBool = B Int + +data DecisionTree = Node PackedBool Inline DecisionTree DecisionTree | Leaf Inline + + + +mkRandomDecisionTree :: Int -> DecisionTree +mkRandomDecisionTree depth = if depth <= 0 then Leaf (Str (getRandomString 10)) + else + let randBool = mod rand 2 + randString = getRandomString 500 + inline = Str randString + leftSubtree = mkRandomDecisionTree (depth-1) + rightSubtree = mkRandomDecisionTree (depth-1) + in Node (B randBool) inline leftSubtree rightSubtree + + + +fromInline :: Inline -> String +fromInline inline = case inline of + Str a -> a + +fromBool :: PackedBool -> Int +fromBool b = case b of + B bb -> bb + +merge_plist :: PList Inline -> PList Inline -> PList Inline +merge_plist lst1 lst2 = case lst1 of + Cons x rst -> Cons x (merge_plist rst lst2) + Nil -> lst2 + + +append_plist :: PList Inline -> Inline -> PList Inline +append_plist lst elem = case lst of + Nil -> (Cons elem) Nil + Cons x rst -> Cons x (append_plist rst elem) + +singleton_plist :: Inline -> PList Inline +singleton_plist elem = (Cons elem) Nil + + +accumulateDecisions :: DecisionTree -> PList Inline +accumulateDecisions tree = case tree of + Node b str left right -> let bb = fromBool b + in if bb == 1 + then + let curr = append_plist Nil str + vecLeft = accumulateDecisions left + temp = merge_plist curr vecLeft + vecRight = accumulateDecisions right + in merge_plist temp vecRight + else + let vecLeft = accumulateDecisions left + vecRight = accumulateDecisions right + in merge_plist vecLeft vecRight + + Leaf str -> (Cons str) Nil + + +gibbon_main = + let tree = mkRandomDecisionTree 20 + vec = iterate (accumulateDecisions tree) + in () + +--- filter + +--- Map + +--- Search + +--- Length diff --git a/gibbon-compiler/examples/layout_bench/DecisionTreeIn.hs b/gibbon-compiler/examples/layout_bench/DecisionTreeIn.hs new file mode 100644 index 000000000..b36a9b22f --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/DecisionTreeIn.hs @@ -0,0 +1,87 @@ +module Bench where + +import Basics +import Gibbon.Vector +import Gibbon.PList + +type String = Vector Char + +data PackedBool = B Int + +data DecisionTree = Node PackedBool DecisionTree (PList Inline) DecisionTree | Leaf -- Inline + + + +mkRandomDecisionTree :: Int -> DecisionTree +mkRandomDecisionTree depth = if depth <= 0 then Leaf --(Str (getRandomString 10)) + else + let randBool = B (mod rand 2) + --irandString = getRandomString 2500 + leftSubtree = mkRandomDecisionTree (depth-1) + inline = mkRandomInline 100 --Str randString + rightSubtree = mkRandomDecisionTree (depth-1) + in Node randBool leftSubtree inline rightSubtree + + +mkRandomInline :: Int -> PList Inline +mkRandomInline len = if len <= 0 then Nil + else let + randString = getRandomString 100 + inline = Str randString + rst = mkRandomInline (len-1) + in Cons inline rst + +fromInline :: Inline -> String +fromInline inline = case inline of + Str a -> a + +fromBool :: PackedBool -> Int +fromBool b = case b of + B bb -> bb + +merge_plist :: PList Inline -> PList Inline -> PList Inline +merge_plist lst1 lst2 = case lst1 of + Cons x rst -> Cons x (merge_plist rst lst2) + Nil -> lst2 + + +append_plist :: PList Inline -> Inline -> PList Inline +append_plist lst elem = case lst of + Nil -> (Cons elem) Nil + Cons x rst -> Cons x (append_plist rst elem) + +singleton_plist :: Inline -> PList Inline +singleton_plist elem = (Cons elem) Nil + + +accumulateDecisions :: DecisionTree -> PList Inline +accumulateDecisions tree = case tree of + Node b left str right -> let bb = fromBool b + in if bb == 1 + then + let --curr = append_plist Nil str + vecLeft = accumulateDecisions left + --temp = merge_plist curr vecLeft + vecRight = accumulateDecisions right + temp = merge_plist vecLeft vecRight + in merge_plist temp str + else + let vecLeft = accumulateDecisions left + vecRight = accumulateDecisions right + in merge_plist vecLeft vecRight + + Leaf -> Nil --(Cons str) Nil + + +gibbon_main = + let tree = mkRandomDecisionTree 22 + vec = iterate (accumulateDecisions tree) + in () + +--- filter + +--- Map + +--- Search + +--- Length diff --git a/gibbon-compiler/examples/layout_bench/DecisionTreePost.hs b/gibbon-compiler/examples/layout_bench/DecisionTreePost.hs new file mode 100644 index 000000000..e52e75f70 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/DecisionTreePost.hs @@ -0,0 +1,85 @@ +module Bench where + +import Basics +import Gibbon.Vector +import Gibbon.PList + +type String = Vector Char + +data PackedBool = B Int + +data DecisionTree = Node PackedBool DecisionTree DecisionTree Inline | Leaf --Inline + + +mkRandomDecisionTree :: Int -> DecisionTree +mkRandomDecisionTree depth = if depth <= 0 then Leaf + else + let randBool = B (mod rand 2) + leftSubtree = mkRandomDecisionTree (depth-1) + rightSubtree = mkRandomDecisionTree (depth-1) + randString = getRandomString 250 + inline = Str randString + in Node randBool leftSubtree rightSubtree inline + + +mkRandomInline :: Int -> PList Inline +mkRandomInline len = if len <= 0 then Nil + else let + randString = getRandomString 50 + inline = Str randString + rst = mkRandomInline (len-1) + in Cons inline rst + +fromInline :: Inline -> String +fromInline inline = case inline of + Str a -> a + +fromBool :: PackedBool -> Int +fromBool b = case b of + B bb -> bb + +merge_plist :: PList Inline -> PList Inline -> PList Inline +merge_plist lst1 lst2 = case lst1 of + Cons x rst -> Cons x (merge_plist rst lst2) + Nil -> lst2 + + +append_plist :: PList Inline -> Inline -> PList Inline +append_plist lst elem = case lst of + Nil -> (Cons elem) Nil + Cons x rst -> Cons x (append_plist rst elem) + +singleton_plist :: Inline -> PList Inline +singleton_plist elem = (Cons elem) Nil + + +accumulateDecisions :: DecisionTree -> PList Inline +accumulateDecisions tree = case tree of + Node b left right str -> let bb = fromBool b + in if bb == 1 + then + let + vecLeft = accumulateDecisions left + vecRight = accumulateDecisions right + merged = merge_plist vecLeft vecRight + in append_plist merged str + else + let vecLeft = accumulateDecisions left + vecRight = accumulateDecisions right + in merge_plist vecLeft vecRight + + Leaf -> Nil -- (Cons str) Nil + + +gibbon_main = + let tree = mkRandomDecisionTree 18 + vec = iterate (accumulateDecisions tree) + in () + +--- filter + +--- Map + +--- Search + +--- Length diff --git a/gibbon-compiler/examples/layout_bench/DecisionTreePre.hs b/gibbon-compiler/examples/layout_bench/DecisionTreePre.hs new file mode 100644 index 000000000..7fe68e2f5 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/DecisionTreePre.hs @@ -0,0 +1,86 @@ +module Bench where + +import Basics +import Gibbon.Vector +import Gibbon.PList + +type String = Vector Char + +data PackedBool = B Int + +data DecisionTree = Node PackedBool Inline DecisionTree DecisionTree | Leaf + + +mkRandomDecisionTree :: Int -> DecisionTree +mkRandomDecisionTree depth = if depth <= 0 then Leaf + else + let randBool = B (mod rand 2) + randString = getRandomString 250 + inline = Str randString + leftSubtree = mkRandomDecisionTree (depth-1) + rightSubtree = mkRandomDecisionTree (depth-1) + in Node randBool inline leftSubtree rightSubtree + + + +--mkRandomInline :: Int -> PList Inline +--mkRandomInline len = if len <= 0 then Nil +-- else let +-- randString = getRandomString 5 +-- inline = Str randString +-- rst = mkRandomInline (len-1) +-- in Cons inline rst + +fromInline :: Inline -> String +fromInline inline = case inline of + Str a -> a + +fromBool :: PackedBool -> Int +fromBool b = case b of + B bb -> bb + +merge_plist :: PList Inline -> PList Inline -> PList Inline +merge_plist lst1 lst2 = case lst1 of + Cons x rst -> Cons x (merge_plist rst lst2) + Nil -> lst2 + + +append_plist :: PList Inline -> Inline -> PList Inline +append_plist lst elem = case lst of + Nil -> (Cons elem) Nil + Cons x rst -> Cons x (append_plist rst elem) + +singleton_plist :: Inline -> PList Inline +singleton_plist elem = (Cons elem) Nil + + +accumulateDecisions :: DecisionTree -> PList Inline +accumulateDecisions tree = case tree of + Node b str left right -> let bb = fromBool b + in if bb == 1 + then + let vecLeft = accumulateDecisions left + vecRight = accumulateDecisions right + merged = merge_plist vecLeft vecRight + in append_plist merged str + else + let vecLeft = accumulateDecisions left + vecRight = accumulateDecisions right + merged = merge_plist vecLeft vecRight + in merged + + Leaf -> Nil + + +gibbon_main = + let tree = mkRandomDecisionTree 18 + vec = iterate (accumulateDecisions tree) + in () + +--- filter + +--- Map + +--- Search + +--- Length diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/Basics.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/Basics.hs new file mode 100644 index 000000000..f16837f85 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/Basics.hs @@ -0,0 +1,640 @@ +module Basics where + +import Gibbon.Prelude +import Gibbon.PList +import Gibbon.Vector +--import Gibbon.Maybe + +type Text = Vector Char + +type TextList = Vector Text + +--type Target = (Text, Text) +--type Attr = (Text, (PList Text), (PList (Text, Text))) +--type Format = Format Text + +-- For simplicity, we are assuming for this benchmark that data Inline is tokenized at the "word" level. +-- Therefore, The Base case where "Text" is used is going to be a single word, i.e, "Str Text". +data Inline = Str Text + | Emph (PList Inline) + -- | Underline (PList Inline) + -- | Strong (PList Inline) + -- | Strikeout (PList Inline) + -- | Superscript (PList Inline) + -- | Subscript (PList Inline) + -- | SmallCaps (PList Inline) + -- | Quoted QuoteType (PList Inline) + -- | Cite [Citation] (PList Inline) + -- | Code Attr Text + | Space + -- | SoftBreak + -- | LineBreak + -- | Math MathType Text + -- | RawInline Format Text + -- | Link Attr (PList Inline) Target + -- | Image Attr (PList Inline) Target + -- | Note (PList Block) + -- | Span Attr (PList Inline) + deriving (Show) + +data Block = Plain (PList Inline) + -- | Para (PList Inline) + -- | LineBlock (PList (PList Inline)) + -- | CodeBlock Attr Text + -- | RawBlock Format Text + -- | BlockQuote (PList Block) + -- | OrderedList ListAttributes [[Block]] + -- | BulletList (PList (PList Block)) + -- | DefinitionList PList ( PList Inline , PList (PList Block) ) ---> This is resulting in a compile time error (TODO: DEBUG) + -- | Header Int Attr (PList Inline) + -- | HorizontalRule + -- | Table Attr Caption [ColSpec] TableHead [TableBody] TableFoot + -- | Div Attr (PList Block) + | Null + deriving (Show) + +-- Define Blog elements +data BlogHeader = Header Text +data BlogId = ID Int +data BlogAuthor = Author Text +data BlogDate = Date Text +data BlogContent = Content Block +data BlogTags = TagList (PList Text) + +-- Define packed Blog data Type/s, we can arrange the fields here to change their relative ordering. +data Blog = End + | Layout1 (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogContent) (BlogTags) (Blog) + | Layout2 (BlogContent) (BlogTags) (Blog) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout3 (BlogTags) (Blog) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout4 (BlogTags) (BlogContent) (Blog) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout5 (Blog) (BlogTags) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout6 (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogContent) (Blog) (BlogTags) + | Layout7 (Blog) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogTags) + | Layout8 (BlogContent) (Blog) (BlogId) (BlogAuthor) (BlogDate) (BlogHeader) (BlogTags) + deriving (Show) + + +getChar :: Int -> Char +getChar decimal = + --if decimal == 0 then '!' + --else if decimal == 1 then '#' + --else if decimal == 2 then '$' + --else if decimal == 3 then '%' + --else if decimal == 4 then '&' + --else if decimal == 5 then '(' + --else if decimal == 6 then ')' + --else if decimal == 7 then '*' + --else if decimal == 8 then '+' + --else if decimal == 9 then ',' + --else if decimal == 10 then '-' + --else if decimal == 11 then '.' + --else if decimal == 12 then '/' + --else if decimal == 13 then '0' + --else if decimal == 14 then '1' + --else if decimal == 15 then '2' + --else if decimal == 16 then '3' + --else if decimal == 17 then '4' + --else if decimal == 18 then '5' + --else if decimal == 19 then '6' + --else if decimal == 20 then '7' + --else if decimal == 21 then '8' + --else if decimal == 22 then '9' + --else if decimal == 23 then ':' + --else if decimal == 24 then ';' + --else if decimal == 25 then '<' + --else if decimal == 26 then '=' + --else if decimal == 27 then '>' + --else if decimal == 28 then '?' + --else if decimal == 29 then '@' + --else if decimal == 30 then 'A' + --else if decimal == 31 then 'B' + --else if decimal == 32 then 'C' + --else if decimal == 33 then 'D' + --else if decimal == 34 then 'E' + --else if decimal == 35 then 'F' + --else if decimal == 36 then 'G' + --else if decimal == 37 then 'H' + --else if decimal == 38 then 'I' + --else if decimal == 39 then 'J' + --else if decimal == 40 then 'K' + --else if decimal == 41 then 'L' + ---else if decimal == 42 then 'M' + --else if decimal == 43 then 'N' + --else if decimal == 44 then 'O' + --else if decimal == 45 then 'P' + --else if decimal == 46 then 'Q' + --else if decimal == 47 then 'R' + --else if decimal == 48 then 'S' + --else if decimal == 49 then 'T' + --else if decimal == 50 then 'U' + --else if decimal == 51 then 'V' + --else if decimal == 52 then 'W' + --else if decimal == 53 then 'X' + --else if decimal == 54 then 'Y' + --else if decimal == 55 then 'Z' + --else if decimal == 56 then '[' + --else if decimal == 57 then ']' + --else if decimal == 58 then '^' + --else if decimal == 59 then '_' + --else if decimal == 60 then '`' + if decimal == 0 then 'a' + --else if decimal == 61 then 'a' + else if decimal == 1 then 'b' + else if decimal == 2 then 'c' + else if decimal == 3 then 'd' + else if decimal == 4 then 'e' + else if decimal == 5 then 'f' + else if decimal == 6 then 'g' + else if decimal == 7 then 'h' + else if decimal == 8 then 'i' + else if decimal == 9 then 'j' + else if decimal == 10 then 'k' + else if decimal == 11 then 'l' + else if decimal == 12 then 'm' + else if decimal == 13 then 'n' + else if decimal == 14 then 'o' + else if decimal == 15 then 'p' + else if decimal == 16 then 'q' + else if decimal == 17 then 'r' + else if decimal == 18 then 's' + else if decimal == 19 then 't' + else if decimal == 20 then 'u' + else if decimal == 21 then 'v' + else if decimal == 22 then 'w' + else if decimal == 23 then 'x' + else if decimal == 24 then 'y' + --else if decimal == 86 then 'z' + else 'z' + --else if decimal == 87 then '{' + --else if decimal == 88 then '|' + --else if decimal == 89 then '}' + --else '~' + +mkChar :: Int -> Char +mkChar val = getChar (mod rand 26) + +-- Get a random word, Int is the length of the string. +-- Based on internet, average english word is 5 characters long +getRandomString :: Int -> Text +getRandomString length = generate length mkChar + +-- Utility Functions to make Blogs and its Elements. +mkBlogHeader :: Text -> BlogHeader +mkBlogHeader text = Header text + +mkBlogID :: Int -> BlogId +mkBlogID val = ID val + +mkBlogAuthor :: Text -> BlogAuthor +mkBlogAuthor text = Author text + +mkBlogDate :: Text -> BlogDate +mkBlogDate text = Date text + +mkBlogContent :: Block -> BlogContent +mkBlogContent block = Content block + +mkBlogTags :: (PList Text) -> BlogTags +mkBlogTags taglist = TagList taglist + + +getFile :: Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Int -> Text +getFile f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 select = + if (select == 0) then f1 + else if (select == 1) then f2 + else if (select == 2) then f3 + else if (select == 3) then f4 + else if (select == 4) then f5 + else if (select == 5) then f6 + else if (select == 6) then f7 + else if (select == 7) then f8 + else if (select == 8) then f9 + else f10 + + +mkListFiles :: Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Int -> PList Text +mkListFiles f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 len = if len < 0 then Nil + else + let f = (getFile f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 len) + rst = (mkListFiles f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 (len - 1)) + in Cons f rst + + +checkBlogID :: BlogId -> Int -> Bool +checkBlogID id val = case id of + ID x -> if ( x == val ) then True + else False + +-- Function to compare two words, each represented by Vector Char. +compareWord :: Text -> Text -> Bool +compareWord word1 word2 = + let len1 = length word1 + len2 = length word2 + compare_len = if (len1 == len2) then True else False + in if (compare_len) then (cmp 0 len1 word1 word2) else False + +-- Compare 2 Vector Char (Text) or words for equality if their length is the same. +cmp :: Int -> Int -> Vector Char -> Vector Char -> Bool +cmp start end word1 word2 = + if (start < end) then + let a = nth word1 start + b = nth word2 start + eq = if (a *==* b) then True else False + recurse = cmp (start+1) end word1 word2 + in (eq && recurse) + else True + +-- Search a TagList (PList Text) for some keyword +searchTagList :: Text -> PList Text -> Bool +{-# INLINE searchTagList #-} +searchTagList keyword taglist = case taglist of + Nil -> False + Cons word rst -> (compareWord keyword word) || (searchTagList keyword rst) + +-- delete a keyword in a TagList +deleteTagList :: Text -> PList Text -> PList Text +deleteTagList keyword taglist = case taglist of + Nil -> Nil + Cons word rst -> if (compareWord keyword word) then (deleteTagList keyword rst) + else Cons word (deleteTagList keyword rst) + + +insertTagList :: Text -> PList Text -> PList Text +insertTagList keyword taglist = case taglist of + Nil -> (Cons keyword) Nil + Cons word rst -> insertTagList keyword rst + +-- Tell if a particular keyword exists in a Block data type or not +isKeywordPresentInBlock :: Text -> Block -> Bool +isKeywordPresentInBlock keyword contentBlock = + case contentBlock of + Plain list_inline -> (searchInlineListForKeyword keyword list_inline) + --Para list_inline -> (searchInlineListForKeyword keyword list_inline) + --BlockQuote list_block -> (searchBlockListForKeyword keyword list_block) + --HorizontalRule -> False + Null -> False + +-- Tell if a particular keyword exists in an inline data type or not. (search a Inline) +isKeywordPresentInline :: Text -> Inline -> Bool +isKeywordPresentInline keyword inline = + case inline of + Str text -> (compareWord keyword text) + Emph list_inline -> (searchInlineListForKeyword keyword list_inline) + --Underline list_inline -> (searchInlineListForKeyword keyword list_inline) + --Strong list_inline -> (searchInlineListForKeyword keyword list_inline) + --Strikeout list_inline -> (searchInlineListForKeyword keyword list_inline) + --Superscript list_inline -> (searchInlineListForKeyword keyword list_inline) + --Subscript list_inline -> (searchInlineListForKeyword keyword list_inline) + --SmallCaps list_inline -> (searchInlineListForKeyword keyword list_inline) + Space -> False + --SoftBreak -> False + --LineBreak -> False + --Note list_block -> (searchBlockListForKeyword keyword list_block) + +-- Search a block list for a particular keyword +searchBlockListForKeyword :: Text -> PList Block -> Bool +searchBlockListForKeyword keyword block_list = + case block_list of + Nil -> False + Cons block rst -> (isKeywordPresentInBlock keyword block) || (searchBlockListForKeyword keyword rst) + +-- Search an Inline list for a particular keyword +searchInlineListForKeyword :: Text -> PList Inline -> Bool +searchInlineListForKeyword keyword inline_list = + case inline_list of + Nil -> False + Cons inline rst -> (isKeywordPresentInline keyword inline) || (searchInlineListForKeyword keyword rst) + +-- Emphasize a particular keyword in a Block type +emphasizeKeywordInBlock :: Text -> Block -> Block +emphasizeKeywordInBlock keyword contentBlock = + case contentBlock of + Plain list_inline -> Plain (emphasizeInlineListForKeyword keyword list_inline) + --Para list_inline -> Para (emphasizeInlineListForKeyword keyword list_inline) + --BlockQuote list_block -> BlockQuote (emphasizeKeywordInBlockList keyword list_block) + --HorizontalRule -> HorizontalRule + Null -> Null + +-- Emphasize a particular keyword in an Inline data type +emphasizeKeywordInline :: Text -> Inline -> Inline +emphasizeKeywordInline keyword inline = + case inline of + Str text -> let isSame = compareWord keyword text + --_ = printsym (quote "NEWLINE") + --_ = printbool isSame + --_ = printsym (quote "NEWLINE") + in if (isSame) then let + newlist :: PList Inline + newlist = (Cons (copyPacked inline)) Nil -- ---> Here we had to use a call to copyPacked in order to copy over the inline to a new region, otherwise segfaults. + in (Emph newlist) + else inline + Emph list_inline -> Emph (emphasizeInlineListForKeyword keyword list_inline) + --Underline list_inline -> Underline (emphasizeInlineListForKeyword keyword list_inline) + --Strong list_inline -> Strong (emphasizeInlineListForKeyword keyword list_inline) + --Strikeout list_inline -> Strikeout (emphasizeInlineListForKeyword keyword list_inline) + --Superscript list_inline -> Superscript (emphasizeInlineListForKeyword keyword list_inline) + --Subscript list_inline -> Subscript (emphasizeInlineListForKeyword keyword list_inline) + --SmallCaps list_inline -> SmallCaps (emphasizeInlineListForKeyword keyword list_inline) + Space -> Space + --SoftBreak -> SoftBreak + --LineBreak -> LineBreak + --Note list_block -> Note (emphasizeKeywordInBlockList keyword list_block) + +-- Emphasize a particular keyword in an Inline list +emphasizeInlineListForKeyword :: Text -> PList Inline -> PList Inline +{-# INLINE emphasizeInlineListForKeyword #-} +emphasizeInlineListForKeyword keyword inline_list = + case inline_list of + Nil -> Nil + Cons inline rst -> let + newinline = emphasizeKeywordInline keyword inline + rst' = emphasizeInlineListForKeyword keyword rst + in Cons newinline rst' + +-- Emphasize a particular keyword in a block list +emphasizeKeywordInBlockList :: Text -> PList Block -> PList Block +emphasizeKeywordInBlockList keyword block_list = + case block_list of + Nil -> Nil + Cons block rst -> let + newBlock = emphasizeKeywordInBlock keyword block + rst' = emphasizeKeywordInBlockList keyword rst + in Cons newBlock rst' + + +searchBlogTags :: Text -> BlogTags -> Bool +searchBlogTags keyword tags = case tags of + TagList list -> searchTagList keyword list + + +deleteBlogTags :: Text -> BlogTags -> BlogTags +deleteBlogTags keyword tags = case tags of + TagList list -> TagList (deleteTagList keyword list) + +insertBlogTags :: Text -> BlogTags -> BlogTags +insertBlogTags keyword tags = case tags of + TagList list -> TagList (insertTagList keyword list) + +-- emphasize blog content, if present is True +emphasizeBlogContent' :: Text -> BlogContent -> BlogContent +emphasizeBlogContent' keyword oldContent = case oldContent of + Content block -> Content (emphasizeKeywordInBlock keyword block) + + + +emphasizeBlogContent :: Text -> BlogContent -> BlogContent +emphasizeBlogContent keyword oldContent = case oldContent of + Content block -> Content (emphasizeKeywordInBlock keyword block) + +searchBlogContent :: Text -> BlogContent -> Bool +searchBlogContent keyword content = case content of + Content block -> (isKeywordPresentInBlock keyword block) + + +fileToContent :: Vector Char -> Vector Char -> PList Inline -> Int -> Int -> Block +fileToContent file word plist_inline index max_len = + if index >= max_len then (Plain plist_inline) + else let + character :: Char + character = nth file index + isSpace = if ( character *==* (head " ") ) then True else False + char_vec = (singleton character) + --plist_space :: PList Inline + --plist_space = (Cons (Space) plist_inline) + in if (isSpace) then (fileToContent file (singleton (nth file (index+1))) (Cons (Str word) plist_inline) (index+2) max_len) + else (fileToContent file (append word char_vec) (plist_inline) (index+1) max_len) + + +fileToContent' :: Vector Char -> Vector Char -> TextList -> Int -> Int -> TextList +fileToContent' file word running_list index max_len = + if index >= max_len then (append running_list (valloc 0) ) --(generate 1 (\i -> "")) + else let + character :: Char + character = nth file index + isSpace = if ( character *==* (head " ") ) then True else False + char_vec = (singleton character) + in if (isSpace) then (fileToContent' file (singleton (nth file (index+1))) (append running_list (generate 1 (\i -> word))) (index+2) max_len) + else (fileToContent' file (append word char_vec) (running_list) (index+1) max_len) + +printWordList :: TextList -> Int -> Int -> () +printWordList vec start end = if start < end then + let + element = nth vec start + _ = printVec (\i -> printchar i) element + in printWordList vec (start+1) end + else () + + +fileToTags :: Vector Char -> Vector Char -> Int -> Int -> PList Text +fileToTags file word index max_len = + if index >= max_len then Nil + else let + character :: Char + character = nth file index + isSpace = if ( character *==* (head " ") ) then True else False + char_vec = (singleton character) + in if (isSpace) then Cons word (fileToTags file (singleton (nth file (index+1))) (index+2) max_len) + else (fileToTags file (append word char_vec) (index+1) max_len) + + +mkTagsFromText :: Text -> BlogTags +mkTagsFromText f' = + let tags = fileToTags f' (singleton (nth f' 0)) 1 (vlength f') + tags' = TagList tags + in tags' + + +{- # INLINE # -} +mkContentFromText :: Text -> BlogContent +mkContentFromText f = + let block = fileToContent f (singleton (nth f 0)) Nil 1 (vlength f) + content = mkBlogContent block + in content + +-- Make an Inline type, option chooses what kind of Inline data type we are creating +-- This creates all the base cases for the inline type +mkInlineBaseCase :: Int -> Inline +mkInlineBaseCase option = + if option == 0 then (Str (getRandomString 1)) -- get a random word + else Space + +-- Make a list of Inline data Type. +mkInlineList :: Int -> Int -> (PList Inline) +mkInlineList length base = + if length <= 0 then Nil + -- If its not base case, then don't stop recursion. + else if (base == 0) then + let item = Emph (mkInlineList 100 1) + rst = (mkInlineList (length - 1) base) + in Cons item rst + -- If its base case, then stop recursion in Inline data type and only add base cases. + else let item = (mkInlineBaseCase (mod rand 4)) + rst = mkInlineList (length - 1) base + in Cons item rst + +-- Make a list of Inline data Type. +mkInlineList' :: Int -> Int -> TextList -> (PList Inline) +mkInlineList' length index words = + if index >= length then Nil + else let item = Str (nth words index) + rst = mkInlineList' length (index+1) words + in Cons item rst + +mkRandomInlineList :: Int -> (PList Inline) +mkRandomInlineList len = if len <= 0 then Nil + else let word = Str (getRandomString 5) + rst = mkRandomInlineList (len - 1) + in Cons word rst + +mkSomeTags :: Int -> PList Text +mkSomeTags len = if len <= 0 then Nil + else let word = "a" --(getRandomString 1) + rst = mkSomeTags (len - 1) + in Cons word rst + + +-- Make a list of blocks +mkBlockList :: Int -> Int -> (PList Block) +mkBlockList length base = + if length <= 0 then Nil + else if (base == 0) then + let item = (Plain (mkInlineList 1000 1)) + rst = (mkBlockList (length - 1) base) + in Cons item rst + else let item = Null + rst = (mkBlockList (length - 1) base) + in Cons item rst + +-- Make a Block data type with random data, make depth of recursion to 1 for now +-- mkBlock :: Int -> Block +-- mkBlock option = +-- if option == 0 then (Plain (mkInlineList 1000 1)) +-- else if option == 1 then (Para (mkInlineList 1000 1)) +-- else (BlockQuote (mkBlockList 1000 1)) + +-- -- Base case for make Block +-- mkBlockBaseCase :: Int -> Block +-- mkBlockBaseCase option = +-- if option == 0 then HorizontalRule +-- else Null + +-- Make an Inline type, option chooses what kind of Inline data type we are creating +-- This will Purposefully make Inline lists at a depth of recursion 1, this can be modified to increase the depth of recursion. +-- This function crates the recursive fields. +-- mkInline :: Int -> Inline +-- mkInline option = +-- if option == 0 then (Emph (mkInlineList 100 1)) +-- else if option == 1 then (Underline (mkInlineList 100 1)) +-- else if option == 2 then (Strong (mkInlineList 100 1)) +-- else if option == 3 then (Strikeout (mkInlineList 100 1)) +-- else if option == 4 then (Superscript (mkInlineList 100 1)) +-- else if option == 5 then (Subscript (mkInlineList 100 1)) +-- else if option == 6 then (SmallCaps (mkInlineList 100 1)) +-- else (Note (mkBlockList 100 1)) + + +blogLength :: Blog -> Int +blogLength blog = case blog of + End -> 0 + Layout1 a b c d e f rst -> 1 + blogLength rst + Layout2 a b rst c d e f -> 1 + blogLength rst + Layout3 a rst b c d e f -> 1 + blogLength rst + Layout4 a b rst d e f g -> 1 + blogLength rst + Layout5 rst a b c d e f -> 1 + blogLength rst + Layout6 a b c d e rst f -> 1 + blogLength rst + Layout7 rst a b c d e f -> 1 + blogLength rst + Layout8 a rst b c d e f -> 1 + blogLength rst + + +printContent :: BlogContent -> () +printContent content = + case content of + Content block -> + let _ = printsym (quote "Content ") + _ = printBlock block + in () + +printTagList :: BlogTags -> () +printTagList tags = + case tags of + TagList plist -> + let _ = printsym (quote "TagList ") + _ = printPlistText plist + in () + +printDate :: BlogDate -> () +printDate date = case date of + Date str -> let _ = printsym (quote "Date ") + _ = printVec (\i -> printchar i) str + in () + +printAuthor :: BlogAuthor -> () +printAuthor date = case date of + Author str -> let _ = printsym (quote "Author ") + _ = printVec (\i -> printchar i) str + in () + +printHeader :: BlogHeader -> () +printHeader header = case header of + Header str -> let _ = printsym (quote "Header ") + _ = printVec (\i -> printchar i) str + in () + +printID :: BlogId -> () +printID id = case id of + ID val -> let _ = printsym (quote "ID ") + _ = printint val + in () + +printBlog :: Blog -> () +printBlog blog = case blog of + Layout1 header id author date content tags rst -> let _ = printsym (quote "Layout1 ") + _ = printHeader header + _ = printID id + _ = printAuthor author + _ = printDate date + _ = printContent content + _ = printTagList tags + _ = printBlog rst + in () + + + +printBlock :: Block -> () +printBlock block = case block of + Plain plist -> let _ = printsym (quote "Plain ") + _ = printPlistInline plist + in () + Null -> let _ = printsym (quote "Null") + in () + +printPlistInline :: PList Inline -> () +printPlistInline list = case list of + Cons x rst -> let _ = printsym (quote "PList ( Cons ") + _ = printInline x + _ = printPlistInline rst + _ = printsym (quote " ) ") + in () + Nil -> let _ = printsym (quote "Nil") + in () + +printPlistText :: PList Text -> () +printPlistText list = case list of + Cons x rst -> let _ = printsym (quote "PList ( Cons ") + _ = printVec (\i -> printchar i) x + _ = printPlistText rst + _ = printsym (quote " ) ") + in () + Nil -> let _ = printsym (quote "Nil") + in () + +printInline :: Inline -> () +printInline inline = case inline of + Str text -> let _ = printsym (quote "Str ") + _ = printVec (\i -> printchar i) text + in () + Emph plist -> let _ = printsym (quote "Emph ") + _ = printPlistInline plist + in () + Space -> let _ = printsym (quote "Space ") + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/Eval.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/Eval.hs new file mode 100644 index 000000000..b25a30a39 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/Eval.hs @@ -0,0 +1,51 @@ +data Ast + = Val Bool + | Not Ast + | Or Ast Ast + | And Ast Ast + +eval :: Ast -> Bool +eval x = case x of + Val b -> b + Not e -> if eval e then False else True + Or e1 e2 -> + if eval e1 then True + else eval e2 + And e1 e2 -> + if eval e1 then eval e2 + else False + +simplify :: Ast -> Ast +simplify x = Val (eval x) + +evalR :: Ast -> Bool +evalR x = case x of + Val b -> b + Not e -> if evalR e then False else True + Or e1 e2 -> + if evalR e2 then True + else evalR e1 + And e1 e2 -> + if evalR e2 then evalR e1 + else False + +simplifyR :: Ast -> Ast +simplifyR x = Val (evalR x) + +mkRandTree :: Int -> Ast +mkRandTree n = + if n > 0 then + let m = mod rand 3 in + if m == 0 then Not (mkRandTree (n-1)) + else if m == 1 then And (mkRandTree (n-1)) (mkRandTree (n-1)) + else Or (mkRandTree (n-1)) (mkRandTree (n-1)) + else Val (mod rand 2 == 0) + +mkDeterministicTree :: Int -> Ast +mkDeterministicTree n = + if n > 0 then + let m = 3 in + if m == 0 then Not (mkDeterministicTree (n-1)) + else if m == 1 then And (mkDeterministicTree (n-1)) (mkDeterministicTree (n-1)) + else Or (mkDeterministicTree (n-1)) (mkDeterministicTree (n-1)) + else Val (1 == 0) diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout1.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout1.hs new file mode 100644 index 000000000..c008094dd --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout1.hs @@ -0,0 +1,53 @@ +module GenerateLayout1 where +import Basics + +type Text = Vector Char + + +-- Int:length, Int:Content, Int: Tags +mkBlogs_layout1 :: Int -> Int -> Int -> Blog +mkBlogs_layout1 length contlen taglen = + if length <= 0 then End + else + let + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + content = (Content (Plain (mkRandomInlineList contlen))) + tags = (TagList (mkSomeTags taglen)) + rst = (mkBlogs_layout1 (length - 1) contlen taglen) + in Layout1 header id author date content tags rst + + + +--- Traversal 1 (Filter blogs) +-- Content -> 500 +-- Tags -> 5 +-- Blogs -> 1,000,000 +-- Input always going to then branch + + +-- Traversal 2 (EmphContent) +-- Content -> 50 +-- Tags -> 10 +-- Blogs -> 1,000,000 +-- Input always going to then branch + + +-- Traversal 3 (SearchTag emph Content) +-- Content -> 500 +-- Tags -> 5 +-- Blogs -> 400,000 +-- Input always going to then branch + +--Testing First Touch +-- Content -> 50 +-- Tags -> 50 +-- Blogs -> 400,000 +-- + +-- manyFuncs +-- Content -> 150 +-- Tags -> 10 +-- Blogs -> 1000000 diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout2.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout2.hs new file mode 100644 index 000000000..5a6e4bd8b --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout2.hs @@ -0,0 +1,18 @@ +module GenerateLayout2 where +import Basics + +type Text = Vector Char + +mkBlogs_layout2 :: Int -> Int -> Int -> Blog +mkBlogs_layout2 length contlen taglen = + if length <= 0 then End + else + let + content = (Content (Plain (mkRandomInlineList contlen))) + tags = (TagList (mkSomeTags taglen)) + rst = (mkBlogs_layout2 (length - 1) contlen taglen) + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + in Layout2 content tags rst header id author date diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout3.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout3.hs new file mode 100644 index 000000000..1e7a5b7ed --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout3.hs @@ -0,0 +1,18 @@ +module GenerateLayout3 where +import Basics + +type Text = Vector Char + +mkBlogs_layout3 :: Int -> Int -> Int -> Blog +mkBlogs_layout3 length contlen taglen = + if length <= 0 then End + else + let + tags = (TagList (mkSomeTags taglen)) + rst = (mkBlogs_layout3 (length - 1) contlen taglen) + content = (Content (Plain (mkRandomInlineList contlen))) + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + in Layout3 tags rst content header id author date diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout4.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout4.hs new file mode 100644 index 000000000..e4a0a20fa --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout4.hs @@ -0,0 +1,18 @@ +module GenerateLayout4 where +import Basics + +type Text = Vector Char + +mkBlogs_layout4 :: Int -> Int -> Int -> Blog +mkBlogs_layout4 length contlen taglen = + if length <= 0 then End + else + let + tags = (TagList (mkSomeTags taglen)) + content = (Content (Plain (mkRandomInlineList contlen))) + rst = (mkBlogs_layout4 (length - 1) contlen taglen) + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + in Layout4 tags content rst header id author date diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout5.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout5.hs new file mode 100644 index 000000000..369c24ee9 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout5.hs @@ -0,0 +1,19 @@ +module GenerateLayout5 where +import Basics + +type Text = Vector Char + + +mkBlogs_layout5 :: Int -> Int -> Int -> Blog +mkBlogs_layout5 length contlen taglen = + if length <= 0 then End + else + let + rst = (mkBlogs_layout5 (length - 1) contlen taglen) + tags = (TagList (mkSomeTags taglen)) + content = (Content (Plain (mkRandomInlineList contlen))) + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + in Layout5 rst tags content header id author date diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout7.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout7.hs new file mode 100644 index 000000000..f40dd823d --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout7.hs @@ -0,0 +1,18 @@ +module GenerateLayout7 where +import Basics + +type Text = Vector Char + +mkBlogs_layout7 :: Int -> Int -> Int -> Blog +mkBlogs_layout7 length contlen taglen = + if length <= 0 then End + else + let + rst = (mkBlogs_layout7 (length - 1) contlen taglen) + content = (Content (Plain (mkRandomInlineList contlen))) + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + tags = (TagList (mkSomeTags taglen)) + in Layout7 rst content header id author date tags diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout8.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout8.hs new file mode 100644 index 000000000..e69d136eb --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/GenerateLayout8.hs @@ -0,0 +1,19 @@ +module GenerateLayout8 where +import Basics + +type Text = Vector Char + + +mkBlogs_layout8 :: Int -> Int -> Int -> Blog +mkBlogs_layout8 length contlen taglen = + if length <= 0 then End + else + let + content = (Content (Plain (mkRandomInlineList contlen))) + rst = (mkBlogs_layout8 (length - 1) contlen taglen) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + header = (Header (getRandomString 5)) + tags = (TagList (mkSomeTags taglen)) + in Layout8 content rst id author date header tags diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/Makefile b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/Makefile new file mode 100644 index 000000000..a4da5f01f --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/Makefile @@ -0,0 +1,4 @@ + + +clean: + rm solve_ilp_* *.c *.exe *.txt *Greedy *Solver diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOneIn.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOneIn.hs new file mode 100644 index 000000000..cf22d12fa --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOneIn.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node Tree PackedInt Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + val = P depth + right = mkTree (depth-1) + in Node left val right + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node l val r -> let + sl = addOneTree l + a1 = addOne val + sr = addOneTree r + in Node sl a1 sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePost.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePost.hs new file mode 100644 index 000000000..d4427aa65 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePost.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node l r val -> let + sl = addOneTree l + sr = addOneTree r + a1 = addOne val + in Node sl sr a1 + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePostPre.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePostPre.hs new file mode 100644 index 000000000..c5e9c129c --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePostPre.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node l r val -> let + a1 = addOne val + sl = addOneTree l + sr = addOneTree r + in Node sl sr a1 + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePre.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePre.hs new file mode 100644 index 000000000..2c071cd2e --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePre.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node val l r -> let + a1 = addOne val + sl = addOneTree l + sr = addOneTree r + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePrePost.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePrePost.hs new file mode 100644 index 000000000..74c5ca1c8 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeAddOnePrePost.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node val l r -> let + sl = addOneTree l + sr = addOneTree r + a1 = addOne val + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyIn.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyIn.hs new file mode 100644 index 000000000..4e1e23914 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyIn.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node Tree PackedInt Tree | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + left = mkTree (depth-1) + val = P depth + right = mkTree (depth-1) + in Node left val right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node l val r -> let + sl = copyTree l + newVal = copyPackedInt val + sr = copyTree r + in Node sl newVal sr + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPost.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPost.hs new file mode 100644 index 000000000..7ed6fd2e2 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPost.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node l r val -> let + sl = copyTree l + sr = copyTree r + newVal = copyPackedInt val + in Node sl sr newVal + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPostPre.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPostPre.hs new file mode 100644 index 000000000..86dc9b803 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPostPre.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node l r val -> let + newVal = copyPackedInt val + sl = copyTree l + sr = copyTree r + in Node sl sr newVal + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPre.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPre.hs new file mode 100644 index 000000000..9dfd554f9 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPre.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node val l r -> let + newVal = copyPackedInt val + sl = copyTree l + sr = copyTree r + in Node newVal sl sr + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPrePost.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPrePost.hs new file mode 100644 index 000000000..3ffea823a --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPrePost.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node val l r -> let + sl = copyTree l + sr = copyTree r + newVal = copyPackedInt val + in Node newVal sl sr + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoIn.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoIn.hs new file mode 100644 index 000000000..5a2830a7d --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoIn.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node Tree PackedInt Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + val = P depth + right = mkTree (depth-1) + in Node left val right + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node l val r -> let + sl = expoTree l + a1 = expo2 val + sr = expoTree r + in Node sl a1 sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPost.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPost.hs new file mode 100644 index 000000000..86bb27e2f --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPost.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node l r val -> let + sl = expoTree l + sr = expoTree r + a1 = expo2 val + in Node sl sr a1 + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPostPre.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPostPre.hs new file mode 100644 index 000000000..4f2a2e88a --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPostPre.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node l r val -> let + a1 = expo2 val + sl = expoTree l + sr = expoTree r + in Node sl sr a1 + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPre.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPre.hs new file mode 100644 index 000000000..44ffa6cd5 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPre.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node val l r -> let + a1 = expo2 val + sl = expoTree l + sr = expoTree r + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPrePost.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPrePost.hs new file mode 100644 index 000000000..07936a1cc --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPrePost.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node val l r -> let + sl = expoTree l + sr = expoTree r + a1 = expo2 val + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeRightMost_l.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeRightMost_l.hs new file mode 100644 index 000000000..f25a97162 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeRightMost_l.hs @@ -0,0 +1,42 @@ +module TreeRightSum where + +data PackedInt = P Int +data Tree = Node Tree Tree | Leaf PackedInt + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then let + val = P depth + in Leaf val + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node left right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +rightMostTree :: Tree -> PackedInt +rightMostTree tree = case tree of + Node l r -> let + rightMostVal = rightMostTree r + in rightMostVal + Leaf val -> val + +rightMostTreeRec :: Int -> Tree -> PackedInt +rightMostTreeRec iters tree = if iters <= 0 + then rightMostTree tree + else let + val = rightMostTree tree + in rightMostTreeRec (iters-1) tree + + + +gibbon_main = let + tree = mkTree 29 + newTree = iterate (rightMostTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeRightMost_r.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeRightMost_r.hs new file mode 100644 index 000000000..e0cbaa7dc --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeRightMost_r.hs @@ -0,0 +1,40 @@ +module TreeRightSum where + +data PackedInt = P Int +data Tree = Node Tree Tree | Leaf PackedInt + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then let + val = P depth + in Leaf val + else + let + right = mkTree (depth-1) + left = mkTree (depth-1) + in Node right left + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +rightMostTree :: Tree -> PackedInt +rightMostTree tree = case tree of + Node r l -> let + rightMostVal = rightMostTree r + in rightMostVal + Leaf val -> val + +rightMostTreeRec :: Int -> Tree -> PackedInt +rightMostTreeRec iters tree = if iters <= 0 + then rightMostTree tree + else let + val = rightMostTree tree + in rightMostTreeRec (iters-1) tree + +gibbon_main = let + tree = mkTree 29 + newTree = iterate (rightMostTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/eval_l.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/eval_l.hs new file mode 100644 index 000000000..32e125701 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/eval_l.hs @@ -0,0 +1,7 @@ +import Eval + +gibbon_main = + let + n = 30 + t = mkDeterministicTree n + in iterate (eval t) diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/eval_r.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/eval_r.hs new file mode 100644 index 000000000..2560bce26 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/eval_r.hs @@ -0,0 +1,7 @@ +import Eval + +gibbon_main = + let + n = 30 + t = mkDeterministicTree n + in iterate (evalR t) diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/generate_cache_stats.py b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/generate_cache_stats.py new file mode 100644 index 000000000..b10d354ea --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/generate_cache_stats.py @@ -0,0 +1,171 @@ +import subprocess +import time +import statistics +import numpy as np +import scipy +import re +import os +import sys + +iterations = 9 +inf_buffer_size = 10000000000 + +def mean_confidence_interval(data, confidence=0.95): + a = 1.0 * np.array(data) + n = len(a) + m, se = np.mean(a), scipy.stats.sem(a) + h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1) + return m, m-h, m+h + +rootdir = "/home/vidush/workdisk/git/gibbon-main/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/" +papi_dir = "/home/vidush/workdisk/git/gibbon-main/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/papi_hl_output/" + + + +# Was thinking to make compile and run separate but not important right now. +#compileTrue = sys.argv[2] +#executeTrue = sys.argv[3] + +executables = [] + +gibbonFiles = ['eval_r.hs', 'layout3FilterBlogs.hs', 'TreeExpoPre.hs', 'layout1TagSearch.hs', 'layout2ListLen.hs', 'layout8TagSearch.hs', 'layout2TagSearch.hs', 'layout8FilterBlogs.hs', 'TreeExpoIn.hs', 'layout4ContentSearch.hs', 'layout3ContentSearch.hs', 'eval_l.hs', 'TreeAddOnePre.hs', 'layout7TagSearch.hs', 'layout2ContentSearch.hs', 'TreeRightMost_l.hs', 'layout2FilterBlogs.hs', 'manyFuncs.hs', 'layout1PowerList.hs', 'TreeCopyPre.hs', 'TreeAddOneIn.hs', 'layout4TagSearch.hs', 'layout1ListLen.hs', 'TreeCopyPost.hs', 'layout8ContentSearch.hs', 'TreeRightMost_r.hs', 'TreeAddOnePost.hs', 'layout1ContentSearch.hs', 'TreeCopyIn.hs', 'layout7ContentSearch.hs', 'layout3TagSearch.hs', 'layout2PowerList.hs', 'layout5ContentSearch.hs', 'layout4FilterBlogs.hs', 'layout5FilterBlogs.hs', 'layout5TagSearch.hs', 'layout7FilterBlogs.hs', 'layout1FilterBlogs.hs', 'TreeExpoPost.hs'] + +# Compile all Gibbon binaries. +for subdir, dirs, files in os.walk(rootdir): + + print("subdir: " + str(subdir)) + print("dirs: " + str(dirs)) + print("files: " + str(files)) + + + for file in files: + + if ".hs" in file and file in gibbonFiles: + + file_path = subdir + file + + file_without_haskell_extension = file_path.replace(".hs", '') + print("Compile " + file + "...") + gibbon_cmd = ["gibbon", "--no-gc", "--to-exe", "--packed", file_path] + + c = subprocess.Popen(gibbon_cmd) + c.wait() + output, error = c.communicate() + + if error is None: + print("Compiled " + file + " succesfully!") + + executables.append(file_without_haskell_extension + ".exe") + + print() + + +marmosetFiles = ['eval_r.hs', 'TreeExpoPre.hs', 'layout2ListLen.hs', 'layout8TagSearch.hs', 'layout8FilterBlogs.hs', 'TreeAddOnePre.hs', 'layout8ContentSearch.hs', 'TreeRightMost_l.hs', 'manyFuncs.hs', 'TreeCopyPre.hs', 'layout1PowerList.hs'] + + +# Compile all Marmoset binaries. +for subdir, dirs, files in os.walk(rootdir): + + print("subdir: " + str(subdir)) + print("dirs: " + str(dirs)) + print("files: " + str(files)) + + + for file in files: + + if ".hs" in file and file in marmosetFiles: + + file_path = subdir + file + + file_without_haskell_extension = file_path.replace(".hs", '') + print(file_without_haskell_extension) + + solver_binary_name = file_without_haskell_extension + "Solver" + greedy_binary_name = file_without_haskell_extension + "Greedy" + + executables.append(solver_binary_name) + executables.append(greedy_binary_name) + + print("Compile " + file + " with solver optimization..." ) + solver_cmd = ["gibbon", "--no-gc", "--to-exe", "--packed", "--opt-layout-global", "--opt-layout-use-solver", file_path, "-o", solver_binary_name] + + c = subprocess.Popen(solver_cmd) + c.wait() + output, error = c.communicate() + + if error is None: + print("Compiled " + file + " succesfully!") + + print() + + print("Compile " + file + " with greedy optimization..." ) + greedy_cmd = ["gibbon", "--no-gc", "--to-exe", "--packed", "--opt-layout-global", file_path, "-o", greedy_binary_name] + + c = subprocess.Popen(greedy_cmd) + c.wait() + output, error = c.communicate() + + if error is None: + print("Compiled " + file + " succesfully!") + + + print() + + +papi_tot_ins = 0 +papi_tot_cyc = 0 +papi_l2_dcm = 0 + +for file in executables: + + cmd2 = ["rm", "-rf", papi_dir] + c1 = subprocess.Popen(cmd2, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + c1.wait() + + + cmd = [file , "--inf-buffer-size", str(inf_buffer_size), "--iterate", "9"] + + try: + c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + c.wait() + output, error = c.communicate() + except: + print("Error!") + + if not os.path.exists(papi_dir): + cmd = [file, "--iterate", "9"] + c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + c.wait() + + + file_name = os.listdir(papi_dir)[0] + file_path = os.path.join(papi_dir, file_name) + fl = open(file_path) + + data = json.load(fl) + + stats = data['threads']['0']['regions'] + + if len(stats) == iterations: + for i in range(0, iterations): + + iter_stats = stats[str(i)] + papi_tot_ins += int(iter_stats['PAPI_TOT_INS']) + papi_tot_cyc += int(iter_stats['PAPI_TOT_CYC']) + papi_l2_dcm += int(iter_stats['PAPI_L2_DCM']) + + tot_ins_avg = papi_tot_ins / iterations + papi_tot_cyc = papi_tot_cyc / iterations + papi_l2_dcm_avg = papi_l2_dcm / iterations + + print(f + " : " + "ins : {}, cyc : {}, l2 dcm : {}".format(tot_ins_avg, papi_tot_cyc, papi_l2_dcm_avg)) + + papi_tot_ins = 0 + papi_tot_cyc = 0 + papi_l2_dcm = 0 + + fl.close() + + + + diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/generate_compile_times.py b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/generate_compile_times.py new file mode 100644 index 000000000..ec3dcde52 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/generate_compile_times.py @@ -0,0 +1,134 @@ +import subprocess +import time +import statistics +import numpy as np +import scipy +import re +import os + +iterations = 9 + +def mean_confidence_interval(data, confidence=0.95): + a = 1.0 * np.array(data) + n = len(a) + m, se = np.mean(a), scipy.stats.sem(a) + h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1) + return m, m-h, m+h + +rootdir = "/home/vidush/workdisk/git/gibbon-main/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/" + +gibbonFiles = ['eval_r.hs', 'layout3FilterBlogs.hs', 'TreeExpoPre.hs', 'layout1TagSearch.hs', 'layout2ListLen.hs', 'layout8TagSearch.hs', 'layout2TagSearch.hs', 'layout8FilterBlogs.hs', 'TreeExpoIn.hs', 'layout4ContentSearch.hs', 'layout3ContentSearch.hs', 'eval_l.hs', 'TreeAddOnePre.hs', 'layout7TagSearch.hs', 'layout2ContentSearch.hs', 'TreeRightMost_l.hs', 'layout2FilterBlogs.hs', 'manyFuncs.hs', 'layout1PowerList.hs', 'TreeCopyPre.hs', 'TreeAddOneIn.hs', 'layout4TagSearch.hs', 'layout1ListLen.hs', 'TreeCopyPost.hs', 'layout8ContentSearch.hs', 'TreeRightMost_r.hs', 'TreeAddOnePost.hs', 'layout1ContentSearch.hs', 'TreeCopyIn.hs', 'layout7ContentSearch.hs', 'layout3TagSearch.hs', 'layout2PowerList.hs', 'layout5ContentSearch.hs', 'layout4FilterBlogs.hs', 'layout5FilterBlogs.hs', 'layout5TagSearch.hs', 'layout7FilterBlogs.hs', 'layout1FilterBlogs.hs', 'TreeExpoPost.hs'] + + +# Compile all Gibbon binaries. +for subdir, dirs, files in os.walk(rootdir): + + for file in files: + + if ".hs" in file and file in gibbonFiles: + + file_path = subdir + file + + file_without_haskell_extension = file_path.replace(".hs", '') + + iterTimes = [] + for i in range(0, iterations): + start = time.time() + gibbon_cmd = subprocess.run(["gibbon", "--packed", "--no-gc", "--to-exe", file_path]) + elapsed = time.time() + iterTimes.append(float(elapsed-start)) + + m, lb, ub = mean_confidence_interval(iterTimes) + median = statistics.median(iterTimes) + print("Gibbon Time: " + file + " : " + "Median: {}, Mean: {}, lb: {}, ub: {}".format(median, m, lb, ub)) + print() + + + + +def parse_solver_times(array): + + solver_times = [] + for line in array: + + result = re.findall("iter time: ((\d+).(\d+))", line) + #print(result) + if not result == []: + #print(float(result[0][0])) + solver_times.append(float(result[0][0])) + + return sum(solver_times) + + +marmosetFiles = ['eval_r.hs', 'TreeExpoPre.hs', 'layout2ListLen.hs', 'layout8TagSearch.hs', 'layout8FilterBlogs.hs', 'TreeAddOnePre.hs', 'layout8ContentSearch.hs', 'TreeRightMost_l.hs', 'manyFuncs.hs', 'TreeCopyPre.hs', 'layout1PowerList.hs'] + + +# Compile all Marmoset binaries. +for subdir, dirs, files in os.walk(rootdir): + + for file in files: + + if ".hs" in file and file in marmosetFiles: + + file_path = subdir + file + + iterTimes = [] + solver_times = [] + + for i in range(0, iterations): + file_handle = open("solver_compile_stats.txt", "w") + start = time.time() + gibbon_cmd_haskell = subprocess.run(["gibbon", "--packed", "--no-gc", "--opt-layout-use-solver", "--opt-layout-global", "--to-exe", file_path], stdout=file_handle, stderr=file_handle) + elapsed = time.time() + file_handle.close() + iterTimes.append(float(elapsed-start)) + read_file_handle = open("solver_compile_stats.txt", "r") + lines = read_file_handle.readlines() + read_file_handle.close() + solver_time = parse_solver_times(lines) + #print() + #print(solver_time) + #print() + solver_times.append(solver_time) + #print() + + #print(iterTimes) + #print(solver_times) + + file_handle.close() + read_file_handle.close() + + m, lb, ub = mean_confidence_interval(iterTimes) + median = statistics.median(iterTimes) + + mm, lbb, ubb = mean_confidence_interval(solver_times) + mediann = statistics.median(solver_times) + print(file + " (total_solver_time) : " + "Median: {}, Mean: {}, lb: {}, ub: {}".format(median, m, lb, ub)) + print(file + " (only_solver_time) : " + "Median: {}, Mean: {}, lb: {}, ub: {}".format(mediann, mm, lbb, ubb)) + print() + + + + +# Compile all Marmoset binaries. +for subdir, dirs, files in os.walk(rootdir): + + for file in files: + + if ".hs" in file and file in marmosetFiles: + + file_path = subdir + file + + iterTimes = [] + + for i in range(0, iterations): + start = time.time() + gibbon_cmd_haskell = subprocess.run(["gibbon", "--packed", "--no-gc", "--opt-layout-global", "--to-exe", file_path]) + elapsed = time.time() + iterTimes.append(float(elapsed-start)) + + m, lb, ub = mean_confidence_interval(iterTimes) + median = statistics.median(iterTimes) + print(file + " (Greedy Times) : " + "Median: {}, Mean: {}, lb: {}, ub: {}".format(median, m, lb, ub)) + print() + diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/generate_runtimes.py b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/generate_runtimes.py new file mode 100644 index 000000000..92f0f3283 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/generate_runtimes.py @@ -0,0 +1,150 @@ +import subprocess +import time +import statistics +import numpy as np +import scipy +import re +import os +import sys + +iterations = 9 +inf_buffer_size = 10000000000 + +def mean_confidence_interval(data, confidence=0.95): + a = 1.0 * np.array(data) + n = len(a) + m, se = np.mean(a), scipy.stats.sem(a) + h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1) + return m, m-h, m+h + +rootdir = "/home/vidush/workdisk/git/gibbon-main/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/" + + +# Was thinking to make compile and run separate but not important right now. +#compileTrue = sys.argv[2] +#executeTrue = sys.argv[3] + +executables = [] + +gibbonFiles = ['eval_r.hs', 'layout3FilterBlogs.hs', 'TreeExpoPre.hs', 'layout1TagSearch.hs', 'layout2ListLen.hs', 'layout8TagSearch.hs', 'layout2TagSearch.hs', 'layout8FilterBlogs.hs', 'TreeExpoIn.hs', 'layout4ContentSearch.hs', 'layout3ContentSearch.hs', 'eval_l.hs', 'TreeAddOnePre.hs', 'layout7TagSearch.hs', 'layout2ContentSearch.hs', 'TreeRightMost_l.hs', 'layout2FilterBlogs.hs', 'manyFuncs.hs', 'layout1PowerList.hs', 'TreeCopyPre.hs', 'TreeAddOneIn.hs', 'layout4TagSearch.hs', 'layout1ListLen.hs', 'TreeCopyPost.hs', 'layout8ContentSearch.hs', 'TreeRightMost_r.hs', 'TreeAddOnePost.hs', 'layout1ContentSearch.hs', 'TreeCopyIn.hs', 'layout7ContentSearch.hs', 'layout3TagSearch.hs', 'layout2PowerList.hs', 'layout5ContentSearch.hs', 'layout4FilterBlogs.hs', 'layout5FilterBlogs.hs', 'layout5TagSearch.hs', 'layout7FilterBlogs.hs', 'layout1FilterBlogs.hs', 'TreeExpoPost.hs'] + +# Compile all Gibbon binaries. +for subdir, dirs, files in os.walk(rootdir): + + print("subdir: " + str(subdir)) + print("dirs: " + str(dirs)) + print("files: " + str(files)) + + + for file in files: + + if ".hs" in file and file in gibbonFiles: + + file_path = subdir + file + + file_without_haskell_extension = file_path.replace(".hs", '') + print("Compile " + file + "...") + gibbon_cmd = ["gibbon", "--no-gc", "--to-exe", "--packed", file_path] + + c = subprocess.Popen(gibbon_cmd) + c.wait() + output, error = c.communicate() + + if error is None: + print("Compiled " + file + " succesfully!") + + executables.append(file_without_haskell_extension + ".exe") + + print() + + +marmosetFiles = ['eval_r.hs', 'TreeExpoPre.hs', 'layout2ListLen.hs', 'layout8TagSearch.hs', 'layout8FilterBlogs.hs', 'TreeAddOnePre.hs', 'layout8ContentSearch.hs', 'TreeRightMost_l.hs', 'manyFuncs.hs', 'TreeCopyPre.hs', 'layout1PowerList.hs'] + + +# Compile all Marmoset binaries. +for subdir, dirs, files in os.walk(rootdir): + + print("subdir: " + str(subdir)) + print("dirs: " + str(dirs)) + print("files: " + str(files)) + + + for file in files: + + if ".hs" in file and file in marmosetFiles: + + file_path = subdir + file + + file_without_haskell_extension = file_path.replace(".hs", '') + print(file_without_haskell_extension) + + solver_binary_name = file_without_haskell_extension + "Solver" + greedy_binary_name = file_without_haskell_extension + "Greedy" + + executables.append(solver_binary_name) + executables.append(greedy_binary_name) + + print("Compile " + file + " with solver optimization..." ) + solver_cmd = ["gibbon", "--no-gc", "--to-exe", "--packed", "--opt-layout-global", "--opt-layout-use-solver", file_path, "-o", solver_binary_name] + + c = subprocess.Popen(solver_cmd) + c.wait() + output, error = c.communicate() + + if error is None: + print("Compiled " + file + " succesfully!") + + print() + + print("Compile " + file + " with greedy optimization..." ) + greedy_cmd = ["gibbon", "--no-gc", "--to-exe", "--packed", "--opt-layout-global", file_path, "-o", greedy_binary_name] + + c = subprocess.Popen(greedy_cmd) + c.wait() + output, error = c.communicate() + + if error is None: + print("Compiled " + file + " succesfully!") + + + print() + +#Run all executables +for file in executables: + + #print(file) + runtimeFile = file + ".txt" + + cmd = [file , "--inf-buffer-size", str(inf_buffer_size), "--iterate", "9"] + + writeFileHandle = open(runtimeFile, "w") + + try: + c = subprocess.Popen(cmd, stdout=writeFileHandle, stderr=subprocess.PIPE, universal_newlines=True) + c.wait() + output, error = c.communicate() + if error is not None: + cmd = [file , "--iterate", "9"] + c = subprocess.Popen(cmd, stdout=writeFileHandle, stderr=subprocess.PIPE, universal_newlines=True) + c.wait() + except: + print("Error could not run file!") + + writeFileHandle.close() + readFileHandle = open(runtimeFile, "r") + fileLines = readFileHandle.readlines() + + iterTimes = [] + mean = 0.0 + median = 0.0 + for lines in fileLines: + search = re.match("itertime: (-?\ *[0-9]+\.?[0-9]*(?:[Ee]\ *-?\ *[0-9]+)?)", lines) + #print(search) + if search is not None: + iterTimes.append(float(search.groups()[0])) + #print(iterTimes) + mean = np.mean(iterTimes) + median = np.median(iterTimes) + a, l, u = mean_confidence_interval(iterTimes) + print(str(file) + "(mean:{0}, median:{1}, lower:{2}, upper:{3})".format(str(mean), str(median), str(l), str(u))) + readFileHandle.close() diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1ContentSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1ContentSearch.hs new file mode 100644 index 000000000..838ae5fa1 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1ContentSearch.hs @@ -0,0 +1,21 @@ +import Basics +import GenerateLayout1 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout1 header id author date content tags rst -> let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout1 header id author date newContent tags newRst + +-- main function +gibbon_main = + let blogs = mkBlogs_layout1 1000000 50 10 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInContent keyword blogs) + in (blogLength newblgs) == 1000000 diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1FilterBlogs.hs new file mode 100644 index 000000000..080474831 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1FilterBlogs.hs @@ -0,0 +1,29 @@ +import Basics +import GenerateLayout1 + +type Text = Vector Char + +filterByKeywordInTagList :: Text -> Blog -> Blog +filterByKeywordInTagList keyword blogs = case blogs of + End -> End + Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags + in if present then + let newRst = filterByKeywordInTagList keyword rst + in Layout1 header id author date content tags newRst + else filterByKeywordInTagList keyword rst + +checkBlogs :: Text -> Blog -> Bool +checkBlogs keyword blogs = case blogs of + End -> True + Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags + in present && (checkBlogs keyword rst) + + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout1 1000000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (filterByKeywordInTagList keyword blogs) + in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1ListLen.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1ListLen.hs new file mode 100644 index 000000000..937928a46 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1ListLen.hs @@ -0,0 +1,37 @@ +import Basics + +type Text = Vector Char + +data List = Snoc (List) Content | E + +data Content = C Block + + +mkSnocList :: Int -> List +mkSnocList len = if len <= 0 + then E + else let + rst = mkSnocList (len - 1) + val = C (Plain (mkRandomInlineList 100)) + in Snoc rst val + +getLengthSnoc :: List -> Int +{-# ANN getLengthSnoc Snoc #-} +getLengthSnoc lst = case lst of + Snoc rst val -> 1 + getLengthSnoc rst + E -> 0 + + +gibbon_main = + let + snocList = mkSnocList 3000000 + --consList = mkConsList 100000 + l1 = iterate (getLengthSnoc snocList) + --l2 = getLengthCons consList + _ = printsym (quote "Length Snoc: ") + _ = printint l1 + _ = printsym (quote "NEWLINE") + --_ = printsym (quote "Length Cons: ") + --_ = printint l2 + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1PowerList.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1PowerList.hs new file mode 100644 index 000000000..7ed8cf7dc --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1PowerList.hs @@ -0,0 +1,36 @@ + +data PackedInt = P Int + +data List = Cons PackedInt List | Nil + +mkList :: Int -> List +mkList len = if len <=0 + then Nil + else + let val = P len + rst = mkList (len-1) + in Cons val rst + + +power :: PackedInt -> PackedInt +power val = case val of + P x -> P (pow_helper x 100) + + +pow_helper :: Int -> Int -> Int +pow_helper val power = if power == 0 + then val + else val * pow_helper (power-1) val + +powerList :: List -> List +powerList lst = case lst of + Cons x rst -> let xp = power x + rst' = powerList rst + in Cons xp rst' + Nil -> Nil + + +gibbon_main = let + lst = mkList 1000000 + lst' = iterate (powerList lst) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1TagSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1TagSearch.hs new file mode 100644 index 000000000..ae83394ce --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout1TagSearch.hs @@ -0,0 +1,29 @@ +import Basics +import GenerateLayout1 + +type Text = Vector Char + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags + in if (present) + then let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout1 header id author date newContent tags newRst + else + let newRst = emphKeywordInTag keyword rst + in Layout1 header id author date content tags newRst + + + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout1 400000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInTag keyword blogs) + in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2ContentSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2ContentSearch.hs new file mode 100644 index 000000000..9ce4d4954 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2ContentSearch.hs @@ -0,0 +1,23 @@ +import Basics +import GenerateLayout2 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout2 content tags rst header id author date -> let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout2 newContent tags newRst header id author date + + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout2 1000000 50 10 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInContent keyword blogs) + in blogLength newblgs == 1000000 diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2FilterBlogs.hs new file mode 100644 index 000000000..96c94200d --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2FilterBlogs.hs @@ -0,0 +1,29 @@ +import Basics +import GenerateLayout2 + +type Text = Vector Char + + +filterByKeywordInTagList :: Text -> Blog -> Blog +filterByKeywordInTagList keyword blogs = case blogs of + End -> End + Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags + in if present then + let newRst = filterByKeywordInTagList keyword rst + in Layout2 content tags newRst header id author date + else filterByKeywordInTagList keyword rst + + +checkBlogs :: Text -> Blog -> Bool +checkBlogs keyword blogs = case blogs of + End -> True + Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags + in present && (checkBlogs keyword rst) + +gibbon_main = + let + blogs = mkBlogs_layout2 1000000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (filterByKeywordInTagList keyword blogs) + in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2ListLen.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2ListLen.hs new file mode 100644 index 000000000..3fe3bebf6 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2ListLen.hs @@ -0,0 +1,36 @@ +import Basics + +type Text = Vector Char + +data Content = C Block + +data List = Cons2 Content (List) | E + +mkConsList :: Int -> List +mkConsList len = if len <= 0 + then E + else let + rst = mkConsList (len - 1) + val = C (Plain (mkRandomInlineList 100)) + in Cons2 val rst + +getLengthCons :: List -> Int +{-# ANN getLengthCons Cons #-} +getLengthCons lst = case lst of + Cons2 val rst -> getLengthCons rst + 1 + E -> 0 + + + +gibbon_main = + let --snocList = mkSnocList 90000 + consList = mkConsList 3000000 + --l1 = getLengthSnoc snocList + l2 = iterate (getLengthCons consList) + --_ = printsym (quote "Length Snoc: ") + --_ = printint l1 + --_ = printsym (quote "NEWLINE") + _ = printsym (quote "Length Cons: ") + _ = printint l2 + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2PowerList.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2PowerList.hs new file mode 100644 index 000000000..ca6be8072 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2PowerList.hs @@ -0,0 +1,36 @@ + +data PackedInt = P Int + +data List = Cons List PackedInt | Nil + +mkList :: Int -> List +mkList len = if len <=0 + then Nil + else + let rst = mkList (len-1) + val = (P len) + in Cons rst val + + +power :: PackedInt -> PackedInt +power val = case val of + P x -> P (power_helper x 100) + +powerList :: List -> List +powerList lst = case lst of + Cons rst x -> let rst' = powerList rst + x' = power x + in Cons rst' x' + Nil -> Nil + +power_helper :: Int -> Int -> Int +power_helper val power = if power == 0 + then val + else val * power_helper (power -1) val + + + +gibbon_main = let + lst = mkList 1000000 + lst' = iterate (powerList lst) + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2TagSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2TagSearch.hs new file mode 100644 index 000000000..a498219fe --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout2TagSearch.hs @@ -0,0 +1,27 @@ +import Basics +import GenerateLayout2 + +type Text = Vector Char + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags + in if (present) + then let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout2 newContent tags newRst header id author date + else + let newRst = emphKeywordInTag keyword rst + in Layout2 content tags newRst header id author date + + +gibbon_main = + let + blogs = mkBlogs_layout2 400000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInTag keyword blogs) + in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout3ContentSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout3ContentSearch.hs new file mode 100644 index 000000000..84d7fda50 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout3ContentSearch.hs @@ -0,0 +1,23 @@ +import Basics +import GenerateLayout3 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout3 tags rst content header id author date -> let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout3 tags newRst newContent header id author date + + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout3 1000000 50 10 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInContent keyword blogs) + in blogLength newblgs == 1000000 diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout3FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout3FilterBlogs.hs new file mode 100644 index 000000000..a826ddac1 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout3FilterBlogs.hs @@ -0,0 +1,30 @@ +import Basics +import GenerateLayout3 + +type Text = Vector Char + + +filterByKeywordInTagList :: Text -> Blog -> Blog +filterByKeywordInTagList keyword blogs = case blogs of + End -> End + Layout3 tags rst content header id author date -> let present = searchBlogTags keyword tags + in if present then + let newRst = filterByKeywordInTagList keyword rst + in Layout3 tags newRst content header id author date + else filterByKeywordInTagList keyword rst + + +checkBlogs :: Text -> Blog -> Bool +checkBlogs keyword blogs = case blogs of + End -> True + Layout3 tags rst content header id author date -> let present = searchBlogTags keyword tags + in present && (checkBlogs keyword rst) + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout3 1000000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (filterByKeywordInTagList keyword blogs) + in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout3TagSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout3TagSearch.hs new file mode 100644 index 000000000..37ff691c2 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout3TagSearch.hs @@ -0,0 +1,28 @@ +import Basics +import GenerateLayout3 + +type Text = Vector Char + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout3 tags rst content header id author date -> let present = searchBlogTags keyword tags + in if present then + let + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout3 tags newRst newContent header id author date + else + let + newRst = emphKeywordInTag keyword rst + in Layout3 tags newRst content header id author date + +gibbon_main = + let + blogs = mkBlogs_layout3 400000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInTag keyword blogs) + in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout4ContentSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout4ContentSearch.hs new file mode 100644 index 000000000..16fe59e77 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout4ContentSearch.hs @@ -0,0 +1,24 @@ +import Basics +import GenerateLayout4 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout4 tags content rst header id author date -> let + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout4 tags newContent newRst header id author date + + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout4 1000000 50 10 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInContent keyword blogs) + in blogLength newblgs == 1000000 diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout4FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout4FilterBlogs.hs new file mode 100644 index 000000000..bc0475f6f --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout4FilterBlogs.hs @@ -0,0 +1,31 @@ +import Basics +import GenerateLayout4 + +type Text = Vector Char + + +filterByKeywordInTagList :: Text -> Blog -> Blog +filterByKeywordInTagList keyword blogs = case blogs of + End -> End + Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags + in if present then + let newRst = filterByKeywordInTagList keyword rst + in Layout4 tags content newRst header id author date + else filterByKeywordInTagList keyword rst + + + +checkBlogs :: Text -> Blog -> Bool +checkBlogs keyword blogs = case blogs of + End -> True + Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags + in present && (checkBlogs keyword rst) + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout4 1000000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (filterByKeywordInTagList keyword blogs) + in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout4TagSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout4TagSearch.hs new file mode 100644 index 000000000..22ada38a8 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout4TagSearch.hs @@ -0,0 +1,22 @@ +import Basics +import GenerateLayout4 + +type Text = Vector Char + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags + newContent = emphasizeBlogContent keyword content + newRst = emphKeywordInTag keyword rst + in Layout4 tags newContent newRst header id author date + + +gibbon_main = + let + blogs = mkBlogs_layout4 400000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInTag keyword blogs) + in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout5ContentSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout5ContentSearch.hs new file mode 100644 index 000000000..1233fc156 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout5ContentSearch.hs @@ -0,0 +1,25 @@ +import Basics +import GenerateLayout5 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout5 rst tags content header id author date -> let + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout5 newRst tags newContent header id author date + + + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout5 1000000 50 10 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInContent keyword blogs) + in blogLength newblgs == 1000000 diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout5FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout5FilterBlogs.hs new file mode 100644 index 000000000..36569bea8 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout5FilterBlogs.hs @@ -0,0 +1,29 @@ +import Basics +import GenerateLayout5 + +type Text = Vector Char + + +filterByKeywordInTagList :: Text -> Blog -> Blog +filterByKeywordInTagList keyword blogs = case blogs of + End -> End + Layout5 rst tags content header id author date -> let present = searchBlogTags keyword tags + in if present then + let newRst = filterByKeywordInTagList keyword rst + in Layout5 newRst tags content header id author date + else filterByKeywordInTagList keyword rst + +checkBlogs :: Text -> Blog -> Bool +checkBlogs keyword blogs = case blogs of + End -> True + Layout5 rst tags content header id author date -> let present = searchBlogTags keyword tags + in present && (checkBlogs keyword rst) + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout5 1000000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (filterByKeywordInTagList keyword blogs) + in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout5TagSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout5TagSearch.hs new file mode 100644 index 000000000..91a1271d6 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout5TagSearch.hs @@ -0,0 +1,28 @@ +import Basics +import GenerateLayout5 + +type Text = Vector Char + + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout5 rst tags content header id author date -> let present = searchBlogTags keyword tags + in if present then + let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout5 newRst tags newContent header id author date + else + let newRst = emphKeywordInTag keyword rst + in Layout5 newRst tags content header id author date + + +gibbon_main = + let + blogs = mkBlogs_layout5 400000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInTag keyword blogs) + in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout7ContentSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout7ContentSearch.hs new file mode 100644 index 000000000..ea11bb044 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout7ContentSearch.hs @@ -0,0 +1,25 @@ +import Basics +import GenerateLayout7 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout7 rst content header id author date tags -> let + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout7 newRst newContent header id author date tags + + + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout7 1000000 50 10 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInContent keyword blogs) + in blogLength newblgs == 1000000 diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout7FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout7FilterBlogs.hs new file mode 100644 index 000000000..3cbad49a2 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout7FilterBlogs.hs @@ -0,0 +1,32 @@ +import Basics +import GenerateLayout7 + +type Text = Vector Char + + +filterByKeywordInTagList :: Text -> Blog -> Blog +filterByKeywordInTagList keyword blogs = case blogs of + End -> End + Layout7 rst content header id author date tags -> let present = searchBlogTags keyword tags + in if present then + let newRst = filterByKeywordInTagList keyword rst + in Layout7 newRst content header id author date tags + else filterByKeywordInTagList keyword rst + + +checkBlogs :: Text -> Blog -> Bool +checkBlogs keyword blogs = case blogs of + End -> True + Layout7 rst content header id author date tags -> let present = searchBlogTags keyword tags + in present && (checkBlogs keyword rst) + + + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout7 1000000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (filterByKeywordInTagList keyword blogs) + in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout7TagSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout7TagSearch.hs new file mode 100644 index 000000000..6cdba8397 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout7TagSearch.hs @@ -0,0 +1,27 @@ +import Basics +import GenerateLayout7 + +type Text = Vector Char + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout7 rst content header id author date tags -> let present = searchBlogTags keyword tags + in if present then + let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout7 newRst newContent header id author date tags + else + let newRst = emphKeywordInTag keyword rst + in Layout7 newRst content header id author date tags + + +gibbon_main = + let + blogs = mkBlogs_layout7 400000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInTag keyword blogs) + in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout8ContentSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout8ContentSearch.hs new file mode 100644 index 000000000..5fc693f57 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout8ContentSearch.hs @@ -0,0 +1,24 @@ +import Basics +import GenerateLayout8 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout8 content rst id author date header tags -> let + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout8 newContent newRst id author date header tags + + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout8 1000000 50 10 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInContent keyword blogs) + in (blogLength newblgs) == 1000000 diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout8FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout8FilterBlogs.hs new file mode 100644 index 000000000..471edca09 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout8FilterBlogs.hs @@ -0,0 +1,32 @@ +import Basics +import GenerateLayout8 + +type Text = Vector Char + + +filterByKeywordInTagList :: Text -> Blog -> Blog +filterByKeywordInTagList keyword blogs = case blogs of + End -> End + Layout8 content rst id author date header tags -> let present = searchBlogTags keyword tags + in if present then + let newRst = filterByKeywordInTagList keyword rst + in Layout8 content newRst id author date header tags + else filterByKeywordInTagList keyword rst + + +checkBlogs :: Text -> Blog -> Bool +checkBlogs keyword blogs = case blogs of + End -> True + Layout8 content rst id author date header tags -> let present = searchBlogTags keyword tags + in present && (checkBlogs keyword rst) + + + +-- main function +gibbon_main = + let + blogs = mkBlogs_layout8 1000000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (filterByKeywordInTagList keyword blogs) + in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout8TagSearch.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout8TagSearch.hs new file mode 100644 index 000000000..13317f39e --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/layout8TagSearch.hs @@ -0,0 +1,28 @@ +import Basics +import GenerateLayout8 + +type Text = Vector Char + + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout8 content rst id author date header tags -> let present = searchBlogTags keyword tags + in if present then + let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout8 newContent newRst id author date header tags + else + let newRst = emphKeywordInTag keyword rst + in Layout8 content newRst id author date header tags + + +gibbon_main = + let + blogs = mkBlogs_layout8 400000 500 5 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInTag keyword blogs) + in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/manyFuncs.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/manyFuncs.hs new file mode 100644 index 000000000..ffbb6b83a --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/manyFuncs.hs @@ -0,0 +1,49 @@ +import Basics +import GenerateLayout1 + +type Text = Vector Char + + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout1 header id author date content tags rst -> let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout1 header id author date newContent tags newRst + + + +filterByKeywordInTagList :: Text -> Blog -> Blog +filterByKeywordInTagList keyword blogs = case blogs of + End -> End + Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags + in if present then + let newRst = filterByKeywordInTagList keyword rst + in Layout4 tags content newRst header id author date + else filterByKeywordInTagList keyword rst + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags + in if (present) + then let newContent = emphasizeBlogContent' keyword content + newRst = emphKeywordInTag keyword rst + in Layout1 header id author date newContent tags newRst + else + let newRst = emphKeywordInTag keyword rst + in Layout1 header id author date content tags newRst + + +-- main function +gibbon_main = + let blogs = mkBlogs_layout1 1000000 150 10 + keyword :: Vector Char + keyword = "a" + newblgs = iterate (emphKeywordInContent keyword blogs) + newblgs' = iterate (emphKeywordInTag keyword newblgs) + newblgs'' = iterate (filterByKeywordInTagList keyword newblgs') + in () diff --git a/gibbon-compiler/examples/layout_bench/GenerateLayout1.hs b/gibbon-compiler/examples/layout_bench/GenerateLayout1.hs index 93ebe9ab3..837c2740b 100644 --- a/gibbon-compiler/examples/layout_bench/GenerateLayout1.hs +++ b/gibbon-compiler/examples/layout_bench/GenerateLayout1.hs @@ -15,7 +15,7 @@ mkBlogs_layout1 length = id = (ID (10 - (mod length 10))) author = (Author (getRandomString 5)) date = (Date (getRandomString 5)) - content = (Content (Plain (mkRandomInlineList 50))) + content = (Content (Plain (mkRandomInlineList 150))) tags = (TagList (mkSomeTags 10)) rst = (mkBlogs_layout1 (length - 1)) in Layout1 header id author date content tags rst @@ -46,3 +46,9 @@ mkBlogs_layout1 length = -- Content -> 50 -- Tags -> 50 -- Blogs -> 400,000 +-- + +-- manyFuncs +-- Content -> 150 +-- Tags -> 10 +-- Blogs -> 1000000 diff --git a/gibbon-compiler/examples/layout_bench/GenerateLayout2.hs b/gibbon-compiler/examples/layout_bench/GenerateLayout2.hs index 0fa91b6cd..41dc191bf 100644 --- a/gibbon-compiler/examples/layout_bench/GenerateLayout2.hs +++ b/gibbon-compiler/examples/layout_bench/GenerateLayout2.hs @@ -8,8 +8,8 @@ mkBlogs_layout2 length = if length <= 0 then End else let - content = (Content (Plain (mkRandomInlineList 50))) - tags = (TagList (mkSomeTags 10)) + content = (Content (Plain (mkRandomInlineList 500))) + tags = (TagList (mkSomeTags 5)) rst = (mkBlogs_layout2 (length - 1)) header = (Header (getRandomString 5)) id = (ID (10 - (mod length 10))) diff --git a/gibbon-compiler/examples/layout_bench/GenerateLayout3.hs b/gibbon-compiler/examples/layout_bench/GenerateLayout3.hs index 528197730..94b9135e5 100644 --- a/gibbon-compiler/examples/layout_bench/GenerateLayout3.hs +++ b/gibbon-compiler/examples/layout_bench/GenerateLayout3.hs @@ -8,9 +8,9 @@ mkBlogs_layout3 length = if length <= 0 then End else let - tags = (TagList (mkSomeTags 10)) + tags = (TagList (mkSomeTags 5)) rst = (mkBlogs_layout3 (length - 1)) - content = (Content (Plain (mkRandomInlineList 50))) + content = (Content (Plain (mkRandomInlineList 500))) header = (Header (getRandomString 5)) id = (ID (10 - (mod length 10))) author = (Author (getRandomString 5)) diff --git a/gibbon-compiler/examples/layout_bench/GenerateLayout4.hs b/gibbon-compiler/examples/layout_bench/GenerateLayout4.hs index 2c8a3c33c..c2fafed93 100644 --- a/gibbon-compiler/examples/layout_bench/GenerateLayout4.hs +++ b/gibbon-compiler/examples/layout_bench/GenerateLayout4.hs @@ -8,8 +8,8 @@ mkBlogs_layout4 length = if length <= 0 then End else let - tags = (TagList (mkSomeTags 10)) - content = (Content (Plain (mkRandomInlineList 50))) + tags = (TagList (mkSomeTags 5)) + content = (Content (Plain (mkRandomInlineList 500))) rst = (mkBlogs_layout4 (length - 1)) header = (Header (getRandomString 5)) id = (ID (10 - (mod length 10))) diff --git a/gibbon-compiler/examples/layout_bench/GenerateLayout5.hs b/gibbon-compiler/examples/layout_bench/GenerateLayout5.hs index b52667127..f66f8d6e9 100644 --- a/gibbon-compiler/examples/layout_bench/GenerateLayout5.hs +++ b/gibbon-compiler/examples/layout_bench/GenerateLayout5.hs @@ -10,8 +10,8 @@ mkBlogs_layout5 length = else let rst = (mkBlogs_layout5 (length - 1)) - tags = (TagList (mkSomeTags 10)) - content = (Content (Plain (mkRandomInlineList 50))) + tags = (TagList (mkSomeTags 5)) + content = (Content (Plain (mkRandomInlineList 500))) header = (Header (getRandomString 5)) id = (ID (10 - (mod length 10))) author = (Author (getRandomString 5)) diff --git a/gibbon-compiler/examples/layout_bench/GenerateLayout6.hs b/gibbon-compiler/examples/layout_bench/GenerateLayout6.hs index 05e138640..18c02dc58 100644 --- a/gibbon-compiler/examples/layout_bench/GenerateLayout6.hs +++ b/gibbon-compiler/examples/layout_bench/GenerateLayout6.hs @@ -12,7 +12,7 @@ mkBlogs_layout6 length = id = (ID (10 - (mod length 10))) author = (Author (getRandomString 5)) date = (Date (getRandomString 5)) - content = (Content (Plain (mkRandomInlineList 50))) + content = (Content (Plain (mkRandomInlineList 500))) rst = (mkBlogs_layout6 (length - 1)) - tags = (TagList (mkSomeTags 10)) + tags = (TagList (mkSomeTags 5)) in Layout6 header id author date content rst tags diff --git a/gibbon-compiler/examples/layout_bench/GenerateLayout7.hs b/gibbon-compiler/examples/layout_bench/GenerateLayout7.hs index 725487adf..7cf86b83e 100644 --- a/gibbon-compiler/examples/layout_bench/GenerateLayout7.hs +++ b/gibbon-compiler/examples/layout_bench/GenerateLayout7.hs @@ -9,10 +9,10 @@ mkBlogs_layout7 length = else let rst = (mkBlogs_layout7 (length - 1)) - content = (Content (Plain (mkRandomInlineList 50))) + content = (Content (Plain (mkRandomInlineList 500))) header = (Header (getRandomString 5)) id = (ID (10 - (mod length 10))) author = (Author (getRandomString 5)) date = (Date (getRandomString 5)) - tags = (TagList (mkSomeTags 10)) + tags = (TagList (mkSomeTags 5)) in Layout7 rst content header id author date tags diff --git a/gibbon-compiler/examples/layout_bench/GenerateLayout8.hs b/gibbon-compiler/examples/layout_bench/GenerateLayout8.hs index baf33b38c..f15f37c1e 100644 --- a/gibbon-compiler/examples/layout_bench/GenerateLayout8.hs +++ b/gibbon-compiler/examples/layout_bench/GenerateLayout8.hs @@ -9,11 +9,11 @@ mkBlogs_layout8 length = if length <= 0 then End else let - content = (Content (Plain (mkRandomInlineList 50))) + content = (Content (Plain (mkRandomInlineList 500))) rst = (mkBlogs_layout8 (length - 1)) id = (ID (10 - (mod length 10))) author = (Author (getRandomString 5)) date = (Date (getRandomString 5)) header = (Header (getRandomString 5)) - tags = (TagList (mkSomeTags 10)) + tags = (TagList (mkSomeTags 5)) in Layout8 content rst id author date header tags diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc.zip b/gibbon-compiler/examples/layout_bench/Ghc/ghc.zip new file mode 100644 index 000000000..303f85217 Binary files /dev/null and b/gibbon-compiler/examples/layout_bench/Ghc/ghc.zip differ diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/MainGhc.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/MainGhc.hs new file mode 100644 index 000000000..66082145a --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/MainGhc.hs @@ -0,0 +1,682 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE Strict #-} +module MainGhc where + +import System.TimeIt +import System.CPUTime +import qualified Data.Vector as V +import System.Random +import Data.Time.Clock (getCurrentTime, diffUTCTime) +import Control.Exception (evaluate) + +import qualified Language.Haskell.TH as TH + +--import Text.StringRandom + +import Control.DeepSeq +import Data.Int +import Data.List +import Text.Printf + +import Control.Monad +import System.IO.Unsafe + +data PList a = Nil | Cons a (PList a) deriving (Show) + +type Text = String + +-- For simplicity, we are assuming for this benchmark that data Inline is tokenized at the "word" level. +-- Therefore, The Base case where "Text" is used is going to be a single word, i.e, "Str Text". +data Inline = Str Text + | Emph (PList Inline) + -- | Underline (PList Inline) + -- | Strong (PList Inline) + -- | Strikeout (PList Inline) + -- | Superscript (PList Inline) + -- | Subscript (PList Inline) + -- | SmallCaps (PList Inline) + -- | Quoted QuoteType (PList Inline) + -- | Cite [Citation] (PList Inline) + -- | Code Attr Text + | Space + -- | SoftBreak + -- | LineBreak + -- | Math MathType Text + -- | RawInline Format Text + -- | Link Attr (PList Inline) Target + -- | Image Attr (PList Inline) Target + -- | Note (PList Block) + -- | Span Attr (PList Inline) + deriving (Show) + +data Block = Plain (PList Inline) + -- | Para (PList Inline) + -- | LineBlock (PList (PList Inline)) + -- | CodeBlock Attr Text + -- | RawBlock Format Text + -- | BlockQuote (PList Block) + -- | OrderedList ListAttributes [[Block]] + -- | BulletList (PList (PList Block)) + -- | DefinitionList PList ( PList Inline , PList (PList Block) ) ---> This is resulting in a compile time error (TODO: DEBUG) + -- | Header Int Attr (PList Inline) + -- | HorizontalRule + -- | Table Attr Caption [ColSpec] TableHead [TableBody] TableFoot + -- | Div Attr (PList Block) + | Null + deriving (Show) + +-- Define Blog elements +data BlogHeader = Header Text deriving (Show) +data BlogId = ID Int deriving (Show) +data BlogAuthor = Author Text deriving (Show) +data BlogDate = Date Text deriving (Show) +data BlogContent = Content Block deriving (Show) +data BlogTags = TagList (PList Text) deriving (Show) + +-- Define packed Blog data Type/s, we can arrange the fields here to change their relative ordering. +data Blog = End + | Layout1 (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogContent) (BlogTags) (Blog) + | Layout2 (BlogContent) (BlogTags) (Blog) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout3 (BlogTags) (Blog) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout4 (BlogTags) (BlogContent) (Blog) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout5 (Blog) (BlogTags) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout6 (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogContent) (Blog) (BlogTags) + | Layout7 (Blog) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogTags) + | Layout8 (BlogContent) (Blog) (BlogId) (BlogAuthor) (BlogDate) (BlogHeader) (BlogTags) + deriving (Show) + +getChar' :: Int -> Char +getChar' decimal = + if decimal == 0 then '!' + else if decimal == 1 then '#' + else if decimal == 2 then '$' + else if decimal == 3 then '%' + else if decimal == 4 then '&' + else if decimal == 5 then '(' + else if decimal == 6 then ')' + else if decimal == 7 then '*' + else if decimal == 8 then '+' + else if decimal == 9 then ',' + else if decimal == 10 then '-' + else if decimal == 11 then '.' + else if decimal == 12 then '/' + else if decimal == 13 then '0' + else if decimal == 14 then '1' + else if decimal == 15 then '2' + else if decimal == 16 then '3' + else if decimal == 17 then '4' + else if decimal == 18 then '5' + else if decimal == 19 then '6' + else if decimal == 20 then '7' + else if decimal == 21 then '8' + else if decimal == 22 then '9' + else if decimal == 23 then ':' + else if decimal == 24 then ';' + else if decimal == 25 then '<' + else if decimal == 26 then '=' + else if decimal == 27 then '>' + else if decimal == 28 then '?' + else if decimal == 29 then '@' + else if decimal == 30 then 'A' + else if decimal == 31 then 'B' + else if decimal == 32 then 'C' + else if decimal == 33 then 'D' + else if decimal == 34 then 'E' + else if decimal == 35 then 'F' + else if decimal == 36 then 'G' + else if decimal == 37 then 'H' + else if decimal == 38 then 'I' + else if decimal == 39 then 'J' + else if decimal == 40 then 'K' + else if decimal == 41 then 'L' + else if decimal == 42 then 'M' + else if decimal == 43 then 'N' + else if decimal == 44 then 'O' + else if decimal == 45 then 'P' + else if decimal == 46 then 'Q' + else if decimal == 47 then 'R' + else if decimal == 48 then 'S' + else if decimal == 49 then 'T' + else if decimal == 50 then 'U' + else if decimal == 51 then 'V' + else if decimal == 52 then 'W' + else if decimal == 53 then 'X' + else if decimal == 54 then 'Y' + else if decimal == 55 then 'Z' + else if decimal == 56 then '[' + else if decimal == 57 then ']' + else if decimal == 58 then '^' + else if decimal == 59 then '_' + else if decimal == 60 then '`' + else if decimal == 61 then 'a' + else if decimal == 62 then 'b' + else if decimal == 63 then 'c' + else if decimal == 64 then 'd' + else if decimal == 65 then 'e' + else if decimal == 66 then 'f' + else if decimal == 67 then 'g' + else if decimal == 68 then 'h' + else if decimal == 69 then 'i' + else if decimal == 70 then 'j' + else if decimal == 71 then 'k' + else if decimal == 72 then 'l' + else if decimal == 73 then 'm' + else if decimal == 74 then 'n' + else if decimal == 75 then 'o' + else if decimal == 76 then 'p' + else if decimal == 77 then 'q' + else if decimal == 78 then 'r' + else if decimal == 79 then 's' + else if decimal == 80 then 't' + else if decimal == 81 then 'u' + else if decimal == 82 then 'v' + else if decimal == 83 then 'w' + else if decimal == 84 then 'x' + else if decimal == 85 then 'y' + else if decimal == 86 then 'z' + else if decimal == 87 then '{' + else if decimal == 88 then '|' + else if decimal == 89 then '}' + else '~' + +mkChar :: Int -> StdGen -> Char +mkChar val r = let (val, _) = randomR (0, 91 :: Int) r + in getChar' val + +-- Get a random word, Int is the length of the string. +-- Based on internet, average english word is 5 characters long +getRandomString :: Int -> Text +getRandomString length = unsafePerformIO $ randString + +-- A standard function generating random strings. +randString :: IO String +randString = liftM (take 5 . randomRs ('a','z')) newStdGen + +-- A standard function generating random strings. +randStrinContent :: IO String +randStrinContent = liftM (take 1 . randomRs ('a','z')) newStdGen + +randInt :: IO Int +randInt = liftM (mod 4 . head . take 1 . randomRs (0, maxBound :: Int)) newStdGen + +randStringTag :: IO String +randStringTag = liftM (take 1 . randomRs ('a','z')) newStdGen + +-- .. lifted to Q +randStringQ :: TH.Q String +randStringQ = TH.runIO randString + +-- .. lifted to an Q Exp +randStringExp :: TH.Q TH.Exp +randStringExp = randStringQ >>= TH.litE . TH.stringL + +-- | Declares a constant `String` function with a given name +-- that returns a random string generated on compile time. +randStringD :: String -> TH.DecsQ +randStringD fname = liftM (: []) $ + TH.funD (TH.mkName fname) [TH.clause [] (TH.normalB randStringExp) []] + + +-- Utility Functions to make Blogs and its Elements. +mkBlogHeader :: Text -> BlogHeader +mkBlogHeader text = Header text + +mkBlogID :: Int -> BlogId +mkBlogID val = ID val + +mkBlogAuthor :: Text -> BlogAuthor +mkBlogAuthor text = Author text + +mkBlogDate :: Text -> BlogDate +mkBlogDate text = Date text + +mkBlogContent :: Block -> BlogContent +mkBlogContent block = Content block + +mkBlogTags :: (PList Text) -> BlogTags +mkBlogTags taglist = TagList taglist + + +checkBlogID :: BlogId -> Int -> Bool +checkBlogID id val = case id of + ID x -> if ( x == val ) then True + else False + +-- Function to compare two words, each represented by String. +compareWord :: Text -> Text -> Bool +compareWord word1 word2 = + let len1 = length word1 + len2 = length word2 + compare_len = if (len1 == len2) then True else False + in if (compare_len) then (cmp 0 len1 word1 word2) else False + +-- Compare 2 String (Text) or words for equality if their length is the same. +cmp :: Int -> Int -> String -> String -> Bool +cmp start end word1 word2 = + if (start < end) then + let a = word1 !! start + b = word2 !! start + eq = if (a == b) then True else False + recurse = cmp (start+1) end word1 word2 + in (eq && recurse) + else True + +-- Search a TagList (PList Text) for some keyword +searchTagList :: Text -> PList Text -> Bool +searchTagList keyword taglist = case taglist of + Nil -> False + Cons word rst -> (compareWord keyword word) || (searchTagList keyword rst) + +-- delete a keyword in a TagList +deleteTagList :: Text -> PList Text -> PList Text +deleteTagList keyword taglist = case taglist of + Nil -> Nil + Cons word rst -> if (compareWord keyword word) then (deleteTagList keyword rst) + else Cons word (deleteTagList keyword rst) + + +insertTagList :: Text -> PList Text -> PList Text +insertTagList keyword taglist = case taglist of + Nil -> (Cons keyword) Nil + Cons word rst -> insertTagList keyword rst + +-- Tell if a particular keyword exists in a Block data type or not +isKeywordPresentInBlock :: Text -> Block -> Bool +isKeywordPresentInBlock keyword contentBlock = + case contentBlock of + Plain list_inline -> (searchInlineListForKeyword keyword list_inline) + --Para list_inline -> (searchInlineListForKeyword keyword list_inline) + --BlockQuote list_block -> (searchBlockListForKeyword keyword list_block) + --HorizontalRule -> False + Null -> False + +-- Tell if a particular keyword exists in an inline data type or not. (search a Inline) +isKeywordPresentInline :: Text -> Inline -> Bool +isKeywordPresentInline keyword inline = + case inline of + Str text -> (compareWord keyword text) + Emph list_inline -> (searchInlineListForKeyword keyword list_inline) + --Underline list_inline -> (searchInlineListForKeyword keyword list_inline) + --Strong list_inline -> (searchInlineListForKeyword keyword list_inline) + --Strikeout list_inline -> (searchInlineListForKeyword keyword list_inline) + --Superscript list_inline -> (searchInlineListForKeyword keyword list_inline) + --Subscript list_inline -> (searchInlineListForKeyword keyword list_inline) + --SmallCaps list_inline -> (searchInlineListForKeyword keyword list_inline) + Space -> False + --SoftBreak -> False + --LineBreak -> False + --Note list_block -> (searchBlockListForKeyword keyword list_block) + +-- Search a block list for a particular keyword +searchBlockListForKeyword :: Text -> PList Block -> Bool +searchBlockListForKeyword keyword block_list = + case block_list of + Nil -> False + Cons block rst -> (isKeywordPresentInBlock keyword block) || (searchBlockListForKeyword keyword rst) + +-- Search an Inline list for a particular keyword +searchInlineListForKeyword :: Text -> PList Inline -> Bool +searchInlineListForKeyword keyword inline_list = + case inline_list of + Nil -> False + Cons inline rst -> (isKeywordPresentInline keyword inline) || (searchInlineListForKeyword keyword rst) + +-- Emphasize a particular keyword in a Block type +emphasizeKeywordInBlock :: Text -> Block -> Block +emphasizeKeywordInBlock keyword contentBlock = + case contentBlock of + Plain list_inline -> Plain (emphasizeInlineListForKeyword keyword list_inline) + --Para list_inline -> Para (emphasizeInlineListForKeyword keyword list_inline) + --BlockQuote list_block -> BlockQuote (emphasizeKeywordInBlockList keyword list_block) + --HorizontalRule -> HorizontalRule + Null -> Null + +-- Emphasize a particular keyword in an Inline data type +emphasizeKeywordInline :: Text -> Inline -> Inline +emphasizeKeywordInline keyword inline = + case inline of + Str text -> let isSame = compareWord keyword text + --_ = printsym (quote "NEWLINE") + --_ = printbool isSame + --_ = printsym (quote "NEWLINE") + in if (isSame) then let + newlist :: PList Inline + newlist = (Cons (inline)) Nil + in (Emph newlist) + else inline + Emph list_inline -> Emph (emphasizeInlineListForKeyword keyword list_inline) + --Underline list_inline -> Underline (emphasizeInlineListForKeyword keyword list_inline) + --Strong list_inline -> Strong (emphasizeInlineListForKeyword keyword list_inline) + --Strikeout list_inline -> Strikeout (emphasizeInlineListForKeyword keyword list_inline) + --Superscript list_inline -> Superscript (emphasizeInlineListForKeyword keyword list_inline) + --Subscript list_inline -> Subscript (emphasizeInlineListForKeyword keyword list_inline) + --SmallCaps list_inline -> SmallCaps (emphasizeInlineListForKeyword keyword list_inline) + Space -> Space + --SoftBreak -> SoftBreak + --LineBreak -> LineBreak + --Note list_block -> Note (emphasizeKeywordInBlockList keyword list_block) + +-- Emphasize a particular keyword in an Inline list +emphasizeInlineListForKeyword :: Text -> PList Inline -> PList Inline +{-# INLINE emphasizeInlineListForKeyword #-} +emphasizeInlineListForKeyword keyword inline_list = + case inline_list of + Nil -> Nil + Cons inline rst -> let + newinline = emphasizeKeywordInline keyword inline + rst' = emphasizeInlineListForKeyword keyword rst + in Cons newinline rst' + +-- Emphasize a particular keyword in a block list +emphasizeKeywordInBlockList :: Text -> PList Block -> PList Block +emphasizeKeywordInBlockList keyword block_list = + case block_list of + Nil -> Nil + Cons block rst -> let + newBlock = emphasizeKeywordInBlock keyword block + rst' = emphasizeKeywordInBlockList keyword rst + in Cons newBlock rst' + + +searchBlogTags :: Text -> BlogTags -> Bool +searchBlogTags keyword tags = case tags of + TagList list -> searchTagList keyword list + + +deleteBlogTags :: Text -> BlogTags -> BlogTags +deleteBlogTags keyword tags = case tags of + TagList list -> TagList (deleteTagList keyword list) + +insertBlogTags :: Text -> BlogTags -> BlogTags +insertBlogTags keyword tags = case tags of + TagList list -> TagList (insertTagList keyword list) + +-- emphasize blog content, if present is True +emphasizeBlogContent' :: Text -> BlogContent -> BlogContent +emphasizeBlogContent' keyword oldContent = case oldContent of + Content block -> Content (emphasizeKeywordInBlock keyword block) + + + +emphasizeBlogContent :: Text -> BlogContent -> BlogContent +emphasizeBlogContent keyword oldContent = case oldContent of + Content block -> Content (emphasizeKeywordInBlock keyword block) + +searchBlogContent :: Text -> BlogContent -> Bool +searchBlogContent keyword content = case content of + Content block -> (isKeywordPresentInBlock keyword block) + +-- printWordList :: TextList -> Int -> Int -> () +-- printWordList vec start end = if start < end then +-- let +-- element = V.unsafeIndex vec start +-- _ = printVec (\i -> printchar i) element +-- in printWordList vec (start+1) end +-- else () + + +-- Make an Inline type, option chooses what kind of Inline data type we are creating +-- This creates all the base cases for the inline type +mkInlineBaseCase :: Int -> Inline +mkInlineBaseCase option = let + in if option == 0 then (Str (getRandomString 5)) -- get a random word + else Space + +-- Make a list of Inline data Type. +mkInlineList :: Int -> Int -> (PList Inline) +mkInlineList length base = + if length <= 0 then Nil + -- If its not base case, then don't stop recursion. + else if (base == 0) then + let item = Emph (mkInlineList 100 1) + rst = (mkInlineList (length - 1) base) + in Cons item rst + -- If its base case, then stop recursion in Inline data type and only add base cases. + else let item = (mkInlineBaseCase (unsafePerformIO $ randInt)) + rst = mkInlineList (length - 1) base + in Cons item rst + +mkRandomInlineList :: Int -> (PList Inline) +mkRandomInlineList len = if len <= 0 then Nil + else let word = Str (unsafePerformIO $ randStrinContent) + rst = mkRandomInlineList (len - 1) + in Cons word rst + +mkSomeTags :: Int -> PList Text +mkSomeTags len = if len <= 0 then Nil + else let word = ['a'] --unsafePerformIO $ randStringTag + rst = mkSomeTags (len - 1) + in Cons word rst + + +-- Make a list of blocks +mkBlockList :: Int -> Int -> (PList Block) +mkBlockList length base = + if length <= 0 then Nil + else if (base == 0) then + let item = (Plain (mkInlineList 1000 1)) + rst = (mkBlockList (length - 1) base) + in Cons item rst + else let item = Null + rst = (mkBlockList (length - 1) base) + in Cons item rst + + + +-------------------------------------------------------------------------------- +-- Timing things +-------------------------------------------------------------------------------- +median :: [Double] -> Double +median ls = (sort ls) !! (length ls `div` 2) +-------------------------------------------------------------------------------- + +-- -- Timing for making the layouts +-- dotrialMkLayout :: (Int -> Int -> Int -> Blog) -> Int -> Int -> Int -> IO (Blog, Double) +-- dotrialMkLayout f length id tag_len = do +-- t1 <- getCurrentTime +-- a <- evaluate $ (f length id tag_len) +-- t2 <- getCurrentTime +-- let delt = fromRational (toRational (diffUTCTime t2 t1)) +-- putStrLn ("iter time: " ++ show delt) +-- return $! (a,delt) + +-- benchMkLayout :: (Int -> Int -> Int -> Blog) -> Int -> Int -> Int -> Int -> IO (Blog, Double, Double) +-- benchMkLayout f length id tag_len iters = do +-- putStrLn ("Timings for making the particular layout") +-- tups <- mapM (\_ -> dotrialMkLayout f length id tag_len) [1..iters] +-- let (results, times) = unzip tups +-- let selftimed = median times +-- batchtime = sum times +-- return $! (last results, selftimed, batchtime) + +-- -- Timing for filtering the blogs based on a keyword +-- dotrialFilterBlogsBasedOnKeywordInTagList :: (Text -> Blog -> Blog) -> Text -> Blog -> IO (Blog, Double) +-- dotrialFilterBlogsBasedOnKeywordInTagList f keyword blogs = do +-- t1 <- getCurrentTime +-- a <- evaluate $ (f keyword blogs) +-- t2 <- getCurrentTime +-- let delt = fromRational (toRational (diffUTCTime t2 t1)) +-- putStrLn ("iter time: " ++ show delt) +-- return $! (a,delt) + +-- benchFilterBlogsBasedOnKeywordInTagList :: (Text -> Blog -> Blog) -> Text -> Blog -> Int -> IO (Blog, Double, Double) +-- benchFilterBlogsBasedOnKeywordInTagList f keyword blog iters = do +-- putStrLn ("Timings for filering blogs based on a keyword in the tag list") +-- tups <- mapM (\_ -> dotrialFilterBlogsBasedOnKeywordInTagList f keyword blog) [1..iters] +-- let (results, times) = unzip tups +-- let selftimed = median times +-- batchtime = sum times +-- return $! (last results, selftimed, batchtime) + +time :: IO t -> IO t +time a = do + start <- getCPUTime + v <- a + end <- getCPUTime + let diff = (fromIntegral (end - start)) / (10^12) + printf "Computation time: %0.6f sec\n" (diff :: Double) + return v + + +mkBlogs_layout1 :: Int -> Int -> Int -> Blog +mkBlogs_layout1 length contlen taglen = + if length < 0 then End + else + let header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + content = (Content (Plain (mkRandomInlineList contlen))) + tags = (TagList (mkSomeTags taglen)) + rst = (mkBlogs_layout1 (length - 1) contlen taglen) + in Layout1 header id author date content tags rst + +mkBlogs_layout2 :: Int -> Int -> Int -> Blog +mkBlogs_layout2 length contlen taglen = + if length < 0 then End + else + let content = (Content (Plain (mkRandomInlineList contlen))) + tags = (TagList (mkSomeTags taglen)) + rst = (mkBlogs_layout2 (length - 1) contlen taglen) + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + in Layout2 content tags rst header id author date + +mkBlogs_layout3 :: Int -> Int -> Int -> Blog +mkBlogs_layout3 length contlen taglen = + if length < 0 then End + else + let tags = (TagList (mkSomeTags taglen)) + rst = (mkBlogs_layout3 (length - 1) contlen taglen) + content = (Content (Plain (mkRandomInlineList contlen))) + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + in Layout3 tags rst content header id author date + +mkBlogs_layout4 :: Int -> Int -> Int -> Blog +mkBlogs_layout4 length contlen taglen = + if length < 0 then End + else + let tags = (TagList (mkSomeTags taglen)) + content = (Content (Plain (mkRandomInlineList contlen))) + rst = (mkBlogs_layout4 (length - 1) contlen taglen) + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + in Layout4 tags content rst header id author date + +mkBlogs_layout5 :: Int -> Int -> Int -> Blog +mkBlogs_layout5 length contlen taglen = + if length < 0 then End + else + let rst = (mkBlogs_layout5 (length - 1) contlen taglen) + tags = (TagList (mkSomeTags taglen)) + content = (Content (Plain (mkRandomInlineList contlen))) + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + in Layout5 rst tags content header id author date + + +mkBlogs_layout6 :: Int -> Int -> Int -> Blog +mkBlogs_layout6 length contlen taglen = + if length < 0 then End + else + let header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + content = (Content (Plain (mkRandomInlineList contlen))) + rst = (mkBlogs_layout6 (length - 1) contlen taglen) + tags = (TagList (mkSomeTags taglen)) + in Layout6 header id author date content rst tags + +mkBlogs_layout7 :: Int -> Int -> Int -> Blog +mkBlogs_layout7 length contlen taglen = + if length < 0 then End + else + let rst = (mkBlogs_layout7 (length - 1) contlen taglen) + content = (Content (Plain (mkRandomInlineList contlen))) + header = (Header (getRandomString 5)) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + tags = (TagList (mkSomeTags taglen)) + in Layout7 rst content header id author date tags + + +mkBlogs_layout8 :: Int -> Int -> Int -> Blog +mkBlogs_layout8 length contlen taglen = + if length < 0 then End + else + let content = (Content (Plain (mkRandomInlineList contlen))) + rst = (mkBlogs_layout8 (length - 1) contlen taglen) + id = (ID (10 - (mod length 10))) + author = (Author (getRandomString 5)) + date = (Date (getRandomString 5)) + header = (Header (getRandomString 5)) + tags = (TagList (mkSomeTags taglen)) + in Layout8 content rst id author date header tags + + +blogLength :: Blog -> Int +blogLength blog = case blog of + End -> 0 + Layout1 _ _ _ _ _ _ rst -> 1 + blogLength rst + Layout2 _ _ rst _ _ _ _ -> 1 + blogLength rst + Layout3 _ rst _ _ _ _ _ -> 1 + blogLength rst + Layout4 _ _ rst _ _ _ _ -> 1 + blogLength rst + Layout5 rst _ _ _ _ _ _ -> 1 + blogLength rst + Layout6 _ _ _ _ _ rst _ -> 1 + blogLength rst + Layout7 rst _ _ _ _ _ _ -> 1 + blogLength rst + Layout8 _ rst _ _ _ _ _ -> 1 + blogLength rst + +benchFilterBlogsBasedOnKeywordInTagList :: (a -> b -> b) -> a -> b -> Int -> IO (b, Double, Double) +benchFilterBlogsBasedOnKeywordInTagList f keyword blog iters = do + putStrLn ("Timings for filering blogs based on a keyword in the tag list") + tups <- mapM (\_ -> dotrialFilterBlogsBasedOnKeywordInTagList f keyword blog) [1..iters] + let (results, times) = unzip tups + let selftimed = median times + batchtime = sum times + return $! (last results, selftimed, batchtime) + +-- Timing for filtering the blogs based on a keyword +dotrialFilterBlogsBasedOnKeywordInTagList :: (a -> b -> b) -> a -> b -> IO (b, Double) +dotrialFilterBlogsBasedOnKeywordInTagList f keyword blogs = do + t1 <- getCurrentTime + a <- evaluate $ (f keyword blogs) + t2 <- getCurrentTime + let delt = fromRational (toRational (diffUTCTime t2 t1)) + putStrLn ("iter time: " ++ show delt) + return $! (a,delt) + + +-- compile with +-- ghc MainGhc.hs -package V.Vector + + +-- Passes written so far +-- 1.) Search for a keyword in Content of Blogs +-- 2.) Search for a keyword in TagList of Blogs +-- 3.) Filter blogs based on a particular keyword +-- 4.) Filter blogs based on a particular keyword in the TagList +-- 5.) emphasize a particular keyword in the Content of Blogs + + +-- let blogs1 = mkBlogs_layout1 100 0 10 +-- blogs2 = mkBlogs_layout2 100 0 10 +-- blogs3 = mkBlogs_layout3 100 0 10 +-- blogs4 = mkBlogs_layout4 100 0 10 +-- keyword = getRandomString 2 +-- start <- getCPUTimeWithUnit +-- time1 = timeIt $ print (filterBlogsBasedOnKeywordInTagList keyword blogs1) +-- time2 = timeIt $ print (filterBlogsBasedOnKeywordInTagList keyword blogs2) +-- time3 = timeIt $ print (filterBlogsBasedOnKeywordInTagList keyword blogs3) +-- time4 = timeIt $ print (filterBlogsBasedOnKeywordInTagList keyword blogs4) +-- in time1 diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1ContentSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1ContentSearch.hs new file mode 100644 index 000000000..e0b1c99e0 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1ContentSearch.hs @@ -0,0 +1,27 @@ +import MainGhc + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout1 header id author date content tags rst -> let --present = searchBlogContent keyword content + --_ = printsym (quote "NEWLINE") + --_ = printbool present + --_ = printsym (quote "NEWLINE") + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + --_ = printsym (quote "NEWLINE") + --_ = printPacked newContent + --_ = printsym (quote "NEWLINE") + newRst = emphKeywordInContent keyword rst + in Layout1 header id author date newContent tags newRst + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout1 1000000 50 10 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1FindBlogs.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1FindBlogs.hs new file mode 100644 index 000000000..6b4c779b1 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1FindBlogs.hs @@ -0,0 +1,20 @@ +import MainGhc + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags + in if present then + let newRst = insertKeywordInTagList keyword rst + in Layout1 header id author date content tags newRst + else insertKeywordInTagList keyword rst + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout1 1000000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1TagSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1TagSearch.hs new file mode 100644 index 000000000..14df7bd0d --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1TagSearch.hs @@ -0,0 +1,26 @@ +import MainGhc + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags -- search the tags for the keyword + --_ = printbool present + in if (present) + then let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout1 header id author date newContent tags newRst + else + let newRst = emphKeywordInTag keyword rst + in Layout1 header id author date content tags newRst + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout1 400000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2ContentSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2ContentSearch.hs new file mode 100644 index 000000000..f74a23ade --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2ContentSearch.hs @@ -0,0 +1,26 @@ +import MainGhc + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout2 content tags rst header id author date -> --let present = searchBlogContent keyword content + -- in + -- if present then + let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout2 newContent tags newRst header id author date + -- else + -- let newRst = emphKeywordInContent keyword rst + -- in Layout2 content tags newRst header id author date + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout2 1000000 50 10 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2FindBlogs.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2FindBlogs.hs new file mode 100644 index 000000000..0a4891424 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2FindBlogs.hs @@ -0,0 +1,21 @@ +import MainGhc + + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags + in if present then + let newRst = insertKeywordInTagList keyword rst + in Layout2 content tags newRst header id author date + else insertKeywordInTagList keyword rst + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout2 1000000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2TagSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2TagSearch.hs new file mode 100644 index 000000000..edaec2878 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2TagSearch.hs @@ -0,0 +1,27 @@ +import MainGhc + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags -- search the tags for the keyword + -- _ = printbool present + in if (present) + then let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout2 newContent tags newRst header id author date + else + let newRst = emphKeywordInTag keyword rst + in Layout2 content tags newRst header id author date + + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout2 400000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3ContentSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3ContentSearch.hs new file mode 100644 index 000000000..a28508391 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3ContentSearch.hs @@ -0,0 +1,22 @@ +import MainGhc + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout3 tags rst content header id author date -> let --present = searchBlogContent keyword content + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout3 tags newRst newContent header id author date + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout3 1000000 50 10 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3FindBlogs.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3FindBlogs.hs new file mode 100644 index 000000000..c06946ad9 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3FindBlogs.hs @@ -0,0 +1,20 @@ +import MainGhc + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout3 tags rst content header id author date -> let present = searchBlogTags keyword tags + in if present then + let newRst = insertKeywordInTagList keyword rst + in Layout3 tags newRst content header id author date + else insertKeywordInTagList keyword rst + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout3 1000000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3TagSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3TagSearch.hs new file mode 100644 index 000000000..26478bcc8 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3TagSearch.hs @@ -0,0 +1,30 @@ +import MainGhc + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout3 tags rst content header id author date -> let present = searchBlogTags keyword tags -- search the tags for the keyword + --_ = printbool present + in if present then + let + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout3 tags newRst newContent header id author date + else + let + newRst = emphKeywordInTag keyword rst + in Layout3 tags newRst content header id author date + + + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout3 400000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4ContentSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4ContentSearch.hs new file mode 100644 index 000000000..47cbb58b5 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4ContentSearch.hs @@ -0,0 +1,22 @@ +import MainGhc + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout4 tags content rst header id author date -> let --present = searchBlogContent keyword content + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout4 tags newContent newRst header id author date + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout4 1000000 50 10 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4FindBlogs.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4FindBlogs.hs new file mode 100644 index 000000000..1f33e2534 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4FindBlogs.hs @@ -0,0 +1,20 @@ +import MainGhc + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags + in if present then + let newRst = insertKeywordInTagList keyword rst + in Layout4 tags content newRst header id author date + else insertKeywordInTagList keyword rst + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout4 1000000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4TagSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4TagSearch.hs new file mode 100644 index 000000000..fbf2adb22 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4TagSearch.hs @@ -0,0 +1,26 @@ +import MainGhc + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags + in if (present) then + let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout4 tags newContent newRst header id author date + else + let newRst = emphKeywordInTag keyword rst + in Layout4 tags content newRst header id author date + + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout4 400000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout5ContentSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout5ContentSearch.hs new file mode 100644 index 000000000..efc0f6f23 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout5ContentSearch.hs @@ -0,0 +1,22 @@ +import MainGhc + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout5 rst tags content header id author date -> let --present = searchBlogContent keyword content + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout5 newRst tags newContent header id author date + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout5 1000000 50 10 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout5FindBlogs.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout5FindBlogs.hs new file mode 100644 index 000000000..8581666df --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout5FindBlogs.hs @@ -0,0 +1,21 @@ +import MainGhc + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout5 rst tags content header id author date -> let present = searchBlogTags keyword tags + in if present then + let newRst = insertKeywordInTagList keyword rst + in Layout5 newRst tags content header id author date + else insertKeywordInTagList keyword rst + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout5 1000000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout5TagSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout5TagSearch.hs new file mode 100644 index 000000000..69bdd6419 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout5TagSearch.hs @@ -0,0 +1,26 @@ +import MainGhc + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout5 rst tags content header id author date -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if present then + let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout5 newRst tags newContent header id author date + else + let newRst = emphKeywordInTag keyword rst + in Layout5 newRst tags content header id author date + + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout5 400000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout6ContentSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout6ContentSearch.hs new file mode 100644 index 000000000..9fadbfbfb --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout6ContentSearch.hs @@ -0,0 +1,22 @@ +import MainGhc + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout6 header id author date content rst tags -> let --present = searchBlogContent keyword content + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout6 header id author date newContent newRst tags + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout6 1000000 50 10 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout6FindBlogs.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout6FindBlogs.hs new file mode 100644 index 000000000..207e234dd --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout6FindBlogs.hs @@ -0,0 +1,21 @@ +import MainGhc + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout6 header id author date content rst tags -> let present = searchBlogTags keyword tags + in if present then + let newRst = insertKeywordInTagList keyword rst + in Layout6 header id author date content newRst tags + else insertKeywordInTagList keyword rst + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout6 1000000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout6TagSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout6TagSearch.hs new file mode 100644 index 000000000..876bd1bbc --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout6TagSearch.hs @@ -0,0 +1,26 @@ +import MainGhc + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout6 header id author date content rst tags -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if present then + let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout6 header id author date newContent newRst tags + else + let newRst = emphKeywordInTag keyword rst + in Layout6 header id author date content newRst tags + + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout6 400000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout7ContentSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout7ContentSearch.hs new file mode 100644 index 000000000..6d64cd377 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout7ContentSearch.hs @@ -0,0 +1,23 @@ +import MainGhc + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout7 rst content header id author date tags -> let --present = searchBlogContent keyword content + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout7 newRst newContent header id author date tags + + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout7 1000000 50 10 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout7FindBlogs.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout7FindBlogs.hs new file mode 100644 index 000000000..ddc790df0 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout7FindBlogs.hs @@ -0,0 +1,21 @@ +import MainGhc + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout7 rst content header id author date tags -> let present = searchBlogTags keyword tags + in if present then + let newRst = insertKeywordInTagList keyword rst + in Layout7 newRst content header id author date tags + else insertKeywordInTagList keyword rst + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout7 1000000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout7TagSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout7TagSearch.hs new file mode 100644 index 000000000..f55f74bb4 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout7TagSearch.hs @@ -0,0 +1,27 @@ +import MainGhc + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout7 rst content header id author date tags -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if present then + let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout7 newRst newContent header id author date tags + else + let newRst = emphKeywordInTag keyword rst + in Layout7 newRst content header id author date tags + + + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout7 400000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout8ContentSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout8ContentSearch.hs new file mode 100644 index 000000000..6be27fb6a --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout8ContentSearch.hs @@ -0,0 +1,22 @@ +import MainGhc + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout8 content rst id author date header tags -> let --present = searchBlogContent keyword content + newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout8 newContent newRst id author date header tags + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout8 1000000 50 10 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout8FindBlogs.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout8FindBlogs.hs new file mode 100644 index 000000000..00c9ceb7f --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout8FindBlogs.hs @@ -0,0 +1,21 @@ +import MainGhc + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout8 content rst id author date header tags -> let present = searchBlogTags keyword tags + in if present then + let newRst = insertKeywordInTagList keyword rst + in Layout8 content newRst id author date header tags + else insertKeywordInTagList keyword rst + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout8 1000000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout8TagSearch.hs b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout8TagSearch.hs new file mode 100644 index 000000000..f7f07f74e --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/Ghc/ghc/layout8TagSearch.hs @@ -0,0 +1,26 @@ +import MainGhc + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout8 content rst id author date header tags -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if present then + let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout8 newContent newRst id author date header tags + else + let newRst = emphKeywordInTag keyword rst + in Layout8 content newRst id author date header tags + + + + +-- main function +main :: IO () +main = + do let blogs1 = mkBlogs_layout8 400000 500 5 + (newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1 + putStrLn $ "Length of new Blogs is: " + print (blogLength newblog1) + putStrLn $ "Done." diff --git a/gibbon-compiler/examples/layout_bench/get_compile_times.py b/gibbon-compiler/examples/layout_bench/get_compile_times.py new file mode 100644 index 000000000..a73a4765b --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/get_compile_times.py @@ -0,0 +1,270 @@ +import subprocess +import time +import statistics +import numpy as np +import scipy +import re + +iterations = 9 + +def mean_confidence_interval(data, confidence=0.95): + a = 1.0 * np.array(data) + n = len(a) + m, se = np.mean(a), scipy.stats.sem(a) + h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1) + return m, m-h, m+h + +rootdir = "/home/vidush/workdisk/git/gibbon-main/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/" + +Passes = ["ContentSearch", "TagSearch", "FilterBlogs"] + +layouts = ["layout1", "layout2", "layout3", "layout4", "layout5", "layout6", "layout7", "layout8"] + +#Compilation phase #gibbon +for myPass in Passes: + for layout in layouts: + + gibbon_file_name = layout + myPass + + #print() + #print("Trying compilation for file " + gibbon_file_name + ".hs") + #print() + + filename_haskell = gibbon_file_name + ".hs" + + haskell_cmd = "gibbon --packed --no-gc --toC " + filename_haskell + + #print("The haskell command was: ") + #print() + #print(haskell_cmd) + #print() + + iterTimes = [] + + for i in range(0, iterations): + start = time.time() + gibbon_cmd_haskell = subprocess.run(["gibbon", "--packed", "--no-gc", "--to-exe", filename_haskell]) + elapsed = time.time() + + iterTimes.append(float(elapsed-start)) + + #print("The exit code for the haskell command was %d" % gibbon_cmd_haskell.returncode) + #print("Time taken by " + gibbon_file_name + "was: " + str(float(elapsed-start))) + + #print(iterTimes) + #filename_c = gibbon_file_name + ".c" + + #gibbon_cmd = "gcc" + " -O3 " + "-I" + ut_hash_include + " " + filename_c + " -o " + gibbon_file_name + + #print("The gcc command was: ") + #print() + #print(gibbon_cmd) + #print() + + #gibbon_cmd_c = subprocess.run(["gcc", "-O3", "-I" + ut_hash_include , filename_c, "-o", gibbon_file_name]) + #print() + + #print("The exit code for the gcc compilation was %d" % gibbon_cmd_c.returncode) + + m, lb, ub = mean_confidence_interval(iterTimes) + median = statistics.median(iterTimes) + print(gibbon_file_name + " : " + "Median: {}, Mean: {}, lb: {}, ub: {}".format(median, m, lb, ub)) + +def parse_solver_times(array): + + solver_times = [] + for line in array: + + result = re.findall("iter time: ((\d+).(\d+))", line) + print(float(result[0][0])) + solver_times.append(float(result[0][0])) + + return sum(solver_times) + +#Compilation phase #solver +for myPass in Passes: + for layout in layouts: + + gibbon_file_name = layout + myPass + + #print() + #print("Trying compilation for file " + gibbon_file_name + ".hs") + #print() + + filename_haskell = gibbon_file_name + ".hs" + + #haskell_cmd = "gibbon --packed --no-gc --toC " + filename_haskell + + #print("The haskell command was: ") + #print() + #print(haskell_cmd) + #print() + + iterTimes = [] + solver_times = [] + + for i in range(0, iterations): + file_handle = open("stats.txt", "w") + start = time.time() + gibbon_cmd_haskell = subprocess.run(["gibbon", "--packed", "--no-gc", "--opt-layout-use-solver", "--opt-layout-global", "--to-exe", filename_haskell], stdout=file_handle, stderr=file_handle) + elapsed = time.time() + file_handle.close() + iterTimes.append(float(elapsed-start)) + read_file_handle = open("stats.txt", "r") + lines = read_file_handle.readlines() + read_file_handle.close() + solver_time = parse_solver_times(lines) + print() + print(solver_time) + print() + solver_times.append(solver_time) + print() + + print(iterTimes) + print(solver_times) + + file_handle.close() + read_file_handle.close() + + #print("The exit code for the haskell command was %d" % gibbon_cmd_haskell.returncode) + #print("Time taken by " + gibbon_file_name + "was: " + str(float(elapsed-start))) + + #print(iterTimes) + #filename_c = gibbon_file_name + ".c" + + #gibbon_cmd = "gcc" + " -O3 " + "-I" + ut_hash_include + " " + filename_c + " -o " + gibbon_file_name + + #print("The gcc command was: ") + #print() + #print(gibbon_cmd) + #print() + + #gibbon_cmd_c = subprocess.run(["gcc", "-O3", "-I" + ut_hash_include , filename_c, "-o", gibbon_file_name]) + #print() + + #print("The exit code for the gcc compilation was %d" % gibbon_cmd_c.returncode) + + m, lb, ub = mean_confidence_interval(iterTimes) + median = statistics.median(iterTimes) + + mm, lbb, ubb = mean_confidence_interval(solver_times) + mediann = statistics.median(solver_times) + print(gibbon_file_name + " (total_solver_time) : " + "Median: {}, Mean: {}, lb: {}, ub: {}".format(median, m, lb, ub)) + print(gibbon_file_name + " (only_solver_time) : " + "Median: {}, Mean: {}, lb: {}, ub: {}".format(mediann, mm, lbb, ubb)) + + +#def parse_solver_times(array): +# +# for line in array: +# +# result = re.findall("iter:\d+", line) +# print(result) + + +#Compilation phase greedy +for myPass in Passes: + for layout in layouts: + + gibbon_file_name = layout + myPass + + #print() + #print("Trying compilation for file " + gibbon_file_name + ".hs") + #print() + + filename_haskell = gibbon_file_name + ".hs" + + haskell_cmd = "gibbon --packed --no-gc --toC " + filename_haskell + + #print("The haskell command was: ") + #print() + #print(haskell_cmd) + #print() + + iterTimes = [] + + for i in range(0, iterations): + start = time.time() + gibbon_cmd_haskell = subprocess.run(["gibbon", "--packed", "--no-gc", "--opt-layout-global", "--to-exe", filename_haskell]) + elapsed = time.time() + + iterTimes.append(float(elapsed-start)) + + #print("The exit code for the haskell command was %d" % gibbon_cmd_haskell.returncode) + #print("Time taken by " + gibbon_file_name + "was: " + str(float(elapsed-start))) + + #print(iterTimes) + #filename_c = gibbon_file_name + ".c" + + #gibbon_cmd = "gcc" + " -O3 " + "-I" + ut_hash_include + " " + filename_c + " -o " + gibbon_file_name + + #print("The gcc command was: ") + #print() + #print(gibbon_cmd) + #print() + + #gibbon_cmd_c = subprocess.run(["gcc", "-O3", "-I" + ut_hash_include , filename_c, "-o", gibbon_file_name]) + #print() + + #print("The exit code for the gcc compilation was %d" % gibbon_cmd_c.returncode) + + m, lb, ub = mean_confidence_interval(iterTimes) + median = statistics.median(iterTimes) + print(gibbon_file_name + " (Greedy Times) : " + "Median: {}, Mean: {}, lb: {}, ub: {}".format(median, m, lb, ub)) + + + +'''Timings = {} + +#run the files and get the timings + +for myPass in Passes: + for layout in layouts: + + gibbon_binary = layout + myPass + + print() + print("Running the binary " + str(gibbon_binary)) + print() + + file_stats = gibbon_binary + ".txt" + + cmd = "(" + "cd " + rootdir + " && " + "(" + "./" + gibbon_binary + " --RUN " + str(iterations) + " > " + file_stats + ")" + ")" + + print(cmd) + + gibbon_binary_cmd = subprocess.call(cmd, shell=True) + + data = open(file_stats, 'r').read() + + batch_time = re.findall("BATCHTIME: (.*)", data) + median_time = re.findall("SELFTIMED: (.*)", data) + + print() + print(batch_time) + print(median_time) + + print(float(batch_time[0])) + print(float(median_time[0])) + + batchTimes = float(batch_time[0]) + medianTimes = float(median_time[0]) + + averageTimes = float (batchTimes / iterations) + + tupleTimes = (averageTimes, medianTimes) + + print(tupleTimes) + + Timings[gibbon_binary] = tupleTimes + + print() + +print(Timings) + +f = open("experiment_timings_marmoset.txt", "w") + +for key, value in Timings.items(): + f.write('%s:(average:%s, median:%s)\n' % (key, value[0], value[1])) + +f.close() +''' diff --git a/gibbon-compiler/examples/layout_bench/layout1ContentSearch.hs b/gibbon-compiler/examples/layout_bench/layout1ContentSearch.hs index a968535e6..5553dce5d 100644 --- a/gibbon-compiler/examples/layout_bench/layout1ContentSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout1ContentSearch.hs @@ -14,8 +14,8 @@ emphKeywordInContent keyword blogs = -- main function gibbon_main = - let blogs = mkBlogs_layout1 1000 + let blogs = mkBlogs_layout1 1000000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInContent keyword blogs + newblgs = iterate (emphKeywordInContent keyword blogs) in (blogLength newblgs) == 1000 diff --git a/gibbon-compiler/examples/layout_bench/layout1FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/layout1FilterBlogs.hs index 682a72521..0c762617c 100644 --- a/gibbon-compiler/examples/layout_bench/layout1FilterBlogs.hs +++ b/gibbon-compiler/examples/layout_bench/layout1FilterBlogs.hs @@ -3,6 +3,8 @@ import GenerateLayout1 type Text = Vector Char +{-# ANN Layout1 (filterByKeywordInTagList, (0 ~> 3, 1 ~> 2)) #-} +{-# ANN Layout1 (filterByKeywordInTagList, (4 :> 5, 3 :> 2)) #-} filterByKeywordInTagList :: Text -> Blog -> Blog filterByKeywordInTagList keyword blogs = case blogs of End -> End @@ -11,7 +13,7 @@ filterByKeywordInTagList keyword blogs = case blogs of let newRst = filterByKeywordInTagList keyword rst in Layout1 header id author date content tags newRst else filterByKeywordInTagList keyword rst - +{-# ANN Layout1 (checkBlogs, (4 :> 5, 3 :> 2)) #-} checkBlogs :: Text -> Blog -> Bool checkBlogs keyword blogs = case blogs of End -> True @@ -22,8 +24,8 @@ checkBlogs keyword blogs = case blogs of -- main function gibbon_main = let - blogs = mkBlogs_layout1 100 + blogs = mkBlogs_layout1 1000000 keyword :: Vector Char keyword = "a" - newblgs = filterByKeywordInTagList keyword blogs + newblgs = iterate (filterByKeywordInTagList keyword blogs) in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/layout1TagSearch.hs b/gibbon-compiler/examples/layout_bench/layout1TagSearch.hs index 080d394e1..7c3b028c7 100644 --- a/gibbon-compiler/examples/layout_bench/layout1TagSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout1TagSearch.hs @@ -22,8 +22,8 @@ emphKeywordInTag keyword blogs = case blogs of -- main function gibbon_main = let - blogs = mkBlogs_layout1 40 + blogs = mkBlogs_layout1 400000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInTag keyword blogs + newblgs = iterate (emphKeywordInTag keyword blogs) in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/layout2ContentSearch.hs b/gibbon-compiler/examples/layout_bench/layout2ContentSearch.hs index c5a75fb2c..73362dcf0 100644 --- a/gibbon-compiler/examples/layout_bench/layout2ContentSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout2ContentSearch.hs @@ -16,8 +16,8 @@ emphKeywordInContent keyword blogs = -- main function gibbon_main = let - blogs = mkBlogs_layout2 1000 + blogs = mkBlogs_layout2 1000000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInContent keyword blogs + newblgs = iterate (emphKeywordInContent keyword blogs) in blogLength newblgs == 1000 diff --git a/gibbon-compiler/examples/layout_bench/layout2FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/layout2FilterBlogs.hs index 4615c5e82..b3660397d 100644 --- a/gibbon-compiler/examples/layout_bench/layout2FilterBlogs.hs +++ b/gibbon-compiler/examples/layout_bench/layout2FilterBlogs.hs @@ -22,8 +22,8 @@ checkBlogs keyword blogs = case blogs of gibbon_main = let - blogs = mkBlogs_layout2 100 + blogs = mkBlogs_layout2 1000000 keyword :: Vector Char keyword = "a" - newblgs = filterByKeywordInTagList keyword blogs + newblgs = iterate (filterByKeywordInTagList keyword blogs) in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/layout2TagSearch.hs b/gibbon-compiler/examples/layout_bench/layout2TagSearch.hs index fe31ecbf2..bc1f3b9cd 100644 --- a/gibbon-compiler/examples/layout_bench/layout2TagSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout2TagSearch.hs @@ -20,8 +20,8 @@ emphKeywordInTag keyword blogs = case blogs of gibbon_main = let - blogs = mkBlogs_layout2 40 + blogs = mkBlogs_layout2 400000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInTag keyword blogs + newblgs = iterate (emphKeywordInTag keyword blogs) in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/layout3ContentSearch.hs b/gibbon-compiler/examples/layout_bench/layout3ContentSearch.hs index e21caf8cc..4ebca08e6 100644 --- a/gibbon-compiler/examples/layout_bench/layout3ContentSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout3ContentSearch.hs @@ -16,8 +16,8 @@ emphKeywordInContent keyword blogs = -- main function gibbon_main = let - blogs = mkBlogs_layout3 1000 + blogs = mkBlogs_layout3 1000000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInContent keyword blogs + newblgs = iterate (emphKeywordInContent keyword blogs) in blogLength newblgs == 1000 diff --git a/gibbon-compiler/examples/layout_bench/layout3FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/layout3FilterBlogs.hs index f0fef7ab5..5cca38496 100644 --- a/gibbon-compiler/examples/layout_bench/layout3FilterBlogs.hs +++ b/gibbon-compiler/examples/layout_bench/layout3FilterBlogs.hs @@ -23,8 +23,8 @@ checkBlogs keyword blogs = case blogs of -- main function gibbon_main = let - blogs = mkBlogs_layout3 100 + blogs = mkBlogs_layout3 1000000 keyword :: Vector Char keyword = "a" - newblgs = filterByKeywordInTagList keyword blogs + newblgs = iterate (filterByKeywordInTagList keyword blogs) in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/layout3TagSearch.hs b/gibbon-compiler/examples/layout_bench/layout3TagSearch.hs index 00e11b992..481cef68c 100644 --- a/gibbon-compiler/examples/layout_bench/layout3TagSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout3TagSearch.hs @@ -21,8 +21,8 @@ emphKeywordInTag keyword blogs = case blogs of gibbon_main = let - blogs = mkBlogs_layout3 40 + blogs = mkBlogs_layout3 400000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInTag keyword blogs + newblgs = iterate (emphKeywordInTag keyword blogs) in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/layout4ContentSearch.hs b/gibbon-compiler/examples/layout_bench/layout4ContentSearch.hs index c9186484d..93e7813b3 100644 --- a/gibbon-compiler/examples/layout_bench/layout4ContentSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout4ContentSearch.hs @@ -17,8 +17,8 @@ emphKeywordInContent keyword blogs = -- main function gibbon_main = let - blogs = mkBlogs_layout4 1000 + blogs = mkBlogs_layout4 1000000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInContent keyword blogs + newblgs = iterate (emphKeywordInContent keyword blogs) in blogLength newblgs == 1000 diff --git a/gibbon-compiler/examples/layout_bench/layout4FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/layout4FilterBlogs.hs index 25d2a3e05..db8b2a70a 100644 --- a/gibbon-compiler/examples/layout_bench/layout4FilterBlogs.hs +++ b/gibbon-compiler/examples/layout_bench/layout4FilterBlogs.hs @@ -24,8 +24,8 @@ checkBlogs keyword blogs = case blogs of -- main function gibbon_main = let - blogs = mkBlogs_layout4 100 + blogs = mkBlogs_layout4 1000000 keyword :: Vector Char keyword = "a" - newblgs = filterByKeywordInTagList keyword blogs + newblgs = iterate (filterByKeywordInTagList keyword blogs) in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/layout4TagSearch.hs b/gibbon-compiler/examples/layout_bench/layout4TagSearch.hs index f6f6f719d..f7efad60f 100644 --- a/gibbon-compiler/examples/layout_bench/layout4TagSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout4TagSearch.hs @@ -15,8 +15,8 @@ emphKeywordInTag keyword blogs = case blogs of gibbon_main = let - blogs = mkBlogs_layout4 40 + blogs = mkBlogs_layout4 400000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInTag keyword blogs + newblgs = iterate (emphKeywordInTag keyword blogs) in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/layout5ContentSearch.hs b/gibbon-compiler/examples/layout_bench/layout5ContentSearch.hs index efc53c840..93092429e 100644 --- a/gibbon-compiler/examples/layout_bench/layout5ContentSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout5ContentSearch.hs @@ -18,8 +18,8 @@ emphKeywordInContent keyword blogs = -- main function gibbon_main = let - blogs = mkBlogs_layout5 1000 + blogs = mkBlogs_layout5 1000000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInContent keyword blogs + newblgs = iterate (emphKeywordInContent keyword blogs) in blogLength newblgs == 1000 diff --git a/gibbon-compiler/examples/layout_bench/layout5FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/layout5FilterBlogs.hs index 93a47371c..3d9ab2350 100644 --- a/gibbon-compiler/examples/layout_bench/layout5FilterBlogs.hs +++ b/gibbon-compiler/examples/layout_bench/layout5FilterBlogs.hs @@ -22,8 +22,8 @@ checkBlogs keyword blogs = case blogs of -- main function gibbon_main = let - blogs = mkBlogs_layout5 100 + blogs = mkBlogs_layout5 1000000 keyword :: Vector Char keyword = "a" - newblgs = filterByKeywordInTagList keyword blogs + newblgs = iterate (filterByKeywordInTagList keyword blogs) in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/layout5TagSearch.hs b/gibbon-compiler/examples/layout_bench/layout5TagSearch.hs index 5993f8396..85183bb94 100644 --- a/gibbon-compiler/examples/layout_bench/layout5TagSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout5TagSearch.hs @@ -21,8 +21,8 @@ emphKeywordInTag keyword blogs = case blogs of gibbon_main = let - blogs = mkBlogs_layout5 40 + blogs = mkBlogs_layout5 400000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInTag keyword blogs + newblgs = iterate (emphKeywordInTag keyword blogs) in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/layout6ContentSearch.hs b/gibbon-compiler/examples/layout_bench/layout6ContentSearch.hs index 158a7895c..1ea33b48c 100644 --- a/gibbon-compiler/examples/layout_bench/layout6ContentSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout6ContentSearch.hs @@ -19,8 +19,8 @@ emphKeywordInContent keyword blogs = -- main function gibbon_main = let - blogs = mkBlogs_layout6 1000 + blogs = mkBlogs_layout6 1000000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInContent keyword blogs + newblgs = iterate (emphKeywordInContent keyword blogs) in blogLength newblgs == 1000 diff --git a/gibbon-compiler/examples/layout_bench/layout6FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/layout6FilterBlogs.hs index 7e8fcdfba..bb9898f44 100644 --- a/gibbon-compiler/examples/layout_bench/layout6FilterBlogs.hs +++ b/gibbon-compiler/examples/layout_bench/layout6FilterBlogs.hs @@ -23,8 +23,8 @@ checkBlogs keyword blogs = case blogs of -- main function gibbon_main = let - blogs = mkBlogs_layout6 100 + blogs = mkBlogs_layout6 1000000 keyword :: Vector Char keyword = "a" - newblgs = filterByKeywordInTagList keyword blogs + newblgs = iterate (filterByKeywordInTagList keyword blogs) in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/layout6TagSearch.hs b/gibbon-compiler/examples/layout_bench/layout6TagSearch.hs index ee7ec6eff..22dce2777 100644 --- a/gibbon-compiler/examples/layout_bench/layout6TagSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout6TagSearch.hs @@ -21,8 +21,8 @@ emphKeywordInTag keyword blogs = case blogs of gibbon_main = let - blogs = mkBlogs_layout6 40 + blogs = mkBlogs_layout6 400000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInTag keyword blogs + newblgs = iterate (emphKeywordInTag keyword blogs) in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/layout7ContentSearch.hs b/gibbon-compiler/examples/layout_bench/layout7ContentSearch.hs index 8bd8eeded..babb85850 100644 --- a/gibbon-compiler/examples/layout_bench/layout7ContentSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout7ContentSearch.hs @@ -18,8 +18,8 @@ emphKeywordInContent keyword blogs = -- main function gibbon_main = let - blogs = mkBlogs_layout7 1000 + blogs = mkBlogs_layout7 1000000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInContent keyword blogs + newblgs = iterate (emphKeywordInContent keyword blogs) in blogLength newblgs == 1000 diff --git a/gibbon-compiler/examples/layout_bench/layout7FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/layout7FilterBlogs.hs index da0d205dd..80c96a0f6 100644 --- a/gibbon-compiler/examples/layout_bench/layout7FilterBlogs.hs +++ b/gibbon-compiler/examples/layout_bench/layout7FilterBlogs.hs @@ -25,8 +25,8 @@ checkBlogs keyword blogs = case blogs of -- main function gibbon_main = let - blogs = mkBlogs_layout7 100 + blogs = mkBlogs_layout7 1000000 keyword :: Vector Char keyword = "a" - newblgs = filterByKeywordInTagList keyword blogs + newblgs = iterate (filterByKeywordInTagList keyword blogs) in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/layout7TagSearch.hs b/gibbon-compiler/examples/layout_bench/layout7TagSearch.hs index 9d6b1db6d..8aad0b5e0 100644 --- a/gibbon-compiler/examples/layout_bench/layout7TagSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout7TagSearch.hs @@ -20,8 +20,8 @@ emphKeywordInTag keyword blogs = case blogs of gibbon_main = let - blogs = mkBlogs_layout7 40 + blogs = mkBlogs_layout7 400000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInTag keyword blogs + newblgs = iterate (emphKeywordInTag keyword blogs) in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/layout8ContentSearch.hs b/gibbon-compiler/examples/layout_bench/layout8ContentSearch.hs index d84789942..79d35269d 100644 --- a/gibbon-compiler/examples/layout_bench/layout8ContentSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout8ContentSearch.hs @@ -17,8 +17,8 @@ emphKeywordInContent keyword blogs = -- main function gibbon_main = let - blogs = mkBlogs_layout8 1000 + blogs = mkBlogs_layout8 1000000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInContent keyword blogs - in (blogLength newblgs) == 1000 + newblgs = iterate (emphKeywordInContent keyword blogs) + in (blogLength newblgs) == 1000000 diff --git a/gibbon-compiler/examples/layout_bench/layout8FilterBlogs.hs b/gibbon-compiler/examples/layout_bench/layout8FilterBlogs.hs index b34d9b9da..8285992fb 100644 --- a/gibbon-compiler/examples/layout_bench/layout8FilterBlogs.hs +++ b/gibbon-compiler/examples/layout_bench/layout8FilterBlogs.hs @@ -25,8 +25,8 @@ checkBlogs keyword blogs = case blogs of -- main function gibbon_main = let - blogs = mkBlogs_layout8 100 + blogs = mkBlogs_layout8 1000000 keyword :: Vector Char keyword = "a" - newblgs = filterByKeywordInTagList keyword blogs + newblgs = iterate (filterByKeywordInTagList keyword blogs) in checkBlogs keyword newblgs diff --git a/gibbon-compiler/examples/layout_bench/layout8TagSearch.hs b/gibbon-compiler/examples/layout_bench/layout8TagSearch.hs index 6d9784034..ade9958dd 100644 --- a/gibbon-compiler/examples/layout_bench/layout8TagSearch.hs +++ b/gibbon-compiler/examples/layout_bench/layout8TagSearch.hs @@ -21,8 +21,8 @@ emphKeywordInTag keyword blogs = case blogs of gibbon_main = let - blogs = mkBlogs_layout8 40 + blogs = mkBlogs_layout8 400000 keyword :: Vector Char - keyword = "a" - newblgs = emphKeywordInTag keyword blogs + keyword = "b" + newblgs = iterate (emphKeywordInTag keyword blogs) in blogLength newblgs == blogLength blogs diff --git a/gibbon-compiler/examples/layout_bench/manyFuncs.hs b/gibbon-compiler/examples/layout_bench/manyFuncs.hs index 6e0527659..cb1e9c4eb 100644 --- a/gibbon-compiler/examples/layout_bench/manyFuncs.hs +++ b/gibbon-compiler/examples/layout_bench/manyFuncs.hs @@ -30,8 +30,7 @@ emphKeywordInTag keyword blogs = case blogs of End -> End Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags in if (present) - then let newContent = case content of - Content block -> Content (emphasizeKeywordInBlock keyword block) + then let newContent = emphasizeBlogContent' keyword content newRst = emphKeywordInTag keyword rst in Layout1 header id author date newContent tags newRst else @@ -41,10 +40,10 @@ emphKeywordInTag keyword blogs = case blogs of -- main function gibbon_main = - let blogs = mkBlogs_layout1 2 + let blogs = mkBlogs_layout1 1000000 keyword :: Vector Char keyword = "a" - newblgs = emphKeywordInContent keyword blogs - newblgs' = emphKeywordInTag keyword newblgs - newblgs'' = filterByKeywordInTagList keyword newblgs' - in printPacked newblgs'' + newblgs = iterate (emphKeywordInContent keyword blogs) + newblgs' = iterate (emphKeywordInTag keyword newblgs) + newblgs'' = iterate (filterByKeywordInTagList keyword newblgs') + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/Tree.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/Tree.hs new file mode 100644 index 000000000..416a8eb60 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/Tree.hs @@ -0,0 +1,52 @@ + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + + + +sumPackedInt :: PackedInt -> PackedInt -> PackedInt +sumPackedInt a b = case a of + P c -> case b of + P d -> P (c + d) + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +sumTree :: Tree -> Tree +sumTree tree = case tree of + Node val l r -> let + a1 = expo2 val + sl = sumTree l + sr = sumTree r + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 26 + sum = iterate (sumTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOne.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOne.hs new file mode 100644 index 000000000..2c071cd2e --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOne.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node val l r -> let + a1 = addOne val + sl = addOneTree l + sr = addOneTree r + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOneIn.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOneIn.hs new file mode 100644 index 000000000..cf22d12fa --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOneIn.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node Tree PackedInt Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + val = P depth + right = mkTree (depth-1) + in Node left val right + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node l val r -> let + sl = addOneTree l + a1 = addOne val + sr = addOneTree r + in Node sl a1 sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePost.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePost.hs new file mode 100644 index 000000000..d4427aa65 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePost.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node l r val -> let + sl = addOneTree l + sr = addOneTree r + a1 = addOne val + in Node sl sr a1 + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePostPre.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePostPre.hs new file mode 100644 index 000000000..c5e9c129c --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePostPre.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node l r val -> let + a1 = addOne val + sl = addOneTree l + sr = addOneTree r + in Node sl sr a1 + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePre.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePre.hs new file mode 100644 index 000000000..2c071cd2e --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePre.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node val l r -> let + a1 = addOne val + sl = addOneTree l + sr = addOneTree r + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePrePost.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePrePost.hs new file mode 100644 index 000000000..74c5ca1c8 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeAddOnePrePost.hs @@ -0,0 +1,36 @@ +module TreeAddOne where + + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +addOneTree :: Tree -> Tree +addOneTree tree = case tree of + Node val l r -> let + sl = addOneTree l + sr = addOneTree r + a1 = addOne val + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (addOneTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopy.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopy.hs new file mode 100644 index 000000000..9dfd554f9 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopy.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node val l r -> let + newVal = copyPackedInt val + sl = copyTree l + sr = copyTree r + in Node newVal sl sr + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyIn.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyIn.hs new file mode 100644 index 000000000..4e1e23914 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyIn.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node Tree PackedInt Tree | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + left = mkTree (depth-1) + val = P depth + right = mkTree (depth-1) + in Node left val right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node l val r -> let + sl = copyTree l + newVal = copyPackedInt val + sr = copyTree r + in Node sl newVal sr + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPost.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPost.hs new file mode 100644 index 000000000..7ed6fd2e2 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPost.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node l r val -> let + sl = copyTree l + sr = copyTree r + newVal = copyPackedInt val + in Node sl sr newVal + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPostPre.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPostPre.hs new file mode 100644 index 000000000..9dfd554f9 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPostPre.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node val l r -> let + newVal = copyPackedInt val + sl = copyTree l + sr = copyTree r + in Node newVal sl sr + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPre.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPre.hs new file mode 100644 index 000000000..9dfd554f9 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPre.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node val l r -> let + newVal = copyPackedInt val + sl = copyTree l + sr = copyTree r + in Node newVal sl sr + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPrePost.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPrePost.hs new file mode 100644 index 000000000..3ffea823a --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeCopyPrePost.hs @@ -0,0 +1,36 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Leaf + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Leaf + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +copyTree :: Tree -> Tree +copyTree tree = case tree of + Node val l r -> let + sl = copyTree l + sr = copyTree r + newVal = copyPackedInt val + in Node newVal sl sr + Leaf -> Leaf + + + +gibbon_main = let + tree = mkTree 27 + newTree = iterate (copyTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpo.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpo.hs new file mode 100644 index 000000000..0a053db23 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpo.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node val l r -> let + a1 = expo2 val + sl = expoTree l + sr = expoTree r + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 26 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoIn.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoIn.hs new file mode 100644 index 000000000..5a2830a7d --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoIn.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node Tree PackedInt Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + val = P depth + right = mkTree (depth-1) + in Node left val right + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node l val r -> let + sl = expoTree l + a1 = expo2 val + sr = expoTree r + in Node sl a1 sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPost.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPost.hs new file mode 100644 index 000000000..86bb27e2f --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPost.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node l r val -> let + sl = expoTree l + sr = expoTree r + a1 = expo2 val + in Node sl sr a1 + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPostPre.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPostPre.hs new file mode 100644 index 000000000..44ffa6cd5 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPostPre.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node val l r -> let + a1 = expo2 val + sl = expoTree l + sr = expoTree r + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPre.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPre.hs new file mode 100644 index 000000000..44ffa6cd5 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPre.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node val l r -> let + a1 = expo2 val + sl = expoTree l + sr = expoTree r + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPrePost.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPrePost.hs new file mode 100644 index 000000000..07936a1cc --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeExpoPrePost.hs @@ -0,0 +1,42 @@ +module TreeExpo where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + +expo :: Int -> Int -> Int +{-# INLINE expo #-} +expo power val = if power == 0 + then val + else val * expo (power-1) val + + +expo2 :: PackedInt -> PackedInt +expo2 val = case val of + P x -> P (expo 10 x) + +expoTree :: Tree -> Tree +expoTree tree = case tree of + Node val l r -> let + sl = expoTree l + sr = expoTree r + a1 = expo2 val + in Node a1 sl sr + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 27 + sum = iterate (expoTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreePost.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreePost.hs new file mode 100644 index 000000000..cf85508f9 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreePost.hs @@ -0,0 +1,37 @@ +data PackedInt = P Int +data Tree = Node Tree Tree PackedInt | Nil + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + val = P depth + in Node left right val + +sumPackedInt :: PackedInt -> PackedInt -> PackedInt +sumPackedInt a b = case a of + P c -> case b of + P d -> P (c + d) + +addOne :: PackedInt -> PackedInt +addOne val = case val of + P b -> P (b+1) + +sumTree :: Tree -> Tree +sumTree tree = case tree of + Node l r val -> let + sl = sumTree l + sr = sumTree r + a1 = addOne val + in Node sl sr a1 + Nil -> Nil + + + +gibbon_main = let + tree = mkTree 25 + sum = iterate (sumTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeRightMost.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeRightMost.hs new file mode 100644 index 000000000..dbcda4fd7 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeRightMost.hs @@ -0,0 +1,35 @@ +module TreeRightSum where + +data PackedInt = P Int +data Tree = Node Tree Tree | Leaf PackedInt + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then let + val = P depth + in Leaf val + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node left right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +rightMostTree :: Tree -> PackedInt +rightMostTree tree = case tree of + Node l r -> let + rightMostVal = rightMostTree r + in rightMostVal + Leaf val -> val + + + +gibbon_main = let + tree = mkTree 32 + newTree = iterate (rightMostTree tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeRightMost_l.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeRightMost_l.hs new file mode 100644 index 000000000..9489ac65b --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeRightMost_l.hs @@ -0,0 +1,42 @@ +module TreeRightSum where + +data PackedInt = P Int +data Tree = Node Tree Tree | Leaf PackedInt + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then let + val = P depth + in Leaf val + else + let + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node left right + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +rightMostTree :: Tree -> PackedInt +rightMostTree tree = case tree of + Node l r -> let + rightMostVal = rightMostTree r + in rightMostVal + Leaf val -> val + +rightMostTreeRec :: Int -> Tree -> PackedInt +rightMostTreeRec iters tree = if iters <= 0 + then rightMostTree tree + else let + val = rightMostTree tree + in rightMostTreeRec (iters-1) tree + + + +gibbon_main = let + tree = mkTree 29 + newTree = iterate (rightMostTree tree) --(rightMostTreeRec 1 tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeRightMost_r.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeRightMost_r.hs new file mode 100644 index 000000000..f6aa14a3c --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeRightMost_r.hs @@ -0,0 +1,40 @@ +module TreeRightSum where + +data PackedInt = P Int +data Tree = Node Tree Tree | Leaf PackedInt + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then let + val = P depth + in Leaf val + else + let + right = mkTree (depth-1) + left = mkTree (depth-1) + in Node right left + + +copyPackedInt :: PackedInt -> PackedInt +copyPackedInt a = case a of + P b -> P b + +rightMostTree :: Tree -> PackedInt +rightMostTree tree = case tree of + Node r l -> let + rightMostVal = rightMostTree r + in rightMostVal + Leaf val -> val + +rightMostTreeRec :: Int -> Tree -> PackedInt +rightMostTreeRec iters tree = if iters <= 0 + then rightMostTree tree + else let + val = rightMostTree tree + in rightMostTreeRec (iters-1) tree + +gibbon_main = let + tree = mkTree 29 + newTree = iterate (rightMostTree tree) --(rightMostTreeRec 1 tree) + in () --printPacked newTree diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/TreeSum.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeSum.hs new file mode 100644 index 000000000..de1e1e80f --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/TreeSum.hs @@ -0,0 +1,45 @@ +module TreeSum where + +data PackedInt = P Int +data Tree = Node PackedInt Tree Tree | Nil + + +mkTree :: Int -> Tree +mkTree depth = if depth <= 0 + then Nil + else + let + val = P depth + left = mkTree (depth-1) + right = mkTree (depth-1) + in Node val left right + + + +getInt :: PackedInt -> Int +getInt p = case p of + P val -> val + + +sumPackedInt :: PackedInt -> PackedInt -> PackedInt +sumPackedInt a b = let + aa = getInt a + bb = getInt b + in P (aa + bb) + + +sumTree :: Tree -> PackedInt +sumTree tree = case tree of + Node val l r -> let + sl = sumTree l + sr = sumTree r + sum1 = sumPackedInt sr sl + in sumPackedInt sum1 val + Nil -> P 0 + + + +gibbon_main = let + tree = mkTree 18 + sum = iterate (sumTree tree) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/eval_l.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/eval_l.hs index 6ac463d17..32e125701 100644 --- a/gibbon-compiler/examples/layout_bench/syntheticBench/eval_l.hs +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/eval_l.hs @@ -2,6 +2,6 @@ import Eval gibbon_main = let - n = 3 + n = 30 t = mkDeterministicTree n - in eval t + in iterate (eval t) diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/eval_r.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/eval_r.hs index 0196d62d7..2560bce26 100644 --- a/gibbon-compiler/examples/layout_bench/syntheticBench/eval_r.hs +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/eval_r.hs @@ -2,6 +2,6 @@ import Eval gibbon_main = let - n = 3 + n = 30 t = mkDeterministicTree n - in evalR t + in iterate (evalR t) diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/layout1ListLen.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/layout1ListLen.hs new file mode 100644 index 000000000..15203f5ac --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/layout1ListLen.hs @@ -0,0 +1,42 @@ +type Text = Vector Char + +data Content = Str Text Content + | End + +data List = Snoc (List) Content + | Nil + + +mkContent :: Int -> Content +mkContent len = if len <= 0 then End + else Str "abcdef" (mkContent (len - 1)) + + +mkSnocList :: Int -> List +mkSnocList len = if len <= 0 + then Nil + else let + rst = mkSnocList (len - 1) + val = mkContent 100 + in Snoc rst val + +getLengthSnoc :: List -> Int +{-# ANN getLengthSnoc Snoc #-} +getLengthSnoc lst = case lst of + Snoc rst val -> 1 + getLengthSnoc rst + Nil -> 0 + + +gibbon_main = + let + snocList = mkSnocList 3000000 + --consList = mkConsList 100000 + l1 = iterate (getLengthSnoc snocList) + --l2 = getLengthCons consList + _ = printsym (quote "Length Snoc: ") + _ = printint l1 + _ = printsym (quote "NEWLINE") + --_ = printsym (quote "Length Cons: ") + --_ = printint l2 + --_ = printsym (quote "NEWLINE") + in () \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/layout2ListLen.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/layout2ListLen.hs new file mode 100644 index 000000000..4eebd0aed --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/layout2ListLen.hs @@ -0,0 +1,42 @@ +type Text = Vector Char + +data Content = Str Text Content + | End + +data List = Cons Content (List) + | Nil + + +mkContent :: Int -> Content +mkContent len = if len <= 0 then End + else Str "abcdef" (mkContent (len - 1)) + + +mkConsList :: Int -> List +mkConsList len = if len <= 0 + then Nil + else let + rst = mkConsList (len - 1) + val = mkContent 100 + in Cons val rst + +getLengthCons :: List -> Int +{-# ANN getLengthCons Cons #-} +getLengthCons lst = case lst of + Cons val rst -> getLengthCons rst + 1 + Nil -> 0 + + + +gibbon_main = + let --snocList = mkSnocList 90000 + consList = mkConsList 3000000 + --l1 = getLengthSnoc snocList + l2 = iterate (getLengthCons consList) + --_ = printsym (quote "Length Snoc: ") + --_ = printint l1 + --_ = printsym (quote "NEWLINE") + _ = printsym (quote "Length Cons: ") + _ = printint l2 + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/test_list_int.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/test_list_int.hs new file mode 100644 index 000000000..7ed8cf7dc --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/test_list_int.hs @@ -0,0 +1,36 @@ + +data PackedInt = P Int + +data List = Cons PackedInt List | Nil + +mkList :: Int -> List +mkList len = if len <=0 + then Nil + else + let val = P len + rst = mkList (len-1) + in Cons val rst + + +power :: PackedInt -> PackedInt +power val = case val of + P x -> P (pow_helper x 100) + + +pow_helper :: Int -> Int -> Int +pow_helper val power = if power == 0 + then val + else val * pow_helper (power-1) val + +powerList :: List -> List +powerList lst = case lst of + Cons x rst -> let xp = power x + rst' = powerList rst + in Cons xp rst' + Nil -> Nil + + +gibbon_main = let + lst = mkList 1000000 + lst' = iterate (powerList lst) + in () diff --git a/gibbon-compiler/examples/layout_bench/syntheticBench/test_list_int2.hs b/gibbon-compiler/examples/layout_bench/syntheticBench/test_list_int2.hs new file mode 100644 index 000000000..ca6be8072 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/syntheticBench/test_list_int2.hs @@ -0,0 +1,36 @@ + +data PackedInt = P Int + +data List = Cons List PackedInt | Nil + +mkList :: Int -> List +mkList len = if len <=0 + then Nil + else + let rst = mkList (len-1) + val = (P len) + in Cons rst val + + +power :: PackedInt -> PackedInt +power val = case val of + P x -> P (power_helper x 100) + +powerList :: List -> List +powerList lst = case lst of + Cons rst x -> let rst' = powerList rst + x' = power x + in Cons rst' x' + Nil -> Nil + +power_helper :: Int -> Int -> Int +power_helper val power = if power == 0 + then val + else val * power_helper (power -1) val + + + +gibbon_main = let + lst = mkList 1000000 + lst' = iterate (powerList lst) + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/Adts.hs b/gibbon-compiler/examples/layout_benchmarks/Adts.hs new file mode 100644 index 000000000..37d23377a --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/Adts.hs @@ -0,0 +1,169 @@ +module Adts where + +import Strings +import Contents +import Tags + + +data Adt = Nil | CA (Content) (Adt) | AC (Adt) (Content) | TCA (Tags) (Content) (Adt) | ACT (Adt) (Content) (Tags) | TAC (Tags) (Adt) (Content) | ATC (Adt) (Tags) (Content) | CTA (Content) (Tags) (Adt) | CAT (Content) (Adt) (Tags) + deriving (Show) + + +-- make list for adt CA Tail recursive +mkCAListTR :: Int -> Int -> Adt -> Adt +mkCAListTR len strLen accumulator = if len <= 0 + then accumulator + else + let content = mkContentTextTR strLen + append = CA content accumulator + in mkCAListTR (len-1) strLen append + +-- make list for adt CA non-tail recursive +mkCAList :: Int -> Int -> Adt +mkCAList len strLen = if len <= 0 + then Nil + else + let content = mkContentText strLen + rst = mkCAList (len-1) strLen + in CA content rst + + +-- make list for adt AC +mkACList :: Int -> Int -> Adt +mkACList len strLen = if len <= 0 + then Nil + else + let rst = mkACList (len-1) strLen + content = mkContentText strLen + in AC rst content + +mkTCAList :: Int -> Int -> Int -> Adt +mkTCAList len tagLen strLen = if (len <= 0) + then Nil + else let + tags = mkRandomTags tagLen + content = mkContentText strLen + rst = mkTCAList (len-1) tagLen strLen + in TCA tags content rst + +mkACTList :: Int -> Int -> Int -> Adt +mkACTList len tagLen strLen = if (len <= 0) + then Nil + else let rst = mkACTList (len-1) tagLen strLen + content = mkContentText strLen + tags = mkRandomTags tagLen + in ACT rst content tags + + +mkTACList :: Int -> Int -> Int -> Adt +mkTACList len tagLen strLen = if (len <= 0) + then Nil + else let tags = mkRandomTags tagLen + rst = mkTACList (len-1) tagLen strLen + content = mkContentText strLen + in TAC tags rst content + + +mkATCList :: Int -> Int -> Int -> Adt +mkATCList len tagLen strLen = if (len <= 0) + then Nil + else let rst = mkATCList (len-1) tagLen strLen + tags = mkRandomTags tagLen + content = mkContentText strLen + in ATC rst tags content + +mkCTAList :: Int -> Int -> Int -> Adt +mkCTAList len tagLen strLen = if (len <= 0) + then Nil + else let content = mkContentText strLen + tags = mkRandomTags tagLen + rst = mkCTAList (len-1) tagLen strLen + in CTA content tags rst + +mkCATList :: Int -> Int -> Int -> Adt +mkCATList len tagLen strLen = if (len <= 0) + then Nil + else let content = mkContentText strLen + rst = mkCATList (len-1) tagLen strLen + tags = mkRandomTags tagLen + in CAT content rst tags + +printAdt :: Adt -> () +printAdt adt = + case adt of + Nil -> + let _ = printsym (quote "Nil") + _ = printsym (quote "SPACE") + in () + CA a rst -> + let _ = printsym (quote "(CA ") + _ = printContent a + _ = printsym (quote "SPACE") + _ = printAdt rst + _ = printsym (quote ")") + _ = printsym (quote "SPACE") + in () + AC rst a -> + let _ = printsym (quote "(AC ") + _ = printAdt rst + _ = printContent a + _ = printsym (quote "SPACE") + _ = printsym (quote ")") + _ = printsym (quote "SPACE") + in () + TCA tags content rst -> + let _ = printsym (quote "(TCA ") + _ = printTags tags + _ = printContent content + _ = printAdt rst + _ = printsym (quote "SPACE") + _ = printsym (quote ")") + _ = printsym (quote "SPACE") + in () + ACT rst content tags -> + let _ = printsym (quote "(ACT ") + _ = printAdt rst + _ = printContent content + _ = printTags tags + _ = printsym (quote "SPACE") + _ = printsym (quote ")") + _ = printsym (quote "SPACE") + in () + TAC tags rst content -> + let _ = printsym (quote "(TAC ") + _ = printTags tags + _ = printAdt rst + _ = printContent content + _ = printsym (quote "SPACE") + _ = printsym (quote ")") + _ = printsym (quote "SPACE") + in () + ATC rst tags content -> + let _ = printsym (quote "(ATC ") + _ = printAdt rst + _ = printTags tags + _ = printContent content + _ = printsym (quote "SPACE") + _ = printsym (quote ")") + _ = printsym (quote "SPACE") + in () + CTA content tags rst -> + let _ = printsym (quote "(CTA ") + _ = printContent content + _ = printTags tags + _ = printAdt rst + _ = printsym (quote "SPACE") + _ = printsym (quote ")") + _ = printsym (quote "SPACE") + in () + CAT content rst tags -> + let _ = printsym (quote "(CAT ") + _ = printContent content + _ = printAdt rst + _ = printTags tags + _ = printsym (quote "SPACE") + _ = printsym (quote ")") + _ = printsym (quote "SPACE") + in () + + diff --git a/gibbon-compiler/examples/layout_benchmarks/Contents.hs b/gibbon-compiler/examples/layout_benchmarks/Contents.hs new file mode 100644 index 000000000..38cd4226f --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/Contents.hs @@ -0,0 +1,45 @@ +module Contents where + +import Strings + +-- A datatype for Content +-- Content can be either an Image represented by String or Text represented by String, for now atleast + +data Content = Image String | Text String + + +-- make Image tail rec +mkContentImageTR :: Int -> Content +mkContentImageTR n = Image (mkStringTR n End) + + +-- make Text tail rc +mkContentTextTR :: Int -> Content +mkContentTextTR n = Text (mkStringTR n End) + +-- make Image +mkContentImage :: Int -> Content +mkContentImage n = Image (mkString n) + + +-- make Text +mkContentText :: Int -> Content +mkContentText n = Text (mkString n) + +-- process content, not dependent on the data layout so okay to make this common. +processContent :: Content -> Content +processContent content = case content of + Image x -> Image (processString x) + Text y -> Text (processString y) + +printContent :: Content -> () +printContent content = + case content of + Text n -> + let _ = printsym (quote "Text ") + _ = printString n + in () + Image n -> + let _ = printsym (quote "Image ") + _ = printString n + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/README.md b/gibbon-compiler/examples/layout_benchmarks/README.md new file mode 100644 index 000000000..88fcf7ff9 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/README.md @@ -0,0 +1,203 @@ +## Layout optimization benchmarks (Focusing on Relative ordering of Fields right now.) +* Long term goal is to show how layout affects performance, add factoring into picture + add string support + (after factoring support -> vectorization support) +* Tie everything to microservices, (social media apps for instance) + Render Tree benchmarks (Real world applications) + +This is a collection of some benchmarks that show how layout affects performance. +In particular this set of benchmarks shows how the position of different fields in the data layout could potentially affect performance. +The file Adts.hs contains the definitions of all the abstract data types and some other accompanying functions. +The file Strings.hs contains the definition of the data type String which is a Cons Int list. +The file Tags.hs contains the definition of the data type Tags which is also a Cons Int list. +the file Contents.hs contains the definition of the data type Content which can be an Image string or Text string. + +3 different scenarios: + +1.) Counting the length of two different Adts (Abstract data types) + CA (Content) (Adts) -> Content is serialized first before we serialize the next Adt. + AC (Adts) (Content) -> The next Adt is serialized first before we serialize any of the Content. + + Here the function simply counts the length of the Adt given these 2 different data layouts. + + Performance discussion... + + Here the CA data layout results in slower performance that the AC layout. + This is because the CA layout inserts pointers to the next Adt so that it can skip over the Content (Since there is no processing done with the content) to count the length of the Adt. + This causes the program to chases pointers to get to the end of the list. + On the other hand, the AC list does not have these pointers and simply traverses the Next directly since they are contiguous in memory. It does not have to chase pointers and the program exits when it sees Nil without having to deal with the content which is serialized after Nil Cell in the Adt. + + Tested on Adt with number of cells = 1000000 + size of the content = 100 elements + + AC + Time for Adt: AC + L2 Cache Misses : 305988 + L3 Cache Misses : 33032 + Instructions : 54003275 + Total Cycles : 18108744 + CPI: 0.335327 + TIMES: [0.000514, 0.000514, 0.000514, 0.000514, 0.000514, 0.000514, 0.000520, 0.000529, 0.000531] + ITERS: 9 + SIZE: 0 + BATCHTIME: 4.665207e-03 + SELFTIMED: 5.142910e-04 + Count of Adt AC is: 1000000 + '#() + + CA + Time for Adt: CA + L2 Cache Misses : 58844120 + L3 Cache Misses : 58279137 + Instructions : 54002788 + Total Cycles : 1302125996 + CPI: 24.112199 + TIMES: [0.035460, 0.035528, 0.035551, 0.035585, 0.035706, 0.036255, 0.036775, 0.037116, 0.037521] + ITERS: 9 + SIZE: 0 + BATCHTIME: 3.254971e-01 + SELFTIMED: 3.570562e-02 + Count of Adt CA is: 1000000 + '#() + + Speedup ~ 70x + + Why are the Instructions still approx. the same when measured via PAPI? + + AC C code: + ... + CursorTy tmpcur_5265 = adt_31_923_1539 + 1; + ... + IntTy fltAppE_1525_1543 = 1 + accumulator_32_924_1540; + IntTy tailapp_3360 = getLengthTR(end_r_2554, tmpcur_5265, fltAppE_1525_1543); + ... + + CA C code: + ... + CursorTy tmpcur_5890 = adt_31_923_1539 + 1; + ... + CursorTy tmpcur_5891 = *(CursorTy *) tmpcur_5890; + IntTy fltAppE_1525_1543 = 1 + accumulator_32_924_1540; + IntTy tailapp_3835 = getLengthTR(end_r_2860, tmpcur_5891, fltAppE_1525_1543); + ... + + Looking at the C code it would seem like the CA layout should have more instructions due to the extra pointer de-reference. + Assembly Code: + + AC .S code: + The increment of the address is computed via + addq $1, %rsi + + + CA .S code: + The increment of the address is computed via + movq 1(%rsi), %rsi + + Since the CISC instruction set has an instruction for loading the pointer with an offset via movq. The total number of instructions remain the same. + + + +2.) Processing the content. Comparing the performance of CA vs AC + + t1 -> traverse Content first, next Adt second + t2 -> traverse next Adt first, Content second + AC -> Next adt fist, Content second + CA -> Content first, Next Adt second + + k/j | AC | CA | + t1 | 1.218167e+00 | 2.664190e-01 | + t2 | 2.654056e-01 | 1.250884e+00 | + +3.) Processing tags when the Abstract data type has 3 fields, Tags, Content and Next Adt. + + Here we test all the 12 permutations of the layout but and traversal order. + + Below are numbers for all j X k variations of the source code and data layout. + Here j = total number of ways you can traverse the Adt, i.e, the specific order of fields you traverse. (Since the number of fields are 2 its tags first, next adt second or next adt first, tags second) + k = total number of different layout = factorial(number of fields) = 3! = 6 + total variations = j X k = 2 X 6 = 12 variations. + + notation: + t1 -> traverse tags first, next adt second + t2 -> traverse next adt first, tags second + d1 -> CAT -> Content first, Next Adt second, Tags third + d2 -> CTA -> Content first, Tags second, Next Adt third + d3 -> TAC -> Tags first, Next Adt second, Content third + d4 -> TCA -> Tags first, Content second, Next Adt third + d5 -> ATC -> Next Adt first, Tags second, Content third + d6 -> ACT -> Next Adt first, Content second, Tags third + + Performance testing using PAPI, we measure the L2, L3 cache misses, number of Instructions and Cycles and the overall runtime. + Each cell in the Adt has 10 tags and Content of size 2000 characters. (in the form of Text string) + The test makes an Adt of size 100,000 cells. + + runtime table(seconds): + + k/j | d1 | d2 | d3 | d4 | d5 | d6 | + t1 | 4.592e-02 | 1.391e-02 | 7.282e-03 | 4.847e-02 | 4.362e-02 | 4.441e-02 | + t2 | 1.366e-02 | 5.003e-02 | 3.918e-02 | 5.026e-02 | 1.416e-02 | 4.565e-02 | + + L2 cache misses: + + k/j | d1 | d2 | d3 | d4 | d5 | d6 | + t1 | 2217093 | 2710350 | 1703596 | 3952795 | 2630472 | 2644843 | + t2 | 2496671 | 4381302 | 3370914 | 4531823 | 2704948 | 3782824 | + + L3 cache misses: + + k/j | d1 | d2 | d3 | d4 | d5 | d6 | + t1 | 1579791 | 2183898 | 1070878 | 3316226 | 2128599 | 2114494 | + t2 | 2028287 | 3906609 | 2710199 | 4050117 | 2204083 | 3201695 | + + Instructions: + + k/j | d1 | d2 | d3 | d4 | d5 | d6 | + t1 | 79688618 | 35908373 | 35909002 | 79984811 | 79688551 | 79688550 | + t2 | 35709106 | 78885177 | 79185414 | 79185175 | 35709240 | 79788900 | + + CPI: + + k/j | d1 | d2 | d3 | d4 | d5 | d6 | + t1 | 1.016672 | 1.251593 | 0.550825 | 1.205783 | 0.925680 | 0.952330 | + t2 | 1.258220 | 1.278253 | 0.725601 | 1.302915 | 1.318570 | 1.008022 | + + + Speedup table(Baseline CAT layout, traversal t1): + + k/j | d1 | d2 | d3 | d4 | d5 | d6 | + t1 | 1 | 3.30 | 6.305 | 0.947 | 1.05 | 1.03 | + t2 | 3.36 | 0.917 | 1.17 | 0.913 | 3.24 | 1.01 | + + CopyPacked's used: + + k/j | d1 | d2 | d3 | d4 | d5 | d6 | + t1 | 1 | 0 | 0 | 2 | 1 | 2 | + t2 | 0 | 1 | 1 | 2 | 0 | 2 | + + + + ### MACHINE SPECIFICATIONS (Tested on a machine where PAPI support was available, newer machines not supported by PAPI yet.): + ``` + Architecture: x86_64 + CPU op-mode(s): 32-bit, 64-bit + Byte Order: Little Endian + Address sizes: 39 bits physical, 48 bits virtual + CPU(s): 12 + On-line CPU(s) list: 0-11 + Thread(s) per core: 2 + Core(s) per socket: 6 + Socket(s): 1 + NUMA node(s): 1 + Vendor ID: GenuineIntel + CPU family: 6 + Model: 158 + Model name: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz + Stepping: 10 + CPU MHz: 2200.000 + CPU max MHz: 4100.0000 + CPU min MHz: 800.0000 + BogoMIPS: 4399.99 + Virtualization: VT-x + L1d cache: 192 KiB + L1i cache: 192 KiB + L2 cache: 1.5 MiB + L3 cache: 9 MiB + NUMA node0 CPU(s): 0-11 + ``` diff --git a/gibbon-compiler/examples/layout_benchmarks/Strings.hs b/gibbon-compiler/examples/layout_benchmarks/Strings.hs new file mode 100644 index 000000000..bdd7b934e --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/Strings.hs @@ -0,0 +1,444 @@ +module Strings where + +-- Data type for Strings + +data String = End | Char Int (String) + + +-- Make a string list which is a Cons Int list +-- Populate the string with random integers between 0 and 127. +-- arguments -> Length of desired list +-- reutns -> Cons Int List +mkStringTR :: Int -> String -> String +mkStringTR len accum = if len <= 0 + then accum + else + let randomChar = mod rand 128 + append = Char randomChar accum + in mkStringTR (len - 1) accum + + +mkString :: Int -> String +mkString len = if len <= 0 + then End + else + let randomChar = mod rand 128 + rst = mkString (len - 1) + in Char randomChar rst + + +-- Do some random calculations with string, not dependent on the data layout for now so okay to make common. +processString :: String -> String +processString string = case string of + End -> End + Char val rst -> let addVal = val + 10 + mulVal = addVal * 10 + divVal = mulVal / 2 + modVal = mod divVal 128 + in Char modVal (processString rst) + +-------------------------------- Print utility ------------------------------------- + +printAscii :: Int -> () +printAscii decimal = + if decimal == 0 then + let _ = printsym (quote "NUL") + in () + else if decimal == 1 then + let _ = printsym (quote "SOH") + in () + else if decimal == 2 then + let _ = printsym (quote "STX") + in () + else if decimal == 3 then + let _ = printsym (quote "ETX") + in () + else if decimal == 4 then + let _ = printsym (quote "EOT") + in () + else if decimal == 5 then + let _ = printsym (quote "ENQ") + in () + else if decimal == 6 then + let _ = printsym (quote "ACK") + in () + else if decimal == 7 then + let _ = printsym (quote "BEL") + in () + else if decimal == 8 then + let _ = printsym (quote "BS") + in () + else if decimal == 9 then + let _ = printsym (quote "TAB") + in () + else if decimal == 10 then + let _ = printsym (quote "LF") + in () + else if decimal == 11 then + let _ = printsym (quote "VT") + in () + else if decimal == 12 then + let _ = printsym (quote "FF") + in () + else if decimal == 13 then + let _ = printsym (quote "CR") + in () + else if decimal == 14 then + let _ = printsym (quote "SO") + in () + else if decimal == 15 then + let _ = printsym (quote "SI") + in () + else if decimal == 16 then + let _ = printsym (quote "DLE") + in () + else if decimal == 17 then + let _ = printsym (quote "DCI") + in () + else if decimal == 18 then + let _ = printsym (quote "DC2") + in () + else if decimal == 19 then + let _ = printsym (quote "DC3") + in () + else if decimal == 20 then + let _ = printsym (quote "DC4") + in () + else if decimal == 21 then + let _ = printsym (quote "NAK") + in () + else if decimal == 22 then + let _ = printsym (quote "SYN") + in () + else if decimal == 23 then + let _ = printsym (quote "ETB") + in () + else if decimal == 24 then + let _ = printsym (quote "CAN") + in () + else if decimal == 25 then + let _ = printsym (quote "EM") + in () + else if decimal == 26 then + let _ = printsym (quote "SUB") + in () + else if decimal == 27 then + let _ = printsym (quote "ESC") + in () + else if decimal == 28 then + let _ = printsym (quote "FS") + in () + else if decimal == 29 then + let _ = printsym (quote "GS") + in () + else if decimal == 30 then + let _ = printsym (quote "RS") + in () + else if decimal == 31 then + let _ = printsym (quote "US") + in () + else if decimal == 32 then + let _ = printsym (quote "SPACE") + in () + else if decimal == 33 then + let _ = printsym (quote "!") + in () + else if decimal == 34 then + let _ = printsym (quote "\"") + in () + else if decimal == 35 then + let _ = printsym (quote "#") + in () + else if decimal == 36 then + let _ = printsym (quote "$") + in () + else if decimal == 37 then + let _ = printsym (quote "%") + in () + else if decimal == 38 then + let _ = printsym (quote "&") + in () + else if decimal == 39 then + let _ = printsym (quote "'") + in () + else if decimal == 40 then + let _ = printsym (quote "(") + in () + else if decimal == 41 then + let _ = printsym (quote ")") + in () + else if decimal == 42 then + let _ = printsym (quote "*") + in () + else if decimal == 43 then + let _ = printsym (quote "+") + in () + else if decimal == 44 then + let _ = printsym (quote ",") + in () + else if decimal == 45 then + let _ = printsym (quote "-") + in () + else if decimal == 46 then + let _ = printsym (quote ".") + in () + else if decimal == 47 then + let _ = printsym (quote "/") + in () + else if decimal == 48 then + let _ = printsym (quote "0") + in () + else if decimal == 49 then + let _ = printsym (quote "1") + in () + else if decimal == 50 then + let _ = printsym (quote "2") + in () + else if decimal == 51 then + let _ = printsym (quote "3") + in () + else if decimal == 52 then + let _ = printsym (quote "4") + in () + else if decimal == 53 then + let _ = printsym (quote "5") + in () + else if decimal == 54 then + let _ = printsym (quote "6") + in () + else if decimal == 55 then + let _ = printsym (quote "7") + in () + else if decimal == 56 then + let _ = printsym (quote "8") + in () + else if decimal == 57 then + let _ = printsym (quote "9") + in () + else if decimal == 58 then + let _ = printsym (quote ":") + in () + else if decimal == 59 then + let _ = printsym (quote ";") + in () + else if decimal == 60 then + let _ = printsym (quote "<") + in () + else if decimal == 61 then + let _ = printsym (quote "=") + in () + else if decimal == 62 then + let _ = printsym (quote ">") + in () + else if decimal == 63 then + let _ = printsym (quote "?") + in () + else if decimal == 64 then + let _ = printsym (quote "@") + in () + else if decimal == 65 then + let _ = printsym (quote "A") + in () + else if decimal == 66 then + let _ = printsym (quote "B") + in () + else if decimal == 67 then + let _ = printsym (quote "C") + in () + else if decimal == 68 then + let _ = printsym (quote "D") + in () + else if decimal == 69 then + let _ = printsym (quote "E") + in () + else if decimal == 70 then + let _ = printsym (quote "F") + in () + else if decimal == 71 then + let _ = printsym (quote "G") + in () + else if decimal == 72 then + let _ = printsym (quote "H") + in () + else if decimal == 73 then + let _ = printsym (quote "I") + in () + else if decimal == 74 then + let _ = printsym (quote "J") + in () + else if decimal == 75 then + let _ = printsym (quote "K") + in () + else if decimal == 76 then + let _ = printsym (quote "L") + in () + else if decimal == 77 then + let _ = printsym (quote "M") + in () + else if decimal == 78 then + let _ = printsym (quote "N") + in () + else if decimal == 79 then + let _ = printsym (quote "O") + in () + else if decimal == 80 then + let _ = printsym (quote "P") + in () + else if decimal == 81 then + let _ = printsym (quote "Q") + in () + else if decimal == 82 then + let _ = printsym (quote "R") + in () + else if decimal == 83 then + let _ = printsym (quote "S") + in () + else if decimal == 84 then + let _ = printsym (quote "T") + in () + else if decimal == 85 then + let _ = printsym (quote "U") + in () + else if decimal == 86 then + let _ = printsym (quote "V") + in () + else if decimal == 87 then + let _ = printsym (quote "W") + in () + else if decimal == 88 then + let _ = printsym (quote "X") + in () + else if decimal == 89 then + let _ = printsym (quote "Y") + in () + else if decimal == 90 then + let _ = printsym (quote "Z") + in () + else if decimal == 91 then + let _ = printsym (quote "[") + in () + else if decimal == 92 then + let _ = printsym (quote "\\") + in () + else if decimal == 93 then + let _ = printsym (quote "]") + in () + else if decimal == 94 then + let _ = printsym (quote "^") + in () + else if decimal == 95 then + let _ = printsym (quote "_") + in () + else if decimal == 96 then + let _ = printsym (quote "`") + in () + else if decimal == 97 then + let _ = printsym (quote "a") + in () + else if decimal == 98 then + let _ = printsym (quote "b") + in () + else if decimal == 99 then + let _ = printsym (quote "c") + in () + else if decimal == 100 then + let _ = printsym (quote "d") + in () + else if decimal == 101 then + let _ = printsym (quote "e") + in () + else if decimal == 102 then + let _ = printsym (quote "f") + in () + else if decimal == 103 then + let _ = printsym (quote "g") + in () + else if decimal == 104 then + let _ = printsym (quote "h") + in () + else if decimal == 105 then + let _ = printsym (quote "i") + in () + else if decimal == 106 then + let _ = printsym (quote "j") + in () + else if decimal == 107 then + let _ = printsym (quote "k") + in () + else if decimal == 108 then + let _ = printsym (quote "l") + in () + else if decimal == 109 then + let _ = printsym (quote "m") + in () + else if decimal == 110 then + let _ = printsym (quote "n") + in () + else if decimal == 111 then + let _ = printsym (quote "o") + in () + else if decimal == 112 then + let _ = printsym (quote "p") + in () + else if decimal == 113 then + let _ = printsym (quote "q") + in () + else if decimal == 114 then + let _ = printsym (quote "r") + in () + else if decimal == 115 then + let _ = printsym (quote "s") + in () + else if decimal == 116 then + let _ = printsym (quote "t") + in () + else if decimal == 117 then + let _ = printsym (quote "u") + in () + else if decimal == 118 then + let _ = printsym (quote "v") + in () + else if decimal == 119 then + let _ = printsym (quote "w") + in () + else if decimal == 120 then + let _ = printsym (quote "x") + in () + else if decimal == 121 then + let _ = printsym (quote "y") + in () + else if decimal == 122 then + let _ = printsym (quote "z") + in () + else if decimal == 123 then + let _ = printsym (quote "{") + in () + else if decimal == 124 then + let _ = printsym (quote "|") + in () + else if decimal == 125 then + let _ = printsym (quote "}") + in () + else if decimal == 126 then + let _ = printsym (quote "~") + in () + else + let _ = printsym (quote "DEL") + in () + + +printString :: String -> () +printString string = + case string of + End -> + let _ = printsym (quote "End") + in () + Char val rst -> + let _ = printsym (quote "(Char ") + _ = printAscii val + _ = printsym (quote "SPACE") + _ = printString rst + _ = printsym (quote ") ") + in () + +----------------------------------------------------------------------------------------------------- diff --git a/gibbon-compiler/examples/layout_benchmarks/Tags.hs b/gibbon-compiler/examples/layout_benchmarks/Tags.hs new file mode 100644 index 000000000..1e3491d20 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/Tags.hs @@ -0,0 +1,53 @@ +module Tags where + +data Tags = Nul | Tag Int (Tags) + +searchTag :: Tags -> Tags -> Bool +searchTag tag tagList = case tag of + Nul -> case tagList of + Nul -> True + Tag val rst -> False + Tag val rst -> case tagList of + Nul -> False + Tag val' rst' -> if (val == val') then True else (False || searchTag tag rst') + + +addValTag :: Tags -> Int -> Tags +addValTag tags inVal = case tags of + Nul -> Nul + Tag val rst -> Tag (val+inVal) (addValTag rst inVal) + +countTags :: Tags -> Int +countTags tags = case tags of + Nul -> 0 + Tag val rst -> 1 + countTags rst + + +sumTags :: Tags -> Int +sumTags tags = case tags of + Nul -> 0 + Tag val rst -> val + sumTags rst + +mkRandomTags :: Int -> Tags +mkRandomTags len = if (len <= 0) + then Nul + else let + val = 100 --mod rand 1000 + rst = mkRandomTags (len-1) + in Tag val rst + +printTags :: Tags -> () +printTags tags = + case tags of + Nul -> + let _ = printsym (quote "Nul") + _ = printsym (quote "SPACE") + in () + Tag val rst -> + let _ = printsym (quote "(Tag ") + _ = printint val + _ = printsym (quote "SPACE") + _ = printTags rst + _ = printsym (quote ")") + _ = printsym (quote "SPACE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/ghc/MainGhc.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/ghc/MainGhc.hs new file mode 100644 index 000000000..e57755b41 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/ghc/MainGhc.hs @@ -0,0 +1,686 @@ +module Main where + +import System.TimeIt +import System.CPUTime +import qualified Data.Vector as V +import System.Random +import Data.Time.Clock (getCurrentTime, diffUTCTime) +import Control.Exception (evaluate) + +import Control.DeepSeq +import Data.Int +import Data.List + +data PList a = Nil | Cons a (PList a) deriving (Show) + +type Text = V.Vector Char -- -> Maybe this needs to be changed to a String type in haskell ? + +--type Target = (Text, Text) +--type Attr = (Text, (PList Text), (PList (Text, Text))) + +-- For simplicity, we are assuming for this benchmark that data Inline is tokenized at the "word" level. +-- Therefore, The Base case where "Text" is used is going to be a single word, i.e, "Str Text". +data Inline = Str Text + | Emph (PList Inline) + | Underline (PList Inline) + | Strong (PList Inline) + | Strikeout (PList Inline) + | Superscript (PList Inline) + | Subscript (PList Inline) + | SmallCaps (PList Inline) + -- | Quoted QuoteType (PList Inline) + -- | Cite [Citation] (PList Inline) + -- | Code Attr Text + | Space + | SoftBreak + | LineBreak + -- | Math MathType Text + -- | RawInline Format Text + -- | Link Attr (PList Inline) Target + -- | Image Attr (PList Inline) Target + | Note (PList Block) + -- | Span Attr (PList Inline) + deriving (Show) + +data Block = Plain (PList Inline) + | Para (PList Inline) + -- | LineBlock (PList (PList Inline)) + -- | CodeBlock Attr Text + -- | RawBlock Format Text + | BlockQuote (PList Block) + -- | OrderedList ListAttributes [[Block]] + -- | BulletList (PList (PList Block)) + -- | DefinitionList PList ( PList Inline , PList (PList Block) ) ---> This is resulting in a compile time error (TODO: DEBUG) + -- | Header Int Attr (PList Inline) + | HorizontalRule + -- | Table Attr Caption [ColSpec] TableHead [TableBody] TableFoot + -- | Div Attr (PList Block) + | Null + deriving (Show) + +-- Define Blog elements +data BlogHeader = Header Text deriving (Show) +data BlogId = ID Int deriving (Show) +data BlogAuthor = Author Text deriving (Show) +data BlogDate = Date Text deriving (Show) +data BlogContent = Content Block deriving (Show) +data BlogTags = TagList (PList Text) deriving (Show) + +-- Define Blog data Type/s +data Blog = End + | Layout1 (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogContent) (BlogTags) (Blog) + | Layout2 (BlogContent) (BlogTags) (Blog) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout3 (BlogTags) (Blog) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout4 (BlogTags) (BlogContent) (Blog) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout5 (Blog) (BlogTags) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout6 (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogContent) (Blog) (BlogTags) + | Layout7 (Blog) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogTags) + deriving (Show) + + +-- Data structures for a Fully Inverted Index table +-- LocationInfo = (Doc id or address, location/address in document) +-- Mapping = (keyword as text, List of Docs as LocationInfo tuples) +-- But maybe, Mapping and Location Info should be packed data as well ? If we are to run multiple passes on them? + +type LocationInfo = (Int, Int) +type Mapping = (Text, PList LocationInfo) +type InvertedTable = PList Mapping + +mkChar :: Int -> Char +mkChar val = 'a' + +-- Get a random word, based on an Int option +getRandomString :: Int -> Text +getRandomString option = + if option == 0 then + let str = V.generate 100 mkChar + in str + else if option == 1 then + let str = V.generate 100 mkChar + in str + else if option == 2 then + let str = V.generate 100 mkChar + in str + else if option == 3 then + let str = V.generate 100 mkChar + in str + else if option == 4 then + let str = V.generate 100 mkChar + in str + else if option == 5 then + let str = V.generate 100 mkChar + in str + else if option == 6 then + let str = V.generate 100 mkChar + in str + else if option == 7 then + let str = V.generate 100 mkChar + in str + else let str = V.generate 100 mkChar + in str + +-- Make an Inline type, option chooses what kind of Inline data type we are creating +-- This will Purposefully make Inline lists at a depth of recursion 1, this can be modified to increase the depth of recursion. +-- This function crates the recursive fields. +mkInline :: Int -> Inline +mkInline option = + if option == 0 then (Emph (mkInlineList 1 1)) + else if option == 1 then (Underline (mkInlineList 1 1)) + else if option == 2 then (Strong (mkInlineList 1 1)) + else if option == 3 then (Strikeout (mkInlineList 1 1)) + else if option == 4 then (Superscript (mkInlineList 1 1)) + else if option == 5 then (Subscript (mkInlineList 1 1)) + else if option == 6 then (SmallCaps (mkInlineList 1 1)) + else (Note (mkBlockList 1 1)) + + +-- Make an Inline type, option chooses what kind of Inline data type we are creating +-- This creates all the base cases for the inline type +mkInlineBaseCase :: Int -> Inline +mkInlineBaseCase option = + if option == 0 then (Str (getRandomString 0)) -- get a random word + else if option == 1 then Space + else if option == 2 then SoftBreak + else LineBreak + +-- Make a list of Inline data Type. +mkInlineList :: Int -> Int -> (PList Inline) +mkInlineList length base = + if length <= 0 then Nil + -- If its not base case, then don't stop recursion. + else if (base == 0) then + let item = (mkInline 0) + rst = (mkInlineList (length - 1) base) + in Cons item rst + -- If its base case, then stop recursion in Inline data type and only add base cases. + else let item = (mkInlineBaseCase 0) + rst = mkInlineList (length - 1) base + in Cons item rst + +-- Make a list of blocks +mkBlockList :: Int -> Int -> (PList Block) +mkBlockList length base = + if length <= 0 then Nil + else if (base == 0) then + let item = (mkBlock 0) + rst = (mkBlockList (length - 1) base) + in Cons item rst + else let item = (mkBlockBaseCase 0) + rst = (mkBlockList (length - 1) base) + in Cons item rst + +-- Make a Block data type with random data, make depth of recursion to 1 for now +mkBlock :: Int -> Block +mkBlock option = + if option == 0 then (Plain (mkInlineList 1 1)) + else if option == 1 then (Para (mkInlineList 1 1)) + else (BlockQuote (mkBlockList 1 1)) + +-- Base case for make Block +mkBlockBaseCase :: Int -> Block +mkBlockBaseCase option = + if option == 0 then HorizontalRule + else Null + +-- A function to make a list of tags each filled with some random tags +mkTagList :: Int -> (PList Text) +mkTagList length = + if length <= 0 then Nil + else let elem = (getRandomString 0) --rand + rst = mkTagList (length - 1) + in Cons elem rst + + +-- Utility Functions to make Blogs and its Elements. +mkBlogHeader :: Text -> BlogHeader +mkBlogHeader text = Header text + +mkBlogID :: Int -> BlogId +mkBlogID val = ID val + +mkBlogAuthor :: Text -> BlogAuthor +mkBlogAuthor text = Author text + +mkBlogDate :: Text -> BlogDate +mkBlogDate text = Date text + +mkBlogContent :: Block -> BlogContent +mkBlogContent block = Content block + +mkBlogTags :: (PList Text) -> BlogTags +mkBlogTags taglist = TagList taglist + + +-- mkBlogs_layout1 :: Int -> Int -> Int -> Blog +-- mkBlogs_layout1 length id tag_length = +-- if length <= 0 then End +-- else +-- let header = mkBlogHeader (getRandomString (mod rand 9)) +-- blogID = mkBlogID id +-- author = mkBlogAuthor (getRandomString (mod rand 9)) +-- date = mkBlogDate (getRandomString (mod rand 9)) +-- content = mkBlogContent (mkBlock (mod rand 2)) +-- tags = mkBlogTags (mkTagList 100) +-- rst = mkBlogs_layout1 (length - 1) (id+1) tag_length +-- in Layout1 header blogID author date content tags rst + +mkBlogs_layout1 :: Int -> Int -> Int -> Blog +mkBlogs_layout1 length id tag_length = + if length <= 0 then End + else + let header = Header (getRandomString 0) + blogID = ID id + author = Author (getRandomString 0) + date = Date (getRandomString 0) + content = Content (mkBlock 0) + tags = TagList (mkTagList 100) + rst = mkBlogs_layout1 (length - 1) (id+1) tag_length + in Layout1 header blogID author date content tags rst + + +mkBlogs_layout2 :: Int -> Int -> Int -> Blog +mkBlogs_layout2 length id tag_length = + if length <= 0 then End + else + let content = Content (mkBlock 0) + tags = TagList (mkTagList 100) + rst = mkBlogs_layout2 (length - 1) (id+1) tag_length + header = Header (getRandomString 0) + blogID = ID id + author = Author (getRandomString 0) + date = Date (getRandomString 0) + in Layout2 content tags rst header blogID author date + +mkBlogs_layout3 :: Int -> Int -> Int -> Blog +mkBlogs_layout3 length id tag_length = + if length <= 0 then End + else + let tags = TagList (mkTagList 100) + rst = mkBlogs_layout3 (length - 1) (id+1) tag_length + content = Content (mkBlock 0) + header = Header (getRandomString 0) + blogID = ID id + author = Author (getRandomString 0) + date = Date (getRandomString 0) + in Layout3 tags rst content header blogID author date + +mkBlogs_layout4 :: Int -> Int -> Int -> Blog +mkBlogs_layout4 length id tag_length = + if length <= 0 then End + else + let tags = TagList (mkTagList 100) + content = Content (mkBlock 0) + rst = mkBlogs_layout4 (length - 1) (id+1) tag_length + header = Header (getRandomString 0) + blogID = ID id + author = Author (getRandomString 0) + date = Date (getRandomString 0) + in Layout4 tags content rst header blogID author date + +mkBlogs_layout5 :: Int -> Int -> Int -> Blog +mkBlogs_layout5 length id tag_length = + if length <= 0 then End + else + let rst = mkBlogs_layout5 (length - 1) (id+1) tag_length + tags = TagList (mkTagList 100) + content = Content (mkBlock 0) + header = Header (getRandomString 0) + blogID = ID id + author = Author (getRandomString 0) + date = Date (getRandomString 0) + in Layout5 rst tags content header blogID author date + +mkBlogs_layout6 :: Int -> Int -> Int -> Blog +mkBlogs_layout6 length id tag_length = + if length <= 0 then End + else + let header = Header (getRandomString 0) + blogID = ID id + author = Author (getRandomString 0) + date = Date (getRandomString 0) + content = Content (mkBlock 0) + rst = mkBlogs_layout6 (length - 1) (id+1) tag_length + tags = TagList (mkTagList 100) + in Layout6 header blogID author date content rst tags + +mkBlogs_layout7 :: Int -> Int -> Int -> Blog +mkBlogs_layout7 length id tag_length = + if length <= 0 then End + else + let rst = mkBlogs_layout7 (length - 1) (id+1) tag_length + content = Content (mkBlock 0) + header = Header (getRandomString 0) + blogID = ID id + author = Author (getRandomString 0) + date = Date (getRandomString 0) + tags = TagList (mkTagList 100) + in Layout7 rst content header blogID author date tags + + +-- Function to make a text string of some length. +-- First argument takes Length, returns a text string. +-- mkText :: Int -> Text +-- mkText length = +-- let string :: Text +-- string = generate length (\i -> i) +-- in string + +-- End functions that will be used to create data structures with random data in it. + +-- Begin functions to search the content for a particular keyword. +-- If keyword is present highlight that keyword (Emph) in the content +-- For now to make things simple, consider a keyword in represented via an Int. + +-- search for a particular keyword (Int) in a Text blob (Vector Int) +-- TODO: Replace Text = Vector Int to Vector Char +-- searchKeywordText :: Int -> Text -> Bool +-- searchKeywordText keyword text = +-- let len = length text in +-- if len <= 0 then False +-- else let front = head text +-- sliced = slice 1 (len - 1) text +-- in +-- if front == keyword then (True || searchKeywordText keyword sliced) +-- else (False || searchKeywordText keyword sliced) + +-- Maybe use this function to implement such that you can search a keyword in a string of words ? +-- searchKeywordText :: Text -> Text -> Bool +-- searchKeywordText keyword text = False + +-- Function to compare two words, each represented by Vector Char. +compareWord :: Text -> Text -> Bool +compareWord word1 word2 = + let len1 = length word1 + len2 = length word2 + compare_len = if (len1 == len2) then True else False + in if (compare_len) then (cmp 0 len1 word1 word2) else False + +-- Compare 2 Vector Char (Text) or words for equality if their length is the same. +cmp :: Int -> Int -> V.Vector Char -> V.Vector Char -> Bool +cmp start end word1 word2 = + if (start < end) then + let a = word1 V.! start + b = word2 V.! start + eq = if (a == b) then True else False + recurse = cmp (start+1) end word1 word2 + in (eq && recurse) + else True + +-- Search a TagList (PList Text) for some keyword +searchTagList :: Text -> PList Text -> Bool +searchTagList keyword taglist = case taglist of + Nil -> False + Cons word rst -> (compareWord keyword word) || (searchTagList keyword rst) + +-- Search if a particular Tag exists in the Tag list of the blog +searchKeywordInBlogsTagList :: Text -> Blog -> Bool +searchKeywordInBlogsTagList keyword blog = + case blog of + End -> False + Layout1 header id author date content tags rst -> case tags of + TagList list -> (searchTagList keyword list) + Layout2 content tags rst header id author date -> case tags of + TagList list -> (searchTagList keyword list) + Layout3 tags rst content header id author date -> case tags of + TagList list -> (searchTagList keyword list) + Layout4 tags content rst header id author date -> case tags of + TagList list -> (searchTagList keyword list) + +-- Filter Blogs with a particular keyword in the TagList of the Blog +filterBlogsBasedOnKeywordInTagList :: Text -> Blog -> Blog +filterBlogsBasedOnKeywordInTagList keyword blogs = case blogs of + End -> End + Layout1 header id author date content tags rst -> case tags of + TagList list -> let exists = searchTagList keyword list + rst' = filterBlogsBasedOnKeywordInTagList keyword rst + in if (exists) then Layout1 header id author date content tags rst' + else rst' + Layout2 content tags rst header id author date -> case tags of + TagList list -> let exists = searchTagList keyword list + rst' = filterBlogsBasedOnKeywordInTagList keyword rst + in if (exists) then Layout2 content tags rst' header id author date + else rst' + Layout3 tags rst content header id author date -> case tags of + TagList list -> let exists = searchTagList keyword list + rst' = filterBlogsBasedOnKeywordInTagList keyword rst + in if (exists) then Layout3 tags rst' content header id author date + else rst' + Layout4 tags content rst header id author date -> case tags of + TagList list -> let exists = searchTagList keyword list + rst' = filterBlogsBasedOnKeywordInTagList keyword rst + in if (exists) then Layout4 tags content rst' header id author date + else rst' + Layout5 rst tags content header id author date -> case tags of + TagList list -> let exists = searchTagList keyword list + rst' = filterBlogsBasedOnKeywordInTagList keyword rst + in if (exists) then Layout5 rst' tags content header id author date + else rst' + Layout6 header id author date content rst tags -> case tags of + TagList list -> let exists = searchTagList keyword list + rst' = filterBlogsBasedOnKeywordInTagList keyword rst + in if (exists) then Layout6 header id author date content rst' tags + else rst' + Layout7 rst content header id author date tags -> case tags of + TagList list -> let exists = searchTagList keyword list + rst' = filterBlogsBasedOnKeywordInTagList keyword rst + in if (exists) then Layout7 rst' content header id author date tags + else rst' + +-- Tell if a particular keyword exists in a Block data type or not +isKeywordPresentInBlock :: Text -> Block -> Bool +isKeywordPresentInBlock keyword contentBlock = + case contentBlock of + Plain list_inline -> (searchInlineListForKeyword keyword list_inline) + Para list_inline -> (searchInlineListForKeyword keyword list_inline) + BlockQuote list_block -> (searchBlockListForKeyword keyword list_block) + HorizontalRule -> False + Null -> False + +-- Tell if a particular keyword exists in an inline data type or not. (search a Inline) +isKeywordPresentInline :: Text -> Inline -> Bool +isKeywordPresentInline keyword inline = + case inline of + Str text -> (compareWord keyword text) + Emph list_inline -> (searchInlineListForKeyword keyword list_inline) + Underline list_inline -> (searchInlineListForKeyword keyword list_inline) + Strong list_inline -> (searchInlineListForKeyword keyword list_inline) + Strikeout list_inline -> (searchInlineListForKeyword keyword list_inline) + Superscript list_inline -> (searchInlineListForKeyword keyword list_inline) + Subscript list_inline -> (searchInlineListForKeyword keyword list_inline) + SmallCaps list_inline -> (searchInlineListForKeyword keyword list_inline) + Space -> False + SoftBreak -> False + LineBreak -> False + Note list_block -> (searchBlockListForKeyword keyword list_block) + +-- Search a block list for a particular keyword +searchBlockListForKeyword :: Text -> PList Block -> Bool +searchBlockListForKeyword keyword block_list = + case block_list of + Nil -> False + Cons block rst -> (isKeywordPresentInBlock keyword block) || (searchBlockListForKeyword keyword rst) + +-- Search an Inline list for a particular keyword +searchInlineListForKeyword :: Text -> PList Inline -> Bool +searchInlineListForKeyword keyword inline_list = + case inline_list of + Nil -> False + Cons inline rst -> (isKeywordPresentInline keyword inline) || (searchInlineListForKeyword keyword rst) + +-- Search blogs for a particular keyword, return a list of bool signifying which block has what keyword in it +searchBlogContentsForKeyword :: Text -> Blog -> PList Bool +searchBlogContentsForKeyword keyword blogs = + case blogs of + End -> Nil + Layout1 header id author date content tags rst -> case content of + Content block -> let exists = isKeywordPresentInBlock keyword block + existsRst = searchBlogContentsForKeyword keyword rst + in Cons exists existsRst + Layout2 content tags rst header id author date -> case content of + Content block -> let exists = isKeywordPresentInBlock keyword block + existsRst = searchBlogContentsForKeyword keyword rst + in Cons exists existsRst + Layout3 tags rst content header id author date -> case content of + Content block -> let exists = isKeywordPresentInBlock keyword block + existsRst = searchBlogContentsForKeyword keyword rst + in Cons exists existsRst + Layout4 tags content rst header id author date -> case content of + Content block -> let exists = isKeywordPresentInBlock keyword block + existsRst = searchBlogContentsForKeyword keyword rst + in Cons exists existsRst + +-- Filter the Blogs based on if some keyword is present in the Contents field of the Blogs or not +filterBlogsBasedOnKeywordInContent :: Text -> Blog -> Blog +filterBlogsBasedOnKeywordInContent keyword blogs = + case blogs of + End -> End + Layout1 header id author date content tags rst -> case content of + Content block -> let exists = isKeywordPresentInBlock keyword block + rst' = filterBlogsBasedOnKeywordInContent keyword rst + in if (exists) then Layout1 header id author date content tags rst' + else rst' + Layout2 content tags rst header id author date -> case content of + Content block -> let exists = isKeywordPresentInBlock keyword block + rst' = filterBlogsBasedOnKeywordInContent keyword rst + in if (exists) then Layout2 content tags rst' header id author date + else rst' + Layout3 tags rst content header id author date -> case content of + Content block -> let exists = isKeywordPresentInBlock keyword block + rst' = filterBlogsBasedOnKeywordInContent keyword rst + in if (exists) then Layout3 tags rst' content header id author date + else rst' + Layout4 tags content rst header id author date -> case content of + Content block -> let exists = isKeywordPresentInBlock keyword block + rst' = filterBlogsBasedOnKeywordInContent keyword rst + in if (exists) then Layout4 tags content rst' header id author date + else rst' + +-- Emphasize a particular keyword in a Block type +emphasizeKeywordInBlock :: Text -> Block -> Block +emphasizeKeywordInBlock keyword contentBlock = + case contentBlock of + Plain list_inline -> Plain (emphasizeInlineListForKeyword keyword list_inline) + Para list_inline -> Para (emphasizeInlineListForKeyword keyword list_inline) + BlockQuote list_block -> BlockQuote (emphasizeKeywordInBlockList keyword list_block) + HorizontalRule -> HorizontalRule + Null -> Null + +-- Emphasize a particular keyword in an Inline data type +emphasizeKeywordInline :: Text -> Inline -> Inline +emphasizeKeywordInline keyword inline = + case inline of + Str text -> let isSame = compareWord keyword text + in if (isSame) then let + newlist :: PList Inline + newlist = (Cons inline) Nil -- ---> Here we had to use a call to copyPacked in order to copy over the inline to a new region. + in (Emph newlist) + else inline + Emph list_inline -> Emph (emphasizeInlineListForKeyword keyword list_inline) + Underline list_inline -> Underline (emphasizeInlineListForKeyword keyword list_inline) + Strong list_inline -> Strong (emphasizeInlineListForKeyword keyword list_inline) + Strikeout list_inline -> Strikeout (emphasizeInlineListForKeyword keyword list_inline) + Superscript list_inline -> Superscript (emphasizeInlineListForKeyword keyword list_inline) + Subscript list_inline -> Subscript (emphasizeInlineListForKeyword keyword list_inline) + SmallCaps list_inline -> SmallCaps (emphasizeInlineListForKeyword keyword list_inline) + Space -> Space + SoftBreak -> SoftBreak + LineBreak -> LineBreak + Note list_block -> Note (emphasizeKeywordInBlockList keyword list_block) + +-- Emphasize a particular keyword in an Inline list +emphasizeInlineListForKeyword :: Text -> PList Inline -> PList Inline +emphasizeInlineListForKeyword keyword inline_list = + case inline_list of + Nil -> Nil + Cons inline rst -> let + newinline = emphasizeKeywordInline keyword inline + rst' = emphasizeInlineListForKeyword keyword rst + in Cons newinline rst' + +-- Emphasize a particular keyword in a block list +emphasizeKeywordInBlockList :: Text -> PList Block -> PList Block +emphasizeKeywordInBlockList keyword block_list = + case block_list of + Nil -> Nil + Cons block rst -> let + newBlock = emphasizeKeywordInBlock keyword block + rst' = emphasizeKeywordInBlockList keyword rst + in Cons newBlock rst' + +-- Emphasize a particular keyword in the blogs, return new Blogs +emphasizeBlogContentsForKeyword :: Text -> Blog -> Blog +emphasizeBlogContentsForKeyword keyword blogs = + case blogs of + End -> End + Layout1 header id author date content tags rst -> case content of + Content block -> let new_content = Content (emphasizeKeywordInBlock keyword block) + existsRst = emphasizeBlogContentsForKeyword keyword rst + in Layout1 header id author date new_content tags existsRst + Layout2 content tags rst header id author date -> case content of + Content block -> let new_content = Content (emphasizeKeywordInBlock keyword block) + existsRst = emphasizeBlogContentsForKeyword keyword rst + in Layout2 new_content tags existsRst header id author date + Layout3 tags rst content header id author date -> case content of + Content block -> let new_content = Content (emphasizeKeywordInBlock keyword block) + existsRst = emphasizeBlogContentsForKeyword keyword rst + in Layout3 tags existsRst new_content header id author date + Layout4 tags content rst header id author date -> case content of + Content block -> let new_content = Content (emphasizeKeywordInBlock keyword block) + existsRst = emphasizeBlogContentsForKeyword keyword rst + in Layout4 tags new_content existsRst header id author date + + +-------------------------------------------------------------------------------- +-- Timing things +-------------------------------------------------------------------------------- +median :: [Double] -> Double +median ls = (sort ls) !! (length ls `div` 2) +-------------------------------------------------------------------------------- + +-- Timing for making the layouts +dotrialMkLayout :: (Int -> Int -> Int -> Blog) -> Int -> Int -> Int -> IO (Blog, Double) +dotrialMkLayout f length id tag_len = do + t1 <- getCurrentTime + a <- evaluate $ (f length id tag_len) + t2 <- getCurrentTime + let delt = fromRational (toRational (diffUTCTime t2 t1)) + putStrLn ("iter time: " ++ show delt) + return $! (a,delt) + +benchMkLayout :: (Int -> Int -> Int -> Blog) -> Int -> Int -> Int -> Int -> IO (Blog, Double, Double) +benchMkLayout f length id tag_len iters = do + putStrLn ("Timings for making the particular layout") + tups <- mapM (\_ -> dotrialMkLayout f length id tag_len) [1..iters] + let (results, times) = unzip tups + let selftimed = median times + batchtime = sum times + return $! (last results, selftimed, batchtime) + +-- Timing for filtering the blogs based on a keyword +dotrialFilterBlogsBasedOnKeywordInTagList :: (Text -> Blog -> Blog) -> Text -> Blog -> IO (Blog, Double) +dotrialFilterBlogsBasedOnKeywordInTagList f keyword blogs = do + t1 <- getCurrentTime + a <- evaluate $ (f keyword blogs) + t2 <- getCurrentTime + let delt = fromRational (toRational (diffUTCTime t2 t1)) + putStrLn ("iter time: " ++ show delt) + return $! (a,delt) + +benchFilterBlogsBasedOnKeywordInTagList :: (Text -> Blog -> Blog) -> Text -> Blog -> Int -> IO (Blog, Double, Double) +benchFilterBlogsBasedOnKeywordInTagList f keyword blog iters = do + putStrLn ("Timings for filering blogs based on a keyword in the tag list") + tups <- mapM (\_ -> dotrialFilterBlogsBasedOnKeywordInTagList f keyword blog) [1..iters] + let (results, times) = unzip tups + let selftimed = median times + batchtime = sum times + return $! (last results, selftimed, batchtime) + + + +-- main function +main :: IO () +main = + do + (blogs1, self1, batch1) <- benchMkLayout mkBlogs_layout1 200000 0 1200 1 + --(blogs2, self2, batch2) <- benchMkLayout mkBlogs_layout2 100 0 10 10 + --(blogs3, self3, batch3) <- benchMkLayout mkBlogs_layout3 100 0 10 10 + --(blogs4, self4, batch4) <- benchMkLayout mkBlogs_layout4 100 0 10 10 + --(blogs5, self5, batch5) <- benchMkLayout mkBlogs_layout5 100 0 10 10 + --(blogs6, self6 ,batch6) <- benchMkLayout mkBlogs_layout6 100 0 10 10 + --(blogs7, self7, batch7) <- benchMkLayout mkBlogs_layout7 100 0 10 10 + let keyword = getRandomString 2 + (newblog1, self8, batch8) <- benchFilterBlogsBasedOnKeywordInTagList filterBlogsBasedOnKeywordInTagList keyword blogs1 1 + --(newblog2, self9, batch8) <- benchFilterBlogsBasedOnKeywordInTagList filterBlogsBasedOnKeywordInTagList keyword blogs2 20 + --(newblog3, self10, batch8) <- benchFilterBlogsBasedOnKeywordInTagList filterBlogsBasedOnKeywordInTagList keyword blogs3 20 + --(newblog4, self11, batch8) <- benchFilterBlogsBasedOnKeywordInTagList filterBlogsBasedOnKeywordInTagList keyword blogs4 20 + --(newblog5, self12, batch8) <- benchFilterBlogsBasedOnKeywordInTagList filterBlogsBasedOnKeywordInTagList keyword blogs5 20 + --(newblog6, self8, batch8) <- benchFilterBlogsBasedOnKeywordInTagList filterBlogsBasedOnKeywordInTagList keyword blogs6 20 + --(newblog7, self8, batch8) <- benchFilterBlogsBasedOnKeywordInTagList filterBlogsBasedOnKeywordInTagList keyword blogs7 20 + --putStrLn $ "Done." + print newblog1 + + +-- compile with +-- ghc MainGhc.hs -package vector + + +-- Passes written so far +-- 1.) Search for a keyword in Content of Blogs +-- 2.) Search for a keyword in TagList of Blogs +-- 3.) Filter blogs based on a particular keyword +-- 4.) Filter blogs based on a particular keyword in the TagList +-- 5.) emphasize a particular keyword in the Content of Blogs + + +-- let blogs1 = mkBlogs_layout1 100 0 10 +-- blogs2 = mkBlogs_layout2 100 0 10 +-- blogs3 = mkBlogs_layout3 100 0 10 +-- blogs4 = mkBlogs_layout4 100 0 10 +-- keyword = getRandomString 2 +-- start <- getCPUTimeWithUnit +-- time1 = timeIt $ print (filterBlogsBasedOnKeywordInTagList keyword blogs1) +-- time2 = timeIt $ print (filterBlogsBasedOnKeywordInTagList keyword blogs2) +-- time3 = timeIt $ print (filterBlogsBasedOnKeywordInTagList keyword blogs3) +-- time4 = timeIt $ print (filterBlogsBasedOnKeywordInTagList keyword blogs4) +-- in time1 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/Basics.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/Basics.hs new file mode 100644 index 000000000..5fe3e40a6 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/Basics.hs @@ -0,0 +1,425 @@ +module Basics where + +import Gibbon.Prelude +import Gibbon.PList +import Gibbon.Vector +import Gibbon.Maybe + +type Text = Vector Char + +--type Target = (Text, Text) +--type Attr = (Text, (PList Text), (PList (Text, Text))) +--type Format = Format Text + +-- For simplicity, we are assuming for this benchmark that data Inline is tokenized at the "word" level. +-- Therefore, The Base case where "Text" is used is going to be a single word, i.e, "Str Text". +data Inline = Str Text + | Emph (PList Inline) + -- | Underline (PList Inline) + -- | Strong (PList Inline) + -- | Strikeout (PList Inline) + -- | Superscript (PList Inline) + -- | Subscript (PList Inline) + -- | SmallCaps (PList Inline) + -- | Quoted QuoteType (PList Inline) + -- | Cite [Citation] (PList Inline) + -- | Code Attr Text + | Space + -- | SoftBreak + -- | LineBreak + -- | Math MathType Text + -- | RawInline Format Text + -- | Link Attr (PList Inline) Target + -- | Image Attr (PList Inline) Target + -- | Note (PList Block) + -- | Span Attr (PList Inline) + deriving (Show) + +data Block = Plain (PList Inline) + -- | Para (PList Inline) + -- | LineBlock (PList (PList Inline)) + -- | CodeBlock Attr Text + -- | RawBlock Format Text + -- | BlockQuote (PList Block) + -- | OrderedList ListAttributes [[Block]] + -- | BulletList (PList (PList Block)) + -- | DefinitionList PList ( PList Inline , PList (PList Block) ) ---> This is resulting in a compile time error (TODO: DEBUG) + -- | Header Int Attr (PList Inline) + -- | HorizontalRule + -- | Table Attr Caption [ColSpec] TableHead [TableBody] TableFoot + -- | Div Attr (PList Block) + | Null + deriving (Show) + +-- Define Blog elements +data BlogHeader = Header Text +data BlogId = ID Int +data BlogAuthor = Author Text +data BlogDate = Date Text +data BlogContent = Content Block +data BlogTags = TagList (PList Text) + +-- Define packed Blog data Type/s, we can arrange the fields here to change their relative ordering. +data Blog = End + | Layout1 (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogContent) (BlogTags) (Blog) + | Layout2 (BlogContent) (BlogTags) (Blog) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout3 (BlogTags) (Blog) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout4 (BlogTags) (BlogContent) (Blog) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout5 (Blog) (BlogTags) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) + | Layout6 (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogContent) (Blog) (BlogTags) + | Layout7 (Blog) (BlogContent) (BlogHeader) (BlogId) (BlogAuthor) (BlogDate) (BlogTags) + | Layout8 (BlogContent) (Blog) (BlogId) (BlogAuthor) (BlogDate) (BlogHeader) (BlogTags) + deriving (Show) + + +getChar :: Int -> Char +getChar decimal = + if decimal == 0 then '!' + else if decimal == 1 then '#' + else if decimal == 2 then '$' + else if decimal == 3 then '%' + else if decimal == 4 then '&' + else if decimal == 5 then '(' + else if decimal == 6 then ')' + else if decimal == 7 then '*' + else if decimal == 8 then '+' + else if decimal == 9 then ',' + else if decimal == 10 then '-' + else if decimal == 11 then '.' + else if decimal == 12 then '/' + else if decimal == 13 then '0' + else if decimal == 14 then '1' + else if decimal == 15 then '2' + else if decimal == 16 then '3' + else if decimal == 17 then '4' + else if decimal == 18 then '5' + else if decimal == 19 then '6' + else if decimal == 20 then '7' + else if decimal == 21 then '8' + else if decimal == 22 then '9' + else if decimal == 23 then ':' + else if decimal == 24 then ';' + else if decimal == 25 then '<' + else if decimal == 26 then '=' + else if decimal == 27 then '>' + else if decimal == 28 then '?' + else if decimal == 29 then '@' + else if decimal == 30 then 'A' + else if decimal == 31 then 'B' + else if decimal == 32 then 'C' + else if decimal == 33 then 'D' + else if decimal == 34 then 'E' + else if decimal == 35 then 'F' + else if decimal == 36 then 'G' + else if decimal == 37 then 'H' + else if decimal == 38 then 'I' + else if decimal == 39 then 'J' + else if decimal == 40 then 'K' + else if decimal == 41 then 'L' + else if decimal == 42 then 'M' + else if decimal == 43 then 'N' + else if decimal == 44 then 'O' + else if decimal == 45 then 'P' + else if decimal == 46 then 'Q' + else if decimal == 47 then 'R' + else if decimal == 48 then 'S' + else if decimal == 49 then 'T' + else if decimal == 50 then 'U' + else if decimal == 51 then 'V' + else if decimal == 52 then 'W' + else if decimal == 53 then 'X' + else if decimal == 54 then 'Y' + else if decimal == 55 then 'Z' + else if decimal == 56 then '[' + else if decimal == 57 then ']' + else if decimal == 58 then '^' + else if decimal == 59 then '_' + else if decimal == 60 then '`' + else if decimal == 61 then 'a' + else if decimal == 62 then 'b' + else if decimal == 63 then 'c' + else if decimal == 64 then 'd' + else if decimal == 65 then 'e' + else if decimal == 66 then 'f' + else if decimal == 67 then 'g' + else if decimal == 68 then 'h' + else if decimal == 69 then 'i' + else if decimal == 70 then 'j' + else if decimal == 71 then 'k' + else if decimal == 72 then 'l' + else if decimal == 73 then 'm' + else if decimal == 74 then 'n' + else if decimal == 75 then 'o' + else if decimal == 76 then 'p' + else if decimal == 77 then 'q' + else if decimal == 78 then 'r' + else if decimal == 79 then 's' + else if decimal == 80 then 't' + else if decimal == 81 then 'u' + else if decimal == 82 then 'v' + else if decimal == 83 then 'w' + else if decimal == 84 then 'x' + else if decimal == 85 then 'y' + else if decimal == 86 then 'z' + else if decimal == 87 then '{' + else if decimal == 88 then '|' + else if decimal == 89 then '}' + else '~' + +mkChar :: Int -> Char +mkChar val = getChar (mod rand 91) + +-- Get a random word, Int is the length of the string. +-- Based on internet, average english word is 5 characters long +getRandomString :: Int -> Text +getRandomString length = generate length mkChar + +-- Utility Functions to make Blogs and its Elements. +mkBlogHeader :: Text -> BlogHeader +mkBlogHeader text = Header text + +mkBlogID :: Int -> BlogId +mkBlogID val = ID val + +mkBlogAuthor :: Text -> BlogAuthor +mkBlogAuthor text = Author text + +mkBlogDate :: Text -> BlogDate +mkBlogDate text = Date text + +mkBlogContent :: Block -> BlogContent +mkBlogContent block = Content block + +mkBlogTags :: (PList Text) -> BlogTags +mkBlogTags taglist = TagList taglist + + +getFile :: Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Int -> Text +getFile f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 select = + if (select == 0) then f1 + else if (select == 1) then f2 + else if (select == 2) then f3 + else if (select == 3) then f4 + else if (select == 4) then f5 + else if (select == 5) then f6 + else if (select == 6) then f7 + else if (select == 7) then f8 + else if (select == 8) then f9 + else f10 + + +mkListFiles :: Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Int -> PList Text +mkListFiles f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 len = if len < 0 then Nil + else + let f = (getFile f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 len) + rst = (mkListFiles f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 (len - 1)) + in Cons f rst + + +checkBlogID :: BlogId -> Int -> Bool +checkBlogID id val = case id of + ID x -> if ( x == val ) then True + else False + +-- Function to compare two words, each represented by Vector Char. +compareWord :: Text -> Text -> Bool +compareWord word1 word2 = + let len1 = length word1 + len2 = length word2 + compare_len = if (len1 == len2) then True else False + in if (compare_len) then (cmp 0 len1 word1 word2) else False + +-- Compare 2 Vector Char (Text) or words for equality if their length is the same. +cmp :: Int -> Int -> Vector Char -> Vector Char -> Bool +cmp start end word1 word2 = + if (start < end) then + let a = nth word1 start + b = nth word2 start + eq = if (a *==* b) then True else False + recurse = cmp (start+1) end word1 word2 + in (eq && recurse) + else True + +-- Search a TagList (PList Text) for some keyword +searchTagList :: Text -> PList Text -> Bool +searchTagList keyword taglist = case taglist of + Nil -> False + Cons word rst -> (compareWord keyword word) || (searchTagList keyword rst) + +-- delete a keyword in a TagList +deleteTagList :: Text -> PList Text -> PList Text +deleteTagList keyword taglist = case taglist of + Nil -> Nil + Cons word rst -> if (compareWord keyword word) then (deleteTagList keyword rst) + else Cons word (deleteTagList keyword rst) + + +insertTagList :: Text -> PList Text -> PList Text +insertTagList keyword taglist = case taglist of + Nil -> (Cons keyword) Nil + Cons word rst -> insertTagList keyword rst + +-- Tell if a particular keyword exists in a Block data type or not +isKeywordPresentInBlock :: Text -> Block -> Bool +isKeywordPresentInBlock keyword contentBlock = + case contentBlock of + Plain list_inline -> (searchInlineListForKeyword keyword list_inline) + --Para list_inline -> (searchInlineListForKeyword keyword list_inline) + --BlockQuote list_block -> (searchBlockListForKeyword keyword list_block) + --HorizontalRule -> False + Null -> False + +-- Tell if a particular keyword exists in an inline data type or not. (search a Inline) +isKeywordPresentInline :: Text -> Inline -> Bool +isKeywordPresentInline keyword inline = + case inline of + Str text -> (compareWord keyword text) + Emph list_inline -> (searchInlineListForKeyword keyword list_inline) + --Underline list_inline -> (searchInlineListForKeyword keyword list_inline) + --Strong list_inline -> (searchInlineListForKeyword keyword list_inline) + --Strikeout list_inline -> (searchInlineListForKeyword keyword list_inline) + --Superscript list_inline -> (searchInlineListForKeyword keyword list_inline) + --Subscript list_inline -> (searchInlineListForKeyword keyword list_inline) + --SmallCaps list_inline -> (searchInlineListForKeyword keyword list_inline) + Space -> False + --SoftBreak -> False + --LineBreak -> False + --Note list_block -> (searchBlockListForKeyword keyword list_block) + +-- Search a block list for a particular keyword +searchBlockListForKeyword :: Text -> PList Block -> Bool +searchBlockListForKeyword keyword block_list = + case block_list of + Nil -> False + Cons block rst -> (isKeywordPresentInBlock keyword block) || (searchBlockListForKeyword keyword rst) + +-- Search an Inline list for a particular keyword +searchInlineListForKeyword :: Text -> PList Inline -> Bool +searchInlineListForKeyword keyword inline_list = + case inline_list of + Nil -> False + Cons inline rst -> (isKeywordPresentInline keyword inline) || (searchInlineListForKeyword keyword rst) + +-- Emphasize a particular keyword in a Block type +emphasizeKeywordInBlock :: Text -> Block -> Block +emphasizeKeywordInBlock keyword contentBlock = + case contentBlock of + Plain list_inline -> Plain (emphasizeInlineListForKeyword keyword list_inline) + --Para list_inline -> Para (emphasizeInlineListForKeyword keyword list_inline) + --BlockQuote list_block -> BlockQuote (emphasizeKeywordInBlockList keyword list_block) + --HorizontalRule -> HorizontalRule + Null -> Null + +-- Emphasize a particular keyword in an Inline data type +emphasizeKeywordInline :: Text -> Inline -> Inline +emphasizeKeywordInline keyword inline = + case inline of + Str text -> let isSame = compareWord keyword text + --_ = printsym (quote "NEWLINE") + --_ = printbool isSame + --_ = printsym (quote "NEWLINE") + in if (isSame) then let + newlist :: PList Inline + newlist = (Cons (inline)) Nil -- ---> Here we had to use a call to copyPacked in order to copy over the inline to a new region, otherwise segfaults. + in (Emph newlist) + else inline + Emph list_inline -> Emph (emphasizeInlineListForKeyword keyword list_inline) + --Underline list_inline -> Underline (emphasizeInlineListForKeyword keyword list_inline) + --Strong list_inline -> Strong (emphasizeInlineListForKeyword keyword list_inline) + --Strikeout list_inline -> Strikeout (emphasizeInlineListForKeyword keyword list_inline) + --Superscript list_inline -> Superscript (emphasizeInlineListForKeyword keyword list_inline) + --Subscript list_inline -> Subscript (emphasizeInlineListForKeyword keyword list_inline) + --SmallCaps list_inline -> SmallCaps (emphasizeInlineListForKeyword keyword list_inline) + Space -> Space + --SoftBreak -> SoftBreak + --LineBreak -> LineBreak + --Note list_block -> Note (emphasizeKeywordInBlockList keyword list_block) + +-- Emphasize a particular keyword in an Inline list +emphasizeInlineListForKeyword :: Text -> PList Inline -> PList Inline +emphasizeInlineListForKeyword keyword inline_list = + case inline_list of + Nil -> Nil + Cons inline rst -> let + newinline = emphasizeKeywordInline keyword inline + rst' = emphasizeInlineListForKeyword keyword rst + in Cons newinline rst' + +-- Emphasize a particular keyword in a block list +emphasizeKeywordInBlockList :: Text -> PList Block -> PList Block +emphasizeKeywordInBlockList keyword block_list = + case block_list of + Nil -> Nil + Cons block rst -> let + newBlock = emphasizeKeywordInBlock keyword block + rst' = emphasizeKeywordInBlockList keyword rst + in Cons newBlock rst' + + +searchBlogTags :: Text -> BlogTags -> Bool +searchBlogTags keyword tags = case tags of + TagList list -> searchTagList keyword list + + +deleteBlogTags :: Text -> BlogTags -> BlogTags +deleteBlogTags keyword tags = case tags of + TagList list -> TagList (deleteTagList keyword list) + +insertBlogTags :: Text -> BlogTags -> BlogTags +insertBlogTags keyword tags = case tags of + TagList list -> TagList (insertTagList keyword list) + +-- emphasize blog content, if present is True +emphasizeBlogContent' :: Text -> BlogContent -> BlogContent +emphasizeBlogContent' keyword oldContent = case oldContent of + Content block -> Content (emphasizeKeywordInBlock keyword block) + + +{- # INLINE # -} +emphasizeBlogContent :: Text -> BlogContent -> Bool -> BlogContent +emphasizeBlogContent keyword oldContent present = case oldContent of + Content block -> if (present) + then Content (emphasizeKeywordInBlock keyword block) + else Content block + +searchBlogContent :: Text -> BlogContent -> Bool +searchBlogContent keyword content = case content of + Content block -> (isKeywordPresentInBlock keyword block) + + +fileToContent :: Vector Char -> Vector Char -> PList Inline -> Int -> Int -> Block +fileToContent file word plist_inline index max_len = + if index >= max_len then (Plain plist_inline) + else let + character :: Char + character = nth file index + isSpace = if ( character *==* (head " ") ) then True else False + char_vec = (singleton character) + -- plist_space :: PList Inline + -- plist_space = (Cons (Space) plist_inline) + in if (isSpace) then (fileToContent file (singleton (nth file (index+1))) (Cons (Str word) (copyPacked plist_inline)) (index+2) max_len) + else (fileToContent file (append word char_vec) (plist_inline) (index+1) max_len) + +fileToTags :: Vector Char -> Vector Char -> Int -> Int -> PList Text +fileToTags file word index max_len = + if index >= max_len then Nil + else let + character :: Char + character = nth file index + isSpace = if ( character *==* (head " ") ) then True else False + char_vec = (singleton character) + in if (isSpace) then Cons word (fileToTags file (singleton (nth file (index+1))) (index+2) max_len) + else (fileToTags file (append word char_vec) (index+1) max_len) + + +mkTagsFromText :: Text -> BlogTags +mkTagsFromText f' = + let tags = fileToTags f' (singleton (nth f' 0)) 1 (vlength f') + tags' = TagList tags + in tags' + + +mkContentFromText :: Text -> BlogContent +mkContentFromText f = + let block = fileToContent f (singleton (nth f 0)) Nil 1 (vlength f) + in Content block diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/Eval.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/Eval.hs new file mode 100644 index 000000000..aa5a3775a --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/Eval.hs @@ -0,0 +1,44 @@ +data Ast + = Val Bool + | Not Ast + | Or Ast Ast + | And Ast Ast + +--eval :: Ast -> Bool +--eval x = case x of +-- Val b -> b +-- Not e -> if eval e then False else True +-- Or e1 e2 -> +-- if eval e1 then True +-- else eval e2 +-- And e1 e2 -> +-- if eval e1 then eval e2 +-- else False + +--simplify :: Ast -> Ast +--simplify x = Val (eval x) + +evalR :: Ast -> Bool +{-# ANN evalR Or #-} +{-# ANN evalR And #-} +evalR x = case x of + Val b -> b + Not e -> if evalR e then False else True + Or e1 e2 -> + if evalR e2 then True + else evalR e1 + And e1 e2 -> + if evalR e2 then evalR e1 + else False + +simplifyR :: Ast -> Ast +simplifyR x = Val (evalR x) + +mkRandTree :: Int -> Ast +mkRandTree n = + if n > 0 then + let m = mod rand 3 in + if m == 0 then Not (mkRandTree (n-1)) + else if m == 1 then And (mkRandTree (n-1)) (mkRandTree (n-1)) + else Or (mkRandTree (n-1)) (mkRandTree (n-1)) + else Val (mod rand 2 == 0) diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout1.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout1.hs new file mode 100644 index 000000000..c91fdae8b --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout1.hs @@ -0,0 +1,24 @@ +module GenerateLayout1 where +import Basics + +type Text = Vector Char + + + + +mkBlogs_layout1 :: PList Text -> PList Text -> Int -> Blog +mkBlogs_layout1 contentfiles tagfiles length = + if length < 0 then End + else + let header = Header (getRandomString 5) + blogID = ID (10 - (mod length 10)) + author = Author (getRandomString 5) + date = Date (getRandomString 5) + select = (mod length 10) + def = "default file" -- this is un-necessary and just used for a default value + fc = fromMaybe def (nth_plist contentfiles Nothing select) + content = mkContentFromText fc + ft = fromMaybe def (nth_plist tagfiles Nothing select) + tags = mkTagsFromText ft + rst = mkBlogs_layout1 contentfiles tagfiles (length - 1) + in Layout1 header blogID author date content tags rst \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout2.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout2.hs new file mode 100644 index 000000000..f27a99133 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout2.hs @@ -0,0 +1,21 @@ +module GenerateLayout2 where +import Basics + +type Text = Vector Char + +mkBlogs_layout2 :: PList Text -> PList Text -> Int -> Blog +mkBlogs_layout2 contentfiles tagfiles length = + if length < 0 then End + else + let select = (mod length 10) + def = "default file" + fc = fromMaybe def (nth_plist contentfiles Nothing select) + content = mkContentFromText fc + ft = fromMaybe def (nth_plist tagfiles Nothing select) + tags = mkTagsFromText ft + rst = mkBlogs_layout2 contentfiles tagfiles (length - 1) + header = Header (getRandomString 5) + blogID = ID (10 - (mod length 10)) + author = Author (getRandomString 5) + date = Date (getRandomString 5) + in Layout2 content tags rst header blogID author date \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout3.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout3.hs new file mode 100644 index 000000000..49c0a5720 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout3.hs @@ -0,0 +1,21 @@ +module GenerateLayout3 where +import Basics + +type Text = Vector Char + +mkBlogs_layout3 :: PList Text -> PList Text -> Int -> Blog +mkBlogs_layout3 contentfiles tagfiles length = + if length < 0 then End + else + let select = (mod length 10) + def = "default file" + ft = fromMaybe def (nth_plist tagfiles Nothing select) + tags = mkTagsFromText ft + rst = mkBlogs_layout3 contentfiles tagfiles (length - 1) + fc = fromMaybe def (nth_plist contentfiles Nothing select) + content = mkContentFromText fc + header = Header (getRandomString 5) + blogID = ID (10 - (mod length 10)) + author = Author (getRandomString 5) + date = Date (getRandomString 5) + in Layout3 tags rst content header blogID author date \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout4.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout4.hs new file mode 100644 index 000000000..f5ff2cf8b --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout4.hs @@ -0,0 +1,21 @@ +module GenerateLayout4 where +import Basics + +type Text = Vector Char + +mkBlogs_layout4 :: PList Text -> PList Text -> Int -> Blog +mkBlogs_layout4 contentfiles tagfiles length = + if length < 0 then End + else + let select = (mod length 10) + def = "default file" + ft = fromMaybe def (nth_plist tagfiles Nothing select) + tags = mkTagsFromText ft + fc = fromMaybe def (nth_plist contentfiles Nothing select) + content = mkContentFromText fc + rst = mkBlogs_layout4 contentfiles tagfiles (length - 1) + header = Header (getRandomString 5) + blogID = ID (10 - (mod length 10)) + author = Author (getRandomString 5) + date = Date (getRandomString 5) + in Layout4 tags content rst header blogID author date \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout5.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout5.hs new file mode 100644 index 000000000..7cb0f9f09 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout5.hs @@ -0,0 +1,22 @@ +module GenerateLayout5 where +import Basics + +type Text = Vector Char + + +mkBlogs_layout5 :: PList Text -> PList Text -> Int -> Blog +mkBlogs_layout5 contentfiles tagfiles length = + if length < 0 then End + else + let select = (mod length 10) + def = "default file" + rst = mkBlogs_layout5 contentfiles tagfiles (length - 1) + ft = fromMaybe def (nth_plist tagfiles Nothing select) + tags = mkTagsFromText ft + fc = fromMaybe def (nth_plist contentfiles Nothing select) + content = mkContentFromText fc + header = Header (getRandomString 5) + blogID = ID (10 - (mod length 10)) + author = Author (getRandomString 5) + date = Date (getRandomString 5) + in Layout5 rst tags content header blogID author date \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout6.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout6.hs new file mode 100644 index 000000000..211316539 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout6.hs @@ -0,0 +1,21 @@ +module GenerateLayout6 where +import Basics + +type Text = Vector Char + +mkBlogs_layout6 :: PList Text -> PList Text -> Int -> Blog +mkBlogs_layout6 contentfiles tagfiles length = + if length < 0 then End + else + let select = (mod length 10) + def = "default file" + header = Header (getRandomString 5) + blogID = ID (10 - (mod length 10)) + author = Author (getRandomString 5) + date = Date (getRandomString 5) + fc = fromMaybe def (nth_plist contentfiles Nothing select) + content = mkContentFromText fc + rst = mkBlogs_layout6 contentfiles tagfiles (length - 1) + ft = fromMaybe def (nth_plist tagfiles Nothing select) + tags = mkTagsFromText ft + in Layout6 header blogID author date content rst tags \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout7.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout7.hs new file mode 100644 index 000000000..5e7fbf3a5 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout7.hs @@ -0,0 +1,21 @@ +module GenerateLayout7 where +import Basics + +type Text = Vector Char + +mkBlogs_layout7 :: PList Text -> PList Text -> Int -> Blog +mkBlogs_layout7 contentfiles tagfiles length = + if length < 0 then End + else + let select = (mod length 10) + def = "default file" + rst = mkBlogs_layout7 contentfiles tagfiles (length - 1) + fc = fromMaybe def (nth_plist contentfiles Nothing select) + content = mkContentFromText fc + header = Header (getRandomString 5) + blogID = ID (10 - (mod length 10)) + author = Author (getRandomString 5) + date = Date (getRandomString 5) + ft = fromMaybe def (nth_plist tagfiles Nothing select) + tags = mkTagsFromText ft + in Layout7 rst content header blogID author date tags \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout8.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout8.hs new file mode 100644 index 000000000..be60bec6c --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/GenerateLayout8.hs @@ -0,0 +1,22 @@ +module GenerateLayout8 where +import Basics + +type Text = Vector Char + + +mkBlogs_layout8 :: PList Text -> PList Text -> Int -> Blog +mkBlogs_layout8 contentfiles tagfiles length = + if length < 0 then End + else + let select = (mod length 10) + def = "default file" + fc = fromMaybe def (nth_plist contentfiles Nothing select) + content = mkContentFromText fc + rst = mkBlogs_layout8 contentfiles tagfiles (length - 1) + id = ID (10 - (mod length 10)) + author = Author (getRandomString (mod rand 9)) + date = Date (getRandomString (mod rand 9)) + header = Header (getRandomString (mod rand 9)) + ft = fromMaybe def (nth_plist tagfiles Nothing select) + tags = mkTagsFromText ft + in Layout8 content rst id author date header tags \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/Timings.md b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/Timings.md new file mode 100644 index 000000000..61f04d5b0 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/Timings.md @@ -0,0 +1,33 @@ +# Timings for hand written benchmarks + +``` +H : Header +I : ID +A : Author +D : Date +C : Content +T : Tags +R : Rst of Blogs +``` + +### layout1 : H I A D C T R +### layout2 : C T R H I A D +### layout3 : T R C H I A D +### layout4 : T C R H I A D +### layout5 : R T C H I A D +### layout6 : H I A D C R T +### layout7 : R C H I A D T +### layout8 : C R I A D H T + +# Time in seconds, 9 iterations per layout + +``` +********************************************************************************************************************************************************************************************* + Passes | layout1 | layout2 | layout3 | layout4 | layout5 | layout6 | layout7 | layout8 | +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Content: Search -> Emphasize | (6.65, 4.92) | (5.41, 4.82) | (5.03, 4.80) | (4.89, 4.10) | (5.26, 4.79) | (4.31, 3.89) | (5.02, 4.75) | (4.33, 3.96) | + Tag: Delete a tag | (0.196, 0.177) | (0.196, 0.177) | (0.09882, 0.09924) | (0.182, 0.119) | (0.222, 0.212) | (0.228, 0.234) | (0.218, 0.203) | (0.213, 0.219) | + Tag: Insert a tag | (0.0358, 0.0354) | (0.0504, 0.0502) | (0.04114, 0.04083) | (0.0428, 0.0425) | (0.0436, 0.0416) | (0.0619, 0.0619) | (0.0437, 0.0435) | (0.04507, 0.04473) | + Tag: Search -> Emphasize | (0.645, 0.584) | (0.6408, 0.5834) | (0.5605, 0.5247) | (0.6577, 0.5874) | (0.6822, 0.5942) | (0.6683, 0.6270) | (0.7305, 0.6230) | (0.67816, 0.62593) | + ******************************************************************************************************************************************************************************************** +``` diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog1/blog1.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog1/blog1.txt new file mode 100644 index 000000000..7fd8024c9 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog1/blog1.txt @@ -0,0 +1 @@ +78366 20975 92256 10285 21553 63075 66011 75434 40745 9773 32674 81676 4778 22475 91998 91515 81315 42660 31517 10712 50675 20626 78869 96124 53984 64581 32722 88675 59928 83378 17859 30239 52460 7650 42508 38271 82221 70460 45834 44569 50808 68542 52961 54281 93319 86335 29571 95894 2643 83720 17910 70388 12861 96437 86822 63592 84754 24575 63288 34476 57721 61354 42376 83334 21235 37983 97823 23713 92303 91883 92715 30092 7365 4459 15918 38610 46750 89079 68994 22094 21435 34955 31067 42959 82099 40043 97947 78278 37347 36962 57240 27530 65017 96501 7664 32795 47828 61654 7236 97178 58589 25505 60126 43094 80361 4166 79703 76668 92917 49890 66236 87539 65385 57315 51946 80085 39527 66739 54090 84488 60881 11166 47411 55638 60605 95998 6737 49399 78746 80938 78949 15125 10664 20591 39308 20929 40040 77717 75348 13238 17475 68557 239 23763 58825 76678 35175 4273 95347 70094 95781 80905 42137 79886 24208 62389 12579 29825 12123 64141 44412 57908 32499 73436 24176 51032 58851 41261 42909 33789 80993 84827 86802 7795 70517 36151 41003 56831 9350 93207 23381 38784 50637 7179 11534 33040 36983 25909 18367 23395 64926 73247 47503 81228 10092 69065 14389 44111 73138 71490 42473 60255 53323 72219 38124 91748 19476 52729 57509 32019 11523 9564 89131 69332 40479 45316 44327 25931 84560 19923 70947 99790 91669 78385 1842 30184 99809 73698 45259 53763 99174 44276 51147 80679 71846 97211 67628 7174 98485 49214 60893 24825 35349 84244 63947 60262 19292 39329 84207 81055 26424 67701 33392 59259 78223 94239 75125 13965 87782 31707 96861 7562 98553 93687 23635 2536 95700 50469 46584 81703 56492 15128 85364 8739 30495 46871 71821 12829 64789 18660 37923 85755 9761 71653 42576 38050 73263 97563 3079 39228 84198 8872 87098 35941 66973 76979 32994 86098 10690 41443 28333 15189 45313 65040 40203 98844 46819 47118 18588 92820 59352 59519 57719 24842 46378 19389 82433 14572 19506 22729 71350 30234 94417 30538 14439 94104 22541 94765 16614 31387 9071 38517 73957 90763 88308 9345 81162 40411 17327 21873 37691 32908 12441 22983 15710 48283 10666 1867 43393 20139 53735 69476 26469 64519 48156 42014 29776 81449 74790 36620 63876 66278 31738 57701 86167 22828 14617 29363 25707 37942 93130 79994 30219 279 11980 33041 14669 4237 26848 34254 43359 69830 1615 3918 52570 92292 55582 45135 82800 43603 50551 54039 75391 21249 84517 6855 35882 69045 28710 49023 75060 91490 73954 29524 76000 82815 29692 3494 37320 29176 13917 83595 75296 48791 22550 58369 47941 14486 13645 36566 65854 21788 57050 11218 54260 51752 6190 75181 24656 23008 99682 37932 21261 74292 61855 86766 37405 49965 36648 70682 29045 80199 99164 60547 32744 11064 30600 70294 56741 88043 39048 45711 72387 86484 80768 14527 37370 63572 4391 40475 74540 56243 61883 49961 50113 67534 61330 70791 45388 68801 50186 59577 33389 26782 6562 4155 79691 10959 45759 1297 45521 28612 96117 94108 85980 90095 48575 92722 9075 25605 58555 98935 19914 98123 93356 94316 61153 29109 42454 20846 84806 87768 79883 43067 57146 17939 48889 4634 50671 86274 92467 37609 37887 46625 1499 14787 86564 75667 31371 62796 2051 95117 48100 35065 24321 81570 41856 6182 64543 89935 66742 71388 11417 90301 81790 59910 52374 90449 57453 29301 7152 12681 72797 50297 92341 91803 84499 25241 86786 44993 51423 27507 46408 96058 56852 11818 4164 83010 91933 43450 31616 75609 14764 76007 52888 67490 81284 76921 29103 94517 45496 93767 57276 1465 39279 74155 49408 68082 91876 54173 6983 52527 70718 37342 39407 6894 63766 14257 1396 58246 57610 33447 64317 1826 23705 53747 90349 38869 21598 90877 24726 72469 63346 50247 92936 50696 45621 40355 66441 88262 53756 69660 87047 58173 29008 94099 48149 88251 75804 37617 90309 44520 82212 13816 13680 84720 31993 5012 3280 31411 12455 93746 17372 65538 7857 38333 81730 78074 55554 45213 35731 28651 59156 4058 23081 80289 85934 53722 85712 17560 83537 17026 15553 80440 72786 25330 94186 79439 86705 42326 87258 84911 67988 51291 69415 66830 11244 74679 51473 89384 16790 99843 38857 61751 75306 68521 69974 6810 44624 57301 82402 45453 45400 75725 45872 49211 54037 94642 90050 86543 84643 36018 18487 9431 69614 97925 90778 12685 44355 31754 57153 16314 73013 55825 14811 76266 69790 51213 80108 73693 34261 93904 69314 65833 2589 31257 55828 3623 48139 82480 11134 71946 11857 77913 79818 7166 55318 46629 77680 45731 88802 75755 53070 26196 46133 13831 23004 62068 39317 38089 99922 55320 19234 23721 21751 75314 85600 77851 854 72051 14216 7636 16681 43076 24559 48642 27769 84107 59855 47439 56847 44252 41638 79412 64330 40279 17947 23523 58933 96651 81710 72627 6118 40002 81358 76192 68954 35747 64818 25906 40929 65157 39281 4563 63454 9451 4709 8877 23331 19922 62650 6313 33874 98002 5903 87159 33863 83471 30953 56111 70022 51574 60774 56088 60518 84380 68241 46226 69407 32610 9612 75375 33257 60352 35865 97845 84280 84408 14886 26332 32959 76664 12430 6101 73604 65497 35665 46245 24498 27 9846 68905 86889 90110 91448 12551 9450 36111 18252 99508 97108 87675 30208 92195 71938 11536 19138 30158 44419 77547 80470 31690 4216 19558 23902 3594 62983 7897 99859 41411 49657 51255 17043 69658 18794 43100 98985 13237 1369 26396 33396 39593 30659 34569 24874 56640 56585 21872 4867 25649 50578 18530 33197 42933 66051 81532 85263 19515 31187 82892 59762 2811 32008 86191 88186 63171 27265 68027 73179 97477 92522 141 47130 14675 1596 5355 91392 40912 35003 78551 54404 78494 56455 84540 88111 64785 39729 55086 67152 30230 50502 95418 82241 57878 79684 96818 85497 42107 47521 80565 4358 61321 93604 76424 88527 84015 85833 36509 97616 7215 67892 12375 31400 70200 28972 35792 88587 28984 40097 11797 86409 8091 87327 27584 19749 46962 87818 51304 9497 39274 75658 4976 49406 55392 12978 12566 81071 65531 70269 47092 37344 85556 37134 26634 99008 41427 82772 3925 36143 85145 34742 40646 79429 97688 72931 71134 73498 99281 90580 55810 48020 48964 77020 53403 23921 46590 65540 2468 16527 70922 \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog1/blog1Out.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog1/blog1Out.txt new file mode 100644 index 000000000..6ca729aab --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog1/blog1Out.txt @@ -0,0 +1,5904 @@ +7 +8 +3 +6 +6 + +2 +0 +9 +7 +5 + +9 +2 +2 +5 +6 + +1 +0 +2 +8 +5 + +2 +1 +5 +5 +3 + +6 +3 +0 +7 +5 + +6 +6 +0 +1 +1 + +7 +5 +4 +3 +4 + +4 +0 +7 +4 +5 + +9 +7 +7 +3 + +3 +2 +6 +7 +4 + +8 +1 +6 +7 +6 + +4 +7 +7 +8 + +2 +2 +4 +7 +5 + +9 +1 +9 +9 +8 + +9 +1 +5 +1 +5 + +8 +1 +3 +1 +5 + +4 +2 +6 +6 +0 + +3 +1 +5 +1 +7 + +1 +0 +7 +1 +2 + +5 +0 +6 +7 +5 + +2 +0 +6 +2 +6 + +7 +8 +8 +6 +9 + +9 +6 +1 +2 +4 + +5 +3 +9 +8 +4 + +6 +4 +5 +8 +1 + +3 +2 +7 +2 +2 + +8 +8 +6 +7 +5 + +5 +9 +9 +2 +8 + +8 +3 +3 +7 +8 + +1 +7 +8 +5 +9 + +3 +0 +2 +3 +9 + +5 +2 +4 +6 +0 + +7 +6 +5 +0 + +4 +2 +5 +0 +8 + +3 +8 +2 +7 +1 + +8 +2 +2 +2 +1 + +7 +0 +4 +6 +0 + +4 +5 +8 +3 +4 + +4 +4 +5 +6 +9 + +5 +0 +8 +0 +8 + +6 +8 +5 +4 +2 + +5 +2 +9 +6 +1 + +5 +4 +2 +8 +1 + +9 +3 +3 +1 +9 + +8 +6 +3 +3 +5 + +2 +9 +5 +7 +1 + +9 +5 +8 +9 +4 + +2 +6 +4 +3 + +8 +3 +7 +2 +0 + +1 +7 +9 +1 +0 + +7 +0 +3 +8 +8 + +1 +2 +8 +6 +1 + +9 +6 +4 +3 +7 + +8 +6 +8 +2 +2 + +6 +3 +5 +9 +2 + +8 +4 +7 +5 +4 + +2 +4 +5 +7 +5 + +6 +3 +2 +8 +8 + +3 +4 +4 +7 +6 + +5 +7 +7 +2 +1 + +6 +1 +3 +5 +4 + +4 +2 +3 +7 +6 + +8 +3 +3 +3 +4 + +2 +1 +2 +3 +5 + +3 +7 +9 +8 +3 + +9 +7 +8 +2 +3 + +2 +3 +7 +1 +3 + +9 +2 +3 +0 +3 + +9 +1 +8 +8 +3 + +9 +2 +7 +1 +5 + +3 +0 +0 +9 +2 + +7 +3 +6 +5 + +4 +4 +5 +9 + +1 +5 +9 +1 +8 + +3 +8 +6 +1 +0 + +4 +6 +7 +5 +0 + +8 +9 +0 +7 +9 + +6 +8 +9 +9 +4 + +2 +2 +0 +9 +4 + +2 +1 +4 +3 +5 + +3 +4 +9 +5 +5 + +3 +1 +0 +6 +7 + +4 +2 +9 +5 +9 + +8 +2 +0 +9 +9 + +4 +0 +0 +4 +3 + +9 +7 +9 +4 +7 + +7 +8 +2 +7 +8 + +3 +7 +3 +4 +7 + +3 +6 +9 +6 +2 + +5 +7 +2 +4 +0 + +2 +7 +5 +3 +0 + +6 +5 +0 +1 +7 + +9 +6 +5 +0 +1 + +7 +6 +6 +4 + +3 +2 +7 +9 +5 + +4 +7 +8 +2 +8 + +6 +1 +6 +5 +4 + +7 +2 +3 +6 + +9 +7 +1 +7 +8 + +5 +8 +5 +8 +9 + +2 +5 +5 +0 +5 + +6 +0 +1 +2 +6 + +4 +3 +0 +9 +4 + +8 +0 +3 +6 +1 + +4 +1 +6 +6 + +7 +9 +7 +0 +3 + +7 +6 +6 +6 +8 + +9 +2 +9 +1 +7 + +4 +9 +8 +9 +0 + +6 +6 +2 +3 +6 + +8 +7 +5 +3 +9 + +6 +5 +3 +8 +5 + +5 +7 +3 +1 +5 + +5 +1 +9 +4 +6 + +8 +0 +0 +8 +5 + +3 +9 +5 +2 +7 + +6 +6 +7 +3 +9 + +5 +4 +0 +9 +0 + +8 +4 +4 +8 +8 + +6 +0 +8 +8 +1 + +1 +1 +1 +6 +6 + +4 +7 +4 +1 +1 + +5 +5 +6 +3 +8 + +6 +0 +6 +0 +5 + +9 +5 +9 +9 +8 + +6 +7 +3 +7 + +4 +9 +3 +9 +9 + +7 +8 +7 +4 +6 + +8 +0 +9 +3 +8 + +7 +8 +9 +4 +9 + +1 +5 +1 +2 +5 + +1 +0 +6 +6 +4 + +2 +0 +5 +9 +1 + +3 +9 +3 +0 +8 + +2 +0 +9 +2 +9 + +4 +0 +0 +4 +0 + +7 +7 +7 +1 +7 + +7 +5 +3 +4 +8 + +1 +3 +2 +3 +8 + +1 +7 +4 +7 +5 + +6 +8 +5 +5 +7 + +2 +3 +9 + +2 +3 +7 +6 +3 + +5 +8 +8 +2 +5 + +7 +6 +6 +7 +8 + +3 +5 +1 +7 +5 + +4 +2 +7 +3 + +9 +5 +3 +4 +7 + +7 +0 +0 +9 +4 + +9 +5 +7 +8 +1 + +8 +0 +9 +0 +5 + +4 +2 +1 +3 +7 + +7 +9 +8 +8 +6 + +2 +4 +2 +0 +8 + +6 +2 +3 +8 +9 + +1 +2 +5 +7 +9 + +2 +9 +8 +2 +5 + +1 +2 +1 +2 +3 + +6 +4 +1 +4 +1 + +4 +4 +4 +1 +2 + +5 +7 +9 +0 +8 + +3 +2 +4 +9 +9 + +7 +3 +4 +3 +6 + +2 +4 +1 +7 +6 + +5 +1 +0 +3 +2 + +5 +8 +8 +5 +1 + +4 +1 +2 +6 +1 + +4 +2 +9 +0 +9 + +3 +3 +7 +8 +9 + +8 +0 +9 +9 +3 + +8 +4 +8 +2 +7 + +8 +6 +8 +0 +2 + +7 +7 +9 +5 + +7 +0 +5 +1 +7 + +3 +6 +1 +5 +1 + +4 +1 +0 +0 +3 + +5 +6 +8 +3 +1 + +9 +3 +5 +0 + +9 +3 +2 +0 +7 + +2 +3 +3 +8 +1 + +3 +8 +7 +8 +4 + +5 +0 +6 +3 +7 + +7 +1 +7 +9 + +1 +1 +5 +3 +4 + +3 +3 +0 +4 +0 + +3 +6 +9 +8 +3 + +2 +5 +9 +0 +9 + +1 +8 +3 +6 +7 + +2 +3 +3 +9 +5 + +6 +4 +9 +2 +6 + +7 +3 +2 +4 +7 + +4 +7 +5 +0 +3 + +8 +1 +2 +2 +8 + +1 +0 +0 +9 +2 + +6 +9 +0 +6 +5 + +1 +4 +3 +8 +9 + +4 +4 +1 +1 +1 + +7 +3 +1 +3 +8 + +7 +1 +4 +9 +0 + +4 +2 +4 +7 +3 + +6 +0 +2 +5 +5 + +5 +3 +3 +2 +3 + +7 +2 +2 +1 +9 + +3 +8 +1 +2 +4 + +9 +1 +7 +4 +8 + +1 +9 +4 +7 +6 + +5 +2 +7 +2 +9 + +5 +7 +5 +0 +9 + +3 +2 +0 +1 +9 + +1 +1 +5 +2 +3 + +9 +5 +6 +4 + +8 +9 +1 +3 +1 + +6 +9 +3 +3 +2 + +4 +0 +4 +7 +9 + +4 +5 +3 +1 +6 + +4 +4 +3 +2 +7 + +2 +5 +9 +3 +1 + +8 +4 +5 +6 +0 + +1 +9 +9 +2 +3 + +7 +0 +9 +4 +7 + +9 +9 +7 +9 +0 + +9 +1 +6 +6 +9 + +7 +8 +3 +8 +5 + +1 +8 +4 +2 + +3 +0 +1 +8 +4 + +9 +9 +8 +0 +9 + +7 +3 +6 +9 +8 + +4 +5 +2 +5 +9 + +5 +3 +7 +6 +3 + +9 +9 +1 +7 +4 + +4 +4 +2 +7 +6 + +5 +1 +1 +4 +7 + +8 +0 +6 +7 +9 + +7 +1 +8 +4 +6 + +9 +7 +2 +1 +1 + +6 +7 +6 +2 +8 + +7 +1 +7 +4 + +9 +8 +4 +8 +5 + +4 +9 +2 +1 +4 + +6 +0 +8 +9 +3 + +2 +4 +8 +2 +5 + +3 +5 +3 +4 +9 + +8 +4 +2 +4 +4 + +6 +3 +9 +4 +7 + +6 +0 +2 +6 +2 + +1 +9 +2 +9 +2 + +3 +9 +3 +2 +9 + +8 +4 +2 +0 +7 + +8 +1 +0 +5 +5 + +2 +6 +4 +2 +4 + +6 +7 +7 +0 +1 + +3 +3 +3 +9 +2 + +5 +9 +2 +5 +9 + +7 +8 +2 +2 +3 + +9 +4 +2 +3 +9 + +7 +5 +1 +2 +5 + +1 +3 +9 +6 +5 + +8 +7 +7 +8 +2 + +3 +1 +7 +0 +7 + +9 +6 +8 +6 +1 + +7 +5 +6 +2 + +9 +8 +5 +5 +3 + +9 +3 +6 +8 +7 + +2 +3 +6 +3 +5 + +2 +5 +3 +6 + +9 +5 +7 +0 +0 + +5 +0 +4 +6 +9 + +4 +6 +5 +8 +4 + +8 +1 +7 +0 +3 + +5 +6 +4 +9 +2 + +1 +5 +1 +2 +8 + +8 +5 +3 +6 +4 + +8 +7 +3 +9 + +3 +0 +4 +9 +5 + +4 +6 +8 +7 +1 + +7 +1 +8 +2 +1 + +1 +2 +8 +2 +9 + +6 +4 +7 +8 +9 + +1 +8 +6 +6 +0 + +3 +7 +9 +2 +3 + +8 +5 +7 +5 +5 + +9 +7 +6 +1 + +7 +1 +6 +5 +3 + +4 +2 +5 +7 +6 + +3 +8 +0 +5 +0 + +7 +3 +2 +6 +3 + +9 +7 +5 +6 +3 + +3 +0 +7 +9 + +3 +9 +2 +2 +8 + +8 +4 +1 +9 +8 + +8 +8 +7 +2 + +8 +7 +0 +9 +8 + +3 +5 +9 +4 +1 + +6 +6 +9 +7 +3 + +7 +6 +9 +7 +9 + +3 +2 +9 +9 +4 + +8 +6 +0 +9 +8 + +1 +0 +6 +9 +0 + +4 +1 +4 +4 +3 + +2 +8 +3 +3 +3 + +1 +5 +1 +8 +9 + +4 +5 +3 +1 +3 + +6 +5 +0 +4 +0 + +4 +0 +2 +0 +3 + +9 +8 +8 +4 +4 + +4 +6 +8 +1 +9 + +4 +7 +1 +1 +8 + +1 +8 +5 +8 +8 + +9 +2 +8 +2 +0 + +5 +9 +3 +5 +2 + +5 +9 +5 +1 +9 + +5 +7 +7 +1 +9 + +2 +4 +8 +4 +2 + +4 +6 +3 +7 +8 + +1 +9 +3 +8 +9 + +8 +2 +4 +3 +3 + +1 +4 +5 +7 +2 + +1 +9 +5 +0 +6 + +2 +2 +7 +2 +9 + +7 +1 +3 +5 +0 + +3 +0 +2 +3 +4 + +9 +4 +4 +1 +7 + +3 +0 +5 +3 +8 + +1 +4 +4 +3 +9 + +9 +4 +1 +0 +4 + +2 +2 +5 +4 +1 + +9 +4 +7 +6 +5 + +1 +6 +6 +1 +4 + +3 +1 +3 +8 +7 + +9 +0 +7 +1 + +3 +8 +5 +1 +7 + +7 +3 +9 +5 +7 + +9 +0 +7 +6 +3 + +8 +8 +3 +0 +8 + +9 +3 +4 +5 + +8 +1 +1 +6 +2 + +4 +0 +4 +1 +1 + +1 +7 +3 +2 +7 + +2 +1 +8 +7 +3 + +3 +7 +6 +9 +1 + +3 +2 +9 +0 +8 + +1 +2 +4 +4 +1 + +2 +2 +9 +8 +3 + +1 +5 +7 +1 +0 + +4 +8 +2 +8 +3 + +1 +0 +6 +6 +6 + +1 +8 +6 +7 + +4 +3 +3 +9 +3 + +2 +0 +1 +3 +9 + +5 +3 +7 +3 +5 + +6 +9 +4 +7 +6 + +2 +6 +4 +6 +9 + +6 +4 +5 +1 +9 + +4 +8 +1 +5 +6 + +4 +2 +0 +1 +4 + +2 +9 +7 +7 +6 + +8 +1 +4 +4 +9 + +7 +4 +7 +9 +0 + +3 +6 +6 +2 +0 + +6 +3 +8 +7 +6 + +6 +6 +2 +7 +8 + +3 +1 +7 +3 +8 + +5 +7 +7 +0 +1 + +8 +6 +1 +6 +7 + +2 +2 +8 +2 +8 + +1 +4 +6 +1 +7 + +2 +9 +3 +6 +3 + +2 +5 +7 +0 +7 + +3 +7 +9 +4 +2 + +9 +3 +1 +3 +0 + +7 +9 +9 +9 +4 + +3 +0 +2 +1 +9 + +2 +7 +9 + +1 +1 +9 +8 +0 + +3 +3 +0 +4 +1 + +1 +4 +6 +6 +9 + +4 +2 +3 +7 + +2 +6 +8 +4 +8 + +3 +4 +2 +5 +4 + +4 +3 +3 +5 +9 + +6 +9 +8 +3 +0 + +1 +6 +1 +5 + +3 +9 +1 +8 + +5 +2 +5 +7 +0 + +9 +2 +2 +9 +2 + +5 +5 +5 +8 +2 + +4 +5 +1 +3 +5 + +8 +2 +8 +0 +0 + +4 +3 +6 +0 +3 + +5 +0 +5 +5 +1 + +5 +4 +0 +3 +9 + +7 +5 +3 +9 +1 + +2 +1 +2 +4 +9 + +8 +4 +5 +1 +7 + +6 +8 +5 +5 + +3 +5 +8 +8 +2 + +6 +9 +0 +4 +5 + +2 +8 +7 +1 +0 + +4 +9 +0 +2 +3 + +7 +5 +0 +6 +0 + +9 +1 +4 +9 +0 + +7 +3 +9 +5 +4 + +2 +9 +5 +2 +4 + +7 +6 +0 +0 +0 + +8 +2 +8 +1 +5 + +2 +9 +6 +9 +2 + +3 +4 +9 +4 + +3 +7 +3 +2 +0 + +2 +9 +1 +7 +6 + +1 +3 +9 +1 +7 + +8 +3 +5 +9 +5 + +7 +5 +2 +9 +6 + +4 +8 +7 +9 +1 + +2 +2 +5 +5 +0 + +5 +8 +3 +6 +9 + +4 +7 +9 +4 +1 + +1 +4 +4 +8 +6 + +1 +3 +6 +4 +5 + +3 +6 +5 +6 +6 + +6 +5 +8 +5 +4 + +2 +1 +7 +8 +8 + +5 +7 +0 +5 +0 + +1 +1 +2 +1 +8 + +5 +4 +2 +6 +0 + +5 +1 +7 +5 +2 + +6 +1 +9 +0 + +7 +5 +1 +8 +1 + +2 +4 +6 +5 +6 + +2 +3 +0 +0 +8 + +9 +9 +6 +8 +2 + +3 +7 +9 +3 +2 + +2 +1 +2 +6 +1 + +7 +4 +2 +9 +2 + +6 +1 +8 +5 +5 + +8 +6 +7 +6 +6 + +3 +7 +4 +0 +5 + +4 +9 +9 +6 +5 + +3 +6 +6 +4 +8 + +7 +0 +6 +8 +2 + +2 +9 +0 +4 +5 + +8 +0 +1 +9 +9 + +9 +9 +1 +6 +4 + +6 +0 +5 +4 +7 + +3 +2 +7 +4 +4 + +1 +1 +0 +6 +4 + +3 +0 +6 +0 +0 + +7 +0 +2 +9 +4 + +5 +6 +7 +4 +1 + +8 +8 +0 +4 +3 + +3 +9 +0 +4 +8 + +4 +5 +7 +1 +1 + +7 +2 +3 +8 +7 + +8 +6 +4 +8 +4 + +8 +0 +7 +6 +8 + +1 +4 +5 +2 +7 + +3 +7 +3 +7 +0 + +6 +3 +5 +7 +2 + +4 +3 +9 +1 + +4 +0 +4 +7 +5 + +7 +4 +5 +4 +0 + +5 +6 +2 +4 +3 + +6 +1 +8 +8 +3 + +4 +9 +9 +6 +1 + +5 +0 +1 +1 +3 + +6 +7 +5 +3 +4 + +6 +1 +3 +3 +0 + +7 +0 +7 +9 +1 + +4 +5 +3 +8 +8 + +6 +8 +8 +0 +1 + +5 +0 +1 +8 +6 + +5 +9 +5 +7 +7 + +3 +3 +3 +8 +9 + +2 +6 +7 +8 +2 + +6 +5 +6 +2 + +4 +1 +5 +5 + +7 +9 +6 +9 +1 + +1 +0 +9 +5 +9 + +4 +5 +7 +5 +9 + +1 +2 +9 +7 + +4 +5 +5 +2 +1 + +2 +8 +6 +1 +2 + +9 +6 +1 +1 +7 + +9 +4 +1 +0 +8 + +8 +5 +9 +8 +0 + +9 +0 +0 +9 +5 + +4 +8 +5 +7 +5 + +9 +2 +7 +2 +2 + +9 +0 +7 +5 + +2 +5 +6 +0 +5 + +5 +8 +5 +5 +5 + +9 +8 +9 +3 +5 + +1 +9 +9 +1 +4 + +9 +8 +1 +2 +3 + +9 +3 +3 +5 +6 + +9 +4 +3 +1 +6 + +6 +1 +1 +5 +3 + +2 +9 +1 +0 +9 + +4 +2 +4 +5 +4 + +2 +0 +8 +4 +6 + +8 +4 +8 +0 +6 + +8 +7 +7 +6 +8 + +7 +9 +8 +8 +3 + +4 +3 +0 +6 +7 + +5 +7 +1 +4 +6 + +1 +7 +9 +3 +9 + +4 +8 +8 +8 +9 + +4 +6 +3 +4 + +5 +0 +6 +7 +1 + +8 +6 +2 +7 +4 + +9 +2 +4 +6 +7 + +3 +7 +6 +0 +9 + +3 +7 +8 +8 +7 + +4 +6 +6 +2 +5 + +1 +4 +9 +9 + +1 +4 +7 +8 +7 + +8 +6 +5 +6 +4 + +7 +5 +6 +6 +7 + +3 +1 +3 +7 +1 + +6 +2 +7 +9 +6 + +2 +0 +5 +1 + +9 +5 +1 +1 +7 + +4 +8 +1 +0 +0 + +3 +5 +0 +6 +5 + +2 +4 +3 +2 +1 + +8 +1 +5 +7 +0 + +4 +1 +8 +5 +6 + +6 +1 +8 +2 + +6 +4 +5 +4 +3 + +8 +9 +9 +3 +5 + +6 +6 +7 +4 +2 + +7 +1 +3 +8 +8 + +1 +1 +4 +1 +7 + +9 +0 +3 +0 +1 + +8 +1 +7 +9 +0 + +5 +9 +9 +1 +0 + +5 +2 +3 +7 +4 + +9 +0 +4 +4 +9 + +5 +7 +4 +5 +3 + +2 +9 +3 +0 +1 + +7 +1 +5 +2 + +1 +2 +6 +8 +1 + +7 +2 +7 +9 +7 + +5 +0 +2 +9 +7 + +9 +2 +3 +4 +1 + +9 +1 +8 +0 +3 + +8 +4 +4 +9 +9 + +2 +5 +2 +4 +1 + +8 +6 +7 +8 +6 + +4 +4 +9 +9 +3 + +5 +1 +4 +2 +3 + +2 +7 +5 +0 +7 + +4 +6 +4 +0 +8 + +9 +6 +0 +5 +8 + +5 +6 +8 +5 +2 + +1 +1 +8 +1 +8 + +4 +1 +6 +4 + +8 +3 +0 +1 +0 + +9 +1 +9 +3 +3 + +4 +3 +4 +5 +0 + +3 +1 +6 +1 +6 + +7 +5 +6 +0 +9 + +1 +4 +7 +6 +4 + +7 +6 +0 +0 +7 + +5 +2 +8 +8 +8 + +6 +7 +4 +9 +0 + +8 +1 +2 +8 +4 + +7 +6 +9 +2 +1 + +2 +9 +1 +0 +3 + +9 +4 +5 +1 +7 + +4 +5 +4 +9 +6 + +9 +3 +7 +6 +7 + +5 +7 +2 +7 +6 + +1 +4 +6 +5 + +3 +9 +2 +7 +9 + +7 +4 +1 +5 +5 + +4 +9 +4 +0 +8 + +6 +8 +0 +8 +2 + +9 +1 +8 +7 +6 + +5 +4 +1 +7 +3 + +6 +9 +8 +3 + +5 +2 +5 +2 +7 + +7 +0 +7 +1 +8 + +3 +7 +3 +4 +2 + +3 +9 +4 +0 +7 + +6 +8 +9 +4 + +6 +3 +7 +6 +6 + +1 +4 +2 +5 +7 + +1 +3 +9 +6 + +5 +8 +2 +4 +6 + +5 +7 +6 +1 +0 + +3 +3 +4 +4 +7 + +6 +4 +3 +1 +7 + +1 +8 +2 +6 + +2 +3 +7 +0 +5 + +5 +3 +7 +4 +7 + +9 +0 +3 +4 +9 + +3 +8 +8 +6 +9 + +2 +1 +5 +9 +8 + +9 +0 +8 +7 +7 + +2 +4 +7 +2 +6 + +7 +2 +4 +6 +9 + +6 +3 +3 +4 +6 + +5 +0 +2 +4 +7 + +9 +2 +9 +3 +6 + +5 +0 +6 +9 +6 + +4 +5 +6 +2 +1 + +4 +0 +3 +5 +5 + +6 +6 +4 +4 +1 + +8 +8 +2 +6 +2 + +5 +3 +7 +5 +6 + +6 +9 +6 +6 +0 + +8 +7 +0 +4 +7 + +5 +8 +1 +7 +3 + +2 +9 +0 +0 +8 + +9 +4 +0 +9 +9 + +4 +8 +1 +4 +9 + +8 +8 +2 +5 +1 + +7 +5 +8 +0 +4 + +3 +7 +6 +1 +7 + +9 +0 +3 +0 +9 + +4 +4 +5 +2 +0 + +8 +2 +2 +1 +2 + +1 +3 +8 +1 +6 + +1 +3 +6 +8 +0 + +8 +4 +7 +2 +0 + +3 +1 +9 +9 +3 + +5 +0 +1 +2 + +3 +2 +8 +0 + +3 +1 +4 +1 +1 + +1 +2 +4 +5 +5 + +9 +3 +7 +4 +6 + +1 +7 +3 +7 +2 + +6 +5 +5 +3 +8 + +7 +8 +5 +7 + +3 +8 +3 +3 +3 + +8 +1 +7 +3 +0 + +7 +8 +0 +7 +4 + +5 +5 +5 +5 +4 + +4 +5 +2 +1 +3 + +3 +5 +7 +3 +1 + +2 +8 +6 +5 +1 + +5 +9 +1 +5 +6 + +4 +0 +5 +8 + +2 +3 +0 +8 +1 + +8 +0 +2 +8 +9 + +8 +5 +9 +3 +4 + +5 +3 +7 +2 +2 + +8 +5 +7 +1 +2 + +1 +7 +5 +6 +0 + +8 +3 +5 +3 +7 + +1 +7 +0 +2 +6 + +1 +5 +5 +5 +3 + +8 +0 +4 +4 +0 + +7 +2 +7 +8 +6 + +2 +5 +3 +3 +0 + +9 +4 +1 +8 +6 + +7 +9 +4 +3 +9 + +8 +6 +7 +0 +5 + +4 +2 +3 +2 +6 + +8 +7 +2 +5 +8 + +8 +4 +9 +1 +1 + +6 +7 +9 +8 +8 + +5 +1 +2 +9 +1 + +6 +9 +4 +1 +5 + +6 +6 +8 +3 +0 + +1 +1 +2 +4 +4 + +7 +4 +6 +7 +9 + +5 +1 +4 +7 +3 + +8 +9 +3 +8 +4 + +1 +6 +7 +9 +0 + +9 +9 +8 +4 +3 + +3 +8 +8 +5 +7 + +6 +1 +7 +5 +1 + +7 +5 +3 +0 +6 + +6 +8 +5 +2 +1 + +6 +9 +9 +7 +4 + +6 +8 +1 +0 + +4 +4 +6 +2 +4 + +5 +7 +3 +0 +1 + +8 +2 +4 +0 +2 + +4 +5 +4 +5 +3 + +4 +5 +4 +0 +0 + +7 +5 +7 +2 +5 + +4 +5 +8 +7 +2 + +4 +9 +2 +1 +1 + +5 +4 +0 +3 +7 + +9 +4 +6 +4 +2 + +9 +0 +0 +5 +0 + +8 +6 +5 +4 +3 + +8 +4 +6 +4 +3 + +3 +6 +0 +1 +8 + +1 +8 +4 +8 +7 + +9 +4 +3 +1 + +6 +9 +6 +1 +4 + +9 +7 +9 +2 +5 + +9 +0 +7 +7 +8 + +1 +2 +6 +8 +5 + +4 +4 +3 +5 +5 + +3 +1 +7 +5 +4 + +5 +7 +1 +5 +3 + +1 +6 +3 +1 +4 + +7 +3 +0 +1 +3 + +5 +5 +8 +2 +5 + +1 +4 +8 +1 +1 + +7 +6 +2 +6 +6 + +6 +9 +7 +9 +0 + +5 +1 +2 +1 +3 + +8 +0 +1 +0 +8 + +7 +3 +6 +9 +3 + +3 +4 +2 +6 +1 + +9 +3 +9 +0 +4 + +6 +9 +3 +1 +4 + +6 +5 +8 +3 +3 + +2 +5 +8 +9 + +3 +1 +2 +5 +7 + +5 +5 +8 +2 +8 + +3 +6 +2 +3 + +4 +8 +1 +3 +9 + +8 +2 +4 +8 +0 + +1 +1 +1 +3 +4 + +7 +1 +9 +4 +6 + +1 +1 +8 +5 +7 + +7 +7 +9 +1 +3 + +7 +9 +8 +1 +8 + +7 +1 +6 +6 + +5 +5 +3 +1 +8 + +4 +6 +6 +2 +9 + +7 +7 +6 +8 +0 + +4 +5 +7 +3 +1 + +8 +8 +8 +0 +2 + +7 +5 +7 +5 +5 + +5 +3 +0 +7 +0 + +2 +6 +1 +9 +6 + +4 +6 +1 +3 +3 + +1 +3 +8 +3 +1 + +2 +3 +0 +0 +4 + +6 +2 +0 +6 +8 + +3 +9 +3 +1 +7 + +3 +8 +0 +8 +9 + +9 +9 +9 +2 +2 + +5 +5 +3 +2 +0 + +1 +9 +2 +3 +4 + +2 +3 +7 +2 +1 + +2 +1 +7 +5 +1 + +7 +5 +3 +1 +4 + +8 +5 +6 +0 +0 + +7 +7 +8 +5 +1 + +8 +5 +4 + +7 +2 +0 +5 +1 + +1 +4 +2 +1 +6 + +7 +6 +3 +6 + +1 +6 +6 +8 +1 + +4 +3 +0 +7 +6 + +2 +4 +5 +5 +9 + +4 +8 +6 +4 +2 + +2 +7 +7 +6 +9 + +8 +4 +1 +0 +7 + +5 +9 +8 +5 +5 + +4 +7 +4 +3 +9 + +5 +6 +8 +4 +7 + +4 +4 +2 +5 +2 + +4 +1 +6 +3 +8 + +7 +9 +4 +1 +2 + +6 +4 +3 +3 +0 + +4 +0 +2 +7 +9 + +1 +7 +9 +4 +7 + +2 +3 +5 +2 +3 + +5 +8 +9 +3 +3 + +9 +6 +6 +5 +1 + +8 +1 +7 +1 +0 + +7 +2 +6 +2 +7 + +6 +1 +1 +8 + +4 +0 +0 +0 +2 + +8 +1 +3 +5 +8 + +7 +6 +1 +9 +2 + +6 +8 +9 +5 +4 + +3 +5 +7 +4 +7 + +6 +4 +8 +1 +8 + +2 +5 +9 +0 +6 + +4 +0 +9 +2 +9 + +6 +5 +1 +5 +7 + +3 +9 +2 +8 +1 + +4 +5 +6 +3 + +6 +3 +4 +5 +4 + +9 +4 +5 +1 + +4 +7 +0 +9 + +8 +8 +7 +7 + +2 +3 +3 +3 +1 + +1 +9 +9 +2 +2 + +6 +2 +6 +5 +0 + +6 +3 +1 +3 + +3 +3 +8 +7 +4 + +9 +8 +0 +0 +2 + +5 +9 +0 +3 + +8 +7 +1 +5 +9 + +3 +3 +8 +6 +3 + +8 +3 +4 +7 +1 + +3 +0 +9 +5 +3 + +5 +6 +1 +1 +1 + +7 +0 +0 +2 +2 + +5 +1 +5 +7 +4 + +6 +0 +7 +7 +4 + +5 +6 +0 +8 +8 + +6 +0 +5 +1 +8 + +8 +4 +3 +8 +0 + +6 +8 +2 +4 +1 + +4 +6 +2 +2 +6 + +6 +9 +4 +0 +7 + +3 +2 +6 +1 +0 + +9 +6 +1 +2 + +7 +5 +3 +7 +5 + +3 +3 +2 +5 +7 + +6 +0 +3 +5 +2 + +3 +5 +8 +6 +5 + +9 +7 +8 +4 +5 + +8 +4 +2 +8 +0 + +8 +4 +4 +0 +8 + +1 +4 +8 +8 +6 + +2 +6 +3 +3 +2 + +3 +2 +9 +5 +9 + +7 +6 +6 +6 +4 + +1 +2 +4 +3 +0 + +6 +1 +0 +1 + +7 +3 +6 +0 +4 + +6 +5 +4 +9 +7 + +3 +5 +6 +6 +5 + +4 +6 +2 +4 +5 + +2 +4 +4 +9 +8 + +2 +7 + +9 +8 +4 +6 + +6 +8 +9 +0 +5 + +8 +6 +8 +8 +9 + +9 +0 +1 +1 +0 + +9 +1 +4 +4 +8 + +1 +2 +5 +5 +1 + +9 +4 +5 +0 + +3 +6 +1 +1 +1 + +1 +8 +2 +5 +2 + +9 +9 +5 +0 +8 + +9 +7 +1 +0 +8 + +8 +7 +6 +7 +5 + +3 +0 +2 +0 +8 + +9 +2 +1 +9 +5 + +7 +1 +9 +3 +8 + +1 +1 +5 +3 +6 + +1 +9 +1 +3 +8 + +3 +0 +1 +5 +8 + +4 +4 +4 +1 +9 + +7 +7 +5 +4 +7 + +8 +0 +4 +7 +0 + +3 +1 +6 +9 +0 + +4 +2 +1 +6 + +1 +9 +5 +5 +8 + +2 +3 +9 +0 +2 + +3 +5 +9 +4 + +6 +2 +9 +8 +3 + +7 +8 +9 +7 + +9 +9 +8 +5 +9 + +4 +1 +4 +1 +1 + +4 +9 +6 +5 +7 + +5 +1 +2 +5 +5 + +1 +7 +0 +4 +3 + +6 +9 +6 +5 +8 + +1 +8 +7 +9 +4 + +4 +3 +1 +0 +0 + +9 +8 +9 +8 +5 + +1 +3 +2 +3 +7 + +1 +3 +6 +9 + +2 +6 +3 +9 +6 + +3 +3 +3 +9 +6 + +3 +9 +5 +9 +3 + +3 +0 +6 +5 +9 + +3 +4 +5 +6 +9 + +2 +4 +8 +7 +4 + +5 +6 +6 +4 +0 + +5 +6 +5 +8 +5 + +2 +1 +8 +7 +2 + +4 +8 +6 +7 + +2 +5 +6 +4 +9 + +5 +0 +5 +7 +8 + +1 +8 +5 +3 +0 + +3 +3 +1 +9 +7 + +4 +2 +9 +3 +3 + +6 +6 +0 +5 +1 + +8 +1 +5 +3 +2 + +8 +5 +2 +6 +3 + +1 +9 +5 +1 +5 + +3 +1 +1 +8 +7 + +8 +2 +8 +9 +2 + +5 +9 +7 +6 +2 + +2 +8 +1 +1 + +3 +2 +0 +0 +8 + +8 +6 +1 +9 +1 + +8 +8 +1 +8 +6 + +6 +3 +1 +7 +1 + +2 +7 +2 +6 +5 + +6 +8 +0 +2 +7 + +7 +3 +1 +7 +9 + +9 +7 +4 +7 +7 + +9 +2 +5 +2 +2 + +1 +4 +1 + +4 +7 +1 +3 +0 + +1 +4 +6 +7 +5 + +1 +5 +9 +6 + +5 +3 +5 +5 + +9 +1 +3 +9 +2 + +4 +0 +9 +1 +2 + +3 +5 +0 +0 +3 + +7 +8 +5 +5 +1 + +5 +4 +4 +0 +4 + +7 +8 +4 +9 +4 + +5 +6 +4 +5 +5 + +8 +4 +5 +4 +0 + +8 +8 +1 +1 +1 + +6 +4 +7 +8 +5 + +3 +9 +7 +2 +9 + +5 +5 +0 +8 +6 + +6 +7 +1 +5 +2 + +3 +0 +2 +3 +0 + +5 +0 +5 +0 +2 + +9 +5 +4 +1 +8 + +8 +2 +2 +4 +1 + +5 +7 +8 +7 +8 + +7 +9 +6 +8 +4 + +9 +6 +8 +1 +8 + +8 +5 +4 +9 +7 + +4 +2 +1 +0 +7 + +4 +7 +5 +2 +1 + +8 +0 +5 +6 +5 + +4 +3 +5 +8 + +6 +1 +3 +2 +1 + +9 +3 +6 +0 +4 + +7 +6 +4 +2 +4 + +8 +8 +5 +2 +7 + +8 +4 +0 +1 +5 + +8 +5 +8 +3 +3 + +3 +6 +5 +0 +9 + +9 +7 +6 +1 +6 + +7 +2 +1 +5 + +6 +7 +8 +9 +2 + +1 +2 +3 +7 +5 + +3 +1 +4 +0 +0 + +7 +0 +2 +0 +0 + +2 +8 +9 +7 +2 + +3 +5 +7 +9 +2 + +8 +8 +5 +8 +7 + +2 +8 +9 +8 +4 + +4 +0 +0 +9 +7 + +1 +1 +7 +9 +7 + +8 +6 +4 +0 +9 + +8 +0 +9 +1 + +8 +7 +3 +2 +7 + +2 +7 +5 +8 +4 + +1 +9 +7 +4 +9 + +4 +6 +9 +6 +2 + +8 +7 +8 +1 +8 + +5 +1 +3 +0 +4 + +9 +4 +9 +7 + +3 +9 +2 +7 +4 + +7 +5 +6 +5 +8 + +4 +9 +7 +6 + +4 +9 +4 +0 +6 + +5 +5 +3 +9 +2 + +1 +2 +9 +7 +8 + +1 +2 +5 +6 +6 + +8 +1 +0 +7 +1 + +6 +5 +5 +3 +1 + +7 +0 +2 +6 +9 + +4 +7 +0 +9 +2 + +3 +7 +3 +4 +4 + +8 +5 +5 +5 +6 + +3 +7 +1 +3 +4 + +2 +6 +6 +3 +4 + +9 +9 +0 +0 +8 + +4 +1 +4 +2 +7 + +8 +2 +7 +7 +2 + +3 +9 +2 +5 + +3 +6 +1 +4 +3 + +8 +5 +1 +4 +5 + +3 +4 +7 +4 +2 + +4 +0 +6 +4 +6 + +7 +9 +4 +2 +9 + +9 +7 +6 +8 +8 + +7 +2 +9 +3 +1 + +7 +1 +1 +3 +4 + +7 +3 +4 +9 +8 + +9 +9 +2 +8 +1 + +9 +0 +5 +8 +0 + +5 +5 +8 +1 +0 + +4 +8 +0 +2 +0 + +4 +8 +9 +6 +4 + +7 +7 +0 +2 +0 + +5 +3 +4 +0 +3 + +2 +3 +9 +2 +1 + +4 +6 +5 +9 +0 + +6 +5 +5 +4 +0 + +2 +4 +6 +8 + +1 +6 +5 +2 +7 + +7 +0 +9 +2 +2 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog1/blog1Tag.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog1/blog1Tag.txt new file mode 100644 index 000000000..a0138e8cf --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog1/blog1Tag.txt @@ -0,0 +1,500 @@ +3 +1 +5 +1 +7 + +9 +3 +3 +1 +9 + +8 +7 +5 +3 +9 + +6 +6 +7 +3 +9 + +6 +7 +3 +7 + +2 +0 +9 +2 +9 + +2 +3 +9 + +4 +2 +7 +3 + +8 +4 +8 +2 +7 + +3 +6 +1 +5 +1 + +1 +8 +3 +6 +7 + +1 +4 +3 +8 +9 + +4 +4 +1 +1 +1 + +4 +2 +4 +7 +3 + +5 +3 +3 +2 +3 + +2 +5 +9 +3 +1 + +9 +9 +8 +0 +9 + +4 +5 +2 +5 +9 + +8 +1 +7 +0 +3 + +7 +1 +8 +2 +1 + +1 +2 +8 +2 +9 + +3 +0 +7 +9 + +6 +6 +9 +7 +3 + +4 +1 +4 +4 +3 + +4 +6 +8 +1 +9 + +5 +7 +7 +1 +9 + +2 +2 +5 +4 +1 + +3 +1 +3 +8 +7 + +1 +7 +3 +2 +7 + +3 +7 +6 +9 +1 + +1 +8 +6 +7 + +2 +9 +3 +6 +3 + +1 +4 +6 +6 +9 + +5 +0 +5 +5 +1 + +7 +5 +3 +9 +1 + +5 +8 +3 +6 +9 + +7 +5 +1 +8 +1 + +4 +3 +9 +1 + +7 +9 +6 +9 +1 + +1 +2 +9 +7 + +9 +8 +1 +2 +3 + +6 +1 +1 +5 +3 + +4 +3 +0 +6 +7 + +1 +7 +9 +3 +9 + +4 +8 +8 +8 +9 + +5 +0 +6 +7 +1 + +9 +2 +4 +6 +7 + +1 +4 +9 +9 + +7 +2 +7 +9 +7 + +8 +4 +4 +9 +9 + +6 +9 +8 +3 + +7 +2 +4 +6 +9 + +9 +4 +0 +9 +9 + +3 +8 +3 +3 +3 + +3 +5 +7 +3 +1 + +2 +3 +0 +8 +1 + +8 +3 +5 +3 +7 + +5 +1 +4 +7 +3 + +6 +1 +7 +5 +1 + +6 +8 +5 +2 +1 + +5 +7 +3 +0 +1 + +4 +9 +2 +1 +1 + +5 +4 +0 +3 +7 + +9 +4 +3 +1 + +7 +3 +0 +1 +3 + +7 +3 +6 +9 +3 + +3 +4 +2 +6 +1 + +3 +6 +2 +3 + +4 +6 +1 +3 +3 + +1 +3 +8 +3 +1 + +3 +9 +3 +1 +7 + +2 +1 +7 +5 +1 + +3 +5 +7 +4 +7 + +5 +9 +0 +3 + +3 +3 +8 +6 +3 + +8 +3 +4 +7 +1 + +6 +1 +0 +1 + +6 +5 +4 +9 +7 + +6 +2 +9 +8 +3 + +9 +9 +8 +5 +9 + +4 +1 +4 +1 +1 + +8 +2 +2 +4 +1 + +4 +7 +5 +2 +1 + +9 +4 +9 +7 + +8 +1 +0 +7 +1 + +7 +2 +9 +3 +1 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog10/blog10.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog10/blog10.txt new file mode 100644 index 000000000..e5e50ceef --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog10/blog10.txt @@ -0,0 +1 @@ +35010 36640 34062 9119 87231 44596 31687 54874 88186 85467 4828 85349 46539 37414 11722 87290 52693 8399 65687 20424 16837 52545 73086 92981 64904 2674 87535 95712 91810 1253 96493 43909 85752 49631 96709 81346 69577 99800 2129 73787 5902 14310 50818 84818 31360 59849 40096 76121 51292 53202 97910 33683 92883 26223 37500 45148 40918 85778 17542 20240 18469 25581 1875 81756 32267 52178 91738 81769 32745 25967 80533 71159 78908 27530 86457 82252 65951 58245 45697 7848 59303 13532 90144 9715 29781 11705 46137 97440 24368 44172 42182 910 2094 93636 69496 98531 87145 21684 50310 3013 83565 2107 266 34940 93426 35543 86691 30266 86751 65963 86058 47286 74154 27637 43671 59360 88475 69287 41747 94734 25806 26657 29052 86931 7654 57833 37903 36510 2891 39014 77762 82333 79886 8271 56495 71050 930 32069 83315 72808 28126 1422 26763 83863 35408 52543 55708 94273 99133 18994 26016 91811 27830 66688 32649 92140 82436 86559 19953 23193 4851 72447 85828 11785 51615 42258 79713 81 62042 93871 98126 66656 68372 71849 51525 47478 73413 34199 88251 38820 46563 59131 83628 70676 47838 74711 61919 98240 56445 78161 29245 28553 78567 1359 88210 26583 34240 92115 94877 38539 45547 85218 95035 82136 57321 35145 32245 46593 98411 55348 83474 18971 53045 50271 82952 46029 90602 13744 25642 39807 54834 54368 91437 76808 77375 48959 99891 37358 53250 7882 38 15653 57478 46330 10108 26940 79608 39206 6305 13802 46886 90690 58204 88003 44767 1487 31613 41739 16680 40760 7923 33757 51413 46202 52850 28440 16412 2972 12875 42480 88608 69195 83909 98645 49262 31910 33636 42620 72140 66561 76183 16950 96381 77192 13190 77480 86799 47896 14534 75513 75414 48948 43536 40573 43431 78447 33805 78438 20426 48861 47581 54065 38042 34432 25532 87896 83982 71472 48556 60789 44276 66512 90898 26354 2926 9913 4535 37935 64453 86488 72291 7836 75217 28304 1088 22668 93589 67142 80179 72825 24607 63003 33903 53032 37418 69503 54517 95925 97208 81297 56283 14749 6400 66880 63627 32865 14880 71302 677 61414 19165 99428 92288 42770 9003 96126 63037 54189 83037 73516 15018 20628 13762 87569 87989 70639 76724 29398 10207 10731 42789 84193 80187 33098 79806 8675 44842 46385 27377 30409 59653 23806 1868 40425 81066 73860 84928 50839 20340 17616 84937 89878 85734 6015 99512 77044 46349 70402 34249 92477 61347 28439 94364 11762 25258 20629 70420 54925 95691 69959 71974 32149 12916 97923 42785 35435 22670 19844 62060 49298 49855 27303 11662 60543 31139 22842 24181 77797 52360 8992 69597 94117 21010 53439 88754 98120 15096 26213 16872 15788 7694 92841 47371 21404 50067 39781 55151 74869 74616 24174 41360 4765 19965 36440 53934 40485 7990 10360 66527 52434 48446 74566 22796 68335 88462 43883 30626 16499 18277 26876 82284 63872 88089 117 78883 34296 58803 68076 88555 58665 57770 93436 56877 75774 41833 88492 61236 9577 91707 27178 37962 86173 65798 39988 88334 88222 59631 19823 8250 33006 72557 31383 76626 62061 38396 90705 82086 59274 88044 41074 21973 12891 4457 96631 72272 5816 8328 41810 95091 58023 95631 56339 22581 52555 83498 87972 94904 10922 52847 8302 30209 45176 13301 79443 76238 77430 12700 97653 13184 89792 97627 30819 8438 5371 83080 12382 2686 28406 42069 52066 38220 62075 71245 7032 18919 73146 5276 54134 4815 52288 31273 93865 9082 17693 37783 1882 5118 5189 31762 69312 85808 16530 14639 57525 10202 88006 63860 68919 14013 49143 11756 31587 4424 31334 17682 32548 31819 4037 62592 86000 35003 22732 70833 80720 53878 25167 18352 99198 41872 68549 3581 48304 87516 15156 23184 34829 54104 99986 79752 71098 46714 12029 49389 87325 86801 18765 87466 35234 60791 89351 77924 75533 58659 20024 12077 60504 154 27468 75983 82504 62924 53171 59539 44655 6776 46250 32762 34068 37365 79069 61484 93900 34693 62458 55306 42208 27781 1769 9834 29346 52971 49977 6661 10630 51744 73427 18383 27118 75306 52511 48966 22461 18197 32580 19034 31352 62624 53783 27193 46012 45278 32199 83620 3398 39947 91471 14074 59500 29161 71681 52638 24260 71709 89354 16760 1439 42946 50757 90378 31612 41103 96300 28574 95303 97578 57473 81536 28668 26209 28545 35670 45147 21160 61625 52189 69580 4 78421 48283 83467 29749 36809 72240 91681 15680 45507 98723 46026 84729 69930 39179 60777 65495 76187 1246 24766 85563 62649 68755 21983 59854 89300 97596 66859 3074 90165 18067 29226 75591 59797 48776 81452 62503 41158 31108 66264 61132 83372 65447 13948 2787 45228 90943 3175 92225 4293 8014 94812 34325 12794 10087 72358 31833 10237 91115 10800 92224 31655 29235 45672 54128 29177 63999 33088 97411 12187 57353 70576 71171 95177 45277 45935 47618 48595 78907 13883 31235 76943 48036 76905 66894 23515 61086 70632 34552 53476 33219 63488 97118 90234 97497 9292 48911 40836 18590 80748 23085 50415 76868 45294 41349 76063 86230 76332 78936 28934 3719 77616 8800 31774 37215 90202 35811 29867 79899 38118 75864 45092 52125 69449 22974 56083 18639 41496 79930 48869 48545 67123 97034 36898 97834 36799 54777 30997 75195 51143 99919 19140 62032 60683 5034 79785 93417 34984 9590 84453 80120 5655 714 14341 14028 18290 20430 91529 83591 31212 3426 20438 48491 24708 65582 13255 46667 31301 32696 91013 95023 5439 38085 8648 77686 3225 15919 77764 4922 44236 69707 5499 39005 90307 2767 40549 51327 62525 57982 85908 42653 44705 81395 77600 13485 25424 60576 35478 61044 91820 69511 53053 22964 11509 72369 97789 62086 68746 76105 62158 15265 13417 57733 91130 31047 20789 58042 26321 24893 47101 13831 41882 2720 76481 21072 98003 14412 76423 55255 13777 45357 86858 73085 2534 71686 75866 91764 97944 75886 38771 78899 97510 1500 68467 5197 61612 76515 91882 24016 52791 17321 28938 58604 38210 52037 44184 71453 15091 12007 24426 28662 3326 24584 9824 14229 47404 40587 22015 54837 49240 26033 34429 23340 90218 20861 65002 73585 73486 60757 54062 46345 14632 86099 54504 45583 54695 13979 99671 93627 48968 43756 44229 50673 59174 20850 96212 67832 59184 44740 62900 62577 91918 74076 36974 \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog10/blog10Out.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog10/blog10Out.txt new file mode 100644 index 000000000..45fdbdb77 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog10/blog10Out.txt @@ -0,0 +1,5887 @@ +3 +5 +0 +1 +0 + +3 +6 +6 +4 +0 + +3 +4 +0 +6 +2 + +9 +1 +1 +9 + +8 +7 +2 +3 +1 + +4 +4 +5 +9 +6 + +3 +1 +6 +8 +7 + +5 +4 +8 +7 +4 + +8 +8 +1 +8 +6 + +8 +5 +4 +6 +7 + +4 +8 +2 +8 + +8 +5 +3 +4 +9 + +4 +6 +5 +3 +9 + +3 +7 +4 +1 +4 + +1 +1 +7 +2 +2 + +8 +7 +2 +9 +0 + +5 +2 +6 +9 +3 + +8 +3 +9 +9 + +6 +5 +6 +8 +7 + +2 +0 +4 +2 +4 + +1 +6 +8 +3 +7 + +5 +2 +5 +4 +5 + +7 +3 +0 +8 +6 + +9 +2 +9 +8 +1 + +6 +4 +9 +0 +4 + +2 +6 +7 +4 + +8 +7 +5 +3 +5 + +9 +5 +7 +1 +2 + +9 +1 +8 +1 +0 + +1 +2 +5 +3 + +9 +6 +4 +9 +3 + +4 +3 +9 +0 +9 + +8 +5 +7 +5 +2 + +4 +9 +6 +3 +1 + +9 +6 +7 +0 +9 + +8 +1 +3 +4 +6 + +6 +9 +5 +7 +7 + +9 +9 +8 +0 +0 + +2 +1 +2 +9 + +7 +3 +7 +8 +7 + +5 +9 +0 +2 + +1 +4 +3 +1 +0 + +5 +0 +8 +1 +8 + +8 +4 +8 +1 +8 + +3 +1 +3 +6 +0 + +5 +9 +8 +4 +9 + +4 +0 +0 +9 +6 + +7 +6 +1 +2 +1 + +5 +1 +2 +9 +2 + +5 +3 +2 +0 +2 + +9 +7 +9 +1 +0 + +3 +3 +6 +8 +3 + +9 +2 +8 +8 +3 + +2 +6 +2 +2 +3 + +3 +7 +5 +0 +0 + +4 +5 +1 +4 +8 + +4 +0 +9 +1 +8 + +8 +5 +7 +7 +8 + +1 +7 +5 +4 +2 + +2 +0 +2 +4 +0 + +1 +8 +4 +6 +9 + +2 +5 +5 +8 +1 + +1 +8 +7 +5 + +8 +1 +7 +5 +6 + +3 +2 +2 +6 +7 + +5 +2 +1 +7 +8 + +9 +1 +7 +3 +8 + +8 +1 +7 +6 +9 + +3 +2 +7 +4 +5 + +2 +5 +9 +6 +7 + +8 +0 +5 +3 +3 + +7 +1 +1 +5 +9 + +7 +8 +9 +0 +8 + +2 +7 +5 +3 +0 + +8 +6 +4 +5 +7 + +8 +2 +2 +5 +2 + +6 +5 +9 +5 +1 + +5 +8 +2 +4 +5 + +4 +5 +6 +9 +7 + +7 +8 +4 +8 + +5 +9 +3 +0 +3 + +1 +3 +5 +3 +2 + +9 +0 +1 +4 +4 + +9 +7 +1 +5 + +2 +9 +7 +8 +1 + +1 +1 +7 +0 +5 + +4 +6 +1 +3 +7 + +9 +7 +4 +4 +0 + +2 +4 +3 +6 +8 + +4 +4 +1 +7 +2 + +4 +2 +1 +8 +2 + +9 +1 +0 + +2 +0 +9 +4 + +9 +3 +6 +3 +6 + +6 +9 +4 +9 +6 + +9 +8 +5 +3 +1 + +8 +7 +1 +4 +5 + +2 +1 +6 +8 +4 + +5 +0 +3 +1 +0 + +3 +0 +1 +3 + +8 +3 +5 +6 +5 + +2 +1 +0 +7 + +2 +6 +6 + +3 +4 +9 +4 +0 + +9 +3 +4 +2 +6 + +3 +5 +5 +4 +3 + +8 +6 +6 +9 +1 + +3 +0 +2 +6 +6 + +8 +6 +7 +5 +1 + +6 +5 +9 +6 +3 + +8 +6 +0 +5 +8 + +4 +7 +2 +8 +6 + +7 +4 +1 +5 +4 + +2 +7 +6 +3 +7 + +4 +3 +6 +7 +1 + +5 +9 +3 +6 +0 + +8 +8 +4 +7 +5 + +6 +9 +2 +8 +7 + +4 +1 +7 +4 +7 + +9 +4 +7 +3 +4 + +2 +5 +8 +0 +6 + +2 +6 +6 +5 +7 + +2 +9 +0 +5 +2 + +8 +6 +9 +3 +1 + +7 +6 +5 +4 + +5 +7 +8 +3 +3 + +3 +7 +9 +0 +3 + +3 +6 +5 +1 +0 + +2 +8 +9 +1 + +3 +9 +0 +1 +4 + +7 +7 +7 +6 +2 + +8 +2 +3 +3 +3 + +7 +9 +8 +8 +6 + +8 +2 +7 +1 + +5 +6 +4 +9 +5 + +7 +1 +0 +5 +0 + +9 +3 +0 + +3 +2 +0 +6 +9 + +8 +3 +3 +1 +5 + +7 +2 +8 +0 +8 + +2 +8 +1 +2 +6 + +1 +4 +2 +2 + +2 +6 +7 +6 +3 + +8 +3 +8 +6 +3 + +3 +5 +4 +0 +8 + +5 +2 +5 +4 +3 + +5 +5 +7 +0 +8 + +9 +4 +2 +7 +3 + +9 +9 +1 +3 +3 + +1 +8 +9 +9 +4 + +2 +6 +0 +1 +6 + +9 +1 +8 +1 +1 + +2 +7 +8 +3 +0 + +6 +6 +6 +8 +8 + +3 +2 +6 +4 +9 + +9 +2 +1 +4 +0 + +8 +2 +4 +3 +6 + +8 +6 +5 +5 +9 + +1 +9 +9 +5 +3 + +2 +3 +1 +9 +3 + +4 +8 +5 +1 + +7 +2 +4 +4 +7 + +8 +5 +8 +2 +8 + +1 +1 +7 +8 +5 + +5 +1 +6 +1 +5 + +4 +2 +2 +5 +8 + +7 +9 +7 +1 +3 + +8 +1 + +6 +2 +0 +4 +2 + +9 +3 +8 +7 +1 + +9 +8 +1 +2 +6 + +6 +6 +6 +5 +6 + +6 +8 +3 +7 +2 + +7 +1 +8 +4 +9 + +5 +1 +5 +2 +5 + +4 +7 +4 +7 +8 + +7 +3 +4 +1 +3 + +3 +4 +1 +9 +9 + +8 +8 +2 +5 +1 + +3 +8 +8 +2 +0 + +4 +6 +5 +6 +3 + +5 +9 +1 +3 +1 + +8 +3 +6 +2 +8 + +7 +0 +6 +7 +6 + +4 +7 +8 +3 +8 + +7 +4 +7 +1 +1 + +6 +1 +9 +1 +9 + +9 +8 +2 +4 +0 + +5 +6 +4 +4 +5 + +7 +8 +1 +6 +1 + +2 +9 +2 +4 +5 + +2 +8 +5 +5 +3 + +7 +8 +5 +6 +7 + +1 +3 +5 +9 + +8 +8 +2 +1 +0 + +2 +6 +5 +8 +3 + +3 +4 +2 +4 +0 + +9 +2 +1 +1 +5 + +9 +4 +8 +7 +7 + +3 +8 +5 +3 +9 + +4 +5 +5 +4 +7 + +8 +5 +2 +1 +8 + +9 +5 +0 +3 +5 + +8 +2 +1 +3 +6 + +5 +7 +3 +2 +1 + +3 +5 +1 +4 +5 + +3 +2 +2 +4 +5 + +4 +6 +5 +9 +3 + +9 +8 +4 +1 +1 + +5 +5 +3 +4 +8 + +8 +3 +4 +7 +4 + +1 +8 +9 +7 +1 + +5 +3 +0 +4 +5 + +5 +0 +2 +7 +1 + +8 +2 +9 +5 +2 + +4 +6 +0 +2 +9 + +9 +0 +6 +0 +2 + +1 +3 +7 +4 +4 + +2 +5 +6 +4 +2 + +3 +9 +8 +0 +7 + +5 +4 +8 +3 +4 + +5 +4 +3 +6 +8 + +9 +1 +4 +3 +7 + +7 +6 +8 +0 +8 + +7 +7 +3 +7 +5 + +4 +8 +9 +5 +9 + +9 +9 +8 +9 +1 + +3 +7 +3 +5 +8 + +5 +3 +2 +5 +0 + +7 +8 +8 +2 + +3 +8 + +1 +5 +6 +5 +3 + +5 +7 +4 +7 +8 + +4 +6 +3 +3 +0 + +1 +0 +1 +0 +8 + +2 +6 +9 +4 +0 + +7 +9 +6 +0 +8 + +3 +9 +2 +0 +6 + +6 +3 +0 +5 + +1 +3 +8 +0 +2 + +4 +6 +8 +8 +6 + +9 +0 +6 +9 +0 + +5 +8 +2 +0 +4 + +8 +8 +0 +0 +3 + +4 +4 +7 +6 +7 + +1 +4 +8 +7 + +3 +1 +6 +1 +3 + +4 +1 +7 +3 +9 + +1 +6 +6 +8 +0 + +4 +0 +7 +6 +0 + +7 +9 +2 +3 + +3 +3 +7 +5 +7 + +5 +1 +4 +1 +3 + +4 +6 +2 +0 +2 + +5 +2 +8 +5 +0 + +2 +8 +4 +4 +0 + +1 +6 +4 +1 +2 + +2 +9 +7 +2 + +1 +2 +8 +7 +5 + +4 +2 +4 +8 +0 + +8 +8 +6 +0 +8 + +6 +9 +1 +9 +5 + +8 +3 +9 +0 +9 + +9 +8 +6 +4 +5 + +4 +9 +2 +6 +2 + +3 +1 +9 +1 +0 + +3 +3 +6 +3 +6 + +4 +2 +6 +2 +0 + +7 +2 +1 +4 +0 + +6 +6 +5 +6 +1 + +7 +6 +1 +8 +3 + +1 +6 +9 +5 +0 + +9 +6 +3 +8 +1 + +7 +7 +1 +9 +2 + +1 +3 +1 +9 +0 + +7 +7 +4 +8 +0 + +8 +6 +7 +9 +9 + +4 +7 +8 +9 +6 + +1 +4 +5 +3 +4 + +7 +5 +5 +1 +3 + +7 +5 +4 +1 +4 + +4 +8 +9 +4 +8 + +4 +3 +5 +3 +6 + +4 +0 +5 +7 +3 + +4 +3 +4 +3 +1 + +7 +8 +4 +4 +7 + +3 +3 +8 +0 +5 + +7 +8 +4 +3 +8 + +2 +0 +4 +2 +6 + +4 +8 +8 +6 +1 + +4 +7 +5 +8 +1 + +5 +4 +0 +6 +5 + +3 +8 +0 +4 +2 + +3 +4 +4 +3 +2 + +2 +5 +5 +3 +2 + +8 +7 +8 +9 +6 + +8 +3 +9 +8 +2 + +7 +1 +4 +7 +2 + +4 +8 +5 +5 +6 + +6 +0 +7 +8 +9 + +4 +4 +2 +7 +6 + +6 +6 +5 +1 +2 + +9 +0 +8 +9 +8 + +2 +6 +3 +5 +4 + +2 +9 +2 +6 + +9 +9 +1 +3 + +4 +5 +3 +5 + +3 +7 +9 +3 +5 + +6 +4 +4 +5 +3 + +8 +6 +4 +8 +8 + +7 +2 +2 +9 +1 + +7 +8 +3 +6 + +7 +5 +2 +1 +7 + +2 +8 +3 +0 +4 + +1 +0 +8 +8 + +2 +2 +6 +6 +8 + +9 +3 +5 +8 +9 + +6 +7 +1 +4 +2 + +8 +0 +1 +7 +9 + +7 +2 +8 +2 +5 + +2 +4 +6 +0 +7 + +6 +3 +0 +0 +3 + +3 +3 +9 +0 +3 + +5 +3 +0 +3 +2 + +3 +7 +4 +1 +8 + +6 +9 +5 +0 +3 + +5 +4 +5 +1 +7 + +9 +5 +9 +2 +5 + +9 +7 +2 +0 +8 + +8 +1 +2 +9 +7 + +5 +6 +2 +8 +3 + +1 +4 +7 +4 +9 + +6 +4 +0 +0 + +6 +6 +8 +8 +0 + +6 +3 +6 +2 +7 + +3 +2 +8 +6 +5 + +1 +4 +8 +8 +0 + +7 +1 +3 +0 +2 + +6 +7 +7 + +6 +1 +4 +1 +4 + +1 +9 +1 +6 +5 + +9 +9 +4 +2 +8 + +9 +2 +2 +8 +8 + +4 +2 +7 +7 +0 + +9 +0 +0 +3 + +9 +6 +1 +2 +6 + +6 +3 +0 +3 +7 + +5 +4 +1 +8 +9 + +8 +3 +0 +3 +7 + +7 +3 +5 +1 +6 + +1 +5 +0 +1 +8 + +2 +0 +6 +2 +8 + +1 +3 +7 +6 +2 + +8 +7 +5 +6 +9 + +8 +7 +9 +8 +9 + +7 +0 +6 +3 +9 + +7 +6 +7 +2 +4 + +2 +9 +3 +9 +8 + +1 +0 +2 +0 +7 + +1 +0 +7 +3 +1 + +4 +2 +7 +8 +9 + +8 +4 +1 +9 +3 + +8 +0 +1 +8 +7 + +3 +3 +0 +9 +8 + +7 +9 +8 +0 +6 + +8 +6 +7 +5 + +4 +4 +8 +4 +2 + +4 +6 +3 +8 +5 + +2 +7 +3 +7 +7 + +3 +0 +4 +0 +9 + +5 +9 +6 +5 +3 + +2 +3 +8 +0 +6 + +1 +8 +6 +8 + +4 +0 +4 +2 +5 + +8 +1 +0 +6 +6 + +7 +3 +8 +6 +0 + +8 +4 +9 +2 +8 + +5 +0 +8 +3 +9 + +2 +0 +3 +4 +0 + +1 +7 +6 +1 +6 + +8 +4 +9 +3 +7 + +8 +9 +8 +7 +8 + +8 +5 +7 +3 +4 + +6 +0 +1 +5 + +9 +9 +5 +1 +2 + +7 +7 +0 +4 +4 + +4 +6 +3 +4 +9 + +7 +0 +4 +0 +2 + +3 +4 +2 +4 +9 + +9 +2 +4 +7 +7 + +6 +1 +3 +4 +7 + +2 +8 +4 +3 +9 + +9 +4 +3 +6 +4 + +1 +1 +7 +6 +2 + +2 +5 +2 +5 +8 + +2 +0 +6 +2 +9 + +7 +0 +4 +2 +0 + +5 +4 +9 +2 +5 + +9 +5 +6 +9 +1 + +6 +9 +9 +5 +9 + +7 +1 +9 +7 +4 + +3 +2 +1 +4 +9 + +1 +2 +9 +1 +6 + +9 +7 +9 +2 +3 + +4 +2 +7 +8 +5 + +3 +5 +4 +3 +5 + +2 +2 +6 +7 +0 + +1 +9 +8 +4 +4 + +6 +2 +0 +6 +0 + +4 +9 +2 +9 +8 + +4 +9 +8 +5 +5 + +2 +7 +3 +0 +3 + +1 +1 +6 +6 +2 + +6 +0 +5 +4 +3 + +3 +1 +1 +3 +9 + +2 +2 +8 +4 +2 + +2 +4 +1 +8 +1 + +7 +7 +7 +9 +7 + +5 +2 +3 +6 +0 + +8 +9 +9 +2 + +6 +9 +5 +9 +7 + +9 +4 +1 +1 +7 + +2 +1 +0 +1 +0 + +5 +3 +4 +3 +9 + +8 +8 +7 +5 +4 + +9 +8 +1 +2 +0 + +1 +5 +0 +9 +6 + +2 +6 +2 +1 +3 + +1 +6 +8 +7 +2 + +1 +5 +7 +8 +8 + +7 +6 +9 +4 + +9 +2 +8 +4 +1 + +4 +7 +3 +7 +1 + +2 +1 +4 +0 +4 + +5 +0 +0 +6 +7 + +3 +9 +7 +8 +1 + +5 +5 +1 +5 +1 + +7 +4 +8 +6 +9 + +7 +4 +6 +1 +6 + +2 +4 +1 +7 +4 + +4 +1 +3 +6 +0 + +4 +7 +6 +5 + +1 +9 +9 +6 +5 + +3 +6 +4 +4 +0 + +5 +3 +9 +3 +4 + +4 +0 +4 +8 +5 + +7 +9 +9 +0 + +1 +0 +3 +6 +0 + +6 +6 +5 +2 +7 + +5 +2 +4 +3 +4 + +4 +8 +4 +4 +6 + +7 +4 +5 +6 +6 + +2 +2 +7 +9 +6 + +6 +8 +3 +3 +5 + +8 +8 +4 +6 +2 + +4 +3 +8 +8 +3 + +3 +0 +6 +2 +6 + +1 +6 +4 +9 +9 + +1 +8 +2 +7 +7 + +2 +6 +8 +7 +6 + +8 +2 +2 +8 +4 + +6 +3 +8 +7 +2 + +8 +8 +0 +8 +9 + +1 +1 +7 + +7 +8 +8 +8 +3 + +3 +4 +2 +9 +6 + +5 +8 +8 +0 +3 + +6 +8 +0 +7 +6 + +8 +8 +5 +5 +5 + +5 +8 +6 +6 +5 + +5 +7 +7 +7 +0 + +9 +3 +4 +3 +6 + +5 +6 +8 +7 +7 + +7 +5 +7 +7 +4 + +4 +1 +8 +3 +3 + +8 +8 +4 +9 +2 + +6 +1 +2 +3 +6 + +9 +5 +7 +7 + +9 +1 +7 +0 +7 + +2 +7 +1 +7 +8 + +3 +7 +9 +6 +2 + +8 +6 +1 +7 +3 + +6 +5 +7 +9 +8 + +3 +9 +9 +8 +8 + +8 +8 +3 +3 +4 + +8 +8 +2 +2 +2 + +5 +9 +6 +3 +1 + +1 +9 +8 +2 +3 + +8 +2 +5 +0 + +3 +3 +0 +0 +6 + +7 +2 +5 +5 +7 + +3 +1 +3 +8 +3 + +7 +6 +6 +2 +6 + +6 +2 +0 +6 +1 + +3 +8 +3 +9 +6 + +9 +0 +7 +0 +5 + +8 +2 +0 +8 +6 + +5 +9 +2 +7 +4 + +8 +8 +0 +4 +4 + +4 +1 +0 +7 +4 + +2 +1 +9 +7 +3 + +1 +2 +8 +9 +1 + +4 +4 +5 +7 + +9 +6 +6 +3 +1 + +7 +2 +2 +7 +2 + +5 +8 +1 +6 + +8 +3 +2 +8 + +4 +1 +8 +1 +0 + +9 +5 +0 +9 +1 + +5 +8 +0 +2 +3 + +9 +5 +6 +3 +1 + +5 +6 +3 +3 +9 + +2 +2 +5 +8 +1 + +5 +2 +5 +5 +5 + +8 +3 +4 +9 +8 + +8 +7 +9 +7 +2 + +9 +4 +9 +0 +4 + +1 +0 +9 +2 +2 + +5 +2 +8 +4 +7 + +8 +3 +0 +2 + +3 +0 +2 +0 +9 + +4 +5 +1 +7 +6 + +1 +3 +3 +0 +1 + +7 +9 +4 +4 +3 + +7 +6 +2 +3 +8 + +7 +7 +4 +3 +0 + +1 +2 +7 +0 +0 + +9 +7 +6 +5 +3 + +1 +3 +1 +8 +4 + +8 +9 +7 +9 +2 + +9 +7 +6 +2 +7 + +3 +0 +8 +1 +9 + +8 +4 +3 +8 + +5 +3 +7 +1 + +8 +3 +0 +8 +0 + +1 +2 +3 +8 +2 + +2 +6 +8 +6 + +2 +8 +4 +0 +6 + +4 +2 +0 +6 +9 + +5 +2 +0 +6 +6 + +3 +8 +2 +2 +0 + +6 +2 +0 +7 +5 + +7 +1 +2 +4 +5 + +7 +0 +3 +2 + +1 +8 +9 +1 +9 + +7 +3 +1 +4 +6 + +5 +2 +7 +6 + +5 +4 +1 +3 +4 + +4 +8 +1 +5 + +5 +2 +2 +8 +8 + +3 +1 +2 +7 +3 + +9 +3 +8 +6 +5 + +9 +0 +8 +2 + +1 +7 +6 +9 +3 + +3 +7 +7 +8 +3 + +1 +8 +8 +2 + +5 +1 +1 +8 + +5 +1 +8 +9 + +3 +1 +7 +6 +2 + +6 +9 +3 +1 +2 + +8 +5 +8 +0 +8 + +1 +6 +5 +3 +0 + +1 +4 +6 +3 +9 + +5 +7 +5 +2 +5 + +1 +0 +2 +0 +2 + +8 +8 +0 +0 +6 + +6 +3 +8 +6 +0 + +6 +8 +9 +1 +9 + +1 +4 +0 +1 +3 + +4 +9 +1 +4 +3 + +1 +1 +7 +5 +6 + +3 +1 +5 +8 +7 + +4 +4 +2 +4 + +3 +1 +3 +3 +4 + +1 +7 +6 +8 +2 + +3 +2 +5 +4 +8 + +3 +1 +8 +1 +9 + +4 +0 +3 +7 + +6 +2 +5 +9 +2 + +8 +6 +0 +0 +0 + +3 +5 +0 +0 +3 + +2 +2 +7 +3 +2 + +7 +0 +8 +3 +3 + +8 +0 +7 +2 +0 + +5 +3 +8 +7 +8 + +2 +5 +1 +6 +7 + +1 +8 +3 +5 +2 + +9 +9 +1 +9 +8 + +4 +1 +8 +7 +2 + +6 +8 +5 +4 +9 + +3 +5 +8 +1 + +4 +8 +3 +0 +4 + +8 +7 +5 +1 +6 + +1 +5 +1 +5 +6 + +2 +3 +1 +8 +4 + +3 +4 +8 +2 +9 + +5 +4 +1 +0 +4 + +9 +9 +9 +8 +6 + +7 +9 +7 +5 +2 + +7 +1 +0 +9 +8 + +4 +6 +7 +1 +4 + +1 +2 +0 +2 +9 + +4 +9 +3 +8 +9 + +8 +7 +3 +2 +5 + +8 +6 +8 +0 +1 + +1 +8 +7 +6 +5 + +8 +7 +4 +6 +6 + +3 +5 +2 +3 +4 + +6 +0 +7 +9 +1 + +8 +9 +3 +5 +1 + +7 +7 +9 +2 +4 + +7 +5 +5 +3 +3 + +5 +8 +6 +5 +9 + +2 +0 +0 +2 +4 + +1 +2 +0 +7 +7 + +6 +0 +5 +0 +4 + +1 +5 +4 + +2 +7 +4 +6 +8 + +7 +5 +9 +8 +3 + +8 +2 +5 +0 +4 + +6 +2 +9 +2 +4 + +5 +3 +1 +7 +1 + +5 +9 +5 +3 +9 + +4 +4 +6 +5 +5 + +6 +7 +7 +6 + +4 +6 +2 +5 +0 + +3 +2 +7 +6 +2 + +3 +4 +0 +6 +8 + +3 +7 +3 +6 +5 + +7 +9 +0 +6 +9 + +6 +1 +4 +8 +4 + +9 +3 +9 +0 +0 + +3 +4 +6 +9 +3 + +6 +2 +4 +5 +8 + +5 +5 +3 +0 +6 + +4 +2 +2 +0 +8 + +2 +7 +7 +8 +1 + +1 +7 +6 +9 + +9 +8 +3 +4 + +2 +9 +3 +4 +6 + +5 +2 +9 +7 +1 + +4 +9 +9 +7 +7 + +6 +6 +6 +1 + +1 +0 +6 +3 +0 + +5 +1 +7 +4 +4 + +7 +3 +4 +2 +7 + +1 +8 +3 +8 +3 + +2 +7 +1 +1 +8 + +7 +5 +3 +0 +6 + +5 +2 +5 +1 +1 + +4 +8 +9 +6 +6 + +2 +2 +4 +6 +1 + +1 +8 +1 +9 +7 + +3 +2 +5 +8 +0 + +1 +9 +0 +3 +4 + +3 +1 +3 +5 +2 + +6 +2 +6 +2 +4 + +5 +3 +7 +8 +3 + +2 +7 +1 +9 +3 + +4 +6 +0 +1 +2 + +4 +5 +2 +7 +8 + +3 +2 +1 +9 +9 + +8 +3 +6 +2 +0 + +3 +3 +9 +8 + +3 +9 +9 +4 +7 + +9 +1 +4 +7 +1 + +1 +4 +0 +7 +4 + +5 +9 +5 +0 +0 + +2 +9 +1 +6 +1 + +7 +1 +6 +8 +1 + +5 +2 +6 +3 +8 + +2 +4 +2 +6 +0 + +7 +1 +7 +0 +9 + +8 +9 +3 +5 +4 + +1 +6 +7 +6 +0 + +1 +4 +3 +9 + +4 +2 +9 +4 +6 + +5 +0 +7 +5 +7 + +9 +0 +3 +7 +8 + +3 +1 +6 +1 +2 + +4 +1 +1 +0 +3 + +9 +6 +3 +0 +0 + +2 +8 +5 +7 +4 + +9 +5 +3 +0 +3 + +9 +7 +5 +7 +8 + +5 +7 +4 +7 +3 + +8 +1 +5 +3 +6 + +2 +8 +6 +6 +8 + +2 +6 +2 +0 +9 + +2 +8 +5 +4 +5 + +3 +5 +6 +7 +0 + +4 +5 +1 +4 +7 + +2 +1 +1 +6 +0 + +6 +1 +6 +2 +5 + +5 +2 +1 +8 +9 + +6 +9 +5 +8 +0 + +4 + +7 +8 +4 +2 +1 + +4 +8 +2 +8 +3 + +8 +3 +4 +6 +7 + +2 +9 +7 +4 +9 + +3 +6 +8 +0 +9 + +7 +2 +2 +4 +0 + +9 +1 +6 +8 +1 + +1 +5 +6 +8 +0 + +4 +5 +5 +0 +7 + +9 +8 +7 +2 +3 + +4 +6 +0 +2 +6 + +8 +4 +7 +2 +9 + +6 +9 +9 +3 +0 + +3 +9 +1 +7 +9 + +6 +0 +7 +7 +7 + +6 +5 +4 +9 +5 + +7 +6 +1 +8 +7 + +1 +2 +4 +6 + +2 +4 +7 +6 +6 + +8 +5 +5 +6 +3 + +6 +2 +6 +4 +9 + +6 +8 +7 +5 +5 + +2 +1 +9 +8 +3 + +5 +9 +8 +5 +4 + +8 +9 +3 +0 +0 + +9 +7 +5 +9 +6 + +6 +6 +8 +5 +9 + +3 +0 +7 +4 + +9 +0 +1 +6 +5 + +1 +8 +0 +6 +7 + +2 +9 +2 +2 +6 + +7 +5 +5 +9 +1 + +5 +9 +7 +9 +7 + +4 +8 +7 +7 +6 + +8 +1 +4 +5 +2 + +6 +2 +5 +0 +3 + +4 +1 +1 +5 +8 + +3 +1 +1 +0 +8 + +6 +6 +2 +6 +4 + +6 +1 +1 +3 +2 + +8 +3 +3 +7 +2 + +6 +5 +4 +4 +7 + +1 +3 +9 +4 +8 + +2 +7 +8 +7 + +4 +5 +2 +2 +8 + +9 +0 +9 +4 +3 + +3 +1 +7 +5 + +9 +2 +2 +2 +5 + +4 +2 +9 +3 + +8 +0 +1 +4 + +9 +4 +8 +1 +2 + +3 +4 +3 +2 +5 + +1 +2 +7 +9 +4 + +1 +0 +0 +8 +7 + +7 +2 +3 +5 +8 + +3 +1 +8 +3 +3 + +1 +0 +2 +3 +7 + +9 +1 +1 +1 +5 + +1 +0 +8 +0 +0 + +9 +2 +2 +2 +4 + +3 +1 +6 +5 +5 + +2 +9 +2 +3 +5 + +4 +5 +6 +7 +2 + +5 +4 +1 +2 +8 + +2 +9 +1 +7 +7 + +6 +3 +9 +9 +9 + +3 +3 +0 +8 +8 + +9 +7 +4 +1 +1 + +1 +2 +1 +8 +7 + +5 +7 +3 +5 +3 + +7 +0 +5 +7 +6 + +7 +1 +1 +7 +1 + +9 +5 +1 +7 +7 + +4 +5 +2 +7 +7 + +4 +5 +9 +3 +5 + +4 +7 +6 +1 +8 + +4 +8 +5 +9 +5 + +7 +8 +9 +0 +7 + +1 +3 +8 +8 +3 + +3 +1 +2 +3 +5 + +7 +6 +9 +4 +3 + +4 +8 +0 +3 +6 + +7 +6 +9 +0 +5 + +6 +6 +8 +9 +4 + +2 +3 +5 +1 +5 + +6 +1 +0 +8 +6 + +7 +0 +6 +3 +2 + +3 +4 +5 +5 +2 + +5 +3 +4 +7 +6 + +3 +3 +2 +1 +9 + +6 +3 +4 +8 +8 + +9 +7 +1 +1 +8 + +9 +0 +2 +3 +4 + +9 +7 +4 +9 +7 + +9 +2 +9 +2 + +4 +8 +9 +1 +1 + +4 +0 +8 +3 +6 + +1 +8 +5 +9 +0 + +8 +0 +7 +4 +8 + +2 +3 +0 +8 +5 + +5 +0 +4 +1 +5 + +7 +6 +8 +6 +8 + +4 +5 +2 +9 +4 + +4 +1 +3 +4 +9 + +7 +6 +0 +6 +3 + +8 +6 +2 +3 +0 + +7 +6 +3 +3 +2 + +7 +8 +9 +3 +6 + +2 +8 +9 +3 +4 + +3 +7 +1 +9 + +7 +7 +6 +1 +6 + +8 +8 +0 +0 + +3 +1 +7 +7 +4 + +3 +7 +2 +1 +5 + +9 +0 +2 +0 +2 + +3 +5 +8 +1 +1 + +2 +9 +8 +6 +7 + +7 +9 +8 +9 +9 + +3 +8 +1 +1 +8 + +7 +5 +8 +6 +4 + +4 +5 +0 +9 +2 + +5 +2 +1 +2 +5 + +6 +9 +4 +4 +9 + +2 +2 +9 +7 +4 + +5 +6 +0 +8 +3 + +1 +8 +6 +3 +9 + +4 +1 +4 +9 +6 + +7 +9 +9 +3 +0 + +4 +8 +8 +6 +9 + +4 +8 +5 +4 +5 + +6 +7 +1 +2 +3 + +9 +7 +0 +3 +4 + +3 +6 +8 +9 +8 + +9 +7 +8 +3 +4 + +3 +6 +7 +9 +9 + +5 +4 +7 +7 +7 + +3 +0 +9 +9 +7 + +7 +5 +1 +9 +5 + +5 +1 +1 +4 +3 + +9 +9 +9 +1 +9 + +1 +9 +1 +4 +0 + +6 +2 +0 +3 +2 + +6 +0 +6 +8 +3 + +5 +0 +3 +4 + +7 +9 +7 +8 +5 + +9 +3 +4 +1 +7 + +3 +4 +9 +8 +4 + +9 +5 +9 +0 + +8 +4 +4 +5 +3 + +8 +0 +1 +2 +0 + +5 +6 +5 +5 + +7 +1 +4 + +1 +4 +3 +4 +1 + +1 +4 +0 +2 +8 + +1 +8 +2 +9 +0 + +2 +0 +4 +3 +0 + +9 +1 +5 +2 +9 + +8 +3 +5 +9 +1 + +3 +1 +2 +1 +2 + +3 +4 +2 +6 + +2 +0 +4 +3 +8 + +4 +8 +4 +9 +1 + +2 +4 +7 +0 +8 + +6 +5 +5 +8 +2 + +1 +3 +2 +5 +5 + +4 +6 +6 +6 +7 + +3 +1 +3 +0 +1 + +3 +2 +6 +9 +6 + +9 +1 +0 +1 +3 + +9 +5 +0 +2 +3 + +5 +4 +3 +9 + +3 +8 +0 +8 +5 + +8 +6 +4 +8 + +7 +7 +6 +8 +6 + +3 +2 +2 +5 + +1 +5 +9 +1 +9 + +7 +7 +7 +6 +4 + +4 +9 +2 +2 + +4 +4 +2 +3 +6 + +6 +9 +7 +0 +7 + +5 +4 +9 +9 + +3 +9 +0 +0 +5 + +9 +0 +3 +0 +7 + +2 +7 +6 +7 + +4 +0 +5 +4 +9 + +5 +1 +3 +2 +7 + +6 +2 +5 +2 +5 + +5 +7 +9 +8 +2 + +8 +5 +9 +0 +8 + +4 +2 +6 +5 +3 + +4 +4 +7 +0 +5 + +8 +1 +3 +9 +5 + +7 +7 +6 +0 +0 + +1 +3 +4 +8 +5 + +2 +5 +4 +2 +4 + +6 +0 +5 +7 +6 + +3 +5 +4 +7 +8 + +6 +1 +0 +4 +4 + +9 +1 +8 +2 +0 + +6 +9 +5 +1 +1 + +5 +3 +0 +5 +3 + +2 +2 +9 +6 +4 + +1 +1 +5 +0 +9 + +7 +2 +3 +6 +9 + +9 +7 +7 +8 +9 + +6 +2 +0 +8 +6 + +6 +8 +7 +4 +6 + +7 +6 +1 +0 +5 + +6 +2 +1 +5 +8 + +1 +5 +2 +6 +5 + +1 +3 +4 +1 +7 + +5 +7 +7 +3 +3 + +9 +1 +1 +3 +0 + +3 +1 +0 +4 +7 + +2 +0 +7 +8 +9 + +5 +8 +0 +4 +2 + +2 +6 +3 +2 +1 + +2 +4 +8 +9 +3 + +4 +7 +1 +0 +1 + +1 +3 +8 +3 +1 + +4 +1 +8 +8 +2 + +2 +7 +2 +0 + +7 +6 +4 +8 +1 + +2 +1 +0 +7 +2 + +9 +8 +0 +0 +3 + +1 +4 +4 +1 +2 + +7 +6 +4 +2 +3 + +5 +5 +2 +5 +5 + +1 +3 +7 +7 +7 + +4 +5 +3 +5 +7 + +8 +6 +8 +5 +8 + +7 +3 +0 +8 +5 + +2 +5 +3 +4 + +7 +1 +6 +8 +6 + +7 +5 +8 +6 +6 + +9 +1 +7 +6 +4 + +9 +7 +9 +4 +4 + +7 +5 +8 +8 +6 + +3 +8 +7 +7 +1 + +7 +8 +8 +9 +9 + +9 +7 +5 +1 +0 + +1 +5 +0 +0 + +6 +8 +4 +6 +7 + +5 +1 +9 +7 + +6 +1 +6 +1 +2 + +7 +6 +5 +1 +5 + +9 +1 +8 +8 +2 + +2 +4 +0 +1 +6 + +5 +2 +7 +9 +1 + +1 +7 +3 +2 +1 + +2 +8 +9 +3 +8 + +5 +8 +6 +0 +4 + +3 +8 +2 +1 +0 + +5 +2 +0 +3 +7 + +4 +4 +1 +8 +4 + +7 +1 +4 +5 +3 + +1 +5 +0 +9 +1 + +1 +2 +0 +0 +7 + +2 +4 +4 +2 +6 + +2 +8 +6 +6 +2 + +3 +3 +2 +6 + +2 +4 +5 +8 +4 + +9 +8 +2 +4 + +1 +4 +2 +2 +9 + +4 +7 +4 +0 +4 + +4 +0 +5 +8 +7 + +2 +2 +0 +1 +5 + +5 +4 +8 +3 +7 + +4 +9 +2 +4 +0 + +2 +6 +0 +3 +3 + +3 +4 +4 +2 +9 + +2 +3 +3 +4 +0 + +9 +0 +2 +1 +8 + +2 +0 +8 +6 +1 + +6 +5 +0 +0 +2 + +7 +3 +5 +8 +5 + +7 +3 +4 +8 +6 + +6 +0 +7 +5 +7 + +5 +4 +0 +6 +2 + +4 +6 +3 +4 +5 + +1 +4 +6 +3 +2 + +8 +6 +0 +9 +9 + +5 +4 +5 +0 +4 + +4 +5 +5 +8 +3 + +5 +4 +6 +9 +5 + +1 +3 +9 +7 +9 + +9 +9 +6 +7 +1 + +9 +3 +6 +2 +7 + +4 +8 +9 +6 +8 + +4 +3 +7 +5 +6 + +4 +4 +2 +2 +9 + +5 +0 +6 +7 +3 + +5 +9 +1 +7 +4 + +2 +0 +8 +5 +0 + +9 +6 +2 +1 +2 + +6 +7 +8 +3 +2 + +5 +9 +1 +8 +4 + +4 +4 +7 +4 +0 + +6 +2 +9 +0 +0 + +6 +2 +5 +7 +7 + +9 +1 +9 +1 +8 + +7 +4 +0 +7 +6 + +3 +6 +9 +7 +4 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog10/blog10Tag.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog10/blog10Tag.txt new file mode 100644 index 000000000..636be419e --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog10/blog10Tag.txt @@ -0,0 +1,485 @@ +3 +1 +6 +8 +7 + +6 +5 +6 +8 +7 + +9 +6 +4 +9 +3 + +2 +1 +2 +9 + +8 +1 +7 +6 +9 + +6 +5 +9 +5 +1 + +4 +5 +6 +9 +7 + +3 +5 +5 +4 +3 + +6 +5 +9 +6 +3 + +3 +2 +0 +6 +9 + +5 +2 +5 +4 +3 + +9 +4 +2 +7 +3 + +9 +9 +1 +3 +3 + +9 +1 +8 +1 +1 + +9 +3 +8 +7 +1 + +7 +1 +8 +4 +9 + +9 +8 +4 +1 +1 + +8 +8 +0 +0 +3 + +1 +4 +8 +7 + +3 +3 +7 +5 +7 + +5 +1 +4 +1 +3 + +4 +7 +5 +8 +1 + +6 +4 +4 +5 +3 + +7 +5 +2 +1 +7 + +5 +4 +5 +1 +7 + +6 +7 +7 + +7 +0 +6 +3 +9 + +5 +0 +8 +3 +9 + +4 +6 +3 +4 +9 + +2 +8 +4 +3 +9 + +6 +9 +9 +5 +9 + +3 +1 +1 +3 +9 + +2 +4 +1 +8 +1 + +7 +7 +7 +9 +7 + +9 +4 +1 +1 +7 + +7 +4 +8 +6 +9 + +4 +4 +5 +7 + +1 +8 +9 +1 +9 + +3 +7 +7 +8 +3 + +5 +1 +8 +9 + +1 +4 +6 +3 +9 + +3 +5 +8 +1 + +7 +5 +5 +3 +3 + +7 +5 +9 +8 +3 + +5 +3 +1 +7 +1 + +5 +9 +5 +3 +9 + +3 +4 +6 +9 +3 + +6 +6 +6 +1 + +5 +2 +5 +1 +1 + +5 +3 +7 +8 +3 + +1 +4 +3 +9 + +2 +6 +2 +0 +9 + +5 +2 +1 +8 +9 + +3 +6 +8 +0 +9 + +5 +9 +7 +9 +7 + +6 +5 +4 +4 +7 + +7 +1 +1 +7 +1 + +9 +5 +1 +7 +7 + +1 +3 +8 +8 +3 + +7 +6 +9 +4 +3 + +3 +7 +1 +9 + +2 +9 +8 +6 +7 + +4 +8 +8 +6 +9 + +1 +4 +3 +4 +1 + +9 +1 +5 +2 +9 + +8 +3 +5 +9 +1 + +4 +8 +4 +9 +1 + +1 +5 +9 +1 +9 + +2 +7 +6 +7 + +9 +7 +7 +8 +9 + +1 +3 +4 +1 +7 + +2 +0 +7 +8 +9 + +2 +6 +3 +2 +1 + +1 +3 +8 +3 +1 + +7 +6 +4 +8 +1 + +7 +6 +4 +2 +3 + +5 +1 +9 +7 + +1 +7 +3 +2 +1 + +7 +1 +4 +5 +3 + +1 +5 +0 +9 +1 + +1 +2 +0 +0 +7 + +3 +4 +4 +2 +9 + +6 +0 +7 +5 +7 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog2/blog2.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog2/blog2.txt new file mode 100644 index 000000000..b55594ca5 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog2/blog2.txt @@ -0,0 +1 @@ +88515 26258 27634 3120 4387 12165 90036 15915 26088 65088 47514 48903 8961 91481 34354 64447 24798 68567 23025 82670 5119 31278 37685 6189 79348 11539 79827 26926 84296 9855 15585 87270 32713 90470 30305 96571 71981 27345 94282 14463 73119 17224 49298 13974 621 7210 41190 31648 97069 17205 62987 31695 54438 79887 74495 23757 10134 26454 85719 77561 6943 81600 43137 2015 87822 20307 25354 28171 72314 47564 39296 27698 16918 95378 57084 64409 22478 61222 70632 42145 41646 39461 25950 31218 89820 30552 56250 36233 99948 87453 80983 77453 12632 30109 27553 75551 595 81110 67055 25447 3985 77579 58917 31332 6830 874 12641 82170 33115 97289 18057 18198 89738 48694 94724 42397 96652 38394 38440 33997 66128 22313 47544 67848 81320 15074 6358 89128 59157 18458 10249 85900 44458 68648 91490 99097 63730 24092 1684 4080 25086 5954 96286 4065 84991 71767 71305 20765 58484 19093 14832 39847 97853 4430 70039 33136 99330 22289 17362 12030 35369 97829 49812 29738 97435 65736 37209 99538 47659 75815 13059 99277 50216 23672 7098 87353 16299 66639 44646 35588 22655 34714 31651 71760 67484 82129 81737 29440 5920 91134 11760 25757 19405 76035 81675 72952 18403 45131 14893 36924 32894 28318 6085 53486 45776 25163 92855 58647 17199 1073 62619 21745 29459 4226 69223 33589 6041 94086 32961 87301 37481 33631 86903 94791 30142 38583 24903 43460 32092 4469 49336 50108 29610 79854 96732 50051 21916 91834 29047 55314 33207 64988 8447 84265 44734 98647 15760 16632 89259 62747 84720 12244 28130 30456 99301 28504 78858 57238 80171 33270 20040 13170 35911 74204 8884 12519 67813 45047 77720 8361 66578 84792 67436 12374 35551 71841 3956 43590 56264 92737 96497 4964 76380 59550 85898 83259 99465 7310 14768 46018 29057 24518 12660 6690 93173 87232 77475 63449 2355 95995 5442 19731 66345 24427 67933 9797 57458 91229 64181 43052 34519 11282 29873 95035 11883 44065 66809 28843 86901 14262 87245 6150 36615 69065 98826 57761 1640 35353 74597 78198 56219 59146 68597 19529 51416 61288 9820 22217 46621 24191 83292 15783 66655 78469 61703 90344 15147 49596 69302 37163 93030 98120 98303 14775 45558 27374 17940 98999 24139 83554 64045 8953 51728 22819 6509 83017 29418 95033 48639 23810 54469 23786 92009 202 942 34386 16362 87760 40523 70913 14356 38822 40762 98231 85972 58855 55511 73159 75926 55670 56751 80568 69945 69178 17955 13820 10175 25360 19956 37823 84999 22756 70368 27582 89450 13136 94277 65696 88911 5438 47545 75859 13547 72670 74944 54135 74672 71524 40408 11313 98368 84257 53473 66377 68284 78934 94947 62585 55658 73423 27154 51543 84343 27792 59630 29277 85383 37606 53074 55336 74918 40491 56292 44860 38550 61287 59728 9435 89531 35638 57430 39608 44264 85445 7424 78616 10052 82441 91630 84149 88744 45099 43890 37208 71785 35408 97970 49271 61580 90192 34754 12139 44663 97699 79564 22950 93150 25232 50520 43687 88868 80513 15582 7299 33673 16586 82720 58896 86678 73050 86318 32765 46165 54440 69262 32761 72118 17925 64055 98983 2458 40588 70816 6857 42015 51447 14755 2891 62469 31621 1711 5278 9459 85840 96416 27299 88127 7205 6058 69410 40414 2542 25998 17294 2896 62444 84337 22440 13801 92858 15777 46074 77546 24868 96203 69853 93180 52171 56345 4281 51190 60522 62261 28712 71735 21075 96554 99702 40662 2997 55592 62658 96017 55750 36077 26779 49349 52443 6123 27664 40678 80934 39235 57647 42647 33540 59060 67433 94148 1671 75123 26976 63914 13015 24793 46176 86735 68857 33039 17098 62673 61564 16630 37961 80477 61194 26747 21385 10293 44949 37828 39003 33273 25414 68595 76234 15085 79927 45783 97223 81878 76571 40521 51678 19535 16499 73977 94520 60916 89406 58179 42461 44343 3222 9455 63221 38204 80234 55833 82053 6513 12024 1011 98725 9113 68879 76042 57677 12185 28964 95539 71249 81425 49340 38843 20626 16073 11292 36605 78672 3121 88817 76841 1859 67702 65228 95930 4154 33654 97189 56089 76573 59509 66856 14894 93302 44328 51652 37252 48828 59791 90461 90772 11340 26634 26279 1076 34225 87529 17852 64587 20338 51597 20344 40478 90107 89793 20271 64860 90389 3321 59395 86170 93184 52913 85132 30155 35950 70956 9389 46709 41214 76787 69 28884 43271 25673 78324 71882 19265 83027 51941 32002 42415 35334 76879 26593 80101 45745 78749 97864 49818 77906 75292 23709 70554 6462 61957 42810 72352 59198 63930 86610 19587 90180 9701 29039 75489 39678 72905 24368 24432 34077 53069 33070 91268 36432 62603 41932 42170 63728 86335 43766 82435 52628 17146 66895 51928 77626 42296 86079 36818 19425 53243 94730 34645 45830 61732 32980 34680 89833 56639 92090 62928 10545 77347 10894 81375 25909 49810 22925 26178 16718 84585 79373 16947 20337 4448 79343 82649 65688 87041 31726 20052 1585 28585 29413 66470 42512 81977 61320 79798 71689 19213 58463 12552 18870 41760 37336 10458 1438 64355 16663 93739 4538 55265 73809 7406 60276 54134 67908 70342 38821 85824 33603 68822 38689 93097 10675 98658 32558 72222 97871 39501 30173 94400 45208 71444 17057 80197 24737 60468 12766 48958 39746 10737 7485 9996 73070 18995 14822 30354 15879 31386 71907 47734 98954 41245 49678 48127 39399 30284 86848 66958 38203 71118 66451 50690 80885 35914 66665 11843 93157 72147 3580 13389 96010 67761 95005 25704 42206 63396 51419 76574 94890 66266 47552 83274 34048 3752 98359 98878 56379 79177 84943 99714 65089 17697 70662 48151 59426 12041 64741 42806 56152 35481 9062 83104 33330 48748 39732 60291 92123 95451 76079 75569 46682 15985 30269 24957 83078 82872 15051 63477 47675 92035 39266 71930 59844 93550 1388 82171 42855 94440 54431 97454 62387 9516 676 19615 95020 21027 53754 63563 72644 96505 29350 33784 89917 87732 12080 59204 90866 65295 31613 11171 61790 81574 45595 76494 57354 46030 24660 23007 10981 77010 68977 86665 25326 11047 82602 82304 91798 13631 81290 38932 75179 33357 32484 94817 86253 82132 7135 44493 10463 95099 83332 83371 33715 85290 74229 49954 82409 20211 8088 19822 41350 9819 26554 22828 29612 44988 89848 88280 83026 31530 58230 38453 18282 77531 \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog2/blog2Out.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog2/blog2Out.txt new file mode 100644 index 000000000..88150fe00 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog2/blog2Out.txt @@ -0,0 +1,5899 @@ +8 +8 +5 +1 +5 + +2 +6 +2 +5 +8 + +2 +7 +6 +3 +4 + +3 +1 +2 +0 + +4 +3 +8 +7 + +1 +2 +1 +6 +5 + +9 +0 +0 +3 +6 + +1 +5 +9 +1 +5 + +2 +6 +0 +8 +8 + +6 +5 +0 +8 +8 + +4 +7 +5 +1 +4 + +4 +8 +9 +0 +3 + +8 +9 +6 +1 + +9 +1 +4 +8 +1 + +3 +4 +3 +5 +4 + +6 +4 +4 +4 +7 + +2 +4 +7 +9 +8 + +6 +8 +5 +6 +7 + +2 +3 +0 +2 +5 + +8 +2 +6 +7 +0 + +5 +1 +1 +9 + +3 +1 +2 +7 +8 + +3 +7 +6 +8 +5 + +6 +1 +8 +9 + +7 +9 +3 +4 +8 + +1 +1 +5 +3 +9 + +7 +9 +8 +2 +7 + +2 +6 +9 +2 +6 + +8 +4 +2 +9 +6 + +9 +8 +5 +5 + +1 +5 +5 +8 +5 + +8 +7 +2 +7 +0 + +3 +2 +7 +1 +3 + +9 +0 +4 +7 +0 + +3 +0 +3 +0 +5 + +9 +6 +5 +7 +1 + +7 +1 +9 +8 +1 + +2 +7 +3 +4 +5 + +9 +4 +2 +8 +2 + +1 +4 +4 +6 +3 + +7 +3 +1 +1 +9 + +1 +7 +2 +2 +4 + +4 +9 +2 +9 +8 + +1 +3 +9 +7 +4 + +6 +2 +1 + +7 +2 +1 +0 + +4 +1 +1 +9 +0 + +3 +1 +6 +4 +8 + +9 +7 +0 +6 +9 + +1 +7 +2 +0 +5 + +6 +2 +9 +8 +7 + +3 +1 +6 +9 +5 + +5 +4 +4 +3 +8 + +7 +9 +8 +8 +7 + +7 +4 +4 +9 +5 + +2 +3 +7 +5 +7 + +1 +0 +1 +3 +4 + +2 +6 +4 +5 +4 + +8 +5 +7 +1 +9 + +7 +7 +5 +6 +1 + +6 +9 +4 +3 + +8 +1 +6 +0 +0 + +4 +3 +1 +3 +7 + +2 +0 +1 +5 + +8 +7 +8 +2 +2 + +2 +0 +3 +0 +7 + +2 +5 +3 +5 +4 + +2 +8 +1 +7 +1 + +7 +2 +3 +1 +4 + +4 +7 +5 +6 +4 + +3 +9 +2 +9 +6 + +2 +7 +6 +9 +8 + +1 +6 +9 +1 +8 + +9 +5 +3 +7 +8 + +5 +7 +0 +8 +4 + +6 +4 +4 +0 +9 + +2 +2 +4 +7 +8 + +6 +1 +2 +2 +2 + +7 +0 +6 +3 +2 + +4 +2 +1 +4 +5 + +4 +1 +6 +4 +6 + +3 +9 +4 +6 +1 + +2 +5 +9 +5 +0 + +3 +1 +2 +1 +8 + +8 +9 +8 +2 +0 + +3 +0 +5 +5 +2 + +5 +6 +2 +5 +0 + +3 +6 +2 +3 +3 + +9 +9 +9 +4 +8 + +8 +7 +4 +5 +3 + +8 +0 +9 +8 +3 + +7 +7 +4 +5 +3 + +1 +2 +6 +3 +2 + +3 +0 +1 +0 +9 + +2 +7 +5 +5 +3 + +7 +5 +5 +5 +1 + +5 +9 +5 + +8 +1 +1 +1 +0 + +6 +7 +0 +5 +5 + +2 +5 +4 +4 +7 + +3 +9 +8 +5 + +7 +7 +5 +7 +9 + +5 +8 +9 +1 +7 + +3 +1 +3 +3 +2 + +6 +8 +3 +0 + +8 +7 +4 + +1 +2 +6 +4 +1 + +8 +2 +1 +7 +0 + +3 +3 +1 +1 +5 + +9 +7 +2 +8 +9 + +1 +8 +0 +5 +7 + +1 +8 +1 +9 +8 + +8 +9 +7 +3 +8 + +4 +8 +6 +9 +4 + +9 +4 +7 +2 +4 + +4 +2 +3 +9 +7 + +9 +6 +6 +5 +2 + +3 +8 +3 +9 +4 + +3 +8 +4 +4 +0 + +3 +3 +9 +9 +7 + +6 +6 +1 +2 +8 + +2 +2 +3 +1 +3 + +4 +7 +5 +4 +4 + +6 +7 +8 +4 +8 + +8 +1 +3 +2 +0 + +1 +5 +0 +7 +4 + +6 +3 +5 +8 + +8 +9 +1 +2 +8 + +5 +9 +1 +5 +7 + +1 +8 +4 +5 +8 + +1 +0 +2 +4 +9 + +8 +5 +9 +0 +0 + +4 +4 +4 +5 +8 + +6 +8 +6 +4 +8 + +9 +1 +4 +9 +0 + +9 +9 +0 +9 +7 + +6 +3 +7 +3 +0 + +2 +4 +0 +9 +2 + +1 +6 +8 +4 + +4 +0 +8 +0 + +2 +5 +0 +8 +6 + +5 +9 +5 +4 + +9 +6 +2 +8 +6 + +4 +0 +6 +5 + +8 +4 +9 +9 +1 + +7 +1 +7 +6 +7 + +7 +1 +3 +0 +5 + +2 +0 +7 +6 +5 + +5 +8 +4 +8 +4 + +1 +9 +0 +9 +3 + +1 +4 +8 +3 +2 + +3 +9 +8 +4 +7 + +9 +7 +8 +5 +3 + +4 +4 +3 +0 + +7 +0 +0 +3 +9 + +3 +3 +1 +3 +6 + +9 +9 +3 +3 +0 + +2 +2 +2 +8 +9 + +1 +7 +3 +6 +2 + +1 +2 +0 +3 +0 + +3 +5 +3 +6 +9 + +9 +7 +8 +2 +9 + +4 +9 +8 +1 +2 + +2 +9 +7 +3 +8 + +9 +7 +4 +3 +5 + +6 +5 +7 +3 +6 + +3 +7 +2 +0 +9 + +9 +9 +5 +3 +8 + +4 +7 +6 +5 +9 + +7 +5 +8 +1 +5 + +1 +3 +0 +5 +9 + +9 +9 +2 +7 +7 + +5 +0 +2 +1 +6 + +2 +3 +6 +7 +2 + +7 +0 +9 +8 + +8 +7 +3 +5 +3 + +1 +6 +2 +9 +9 + +6 +6 +6 +3 +9 + +4 +4 +6 +4 +6 + +3 +5 +5 +8 +8 + +2 +2 +6 +5 +5 + +3 +4 +7 +1 +4 + +3 +1 +6 +5 +1 + +7 +1 +7 +6 +0 + +6 +7 +4 +8 +4 + +8 +2 +1 +2 +9 + +8 +1 +7 +3 +7 + +2 +9 +4 +4 +0 + +5 +9 +2 +0 + +9 +1 +1 +3 +4 + +1 +1 +7 +6 +0 + +2 +5 +7 +5 +7 + +1 +9 +4 +0 +5 + +7 +6 +0 +3 +5 + +8 +1 +6 +7 +5 + +7 +2 +9 +5 +2 + +1 +8 +4 +0 +3 + +4 +5 +1 +3 +1 + +1 +4 +8 +9 +3 + +3 +6 +9 +2 +4 + +3 +2 +8 +9 +4 + +2 +8 +3 +1 +8 + +6 +0 +8 +5 + +5 +3 +4 +8 +6 + +4 +5 +7 +7 +6 + +2 +5 +1 +6 +3 + +9 +2 +8 +5 +5 + +5 +8 +6 +4 +7 + +1 +7 +1 +9 +9 + +1 +0 +7 +3 + +6 +2 +6 +1 +9 + +2 +1 +7 +4 +5 + +2 +9 +4 +5 +9 + +4 +2 +2 +6 + +6 +9 +2 +2 +3 + +3 +3 +5 +8 +9 + +6 +0 +4 +1 + +9 +4 +0 +8 +6 + +3 +2 +9 +6 +1 + +8 +7 +3 +0 +1 + +3 +7 +4 +8 +1 + +3 +3 +6 +3 +1 + +8 +6 +9 +0 +3 + +9 +4 +7 +9 +1 + +3 +0 +1 +4 +2 + +3 +8 +5 +8 +3 + +2 +4 +9 +0 +3 + +4 +3 +4 +6 +0 + +3 +2 +0 +9 +2 + +4 +4 +6 +9 + +4 +9 +3 +3 +6 + +5 +0 +1 +0 +8 + +2 +9 +6 +1 +0 + +7 +9 +8 +5 +4 + +9 +6 +7 +3 +2 + +5 +0 +0 +5 +1 + +2 +1 +9 +1 +6 + +9 +1 +8 +3 +4 + +2 +9 +0 +4 +7 + +5 +5 +3 +1 +4 + +3 +3 +2 +0 +7 + +6 +4 +9 +8 +8 + +8 +4 +4 +7 + +8 +4 +2 +6 +5 + +4 +4 +7 +3 +4 + +9 +8 +6 +4 +7 + +1 +5 +7 +6 +0 + +1 +6 +6 +3 +2 + +8 +9 +2 +5 +9 + +6 +2 +7 +4 +7 + +8 +4 +7 +2 +0 + +1 +2 +2 +4 +4 + +2 +8 +1 +3 +0 + +3 +0 +4 +5 +6 + +9 +9 +3 +0 +1 + +2 +8 +5 +0 +4 + +7 +8 +8 +5 +8 + +5 +7 +2 +3 +8 + +8 +0 +1 +7 +1 + +3 +3 +2 +7 +0 + +2 +0 +0 +4 +0 + +1 +3 +1 +7 +0 + +3 +5 +9 +1 +1 + +7 +4 +2 +0 +4 + +8 +8 +8 +4 + +1 +2 +5 +1 +9 + +6 +7 +8 +1 +3 + +4 +5 +0 +4 +7 + +7 +7 +7 +2 +0 + +8 +3 +6 +1 + +6 +6 +5 +7 +8 + +8 +4 +7 +9 +2 + +6 +7 +4 +3 +6 + +1 +2 +3 +7 +4 + +3 +5 +5 +5 +1 + +7 +1 +8 +4 +1 + +3 +9 +5 +6 + +4 +3 +5 +9 +0 + +5 +6 +2 +6 +4 + +9 +2 +7 +3 +7 + +9 +6 +4 +9 +7 + +4 +9 +6 +4 + +7 +6 +3 +8 +0 + +5 +9 +5 +5 +0 + +8 +5 +8 +9 +8 + +8 +3 +2 +5 +9 + +9 +9 +4 +6 +5 + +7 +3 +1 +0 + +1 +4 +7 +6 +8 + +4 +6 +0 +1 +8 + +2 +9 +0 +5 +7 + +2 +4 +5 +1 +8 + +1 +2 +6 +6 +0 + +6 +6 +9 +0 + +9 +3 +1 +7 +3 + +8 +7 +2 +3 +2 + +7 +7 +4 +7 +5 + +6 +3 +4 +4 +9 + +2 +3 +5 +5 + +9 +5 +9 +9 +5 + +5 +4 +4 +2 + +1 +9 +7 +3 +1 + +6 +6 +3 +4 +5 + +2 +4 +4 +2 +7 + +6 +7 +9 +3 +3 + +9 +7 +9 +7 + +5 +7 +4 +5 +8 + +9 +1 +2 +2 +9 + +6 +4 +1 +8 +1 + +4 +3 +0 +5 +2 + +3 +4 +5 +1 +9 + +1 +1 +2 +8 +2 + +2 +9 +8 +7 +3 + +9 +5 +0 +3 +5 + +1 +1 +8 +8 +3 + +4 +4 +0 +6 +5 + +6 +6 +8 +0 +9 + +2 +8 +8 +4 +3 + +8 +6 +9 +0 +1 + +1 +4 +2 +6 +2 + +8 +7 +2 +4 +5 + +6 +1 +5 +0 + +3 +6 +6 +1 +5 + +6 +9 +0 +6 +5 + +9 +8 +8 +2 +6 + +5 +7 +7 +6 +1 + +1 +6 +4 +0 + +3 +5 +3 +5 +3 + +7 +4 +5 +9 +7 + +7 +8 +1 +9 +8 + +5 +6 +2 +1 +9 + +5 +9 +1 +4 +6 + +6 +8 +5 +9 +7 + +1 +9 +5 +2 +9 + +5 +1 +4 +1 +6 + +6 +1 +2 +8 +8 + +9 +8 +2 +0 + +2 +2 +2 +1 +7 + +4 +6 +6 +2 +1 + +2 +4 +1 +9 +1 + +8 +3 +2 +9 +2 + +1 +5 +7 +8 +3 + +6 +6 +6 +5 +5 + +7 +8 +4 +6 +9 + +6 +1 +7 +0 +3 + +9 +0 +3 +4 +4 + +1 +5 +1 +4 +7 + +4 +9 +5 +9 +6 + +6 +9 +3 +0 +2 + +3 +7 +1 +6 +3 + +9 +3 +0 +3 +0 + +9 +8 +1 +2 +0 + +9 +8 +3 +0 +3 + +1 +4 +7 +7 +5 + +4 +5 +5 +5 +8 + +2 +7 +3 +7 +4 + +1 +7 +9 +4 +0 + +9 +8 +9 +9 +9 + +2 +4 +1 +3 +9 + +8 +3 +5 +5 +4 + +6 +4 +0 +4 +5 + +8 +9 +5 +3 + +5 +1 +7 +2 +8 + +2 +2 +8 +1 +9 + +6 +5 +0 +9 + +8 +3 +0 +1 +7 + +2 +9 +4 +1 +8 + +9 +5 +0 +3 +3 + +4 +8 +6 +3 +9 + +2 +3 +8 +1 +0 + +5 +4 +4 +6 +9 + +2 +3 +7 +8 +6 + +9 +2 +0 +0 +9 + +2 +0 +2 + +9 +4 +2 + +3 +4 +3 +8 +6 + +1 +6 +3 +6 +2 + +8 +7 +7 +6 +0 + +4 +0 +5 +2 +3 + +7 +0 +9 +1 +3 + +1 +4 +3 +5 +6 + +3 +8 +8 +2 +2 + +4 +0 +7 +6 +2 + +9 +8 +2 +3 +1 + +8 +5 +9 +7 +2 + +5 +8 +8 +5 +5 + +5 +5 +5 +1 +1 + +7 +3 +1 +5 +9 + +7 +5 +9 +2 +6 + +5 +5 +6 +7 +0 + +5 +6 +7 +5 +1 + +8 +0 +5 +6 +8 + +6 +9 +9 +4 +5 + +6 +9 +1 +7 +8 + +1 +7 +9 +5 +5 + +1 +3 +8 +2 +0 + +1 +0 +1 +7 +5 + +2 +5 +3 +6 +0 + +1 +9 +9 +5 +6 + +3 +7 +8 +2 +3 + +8 +4 +9 +9 +9 + +2 +2 +7 +5 +6 + +7 +0 +3 +6 +8 + +2 +7 +5 +8 +2 + +8 +9 +4 +5 +0 + +1 +3 +1 +3 +6 + +9 +4 +2 +7 +7 + +6 +5 +6 +9 +6 + +8 +8 +9 +1 +1 + +5 +4 +3 +8 + +4 +7 +5 +4 +5 + +7 +5 +8 +5 +9 + +1 +3 +5 +4 +7 + +7 +2 +6 +7 +0 + +7 +4 +9 +4 +4 + +5 +4 +1 +3 +5 + +7 +4 +6 +7 +2 + +7 +1 +5 +2 +4 + +4 +0 +4 +0 +8 + +1 +1 +3 +1 +3 + +9 +8 +3 +6 +8 + +8 +4 +2 +5 +7 + +5 +3 +4 +7 +3 + +6 +6 +3 +7 +7 + +6 +8 +2 +8 +4 + +7 +8 +9 +3 +4 + +9 +4 +9 +4 +7 + +6 +2 +5 +8 +5 + +5 +5 +6 +5 +8 + +7 +3 +4 +2 +3 + +2 +7 +1 +5 +4 + +5 +1 +5 +4 +3 + +8 +4 +3 +4 +3 + +2 +7 +7 +9 +2 + +5 +9 +6 +3 +0 + +2 +9 +2 +7 +7 + +8 +5 +3 +8 +3 + +3 +7 +6 +0 +6 + +5 +3 +0 +7 +4 + +5 +5 +3 +3 +6 + +7 +4 +9 +1 +8 + +4 +0 +4 +9 +1 + +5 +6 +2 +9 +2 + +4 +4 +8 +6 +0 + +3 +8 +5 +5 +0 + +6 +1 +2 +8 +7 + +5 +9 +7 +2 +8 + +9 +4 +3 +5 + +8 +9 +5 +3 +1 + +3 +5 +6 +3 +8 + +5 +7 +4 +3 +0 + +3 +9 +6 +0 +8 + +4 +4 +2 +6 +4 + +8 +5 +4 +4 +5 + +7 +4 +2 +4 + +7 +8 +6 +1 +6 + +1 +0 +0 +5 +2 + +8 +2 +4 +4 +1 + +9 +1 +6 +3 +0 + +8 +4 +1 +4 +9 + +8 +8 +7 +4 +4 + +4 +5 +0 +9 +9 + +4 +3 +8 +9 +0 + +3 +7 +2 +0 +8 + +7 +1 +7 +8 +5 + +3 +5 +4 +0 +8 + +9 +7 +9 +7 +0 + +4 +9 +2 +7 +1 + +6 +1 +5 +8 +0 + +9 +0 +1 +9 +2 + +3 +4 +7 +5 +4 + +1 +2 +1 +3 +9 + +4 +4 +6 +6 +3 + +9 +7 +6 +9 +9 + +7 +9 +5 +6 +4 + +2 +2 +9 +5 +0 + +9 +3 +1 +5 +0 + +2 +5 +2 +3 +2 + +5 +0 +5 +2 +0 + +4 +3 +6 +8 +7 + +8 +8 +8 +6 +8 + +8 +0 +5 +1 +3 + +1 +5 +5 +8 +2 + +7 +2 +9 +9 + +3 +3 +6 +7 +3 + +1 +6 +5 +8 +6 + +8 +2 +7 +2 +0 + +5 +8 +8 +9 +6 + +8 +6 +6 +7 +8 + +7 +3 +0 +5 +0 + +8 +6 +3 +1 +8 + +3 +2 +7 +6 +5 + +4 +6 +1 +6 +5 + +5 +4 +4 +4 +0 + +6 +9 +2 +6 +2 + +3 +2 +7 +6 +1 + +7 +2 +1 +1 +8 + +1 +7 +9 +2 +5 + +6 +4 +0 +5 +5 + +9 +8 +9 +8 +3 + +2 +4 +5 +8 + +4 +0 +5 +8 +8 + +7 +0 +8 +1 +6 + +6 +8 +5 +7 + +4 +2 +0 +1 +5 + +5 +1 +4 +4 +7 + +1 +4 +7 +5 +5 + +2 +8 +9 +1 + +6 +2 +4 +6 +9 + +3 +1 +6 +2 +1 + +1 +7 +1 +1 + +5 +2 +7 +8 + +9 +4 +5 +9 + +8 +5 +8 +4 +0 + +9 +6 +4 +1 +6 + +2 +7 +2 +9 +9 + +8 +8 +1 +2 +7 + +7 +2 +0 +5 + +6 +0 +5 +8 + +6 +9 +4 +1 +0 + +4 +0 +4 +1 +4 + +2 +5 +4 +2 + +2 +5 +9 +9 +8 + +1 +7 +2 +9 +4 + +2 +8 +9 +6 + +6 +2 +4 +4 +4 + +8 +4 +3 +3 +7 + +2 +2 +4 +4 +0 + +1 +3 +8 +0 +1 + +9 +2 +8 +5 +8 + +1 +5 +7 +7 +7 + +4 +6 +0 +7 +4 + +7 +7 +5 +4 +6 + +2 +4 +8 +6 +8 + +9 +6 +2 +0 +3 + +6 +9 +8 +5 +3 + +9 +3 +1 +8 +0 + +5 +2 +1 +7 +1 + +5 +6 +3 +4 +5 + +4 +2 +8 +1 + +5 +1 +1 +9 +0 + +6 +0 +5 +2 +2 + +6 +2 +2 +6 +1 + +2 +8 +7 +1 +2 + +7 +1 +7 +3 +5 + +2 +1 +0 +7 +5 + +9 +6 +5 +5 +4 + +9 +9 +7 +0 +2 + +4 +0 +6 +6 +2 + +2 +9 +9 +7 + +5 +5 +5 +9 +2 + +6 +2 +6 +5 +8 + +9 +6 +0 +1 +7 + +5 +5 +7 +5 +0 + +3 +6 +0 +7 +7 + +2 +6 +7 +7 +9 + +4 +9 +3 +4 +9 + +5 +2 +4 +4 +3 + +6 +1 +2 +3 + +2 +7 +6 +6 +4 + +4 +0 +6 +7 +8 + +8 +0 +9 +3 +4 + +3 +9 +2 +3 +5 + +5 +7 +6 +4 +7 + +4 +2 +6 +4 +7 + +3 +3 +5 +4 +0 + +5 +9 +0 +6 +0 + +6 +7 +4 +3 +3 + +9 +4 +1 +4 +8 + +1 +6 +7 +1 + +7 +5 +1 +2 +3 + +2 +6 +9 +7 +6 + +6 +3 +9 +1 +4 + +1 +3 +0 +1 +5 + +2 +4 +7 +9 +3 + +4 +6 +1 +7 +6 + +8 +6 +7 +3 +5 + +6 +8 +8 +5 +7 + +3 +3 +0 +3 +9 + +1 +7 +0 +9 +8 + +6 +2 +6 +7 +3 + +6 +1 +5 +6 +4 + +1 +6 +6 +3 +0 + +3 +7 +9 +6 +1 + +8 +0 +4 +7 +7 + +6 +1 +1 +9 +4 + +2 +6 +7 +4 +7 + +2 +1 +3 +8 +5 + +1 +0 +2 +9 +3 + +4 +4 +9 +4 +9 + +3 +7 +8 +2 +8 + +3 +9 +0 +0 +3 + +3 +3 +2 +7 +3 + +2 +5 +4 +1 +4 + +6 +8 +5 +9 +5 + +7 +6 +2 +3 +4 + +1 +5 +0 +8 +5 + +7 +9 +9 +2 +7 + +4 +5 +7 +8 +3 + +9 +7 +2 +2 +3 + +8 +1 +8 +7 +8 + +7 +6 +5 +7 +1 + +4 +0 +5 +2 +1 + +5 +1 +6 +7 +8 + +1 +9 +5 +3 +5 + +1 +6 +4 +9 +9 + +7 +3 +9 +7 +7 + +9 +4 +5 +2 +0 + +6 +0 +9 +1 +6 + +8 +9 +4 +0 +6 + +5 +8 +1 +7 +9 + +4 +2 +4 +6 +1 + +4 +4 +3 +4 +3 + +3 +2 +2 +2 + +9 +4 +5 +5 + +6 +3 +2 +2 +1 + +3 +8 +2 +0 +4 + +8 +0 +2 +3 +4 + +5 +5 +8 +3 +3 + +8 +2 +0 +5 +3 + +6 +5 +1 +3 + +1 +2 +0 +2 +4 + +1 +0 +1 +1 + +9 +8 +7 +2 +5 + +9 +1 +1 +3 + +6 +8 +8 +7 +9 + +7 +6 +0 +4 +2 + +5 +7 +6 +7 +7 + +1 +2 +1 +8 +5 + +2 +8 +9 +6 +4 + +9 +5 +5 +3 +9 + +7 +1 +2 +4 +9 + +8 +1 +4 +2 +5 + +4 +9 +3 +4 +0 + +3 +8 +8 +4 +3 + +2 +0 +6 +2 +6 + +1 +6 +0 +7 +3 + +1 +1 +2 +9 +2 + +3 +6 +6 +0 +5 + +7 +8 +6 +7 +2 + +3 +1 +2 +1 + +8 +8 +8 +1 +7 + +7 +6 +8 +4 +1 + +1 +8 +5 +9 + +6 +7 +7 +0 +2 + +6 +5 +2 +2 +8 + +9 +5 +9 +3 +0 + +4 +1 +5 +4 + +3 +3 +6 +5 +4 + +9 +7 +1 +8 +9 + +5 +6 +0 +8 +9 + +7 +6 +5 +7 +3 + +5 +9 +5 +0 +9 + +6 +6 +8 +5 +6 + +1 +4 +8 +9 +4 + +9 +3 +3 +0 +2 + +4 +4 +3 +2 +8 + +5 +1 +6 +5 +2 + +3 +7 +2 +5 +2 + +4 +8 +8 +2 +8 + +5 +9 +7 +9 +1 + +9 +0 +4 +6 +1 + +9 +0 +7 +7 +2 + +1 +1 +3 +4 +0 + +2 +6 +6 +3 +4 + +2 +6 +2 +7 +9 + +1 +0 +7 +6 + +3 +4 +2 +2 +5 + +8 +7 +5 +2 +9 + +1 +7 +8 +5 +2 + +6 +4 +5 +8 +7 + +2 +0 +3 +3 +8 + +5 +1 +5 +9 +7 + +2 +0 +3 +4 +4 + +4 +0 +4 +7 +8 + +9 +0 +1 +0 +7 + +8 +9 +7 +9 +3 + +2 +0 +2 +7 +1 + +6 +4 +8 +6 +0 + +9 +0 +3 +8 +9 + +3 +3 +2 +1 + +5 +9 +3 +9 +5 + +8 +6 +1 +7 +0 + +9 +3 +1 +8 +4 + +5 +2 +9 +1 +3 + +8 +5 +1 +3 +2 + +3 +0 +1 +5 +5 + +3 +5 +9 +5 +0 + +7 +0 +9 +5 +6 + +9 +3 +8 +9 + +4 +6 +7 +0 +9 + +4 +1 +2 +1 +4 + +7 +6 +7 +8 +7 + +6 +9 + +2 +8 +8 +8 +4 + +4 +3 +2 +7 +1 + +2 +5 +6 +7 +3 + +7 +8 +3 +2 +4 + +7 +1 +8 +8 +2 + +1 +9 +2 +6 +5 + +8 +3 +0 +2 +7 + +5 +1 +9 +4 +1 + +3 +2 +0 +0 +2 + +4 +2 +4 +1 +5 + +3 +5 +3 +3 +4 + +7 +6 +8 +7 +9 + +2 +6 +5 +9 +3 + +8 +0 +1 +0 +1 + +4 +5 +7 +4 +5 + +7 +8 +7 +4 +9 + +9 +7 +8 +6 +4 + +4 +9 +8 +1 +8 + +7 +7 +9 +0 +6 + +7 +5 +2 +9 +2 + +2 +3 +7 +0 +9 + +7 +0 +5 +5 +4 + +6 +4 +6 +2 + +6 +1 +9 +5 +7 + +4 +2 +8 +1 +0 + +7 +2 +3 +5 +2 + +5 +9 +1 +9 +8 + +6 +3 +9 +3 +0 + +8 +6 +6 +1 +0 + +1 +9 +5 +8 +7 + +9 +0 +1 +8 +0 + +9 +7 +0 +1 + +2 +9 +0 +3 +9 + +7 +5 +4 +8 +9 + +3 +9 +6 +7 +8 + +7 +2 +9 +0 +5 + +2 +4 +3 +6 +8 + +2 +4 +4 +3 +2 + +3 +4 +0 +7 +7 + +5 +3 +0 +6 +9 + +3 +3 +0 +7 +0 + +9 +1 +2 +6 +8 + +3 +6 +4 +3 +2 + +6 +2 +6 +0 +3 + +4 +1 +9 +3 +2 + +4 +2 +1 +7 +0 + +6 +3 +7 +2 +8 + +8 +6 +3 +3 +5 + +4 +3 +7 +6 +6 + +8 +2 +4 +3 +5 + +5 +2 +6 +2 +8 + +1 +7 +1 +4 +6 + +6 +6 +8 +9 +5 + +5 +1 +9 +2 +8 + +7 +7 +6 +2 +6 + +4 +2 +2 +9 +6 + +8 +6 +0 +7 +9 + +3 +6 +8 +1 +8 + +1 +9 +4 +2 +5 + +5 +3 +2 +4 +3 + +9 +4 +7 +3 +0 + +3 +4 +6 +4 +5 + +4 +5 +8 +3 +0 + +6 +1 +7 +3 +2 + +3 +2 +9 +8 +0 + +3 +4 +6 +8 +0 + +8 +9 +8 +3 +3 + +5 +6 +6 +3 +9 + +9 +2 +0 +9 +0 + +6 +2 +9 +2 +8 + +1 +0 +5 +4 +5 + +7 +7 +3 +4 +7 + +1 +0 +8 +9 +4 + +8 +1 +3 +7 +5 + +2 +5 +9 +0 +9 + +4 +9 +8 +1 +0 + +2 +2 +9 +2 +5 + +2 +6 +1 +7 +8 + +1 +6 +7 +1 +8 + +8 +4 +5 +8 +5 + +7 +9 +3 +7 +3 + +1 +6 +9 +4 +7 + +2 +0 +3 +3 +7 + +4 +4 +4 +8 + +7 +9 +3 +4 +3 + +8 +2 +6 +4 +9 + +6 +5 +6 +8 +8 + +8 +7 +0 +4 +1 + +3 +1 +7 +2 +6 + +2 +0 +0 +5 +2 + +1 +5 +8 +5 + +2 +8 +5 +8 +5 + +2 +9 +4 +1 +3 + +6 +6 +4 +7 +0 + +4 +2 +5 +1 +2 + +8 +1 +9 +7 +7 + +6 +1 +3 +2 +0 + +7 +9 +7 +9 +8 + +7 +1 +6 +8 +9 + +1 +9 +2 +1 +3 + +5 +8 +4 +6 +3 + +1 +2 +5 +5 +2 + +1 +8 +8 +7 +0 + +4 +1 +7 +6 +0 + +3 +7 +3 +3 +6 + +1 +0 +4 +5 +8 + +1 +4 +3 +8 + +6 +4 +3 +5 +5 + +1 +6 +6 +6 +3 + +9 +3 +7 +3 +9 + +4 +5 +3 +8 + +5 +5 +2 +6 +5 + +7 +3 +8 +0 +9 + +7 +4 +0 +6 + +6 +0 +2 +7 +6 + +5 +4 +1 +3 +4 + +6 +7 +9 +0 +8 + +7 +0 +3 +4 +2 + +3 +8 +8 +2 +1 + +8 +5 +8 +2 +4 + +3 +3 +6 +0 +3 + +6 +8 +8 +2 +2 + +3 +8 +6 +8 +9 + +9 +3 +0 +9 +7 + +1 +0 +6 +7 +5 + +9 +8 +6 +5 +8 + +3 +2 +5 +5 +8 + +7 +2 +2 +2 +2 + +9 +7 +8 +7 +1 + +3 +9 +5 +0 +1 + +3 +0 +1 +7 +3 + +9 +4 +4 +0 +0 + +4 +5 +2 +0 +8 + +7 +1 +4 +4 +4 + +1 +7 +0 +5 +7 + +8 +0 +1 +9 +7 + +2 +4 +7 +3 +7 + +6 +0 +4 +6 +8 + +1 +2 +7 +6 +6 + +4 +8 +9 +5 +8 + +3 +9 +7 +4 +6 + +1 +0 +7 +3 +7 + +7 +4 +8 +5 + +9 +9 +9 +6 + +7 +3 +0 +7 +0 + +1 +8 +9 +9 +5 + +1 +4 +8 +2 +2 + +3 +0 +3 +5 +4 + +1 +5 +8 +7 +9 + +3 +1 +3 +8 +6 + +7 +1 +9 +0 +7 + +4 +7 +7 +3 +4 + +9 +8 +9 +5 +4 + +4 +1 +2 +4 +5 + +4 +9 +6 +7 +8 + +4 +8 +1 +2 +7 + +3 +9 +3 +9 +9 + +3 +0 +2 +8 +4 + +8 +6 +8 +4 +8 + +6 +6 +9 +5 +8 + +3 +8 +2 +0 +3 + +7 +1 +1 +1 +8 + +6 +6 +4 +5 +1 + +5 +0 +6 +9 +0 + +8 +0 +8 +8 +5 + +3 +5 +9 +1 +4 + +6 +6 +6 +6 +5 + +1 +1 +8 +4 +3 + +9 +3 +1 +5 +7 + +7 +2 +1 +4 +7 + +3 +5 +8 +0 + +1 +3 +3 +8 +9 + +9 +6 +0 +1 +0 + +6 +7 +7 +6 +1 + +9 +5 +0 +0 +5 + +2 +5 +7 +0 +4 + +4 +2 +2 +0 +6 + +6 +3 +3 +9 +6 + +5 +1 +4 +1 +9 + +7 +6 +5 +7 +4 + +9 +4 +8 +9 +0 + +6 +6 +2 +6 +6 + +4 +7 +5 +5 +2 + +8 +3 +2 +7 +4 + +3 +4 +0 +4 +8 + +3 +7 +5 +2 + +9 +8 +3 +5 +9 + +9 +8 +8 +7 +8 + +5 +6 +3 +7 +9 + +7 +9 +1 +7 +7 + +8 +4 +9 +4 +3 + +9 +9 +7 +1 +4 + +6 +5 +0 +8 +9 + +1 +7 +6 +9 +7 + +7 +0 +6 +6 +2 + +4 +8 +1 +5 +1 + +5 +9 +4 +2 +6 + +1 +2 +0 +4 +1 + +6 +4 +7 +4 +1 + +4 +2 +8 +0 +6 + +5 +6 +1 +5 +2 + +3 +5 +4 +8 +1 + +9 +0 +6 +2 + +8 +3 +1 +0 +4 + +3 +3 +3 +3 +0 + +4 +8 +7 +4 +8 + +3 +9 +7 +3 +2 + +6 +0 +2 +9 +1 + +9 +2 +1 +2 +3 + +9 +5 +4 +5 +1 + +7 +6 +0 +7 +9 + +7 +5 +5 +6 +9 + +4 +6 +6 +8 +2 + +1 +5 +9 +8 +5 + +3 +0 +2 +6 +9 + +2 +4 +9 +5 +7 + +8 +3 +0 +7 +8 + +8 +2 +8 +7 +2 + +1 +5 +0 +5 +1 + +6 +3 +4 +7 +7 + +4 +7 +6 +7 +5 + +9 +2 +0 +3 +5 + +3 +9 +2 +6 +6 + +7 +1 +9 +3 +0 + +5 +9 +8 +4 +4 + +9 +3 +5 +5 +0 + +1 +3 +8 +8 + +8 +2 +1 +7 +1 + +4 +2 +8 +5 +5 + +9 +4 +4 +4 +0 + +5 +4 +4 +3 +1 + +9 +7 +4 +5 +4 + +6 +2 +3 +8 +7 + +9 +5 +1 +6 + +6 +7 +6 + +1 +9 +6 +1 +5 + +9 +5 +0 +2 +0 + +2 +1 +0 +2 +7 + +5 +3 +7 +5 +4 + +6 +3 +5 +6 +3 + +7 +2 +6 +4 +4 + +9 +6 +5 +0 +5 + +2 +9 +3 +5 +0 + +3 +3 +7 +8 +4 + +8 +9 +9 +1 +7 + +8 +7 +7 +3 +2 + +1 +2 +0 +8 +0 + +5 +9 +2 +0 +4 + +9 +0 +8 +6 +6 + +6 +5 +2 +9 +5 + +3 +1 +6 +1 +3 + +1 +1 +1 +7 +1 + +6 +1 +7 +9 +0 + +8 +1 +5 +7 +4 + +4 +5 +5 +9 +5 + +7 +6 +4 +9 +4 + +5 +7 +3 +5 +4 + +4 +6 +0 +3 +0 + +2 +4 +6 +6 +0 + +2 +3 +0 +0 +7 + +1 +0 +9 +8 +1 + +7 +7 +0 +1 +0 + +6 +8 +9 +7 +7 + +8 +6 +6 +6 +5 + +2 +5 +3 +2 +6 + +1 +1 +0 +4 +7 + +8 +2 +6 +0 +2 + +8 +2 +3 +0 +4 + +9 +1 +7 +9 +8 + +1 +3 +6 +3 +1 + +8 +1 +2 +9 +0 + +3 +8 +9 +3 +2 + +7 +5 +1 +7 +9 + +3 +3 +3 +5 +7 + +3 +2 +4 +8 +4 + +9 +4 +8 +1 +7 + +8 +6 +2 +5 +3 + +8 +2 +1 +3 +2 + +7 +1 +3 +5 + +4 +4 +4 +9 +3 + +1 +0 +4 +6 +3 + +9 +5 +0 +9 +9 + +8 +3 +3 +3 +2 + +8 +3 +3 +7 +1 + +3 +3 +7 +1 +5 + +8 +5 +2 +9 +0 + +7 +4 +2 +2 +9 + +4 +9 +9 +5 +4 + +8 +2 +4 +0 +9 + +2 +0 +2 +1 +1 + +8 +0 +8 +8 + +1 +9 +8 +2 +2 + +4 +1 +3 +5 +0 + +9 +8 +1 +9 + +2 +6 +5 +5 +4 + +2 +2 +8 +2 +8 + +2 +9 +6 +1 +2 + +4 +4 +9 +8 +8 + +8 +9 +8 +4 +8 + +8 +8 +2 +8 +0 + +8 +3 +0 +2 +6 + +3 +1 +5 +3 +0 + +5 +8 +2 +3 +0 + +3 +8 +4 +5 +3 + +1 +8 +2 +8 +2 + +7 +7 +5 +3 +1 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog2/blog2Tag.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog2/blog2Tag.txt new file mode 100644 index 000000000..d5e68c95c --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog2/blog2Tag.txt @@ -0,0 +1,487 @@ +6 +8 +5 +6 +7 + +5 +1 +1 +9 + +3 +2 +7 +1 +3 + +6 +2 +9 +8 +7 + +3 +9 +4 +6 +1 + +3 +0 +1 +0 +9 + +2 +5 +4 +4 +7 + +1 +2 +6 +4 +1 + +4 +2 +3 +9 +7 + +3 +3 +9 +9 +7 + +8 +4 +9 +9 +1 + +3 +9 +8 +4 +7 + +7 +0 +0 +3 +9 + +9 +7 +8 +2 +9 + +4 +7 +6 +5 +9 + +9 +9 +2 +7 +7 + +8 +2 +1 +2 +9 + +8 +1 +7 +3 +7 + +4 +5 +1 +3 +1 + +2 +5 +1 +6 +3 + +3 +3 +5 +8 +9 + +5 +0 +0 +5 +1 + +8 +4 +4 +7 + +3 +5 +9 +1 +1 + +9 +2 +7 +3 +7 + +9 +6 +4 +9 +7 + +6 +7 +9 +3 +3 + +9 +1 +2 +2 +9 + +3 +4 +5 +1 +9 + +2 +9 +8 +7 +3 + +6 +6 +8 +0 +9 + +2 +8 +8 +4 +3 + +3 +5 +3 +5 +3 + +7 +4 +5 +9 +7 + +6 +8 +5 +9 +7 + +6 +1 +7 +0 +3 + +9 +8 +9 +9 +9 + +5 +4 +4 +6 +9 + +9 +2 +0 +0 +9 + +7 +0 +9 +1 +3 + +5 +5 +5 +1 +1 + +6 +6 +3 +7 +7 + +8 +0 +5 +1 +3 + +6 +8 +5 +7 + +2 +7 +2 +9 +9 + +9 +6 +0 +1 +7 + +6 +7 +4 +3 +3 + +2 +4 +7 +9 +3 + +4 +2 +4 +6 +1 + +6 +8 +8 +7 +9 + +9 +5 +5 +3 +9 + +7 +1 +2 +4 +9 + +1 +6 +0 +7 +3 + +3 +1 +2 +1 + +8 +8 +8 +1 +7 + +5 +9 +5 +0 +9 + +5 +9 +7 +9 +1 + +9 +0 +1 +0 +7 + +4 +3 +2 +7 +1 + +2 +5 +6 +7 +3 + +5 +1 +9 +4 +1 + +5 +3 +0 +6 +9 + +6 +2 +6 +0 +3 + +8 +9 +8 +3 +3 + +7 +7 +3 +4 +7 + +8 +7 +0 +4 +1 + +1 +9 +2 +1 +3 + +9 +3 +7 +3 +9 + +3 +8 +8 +2 +1 + +9 +3 +0 +9 +7 + +9 +7 +8 +7 +1 + +5 +1 +4 +1 +9 + +6 +5 +0 +8 +9 + +1 +2 +0 +4 +1 + +7 +6 +0 +7 +9 + +3 +0 +2 +6 +9 + +8 +2 +1 +7 +1 + +8 +9 +9 +1 +7 + +1 +1 +1 +7 +1 + +1 +1 +0 +4 +7 + +1 +0 +4 +6 +3 + +3 +8 +4 +5 +3 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog3/blog3.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog3/blog3.txt new file mode 100644 index 000000000..4893f4048 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog3/blog3.txt @@ -0,0 +1 @@ +82425 65336 12200 87514 44149 63424 84856 37261 67004 53956 98280 56944 92320 58306 13481 19474 39616 45845 70517 81232 4725 65873 23147 14613 39434 54105 57731 369 83326 70141 50463 98942 89834 95673 67917 92779 41937 21242 46673 85029 21633 78590 17888 75921 60315 32422 43112 21547 27834 60453 78432 46943 24387 77635 30784 6777 51628 49077 6721 31605 6155 17321 62775 8037 92883 51218 12095 44959 96587 42219 79954 54178 5335 42786 74293 32348 7609 4327 21656 70703 61823 53657 76649 42212 95001 72169 45335 23872 66345 83855 33722 19771 70117 32274 3285 47008 36570 51095 6036 80404 41746 49704 22507 74205 47075 65363 96498 59807 54183 57466 14832 62012 41149 8495 31169 61020 77239 86321 95624 52954 53618 51997 88938 54018 79855 36746 44625 7956 19435 80610 40175 91633 99415 52347 83924 63615 86607 22144 10961 16304 17187 95695 74659 15126 83417 32148 30997 25464 80397 59412 53269 71278 8410 79757 26836 83412 96861 299 43524 74071 24279 49962 34129 31454 65084 63636 66788 62465 63621 56603 71314 96375 76645 14272 72652 98924 17747 25900 63973 70637 62302 51349 9750 32871 37365 64705 26152 54860 13465 59289 69786 85465 34020 9456 52300 48868 76069 29187 93960 80564 54544 12951 81241 63005 79871 90234 30044 88699 36350 65168 67170 22601 3299 21587 49601 11937 18511 49072 47716 2711 21555 2074 92696 16978 88673 30762 1415 29427 58094 61285 86046 50841 11293 74129 70838 67807 81543 93341 12275 34047 22939 73939 11124 89796 87660 89210 75428 20561 88 58280 56124 91996 38992 59641 78316 14252 35337 1201 19635 83041 68107 59822 28021 10897 52745 3686 19926 73284 41631 98905 67142 34126 17062 92066 87791 73458 16534 12541 71488 21359 19602 70036 62181 28037 6757 63733 5909 76024 77396 71387 69692 48412 45316 90646 59076 59054 26188 86887 12564 27165 46471 82798 39978 80463 63494 65470 29521 94834 2634 40073 54069 20382 70608 57388 19047 67389 27732 70651 15557 57123 68202 33784 254 66808 53753 57701 44935 31098 66233 41157 62280 44799 98552 77528 60982 7262 59468 55136 20396 29275 76450 87942 12658 15761 83998 88835 34562 54087 73515 97999 35241 67207 77442 90736 16773 43842 67744 7750 98008 64830 68557 69969 90539 25374 55890 90732 59872 93588 70145 78391 31684 47475 81246 45831 75980 79776 26112 83614 18309 4591 87077 99780 64836 33862 45681 67902 1959 34752 66331 44767 6148 35182 79453 34260 36112 70719 14335 35143 3916 4695 24278 3208 82851 16931 45017 42570 61078 38095 34225 18334 83075 86221 41539 81812 36503 27294 77498 7071 57718 9464 23987 85286 20197 27935 12021 74112 60455 75842 19900 30296 72367 27554 71414 99246 5026 80350 20840 17395 17853 90580 91016 87118 84506 42419 62452 14993 91281 60672 57657 12419 21341 96724 32149 54068 40263 63856 29354 14891 75120 76505 12974 19999 46352 66149 57255 71413 30377 55244 20780 11236 36699 89378 53081 32191 59247 55424 29098 10020 2877 93091 24305 91892 17334 33073 32046 93889 9612 55662 29201 29137 11373 54579 73470 1160 45016 92487 64184 85688 36471 20276 64334 51629 72438 28896 61898 19571 63145 91846 26814 19286 16631 10654 40039 17312 17542 9772 23552 30150 52959 57694 32598 64511 31067 61703 41680 77794 58893 36159 41599 86516 72463 21536 17154 51091 18741 72191 7982 1569 26982 12208 81231 40056 17555 49586 44797 43575 63192 19351 42041 69976 90345 22240 65709 65551 69945 60909 6569 24555 92623 1520 19156 50866 14561 2863 69630 81667 96533 95564 63545 51326 94238 82274 47126 79564 96579 40360 45811 95038 16184 71582 30067 16085 13952 1212 75055 81740 56198 16308 74535 47281 40102 2452 52426 76439 71606 56265 89039 40431 15935 99137 74369 78090 90496 75590 3034 71066 99526 4313 34550 90917 99765 49828 54160 53852 41347 57917 65637 3760 82972 56880 8450 97028 33767 8668 59833 8203 44756 47662 17553 71445 87285 60581 4895 976 18554 41175 59030 29908 14216 84848 73306 26614 17051 81313 47879 76452 79563 6639 55495 36004 67565 75216 37713 69751 7049 32585 11036 61506 4795 99183 84463 92986 63177 43174 38174 85695 76997 71399 41813 70488 65604 8883 96591 3008 59694 71197 59210 17659 47727 71218 77910 99816 91715 66723 78997 60575 1591 42298 37697 28891 69677 74257 58478 68860 39761 9637 88646 73398 42615 95629 6606 97568 33049 71740 59326 65668 69006 82877 95980 69565 88596 49991 80862 80634 45191 90205 41847 28727 62236 84984 89935 20934 23265 90444 58238 44200 23580 60577 47661 81755 14109 25256 18679 51871 82410 44540 87267 21811 33009 28104 4 69051 65522 98396 36429 18121 49067 86561 25271 43262 8965 40300 48589 15520 49240 92577 85900 67387 5524 84315 43207 92886 87881 24678 83406 5023 14562 17886 93101 47082 83061 85995 81161 27226 81015 66640 74084 22326 15795 9179 53803 50058 61138 19770 10271 16829 3148 9569 64350 29387 42901 13747 64798 96178 84441 10867 44689 38471 56878 42977 81829 38386 92783 77077 94521 37183 88677 50657 31722 93085 3910 48853 47477 4116 42099 80985 48744 71098 96641 85038 3065 86454 646 23678 29128 60786 27487 61832 63889 6209 69329 11220 1466 53136 52487 23704 49386 7888 80864 66970 89382 1044 18622 62897 19136 18078 86084 37187 20765 67779 6206 93929 71481 5771 12576 30675 12884 84493 99146 47884 10789 11527 92121 77715 25261 27133 88309 34722 96205 3670 62809 6625 76290 55281 44649 16623 42829 53527 8747 2115 20048 21884 40296 83345 13139 97164 7149 82295 74897 16271 11016 84153 77152 29331 32943 55027 46072 3466 56493 6061 44846 63164 40222 84678 3140 70151 36632 51140 85296 58192 66531 78555 18954 66072 8106 34153 64201 21366 43550 94842 8060 94379 90925 84995 82258 10446 73629 70595 26174 4881 31458 54880 78665 9303 84122 36900 85503 93201 25584 50152 18631 89078 42408 68972 63826 8404 8193 66420 84072 49762 79135 31871 67064 2343 14011 44519 27707 95784 85819 42458 20358 77363 41081 43213 31617 29879 48153 3829 66348 26229 57346 26869 4562 65582 30068 32280 52054 57260 43328 90617 71653 27704 65288 93680 56790 63916 45606 88871 8411 48187 44461 7611 10594 41035 87435 5292 93574 45667 64117 66088 \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog3/blog3Out.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog3/blog3Out.txt new file mode 100644 index 000000000..62716a983 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog3/blog3Out.txt @@ -0,0 +1,5886 @@ +8 +2 +4 +2 +5 + +6 +5 +3 +3 +6 + +1 +2 +2 +0 +0 + +8 +7 +5 +1 +4 + +4 +4 +1 +4 +9 + +6 +3 +4 +2 +4 + +8 +4 +8 +5 +6 + +3 +7 +2 +6 +1 + +6 +7 +0 +0 +4 + +5 +3 +9 +5 +6 + +9 +8 +2 +8 +0 + +5 +6 +9 +4 +4 + +9 +2 +3 +2 +0 + +5 +8 +3 +0 +6 + +1 +3 +4 +8 +1 + +1 +9 +4 +7 +4 + +3 +9 +6 +1 +6 + +4 +5 +8 +4 +5 + +7 +0 +5 +1 +7 + +8 +1 +2 +3 +2 + +4 +7 +2 +5 + +6 +5 +8 +7 +3 + +2 +3 +1 +4 +7 + +1 +4 +6 +1 +3 + +3 +9 +4 +3 +4 + +5 +4 +1 +0 +5 + +5 +7 +7 +3 +1 + +3 +6 +9 + +8 +3 +3 +2 +6 + +7 +0 +1 +4 +1 + +5 +0 +4 +6 +3 + +9 +8 +9 +4 +2 + +8 +9 +8 +3 +4 + +9 +5 +6 +7 +3 + +6 +7 +9 +1 +7 + +9 +2 +7 +7 +9 + +4 +1 +9 +3 +7 + +2 +1 +2 +4 +2 + +4 +6 +6 +7 +3 + +8 +5 +0 +2 +9 + +2 +1 +6 +3 +3 + +7 +8 +5 +9 +0 + +1 +7 +8 +8 +8 + +7 +5 +9 +2 +1 + +6 +0 +3 +1 +5 + +3 +2 +4 +2 +2 + +4 +3 +1 +1 +2 + +2 +1 +5 +4 +7 + +2 +7 +8 +3 +4 + +6 +0 +4 +5 +3 + +7 +8 +4 +3 +2 + +4 +6 +9 +4 +3 + +2 +4 +3 +8 +7 + +7 +7 +6 +3 +5 + +3 +0 +7 +8 +4 + +6 +7 +7 +7 + +5 +1 +6 +2 +8 + +4 +9 +0 +7 +7 + +6 +7 +2 +1 + +3 +1 +6 +0 +5 + +6 +1 +5 +5 + +1 +7 +3 +2 +1 + +6 +2 +7 +7 +5 + +8 +0 +3 +7 + +9 +2 +8 +8 +3 + +5 +1 +2 +1 +8 + +1 +2 +0 +9 +5 + +4 +4 +9 +5 +9 + +9 +6 +5 +8 +7 + +4 +2 +2 +1 +9 + +7 +9 +9 +5 +4 + +5 +4 +1 +7 +8 + +5 +3 +3 +5 + +4 +2 +7 +8 +6 + +7 +4 +2 +9 +3 + +3 +2 +3 +4 +8 + +7 +6 +0 +9 + +4 +3 +2 +7 + +2 +1 +6 +5 +6 + +7 +0 +7 +0 +3 + +6 +1 +8 +2 +3 + +5 +3 +6 +5 +7 + +7 +6 +6 +4 +9 + +4 +2 +2 +1 +2 + +9 +5 +0 +0 +1 + +7 +2 +1 +6 +9 + +4 +5 +3 +3 +5 + +2 +3 +8 +7 +2 + +6 +6 +3 +4 +5 + +8 +3 +8 +5 +5 + +3 +3 +7 +2 +2 + +1 +9 +7 +7 +1 + +7 +0 +1 +1 +7 + +3 +2 +2 +7 +4 + +3 +2 +8 +5 + +4 +7 +0 +0 +8 + +3 +6 +5 +7 +0 + +5 +1 +0 +9 +5 + +6 +0 +3 +6 + +8 +0 +4 +0 +4 + +4 +1 +7 +4 +6 + +4 +9 +7 +0 +4 + +2 +2 +5 +0 +7 + +7 +4 +2 +0 +5 + +4 +7 +0 +7 +5 + +6 +5 +3 +6 +3 + +9 +6 +4 +9 +8 + +5 +9 +8 +0 +7 + +5 +4 +1 +8 +3 + +5 +7 +4 +6 +6 + +1 +4 +8 +3 +2 + +6 +2 +0 +1 +2 + +4 +1 +1 +4 +9 + +8 +4 +9 +5 + +3 +1 +1 +6 +9 + +6 +1 +0 +2 +0 + +7 +7 +2 +3 +9 + +8 +6 +3 +2 +1 + +9 +5 +6 +2 +4 + +5 +2 +9 +5 +4 + +5 +3 +6 +1 +8 + +5 +1 +9 +9 +7 + +8 +8 +9 +3 +8 + +5 +4 +0 +1 +8 + +7 +9 +8 +5 +5 + +3 +6 +7 +4 +6 + +4 +4 +6 +2 +5 + +7 +9 +5 +6 + +1 +9 +4 +3 +5 + +8 +0 +6 +1 +0 + +4 +0 +1 +7 +5 + +9 +1 +6 +3 +3 + +9 +9 +4 +1 +5 + +5 +2 +3 +4 +7 + +8 +3 +9 +2 +4 + +6 +3 +6 +1 +5 + +8 +6 +6 +0 +7 + +2 +2 +1 +4 +4 + +1 +0 +9 +6 +1 + +1 +6 +3 +0 +4 + +1 +7 +1 +8 +7 + +9 +5 +6 +9 +5 + +7 +4 +6 +5 +9 + +1 +5 +1 +2 +6 + +8 +3 +4 +1 +7 + +3 +2 +1 +4 +8 + +3 +0 +9 +9 +7 + +2 +5 +4 +6 +4 + +8 +0 +3 +9 +7 + +5 +9 +4 +1 +2 + +5 +3 +2 +6 +9 + +7 +1 +2 +7 +8 + +8 +4 +1 +0 + +7 +9 +7 +5 +7 + +2 +6 +8 +3 +6 + +8 +3 +4 +1 +2 + +9 +6 +8 +6 +1 + +2 +9 +9 + +4 +3 +5 +2 +4 + +7 +4 +0 +7 +1 + +2 +4 +2 +7 +9 + +4 +9 +9 +6 +2 + +3 +4 +1 +2 +9 + +3 +1 +4 +5 +4 + +6 +5 +0 +8 +4 + +6 +3 +6 +3 +6 + +6 +6 +7 +8 +8 + +6 +2 +4 +6 +5 + +6 +3 +6 +2 +1 + +5 +6 +6 +0 +3 + +7 +1 +3 +1 +4 + +9 +6 +3 +7 +5 + +7 +6 +6 +4 +5 + +1 +4 +2 +7 +2 + +7 +2 +6 +5 +2 + +9 +8 +9 +2 +4 + +1 +7 +7 +4 +7 + +2 +5 +9 +0 +0 + +6 +3 +9 +7 +3 + +7 +0 +6 +3 +7 + +6 +2 +3 +0 +2 + +5 +1 +3 +4 +9 + +9 +7 +5 +0 + +3 +2 +8 +7 +1 + +3 +7 +3 +6 +5 + +6 +4 +7 +0 +5 + +2 +6 +1 +5 +2 + +5 +4 +8 +6 +0 + +1 +3 +4 +6 +5 + +5 +9 +2 +8 +9 + +6 +9 +7 +8 +6 + +8 +5 +4 +6 +5 + +3 +4 +0 +2 +0 + +9 +4 +5 +6 + +5 +2 +3 +0 +0 + +4 +8 +8 +6 +8 + +7 +6 +0 +6 +9 + +2 +9 +1 +8 +7 + +9 +3 +9 +6 +0 + +8 +0 +5 +6 +4 + +5 +4 +5 +4 +4 + +1 +2 +9 +5 +1 + +8 +1 +2 +4 +1 + +6 +3 +0 +0 +5 + +7 +9 +8 +7 +1 + +9 +0 +2 +3 +4 + +3 +0 +0 +4 +4 + +8 +8 +6 +9 +9 + +3 +6 +3 +5 +0 + +6 +5 +1 +6 +8 + +6 +7 +1 +7 +0 + +2 +2 +6 +0 +1 + +3 +2 +9 +9 + +2 +1 +5 +8 +7 + +4 +9 +6 +0 +1 + +1 +1 +9 +3 +7 + +1 +8 +5 +1 +1 + +4 +9 +0 +7 +2 + +4 +7 +7 +1 +6 + +2 +7 +1 +1 + +2 +1 +5 +5 +5 + +2 +0 +7 +4 + +9 +2 +6 +9 +6 + +1 +6 +9 +7 +8 + +8 +8 +6 +7 +3 + +3 +0 +7 +6 +2 + +1 +4 +1 +5 + +2 +9 +4 +2 +7 + +5 +8 +0 +9 +4 + +6 +1 +2 +8 +5 + +8 +6 +0 +4 +6 + +5 +0 +8 +4 +1 + +1 +1 +2 +9 +3 + +7 +4 +1 +2 +9 + +7 +0 +8 +3 +8 + +6 +7 +8 +0 +7 + +8 +1 +5 +4 +3 + +9 +3 +3 +4 +1 + +1 +2 +2 +7 +5 + +3 +4 +0 +4 +7 + +2 +2 +9 +3 +9 + +7 +3 +9 +3 +9 + +1 +1 +1 +2 +4 + +8 +9 +7 +9 +6 + +8 +7 +6 +6 +0 + +8 +9 +2 +1 +0 + +7 +5 +4 +2 +8 + +2 +0 +5 +6 +1 + +8 +8 + +5 +8 +2 +8 +0 + +5 +6 +1 +2 +4 + +9 +1 +9 +9 +6 + +3 +8 +9 +9 +2 + +5 +9 +6 +4 +1 + +7 +8 +3 +1 +6 + +1 +4 +2 +5 +2 + +3 +5 +3 +3 +7 + +1 +2 +0 +1 + +1 +9 +6 +3 +5 + +8 +3 +0 +4 +1 + +6 +8 +1 +0 +7 + +5 +9 +8 +2 +2 + +2 +8 +0 +2 +1 + +1 +0 +8 +9 +7 + +5 +2 +7 +4 +5 + +3 +6 +8 +6 + +1 +9 +9 +2 +6 + +7 +3 +2 +8 +4 + +4 +1 +6 +3 +1 + +9 +8 +9 +0 +5 + +6 +7 +1 +4 +2 + +3 +4 +1 +2 +6 + +1 +7 +0 +6 +2 + +9 +2 +0 +6 +6 + +8 +7 +7 +9 +1 + +7 +3 +4 +5 +8 + +1 +6 +5 +3 +4 + +1 +2 +5 +4 +1 + +7 +1 +4 +8 +8 + +2 +1 +3 +5 +9 + +1 +9 +6 +0 +2 + +7 +0 +0 +3 +6 + +6 +2 +1 +8 +1 + +2 +8 +0 +3 +7 + +6 +7 +5 +7 + +6 +3 +7 +3 +3 + +5 +9 +0 +9 + +7 +6 +0 +2 +4 + +7 +7 +3 +9 +6 + +7 +1 +3 +8 +7 + +6 +9 +6 +9 +2 + +4 +8 +4 +1 +2 + +4 +5 +3 +1 +6 + +9 +0 +6 +4 +6 + +5 +9 +0 +7 +6 + +5 +9 +0 +5 +4 + +2 +6 +1 +8 +8 + +8 +6 +8 +8 +7 + +1 +2 +5 +6 +4 + +2 +7 +1 +6 +5 + +4 +6 +4 +7 +1 + +8 +2 +7 +9 +8 + +3 +9 +9 +7 +8 + +8 +0 +4 +6 +3 + +6 +3 +4 +9 +4 + +6 +5 +4 +7 +0 + +2 +9 +5 +2 +1 + +9 +4 +8 +3 +4 + +2 +6 +3 +4 + +4 +0 +0 +7 +3 + +5 +4 +0 +6 +9 + +2 +0 +3 +8 +2 + +7 +0 +6 +0 +8 + +5 +7 +3 +8 +8 + +1 +9 +0 +4 +7 + +6 +7 +3 +8 +9 + +2 +7 +7 +3 +2 + +7 +0 +6 +5 +1 + +1 +5 +5 +5 +7 + +5 +7 +1 +2 +3 + +6 +8 +2 +0 +2 + +3 +3 +7 +8 +4 + +2 +5 +4 + +6 +6 +8 +0 +8 + +5 +3 +7 +5 +3 + +5 +7 +7 +0 +1 + +4 +4 +9 +3 +5 + +3 +1 +0 +9 +8 + +6 +6 +2 +3 +3 + +4 +1 +1 +5 +7 + +6 +2 +2 +8 +0 + +4 +4 +7 +9 +9 + +9 +8 +5 +5 +2 + +7 +7 +5 +2 +8 + +6 +0 +9 +8 +2 + +7 +2 +6 +2 + +5 +9 +4 +6 +8 + +5 +5 +1 +3 +6 + +2 +0 +3 +9 +6 + +2 +9 +2 +7 +5 + +7 +6 +4 +5 +0 + +8 +7 +9 +4 +2 + +1 +2 +6 +5 +8 + +1 +5 +7 +6 +1 + +8 +3 +9 +9 +8 + +8 +8 +8 +3 +5 + +3 +4 +5 +6 +2 + +5 +4 +0 +8 +7 + +7 +3 +5 +1 +5 + +9 +7 +9 +9 +9 + +3 +5 +2 +4 +1 + +6 +7 +2 +0 +7 + +7 +7 +4 +4 +2 + +9 +0 +7 +3 +6 + +1 +6 +7 +7 +3 + +4 +3 +8 +4 +2 + +6 +7 +7 +4 +4 + +7 +7 +5 +0 + +9 +8 +0 +0 +8 + +6 +4 +8 +3 +0 + +6 +8 +5 +5 +7 + +6 +9 +9 +6 +9 + +9 +0 +5 +3 +9 + +2 +5 +3 +7 +4 + +5 +5 +8 +9 +0 + +9 +0 +7 +3 +2 + +5 +9 +8 +7 +2 + +9 +3 +5 +8 +8 + +7 +0 +1 +4 +5 + +7 +8 +3 +9 +1 + +3 +1 +6 +8 +4 + +4 +7 +4 +7 +5 + +8 +1 +2 +4 +6 + +4 +5 +8 +3 +1 + +7 +5 +9 +8 +0 + +7 +9 +7 +7 +6 + +2 +6 +1 +1 +2 + +8 +3 +6 +1 +4 + +1 +8 +3 +0 +9 + +4 +5 +9 +1 + +8 +7 +0 +7 +7 + +9 +9 +7 +8 +0 + +6 +4 +8 +3 +6 + +3 +3 +8 +6 +2 + +4 +5 +6 +8 +1 + +6 +7 +9 +0 +2 + +1 +9 +5 +9 + +3 +4 +7 +5 +2 + +6 +6 +3 +3 +1 + +4 +4 +7 +6 +7 + +6 +1 +4 +8 + +3 +5 +1 +8 +2 + +7 +9 +4 +5 +3 + +3 +4 +2 +6 +0 + +3 +6 +1 +1 +2 + +7 +0 +7 +1 +9 + +1 +4 +3 +3 +5 + +3 +5 +1 +4 +3 + +3 +9 +1 +6 + +4 +6 +9 +5 + +2 +4 +2 +7 +8 + +3 +2 +0 +8 + +8 +2 +8 +5 +1 + +1 +6 +9 +3 +1 + +4 +5 +0 +1 +7 + +4 +2 +5 +7 +0 + +6 +1 +0 +7 +8 + +3 +8 +0 +9 +5 + +3 +4 +2 +2 +5 + +1 +8 +3 +3 +4 + +8 +3 +0 +7 +5 + +8 +6 +2 +2 +1 + +4 +1 +5 +3 +9 + +8 +1 +8 +1 +2 + +3 +6 +5 +0 +3 + +2 +7 +2 +9 +4 + +7 +7 +4 +9 +8 + +7 +0 +7 +1 + +5 +7 +7 +1 +8 + +9 +4 +6 +4 + +2 +3 +9 +8 +7 + +8 +5 +2 +8 +6 + +2 +0 +1 +9 +7 + +2 +7 +9 +3 +5 + +1 +2 +0 +2 +1 + +7 +4 +1 +1 +2 + +6 +0 +4 +5 +5 + +7 +5 +8 +4 +2 + +1 +9 +9 +0 +0 + +3 +0 +2 +9 +6 + +7 +2 +3 +6 +7 + +2 +7 +5 +5 +4 + +7 +1 +4 +1 +4 + +9 +9 +2 +4 +6 + +5 +0 +2 +6 + +8 +0 +3 +5 +0 + +2 +0 +8 +4 +0 + +1 +7 +3 +9 +5 + +1 +7 +8 +5 +3 + +9 +0 +5 +8 +0 + +9 +1 +0 +1 +6 + +8 +7 +1 +1 +8 + +8 +4 +5 +0 +6 + +4 +2 +4 +1 +9 + +6 +2 +4 +5 +2 + +1 +4 +9 +9 +3 + +9 +1 +2 +8 +1 + +6 +0 +6 +7 +2 + +5 +7 +6 +5 +7 + +1 +2 +4 +1 +9 + +2 +1 +3 +4 +1 + +9 +6 +7 +2 +4 + +3 +2 +1 +4 +9 + +5 +4 +0 +6 +8 + +4 +0 +2 +6 +3 + +6 +3 +8 +5 +6 + +2 +9 +3 +5 +4 + +1 +4 +8 +9 +1 + +7 +5 +1 +2 +0 + +7 +6 +5 +0 +5 + +1 +2 +9 +7 +4 + +1 +9 +9 +9 +9 + +4 +6 +3 +5 +2 + +6 +6 +1 +4 +9 + +5 +7 +2 +5 +5 + +7 +1 +4 +1 +3 + +3 +0 +3 +7 +7 + +5 +5 +2 +4 +4 + +2 +0 +7 +8 +0 + +1 +1 +2 +3 +6 + +3 +6 +6 +9 +9 + +8 +9 +3 +7 +8 + +5 +3 +0 +8 +1 + +3 +2 +1 +9 +1 + +5 +9 +2 +4 +7 + +5 +5 +4 +2 +4 + +2 +9 +0 +9 +8 + +1 +0 +0 +2 +0 + +2 +8 +7 +7 + +9 +3 +0 +9 +1 + +2 +4 +3 +0 +5 + +9 +1 +8 +9 +2 + +1 +7 +3 +3 +4 + +3 +3 +0 +7 +3 + +3 +2 +0 +4 +6 + +9 +3 +8 +8 +9 + +9 +6 +1 +2 + +5 +5 +6 +6 +2 + +2 +9 +2 +0 +1 + +2 +9 +1 +3 +7 + +1 +1 +3 +7 +3 + +5 +4 +5 +7 +9 + +7 +3 +4 +7 +0 + +1 +1 +6 +0 + +4 +5 +0 +1 +6 + +9 +2 +4 +8 +7 + +6 +4 +1 +8 +4 + +8 +5 +6 +8 +8 + +3 +6 +4 +7 +1 + +2 +0 +2 +7 +6 + +6 +4 +3 +3 +4 + +5 +1 +6 +2 +9 + +7 +2 +4 +3 +8 + +2 +8 +8 +9 +6 + +6 +1 +8 +9 +8 + +1 +9 +5 +7 +1 + +6 +3 +1 +4 +5 + +9 +1 +8 +4 +6 + +2 +6 +8 +1 +4 + +1 +9 +2 +8 +6 + +1 +6 +6 +3 +1 + +1 +0 +6 +5 +4 + +4 +0 +0 +3 +9 + +1 +7 +3 +1 +2 + +1 +7 +5 +4 +2 + +9 +7 +7 +2 + +2 +3 +5 +5 +2 + +3 +0 +1 +5 +0 + +5 +2 +9 +5 +9 + +5 +7 +6 +9 +4 + +3 +2 +5 +9 +8 + +6 +4 +5 +1 +1 + +3 +1 +0 +6 +7 + +6 +1 +7 +0 +3 + +4 +1 +6 +8 +0 + +7 +7 +7 +9 +4 + +5 +8 +8 +9 +3 + +3 +6 +1 +5 +9 + +4 +1 +5 +9 +9 + +8 +6 +5 +1 +6 + +7 +2 +4 +6 +3 + +2 +1 +5 +3 +6 + +1 +7 +1 +5 +4 + +5 +1 +0 +9 +1 + +1 +8 +7 +4 +1 + +7 +2 +1 +9 +1 + +7 +9 +8 +2 + +1 +5 +6 +9 + +2 +6 +9 +8 +2 + +1 +2 +2 +0 +8 + +8 +1 +2 +3 +1 + +4 +0 +0 +5 +6 + +1 +7 +5 +5 +5 + +4 +9 +5 +8 +6 + +4 +4 +7 +9 +7 + +4 +3 +5 +7 +5 + +6 +3 +1 +9 +2 + +1 +9 +3 +5 +1 + +4 +2 +0 +4 +1 + +6 +9 +9 +7 +6 + +9 +0 +3 +4 +5 + +2 +2 +2 +4 +0 + +6 +5 +7 +0 +9 + +6 +5 +5 +5 +1 + +6 +9 +9 +4 +5 + +6 +0 +9 +0 +9 + +6 +5 +6 +9 + +2 +4 +5 +5 +5 + +9 +2 +6 +2 +3 + +1 +5 +2 +0 + +1 +9 +1 +5 +6 + +5 +0 +8 +6 +6 + +1 +4 +5 +6 +1 + +2 +8 +6 +3 + +6 +9 +6 +3 +0 + +8 +1 +6 +6 +7 + +9 +6 +5 +3 +3 + +9 +5 +5 +6 +4 + +6 +3 +5 +4 +5 + +5 +1 +3 +2 +6 + +9 +4 +2 +3 +8 + +8 +2 +2 +7 +4 + +4 +7 +1 +2 +6 + +7 +9 +5 +6 +4 + +9 +6 +5 +7 +9 + +4 +0 +3 +6 +0 + +4 +5 +8 +1 +1 + +9 +5 +0 +3 +8 + +1 +6 +1 +8 +4 + +7 +1 +5 +8 +2 + +3 +0 +0 +6 +7 + +1 +6 +0 +8 +5 + +1 +3 +9 +5 +2 + +1 +2 +1 +2 + +7 +5 +0 +5 +5 + +8 +1 +7 +4 +0 + +5 +6 +1 +9 +8 + +1 +6 +3 +0 +8 + +7 +4 +5 +3 +5 + +4 +7 +2 +8 +1 + +4 +0 +1 +0 +2 + +2 +4 +5 +2 + +5 +2 +4 +2 +6 + +7 +6 +4 +3 +9 + +7 +1 +6 +0 +6 + +5 +6 +2 +6 +5 + +8 +9 +0 +3 +9 + +4 +0 +4 +3 +1 + +1 +5 +9 +3 +5 + +9 +9 +1 +3 +7 + +7 +4 +3 +6 +9 + +7 +8 +0 +9 +0 + +9 +0 +4 +9 +6 + +7 +5 +5 +9 +0 + +3 +0 +3 +4 + +7 +1 +0 +6 +6 + +9 +9 +5 +2 +6 + +4 +3 +1 +3 + +3 +4 +5 +5 +0 + +9 +0 +9 +1 +7 + +9 +9 +7 +6 +5 + +4 +9 +8 +2 +8 + +5 +4 +1 +6 +0 + +5 +3 +8 +5 +2 + +4 +1 +3 +4 +7 + +5 +7 +9 +1 +7 + +6 +5 +6 +3 +7 + +3 +7 +6 +0 + +8 +2 +9 +7 +2 + +5 +6 +8 +8 +0 + +8 +4 +5 +0 + +9 +7 +0 +2 +8 + +3 +3 +7 +6 +7 + +8 +6 +6 +8 + +5 +9 +8 +3 +3 + +8 +2 +0 +3 + +4 +4 +7 +5 +6 + +4 +7 +6 +6 +2 + +1 +7 +5 +5 +3 + +7 +1 +4 +4 +5 + +8 +7 +2 +8 +5 + +6 +0 +5 +8 +1 + +4 +8 +9 +5 + +9 +7 +6 + +1 +8 +5 +5 +4 + +4 +1 +1 +7 +5 + +5 +9 +0 +3 +0 + +2 +9 +9 +0 +8 + +1 +4 +2 +1 +6 + +8 +4 +8 +4 +8 + +7 +3 +3 +0 +6 + +2 +6 +6 +1 +4 + +1 +7 +0 +5 +1 + +8 +1 +3 +1 +3 + +4 +7 +8 +7 +9 + +7 +6 +4 +5 +2 + +7 +9 +5 +6 +3 + +6 +6 +3 +9 + +5 +5 +4 +9 +5 + +3 +6 +0 +0 +4 + +6 +7 +5 +6 +5 + +7 +5 +2 +1 +6 + +3 +7 +7 +1 +3 + +6 +9 +7 +5 +1 + +7 +0 +4 +9 + +3 +2 +5 +8 +5 + +1 +1 +0 +3 +6 + +6 +1 +5 +0 +6 + +4 +7 +9 +5 + +9 +9 +1 +8 +3 + +8 +4 +4 +6 +3 + +9 +2 +9 +8 +6 + +6 +3 +1 +7 +7 + +4 +3 +1 +7 +4 + +3 +8 +1 +7 +4 + +8 +5 +6 +9 +5 + +7 +6 +9 +9 +7 + +7 +1 +3 +9 +9 + +4 +1 +8 +1 +3 + +7 +0 +4 +8 +8 + +6 +5 +6 +0 +4 + +8 +8 +8 +3 + +9 +6 +5 +9 +1 + +3 +0 +0 +8 + +5 +9 +6 +9 +4 + +7 +1 +1 +9 +7 + +5 +9 +2 +1 +0 + +1 +7 +6 +5 +9 + +4 +7 +7 +2 +7 + +7 +1 +2 +1 +8 + +7 +7 +9 +1 +0 + +9 +9 +8 +1 +6 + +9 +1 +7 +1 +5 + +6 +6 +7 +2 +3 + +7 +8 +9 +9 +7 + +6 +0 +5 +7 +5 + +1 +5 +9 +1 + +4 +2 +2 +9 +8 + +3 +7 +6 +9 +7 + +2 +8 +8 +9 +1 + +6 +9 +6 +7 +7 + +7 +4 +2 +5 +7 + +5 +8 +4 +7 +8 + +6 +8 +8 +6 +0 + +3 +9 +7 +6 +1 + +9 +6 +3 +7 + +8 +8 +6 +4 +6 + +7 +3 +3 +9 +8 + +4 +2 +6 +1 +5 + +9 +5 +6 +2 +9 + +6 +6 +0 +6 + +9 +7 +5 +6 +8 + +3 +3 +0 +4 +9 + +7 +1 +7 +4 +0 + +5 +9 +3 +2 +6 + +6 +5 +6 +6 +8 + +6 +9 +0 +0 +6 + +8 +2 +8 +7 +7 + +9 +5 +9 +8 +0 + +6 +9 +5 +6 +5 + +8 +8 +5 +9 +6 + +4 +9 +9 +9 +1 + +8 +0 +8 +6 +2 + +8 +0 +6 +3 +4 + +4 +5 +1 +9 +1 + +9 +0 +2 +0 +5 + +4 +1 +8 +4 +7 + +2 +8 +7 +2 +7 + +6 +2 +2 +3 +6 + +8 +4 +9 +8 +4 + +8 +9 +9 +3 +5 + +2 +0 +9 +3 +4 + +2 +3 +2 +6 +5 + +9 +0 +4 +4 +4 + +5 +8 +2 +3 +8 + +4 +4 +2 +0 +0 + +2 +3 +5 +8 +0 + +6 +0 +5 +7 +7 + +4 +7 +6 +6 +1 + +8 +1 +7 +5 +5 + +1 +4 +1 +0 +9 + +2 +5 +2 +5 +6 + +1 +8 +6 +7 +9 + +5 +1 +8 +7 +1 + +8 +2 +4 +1 +0 + +4 +4 +5 +4 +0 + +8 +7 +2 +6 +7 + +2 +1 +8 +1 +1 + +3 +3 +0 +0 +9 + +2 +8 +1 +0 +4 + +4 + +6 +9 +0 +5 +1 + +6 +5 +5 +2 +2 + +9 +8 +3 +9 +6 + +3 +6 +4 +2 +9 + +1 +8 +1 +2 +1 + +4 +9 +0 +6 +7 + +8 +6 +5 +6 +1 + +2 +5 +2 +7 +1 + +4 +3 +2 +6 +2 + +8 +9 +6 +5 + +4 +0 +3 +0 +0 + +4 +8 +5 +8 +9 + +1 +5 +5 +2 +0 + +4 +9 +2 +4 +0 + +9 +2 +5 +7 +7 + +8 +5 +9 +0 +0 + +6 +7 +3 +8 +7 + +5 +5 +2 +4 + +8 +4 +3 +1 +5 + +4 +3 +2 +0 +7 + +9 +2 +8 +8 +6 + +8 +7 +8 +8 +1 + +2 +4 +6 +7 +8 + +8 +3 +4 +0 +6 + +5 +0 +2 +3 + +1 +4 +5 +6 +2 + +1 +7 +8 +8 +6 + +9 +3 +1 +0 +1 + +4 +7 +0 +8 +2 + +8 +3 +0 +6 +1 + +8 +5 +9 +9 +5 + +8 +1 +1 +6 +1 + +2 +7 +2 +2 +6 + +8 +1 +0 +1 +5 + +6 +6 +6 +4 +0 + +7 +4 +0 +8 +4 + +2 +2 +3 +2 +6 + +1 +5 +7 +9 +5 + +9 +1 +7 +9 + +5 +3 +8 +0 +3 + +5 +0 +0 +5 +8 + +6 +1 +1 +3 +8 + +1 +9 +7 +7 +0 + +1 +0 +2 +7 +1 + +1 +6 +8 +2 +9 + +3 +1 +4 +8 + +9 +5 +6 +9 + +6 +4 +3 +5 +0 + +2 +9 +3 +8 +7 + +4 +2 +9 +0 +1 + +1 +3 +7 +4 +7 + +6 +4 +7 +9 +8 + +9 +6 +1 +7 +8 + +8 +4 +4 +4 +1 + +1 +0 +8 +6 +7 + +4 +4 +6 +8 +9 + +3 +8 +4 +7 +1 + +5 +6 +8 +7 +8 + +4 +2 +9 +7 +7 + +8 +1 +8 +2 +9 + +3 +8 +3 +8 +6 + +9 +2 +7 +8 +3 + +7 +7 +0 +7 +7 + +9 +4 +5 +2 +1 + +3 +7 +1 +8 +3 + +8 +8 +6 +7 +7 + +5 +0 +6 +5 +7 + +3 +1 +7 +2 +2 + +9 +3 +0 +8 +5 + +3 +9 +1 +0 + +4 +8 +8 +5 +3 + +4 +7 +4 +7 +7 + +4 +1 +1 +6 + +4 +2 +0 +9 +9 + +8 +0 +9 +8 +5 + +4 +8 +7 +4 +4 + +7 +1 +0 +9 +8 + +9 +6 +6 +4 +1 + +8 +5 +0 +3 +8 + +3 +0 +6 +5 + +8 +6 +4 +5 +4 + +6 +4 +6 + +2 +3 +6 +7 +8 + +2 +9 +1 +2 +8 + +6 +0 +7 +8 +6 + +2 +7 +4 +8 +7 + +6 +1 +8 +3 +2 + +6 +3 +8 +8 +9 + +6 +2 +0 +9 + +6 +9 +3 +2 +9 + +1 +1 +2 +2 +0 + +1 +4 +6 +6 + +5 +3 +1 +3 +6 + +5 +2 +4 +8 +7 + +2 +3 +7 +0 +4 + +4 +9 +3 +8 +6 + +7 +8 +8 +8 + +8 +0 +8 +6 +4 + +6 +6 +9 +7 +0 + +8 +9 +3 +8 +2 + +1 +0 +4 +4 + +1 +8 +6 +2 +2 + +6 +2 +8 +9 +7 + +1 +9 +1 +3 +6 + +1 +8 +0 +7 +8 + +8 +6 +0 +8 +4 + +3 +7 +1 +8 +7 + +2 +0 +7 +6 +5 + +6 +7 +7 +7 +9 + +6 +2 +0 +6 + +9 +3 +9 +2 +9 + +7 +1 +4 +8 +1 + +5 +7 +7 +1 + +1 +2 +5 +7 +6 + +3 +0 +6 +7 +5 + +1 +2 +8 +8 +4 + +8 +4 +4 +9 +3 + +9 +9 +1 +4 +6 + +4 +7 +8 +8 +4 + +1 +0 +7 +8 +9 + +1 +1 +5 +2 +7 + +9 +2 +1 +2 +1 + +7 +7 +7 +1 +5 + +2 +5 +2 +6 +1 + +2 +7 +1 +3 +3 + +8 +8 +3 +0 +9 + +3 +4 +7 +2 +2 + +9 +6 +2 +0 +5 + +3 +6 +7 +0 + +6 +2 +8 +0 +9 + +6 +6 +2 +5 + +7 +6 +2 +9 +0 + +5 +5 +2 +8 +1 + +4 +4 +6 +4 +9 + +1 +6 +6 +2 +3 + +4 +2 +8 +2 +9 + +5 +3 +5 +2 +7 + +8 +7 +4 +7 + +2 +1 +1 +5 + +2 +0 +0 +4 +8 + +2 +1 +8 +8 +4 + +4 +0 +2 +9 +6 + +8 +3 +3 +4 +5 + +1 +3 +1 +3 +9 + +9 +7 +1 +6 +4 + +7 +1 +4 +9 + +8 +2 +2 +9 +5 + +7 +4 +8 +9 +7 + +1 +6 +2 +7 +1 + +1 +1 +0 +1 +6 + +8 +4 +1 +5 +3 + +7 +7 +1 +5 +2 + +2 +9 +3 +3 +1 + +3 +2 +9 +4 +3 + +5 +5 +0 +2 +7 + +4 +6 +0 +7 +2 + +3 +4 +6 +6 + +5 +6 +4 +9 +3 + +6 +0 +6 +1 + +4 +4 +8 +4 +6 + +6 +3 +1 +6 +4 + +4 +0 +2 +2 +2 + +8 +4 +6 +7 +8 + +3 +1 +4 +0 + +7 +0 +1 +5 +1 + +3 +6 +6 +3 +2 + +5 +1 +1 +4 +0 + +8 +5 +2 +9 +6 + +5 +8 +1 +9 +2 + +6 +6 +5 +3 +1 + +7 +8 +5 +5 +5 + +1 +8 +9 +5 +4 + +6 +6 +0 +7 +2 + +8 +1 +0 +6 + +3 +4 +1 +5 +3 + +6 +4 +2 +0 +1 + +2 +1 +3 +6 +6 + +4 +3 +5 +5 +0 + +9 +4 +8 +4 +2 + +8 +0 +6 +0 + +9 +4 +3 +7 +9 + +9 +0 +9 +2 +5 + +8 +4 +9 +9 +5 + +8 +2 +2 +5 +8 + +1 +0 +4 +4 +6 + +7 +3 +6 +2 +9 + +7 +0 +5 +9 +5 + +2 +6 +1 +7 +4 + +4 +8 +8 +1 + +3 +1 +4 +5 +8 + +5 +4 +8 +8 +0 + +7 +8 +6 +6 +5 + +9 +3 +0 +3 + +8 +4 +1 +2 +2 + +3 +6 +9 +0 +0 + +8 +5 +5 +0 +3 + +9 +3 +2 +0 +1 + +2 +5 +5 +8 +4 + +5 +0 +1 +5 +2 + +1 +8 +6 +3 +1 + +8 +9 +0 +7 +8 + +4 +2 +4 +0 +8 + +6 +8 +9 +7 +2 + +6 +3 +8 +2 +6 + +8 +4 +0 +4 + +8 +1 +9 +3 + +6 +6 +4 +2 +0 + +8 +4 +0 +7 +2 + +4 +9 +7 +6 +2 + +7 +9 +1 +3 +5 + +3 +1 +8 +7 +1 + +6 +7 +0 +6 +4 + +2 +3 +4 +3 + +1 +4 +0 +1 +1 + +4 +4 +5 +1 +9 + +2 +7 +7 +0 +7 + +9 +5 +7 +8 +4 + +8 +5 +8 +1 +9 + +4 +2 +4 +5 +8 + +2 +0 +3 +5 +8 + +7 +7 +3 +6 +3 + +4 +1 +0 +8 +1 + +4 +3 +2 +1 +3 + +3 +1 +6 +1 +7 + +2 +9 +8 +7 +9 + +4 +8 +1 +5 +3 + +3 +8 +2 +9 + +6 +6 +3 +4 +8 + +2 +6 +2 +2 +9 + +5 +7 +3 +4 +6 + +2 +6 +8 +6 +9 + +4 +5 +6 +2 + +6 +5 +5 +8 +2 + +3 +0 +0 +6 +8 + +3 +2 +2 +8 +0 + +5 +2 +0 +5 +4 + +5 +7 +2 +6 +0 + +4 +3 +3 +2 +8 + +9 +0 +6 +1 +7 + +7 +1 +6 +5 +3 + +2 +7 +7 +0 +4 + +6 +5 +2 +8 +8 + +9 +3 +6 +8 +0 + +5 +6 +7 +9 +0 + +6 +3 +9 +1 +6 + +4 +5 +6 +0 +6 + +8 +8 +8 +7 +1 + +8 +4 +1 +1 + +4 +8 +1 +8 +7 + +4 +4 +4 +6 +1 + +7 +6 +1 +1 + +1 +0 +5 +9 +4 + +4 +1 +0 +3 +5 + +8 +7 +4 +3 +5 + +5 +2 +9 +2 + +9 +3 +5 +7 +4 + +4 +5 +6 +6 +7 + +6 +4 +1 +1 +7 + +6 +6 +0 +8 +8 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog3/blog3Tag.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog3/blog3Tag.txt new file mode 100644 index 000000000..9ee0337de --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog3/blog3Tag.txt @@ -0,0 +1,591 @@ +5 +7 +7 +3 +1 + +7 +0 +1 +4 +1 + +9 +2 +7 +7 +9 + +1 +7 +3 +2 +1 + +4 +4 +9 +5 +9 + +9 +6 +5 +8 +7 + +7 +4 +2 +9 +3 + +4 +3 +2 +7 + +5 +3 +6 +5 +7 + +7 +6 +6 +4 +9 + +7 +2 +1 +6 +9 + +7 +0 +1 +1 +7 + +4 +1 +1 +4 +9 + +7 +7 +2 +3 +9 + +8 +3 +4 +1 +7 + +5 +3 +2 +6 +9 + +7 +9 +7 +5 +7 + +7 +4 +0 +7 +1 + +3 +4 +1 +2 +9 + +1 +7 +7 +4 +7 + +5 +1 +3 +4 +9 + +3 +2 +9 +9 + +2 +1 +5 +8 +7 + +2 +7 +1 +1 + +6 +7 +8 +0 +7 + +7 +3 +9 +3 +9 + +1 +2 +0 +1 + +1 +2 +5 +4 +1 + +7 +1 +3 +8 +7 + +4 +6 +4 +7 +1 + +1 +5 +7 +6 +1 + +4 +5 +9 +1 + +1 +6 +9 +3 +1 + +4 +1 +5 +3 +9 + +7 +2 +3 +6 +7 + +2 +1 +3 +4 +1 + +1 +4 +8 +9 +1 + +7 +1 +4 +1 +3 + +3 +2 +1 +9 +1 + +3 +3 +0 +7 +3 + +9 +3 +8 +8 +9 + +2 +9 +2 +0 +1 + +2 +9 +1 +3 +7 + +1 +9 +5 +7 +1 + +1 +6 +6 +3 +1 + +4 +0 +0 +3 +9 + +6 +1 +7 +0 +3 + +4 +4 +7 +9 +7 + +6 +5 +5 +5 +1 + +6 +5 +6 +9 + +9 +2 +6 +2 +3 + +1 +4 +5 +6 +1 + +8 +1 +6 +6 +7 + +9 +9 +1 +3 +7 + +9 +0 +9 +1 +7 + +5 +7 +9 +1 +7 + +3 +3 +7 +6 +7 + +5 +9 +8 +3 +3 + +8 +4 +4 +6 +3 + +7 +1 +3 +9 +9 + +4 +1 +8 +1 +3 + +1 +7 +6 +5 +9 + +6 +9 +6 +7 +7 + +7 +4 +2 +5 +7 + +3 +9 +7 +6 +1 + +9 +5 +6 +2 +9 + +3 +3 +0 +4 +9 + +4 +9 +9 +9 +1 + +4 +5 +1 +9 +1 + +1 +8 +6 +7 +9 + +5 +1 +8 +7 +1 + +1 +8 +1 +2 +1 + +8 +6 +5 +6 +1 + +4 +8 +5 +8 +9 + +4 +3 +2 +0 +7 + +8 +7 +8 +8 +1 + +5 +0 +2 +3 + +1 +0 +2 +7 +1 + +1 +6 +8 +2 +9 + +2 +9 +3 +8 +7 + +4 +2 +9 +0 +1 + +1 +0 +8 +6 +7 + +2 +7 +4 +8 +7 + +6 +2 +8 +9 +7 + +1 +0 +7 +8 +9 + +1 +1 +5 +2 +7 + +2 +5 +2 +6 +1 + +4 +2 +8 +2 +9 + +5 +3 +5 +2 +7 + +8 +7 +4 +7 + +7 +4 +8 +9 +7 + +9 +4 +3 +7 +9 + +1 +4 +0 +1 +1 + +4 +4 +5 +1 +9 + +8 +5 +8 +1 +9 + +4 +1 +0 +8 +1 + +2 +9 +8 +7 +9 + +9 +0 +6 +1 +7 + +4 +8 +1 +8 +7 + +4 +5 +6 +6 +7 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog4/blog4.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog4/blog4.txt new file mode 100644 index 000000000..6afcbb331 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog4/blog4.txt @@ -0,0 +1 @@ +82811 85509 76080 76048 6871 78076 62961 46654 68702 52223 92097 53412 37102 44094 94937 10017 70317 70912 91330 49929 56674 13012 44467 60158 98375 73708 59841 6048 55335 41012 13388 96588 88261 87659 5232 88719 71229 78316 90971 55518 25923 80067 7368 5666 48752 70194 85072 73867 48920 12933 58308 56699 66307 86682 50386 36927 99360 70022 25651 13263 40630 49018 4718 85540 54532 5273 62371 6708 80306 72405 48753 21852 85884 61393 25077 82405 86299 95864 63971 92560 244 42160 53563 61072 46117 57395 49597 27306 42202 12730 49508 85333 49457 57830 56932 49708 62278 22603 31344 65876 48111 80297 1737 73797 35907 95096 87608 62128 24177 12472 35739 18893 93255 29078 423 68581 23886 46774 48632 96802 6124 62847 94061 82317 61014 94053 88111 78360 80298 50487 84129 67247 33809 90691 45557 50712 59082 32274 33931 22469 49541 83547 35004 52526 91893 78783 71096 37758 33024 9748 75349 82455 34611 68590 33370 20993 90630 82038 16859 5876 41443 60325 90254 9033 74937 99598 25154 73981 98314 79106 51779 58744 32063 57077 33152 6382 95498 55847 14149 12553 60725 17086 10631 14454 87402 2575 44068 52124 82729 67259 27376 43354 88643 87152 79840 67087 64877 10605 38299 15493 44490 79837 39055 97467 67974 69713 72184 2781 11185 44370 54597 37119 47836 97533 56690 90649 34653 77175 25531 25573 24242 68928 11652 76221 73443 22939 12066 86535 23654 67488 70848 33376 52853 57988 70042 72378 35752 62641 19793 51732 84472 68235 27489 59972 61357 78411 23914 84411 46689 58422 55858 32364 65304 10438 51045 65982 37900 26012 77534 48565 19546 11673 45896 46303 80714 37983 4315 82555 82655 83505 4000 35081 16589 59081 13995 43666 12600 91425 62086 95476 85850 53704 87136 54662 59515 19789 24349 53963 36061 61618 85165 54586 80336 6159 5452 71127 98724 17312 66270 40134 30292 6051 76001 1176 6827 63124 71285 79656 68333 80049 74533 28857 43908 58024 59424 59501 35498 51339 19987 16699 9644 28726 9517 55314 90092 61104 31690 68843 9163 49965 41335 72944 22356 39764 39527 40851 42006 22347 56930 91054 25756 24583 95436 62631 39207 84352 31352 62606 8892 86720 51724 74040 51472 96469 87972 29728 2050 13146 16752 19349 79224 65972 66411 43991 86569 29960 5745 37678 60990 8213 61067 95816 97503 31084 66712 36701 66041 11318 58280 27920 81691 8643 55158 57954 42614 77014 7403 96245 3282 22770 59356 18860 18571 14857 65712 50717 32155 19245 34997 10472 81351 83651 29433 50432 88376 25239 20481 55701 34582 66471 19336 42871 7679 27684 75677 96085 18423 21227 56710 61003 97820 86301 84009 45397 63746 38740 11651 7002 96624 47629 8194 90020 92028 25312 88191 82176 15943 41135 86490 57906 9290 88449 91395 80087 38060 30755 67838 14073 89003 6979 36257 24754 23784 46804 69099 69279 22776 75047 4116 87482 85682 96415 4555 54724 13875 66302 45833 80831 76634 8030 78102 55274 7879 82787 33180 11513 17691 72622 89685 42340 82198 5896 8642 21223 63 69920 93695 93701 9329 51588 24570 22534 88936 39376 50345 89464 34887 85148 98278 94928 80760 55076 16496 90775 39751 7560 18223 12625 43541 27021 53748 76012 42059 10732 95561 38591 42194 60482 47946 40744 7399 61004 2675 24118 60344 23270 13512 62654 73358 45062 75764 59796 96894 44300 68610 88651 96995 83118 88880 15574 67518 78309 40561 69539 49433 13478 90776 24782 30826 14894 13776 65730 87064 13240 5740 91592 14721 66433 30199 51274 77936 21144 68455 74262 25101 68594 73542 58494 60053 40171 68043 57725 66806 47606 28238 95199 85188 23160 95644 94893 3041 66799 64522 91519 39001 71598 98234 11013 88146 69788 4181 72798 9156 6312 53380 95577 59080 85885 76525 36563 12723 15505 77477 79442 19705 29647 95801 61360 40453 96100 17221 28031 85924 97358 86076 95014 87740 24372 16123 3651 45970 85353 19963 75901 87411 43313 57924 55737 64087 68932 17465 22681 57097 21325 42735 75431 89492 55504 6060 29158 11777 61307 3053 44638 25815 3091 86237 85069 6009 31553 25173 91715 91147 42888 92675 80007 27132 65705 6052 5684 93196 11450 41973 79358 4195 9032 58729 73407 81355 35419 92143 66651 12628 39520 15661 94960 5392 30427 85650 64569 90617 93425 30285 81561 10264 91932 4490 85582 93253 72787 52171 687 7317 85666 16208 47548 36928 46473 12423 70106 81851 38157 93464 54027 48633 29811 1663 29484 86333 23748 97705 12696 1836 17161 9740 63036 59592 39656 98352 86592 51887 57081 29777 73086 81255 17642 96043 70054 16160 69955 98790 13357 30636 17118 20845 74440 81669 33526 79338 28086 66979 92455 4138 7232 30004 17521 4052 66901 38340 7786 46859 64563 35114 67687 44990 53218 28352 85153 7774 78369 16964 28060 9543 70777 2479 88556 15214 77370 16314 58855 2216 92457 74034 37059 86702 32355 36615 25562 98022 21358 55720 5545 99621 6530 87199 80282 32853 39696 35430 53666 18316 20095 27835 57957 7099 57025 67022 63274 20899 82839 11542 77367 56573 22009 49502 7623 8889 9533 75916 50976 57144 70952 59637 71494 3844 96131 38417 89333 8542 23871 11171 18169 60810 39415 23708 10704 97608 97560 11929 78226 81885 26998 22173 99573 96396 82041 96321 27571 65777 75953 18386 79038 49404 62489 46121 48615 95773 57663 23020 89347 20638 57126 60413 82751 86164 1542 44291 82827 73172 3262 45727 84291 28274 61530 33568 73998 95883 28154 6534 23332 4711 16770 18359 54369 29277 82755 31023 68221 38483 73405 31864 93922 95086 70764 57407 38878 34623 98499 18077 48252 80144 64947 71703 92932 12620 86856 25499 52230 36258 58251 67415 77884 76024 54507 99234 86012 31003 57279 37690 89536 30980 59247 28842 53438 55525 8393 63562 70736 45016 24540 52237 2438 85287 79715 5258 94579 71230 16655 39996 56366 35584 60612 42100 76116 65738 98755 28574 33492 68713 70922 89978 56170 88964 51438 63112 18009 10549 56287 86780 54451 38891 81797 87902 90288 89931 86271 79484 87852 18684 29934 51121 47566 94261 33286 76736 10219 8451 36971 11016 71836 53239 19569 96567 11857 12570 28806 2299 75156 67521 26522 32419 7563 43087 62309 29880 90317 74510 69906 73591 97520 89677 58836 65262 29842 79183 15840 17885 42155 88206 98073 \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog4/blog4Out.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog4/blog4Out.txt new file mode 100644 index 000000000..1d87935ed --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog4/blog4Out.txt @@ -0,0 +1,5896 @@ +8 +2 +8 +1 +1 + +8 +5 +5 +0 +9 + +7 +6 +0 +8 +0 + +7 +6 +0 +4 +8 + +6 +8 +7 +1 + +7 +8 +0 +7 +6 + +6 +2 +9 +6 +1 + +4 +6 +6 +5 +4 + +6 +8 +7 +0 +2 + +5 +2 +2 +2 +3 + +9 +2 +0 +9 +7 + +5 +3 +4 +1 +2 + +3 +7 +1 +0 +2 + +4 +4 +0 +9 +4 + +9 +4 +9 +3 +7 + +1 +0 +0 +1 +7 + +7 +0 +3 +1 +7 + +7 +0 +9 +1 +2 + +9 +1 +3 +3 +0 + +4 +9 +9 +2 +9 + +5 +6 +6 +7 +4 + +1 +3 +0 +1 +2 + +4 +4 +4 +6 +7 + +6 +0 +1 +5 +8 + +9 +8 +3 +7 +5 + +7 +3 +7 +0 +8 + +5 +9 +8 +4 +1 + +6 +0 +4 +8 + +5 +5 +3 +3 +5 + +4 +1 +0 +1 +2 + +1 +3 +3 +8 +8 + +9 +6 +5 +8 +8 + +8 +8 +2 +6 +1 + +8 +7 +6 +5 +9 + +5 +2 +3 +2 + +8 +8 +7 +1 +9 + +7 +1 +2 +2 +9 + +7 +8 +3 +1 +6 + +9 +0 +9 +7 +1 + +5 +5 +5 +1 +8 + +2 +5 +9 +2 +3 + +8 +0 +0 +6 +7 + +7 +3 +6 +8 + +5 +6 +6 +6 + +4 +8 +7 +5 +2 + +7 +0 +1 +9 +4 + +8 +5 +0 +7 +2 + +7 +3 +8 +6 +7 + +4 +8 +9 +2 +0 + +1 +2 +9 +3 +3 + +5 +8 +3 +0 +8 + +5 +6 +6 +9 +9 + +6 +6 +3 +0 +7 + +8 +6 +6 +8 +2 + +5 +0 +3 +8 +6 + +3 +6 +9 +2 +7 + +9 +9 +3 +6 +0 + +7 +0 +0 +2 +2 + +2 +5 +6 +5 +1 + +1 +3 +2 +6 +3 + +4 +0 +6 +3 +0 + +4 +9 +0 +1 +8 + +4 +7 +1 +8 + +8 +5 +5 +4 +0 + +5 +4 +5 +3 +2 + +5 +2 +7 +3 + +6 +2 +3 +7 +1 + +6 +7 +0 +8 + +8 +0 +3 +0 +6 + +7 +2 +4 +0 +5 + +4 +8 +7 +5 +3 + +2 +1 +8 +5 +2 + +8 +5 +8 +8 +4 + +6 +1 +3 +9 +3 + +2 +5 +0 +7 +7 + +8 +2 +4 +0 +5 + +8 +6 +2 +9 +9 + +9 +5 +8 +6 +4 + +6 +3 +9 +7 +1 + +9 +2 +5 +6 +0 + +2 +4 +4 + +4 +2 +1 +6 +0 + +5 +3 +5 +6 +3 + +6 +1 +0 +7 +2 + +4 +6 +1 +1 +7 + +5 +7 +3 +9 +5 + +4 +9 +5 +9 +7 + +2 +7 +3 +0 +6 + +4 +2 +2 +0 +2 + +1 +2 +7 +3 +0 + +4 +9 +5 +0 +8 + +8 +5 +3 +3 +3 + +4 +9 +4 +5 +7 + +5 +7 +8 +3 +0 + +5 +6 +9 +3 +2 + +4 +9 +7 +0 +8 + +6 +2 +2 +7 +8 + +2 +2 +6 +0 +3 + +3 +1 +3 +4 +4 + +6 +5 +8 +7 +6 + +4 +8 +1 +1 +1 + +8 +0 +2 +9 +7 + +1 +7 +3 +7 + +7 +3 +7 +9 +7 + +3 +5 +9 +0 +7 + +9 +5 +0 +9 +6 + +8 +7 +6 +0 +8 + +6 +2 +1 +2 +8 + +2 +4 +1 +7 +7 + +1 +2 +4 +7 +2 + +3 +5 +7 +3 +9 + +1 +8 +8 +9 +3 + +9 +3 +2 +5 +5 + +2 +9 +0 +7 +8 + +4 +2 +3 + +6 +8 +5 +8 +1 + +2 +3 +8 +8 +6 + +4 +6 +7 +7 +4 + +4 +8 +6 +3 +2 + +9 +6 +8 +0 +2 + +6 +1 +2 +4 + +6 +2 +8 +4 +7 + +9 +4 +0 +6 +1 + +8 +2 +3 +1 +7 + +6 +1 +0 +1 +4 + +9 +4 +0 +5 +3 + +8 +8 +1 +1 +1 + +7 +8 +3 +6 +0 + +8 +0 +2 +9 +8 + +5 +0 +4 +8 +7 + +8 +4 +1 +2 +9 + +6 +7 +2 +4 +7 + +3 +3 +8 +0 +9 + +9 +0 +6 +9 +1 + +4 +5 +5 +5 +7 + +5 +0 +7 +1 +2 + +5 +9 +0 +8 +2 + +3 +2 +2 +7 +4 + +3 +3 +9 +3 +1 + +2 +2 +4 +6 +9 + +4 +9 +5 +4 +1 + +8 +3 +5 +4 +7 + +3 +5 +0 +0 +4 + +5 +2 +5 +2 +6 + +9 +1 +8 +9 +3 + +7 +8 +7 +8 +3 + +7 +1 +0 +9 +6 + +3 +7 +7 +5 +8 + +3 +3 +0 +2 +4 + +9 +7 +4 +8 + +7 +5 +3 +4 +9 + +8 +2 +4 +5 +5 + +3 +4 +6 +1 +1 + +6 +8 +5 +9 +0 + +3 +3 +3 +7 +0 + +2 +0 +9 +9 +3 + +9 +0 +6 +3 +0 + +8 +2 +0 +3 +8 + +1 +6 +8 +5 +9 + +5 +8 +7 +6 + +4 +1 +4 +4 +3 + +6 +0 +3 +2 +5 + +9 +0 +2 +5 +4 + +9 +0 +3 +3 + +7 +4 +9 +3 +7 + +9 +9 +5 +9 +8 + +2 +5 +1 +5 +4 + +7 +3 +9 +8 +1 + +9 +8 +3 +1 +4 + +7 +9 +1 +0 +6 + +5 +1 +7 +7 +9 + +5 +8 +7 +4 +4 + +3 +2 +0 +6 +3 + +5 +7 +0 +7 +7 + +3 +3 +1 +5 +2 + +6 +3 +8 +2 + +9 +5 +4 +9 +8 + +5 +5 +8 +4 +7 + +1 +4 +1 +4 +9 + +1 +2 +5 +5 +3 + +6 +0 +7 +2 +5 + +1 +7 +0 +8 +6 + +1 +0 +6 +3 +1 + +1 +4 +4 +5 +4 + +8 +7 +4 +0 +2 + +2 +5 +7 +5 + +4 +4 +0 +6 +8 + +5 +2 +1 +2 +4 + +8 +2 +7 +2 +9 + +6 +7 +2 +5 +9 + +2 +7 +3 +7 +6 + +4 +3 +3 +5 +4 + +8 +8 +6 +4 +3 + +8 +7 +1 +5 +2 + +7 +9 +8 +4 +0 + +6 +7 +0 +8 +7 + +6 +4 +8 +7 +7 + +1 +0 +6 +0 +5 + +3 +8 +2 +9 +9 + +1 +5 +4 +9 +3 + +4 +4 +4 +9 +0 + +7 +9 +8 +3 +7 + +3 +9 +0 +5 +5 + +9 +7 +4 +6 +7 + +6 +7 +9 +7 +4 + +6 +9 +7 +1 +3 + +7 +2 +1 +8 +4 + +2 +7 +8 +1 + +1 +1 +1 +8 +5 + +4 +4 +3 +7 +0 + +5 +4 +5 +9 +7 + +3 +7 +1 +1 +9 + +4 +7 +8 +3 +6 + +9 +7 +5 +3 +3 + +5 +6 +6 +9 +0 + +9 +0 +6 +4 +9 + +3 +4 +6 +5 +3 + +7 +7 +1 +7 +5 + +2 +5 +5 +3 +1 + +2 +5 +5 +7 +3 + +2 +4 +2 +4 +2 + +6 +8 +9 +2 +8 + +1 +1 +6 +5 +2 + +7 +6 +2 +2 +1 + +7 +3 +4 +4 +3 + +2 +2 +9 +3 +9 + +1 +2 +0 +6 +6 + +8 +6 +5 +3 +5 + +2 +3 +6 +5 +4 + +6 +7 +4 +8 +8 + +7 +0 +8 +4 +8 + +3 +3 +3 +7 +6 + +5 +2 +8 +5 +3 + +5 +7 +9 +8 +8 + +7 +0 +0 +4 +2 + +7 +2 +3 +7 +8 + +3 +5 +7 +5 +2 + +6 +2 +6 +4 +1 + +1 +9 +7 +9 +3 + +5 +1 +7 +3 +2 + +8 +4 +4 +7 +2 + +6 +8 +2 +3 +5 + +2 +7 +4 +8 +9 + +5 +9 +9 +7 +2 + +6 +1 +3 +5 +7 + +7 +8 +4 +1 +1 + +2 +3 +9 +1 +4 + +8 +4 +4 +1 +1 + +4 +6 +6 +8 +9 + +5 +8 +4 +2 +2 + +5 +5 +8 +5 +8 + +3 +2 +3 +6 +4 + +6 +5 +3 +0 +4 + +1 +0 +4 +3 +8 + +5 +1 +0 +4 +5 + +6 +5 +9 +8 +2 + +3 +7 +9 +0 +0 + +2 +6 +0 +1 +2 + +7 +7 +5 +3 +4 + +4 +8 +5 +6 +5 + +1 +9 +5 +4 +6 + +1 +1 +6 +7 +3 + +4 +5 +8 +9 +6 + +4 +6 +3 +0 +3 + +8 +0 +7 +1 +4 + +3 +7 +9 +8 +3 + +4 +3 +1 +5 + +8 +2 +5 +5 +5 + +8 +2 +6 +5 +5 + +8 +3 +5 +0 +5 + +4 +0 +0 +0 + +3 +5 +0 +8 +1 + +1 +6 +5 +8 +9 + +5 +9 +0 +8 +1 + +1 +3 +9 +9 +5 + +4 +3 +6 +6 +6 + +1 +2 +6 +0 +0 + +9 +1 +4 +2 +5 + +6 +2 +0 +8 +6 + +9 +5 +4 +7 +6 + +8 +5 +8 +5 +0 + +5 +3 +7 +0 +4 + +8 +7 +1 +3 +6 + +5 +4 +6 +6 +2 + +5 +9 +5 +1 +5 + +1 +9 +7 +8 +9 + +2 +4 +3 +4 +9 + +5 +3 +9 +6 +3 + +3 +6 +0 +6 +1 + +6 +1 +6 +1 +8 + +8 +5 +1 +6 +5 + +5 +4 +5 +8 +6 + +8 +0 +3 +3 +6 + +6 +1 +5 +9 + +5 +4 +5 +2 + +7 +1 +1 +2 +7 + +9 +8 +7 +2 +4 + +1 +7 +3 +1 +2 + +6 +6 +2 +7 +0 + +4 +0 +1 +3 +4 + +3 +0 +2 +9 +2 + +6 +0 +5 +1 + +7 +6 +0 +0 +1 + +1 +1 +7 +6 + +6 +8 +2 +7 + +6 +3 +1 +2 +4 + +7 +1 +2 +8 +5 + +7 +9 +6 +5 +6 + +6 +8 +3 +3 +3 + +8 +0 +0 +4 +9 + +7 +4 +5 +3 +3 + +2 +8 +8 +5 +7 + +4 +3 +9 +0 +8 + +5 +8 +0 +2 +4 + +5 +9 +4 +2 +4 + +5 +9 +5 +0 +1 + +3 +5 +4 +9 +8 + +5 +1 +3 +3 +9 + +1 +9 +9 +8 +7 + +1 +6 +6 +9 +9 + +9 +6 +4 +4 + +2 +8 +7 +2 +6 + +9 +5 +1 +7 + +5 +5 +3 +1 +4 + +9 +0 +0 +9 +2 + +6 +1 +1 +0 +4 + +3 +1 +6 +9 +0 + +6 +8 +8 +4 +3 + +9 +1 +6 +3 + +4 +9 +9 +6 +5 + +4 +1 +3 +3 +5 + +7 +2 +9 +4 +4 + +2 +2 +3 +5 +6 + +3 +9 +7 +6 +4 + +3 +9 +5 +2 +7 + +4 +0 +8 +5 +1 + +4 +2 +0 +0 +6 + +2 +2 +3 +4 +7 + +5 +6 +9 +3 +0 + +9 +1 +0 +5 +4 + +2 +5 +7 +5 +6 + +2 +4 +5 +8 +3 + +9 +5 +4 +3 +6 + +6 +2 +6 +3 +1 + +3 +9 +2 +0 +7 + +8 +4 +3 +5 +2 + +3 +1 +3 +5 +2 + +6 +2 +6 +0 +6 + +8 +8 +9 +2 + +8 +6 +7 +2 +0 + +5 +1 +7 +2 +4 + +7 +4 +0 +4 +0 + +5 +1 +4 +7 +2 + +9 +6 +4 +6 +9 + +8 +7 +9 +7 +2 + +2 +9 +7 +2 +8 + +2 +0 +5 +0 + +1 +3 +1 +4 +6 + +1 +6 +7 +5 +2 + +1 +9 +3 +4 +9 + +7 +9 +2 +2 +4 + +6 +5 +9 +7 +2 + +6 +6 +4 +1 +1 + +4 +3 +9 +9 +1 + +8 +6 +5 +6 +9 + +2 +9 +9 +6 +0 + +5 +7 +4 +5 + +3 +7 +6 +7 +8 + +6 +0 +9 +9 +0 + +8 +2 +1 +3 + +6 +1 +0 +6 +7 + +9 +5 +8 +1 +6 + +9 +7 +5 +0 +3 + +3 +1 +0 +8 +4 + +6 +6 +7 +1 +2 + +3 +6 +7 +0 +1 + +6 +6 +0 +4 +1 + +1 +1 +3 +1 +8 + +5 +8 +2 +8 +0 + +2 +7 +9 +2 +0 + +8 +1 +6 +9 +1 + +8 +6 +4 +3 + +5 +5 +1 +5 +8 + +5 +7 +9 +5 +4 + +4 +2 +6 +1 +4 + +7 +7 +0 +1 +4 + +7 +4 +0 +3 + +9 +6 +2 +4 +5 + +3 +2 +8 +2 + +2 +2 +7 +7 +0 + +5 +9 +3 +5 +6 + +1 +8 +8 +6 +0 + +1 +8 +5 +7 +1 + +1 +4 +8 +5 +7 + +6 +5 +7 +1 +2 + +5 +0 +7 +1 +7 + +3 +2 +1 +5 +5 + +1 +9 +2 +4 +5 + +3 +4 +9 +9 +7 + +1 +0 +4 +7 +2 + +8 +1 +3 +5 +1 + +8 +3 +6 +5 +1 + +2 +9 +4 +3 +3 + +5 +0 +4 +3 +2 + +8 +8 +3 +7 +6 + +2 +5 +2 +3 +9 + +2 +0 +4 +8 +1 + +5 +5 +7 +0 +1 + +3 +4 +5 +8 +2 + +6 +6 +4 +7 +1 + +1 +9 +3 +3 +6 + +4 +2 +8 +7 +1 + +7 +6 +7 +9 + +2 +7 +6 +8 +4 + +7 +5 +6 +7 +7 + +9 +6 +0 +8 +5 + +1 +8 +4 +2 +3 + +2 +1 +2 +2 +7 + +5 +6 +7 +1 +0 + +6 +1 +0 +0 +3 + +9 +7 +8 +2 +0 + +8 +6 +3 +0 +1 + +8 +4 +0 +0 +9 + +4 +5 +3 +9 +7 + +6 +3 +7 +4 +6 + +3 +8 +7 +4 +0 + +1 +1 +6 +5 +1 + +7 +0 +0 +2 + +9 +6 +6 +2 +4 + +4 +7 +6 +2 +9 + +8 +1 +9 +4 + +9 +0 +0 +2 +0 + +9 +2 +0 +2 +8 + +2 +5 +3 +1 +2 + +8 +8 +1 +9 +1 + +8 +2 +1 +7 +6 + +1 +5 +9 +4 +3 + +4 +1 +1 +3 +5 + +8 +6 +4 +9 +0 + +5 +7 +9 +0 +6 + +9 +2 +9 +0 + +8 +8 +4 +4 +9 + +9 +1 +3 +9 +5 + +8 +0 +0 +8 +7 + +3 +8 +0 +6 +0 + +3 +0 +7 +5 +5 + +6 +7 +8 +3 +8 + +1 +4 +0 +7 +3 + +8 +9 +0 +0 +3 + +6 +9 +7 +9 + +3 +6 +2 +5 +7 + +2 +4 +7 +5 +4 + +2 +3 +7 +8 +4 + +4 +6 +8 +0 +4 + +6 +9 +0 +9 +9 + +6 +9 +2 +7 +9 + +2 +2 +7 +7 +6 + +7 +5 +0 +4 +7 + +4 +1 +1 +6 + +8 +7 +4 +8 +2 + +8 +5 +6 +8 +2 + +9 +6 +4 +1 +5 + +4 +5 +5 +5 + +5 +4 +7 +2 +4 + +1 +3 +8 +7 +5 + +6 +6 +3 +0 +2 + +4 +5 +8 +3 +3 + +8 +0 +8 +3 +1 + +7 +6 +6 +3 +4 + +8 +0 +3 +0 + +7 +8 +1 +0 +2 + +5 +5 +2 +7 +4 + +7 +8 +7 +9 + +8 +2 +7 +8 +7 + +3 +3 +1 +8 +0 + +1 +1 +5 +1 +3 + +1 +7 +6 +9 +1 + +7 +2 +6 +2 +2 + +8 +9 +6 +8 +5 + +4 +2 +3 +4 +0 + +8 +2 +1 +9 +8 + +5 +8 +9 +6 + +8 +6 +4 +2 + +2 +1 +2 +2 +3 + +6 +3 + +6 +9 +9 +2 +0 + +9 +3 +6 +9 +5 + +9 +3 +7 +0 +1 + +9 +3 +2 +9 + +5 +1 +5 +8 +8 + +2 +4 +5 +7 +0 + +2 +2 +5 +3 +4 + +8 +8 +9 +3 +6 + +3 +9 +3 +7 +6 + +5 +0 +3 +4 +5 + +8 +9 +4 +6 +4 + +3 +4 +8 +8 +7 + +8 +5 +1 +4 +8 + +9 +8 +2 +7 +8 + +9 +4 +9 +2 +8 + +8 +0 +7 +6 +0 + +5 +5 +0 +7 +6 + +1 +6 +4 +9 +6 + +9 +0 +7 +7 +5 + +3 +9 +7 +5 +1 + +7 +5 +6 +0 + +1 +8 +2 +2 +3 + +1 +2 +6 +2 +5 + +4 +3 +5 +4 +1 + +2 +7 +0 +2 +1 + +5 +3 +7 +4 +8 + +7 +6 +0 +1 +2 + +4 +2 +0 +5 +9 + +1 +0 +7 +3 +2 + +9 +5 +5 +6 +1 + +3 +8 +5 +9 +1 + +4 +2 +1 +9 +4 + +6 +0 +4 +8 +2 + +4 +7 +9 +4 +6 + +4 +0 +7 +4 +4 + +7 +3 +9 +9 + +6 +1 +0 +0 +4 + +2 +6 +7 +5 + +2 +4 +1 +1 +8 + +6 +0 +3 +4 +4 + +2 +3 +2 +7 +0 + +1 +3 +5 +1 +2 + +6 +2 +6 +5 +4 + +7 +3 +3 +5 +8 + +4 +5 +0 +6 +2 + +7 +5 +7 +6 +4 + +5 +9 +7 +9 +6 + +9 +6 +8 +9 +4 + +4 +4 +3 +0 +0 + +6 +8 +6 +1 +0 + +8 +8 +6 +5 +1 + +9 +6 +9 +9 +5 + +8 +3 +1 +1 +8 + +8 +8 +8 +8 +0 + +1 +5 +5 +7 +4 + +6 +7 +5 +1 +8 + +7 +8 +3 +0 +9 + +4 +0 +5 +6 +1 + +6 +9 +5 +3 +9 + +4 +9 +4 +3 +3 + +1 +3 +4 +7 +8 + +9 +0 +7 +7 +6 + +2 +4 +7 +8 +2 + +3 +0 +8 +2 +6 + +1 +4 +8 +9 +4 + +1 +3 +7 +7 +6 + +6 +5 +7 +3 +0 + +8 +7 +0 +6 +4 + +1 +3 +2 +4 +0 + +5 +7 +4 +0 + +9 +1 +5 +9 +2 + +1 +4 +7 +2 +1 + +6 +6 +4 +3 +3 + +3 +0 +1 +9 +9 + +5 +1 +2 +7 +4 + +7 +7 +9 +3 +6 + +2 +1 +1 +4 +4 + +6 +8 +4 +5 +5 + +7 +4 +2 +6 +2 + +2 +5 +1 +0 +1 + +6 +8 +5 +9 +4 + +7 +3 +5 +4 +2 + +5 +8 +4 +9 +4 + +6 +0 +0 +5 +3 + +4 +0 +1 +7 +1 + +6 +8 +0 +4 +3 + +5 +7 +7 +2 +5 + +6 +6 +8 +0 +6 + +4 +7 +6 +0 +6 + +2 +8 +2 +3 +8 + +9 +5 +1 +9 +9 + +8 +5 +1 +8 +8 + +2 +3 +1 +6 +0 + +9 +5 +6 +4 +4 + +9 +4 +8 +9 +3 + +3 +0 +4 +1 + +6 +6 +7 +9 +9 + +6 +4 +5 +2 +2 + +9 +1 +5 +1 +9 + +3 +9 +0 +0 +1 + +7 +1 +5 +9 +8 + +9 +8 +2 +3 +4 + +1 +1 +0 +1 +3 + +8 +8 +1 +4 +6 + +6 +9 +7 +8 +8 + +4 +1 +8 +1 + +7 +2 +7 +9 +8 + +9 +1 +5 +6 + +6 +3 +1 +2 + +5 +3 +3 +8 +0 + +9 +5 +5 +7 +7 + +5 +9 +0 +8 +0 + +8 +5 +8 +8 +5 + +7 +6 +5 +2 +5 + +3 +6 +5 +6 +3 + +1 +2 +7 +2 +3 + +1 +5 +5 +0 +5 + +7 +7 +4 +7 +7 + +7 +9 +4 +4 +2 + +1 +9 +7 +0 +5 + +2 +9 +6 +4 +7 + +9 +5 +8 +0 +1 + +6 +1 +3 +6 +0 + +4 +0 +4 +5 +3 + +9 +6 +1 +0 +0 + +1 +7 +2 +2 +1 + +2 +8 +0 +3 +1 + +8 +5 +9 +2 +4 + +9 +7 +3 +5 +8 + +8 +6 +0 +7 +6 + +9 +5 +0 +1 +4 + +8 +7 +7 +4 +0 + +2 +4 +3 +7 +2 + +1 +6 +1 +2 +3 + +3 +6 +5 +1 + +4 +5 +9 +7 +0 + +8 +5 +3 +5 +3 + +1 +9 +9 +6 +3 + +7 +5 +9 +0 +1 + +8 +7 +4 +1 +1 + +4 +3 +3 +1 +3 + +5 +7 +9 +2 +4 + +5 +5 +7 +3 +7 + +6 +4 +0 +8 +7 + +6 +8 +9 +3 +2 + +1 +7 +4 +6 +5 + +2 +2 +6 +8 +1 + +5 +7 +0 +9 +7 + +2 +1 +3 +2 +5 + +4 +2 +7 +3 +5 + +7 +5 +4 +3 +1 + +8 +9 +4 +9 +2 + +5 +5 +5 +0 +4 + +6 +0 +6 +0 + +2 +9 +1 +5 +8 + +1 +1 +7 +7 +7 + +6 +1 +3 +0 +7 + +3 +0 +5 +3 + +4 +4 +6 +3 +8 + +2 +5 +8 +1 +5 + +3 +0 +9 +1 + +8 +6 +2 +3 +7 + +8 +5 +0 +6 +9 + +6 +0 +0 +9 + +3 +1 +5 +5 +3 + +2 +5 +1 +7 +3 + +9 +1 +7 +1 +5 + +9 +1 +1 +4 +7 + +4 +2 +8 +8 +8 + +9 +2 +6 +7 +5 + +8 +0 +0 +0 +7 + +2 +7 +1 +3 +2 + +6 +5 +7 +0 +5 + +6 +0 +5 +2 + +5 +6 +8 +4 + +9 +3 +1 +9 +6 + +1 +1 +4 +5 +0 + +4 +1 +9 +7 +3 + +7 +9 +3 +5 +8 + +4 +1 +9 +5 + +9 +0 +3 +2 + +5 +8 +7 +2 +9 + +7 +3 +4 +0 +7 + +8 +1 +3 +5 +5 + +3 +5 +4 +1 +9 + +9 +2 +1 +4 +3 + +6 +6 +6 +5 +1 + +1 +2 +6 +2 +8 + +3 +9 +5 +2 +0 + +1 +5 +6 +6 +1 + +9 +4 +9 +6 +0 + +5 +3 +9 +2 + +3 +0 +4 +2 +7 + +8 +5 +6 +5 +0 + +6 +4 +5 +6 +9 + +9 +0 +6 +1 +7 + +9 +3 +4 +2 +5 + +3 +0 +2 +8 +5 + +8 +1 +5 +6 +1 + +1 +0 +2 +6 +4 + +9 +1 +9 +3 +2 + +4 +4 +9 +0 + +8 +5 +5 +8 +2 + +9 +3 +2 +5 +3 + +7 +2 +7 +8 +7 + +5 +2 +1 +7 +1 + +6 +8 +7 + +7 +3 +1 +7 + +8 +5 +6 +6 +6 + +1 +6 +2 +0 +8 + +4 +7 +5 +4 +8 + +3 +6 +9 +2 +8 + +4 +6 +4 +7 +3 + +1 +2 +4 +2 +3 + +7 +0 +1 +0 +6 + +8 +1 +8 +5 +1 + +3 +8 +1 +5 +7 + +9 +3 +4 +6 +4 + +5 +4 +0 +2 +7 + +4 +8 +6 +3 +3 + +2 +9 +8 +1 +1 + +1 +6 +6 +3 + +2 +9 +4 +8 +4 + +8 +6 +3 +3 +3 + +2 +3 +7 +4 +8 + +9 +7 +7 +0 +5 + +1 +2 +6 +9 +6 + +1 +8 +3 +6 + +1 +7 +1 +6 +1 + +9 +7 +4 +0 + +6 +3 +0 +3 +6 + +5 +9 +5 +9 +2 + +3 +9 +6 +5 +6 + +9 +8 +3 +5 +2 + +8 +6 +5 +9 +2 + +5 +1 +8 +8 +7 + +5 +7 +0 +8 +1 + +2 +9 +7 +7 +7 + +7 +3 +0 +8 +6 + +8 +1 +2 +5 +5 + +1 +7 +6 +4 +2 + +9 +6 +0 +4 +3 + +7 +0 +0 +5 +4 + +1 +6 +1 +6 +0 + +6 +9 +9 +5 +5 + +9 +8 +7 +9 +0 + +1 +3 +3 +5 +7 + +3 +0 +6 +3 +6 + +1 +7 +1 +1 +8 + +2 +0 +8 +4 +5 + +7 +4 +4 +4 +0 + +8 +1 +6 +6 +9 + +3 +3 +5 +2 +6 + +7 +9 +3 +3 +8 + +2 +8 +0 +8 +6 + +6 +6 +9 +7 +9 + +9 +2 +4 +5 +5 + +4 +1 +3 +8 + +7 +2 +3 +2 + +3 +0 +0 +0 +4 + +1 +7 +5 +2 +1 + +4 +0 +5 +2 + +6 +6 +9 +0 +1 + +3 +8 +3 +4 +0 + +7 +7 +8 +6 + +4 +6 +8 +5 +9 + +6 +4 +5 +6 +3 + +3 +5 +1 +1 +4 + +6 +7 +6 +8 +7 + +4 +4 +9 +9 +0 + +5 +3 +2 +1 +8 + +2 +8 +3 +5 +2 + +8 +5 +1 +5 +3 + +7 +7 +7 +4 + +7 +8 +3 +6 +9 + +1 +6 +9 +6 +4 + +2 +8 +0 +6 +0 + +9 +5 +4 +3 + +7 +0 +7 +7 +7 + +2 +4 +7 +9 + +8 +8 +5 +5 +6 + +1 +5 +2 +1 +4 + +7 +7 +3 +7 +0 + +1 +6 +3 +1 +4 + +5 +8 +8 +5 +5 + +2 +2 +1 +6 + +9 +2 +4 +5 +7 + +7 +4 +0 +3 +4 + +3 +7 +0 +5 +9 + +8 +6 +7 +0 +2 + +3 +2 +3 +5 +5 + +3 +6 +6 +1 +5 + +2 +5 +5 +6 +2 + +9 +8 +0 +2 +2 + +2 +1 +3 +5 +8 + +5 +5 +7 +2 +0 + +5 +5 +4 +5 + +9 +9 +6 +2 +1 + +6 +5 +3 +0 + +8 +7 +1 +9 +9 + +8 +0 +2 +8 +2 + +3 +2 +8 +5 +3 + +3 +9 +6 +9 +6 + +3 +5 +4 +3 +0 + +5 +3 +6 +6 +6 + +1 +8 +3 +1 +6 + +2 +0 +0 +9 +5 + +2 +7 +8 +3 +5 + +5 +7 +9 +5 +7 + +7 +0 +9 +9 + +5 +7 +0 +2 +5 + +6 +7 +0 +2 +2 + +6 +3 +2 +7 +4 + +2 +0 +8 +9 +9 + +8 +2 +8 +3 +9 + +1 +1 +5 +4 +2 + +7 +7 +3 +6 +7 + +5 +6 +5 +7 +3 + +2 +2 +0 +0 +9 + +4 +9 +5 +0 +2 + +7 +6 +2 +3 + +8 +8 +8 +9 + +9 +5 +3 +3 + +7 +5 +9 +1 +6 + +5 +0 +9 +7 +6 + +5 +7 +1 +4 +4 + +7 +0 +9 +5 +2 + +5 +9 +6 +3 +7 + +7 +1 +4 +9 +4 + +3 +8 +4 +4 + +9 +6 +1 +3 +1 + +3 +8 +4 +1 +7 + +8 +9 +3 +3 +3 + +8 +5 +4 +2 + +2 +3 +8 +7 +1 + +1 +1 +1 +7 +1 + +1 +8 +1 +6 +9 + +6 +0 +8 +1 +0 + +3 +9 +4 +1 +5 + +2 +3 +7 +0 +8 + +1 +0 +7 +0 +4 + +9 +7 +6 +0 +8 + +9 +7 +5 +6 +0 + +1 +1 +9 +2 +9 + +7 +8 +2 +2 +6 + +8 +1 +8 +8 +5 + +2 +6 +9 +9 +8 + +2 +2 +1 +7 +3 + +9 +9 +5 +7 +3 + +9 +6 +3 +9 +6 + +8 +2 +0 +4 +1 + +9 +6 +3 +2 +1 + +2 +7 +5 +7 +1 + +6 +5 +7 +7 +7 + +7 +5 +9 +5 +3 + +1 +8 +3 +8 +6 + +7 +9 +0 +3 +8 + +4 +9 +4 +0 +4 + +6 +2 +4 +8 +9 + +4 +6 +1 +2 +1 + +4 +8 +6 +1 +5 + +9 +5 +7 +7 +3 + +5 +7 +6 +6 +3 + +2 +3 +0 +2 +0 + +8 +9 +3 +4 +7 + +2 +0 +6 +3 +8 + +5 +7 +1 +2 +6 + +6 +0 +4 +1 +3 + +8 +2 +7 +5 +1 + +8 +6 +1 +6 +4 + +1 +5 +4 +2 + +4 +4 +2 +9 +1 + +8 +2 +8 +2 +7 + +7 +3 +1 +7 +2 + +3 +2 +6 +2 + +4 +5 +7 +2 +7 + +8 +4 +2 +9 +1 + +2 +8 +2 +7 +4 + +6 +1 +5 +3 +0 + +3 +3 +5 +6 +8 + +7 +3 +9 +9 +8 + +9 +5 +8 +8 +3 + +2 +8 +1 +5 +4 + +6 +5 +3 +4 + +2 +3 +3 +3 +2 + +4 +7 +1 +1 + +1 +6 +7 +7 +0 + +1 +8 +3 +5 +9 + +5 +4 +3 +6 +9 + +2 +9 +2 +7 +7 + +8 +2 +7 +5 +5 + +3 +1 +0 +2 +3 + +6 +8 +2 +2 +1 + +3 +8 +4 +8 +3 + +7 +3 +4 +0 +5 + +3 +1 +8 +6 +4 + +9 +3 +9 +2 +2 + +9 +5 +0 +8 +6 + +7 +0 +7 +6 +4 + +5 +7 +4 +0 +7 + +3 +8 +8 +7 +8 + +3 +4 +6 +2 +3 + +9 +8 +4 +9 +9 + +1 +8 +0 +7 +7 + +4 +8 +2 +5 +2 + +8 +0 +1 +4 +4 + +6 +4 +9 +4 +7 + +7 +1 +7 +0 +3 + +9 +2 +9 +3 +2 + +1 +2 +6 +2 +0 + +8 +6 +8 +5 +6 + +2 +5 +4 +9 +9 + +5 +2 +2 +3 +0 + +3 +6 +2 +5 +8 + +5 +8 +2 +5 +1 + +6 +7 +4 +1 +5 + +7 +7 +8 +8 +4 + +7 +6 +0 +2 +4 + +5 +4 +5 +0 +7 + +9 +9 +2 +3 +4 + +8 +6 +0 +1 +2 + +3 +1 +0 +0 +3 + +5 +7 +2 +7 +9 + +3 +7 +6 +9 +0 + +8 +9 +5 +3 +6 + +3 +0 +9 +8 +0 + +5 +9 +2 +4 +7 + +2 +8 +8 +4 +2 + +5 +3 +4 +3 +8 + +5 +5 +5 +2 +5 + +8 +3 +9 +3 + +6 +3 +5 +6 +2 + +7 +0 +7 +3 +6 + +4 +5 +0 +1 +6 + +2 +4 +5 +4 +0 + +5 +2 +2 +3 +7 + +2 +4 +3 +8 + +8 +5 +2 +8 +7 + +7 +9 +7 +1 +5 + +5 +2 +5 +8 + +9 +4 +5 +7 +9 + +7 +1 +2 +3 +0 + +1 +6 +6 +5 +5 + +3 +9 +9 +9 +6 + +5 +6 +3 +6 +6 + +3 +5 +5 +8 +4 + +6 +0 +6 +1 +2 + +4 +2 +1 +0 +0 + +7 +6 +1 +1 +6 + +6 +5 +7 +3 +8 + +9 +8 +7 +5 +5 + +2 +8 +5 +7 +4 + +3 +3 +4 +9 +2 + +6 +8 +7 +1 +3 + +7 +0 +9 +2 +2 + +8 +9 +9 +7 +8 + +5 +6 +1 +7 +0 + +8 +8 +9 +6 +4 + +5 +1 +4 +3 +8 + +6 +3 +1 +1 +2 + +1 +8 +0 +0 +9 + +1 +0 +5 +4 +9 + +5 +6 +2 +8 +7 + +8 +6 +7 +8 +0 + +5 +4 +4 +5 +1 + +3 +8 +8 +9 +1 + +8 +1 +7 +9 +7 + +8 +7 +9 +0 +2 + +9 +0 +2 +8 +8 + +8 +9 +9 +3 +1 + +8 +6 +2 +7 +1 + +7 +9 +4 +8 +4 + +8 +7 +8 +5 +2 + +1 +8 +6 +8 +4 + +2 +9 +9 +3 +4 + +5 +1 +1 +2 +1 + +4 +7 +5 +6 +6 + +9 +4 +2 +6 +1 + +3 +3 +2 +8 +6 + +7 +6 +7 +3 +6 + +1 +0 +2 +1 +9 + +8 +4 +5 +1 + +3 +6 +9 +7 +1 + +1 +1 +0 +1 +6 + +7 +1 +8 +3 +6 + +5 +3 +2 +3 +9 + +1 +9 +5 +6 +9 + +9 +6 +5 +6 +7 + +1 +1 +8 +5 +7 + +1 +2 +5 +7 +0 + +2 +8 +8 +0 +6 + +2 +2 +9 +9 + +7 +5 +1 +5 +6 + +6 +7 +5 +2 +1 + +2 +6 +5 +2 +2 + +3 +2 +4 +1 +9 + +7 +5 +6 +3 + +4 +3 +0 +8 +7 + +6 +2 +3 +0 +9 + +2 +9 +8 +8 +0 + +9 +0 +3 +1 +7 + +7 +4 +5 +1 +0 + +6 +9 +9 +0 +6 + +7 +3 +5 +9 +1 + +9 +7 +5 +2 +0 + +8 +9 +6 +7 +7 + +5 +8 +8 +3 +6 + +6 +5 +2 +6 +2 + +2 +9 +8 +4 +2 + +7 +9 +1 +8 +3 + +1 +5 +8 +4 +0 + +1 +7 +8 +8 +5 + +4 +2 +1 +5 +5 + +8 +8 +2 +0 +6 + +9 +8 +0 +7 +3 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog4/blog4Tag.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog4/blog4Tag.txt new file mode 100644 index 000000000..052a1bec1 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog4/blog4Tag.txt @@ -0,0 +1,478 @@ +8 +2 +8 +1 +1 + +6 +8 +7 +1 + +5 +2 +2 +2 +3 + +8 +8 +2 +6 +1 + +9 +0 +9 +7 +1 + +7 +3 +8 +6 +7 + +5 +2 +7 +3 + +4 +9 +5 +9 +7 + +8 +5 +3 +3 +3 + +6 +8 +5 +8 +1 + +6 +7 +2 +4 +7 + +3 +3 +8 +0 +9 + +4 +5 +5 +5 +7 + +3 +3 +9 +3 +1 + +2 +2 +4 +6 +9 + +4 +1 +4 +4 +3 + +3 +2 +0 +6 +3 + +5 +7 +0 +7 +7 + +1 +4 +1 +4 +9 + +1 +2 +5 +5 +3 + +1 +0 +6 +3 +1 + +8 +2 +7 +2 +9 + +8 +8 +6 +4 +3 + +6 +4 +8 +7 +7 + +3 +8 +2 +9 +9 + +1 +5 +4 +9 +3 + +1 +9 +7 +9 +3 + +6 +1 +3 +5 +7 + +3 +5 +0 +8 +1 + +3 +6 +0 +6 +1 + +7 +6 +0 +0 +1 + +6 +8 +2 +7 + +1 +6 +6 +9 +9 + +9 +6 +4 +6 +9 + +4 +3 +9 +9 +1 + +6 +6 +0 +4 +1 + +2 +1 +2 +2 +7 + +4 +7 +6 +2 +9 + +8 +9 +0 +0 +3 + +4 +5 +8 +3 +3 + +8 +0 +8 +3 +1 + +7 +8 +7 +9 + +8 +2 +7 +8 +7 + +9 +3 +7 +0 +1 + +1 +8 +2 +2 +3 + +4 +3 +5 +4 +1 + +9 +5 +5 +6 +1 + +8 +8 +6 +5 +1 + +6 +9 +5 +3 +9 + +4 +9 +4 +3 +3 + +3 +0 +4 +1 + +3 +6 +5 +6 +3 + +7 +7 +4 +7 +7 + +9 +5 +8 +0 +1 + +2 +8 +0 +3 +1 + +1 +9 +9 +6 +3 + +4 +3 +3 +1 +3 + +5 +7 +0 +9 +7 + +7 +5 +4 +3 +1 + +1 +1 +7 +7 +7 + +3 +5 +4 +1 +9 + +9 +2 +1 +4 +3 + +1 +5 +6 +6 +1 + +3 +0 +4 +2 +7 + +9 +0 +6 +1 +7 + +9 +3 +2 +5 +3 + +1 +6 +6 +3 + +9 +6 +0 +4 +3 + +2 +0 +8 +9 +9 + +9 +5 +3 +3 + +1 +1 +1 +7 +1 + +1 +8 +1 +6 +9 + +6 +5 +7 +7 +7 + +9 +5 +7 +7 +3 + +6 +0 +4 +1 +3 + +1 +8 +0 +7 +7 + +5 +2 +2 +3 +7 + +6 +8 +7 +1 +3 + +3 +8 +8 +9 +1 + +9 +4 +2 +6 +1 + +5 +3 +2 +3 +9 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog5/blog5.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog5/blog5.txt new file mode 100644 index 000000000..95874bafc --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog5/blog5.txt @@ -0,0 +1 @@ +29182 62554 54973 90214 92702 67529 82626 32183 11997 35932 56950 32804 33217 67557 209 39779 64417 37348 1449 3270 57787 24693 55246 19828 81681 99958 83629 8578 36807 70947 11511 5316 56630 41870 68431 3478 84960 1343 26221 6319 83381 36944 42090 91859 46616 52940 94406 81463 31550 64823 18386 6218 40551 26647 41253 84571 50303 45910 81881 97291 11714 74636 92163 33495 75281 29563 97908 23087 29951 43354 18786 54494 41472 42478 68810 62589 81530 23518 3064 92021 81755 52653 77913 60567 9401 77808 90217 9808 95673 5756 72183 67278 15186 61771 4828 88331 28910 10374 26078 23957 3056 99927 74383 53582 43954 98897 75318 48637 8835 11777 67628 64187 97036 18839 51244 40084 96518 29091 18944 74206 53864 4232 99544 9484 81391 97113 85901 48079 52013 71974 6774 51761 60075 34463 52284 57324 35233 31999 91704 59504 54297 61264 14322 25468 55362 19824 52213 41963 95014 72529 48384 29614 31804 88629 50893 72457 39844 87707 32592 43183 40511 53851 8327 47550 24365 33704 7641 17379 50059 76729 82348 26947 26161 72514 55966 38553 91180 30074 12763 66309 20679 40262 72590 21318 11537 5162 2833 63614 10074 67359 46708 59809 6758 16783 51930 10228 19686 3548 49398 97943 43251 21454 80121 97452 44554 23280 53399 63981 92973 63436 64344 48392 91089 51780 91802 1626 30068 99693 32634 11372 88878 6773 33369 93209 25374 60676 63697 10964 27023 53744 96817 43203 51728 88520 93303 37026 18965 82985 86370 7425 27791 5323 54059 65866 37294 20849 93887 84599 1748 11128 30302 32310 21798 73376 68635 45123 60145 76614 40045 31613 73327 13833 70488 7486 15453 79782 15553 7191 97222 42768 448 67746 70461 35356 92316 34965 12627 98264 92744 52959 97064 68576 73493 85150 91879 10746 46426 79363 40560 93111 33377 53863 75663 71035 58133 3330 65676 95613 9481 5973 92011 71960 60573 63269 64049 22361 72099 2021 75371 83351 71684 32950 68749 42280 58881 10876 78325 21842 3086 1272 67247 87345 49671 62299 50151 77794 95950 1791 9583 1270 44199 99043 63139 23757 29520 22746 17484 32793 4090 55018 92726 58462 77609 1298 85556 12493 1861 91976 9731 89121 80913 42746 10828 24802 80994 71788 42762 54081 93783 70199 62843 43396 63228 42652 26726 35150 89009 97084 98315 32028 93492 92763 89614 79302 69204 60686 12425 27673 86349 75201 30771 47474 81041 60568 5001 40967 44050 56666 32141 3967 57 5541 33771 43858 79347 38772 37364 13498 16156 28767 49827 13869 62859 69678 66642 63844 97071 62599 90740 27481 77783 57994 53098 29257 60095 97497 85736 8324 19518 90069 12810 68580 68546 77516 81279 34822 75191 15279 63812 53297 25403 62829 88110 98786 73934 6418 98064 72954 96111 29535 91113 97368 54861 5768 16512 77352 4667 32113 63493 45001 33247 67029 67681 49616 23205 94942 88786 75919 27232 96758 6048 51029 56475 29821 74258 92912 6495 14290 93745 7512 25598 42382 63066 51791 84067 24163 15927 78416 94830 82090 21178 23732 32373 21276 99340 55594 74167 95136 39891 52577 50311 74236 33229 70050 65245 73102 51819 65284 96621 52064 82137 34980 8976 19593 84770 11046 7167 76297 58127 60571 8116 16936 26071 26324 74224 88153 19122 1954 96938 16221 70773 7 35499 84922 82823 83246 95828 52762 23264 21521 17436 77588 78755 65688 38050 24964 44087 2689 84401 36387 5845 6072 18868 69434 54823 59699 43178 34012 52552 61022 26944 44626 97540 18305 26009 82972 34155 57986 64485 86680 32800 68653 49552 62045 29470 44944 8237 20901 29017 29661 78939 46418 59710 88534 94418 48641 78142 2806 78104 63229 50881 19326 26821 57660 377 14969 47069 99870 90731 80394 90222 10990 71060 36304 81731 90614 57165 53385 40449 10620 75125 14617 27083 57437 84155 55773 63059 51328 71715 41810 88054 44878 50981 1518 22173 24833 37488 84036 12098 60285 95330 31802 70524 68717 82047 78284 40905 93678 82229 84060 64541 34804 6527 16069 39800 56566 92320 13633 27074 10957 78447 51002 61337 77824 961 7038 58177 23438 23493 38449 88119 17414 59717 23607 31000 75821 51748 65834 76032 50379 45607 85172 23472 8915 4391 57996 38214 80458 20961 90767 96825 44722 11691 19689 56149 87837 96349 41009 22418 85911 13973 28301 97556 58628 12993 5679 11464 88916 15161 47077 264 37979 58363 57131 82421 32071 63506 59484 84176 20431 3544 40168 78344 97212 95659 37952 76838 80577 78867 82356 41804 48041 76479 34545 99230 45387 38871 59686 21645 83813 57057 11261 61927 72531 8480 62453 35632 59721 39093 79152 31123 67826 78044 16806 79401 23540 6174 7017 54088 85813 675 50639 8708 91136 69408 13451 41914 45196 33061 64407 37466 91045 15498 21882 51880 60050 52103 32662 48461 8919 34002 12600 33450 21617 23193 87384 6587 89640 95052 21692 92429 81125 57404 59334 13395 45338 43280 18962 37936 42137 51796 32289 39941 40593 63906 28849 87828 56623 79142 58677 60526 46191 94134 8484 30153 27081 14270 92836 19197 51297 88808 6570 76069 14107 35538 43995 42892 19841 75400 16858 17398 88631 3909 98918 84214 78778 1472 24886 18127 88222 1253 30366 5169 53317 35574 98127 71010 26180 98035 3775 96633 42939 15141 76304 98572 14294 96914 34020 73880 66132 56495 27138 73037 20893 28257 89329 20954 4581 32862 34216 929 97611 61976 35481 52193 45491 93518 91291 8068 9507 92423 79550 38032 57693 59554 55317 17839 32431 52187 47278 18583 40402 69123 31983 61199 79993 39578 3234 3742 85210 73933 67347 95837 26001 80778 96810 65645 68638 13169 98984 14788 73356 15800 33851 30328 76659 56323 59011 14354 37496 86949 67373 7836 74981 16444 66513 82339 42728 59626 54304 67760 81344 30551 77480 10481 35820 75094 23031 43099 42725 30370 19597 21637 49021 43194 33847 45438 22270 35160 27107 39859 63060 9097 64036 64788 23659 3995 34100 28064 13173 40391 740 16541 40702 71506 82337 22706 26857 32891 42447 59228 89279 24343 21673 95277 45812 10688 44979 66476 58970 35461 23525 18207 91114 52619 38515 75002 60768 24835 41138 22556 38044 1202 27226 30204 87921 89966 69957 29842 20458 30602 23217 95609 51694 5489 43020 61466 19539 49200 55511 23336 96835 82752 28860 87001 98603 73377 45666 66258 2853 \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog5/blog5Out.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog5/blog5Out.txt new file mode 100644 index 000000000..c69b9928b --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog5/blog5Out.txt @@ -0,0 +1,5882 @@ +2 +9 +1 +8 +2 + +6 +2 +5 +5 +4 + +5 +4 +9 +7 +3 + +9 +0 +2 +1 +4 + +9 +2 +7 +0 +2 + +6 +7 +5 +2 +9 + +8 +2 +6 +2 +6 + +3 +2 +1 +8 +3 + +1 +1 +9 +9 +7 + +3 +5 +9 +3 +2 + +5 +6 +9 +5 +0 + +3 +2 +8 +0 +4 + +3 +3 +2 +1 +7 + +6 +7 +5 +5 +7 + +2 +0 +9 + +3 +9 +7 +7 +9 + +6 +4 +4 +1 +7 + +3 +7 +3 +4 +8 + +1 +4 +4 +9 + +3 +2 +7 +0 + +5 +7 +7 +8 +7 + +2 +4 +6 +9 +3 + +5 +5 +2 +4 +6 + +1 +9 +8 +2 +8 + +8 +1 +6 +8 +1 + +9 +9 +9 +5 +8 + +8 +3 +6 +2 +9 + +8 +5 +7 +8 + +3 +6 +8 +0 +7 + +7 +0 +9 +4 +7 + +1 +1 +5 +1 +1 + +5 +3 +1 +6 + +5 +6 +6 +3 +0 + +4 +1 +8 +7 +0 + +6 +8 +4 +3 +1 + +3 +4 +7 +8 + +8 +4 +9 +6 +0 + +1 +3 +4 +3 + +2 +6 +2 +2 +1 + +6 +3 +1 +9 + +8 +3 +3 +8 +1 + +3 +6 +9 +4 +4 + +4 +2 +0 +9 +0 + +9 +1 +8 +5 +9 + +4 +6 +6 +1 +6 + +5 +2 +9 +4 +0 + +9 +4 +4 +0 +6 + +8 +1 +4 +6 +3 + +3 +1 +5 +5 +0 + +6 +4 +8 +2 +3 + +1 +8 +3 +8 +6 + +6 +2 +1 +8 + +4 +0 +5 +5 +1 + +2 +6 +6 +4 +7 + +4 +1 +2 +5 +3 + +8 +4 +5 +7 +1 + +5 +0 +3 +0 +3 + +4 +5 +9 +1 +0 + +8 +1 +8 +8 +1 + +9 +7 +2 +9 +1 + +1 +1 +7 +1 +4 + +7 +4 +6 +3 +6 + +9 +2 +1 +6 +3 + +3 +3 +4 +9 +5 + +7 +5 +2 +8 +1 + +2 +9 +5 +6 +3 + +9 +7 +9 +0 +8 + +2 +3 +0 +8 +7 + +2 +9 +9 +5 +1 + +4 +3 +3 +5 +4 + +1 +8 +7 +8 +6 + +5 +4 +4 +9 +4 + +4 +1 +4 +7 +2 + +4 +2 +4 +7 +8 + +6 +8 +8 +1 +0 + +6 +2 +5 +8 +9 + +8 +1 +5 +3 +0 + +2 +3 +5 +1 +8 + +3 +0 +6 +4 + +9 +2 +0 +2 +1 + +8 +1 +7 +5 +5 + +5 +2 +6 +5 +3 + +7 +7 +9 +1 +3 + +6 +0 +5 +6 +7 + +9 +4 +0 +1 + +7 +7 +8 +0 +8 + +9 +0 +2 +1 +7 + +9 +8 +0 +8 + +9 +5 +6 +7 +3 + +5 +7 +5 +6 + +7 +2 +1 +8 +3 + +6 +7 +2 +7 +8 + +1 +5 +1 +8 +6 + +6 +1 +7 +7 +1 + +4 +8 +2 +8 + +8 +8 +3 +3 +1 + +2 +8 +9 +1 +0 + +1 +0 +3 +7 +4 + +2 +6 +0 +7 +8 + +2 +3 +9 +5 +7 + +3 +0 +5 +6 + +9 +9 +9 +2 +7 + +7 +4 +3 +8 +3 + +5 +3 +5 +8 +2 + +4 +3 +9 +5 +4 + +9 +8 +8 +9 +7 + +7 +5 +3 +1 +8 + +4 +8 +6 +3 +7 + +8 +8 +3 +5 + +1 +1 +7 +7 +7 + +6 +7 +6 +2 +8 + +6 +4 +1 +8 +7 + +9 +7 +0 +3 +6 + +1 +8 +8 +3 +9 + +5 +1 +2 +4 +4 + +4 +0 +0 +8 +4 + +9 +6 +5 +1 +8 + +2 +9 +0 +9 +1 + +1 +8 +9 +4 +4 + +7 +4 +2 +0 +6 + +5 +3 +8 +6 +4 + +4 +2 +3 +2 + +9 +9 +5 +4 +4 + +9 +4 +8 +4 + +8 +1 +3 +9 +1 + +9 +7 +1 +1 +3 + +8 +5 +9 +0 +1 + +4 +8 +0 +7 +9 + +5 +2 +0 +1 +3 + +7 +1 +9 +7 +4 + +6 +7 +7 +4 + +5 +1 +7 +6 +1 + +6 +0 +0 +7 +5 + +3 +4 +4 +6 +3 + +5 +2 +2 +8 +4 + +5 +7 +3 +2 +4 + +3 +5 +2 +3 +3 + +3 +1 +9 +9 +9 + +9 +1 +7 +0 +4 + +5 +9 +5 +0 +4 + +5 +4 +2 +9 +7 + +6 +1 +2 +6 +4 + +1 +4 +3 +2 +2 + +2 +5 +4 +6 +8 + +5 +5 +3 +6 +2 + +1 +9 +8 +2 +4 + +5 +2 +2 +1 +3 + +4 +1 +9 +6 +3 + +9 +5 +0 +1 +4 + +7 +2 +5 +2 +9 + +4 +8 +3 +8 +4 + +2 +9 +6 +1 +4 + +3 +1 +8 +0 +4 + +8 +8 +6 +2 +9 + +5 +0 +8 +9 +3 + +7 +2 +4 +5 +7 + +3 +9 +8 +4 +4 + +8 +7 +7 +0 +7 + +3 +2 +5 +9 +2 + +4 +3 +1 +8 +3 + +4 +0 +5 +1 +1 + +5 +3 +8 +5 +1 + +8 +3 +2 +7 + +4 +7 +5 +5 +0 + +2 +4 +3 +6 +5 + +3 +3 +7 +0 +4 + +7 +6 +4 +1 + +1 +7 +3 +7 +9 + +5 +0 +0 +5 +9 + +7 +6 +7 +2 +9 + +8 +2 +3 +4 +8 + +2 +6 +9 +4 +7 + +2 +6 +1 +6 +1 + +7 +2 +5 +1 +4 + +5 +5 +9 +6 +6 + +3 +8 +5 +5 +3 + +9 +1 +1 +8 +0 + +3 +0 +0 +7 +4 + +1 +2 +7 +6 +3 + +6 +6 +3 +0 +9 + +2 +0 +6 +7 +9 + +4 +0 +2 +6 +2 + +7 +2 +5 +9 +0 + +2 +1 +3 +1 +8 + +1 +1 +5 +3 +7 + +5 +1 +6 +2 + +2 +8 +3 +3 + +6 +3 +6 +1 +4 + +1 +0 +0 +7 +4 + +6 +7 +3 +5 +9 + +4 +6 +7 +0 +8 + +5 +9 +8 +0 +9 + +6 +7 +5 +8 + +1 +6 +7 +8 +3 + +5 +1 +9 +3 +0 + +1 +0 +2 +2 +8 + +1 +9 +6 +8 +6 + +3 +5 +4 +8 + +4 +9 +3 +9 +8 + +9 +7 +9 +4 +3 + +4 +3 +2 +5 +1 + +2 +1 +4 +5 +4 + +8 +0 +1 +2 +1 + +9 +7 +4 +5 +2 + +4 +4 +5 +5 +4 + +2 +3 +2 +8 +0 + +5 +3 +3 +9 +9 + +6 +3 +9 +8 +1 + +9 +2 +9 +7 +3 + +6 +3 +4 +3 +6 + +6 +4 +3 +4 +4 + +4 +8 +3 +9 +2 + +9 +1 +0 +8 +9 + +5 +1 +7 +8 +0 + +9 +1 +8 +0 +2 + +1 +6 +2 +6 + +3 +0 +0 +6 +8 + +9 +9 +6 +9 +3 + +3 +2 +6 +3 +4 + +1 +1 +3 +7 +2 + +8 +8 +8 +7 +8 + +6 +7 +7 +3 + +3 +3 +3 +6 +9 + +9 +3 +2 +0 +9 + +2 +5 +3 +7 +4 + +6 +0 +6 +7 +6 + +6 +3 +6 +9 +7 + +1 +0 +9 +6 +4 + +2 +7 +0 +2 +3 + +5 +3 +7 +4 +4 + +9 +6 +8 +1 +7 + +4 +3 +2 +0 +3 + +5 +1 +7 +2 +8 + +8 +8 +5 +2 +0 + +9 +3 +3 +0 +3 + +3 +7 +0 +2 +6 + +1 +8 +9 +6 +5 + +8 +2 +9 +8 +5 + +8 +6 +3 +7 +0 + +7 +4 +2 +5 + +2 +7 +7 +9 +1 + +5 +3 +2 +3 + +5 +4 +0 +5 +9 + +6 +5 +8 +6 +6 + +3 +7 +2 +9 +4 + +2 +0 +8 +4 +9 + +9 +3 +8 +8 +7 + +8 +4 +5 +9 +9 + +1 +7 +4 +8 + +1 +1 +1 +2 +8 + +3 +0 +3 +0 +2 + +3 +2 +3 +1 +0 + +2 +1 +7 +9 +8 + +7 +3 +3 +7 +6 + +6 +8 +6 +3 +5 + +4 +5 +1 +2 +3 + +6 +0 +1 +4 +5 + +7 +6 +6 +1 +4 + +4 +0 +0 +4 +5 + +3 +1 +6 +1 +3 + +7 +3 +3 +2 +7 + +1 +3 +8 +3 +3 + +7 +0 +4 +8 +8 + +7 +4 +8 +6 + +1 +5 +4 +5 +3 + +7 +9 +7 +8 +2 + +1 +5 +5 +5 +3 + +7 +1 +9 +1 + +9 +7 +2 +2 +2 + +4 +2 +7 +6 +8 + +4 +4 +8 + +6 +7 +7 +4 +6 + +7 +0 +4 +6 +1 + +3 +5 +3 +5 +6 + +9 +2 +3 +1 +6 + +3 +4 +9 +6 +5 + +1 +2 +6 +2 +7 + +9 +8 +2 +6 +4 + +9 +2 +7 +4 +4 + +5 +2 +9 +5 +9 + +9 +7 +0 +6 +4 + +6 +8 +5 +7 +6 + +7 +3 +4 +9 +3 + +8 +5 +1 +5 +0 + +9 +1 +8 +7 +9 + +1 +0 +7 +4 +6 + +4 +6 +4 +2 +6 + +7 +9 +3 +6 +3 + +4 +0 +5 +6 +0 + +9 +3 +1 +1 +1 + +3 +3 +3 +7 +7 + +5 +3 +8 +6 +3 + +7 +5 +6 +6 +3 + +7 +1 +0 +3 +5 + +5 +8 +1 +3 +3 + +3 +3 +3 +0 + +6 +5 +6 +7 +6 + +9 +5 +6 +1 +3 + +9 +4 +8 +1 + +5 +9 +7 +3 + +9 +2 +0 +1 +1 + +7 +1 +9 +6 +0 + +6 +0 +5 +7 +3 + +6 +3 +2 +6 +9 + +6 +4 +0 +4 +9 + +2 +2 +3 +6 +1 + +7 +2 +0 +9 +9 + +2 +0 +2 +1 + +7 +5 +3 +7 +1 + +8 +3 +3 +5 +1 + +7 +1 +6 +8 +4 + +3 +2 +9 +5 +0 + +6 +8 +7 +4 +9 + +4 +2 +2 +8 +0 + +5 +8 +8 +8 +1 + +1 +0 +8 +7 +6 + +7 +8 +3 +2 +5 + +2 +1 +8 +4 +2 + +3 +0 +8 +6 + +1 +2 +7 +2 + +6 +7 +2 +4 +7 + +8 +7 +3 +4 +5 + +4 +9 +6 +7 +1 + +6 +2 +2 +9 +9 + +5 +0 +1 +5 +1 + +7 +7 +7 +9 +4 + +9 +5 +9 +5 +0 + +1 +7 +9 +1 + +9 +5 +8 +3 + +1 +2 +7 +0 + +4 +4 +1 +9 +9 + +9 +9 +0 +4 +3 + +6 +3 +1 +3 +9 + +2 +3 +7 +5 +7 + +2 +9 +5 +2 +0 + +2 +2 +7 +4 +6 + +1 +7 +4 +8 +4 + +3 +2 +7 +9 +3 + +4 +0 +9 +0 + +5 +5 +0 +1 +8 + +9 +2 +7 +2 +6 + +5 +8 +4 +6 +2 + +7 +7 +6 +0 +9 + +1 +2 +9 +8 + +8 +5 +5 +5 +6 + +1 +2 +4 +9 +3 + +1 +8 +6 +1 + +9 +1 +9 +7 +6 + +9 +7 +3 +1 + +8 +9 +1 +2 +1 + +8 +0 +9 +1 +3 + +4 +2 +7 +4 +6 + +1 +0 +8 +2 +8 + +2 +4 +8 +0 +2 + +8 +0 +9 +9 +4 + +7 +1 +7 +8 +8 + +4 +2 +7 +6 +2 + +5 +4 +0 +8 +1 + +9 +3 +7 +8 +3 + +7 +0 +1 +9 +9 + +6 +2 +8 +4 +3 + +4 +3 +3 +9 +6 + +6 +3 +2 +2 +8 + +4 +2 +6 +5 +2 + +2 +6 +7 +2 +6 + +3 +5 +1 +5 +0 + +8 +9 +0 +0 +9 + +9 +7 +0 +8 +4 + +9 +8 +3 +1 +5 + +3 +2 +0 +2 +8 + +9 +3 +4 +9 +2 + +9 +2 +7 +6 +3 + +8 +9 +6 +1 +4 + +7 +9 +3 +0 +2 + +6 +9 +2 +0 +4 + +6 +0 +6 +8 +6 + +1 +2 +4 +2 +5 + +2 +7 +6 +7 +3 + +8 +6 +3 +4 +9 + +7 +5 +2 +0 +1 + +3 +0 +7 +7 +1 + +4 +7 +4 +7 +4 + +8 +1 +0 +4 +1 + +6 +0 +5 +6 +8 + +5 +0 +0 +1 + +4 +0 +9 +6 +7 + +4 +4 +0 +5 +0 + +5 +6 +6 +6 +6 + +3 +2 +1 +4 +1 + +3 +9 +6 +7 + +5 +7 + +5 +5 +4 +1 + +3 +3 +7 +7 +1 + +4 +3 +8 +5 +8 + +7 +9 +3 +4 +7 + +3 +8 +7 +7 +2 + +3 +7 +3 +6 +4 + +1 +3 +4 +9 +8 + +1 +6 +1 +5 +6 + +2 +8 +7 +6 +7 + +4 +9 +8 +2 +7 + +1 +3 +8 +6 +9 + +6 +2 +8 +5 +9 + +6 +9 +6 +7 +8 + +6 +6 +6 +4 +2 + +6 +3 +8 +4 +4 + +9 +7 +0 +7 +1 + +6 +2 +5 +9 +9 + +9 +0 +7 +4 +0 + +2 +7 +4 +8 +1 + +7 +7 +7 +8 +3 + +5 +7 +9 +9 +4 + +5 +3 +0 +9 +8 + +2 +9 +2 +5 +7 + +6 +0 +0 +9 +5 + +9 +7 +4 +9 +7 + +8 +5 +7 +3 +6 + +8 +3 +2 +4 + +1 +9 +5 +1 +8 + +9 +0 +0 +6 +9 + +1 +2 +8 +1 +0 + +6 +8 +5 +8 +0 + +6 +8 +5 +4 +6 + +7 +7 +5 +1 +6 + +8 +1 +2 +7 +9 + +3 +4 +8 +2 +2 + +7 +5 +1 +9 +1 + +1 +5 +2 +7 +9 + +6 +3 +8 +1 +2 + +5 +3 +2 +9 +7 + +2 +5 +4 +0 +3 + +6 +2 +8 +2 +9 + +8 +8 +1 +1 +0 + +9 +8 +7 +8 +6 + +7 +3 +9 +3 +4 + +6 +4 +1 +8 + +9 +8 +0 +6 +4 + +7 +2 +9 +5 +4 + +9 +6 +1 +1 +1 + +2 +9 +5 +3 +5 + +9 +1 +1 +1 +3 + +9 +7 +3 +6 +8 + +5 +4 +8 +6 +1 + +5 +7 +6 +8 + +1 +6 +5 +1 +2 + +7 +7 +3 +5 +2 + +4 +6 +6 +7 + +3 +2 +1 +1 +3 + +6 +3 +4 +9 +3 + +4 +5 +0 +0 +1 + +3 +3 +2 +4 +7 + +6 +7 +0 +2 +9 + +6 +7 +6 +8 +1 + +4 +9 +6 +1 +6 + +2 +3 +2 +0 +5 + +9 +4 +9 +4 +2 + +8 +8 +7 +8 +6 + +7 +5 +9 +1 +9 + +2 +7 +2 +3 +2 + +9 +6 +7 +5 +8 + +6 +0 +4 +8 + +5 +1 +0 +2 +9 + +5 +6 +4 +7 +5 + +2 +9 +8 +2 +1 + +7 +4 +2 +5 +8 + +9 +2 +9 +1 +2 + +6 +4 +9 +5 + +1 +4 +2 +9 +0 + +9 +3 +7 +4 +5 + +7 +5 +1 +2 + +2 +5 +5 +9 +8 + +4 +2 +3 +8 +2 + +6 +3 +0 +6 +6 + +5 +1 +7 +9 +1 + +8 +4 +0 +6 +7 + +2 +4 +1 +6 +3 + +1 +5 +9 +2 +7 + +7 +8 +4 +1 +6 + +9 +4 +8 +3 +0 + +8 +2 +0 +9 +0 + +2 +1 +1 +7 +8 + +2 +3 +7 +3 +2 + +3 +2 +3 +7 +3 + +2 +1 +2 +7 +6 + +9 +9 +3 +4 +0 + +5 +5 +5 +9 +4 + +7 +4 +1 +6 +7 + +9 +5 +1 +3 +6 + +3 +9 +8 +9 +1 + +5 +2 +5 +7 +7 + +5 +0 +3 +1 +1 + +7 +4 +2 +3 +6 + +3 +3 +2 +2 +9 + +7 +0 +0 +5 +0 + +6 +5 +2 +4 +5 + +7 +3 +1 +0 +2 + +5 +1 +8 +1 +9 + +6 +5 +2 +8 +4 + +9 +6 +6 +2 +1 + +5 +2 +0 +6 +4 + +8 +2 +1 +3 +7 + +3 +4 +9 +8 +0 + +8 +9 +7 +6 + +1 +9 +5 +9 +3 + +8 +4 +7 +7 +0 + +1 +1 +0 +4 +6 + +7 +1 +6 +7 + +7 +6 +2 +9 +7 + +5 +8 +1 +2 +7 + +6 +0 +5 +7 +1 + +8 +1 +1 +6 + +1 +6 +9 +3 +6 + +2 +6 +0 +7 +1 + +2 +6 +3 +2 +4 + +7 +4 +2 +2 +4 + +8 +8 +1 +5 +3 + +1 +9 +1 +2 +2 + +1 +9 +5 +4 + +9 +6 +9 +3 +8 + +1 +6 +2 +2 +1 + +7 +0 +7 +7 +3 + +7 + +3 +5 +4 +9 +9 + +8 +4 +9 +2 +2 + +8 +2 +8 +2 +3 + +8 +3 +2 +4 +6 + +9 +5 +8 +2 +8 + +5 +2 +7 +6 +2 + +2 +3 +2 +6 +4 + +2 +1 +5 +2 +1 + +1 +7 +4 +3 +6 + +7 +7 +5 +8 +8 + +7 +8 +7 +5 +5 + +6 +5 +6 +8 +8 + +3 +8 +0 +5 +0 + +2 +4 +9 +6 +4 + +4 +4 +0 +8 +7 + +2 +6 +8 +9 + +8 +4 +4 +0 +1 + +3 +6 +3 +8 +7 + +5 +8 +4 +5 + +6 +0 +7 +2 + +1 +8 +8 +6 +8 + +6 +9 +4 +3 +4 + +5 +4 +8 +2 +3 + +5 +9 +6 +9 +9 + +4 +3 +1 +7 +8 + +3 +4 +0 +1 +2 + +5 +2 +5 +5 +2 + +6 +1 +0 +2 +2 + +2 +6 +9 +4 +4 + +4 +4 +6 +2 +6 + +9 +7 +5 +4 +0 + +1 +8 +3 +0 +5 + +2 +6 +0 +0 +9 + +8 +2 +9 +7 +2 + +3 +4 +1 +5 +5 + +5 +7 +9 +8 +6 + +6 +4 +4 +8 +5 + +8 +6 +6 +8 +0 + +3 +2 +8 +0 +0 + +6 +8 +6 +5 +3 + +4 +9 +5 +5 +2 + +6 +2 +0 +4 +5 + +2 +9 +4 +7 +0 + +4 +4 +9 +4 +4 + +8 +2 +3 +7 + +2 +0 +9 +0 +1 + +2 +9 +0 +1 +7 + +2 +9 +6 +6 +1 + +7 +8 +9 +3 +9 + +4 +6 +4 +1 +8 + +5 +9 +7 +1 +0 + +8 +8 +5 +3 +4 + +9 +4 +4 +1 +8 + +4 +8 +6 +4 +1 + +7 +8 +1 +4 +2 + +2 +8 +0 +6 + +7 +8 +1 +0 +4 + +6 +3 +2 +2 +9 + +5 +0 +8 +8 +1 + +1 +9 +3 +2 +6 + +2 +6 +8 +2 +1 + +5 +7 +6 +6 +0 + +3 +7 +7 + +1 +4 +9 +6 +9 + +4 +7 +0 +6 +9 + +9 +9 +8 +7 +0 + +9 +0 +7 +3 +1 + +8 +0 +3 +9 +4 + +9 +0 +2 +2 +2 + +1 +0 +9 +9 +0 + +7 +1 +0 +6 +0 + +3 +6 +3 +0 +4 + +8 +1 +7 +3 +1 + +9 +0 +6 +1 +4 + +5 +7 +1 +6 +5 + +5 +3 +3 +8 +5 + +4 +0 +4 +4 +9 + +1 +0 +6 +2 +0 + +7 +5 +1 +2 +5 + +1 +4 +6 +1 +7 + +2 +7 +0 +8 +3 + +5 +7 +4 +3 +7 + +8 +4 +1 +5 +5 + +5 +5 +7 +7 +3 + +6 +3 +0 +5 +9 + +5 +1 +3 +2 +8 + +7 +1 +7 +1 +5 + +4 +1 +8 +1 +0 + +8 +8 +0 +5 +4 + +4 +4 +8 +7 +8 + +5 +0 +9 +8 +1 + +1 +5 +1 +8 + +2 +2 +1 +7 +3 + +2 +4 +8 +3 +3 + +3 +7 +4 +8 +8 + +8 +4 +0 +3 +6 + +1 +2 +0 +9 +8 + +6 +0 +2 +8 +5 + +9 +5 +3 +3 +0 + +3 +1 +8 +0 +2 + +7 +0 +5 +2 +4 + +6 +8 +7 +1 +7 + +8 +2 +0 +4 +7 + +7 +8 +2 +8 +4 + +4 +0 +9 +0 +5 + +9 +3 +6 +7 +8 + +8 +2 +2 +2 +9 + +8 +4 +0 +6 +0 + +6 +4 +5 +4 +1 + +3 +4 +8 +0 +4 + +6 +5 +2 +7 + +1 +6 +0 +6 +9 + +3 +9 +8 +0 +0 + +5 +6 +5 +6 +6 + +9 +2 +3 +2 +0 + +1 +3 +6 +3 +3 + +2 +7 +0 +7 +4 + +1 +0 +9 +5 +7 + +7 +8 +4 +4 +7 + +5 +1 +0 +0 +2 + +6 +1 +3 +3 +7 + +7 +7 +8 +2 +4 + +9 +6 +1 + +7 +0 +3 +8 + +5 +8 +1 +7 +7 + +2 +3 +4 +3 +8 + +2 +3 +4 +9 +3 + +3 +8 +4 +4 +9 + +8 +8 +1 +1 +9 + +1 +7 +4 +1 +4 + +5 +9 +7 +1 +7 + +2 +3 +6 +0 +7 + +3 +1 +0 +0 +0 + +7 +5 +8 +2 +1 + +5 +1 +7 +4 +8 + +6 +5 +8 +3 +4 + +7 +6 +0 +3 +2 + +5 +0 +3 +7 +9 + +4 +5 +6 +0 +7 + +8 +5 +1 +7 +2 + +2 +3 +4 +7 +2 + +8 +9 +1 +5 + +4 +3 +9 +1 + +5 +7 +9 +9 +6 + +3 +8 +2 +1 +4 + +8 +0 +4 +5 +8 + +2 +0 +9 +6 +1 + +9 +0 +7 +6 +7 + +9 +6 +8 +2 +5 + +4 +4 +7 +2 +2 + +1 +1 +6 +9 +1 + +1 +9 +6 +8 +9 + +5 +6 +1 +4 +9 + +8 +7 +8 +3 +7 + +9 +6 +3 +4 +9 + +4 +1 +0 +0 +9 + +2 +2 +4 +1 +8 + +8 +5 +9 +1 +1 + +1 +3 +9 +7 +3 + +2 +8 +3 +0 +1 + +9 +7 +5 +5 +6 + +5 +8 +6 +2 +8 + +1 +2 +9 +9 +3 + +5 +6 +7 +9 + +1 +1 +4 +6 +4 + +8 +8 +9 +1 +6 + +1 +5 +1 +6 +1 + +4 +7 +0 +7 +7 + +2 +6 +4 + +3 +7 +9 +7 +9 + +5 +8 +3 +6 +3 + +5 +7 +1 +3 +1 + +8 +2 +4 +2 +1 + +3 +2 +0 +7 +1 + +6 +3 +5 +0 +6 + +5 +9 +4 +8 +4 + +8 +4 +1 +7 +6 + +2 +0 +4 +3 +1 + +3 +5 +4 +4 + +4 +0 +1 +6 +8 + +7 +8 +3 +4 +4 + +9 +7 +2 +1 +2 + +9 +5 +6 +5 +9 + +3 +7 +9 +5 +2 + +7 +6 +8 +3 +8 + +8 +0 +5 +7 +7 + +7 +8 +8 +6 +7 + +8 +2 +3 +5 +6 + +4 +1 +8 +0 +4 + +4 +8 +0 +4 +1 + +7 +6 +4 +7 +9 + +3 +4 +5 +4 +5 + +9 +9 +2 +3 +0 + +4 +5 +3 +8 +7 + +3 +8 +8 +7 +1 + +5 +9 +6 +8 +6 + +2 +1 +6 +4 +5 + +8 +3 +8 +1 +3 + +5 +7 +0 +5 +7 + +1 +1 +2 +6 +1 + +6 +1 +9 +2 +7 + +7 +2 +5 +3 +1 + +8 +4 +8 +0 + +6 +2 +4 +5 +3 + +3 +5 +6 +3 +2 + +5 +9 +7 +2 +1 + +3 +9 +0 +9 +3 + +7 +9 +1 +5 +2 + +3 +1 +1 +2 +3 + +6 +7 +8 +2 +6 + +7 +8 +0 +4 +4 + +1 +6 +8 +0 +6 + +7 +9 +4 +0 +1 + +2 +3 +5 +4 +0 + +6 +1 +7 +4 + +7 +0 +1 +7 + +5 +4 +0 +8 +8 + +8 +5 +8 +1 +3 + +6 +7 +5 + +5 +0 +6 +3 +9 + +8 +7 +0 +8 + +9 +1 +1 +3 +6 + +6 +9 +4 +0 +8 + +1 +3 +4 +5 +1 + +4 +1 +9 +1 +4 + +4 +5 +1 +9 +6 + +3 +3 +0 +6 +1 + +6 +4 +4 +0 +7 + +3 +7 +4 +6 +6 + +9 +1 +0 +4 +5 + +1 +5 +4 +9 +8 + +2 +1 +8 +8 +2 + +5 +1 +8 +8 +0 + +6 +0 +0 +5 +0 + +5 +2 +1 +0 +3 + +3 +2 +6 +6 +2 + +4 +8 +4 +6 +1 + +8 +9 +1 +9 + +3 +4 +0 +0 +2 + +1 +2 +6 +0 +0 + +3 +3 +4 +5 +0 + +2 +1 +6 +1 +7 + +2 +3 +1 +9 +3 + +8 +7 +3 +8 +4 + +6 +5 +8 +7 + +8 +9 +6 +4 +0 + +9 +5 +0 +5 +2 + +2 +1 +6 +9 +2 + +9 +2 +4 +2 +9 + +8 +1 +1 +2 +5 + +5 +7 +4 +0 +4 + +5 +9 +3 +3 +4 + +1 +3 +3 +9 +5 + +4 +5 +3 +3 +8 + +4 +3 +2 +8 +0 + +1 +8 +9 +6 +2 + +3 +7 +9 +3 +6 + +4 +2 +1 +3 +7 + +5 +1 +7 +9 +6 + +3 +2 +2 +8 +9 + +3 +9 +9 +4 +1 + +4 +0 +5 +9 +3 + +6 +3 +9 +0 +6 + +2 +8 +8 +4 +9 + +8 +7 +8 +2 +8 + +5 +6 +6 +2 +3 + +7 +9 +1 +4 +2 + +5 +8 +6 +7 +7 + +6 +0 +5 +2 +6 + +4 +6 +1 +9 +1 + +9 +4 +1 +3 +4 + +8 +4 +8 +4 + +3 +0 +1 +5 +3 + +2 +7 +0 +8 +1 + +1 +4 +2 +7 +0 + +9 +2 +8 +3 +6 + +1 +9 +1 +9 +7 + +5 +1 +2 +9 +7 + +8 +8 +8 +0 +8 + +6 +5 +7 +0 + +7 +6 +0 +6 +9 + +1 +4 +1 +0 +7 + +3 +5 +5 +3 +8 + +4 +3 +9 +9 +5 + +4 +2 +8 +9 +2 + +1 +9 +8 +4 +1 + +7 +5 +4 +0 +0 + +1 +6 +8 +5 +8 + +1 +7 +3 +9 +8 + +8 +8 +6 +3 +1 + +3 +9 +0 +9 + +9 +8 +9 +1 +8 + +8 +4 +2 +1 +4 + +7 +8 +7 +7 +8 + +1 +4 +7 +2 + +2 +4 +8 +8 +6 + +1 +8 +1 +2 +7 + +8 +8 +2 +2 +2 + +1 +2 +5 +3 + +3 +0 +3 +6 +6 + +5 +1 +6 +9 + +5 +3 +3 +1 +7 + +3 +5 +5 +7 +4 + +9 +8 +1 +2 +7 + +7 +1 +0 +1 +0 + +2 +6 +1 +8 +0 + +9 +8 +0 +3 +5 + +3 +7 +7 +5 + +9 +6 +6 +3 +3 + +4 +2 +9 +3 +9 + +1 +5 +1 +4 +1 + +7 +6 +3 +0 +4 + +9 +8 +5 +7 +2 + +1 +4 +2 +9 +4 + +9 +6 +9 +1 +4 + +3 +4 +0 +2 +0 + +7 +3 +8 +8 +0 + +6 +6 +1 +3 +2 + +5 +6 +4 +9 +5 + +2 +7 +1 +3 +8 + +7 +3 +0 +3 +7 + +2 +0 +8 +9 +3 + +2 +8 +2 +5 +7 + +8 +9 +3 +2 +9 + +2 +0 +9 +5 +4 + +4 +5 +8 +1 + +3 +2 +8 +6 +2 + +3 +4 +2 +1 +6 + +9 +2 +9 + +9 +7 +6 +1 +1 + +6 +1 +9 +7 +6 + +3 +5 +4 +8 +1 + +5 +2 +1 +9 +3 + +4 +5 +4 +9 +1 + +9 +3 +5 +1 +8 + +9 +1 +2 +9 +1 + +8 +0 +6 +8 + +9 +5 +0 +7 + +9 +2 +4 +2 +3 + +7 +9 +5 +5 +0 + +3 +8 +0 +3 +2 + +5 +7 +6 +9 +3 + +5 +9 +5 +5 +4 + +5 +5 +3 +1 +7 + +1 +7 +8 +3 +9 + +3 +2 +4 +3 +1 + +5 +2 +1 +8 +7 + +4 +7 +2 +7 +8 + +1 +8 +5 +8 +3 + +4 +0 +4 +0 +2 + +6 +9 +1 +2 +3 + +3 +1 +9 +8 +3 + +6 +1 +1 +9 +9 + +7 +9 +9 +9 +3 + +3 +9 +5 +7 +8 + +3 +2 +3 +4 + +3 +7 +4 +2 + +8 +5 +2 +1 +0 + +7 +3 +9 +3 +3 + +6 +7 +3 +4 +7 + +9 +5 +8 +3 +7 + +2 +6 +0 +0 +1 + +8 +0 +7 +7 +8 + +9 +6 +8 +1 +0 + +6 +5 +6 +4 +5 + +6 +8 +6 +3 +8 + +1 +3 +1 +6 +9 + +9 +8 +9 +8 +4 + +1 +4 +7 +8 +8 + +7 +3 +3 +5 +6 + +1 +5 +8 +0 +0 + +3 +3 +8 +5 +1 + +3 +0 +3 +2 +8 + +7 +6 +6 +5 +9 + +5 +6 +3 +2 +3 + +5 +9 +0 +1 +1 + +1 +4 +3 +5 +4 + +3 +7 +4 +9 +6 + +8 +6 +9 +4 +9 + +6 +7 +3 +7 +3 + +7 +8 +3 +6 + +7 +4 +9 +8 +1 + +1 +6 +4 +4 +4 + +6 +6 +5 +1 +3 + +8 +2 +3 +3 +9 + +4 +2 +7 +2 +8 + +5 +9 +6 +2 +6 + +5 +4 +3 +0 +4 + +6 +7 +7 +6 +0 + +8 +1 +3 +4 +4 + +3 +0 +5 +5 +1 + +7 +7 +4 +8 +0 + +1 +0 +4 +8 +1 + +3 +5 +8 +2 +0 + +7 +5 +0 +9 +4 + +2 +3 +0 +3 +1 + +4 +3 +0 +9 +9 + +4 +2 +7 +2 +5 + +3 +0 +3 +7 +0 + +1 +9 +5 +9 +7 + +2 +1 +6 +3 +7 + +4 +9 +0 +2 +1 + +4 +3 +1 +9 +4 + +3 +3 +8 +4 +7 + +4 +5 +4 +3 +8 + +2 +2 +2 +7 +0 + +3 +5 +1 +6 +0 + +2 +7 +1 +0 +7 + +3 +9 +8 +5 +9 + +6 +3 +0 +6 +0 + +9 +0 +9 +7 + +6 +4 +0 +3 +6 + +6 +4 +7 +8 +8 + +2 +3 +6 +5 +9 + +3 +9 +9 +5 + +3 +4 +1 +0 +0 + +2 +8 +0 +6 +4 + +1 +3 +1 +7 +3 + +4 +0 +3 +9 +1 + +7 +4 +0 + +1 +6 +5 +4 +1 + +4 +0 +7 +0 +2 + +7 +1 +5 +0 +6 + +8 +2 +3 +3 +7 + +2 +2 +7 +0 +6 + +2 +6 +8 +5 +7 + +3 +2 +8 +9 +1 + +4 +2 +4 +4 +7 + +5 +9 +2 +2 +8 + +8 +9 +2 +7 +9 + +2 +4 +3 +4 +3 + +2 +1 +6 +7 +3 + +9 +5 +2 +7 +7 + +4 +5 +8 +1 +2 + +1 +0 +6 +8 +8 + +4 +4 +9 +7 +9 + +6 +6 +4 +7 +6 + +5 +8 +9 +7 +0 + +3 +5 +4 +6 +1 + +2 +3 +5 +2 +5 + +1 +8 +2 +0 +7 + +9 +1 +1 +1 +4 + +5 +2 +6 +1 +9 + +3 +8 +5 +1 +5 + +7 +5 +0 +0 +2 + +6 +0 +7 +6 +8 + +2 +4 +8 +3 +5 + +4 +1 +1 +3 +8 + +2 +2 +5 +5 +6 + +3 +8 +0 +4 +4 + +1 +2 +0 +2 + +2 +7 +2 +2 +6 + +3 +0 +2 +0 +4 + +8 +7 +9 +2 +1 + +8 +9 +9 +6 +6 + +6 +9 +9 +5 +7 + +2 +9 +8 +4 +2 + +2 +0 +4 +5 +8 + +3 +0 +6 +0 +2 + +2 +3 +2 +1 +7 + +9 +5 +6 +0 +9 + +5 +1 +6 +9 +4 + +5 +4 +8 +9 + +4 +3 +0 +2 +0 + +6 +1 +4 +6 +6 + +1 +9 +5 +3 +9 + +4 +9 +2 +0 +0 + +5 +5 +5 +1 +1 + +2 +3 +3 +3 +6 + +9 +6 +8 +3 +5 + +8 +2 +7 +5 +2 + +2 +8 +8 +6 +0 + +8 +7 +0 +0 +1 + +9 +8 +6 +0 +3 + +7 +3 +3 +7 +7 + +4 +5 +6 +6 +6 + +6 +6 +2 +5 +8 + +2 +8 +5 +3 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog5/blog5Tag.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog5/blog5Tag.txt new file mode 100644 index 000000000..6e2723abd --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog5/blog5Tag.txt @@ -0,0 +1,562 @@ +5 +4 +9 +7 +3 + +3 +2 +1 +8 +3 + +3 +9 +7 +7 +9 + +5 +7 +7 +8 +7 + +8 +1 +4 +6 +3 + +2 +6 +6 +4 +7 + +2 +3 +0 +8 +7 + +9 +0 +2 +1 +7 + +2 +3 +9 +5 +7 + +7 +4 +3 +8 +3 + +9 +8 +8 +9 +7 + +1 +1 +7 +7 +7 + +6 +4 +1 +8 +7 + +1 +8 +8 +3 +9 + +4 +8 +0 +7 +9 + +5 +0 +8 +9 +3 + +2 +6 +9 +4 +7 + +2 +6 +1 +6 +1 + +1 +2 +7 +6 +3 + +2 +8 +3 +3 + +5 +9 +8 +0 +9 + +9 +7 +9 +4 +3 + +6 +3 +6 +9 +7 + +2 +7 +7 +9 +1 + +5 +3 +2 +3 + +5 +4 +0 +5 +9 + +2 +0 +8 +4 +9 + +9 +3 +8 +8 +7 + +7 +3 +3 +2 +7 + +3 +3 +3 +7 +7 + +6 +8 +7 +4 +9 + +6 +7 +2 +4 +7 + +6 +2 +2 +9 +9 + +1 +8 +6 +1 + +7 +0 +1 +9 +9 + +8 +9 +0 +0 +9 + +2 +7 +6 +7 +3 + +8 +1 +0 +4 +1 + +3 +2 +1 +4 +1 + +3 +9 +6 +7 + +2 +7 +4 +8 +1 + +7 +7 +7 +8 +3 + +6 +3 +4 +9 +3 + +3 +3 +2 +4 +7 + +8 +4 +0 +6 +7 + +7 +4 +1 +6 +7 + +5 +0 +3 +1 +1 + +7 + +2 +1 +5 +2 +1 + +4 +4 +0 +8 +7 + +2 +6 +8 +9 + +8 +4 +4 +0 +1 + +5 +9 +6 +9 +9 + +8 +2 +3 +7 + +2 +9 +0 +1 +7 + +2 +6 +8 +2 +1 + +1 +4 +9 +6 +9 + +9 +0 +7 +3 +1 + +6 +3 +0 +5 +9 + +1 +6 +0 +6 +9 + +1 +3 +6 +3 +3 + +1 +0 +9 +5 +7 + +3 +8 +4 +4 +9 + +7 +5 +8 +2 +1 + +4 +3 +9 +1 + +5 +6 +1 +4 +9 + +1 +5 +1 +6 +1 + +5 +8 +3 +6 +3 + +5 +7 +1 +3 +1 + +8 +2 +4 +2 +1 + +2 +0 +4 +3 +1 + +8 +3 +8 +1 +3 + +1 +1 +2 +6 +1 + +6 +1 +9 +2 +7 + +3 +1 +1 +2 +3 + +1 +3 +4 +5 +1 + +5 +2 +1 +0 +3 + +2 +1 +6 +1 +7 + +1 +4 +1 +0 +7 + +1 +9 +8 +4 +1 + +1 +8 +1 +2 +7 + +7 +3 +0 +3 +7 + +8 +9 +3 +2 +9 + +9 +2 +9 + +4 +5 +4 +9 +1 + +9 +1 +2 +9 +1 + +1 +7 +8 +3 +9 + +1 +8 +5 +8 +3 + +3 +3 +8 +5 +1 + +5 +9 +0 +1 +1 + +8 +2 +3 +3 +9 + +1 +9 +5 +9 +7 + +2 +7 +1 +0 +7 + +2 +1 +6 +7 +3 + +3 +5 +4 +6 +1 + +5 +5 +5 +1 +1 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog6/blog6.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog6/blog6.txt new file mode 100644 index 000000000..755674d03 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog6/blog6.txt @@ -0,0 +1 @@ +41752 72181 13048 40377 58274 56269 9092 10925 80205 70277 63151 24157 9457 65095 43498 14858 13857 29349 85758 48322 43857 16682 28047 49041 75120 60228 82956 97172 2876 539 51249 66221 35934 25035 49596 8161 45094 3297 29041 95383 15200 237 61479 36862 65742 66553 76182 99541 48370 24858 46453 96573 55526 47311 6070 68878 45830 19058 90534 81583 65437 70391 64768 18797 61942 33950 2835 12645 99966 57299 79741 42041 55056 63767 49027 34903 79674 90659 33099 35144 43091 8974 96278 72141 53570 36327 91299 21431 96082 56900 38402 88787 56242 45181 29571 50428 21102 76014 16510 94803 11838 26847 61851 99866 42649 90050 17729 32494 29256 23376 20713 34357 63278 80820 15816 32577 94164 89863 31726 1668 27780 1426 65226 46297 32600 50122 26049 49899 44506 99646 54150 57471 65096 15940 40361 9323 25159 92419 6010 6188 92850 79924 14451 3926 44842 59532 48678 92851 24685 23169 1952 55261 39490 28701 46973 22563 62804 96773 70688 77778 49973 45262 4389 59595 75738 44367 75581 23732 22835 57153 34954 42597 90823 1379 82062 74156 79928 26813 90921 59397 57017 37246 1935 84386 12176 40458 86222 21794 66043 52464 64889 99571 5706 70219 26524 74059 7421 54876 5724 35341 87677 19407 1716 45059 72996 89497 12237 72984 28241 56311 82483 20453 1673 34493 54149 61837 40010 18467 77014 60766 17750 81962 2819 88545 72829 70561 38886 10084 88362 62998 26455 8615 94734 82622 28882 17154 5676 12550 75477 9479 32813 51359 74683 66991 23444 17865 13806 81854 48242 56408 87664 96473 74839 56385 75330 90477 3327 74548 98645 55705 52425 39423 73493 4479 64397 3050 19027 52012 57104 18609 17978 23835 24109 84347 4269 9746 22389 12708 84512 68760 27459 62113 44131 88308 84869 5947 59525 25528 84579 63215 88576 41522 67348 58798 25052 72377 88390 58703 50723 59461 17861 57681 20249 2021 33640 96193 97863 89473 11266 29456 36285 26765 84887 54068 9590 89671 44957 26975 39212 98431 94712 60858 43699 89765 12810 94907 78007 39261 11162 74433 7320 53440 55513 22491 30102 46197 48766 81248 84514 60273 16764 60034 56699 63226 92337 44417 71549 30805 25792 85492 11413 58575 42029 90685 92749 69820 10053 84614 45559 3458 40738 12485 37952 56386 78856 39044 79814 67784 7998 89194 3044 88193 76523 27456 93599 20172 99564 70612 6403 67189 56975 66871 76668 92171 48064 45429 39452 11936 26449 25147 8356 96033 34296 15852 22283 85804 16009 9626 16678 62814 49643 59943 52486 72080 37949 35028 27094 78566 7724 39825 67516 23698 39301 30907 61915 82955 19968 99650 62638 56697 14679 54521 57909 16331 47373 32608 32136 46299 47548 4598 82756 58428 21282 73478 2669 31598 26846 90210 82292 49834 75135 87559 65763 79427 79350 95616 70487 90809 20403 92883 24766 91688 43028 38939 75154 91066 19555 56817 39078 8159 83222 55931 95790 1789 17223 67339 76931 39664 14174 52061 12784 98682 62385 50820 68646 94912 85053 34351 6358 99274 50410 40731 61422 1139 40760 2358 98358 68730 92620 44318 86703 55864 82685 41219 63317 23034 10999 94175 66026 1851 43142 9355 76005 7790 27556 34069 93377 13275 77340 15777 18402 36823 51842 35265 3914 64302 47240 82921 41407 91683 8980 47987 23614 49336 98716 91705 8459 81489 35372 92259 72320 29058 91948 12354 27048 64579 63385 66561 35985 31685 9787 88454 68502 97425 17649 18442 52058 30870 41108 72697 29231 40848 33189 34969 74546 28442 13603 68832 85824 1473 27184 58146 46874 6485 8447 12401 99293 56979 84270 42575 69073 88234 19883 46643 59746 93732 2701 62583 8489 82493 35673 80384 76718 86604 54134 1163 53428 50304 35440 33552 87635 57639 75073 70358 93380 96574 47053 28404 40806 24493 17305 6415 71992 43548 8519 93662 40428 51105 29992 54357 69120 39456 74309 23173 17619 74613 79856 36337 56928 9095 16856 34004 8361 50788 12098 71646 82864 27075 58551 25756 69673 51005 79599 82273 18950 60054 64203 64725 62148 6734 80145 83237 28556 44026 91448 62793 28281 21541 86821 86597 78647 81269 22975 48364 26252 62832 74758 18556 4429 40067 95476 87317 36968 1301 79382 74273 57535 70662 25660 4768 96957 11484 76835 73242 31194 82824 36896 47645 25535 25974 83839 55831 34926 74 28930 55058 66470 10119 59045 12085 7621 579 5544 12378 7392 38029 36060 42969 20145 47604 86992 28211 58810 82992 41475 68160 59557 59884 55268 70368 58525 56026 53494 14101 43059 15479 37985 92444 69543 28367 23868 60728 23974 10937 67684 41519 60714 11291 31901 6898 28491 21839 75342 26949 97955 43406 95463 15885 88672 42204 17078 56658 41037 56414 82460 55844 96694 64088 99407 66120 71823 37418 62466 49149 466 67210 90321 13863 85388 63667 22463 76246 296 99585 53602 63689 86975 94694 81592 16402 51493 53960 5063 85557 69470 17499 3756 21681 18380 36280 77225 1841 95680 53100 80425 24599 42610 9884 69857 57919 58465 72252 39027 83783 6806 74869 17727 14433 13197 79074 67574 13246 78988 97451 72412 54548 35067 57004 85449 61348 39361 81348 22456 38509 75832 41129 75697 45205 60261 22985 60838 36191 34665 55252 39159 91277 40443 27675 85587 5003 6674 41131 72607 11834 51542 9971 60590 30795 64443 56944 3476 64687 20517 7433 40342 89309 18881 12131 76354 57025 12387 37452 66172 5504 39832 45369 78451 45525 94201 4714 54715 52842 65267 36854 76659 88815 61329 59260 43893 78116 16373 77590 81534 32550 49415 97528 63037 12157 48409 34523 75409 66602 61834 2219 28622 85362 7682 47843 61721 67558 6844 38875 14824 47814 4406 42448 55383 77814 74515 96479 83563 46569 48257 92649 34466 35160 54889 24607 50141 5503 71534 1135 47816 44865 77431 53385 65306 33485 58168 64097 81536 19584 62882 53477 31121 1184 11139 46252 19706 53823 97061 26378 66961 32514 19930 14055 95098 11478 76781 50256 80728 50961 67545 31923 80075 5170 1244 83035 1562 35689 82216 68732 94070 43294 89543 91932 18172 75631 66508 29996 10869 4599 37074 92156 90838 66554 12 17353 19110 94233 94961 16290 27852 11668 1035 41713 41649 75761 30879 59745 43614 88816 85631 20014 85546 5267 17321 21560 21997 96533 66285 93091 42233 30722 11177 18907 65169 59391 36790 54959 \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog6/blog6Out.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog6/blog6Out.txt new file mode 100644 index 000000000..6acd1d0ad --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog6/blog6Out.txt @@ -0,0 +1,5883 @@ +4 +1 +7 +5 +2 + +7 +2 +1 +8 +1 + +1 +3 +0 +4 +8 + +4 +0 +3 +7 +7 + +5 +8 +2 +7 +4 + +5 +6 +2 +6 +9 + +9 +0 +9 +2 + +1 +0 +9 +2 +5 + +8 +0 +2 +0 +5 + +7 +0 +2 +7 +7 + +6 +3 +1 +5 +1 + +2 +4 +1 +5 +7 + +9 +4 +5 +7 + +6 +5 +0 +9 +5 + +4 +3 +4 +9 +8 + +1 +4 +8 +5 +8 + +1 +3 +8 +5 +7 + +2 +9 +3 +4 +9 + +8 +5 +7 +5 +8 + +4 +8 +3 +2 +2 + +4 +3 +8 +5 +7 + +1 +6 +6 +8 +2 + +2 +8 +0 +4 +7 + +4 +9 +0 +4 +1 + +7 +5 +1 +2 +0 + +6 +0 +2 +2 +8 + +8 +2 +9 +5 +6 + +9 +7 +1 +7 +2 + +2 +8 +7 +6 + +5 +3 +9 + +5 +1 +2 +4 +9 + +6 +6 +2 +2 +1 + +3 +5 +9 +3 +4 + +2 +5 +0 +3 +5 + +4 +9 +5 +9 +6 + +8 +1 +6 +1 + +4 +5 +0 +9 +4 + +3 +2 +9 +7 + +2 +9 +0 +4 +1 + +9 +5 +3 +8 +3 + +1 +5 +2 +0 +0 + +2 +3 +7 + +6 +1 +4 +7 +9 + +3 +6 +8 +6 +2 + +6 +5 +7 +4 +2 + +6 +6 +5 +5 +3 + +7 +6 +1 +8 +2 + +9 +9 +5 +4 +1 + +4 +8 +3 +7 +0 + +2 +4 +8 +5 +8 + +4 +6 +4 +5 +3 + +9 +6 +5 +7 +3 + +5 +5 +5 +2 +6 + +4 +7 +3 +1 +1 + +6 +0 +7 +0 + +6 +8 +8 +7 +8 + +4 +5 +8 +3 +0 + +1 +9 +0 +5 +8 + +9 +0 +5 +3 +4 + +8 +1 +5 +8 +3 + +6 +5 +4 +3 +7 + +7 +0 +3 +9 +1 + +6 +4 +7 +6 +8 + +1 +8 +7 +9 +7 + +6 +1 +9 +4 +2 + +3 +3 +9 +5 +0 + +2 +8 +3 +5 + +1 +2 +6 +4 +5 + +9 +9 +9 +6 +6 + +5 +7 +2 +9 +9 + +7 +9 +7 +4 +1 + +4 +2 +0 +4 +1 + +5 +5 +0 +5 +6 + +6 +3 +7 +6 +7 + +4 +9 +0 +2 +7 + +3 +4 +9 +0 +3 + +7 +9 +6 +7 +4 + +9 +0 +6 +5 +9 + +3 +3 +0 +9 +9 + +3 +5 +1 +4 +4 + +4 +3 +0 +9 +1 + +8 +9 +7 +4 + +9 +6 +2 +7 +8 + +7 +2 +1 +4 +1 + +5 +3 +5 +7 +0 + +3 +6 +3 +2 +7 + +9 +1 +2 +9 +9 + +2 +1 +4 +3 +1 + +9 +6 +0 +8 +2 + +5 +6 +9 +0 +0 + +3 +8 +4 +0 +2 + +8 +8 +7 +8 +7 + +5 +6 +2 +4 +2 + +4 +5 +1 +8 +1 + +2 +9 +5 +7 +1 + +5 +0 +4 +2 +8 + +2 +1 +1 +0 +2 + +7 +6 +0 +1 +4 + +1 +6 +5 +1 +0 + +9 +4 +8 +0 +3 + +1 +1 +8 +3 +8 + +2 +6 +8 +4 +7 + +6 +1 +8 +5 +1 + +9 +9 +8 +6 +6 + +4 +2 +6 +4 +9 + +9 +0 +0 +5 +0 + +1 +7 +7 +2 +9 + +3 +2 +4 +9 +4 + +2 +9 +2 +5 +6 + +2 +3 +3 +7 +6 + +2 +0 +7 +1 +3 + +3 +4 +3 +5 +7 + +6 +3 +2 +7 +8 + +8 +0 +8 +2 +0 + +1 +5 +8 +1 +6 + +3 +2 +5 +7 +7 + +9 +4 +1 +6 +4 + +8 +9 +8 +6 +3 + +3 +1 +7 +2 +6 + +1 +6 +6 +8 + +2 +7 +7 +8 +0 + +1 +4 +2 +6 + +6 +5 +2 +2 +6 + +4 +6 +2 +9 +7 + +3 +2 +6 +0 +0 + +5 +0 +1 +2 +2 + +2 +6 +0 +4 +9 + +4 +9 +8 +9 +9 + +4 +4 +5 +0 +6 + +9 +9 +6 +4 +6 + +5 +4 +1 +5 +0 + +5 +7 +4 +7 +1 + +6 +5 +0 +9 +6 + +1 +5 +9 +4 +0 + +4 +0 +3 +6 +1 + +9 +3 +2 +3 + +2 +5 +1 +5 +9 + +9 +2 +4 +1 +9 + +6 +0 +1 +0 + +6 +1 +8 +8 + +9 +2 +8 +5 +0 + +7 +9 +9 +2 +4 + +1 +4 +4 +5 +1 + +3 +9 +2 +6 + +4 +4 +8 +4 +2 + +5 +9 +5 +3 +2 + +4 +8 +6 +7 +8 + +9 +2 +8 +5 +1 + +2 +4 +6 +8 +5 + +2 +3 +1 +6 +9 + +1 +9 +5 +2 + +5 +5 +2 +6 +1 + +3 +9 +4 +9 +0 + +2 +8 +7 +0 +1 + +4 +6 +9 +7 +3 + +2 +2 +5 +6 +3 + +6 +2 +8 +0 +4 + +9 +6 +7 +7 +3 + +7 +0 +6 +8 +8 + +7 +7 +7 +7 +8 + +4 +9 +9 +7 +3 + +4 +5 +2 +6 +2 + +4 +3 +8 +9 + +5 +9 +5 +9 +5 + +7 +5 +7 +3 +8 + +4 +4 +3 +6 +7 + +7 +5 +5 +8 +1 + +2 +3 +7 +3 +2 + +2 +2 +8 +3 +5 + +5 +7 +1 +5 +3 + +3 +4 +9 +5 +4 + +4 +2 +5 +9 +7 + +9 +0 +8 +2 +3 + +1 +3 +7 +9 + +8 +2 +0 +6 +2 + +7 +4 +1 +5 +6 + +7 +9 +9 +2 +8 + +2 +6 +8 +1 +3 + +9 +0 +9 +2 +1 + +5 +9 +3 +9 +7 + +5 +7 +0 +1 +7 + +3 +7 +2 +4 +6 + +1 +9 +3 +5 + +8 +4 +3 +8 +6 + +1 +2 +1 +7 +6 + +4 +0 +4 +5 +8 + +8 +6 +2 +2 +2 + +2 +1 +7 +9 +4 + +6 +6 +0 +4 +3 + +5 +2 +4 +6 +4 + +6 +4 +8 +8 +9 + +9 +9 +5 +7 +1 + +5 +7 +0 +6 + +7 +0 +2 +1 +9 + +2 +6 +5 +2 +4 + +7 +4 +0 +5 +9 + +7 +4 +2 +1 + +5 +4 +8 +7 +6 + +5 +7 +2 +4 + +3 +5 +3 +4 +1 + +8 +7 +6 +7 +7 + +1 +9 +4 +0 +7 + +1 +7 +1 +6 + +4 +5 +0 +5 +9 + +7 +2 +9 +9 +6 + +8 +9 +4 +9 +7 + +1 +2 +2 +3 +7 + +7 +2 +9 +8 +4 + +2 +8 +2 +4 +1 + +5 +6 +3 +1 +1 + +8 +2 +4 +8 +3 + +2 +0 +4 +5 +3 + +1 +6 +7 +3 + +3 +4 +4 +9 +3 + +5 +4 +1 +4 +9 + +6 +1 +8 +3 +7 + +4 +0 +0 +1 +0 + +1 +8 +4 +6 +7 + +7 +7 +0 +1 +4 + +6 +0 +7 +6 +6 + +1 +7 +7 +5 +0 + +8 +1 +9 +6 +2 + +2 +8 +1 +9 + +8 +8 +5 +4 +5 + +7 +2 +8 +2 +9 + +7 +0 +5 +6 +1 + +3 +8 +8 +8 +6 + +1 +0 +0 +8 +4 + +8 +8 +3 +6 +2 + +6 +2 +9 +9 +8 + +2 +6 +4 +5 +5 + +8 +6 +1 +5 + +9 +4 +7 +3 +4 + +8 +2 +6 +2 +2 + +2 +8 +8 +8 +2 + +1 +7 +1 +5 +4 + +5 +6 +7 +6 + +1 +2 +5 +5 +0 + +7 +5 +4 +7 +7 + +9 +4 +7 +9 + +3 +2 +8 +1 +3 + +5 +1 +3 +5 +9 + +7 +4 +6 +8 +3 + +6 +6 +9 +9 +1 + +2 +3 +4 +4 +4 + +1 +7 +8 +6 +5 + +1 +3 +8 +0 +6 + +8 +1 +8 +5 +4 + +4 +8 +2 +4 +2 + +5 +6 +4 +0 +8 + +8 +7 +6 +6 +4 + +9 +6 +4 +7 +3 + +7 +4 +8 +3 +9 + +5 +6 +3 +8 +5 + +7 +5 +3 +3 +0 + +9 +0 +4 +7 +7 + +3 +3 +2 +7 + +7 +4 +5 +4 +8 + +9 +8 +6 +4 +5 + +5 +5 +7 +0 +5 + +5 +2 +4 +2 +5 + +3 +9 +4 +2 +3 + +7 +3 +4 +9 +3 + +4 +4 +7 +9 + +6 +4 +3 +9 +7 + +3 +0 +5 +0 + +1 +9 +0 +2 +7 + +5 +2 +0 +1 +2 + +5 +7 +1 +0 +4 + +1 +8 +6 +0 +9 + +1 +7 +9 +7 +8 + +2 +3 +8 +3 +5 + +2 +4 +1 +0 +9 + +8 +4 +3 +4 +7 + +4 +2 +6 +9 + +9 +7 +4 +6 + +2 +2 +3 +8 +9 + +1 +2 +7 +0 +8 + +8 +4 +5 +1 +2 + +6 +8 +7 +6 +0 + +2 +7 +4 +5 +9 + +6 +2 +1 +1 +3 + +4 +4 +1 +3 +1 + +8 +8 +3 +0 +8 + +8 +4 +8 +6 +9 + +5 +9 +4 +7 + +5 +9 +5 +2 +5 + +2 +5 +5 +2 +8 + +8 +4 +5 +7 +9 + +6 +3 +2 +1 +5 + +8 +8 +5 +7 +6 + +4 +1 +5 +2 +2 + +6 +7 +3 +4 +8 + +5 +8 +7 +9 +8 + +2 +5 +0 +5 +2 + +7 +2 +3 +7 +7 + +8 +8 +3 +9 +0 + +5 +8 +7 +0 +3 + +5 +0 +7 +2 +3 + +5 +9 +4 +6 +1 + +1 +7 +8 +6 +1 + +5 +7 +6 +8 +1 + +2 +0 +2 +4 +9 + +2 +0 +2 +1 + +3 +3 +6 +4 +0 + +9 +6 +1 +9 +3 + +9 +7 +8 +6 +3 + +8 +9 +4 +7 +3 + +1 +1 +2 +6 +6 + +2 +9 +4 +5 +6 + +3 +6 +2 +8 +5 + +2 +6 +7 +6 +5 + +8 +4 +8 +8 +7 + +5 +4 +0 +6 +8 + +9 +5 +9 +0 + +8 +9 +6 +7 +1 + +4 +4 +9 +5 +7 + +2 +6 +9 +7 +5 + +3 +9 +2 +1 +2 + +9 +8 +4 +3 +1 + +9 +4 +7 +1 +2 + +6 +0 +8 +5 +8 + +4 +3 +6 +9 +9 + +8 +9 +7 +6 +5 + +1 +2 +8 +1 +0 + +9 +4 +9 +0 +7 + +7 +8 +0 +0 +7 + +3 +9 +2 +6 +1 + +1 +1 +1 +6 +2 + +7 +4 +4 +3 +3 + +7 +3 +2 +0 + +5 +3 +4 +4 +0 + +5 +5 +5 +1 +3 + +2 +2 +4 +9 +1 + +3 +0 +1 +0 +2 + +4 +6 +1 +9 +7 + +4 +8 +7 +6 +6 + +8 +1 +2 +4 +8 + +8 +4 +5 +1 +4 + +6 +0 +2 +7 +3 + +1 +6 +7 +6 +4 + +6 +0 +0 +3 +4 + +5 +6 +6 +9 +9 + +6 +3 +2 +2 +6 + +9 +2 +3 +3 +7 + +4 +4 +4 +1 +7 + +7 +1 +5 +4 +9 + +3 +0 +8 +0 +5 + +2 +5 +7 +9 +2 + +8 +5 +4 +9 +2 + +1 +1 +4 +1 +3 + +5 +8 +5 +7 +5 + +4 +2 +0 +2 +9 + +9 +0 +6 +8 +5 + +9 +2 +7 +4 +9 + +6 +9 +8 +2 +0 + +1 +0 +0 +5 +3 + +8 +4 +6 +1 +4 + +4 +5 +5 +5 +9 + +3 +4 +5 +8 + +4 +0 +7 +3 +8 + +1 +2 +4 +8 +5 + +3 +7 +9 +5 +2 + +5 +6 +3 +8 +6 + +7 +8 +8 +5 +6 + +3 +9 +0 +4 +4 + +7 +9 +8 +1 +4 + +6 +7 +7 +8 +4 + +7 +9 +9 +8 + +8 +9 +1 +9 +4 + +3 +0 +4 +4 + +8 +8 +1 +9 +3 + +7 +6 +5 +2 +3 + +2 +7 +4 +5 +6 + +9 +3 +5 +9 +9 + +2 +0 +1 +7 +2 + +9 +9 +5 +6 +4 + +7 +0 +6 +1 +2 + +6 +4 +0 +3 + +6 +7 +1 +8 +9 + +5 +6 +9 +7 +5 + +6 +6 +8 +7 +1 + +7 +6 +6 +6 +8 + +9 +2 +1 +7 +1 + +4 +8 +0 +6 +4 + +4 +5 +4 +2 +9 + +3 +9 +4 +5 +2 + +1 +1 +9 +3 +6 + +2 +6 +4 +4 +9 + +2 +5 +1 +4 +7 + +8 +3 +5 +6 + +9 +6 +0 +3 +3 + +3 +4 +2 +9 +6 + +1 +5 +8 +5 +2 + +2 +2 +2 +8 +3 + +8 +5 +8 +0 +4 + +1 +6 +0 +0 +9 + +9 +6 +2 +6 + +1 +6 +6 +7 +8 + +6 +2 +8 +1 +4 + +4 +9 +6 +4 +3 + +5 +9 +9 +4 +3 + +5 +2 +4 +8 +6 + +7 +2 +0 +8 +0 + +3 +7 +9 +4 +9 + +3 +5 +0 +2 +8 + +2 +7 +0 +9 +4 + +7 +8 +5 +6 +6 + +7 +7 +2 +4 + +3 +9 +8 +2 +5 + +6 +7 +5 +1 +6 + +2 +3 +6 +9 +8 + +3 +9 +3 +0 +1 + +3 +0 +9 +0 +7 + +6 +1 +9 +1 +5 + +8 +2 +9 +5 +5 + +1 +9 +9 +6 +8 + +9 +9 +6 +5 +0 + +6 +2 +6 +3 +8 + +5 +6 +6 +9 +7 + +1 +4 +6 +7 +9 + +5 +4 +5 +2 +1 + +5 +7 +9 +0 +9 + +1 +6 +3 +3 +1 + +4 +7 +3 +7 +3 + +3 +2 +6 +0 +8 + +3 +2 +1 +3 +6 + +4 +6 +2 +9 +9 + +4 +7 +5 +4 +8 + +4 +5 +9 +8 + +8 +2 +7 +5 +6 + +5 +8 +4 +2 +8 + +2 +1 +2 +8 +2 + +7 +3 +4 +7 +8 + +2 +6 +6 +9 + +3 +1 +5 +9 +8 + +2 +6 +8 +4 +6 + +9 +0 +2 +1 +0 + +8 +2 +2 +9 +2 + +4 +9 +8 +3 +4 + +7 +5 +1 +3 +5 + +8 +7 +5 +5 +9 + +6 +5 +7 +6 +3 + +7 +9 +4 +2 +7 + +7 +9 +3 +5 +0 + +9 +5 +6 +1 +6 + +7 +0 +4 +8 +7 + +9 +0 +8 +0 +9 + +2 +0 +4 +0 +3 + +9 +2 +8 +8 +3 + +2 +4 +7 +6 +6 + +9 +1 +6 +8 +8 + +4 +3 +0 +2 +8 + +3 +8 +9 +3 +9 + +7 +5 +1 +5 +4 + +9 +1 +0 +6 +6 + +1 +9 +5 +5 +5 + +5 +6 +8 +1 +7 + +3 +9 +0 +7 +8 + +8 +1 +5 +9 + +8 +3 +2 +2 +2 + +5 +5 +9 +3 +1 + +9 +5 +7 +9 +0 + +1 +7 +8 +9 + +1 +7 +2 +2 +3 + +6 +7 +3 +3 +9 + +7 +6 +9 +3 +1 + +3 +9 +6 +6 +4 + +1 +4 +1 +7 +4 + +5 +2 +0 +6 +1 + +1 +2 +7 +8 +4 + +9 +8 +6 +8 +2 + +6 +2 +3 +8 +5 + +5 +0 +8 +2 +0 + +6 +8 +6 +4 +6 + +9 +4 +9 +1 +2 + +8 +5 +0 +5 +3 + +3 +4 +3 +5 +1 + +6 +3 +5 +8 + +9 +9 +2 +7 +4 + +5 +0 +4 +1 +0 + +4 +0 +7 +3 +1 + +6 +1 +4 +2 +2 + +1 +1 +3 +9 + +4 +0 +7 +6 +0 + +2 +3 +5 +8 + +9 +8 +3 +5 +8 + +6 +8 +7 +3 +0 + +9 +2 +6 +2 +0 + +4 +4 +3 +1 +8 + +8 +6 +7 +0 +3 + +5 +5 +8 +6 +4 + +8 +2 +6 +8 +5 + +4 +1 +2 +1 +9 + +6 +3 +3 +1 +7 + +2 +3 +0 +3 +4 + +1 +0 +9 +9 +9 + +9 +4 +1 +7 +5 + +6 +6 +0 +2 +6 + +1 +8 +5 +1 + +4 +3 +1 +4 +2 + +9 +3 +5 +5 + +7 +6 +0 +0 +5 + +7 +7 +9 +0 + +2 +7 +5 +5 +6 + +3 +4 +0 +6 +9 + +9 +3 +3 +7 +7 + +1 +3 +2 +7 +5 + +7 +7 +3 +4 +0 + +1 +5 +7 +7 +7 + +1 +8 +4 +0 +2 + +3 +6 +8 +2 +3 + +5 +1 +8 +4 +2 + +3 +5 +2 +6 +5 + +3 +9 +1 +4 + +6 +4 +3 +0 +2 + +4 +7 +2 +4 +0 + +8 +2 +9 +2 +1 + +4 +1 +4 +0 +7 + +9 +1 +6 +8 +3 + +8 +9 +8 +0 + +4 +7 +9 +8 +7 + +2 +3 +6 +1 +4 + +4 +9 +3 +3 +6 + +9 +8 +7 +1 +6 + +9 +1 +7 +0 +5 + +8 +4 +5 +9 + +8 +1 +4 +8 +9 + +3 +5 +3 +7 +2 + +9 +2 +2 +5 +9 + +7 +2 +3 +2 +0 + +2 +9 +0 +5 +8 + +9 +1 +9 +4 +8 + +1 +2 +3 +5 +4 + +2 +7 +0 +4 +8 + +6 +4 +5 +7 +9 + +6 +3 +3 +8 +5 + +6 +6 +5 +6 +1 + +3 +5 +9 +8 +5 + +3 +1 +6 +8 +5 + +9 +7 +8 +7 + +8 +8 +4 +5 +4 + +6 +8 +5 +0 +2 + +9 +7 +4 +2 +5 + +1 +7 +6 +4 +9 + +1 +8 +4 +4 +2 + +5 +2 +0 +5 +8 + +3 +0 +8 +7 +0 + +4 +1 +1 +0 +8 + +7 +2 +6 +9 +7 + +2 +9 +2 +3 +1 + +4 +0 +8 +4 +8 + +3 +3 +1 +8 +9 + +3 +4 +9 +6 +9 + +7 +4 +5 +4 +6 + +2 +8 +4 +4 +2 + +1 +3 +6 +0 +3 + +6 +8 +8 +3 +2 + +8 +5 +8 +2 +4 + +1 +4 +7 +3 + +2 +7 +1 +8 +4 + +5 +8 +1 +4 +6 + +4 +6 +8 +7 +4 + +6 +4 +8 +5 + +8 +4 +4 +7 + +1 +2 +4 +0 +1 + +9 +9 +2 +9 +3 + +5 +6 +9 +7 +9 + +8 +4 +2 +7 +0 + +4 +2 +5 +7 +5 + +6 +9 +0 +7 +3 + +8 +8 +2 +3 +4 + +1 +9 +8 +8 +3 + +4 +6 +6 +4 +3 + +5 +9 +7 +4 +6 + +9 +3 +7 +3 +2 + +2 +7 +0 +1 + +6 +2 +5 +8 +3 + +8 +4 +8 +9 + +8 +2 +4 +9 +3 + +3 +5 +6 +7 +3 + +8 +0 +3 +8 +4 + +7 +6 +7 +1 +8 + +8 +6 +6 +0 +4 + +5 +4 +1 +3 +4 + +1 +1 +6 +3 + +5 +3 +4 +2 +8 + +5 +0 +3 +0 +4 + +3 +5 +4 +4 +0 + +3 +3 +5 +5 +2 + +8 +7 +6 +3 +5 + +5 +7 +6 +3 +9 + +7 +5 +0 +7 +3 + +7 +0 +3 +5 +8 + +9 +3 +3 +8 +0 + +9 +6 +5 +7 +4 + +4 +7 +0 +5 +3 + +2 +8 +4 +0 +4 + +4 +0 +8 +0 +6 + +2 +4 +4 +9 +3 + +1 +7 +3 +0 +5 + +6 +4 +1 +5 + +7 +1 +9 +9 +2 + +4 +3 +5 +4 +8 + +8 +5 +1 +9 + +9 +3 +6 +6 +2 + +4 +0 +4 +2 +8 + +5 +1 +1 +0 +5 + +2 +9 +9 +9 +2 + +5 +4 +3 +5 +7 + +6 +9 +1 +2 +0 + +3 +9 +4 +5 +6 + +7 +4 +3 +0 +9 + +2 +3 +1 +7 +3 + +1 +7 +6 +1 +9 + +7 +4 +6 +1 +3 + +7 +9 +8 +5 +6 + +3 +6 +3 +3 +7 + +5 +6 +9 +2 +8 + +9 +0 +9 +5 + +1 +6 +8 +5 +6 + +3 +4 +0 +0 +4 + +8 +3 +6 +1 + +5 +0 +7 +8 +8 + +1 +2 +0 +9 +8 + +7 +1 +6 +4 +6 + +8 +2 +8 +6 +4 + +2 +7 +0 +7 +5 + +5 +8 +5 +5 +1 + +2 +5 +7 +5 +6 + +6 +9 +6 +7 +3 + +5 +1 +0 +0 +5 + +7 +9 +5 +9 +9 + +8 +2 +2 +7 +3 + +1 +8 +9 +5 +0 + +6 +0 +0 +5 +4 + +6 +4 +2 +0 +3 + +6 +4 +7 +2 +5 + +6 +2 +1 +4 +8 + +6 +7 +3 +4 + +8 +0 +1 +4 +5 + +8 +3 +2 +3 +7 + +2 +8 +5 +5 +6 + +4 +4 +0 +2 +6 + +9 +1 +4 +4 +8 + +6 +2 +7 +9 +3 + +2 +8 +2 +8 +1 + +2 +1 +5 +4 +1 + +8 +6 +8 +2 +1 + +8 +6 +5 +9 +7 + +7 +8 +6 +4 +7 + +8 +1 +2 +6 +9 + +2 +2 +9 +7 +5 + +4 +8 +3 +6 +4 + +2 +6 +2 +5 +2 + +6 +2 +8 +3 +2 + +7 +4 +7 +5 +8 + +1 +8 +5 +5 +6 + +4 +4 +2 +9 + +4 +0 +0 +6 +7 + +9 +5 +4 +7 +6 + +8 +7 +3 +1 +7 + +3 +6 +9 +6 +8 + +1 +3 +0 +1 + +7 +9 +3 +8 +2 + +7 +4 +2 +7 +3 + +5 +7 +5 +3 +5 + +7 +0 +6 +6 +2 + +2 +5 +6 +6 +0 + +4 +7 +6 +8 + +9 +6 +9 +5 +7 + +1 +1 +4 +8 +4 + +7 +6 +8 +3 +5 + +7 +3 +2 +4 +2 + +3 +1 +1 +9 +4 + +8 +2 +8 +2 +4 + +3 +6 +8 +9 +6 + +4 +7 +6 +4 +5 + +2 +5 +5 +3 +5 + +2 +5 +9 +7 +4 + +8 +3 +8 +3 +9 + +5 +5 +8 +3 +1 + +3 +4 +9 +2 +6 + +7 +4 + +2 +8 +9 +3 +0 + +5 +5 +0 +5 +8 + +6 +6 +4 +7 +0 + +1 +0 +1 +1 +9 + +5 +9 +0 +4 +5 + +1 +2 +0 +8 +5 + +7 +6 +2 +1 + +5 +7 +9 + +5 +5 +4 +4 + +1 +2 +3 +7 +8 + +7 +3 +9 +2 + +3 +8 +0 +2 +9 + +3 +6 +0 +6 +0 + +4 +2 +9 +6 +9 + +2 +0 +1 +4 +5 + +4 +7 +6 +0 +4 + +8 +6 +9 +9 +2 + +2 +8 +2 +1 +1 + +5 +8 +8 +1 +0 + +8 +2 +9 +9 +2 + +4 +1 +4 +7 +5 + +6 +8 +1 +6 +0 + +5 +9 +5 +5 +7 + +5 +9 +8 +8 +4 + +5 +5 +2 +6 +8 + +7 +0 +3 +6 +8 + +5 +8 +5 +2 +5 + +5 +6 +0 +2 +6 + +5 +3 +4 +9 +4 + +1 +4 +1 +0 +1 + +4 +3 +0 +5 +9 + +1 +5 +4 +7 +9 + +3 +7 +9 +8 +5 + +9 +2 +4 +4 +4 + +6 +9 +5 +4 +3 + +2 +8 +3 +6 +7 + +2 +3 +8 +6 +8 + +6 +0 +7 +2 +8 + +2 +3 +9 +7 +4 + +1 +0 +9 +3 +7 + +6 +7 +6 +8 +4 + +4 +1 +5 +1 +9 + +6 +0 +7 +1 +4 + +1 +1 +2 +9 +1 + +3 +1 +9 +0 +1 + +6 +8 +9 +8 + +2 +8 +4 +9 +1 + +2 +1 +8 +3 +9 + +7 +5 +3 +4 +2 + +2 +6 +9 +4 +9 + +9 +7 +9 +5 +5 + +4 +3 +4 +0 +6 + +9 +5 +4 +6 +3 + +1 +5 +8 +8 +5 + +8 +8 +6 +7 +2 + +4 +2 +2 +0 +4 + +1 +7 +0 +7 +8 + +5 +6 +6 +5 +8 + +4 +1 +0 +3 +7 + +5 +6 +4 +1 +4 + +8 +2 +4 +6 +0 + +5 +5 +8 +4 +4 + +9 +6 +6 +9 +4 + +6 +4 +0 +8 +8 + +9 +9 +4 +0 +7 + +6 +6 +1 +2 +0 + +7 +1 +8 +2 +3 + +3 +7 +4 +1 +8 + +6 +2 +4 +6 +6 + +4 +9 +1 +4 +9 + +4 +6 +6 + +6 +7 +2 +1 +0 + +9 +0 +3 +2 +1 + +1 +3 +8 +6 +3 + +8 +5 +3 +8 +8 + +6 +3 +6 +6 +7 + +2 +2 +4 +6 +3 + +7 +6 +2 +4 +6 + +2 +9 +6 + +9 +9 +5 +8 +5 + +5 +3 +6 +0 +2 + +6 +3 +6 +8 +9 + +8 +6 +9 +7 +5 + +9 +4 +6 +9 +4 + +8 +1 +5 +9 +2 + +1 +6 +4 +0 +2 + +5 +1 +4 +9 +3 + +5 +3 +9 +6 +0 + +5 +0 +6 +3 + +8 +5 +5 +5 +7 + +6 +9 +4 +7 +0 + +1 +7 +4 +9 +9 + +3 +7 +5 +6 + +2 +1 +6 +8 +1 + +1 +8 +3 +8 +0 + +3 +6 +2 +8 +0 + +7 +7 +2 +2 +5 + +1 +8 +4 +1 + +9 +5 +6 +8 +0 + +5 +3 +1 +0 +0 + +8 +0 +4 +2 +5 + +2 +4 +5 +9 +9 + +4 +2 +6 +1 +0 + +9 +8 +8 +4 + +6 +9 +8 +5 +7 + +5 +7 +9 +1 +9 + +5 +8 +4 +6 +5 + +7 +2 +2 +5 +2 + +3 +9 +0 +2 +7 + +8 +3 +7 +8 +3 + +6 +8 +0 +6 + +7 +4 +8 +6 +9 + +1 +7 +7 +2 +7 + +1 +4 +4 +3 +3 + +1 +3 +1 +9 +7 + +7 +9 +0 +7 +4 + +6 +7 +5 +7 +4 + +1 +3 +2 +4 +6 + +7 +8 +9 +8 +8 + +9 +7 +4 +5 +1 + +7 +2 +4 +1 +2 + +5 +4 +5 +4 +8 + +3 +5 +0 +6 +7 + +5 +7 +0 +0 +4 + +8 +5 +4 +4 +9 + +6 +1 +3 +4 +8 + +3 +9 +3 +6 +1 + +8 +1 +3 +4 +8 + +2 +2 +4 +5 +6 + +3 +8 +5 +0 +9 + +7 +5 +8 +3 +2 + +4 +1 +1 +2 +9 + +7 +5 +6 +9 +7 + +4 +5 +2 +0 +5 + +6 +0 +2 +6 +1 + +2 +2 +9 +8 +5 + +6 +0 +8 +3 +8 + +3 +6 +1 +9 +1 + +3 +4 +6 +6 +5 + +5 +5 +2 +5 +2 + +3 +9 +1 +5 +9 + +9 +1 +2 +7 +7 + +4 +0 +4 +4 +3 + +2 +7 +6 +7 +5 + +8 +5 +5 +8 +7 + +5 +0 +0 +3 + +6 +6 +7 +4 + +4 +1 +1 +3 +1 + +7 +2 +6 +0 +7 + +1 +1 +8 +3 +4 + +5 +1 +5 +4 +2 + +9 +9 +7 +1 + +6 +0 +5 +9 +0 + +3 +0 +7 +9 +5 + +6 +4 +4 +4 +3 + +5 +6 +9 +4 +4 + +3 +4 +7 +6 + +6 +4 +6 +8 +7 + +2 +0 +5 +1 +7 + +7 +4 +3 +3 + +4 +0 +3 +4 +2 + +8 +9 +3 +0 +9 + +1 +8 +8 +8 +1 + +1 +2 +1 +3 +1 + +7 +6 +3 +5 +4 + +5 +7 +0 +2 +5 + +1 +2 +3 +8 +7 + +3 +7 +4 +5 +2 + +6 +6 +1 +7 +2 + +5 +5 +0 +4 + +3 +9 +8 +3 +2 + +4 +5 +3 +6 +9 + +7 +8 +4 +5 +1 + +4 +5 +5 +2 +5 + +9 +4 +2 +0 +1 + +4 +7 +1 +4 + +5 +4 +7 +1 +5 + +5 +2 +8 +4 +2 + +6 +5 +2 +6 +7 + +3 +6 +8 +5 +4 + +7 +6 +6 +5 +9 + +8 +8 +8 +1 +5 + +6 +1 +3 +2 +9 + +5 +9 +2 +6 +0 + +4 +3 +8 +9 +3 + +7 +8 +1 +1 +6 + +1 +6 +3 +7 +3 + +7 +7 +5 +9 +0 + +8 +1 +5 +3 +4 + +3 +2 +5 +5 +0 + +4 +9 +4 +1 +5 + +9 +7 +5 +2 +8 + +6 +3 +0 +3 +7 + +1 +2 +1 +5 +7 + +4 +8 +4 +0 +9 + +3 +4 +5 +2 +3 + +7 +5 +4 +0 +9 + +6 +6 +6 +0 +2 + +6 +1 +8 +3 +4 + +2 +2 +1 +9 + +2 +8 +6 +2 +2 + +8 +5 +3 +6 +2 + +7 +6 +8 +2 + +4 +7 +8 +4 +3 + +6 +1 +7 +2 +1 + +6 +7 +5 +5 +8 + +6 +8 +4 +4 + +3 +8 +8 +7 +5 + +1 +4 +8 +2 +4 + +4 +7 +8 +1 +4 + +4 +4 +0 +6 + +4 +2 +4 +4 +8 + +5 +5 +3 +8 +3 + +7 +7 +8 +1 +4 + +7 +4 +5 +1 +5 + +9 +6 +4 +7 +9 + +8 +3 +5 +6 +3 + +4 +6 +5 +6 +9 + +4 +8 +2 +5 +7 + +9 +2 +6 +4 +9 + +3 +4 +4 +6 +6 + +3 +5 +1 +6 +0 + +5 +4 +8 +8 +9 + +2 +4 +6 +0 +7 + +5 +0 +1 +4 +1 + +5 +5 +0 +3 + +7 +1 +5 +3 +4 + +1 +1 +3 +5 + +4 +7 +8 +1 +6 + +4 +4 +8 +6 +5 + +7 +7 +4 +3 +1 + +5 +3 +3 +8 +5 + +6 +5 +3 +0 +6 + +3 +3 +4 +8 +5 + +5 +8 +1 +6 +8 + +6 +4 +0 +9 +7 + +8 +1 +5 +3 +6 + +1 +9 +5 +8 +4 + +6 +2 +8 +8 +2 + +5 +3 +4 +7 +7 + +3 +1 +1 +2 +1 + +1 +1 +8 +4 + +1 +1 +1 +3 +9 + +4 +6 +2 +5 +2 + +1 +9 +7 +0 +6 + +5 +3 +8 +2 +3 + +9 +7 +0 +6 +1 + +2 +6 +3 +7 +8 + +6 +6 +9 +6 +1 + +3 +2 +5 +1 +4 + +1 +9 +9 +3 +0 + +1 +4 +0 +5 +5 + +9 +5 +0 +9 +8 + +1 +1 +4 +7 +8 + +7 +6 +7 +8 +1 + +5 +0 +2 +5 +6 + +8 +0 +7 +2 +8 + +5 +0 +9 +6 +1 + +6 +7 +5 +4 +5 + +3 +1 +9 +2 +3 + +8 +0 +0 +7 +5 + +5 +1 +7 +0 + +1 +2 +4 +4 + +8 +3 +0 +3 +5 + +1 +5 +6 +2 + +3 +5 +6 +8 +9 + +8 +2 +2 +1 +6 + +6 +8 +7 +3 +2 + +9 +4 +0 +7 +0 + +4 +3 +2 +9 +4 + +8 +9 +5 +4 +3 + +9 +1 +9 +3 +2 + +1 +8 +1 +7 +2 + +7 +5 +6 +3 +1 + +6 +6 +5 +0 +8 + +2 +9 +9 +9 +6 + +1 +0 +8 +6 +9 + +4 +5 +9 +9 + +3 +7 +0 +7 +4 + +9 +2 +1 +5 +6 + +9 +0 +8 +3 +8 + +6 +6 +5 +5 +4 + +1 +2 + +1 +7 +3 +5 +3 + +1 +9 +1 +1 +0 + +9 +4 +2 +3 +3 + +9 +4 +9 +6 +1 + +1 +6 +2 +9 +0 + +2 +7 +8 +5 +2 + +1 +1 +6 +6 +8 + +1 +0 +3 +5 + +4 +1 +7 +1 +3 + +4 +1 +6 +4 +9 + +7 +5 +7 +6 +1 + +3 +0 +8 +7 +9 + +5 +9 +7 +4 +5 + +4 +3 +6 +1 +4 + +8 +8 +8 +1 +6 + +8 +5 +6 +3 +1 + +2 +0 +0 +1 +4 + +8 +5 +5 +4 +6 + +5 +2 +6 +7 + +1 +7 +3 +2 +1 + +2 +1 +5 +6 +0 + +2 +1 +9 +9 +7 + +9 +6 +5 +3 +3 + +6 +6 +2 +8 +5 + +9 +3 +0 +9 +1 + +4 +2 +2 +3 +3 + +3 +0 +7 +2 +2 + +1 +1 +1 +7 +7 + +1 +8 +9 +0 +7 + +6 +5 +1 +6 +9 + +5 +9 +3 +9 +1 + +3 +6 +7 +9 +0 + +5 +4 +9 +5 +9 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog6/blog6Tag.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog6/blog6Tag.txt new file mode 100644 index 000000000..e8f792e30 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog6/blog6Tag.txt @@ -0,0 +1,526 @@ +5 +6 +2 +6 +9 + +6 +6 +2 +2 +1 + +8 +1 +6 +1 + +9 +5 +3 +8 +3 + +6 +6 +5 +5 +3 + +6 +5 +4 +3 +7 + +1 +8 +7 +9 +7 + +9 +0 +6 +5 +9 + +4 +5 +1 +8 +1 + +4 +2 +6 +4 +9 + +1 +7 +7 +2 +9 + +4 +0 +3 +6 +1 + +9 +3 +2 +3 + +9 +2 +4 +1 +9 + +9 +0 +8 +2 +3 + +2 +6 +8 +1 +3 + +9 +9 +5 +7 +1 + +5 +6 +3 +1 +1 + +8 +2 +4 +8 +3 + +6 +1 +8 +3 +7 + +2 +8 +1 +9 + +9 +4 +7 +9 + +2 +4 +1 +0 +9 + +8 +4 +3 +4 +7 + +4 +4 +1 +3 +1 + +8 +4 +8 +6 +9 + +5 +0 +7 +2 +3 + +2 +0 +2 +4 +9 + +8 +9 +6 +7 +1 + +9 +4 +9 +0 +7 + +7 +8 +0 +0 +7 + +4 +4 +4 +1 +7 + +7 +1 +5 +4 +9 + +6 +7 +1 +8 +9 + +2 +6 +4 +4 +9 + +2 +5 +1 +4 +7 + +2 +2 +2 +8 +3 + +3 +9 +3 +0 +1 + +5 +4 +5 +2 +1 + +8 +7 +5 +5 +9 + +7 +9 +4 +2 +7 + +7 +0 +4 +8 +7 + +5 +5 +9 +3 +1 + +1 +7 +8 +9 + +6 +7 +3 +3 +9 + +3 +4 +3 +5 +1 + +6 +3 +3 +1 +7 + +9 +3 +3 +7 +7 + +6 +4 +5 +7 +9 + +9 +7 +8 +7 + +2 +9 +2 +3 +1 + +8 +4 +4 +7 + +1 +2 +4 +0 +1 + +6 +9 +0 +7 +3 + +4 +6 +6 +4 +3 + +8 +2 +4 +9 +3 + +1 +1 +6 +3 + +2 +3 +1 +7 +3 + +8 +7 +3 +1 +7 + +1 +3 +0 +1 + +7 +6 +2 +1 + +2 +8 +2 +1 +1 + +5 +9 +5 +5 +7 + +1 +0 +9 +3 +7 + +4 +1 +5 +1 +9 + +2 +1 +8 +3 +9 + +6 +3 +6 +6 +7 + +6 +3 +6 +8 +9 + +6 +9 +8 +5 +7 + +7 +4 +8 +6 +9 + +3 +6 +1 +9 +1 + +5 +0 +0 +3 + +4 +1 +1 +3 +1 + +7 +4 +3 +3 + +9 +4 +2 +0 +1 + +6 +5 +2 +6 +7 + +1 +2 +1 +5 +7 + +4 +8 +4 +0 +9 + +4 +7 +8 +4 +3 + +9 +6 +4 +7 +9 + +8 +3 +5 +6 +3 + +5 +5 +0 +3 + +7 +7 +4 +3 +1 + +3 +1 +1 +2 +1 + +7 +6 +7 +8 +1 + +9 +4 +9 +6 +1 + +1 +7 +3 +2 +1 + +2 +1 +9 +9 +7 + +1 +1 +1 +7 +7 + +5 +4 +9 +5 +9 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog7/blog7.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog7/blog7.txt new file mode 100644 index 000000000..89f09faa0 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog7/blog7.txt @@ -0,0 +1 @@ +71733 53807 9366 1176 38830 43820 58265 81205 21547 2691 12590 92380 30474 46923 91388 66398 59856 58682 20355 24670 9694 2641 87277 48062 2629 95098 23892 52412 54602 63476 16969 53542 79678 53711 25376 66252 41678 53499 80077 97507 86610 82824 81696 71885 10376 36823 43110 51030 15090 75747 33720 30620 95951 29081 94673 98692 86656 42424 70914 487 99622 45670 73098 55419 20603 8425 33646 98045 86516 34400 29387 24030 90645 14682 97914 44411 16486 70793 39088 82928 49747 37562 45408 70598 93813 76794 42970 63142 26249 50905 55747 76819 49910 6236 31255 8822 27785 41766 81577 3027 29111 82957 80682 7408 79923 4928 20741 6293 80686 20779 28446 47839 24863 56030 69815 34784 82909 2847 90235 49248 10439 79390 61983 92925 57053 16884 38706 69796 44338 48562 76699 11542 92281 23414 53671 1773 55537 57351 40884 52901 85363 82144 48477 134 23468 79461 14244 83428 65257 27797 75330 58228 91696 97103 97737 74761 28408 88778 49093 47005 76457 25519 45496 36725 53559 96036 99834 78445 9915 17085 6793 14097 81772 16751 3809 76543 61552 16285 99813 82792 85200 79262 76875 17489 21230 48884 58938 12507 16975 23986 79681 76750 30712 81012 43244 69782 31086 98409 57555 33223 3243 32863 39858 480 72295 70036 4669 71875 58299 74635 55156 2112 87305 47762 92996 38513 23112 68916 54979 25553 95436 62726 68402 62063 1806 48055 78120 94907 55783 24790 97526 43499 41747 62778 5092 51392 70881 433 26458 39499 21998 96287 32491 87132 39129 16383 34342 18960 61223 57369 52882 86301 76325 30371 20179 70446 92494 35476 1568 3506 19990 98664 95040 87891 53407 35761 11784 5674 11214 89846 57623 12909 38836 64756 58116 48447 41797 58314 64307 98660 56335 18088 28182 47645 17142 69578 70416 68361 36812 18149 3482 48384 51291 3544 78715 95297 97863 24674 75588 94096 62047 76541 87963 45577 65244 74988 76984 59712 73904 48193 49478 71347 23121 98078 73001 66305 15951 66511 6922 12256 89740 82731 1804 62885 249 57219 18244 77315 25048 17450 60036 41501 56848 39744 55710 44920 32610 26113 92459 10479 96642 68669 82224 29430 80526 37023 54346 31793 22644 84180 47265 81225 1592 74650 23704 19651 56223 11311 4855 43304 66925 19588 46713 98405 85131 5980 29698 71444 37327 37448 76479 67354 90881 26845 1791 45034 92207 15493 44381 15450 349 81283 14616 66424 72725 32833 70894 18624 61608 28917 67288 42583 25961 62688 66946 86742 9470 19782 21820 94038 66796 10205 42604 59388 38100 50465 27822 32397 65993 48606 69042 16132 55002 63138 62 74829 38967 60671 20560 47657 31078 50578 25256 70937 63048 6389 59345 34464 78276 98400 79531 11793 69114 56944 15486 72818 75356 408 50453 76881 46431 44674 17308 26146 26507 41788 36284 65572 67298 29375 98564 16783 57881 49202 33735 65732 21648 71092 12310 48503 79828 31333 17293 53764 77471 84032 4736 15298 62234 39722 58117 13931 48334 27963 86916 1542 9678 61802 94692 63179 76848 52942 73573 1142 95150 15400 59613 28839 7938 69339 4167 3045 17079 3359 90083 37388 39241 7450 21624 48802 13344 63373 70420 74902 20436 11025 10306 81068 91514 34241 4491 56742 52143 63453 46266 67597 5308 7410 19008 94081 22607 3046 92512 41480 89271 17549 16474 64230 38486 87257 41710 82343 70988 84235 26779 85163 76461 55698 57243 28297 16848 65659 19738 51492 32841 37287 5824 54278 59661 71700 63626 61853 14436 42565 70640 59868 9371 35100 79387 27713 34953 28846 28361 35487 61361 66332 87586 89524 26043 62107 64463 70244 58006 65583 69978 31128 86486 4968 70439 84657 63143 60604 96006 64817 7100 63618 44380 38379 30841 62813 58971 86238 28746 81261 76664 63411 76094 25535 73829 2373 51525 89249 42256 40063 46076 69886 45642 62944 73422 36525 31588 49277 745 69412 73247 95548 18596 64448 95479 18308 90094 89075 79377 34568 5886 37794 40745 18799 73076 3512 64323 54310 59129 46453 46023 27876 63500 77308 73801 62970 73189 83173 53530 86628 23383 77937 91426 59761 62585 85337 34100 97018 94695 92224 41977 75130 51231 22465 63666 90833 97716 9104 78357 27359 61009 17109 55348 51428 59076 39197 96914 46294 76139 45523 95924 16272 75900 57957 72451 31953 95794 14410 87546 9751 61752 94454 99765 11074 23487 58992 95024 92069 40385 1325 12917 85720 64487 578 41417 3548 68995 15405 99524 63170 4904 43276 96157 1632 72864 19392 87518 75658 86058 37057 82756 28412 11299 31257 85153 49055 63276 1269 66330 35287 23667 11823 66317 13880 80896 51906 47361 37610 77818 69633 10164 31946 71022 24327 31349 2194 71442 55546 84565 34259 66677 10602 16611 44742 76591 26635 59824 30259 78666 55571 45193 74805 30432 68434 76465 19003 32357 13163 95917 77306 35696 2979 48721 64262 60609 25488 97194 57872 56495 32807 77637 1584 29831 57781 5602 41094 32776 3079 73166 1566 63935 10862 58470 84598 51043 86965 55658 75513 49285 28920 67062 79435 81997 36511 27378 59435 93411 29441 12190 4699 20979 29693 72538 84966 51077 40510 89179 34735 78032 91703 60955 16469 32427 781 16364 72840 57103 18925 85217 5167 62004 45066 66578 67842 79662 1668 51571 37223 18179 81326 34281 71242 66203 20317 40422 18003 32322 97171 87170 70996 35300 35467 21365 99352 75799 26266 2349 44327 62197 36078 90393 47342 11932 46732 36128 2715 95462 20014 75664 92233 24363 89381 18716 60125 57451 90786 33088 23566 71664 80610 86008 65681 55501 56841 74851 91675 3705 29320 14965 48811 9790 86849 55418 44251 62333 48223 22359 34185 47783 49456 93032 71645 88275 9937 62816 87282 49748 8312 86253 2674 16289 49821 76906 52002 873 39226 60106 20480 98722 48016 75135 75575 32437 43520 30768 44938 69928 38192 85822 79366 6745 16516 63403 21027 61435 96402 83555 85113 13834 46606 93943 21158 1966 11403 48949 60131 49377 1575 43374 84810 67737 54013 18909 8364 8570 31035 3036 55440 12159 46230 33035 32858 61838 95858 13817 92411 67537 80998 43857 97575 82698 78360 22426 63763 79114 90021 8533 50492 16785 47370 33324 72604 33093 627 68347 20724 87426 51555 81357 28987 33301 41000 66319 84852 19716 64190 17749 645 40206 88963 85867 3085 87168 5046 70409 88988 \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog7/blog7Out.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog7/blog7Out.txt new file mode 100644 index 000000000..c110ac36b --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog7/blog7Out.txt @@ -0,0 +1,5882 @@ +7 +1 +7 +3 +3 + +5 +3 +8 +0 +7 + +9 +3 +6 +6 + +1 +1 +7 +6 + +3 +8 +8 +3 +0 + +4 +3 +8 +2 +0 + +5 +8 +2 +6 +5 + +8 +1 +2 +0 +5 + +2 +1 +5 +4 +7 + +2 +6 +9 +1 + +1 +2 +5 +9 +0 + +9 +2 +3 +8 +0 + +3 +0 +4 +7 +4 + +4 +6 +9 +2 +3 + +9 +1 +3 +8 +8 + +6 +6 +3 +9 +8 + +5 +9 +8 +5 +6 + +5 +8 +6 +8 +2 + +2 +0 +3 +5 +5 + +2 +4 +6 +7 +0 + +9 +6 +9 +4 + +2 +6 +4 +1 + +8 +7 +2 +7 +7 + +4 +8 +0 +6 +2 + +2 +6 +2 +9 + +9 +5 +0 +9 +8 + +2 +3 +8 +9 +2 + +5 +2 +4 +1 +2 + +5 +4 +6 +0 +2 + +6 +3 +4 +7 +6 + +1 +6 +9 +6 +9 + +5 +3 +5 +4 +2 + +7 +9 +6 +7 +8 + +5 +3 +7 +1 +1 + +2 +5 +3 +7 +6 + +6 +6 +2 +5 +2 + +4 +1 +6 +7 +8 + +5 +3 +4 +9 +9 + +8 +0 +0 +7 +7 + +9 +7 +5 +0 +7 + +8 +6 +6 +1 +0 + +8 +2 +8 +2 +4 + +8 +1 +6 +9 +6 + +7 +1 +8 +8 +5 + +1 +0 +3 +7 +6 + +3 +6 +8 +2 +3 + +4 +3 +1 +1 +0 + +5 +1 +0 +3 +0 + +1 +5 +0 +9 +0 + +7 +5 +7 +4 +7 + +3 +3 +7 +2 +0 + +3 +0 +6 +2 +0 + +9 +5 +9 +5 +1 + +2 +9 +0 +8 +1 + +9 +4 +6 +7 +3 + +9 +8 +6 +9 +2 + +8 +6 +6 +5 +6 + +4 +2 +4 +2 +4 + +7 +0 +9 +1 +4 + +4 +8 +7 + +9 +9 +6 +2 +2 + +4 +5 +6 +7 +0 + +7 +3 +0 +9 +8 + +5 +5 +4 +1 +9 + +2 +0 +6 +0 +3 + +8 +4 +2 +5 + +3 +3 +6 +4 +6 + +9 +8 +0 +4 +5 + +8 +6 +5 +1 +6 + +3 +4 +4 +0 +0 + +2 +9 +3 +8 +7 + +2 +4 +0 +3 +0 + +9 +0 +6 +4 +5 + +1 +4 +6 +8 +2 + +9 +7 +9 +1 +4 + +4 +4 +4 +1 +1 + +1 +6 +4 +8 +6 + +7 +0 +7 +9 +3 + +3 +9 +0 +8 +8 + +8 +2 +9 +2 +8 + +4 +9 +7 +4 +7 + +3 +7 +5 +6 +2 + +4 +5 +4 +0 +8 + +7 +0 +5 +9 +8 + +9 +3 +8 +1 +3 + +7 +6 +7 +9 +4 + +4 +2 +9 +7 +0 + +6 +3 +1 +4 +2 + +2 +6 +2 +4 +9 + +5 +0 +9 +0 +5 + +5 +5 +7 +4 +7 + +7 +6 +8 +1 +9 + +4 +9 +9 +1 +0 + +6 +2 +3 +6 + +3 +1 +2 +5 +5 + +8 +8 +2 +2 + +2 +7 +7 +8 +5 + +4 +1 +7 +6 +6 + +8 +1 +5 +7 +7 + +3 +0 +2 +7 + +2 +9 +1 +1 +1 + +8 +2 +9 +5 +7 + +8 +0 +6 +8 +2 + +7 +4 +0 +8 + +7 +9 +9 +2 +3 + +4 +9 +2 +8 + +2 +0 +7 +4 +1 + +6 +2 +9 +3 + +8 +0 +6 +8 +6 + +2 +0 +7 +7 +9 + +2 +8 +4 +4 +6 + +4 +7 +8 +3 +9 + +2 +4 +8 +6 +3 + +5 +6 +0 +3 +0 + +6 +9 +8 +1 +5 + +3 +4 +7 +8 +4 + +8 +2 +9 +0 +9 + +2 +8 +4 +7 + +9 +0 +2 +3 +5 + +4 +9 +2 +4 +8 + +1 +0 +4 +3 +9 + +7 +9 +3 +9 +0 + +6 +1 +9 +8 +3 + +9 +2 +9 +2 +5 + +5 +7 +0 +5 +3 + +1 +6 +8 +8 +4 + +3 +8 +7 +0 +6 + +6 +9 +7 +9 +6 + +4 +4 +3 +3 +8 + +4 +8 +5 +6 +2 + +7 +6 +6 +9 +9 + +1 +1 +5 +4 +2 + +9 +2 +2 +8 +1 + +2 +3 +4 +1 +4 + +5 +3 +6 +7 +1 + +1 +7 +7 +3 + +5 +5 +5 +3 +7 + +5 +7 +3 +5 +1 + +4 +0 +8 +8 +4 + +5 +2 +9 +0 +1 + +8 +5 +3 +6 +3 + +8 +2 +1 +4 +4 + +4 +8 +4 +7 +7 + +1 +3 +4 + +2 +3 +4 +6 +8 + +7 +9 +4 +6 +1 + +1 +4 +2 +4 +4 + +8 +3 +4 +2 +8 + +6 +5 +2 +5 +7 + +2 +7 +7 +9 +7 + +7 +5 +3 +3 +0 + +5 +8 +2 +2 +8 + +9 +1 +6 +9 +6 + +9 +7 +1 +0 +3 + +9 +7 +7 +3 +7 + +7 +4 +7 +6 +1 + +2 +8 +4 +0 +8 + +8 +8 +7 +7 +8 + +4 +9 +0 +9 +3 + +4 +7 +0 +0 +5 + +7 +6 +4 +5 +7 + +2 +5 +5 +1 +9 + +4 +5 +4 +9 +6 + +3 +6 +7 +2 +5 + +5 +3 +5 +5 +9 + +9 +6 +0 +3 +6 + +9 +9 +8 +3 +4 + +7 +8 +4 +4 +5 + +9 +9 +1 +5 + +1 +7 +0 +8 +5 + +6 +7 +9 +3 + +1 +4 +0 +9 +7 + +8 +1 +7 +7 +2 + +1 +6 +7 +5 +1 + +3 +8 +0 +9 + +7 +6 +5 +4 +3 + +6 +1 +5 +5 +2 + +1 +6 +2 +8 +5 + +9 +9 +8 +1 +3 + +8 +2 +7 +9 +2 + +8 +5 +2 +0 +0 + +7 +9 +2 +6 +2 + +7 +6 +8 +7 +5 + +1 +7 +4 +8 +9 + +2 +1 +2 +3 +0 + +4 +8 +8 +8 +4 + +5 +8 +9 +3 +8 + +1 +2 +5 +0 +7 + +1 +6 +9 +7 +5 + +2 +3 +9 +8 +6 + +7 +9 +6 +8 +1 + +7 +6 +7 +5 +0 + +3 +0 +7 +1 +2 + +8 +1 +0 +1 +2 + +4 +3 +2 +4 +4 + +6 +9 +7 +8 +2 + +3 +1 +0 +8 +6 + +9 +8 +4 +0 +9 + +5 +7 +5 +5 +5 + +3 +3 +2 +2 +3 + +3 +2 +4 +3 + +3 +2 +8 +6 +3 + +3 +9 +8 +5 +8 + +4 +8 +0 + +7 +2 +2 +9 +5 + +7 +0 +0 +3 +6 + +4 +6 +6 +9 + +7 +1 +8 +7 +5 + +5 +8 +2 +9 +9 + +7 +4 +6 +3 +5 + +5 +5 +1 +5 +6 + +2 +1 +1 +2 + +8 +7 +3 +0 +5 + +4 +7 +7 +6 +2 + +9 +2 +9 +9 +6 + +3 +8 +5 +1 +3 + +2 +3 +1 +1 +2 + +6 +8 +9 +1 +6 + +5 +4 +9 +7 +9 + +2 +5 +5 +5 +3 + +9 +5 +4 +3 +6 + +6 +2 +7 +2 +6 + +6 +8 +4 +0 +2 + +6 +2 +0 +6 +3 + +1 +8 +0 +6 + +4 +8 +0 +5 +5 + +7 +8 +1 +2 +0 + +9 +4 +9 +0 +7 + +5 +5 +7 +8 +3 + +2 +4 +7 +9 +0 + +9 +7 +5 +2 +6 + +4 +3 +4 +9 +9 + +4 +1 +7 +4 +7 + +6 +2 +7 +7 +8 + +5 +0 +9 +2 + +5 +1 +3 +9 +2 + +7 +0 +8 +8 +1 + +4 +3 +3 + +2 +6 +4 +5 +8 + +3 +9 +4 +9 +9 + +2 +1 +9 +9 +8 + +9 +6 +2 +8 +7 + +3 +2 +4 +9 +1 + +8 +7 +1 +3 +2 + +3 +9 +1 +2 +9 + +1 +6 +3 +8 +3 + +3 +4 +3 +4 +2 + +1 +8 +9 +6 +0 + +6 +1 +2 +2 +3 + +5 +7 +3 +6 +9 + +5 +2 +8 +8 +2 + +8 +6 +3 +0 +1 + +7 +6 +3 +2 +5 + +3 +0 +3 +7 +1 + +2 +0 +1 +7 +9 + +7 +0 +4 +4 +6 + +9 +2 +4 +9 +4 + +3 +5 +4 +7 +6 + +1 +5 +6 +8 + +3 +5 +0 +6 + +1 +9 +9 +9 +0 + +9 +8 +6 +6 +4 + +9 +5 +0 +4 +0 + +8 +7 +8 +9 +1 + +5 +3 +4 +0 +7 + +3 +5 +7 +6 +1 + +1 +1 +7 +8 +4 + +5 +6 +7 +4 + +1 +1 +2 +1 +4 + +8 +9 +8 +4 +6 + +5 +7 +6 +2 +3 + +1 +2 +9 +0 +9 + +3 +8 +8 +3 +6 + +6 +4 +7 +5 +6 + +5 +8 +1 +1 +6 + +4 +8 +4 +4 +7 + +4 +1 +7 +9 +7 + +5 +8 +3 +1 +4 + +6 +4 +3 +0 +7 + +9 +8 +6 +6 +0 + +5 +6 +3 +3 +5 + +1 +8 +0 +8 +8 + +2 +8 +1 +8 +2 + +4 +7 +6 +4 +5 + +1 +7 +1 +4 +2 + +6 +9 +5 +7 +8 + +7 +0 +4 +1 +6 + +6 +8 +3 +6 +1 + +3 +6 +8 +1 +2 + +1 +8 +1 +4 +9 + +3 +4 +8 +2 + +4 +8 +3 +8 +4 + +5 +1 +2 +9 +1 + +3 +5 +4 +4 + +7 +8 +7 +1 +5 + +9 +5 +2 +9 +7 + +9 +7 +8 +6 +3 + +2 +4 +6 +7 +4 + +7 +5 +5 +8 +8 + +9 +4 +0 +9 +6 + +6 +2 +0 +4 +7 + +7 +6 +5 +4 +1 + +8 +7 +9 +6 +3 + +4 +5 +5 +7 +7 + +6 +5 +2 +4 +4 + +7 +4 +9 +8 +8 + +7 +6 +9 +8 +4 + +5 +9 +7 +1 +2 + +7 +3 +9 +0 +4 + +4 +8 +1 +9 +3 + +4 +9 +4 +7 +8 + +7 +1 +3 +4 +7 + +2 +3 +1 +2 +1 + +9 +8 +0 +7 +8 + +7 +3 +0 +0 +1 + +6 +6 +3 +0 +5 + +1 +5 +9 +5 +1 + +6 +6 +5 +1 +1 + +6 +9 +2 +2 + +1 +2 +2 +5 +6 + +8 +9 +7 +4 +0 + +8 +2 +7 +3 +1 + +1 +8 +0 +4 + +6 +2 +8 +8 +5 + +2 +4 +9 + +5 +7 +2 +1 +9 + +1 +8 +2 +4 +4 + +7 +7 +3 +1 +5 + +2 +5 +0 +4 +8 + +1 +7 +4 +5 +0 + +6 +0 +0 +3 +6 + +4 +1 +5 +0 +1 + +5 +6 +8 +4 +8 + +3 +9 +7 +4 +4 + +5 +5 +7 +1 +0 + +4 +4 +9 +2 +0 + +3 +2 +6 +1 +0 + +2 +6 +1 +1 +3 + +9 +2 +4 +5 +9 + +1 +0 +4 +7 +9 + +9 +6 +6 +4 +2 + +6 +8 +6 +6 +9 + +8 +2 +2 +2 +4 + +2 +9 +4 +3 +0 + +8 +0 +5 +2 +6 + +3 +7 +0 +2 +3 + +5 +4 +3 +4 +6 + +3 +1 +7 +9 +3 + +2 +2 +6 +4 +4 + +8 +4 +1 +8 +0 + +4 +7 +2 +6 +5 + +8 +1 +2 +2 +5 + +1 +5 +9 +2 + +7 +4 +6 +5 +0 + +2 +3 +7 +0 +4 + +1 +9 +6 +5 +1 + +5 +6 +2 +2 +3 + +1 +1 +3 +1 +1 + +4 +8 +5 +5 + +4 +3 +3 +0 +4 + +6 +6 +9 +2 +5 + +1 +9 +5 +8 +8 + +4 +6 +7 +1 +3 + +9 +8 +4 +0 +5 + +8 +5 +1 +3 +1 + +5 +9 +8 +0 + +2 +9 +6 +9 +8 + +7 +1 +4 +4 +4 + +3 +7 +3 +2 +7 + +3 +7 +4 +4 +8 + +7 +6 +4 +7 +9 + +6 +7 +3 +5 +4 + +9 +0 +8 +8 +1 + +2 +6 +8 +4 +5 + +1 +7 +9 +1 + +4 +5 +0 +3 +4 + +9 +2 +2 +0 +7 + +1 +5 +4 +9 +3 + +4 +4 +3 +8 +1 + +1 +5 +4 +5 +0 + +3 +4 +9 + +8 +1 +2 +8 +3 + +1 +4 +6 +1 +6 + +6 +6 +4 +2 +4 + +7 +2 +7 +2 +5 + +3 +2 +8 +3 +3 + +7 +0 +8 +9 +4 + +1 +8 +6 +2 +4 + +6 +1 +6 +0 +8 + +2 +8 +9 +1 +7 + +6 +7 +2 +8 +8 + +4 +2 +5 +8 +3 + +2 +5 +9 +6 +1 + +6 +2 +6 +8 +8 + +6 +6 +9 +4 +6 + +8 +6 +7 +4 +2 + +9 +4 +7 +0 + +1 +9 +7 +8 +2 + +2 +1 +8 +2 +0 + +9 +4 +0 +3 +8 + +6 +6 +7 +9 +6 + +1 +0 +2 +0 +5 + +4 +2 +6 +0 +4 + +5 +9 +3 +8 +8 + +3 +8 +1 +0 +0 + +5 +0 +4 +6 +5 + +2 +7 +8 +2 +2 + +3 +2 +3 +9 +7 + +6 +5 +9 +9 +3 + +4 +8 +6 +0 +6 + +6 +9 +0 +4 +2 + +1 +6 +1 +3 +2 + +5 +5 +0 +0 +2 + +6 +3 +1 +3 +8 + +6 +2 + +7 +4 +8 +2 +9 + +3 +8 +9 +6 +7 + +6 +0 +6 +7 +1 + +2 +0 +5 +6 +0 + +4 +7 +6 +5 +7 + +3 +1 +0 +7 +8 + +5 +0 +5 +7 +8 + +2 +5 +2 +5 +6 + +7 +0 +9 +3 +7 + +6 +3 +0 +4 +8 + +6 +3 +8 +9 + +5 +9 +3 +4 +5 + +3 +4 +4 +6 +4 + +7 +8 +2 +7 +6 + +9 +8 +4 +0 +0 + +7 +9 +5 +3 +1 + +1 +1 +7 +9 +3 + +6 +9 +1 +1 +4 + +5 +6 +9 +4 +4 + +1 +5 +4 +8 +6 + +7 +2 +8 +1 +8 + +7 +5 +3 +5 +6 + +4 +0 +8 + +5 +0 +4 +5 +3 + +7 +6 +8 +8 +1 + +4 +6 +4 +3 +1 + +4 +4 +6 +7 +4 + +1 +7 +3 +0 +8 + +2 +6 +1 +4 +6 + +2 +6 +5 +0 +7 + +4 +1 +7 +8 +8 + +3 +6 +2 +8 +4 + +6 +5 +5 +7 +2 + +6 +7 +2 +9 +8 + +2 +9 +3 +7 +5 + +9 +8 +5 +6 +4 + +1 +6 +7 +8 +3 + +5 +7 +8 +8 +1 + +4 +9 +2 +0 +2 + +3 +3 +7 +3 +5 + +6 +5 +7 +3 +2 + +2 +1 +6 +4 +8 + +7 +1 +0 +9 +2 + +1 +2 +3 +1 +0 + +4 +8 +5 +0 +3 + +7 +9 +8 +2 +8 + +3 +1 +3 +3 +3 + +1 +7 +2 +9 +3 + +5 +3 +7 +6 +4 + +7 +7 +4 +7 +1 + +8 +4 +0 +3 +2 + +4 +7 +3 +6 + +1 +5 +2 +9 +8 + +6 +2 +2 +3 +4 + +3 +9 +7 +2 +2 + +5 +8 +1 +1 +7 + +1 +3 +9 +3 +1 + +4 +8 +3 +3 +4 + +2 +7 +9 +6 +3 + +8 +6 +9 +1 +6 + +1 +5 +4 +2 + +9 +6 +7 +8 + +6 +1 +8 +0 +2 + +9 +4 +6 +9 +2 + +6 +3 +1 +7 +9 + +7 +6 +8 +4 +8 + +5 +2 +9 +4 +2 + +7 +3 +5 +7 +3 + +1 +1 +4 +2 + +9 +5 +1 +5 +0 + +1 +5 +4 +0 +0 + +5 +9 +6 +1 +3 + +2 +8 +8 +3 +9 + +7 +9 +3 +8 + +6 +9 +3 +3 +9 + +4 +1 +6 +7 + +3 +0 +4 +5 + +1 +7 +0 +7 +9 + +3 +3 +5 +9 + +9 +0 +0 +8 +3 + +3 +7 +3 +8 +8 + +3 +9 +2 +4 +1 + +7 +4 +5 +0 + +2 +1 +6 +2 +4 + +4 +8 +8 +0 +2 + +1 +3 +3 +4 +4 + +6 +3 +3 +7 +3 + +7 +0 +4 +2 +0 + +7 +4 +9 +0 +2 + +2 +0 +4 +3 +6 + +1 +1 +0 +2 +5 + +1 +0 +3 +0 +6 + +8 +1 +0 +6 +8 + +9 +1 +5 +1 +4 + +3 +4 +2 +4 +1 + +4 +4 +9 +1 + +5 +6 +7 +4 +2 + +5 +2 +1 +4 +3 + +6 +3 +4 +5 +3 + +4 +6 +2 +6 +6 + +6 +7 +5 +9 +7 + +5 +3 +0 +8 + +7 +4 +1 +0 + +1 +9 +0 +0 +8 + +9 +4 +0 +8 +1 + +2 +2 +6 +0 +7 + +3 +0 +4 +6 + +9 +2 +5 +1 +2 + +4 +1 +4 +8 +0 + +8 +9 +2 +7 +1 + +1 +7 +5 +4 +9 + +1 +6 +4 +7 +4 + +6 +4 +2 +3 +0 + +3 +8 +4 +8 +6 + +8 +7 +2 +5 +7 + +4 +1 +7 +1 +0 + +8 +2 +3 +4 +3 + +7 +0 +9 +8 +8 + +8 +4 +2 +3 +5 + +2 +6 +7 +7 +9 + +8 +5 +1 +6 +3 + +7 +6 +4 +6 +1 + +5 +5 +6 +9 +8 + +5 +7 +2 +4 +3 + +2 +8 +2 +9 +7 + +1 +6 +8 +4 +8 + +6 +5 +6 +5 +9 + +1 +9 +7 +3 +8 + +5 +1 +4 +9 +2 + +3 +2 +8 +4 +1 + +3 +7 +2 +8 +7 + +5 +8 +2 +4 + +5 +4 +2 +7 +8 + +5 +9 +6 +6 +1 + +7 +1 +7 +0 +0 + +6 +3 +6 +2 +6 + +6 +1 +8 +5 +3 + +1 +4 +4 +3 +6 + +4 +2 +5 +6 +5 + +7 +0 +6 +4 +0 + +5 +9 +8 +6 +8 + +9 +3 +7 +1 + +3 +5 +1 +0 +0 + +7 +9 +3 +8 +7 + +2 +7 +7 +1 +3 + +3 +4 +9 +5 +3 + +2 +8 +8 +4 +6 + +2 +8 +3 +6 +1 + +3 +5 +4 +8 +7 + +6 +1 +3 +6 +1 + +6 +6 +3 +3 +2 + +8 +7 +5 +8 +6 + +8 +9 +5 +2 +4 + +2 +6 +0 +4 +3 + +6 +2 +1 +0 +7 + +6 +4 +4 +6 +3 + +7 +0 +2 +4 +4 + +5 +8 +0 +0 +6 + +6 +5 +5 +8 +3 + +6 +9 +9 +7 +8 + +3 +1 +1 +2 +8 + +8 +6 +4 +8 +6 + +4 +9 +6 +8 + +7 +0 +4 +3 +9 + +8 +4 +6 +5 +7 + +6 +3 +1 +4 +3 + +6 +0 +6 +0 +4 + +9 +6 +0 +0 +6 + +6 +4 +8 +1 +7 + +7 +1 +0 +0 + +6 +3 +6 +1 +8 + +4 +4 +3 +8 +0 + +3 +8 +3 +7 +9 + +3 +0 +8 +4 +1 + +6 +2 +8 +1 +3 + +5 +8 +9 +7 +1 + +8 +6 +2 +3 +8 + +2 +8 +7 +4 +6 + +8 +1 +2 +6 +1 + +7 +6 +6 +6 +4 + +6 +3 +4 +1 +1 + +7 +6 +0 +9 +4 + +2 +5 +5 +3 +5 + +7 +3 +8 +2 +9 + +2 +3 +7 +3 + +5 +1 +5 +2 +5 + +8 +9 +2 +4 +9 + +4 +2 +2 +5 +6 + +4 +0 +0 +6 +3 + +4 +6 +0 +7 +6 + +6 +9 +8 +8 +6 + +4 +5 +6 +4 +2 + +6 +2 +9 +4 +4 + +7 +3 +4 +2 +2 + +3 +6 +5 +2 +5 + +3 +1 +5 +8 +8 + +4 +9 +2 +7 +7 + +7 +4 +5 + +6 +9 +4 +1 +2 + +7 +3 +2 +4 +7 + +9 +5 +5 +4 +8 + +1 +8 +5 +9 +6 + +6 +4 +4 +4 +8 + +9 +5 +4 +7 +9 + +1 +8 +3 +0 +8 + +9 +0 +0 +9 +4 + +8 +9 +0 +7 +5 + +7 +9 +3 +7 +7 + +3 +4 +5 +6 +8 + +5 +8 +8 +6 + +3 +7 +7 +9 +4 + +4 +0 +7 +4 +5 + +1 +8 +7 +9 +9 + +7 +3 +0 +7 +6 + +3 +5 +1 +2 + +6 +4 +3 +2 +3 + +5 +4 +3 +1 +0 + +5 +9 +1 +2 +9 + +4 +6 +4 +5 +3 + +4 +6 +0 +2 +3 + +2 +7 +8 +7 +6 + +6 +3 +5 +0 +0 + +7 +7 +3 +0 +8 + +7 +3 +8 +0 +1 + +6 +2 +9 +7 +0 + +7 +3 +1 +8 +9 + +8 +3 +1 +7 +3 + +5 +3 +5 +3 +0 + +8 +6 +6 +2 +8 + +2 +3 +3 +8 +3 + +7 +7 +9 +3 +7 + +9 +1 +4 +2 +6 + +5 +9 +7 +6 +1 + +6 +2 +5 +8 +5 + +8 +5 +3 +3 +7 + +3 +4 +1 +0 +0 + +9 +7 +0 +1 +8 + +9 +4 +6 +9 +5 + +9 +2 +2 +2 +4 + +4 +1 +9 +7 +7 + +7 +5 +1 +3 +0 + +5 +1 +2 +3 +1 + +2 +2 +4 +6 +5 + +6 +3 +6 +6 +6 + +9 +0 +8 +3 +3 + +9 +7 +7 +1 +6 + +9 +1 +0 +4 + +7 +8 +3 +5 +7 + +2 +7 +3 +5 +9 + +6 +1 +0 +0 +9 + +1 +7 +1 +0 +9 + +5 +5 +3 +4 +8 + +5 +1 +4 +2 +8 + +5 +9 +0 +7 +6 + +3 +9 +1 +9 +7 + +9 +6 +9 +1 +4 + +4 +6 +2 +9 +4 + +7 +6 +1 +3 +9 + +4 +5 +5 +2 +3 + +9 +5 +9 +2 +4 + +1 +6 +2 +7 +2 + +7 +5 +9 +0 +0 + +5 +7 +9 +5 +7 + +7 +2 +4 +5 +1 + +3 +1 +9 +5 +3 + +9 +5 +7 +9 +4 + +1 +4 +4 +1 +0 + +8 +7 +5 +4 +6 + +9 +7 +5 +1 + +6 +1 +7 +5 +2 + +9 +4 +4 +5 +4 + +9 +9 +7 +6 +5 + +1 +1 +0 +7 +4 + +2 +3 +4 +8 +7 + +5 +8 +9 +9 +2 + +9 +5 +0 +2 +4 + +9 +2 +0 +6 +9 + +4 +0 +3 +8 +5 + +1 +3 +2 +5 + +1 +2 +9 +1 +7 + +8 +5 +7 +2 +0 + +6 +4 +4 +8 +7 + +5 +7 +8 + +4 +1 +4 +1 +7 + +3 +5 +4 +8 + +6 +8 +9 +9 +5 + +1 +5 +4 +0 +5 + +9 +9 +5 +2 +4 + +6 +3 +1 +7 +0 + +4 +9 +0 +4 + +4 +3 +2 +7 +6 + +9 +6 +1 +5 +7 + +1 +6 +3 +2 + +7 +2 +8 +6 +4 + +1 +9 +3 +9 +2 + +8 +7 +5 +1 +8 + +7 +5 +6 +5 +8 + +8 +6 +0 +5 +8 + +3 +7 +0 +5 +7 + +8 +2 +7 +5 +6 + +2 +8 +4 +1 +2 + +1 +1 +2 +9 +9 + +3 +1 +2 +5 +7 + +8 +5 +1 +5 +3 + +4 +9 +0 +5 +5 + +6 +3 +2 +7 +6 + +1 +2 +6 +9 + +6 +6 +3 +3 +0 + +3 +5 +2 +8 +7 + +2 +3 +6 +6 +7 + +1 +1 +8 +2 +3 + +6 +6 +3 +1 +7 + +1 +3 +8 +8 +0 + +8 +0 +8 +9 +6 + +5 +1 +9 +0 +6 + +4 +7 +3 +6 +1 + +3 +7 +6 +1 +0 + +7 +7 +8 +1 +8 + +6 +9 +6 +3 +3 + +1 +0 +1 +6 +4 + +3 +1 +9 +4 +6 + +7 +1 +0 +2 +2 + +2 +4 +3 +2 +7 + +3 +1 +3 +4 +9 + +2 +1 +9 +4 + +7 +1 +4 +4 +2 + +5 +5 +5 +4 +6 + +8 +4 +5 +6 +5 + +3 +4 +2 +5 +9 + +6 +6 +6 +7 +7 + +1 +0 +6 +0 +2 + +1 +6 +6 +1 +1 + +4 +4 +7 +4 +2 + +7 +6 +5 +9 +1 + +2 +6 +6 +3 +5 + +5 +9 +8 +2 +4 + +3 +0 +2 +5 +9 + +7 +8 +6 +6 +6 + +5 +5 +5 +7 +1 + +4 +5 +1 +9 +3 + +7 +4 +8 +0 +5 + +3 +0 +4 +3 +2 + +6 +8 +4 +3 +4 + +7 +6 +4 +6 +5 + +1 +9 +0 +0 +3 + +3 +2 +3 +5 +7 + +1 +3 +1 +6 +3 + +9 +5 +9 +1 +7 + +7 +7 +3 +0 +6 + +3 +5 +6 +9 +6 + +2 +9 +7 +9 + +4 +8 +7 +2 +1 + +6 +4 +2 +6 +2 + +6 +0 +6 +0 +9 + +2 +5 +4 +8 +8 + +9 +7 +1 +9 +4 + +5 +7 +8 +7 +2 + +5 +6 +4 +9 +5 + +3 +2 +8 +0 +7 + +7 +7 +6 +3 +7 + +1 +5 +8 +4 + +2 +9 +8 +3 +1 + +5 +7 +7 +8 +1 + +5 +6 +0 +2 + +4 +1 +0 +9 +4 + +3 +2 +7 +7 +6 + +3 +0 +7 +9 + +7 +3 +1 +6 +6 + +1 +5 +6 +6 + +6 +3 +9 +3 +5 + +1 +0 +8 +6 +2 + +5 +8 +4 +7 +0 + +8 +4 +5 +9 +8 + +5 +1 +0 +4 +3 + +8 +6 +9 +6 +5 + +5 +5 +6 +5 +8 + +7 +5 +5 +1 +3 + +4 +9 +2 +8 +5 + +2 +8 +9 +2 +0 + +6 +7 +0 +6 +2 + +7 +9 +4 +3 +5 + +8 +1 +9 +9 +7 + +3 +6 +5 +1 +1 + +2 +7 +3 +7 +8 + +5 +9 +4 +3 +5 + +9 +3 +4 +1 +1 + +2 +9 +4 +4 +1 + +1 +2 +1 +9 +0 + +4 +6 +9 +9 + +2 +0 +9 +7 +9 + +2 +9 +6 +9 +3 + +7 +2 +5 +3 +8 + +8 +4 +9 +6 +6 + +5 +1 +0 +7 +7 + +4 +0 +5 +1 +0 + +8 +9 +1 +7 +9 + +3 +4 +7 +3 +5 + +7 +8 +0 +3 +2 + +9 +1 +7 +0 +3 + +6 +0 +9 +5 +5 + +1 +6 +4 +6 +9 + +3 +2 +4 +2 +7 + +7 +8 +1 + +1 +6 +3 +6 +4 + +7 +2 +8 +4 +0 + +5 +7 +1 +0 +3 + +1 +8 +9 +2 +5 + +8 +5 +2 +1 +7 + +5 +1 +6 +7 + +6 +2 +0 +0 +4 + +4 +5 +0 +6 +6 + +6 +6 +5 +7 +8 + +6 +7 +8 +4 +2 + +7 +9 +6 +6 +2 + +1 +6 +6 +8 + +5 +1 +5 +7 +1 + +3 +7 +2 +2 +3 + +1 +8 +1 +7 +9 + +8 +1 +3 +2 +6 + +3 +4 +2 +8 +1 + +7 +1 +2 +4 +2 + +6 +6 +2 +0 +3 + +2 +0 +3 +1 +7 + +4 +0 +4 +2 +2 + +1 +8 +0 +0 +3 + +3 +2 +3 +2 +2 + +9 +7 +1 +7 +1 + +8 +7 +1 +7 +0 + +7 +0 +9 +9 +6 + +3 +5 +3 +0 +0 + +3 +5 +4 +6 +7 + +2 +1 +3 +6 +5 + +9 +9 +3 +5 +2 + +7 +5 +7 +9 +9 + +2 +6 +2 +6 +6 + +2 +3 +4 +9 + +4 +4 +3 +2 +7 + +6 +2 +1 +9 +7 + +3 +6 +0 +7 +8 + +9 +0 +3 +9 +3 + +4 +7 +3 +4 +2 + +1 +1 +9 +3 +2 + +4 +6 +7 +3 +2 + +3 +6 +1 +2 +8 + +2 +7 +1 +5 + +9 +5 +4 +6 +2 + +2 +0 +0 +1 +4 + +7 +5 +6 +6 +4 + +9 +2 +2 +3 +3 + +2 +4 +3 +6 +3 + +8 +9 +3 +8 +1 + +1 +8 +7 +1 +6 + +6 +0 +1 +2 +5 + +5 +7 +4 +5 +1 + +9 +0 +7 +8 +6 + +3 +3 +0 +8 +8 + +2 +3 +5 +6 +6 + +7 +1 +6 +6 +4 + +8 +0 +6 +1 +0 + +8 +6 +0 +0 +8 + +6 +5 +6 +8 +1 + +5 +5 +5 +0 +1 + +5 +6 +8 +4 +1 + +7 +4 +8 +5 +1 + +9 +1 +6 +7 +5 + +3 +7 +0 +5 + +2 +9 +3 +2 +0 + +1 +4 +9 +6 +5 + +4 +8 +8 +1 +1 + +9 +7 +9 +0 + +8 +6 +8 +4 +9 + +5 +5 +4 +1 +8 + +4 +4 +2 +5 +1 + +6 +2 +3 +3 +3 + +4 +8 +2 +2 +3 + +2 +2 +3 +5 +9 + +3 +4 +1 +8 +5 + +4 +7 +7 +8 +3 + +4 +9 +4 +5 +6 + +9 +3 +0 +3 +2 + +7 +1 +6 +4 +5 + +8 +8 +2 +7 +5 + +9 +9 +3 +7 + +6 +2 +8 +1 +6 + +8 +7 +2 +8 +2 + +4 +9 +7 +4 +8 + +8 +3 +1 +2 + +8 +6 +2 +5 +3 + +2 +6 +7 +4 + +1 +6 +2 +8 +9 + +4 +9 +8 +2 +1 + +7 +6 +9 +0 +6 + +5 +2 +0 +0 +2 + +8 +7 +3 + +3 +9 +2 +2 +6 + +6 +0 +1 +0 +6 + +2 +0 +4 +8 +0 + +9 +8 +7 +2 +2 + +4 +8 +0 +1 +6 + +7 +5 +1 +3 +5 + +7 +5 +5 +7 +5 + +3 +2 +4 +3 +7 + +4 +3 +5 +2 +0 + +3 +0 +7 +6 +8 + +4 +4 +9 +3 +8 + +6 +9 +9 +2 +8 + +3 +8 +1 +9 +2 + +8 +5 +8 +2 +2 + +7 +9 +3 +6 +6 + +6 +7 +4 +5 + +1 +6 +5 +1 +6 + +6 +3 +4 +0 +3 + +2 +1 +0 +2 +7 + +6 +1 +4 +3 +5 + +9 +6 +4 +0 +2 + +8 +3 +5 +5 +5 + +8 +5 +1 +1 +3 + +1 +3 +8 +3 +4 + +4 +6 +6 +0 +6 + +9 +3 +9 +4 +3 + +2 +1 +1 +5 +8 + +1 +9 +6 +6 + +1 +1 +4 +0 +3 + +4 +8 +9 +4 +9 + +6 +0 +1 +3 +1 + +4 +9 +3 +7 +7 + +1 +5 +7 +5 + +4 +3 +3 +7 +4 + +8 +4 +8 +1 +0 + +6 +7 +7 +3 +7 + +5 +4 +0 +1 +3 + +1 +8 +9 +0 +9 + +8 +3 +6 +4 + +8 +5 +7 +0 + +3 +1 +0 +3 +5 + +3 +0 +3 +6 + +5 +5 +4 +4 +0 + +1 +2 +1 +5 +9 + +4 +6 +2 +3 +0 + +3 +3 +0 +3 +5 + +3 +2 +8 +5 +8 + +6 +1 +8 +3 +8 + +9 +5 +8 +5 +8 + +1 +3 +8 +1 +7 + +9 +2 +4 +1 +1 + +6 +7 +5 +3 +7 + +8 +0 +9 +9 +8 + +4 +3 +8 +5 +7 + +9 +7 +5 +7 +5 + +8 +2 +6 +9 +8 + +7 +8 +3 +6 +0 + +2 +2 +4 +2 +6 + +6 +3 +7 +6 +3 + +7 +9 +1 +1 +4 + +9 +0 +0 +2 +1 + +8 +5 +3 +3 + +5 +0 +4 +9 +2 + +1 +6 +7 +8 +5 + +4 +7 +3 +7 +0 + +3 +3 +3 +2 +4 + +7 +2 +6 +0 +4 + +3 +3 +0 +9 +3 + +6 +2 +7 + +6 +8 +3 +4 +7 + +2 +0 +7 +2 +4 + +8 +7 +4 +2 +6 + +5 +1 +5 +5 +5 + +8 +1 +3 +5 +7 + +2 +8 +9 +8 +7 + +3 +3 +3 +0 +1 + +4 +1 +0 +0 +0 + +6 +6 +3 +1 +9 + +8 +4 +8 +5 +2 + +1 +9 +7 +1 +6 + +6 +4 +1 +9 +0 + +1 +7 +7 +4 +9 + +6 +4 +5 + +4 +0 +2 +0 +6 + +8 +8 +9 +6 +3 + +8 +5 +8 +6 +7 + +3 +0 +8 +5 + +8 +7 +1 +6 +8 + +5 +0 +4 +6 + +7 +0 +4 +0 +9 + +8 +8 +9 +8 +8 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog7/blog7Tag.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog7/blog7Tag.txt new file mode 100644 index 000000000..304788c82 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog7/blog7Tag.txt @@ -0,0 +1,509 @@ +8 +7 +2 +7 +7 + +8 +0 +0 +7 +7 + +4 +8 +7 + +2 +9 +3 +8 +7 + +7 +0 +7 +9 +3 + +4 +9 +7 +4 +7 + +2 +6 +2 +4 +9 + +7 +6 +8 +1 +9 + +5 +2 +9 +0 +1 + +8 +5 +3 +6 +3 + +6 +5 +2 +5 +7 + +9 +7 +1 +0 +3 + +7 +4 +7 +6 +1 + +6 +7 +9 +3 + +7 +6 +5 +4 +3 + +1 +7 +4 +8 +9 + +3 +3 +2 +2 +3 + +5 +4 +9 +7 +9 + +9 +4 +9 +0 +7 + +4 +3 +4 +9 +9 + +4 +3 +3 + +3 +9 +4 +9 +9 + +3 +2 +4 +9 +1 + +6 +1 +2 +2 +3 + +5 +3 +4 +0 +7 + +1 +8 +1 +4 +9 + +6 +2 +0 +4 +7 + +7 +6 +5 +4 +1 + +4 +8 +1 +9 +3 + +7 +1 +3 +4 +7 + +2 +6 +1 +1 +3 + +9 +2 +4 +5 +9 + +6 +8 +6 +6 +9 + +3 +1 +7 +9 +3 + +1 +1 +3 +1 +1 + +1 +5 +4 +9 +3 + +4 +4 +3 +8 +1 + +3 +4 +9 + +8 +1 +2 +8 +3 + +3 +2 +8 +3 +3 + +6 +5 +9 +9 +3 + +4 +7 +6 +5 +7 + +7 +0 +9 +3 +7 + +6 +3 +8 +9 + +7 +9 +5 +3 +1 + +5 +7 +8 +8 +1 + +3 +1 +3 +3 +3 + +1 +7 +2 +9 +3 + +7 +7 +4 +7 +1 + +1 +3 +9 +3 +1 + +6 +3 +1 +7 +9 + +3 +3 +5 +9 + +3 +9 +2 +4 +1 + +8 +7 +2 +5 +7 + +2 +8 +2 +9 +7 + +9 +3 +7 +1 + +7 +0 +4 +3 +9 + +6 +4 +8 +1 +7 + +3 +0 +8 +4 +1 + +4 +0 +0 +6 +3 + +4 +9 +2 +7 +7 + +9 +5 +4 +7 +9 + +7 +3 +1 +8 +9 + +9 +0 +8 +3 +3 + +4 +5 +5 +2 +3 + +1 +2 +9 +1 +7 + +9 +6 +1 +5 +7 + +3 +7 +0 +5 +7 + +1 +1 +2 +9 +9 + +3 +4 +2 +5 +9 + +3 +0 +2 +5 +9 + +1 +3 +1 +6 +3 + +9 +5 +9 +1 +7 + +5 +7 +7 +8 +1 + +3 +0 +7 +9 + +5 +1 +0 +4 +3 + +9 +1 +7 +0 +3 + +5 +1 +6 +7 + +3 +7 +2 +2 +3 + +9 +7 +1 +7 +1 + +9 +2 +2 +3 +3 + +8 +9 +3 +8 +1 + +5 +5 +5 +0 +1 + +5 +4 +0 +1 +3 + +6 +7 +5 +3 +7 + +3 +3 +3 +0 +1 + +1 +7 +7 +4 +9 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog8/blog8.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog8/blog8.txt new file mode 100644 index 000000000..c24f2f391 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog8/blog8.txt @@ -0,0 +1 @@ +14349 22774 18717 91025 33972 66132 22539 74 36645 88264 87391 62801 57815 44327 49099 63824 28675 72959 43668 57718 56123 51081 94819 89779 60797 68042 89163 76165 96 24550 25536 30544 98383 23866 67104 33835 91872 88321 37285 72739 6777 96002 59460 27894 34432 29979 37869 39896 31111 50247 45765 47187 82829 75425 49420 67317 18306 89376 13704 23760 37701 18077 35795 22057 3512 84827 50406 7035 49585 83624 77884 44858 3943 10941 63909 49126 72306 4416 70246 88200 50508 16474 32456 28352 80192 63979 31016 5713 92391 57095 36980 65446 52200 8509 70849 27465 84134 52848 76111 36692 49017 68986 71247 95594 71882 34398 3830 7810 42630 85289 2015 19420 65216 61847 10712 43178 17506 94199 97279 49916 9394 39489 67969 57653 22587 95630 25977 27433 75805 74338 11612 45064 39417 73147 2141 535 11560 50819 48974 6935 48446 737 97421 81671 77450 98452 1996 42349 82369 35541 17763 39751 77755 82735 84888 37423 57765 50749 16870 89338 52835 96564 56782 61076 10513 141 34513 78539 40393 53269 12323 57509 42534 92649 72169 68458 50770 73340 29846 18278 46458 14272 81020 69571 52941 6091 56912 46071 50519 7209 22270 68536 89600 29742 72696 59727 77832 14937 28446 45369 64802 84501 39900 75334 2672 29257 13407 86118 34965 18562 77495 50451 83995 72647 44376 78784 70317 47386 95265 30810 89501 70878 4716 32925 26935 55011 50029 91331 1963 31691 77927 98594 50974 33526 14559 18432 28895 82470 97949 43827 70936 74815 74918 85939 36896 92346 62701 17552 95600 44439 35636 4650 44353 14753 72656 60690 81179 8428 99736 52215 75400 26041 53443 82027 25641 83848 42538 95197 66396 49221 3101 90136 29329 26554 92094 13237 29917 25292 64419 36396 47033 11552 36196 53268 64046 42632 79439 57072 15069 71358 91687 37066 14257 15341 86354 24379 76311 10974 60554 172 51914 78188 82175 51343 67615 7476 4102 27088 68988 81747 98264 47768 46829 7328 13215 91711 92272 9631 67957 52521 91965 37891 55251 55206 60235 12976 23496 63509 30267 59299 25634 39100 51325 48965 50502 29270 12251 61777 43650 6193 44355 75489 45929 14163 48651 99623 35464 19904 29418 59574 12686 24047 88518 7280 16168 47160 4151 94389 90748 65584 98806 55561 25040 73905 31963 29678 15121 49811 15902 96012 52102 60404 71209 60512 80124 15280 14174 33858 57807 98259 4202 61385 15286 60577 32296 45190 15022 90622 56684 62620 21858 40522 24115 80477 89696 87393 16844 45530 91140 90831 22855 67263 7137 77336 62881 56449 16851 21292 4347 88743 92846 59062 62141 4492 90516 4098 81234 54450 70266 75772 47691 65254 77493 365 48442 68887 92311 13991 47747 82030 46372 77140 65868 13671 8807 71732 27963 10423 57214 90823 50670 23010 3517 48609 79381 39989 97207 5792 59928 13997 96498 35061 7086 3184 12792 96017 50655 78264 643 39701 19277 4215 69976 77492 66380 62193 13287 3148 24354 93054 5489 93549 99171 88525 18919 36315 95641 31334 54538 8441 77286 65427 69335 77507 70082 98627 71007 84861 40076 41644 27818 84738 97862 80578 30441 98525 42370 84186 17857 50843 58160 71386 2630 92245 50942 19767 18610 5689 74797 93661 75516 808 9067 43108 78385 98569 74026 29863 87487 55504 78710 79202 33317 42849 54668 80029 13499 40280 47718 84846 96078 42646 56941 98423 35313 33880 61331 3665 87265 77902 44755 20561 14152 6119 9691 5548 16954 22964 21344 26152 75315 48529 12876 7609 48028 60025 45774 84631 32418 35011 20004 94947 63660 7110 59678 399 36053 33349 25827 12800 53046 73784 97518 61771 90554 43410 30564 27613 12148 56206 80371 12250 88429 54708 20844 28909 59832 96886 32247 28399 60610 40270 49391 96805 62313 94079 25749 34111 4570 40255 50980 14568 47249 83452 40012 52768 12296 50324 43510 2389 71117 65268 47922 16698 79521 24038 4957 83954 59436 46506 67700 49110 25357 17881 25371 78591 73781 8126 66647 45109 6423 93462 82561 48841 75592 36440 9800 18194 34366 77317 66557 91855 10183 17444 610 33656 26923 40590 13861 51905 39833 95722 24691 52171 74445 65710 71875 75875 8771 91042 78322 2215 76246 72826 34536 97067 79416 82399 63836 52654 26501 27659 95723 64141 70622 57092 90067 43289 21167 48362 90853 94388 92792 39613 5253 5011 10692 82065 53533 5825 64866 8080 83325 31825 71686 1823 70166 88098 49729 67953 50563 12253 92469 3016 53760 95146 93904 72734 42364 40628 24567 37531 12737 79945 10749 20074 10091 79844 55831 30097 60460 36605 70677 29239 64931 32119 41545 82145 43498 10834 10662 55915 67369 77096 36277 69633 70568 29616 38997 94396 93101 79969 94784 47737 32611 43217 80638 76411 12691 19156 31131 42258 92541 12828 44752 38800 13153 64895 2899 12988 97758 19276 25182 68174 52509 76004 62552 99653 13289 34327 24189 57795 48243 43037 48493 35706 21084 882 38766 85569 33414 54899 86521 48114 81565 93083 25671 60734 76640 59511 20256 41127 8614 41732 83962 2594 52244 99540 64847 57873 37216 7990 28030 66684 92119 35898 77167 2805 20654 43708 23758 41611 43505 84054 73659 4261 37603 73203 10352 84262 62724 40687 64375 88398 34763 56624 68227 60552 47302 47185 15649 13561 12421 36303 56562 39256 13971 42002 73049 930 1510 44781 69206 68179 37704 88629 14824 18906 7644 4548 47606 25329 39819 94708 47244 59168 85400 51273 45328 99866 91541 80351 6348 19096 99698 43519 59537 52223 4450 43179 75331 11563 44812 47517 49062 51156 82329 49255 29534 49140 14583 45538 85514 13579 84328 36402 13863 29119 12940 70499 96214 91162 65793 93131 85900 48671 36075 70572 1259 36140 37702 68566 44887 3978 56970 27206 52543 86580 18723 85810 40811 73649 89415 25125 95664 74765 46073 85704 30625 94390 30272 19665 77468 95928 25666 77391 64769 78179 43654 72907 9137 57814 8485 97996 653 65863 61996 72311 85747 50394 64128 5082 49292 6157 30101 32415 9141 63383 57654 79578 22577 70459 70715 44942 43784 24393 54968 41570 33412 40126 95585 42948 89877 37582 56310 42746 23753 48888 92109 75883 59998 863 14091 70285 86561 67468 63325 40888 91796 83548 49788 50734 12537 9150 29642 47071 18274 3447 28466 26611 4118 74706 19054 77566 8888 81792 84824 55336 95249 93851 \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog8/blog8Out.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog8/blog8Out.txt new file mode 100644 index 000000000..b98453981 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog8/blog8Out.txt @@ -0,0 +1,5879 @@ +1 +4 +3 +4 +9 + +2 +2 +7 +7 +4 + +1 +8 +7 +1 +7 + +9 +1 +0 +2 +5 + +3 +3 +9 +7 +2 + +6 +6 +1 +3 +2 + +2 +2 +5 +3 +9 + +7 +4 + +3 +6 +6 +4 +5 + +8 +8 +2 +6 +4 + +8 +7 +3 +9 +1 + +6 +2 +8 +0 +1 + +5 +7 +8 +1 +5 + +4 +4 +3 +2 +7 + +4 +9 +0 +9 +9 + +6 +3 +8 +2 +4 + +2 +8 +6 +7 +5 + +7 +2 +9 +5 +9 + +4 +3 +6 +6 +8 + +5 +7 +7 +1 +8 + +5 +6 +1 +2 +3 + +5 +1 +0 +8 +1 + +9 +4 +8 +1 +9 + +8 +9 +7 +7 +9 + +6 +0 +7 +9 +7 + +6 +8 +0 +4 +2 + +8 +9 +1 +6 +3 + +7 +6 +1 +6 +5 + +9 +6 + +2 +4 +5 +5 +0 + +2 +5 +5 +3 +6 + +3 +0 +5 +4 +4 + +9 +8 +3 +8 +3 + +2 +3 +8 +6 +6 + +6 +7 +1 +0 +4 + +3 +3 +8 +3 +5 + +9 +1 +8 +7 +2 + +8 +8 +3 +2 +1 + +3 +7 +2 +8 +5 + +7 +2 +7 +3 +9 + +6 +7 +7 +7 + +9 +6 +0 +0 +2 + +5 +9 +4 +6 +0 + +2 +7 +8 +9 +4 + +3 +4 +4 +3 +2 + +2 +9 +9 +7 +9 + +3 +7 +8 +6 +9 + +3 +9 +8 +9 +6 + +3 +1 +1 +1 +1 + +5 +0 +2 +4 +7 + +4 +5 +7 +6 +5 + +4 +7 +1 +8 +7 + +8 +2 +8 +2 +9 + +7 +5 +4 +2 +5 + +4 +9 +4 +2 +0 + +6 +7 +3 +1 +7 + +1 +8 +3 +0 +6 + +8 +9 +3 +7 +6 + +1 +3 +7 +0 +4 + +2 +3 +7 +6 +0 + +3 +7 +7 +0 +1 + +1 +8 +0 +7 +7 + +3 +5 +7 +9 +5 + +2 +2 +0 +5 +7 + +3 +5 +1 +2 + +8 +4 +8 +2 +7 + +5 +0 +4 +0 +6 + +7 +0 +3 +5 + +4 +9 +5 +8 +5 + +8 +3 +6 +2 +4 + +7 +7 +8 +8 +4 + +4 +4 +8 +5 +8 + +3 +9 +4 +3 + +1 +0 +9 +4 +1 + +6 +3 +9 +0 +9 + +4 +9 +1 +2 +6 + +7 +2 +3 +0 +6 + +4 +4 +1 +6 + +7 +0 +2 +4 +6 + +8 +8 +2 +0 +0 + +5 +0 +5 +0 +8 + +1 +6 +4 +7 +4 + +3 +2 +4 +5 +6 + +2 +8 +3 +5 +2 + +8 +0 +1 +9 +2 + +6 +3 +9 +7 +9 + +3 +1 +0 +1 +6 + +5 +7 +1 +3 + +9 +2 +3 +9 +1 + +5 +7 +0 +9 +5 + +3 +6 +9 +8 +0 + +6 +5 +4 +4 +6 + +5 +2 +2 +0 +0 + +8 +5 +0 +9 + +7 +0 +8 +4 +9 + +2 +7 +4 +6 +5 + +8 +4 +1 +3 +4 + +5 +2 +8 +4 +8 + +7 +6 +1 +1 +1 + +3 +6 +6 +9 +2 + +4 +9 +0 +1 +7 + +6 +8 +9 +8 +6 + +7 +1 +2 +4 +7 + +9 +5 +5 +9 +4 + +7 +1 +8 +8 +2 + +3 +4 +3 +9 +8 + +3 +8 +3 +0 + +7 +8 +1 +0 + +4 +2 +6 +3 +0 + +8 +5 +2 +8 +9 + +2 +0 +1 +5 + +1 +9 +4 +2 +0 + +6 +5 +2 +1 +6 + +6 +1 +8 +4 +7 + +1 +0 +7 +1 +2 + +4 +3 +1 +7 +8 + +1 +7 +5 +0 +6 + +9 +4 +1 +9 +9 + +9 +7 +2 +7 +9 + +4 +9 +9 +1 +6 + +9 +3 +9 +4 + +3 +9 +4 +8 +9 + +6 +7 +9 +6 +9 + +5 +7 +6 +5 +3 + +2 +2 +5 +8 +7 + +9 +5 +6 +3 +0 + +2 +5 +9 +7 +7 + +2 +7 +4 +3 +3 + +7 +5 +8 +0 +5 + +7 +4 +3 +3 +8 + +1 +1 +6 +1 +2 + +4 +5 +0 +6 +4 + +3 +9 +4 +1 +7 + +7 +3 +1 +4 +7 + +2 +1 +4 +1 + +5 +3 +5 + +1 +1 +5 +6 +0 + +5 +0 +8 +1 +9 + +4 +8 +9 +7 +4 + +6 +9 +3 +5 + +4 +8 +4 +4 +6 + +7 +3 +7 + +9 +7 +4 +2 +1 + +8 +1 +6 +7 +1 + +7 +7 +4 +5 +0 + +9 +8 +4 +5 +2 + +1 +9 +9 +6 + +4 +2 +3 +4 +9 + +8 +2 +3 +6 +9 + +3 +5 +5 +4 +1 + +1 +7 +7 +6 +3 + +3 +9 +7 +5 +1 + +7 +7 +7 +5 +5 + +8 +2 +7 +3 +5 + +8 +4 +8 +8 +8 + +3 +7 +4 +2 +3 + +5 +7 +7 +6 +5 + +5 +0 +7 +4 +9 + +1 +6 +8 +7 +0 + +8 +9 +3 +3 +8 + +5 +2 +8 +3 +5 + +9 +6 +5 +6 +4 + +5 +6 +7 +8 +2 + +6 +1 +0 +7 +6 + +1 +0 +5 +1 +3 + +1 +4 +1 + +3 +4 +5 +1 +3 + +7 +8 +5 +3 +9 + +4 +0 +3 +9 +3 + +5 +3 +2 +6 +9 + +1 +2 +3 +2 +3 + +5 +7 +5 +0 +9 + +4 +2 +5 +3 +4 + +9 +2 +6 +4 +9 + +7 +2 +1 +6 +9 + +6 +8 +4 +5 +8 + +5 +0 +7 +7 +0 + +7 +3 +3 +4 +0 + +2 +9 +8 +4 +6 + +1 +8 +2 +7 +8 + +4 +6 +4 +5 +8 + +1 +4 +2 +7 +2 + +8 +1 +0 +2 +0 + +6 +9 +5 +7 +1 + +5 +2 +9 +4 +1 + +6 +0 +9 +1 + +5 +6 +9 +1 +2 + +4 +6 +0 +7 +1 + +5 +0 +5 +1 +9 + +7 +2 +0 +9 + +2 +2 +2 +7 +0 + +6 +8 +5 +3 +6 + +8 +9 +6 +0 +0 + +2 +9 +7 +4 +2 + +7 +2 +6 +9 +6 + +5 +9 +7 +2 +7 + +7 +7 +8 +3 +2 + +1 +4 +9 +3 +7 + +2 +8 +4 +4 +6 + +4 +5 +3 +6 +9 + +6 +4 +8 +0 +2 + +8 +4 +5 +0 +1 + +3 +9 +9 +0 +0 + +7 +5 +3 +3 +4 + +2 +6 +7 +2 + +2 +9 +2 +5 +7 + +1 +3 +4 +0 +7 + +8 +6 +1 +1 +8 + +3 +4 +9 +6 +5 + +1 +8 +5 +6 +2 + +7 +7 +4 +9 +5 + +5 +0 +4 +5 +1 + +8 +3 +9 +9 +5 + +7 +2 +6 +4 +7 + +4 +4 +3 +7 +6 + +7 +8 +7 +8 +4 + +7 +0 +3 +1 +7 + +4 +7 +3 +8 +6 + +9 +5 +2 +6 +5 + +3 +0 +8 +1 +0 + +8 +9 +5 +0 +1 + +7 +0 +8 +7 +8 + +4 +7 +1 +6 + +3 +2 +9 +2 +5 + +2 +6 +9 +3 +5 + +5 +5 +0 +1 +1 + +5 +0 +0 +2 +9 + +9 +1 +3 +3 +1 + +1 +9 +6 +3 + +3 +1 +6 +9 +1 + +7 +7 +9 +2 +7 + +9 +8 +5 +9 +4 + +5 +0 +9 +7 +4 + +3 +3 +5 +2 +6 + +1 +4 +5 +5 +9 + +1 +8 +4 +3 +2 + +2 +8 +8 +9 +5 + +8 +2 +4 +7 +0 + +9 +7 +9 +4 +9 + +4 +3 +8 +2 +7 + +7 +0 +9 +3 +6 + +7 +4 +8 +1 +5 + +7 +4 +9 +1 +8 + +8 +5 +9 +3 +9 + +3 +6 +8 +9 +6 + +9 +2 +3 +4 +6 + +6 +2 +7 +0 +1 + +1 +7 +5 +5 +2 + +9 +5 +6 +0 +0 + +4 +4 +4 +3 +9 + +3 +5 +6 +3 +6 + +4 +6 +5 +0 + +4 +4 +3 +5 +3 + +1 +4 +7 +5 +3 + +7 +2 +6 +5 +6 + +6 +0 +6 +9 +0 + +8 +1 +1 +7 +9 + +8 +4 +2 +8 + +9 +9 +7 +3 +6 + +5 +2 +2 +1 +5 + +7 +5 +4 +0 +0 + +2 +6 +0 +4 +1 + +5 +3 +4 +4 +3 + +8 +2 +0 +2 +7 + +2 +5 +6 +4 +1 + +8 +3 +8 +4 +8 + +4 +2 +5 +3 +8 + +9 +5 +1 +9 +7 + +6 +6 +3 +9 +6 + +4 +9 +2 +2 +1 + +3 +1 +0 +1 + +9 +0 +1 +3 +6 + +2 +9 +3 +2 +9 + +2 +6 +5 +5 +4 + +9 +2 +0 +9 +4 + +1 +3 +2 +3 +7 + +2 +9 +9 +1 +7 + +2 +5 +2 +9 +2 + +6 +4 +4 +1 +9 + +3 +6 +3 +9 +6 + +4 +7 +0 +3 +3 + +1 +1 +5 +5 +2 + +3 +6 +1 +9 +6 + +5 +3 +2 +6 +8 + +6 +4 +0 +4 +6 + +4 +2 +6 +3 +2 + +7 +9 +4 +3 +9 + +5 +7 +0 +7 +2 + +1 +5 +0 +6 +9 + +7 +1 +3 +5 +8 + +9 +1 +6 +8 +7 + +3 +7 +0 +6 +6 + +1 +4 +2 +5 +7 + +1 +5 +3 +4 +1 + +8 +6 +3 +5 +4 + +2 +4 +3 +7 +9 + +7 +6 +3 +1 +1 + +1 +0 +9 +7 +4 + +6 +0 +5 +5 +4 + +1 +7 +2 + +5 +1 +9 +1 +4 + +7 +8 +1 +8 +8 + +8 +2 +1 +7 +5 + +5 +1 +3 +4 +3 + +6 +7 +6 +1 +5 + +7 +4 +7 +6 + +4 +1 +0 +2 + +2 +7 +0 +8 +8 + +6 +8 +9 +8 +8 + +8 +1 +7 +4 +7 + +9 +8 +2 +6 +4 + +4 +7 +7 +6 +8 + +4 +6 +8 +2 +9 + +7 +3 +2 +8 + +1 +3 +2 +1 +5 + +9 +1 +7 +1 +1 + +9 +2 +2 +7 +2 + +9 +6 +3 +1 + +6 +7 +9 +5 +7 + +5 +2 +5 +2 +1 + +9 +1 +9 +6 +5 + +3 +7 +8 +9 +1 + +5 +5 +2 +5 +1 + +5 +5 +2 +0 +6 + +6 +0 +2 +3 +5 + +1 +2 +9 +7 +6 + +2 +3 +4 +9 +6 + +6 +3 +5 +0 +9 + +3 +0 +2 +6 +7 + +5 +9 +2 +9 +9 + +2 +5 +6 +3 +4 + +3 +9 +1 +0 +0 + +5 +1 +3 +2 +5 + +4 +8 +9 +6 +5 + +5 +0 +5 +0 +2 + +2 +9 +2 +7 +0 + +1 +2 +2 +5 +1 + +6 +1 +7 +7 +7 + +4 +3 +6 +5 +0 + +6 +1 +9 +3 + +4 +4 +3 +5 +5 + +7 +5 +4 +8 +9 + +4 +5 +9 +2 +9 + +1 +4 +1 +6 +3 + +4 +8 +6 +5 +1 + +9 +9 +6 +2 +3 + +3 +5 +4 +6 +4 + +1 +9 +9 +0 +4 + +2 +9 +4 +1 +8 + +5 +9 +5 +7 +4 + +1 +2 +6 +8 +6 + +2 +4 +0 +4 +7 + +8 +8 +5 +1 +8 + +7 +2 +8 +0 + +1 +6 +1 +6 +8 + +4 +7 +1 +6 +0 + +4 +1 +5 +1 + +9 +4 +3 +8 +9 + +9 +0 +7 +4 +8 + +6 +5 +5 +8 +4 + +9 +8 +8 +0 +6 + +5 +5 +5 +6 +1 + +2 +5 +0 +4 +0 + +7 +3 +9 +0 +5 + +3 +1 +9 +6 +3 + +2 +9 +6 +7 +8 + +1 +5 +1 +2 +1 + +4 +9 +8 +1 +1 + +1 +5 +9 +0 +2 + +9 +6 +0 +1 +2 + +5 +2 +1 +0 +2 + +6 +0 +4 +0 +4 + +7 +1 +2 +0 +9 + +6 +0 +5 +1 +2 + +8 +0 +1 +2 +4 + +1 +5 +2 +8 +0 + +1 +4 +1 +7 +4 + +3 +3 +8 +5 +8 + +5 +7 +8 +0 +7 + +9 +8 +2 +5 +9 + +4 +2 +0 +2 + +6 +1 +3 +8 +5 + +1 +5 +2 +8 +6 + +6 +0 +5 +7 +7 + +3 +2 +2 +9 +6 + +4 +5 +1 +9 +0 + +1 +5 +0 +2 +2 + +9 +0 +6 +2 +2 + +5 +6 +6 +8 +4 + +6 +2 +6 +2 +0 + +2 +1 +8 +5 +8 + +4 +0 +5 +2 +2 + +2 +4 +1 +1 +5 + +8 +0 +4 +7 +7 + +8 +9 +6 +9 +6 + +8 +7 +3 +9 +3 + +1 +6 +8 +4 +4 + +4 +5 +5 +3 +0 + +9 +1 +1 +4 +0 + +9 +0 +8 +3 +1 + +2 +2 +8 +5 +5 + +6 +7 +2 +6 +3 + +7 +1 +3 +7 + +7 +7 +3 +3 +6 + +6 +2 +8 +8 +1 + +5 +6 +4 +4 +9 + +1 +6 +8 +5 +1 + +2 +1 +2 +9 +2 + +4 +3 +4 +7 + +8 +8 +7 +4 +3 + +9 +2 +8 +4 +6 + +5 +9 +0 +6 +2 + +6 +2 +1 +4 +1 + +4 +4 +9 +2 + +9 +0 +5 +1 +6 + +4 +0 +9 +8 + +8 +1 +2 +3 +4 + +5 +4 +4 +5 +0 + +7 +0 +2 +6 +6 + +7 +5 +7 +7 +2 + +4 +7 +6 +9 +1 + +6 +5 +2 +5 +4 + +7 +7 +4 +9 +3 + +3 +6 +5 + +4 +8 +4 +4 +2 + +6 +8 +8 +8 +7 + +9 +2 +3 +1 +1 + +1 +3 +9 +9 +1 + +4 +7 +7 +4 +7 + +8 +2 +0 +3 +0 + +4 +6 +3 +7 +2 + +7 +7 +1 +4 +0 + +6 +5 +8 +6 +8 + +1 +3 +6 +7 +1 + +8 +8 +0 +7 + +7 +1 +7 +3 +2 + +2 +7 +9 +6 +3 + +1 +0 +4 +2 +3 + +5 +7 +2 +1 +4 + +9 +0 +8 +2 +3 + +5 +0 +6 +7 +0 + +2 +3 +0 +1 +0 + +3 +5 +1 +7 + +4 +8 +6 +0 +9 + +7 +9 +3 +8 +1 + +3 +9 +9 +8 +9 + +9 +7 +2 +0 +7 + +5 +7 +9 +2 + +5 +9 +9 +2 +8 + +1 +3 +9 +9 +7 + +9 +6 +4 +9 +8 + +3 +5 +0 +6 +1 + +7 +0 +8 +6 + +3 +1 +8 +4 + +1 +2 +7 +9 +2 + +9 +6 +0 +1 +7 + +5 +0 +6 +5 +5 + +7 +8 +2 +6 +4 + +6 +4 +3 + +3 +9 +7 +0 +1 + +1 +9 +2 +7 +7 + +4 +2 +1 +5 + +6 +9 +9 +7 +6 + +7 +7 +4 +9 +2 + +6 +6 +3 +8 +0 + +6 +2 +1 +9 +3 + +1 +3 +2 +8 +7 + +3 +1 +4 +8 + +2 +4 +3 +5 +4 + +9 +3 +0 +5 +4 + +5 +4 +8 +9 + +9 +3 +5 +4 +9 + +9 +9 +1 +7 +1 + +8 +8 +5 +2 +5 + +1 +8 +9 +1 +9 + +3 +6 +3 +1 +5 + +9 +5 +6 +4 +1 + +3 +1 +3 +3 +4 + +5 +4 +5 +3 +8 + +8 +4 +4 +1 + +7 +7 +2 +8 +6 + +6 +5 +4 +2 +7 + +6 +9 +3 +3 +5 + +7 +7 +5 +0 +7 + +7 +0 +0 +8 +2 + +9 +8 +6 +2 +7 + +7 +1 +0 +0 +7 + +8 +4 +8 +6 +1 + +4 +0 +0 +7 +6 + +4 +1 +6 +4 +4 + +2 +7 +8 +1 +8 + +8 +4 +7 +3 +8 + +9 +7 +8 +6 +2 + +8 +0 +5 +7 +8 + +3 +0 +4 +4 +1 + +9 +8 +5 +2 +5 + +4 +2 +3 +7 +0 + +8 +4 +1 +8 +6 + +1 +7 +8 +5 +7 + +5 +0 +8 +4 +3 + +5 +8 +1 +6 +0 + +7 +1 +3 +8 +6 + +2 +6 +3 +0 + +9 +2 +2 +4 +5 + +5 +0 +9 +4 +2 + +1 +9 +7 +6 +7 + +1 +8 +6 +1 +0 + +5 +6 +8 +9 + +7 +4 +7 +9 +7 + +9 +3 +6 +6 +1 + +7 +5 +5 +1 +6 + +8 +0 +8 + +9 +0 +6 +7 + +4 +3 +1 +0 +8 + +7 +8 +3 +8 +5 + +9 +8 +5 +6 +9 + +7 +4 +0 +2 +6 + +2 +9 +8 +6 +3 + +8 +7 +4 +8 +7 + +5 +5 +5 +0 +4 + +7 +8 +7 +1 +0 + +7 +9 +2 +0 +2 + +3 +3 +3 +1 +7 + +4 +2 +8 +4 +9 + +5 +4 +6 +6 +8 + +8 +0 +0 +2 +9 + +1 +3 +4 +9 +9 + +4 +0 +2 +8 +0 + +4 +7 +7 +1 +8 + +8 +4 +8 +4 +6 + +9 +6 +0 +7 +8 + +4 +2 +6 +4 +6 + +5 +6 +9 +4 +1 + +9 +8 +4 +2 +3 + +3 +5 +3 +1 +3 + +3 +3 +8 +8 +0 + +6 +1 +3 +3 +1 + +3 +6 +6 +5 + +8 +7 +2 +6 +5 + +7 +7 +9 +0 +2 + +4 +4 +7 +5 +5 + +2 +0 +5 +6 +1 + +1 +4 +1 +5 +2 + +6 +1 +1 +9 + +9 +6 +9 +1 + +5 +5 +4 +8 + +1 +6 +9 +5 +4 + +2 +2 +9 +6 +4 + +2 +1 +3 +4 +4 + +2 +6 +1 +5 +2 + +7 +5 +3 +1 +5 + +4 +8 +5 +2 +9 + +1 +2 +8 +7 +6 + +7 +6 +0 +9 + +4 +8 +0 +2 +8 + +6 +0 +0 +2 +5 + +4 +5 +7 +7 +4 + +8 +4 +6 +3 +1 + +3 +2 +4 +1 +8 + +3 +5 +0 +1 +1 + +2 +0 +0 +0 +4 + +9 +4 +9 +4 +7 + +6 +3 +6 +6 +0 + +7 +1 +1 +0 + +5 +9 +6 +7 +8 + +3 +9 +9 + +3 +6 +0 +5 +3 + +3 +3 +3 +4 +9 + +2 +5 +8 +2 +7 + +1 +2 +8 +0 +0 + +5 +3 +0 +4 +6 + +7 +3 +7 +8 +4 + +9 +7 +5 +1 +8 + +6 +1 +7 +7 +1 + +9 +0 +5 +5 +4 + +4 +3 +4 +1 +0 + +3 +0 +5 +6 +4 + +2 +7 +6 +1 +3 + +1 +2 +1 +4 +8 + +5 +6 +2 +0 +6 + +8 +0 +3 +7 +1 + +1 +2 +2 +5 +0 + +8 +8 +4 +2 +9 + +5 +4 +7 +0 +8 + +2 +0 +8 +4 +4 + +2 +8 +9 +0 +9 + +5 +9 +8 +3 +2 + +9 +6 +8 +8 +6 + +3 +2 +2 +4 +7 + +2 +8 +3 +9 +9 + +6 +0 +6 +1 +0 + +4 +0 +2 +7 +0 + +4 +9 +3 +9 +1 + +9 +6 +8 +0 +5 + +6 +2 +3 +1 +3 + +9 +4 +0 +7 +9 + +2 +5 +7 +4 +9 + +3 +4 +1 +1 +1 + +4 +5 +7 +0 + +4 +0 +2 +5 +5 + +5 +0 +9 +8 +0 + +1 +4 +5 +6 +8 + +4 +7 +2 +4 +9 + +8 +3 +4 +5 +2 + +4 +0 +0 +1 +2 + +5 +2 +7 +6 +8 + +1 +2 +2 +9 +6 + +5 +0 +3 +2 +4 + +4 +3 +5 +1 +0 + +2 +3 +8 +9 + +7 +1 +1 +1 +7 + +6 +5 +2 +6 +8 + +4 +7 +9 +2 +2 + +1 +6 +6 +9 +8 + +7 +9 +5 +2 +1 + +2 +4 +0 +3 +8 + +4 +9 +5 +7 + +8 +3 +9 +5 +4 + +5 +9 +4 +3 +6 + +4 +6 +5 +0 +6 + +6 +7 +7 +0 +0 + +4 +9 +1 +1 +0 + +2 +5 +3 +5 +7 + +1 +7 +8 +8 +1 + +2 +5 +3 +7 +1 + +7 +8 +5 +9 +1 + +7 +3 +7 +8 +1 + +8 +1 +2 +6 + +6 +6 +6 +4 +7 + +4 +5 +1 +0 +9 + +6 +4 +2 +3 + +9 +3 +4 +6 +2 + +8 +2 +5 +6 +1 + +4 +8 +8 +4 +1 + +7 +5 +5 +9 +2 + +3 +6 +4 +4 +0 + +9 +8 +0 +0 + +1 +8 +1 +9 +4 + +3 +4 +3 +6 +6 + +7 +7 +3 +1 +7 + +6 +6 +5 +5 +7 + +9 +1 +8 +5 +5 + +1 +0 +1 +8 +3 + +1 +7 +4 +4 +4 + +6 +1 +0 + +3 +3 +6 +5 +6 + +2 +6 +9 +2 +3 + +4 +0 +5 +9 +0 + +1 +3 +8 +6 +1 + +5 +1 +9 +0 +5 + +3 +9 +8 +3 +3 + +9 +5 +7 +2 +2 + +2 +4 +6 +9 +1 + +5 +2 +1 +7 +1 + +7 +4 +4 +4 +5 + +6 +5 +7 +1 +0 + +7 +1 +8 +7 +5 + +7 +5 +8 +7 +5 + +8 +7 +7 +1 + +9 +1 +0 +4 +2 + +7 +8 +3 +2 +2 + +2 +2 +1 +5 + +7 +6 +2 +4 +6 + +7 +2 +8 +2 +6 + +3 +4 +5 +3 +6 + +9 +7 +0 +6 +7 + +7 +9 +4 +1 +6 + +8 +2 +3 +9 +9 + +6 +3 +8 +3 +6 + +5 +2 +6 +5 +4 + +2 +6 +5 +0 +1 + +2 +7 +6 +5 +9 + +9 +5 +7 +2 +3 + +6 +4 +1 +4 +1 + +7 +0 +6 +2 +2 + +5 +7 +0 +9 +2 + +9 +0 +0 +6 +7 + +4 +3 +2 +8 +9 + +2 +1 +1 +6 +7 + +4 +8 +3 +6 +2 + +9 +0 +8 +5 +3 + +9 +4 +3 +8 +8 + +9 +2 +7 +9 +2 + +3 +9 +6 +1 +3 + +5 +2 +5 +3 + +5 +0 +1 +1 + +1 +0 +6 +9 +2 + +8 +2 +0 +6 +5 + +5 +3 +5 +3 +3 + +5 +8 +2 +5 + +6 +4 +8 +6 +6 + +8 +0 +8 +0 + +8 +3 +3 +2 +5 + +3 +1 +8 +2 +5 + +7 +1 +6 +8 +6 + +1 +8 +2 +3 + +7 +0 +1 +6 +6 + +8 +8 +0 +9 +8 + +4 +9 +7 +2 +9 + +6 +7 +9 +5 +3 + +5 +0 +5 +6 +3 + +1 +2 +2 +5 +3 + +9 +2 +4 +6 +9 + +3 +0 +1 +6 + +5 +3 +7 +6 +0 + +9 +5 +1 +4 +6 + +9 +3 +9 +0 +4 + +7 +2 +7 +3 +4 + +4 +2 +3 +6 +4 + +4 +0 +6 +2 +8 + +2 +4 +5 +6 +7 + +3 +7 +5 +3 +1 + +1 +2 +7 +3 +7 + +7 +9 +9 +4 +5 + +1 +0 +7 +4 +9 + +2 +0 +0 +7 +4 + +1 +0 +0 +9 +1 + +7 +9 +8 +4 +4 + +5 +5 +8 +3 +1 + +3 +0 +0 +9 +7 + +6 +0 +4 +6 +0 + +3 +6 +6 +0 +5 + +7 +0 +6 +7 +7 + +2 +9 +2 +3 +9 + +6 +4 +9 +3 +1 + +3 +2 +1 +1 +9 + +4 +1 +5 +4 +5 + +8 +2 +1 +4 +5 + +4 +3 +4 +9 +8 + +1 +0 +8 +3 +4 + +1 +0 +6 +6 +2 + +5 +5 +9 +1 +5 + +6 +7 +3 +6 +9 + +7 +7 +0 +9 +6 + +3 +6 +2 +7 +7 + +6 +9 +6 +3 +3 + +7 +0 +5 +6 +8 + +2 +9 +6 +1 +6 + +3 +8 +9 +9 +7 + +9 +4 +3 +9 +6 + +9 +3 +1 +0 +1 + +7 +9 +9 +6 +9 + +9 +4 +7 +8 +4 + +4 +7 +7 +3 +7 + +3 +2 +6 +1 +1 + +4 +3 +2 +1 +7 + +8 +0 +6 +3 +8 + +7 +6 +4 +1 +1 + +1 +2 +6 +9 +1 + +1 +9 +1 +5 +6 + +3 +1 +1 +3 +1 + +4 +2 +2 +5 +8 + +9 +2 +5 +4 +1 + +1 +2 +8 +2 +8 + +4 +4 +7 +5 +2 + +3 +8 +8 +0 +0 + +1 +3 +1 +5 +3 + +6 +4 +8 +9 +5 + +2 +8 +9 +9 + +1 +2 +9 +8 +8 + +9 +7 +7 +5 +8 + +1 +9 +2 +7 +6 + +2 +5 +1 +8 +2 + +6 +8 +1 +7 +4 + +5 +2 +5 +0 +9 + +7 +6 +0 +0 +4 + +6 +2 +5 +5 +2 + +9 +9 +6 +5 +3 + +1 +3 +2 +8 +9 + +3 +4 +3 +2 +7 + +2 +4 +1 +8 +9 + +5 +7 +7 +9 +5 + +4 +8 +2 +4 +3 + +4 +3 +0 +3 +7 + +4 +8 +4 +9 +3 + +3 +5 +7 +0 +6 + +2 +1 +0 +8 +4 + +8 +8 +2 + +3 +8 +7 +6 +6 + +8 +5 +5 +6 +9 + +3 +3 +4 +1 +4 + +5 +4 +8 +9 +9 + +8 +6 +5 +2 +1 + +4 +8 +1 +1 +4 + +8 +1 +5 +6 +5 + +9 +3 +0 +8 +3 + +2 +5 +6 +7 +1 + +6 +0 +7 +3 +4 + +7 +6 +6 +4 +0 + +5 +9 +5 +1 +1 + +2 +0 +2 +5 +6 + +4 +1 +1 +2 +7 + +8 +6 +1 +4 + +4 +1 +7 +3 +2 + +8 +3 +9 +6 +2 + +2 +5 +9 +4 + +5 +2 +2 +4 +4 + +9 +9 +5 +4 +0 + +6 +4 +8 +4 +7 + +5 +7 +8 +7 +3 + +3 +7 +2 +1 +6 + +7 +9 +9 +0 + +2 +8 +0 +3 +0 + +6 +6 +6 +8 +4 + +9 +2 +1 +1 +9 + +3 +5 +8 +9 +8 + +7 +7 +1 +6 +7 + +2 +8 +0 +5 + +2 +0 +6 +5 +4 + +4 +3 +7 +0 +8 + +2 +3 +7 +5 +8 + +4 +1 +6 +1 +1 + +4 +3 +5 +0 +5 + +8 +4 +0 +5 +4 + +7 +3 +6 +5 +9 + +4 +2 +6 +1 + +3 +7 +6 +0 +3 + +7 +3 +2 +0 +3 + +1 +0 +3 +5 +2 + +8 +4 +2 +6 +2 + +6 +2 +7 +2 +4 + +4 +0 +6 +8 +7 + +6 +4 +3 +7 +5 + +8 +8 +3 +9 +8 + +3 +4 +7 +6 +3 + +5 +6 +6 +2 +4 + +6 +8 +2 +2 +7 + +6 +0 +5 +5 +2 + +4 +7 +3 +0 +2 + +4 +7 +1 +8 +5 + +1 +5 +6 +4 +9 + +1 +3 +5 +6 +1 + +1 +2 +4 +2 +1 + +3 +6 +3 +0 +3 + +5 +6 +5 +6 +2 + +3 +9 +2 +5 +6 + +1 +3 +9 +7 +1 + +4 +2 +0 +0 +2 + +7 +3 +0 +4 +9 + +9 +3 +0 + +1 +5 +1 +0 + +4 +4 +7 +8 +1 + +6 +9 +2 +0 +6 + +6 +8 +1 +7 +9 + +3 +7 +7 +0 +4 + +8 +8 +6 +2 +9 + +1 +4 +8 +2 +4 + +1 +8 +9 +0 +6 + +7 +6 +4 +4 + +4 +5 +4 +8 + +4 +7 +6 +0 +6 + +2 +5 +3 +2 +9 + +3 +9 +8 +1 +9 + +9 +4 +7 +0 +8 + +4 +7 +2 +4 +4 + +5 +9 +1 +6 +8 + +8 +5 +4 +0 +0 + +5 +1 +2 +7 +3 + +4 +5 +3 +2 +8 + +9 +9 +8 +6 +6 + +9 +1 +5 +4 +1 + +8 +0 +3 +5 +1 + +6 +3 +4 +8 + +1 +9 +0 +9 +6 + +9 +9 +6 +9 +8 + +4 +3 +5 +1 +9 + +5 +9 +5 +3 +7 + +5 +2 +2 +2 +3 + +4 +4 +5 +0 + +4 +3 +1 +7 +9 + +7 +5 +3 +3 +1 + +1 +1 +5 +6 +3 + +4 +4 +8 +1 +2 + +4 +7 +5 +1 +7 + +4 +9 +0 +6 +2 + +5 +1 +1 +5 +6 + +8 +2 +3 +2 +9 + +4 +9 +2 +5 +5 + +2 +9 +5 +3 +4 + +4 +9 +1 +4 +0 + +1 +4 +5 +8 +3 + +4 +5 +5 +3 +8 + +8 +5 +5 +1 +4 + +1 +3 +5 +7 +9 + +8 +4 +3 +2 +8 + +3 +6 +4 +0 +2 + +1 +3 +8 +6 +3 + +2 +9 +1 +1 +9 + +1 +2 +9 +4 +0 + +7 +0 +4 +9 +9 + +9 +6 +2 +1 +4 + +9 +1 +1 +6 +2 + +6 +5 +7 +9 +3 + +9 +3 +1 +3 +1 + +8 +5 +9 +0 +0 + +4 +8 +6 +7 +1 + +3 +6 +0 +7 +5 + +7 +0 +5 +7 +2 + +1 +2 +5 +9 + +3 +6 +1 +4 +0 + +3 +7 +7 +0 +2 + +6 +8 +5 +6 +6 + +4 +4 +8 +8 +7 + +3 +9 +7 +8 + +5 +6 +9 +7 +0 + +2 +7 +2 +0 +6 + +5 +2 +5 +4 +3 + +8 +6 +5 +8 +0 + +1 +8 +7 +2 +3 + +8 +5 +8 +1 +0 + +4 +0 +8 +1 +1 + +7 +3 +6 +4 +9 + +8 +9 +4 +1 +5 + +2 +5 +1 +2 +5 + +9 +5 +6 +6 +4 + +7 +4 +7 +6 +5 + +4 +6 +0 +7 +3 + +8 +5 +7 +0 +4 + +3 +0 +6 +2 +5 + +9 +4 +3 +9 +0 + +3 +0 +2 +7 +2 + +1 +9 +6 +6 +5 + +7 +7 +4 +6 +8 + +9 +5 +9 +2 +8 + +2 +5 +6 +6 +6 + +7 +7 +3 +9 +1 + +6 +4 +7 +6 +9 + +7 +8 +1 +7 +9 + +4 +3 +6 +5 +4 + +7 +2 +9 +0 +7 + +9 +1 +3 +7 + +5 +7 +8 +1 +4 + +8 +4 +8 +5 + +9 +7 +9 +9 +6 + +6 +5 +3 + +6 +5 +8 +6 +3 + +6 +1 +9 +9 +6 + +7 +2 +3 +1 +1 + +8 +5 +7 +4 +7 + +5 +0 +3 +9 +4 + +6 +4 +1 +2 +8 + +5 +0 +8 +2 + +4 +9 +2 +9 +2 + +6 +1 +5 +7 + +3 +0 +1 +0 +1 + +3 +2 +4 +1 +5 + +9 +1 +4 +1 + +6 +3 +3 +8 +3 + +5 +7 +6 +5 +4 + +7 +9 +5 +7 +8 + +2 +2 +5 +7 +7 + +7 +0 +4 +5 +9 + +7 +0 +7 +1 +5 + +4 +4 +9 +4 +2 + +4 +3 +7 +8 +4 + +2 +4 +3 +9 +3 + +5 +4 +9 +6 +8 + +4 +1 +5 +7 +0 + +3 +3 +4 +1 +2 + +4 +0 +1 +2 +6 + +9 +5 +5 +8 +5 + +4 +2 +9 +4 +8 + +8 +9 +8 +7 +7 + +3 +7 +5 +8 +2 + +5 +6 +3 +1 +0 + +4 +2 +7 +4 +6 + +2 +3 +7 +5 +3 + +4 +8 +8 +8 +8 + +9 +2 +1 +0 +9 + +7 +5 +8 +8 +3 + +5 +9 +9 +9 +8 + +8 +6 +3 + +1 +4 +0 +9 +1 + +7 +0 +2 +8 +5 + +8 +6 +5 +6 +1 + +6 +7 +4 +6 +8 + +6 +3 +3 +2 +5 + +4 +0 +8 +8 +8 + +9 +1 +7 +9 +6 + +8 +3 +5 +4 +8 + +4 +9 +7 +8 +8 + +5 +0 +7 +3 +4 + +1 +2 +5 +3 +7 + +9 +1 +5 +0 + +2 +9 +6 +4 +2 + +4 +7 +0 +7 +1 + +1 +8 +2 +7 +4 + +3 +4 +4 +7 + +2 +8 +4 +6 +6 + +2 +6 +6 +1 +1 + +4 +1 +1 +8 + +7 +4 +7 +0 +6 + +1 +9 +0 +5 +4 + +7 +7 +5 +6 +6 + +8 +8 +8 +8 + +8 +1 +7 +9 +2 + +8 +4 +8 +2 +4 + +5 +5 +3 +3 +6 + +9 +5 +2 +4 +9 + +9 +3 +8 +5 +1 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog8/blog8Tag.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog8/blog8Tag.txt new file mode 100644 index 000000000..19c203981 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog8/blog8Tag.txt @@ -0,0 +1,662 @@ +6 +2 +8 +0 +1 + +7 +2 +9 +5 +9 + +5 +6 +1 +2 +3 + +9 +4 +8 +1 +9 + +8 +9 +7 +7 +9 + +8 +8 +3 +2 +1 + +7 +2 +7 +3 +9 + +1 +8 +0 +7 +7 + +8 +4 +8 +2 +7 + +3 +9 +4 +3 + +7 +0 +8 +4 +9 + +5 +7 +6 +5 +3 + +2 +1 +4 +1 + +8 +1 +6 +7 +1 + +4 +2 +3 +4 +9 + +3 +7 +4 +2 +3 + +1 +0 +5 +1 +3 + +3 +4 +5 +1 +3 + +7 +8 +5 +3 +9 + +5 +3 +2 +6 +9 + +1 +2 +3 +2 +3 + +7 +2 +1 +6 +9 + +6 +0 +9 +1 + +7 +2 +6 +4 +7 + +8 +9 +5 +0 +1 + +9 +1 +3 +3 +1 + +6 +2 +7 +0 +1 + +1 +4 +7 +5 +3 + +2 +6 +0 +4 +1 + +2 +9 +9 +1 +7 + +2 +4 +3 +7 +9 + +5 +1 +3 +4 +3 + +4 +6 +8 +2 +9 + +9 +1 +7 +1 +1 + +9 +6 +3 +1 + +6 +7 +9 +5 +7 + +1 +2 +2 +5 +1 + +9 +9 +6 +2 +3 + +3 +1 +9 +6 +3 + +1 +5 +1 +2 +1 + +4 +9 +8 +1 +1 + +7 +1 +2 +0 +9 + +6 +2 +1 +4 +1 + +9 +2 +3 +1 +1 + +8 +8 +0 +7 + +9 +0 +8 +2 +3 + +3 +5 +1 +7 + +3 +9 +9 +8 +9 + +1 +3 +9 +9 +7 + +9 +6 +0 +1 +7 + +6 +4 +3 + +1 +8 +9 +1 +9 + +9 +8 +6 +2 +7 + +5 +6 +8 +9 + +7 +4 +7 +9 +7 + +9 +0 +6 +7 + +2 +9 +8 +6 +3 + +3 +3 +3 +1 +7 + +1 +3 +4 +9 +9 + +5 +6 +9 +4 +1 + +6 +1 +3 +3 +1 + +8 +4 +6 +3 +1 + +3 +3 +3 +4 +9 + +2 +8 +9 +0 +9 + +4 +9 +3 +9 +1 + +9 +4 +0 +7 +9 + +2 +3 +8 +9 + +4 +9 +5 +7 + +2 +5 +3 +5 +7 + +1 +7 +8 +8 +1 + +8 +2 +5 +6 +1 + +7 +7 +3 +1 +7 + +2 +4 +6 +9 +1 + +2 +6 +5 +0 +1 + +9 +5 +7 +2 +3 + +9 +0 +0 +6 +7 + +5 +0 +1 +1 + +1 +8 +2 +3 + +1 +2 +2 +5 +3 + +1 +0 +0 +9 +1 + +3 +0 +0 +9 +7 + +3 +2 +1 +1 +9 + +6 +7 +3 +6 +9 + +3 +6 +2 +7 +7 + +4 +7 +7 +3 +7 + +3 +2 +6 +1 +1 + +3 +4 +3 +2 +7 + +4 +3 +0 +3 +7 + +9 +3 +0 +8 +3 + +9 +2 +1 +1 +9 + +7 +7 +1 +6 +7 + +4 +1 +6 +1 +1 + +4 +2 +6 +1 + +3 +4 +7 +6 +3 + +6 +8 +2 +2 +7 + +1 +5 +6 +4 +9 + +1 +2 +4 +2 +1 + +9 +1 +5 +4 +1 + +5 +2 +2 +2 +3 + +9 +3 +1 +3 +1 + +1 +2 +5 +9 + +4 +4 +8 +8 +7 + +5 +2 +5 +4 +3 + +4 +6 +0 +7 +3 + +7 +8 +1 +7 +9 + +7 +2 +9 +0 +7 + +9 +1 +3 +7 + +6 +5 +3 + +7 +0 +4 +5 +9 + +2 +3 +7 +5 +3 + +7 +5 +8 +8 +3 + +8 +6 +3 + +8 +6 +5 +6 +1 + +9 +3 +8 +5 +1 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog9/blog9.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog9/blog9.txt new file mode 100644 index 000000000..8b44e47f2 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog9/blog9.txt @@ -0,0 +1 @@ +51213 53396 18190 9985 90396 71383 67171 26271 52424 54848 66611 70747 29633 6605 43202 50584 83315 85630 26189 32437 10122 63830 53148 86586 6063 24138 33633 369 852 82479 56176 16824 52478 21377 98106 49518 98659 61496 83244 47718 43705 74799 26747 53615 62081 98305 51006 99505 19384 83679 33990 48191 56740 8574 74071 41633 74429 79116 4530 14280 13261 10723 63949 45020 7836 49207 64957 57158 70546 20672 93857 92870 2057 35884 27350 48108 11744 6981 48030 91544 6697 6799 30034 74957 20529 14276 34554 89227 9209 37925 83031 90495 72967 23643 50918 8325 69883 50132 65470 81290 93545 6467 92765 62451 72446 88460 27591 28386 23930 43673 81581 93561 13777 81501 50539 26902 12253 61053 30878 454 39321 26527 87315 61550 61914 55697 77675 44291 95712 49358 31406 42831 28382 3787 87616 58076 28088 17790 4600 7396 35651 55658 42382 3945 4655 42402 33621 4631 73581 92591 1409 28020 88187 73020 39689 38930 18793 47528 19498 85430 22479 31098 88338 35566 85935 83121 9990 66150 99475 15441 36967 32805 75772 98087 99926 70467 73572 26568 29545 18654 51995 47205 27920 61141 39913 55362 69612 60096 3883 1239 73400 15292 95156 60422 2191 23668 77067 40873 44412 81510 44876 4548 48247 64282 84315 98652 69711 31061 53859 17011 12961 10918 22296 48127 32575 32257 99513 2856 16844 39517 81171 40530 67859 21480 37571 52355 45238 49441 77865 17055 7319 71685 60068 97919 48976 12901 50534 33875 2105 93852 1172 49427 71252 3103 99645 22388 74452 91197 84189 43014 55104 71623 99544 14314 89371 93178 84871 78910 16056 8522 56301 68209 36652 28964 41600 91850 55571 1571 31577 75392 64039 73582 34103 82449 19327 61898 41074 90499 85342 51491 94138 35571 8547 64836 9515 59812 56992 77710 79449 48561 38978 38142 66212 50320 15626 75340 92001 41278 55525 37590 99966 6694 5163 66622 45631 70454 54983 88172 51816 5457 48199 34215 87637 11739 36248 43979 22498 99166 50546 81002 2163 99491 33675 918 17305 42753 68729 99219 86471 91342 51457 55580 15461 93696 3284 25949 22166 10389 78660 57734 47814 866 6101 27267 17905 75799 5653 37262 9639 54651 63449 79456 42203 39367 1000 35255 85684 47401 72442 93658 36335 43318 6761 644 6530 16698 68275 68682 69864 64708 28439 38509 82101 93593 6438 57261 77587 1604 90844 64840 7141 46558 79177 57123 74871 49978 65691 31373 74730 21104 3490 6792 99713 21648 20420 40561 10332 82623 67871 28297 71227 44865 29180 50810 48200 91798 35008 87001 16755 86020 70449 71657 35725 2275 64638 68820 67283 98469 23952 33918 1575 70410 7699 81472 44334 95408 49624 3246 21368 85803 82488 92537 82536 40406 2587 93381 70229 39325 7607 81174 64268 90991 37551 96467 29579 79696 2402 39248 45453 41966 73280 20414 30962 91278 28646 53829 81873 85254 33193 46885 32943 53040 11526 27908 17069 20708 53746 81516 94770 98529 38153 71730 25135 68743 50626 84231 93924 93411 51654 60944 342 85864 63718 68676 84873 48056 47129 69886 80451 20914 73169 11121 78011 65850 36736 25433 10988 20501 61607 60070 53865 57218 56468 90782 6265 93964 10143 17424 79222 42824 28458 32993 5914 24380 41358 63589 24581 4774 82325 85973 24541 19378 6266 55291 99227 79026 3051 69073 77180 9885 8300 53875 46124 76419 87635 31235 24494 89690 46859 4082 43414 49637 20650 95381 17252 93585 29888 68159 48084 14819 39334 84583 86849 15725 10048 43149 91668 49602 6972 53161 68384 94462 54077 48000 8903 28306 26211 2094 63882 69214 3034 82189 10501 6901 9867 71118 97832 24445 43133 98996 36929 59229 67309 60688 36908 2678 98635 81801 86942 80269 71723 82984 51894 92392 663 37774 2932 90547 72319 57232 726 79160 52455 54744 33277 14235 22261 67360 17795 62256 69552 27794 46831 37019 93068 37874 64310 27774 43540 1487 19014 20569 26214 84345 42252 32050 3899 23481 88615 90254 71518 1129 68464 97378 86531 85761 60215 22329 91870 32240 42839 76224 65158 88780 56988 25423 48881 2219 80304 81164 72586 49352 59899 67292 50592 6625 7766 1718 23236 270 9335 64857 60177 96987 12380 20690 80746 26517 86113 38400 25888 94340 50165 8736 59865 65382 3950 32492 43602 56882 15020 41689 506 77338 11269 932 60829 44586 76854 43015 50907 41605 69096 77558 32095 90377 41497 44806 53623 99768 77977 692 11247 78453 83808 78764 6276 2338 26 27291 56542 76278 7793 72933 56189 42410 9118 33836 88494 69731 52342 11102 13357 35700 19028 30977 62603 83912 23307 90320 33715 53847 3253 61491 74569 15625 37550 88635 38875 87804 63747 51997 80306 48817 54582 42070 52183 1034 35763 97455 62182 25112 74759 82191 75372 68019 9602 64102 20788 55165 43280 15992 29123 76991 72417 41047 95990 92709 22587 99909 38352 20665 32831 7201 75266 38556 91948 72640 78490 85575 97662 65628 63481 60567 13728 39095 34739 49230 82988 66122 8197 11657 16859 14853 35051 81940 18092 55919 24667 97068 38540 91184 18069 86327 15356 98472 76848 34585 16925 33815 28154 19198 49160 33293 85312 51523 60265 29385 40342 85236 4635 38618 80936 24533 94240 19708 33723 90640 41213 86445 24486 70406 18309 83133 94983 76999 755 9962 28356 17630 44879 95109 23398 78081 68084 28918 24776 87639 55984 44365 28705 74340 62610 4664 14433 44968 92202 45361 91071 57935 18141 54632 40013 58058 89424 56616 92413 14603 68520 16768 96015 27613 36783 11082 23403 65114 20712 16378 537 94498 36359 7934 70766 19773 20333 30298 56571 88631 53098 81009 34418 13784 48789 28077 59059 49858 89615 54229 90614 60122 54470 50655 66368 91484 24965 10313 87559 94495 8419 7492 70989 68718 69532 63916 65472 16970 84328 94291 64402 22380 44511 98232 39079 49218 11769 9561 35771 68145 69778 10810 71837 99107 82427 76140 45579 12398 25868 68235 86751 87123 75069 86740 73800 7211 98339 50547 89129 83075 64314 84163 18648 20512 88748 91106 63264 81395 39640 87333 13634 45258 66153 83675 12351 93069 14122 83360 9658 7044 55781 7123 34631 78933 78780 38873 30933 66843 67910 89028 46490 97312 38609 67886 53143 86467 63713 54432 64244 81493 32132 31795 90666 81107 34470 8445 12557 55006 45205 96523 80116 45229 \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog9/blog9Out.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog9/blog9Out.txt new file mode 100644 index 000000000..b0b483b12 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog9/blog9Out.txt @@ -0,0 +1,5862 @@ +5 +1 +2 +1 +3 + +5 +3 +3 +9 +6 + +1 +8 +1 +9 +0 + +9 +9 +8 +5 + +9 +0 +3 +9 +6 + +7 +1 +3 +8 +3 + +6 +7 +1 +7 +1 + +2 +6 +2 +7 +1 + +5 +2 +4 +2 +4 + +5 +4 +8 +4 +8 + +6 +6 +6 +1 +1 + +7 +0 +7 +4 +7 + +2 +9 +6 +3 +3 + +6 +6 +0 +5 + +4 +3 +2 +0 +2 + +5 +0 +5 +8 +4 + +8 +3 +3 +1 +5 + +8 +5 +6 +3 +0 + +2 +6 +1 +8 +9 + +3 +2 +4 +3 +7 + +1 +0 +1 +2 +2 + +6 +3 +8 +3 +0 + +5 +3 +1 +4 +8 + +8 +6 +5 +8 +6 + +6 +0 +6 +3 + +2 +4 +1 +3 +8 + +3 +3 +6 +3 +3 + +3 +6 +9 + +8 +5 +2 + +8 +2 +4 +7 +9 + +5 +6 +1 +7 +6 + +1 +6 +8 +2 +4 + +5 +2 +4 +7 +8 + +2 +1 +3 +7 +7 + +9 +8 +1 +0 +6 + +4 +9 +5 +1 +8 + +9 +8 +6 +5 +9 + +6 +1 +4 +9 +6 + +8 +3 +2 +4 +4 + +4 +7 +7 +1 +8 + +4 +3 +7 +0 +5 + +7 +4 +7 +9 +9 + +2 +6 +7 +4 +7 + +5 +3 +6 +1 +5 + +6 +2 +0 +8 +1 + +9 +8 +3 +0 +5 + +5 +1 +0 +0 +6 + +9 +9 +5 +0 +5 + +1 +9 +3 +8 +4 + +8 +3 +6 +7 +9 + +3 +3 +9 +9 +0 + +4 +8 +1 +9 +1 + +5 +6 +7 +4 +0 + +8 +5 +7 +4 + +7 +4 +0 +7 +1 + +4 +1 +6 +3 +3 + +7 +4 +4 +2 +9 + +7 +9 +1 +1 +6 + +4 +5 +3 +0 + +1 +4 +2 +8 +0 + +1 +3 +2 +6 +1 + +1 +0 +7 +2 +3 + +6 +3 +9 +4 +9 + +4 +5 +0 +2 +0 + +7 +8 +3 +6 + +4 +9 +2 +0 +7 + +6 +4 +9 +5 +7 + +5 +7 +1 +5 +8 + +7 +0 +5 +4 +6 + +2 +0 +6 +7 +2 + +9 +3 +8 +5 +7 + +9 +2 +8 +7 +0 + +2 +0 +5 +7 + +3 +5 +8 +8 +4 + +2 +7 +3 +5 +0 + +4 +8 +1 +0 +8 + +1 +1 +7 +4 +4 + +6 +9 +8 +1 + +4 +8 +0 +3 +0 + +9 +1 +5 +4 +4 + +6 +6 +9 +7 + +6 +7 +9 +9 + +3 +0 +0 +3 +4 + +7 +4 +9 +5 +7 + +2 +0 +5 +2 +9 + +1 +4 +2 +7 +6 + +3 +4 +5 +5 +4 + +8 +9 +2 +2 +7 + +9 +2 +0 +9 + +3 +7 +9 +2 +5 + +8 +3 +0 +3 +1 + +9 +0 +4 +9 +5 + +7 +2 +9 +6 +7 + +2 +3 +6 +4 +3 + +5 +0 +9 +1 +8 + +8 +3 +2 +5 + +6 +9 +8 +8 +3 + +5 +0 +1 +3 +2 + +6 +5 +4 +7 +0 + +8 +1 +2 +9 +0 + +9 +3 +5 +4 +5 + +6 +4 +6 +7 + +9 +2 +7 +6 +5 + +6 +2 +4 +5 +1 + +7 +2 +4 +4 +6 + +8 +8 +4 +6 +0 + +2 +7 +5 +9 +1 + +2 +8 +3 +8 +6 + +2 +3 +9 +3 +0 + +4 +3 +6 +7 +3 + +8 +1 +5 +8 +1 + +9 +3 +5 +6 +1 + +1 +3 +7 +7 +7 + +8 +1 +5 +0 +1 + +5 +0 +5 +3 +9 + +2 +6 +9 +0 +2 + +1 +2 +2 +5 +3 + +6 +1 +0 +5 +3 + +3 +0 +8 +7 +8 + +4 +5 +4 + +3 +9 +3 +2 +1 + +2 +6 +5 +2 +7 + +8 +7 +3 +1 +5 + +6 +1 +5 +5 +0 + +6 +1 +9 +1 +4 + +5 +5 +6 +9 +7 + +7 +7 +6 +7 +5 + +4 +4 +2 +9 +1 + +9 +5 +7 +1 +2 + +4 +9 +3 +5 +8 + +3 +1 +4 +0 +6 + +4 +2 +8 +3 +1 + +2 +8 +3 +8 +2 + +3 +7 +8 +7 + +8 +7 +6 +1 +6 + +5 +8 +0 +7 +6 + +2 +8 +0 +8 +8 + +1 +7 +7 +9 +0 + +4 +6 +0 +0 + +7 +3 +9 +6 + +3 +5 +6 +5 +1 + +5 +5 +6 +5 +8 + +4 +2 +3 +8 +2 + +3 +9 +4 +5 + +4 +6 +5 +5 + +4 +2 +4 +0 +2 + +3 +3 +6 +2 +1 + +4 +6 +3 +1 + +7 +3 +5 +8 +1 + +9 +2 +5 +9 +1 + +1 +4 +0 +9 + +2 +8 +0 +2 +0 + +8 +8 +1 +8 +7 + +7 +3 +0 +2 +0 + +3 +9 +6 +8 +9 + +3 +8 +9 +3 +0 + +1 +8 +7 +9 +3 + +4 +7 +5 +2 +8 + +1 +9 +4 +9 +8 + +8 +5 +4 +3 +0 + +2 +2 +4 +7 +9 + +3 +1 +0 +9 +8 + +8 +8 +3 +3 +8 + +3 +5 +5 +6 +6 + +8 +5 +9 +3 +5 + +8 +3 +1 +2 +1 + +9 +9 +9 +0 + +6 +6 +1 +5 +0 + +9 +9 +4 +7 +5 + +1 +5 +4 +4 +1 + +3 +6 +9 +6 +7 + +3 +2 +8 +0 +5 + +7 +5 +7 +7 +2 + +9 +8 +0 +8 +7 + +9 +9 +9 +2 +6 + +7 +0 +4 +6 +7 + +7 +3 +5 +7 +2 + +2 +6 +5 +6 +8 + +2 +9 +5 +4 +5 + +1 +8 +6 +5 +4 + +5 +1 +9 +9 +5 + +4 +7 +2 +0 +5 + +2 +7 +9 +2 +0 + +6 +1 +1 +4 +1 + +3 +9 +9 +1 +3 + +5 +5 +3 +6 +2 + +6 +9 +6 +1 +2 + +6 +0 +0 +9 +6 + +3 +8 +8 +3 + +1 +2 +3 +9 + +7 +3 +4 +0 +0 + +1 +5 +2 +9 +2 + +9 +5 +1 +5 +6 + +6 +0 +4 +2 +2 + +2 +1 +9 +1 + +2 +3 +6 +6 +8 + +7 +7 +0 +6 +7 + +4 +0 +8 +7 +3 + +4 +4 +4 +1 +2 + +8 +1 +5 +1 +0 + +4 +4 +8 +7 +6 + +4 +5 +4 +8 + +4 +8 +2 +4 +7 + +6 +4 +2 +8 +2 + +8 +4 +3 +1 +5 + +9 +8 +6 +5 +2 + +6 +9 +7 +1 +1 + +3 +1 +0 +6 +1 + +5 +3 +8 +5 +9 + +1 +7 +0 +1 +1 + +1 +2 +9 +6 +1 + +1 +0 +9 +1 +8 + +2 +2 +2 +9 +6 + +4 +8 +1 +2 +7 + +3 +2 +5 +7 +5 + +3 +2 +2 +5 +7 + +9 +9 +5 +1 +3 + +2 +8 +5 +6 + +1 +6 +8 +4 +4 + +3 +9 +5 +1 +7 + +8 +1 +1 +7 +1 + +4 +0 +5 +3 +0 + +6 +7 +8 +5 +9 + +2 +1 +4 +8 +0 + +3 +7 +5 +7 +1 + +5 +2 +3 +5 +5 + +4 +5 +2 +3 +8 + +4 +9 +4 +4 +1 + +7 +7 +8 +6 +5 + +1 +7 +0 +5 +5 + +7 +3 +1 +9 + +7 +1 +6 +8 +5 + +6 +0 +0 +6 +8 + +9 +7 +9 +1 +9 + +4 +8 +9 +7 +6 + +1 +2 +9 +0 +1 + +5 +0 +5 +3 +4 + +3 +3 +8 +7 +5 + +2 +1 +0 +5 + +9 +3 +8 +5 +2 + +1 +1 +7 +2 + +4 +9 +4 +2 +7 + +7 +1 +2 +5 +2 + +3 +1 +0 +3 + +9 +9 +6 +4 +5 + +2 +2 +3 +8 +8 + +7 +4 +4 +5 +2 + +9 +1 +1 +9 +7 + +8 +4 +1 +8 +9 + +4 +3 +0 +1 +4 + +5 +5 +1 +0 +4 + +7 +1 +6 +2 +3 + +9 +9 +5 +4 +4 + +1 +4 +3 +1 +4 + +8 +9 +3 +7 +1 + +9 +3 +1 +7 +8 + +8 +4 +8 +7 +1 + +7 +8 +9 +1 +0 + +1 +6 +0 +5 +6 + +8 +5 +2 +2 + +5 +6 +3 +0 +1 + +6 +8 +2 +0 +9 + +3 +6 +6 +5 +2 + +2 +8 +9 +6 +4 + +4 +1 +6 +0 +0 + +9 +1 +8 +5 +0 + +5 +5 +5 +7 +1 + +1 +5 +7 +1 + +3 +1 +5 +7 +7 + +7 +5 +3 +9 +2 + +6 +4 +0 +3 +9 + +7 +3 +5 +8 +2 + +3 +4 +1 +0 +3 + +8 +2 +4 +4 +9 + +1 +9 +3 +2 +7 + +6 +1 +8 +9 +8 + +4 +1 +0 +7 +4 + +9 +0 +4 +9 +9 + +8 +5 +3 +4 +2 + +5 +1 +4 +9 +1 + +9 +4 +1 +3 +8 + +3 +5 +5 +7 +1 + +8 +5 +4 +7 + +6 +4 +8 +3 +6 + +9 +5 +1 +5 + +5 +9 +8 +1 +2 + +5 +6 +9 +9 +2 + +7 +7 +7 +1 +0 + +7 +9 +4 +4 +9 + +4 +8 +5 +6 +1 + +3 +8 +9 +7 +8 + +3 +8 +1 +4 +2 + +6 +6 +2 +1 +2 + +5 +0 +3 +2 +0 + +1 +5 +6 +2 +6 + +7 +5 +3 +4 +0 + +9 +2 +0 +0 +1 + +4 +1 +2 +7 +8 + +5 +5 +5 +2 +5 + +3 +7 +5 +9 +0 + +9 +9 +9 +6 +6 + +6 +6 +9 +4 + +5 +1 +6 +3 + +6 +6 +6 +2 +2 + +4 +5 +6 +3 +1 + +7 +0 +4 +5 +4 + +5 +4 +9 +8 +3 + +8 +8 +1 +7 +2 + +5 +1 +8 +1 +6 + +5 +4 +5 +7 + +4 +8 +1 +9 +9 + +3 +4 +2 +1 +5 + +8 +7 +6 +3 +7 + +1 +1 +7 +3 +9 + +3 +6 +2 +4 +8 + +4 +3 +9 +7 +9 + +2 +2 +4 +9 +8 + +9 +9 +1 +6 +6 + +5 +0 +5 +4 +6 + +8 +1 +0 +0 +2 + +2 +1 +6 +3 + +9 +9 +4 +9 +1 + +3 +3 +6 +7 +5 + +9 +1 +8 + +1 +7 +3 +0 +5 + +4 +2 +7 +5 +3 + +6 +8 +7 +2 +9 + +9 +9 +2 +1 +9 + +8 +6 +4 +7 +1 + +9 +1 +3 +4 +2 + +5 +1 +4 +5 +7 + +5 +5 +5 +8 +0 + +1 +5 +4 +6 +1 + +9 +3 +6 +9 +6 + +3 +2 +8 +4 + +2 +5 +9 +4 +9 + +2 +2 +1 +6 +6 + +1 +0 +3 +8 +9 + +7 +8 +6 +6 +0 + +5 +7 +7 +3 +4 + +4 +7 +8 +1 +4 + +8 +6 +6 + +6 +1 +0 +1 + +2 +7 +2 +6 +7 + +1 +7 +9 +0 +5 + +7 +5 +7 +9 +9 + +5 +6 +5 +3 + +3 +7 +2 +6 +2 + +9 +6 +3 +9 + +5 +4 +6 +5 +1 + +6 +3 +4 +4 +9 + +7 +9 +4 +5 +6 + +4 +2 +2 +0 +3 + +3 +9 +3 +6 +7 + +1 +0 +0 +0 + +3 +5 +2 +5 +5 + +8 +5 +6 +8 +4 + +4 +7 +4 +0 +1 + +7 +2 +4 +4 +2 + +9 +3 +6 +5 +8 + +3 +6 +3 +3 +5 + +4 +3 +3 +1 +8 + +6 +7 +6 +1 + +6 +4 +4 + +6 +5 +3 +0 + +1 +6 +6 +9 +8 + +6 +8 +2 +7 +5 + +6 +8 +6 +8 +2 + +6 +9 +8 +6 +4 + +6 +4 +7 +0 +8 + +2 +8 +4 +3 +9 + +3 +8 +5 +0 +9 + +8 +2 +1 +0 +1 + +9 +3 +5 +9 +3 + +6 +4 +3 +8 + +5 +7 +2 +6 +1 + +7 +7 +5 +8 +7 + +1 +6 +0 +4 + +9 +0 +8 +4 +4 + +6 +4 +8 +4 +0 + +7 +1 +4 +1 + +4 +6 +5 +5 +8 + +7 +9 +1 +7 +7 + +5 +7 +1 +2 +3 + +7 +4 +8 +7 +1 + +4 +9 +9 +7 +8 + +6 +5 +6 +9 +1 + +3 +1 +3 +7 +3 + +7 +4 +7 +3 +0 + +2 +1 +1 +0 +4 + +3 +4 +9 +0 + +6 +7 +9 +2 + +9 +9 +7 +1 +3 + +2 +1 +6 +4 +8 + +2 +0 +4 +2 +0 + +4 +0 +5 +6 +1 + +1 +0 +3 +3 +2 + +8 +2 +6 +2 +3 + +6 +7 +8 +7 +1 + +2 +8 +2 +9 +7 + +7 +1 +2 +2 +7 + +4 +4 +8 +6 +5 + +2 +9 +1 +8 +0 + +5 +0 +8 +1 +0 + +4 +8 +2 +0 +0 + +9 +1 +7 +9 +8 + +3 +5 +0 +0 +8 + +8 +7 +0 +0 +1 + +1 +6 +7 +5 +5 + +8 +6 +0 +2 +0 + +7 +0 +4 +4 +9 + +7 +1 +6 +5 +7 + +3 +5 +7 +2 +5 + +2 +2 +7 +5 + +6 +4 +6 +3 +8 + +6 +8 +8 +2 +0 + +6 +7 +2 +8 +3 + +9 +8 +4 +6 +9 + +2 +3 +9 +5 +2 + +3 +3 +9 +1 +8 + +1 +5 +7 +5 + +7 +0 +4 +1 +0 + +7 +6 +9 +9 + +8 +1 +4 +7 +2 + +4 +4 +3 +3 +4 + +9 +5 +4 +0 +8 + +4 +9 +6 +2 +4 + +3 +2 +4 +6 + +2 +1 +3 +6 +8 + +8 +5 +8 +0 +3 + +8 +2 +4 +8 +8 + +9 +2 +5 +3 +7 + +8 +2 +5 +3 +6 + +4 +0 +4 +0 +6 + +2 +5 +8 +7 + +9 +3 +3 +8 +1 + +7 +0 +2 +2 +9 + +3 +9 +3 +2 +5 + +7 +6 +0 +7 + +8 +1 +1 +7 +4 + +6 +4 +2 +6 +8 + +9 +0 +9 +9 +1 + +3 +7 +5 +5 +1 + +9 +6 +4 +6 +7 + +2 +9 +5 +7 +9 + +7 +9 +6 +9 +6 + +2 +4 +0 +2 + +3 +9 +2 +4 +8 + +4 +5 +4 +5 +3 + +4 +1 +9 +6 +6 + +7 +3 +2 +8 +0 + +2 +0 +4 +1 +4 + +3 +0 +9 +6 +2 + +9 +1 +2 +7 +8 + +2 +8 +6 +4 +6 + +5 +3 +8 +2 +9 + +8 +1 +8 +7 +3 + +8 +5 +2 +5 +4 + +3 +3 +1 +9 +3 + +4 +6 +8 +8 +5 + +3 +2 +9 +4 +3 + +5 +3 +0 +4 +0 + +1 +1 +5 +2 +6 + +2 +7 +9 +0 +8 + +1 +7 +0 +6 +9 + +2 +0 +7 +0 +8 + +5 +3 +7 +4 +6 + +8 +1 +5 +1 +6 + +9 +4 +7 +7 +0 + +9 +8 +5 +2 +9 + +3 +8 +1 +5 +3 + +7 +1 +7 +3 +0 + +2 +5 +1 +3 +5 + +6 +8 +7 +4 +3 + +5 +0 +6 +2 +6 + +8 +4 +2 +3 +1 + +9 +3 +9 +2 +4 + +9 +3 +4 +1 +1 + +5 +1 +6 +5 +4 + +6 +0 +9 +4 +4 + +3 +4 +2 + +8 +5 +8 +6 +4 + +6 +3 +7 +1 +8 + +6 +8 +6 +7 +6 + +8 +4 +8 +7 +3 + +4 +8 +0 +5 +6 + +4 +7 +1 +2 +9 + +6 +9 +8 +8 +6 + +8 +0 +4 +5 +1 + +2 +0 +9 +1 +4 + +7 +3 +1 +6 +9 + +1 +1 +1 +2 +1 + +7 +8 +0 +1 +1 + +6 +5 +8 +5 +0 + +3 +6 +7 +3 +6 + +2 +5 +4 +3 +3 + +1 +0 +9 +8 +8 + +2 +0 +5 +0 +1 + +6 +1 +6 +0 +7 + +6 +0 +0 +7 +0 + +5 +3 +8 +6 +5 + +5 +7 +2 +1 +8 + +5 +6 +4 +6 +8 + +9 +0 +7 +8 +2 + +6 +2 +6 +5 + +9 +3 +9 +6 +4 + +1 +0 +1 +4 +3 + +1 +7 +4 +2 +4 + +7 +9 +2 +2 +2 + +4 +2 +8 +2 +4 + +2 +8 +4 +5 +8 + +3 +2 +9 +9 +3 + +5 +9 +1 +4 + +2 +4 +3 +8 +0 + +4 +1 +3 +5 +8 + +6 +3 +5 +8 +9 + +2 +4 +5 +8 +1 + +4 +7 +7 +4 + +8 +2 +3 +2 +5 + +8 +5 +9 +7 +3 + +2 +4 +5 +4 +1 + +1 +9 +3 +7 +8 + +6 +2 +6 +6 + +5 +5 +2 +9 +1 + +9 +9 +2 +2 +7 + +7 +9 +0 +2 +6 + +3 +0 +5 +1 + +6 +9 +0 +7 +3 + +7 +7 +1 +8 +0 + +9 +8 +8 +5 + +8 +3 +0 +0 + +5 +3 +8 +7 +5 + +4 +6 +1 +2 +4 + +7 +6 +4 +1 +9 + +8 +7 +6 +3 +5 + +3 +1 +2 +3 +5 + +2 +4 +4 +9 +4 + +8 +9 +6 +9 +0 + +4 +6 +8 +5 +9 + +4 +0 +8 +2 + +4 +3 +4 +1 +4 + +4 +9 +6 +3 +7 + +2 +0 +6 +5 +0 + +9 +5 +3 +8 +1 + +1 +7 +2 +5 +2 + +9 +3 +5 +8 +5 + +2 +9 +8 +8 +8 + +6 +8 +1 +5 +9 + +4 +8 +0 +8 +4 + +1 +4 +8 +1 +9 + +3 +9 +3 +3 +4 + +8 +4 +5 +8 +3 + +8 +6 +8 +4 +9 + +1 +5 +7 +2 +5 + +1 +0 +0 +4 +8 + +4 +3 +1 +4 +9 + +9 +1 +6 +6 +8 + +4 +9 +6 +0 +2 + +6 +9 +7 +2 + +5 +3 +1 +6 +1 + +6 +8 +3 +8 +4 + +9 +4 +4 +6 +2 + +5 +4 +0 +7 +7 + +4 +8 +0 +0 +0 + +8 +9 +0 +3 + +2 +8 +3 +0 +6 + +2 +6 +2 +1 +1 + +2 +0 +9 +4 + +6 +3 +8 +8 +2 + +6 +9 +2 +1 +4 + +3 +0 +3 +4 + +8 +2 +1 +8 +9 + +1 +0 +5 +0 +1 + +6 +9 +0 +1 + +9 +8 +6 +7 + +7 +1 +1 +1 +8 + +9 +7 +8 +3 +2 + +2 +4 +4 +4 +5 + +4 +3 +1 +3 +3 + +9 +8 +9 +9 +6 + +3 +6 +9 +2 +9 + +5 +9 +2 +2 +9 + +6 +7 +3 +0 +9 + +6 +0 +6 +8 +8 + +3 +6 +9 +0 +8 + +2 +6 +7 +8 + +9 +8 +6 +3 +5 + +8 +1 +8 +0 +1 + +8 +6 +9 +4 +2 + +8 +0 +2 +6 +9 + +7 +1 +7 +2 +3 + +8 +2 +9 +8 +4 + +5 +1 +8 +9 +4 + +9 +2 +3 +9 +2 + +6 +6 +3 + +3 +7 +7 +7 +4 + +2 +9 +3 +2 + +9 +0 +5 +4 +7 + +7 +2 +3 +1 +9 + +5 +7 +2 +3 +2 + +7 +2 +6 + +7 +9 +1 +6 +0 + +5 +2 +4 +5 +5 + +5 +4 +7 +4 +4 + +3 +3 +2 +7 +7 + +1 +4 +2 +3 +5 + +2 +2 +2 +6 +1 + +6 +7 +3 +6 +0 + +1 +7 +7 +9 +5 + +6 +2 +2 +5 +6 + +6 +9 +5 +5 +2 + +2 +7 +7 +9 +4 + +4 +6 +8 +3 +1 + +3 +7 +0 +1 +9 + +9 +3 +0 +6 +8 + +3 +7 +8 +7 +4 + +6 +4 +3 +1 +0 + +2 +7 +7 +7 +4 + +4 +3 +5 +4 +0 + +1 +4 +8 +7 + +1 +9 +0 +1 +4 + +2 +0 +5 +6 +9 + +2 +6 +2 +1 +4 + +8 +4 +3 +4 +5 + +4 +2 +2 +5 +2 + +3 +2 +0 +5 +0 + +3 +8 +9 +9 + +2 +3 +4 +8 +1 + +8 +8 +6 +1 +5 + +9 +0 +2 +5 +4 + +7 +1 +5 +1 +8 + +1 +1 +2 +9 + +6 +8 +4 +6 +4 + +9 +7 +3 +7 +8 + +8 +6 +5 +3 +1 + +8 +5 +7 +6 +1 + +6 +0 +2 +1 +5 + +2 +2 +3 +2 +9 + +9 +1 +8 +7 +0 + +3 +2 +2 +4 +0 + +4 +2 +8 +3 +9 + +7 +6 +2 +2 +4 + +6 +5 +1 +5 +8 + +8 +8 +7 +8 +0 + +5 +6 +9 +8 +8 + +2 +5 +4 +2 +3 + +4 +8 +8 +8 +1 + +2 +2 +1 +9 + +8 +0 +3 +0 +4 + +8 +1 +1 +6 +4 + +7 +2 +5 +8 +6 + +4 +9 +3 +5 +2 + +5 +9 +8 +9 +9 + +6 +7 +2 +9 +2 + +5 +0 +5 +9 +2 + +6 +6 +2 +5 + +7 +7 +6 +6 + +1 +7 +1 +8 + +2 +3 +2 +3 +6 + +2 +7 +0 + +9 +3 +3 +5 + +6 +4 +8 +5 +7 + +6 +0 +1 +7 +7 + +9 +6 +9 +8 +7 + +1 +2 +3 +8 +0 + +2 +0 +6 +9 +0 + +8 +0 +7 +4 +6 + +2 +6 +5 +1 +7 + +8 +6 +1 +1 +3 + +3 +8 +4 +0 +0 + +2 +5 +8 +8 +8 + +9 +4 +3 +4 +0 + +5 +0 +1 +6 +5 + +8 +7 +3 +6 + +5 +9 +8 +6 +5 + +6 +5 +3 +8 +2 + +3 +9 +5 +0 + +3 +2 +4 +9 +2 + +4 +3 +6 +0 +2 + +5 +6 +8 +8 +2 + +1 +5 +0 +2 +0 + +4 +1 +6 +8 +9 + +5 +0 +6 + +7 +7 +3 +3 +8 + +1 +1 +2 +6 +9 + +9 +3 +2 + +6 +0 +8 +2 +9 + +4 +4 +5 +8 +6 + +7 +6 +8 +5 +4 + +4 +3 +0 +1 +5 + +5 +0 +9 +0 +7 + +4 +1 +6 +0 +5 + +6 +9 +0 +9 +6 + +7 +7 +5 +5 +8 + +3 +2 +0 +9 +5 + +9 +0 +3 +7 +7 + +4 +1 +4 +9 +7 + +4 +4 +8 +0 +6 + +5 +3 +6 +2 +3 + +9 +9 +7 +6 +8 + +7 +7 +9 +7 +7 + +6 +9 +2 + +1 +1 +2 +4 +7 + +7 +8 +4 +5 +3 + +8 +3 +8 +0 +8 + +7 +8 +7 +6 +4 + +6 +2 +7 +6 + +2 +3 +3 +8 + +2 +6 + +2 +7 +2 +9 +1 + +5 +6 +5 +4 +2 + +7 +6 +2 +7 +8 + +7 +7 +9 +3 + +7 +2 +9 +3 +3 + +5 +6 +1 +8 +9 + +4 +2 +4 +1 +0 + +9 +1 +1 +8 + +3 +3 +8 +3 +6 + +8 +8 +4 +9 +4 + +6 +9 +7 +3 +1 + +5 +2 +3 +4 +2 + +1 +1 +1 +0 +2 + +1 +3 +3 +5 +7 + +3 +5 +7 +0 +0 + +1 +9 +0 +2 +8 + +3 +0 +9 +7 +7 + +6 +2 +6 +0 +3 + +8 +3 +9 +1 +2 + +2 +3 +3 +0 +7 + +9 +0 +3 +2 +0 + +3 +3 +7 +1 +5 + +5 +3 +8 +4 +7 + +3 +2 +5 +3 + +6 +1 +4 +9 +1 + +7 +4 +5 +6 +9 + +1 +5 +6 +2 +5 + +3 +7 +5 +5 +0 + +8 +8 +6 +3 +5 + +3 +8 +8 +7 +5 + +8 +7 +8 +0 +4 + +6 +3 +7 +4 +7 + +5 +1 +9 +9 +7 + +8 +0 +3 +0 +6 + +4 +8 +8 +1 +7 + +5 +4 +5 +8 +2 + +4 +2 +0 +7 +0 + +5 +2 +1 +8 +3 + +1 +0 +3 +4 + +3 +5 +7 +6 +3 + +9 +7 +4 +5 +5 + +6 +2 +1 +8 +2 + +2 +5 +1 +1 +2 + +7 +4 +7 +5 +9 + +8 +2 +1 +9 +1 + +7 +5 +3 +7 +2 + +6 +8 +0 +1 +9 + +9 +6 +0 +2 + +6 +4 +1 +0 +2 + +2 +0 +7 +8 +8 + +5 +5 +1 +6 +5 + +4 +3 +2 +8 +0 + +1 +5 +9 +9 +2 + +2 +9 +1 +2 +3 + +7 +6 +9 +9 +1 + +7 +2 +4 +1 +7 + +4 +1 +0 +4 +7 + +9 +5 +9 +9 +0 + +9 +2 +7 +0 +9 + +2 +2 +5 +8 +7 + +9 +9 +9 +0 +9 + +3 +8 +3 +5 +2 + +2 +0 +6 +6 +5 + +3 +2 +8 +3 +1 + +7 +2 +0 +1 + +7 +5 +2 +6 +6 + +3 +8 +5 +5 +6 + +9 +1 +9 +4 +8 + +7 +2 +6 +4 +0 + +7 +8 +4 +9 +0 + +8 +5 +5 +7 +5 + +9 +7 +6 +6 +2 + +6 +5 +6 +2 +8 + +6 +3 +4 +8 +1 + +6 +0 +5 +6 +7 + +1 +3 +7 +2 +8 + +3 +9 +0 +9 +5 + +3 +4 +7 +3 +9 + +4 +9 +2 +3 +0 + +8 +2 +9 +8 +8 + +6 +6 +1 +2 +2 + +8 +1 +9 +7 + +1 +1 +6 +5 +7 + +1 +6 +8 +5 +9 + +1 +4 +8 +5 +3 + +3 +5 +0 +5 +1 + +8 +1 +9 +4 +0 + +1 +8 +0 +9 +2 + +5 +5 +9 +1 +9 + +2 +4 +6 +6 +7 + +9 +7 +0 +6 +8 + +3 +8 +5 +4 +0 + +9 +1 +1 +8 +4 + +1 +8 +0 +6 +9 + +8 +6 +3 +2 +7 + +1 +5 +3 +5 +6 + +9 +8 +4 +7 +2 + +7 +6 +8 +4 +8 + +3 +4 +5 +8 +5 + +1 +6 +9 +2 +5 + +3 +3 +8 +1 +5 + +2 +8 +1 +5 +4 + +1 +9 +1 +9 +8 + +4 +9 +1 +6 +0 + +3 +3 +2 +9 +3 + +8 +5 +3 +1 +2 + +5 +1 +5 +2 +3 + +6 +0 +2 +6 +5 + +2 +9 +3 +8 +5 + +4 +0 +3 +4 +2 + +8 +5 +2 +3 +6 + +4 +6 +3 +5 + +3 +8 +6 +1 +8 + +8 +0 +9 +3 +6 + +2 +4 +5 +3 +3 + +9 +4 +2 +4 +0 + +1 +9 +7 +0 +8 + +3 +3 +7 +2 +3 + +9 +0 +6 +4 +0 + +4 +1 +2 +1 +3 + +8 +6 +4 +4 +5 + +2 +4 +4 +8 +6 + +7 +0 +4 +0 +6 + +1 +8 +3 +0 +9 + +8 +3 +1 +3 +3 + +9 +4 +9 +8 +3 + +7 +6 +9 +9 +9 + +7 +5 +5 + +9 +9 +6 +2 + +2 +8 +3 +5 +6 + +1 +7 +6 +3 +0 + +4 +4 +8 +7 +9 + +9 +5 +1 +0 +9 + +2 +3 +3 +9 +8 + +7 +8 +0 +8 +1 + +6 +8 +0 +8 +4 + +2 +8 +9 +1 +8 + +2 +4 +7 +7 +6 + +8 +7 +6 +3 +9 + +5 +5 +9 +8 +4 + +4 +4 +3 +6 +5 + +2 +8 +7 +0 +5 + +7 +4 +3 +4 +0 + +6 +2 +6 +1 +0 + +4 +6 +6 +4 + +1 +4 +4 +3 +3 + +4 +4 +9 +6 +8 + +9 +2 +2 +0 +2 + +4 +5 +3 +6 +1 + +9 +1 +0 +7 +1 + +5 +7 +9 +3 +5 + +1 +8 +1 +4 +1 + +5 +4 +6 +3 +2 + +4 +0 +0 +1 +3 + +5 +8 +0 +5 +8 + +8 +9 +4 +2 +4 + +5 +6 +6 +1 +6 + +9 +2 +4 +1 +3 + +1 +4 +6 +0 +3 + +6 +8 +5 +2 +0 + +1 +6 +7 +6 +8 + +9 +6 +0 +1 +5 + +2 +7 +6 +1 +3 + +3 +6 +7 +8 +3 + +1 +1 +0 +8 +2 + +2 +3 +4 +0 +3 + +6 +5 +1 +1 +4 + +2 +0 +7 +1 +2 + +1 +6 +3 +7 +8 + +5 +3 +7 + +9 +4 +4 +9 +8 + +3 +6 +3 +5 +9 + +7 +9 +3 +4 + +7 +0 +7 +6 +6 + +1 +9 +7 +7 +3 + +2 +0 +3 +3 +3 + +3 +0 +2 +9 +8 + +5 +6 +5 +7 +1 + +8 +8 +6 +3 +1 + +5 +3 +0 +9 +8 + +8 +1 +0 +0 +9 + +3 +4 +4 +1 +8 + +1 +3 +7 +8 +4 + +4 +8 +7 +8 +9 + +2 +8 +0 +7 +7 + +5 +9 +0 +5 +9 + +4 +9 +8 +5 +8 + +8 +9 +6 +1 +5 + +5 +4 +2 +2 +9 + +9 +0 +6 +1 +4 + +6 +0 +1 +2 +2 + +5 +4 +4 +7 +0 + +5 +0 +6 +5 +5 + +6 +6 +3 +6 +8 + +9 +1 +4 +8 +4 + +2 +4 +9 +6 +5 + +1 +0 +3 +1 +3 + +8 +7 +5 +5 +9 + +9 +4 +4 +9 +5 + +8 +4 +1 +9 + +7 +4 +9 +2 + +7 +0 +9 +8 +9 + +6 +8 +7 +1 +8 + +6 +9 +5 +3 +2 + +6 +3 +9 +1 +6 + +6 +5 +4 +7 +2 + +1 +6 +9 +7 +0 + +8 +4 +3 +2 +8 + +9 +4 +2 +9 +1 + +6 +4 +4 +0 +2 + +2 +2 +3 +8 +0 + +4 +4 +5 +1 +1 + +9 +8 +2 +3 +2 + +3 +9 +0 +7 +9 + +4 +9 +2 +1 +8 + +1 +1 +7 +6 +9 + +9 +5 +6 +1 + +3 +5 +7 +7 +1 + +6 +8 +1 +4 +5 + +6 +9 +7 +7 +8 + +1 +0 +8 +1 +0 + +7 +1 +8 +3 +7 + +9 +9 +1 +0 +7 + +8 +2 +4 +2 +7 + +7 +6 +1 +4 +0 + +4 +5 +5 +7 +9 + +1 +2 +3 +9 +8 + +2 +5 +8 +6 +8 + +6 +8 +2 +3 +5 + +8 +6 +7 +5 +1 + +8 +7 +1 +2 +3 + +7 +5 +0 +6 +9 + +8 +6 +7 +4 +0 + +7 +3 +8 +0 +0 + +7 +2 +1 +1 + +9 +8 +3 +3 +9 + +5 +0 +5 +4 +7 + +8 +9 +1 +2 +9 + +8 +3 +0 +7 +5 + +6 +4 +3 +1 +4 + +8 +4 +1 +6 +3 + +1 +8 +6 +4 +8 + +2 +0 +5 +1 +2 + +8 +8 +7 +4 +8 + +9 +1 +1 +0 +6 + +6 +3 +2 +6 +4 + +8 +1 +3 +9 +5 + +3 +9 +6 +4 +0 + +8 +7 +3 +3 +3 + +1 +3 +6 +3 +4 + +4 +5 +2 +5 +8 + +6 +6 +1 +5 +3 + +8 +3 +6 +7 +5 + +1 +2 +3 +5 +1 + +9 +3 +0 +6 +9 + +1 +4 +1 +2 +2 + +8 +3 +3 +6 +0 + +9 +6 +5 +8 + +7 +0 +4 +4 + +5 +5 +7 +8 +1 + +7 +1 +2 +3 + +3 +4 +6 +3 +1 + +7 +8 +9 +3 +3 + +7 +8 +7 +8 +0 + +3 +8 +8 +7 +3 + +3 +0 +9 +3 +3 + +6 +6 +8 +4 +3 + +6 +7 +9 +1 +0 + +8 +9 +0 +2 +8 + +4 +6 +4 +9 +0 + +9 +7 +3 +1 +2 + +3 +8 +6 +0 +9 + +6 +7 +8 +8 +6 + +5 +3 +1 +4 +3 + +8 +6 +4 +6 +7 + +6 +3 +7 +1 +3 + +5 +4 +4 +3 +2 + +6 +4 +2 +4 +4 + +8 +1 +4 +9 +3 + +3 +2 +1 +3 +2 + +3 +1 +7 +9 +5 + +9 +0 +6 +6 +6 + +8 +1 +1 +0 +7 + +3 +4 +4 +7 +0 + +8 +4 +4 +5 + +1 +2 +5 +5 +7 + +5 +5 +0 +0 +6 + +4 +5 +2 +0 +5 + +9 +6 +5 +2 +3 + +8 +0 +1 +1 +6 + +4 +5 +2 +2 +9 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog9/blog9Tag.txt b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog9/blog9Tag.txt new file mode 100644 index 000000000..163c2d36a --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/blog9/blog9Tag.txt @@ -0,0 +1,573 @@ +2 +9 +6 +3 +3 + +2 +6 +1 +8 +9 + +2 +1 +3 +7 +7 + +6 +2 +0 +8 +1 + +7 +4 +0 +7 +1 + +1 +0 +7 +2 +3 + +6 +3 +9 +4 +9 + +4 +9 +2 +0 +7 + +8 +9 +2 +2 +7 + +9 +2 +0 +9 + +5 +0 +5 +3 +9 + +1 +2 +2 +5 +3 + +5 +5 +6 +9 +7 + +1 +4 +0 +9 + +1 +8 +7 +9 +3 + +6 +1 +1 +4 +1 + +4 +8 +2 +4 +7 + +1 +7 +0 +1 +1 + +3 +2 +2 +5 +7 + +3 +7 +5 +7 +1 + +9 +7 +9 +1 +9 + +8 +9 +3 +7 +1 + +8 +4 +8 +7 +1 + +6 +8 +2 +0 +9 + +1 +5 +7 +1 + +9 +0 +4 +9 +9 + +4 +5 +6 +3 +1 + +5 +4 +9 +8 +3 + +6 +8 +7 +2 +9 + +1 +5 +4 +6 +1 + +6 +1 +0 +1 + +5 +6 +5 +3 + +3 +9 +3 +6 +7 + +6 +7 +6 +1 + +2 +8 +4 +3 +9 + +7 +7 +5 +8 +7 + +9 +9 +7 +1 +3 + +2 +8 +2 +9 +7 + +7 +6 +9 +9 + +7 +0 +2 +2 +9 + +7 +6 +0 +7 + +3 +8 +1 +5 +3 + +6 +8 +7 +4 +3 + +4 +7 +1 +2 +9 + +3 +2 +9 +9 +3 + +6 +3 +5 +8 +9 + +5 +5 +2 +9 +1 + +6 +9 +0 +7 +3 + +5 +3 +1 +6 +1 + +8 +2 +1 +8 +9 + +1 +0 +5 +0 +1 + +4 +3 +1 +3 +3 + +3 +6 +9 +2 +9 + +9 +0 +5 +4 +7 + +4 +6 +8 +3 +1 + +3 +7 +0 +1 +9 + +1 +4 +8 +7 + +1 +1 +2 +9 + +8 +6 +5 +3 +1 + +4 +2 +8 +3 +9 + +2 +5 +4 +2 +3 + +8 +6 +1 +1 +3 + +5 +3 +6 +2 +3 + +7 +7 +9 +7 +7 + +7 +7 +9 +3 + +3 +0 +9 +7 +7 + +6 +2 +6 +0 +3 + +3 +2 +5 +3 + +4 +8 +8 +1 +7 + +5 +2 +1 +8 +3 + +7 +4 +7 +5 +9 + +2 +9 +1 +2 +3 + +7 +6 +9 +9 +1 + +4 +1 +0 +4 +7 + +3 +2 +8 +3 +1 + +3 +4 +7 +3 +9 + +1 +1 +6 +5 +7 + +3 +5 +0 +5 +1 + +2 +4 +5 +3 +3 + +4 +1 +2 +1 +3 + +4 +4 +8 +7 +9 + +4 +5 +3 +6 +1 + +4 +0 +0 +1 +3 + +9 +2 +4 +1 +3 + +2 +0 +3 +3 +3 + +1 +0 +3 +1 +3 + +8 +7 +5 +5 +9 + +8 +4 +1 +9 + +9 +4 +2 +9 +1 + +3 +9 +0 +7 +9 + +3 +5 +7 +7 +1 + +7 +1 +8 +3 +7 + +7 +2 +1 +1 + +8 +4 +1 +6 +3 + +3 +4 +6 +3 +1 + +3 +8 +8 +7 +3 + +3 +8 +6 +0 +9 + +8 +6 +4 +6 +7 diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/clean.py b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/clean.py new file mode 100644 index 000000000..50e03ede6 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/clean.py @@ -0,0 +1,20 @@ +import os +import subprocess + +Passes = ["ContentSearch", "DeleteTag", "InsertTag", "TagSearch"] + +layouts = ["layout1", "layout2", "layout3", "layout4", "layout5", "layout6", "layout7", "layout8"] + +print("Cleaning out the c files and binaries") + +#Compilation phase +for myPass in Passes: + for layout in layouts: + + gibbon_file_name = layout + myPass + filename_c = gibbon_file_name + ".c" + gibbon_cmd_c = subprocess.run(["rm", filename_c]) + gibbon_cmd_bin = subprocess.run(["rm", gibbon_file_name]) + + + diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/eval_bench.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/eval_bench.hs new file mode 100644 index 000000000..88c75f31d --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/eval_bench.hs @@ -0,0 +1,11 @@ +import Eval + +gibbon_main = + let + n = 45 + t = mkRandTree n + + -- _ = iterate (eval t) + s = iterate (evalR t) + in () + diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/format_blog.py b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/format_blog.py new file mode 100644 index 000000000..9c4f150dc --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/format_blog.py @@ -0,0 +1,112 @@ +import random + +filenamesIn = [ +"blog1/blog1", +"blog2/blog2", +"blog3/blog3", +"blog4/blog4", +"blog5/blog5", +"blog6/blog6", +"blog7/blog7", +"blog8/blog8", +"blog9/blog9", +"blog10/blog10"] + +'''for files in filenamesIn: + filenameOut = files + "Out" + ".txt" + file = open(files + ".txt", 'r') + characters = [] + + while True: + read = file.read(1) + characters.append(read + "\n") + if not read: + break + + file.close() + + words = [] + with open(files + ".txt" ,'r') as file: + for line in file: + for word in line.split(): + words.append(word) + + random_keyowrds = random.choices(words, k=500) + + tagfile = files + "Tag.txt" + + tag_char_counter = 0 + + with open(tagfile, 'w') as fTag: + for word in random_keyowrds: + for char in word: + fTag.write(char + "\n") + tag_char_counter = tag_char_counter + 1 + fTag.write(" \n") + tag_char_counter = tag_char_counter + 1 + + print("Length of the character in thr taglist is " + str(tag_char_counter)) + + print("Length of characters is " + str(len(characters))) + + with open(filenameOut, 'w') as fOut: + for char in characters: + fOut.write(char)''' + +def is_prime(n): + + if (n == 0): + return False + + if (n == 1): + return True + + for i in range(2, n): + if (n%i == 0): + return False + + return True + +for files in filenamesIn: + randomlist = random.sample(range(0, 100000), 1000) + + primes = [] + for i in randomlist: + if (is_prime(i)): + primes.append(i) + + filenameIn = files + ".txt" + filenameOut = files + "Out" + ".txt" + tagfile = files + "Tag.txt" + + num_string = " ".join(map(str,randomlist)) + num_primes = " ".join(map(str,primes)) + + num_string = str(num_string) + num_primes = str(num_primes) + + #for char in num_string: + # print(char) + + #print(num_string) + #print(num_primes) + + with open(filenameIn, 'w') as fIn: + for num in randomlist: + fIn.write(str(num) + " ") + + out_char = 0 + with open(filenameOut, 'w') as fOut: + for char in num_string: + fOut.write(char + "\n") + out_char += 1 + + print("Character count for " + str(filenameOut) + " is " + str(out_char) ) + + out_tag = 0 + with open(tagfile, 'w') as fTag: + for char in num_primes: + fTag.write(char + "\n") + out_tag += 1 + + print("Character count for " + str(tagfile) + " is " + str(out_tag) ) diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1ContentSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1ContentSearch.hs new file mode 100644 index 000000000..052d2f28d --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1ContentSearch.hs @@ -0,0 +1,111 @@ +import Basics +import GenerateLayout1 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout1 header id author date content tags rst -> let --present = searchBlogContent keyword content + --_ = printsym (quote "NEWLINE") + --_ = printbool present + --_ = printsym (quote "NEWLINE") + newContent = emphasizeBlogContent' keyword content + --_ = printsym (quote "NEWLINE") + --_ = printPacked newContent + --_ = printsym (quote "NEWLINE") + newRst = emphKeywordInContent keyword rst + in Layout1 header id author date newContent tags newRst + +-- main function +gibbon_main = + let --blogs = mkBlogs_layout1 200 0 12 -- mkBlogs_layout1 length start_id tag_length + --f1, f2, f3, f4, f5, f6, f7, f8, f9, f10 :: Vector Char + --f1 = readArrayFile (Just ("blog1Out.txt", 502)) + --f2 = readArrayFile (Just ("blog2Out.txt", 400)) + --f3 = readArrayFile (Just ("blog3Out.txt", 340)) + --f4 = readArrayFile (Just ("blog4Out.txt", 347)) + --f5 = readArrayFile (Just ("blog5Out.txt", 452)) + --f6 = readArrayFile (Just ("blog6Out.txt", 260)) + --f7 = readArrayFile (Just ("blog7Out.txt", 395)) + --f8 = readArrayFile (Just ("blog8Out.txt", 404)) + --f9 = readArrayFile (Just ("blog9Out.txt", 278)) + --f10 = readArrayFile (Just ("blog10Out.txt", 299)) + --_ = printVec (\i -> printchar i) f1 + --_ = printVec (\i -> printchar i) f2 + --_ = printVec (\i -> printchar i) f3 + --_ = printVec (\i -> printchar i) f4 + --_ = printVec (\i -> printchar i) f5 + --_ = printVec (\i -> printchar i) f6 + --_ = printVec (\i -> printchar i) f7 + --_ = printVec (\i -> printchar i) f8 + --_ = printVec (\i -> printchar i) f9 + --_ = printVec (\i -> printchar i) f10 + --block1 = fileToContent f1 (singleton (nth f1 0)) Nil 1 (vlength f1 ) + --block2 = fileToContent f2 (singleton (nth f2 0)) Nil 1 (vlength f2 ) + --block3 = fileToContent f3 (singleton (nth f3 0)) Nil 1 (vlength f3 ) + --block4 = fileToContent f4 (singleton (nth f4 0)) Nil 1 (vlength f4 ) + --block5 = fileToContent f5 (singleton (nth f5 0)) Nil 1 (vlength f5 ) + --block6 = fileToContent f6 (singleton (nth f6 0)) Nil 1 (vlength f6 ) + --block7 = fileToContent f7 (singleton (nth f7 0)) Nil 1 (vlength f7 ) + --block8 = fileToContent f8 (singleton (nth f8 0)) Nil 1 (vlength f8 ) + --block9 = fileToContent f9 (singleton (nth f9 0)) Nil 1 (vlength f9 ) + --block10 = fileToContent f10 (singleton (nth f10 0)) Nil 1 (vlength f10) + --_ = printPacked block1 + --_ = printPacked block2 + --_ = printPacked block3 + --_ = printPacked block4 + --_ = printPacked block5 + --_ = printPacked block6 + --_ = printPacked block7 + --_ = printPacked block8 + --_ = printPacked block9 + --_ = printPacked block10 + -- keyword = (getRandomString 2) -- some random keyword + -- new_blogs = iterate (emphKeywordInContent keyword blogs) + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --_ = printPacked new_blogs1 + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --content :: BlogContent + --tags :: BlogTags + --(content, tags) = mkContentFromText (mod rand 10) + --_ = printPacked content + --_ = printPacked tags + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout1 lfc ltc 2 + _ = printPacked blogs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "feelings" + newblgs = iterate (emphKeywordInContent keyword blogs) + _ = printPacked newblgs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1DeleteTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1DeleteTag.hs new file mode 100644 index 000000000..999c2a09e --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1DeleteTag.hs @@ -0,0 +1,61 @@ +import Basics +import GenerateLayout1 + +type Text = Vector Char + + +deleteKeywordInTagList :: Text -> Blog -> Blog +deleteKeywordInTagList keyword blogs = case blogs of + End -> End + Layout1 header id author date content tags rst -> let + newTags = deleteBlogTags keyword tags + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --_ = printPacked tags + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --_ = printPacked newTags + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + newRst = deleteKeywordInTagList keyword rst + in Layout1 header id author date content newTags newRst + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout1 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (deleteKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1InsertTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1InsertTag.hs new file mode 100644 index 000000000..958063769 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1InsertTag.hs @@ -0,0 +1,63 @@ +import Basics +import GenerateLayout1 + +type Text = Vector Char + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout1 header id author date content tags rst -> let + --true = checkBlogID id 1 + --newTags :: BlogTags + --in if (true) then + -- let + -- newTags = insertBlogTags keyword tags + -- newRst = insertKeywordInTagList keyword rst + -- in Layout1 header id author date (copyPacked content) (copyPacked newTags) (copyPacked newRst) + --else + -- let + -- newRst = insertKeywordInTagList keyword rst + -- in Layout1 header id author date content tags (copyPacked newRst) + + newTags = insertBlogTags keyword tags + newRst = insertKeywordInTagList keyword rst + in Layout1 header id author date content newTags newRst + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout1 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (insertKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1ListLen.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1ListLen.hs new file mode 100644 index 000000000..f749cb9bc --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1ListLen.hs @@ -0,0 +1,41 @@ +type Text = Vector Char + +data Content = Str Text Content + | End + +data List = Snoc (List) Content + | Nil + + +mkContent :: Int -> Content +mkContent len = if len <= 0 then End + else Str "abcdef" (mkContent (len - 1)) + + +mkSnocList :: Int -> List +mkSnocList len = if len <= 0 + then Nil + else let + rst = mkSnocList (len - 1) + val = mkContent 100 + in Snoc rst val + +getLengthSnoc :: List -> Int +{-# ANN getLengthSnoc Snoc #-} +getLengthSnoc lst = case lst of + Snoc rst val -> 1 + getLengthSnoc rst + Nil -> 0 + + +gibbon_main = + let snocList = mkSnocList 1000000 + --consList = mkConsList 100000 + l1 = iterate (getLengthSnoc snocList) + --l2 = getLengthCons consList + _ = printsym (quote "Length Snoc: ") + _ = printint l1 + _ = printsym (quote "NEWLINE") + --_ = printsym (quote "Length Cons: ") + --_ = printint l2 + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1TagSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1TagSearch.hs new file mode 100644 index 000000000..c5755ddf9 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout1TagSearch.hs @@ -0,0 +1,71 @@ +import Basics +import GenerateLayout1 + +type Text = Vector Char + +-- emphKeywordInTag :: Text -> Blog -> Blog +-- emphKeywordInTag keyword blogs = case blogs of +-- End -> End +-- Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags -- search the tags for the keyword +-- --_ = printsym (quote "NEWLINE") +-- --_ = printPacked id +-- --_ = printsym (quote " ") +-- --_ = printbool present +-- --_ = printsym (quote "NEWLINE") +-- newContent = emphasizeBlogContent keyword content present -- get the new content, this should be inlined +-- newRst = emphKeywordInTag keyword rst +-- in Layout1 header id author (copyPacked date) (copyPacked newContent) (copyPacked tags) (copyPacked newRst) + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if (present) + then let newContent = emphasizeBlogContent keyword content present + newRst = emphKeywordInTag keyword rst + in Layout1 header id author date newContent tags newRst + else + let newRst = emphKeywordInTag keyword rst + in Layout1 header id author date content tags newRst + + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout1 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (emphKeywordInTag keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2ContentSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2ContentSearch.hs new file mode 100644 index 000000000..b6e436b42 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2ContentSearch.hs @@ -0,0 +1,59 @@ +import Basics +import GenerateLayout2 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout2 content tags rst header id author date -> let --present = searchBlogContent keyword content + newContent = emphasizeBlogContent' keyword content + newRst = emphKeywordInContent keyword rst + in Layout2 newContent tags newRst header id author date + +-- main function +gibbon_main = + let --blogs = mkBlogs_layout2 200000 0 1200 -- mkBlogs_layout1 length start_id tag_length + --keyword = (getRandomString 2) -- some random keyword + --new_blogs = iterate (emphKeywordInContent keyword blogs) + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --_ = printPacked new_blogs1 + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout2 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "feelings" + newblgs = iterate (emphKeywordInContent keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2DeleteTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2DeleteTag.hs new file mode 100644 index 000000000..78e17023e --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2DeleteTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout2 + +type Text = Vector Char + + +deleteKeywordInTagList :: Text -> Blog -> Blog +deleteKeywordInTagList keyword blogs = case blogs of + End -> End + Layout2 content tags rst header id author date -> let + newTags = deleteBlogTags keyword tags + newRst = deleteKeywordInTagList keyword rst + in Layout2 content newTags newRst header id author date + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout2 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (deleteKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2InsertTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2InsertTag.hs new file mode 100644 index 000000000..61a7d9d7b --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2InsertTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout2 + +type Text = Vector Char + + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout2 content tags rst header id author date -> let + newTags = insertBlogTags keyword tags + newRst = insertKeywordInTagList keyword rst + in Layout2 content newTags newRst header id author date + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout2 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (insertKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2ListLen.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2ListLen.hs new file mode 100644 index 000000000..2fe8600e4 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2ListLen.hs @@ -0,0 +1,43 @@ +type Text = Vector Char + +data Content = Str Text Content + | End + +data List = Cons Content (List) + | Nil + + +mkContent :: Int -> Content +mkContent len = if len <= 0 then End + else Str "abcdef" (mkContent (len - 1)) + + +mkConsList :: Int -> List +mkConsList len = if len <= 0 + then Nil + else let + --val = mkContent 100 + rst = mkConsList (len - 1) + val = mkContent 100 + in Cons val rst + +getLengthCons :: List -> Int +{-# ANN getLengthCons Cons #-} +getLengthCons lst = case lst of + Cons val rst -> getLengthCons rst + 1 + Nil -> 0 + + + +gibbon_main = + let --snocList = mkSnocList 90000 + consList = mkConsList 3000000 + --l1 = getLengthSnoc snocList + l2 = iterate (getLengthCons consList) + --_ = printsym (quote "Length Snoc: ") + --_ = printint l1 + --_ = printsym (quote "NEWLINE") + _ = printsym (quote "Length Cons: ") + _ = printint l2 + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2TagSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2TagSearch.hs new file mode 100644 index 000000000..583cd4bfd --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout2TagSearch.hs @@ -0,0 +1,57 @@ +import Basics +import GenerateLayout2 + +type Text = Vector Char + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if (present) + then let newContent = emphasizeBlogContent keyword content present + newRst = emphKeywordInTag keyword rst + in Layout2 newContent tags newRst header id author date + else + let newRst = emphKeywordInTag keyword rst + in Layout2 content tags newRst header id author date + + + +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout2 lfc ltc 2 + _ = printPacked blogs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (emphKeywordInTag keyword blogs) + _ = printPacked newblgs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3ContentSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3ContentSearch.hs new file mode 100644 index 000000000..9f5d79d91 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3ContentSearch.hs @@ -0,0 +1,60 @@ +import Basics +import GenerateLayout3 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout3 tags rst content header id author date -> let --present = searchBlogContent keyword content + newContent = emphasizeBlogContent' keyword content + newRst = emphKeywordInContent keyword rst + in Layout3 tags newRst newContent header id author date + + +-- main function +gibbon_main = + let --blogs = mkBlogs_layout3 200000 0 1200 -- mkBlogs_layout1 length start_id tag_length + --keyword = (getRandomString 2) -- some random keyword + --new_blogs = iterate (emphKeywordInContent keyword blogs) + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --_ = printPacked new_blogs1 + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout3 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "feelings" + newblgs = iterate (emphKeywordInContent keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3DeleteTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3DeleteTag.hs new file mode 100644 index 000000000..9d9b39f45 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3DeleteTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout3 + +type Text = Vector Char + + +deleteKeywordInTagList :: Text -> Blog -> Blog +deleteKeywordInTagList keyword blogs = case blogs of + End -> End + Layout3 tags rst content header id author date -> let + newTags = deleteBlogTags keyword tags + newRst = deleteKeywordInTagList keyword rst + in Layout3 newTags newRst content header id author date + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout3 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (deleteKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3InsertTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3InsertTag.hs new file mode 100644 index 000000000..b4559d473 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3InsertTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout3 + +type Text = Vector Char + + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout3 tags rst content header id author date -> let + newTags = insertBlogTags keyword tags + newRst = insertKeywordInTagList keyword rst + in Layout3 newTags newRst content header id author date + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout3 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (insertKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3TagSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3TagSearch.hs new file mode 100644 index 000000000..64574f2c9 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout3TagSearch.hs @@ -0,0 +1,60 @@ +import Basics +import GenerateLayout3 + +type Text = Vector Char + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout3 tags rst content header id author date -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if present then + let + newContent = emphasizeBlogContent keyword content present -- get the new content, this should be inlined + newRst = emphKeywordInTag keyword rst + in Layout3 tags newRst newContent header id author date + else + let + newRst = emphKeywordInTag keyword rst + in Layout3 tags newRst content header id author date + + + + +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout3 lfc ltc 2 + _ = printPacked blogs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (emphKeywordInTag keyword blogs) + _ = printPacked newblgs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + in () \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4ContentSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4ContentSearch.hs new file mode 100644 index 000000000..6d754f9b5 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4ContentSearch.hs @@ -0,0 +1,60 @@ +import Basics +import GenerateLayout4 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout4 tags content rst header id author date -> let --present = searchBlogContent keyword content + newContent = emphasizeBlogContent' keyword content --present + newRst = emphKeywordInContent keyword rst + in Layout4 tags newContent newRst header id author date + + +-- main function +gibbon_main = + let --blogs = mkBlogs_layout4 200000 0 1200 -- mkBlogs_layout1 length start_id tag_length + --keyword = (getRandomString 2) -- some random keyword + --new_blogs = iterate (emphKeywordInContent keyword blogs) + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --_ = printPacked new_blogs1 + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout4 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "feelings" + newblgs = iterate (emphKeywordInContent keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4DeleteTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4DeleteTag.hs new file mode 100644 index 000000000..33bef5237 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4DeleteTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout4 + +type Text = Vector Char + + +deleteKeywordInTagList :: Text -> Blog -> Blog +deleteKeywordInTagList keyword blogs = case blogs of + End -> End + Layout4 tags content rst header id author date -> let + newTags = deleteBlogTags keyword tags + newRst = deleteKeywordInTagList keyword rst + in Layout4 newTags content newRst header id author date + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout4 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (deleteKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4InsertTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4InsertTag.hs new file mode 100644 index 000000000..4b60d12c7 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4InsertTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout4 + +type Text = Vector Char + + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout4 tags content rst header id author date -> let + newTags = insertBlogTags keyword tags + newRst = insertKeywordInTagList keyword rst + in Layout4 newTags content newRst header id author date + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout4 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (insertKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4TagSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4TagSearch.hs new file mode 100644 index 000000000..d949f1b02 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout4TagSearch.hs @@ -0,0 +1,58 @@ +import Basics +import GenerateLayout4 + +type Text = Vector Char + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags + in if (present) then + let newContent = emphasizeBlogContent keyword content present + newRst = emphKeywordInTag keyword rst + in Layout4 tags newContent newRst header id author date + else + let newRst = emphKeywordInTag keyword rst + in Layout4 tags content newRst header id author date + + + + +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout4 lfc ltc 2 + _ = printPacked blogs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (emphKeywordInTag keyword blogs) + _ = printPacked newblgs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5ContentSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5ContentSearch.hs new file mode 100644 index 000000000..049fd7e18 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5ContentSearch.hs @@ -0,0 +1,61 @@ +import Basics +import GenerateLayout5 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout5 rst tags content header id author date -> let --present = searchBlogContent keyword content + newContent = emphasizeBlogContent' keyword content --present + newRst = emphKeywordInContent keyword rst + in Layout5 newRst tags newContent header id author date + + + +-- main function +gibbon_main = + let --blogs = mkBlogs_layout5 200000 0 1200 -- mkBlogs_layout1 length start_id tag_length + --keyword = (getRandomString 2) -- some random keyword + --new_blogs = iterate (emphKeywordInContent keyword blogs) + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --_ = printPacked new_blogs1 + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout5 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "feelings" + newblgs = iterate (emphKeywordInContent keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5DeleteTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5DeleteTag.hs new file mode 100644 index 000000000..933ca9da6 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5DeleteTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout5 + +type Text = Vector Char + + +deleteKeywordInTagList :: Text -> Blog -> Blog +deleteKeywordInTagList keyword blogs = case blogs of + End -> End + Layout5 rst tags content header id author date -> let + newTags = deleteBlogTags keyword tags + newRst = deleteKeywordInTagList keyword rst + in Layout5 newRst newTags content header id author date + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout5 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (deleteKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5InsertTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5InsertTag.hs new file mode 100644 index 000000000..0221bf1fa --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5InsertTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout5 + +type Text = Vector Char + + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout5 rst tags content header id author date -> let + newTags = insertBlogTags keyword tags + newRst = insertKeywordInTagList keyword rst + in Layout5 newRst newTags content header id author date + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout5 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (insertKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5TagSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5TagSearch.hs new file mode 100644 index 000000000..1dd9e67b5 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout5TagSearch.hs @@ -0,0 +1,57 @@ +import Basics +import GenerateLayout5 + +type Text = Vector Char + + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout5 rst tags content header id author date -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if present then + let newContent = emphasizeBlogContent keyword content present -- get the new content, this should be inlined + newRst = emphKeywordInTag keyword rst + in Layout5 newRst tags newContent header id author date + else + let newRst = emphKeywordInTag keyword rst + in Layout5 newRst tags content header id author date + + +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout5 lfc ltc 2 + _ = printPacked blogs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (emphKeywordInTag keyword blogs) + _ = printPacked newblgs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6ContentSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6ContentSearch.hs new file mode 100644 index 000000000..5f8fdef66 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6ContentSearch.hs @@ -0,0 +1,62 @@ +import Basics +import GenerateLayout6 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout6 header id author date content rst tags -> let --present = searchBlogContent keyword content + newContent = emphasizeBlogContent' keyword content --present + newRst = emphKeywordInContent keyword rst + in Layout6 header id author date newContent newRst tags + + + + +-- main function +gibbon_main = + let --blogs = mkBlogs_layout6 200000 0 1200 -- mkBlogs_layout1 length start_id tag_length + --keyword = (getRandomString 2) -- some random keyword + --new_blogs = iterate (emphKeywordInContent keyword blogs) + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --_ = printPacked new_blogs1 + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout6 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "feelings" + newblgs = iterate (emphKeywordInContent keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6DeleteTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6DeleteTag.hs new file mode 100644 index 000000000..bee65a933 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6DeleteTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout6 + +type Text = Vector Char + + +deleteKeywordInTagList :: Text -> Blog -> Blog +deleteKeywordInTagList keyword blogs = case blogs of + End -> End + Layout6 header id author date content rst tags -> let + newTags = deleteBlogTags keyword tags + newRst = deleteKeywordInTagList keyword rst + in Layout6 header id author date content newRst newTags + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout6 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (deleteKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6InsertTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6InsertTag.hs new file mode 100644 index 000000000..9b7b1b793 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6InsertTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout6 + +type Text = Vector Char + + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout6 header id author date content rst tags -> let + newTags = insertBlogTags keyword tags + newRst = insertKeywordInTagList keyword rst + in Layout6 header id author date content newRst newTags + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout6 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (insertKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6TagSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6TagSearch.hs new file mode 100644 index 000000000..030fc0095 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout6TagSearch.hs @@ -0,0 +1,58 @@ +import Basics +import GenerateLayout6 + +type Text = Vector Char + + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout6 header id author date content rst tags -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if present then + let newContent = emphasizeBlogContent keyword content present -- get the new content, this should be inlined + newRst = emphKeywordInTag keyword rst + in Layout6 header id author date newContent newRst tags + else + let newRst = emphKeywordInTag keyword rst + in Layout6 header id author date content newRst tags + + + +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout6 lfc ltc 2 + _ = printPacked blogs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (emphKeywordInTag keyword blogs) + _ = printPacked newblgs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7ContentSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7ContentSearch.hs new file mode 100644 index 000000000..ae6434a15 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7ContentSearch.hs @@ -0,0 +1,61 @@ +import Basics +import GenerateLayout7 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout7 rst content header id author date tags -> let --present = searchBlogContent keyword content + newContent = emphasizeBlogContent' keyword content --present + newRst = emphKeywordInContent keyword rst + in Layout7 newRst newContent header id author date tags + + + +-- main function +gibbon_main = + let --blogs = mkBlogs_layout7 200000 0 1200 -- mkBlogs_layout1 length start_id tag_length + --keyword = (getRandomString 2) -- some random keyword + --new_blogs = iterate (emphKeywordInContent keyword blogs) + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --_ = printPacked new_blogs1 + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout7 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "feelings" + newblgs = iterate (emphKeywordInContent keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7DeleteTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7DeleteTag.hs new file mode 100644 index 000000000..9eaa9dd7b --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7DeleteTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout7 + +type Text = Vector Char + + +deleteKeywordInTagList :: Text -> Blog -> Blog +deleteKeywordInTagList keyword blogs = case blogs of + End -> End + Layout7 rst content header id author date tags -> let + newTags = deleteBlogTags keyword tags + newRst = deleteKeywordInTagList keyword rst + in Layout7 newRst content header id author date newTags + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout7 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (deleteKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7InsertTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7InsertTag.hs new file mode 100644 index 000000000..ea50d3841 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7InsertTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout7 + +type Text = Vector Char + + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout7 rst content header id author date tags -> let + newTags = insertBlogTags keyword tags + newRst = insertKeywordInTagList keyword rst + in Layout7 newRst content header id author date newTags + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout7 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (insertKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7TagSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7TagSearch.hs new file mode 100644 index 000000000..b2f7606bb --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout7TagSearch.hs @@ -0,0 +1,56 @@ +import Basics +import GenerateLayout7 + +type Text = Vector Char + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout7 rst content header id author date tags -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if present then + let newContent = emphasizeBlogContent keyword content present -- get the new content, this should be inlined + newRst = emphKeywordInTag keyword rst + in Layout7 newRst newContent header id author date tags + else + let newRst = emphKeywordInTag keyword rst + in Layout7 newRst content header id author date tags + + +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout7 lfc ltc 2 + _ = printPacked blogs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (emphKeywordInTag keyword blogs) + _ = printPacked newblgs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + in () \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8ContentSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8ContentSearch.hs new file mode 100644 index 000000000..3958a7ad4 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8ContentSearch.hs @@ -0,0 +1,60 @@ +import Basics +import GenerateLayout8 + +type Text = Vector Char + +emphKeywordInContent :: Text -> Blog -> Blog +emphKeywordInContent keyword blogs = + case blogs of + End -> End + Layout8 content rst id author date header tags -> let --present = searchBlogContent keyword content + newContent = emphasizeBlogContent' keyword content --present + newRst = emphKeywordInContent keyword rst + in Layout8 newContent newRst id author date header tags + + +-- main function +gibbon_main = + let --blogs = mkBlogs_layout8 200000 0 1200 -- mkBlogs_layout1 length start_id tag_length + --keyword = (getRandomString 2) -- some random keyword + --new_blogs = iterate (emphKeywordInContent keyword blogs) + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + --_ = printPacked new_blogs1 + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout8 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "feelings" + newblgs = iterate (emphKeywordInContent keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8DeleteTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8DeleteTag.hs new file mode 100644 index 000000000..72c712452 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8DeleteTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout8 + +type Text = Vector Char + + +deleteKeywordInTagList :: Text -> Blog -> Blog +deleteKeywordInTagList keyword blogs = case blogs of + End -> End + Layout8 content rst id author date header tags -> let + newTags = deleteBlogTags keyword tags + newRst = deleteKeywordInTagList keyword rst + in Layout8 content newRst id author date header newTags + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout8 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (deleteKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8InsertTag.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8InsertTag.hs new file mode 100644 index 000000000..31040f79b --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8InsertTag.hs @@ -0,0 +1,53 @@ +import Basics +import GenerateLayout8 + +type Text = Vector Char + + +insertKeywordInTagList :: Text -> Blog -> Blog +insertKeywordInTagList keyword blogs = case blogs of + End -> End + Layout8 content rst id author date header tags -> let + newTags = insertBlogTags keyword tags + newRst = insertKeywordInTagList keyword rst + in Layout8 content newRst id author date header newTags + + +-- main function +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout8 lfc ltc 10000 + --_ = printPacked blogs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (insertKeywordInTagList keyword blogs) + --_ = printPacked newblgs + --_ = printsym (quote "NEWLINE") + --_ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8TagSearch.hs b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8TagSearch.hs new file mode 100644 index 000000000..ee8acaea7 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/layout8TagSearch.hs @@ -0,0 +1,57 @@ +import Basics +import GenerateLayout8 + +type Text = Vector Char + + + +emphKeywordInTag :: Text -> Blog -> Blog +emphKeywordInTag keyword blogs = case blogs of + End -> End + Layout8 content rst id author date header tags -> let present = searchBlogTags keyword tags -- search the tags for the keyword + in if present then + let newContent = emphasizeBlogContent keyword content present -- get the new content, this should be inlined + newRst = emphKeywordInTag keyword rst + in Layout8 newContent newRst id author date header tags + else + let newRst = emphKeywordInTag keyword rst + in Layout8 content newRst id author date header tags + + +gibbon_main = + let + fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10 :: Text + ft1, ft2, ft3, ft4, ft5, ft6, ft7, ft8, ft9, ft10 :: Text + fc1 = readArrayFile (Just ("blog1/blog1Out.txt", 5904)) + fc2 = readArrayFile (Just ("blog2/blog2Out.txt", 5899)) + fc3 = readArrayFile (Just ("blog3/blog3Out.txt", 5886)) + fc4 = readArrayFile (Just ("blog4/blog4Out.txt", 5896)) + fc5 = readArrayFile (Just ("blog5/blog5Out.txt", 5882)) + fc6 = readArrayFile (Just ("blog6/blog6Out.txt", 5883)) + fc7 = readArrayFile (Just ("blog7/blog7Out.txt", 5882)) + fc8 = readArrayFile (Just ("blog8/blog8Out.txt", 5879)) + fc9 = readArrayFile (Just ("blog9/blog9Out.txt", 5862)) + fc10 = readArrayFile (Just ("blog10/blog10Out.txt", 5887)) + ft1 = readArrayFile (Just ("blog1/blog1Tag.txt", 500)) + ft2 = readArrayFile (Just ("blog2/blog2Tag.txt", 487)) + ft3 = readArrayFile (Just ("blog3/blog3Tag.txt", 591)) + ft4 = readArrayFile (Just ("blog4/blog4Tag.txt", 478)) + ft5 = readArrayFile (Just ("blog5/blog5Tag.txt", 562)) + ft6 = readArrayFile (Just ("blog6/blog6Tag.txt", 526)) + ft7 = readArrayFile (Just ("blog7/blog7Tag.txt", 509)) + ft8 = readArrayFile (Just ("blog8/blog8Tag.txt", 662)) + ft9 = readArrayFile (Just ("blog9/blog9Tag.txt", 573)) + ft10 = readArrayFile (Just ("blog10/blog10Tag.txt", 485)) + lfc = mkListFiles fc1 fc2 fc3 fc4 fc5 fc6 fc7 fc8 fc9 fc10 9 + ltc = mkListFiles ft1 ft2 ft3 ft4 ft5 ft6 ft7 ft8 ft9 ft10 9 + blogs = mkBlogs_layout8 lfc ltc 2 + _ = printPacked blogs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + keyword :: Vector Char + keyword = "31517" + newblgs = iterate (emphKeywordInTag keyword blogs) + _ = printPacked newblgs + _ = printsym (quote "NEWLINE") + _ = printsym (quote "NEWLINE") + in () \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/timings.py b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/timings.py new file mode 100644 index 000000000..0efe35f51 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/timings.py @@ -0,0 +1,108 @@ +import os +import subprocess +import re + +iterations = 9 + +rootdir = "/local/scratch/a/singhav/Applications/src/gibbon/gibbon-compiler/examples/layout_benchmarks/blog_management/marmoset/" + +ut_hash_include = "/local/scratch/a/singhav/Applications/src/uthash-2.3.0/include" + +Passes = ["ContentSearch", "DeleteTag", "InsertTag", "TagSearch"] + +layouts = ["layout1", "layout2", "layout3", "layout4", "layout5", "layout6", "layout7", "layout8"] + +#Compilation phase +for myPass in Passes: + for layout in layouts: + + gibbon_file_name = layout + myPass + + print() + print("Trying compilation for file " + gibbon_file_name + ".hs") + print() + + filename_haskell = gibbon_file_name + ".hs" + + haskell_cmd = "gibbon --packed --no-gc --toC " + filename_haskell + + print("The haskell command was: ") + print() + print(haskell_cmd) + print() + + gibbon_cmd_haskell = subprocess.run(["gibbon", "--packed", "--no-gc", "--toC", filename_haskell]) + + print("The exit code for the haskell command was %d" % gibbon_cmd_haskell.returncode) + print() + + filename_c = gibbon_file_name + ".c" + + gibbon_cmd = "gcc" + " -O3 " + "-I" + ut_hash_include + " " + filename_c + " -o " + gibbon_file_name + + print("The gcc command was: ") + print() + print(gibbon_cmd) + print() + + gibbon_cmd_c = subprocess.run(["gcc", "-O3", "-I" + ut_hash_include , filename_c, "-o", gibbon_file_name]) + print() + + print("The exit code for the gcc compilation was %d" % gibbon_cmd_c.returncode) + + + +Timings = {} + +#run the files and get the timings + +for myPass in Passes: + for layout in layouts: + + gibbon_binary = layout + myPass + + print() + print("Running the binary " + str(gibbon_binary)) + print() + + file_stats = gibbon_binary + ".txt" + + cmd = "(" + "cd " + rootdir + " && " + "(" + "./" + gibbon_binary + " --RUN " + str(iterations) + " > " + file_stats + ")" + ")" + + print(cmd) + + gibbon_binary_cmd = subprocess.call(cmd, shell=True) + + data = open(file_stats, 'r').read() + + batch_time = re.findall("BATCHTIME: (.*)", data) + median_time = re.findall("SELFTIMED: (.*)", data) + + print() + print(batch_time) + print(median_time) + + print(float(batch_time[0])) + print(float(median_time[0])) + + batchTimes = float(batch_time[0]) + medianTimes = float(median_time[0]) + + averageTimes = float (batchTimes / iterations) + + tupleTimes = (averageTimes, medianTimes) + + print(tupleTimes) + + Timings[gibbon_binary] = tupleTimes + + print() + +print(Timings) + +f = open("experiment_timings_marmoset.txt", "w") + +for key, value in Timings.items(): + f.write('%s:(average:%s, median:%s)\n' % (key, value[0], value[1])) + +f.close() diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/calcAdtLengthAc.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/calcAdtLengthAc.c new file mode 100644 index 000000000..65b4de08b --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/calcAdtLengthAc.c @@ -0,0 +1,4382 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +IntTy getLengthTR(CursorTy end_r_2554, CursorTy adt_31_923_1539, + IntTy accumulator_32_924_1540); +CursorCursorCursorProd mkACList(CursorTy end_r_2556, CursorTy loc_2555, + IntTy len_35_927_1544, + IntTy strLen_36_928_1545); +CursorCursorCursorProd mkString(CursorTy end_r_2558, CursorTy loc_2557, + IntTy len_188_1080_1550); +CursorCursorCursorProd mkContentText(CursorTy end_r_2560, CursorTy loc_2559, + IntTy n_202_1094_1556); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2563, + CursorTy end_r_2564, + CursorTy loc_2562, + CursorTy arg_637_1249_1558); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2567, + CursorTy end_r_2568, + CursorTy loc_2566, + CursorTy arg_642_1254_1563); +CursorProd _traverse_String(CursorTy end_r_2570, CursorTy arg_647_1259_1568); +CursorProd _print_String(CursorTy end_r_2572, CursorTy arg_652_1263_1572); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2575, + CursorTy end_r_2576, + CursorTy loc_2574, + CursorTy arg_661_1272_1581); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2579, + CursorTy end_r_2580, + CursorTy loc_2578, + CursorTy arg_666_1277_1586); +CursorProd _traverse_Content(CursorTy end_r_2582, CursorTy arg_671_1282_1591); +CursorProd _print_Content(CursorTy end_r_2584, CursorTy arg_676_1287_1596); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2587, CursorTy end_r_2588, + CursorTy loc_2586, + CursorTy arg_685_1296_1605); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2591, + CursorTy end_r_2592, + CursorTy loc_2590, + CursorTy arg_730_1341_1650); +CursorProd _traverse_Adt(CursorTy end_r_2594, CursorTy arg_775_1386_1695); +CursorProd _print_Adt(CursorTy end_r_2596, CursorTy arg_820_1431_1740); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2599, + CursorTy end_r_2600, CursorTy loc_2598, + CursorTy arg_883_1494_1803); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2603, + CursorTy end_r_2604, + CursorTy loc_2602, + CursorTy arg_888_1499_1808); +CursorProd _traverse_Tags(CursorTy end_r_2606, CursorTy arg_893_1504_1813); +CursorProd _print_Tags(CursorTy end_r_2608, CursorTy arg_898_1508_1817); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2611, CursorTy end_r_2612, + CursorTy loc_2610, CursorTy arg_2467); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2615, CursorTy end_r_2616, + CursorTy loc_2614, CursorTy arg_2472); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2619, + CursorTy end_r_2620, + CursorTy loc_2618, + CursorTy arg_2477); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2623, + CursorTy end_r_2624, + CursorTy loc_2622, + CursorTy arg_2522); +IntTy getLengthTR(CursorTy end_r_2554, CursorTy adt_31_923_1539, + IntTy accumulator_32_924_1540) +{ + TagTyPacked tmpval_5264 = *(TagTyPacked *) adt_31_923_1539; + CursorTy tmpcur_5265 = adt_31_923_1539 + 1; + + + switch_5270: + ; + switch (tmpval_5264) { + + case 0: + { + CursorTy jump_3359 = adt_31_923_1539 + 1; + + return accumulator_32_924_1540; + break; + } + + case 2: + { + IntTy fltAppE_1525_1543 = 1 + accumulator_32_924_1540; + IntTy tailapp_3360 = + getLengthTR(end_r_2554, tmpcur_5265, fltAppE_1525_1543); + + return tailapp_3360; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5266 = *(CursorTy *) tmpcur_5265; + CursorTy tmpaftercur_5267 = tmpcur_5265 + 8; + CursorTy jump_3604 = tmpcur_5265 + 8; + IntTy call_3605 = + getLengthTR(end_r_2554, tmpcur_5266, accumulator_32_924_1540); + + return call_3605; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5268 = *(CursorTy *) tmpcur_5265; + CursorTy tmpaftercur_5269 = tmpcur_5265 + 8; + IntTy call_3605 = + getLengthTR(end_r_2554, tmpcur_5268, accumulator_32_924_1540); + + return call_3605; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5264"); + exit(1); + } + } +} +CursorCursorCursorProd mkACList(CursorTy end_r_2556, CursorTy loc_2555, + IntTy len_35_927_1544, IntTy strLen_36_928_1545) +{ + if (loc_2555 + 32 > end_r_2556) { + ChunkTy new_chunk_2 = alloc_chunk(end_r_2556); + CursorTy chunk_start_3 = new_chunk_2.chunk_start; + CursorTy chunk_end_4 = new_chunk_2.chunk_end; + + end_r_2556 = chunk_end_4; + *(TagTyPacked *) loc_2555 = 255; + + CursorTy redir = loc_2555 + 1; + + *(CursorTy *) redir = chunk_start_3; + loc_2555 = chunk_start_3; + } + + BoolTy fltIf_1526_1546 = len_35_927_1544 <= 0; + + if (fltIf_1526_1546) { + *(TagTyPacked *) loc_2555 = 0; + + CursorTy writetag_3840 = loc_2555 + 1; + + return (CursorCursorCursorProd) {end_r_2556, loc_2555, writetag_3840}; + } else { + IntTy fltAppE_1527_1547 = len_35_927_1544 - 1; + CursorTy loc_2640 = loc_2555 + 1; + CursorCursorCursorProd tmp_struct_0 = + mkACList(end_r_2556, loc_2640, fltAppE_1527_1547, strLen_36_928_1545); + CursorTy pvrtmp_5275 = tmp_struct_0.field0; + CursorTy pvrtmp_5276 = tmp_struct_0.field1; + CursorTy pvrtmp_5277 = tmp_struct_0.field2; + CursorCursorCursorProd tmp_struct_1 = + mkContentText(pvrtmp_5275, pvrtmp_5277, strLen_36_928_1545); + CursorTy pvrtmp_5282 = tmp_struct_1.field0; + CursorTy pvrtmp_5283 = tmp_struct_1.field1; + CursorTy pvrtmp_5284 = tmp_struct_1.field2; + + *(TagTyPacked *) loc_2555 = 2; + + CursorTy writetag_3844 = loc_2555 + 1; + + return (CursorCursorCursorProd) {pvrtmp_5282, loc_2555, pvrtmp_5284}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2558, CursorTy loc_2557, + IntTy len_188_1080_1550) +{ + if (loc_2557 + 32 > end_r_2558) { + ChunkTy new_chunk_6 = alloc_chunk(end_r_2558); + CursorTy chunk_start_7 = new_chunk_6.chunk_start; + CursorTy chunk_end_8 = new_chunk_6.chunk_end; + + end_r_2558 = chunk_end_8; + *(TagTyPacked *) loc_2557 = 255; + + CursorTy redir = loc_2557 + 1; + + *(CursorTy *) redir = chunk_start_7; + loc_2557 = chunk_start_7; + } + + CursorTy loc_2646 = loc_2557 + 1; + CursorTy loc_2647 = loc_2646 + 8; + BoolTy fltIf_1528_1551 = len_188_1080_1550 <= 0; + + if (fltIf_1528_1551) { + *(TagTyPacked *) loc_2557 = 0; + + CursorTy writetag_3848 = loc_2557 + 1; + + return (CursorCursorCursorProd) {end_r_2558, loc_2557, writetag_3848}; + } else { + IntTy fltPrm_1529_1552 = rand(); + IntTy randomChar_189_1081_1553 = fltPrm_1529_1552 % 128; + IntTy fltAppE_1530_1554 = len_188_1080_1550 - 1; + CursorCursorCursorProd tmp_struct_5 = + mkString(end_r_2558, loc_2647, fltAppE_1530_1554); + CursorTy pvrtmp_5297 = tmp_struct_5.field0; + CursorTy pvrtmp_5298 = tmp_struct_5.field1; + CursorTy pvrtmp_5299 = tmp_struct_5.field2; + + *(TagTyPacked *) loc_2557 = 1; + + CursorTy writetag_3851 = loc_2557 + 1; + + *(IntTy *) writetag_3851 = randomChar_189_1081_1553; + + CursorTy writecur_3852 = writetag_3851 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_5297, loc_2557, pvrtmp_5299}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2560, CursorTy loc_2559, + IntTy n_202_1094_1556) +{ + if (loc_2559 + 32 > end_r_2560) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2560); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2560 = chunk_end_12; + *(TagTyPacked *) loc_2559 = 255; + + CursorTy redir = loc_2559 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2559 = chunk_start_11; + } + + CursorTy loc_2652 = loc_2559 + 1; + CursorCursorCursorProd tmp_struct_9 = + mkString(end_r_2560, loc_2652, n_202_1094_1556); + CursorTy pvrtmp_5308 = tmp_struct_9.field0; + CursorTy pvrtmp_5309 = tmp_struct_9.field1; + CursorTy pvrtmp_5310 = tmp_struct_9.field2; + + *(TagTyPacked *) loc_2559 = 1; + + CursorTy writetag_3856 = loc_2559 + 1; + + return (CursorCursorCursorProd) {pvrtmp_5308, loc_2559, pvrtmp_5310}; +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2563, + CursorTy end_r_2564, + CursorTy loc_2562, + CursorTy arg_637_1249_1558) +{ + if (loc_2562 + 32 > end_r_2564) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2564); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2564 = chunk_end_18; + *(TagTyPacked *) loc_2562 = 255; + + CursorTy redir = loc_2562 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2562 = chunk_start_17; + } + + CursorTy loc_2662 = loc_2562 + 1; + CursorTy loc_2663 = loc_2662 + 8; + TagTyPacked tmpval_5319 = *(TagTyPacked *) arg_637_1249_1558; + CursorTy tmpcur_5320 = arg_637_1249_1558 + 1; + + + switch_5363: + ; + switch (tmpval_5319) { + + case 0: + { + CursorTy jump_3366 = arg_637_1249_1558 + 1; + + *(TagTyPacked *) loc_2562 = 0; + + CursorTy writetag_3860 = loc_2562 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2564, jump_3366, + loc_2562, writetag_3860}; + break; + } + + case 1: + { + IntTy tmpval_5325 = *(IntTy *) tmpcur_5320; + CursorTy tmpcur_5326 = tmpcur_5320 + sizeof(IntTy); + CursorTy jump_3368 = tmpcur_5320 + 8; + CursorCursorCursorCursorProd tmp_struct_13 = + _copy_String(end_r_2563, end_r_2564, loc_2663, tmpcur_5326); + CursorTy pvrtmp_5327 = tmp_struct_13.field0; + CursorTy pvrtmp_5328 = tmp_struct_13.field1; + CursorTy pvrtmp_5329 = tmp_struct_13.field2; + CursorTy pvrtmp_5330 = tmp_struct_13.field3; + + *(TagTyPacked *) loc_2562 = 1; + + CursorTy writetag_3865 = loc_2562 + 1; + + *(IntTy *) writetag_3865 = tmpval_5325; + + CursorTy writecur_3866 = writetag_3865 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_5327, pvrtmp_5328, + loc_2562, pvrtmp_5330}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5339 = *(CursorTy *) tmpcur_5320; + CursorTy tmpaftercur_5340 = tmpcur_5320 + 8; + CursorTy jump_3609 = tmpcur_5320 + 8; + CursorCursorCursorCursorProd tmp_struct_14 = + _copy_String(end_r_2563, end_r_2564, loc_2562, tmpcur_5339); + CursorTy pvrtmp_5341 = tmp_struct_14.field0; + CursorTy pvrtmp_5342 = tmp_struct_14.field1; + CursorTy pvrtmp_5343 = tmp_struct_14.field2; + CursorTy pvrtmp_5344 = tmp_struct_14.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5341, jump_3609, + pvrtmp_5343, pvrtmp_5344}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5351 = *(CursorTy *) tmpcur_5320; + CursorTy tmpaftercur_5352 = tmpcur_5320 + 8; + CursorCursorCursorCursorProd tmp_struct_15 = + _copy_String(end_r_2563, end_r_2564, loc_2562, tmpcur_5351); + CursorTy pvrtmp_5353 = tmp_struct_15.field0; + CursorTy pvrtmp_5354 = tmp_struct_15.field1; + CursorTy pvrtmp_5355 = tmp_struct_15.field2; + CursorTy pvrtmp_5356 = tmp_struct_15.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5353, pvrtmp_5354, + pvrtmp_5355, pvrtmp_5356}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5319"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2567, + CursorTy end_r_2568, + CursorTy loc_2566, + CursorTy arg_642_1254_1563) +{ + CursorTy loc_2675 = loc_2566 + 1; + CursorTy loc_2676 = loc_2675 + 8; + TagTyPacked tmpval_5364 = *(TagTyPacked *) arg_642_1254_1563; + CursorTy tmpcur_5365 = arg_642_1254_1563 + 1; + + + switch_5408: + ; + switch (tmpval_5364) { + + case 0: + { + CursorTy jump_3371 = arg_642_1254_1563 + 1; + + *(TagTyPacked *) loc_2566 = 0; + + CursorTy writetag_3876 = loc_2566 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2568, jump_3371, + loc_2566, writetag_3876}; + break; + } + + case 1: + { + IntTy tmpval_5370 = *(IntTy *) tmpcur_5365; + CursorTy tmpcur_5371 = tmpcur_5365 + sizeof(IntTy); + CursorTy jump_3373 = tmpcur_5365 + 8; + CursorCursorCursorCursorProd tmp_struct_19 = + _copy_without_ptrs_String(end_r_2567, end_r_2568, loc_2676, tmpcur_5371); + CursorTy pvrtmp_5372 = tmp_struct_19.field0; + CursorTy pvrtmp_5373 = tmp_struct_19.field1; + CursorTy pvrtmp_5374 = tmp_struct_19.field2; + CursorTy pvrtmp_5375 = tmp_struct_19.field3; + + *(TagTyPacked *) loc_2566 = 1; + + CursorTy writetag_3881 = loc_2566 + 1; + + *(IntTy *) writetag_3881 = tmpval_5370; + + CursorTy writecur_3882 = writetag_3881 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_5372, pvrtmp_5373, + loc_2566, pvrtmp_5375}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5384 = *(CursorTy *) tmpcur_5365; + CursorTy tmpaftercur_5385 = tmpcur_5365 + 8; + CursorTy jump_3615 = tmpcur_5365 + 8; + CursorCursorCursorCursorProd tmp_struct_20 = + _copy_without_ptrs_String(end_r_2567, end_r_2568, loc_2566, tmpcur_5384); + CursorTy pvrtmp_5386 = tmp_struct_20.field0; + CursorTy pvrtmp_5387 = tmp_struct_20.field1; + CursorTy pvrtmp_5388 = tmp_struct_20.field2; + CursorTy pvrtmp_5389 = tmp_struct_20.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5386, jump_3615, + pvrtmp_5388, pvrtmp_5389}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5396 = *(CursorTy *) tmpcur_5365; + CursorTy tmpaftercur_5397 = tmpcur_5365 + 8; + CursorCursorCursorCursorProd tmp_struct_21 = + _copy_without_ptrs_String(end_r_2567, end_r_2568, loc_2566, tmpcur_5396); + CursorTy pvrtmp_5398 = tmp_struct_21.field0; + CursorTy pvrtmp_5399 = tmp_struct_21.field1; + CursorTy pvrtmp_5400 = tmp_struct_21.field2; + CursorTy pvrtmp_5401 = tmp_struct_21.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5398, pvrtmp_5399, + pvrtmp_5400, pvrtmp_5401}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5364"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2570, CursorTy arg_647_1259_1568) +{ + TagTyPacked tmpval_5409 = *(TagTyPacked *) arg_647_1259_1568; + CursorTy tmpcur_5410 = arg_647_1259_1568 + 1; + + + switch_5420: + ; + switch (tmpval_5409) { + + case 0: + { + CursorTy jump_3376 = arg_647_1259_1568 + 1; + + return (CursorProd) {jump_3376}; + break; + } + + case 1: + { + IntTy tmpval_5411 = *(IntTy *) tmpcur_5410; + CursorTy tmpcur_5412 = tmpcur_5410 + sizeof(IntTy); + CursorTy jump_3378 = tmpcur_5410 + 8; + CursorProd tmp_struct_22 = + _traverse_String(end_r_2570, tmpcur_5412); + CursorTy pvrtmp_5413 = tmp_struct_22.field0; + + return (CursorProd) {pvrtmp_5413}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5414 = *(CursorTy *) tmpcur_5410; + CursorTy tmpaftercur_5415 = tmpcur_5410 + 8; + CursorTy jump_3621 = tmpcur_5410 + 8; + CursorProd tmp_struct_23 = + _traverse_String(end_r_2570, tmpcur_5414); + CursorTy pvrtmp_5416 = tmp_struct_23.field0; + + return (CursorProd) {jump_3621}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5417 = *(CursorTy *) tmpcur_5410; + CursorTy tmpaftercur_5418 = tmpcur_5410 + 8; + CursorProd tmp_struct_24 = + _traverse_String(end_r_2570, tmpcur_5417); + CursorTy pvrtmp_5419 = tmp_struct_24.field0; + + return (CursorProd) {pvrtmp_5419}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5409"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2572, CursorTy arg_652_1263_1572) +{ + TagTyPacked tmpval_5421 = *(TagTyPacked *) arg_652_1263_1572; + CursorTy tmpcur_5422 = arg_652_1263_1572 + 1; + + + switch_5432: + ; + switch (tmpval_5421) { + + case 0: + { + CursorTy jump_3381 = arg_652_1263_1572 + 1; + unsigned char wildcard_653_1264_1573 = print_symbol(5245); + unsigned char wildcard_654_1265_1574 = print_symbol(5237); + + return (CursorProd) {jump_3381}; + break; + } + + case 1: + { + IntTy tmpval_5423 = *(IntTy *) tmpcur_5422; + CursorTy tmpcur_5424 = tmpcur_5422 + sizeof(IntTy); + CursorTy jump_3383 = tmpcur_5422 + 8; + unsigned char wildcard_659_1268_1577 = print_symbol(5246); + unsigned char y_657_1269_1578 = printf("%lld", tmpval_5423); + CursorProd tmp_struct_25 = _print_String(end_r_2572, tmpcur_5424); + CursorTy pvrtmp_5425 = tmp_struct_25.field0; + unsigned char wildcard_660_1271_1580 = print_symbol(5237); + + return (CursorProd) {pvrtmp_5425}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5426 = *(CursorTy *) tmpcur_5422; + CursorTy tmpaftercur_5427 = tmpcur_5422 + 8; + CursorTy jump_3627 = tmpcur_5422 + 8; + unsigned char wildcard_3630 = print_symbol(5254); + CursorProd tmp_struct_26 = _print_String(end_r_2572, tmpcur_5426); + CursorTy pvrtmp_5428 = tmp_struct_26.field0; + + return (CursorProd) {jump_3627}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5429 = *(CursorTy *) tmpcur_5422; + CursorTy tmpaftercur_5430 = tmpcur_5422 + 8; + unsigned char wildcard_3630 = print_symbol(5253); + CursorProd tmp_struct_27 = _print_String(end_r_2572, tmpcur_5429); + CursorTy pvrtmp_5431 = tmp_struct_27.field0; + + return (CursorProd) {pvrtmp_5431}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5421"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2575, + CursorTy end_r_2576, + CursorTy loc_2574, + CursorTy arg_661_1272_1581) +{ + if (loc_2574 + 32 > end_r_2576) { + ChunkTy new_chunk_32 = alloc_chunk(end_r_2576); + CursorTy chunk_start_33 = new_chunk_32.chunk_start; + CursorTy chunk_end_34 = new_chunk_32.chunk_end; + + end_r_2576 = chunk_end_34; + *(TagTyPacked *) loc_2574 = 255; + + CursorTy redir = loc_2574 + 1; + + *(CursorTy *) redir = chunk_start_33; + loc_2574 = chunk_start_33; + } + + TagTyPacked tmpval_5433 = *(TagTyPacked *) arg_661_1272_1581; + CursorTy tmpcur_5434 = arg_661_1272_1581 + 1; + + + switch_5483: + ; + switch (tmpval_5433) { + + case 0: + { + CursorTy loc_2698 = loc_2574 + 1; + CursorCursorCursorCursorProd tmp_struct_28 = + _copy_String(end_r_2575, end_r_2576, loc_2698, tmpcur_5434); + CursorTy pvrtmp_5435 = tmp_struct_28.field0; + CursorTy pvrtmp_5436 = tmp_struct_28.field1; + CursorTy pvrtmp_5437 = tmp_struct_28.field2; + CursorTy pvrtmp_5438 = tmp_struct_28.field3; + + *(TagTyPacked *) loc_2574 = 0; + + CursorTy writetag_3913 = loc_2574 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5435, pvrtmp_5436, + loc_2574, pvrtmp_5438}; + break; + } + + case 1: + { + CursorTy loc_2704 = loc_2574 + 1; + CursorCursorCursorCursorProd tmp_struct_29 = + _copy_String(end_r_2575, end_r_2576, loc_2704, tmpcur_5434); + CursorTy pvrtmp_5447 = tmp_struct_29.field0; + CursorTy pvrtmp_5448 = tmp_struct_29.field1; + CursorTy pvrtmp_5449 = tmp_struct_29.field2; + CursorTy pvrtmp_5450 = tmp_struct_29.field3; + + *(TagTyPacked *) loc_2574 = 1; + + CursorTy writetag_3918 = loc_2574 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5447, pvrtmp_5448, + loc_2574, pvrtmp_5450}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5459 = *(CursorTy *) tmpcur_5434; + CursorTy tmpaftercur_5460 = tmpcur_5434 + 8; + CursorTy jump_3633 = tmpcur_5434 + 8; + CursorCursorCursorCursorProd tmp_struct_30 = + _copy_Content(end_r_2575, end_r_2576, loc_2574, tmpcur_5459); + CursorTy pvrtmp_5461 = tmp_struct_30.field0; + CursorTy pvrtmp_5462 = tmp_struct_30.field1; + CursorTy pvrtmp_5463 = tmp_struct_30.field2; + CursorTy pvrtmp_5464 = tmp_struct_30.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5461, jump_3633, + pvrtmp_5463, pvrtmp_5464}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5471 = *(CursorTy *) tmpcur_5434; + CursorTy tmpaftercur_5472 = tmpcur_5434 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_Content(end_r_2575, end_r_2576, loc_2574, tmpcur_5471); + CursorTy pvrtmp_5473 = tmp_struct_31.field0; + CursorTy pvrtmp_5474 = tmp_struct_31.field1; + CursorTy pvrtmp_5475 = tmp_struct_31.field2; + CursorTy pvrtmp_5476 = tmp_struct_31.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5473, pvrtmp_5474, + pvrtmp_5475, pvrtmp_5476}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5433"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2579, + CursorTy end_r_2580, + CursorTy loc_2578, + CursorTy arg_666_1277_1586) +{ + TagTyPacked tmpval_5484 = *(TagTyPacked *) arg_666_1277_1586; + CursorTy tmpcur_5485 = arg_666_1277_1586 + 1; + + + switch_5534: + ; + switch (tmpval_5484) { + + case 0: + { + CursorTy loc_2712 = loc_2578 + 1; + CursorCursorCursorCursorProd tmp_struct_35 = + _copy_without_ptrs_String(end_r_2579, end_r_2580, loc_2712, tmpcur_5485); + CursorTy pvrtmp_5486 = tmp_struct_35.field0; + CursorTy pvrtmp_5487 = tmp_struct_35.field1; + CursorTy pvrtmp_5488 = tmp_struct_35.field2; + CursorTy pvrtmp_5489 = tmp_struct_35.field3; + + *(TagTyPacked *) loc_2578 = 0; + + CursorTy writetag_3929 = loc_2578 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5486, pvrtmp_5487, + loc_2578, pvrtmp_5489}; + break; + } + + case 1: + { + CursorTy loc_2718 = loc_2578 + 1; + CursorCursorCursorCursorProd tmp_struct_36 = + _copy_without_ptrs_String(end_r_2579, end_r_2580, loc_2718, tmpcur_5485); + CursorTy pvrtmp_5498 = tmp_struct_36.field0; + CursorTy pvrtmp_5499 = tmp_struct_36.field1; + CursorTy pvrtmp_5500 = tmp_struct_36.field2; + CursorTy pvrtmp_5501 = tmp_struct_36.field3; + + *(TagTyPacked *) loc_2578 = 1; + + CursorTy writetag_3934 = loc_2578 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5498, pvrtmp_5499, + loc_2578, pvrtmp_5501}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5510 = *(CursorTy *) tmpcur_5485; + CursorTy tmpaftercur_5511 = tmpcur_5485 + 8; + CursorTy jump_3639 = tmpcur_5485 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_Content(end_r_2579, end_r_2580, loc_2578, tmpcur_5510); + CursorTy pvrtmp_5512 = tmp_struct_37.field0; + CursorTy pvrtmp_5513 = tmp_struct_37.field1; + CursorTy pvrtmp_5514 = tmp_struct_37.field2; + CursorTy pvrtmp_5515 = tmp_struct_37.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5512, jump_3639, + pvrtmp_5514, pvrtmp_5515}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5522 = *(CursorTy *) tmpcur_5485; + CursorTy tmpaftercur_5523 = tmpcur_5485 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_Content(end_r_2579, end_r_2580, loc_2578, tmpcur_5522); + CursorTy pvrtmp_5524 = tmp_struct_38.field0; + CursorTy pvrtmp_5525 = tmp_struct_38.field1; + CursorTy pvrtmp_5526 = tmp_struct_38.field2; + CursorTy pvrtmp_5527 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5524, pvrtmp_5525, + pvrtmp_5526, pvrtmp_5527}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5484"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2582, CursorTy arg_671_1282_1591) +{ + TagTyPacked tmpval_5535 = *(TagTyPacked *) arg_671_1282_1591; + CursorTy tmpcur_5536 = arg_671_1282_1591 + 1; + + + switch_5545: + ; + switch (tmpval_5535) { + + case 0: + { + CursorProd tmp_struct_39 = + _traverse_String(end_r_2582, tmpcur_5536); + CursorTy pvrtmp_5537 = tmp_struct_39.field0; + + return (CursorProd) {pvrtmp_5537}; + break; + } + + case 1: + { + CursorProd tmp_struct_40 = + _traverse_String(end_r_2582, tmpcur_5536); + CursorTy pvrtmp_5538 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_5538}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5539 = *(CursorTy *) tmpcur_5536; + CursorTy tmpaftercur_5540 = tmpcur_5536 + 8; + CursorTy jump_3645 = tmpcur_5536 + 8; + CursorProd tmp_struct_41 = + _traverse_Content(end_r_2582, tmpcur_5539); + CursorTy pvrtmp_5541 = tmp_struct_41.field0; + + return (CursorProd) {jump_3645}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5542 = *(CursorTy *) tmpcur_5536; + CursorTy tmpaftercur_5543 = tmpcur_5536 + 8; + CursorProd tmp_struct_42 = + _traverse_Content(end_r_2582, tmpcur_5542); + CursorTy pvrtmp_5544 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_5544}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5535"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2584, CursorTy arg_676_1287_1596) +{ + TagTyPacked tmpval_5546 = *(TagTyPacked *) arg_676_1287_1596; + CursorTy tmpcur_5547 = arg_676_1287_1596 + 1; + + + switch_5556: + ; + switch (tmpval_5546) { + + case 0: + { + unsigned char wildcard_679_1289_1598 = print_symbol(5244); + CursorProd tmp_struct_43 = _print_String(end_r_2584, tmpcur_5547); + CursorTy pvrtmp_5548 = tmp_struct_43.field0; + unsigned char wildcard_680_1291_1600 = print_symbol(5237); + + return (CursorProd) {pvrtmp_5548}; + break; + } + + case 1: + { + unsigned char wildcard_683_1293_1602 = print_symbol(5238); + CursorProd tmp_struct_44 = _print_String(end_r_2584, tmpcur_5547); + CursorTy pvrtmp_5549 = tmp_struct_44.field0; + unsigned char wildcard_684_1295_1604 = print_symbol(5237); + + return (CursorProd) {pvrtmp_5549}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5550 = *(CursorTy *) tmpcur_5547; + CursorTy tmpaftercur_5551 = tmpcur_5547 + 8; + CursorTy jump_3651 = tmpcur_5547 + 8; + unsigned char wildcard_3654 = print_symbol(5254); + CursorProd tmp_struct_45 = _print_Content(end_r_2584, tmpcur_5550); + CursorTy pvrtmp_5552 = tmp_struct_45.field0; + + return (CursorProd) {jump_3651}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5553 = *(CursorTy *) tmpcur_5547; + CursorTy tmpaftercur_5554 = tmpcur_5547 + 8; + unsigned char wildcard_3654 = print_symbol(5253); + CursorProd tmp_struct_46 = _print_Content(end_r_2584, tmpcur_5553); + CursorTy pvrtmp_5555 = tmp_struct_46.field0; + + return (CursorProd) {pvrtmp_5555}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5546"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2587, CursorTy end_r_2588, + CursorTy loc_2586, + CursorTy arg_685_1296_1605) +{ + if (loc_2586 + 32 > end_r_2588) { + ChunkTy new_chunk_71 = alloc_chunk(end_r_2588); + CursorTy chunk_start_72 = new_chunk_71.chunk_start; + CursorTy chunk_end_73 = new_chunk_71.chunk_end; + + end_r_2588 = chunk_end_73; + *(TagTyPacked *) loc_2586 = 255; + + CursorTy redir = loc_2586 + 1; + + *(CursorTy *) redir = chunk_start_72; + loc_2586 = chunk_start_72; + } + + TagTyPacked tmpval_5557 = *(TagTyPacked *) arg_685_1296_1605; + CursorTy tmpcur_5558 = arg_685_1296_1605 + 1; + + + switch_5795: + ; + switch (tmpval_5557) { + + case 0: + { + CursorTy jump_3402 = arg_685_1296_1605 + 1; + + *(TagTyPacked *) loc_2586 = 0; + + CursorTy writetag_3964 = loc_2586 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2588, jump_3402, + loc_2586, writetag_3964}; + break; + } + + case 1: + { + CursorTy loc_2747 = loc_2586 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_Content(end_r_2587, end_r_2588, loc_2747, tmpcur_5558); + CursorTy pvrtmp_5563 = tmp_struct_47.field0; + CursorTy pvrtmp_5564 = tmp_struct_47.field1; + CursorTy pvrtmp_5565 = tmp_struct_47.field2; + CursorTy pvrtmp_5566 = tmp_struct_47.field3; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Adt(end_r_2587, pvrtmp_5563, pvrtmp_5566, pvrtmp_5564); + CursorTy pvrtmp_5571 = tmp_struct_48.field0; + CursorTy pvrtmp_5572 = tmp_struct_48.field1; + CursorTy pvrtmp_5573 = tmp_struct_48.field2; + CursorTy pvrtmp_5574 = tmp_struct_48.field3; + + *(TagTyPacked *) loc_2586 = 1; + + CursorTy writetag_3969 = loc_2586 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5571, pvrtmp_5572, + loc_2586, pvrtmp_5574}; + break; + } + + case 2: + { + CursorTy loc_2759 = loc_2586 + 1; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Adt(end_r_2587, end_r_2588, loc_2759, tmpcur_5558); + CursorTy pvrtmp_5583 = tmp_struct_49.field0; + CursorTy pvrtmp_5584 = tmp_struct_49.field1; + CursorTy pvrtmp_5585 = tmp_struct_49.field2; + CursorTy pvrtmp_5586 = tmp_struct_49.field3; + CursorCursorCursorCursorProd tmp_struct_50 = + _copy_Content(end_r_2587, pvrtmp_5583, pvrtmp_5586, pvrtmp_5584); + CursorTy pvrtmp_5591 = tmp_struct_50.field0; + CursorTy pvrtmp_5592 = tmp_struct_50.field1; + CursorTy pvrtmp_5593 = tmp_struct_50.field2; + CursorTy pvrtmp_5594 = tmp_struct_50.field3; + + *(TagTyPacked *) loc_2586 = 2; + + CursorTy writetag_3976 = loc_2586 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5591, pvrtmp_5592, + loc_2586, pvrtmp_5594}; + break; + } + + case 3: + { + CursorTy loc_2775 = loc_2586 + 1; + CursorCursorCursorCursorProd tmp_struct_51 = + _copy_Tags(end_r_2587, end_r_2588, loc_2775, tmpcur_5558); + CursorTy pvrtmp_5603 = tmp_struct_51.field0; + CursorTy pvrtmp_5604 = tmp_struct_51.field1; + CursorTy pvrtmp_5605 = tmp_struct_51.field2; + CursorTy pvrtmp_5606 = tmp_struct_51.field3; + CursorCursorCursorCursorProd tmp_struct_52 = + _copy_Content(end_r_2587, pvrtmp_5603, pvrtmp_5606, pvrtmp_5604); + CursorTy pvrtmp_5611 = tmp_struct_52.field0; + CursorTy pvrtmp_5612 = tmp_struct_52.field1; + CursorTy pvrtmp_5613 = tmp_struct_52.field2; + CursorTy pvrtmp_5614 = tmp_struct_52.field3; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_Adt(end_r_2587, pvrtmp_5611, pvrtmp_5614, pvrtmp_5612); + CursorTy pvrtmp_5619 = tmp_struct_53.field0; + CursorTy pvrtmp_5620 = tmp_struct_53.field1; + CursorTy pvrtmp_5621 = tmp_struct_53.field2; + CursorTy pvrtmp_5622 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2586 = 3; + + CursorTy writetag_3984 = loc_2586 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5619, pvrtmp_5620, + loc_2586, pvrtmp_5622}; + break; + } + + case 4: + { + CursorTy loc_2793 = loc_2586 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_Adt(end_r_2587, end_r_2588, loc_2793, tmpcur_5558); + CursorTy pvrtmp_5631 = tmp_struct_54.field0; + CursorTy pvrtmp_5632 = tmp_struct_54.field1; + CursorTy pvrtmp_5633 = tmp_struct_54.field2; + CursorTy pvrtmp_5634 = tmp_struct_54.field3; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_Content(end_r_2587, pvrtmp_5631, pvrtmp_5634, pvrtmp_5632); + CursorTy pvrtmp_5639 = tmp_struct_55.field0; + CursorTy pvrtmp_5640 = tmp_struct_55.field1; + CursorTy pvrtmp_5641 = tmp_struct_55.field2; + CursorTy pvrtmp_5642 = tmp_struct_55.field3; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_Tags(end_r_2587, pvrtmp_5639, pvrtmp_5642, pvrtmp_5640); + CursorTy pvrtmp_5647 = tmp_struct_56.field0; + CursorTy pvrtmp_5648 = tmp_struct_56.field1; + CursorTy pvrtmp_5649 = tmp_struct_56.field2; + CursorTy pvrtmp_5650 = tmp_struct_56.field3; + + *(TagTyPacked *) loc_2586 = 4; + + CursorTy writetag_3993 = loc_2586 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5647, pvrtmp_5648, + loc_2586, pvrtmp_5650}; + break; + } + + case 5: + { + CursorTy loc_2811 = loc_2586 + 1; + CursorCursorCursorCursorProd tmp_struct_57 = + _copy_Tags(end_r_2587, end_r_2588, loc_2811, tmpcur_5558); + CursorTy pvrtmp_5659 = tmp_struct_57.field0; + CursorTy pvrtmp_5660 = tmp_struct_57.field1; + CursorTy pvrtmp_5661 = tmp_struct_57.field2; + CursorTy pvrtmp_5662 = tmp_struct_57.field3; + CursorCursorCursorCursorProd tmp_struct_58 = + _copy_Adt(end_r_2587, pvrtmp_5659, pvrtmp_5662, pvrtmp_5660); + CursorTy pvrtmp_5667 = tmp_struct_58.field0; + CursorTy pvrtmp_5668 = tmp_struct_58.field1; + CursorTy pvrtmp_5669 = tmp_struct_58.field2; + CursorTy pvrtmp_5670 = tmp_struct_58.field3; + CursorCursorCursorCursorProd tmp_struct_59 = + _copy_Content(end_r_2587, pvrtmp_5667, pvrtmp_5670, pvrtmp_5668); + CursorTy pvrtmp_5675 = tmp_struct_59.field0; + CursorTy pvrtmp_5676 = tmp_struct_59.field1; + CursorTy pvrtmp_5677 = tmp_struct_59.field2; + CursorTy pvrtmp_5678 = tmp_struct_59.field3; + + *(TagTyPacked *) loc_2586 = 5; + + CursorTy writetag_4002 = loc_2586 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5675, pvrtmp_5676, + loc_2586, pvrtmp_5678}; + break; + } + + case 6: + { + CursorTy loc_2829 = loc_2586 + 1; + CursorCursorCursorCursorProd tmp_struct_60 = + _copy_Adt(end_r_2587, end_r_2588, loc_2829, tmpcur_5558); + CursorTy pvrtmp_5687 = tmp_struct_60.field0; + CursorTy pvrtmp_5688 = tmp_struct_60.field1; + CursorTy pvrtmp_5689 = tmp_struct_60.field2; + CursorTy pvrtmp_5690 = tmp_struct_60.field3; + CursorCursorCursorCursorProd tmp_struct_61 = + _copy_Tags(end_r_2587, pvrtmp_5687, pvrtmp_5690, pvrtmp_5688); + CursorTy pvrtmp_5695 = tmp_struct_61.field0; + CursorTy pvrtmp_5696 = tmp_struct_61.field1; + CursorTy pvrtmp_5697 = tmp_struct_61.field2; + CursorTy pvrtmp_5698 = tmp_struct_61.field3; + CursorCursorCursorCursorProd tmp_struct_62 = + _copy_Content(end_r_2587, pvrtmp_5695, pvrtmp_5698, pvrtmp_5696); + CursorTy pvrtmp_5703 = tmp_struct_62.field0; + CursorTy pvrtmp_5704 = tmp_struct_62.field1; + CursorTy pvrtmp_5705 = tmp_struct_62.field2; + CursorTy pvrtmp_5706 = tmp_struct_62.field3; + + *(TagTyPacked *) loc_2586 = 6; + + CursorTy writetag_4011 = loc_2586 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5703, pvrtmp_5704, + loc_2586, pvrtmp_5706}; + break; + } + + case 7: + { + CursorTy loc_2847 = loc_2586 + 1; + CursorCursorCursorCursorProd tmp_struct_63 = + _copy_Content(end_r_2587, end_r_2588, loc_2847, tmpcur_5558); + CursorTy pvrtmp_5715 = tmp_struct_63.field0; + CursorTy pvrtmp_5716 = tmp_struct_63.field1; + CursorTy pvrtmp_5717 = tmp_struct_63.field2; + CursorTy pvrtmp_5718 = tmp_struct_63.field3; + CursorCursorCursorCursorProd tmp_struct_64 = + _copy_Tags(end_r_2587, pvrtmp_5715, pvrtmp_5718, pvrtmp_5716); + CursorTy pvrtmp_5723 = tmp_struct_64.field0; + CursorTy pvrtmp_5724 = tmp_struct_64.field1; + CursorTy pvrtmp_5725 = tmp_struct_64.field2; + CursorTy pvrtmp_5726 = tmp_struct_64.field3; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Adt(end_r_2587, pvrtmp_5723, pvrtmp_5726, pvrtmp_5724); + CursorTy pvrtmp_5731 = tmp_struct_65.field0; + CursorTy pvrtmp_5732 = tmp_struct_65.field1; + CursorTy pvrtmp_5733 = tmp_struct_65.field2; + CursorTy pvrtmp_5734 = tmp_struct_65.field3; + + *(TagTyPacked *) loc_2586 = 7; + + CursorTy writetag_4020 = loc_2586 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5731, pvrtmp_5732, + loc_2586, pvrtmp_5734}; + break; + } + + case 8: + { + CursorTy loc_2865 = loc_2586 + 1; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Content(end_r_2587, end_r_2588, loc_2865, tmpcur_5558); + CursorTy pvrtmp_5743 = tmp_struct_66.field0; + CursorTy pvrtmp_5744 = tmp_struct_66.field1; + CursorTy pvrtmp_5745 = tmp_struct_66.field2; + CursorTy pvrtmp_5746 = tmp_struct_66.field3; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2587, pvrtmp_5743, pvrtmp_5746, pvrtmp_5744); + CursorTy pvrtmp_5751 = tmp_struct_67.field0; + CursorTy pvrtmp_5752 = tmp_struct_67.field1; + CursorTy pvrtmp_5753 = tmp_struct_67.field2; + CursorTy pvrtmp_5754 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Tags(end_r_2587, pvrtmp_5751, pvrtmp_5754, pvrtmp_5752); + CursorTy pvrtmp_5759 = tmp_struct_68.field0; + CursorTy pvrtmp_5760 = tmp_struct_68.field1; + CursorTy pvrtmp_5761 = tmp_struct_68.field2; + CursorTy pvrtmp_5762 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2586 = 8; + + CursorTy writetag_4029 = loc_2586 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5759, pvrtmp_5760, + loc_2586, pvrtmp_5762}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5771 = *(CursorTy *) tmpcur_5558; + CursorTy tmpaftercur_5772 = tmpcur_5558 + 8; + CursorTy jump_3657 = tmpcur_5558 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Adt(end_r_2587, end_r_2588, loc_2586, tmpcur_5771); + CursorTy pvrtmp_5773 = tmp_struct_69.field0; + CursorTy pvrtmp_5774 = tmp_struct_69.field1; + CursorTy pvrtmp_5775 = tmp_struct_69.field2; + CursorTy pvrtmp_5776 = tmp_struct_69.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5773, jump_3657, + pvrtmp_5775, pvrtmp_5776}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5783 = *(CursorTy *) tmpcur_5558; + CursorTy tmpaftercur_5784 = tmpcur_5558 + 8; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Adt(end_r_2587, end_r_2588, loc_2586, tmpcur_5783); + CursorTy pvrtmp_5785 = tmp_struct_70.field0; + CursorTy pvrtmp_5786 = tmp_struct_70.field1; + CursorTy pvrtmp_5787 = tmp_struct_70.field2; + CursorTy pvrtmp_5788 = tmp_struct_70.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5785, pvrtmp_5786, + pvrtmp_5787, pvrtmp_5788}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5557"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2591, + CursorTy end_r_2592, + CursorTy loc_2590, + CursorTy arg_730_1341_1650) +{ + TagTyPacked tmpval_5796 = *(TagTyPacked *) arg_730_1341_1650; + CursorTy tmpcur_5797 = arg_730_1341_1650 + 1; + + + switch_6034: + ; + switch (tmpval_5796) { + + case 0: + { + CursorTy jump_3434 = arg_730_1341_1650 + 1; + + *(TagTyPacked *) loc_2590 = 0; + + CursorTy writetag_4041 = loc_2590 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2592, jump_3434, + loc_2590, writetag_4041}; + break; + } + + case 1: + { + CursorTy loc_2882 = loc_2590 + 1; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_without_ptrs_Content(end_r_2591, end_r_2592, loc_2882, tmpcur_5797); + CursorTy pvrtmp_5802 = tmp_struct_74.field0; + CursorTy pvrtmp_5803 = tmp_struct_74.field1; + CursorTy pvrtmp_5804 = tmp_struct_74.field2; + CursorTy pvrtmp_5805 = tmp_struct_74.field3; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_without_ptrs_Adt(end_r_2591, pvrtmp_5802, pvrtmp_5805, pvrtmp_5803); + CursorTy pvrtmp_5810 = tmp_struct_75.field0; + CursorTy pvrtmp_5811 = tmp_struct_75.field1; + CursorTy pvrtmp_5812 = tmp_struct_75.field2; + CursorTy pvrtmp_5813 = tmp_struct_75.field3; + + *(TagTyPacked *) loc_2590 = 1; + + CursorTy writetag_4046 = loc_2590 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5810, pvrtmp_5811, + loc_2590, pvrtmp_5813}; + break; + } + + case 2: + { + CursorTy loc_2894 = loc_2590 + 1; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_without_ptrs_Adt(end_r_2591, end_r_2592, loc_2894, tmpcur_5797); + CursorTy pvrtmp_5822 = tmp_struct_76.field0; + CursorTy pvrtmp_5823 = tmp_struct_76.field1; + CursorTy pvrtmp_5824 = tmp_struct_76.field2; + CursorTy pvrtmp_5825 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_without_ptrs_Content(end_r_2591, pvrtmp_5822, pvrtmp_5825, pvrtmp_5823); + CursorTy pvrtmp_5830 = tmp_struct_77.field0; + CursorTy pvrtmp_5831 = tmp_struct_77.field1; + CursorTy pvrtmp_5832 = tmp_struct_77.field2; + CursorTy pvrtmp_5833 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2590 = 2; + + CursorTy writetag_4053 = loc_2590 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5830, pvrtmp_5831, + loc_2590, pvrtmp_5833}; + break; + } + + case 3: + { + CursorTy loc_2910 = loc_2590 + 1; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_without_ptrs_Tags(end_r_2591, end_r_2592, loc_2910, tmpcur_5797); + CursorTy pvrtmp_5842 = tmp_struct_78.field0; + CursorTy pvrtmp_5843 = tmp_struct_78.field1; + CursorTy pvrtmp_5844 = tmp_struct_78.field2; + CursorTy pvrtmp_5845 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_without_ptrs_Content(end_r_2591, pvrtmp_5842, pvrtmp_5845, pvrtmp_5843); + CursorTy pvrtmp_5850 = tmp_struct_79.field0; + CursorTy pvrtmp_5851 = tmp_struct_79.field1; + CursorTy pvrtmp_5852 = tmp_struct_79.field2; + CursorTy pvrtmp_5853 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_without_ptrs_Adt(end_r_2591, pvrtmp_5850, pvrtmp_5853, pvrtmp_5851); + CursorTy pvrtmp_5858 = tmp_struct_80.field0; + CursorTy pvrtmp_5859 = tmp_struct_80.field1; + CursorTy pvrtmp_5860 = tmp_struct_80.field2; + CursorTy pvrtmp_5861 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2590 = 3; + + CursorTy writetag_4061 = loc_2590 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5858, pvrtmp_5859, + loc_2590, pvrtmp_5861}; + break; + } + + case 4: + { + CursorTy loc_2928 = loc_2590 + 1; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_without_ptrs_Adt(end_r_2591, end_r_2592, loc_2928, tmpcur_5797); + CursorTy pvrtmp_5870 = tmp_struct_81.field0; + CursorTy pvrtmp_5871 = tmp_struct_81.field1; + CursorTy pvrtmp_5872 = tmp_struct_81.field2; + CursorTy pvrtmp_5873 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_without_ptrs_Content(end_r_2591, pvrtmp_5870, pvrtmp_5873, pvrtmp_5871); + CursorTy pvrtmp_5878 = tmp_struct_82.field0; + CursorTy pvrtmp_5879 = tmp_struct_82.field1; + CursorTy pvrtmp_5880 = tmp_struct_82.field2; + CursorTy pvrtmp_5881 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_without_ptrs_Tags(end_r_2591, pvrtmp_5878, pvrtmp_5881, pvrtmp_5879); + CursorTy pvrtmp_5886 = tmp_struct_83.field0; + CursorTy pvrtmp_5887 = tmp_struct_83.field1; + CursorTy pvrtmp_5888 = tmp_struct_83.field2; + CursorTy pvrtmp_5889 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2590 = 4; + + CursorTy writetag_4070 = loc_2590 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5886, pvrtmp_5887, + loc_2590, pvrtmp_5889}; + break; + } + + case 5: + { + CursorTy loc_2946 = loc_2590 + 1; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_without_ptrs_Tags(end_r_2591, end_r_2592, loc_2946, tmpcur_5797); + CursorTy pvrtmp_5898 = tmp_struct_84.field0; + CursorTy pvrtmp_5899 = tmp_struct_84.field1; + CursorTy pvrtmp_5900 = tmp_struct_84.field2; + CursorTy pvrtmp_5901 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_without_ptrs_Adt(end_r_2591, pvrtmp_5898, pvrtmp_5901, pvrtmp_5899); + CursorTy pvrtmp_5906 = tmp_struct_85.field0; + CursorTy pvrtmp_5907 = tmp_struct_85.field1; + CursorTy pvrtmp_5908 = tmp_struct_85.field2; + CursorTy pvrtmp_5909 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_without_ptrs_Content(end_r_2591, pvrtmp_5906, pvrtmp_5909, pvrtmp_5907); + CursorTy pvrtmp_5914 = tmp_struct_86.field0; + CursorTy pvrtmp_5915 = tmp_struct_86.field1; + CursorTy pvrtmp_5916 = tmp_struct_86.field2; + CursorTy pvrtmp_5917 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2590 = 5; + + CursorTy writetag_4079 = loc_2590 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5914, pvrtmp_5915, + loc_2590, pvrtmp_5917}; + break; + } + + case 6: + { + CursorTy loc_2964 = loc_2590 + 1; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_without_ptrs_Adt(end_r_2591, end_r_2592, loc_2964, tmpcur_5797); + CursorTy pvrtmp_5926 = tmp_struct_87.field0; + CursorTy pvrtmp_5927 = tmp_struct_87.field1; + CursorTy pvrtmp_5928 = tmp_struct_87.field2; + CursorTy pvrtmp_5929 = tmp_struct_87.field3; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_without_ptrs_Tags(end_r_2591, pvrtmp_5926, pvrtmp_5929, pvrtmp_5927); + CursorTy pvrtmp_5934 = tmp_struct_88.field0; + CursorTy pvrtmp_5935 = tmp_struct_88.field1; + CursorTy pvrtmp_5936 = tmp_struct_88.field2; + CursorTy pvrtmp_5937 = tmp_struct_88.field3; + CursorCursorCursorCursorProd tmp_struct_89 = + _copy_without_ptrs_Content(end_r_2591, pvrtmp_5934, pvrtmp_5937, pvrtmp_5935); + CursorTy pvrtmp_5942 = tmp_struct_89.field0; + CursorTy pvrtmp_5943 = tmp_struct_89.field1; + CursorTy pvrtmp_5944 = tmp_struct_89.field2; + CursorTy pvrtmp_5945 = tmp_struct_89.field3; + + *(TagTyPacked *) loc_2590 = 6; + + CursorTy writetag_4088 = loc_2590 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5942, pvrtmp_5943, + loc_2590, pvrtmp_5945}; + break; + } + + case 7: + { + CursorTy loc_2982 = loc_2590 + 1; + CursorCursorCursorCursorProd tmp_struct_90 = + _copy_without_ptrs_Content(end_r_2591, end_r_2592, loc_2982, tmpcur_5797); + CursorTy pvrtmp_5954 = tmp_struct_90.field0; + CursorTy pvrtmp_5955 = tmp_struct_90.field1; + CursorTy pvrtmp_5956 = tmp_struct_90.field2; + CursorTy pvrtmp_5957 = tmp_struct_90.field3; + CursorCursorCursorCursorProd tmp_struct_91 = + _copy_without_ptrs_Tags(end_r_2591, pvrtmp_5954, pvrtmp_5957, pvrtmp_5955); + CursorTy pvrtmp_5962 = tmp_struct_91.field0; + CursorTy pvrtmp_5963 = tmp_struct_91.field1; + CursorTy pvrtmp_5964 = tmp_struct_91.field2; + CursorTy pvrtmp_5965 = tmp_struct_91.field3; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Adt(end_r_2591, pvrtmp_5962, pvrtmp_5965, pvrtmp_5963); + CursorTy pvrtmp_5970 = tmp_struct_92.field0; + CursorTy pvrtmp_5971 = tmp_struct_92.field1; + CursorTy pvrtmp_5972 = tmp_struct_92.field2; + CursorTy pvrtmp_5973 = tmp_struct_92.field3; + + *(TagTyPacked *) loc_2590 = 7; + + CursorTy writetag_4097 = loc_2590 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5970, pvrtmp_5971, + loc_2590, pvrtmp_5973}; + break; + } + + case 8: + { + CursorTy loc_3000 = loc_2590 + 1; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Content(end_r_2591, end_r_2592, loc_3000, tmpcur_5797); + CursorTy pvrtmp_5982 = tmp_struct_93.field0; + CursorTy pvrtmp_5983 = tmp_struct_93.field1; + CursorTy pvrtmp_5984 = tmp_struct_93.field2; + CursorTy pvrtmp_5985 = tmp_struct_93.field3; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2591, pvrtmp_5982, pvrtmp_5985, pvrtmp_5983); + CursorTy pvrtmp_5990 = tmp_struct_94.field0; + CursorTy pvrtmp_5991 = tmp_struct_94.field1; + CursorTy pvrtmp_5992 = tmp_struct_94.field2; + CursorTy pvrtmp_5993 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Tags(end_r_2591, pvrtmp_5990, pvrtmp_5993, pvrtmp_5991); + CursorTy pvrtmp_5998 = tmp_struct_95.field0; + CursorTy pvrtmp_5999 = tmp_struct_95.field1; + CursorTy pvrtmp_6000 = tmp_struct_95.field2; + CursorTy pvrtmp_6001 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2590 = 8; + + CursorTy writetag_4106 = loc_2590 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_5998, pvrtmp_5999, + loc_2590, pvrtmp_6001}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6010 = *(CursorTy *) tmpcur_5797; + CursorTy tmpaftercur_6011 = tmpcur_5797 + 8; + CursorTy jump_3663 = tmpcur_5797 + 8; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Adt(end_r_2591, end_r_2592, loc_2590, tmpcur_6010); + CursorTy pvrtmp_6012 = tmp_struct_96.field0; + CursorTy pvrtmp_6013 = tmp_struct_96.field1; + CursorTy pvrtmp_6014 = tmp_struct_96.field2; + CursorTy pvrtmp_6015 = tmp_struct_96.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6012, jump_3663, + pvrtmp_6014, pvrtmp_6015}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6022 = *(CursorTy *) tmpcur_5797; + CursorTy tmpaftercur_6023 = tmpcur_5797 + 8; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Adt(end_r_2591, end_r_2592, loc_2590, tmpcur_6022); + CursorTy pvrtmp_6024 = tmp_struct_97.field0; + CursorTy pvrtmp_6025 = tmp_struct_97.field1; + CursorTy pvrtmp_6026 = tmp_struct_97.field2; + CursorTy pvrtmp_6027 = tmp_struct_97.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6024, pvrtmp_6025, + pvrtmp_6026, pvrtmp_6027}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5796"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2594, CursorTy arg_775_1386_1695) +{ + TagTyPacked tmpval_6035 = *(TagTyPacked *) arg_775_1386_1695; + CursorTy tmpcur_6036 = arg_775_1386_1695 + 1; + + + switch_6065: + ; + switch (tmpval_6035) { + + case 0: + { + CursorTy jump_3466 = arg_775_1386_1695 + 1; + + return (CursorProd) {jump_3466}; + break; + } + + case 1: + { + CursorProd tmp_struct_98 = + _traverse_Content(end_r_2594, tmpcur_6036); + CursorTy pvrtmp_6037 = tmp_struct_98.field0; + CursorProd tmp_struct_99 = _traverse_Adt(end_r_2594, pvrtmp_6037); + CursorTy pvrtmp_6038 = tmp_struct_99.field0; + + return (CursorProd) {pvrtmp_6038}; + break; + } + + case 2: + { + CursorProd tmp_struct_100 = _traverse_Adt(end_r_2594, tmpcur_6036); + CursorTy pvrtmp_6039 = tmp_struct_100.field0; + CursorProd tmp_struct_101 = + _traverse_Content(end_r_2594, pvrtmp_6039); + CursorTy pvrtmp_6040 = tmp_struct_101.field0; + + return (CursorProd) {pvrtmp_6040}; + break; + } + + case 3: + { + CursorProd tmp_struct_102 = + _traverse_Tags(end_r_2594, tmpcur_6036); + CursorTy pvrtmp_6041 = tmp_struct_102.field0; + CursorProd tmp_struct_103 = + _traverse_Content(end_r_2594, pvrtmp_6041); + CursorTy pvrtmp_6042 = tmp_struct_103.field0; + CursorProd tmp_struct_104 = _traverse_Adt(end_r_2594, pvrtmp_6042); + CursorTy pvrtmp_6043 = tmp_struct_104.field0; + + return (CursorProd) {pvrtmp_6043}; + break; + } + + case 4: + { + CursorProd tmp_struct_105 = _traverse_Adt(end_r_2594, tmpcur_6036); + CursorTy pvrtmp_6044 = tmp_struct_105.field0; + CursorProd tmp_struct_106 = + _traverse_Content(end_r_2594, pvrtmp_6044); + CursorTy pvrtmp_6045 = tmp_struct_106.field0; + CursorProd tmp_struct_107 = + _traverse_Tags(end_r_2594, pvrtmp_6045); + CursorTy pvrtmp_6046 = tmp_struct_107.field0; + + return (CursorProd) {pvrtmp_6046}; + break; + } + + case 5: + { + CursorProd tmp_struct_108 = + _traverse_Tags(end_r_2594, tmpcur_6036); + CursorTy pvrtmp_6047 = tmp_struct_108.field0; + CursorProd tmp_struct_109 = _traverse_Adt(end_r_2594, pvrtmp_6047); + CursorTy pvrtmp_6048 = tmp_struct_109.field0; + CursorProd tmp_struct_110 = + _traverse_Content(end_r_2594, pvrtmp_6048); + CursorTy pvrtmp_6049 = tmp_struct_110.field0; + + return (CursorProd) {pvrtmp_6049}; + break; + } + + case 6: + { + CursorProd tmp_struct_111 = _traverse_Adt(end_r_2594, tmpcur_6036); + CursorTy pvrtmp_6050 = tmp_struct_111.field0; + CursorProd tmp_struct_112 = + _traverse_Tags(end_r_2594, pvrtmp_6050); + CursorTy pvrtmp_6051 = tmp_struct_112.field0; + CursorProd tmp_struct_113 = + _traverse_Content(end_r_2594, pvrtmp_6051); + CursorTy pvrtmp_6052 = tmp_struct_113.field0; + + return (CursorProd) {pvrtmp_6052}; + break; + } + + case 7: + { + CursorProd tmp_struct_114 = + _traverse_Content(end_r_2594, tmpcur_6036); + CursorTy pvrtmp_6053 = tmp_struct_114.field0; + CursorProd tmp_struct_115 = + _traverse_Tags(end_r_2594, pvrtmp_6053); + CursorTy pvrtmp_6054 = tmp_struct_115.field0; + CursorProd tmp_struct_116 = _traverse_Adt(end_r_2594, pvrtmp_6054); + CursorTy pvrtmp_6055 = tmp_struct_116.field0; + + return (CursorProd) {pvrtmp_6055}; + break; + } + + case 8: + { + CursorProd tmp_struct_117 = + _traverse_Content(end_r_2594, tmpcur_6036); + CursorTy pvrtmp_6056 = tmp_struct_117.field0; + CursorProd tmp_struct_118 = _traverse_Adt(end_r_2594, pvrtmp_6056); + CursorTy pvrtmp_6057 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Tags(end_r_2594, pvrtmp_6057); + CursorTy pvrtmp_6058 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_6058}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6059 = *(CursorTy *) tmpcur_6036; + CursorTy tmpaftercur_6060 = tmpcur_6036 + 8; + CursorTy jump_3669 = tmpcur_6036 + 8; + CursorProd tmp_struct_120 = _traverse_Adt(end_r_2594, tmpcur_6059); + CursorTy pvrtmp_6061 = tmp_struct_120.field0; + + return (CursorProd) {jump_3669}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6062 = *(CursorTy *) tmpcur_6036; + CursorTy tmpaftercur_6063 = tmpcur_6036 + 8; + CursorProd tmp_struct_121 = _traverse_Adt(end_r_2594, tmpcur_6062); + CursorTy pvrtmp_6064 = tmp_struct_121.field0; + + return (CursorProd) {pvrtmp_6064}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6035"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2596, CursorTy arg_820_1431_1740) +{ + TagTyPacked tmpval_6066 = *(TagTyPacked *) arg_820_1431_1740; + CursorTy tmpcur_6067 = arg_820_1431_1740 + 1; + + + switch_6096: + ; + switch (tmpval_6066) { + + case 0: + { + CursorTy jump_3498 = arg_820_1431_1740 + 1; + unsigned char wildcard_821_1432_1741 = print_symbol(5243); + unsigned char wildcard_822_1433_1742 = print_symbol(5237); + + return (CursorProd) {jump_3498}; + break; + } + + case 1: + { + unsigned char wildcard_827_1436_1745 = print_symbol(5249); + CursorProd tmp_struct_122 = + _print_Content(end_r_2596, tmpcur_6067); + CursorTy pvrtmp_6068 = tmp_struct_122.field0; + CursorProd tmp_struct_123 = _print_Adt(end_r_2596, pvrtmp_6068); + CursorTy pvrtmp_6069 = tmp_struct_123.field0; + unsigned char wildcard_828_1439_1748 = print_symbol(5237); + + return (CursorProd) {pvrtmp_6069}; + break; + } + + case 2: + { + unsigned char wildcard_833_1442_1751 = print_symbol(5252); + CursorProd tmp_struct_124 = _print_Adt(end_r_2596, tmpcur_6067); + CursorTy pvrtmp_6070 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _print_Content(end_r_2596, pvrtmp_6070); + CursorTy pvrtmp_6071 = tmp_struct_125.field0; + unsigned char wildcard_834_1445_1754 = print_symbol(5237); + + return (CursorProd) {pvrtmp_6071}; + break; + } + + case 3: + { + unsigned char wildcard_841_1449_1758 = print_symbol(5240); + CursorProd tmp_struct_126 = _print_Tags(end_r_2596, tmpcur_6067); + CursorTy pvrtmp_6072 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = + _print_Content(end_r_2596, pvrtmp_6072); + CursorTy pvrtmp_6073 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = _print_Adt(end_r_2596, pvrtmp_6073); + CursorTy pvrtmp_6074 = tmp_struct_128.field0; + unsigned char wildcard_842_1453_1762 = print_symbol(5237); + + return (CursorProd) {pvrtmp_6074}; + break; + } + + case 4: + { + unsigned char wildcard_849_1457_1766 = print_symbol(5251); + CursorProd tmp_struct_129 = _print_Adt(end_r_2596, tmpcur_6067); + CursorTy pvrtmp_6075 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _print_Content(end_r_2596, pvrtmp_6075); + CursorTy pvrtmp_6076 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = _print_Tags(end_r_2596, pvrtmp_6076); + CursorTy pvrtmp_6077 = tmp_struct_131.field0; + unsigned char wildcard_850_1461_1770 = print_symbol(5237); + + return (CursorProd) {pvrtmp_6077}; + break; + } + + case 5: + { + unsigned char wildcard_857_1465_1774 = print_symbol(5241); + CursorProd tmp_struct_132 = _print_Tags(end_r_2596, tmpcur_6067); + CursorTy pvrtmp_6078 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = _print_Adt(end_r_2596, pvrtmp_6078); + CursorTy pvrtmp_6079 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = + _print_Content(end_r_2596, pvrtmp_6079); + CursorTy pvrtmp_6080 = tmp_struct_134.field0; + unsigned char wildcard_858_1469_1778 = print_symbol(5237); + + return (CursorProd) {pvrtmp_6080}; + break; + } + + case 6: + { + unsigned char wildcard_865_1473_1782 = print_symbol(5250); + CursorProd tmp_struct_135 = _print_Adt(end_r_2596, tmpcur_6067); + CursorTy pvrtmp_6081 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _print_Tags(end_r_2596, pvrtmp_6081); + CursorTy pvrtmp_6082 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _print_Content(end_r_2596, pvrtmp_6082); + CursorTy pvrtmp_6083 = tmp_struct_137.field0; + unsigned char wildcard_866_1477_1786 = print_symbol(5237); + + return (CursorProd) {pvrtmp_6083}; + break; + } + + case 7: + { + unsigned char wildcard_873_1481_1790 = print_symbol(5247); + CursorProd tmp_struct_138 = + _print_Content(end_r_2596, tmpcur_6067); + CursorTy pvrtmp_6084 = tmp_struct_138.field0; + CursorProd tmp_struct_139 = _print_Tags(end_r_2596, pvrtmp_6084); + CursorTy pvrtmp_6085 = tmp_struct_139.field0; + CursorProd tmp_struct_140 = _print_Adt(end_r_2596, pvrtmp_6085); + CursorTy pvrtmp_6086 = tmp_struct_140.field0; + unsigned char wildcard_874_1485_1794 = print_symbol(5237); + + return (CursorProd) {pvrtmp_6086}; + break; + } + + case 8: + { + unsigned char wildcard_881_1489_1798 = print_symbol(5248); + CursorProd tmp_struct_141 = + _print_Content(end_r_2596, tmpcur_6067); + CursorTy pvrtmp_6087 = tmp_struct_141.field0; + CursorProd tmp_struct_142 = _print_Adt(end_r_2596, pvrtmp_6087); + CursorTy pvrtmp_6088 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = _print_Tags(end_r_2596, pvrtmp_6088); + CursorTy pvrtmp_6089 = tmp_struct_143.field0; + unsigned char wildcard_882_1493_1802 = print_symbol(5237); + + return (CursorProd) {pvrtmp_6089}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6090 = *(CursorTy *) tmpcur_6067; + CursorTy tmpaftercur_6091 = tmpcur_6067 + 8; + CursorTy jump_3675 = tmpcur_6067 + 8; + unsigned char wildcard_3678 = print_symbol(5254); + CursorProd tmp_struct_144 = _print_Adt(end_r_2596, tmpcur_6090); + CursorTy pvrtmp_6092 = tmp_struct_144.field0; + + return (CursorProd) {jump_3675}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6093 = *(CursorTy *) tmpcur_6067; + CursorTy tmpaftercur_6094 = tmpcur_6067 + 8; + unsigned char wildcard_3678 = print_symbol(5253); + CursorProd tmp_struct_145 = _print_Adt(end_r_2596, tmpcur_6093); + CursorTy pvrtmp_6095 = tmp_struct_145.field0; + + return (CursorProd) {pvrtmp_6095}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6066"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2599, + CursorTy end_r_2600, CursorTy loc_2598, + CursorTy arg_883_1494_1803) +{ + if (loc_2598 + 32 > end_r_2600) { + ChunkTy new_chunk_149 = alloc_chunk(end_r_2600); + CursorTy chunk_start_150 = new_chunk_149.chunk_start; + CursorTy chunk_end_151 = new_chunk_149.chunk_end; + + end_r_2600 = chunk_end_151; + *(TagTyPacked *) loc_2598 = 255; + + CursorTy redir = loc_2598 + 1; + + *(CursorTy *) redir = chunk_start_150; + loc_2598 = chunk_start_150; + } + + CursorTy loc_3150 = loc_2598 + 1; + CursorTy loc_3151 = loc_3150 + 8; + TagTyPacked tmpval_6097 = *(TagTyPacked *) arg_883_1494_1803; + CursorTy tmpcur_6098 = arg_883_1494_1803 + 1; + + + switch_6141: + ; + switch (tmpval_6097) { + + case 0: + { + CursorTy jump_3530 = arg_883_1494_1803 + 1; + + *(TagTyPacked *) loc_2598 = 0; + + CursorTy writetag_4192 = loc_2598 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2600, jump_3530, + loc_2598, writetag_4192}; + break; + } + + case 1: + { + IntTy tmpval_6103 = *(IntTy *) tmpcur_6098; + CursorTy tmpcur_6104 = tmpcur_6098 + sizeof(IntTy); + CursorTy jump_3532 = tmpcur_6098 + 8; + CursorCursorCursorCursorProd tmp_struct_146 = + _copy_Tags(end_r_2599, end_r_2600, loc_3151, tmpcur_6104); + CursorTy pvrtmp_6105 = tmp_struct_146.field0; + CursorTy pvrtmp_6106 = tmp_struct_146.field1; + CursorTy pvrtmp_6107 = tmp_struct_146.field2; + CursorTy pvrtmp_6108 = tmp_struct_146.field3; + + *(TagTyPacked *) loc_2598 = 1; + + CursorTy writetag_4197 = loc_2598 + 1; + + *(IntTy *) writetag_4197 = tmpval_6103; + + CursorTy writecur_4198 = writetag_4197 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6105, pvrtmp_6106, + loc_2598, pvrtmp_6108}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6117 = *(CursorTy *) tmpcur_6098; + CursorTy tmpaftercur_6118 = tmpcur_6098 + 8; + CursorTy jump_3681 = tmpcur_6098 + 8; + CursorCursorCursorCursorProd tmp_struct_147 = + _copy_Tags(end_r_2599, end_r_2600, loc_2598, tmpcur_6117); + CursorTy pvrtmp_6119 = tmp_struct_147.field0; + CursorTy pvrtmp_6120 = tmp_struct_147.field1; + CursorTy pvrtmp_6121 = tmp_struct_147.field2; + CursorTy pvrtmp_6122 = tmp_struct_147.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6119, jump_3681, + pvrtmp_6121, pvrtmp_6122}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6129 = *(CursorTy *) tmpcur_6098; + CursorTy tmpaftercur_6130 = tmpcur_6098 + 8; + CursorCursorCursorCursorProd tmp_struct_148 = + _copy_Tags(end_r_2599, end_r_2600, loc_2598, tmpcur_6129); + CursorTy pvrtmp_6131 = tmp_struct_148.field0; + CursorTy pvrtmp_6132 = tmp_struct_148.field1; + CursorTy pvrtmp_6133 = tmp_struct_148.field2; + CursorTy pvrtmp_6134 = tmp_struct_148.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6131, pvrtmp_6132, + pvrtmp_6133, pvrtmp_6134}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6097"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2603, + CursorTy end_r_2604, + CursorTy loc_2602, + CursorTy arg_888_1499_1808) +{ + CursorTy loc_3163 = loc_2602 + 1; + CursorTy loc_3164 = loc_3163 + 8; + TagTyPacked tmpval_6142 = *(TagTyPacked *) arg_888_1499_1808; + CursorTy tmpcur_6143 = arg_888_1499_1808 + 1; + + + switch_6186: + ; + switch (tmpval_6142) { + + case 0: + { + CursorTy jump_3535 = arg_888_1499_1808 + 1; + + *(TagTyPacked *) loc_2602 = 0; + + CursorTy writetag_4208 = loc_2602 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2604, jump_3535, + loc_2602, writetag_4208}; + break; + } + + case 1: + { + IntTy tmpval_6148 = *(IntTy *) tmpcur_6143; + CursorTy tmpcur_6149 = tmpcur_6143 + sizeof(IntTy); + CursorTy jump_3537 = tmpcur_6143 + 8; + CursorCursorCursorCursorProd tmp_struct_152 = + _copy_without_ptrs_Tags(end_r_2603, end_r_2604, loc_3164, tmpcur_6149); + CursorTy pvrtmp_6150 = tmp_struct_152.field0; + CursorTy pvrtmp_6151 = tmp_struct_152.field1; + CursorTy pvrtmp_6152 = tmp_struct_152.field2; + CursorTy pvrtmp_6153 = tmp_struct_152.field3; + + *(TagTyPacked *) loc_2602 = 1; + + CursorTy writetag_4213 = loc_2602 + 1; + + *(IntTy *) writetag_4213 = tmpval_6148; + + CursorTy writecur_4214 = writetag_4213 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6150, pvrtmp_6151, + loc_2602, pvrtmp_6153}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6162 = *(CursorTy *) tmpcur_6143; + CursorTy tmpaftercur_6163 = tmpcur_6143 + 8; + CursorTy jump_3687 = tmpcur_6143 + 8; + CursorCursorCursorCursorProd tmp_struct_153 = + _copy_without_ptrs_Tags(end_r_2603, end_r_2604, loc_2602, tmpcur_6162); + CursorTy pvrtmp_6164 = tmp_struct_153.field0; + CursorTy pvrtmp_6165 = tmp_struct_153.field1; + CursorTy pvrtmp_6166 = tmp_struct_153.field2; + CursorTy pvrtmp_6167 = tmp_struct_153.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6164, jump_3687, + pvrtmp_6166, pvrtmp_6167}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6174 = *(CursorTy *) tmpcur_6143; + CursorTy tmpaftercur_6175 = tmpcur_6143 + 8; + CursorCursorCursorCursorProd tmp_struct_154 = + _copy_without_ptrs_Tags(end_r_2603, end_r_2604, loc_2602, tmpcur_6174); + CursorTy pvrtmp_6176 = tmp_struct_154.field0; + CursorTy pvrtmp_6177 = tmp_struct_154.field1; + CursorTy pvrtmp_6178 = tmp_struct_154.field2; + CursorTy pvrtmp_6179 = tmp_struct_154.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6176, pvrtmp_6177, + pvrtmp_6178, pvrtmp_6179}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6142"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2606, CursorTy arg_893_1504_1813) +{ + TagTyPacked tmpval_6187 = *(TagTyPacked *) arg_893_1504_1813; + CursorTy tmpcur_6188 = arg_893_1504_1813 + 1; + + + switch_6198: + ; + switch (tmpval_6187) { + + case 0: + { + CursorTy jump_3540 = arg_893_1504_1813 + 1; + + return (CursorProd) {jump_3540}; + break; + } + + case 1: + { + IntTy tmpval_6189 = *(IntTy *) tmpcur_6188; + CursorTy tmpcur_6190 = tmpcur_6188 + sizeof(IntTy); + CursorTy jump_3542 = tmpcur_6188 + 8; + CursorProd tmp_struct_155 = + _traverse_Tags(end_r_2606, tmpcur_6190); + CursorTy pvrtmp_6191 = tmp_struct_155.field0; + + return (CursorProd) {pvrtmp_6191}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6192 = *(CursorTy *) tmpcur_6188; + CursorTy tmpaftercur_6193 = tmpcur_6188 + 8; + CursorTy jump_3693 = tmpcur_6188 + 8; + CursorProd tmp_struct_156 = + _traverse_Tags(end_r_2606, tmpcur_6192); + CursorTy pvrtmp_6194 = tmp_struct_156.field0; + + return (CursorProd) {jump_3693}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6195 = *(CursorTy *) tmpcur_6188; + CursorTy tmpaftercur_6196 = tmpcur_6188 + 8; + CursorProd tmp_struct_157 = + _traverse_Tags(end_r_2606, tmpcur_6195); + CursorTy pvrtmp_6197 = tmp_struct_157.field0; + + return (CursorProd) {pvrtmp_6197}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6187"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2608, CursorTy arg_898_1508_1817) +{ + TagTyPacked tmpval_6199 = *(TagTyPacked *) arg_898_1508_1817; + CursorTy tmpcur_6200 = arg_898_1508_1817 + 1; + + + switch_6210: + ; + switch (tmpval_6199) { + + case 0: + { + CursorTy jump_3545 = arg_898_1508_1817 + 1; + unsigned char wildcard_899_1509_1818 = print_symbol(5242); + unsigned char wildcard_900_1510_1819 = print_symbol(5237); + + return (CursorProd) {jump_3545}; + break; + } + + case 1: + { + IntTy tmpval_6201 = *(IntTy *) tmpcur_6200; + CursorTy tmpcur_6202 = tmpcur_6200 + sizeof(IntTy); + CursorTy jump_3547 = tmpcur_6200 + 8; + unsigned char wildcard_905_1513_1822 = print_symbol(5239); + unsigned char y_903_1514_1823 = printf("%lld", tmpval_6201); + CursorProd tmp_struct_158 = _print_Tags(end_r_2608, tmpcur_6202); + CursorTy pvrtmp_6203 = tmp_struct_158.field0; + unsigned char wildcard_906_1516_1825 = print_symbol(5237); + + return (CursorProd) {pvrtmp_6203}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6204 = *(CursorTy *) tmpcur_6200; + CursorTy tmpaftercur_6205 = tmpcur_6200 + 8; + CursorTy jump_3699 = tmpcur_6200 + 8; + unsigned char wildcard_3702 = print_symbol(5254); + CursorProd tmp_struct_159 = _print_Tags(end_r_2608, tmpcur_6204); + CursorTy pvrtmp_6206 = tmp_struct_159.field0; + + return (CursorProd) {jump_3699}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6207 = *(CursorTy *) tmpcur_6200; + CursorTy tmpaftercur_6208 = tmpcur_6200 + 8; + unsigned char wildcard_3702 = print_symbol(5253); + CursorProd tmp_struct_160 = _print_Tags(end_r_2608, tmpcur_6207); + CursorTy pvrtmp_6209 = tmp_struct_160.field0; + + return (CursorProd) {pvrtmp_6209}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6199"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2611, + CursorTy end_r_2612, + CursorTy loc_2610, + CursorTy arg_2467) +{ + if (loc_2610 + 32 > end_r_2612) { + ChunkTy new_chunk_164 = alloc_chunk(end_r_2612); + CursorTy chunk_start_165 = new_chunk_164.chunk_start; + CursorTy chunk_end_166 = new_chunk_164.chunk_end; + + end_r_2612 = chunk_end_166; + *(TagTyPacked *) loc_2610 = 255; + + CursorTy redir = loc_2610 + 1; + + *(CursorTy *) redir = chunk_start_165; + loc_2610 = chunk_start_165; + } + + CursorTy loc_3188 = loc_2610 + 1; + CursorTy loc_3189 = loc_3188 + 8; + TagTyPacked tmpval_6211 = *(TagTyPacked *) arg_2467; + CursorTy tmpcur_6212 = arg_2467 + 1; + + + switch_6255: + ; + switch (tmpval_6211) { + + case 0: + { + CursorTy jump_3550 = arg_2467 + 1; + + *(TagTyPacked *) loc_2610 = 0; + + CursorTy writetag_4244 = loc_2610 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2612, jump_3550, + loc_2610, writetag_4244}; + break; + } + + case 1: + { + IntTy tmpval_6217 = *(IntTy *) tmpcur_6212; + CursorTy tmpcur_6218 = tmpcur_6212 + sizeof(IntTy); + CursorTy jump_3552 = tmpcur_6212 + 8; + CursorCursorCursorCursorProd tmp_struct_161 = + _add_size_and_rel_offsets_String(end_r_2611, end_r_2612, loc_3189, tmpcur_6218); + CursorTy pvrtmp_6219 = tmp_struct_161.field0; + CursorTy pvrtmp_6220 = tmp_struct_161.field1; + CursorTy pvrtmp_6221 = tmp_struct_161.field2; + CursorTy pvrtmp_6222 = tmp_struct_161.field3; + + *(TagTyPacked *) loc_2610 = 1; + + CursorTy writetag_4249 = loc_2610 + 1; + + *(IntTy *) writetag_4249 = tmpval_6217; + + CursorTy writecur_4250 = writetag_4249 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6219, pvrtmp_6220, + loc_2610, pvrtmp_6222}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6231 = *(CursorTy *) tmpcur_6212; + CursorTy tmpaftercur_6232 = tmpcur_6212 + 8; + CursorTy jump_3705 = tmpcur_6212 + 8; + CursorCursorCursorCursorProd tmp_struct_162 = + _add_size_and_rel_offsets_String(end_r_2611, end_r_2612, loc_2610, tmpcur_6231); + CursorTy pvrtmp_6233 = tmp_struct_162.field0; + CursorTy pvrtmp_6234 = tmp_struct_162.field1; + CursorTy pvrtmp_6235 = tmp_struct_162.field2; + CursorTy pvrtmp_6236 = tmp_struct_162.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6233, jump_3705, + pvrtmp_6235, pvrtmp_6236}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6243 = *(CursorTy *) tmpcur_6212; + CursorTy tmpaftercur_6244 = tmpcur_6212 + 8; + CursorCursorCursorCursorProd tmp_struct_163 = + _add_size_and_rel_offsets_String(end_r_2611, end_r_2612, loc_2610, tmpcur_6243); + CursorTy pvrtmp_6245 = tmp_struct_163.field0; + CursorTy pvrtmp_6246 = tmp_struct_163.field1; + CursorTy pvrtmp_6247 = tmp_struct_163.field2; + CursorTy pvrtmp_6248 = tmp_struct_163.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6245, pvrtmp_6246, + pvrtmp_6247, pvrtmp_6248}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6211"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2615, + CursorTy end_r_2616, + CursorTy loc_2614, + CursorTy arg_2472) +{ + if (loc_2614 + 32 > end_r_2616) { + ChunkTy new_chunk_171 = alloc_chunk(end_r_2616); + CursorTy chunk_start_172 = new_chunk_171.chunk_start; + CursorTy chunk_end_173 = new_chunk_171.chunk_end; + + end_r_2616 = chunk_end_173; + *(TagTyPacked *) loc_2614 = 255; + + CursorTy redir = loc_2614 + 1; + + *(CursorTy *) redir = chunk_start_172; + loc_2614 = chunk_start_172; + } + + TagTyPacked tmpval_6256 = *(TagTyPacked *) arg_2472; + CursorTy tmpcur_6257 = arg_2472 + 1; + + + switch_6306: + ; + switch (tmpval_6256) { + + case 0: + { + CursorTy loc_3199 = loc_2614 + 1; + CursorCursorCursorCursorProd tmp_struct_167 = + _add_size_and_rel_offsets_String(end_r_2615, end_r_2616, loc_3199, tmpcur_6257); + CursorTy pvrtmp_6258 = tmp_struct_167.field0; + CursorTy pvrtmp_6259 = tmp_struct_167.field1; + CursorTy pvrtmp_6260 = tmp_struct_167.field2; + CursorTy pvrtmp_6261 = tmp_struct_167.field3; + + *(TagTyPacked *) loc_2614 = 0; + + CursorTy writetag_4261 = loc_2614 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6258, pvrtmp_6259, + loc_2614, pvrtmp_6261}; + break; + } + + case 1: + { + CursorTy loc_3205 = loc_2614 + 1; + CursorCursorCursorCursorProd tmp_struct_168 = + _add_size_and_rel_offsets_String(end_r_2615, end_r_2616, loc_3205, tmpcur_6257); + CursorTy pvrtmp_6270 = tmp_struct_168.field0; + CursorTy pvrtmp_6271 = tmp_struct_168.field1; + CursorTy pvrtmp_6272 = tmp_struct_168.field2; + CursorTy pvrtmp_6273 = tmp_struct_168.field3; + + *(TagTyPacked *) loc_2614 = 1; + + CursorTy writetag_4266 = loc_2614 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6270, pvrtmp_6271, + loc_2614, pvrtmp_6273}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6282 = *(CursorTy *) tmpcur_6257; + CursorTy tmpaftercur_6283 = tmpcur_6257 + 8; + CursorTy jump_3711 = tmpcur_6257 + 8; + CursorCursorCursorCursorProd tmp_struct_169 = + _add_size_and_rel_offsets_Content(end_r_2615, end_r_2616, loc_2614, tmpcur_6282); + CursorTy pvrtmp_6284 = tmp_struct_169.field0; + CursorTy pvrtmp_6285 = tmp_struct_169.field1; + CursorTy pvrtmp_6286 = tmp_struct_169.field2; + CursorTy pvrtmp_6287 = tmp_struct_169.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6284, jump_3711, + pvrtmp_6286, pvrtmp_6287}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6294 = *(CursorTy *) tmpcur_6257; + CursorTy tmpaftercur_6295 = tmpcur_6257 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _add_size_and_rel_offsets_Content(end_r_2615, end_r_2616, loc_2614, tmpcur_6294); + CursorTy pvrtmp_6296 = tmp_struct_170.field0; + CursorTy pvrtmp_6297 = tmp_struct_170.field1; + CursorTy pvrtmp_6298 = tmp_struct_170.field2; + CursorTy pvrtmp_6299 = tmp_struct_170.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6296, pvrtmp_6297, + pvrtmp_6298, pvrtmp_6299}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6256"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2619, + CursorTy end_r_2620, + CursorTy loc_2618, + CursorTy arg_2477) +{ + if (loc_2618 + 32 > end_r_2620) { + ChunkTy new_chunk_198 = alloc_chunk(end_r_2620); + CursorTy chunk_start_199 = new_chunk_198.chunk_start; + CursorTy chunk_end_200 = new_chunk_198.chunk_end; + + end_r_2620 = chunk_end_200; + *(TagTyPacked *) loc_2618 = 255; + + CursorTy redir = loc_2618 + 1; + + *(CursorTy *) redir = chunk_start_199; + loc_2618 = chunk_start_199; + } + + TagTyPacked tmpval_6307 = *(TagTyPacked *) arg_2477; + CursorTy tmpcur_6308 = arg_2477 + 1; + + + switch_6545: + ; + switch (tmpval_6307) { + + case 0: + { + CursorTy jump_3559 = arg_2477 + 1; + + *(TagTyPacked *) loc_2618 = 0; + + CursorTy writetag_4276 = loc_2618 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2620, jump_3559, + loc_2618, writetag_4276}; + break; + } + + case 1: + { + CursorTy loc_3218 = loc_2618 + 1; + CursorCursorCursorCursorProd tmp_struct_174 = + _add_size_and_rel_offsets_Content(end_r_2619, end_r_2620, loc_3218, tmpcur_6308); + CursorTy pvrtmp_6313 = tmp_struct_174.field0; + CursorTy pvrtmp_6314 = tmp_struct_174.field1; + CursorTy pvrtmp_6315 = tmp_struct_174.field2; + CursorTy pvrtmp_6316 = tmp_struct_174.field3; + CursorCursorCursorCursorProd tmp_struct_175 = + _add_size_and_rel_offsets_Adt(end_r_2619, pvrtmp_6313, pvrtmp_6316, pvrtmp_6314); + CursorTy pvrtmp_6321 = tmp_struct_175.field0; + CursorTy pvrtmp_6322 = tmp_struct_175.field1; + CursorTy pvrtmp_6323 = tmp_struct_175.field2; + CursorTy pvrtmp_6324 = tmp_struct_175.field3; + + *(TagTyPacked *) loc_2618 = 1; + + CursorTy writetag_4281 = loc_2618 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6321, pvrtmp_6322, + loc_2618, pvrtmp_6324}; + break; + } + + case 2: + { + CursorTy loc_3230 = loc_2618 + 1; + CursorCursorCursorCursorProd tmp_struct_176 = + _add_size_and_rel_offsets_Adt(end_r_2619, end_r_2620, loc_3230, tmpcur_6308); + CursorTy pvrtmp_6333 = tmp_struct_176.field0; + CursorTy pvrtmp_6334 = tmp_struct_176.field1; + CursorTy pvrtmp_6335 = tmp_struct_176.field2; + CursorTy pvrtmp_6336 = tmp_struct_176.field3; + CursorCursorCursorCursorProd tmp_struct_177 = + _add_size_and_rel_offsets_Content(end_r_2619, pvrtmp_6333, pvrtmp_6336, pvrtmp_6334); + CursorTy pvrtmp_6341 = tmp_struct_177.field0; + CursorTy pvrtmp_6342 = tmp_struct_177.field1; + CursorTy pvrtmp_6343 = tmp_struct_177.field2; + CursorTy pvrtmp_6344 = tmp_struct_177.field3; + + *(TagTyPacked *) loc_2618 = 2; + + CursorTy writetag_4288 = loc_2618 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6341, pvrtmp_6342, + loc_2618, pvrtmp_6344}; + break; + } + + case 3: + { + CursorTy loc_3246 = loc_2618 + 1; + CursorCursorCursorCursorProd tmp_struct_178 = + _add_size_and_rel_offsets_Tags(end_r_2619, end_r_2620, loc_3246, tmpcur_6308); + CursorTy pvrtmp_6353 = tmp_struct_178.field0; + CursorTy pvrtmp_6354 = tmp_struct_178.field1; + CursorTy pvrtmp_6355 = tmp_struct_178.field2; + CursorTy pvrtmp_6356 = tmp_struct_178.field3; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_Content(end_r_2619, pvrtmp_6353, pvrtmp_6356, pvrtmp_6354); + CursorTy pvrtmp_6361 = tmp_struct_179.field0; + CursorTy pvrtmp_6362 = tmp_struct_179.field1; + CursorTy pvrtmp_6363 = tmp_struct_179.field2; + CursorTy pvrtmp_6364 = tmp_struct_179.field3; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_Adt(end_r_2619, pvrtmp_6361, pvrtmp_6364, pvrtmp_6362); + CursorTy pvrtmp_6369 = tmp_struct_180.field0; + CursorTy pvrtmp_6370 = tmp_struct_180.field1; + CursorTy pvrtmp_6371 = tmp_struct_180.field2; + CursorTy pvrtmp_6372 = tmp_struct_180.field3; + + *(TagTyPacked *) loc_2618 = 3; + + CursorTy writetag_4296 = loc_2618 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6369, pvrtmp_6370, + loc_2618, pvrtmp_6372}; + break; + } + + case 4: + { + CursorTy loc_3264 = loc_2618 + 1; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_Adt(end_r_2619, end_r_2620, loc_3264, tmpcur_6308); + CursorTy pvrtmp_6381 = tmp_struct_181.field0; + CursorTy pvrtmp_6382 = tmp_struct_181.field1; + CursorTy pvrtmp_6383 = tmp_struct_181.field2; + CursorTy pvrtmp_6384 = tmp_struct_181.field3; + CursorCursorCursorCursorProd tmp_struct_182 = + _add_size_and_rel_offsets_Content(end_r_2619, pvrtmp_6381, pvrtmp_6384, pvrtmp_6382); + CursorTy pvrtmp_6389 = tmp_struct_182.field0; + CursorTy pvrtmp_6390 = tmp_struct_182.field1; + CursorTy pvrtmp_6391 = tmp_struct_182.field2; + CursorTy pvrtmp_6392 = tmp_struct_182.field3; + CursorCursorCursorCursorProd tmp_struct_183 = + _add_size_and_rel_offsets_Tags(end_r_2619, pvrtmp_6389, pvrtmp_6392, pvrtmp_6390); + CursorTy pvrtmp_6397 = tmp_struct_183.field0; + CursorTy pvrtmp_6398 = tmp_struct_183.field1; + CursorTy pvrtmp_6399 = tmp_struct_183.field2; + CursorTy pvrtmp_6400 = tmp_struct_183.field3; + + *(TagTyPacked *) loc_2618 = 4; + + CursorTy writetag_4305 = loc_2618 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6397, pvrtmp_6398, + loc_2618, pvrtmp_6400}; + break; + } + + case 5: + { + CursorTy loc_3282 = loc_2618 + 1; + CursorCursorCursorCursorProd tmp_struct_184 = + _add_size_and_rel_offsets_Tags(end_r_2619, end_r_2620, loc_3282, tmpcur_6308); + CursorTy pvrtmp_6409 = tmp_struct_184.field0; + CursorTy pvrtmp_6410 = tmp_struct_184.field1; + CursorTy pvrtmp_6411 = tmp_struct_184.field2; + CursorTy pvrtmp_6412 = tmp_struct_184.field3; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_Adt(end_r_2619, pvrtmp_6409, pvrtmp_6412, pvrtmp_6410); + CursorTy pvrtmp_6417 = tmp_struct_185.field0; + CursorTy pvrtmp_6418 = tmp_struct_185.field1; + CursorTy pvrtmp_6419 = tmp_struct_185.field2; + CursorTy pvrtmp_6420 = tmp_struct_185.field3; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_Content(end_r_2619, pvrtmp_6417, pvrtmp_6420, pvrtmp_6418); + CursorTy pvrtmp_6425 = tmp_struct_186.field0; + CursorTy pvrtmp_6426 = tmp_struct_186.field1; + CursorTy pvrtmp_6427 = tmp_struct_186.field2; + CursorTy pvrtmp_6428 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2618 = 5; + + CursorTy writetag_4314 = loc_2618 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6425, pvrtmp_6426, + loc_2618, pvrtmp_6428}; + break; + } + + case 6: + { + CursorTy loc_3300 = loc_2618 + 1; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Adt(end_r_2619, end_r_2620, loc_3300, tmpcur_6308); + CursorTy pvrtmp_6437 = tmp_struct_187.field0; + CursorTy pvrtmp_6438 = tmp_struct_187.field1; + CursorTy pvrtmp_6439 = tmp_struct_187.field2; + CursorTy pvrtmp_6440 = tmp_struct_187.field3; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Tags(end_r_2619, pvrtmp_6437, pvrtmp_6440, pvrtmp_6438); + CursorTy pvrtmp_6445 = tmp_struct_188.field0; + CursorTy pvrtmp_6446 = tmp_struct_188.field1; + CursorTy pvrtmp_6447 = tmp_struct_188.field2; + CursorTy pvrtmp_6448 = tmp_struct_188.field3; + CursorCursorCursorCursorProd tmp_struct_189 = + _add_size_and_rel_offsets_Content(end_r_2619, pvrtmp_6445, pvrtmp_6448, pvrtmp_6446); + CursorTy pvrtmp_6453 = tmp_struct_189.field0; + CursorTy pvrtmp_6454 = tmp_struct_189.field1; + CursorTy pvrtmp_6455 = tmp_struct_189.field2; + CursorTy pvrtmp_6456 = tmp_struct_189.field3; + + *(TagTyPacked *) loc_2618 = 6; + + CursorTy writetag_4323 = loc_2618 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6453, pvrtmp_6454, + loc_2618, pvrtmp_6456}; + break; + } + + case 7: + { + CursorTy loc_3318 = loc_2618 + 1; + CursorCursorCursorCursorProd tmp_struct_190 = + _add_size_and_rel_offsets_Content(end_r_2619, end_r_2620, loc_3318, tmpcur_6308); + CursorTy pvrtmp_6465 = tmp_struct_190.field0; + CursorTy pvrtmp_6466 = tmp_struct_190.field1; + CursorTy pvrtmp_6467 = tmp_struct_190.field2; + CursorTy pvrtmp_6468 = tmp_struct_190.field3; + CursorCursorCursorCursorProd tmp_struct_191 = + _add_size_and_rel_offsets_Tags(end_r_2619, pvrtmp_6465, pvrtmp_6468, pvrtmp_6466); + CursorTy pvrtmp_6473 = tmp_struct_191.field0; + CursorTy pvrtmp_6474 = tmp_struct_191.field1; + CursorTy pvrtmp_6475 = tmp_struct_191.field2; + CursorTy pvrtmp_6476 = tmp_struct_191.field3; + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Adt(end_r_2619, pvrtmp_6473, pvrtmp_6476, pvrtmp_6474); + CursorTy pvrtmp_6481 = tmp_struct_192.field0; + CursorTy pvrtmp_6482 = tmp_struct_192.field1; + CursorTy pvrtmp_6483 = tmp_struct_192.field2; + CursorTy pvrtmp_6484 = tmp_struct_192.field3; + + *(TagTyPacked *) loc_2618 = 7; + + CursorTy writetag_4332 = loc_2618 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6481, pvrtmp_6482, + loc_2618, pvrtmp_6484}; + break; + } + + case 8: + { + CursorTy loc_3336 = loc_2618 + 1; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Content(end_r_2619, end_r_2620, loc_3336, tmpcur_6308); + CursorTy pvrtmp_6493 = tmp_struct_193.field0; + CursorTy pvrtmp_6494 = tmp_struct_193.field1; + CursorTy pvrtmp_6495 = tmp_struct_193.field2; + CursorTy pvrtmp_6496 = tmp_struct_193.field3; + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2619, pvrtmp_6493, pvrtmp_6496, pvrtmp_6494); + CursorTy pvrtmp_6501 = tmp_struct_194.field0; + CursorTy pvrtmp_6502 = tmp_struct_194.field1; + CursorTy pvrtmp_6503 = tmp_struct_194.field2; + CursorTy pvrtmp_6504 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Tags(end_r_2619, pvrtmp_6501, pvrtmp_6504, pvrtmp_6502); + CursorTy pvrtmp_6509 = tmp_struct_195.field0; + CursorTy pvrtmp_6510 = tmp_struct_195.field1; + CursorTy pvrtmp_6511 = tmp_struct_195.field2; + CursorTy pvrtmp_6512 = tmp_struct_195.field3; + + *(TagTyPacked *) loc_2618 = 8; + + CursorTy writetag_4341 = loc_2618 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6509, pvrtmp_6510, + loc_2618, pvrtmp_6512}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6521 = *(CursorTy *) tmpcur_6308; + CursorTy tmpaftercur_6522 = tmpcur_6308 + 8; + CursorTy jump_3717 = tmpcur_6308 + 8; + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Adt(end_r_2619, end_r_2620, loc_2618, tmpcur_6521); + CursorTy pvrtmp_6523 = tmp_struct_196.field0; + CursorTy pvrtmp_6524 = tmp_struct_196.field1; + CursorTy pvrtmp_6525 = tmp_struct_196.field2; + CursorTy pvrtmp_6526 = tmp_struct_196.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6523, jump_3717, + pvrtmp_6525, pvrtmp_6526}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6533 = *(CursorTy *) tmpcur_6308; + CursorTy tmpaftercur_6534 = tmpcur_6308 + 8; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Adt(end_r_2619, end_r_2620, loc_2618, tmpcur_6533); + CursorTy pvrtmp_6535 = tmp_struct_197.field0; + CursorTy pvrtmp_6536 = tmp_struct_197.field1; + CursorTy pvrtmp_6537 = tmp_struct_197.field2; + CursorTy pvrtmp_6538 = tmp_struct_197.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6535, pvrtmp_6536, + pvrtmp_6537, pvrtmp_6538}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6307"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2623, + CursorTy end_r_2624, + CursorTy loc_2622, + CursorTy arg_2522) +{ + if (loc_2622 + 32 > end_r_2624) { + ChunkTy new_chunk_204 = alloc_chunk(end_r_2624); + CursorTy chunk_start_205 = new_chunk_204.chunk_start; + CursorTy chunk_end_206 = new_chunk_204.chunk_end; + + end_r_2624 = chunk_end_206; + *(TagTyPacked *) loc_2622 = 255; + + CursorTy redir = loc_2622 + 1; + + *(CursorTy *) redir = chunk_start_205; + loc_2622 = chunk_start_205; + } + + CursorTy loc_3350 = loc_2622 + 1; + CursorTy loc_3351 = loc_3350 + 8; + TagTyPacked tmpval_6546 = *(TagTyPacked *) arg_2522; + CursorTy tmpcur_6547 = arg_2522 + 1; + + + switch_6590: + ; + switch (tmpval_6546) { + + case 0: + { + CursorTy jump_3591 = arg_2522 + 1; + + *(TagTyPacked *) loc_2622 = 0; + + CursorTy writetag_4353 = loc_2622 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2624, jump_3591, + loc_2622, writetag_4353}; + break; + } + + case 1: + { + IntTy tmpval_6552 = *(IntTy *) tmpcur_6547; + CursorTy tmpcur_6553 = tmpcur_6547 + sizeof(IntTy); + CursorTy jump_3593 = tmpcur_6547 + 8; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2623, end_r_2624, loc_3351, tmpcur_6553); + CursorTy pvrtmp_6554 = tmp_struct_201.field0; + CursorTy pvrtmp_6555 = tmp_struct_201.field1; + CursorTy pvrtmp_6556 = tmp_struct_201.field2; + CursorTy pvrtmp_6557 = tmp_struct_201.field3; + + *(TagTyPacked *) loc_2622 = 1; + + CursorTy writetag_4358 = loc_2622 + 1; + + *(IntTy *) writetag_4358 = tmpval_6552; + + CursorTy writecur_4359 = writetag_4358 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6554, pvrtmp_6555, + loc_2622, pvrtmp_6557}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6566 = *(CursorTy *) tmpcur_6547; + CursorTy tmpaftercur_6567 = tmpcur_6547 + 8; + CursorTy jump_3723 = tmpcur_6547 + 8; + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2623, end_r_2624, loc_2622, tmpcur_6566); + CursorTy pvrtmp_6568 = tmp_struct_202.field0; + CursorTy pvrtmp_6569 = tmp_struct_202.field1; + CursorTy pvrtmp_6570 = tmp_struct_202.field2; + CursorTy pvrtmp_6571 = tmp_struct_202.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6568, jump_3723, + pvrtmp_6570, pvrtmp_6571}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6578 = *(CursorTy *) tmpcur_6547; + CursorTy tmpaftercur_6579 = tmpcur_6547 + 8; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Tags(end_r_2623, end_r_2624, loc_2622, tmpcur_6578); + CursorTy pvrtmp_6580 = tmp_struct_203.field0; + CursorTy pvrtmp_6581 = tmp_struct_203.field1; + CursorTy pvrtmp_6582 = tmp_struct_203.field2; + CursorTy pvrtmp_6583 = tmp_struct_203.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6580, pvrtmp_6581, + pvrtmp_6582, pvrtmp_6583}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6546"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(5234, "Time for Adt: AC"); + set_newline(5235); + add_symbol(5236, "Count of Adt AC is: "); + add_symbol(5237, ")"); + add_symbol(5238, "(Text "); + add_symbol(5239, "(Tag "); + add_symbol(5240, "(TCA "); + add_symbol(5241, "(TAC "); + add_symbol(5242, "(Nul "); + add_symbol(5243, "(Nil "); + add_symbol(5244, "(Image "); + add_symbol(5245, "(End "); + add_symbol(5246, "(Char "); + add_symbol(5247, "(CTA "); + add_symbol(5248, "(CAT "); + add_symbol(5249, "(CA "); + add_symbol(5250, "(ATC "); + add_symbol(5251, "(ACT "); + add_symbol(5252, "(AC "); + add_symbol(5253, " ->r "); + add_symbol(5254, " ->i "); + + RegionTy *region_5255 = alloc_region(global_init_inf_buf_size); + CursorTy r_2630 = region_5255->reg_heap; + IntTy sizeof_end_r_2630_5256 = global_init_inf_buf_size; + CursorTy end_r_2630 = r_2630 + sizeof_end_r_2630_5256; + CursorCursorCursorProd tmp_struct_207 = + mkACList(end_r_2630, r_2630, 1000000, 100); + CursorTy pvrtmp_5257 = tmp_struct_207.field0; + CursorTy pvrtmp_5258 = tmp_struct_207.field1; + CursorTy pvrtmp_5259 = tmp_struct_207.field2; + unsigned char wildcard__17_22_914_1533 = print_symbol(5234); + unsigned char wildcard__15_23_915_1534 = print_symbol(5235); + IntTy timed_4657; + VectorTy *times_211 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_timed_4657; + struct timespec end_timed_4657; + + start_counters(); + for (long long iters_timed_4657 = 0; iters_timed_4657 < global_iters_param; + iters_timed_4657++) { + if (iters_timed_4657 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_timed_4657); + + IntTy tailapp_3596 = getLengthTR(pvrtmp_5257, pvrtmp_5258, 0); + + timed_4657 = tailapp_3596; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_timed_4657); + if (iters_timed_4657 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_208 = difftimespecs(&begin_timed_4657, &end_timed_4657); + + vector_inplace_update(times_211, iters_timed_4657, &itertime_208); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_211, compare_doubles); + + double *tmp_212 = (double *) vector_nth(times_211, global_iters_param / 2); + double selftimed_210 = *tmp_212; + double batchtime_209 = sum_timing_array(times_211); + + print_timing_array(times_211); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_209); + printf("SELFTIMED: %e\n", selftimed_210); + + unsigned char wildcard__11_25_917_1536 = print_symbol(5236); + unsigned char wildcard__9_26_918_1537 = printf("%lld", timed_4657); + unsigned char wildcard__7_27_919_1538 = print_symbol(5235); + + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/calcAdtLengthCa.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/calcAdtLengthCa.c new file mode 100644 index 000000000..cfc226370 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/calcAdtLengthCa.c @@ -0,0 +1,4818 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +IntTy getLengthTR(CursorTy end_r_2860, CursorTy adt_31_923_1539, + IntTy accumulator_32_924_1540); +CursorCursorCursorProd mkCAList(CursorTy end_r_2862, CursorTy loc_2861, + IntTy len_35_927_1544, + IntTy strLen_36_928_1545); +CursorCursorCursorProd mkString(CursorTy end_r_2864, CursorTy loc_2863, + IntTy len_188_1080_1550); +CursorCursorCursorProd mkContentText(CursorTy end_r_2866, CursorTy loc_2865, + IntTy n_202_1094_1556); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2869, + CursorTy end_r_2870, + CursorTy loc_2868, + CursorTy arg_637_1249_1558); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2873, + CursorTy end_r_2874, + CursorTy loc_2872, + CursorTy arg_642_1254_1563); +CursorProd _traverse_String(CursorTy end_r_2876, CursorTy arg_647_1259_1568); +CursorProd _print_String(CursorTy end_r_2878, CursorTy arg_652_1263_1572); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2881, + CursorTy end_r_2882, + CursorTy loc_2880, + CursorTy arg_661_1272_1581); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2885, + CursorTy end_r_2886, + CursorTy loc_2884, + CursorTy arg_666_1277_1586); +CursorProd _traverse_Content(CursorTy end_r_2888, CursorTy arg_671_1282_1591); +CursorProd _print_Content(CursorTy end_r_2890, CursorTy arg_676_1287_1596); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2893, CursorTy end_r_2894, + CursorTy loc_2892, + CursorTy arg_685_1296_1605); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2897, + CursorTy end_r_2898, + CursorTy loc_2896, + CursorTy arg_730_1341_1650); +CursorProd _traverse_Adt(CursorTy end_r_2900, CursorTy arg_775_1386_1695); +CursorProd _print_Adt(CursorTy end_r_2902, CursorTy arg_820_1431_1740); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2905, + CursorTy end_r_2906, CursorTy loc_2904, + CursorTy arg_883_1494_1803); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2909, + CursorTy end_r_2910, + CursorTy loc_2908, + CursorTy arg_888_1499_1808); +CursorProd _traverse_Tags(CursorTy end_r_2912, CursorTy arg_893_1504_1813); +CursorProd _print_Tags(CursorTy end_r_2914, CursorTy arg_898_1508_1817); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2917, CursorTy end_r_2918, + CursorTy loc_2916, CursorTy arg_2657); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2921, CursorTy end_r_2922, + CursorTy loc_2920, CursorTy arg_2662); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2925, + CursorTy end_r_2926, + CursorTy loc_2924, + CursorTy arg_2667); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2929, + CursorTy end_r_2930, + CursorTy loc_2928, + CursorTy arg_2756); +IntTy getLengthTR(CursorTy end_r_2860, CursorTy adt_31_923_1539, + IntTy accumulator_32_924_1540) +{ + TagTyPacked tmpval_5889 = *(TagTyPacked *) adt_31_923_1539; + CursorTy tmpcur_5890 = adt_31_923_1539 + 1; + + + switch_5897: + ; + switch (tmpval_5889) { + + case 0: + { + CursorTy jump_3833 = adt_31_923_1539 + 1; + + return accumulator_32_924_1540; + break; + } + + case 9: + { + CursorTy tmpcur_5891 = *(CursorTy *) tmpcur_5890; + CursorTy tmpaftercur_5892 = tmpcur_5890 + 8; + CursorTy jump_3834 = tmpcur_5890 + 8; + IntTy fltAppE_1525_1543 = 1 + accumulator_32_924_1540; + IntTy tailapp_3835 = + getLengthTR(end_r_2860, tmpcur_5891, fltAppE_1525_1543); + + return tailapp_3835; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5893 = *(CursorTy *) tmpcur_5890; + CursorTy tmpaftercur_5894 = tmpcur_5890 + 8; + CursorTy jump_4135 = tmpcur_5890 + 8; + IntTy call_4136 = + getLengthTR(end_r_2860, tmpcur_5893, accumulator_32_924_1540); + + return call_4136; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5895 = *(CursorTy *) tmpcur_5890; + CursorTy tmpaftercur_5896 = tmpcur_5890 + 8; + IntTy call_4136 = + getLengthTR(end_r_2860, tmpcur_5895, accumulator_32_924_1540); + + return call_4136; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5889"); + exit(1); + } + } +} +CursorCursorCursorProd mkCAList(CursorTy end_r_2862, CursorTy loc_2861, + IntTy len_35_927_1544, IntTy strLen_36_928_1545) +{ + if (loc_2861 + 32 > end_r_2862) { + ChunkTy new_chunk_2 = alloc_chunk(end_r_2862); + CursorTy chunk_start_3 = new_chunk_2.chunk_start; + CursorTy chunk_end_4 = new_chunk_2.chunk_end; + + end_r_2862 = chunk_end_4; + *(TagTyPacked *) loc_2861 = 255; + + CursorTy redir = loc_2861 + 1; + + *(CursorTy *) redir = chunk_start_3; + loc_2861 = chunk_start_3; + } + + CursorTy loc_2947 = loc_2861 + 1; + CursorTy loc_2948 = loc_2947 + 8; + BoolTy fltIf_1526_1546 = len_35_927_1544 <= 0; + + if (fltIf_1526_1546) { + *(TagTyPacked *) loc_2861 = 0; + + CursorTy writetag_4372 = loc_2861 + 1; + + return (CursorCursorCursorProd) {end_r_2862, loc_2861, writetag_4372}; + } else { + CursorCursorCursorProd tmp_struct_0 = + mkContentText(end_r_2862, loc_2948, strLen_36_928_1545); + CursorTy pvrtmp_5902 = tmp_struct_0.field0; + CursorTy pvrtmp_5903 = tmp_struct_0.field1; + CursorTy pvrtmp_5904 = tmp_struct_0.field2; + IntTy fltAppE_1527_1548 = len_35_927_1544 - 1; + CursorCursorCursorProd tmp_struct_1 = + mkCAList(pvrtmp_5902, pvrtmp_5904, fltAppE_1527_1548, strLen_36_928_1545); + CursorTy pvrtmp_5909 = tmp_struct_1.field0; + CursorTy pvrtmp_5910 = tmp_struct_1.field1; + CursorTy pvrtmp_5911 = tmp_struct_1.field2; + + *(TagTyPacked *) loc_2861 = 9; + + CursorTy writetag_4376 = loc_2861 + 1; + + *(CursorTy *) writetag_4376 = pvrtmp_5904; + + CursorTy writecur_4377 = writetag_4376 + 8; + + return (CursorCursorCursorProd) {pvrtmp_5909, loc_2861, pvrtmp_5911}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2864, CursorTy loc_2863, + IntTy len_188_1080_1550) +{ + if (loc_2863 + 32 > end_r_2864) { + ChunkTy new_chunk_6 = alloc_chunk(end_r_2864); + CursorTy chunk_start_7 = new_chunk_6.chunk_start; + CursorTy chunk_end_8 = new_chunk_6.chunk_end; + + end_r_2864 = chunk_end_8; + *(TagTyPacked *) loc_2863 = 255; + + CursorTy redir = loc_2863 + 1; + + *(CursorTy *) redir = chunk_start_7; + loc_2863 = chunk_start_7; + } + + CursorTy loc_2956 = loc_2863 + 1; + CursorTy loc_2957 = loc_2956 + 8; + BoolTy fltIf_1528_1551 = len_188_1080_1550 <= 0; + + if (fltIf_1528_1551) { + *(TagTyPacked *) loc_2863 = 0; + + CursorTy writetag_4381 = loc_2863 + 1; + + return (CursorCursorCursorProd) {end_r_2864, loc_2863, writetag_4381}; + } else { + IntTy fltPrm_1529_1552 = rand(); + IntTy randomChar_189_1081_1553 = fltPrm_1529_1552 % 128; + IntTy fltAppE_1530_1554 = len_188_1080_1550 - 1; + CursorCursorCursorProd tmp_struct_5 = + mkString(end_r_2864, loc_2957, fltAppE_1530_1554); + CursorTy pvrtmp_5924 = tmp_struct_5.field0; + CursorTy pvrtmp_5925 = tmp_struct_5.field1; + CursorTy pvrtmp_5926 = tmp_struct_5.field2; + + *(TagTyPacked *) loc_2863 = 1; + + CursorTy writetag_4384 = loc_2863 + 1; + + *(IntTy *) writetag_4384 = randomChar_189_1081_1553; + + CursorTy writecur_4385 = writetag_4384 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_5924, loc_2863, pvrtmp_5926}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2866, CursorTy loc_2865, + IntTy n_202_1094_1556) +{ + if (loc_2865 + 32 > end_r_2866) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2866); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2866 = chunk_end_12; + *(TagTyPacked *) loc_2865 = 255; + + CursorTy redir = loc_2865 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2865 = chunk_start_11; + } + + CursorTy loc_2962 = loc_2865 + 1; + CursorCursorCursorProd tmp_struct_9 = + mkString(end_r_2866, loc_2962, n_202_1094_1556); + CursorTy pvrtmp_5935 = tmp_struct_9.field0; + CursorTy pvrtmp_5936 = tmp_struct_9.field1; + CursorTy pvrtmp_5937 = tmp_struct_9.field2; + + *(TagTyPacked *) loc_2865 = 1; + + CursorTy writetag_4389 = loc_2865 + 1; + + return (CursorCursorCursorProd) {pvrtmp_5935, loc_2865, pvrtmp_5937}; +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2869, + CursorTy end_r_2870, + CursorTy loc_2868, + CursorTy arg_637_1249_1558) +{ + if (loc_2868 + 32 > end_r_2870) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2870); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2870 = chunk_end_18; + *(TagTyPacked *) loc_2868 = 255; + + CursorTy redir = loc_2868 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2868 = chunk_start_17; + } + + CursorTy loc_2972 = loc_2868 + 1; + CursorTy loc_2973 = loc_2972 + 8; + TagTyPacked tmpval_5946 = *(TagTyPacked *) arg_637_1249_1558; + CursorTy tmpcur_5947 = arg_637_1249_1558 + 1; + + + switch_5990: + ; + switch (tmpval_5946) { + + case 0: + { + CursorTy jump_3841 = arg_637_1249_1558 + 1; + + *(TagTyPacked *) loc_2868 = 0; + + CursorTy writetag_4393 = loc_2868 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2870, jump_3841, + loc_2868, writetag_4393}; + break; + } + + case 1: + { + IntTy tmpval_5952 = *(IntTy *) tmpcur_5947; + CursorTy tmpcur_5953 = tmpcur_5947 + sizeof(IntTy); + CursorTy jump_3843 = tmpcur_5947 + 8; + CursorCursorCursorCursorProd tmp_struct_13 = + _copy_String(end_r_2869, end_r_2870, loc_2973, tmpcur_5953); + CursorTy pvrtmp_5954 = tmp_struct_13.field0; + CursorTy pvrtmp_5955 = tmp_struct_13.field1; + CursorTy pvrtmp_5956 = tmp_struct_13.field2; + CursorTy pvrtmp_5957 = tmp_struct_13.field3; + + *(TagTyPacked *) loc_2868 = 1; + + CursorTy writetag_4398 = loc_2868 + 1; + + *(IntTy *) writetag_4398 = tmpval_5952; + + CursorTy writecur_4399 = writetag_4398 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_5954, pvrtmp_5955, + loc_2868, pvrtmp_5957}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_5966 = *(CursorTy *) tmpcur_5947; + CursorTy tmpaftercur_5967 = tmpcur_5947 + 8; + CursorTy jump_4140 = tmpcur_5947 + 8; + CursorCursorCursorCursorProd tmp_struct_14 = + _copy_String(end_r_2869, end_r_2870, loc_2868, tmpcur_5966); + CursorTy pvrtmp_5968 = tmp_struct_14.field0; + CursorTy pvrtmp_5969 = tmp_struct_14.field1; + CursorTy pvrtmp_5970 = tmp_struct_14.field2; + CursorTy pvrtmp_5971 = tmp_struct_14.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5968, jump_4140, + pvrtmp_5970, pvrtmp_5971}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_5978 = *(CursorTy *) tmpcur_5947; + CursorTy tmpaftercur_5979 = tmpcur_5947 + 8; + CursorCursorCursorCursorProd tmp_struct_15 = + _copy_String(end_r_2869, end_r_2870, loc_2868, tmpcur_5978); + CursorTy pvrtmp_5980 = tmp_struct_15.field0; + CursorTy pvrtmp_5981 = tmp_struct_15.field1; + CursorTy pvrtmp_5982 = tmp_struct_15.field2; + CursorTy pvrtmp_5983 = tmp_struct_15.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_5980, pvrtmp_5981, + pvrtmp_5982, pvrtmp_5983}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5946"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2873, + CursorTy end_r_2874, + CursorTy loc_2872, + CursorTy arg_642_1254_1563) +{ + CursorTy loc_2985 = loc_2872 + 1; + CursorTy loc_2986 = loc_2985 + 8; + TagTyPacked tmpval_5991 = *(TagTyPacked *) arg_642_1254_1563; + CursorTy tmpcur_5992 = arg_642_1254_1563 + 1; + + + switch_6035: + ; + switch (tmpval_5991) { + + case 0: + { + CursorTy jump_3846 = arg_642_1254_1563 + 1; + + *(TagTyPacked *) loc_2872 = 0; + + CursorTy writetag_4409 = loc_2872 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2874, jump_3846, + loc_2872, writetag_4409}; + break; + } + + case 1: + { + IntTy tmpval_5997 = *(IntTy *) tmpcur_5992; + CursorTy tmpcur_5998 = tmpcur_5992 + sizeof(IntTy); + CursorTy jump_3848 = tmpcur_5992 + 8; + CursorCursorCursorCursorProd tmp_struct_19 = + _copy_without_ptrs_String(end_r_2873, end_r_2874, loc_2986, tmpcur_5998); + CursorTy pvrtmp_5999 = tmp_struct_19.field0; + CursorTy pvrtmp_6000 = tmp_struct_19.field1; + CursorTy pvrtmp_6001 = tmp_struct_19.field2; + CursorTy pvrtmp_6002 = tmp_struct_19.field3; + + *(TagTyPacked *) loc_2872 = 1; + + CursorTy writetag_4414 = loc_2872 + 1; + + *(IntTy *) writetag_4414 = tmpval_5997; + + CursorTy writecur_4415 = writetag_4414 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_5999, pvrtmp_6000, + loc_2872, pvrtmp_6002}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6011 = *(CursorTy *) tmpcur_5992; + CursorTy tmpaftercur_6012 = tmpcur_5992 + 8; + CursorTy jump_4146 = tmpcur_5992 + 8; + CursorCursorCursorCursorProd tmp_struct_20 = + _copy_without_ptrs_String(end_r_2873, end_r_2874, loc_2872, tmpcur_6011); + CursorTy pvrtmp_6013 = tmp_struct_20.field0; + CursorTy pvrtmp_6014 = tmp_struct_20.field1; + CursorTy pvrtmp_6015 = tmp_struct_20.field2; + CursorTy pvrtmp_6016 = tmp_struct_20.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6013, jump_4146, + pvrtmp_6015, pvrtmp_6016}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6023 = *(CursorTy *) tmpcur_5992; + CursorTy tmpaftercur_6024 = tmpcur_5992 + 8; + CursorCursorCursorCursorProd tmp_struct_21 = + _copy_without_ptrs_String(end_r_2873, end_r_2874, loc_2872, tmpcur_6023); + CursorTy pvrtmp_6025 = tmp_struct_21.field0; + CursorTy pvrtmp_6026 = tmp_struct_21.field1; + CursorTy pvrtmp_6027 = tmp_struct_21.field2; + CursorTy pvrtmp_6028 = tmp_struct_21.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6025, pvrtmp_6026, + pvrtmp_6027, pvrtmp_6028}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_5991"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2876, CursorTy arg_647_1259_1568) +{ + TagTyPacked tmpval_6036 = *(TagTyPacked *) arg_647_1259_1568; + CursorTy tmpcur_6037 = arg_647_1259_1568 + 1; + + + switch_6047: + ; + switch (tmpval_6036) { + + case 0: + { + CursorTy jump_3851 = arg_647_1259_1568 + 1; + + return (CursorProd) {jump_3851}; + break; + } + + case 1: + { + IntTy tmpval_6038 = *(IntTy *) tmpcur_6037; + CursorTy tmpcur_6039 = tmpcur_6037 + sizeof(IntTy); + CursorTy jump_3853 = tmpcur_6037 + 8; + CursorProd tmp_struct_22 = + _traverse_String(end_r_2876, tmpcur_6039); + CursorTy pvrtmp_6040 = tmp_struct_22.field0; + + return (CursorProd) {pvrtmp_6040}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6041 = *(CursorTy *) tmpcur_6037; + CursorTy tmpaftercur_6042 = tmpcur_6037 + 8; + CursorTy jump_4152 = tmpcur_6037 + 8; + CursorProd tmp_struct_23 = + _traverse_String(end_r_2876, tmpcur_6041); + CursorTy pvrtmp_6043 = tmp_struct_23.field0; + + return (CursorProd) {jump_4152}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6044 = *(CursorTy *) tmpcur_6037; + CursorTy tmpaftercur_6045 = tmpcur_6037 + 8; + CursorProd tmp_struct_24 = + _traverse_String(end_r_2876, tmpcur_6044); + CursorTy pvrtmp_6046 = tmp_struct_24.field0; + + return (CursorProd) {pvrtmp_6046}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6036"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2878, CursorTy arg_652_1263_1572) +{ + TagTyPacked tmpval_6048 = *(TagTyPacked *) arg_652_1263_1572; + CursorTy tmpcur_6049 = arg_652_1263_1572 + 1; + + + switch_6059: + ; + switch (tmpval_6048) { + + case 0: + { + CursorTy jump_3856 = arg_652_1263_1572 + 1; + unsigned char wildcard_653_1264_1573 = print_symbol(5870); + unsigned char wildcard_654_1265_1574 = print_symbol(5862); + + return (CursorProd) {jump_3856}; + break; + } + + case 1: + { + IntTy tmpval_6050 = *(IntTy *) tmpcur_6049; + CursorTy tmpcur_6051 = tmpcur_6049 + sizeof(IntTy); + CursorTy jump_3858 = tmpcur_6049 + 8; + unsigned char wildcard_659_1268_1577 = print_symbol(5871); + unsigned char y_657_1269_1578 = printf("%lld", tmpval_6050); + CursorProd tmp_struct_25 = _print_String(end_r_2878, tmpcur_6051); + CursorTy pvrtmp_6052 = tmp_struct_25.field0; + unsigned char wildcard_660_1271_1580 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6052}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6053 = *(CursorTy *) tmpcur_6049; + CursorTy tmpaftercur_6054 = tmpcur_6049 + 8; + CursorTy jump_4158 = tmpcur_6049 + 8; + unsigned char wildcard_4161 = print_symbol(5879); + CursorProd tmp_struct_26 = _print_String(end_r_2878, tmpcur_6053); + CursorTy pvrtmp_6055 = tmp_struct_26.field0; + + return (CursorProd) {jump_4158}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6056 = *(CursorTy *) tmpcur_6049; + CursorTy tmpaftercur_6057 = tmpcur_6049 + 8; + unsigned char wildcard_4161 = print_symbol(5878); + CursorProd tmp_struct_27 = _print_String(end_r_2878, tmpcur_6056); + CursorTy pvrtmp_6058 = tmp_struct_27.field0; + + return (CursorProd) {pvrtmp_6058}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6048"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2881, + CursorTy end_r_2882, + CursorTy loc_2880, + CursorTy arg_661_1272_1581) +{ + if (loc_2880 + 32 > end_r_2882) { + ChunkTy new_chunk_32 = alloc_chunk(end_r_2882); + CursorTy chunk_start_33 = new_chunk_32.chunk_start; + CursorTy chunk_end_34 = new_chunk_32.chunk_end; + + end_r_2882 = chunk_end_34; + *(TagTyPacked *) loc_2880 = 255; + + CursorTy redir = loc_2880 + 1; + + *(CursorTy *) redir = chunk_start_33; + loc_2880 = chunk_start_33; + } + + TagTyPacked tmpval_6060 = *(TagTyPacked *) arg_661_1272_1581; + CursorTy tmpcur_6061 = arg_661_1272_1581 + 1; + + + switch_6110: + ; + switch (tmpval_6060) { + + case 0: + { + CursorTy loc_3008 = loc_2880 + 1; + CursorCursorCursorCursorProd tmp_struct_28 = + _copy_String(end_r_2881, end_r_2882, loc_3008, tmpcur_6061); + CursorTy pvrtmp_6062 = tmp_struct_28.field0; + CursorTy pvrtmp_6063 = tmp_struct_28.field1; + CursorTy pvrtmp_6064 = tmp_struct_28.field2; + CursorTy pvrtmp_6065 = tmp_struct_28.field3; + + *(TagTyPacked *) loc_2880 = 0; + + CursorTy writetag_4446 = loc_2880 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6062, pvrtmp_6063, + loc_2880, pvrtmp_6065}; + break; + } + + case 1: + { + CursorTy loc_3014 = loc_2880 + 1; + CursorCursorCursorCursorProd tmp_struct_29 = + _copy_String(end_r_2881, end_r_2882, loc_3014, tmpcur_6061); + CursorTy pvrtmp_6074 = tmp_struct_29.field0; + CursorTy pvrtmp_6075 = tmp_struct_29.field1; + CursorTy pvrtmp_6076 = tmp_struct_29.field2; + CursorTy pvrtmp_6077 = tmp_struct_29.field3; + + *(TagTyPacked *) loc_2880 = 1; + + CursorTy writetag_4451 = loc_2880 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6074, pvrtmp_6075, + loc_2880, pvrtmp_6077}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6086 = *(CursorTy *) tmpcur_6061; + CursorTy tmpaftercur_6087 = tmpcur_6061 + 8; + CursorTy jump_4164 = tmpcur_6061 + 8; + CursorCursorCursorCursorProd tmp_struct_30 = + _copy_Content(end_r_2881, end_r_2882, loc_2880, tmpcur_6086); + CursorTy pvrtmp_6088 = tmp_struct_30.field0; + CursorTy pvrtmp_6089 = tmp_struct_30.field1; + CursorTy pvrtmp_6090 = tmp_struct_30.field2; + CursorTy pvrtmp_6091 = tmp_struct_30.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6088, jump_4164, + pvrtmp_6090, pvrtmp_6091}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6098 = *(CursorTy *) tmpcur_6061; + CursorTy tmpaftercur_6099 = tmpcur_6061 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_Content(end_r_2881, end_r_2882, loc_2880, tmpcur_6098); + CursorTy pvrtmp_6100 = tmp_struct_31.field0; + CursorTy pvrtmp_6101 = tmp_struct_31.field1; + CursorTy pvrtmp_6102 = tmp_struct_31.field2; + CursorTy pvrtmp_6103 = tmp_struct_31.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6100, pvrtmp_6101, + pvrtmp_6102, pvrtmp_6103}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6060"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2885, + CursorTy end_r_2886, + CursorTy loc_2884, + CursorTy arg_666_1277_1586) +{ + TagTyPacked tmpval_6111 = *(TagTyPacked *) arg_666_1277_1586; + CursorTy tmpcur_6112 = arg_666_1277_1586 + 1; + + + switch_6161: + ; + switch (tmpval_6111) { + + case 0: + { + CursorTy loc_3022 = loc_2884 + 1; + CursorCursorCursorCursorProd tmp_struct_35 = + _copy_without_ptrs_String(end_r_2885, end_r_2886, loc_3022, tmpcur_6112); + CursorTy pvrtmp_6113 = tmp_struct_35.field0; + CursorTy pvrtmp_6114 = tmp_struct_35.field1; + CursorTy pvrtmp_6115 = tmp_struct_35.field2; + CursorTy pvrtmp_6116 = tmp_struct_35.field3; + + *(TagTyPacked *) loc_2884 = 0; + + CursorTy writetag_4462 = loc_2884 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6113, pvrtmp_6114, + loc_2884, pvrtmp_6116}; + break; + } + + case 1: + { + CursorTy loc_3028 = loc_2884 + 1; + CursorCursorCursorCursorProd tmp_struct_36 = + _copy_without_ptrs_String(end_r_2885, end_r_2886, loc_3028, tmpcur_6112); + CursorTy pvrtmp_6125 = tmp_struct_36.field0; + CursorTy pvrtmp_6126 = tmp_struct_36.field1; + CursorTy pvrtmp_6127 = tmp_struct_36.field2; + CursorTy pvrtmp_6128 = tmp_struct_36.field3; + + *(TagTyPacked *) loc_2884 = 1; + + CursorTy writetag_4467 = loc_2884 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6125, pvrtmp_6126, + loc_2884, pvrtmp_6128}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6137 = *(CursorTy *) tmpcur_6112; + CursorTy tmpaftercur_6138 = tmpcur_6112 + 8; + CursorTy jump_4170 = tmpcur_6112 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_Content(end_r_2885, end_r_2886, loc_2884, tmpcur_6137); + CursorTy pvrtmp_6139 = tmp_struct_37.field0; + CursorTy pvrtmp_6140 = tmp_struct_37.field1; + CursorTy pvrtmp_6141 = tmp_struct_37.field2; + CursorTy pvrtmp_6142 = tmp_struct_37.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6139, jump_4170, + pvrtmp_6141, pvrtmp_6142}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6149 = *(CursorTy *) tmpcur_6112; + CursorTy tmpaftercur_6150 = tmpcur_6112 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_Content(end_r_2885, end_r_2886, loc_2884, tmpcur_6149); + CursorTy pvrtmp_6151 = tmp_struct_38.field0; + CursorTy pvrtmp_6152 = tmp_struct_38.field1; + CursorTy pvrtmp_6153 = tmp_struct_38.field2; + CursorTy pvrtmp_6154 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6151, pvrtmp_6152, + pvrtmp_6153, pvrtmp_6154}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6111"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2888, CursorTy arg_671_1282_1591) +{ + TagTyPacked tmpval_6162 = *(TagTyPacked *) arg_671_1282_1591; + CursorTy tmpcur_6163 = arg_671_1282_1591 + 1; + + + switch_6172: + ; + switch (tmpval_6162) { + + case 0: + { + CursorProd tmp_struct_39 = + _traverse_String(end_r_2888, tmpcur_6163); + CursorTy pvrtmp_6164 = tmp_struct_39.field0; + + return (CursorProd) {pvrtmp_6164}; + break; + } + + case 1: + { + CursorProd tmp_struct_40 = + _traverse_String(end_r_2888, tmpcur_6163); + CursorTy pvrtmp_6165 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6165}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6166 = *(CursorTy *) tmpcur_6163; + CursorTy tmpaftercur_6167 = tmpcur_6163 + 8; + CursorTy jump_4176 = tmpcur_6163 + 8; + CursorProd tmp_struct_41 = + _traverse_Content(end_r_2888, tmpcur_6166); + CursorTy pvrtmp_6168 = tmp_struct_41.field0; + + return (CursorProd) {jump_4176}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6169 = *(CursorTy *) tmpcur_6163; + CursorTy tmpaftercur_6170 = tmpcur_6163 + 8; + CursorProd tmp_struct_42 = + _traverse_Content(end_r_2888, tmpcur_6169); + CursorTy pvrtmp_6171 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6171}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6162"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2890, CursorTy arg_676_1287_1596) +{ + TagTyPacked tmpval_6173 = *(TagTyPacked *) arg_676_1287_1596; + CursorTy tmpcur_6174 = arg_676_1287_1596 + 1; + + + switch_6183: + ; + switch (tmpval_6173) { + + case 0: + { + unsigned char wildcard_679_1289_1598 = print_symbol(5869); + CursorProd tmp_struct_43 = _print_String(end_r_2890, tmpcur_6174); + CursorTy pvrtmp_6175 = tmp_struct_43.field0; + unsigned char wildcard_680_1291_1600 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6175}; + break; + } + + case 1: + { + unsigned char wildcard_683_1293_1602 = print_symbol(5863); + CursorProd tmp_struct_44 = _print_String(end_r_2890, tmpcur_6174); + CursorTy pvrtmp_6176 = tmp_struct_44.field0; + unsigned char wildcard_684_1295_1604 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6176}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6177 = *(CursorTy *) tmpcur_6174; + CursorTy tmpaftercur_6178 = tmpcur_6174 + 8; + CursorTy jump_4182 = tmpcur_6174 + 8; + unsigned char wildcard_4185 = print_symbol(5879); + CursorProd tmp_struct_45 = _print_Content(end_r_2890, tmpcur_6177); + CursorTy pvrtmp_6179 = tmp_struct_45.field0; + + return (CursorProd) {jump_4182}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6180 = *(CursorTy *) tmpcur_6174; + CursorTy tmpaftercur_6181 = tmpcur_6174 + 8; + unsigned char wildcard_4185 = print_symbol(5878); + CursorProd tmp_struct_46 = _print_Content(end_r_2890, tmpcur_6180); + CursorTy pvrtmp_6182 = tmp_struct_46.field0; + + return (CursorProd) {pvrtmp_6182}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6173"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2893, CursorTy end_r_2894, + CursorTy loc_2892, + CursorTy arg_685_1296_1605) +{ + if (loc_2892 + 32 > end_r_2894) { + ChunkTy new_chunk_71 = alloc_chunk(end_r_2894); + CursorTy chunk_start_72 = new_chunk_71.chunk_start; + CursorTy chunk_end_73 = new_chunk_71.chunk_end; + + end_r_2894 = chunk_end_73; + *(TagTyPacked *) loc_2892 = 255; + + CursorTy redir = loc_2892 + 1; + + *(CursorTy *) redir = chunk_start_72; + loc_2892 = chunk_start_72; + } + + CursorTy loc_3058 = loc_2892 + 1; + CursorTy loc_3059 = loc_3058 + 8; + CursorTy loc_3074 = loc_2892 + 1; + CursorTy loc_3075 = loc_3074 + 8; + CursorTy loc_3095 = loc_2892 + 1; + CursorTy loc_3096 = loc_3095 + 8; + CursorTy loc_3097 = loc_3096 + 8; + CursorTy loc_3121 = loc_2892 + 1; + CursorTy loc_3122 = loc_3121 + 8; + CursorTy loc_3123 = loc_3122 + 8; + CursorTy loc_3147 = loc_2892 + 1; + CursorTy loc_3148 = loc_3147 + 8; + CursorTy loc_3149 = loc_3148 + 8; + CursorTy loc_3173 = loc_2892 + 1; + CursorTy loc_3174 = loc_3173 + 8; + CursorTy loc_3175 = loc_3174 + 8; + CursorTy loc_3199 = loc_2892 + 1; + CursorTy loc_3200 = loc_3199 + 8; + CursorTy loc_3201 = loc_3200 + 8; + CursorTy loc_3225 = loc_2892 + 1; + CursorTy loc_3226 = loc_3225 + 8; + CursorTy loc_3227 = loc_3226 + 8; + TagTyPacked tmpval_6184 = *(TagTyPacked *) arg_685_1296_1605; + CursorTy tmpcur_6185 = arg_685_1296_1605 + 1; + + + switch_6450: + ; + switch (tmpval_6184) { + + case 0: + { + CursorTy jump_3877 = arg_685_1296_1605 + 1; + + *(TagTyPacked *) loc_2892 = 0; + + CursorTy writetag_4497 = loc_2892 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2894, jump_3877, + loc_2892, writetag_4497}; + break; + } + + case 9: + { + CursorTy tmpcur_6190 = *(CursorTy *) tmpcur_6185; + CursorTy tmpaftercur_6191 = tmpcur_6185 + 8; + CursorTy jump_3879 = tmpcur_6185 + 8; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_Content(end_r_2893, end_r_2894, loc_3059, tmpaftercur_6191); + CursorTy pvrtmp_6192 = tmp_struct_47.field0; + CursorTy pvrtmp_6193 = tmp_struct_47.field1; + CursorTy pvrtmp_6194 = tmp_struct_47.field2; + CursorTy pvrtmp_6195 = tmp_struct_47.field3; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Adt(end_r_2893, pvrtmp_6192, pvrtmp_6195, tmpcur_6190); + CursorTy pvrtmp_6200 = tmp_struct_48.field0; + CursorTy pvrtmp_6201 = tmp_struct_48.field1; + CursorTy pvrtmp_6202 = tmp_struct_48.field2; + CursorTy pvrtmp_6203 = tmp_struct_48.field3; + + *(TagTyPacked *) loc_2892 = 9; + + CursorTy writetag_4503 = loc_2892 + 1; + + *(CursorTy *) writetag_4503 = pvrtmp_6195; + + CursorTy writecur_4504 = writetag_4503 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6200, pvrtmp_6201, + loc_2892, pvrtmp_6203}; + break; + } + + case 11: + { + CursorTy tmpcur_6212 = *(CursorTy *) tmpcur_6185; + CursorTy tmpaftercur_6213 = tmpcur_6185 + 8; + CursorTy jump_3883 = tmpcur_6185 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Adt(end_r_2893, end_r_2894, loc_3075, tmpaftercur_6213); + CursorTy pvrtmp_6214 = tmp_struct_49.field0; + CursorTy pvrtmp_6215 = tmp_struct_49.field1; + CursorTy pvrtmp_6216 = tmp_struct_49.field2; + CursorTy pvrtmp_6217 = tmp_struct_49.field3; + CursorCursorCursorCursorProd tmp_struct_50 = + _copy_Content(end_r_2893, pvrtmp_6214, pvrtmp_6217, tmpcur_6212); + CursorTy pvrtmp_6222 = tmp_struct_50.field0; + CursorTy pvrtmp_6223 = tmp_struct_50.field1; + CursorTy pvrtmp_6224 = tmp_struct_50.field2; + CursorTy pvrtmp_6225 = tmp_struct_50.field3; + + *(TagTyPacked *) loc_2892 = 11; + + CursorTy writetag_4512 = loc_2892 + 1; + + *(CursorTy *) writetag_4512 = pvrtmp_6217; + + CursorTy writecur_4513 = writetag_4512 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6222, pvrtmp_6223, + loc_2892, pvrtmp_6225}; + break; + } + + case 13: + { + CursorTy tmpcur_6234 = *(CursorTy *) tmpcur_6185; + CursorTy tmpaftercur_6235 = tmpcur_6185 + 8; + CursorTy tmpcur_6236 = *(CursorTy *) tmpaftercur_6235; + CursorTy tmpaftercur_6237 = tmpaftercur_6235 + 8; + CursorTy jump_3888 = tmpaftercur_6235 + 8; + CursorTy jump_3887 = tmpcur_6185 + 8; + CursorCursorCursorCursorProd tmp_struct_51 = + _copy_Tags(end_r_2893, end_r_2894, loc_3097, tmpaftercur_6237); + CursorTy pvrtmp_6238 = tmp_struct_51.field0; + CursorTy pvrtmp_6239 = tmp_struct_51.field1; + CursorTy pvrtmp_6240 = tmp_struct_51.field2; + CursorTy pvrtmp_6241 = tmp_struct_51.field3; + CursorCursorCursorCursorProd tmp_struct_52 = + _copy_Content(end_r_2893, pvrtmp_6238, pvrtmp_6241, tmpcur_6234); + CursorTy pvrtmp_6246 = tmp_struct_52.field0; + CursorTy pvrtmp_6247 = tmp_struct_52.field1; + CursorTy pvrtmp_6248 = tmp_struct_52.field2; + CursorTy pvrtmp_6249 = tmp_struct_52.field3; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_Adt(end_r_2893, pvrtmp_6246, pvrtmp_6249, tmpcur_6236); + CursorTy pvrtmp_6254 = tmp_struct_53.field0; + CursorTy pvrtmp_6255 = tmp_struct_53.field1; + CursorTy pvrtmp_6256 = tmp_struct_53.field2; + CursorTy pvrtmp_6257 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2892 = 13; + + CursorTy writetag_4523 = loc_2892 + 1; + + *(CursorTy *) writetag_4523 = pvrtmp_6241; + + CursorTy writecur_4524 = writetag_4523 + 8; + + *(CursorTy *) writecur_4524 = pvrtmp_6249; + + CursorTy writecur_4525 = writecur_4524 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6254, pvrtmp_6255, + loc_2892, pvrtmp_6257}; + break; + } + + case 15: + { + CursorTy tmpcur_6266 = *(CursorTy *) tmpcur_6185; + CursorTy tmpaftercur_6267 = tmpcur_6185 + 8; + CursorTy tmpcur_6268 = *(CursorTy *) tmpaftercur_6267; + CursorTy tmpaftercur_6269 = tmpaftercur_6267 + 8; + CursorTy jump_3894 = tmpaftercur_6267 + 8; + CursorTy jump_3893 = tmpcur_6185 + 8; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_Adt(end_r_2893, end_r_2894, loc_3123, tmpaftercur_6269); + CursorTy pvrtmp_6270 = tmp_struct_54.field0; + CursorTy pvrtmp_6271 = tmp_struct_54.field1; + CursorTy pvrtmp_6272 = tmp_struct_54.field2; + CursorTy pvrtmp_6273 = tmp_struct_54.field3; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_Content(end_r_2893, pvrtmp_6270, pvrtmp_6273, tmpcur_6266); + CursorTy pvrtmp_6278 = tmp_struct_55.field0; + CursorTy pvrtmp_6279 = tmp_struct_55.field1; + CursorTy pvrtmp_6280 = tmp_struct_55.field2; + CursorTy pvrtmp_6281 = tmp_struct_55.field3; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_Tags(end_r_2893, pvrtmp_6278, pvrtmp_6281, tmpcur_6268); + CursorTy pvrtmp_6286 = tmp_struct_56.field0; + CursorTy pvrtmp_6287 = tmp_struct_56.field1; + CursorTy pvrtmp_6288 = tmp_struct_56.field2; + CursorTy pvrtmp_6289 = tmp_struct_56.field3; + + *(TagTyPacked *) loc_2892 = 15; + + CursorTy writetag_4536 = loc_2892 + 1; + + *(CursorTy *) writetag_4536 = pvrtmp_6273; + + CursorTy writecur_4537 = writetag_4536 + 8; + + *(CursorTy *) writecur_4537 = pvrtmp_6281; + + CursorTy writecur_4538 = writecur_4537 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6286, pvrtmp_6287, + loc_2892, pvrtmp_6289}; + break; + } + + case 17: + { + CursorTy tmpcur_6298 = *(CursorTy *) tmpcur_6185; + CursorTy tmpaftercur_6299 = tmpcur_6185 + 8; + CursorTy tmpcur_6300 = *(CursorTy *) tmpaftercur_6299; + CursorTy tmpaftercur_6301 = tmpaftercur_6299 + 8; + CursorTy jump_3900 = tmpaftercur_6299 + 8; + CursorTy jump_3899 = tmpcur_6185 + 8; + CursorCursorCursorCursorProd tmp_struct_57 = + _copy_Tags(end_r_2893, end_r_2894, loc_3149, tmpaftercur_6301); + CursorTy pvrtmp_6302 = tmp_struct_57.field0; + CursorTy pvrtmp_6303 = tmp_struct_57.field1; + CursorTy pvrtmp_6304 = tmp_struct_57.field2; + CursorTy pvrtmp_6305 = tmp_struct_57.field3; + CursorCursorCursorCursorProd tmp_struct_58 = + _copy_Adt(end_r_2893, pvrtmp_6302, pvrtmp_6305, tmpcur_6298); + CursorTy pvrtmp_6310 = tmp_struct_58.field0; + CursorTy pvrtmp_6311 = tmp_struct_58.field1; + CursorTy pvrtmp_6312 = tmp_struct_58.field2; + CursorTy pvrtmp_6313 = tmp_struct_58.field3; + CursorCursorCursorCursorProd tmp_struct_59 = + _copy_Content(end_r_2893, pvrtmp_6310, pvrtmp_6313, tmpcur_6300); + CursorTy pvrtmp_6318 = tmp_struct_59.field0; + CursorTy pvrtmp_6319 = tmp_struct_59.field1; + CursorTy pvrtmp_6320 = tmp_struct_59.field2; + CursorTy pvrtmp_6321 = tmp_struct_59.field3; + + *(TagTyPacked *) loc_2892 = 17; + + CursorTy writetag_4549 = loc_2892 + 1; + + *(CursorTy *) writetag_4549 = pvrtmp_6305; + + CursorTy writecur_4550 = writetag_4549 + 8; + + *(CursorTy *) writecur_4550 = pvrtmp_6313; + + CursorTy writecur_4551 = writecur_4550 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6318, pvrtmp_6319, + loc_2892, pvrtmp_6321}; + break; + } + + case 19: + { + CursorTy tmpcur_6330 = *(CursorTy *) tmpcur_6185; + CursorTy tmpaftercur_6331 = tmpcur_6185 + 8; + CursorTy tmpcur_6332 = *(CursorTy *) tmpaftercur_6331; + CursorTy tmpaftercur_6333 = tmpaftercur_6331 + 8; + CursorTy jump_3906 = tmpaftercur_6331 + 8; + CursorTy jump_3905 = tmpcur_6185 + 8; + CursorCursorCursorCursorProd tmp_struct_60 = + _copy_Adt(end_r_2893, end_r_2894, loc_3175, tmpaftercur_6333); + CursorTy pvrtmp_6334 = tmp_struct_60.field0; + CursorTy pvrtmp_6335 = tmp_struct_60.field1; + CursorTy pvrtmp_6336 = tmp_struct_60.field2; + CursorTy pvrtmp_6337 = tmp_struct_60.field3; + CursorCursorCursorCursorProd tmp_struct_61 = + _copy_Tags(end_r_2893, pvrtmp_6334, pvrtmp_6337, tmpcur_6330); + CursorTy pvrtmp_6342 = tmp_struct_61.field0; + CursorTy pvrtmp_6343 = tmp_struct_61.field1; + CursorTy pvrtmp_6344 = tmp_struct_61.field2; + CursorTy pvrtmp_6345 = tmp_struct_61.field3; + CursorCursorCursorCursorProd tmp_struct_62 = + _copy_Content(end_r_2893, pvrtmp_6342, pvrtmp_6345, tmpcur_6332); + CursorTy pvrtmp_6350 = tmp_struct_62.field0; + CursorTy pvrtmp_6351 = tmp_struct_62.field1; + CursorTy pvrtmp_6352 = tmp_struct_62.field2; + CursorTy pvrtmp_6353 = tmp_struct_62.field3; + + *(TagTyPacked *) loc_2892 = 19; + + CursorTy writetag_4562 = loc_2892 + 1; + + *(CursorTy *) writetag_4562 = pvrtmp_6337; + + CursorTy writecur_4563 = writetag_4562 + 8; + + *(CursorTy *) writecur_4563 = pvrtmp_6345; + + CursorTy writecur_4564 = writecur_4563 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6350, pvrtmp_6351, + loc_2892, pvrtmp_6353}; + break; + } + + case 21: + { + CursorTy tmpcur_6362 = *(CursorTy *) tmpcur_6185; + CursorTy tmpaftercur_6363 = tmpcur_6185 + 8; + CursorTy tmpcur_6364 = *(CursorTy *) tmpaftercur_6363; + CursorTy tmpaftercur_6365 = tmpaftercur_6363 + 8; + CursorTy jump_3912 = tmpaftercur_6363 + 8; + CursorTy jump_3911 = tmpcur_6185 + 8; + CursorCursorCursorCursorProd tmp_struct_63 = + _copy_Content(end_r_2893, end_r_2894, loc_3201, tmpaftercur_6365); + CursorTy pvrtmp_6366 = tmp_struct_63.field0; + CursorTy pvrtmp_6367 = tmp_struct_63.field1; + CursorTy pvrtmp_6368 = tmp_struct_63.field2; + CursorTy pvrtmp_6369 = tmp_struct_63.field3; + CursorCursorCursorCursorProd tmp_struct_64 = + _copy_Tags(end_r_2893, pvrtmp_6366, pvrtmp_6369, tmpcur_6362); + CursorTy pvrtmp_6374 = tmp_struct_64.field0; + CursorTy pvrtmp_6375 = tmp_struct_64.field1; + CursorTy pvrtmp_6376 = tmp_struct_64.field2; + CursorTy pvrtmp_6377 = tmp_struct_64.field3; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Adt(end_r_2893, pvrtmp_6374, pvrtmp_6377, tmpcur_6364); + CursorTy pvrtmp_6382 = tmp_struct_65.field0; + CursorTy pvrtmp_6383 = tmp_struct_65.field1; + CursorTy pvrtmp_6384 = tmp_struct_65.field2; + CursorTy pvrtmp_6385 = tmp_struct_65.field3; + + *(TagTyPacked *) loc_2892 = 21; + + CursorTy writetag_4575 = loc_2892 + 1; + + *(CursorTy *) writetag_4575 = pvrtmp_6369; + + CursorTy writecur_4576 = writetag_4575 + 8; + + *(CursorTy *) writecur_4576 = pvrtmp_6377; + + CursorTy writecur_4577 = writecur_4576 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6382, pvrtmp_6383, + loc_2892, pvrtmp_6385}; + break; + } + + case 23: + { + CursorTy tmpcur_6394 = *(CursorTy *) tmpcur_6185; + CursorTy tmpaftercur_6395 = tmpcur_6185 + 8; + CursorTy tmpcur_6396 = *(CursorTy *) tmpaftercur_6395; + CursorTy tmpaftercur_6397 = tmpaftercur_6395 + 8; + CursorTy jump_3918 = tmpaftercur_6395 + 8; + CursorTy jump_3917 = tmpcur_6185 + 8; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Content(end_r_2893, end_r_2894, loc_3227, tmpaftercur_6397); + CursorTy pvrtmp_6398 = tmp_struct_66.field0; + CursorTy pvrtmp_6399 = tmp_struct_66.field1; + CursorTy pvrtmp_6400 = tmp_struct_66.field2; + CursorTy pvrtmp_6401 = tmp_struct_66.field3; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2893, pvrtmp_6398, pvrtmp_6401, tmpcur_6394); + CursorTy pvrtmp_6406 = tmp_struct_67.field0; + CursorTy pvrtmp_6407 = tmp_struct_67.field1; + CursorTy pvrtmp_6408 = tmp_struct_67.field2; + CursorTy pvrtmp_6409 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Tags(end_r_2893, pvrtmp_6406, pvrtmp_6409, tmpcur_6396); + CursorTy pvrtmp_6414 = tmp_struct_68.field0; + CursorTy pvrtmp_6415 = tmp_struct_68.field1; + CursorTy pvrtmp_6416 = tmp_struct_68.field2; + CursorTy pvrtmp_6417 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2892 = 23; + + CursorTy writetag_4588 = loc_2892 + 1; + + *(CursorTy *) writetag_4588 = pvrtmp_6401; + + CursorTy writecur_4589 = writetag_4588 + 8; + + *(CursorTy *) writecur_4589 = pvrtmp_6409; + + CursorTy writecur_4590 = writecur_4589 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6414, pvrtmp_6415, + loc_2892, pvrtmp_6417}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6426 = *(CursorTy *) tmpcur_6185; + CursorTy tmpaftercur_6427 = tmpcur_6185 + 8; + CursorTy jump_4188 = tmpcur_6185 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Adt(end_r_2893, end_r_2894, loc_2892, tmpcur_6426); + CursorTy pvrtmp_6428 = tmp_struct_69.field0; + CursorTy pvrtmp_6429 = tmp_struct_69.field1; + CursorTy pvrtmp_6430 = tmp_struct_69.field2; + CursorTy pvrtmp_6431 = tmp_struct_69.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6428, jump_4188, + pvrtmp_6430, pvrtmp_6431}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6438 = *(CursorTy *) tmpcur_6185; + CursorTy tmpaftercur_6439 = tmpcur_6185 + 8; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Adt(end_r_2893, end_r_2894, loc_2892, tmpcur_6438); + CursorTy pvrtmp_6440 = tmp_struct_70.field0; + CursorTy pvrtmp_6441 = tmp_struct_70.field1; + CursorTy pvrtmp_6442 = tmp_struct_70.field2; + CursorTy pvrtmp_6443 = tmp_struct_70.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6440, pvrtmp_6441, + pvrtmp_6442, pvrtmp_6443}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6184"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2897, + CursorTy end_r_2898, + CursorTy loc_2896, + CursorTy arg_730_1341_1650) +{ + TagTyPacked tmpval_6451 = *(TagTyPacked *) arg_730_1341_1650; + CursorTy tmpcur_6452 = arg_730_1341_1650 + 1; + + + switch_6717: + ; + switch (tmpval_6451) { + + case 0: + { + CursorTy jump_3923 = arg_730_1341_1650 + 1; + + *(TagTyPacked *) loc_2896 = 0; + + CursorTy writetag_4602 = loc_2896 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2898, jump_3923, + loc_2896, writetag_4602}; + break; + } + + case 9: + { + CursorTy tmpcur_6457 = *(CursorTy *) tmpcur_6452; + CursorTy tmpaftercur_6458 = tmpcur_6452 + 8; + CursorTy jump_3925 = tmpcur_6452 + 8; + CursorTy loc_3249 = loc_2896 + 1; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_without_ptrs_Content(end_r_2897, end_r_2898, loc_3249, tmpaftercur_6458); + CursorTy pvrtmp_6459 = tmp_struct_74.field0; + CursorTy pvrtmp_6460 = tmp_struct_74.field1; + CursorTy pvrtmp_6461 = tmp_struct_74.field2; + CursorTy pvrtmp_6462 = tmp_struct_74.field3; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_without_ptrs_Adt(end_r_2897, pvrtmp_6459, pvrtmp_6462, tmpcur_6457); + CursorTy pvrtmp_6467 = tmp_struct_75.field0; + CursorTy pvrtmp_6468 = tmp_struct_75.field1; + CursorTy pvrtmp_6469 = tmp_struct_75.field2; + CursorTy pvrtmp_6470 = tmp_struct_75.field3; + + *(TagTyPacked *) loc_2896 = 1; + + CursorTy writetag_4608 = loc_2896 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6467, pvrtmp_6468, + loc_2896, pvrtmp_6470}; + break; + } + + case 11: + { + CursorTy tmpcur_6479 = *(CursorTy *) tmpcur_6452; + CursorTy tmpaftercur_6480 = tmpcur_6452 + 8; + CursorTy jump_3929 = tmpcur_6452 + 8; + CursorTy loc_3262 = loc_2896 + 1; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_without_ptrs_Adt(end_r_2897, end_r_2898, loc_3262, tmpaftercur_6480); + CursorTy pvrtmp_6481 = tmp_struct_76.field0; + CursorTy pvrtmp_6482 = tmp_struct_76.field1; + CursorTy pvrtmp_6483 = tmp_struct_76.field2; + CursorTy pvrtmp_6484 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_without_ptrs_Content(end_r_2897, pvrtmp_6481, pvrtmp_6484, tmpcur_6479); + CursorTy pvrtmp_6489 = tmp_struct_77.field0; + CursorTy pvrtmp_6490 = tmp_struct_77.field1; + CursorTy pvrtmp_6491 = tmp_struct_77.field2; + CursorTy pvrtmp_6492 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2896 = 2; + + CursorTy writetag_4616 = loc_2896 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6489, pvrtmp_6490, + loc_2896, pvrtmp_6492}; + break; + } + + case 13: + { + CursorTy tmpcur_6501 = *(CursorTy *) tmpcur_6452; + CursorTy tmpaftercur_6502 = tmpcur_6452 + 8; + CursorTy tmpcur_6503 = *(CursorTy *) tmpaftercur_6502; + CursorTy tmpaftercur_6504 = tmpaftercur_6502 + 8; + CursorTy jump_3934 = tmpaftercur_6502 + 8; + CursorTy jump_3933 = tmpcur_6452 + 8; + CursorTy loc_3280 = loc_2896 + 1; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_without_ptrs_Tags(end_r_2897, end_r_2898, loc_3280, tmpaftercur_6504); + CursorTy pvrtmp_6505 = tmp_struct_78.field0; + CursorTy pvrtmp_6506 = tmp_struct_78.field1; + CursorTy pvrtmp_6507 = tmp_struct_78.field2; + CursorTy pvrtmp_6508 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_without_ptrs_Content(end_r_2897, pvrtmp_6505, pvrtmp_6508, tmpcur_6501); + CursorTy pvrtmp_6513 = tmp_struct_79.field0; + CursorTy pvrtmp_6514 = tmp_struct_79.field1; + CursorTy pvrtmp_6515 = tmp_struct_79.field2; + CursorTy pvrtmp_6516 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_without_ptrs_Adt(end_r_2897, pvrtmp_6513, pvrtmp_6516, tmpcur_6503); + CursorTy pvrtmp_6521 = tmp_struct_80.field0; + CursorTy pvrtmp_6522 = tmp_struct_80.field1; + CursorTy pvrtmp_6523 = tmp_struct_80.field2; + CursorTy pvrtmp_6524 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2896 = 3; + + CursorTy writetag_4626 = loc_2896 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6521, pvrtmp_6522, + loc_2896, pvrtmp_6524}; + break; + } + + case 15: + { + CursorTy tmpcur_6533 = *(CursorTy *) tmpcur_6452; + CursorTy tmpaftercur_6534 = tmpcur_6452 + 8; + CursorTy tmpcur_6535 = *(CursorTy *) tmpaftercur_6534; + CursorTy tmpaftercur_6536 = tmpaftercur_6534 + 8; + CursorTy jump_3940 = tmpaftercur_6534 + 8; + CursorTy jump_3939 = tmpcur_6452 + 8; + CursorTy loc_3300 = loc_2896 + 1; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_without_ptrs_Adt(end_r_2897, end_r_2898, loc_3300, tmpaftercur_6536); + CursorTy pvrtmp_6537 = tmp_struct_81.field0; + CursorTy pvrtmp_6538 = tmp_struct_81.field1; + CursorTy pvrtmp_6539 = tmp_struct_81.field2; + CursorTy pvrtmp_6540 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_without_ptrs_Content(end_r_2897, pvrtmp_6537, pvrtmp_6540, tmpcur_6533); + CursorTy pvrtmp_6545 = tmp_struct_82.field0; + CursorTy pvrtmp_6546 = tmp_struct_82.field1; + CursorTy pvrtmp_6547 = tmp_struct_82.field2; + CursorTy pvrtmp_6548 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_without_ptrs_Tags(end_r_2897, pvrtmp_6545, pvrtmp_6548, tmpcur_6535); + CursorTy pvrtmp_6553 = tmp_struct_83.field0; + CursorTy pvrtmp_6554 = tmp_struct_83.field1; + CursorTy pvrtmp_6555 = tmp_struct_83.field2; + CursorTy pvrtmp_6556 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2896 = 4; + + CursorTy writetag_4637 = loc_2896 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6553, pvrtmp_6554, + loc_2896, pvrtmp_6556}; + break; + } + + case 17: + { + CursorTy tmpcur_6565 = *(CursorTy *) tmpcur_6452; + CursorTy tmpaftercur_6566 = tmpcur_6452 + 8; + CursorTy tmpcur_6567 = *(CursorTy *) tmpaftercur_6566; + CursorTy tmpaftercur_6568 = tmpaftercur_6566 + 8; + CursorTy jump_3946 = tmpaftercur_6566 + 8; + CursorTy jump_3945 = tmpcur_6452 + 8; + CursorTy loc_3320 = loc_2896 + 1; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_without_ptrs_Tags(end_r_2897, end_r_2898, loc_3320, tmpaftercur_6568); + CursorTy pvrtmp_6569 = tmp_struct_84.field0; + CursorTy pvrtmp_6570 = tmp_struct_84.field1; + CursorTy pvrtmp_6571 = tmp_struct_84.field2; + CursorTy pvrtmp_6572 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_without_ptrs_Adt(end_r_2897, pvrtmp_6569, pvrtmp_6572, tmpcur_6565); + CursorTy pvrtmp_6577 = tmp_struct_85.field0; + CursorTy pvrtmp_6578 = tmp_struct_85.field1; + CursorTy pvrtmp_6579 = tmp_struct_85.field2; + CursorTy pvrtmp_6580 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_without_ptrs_Content(end_r_2897, pvrtmp_6577, pvrtmp_6580, tmpcur_6567); + CursorTy pvrtmp_6585 = tmp_struct_86.field0; + CursorTy pvrtmp_6586 = tmp_struct_86.field1; + CursorTy pvrtmp_6587 = tmp_struct_86.field2; + CursorTy pvrtmp_6588 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2896 = 5; + + CursorTy writetag_4648 = loc_2896 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6585, pvrtmp_6586, + loc_2896, pvrtmp_6588}; + break; + } + + case 19: + { + CursorTy tmpcur_6597 = *(CursorTy *) tmpcur_6452; + CursorTy tmpaftercur_6598 = tmpcur_6452 + 8; + CursorTy tmpcur_6599 = *(CursorTy *) tmpaftercur_6598; + CursorTy tmpaftercur_6600 = tmpaftercur_6598 + 8; + CursorTy jump_3952 = tmpaftercur_6598 + 8; + CursorTy jump_3951 = tmpcur_6452 + 8; + CursorTy loc_3340 = loc_2896 + 1; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_without_ptrs_Adt(end_r_2897, end_r_2898, loc_3340, tmpaftercur_6600); + CursorTy pvrtmp_6601 = tmp_struct_87.field0; + CursorTy pvrtmp_6602 = tmp_struct_87.field1; + CursorTy pvrtmp_6603 = tmp_struct_87.field2; + CursorTy pvrtmp_6604 = tmp_struct_87.field3; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_without_ptrs_Tags(end_r_2897, pvrtmp_6601, pvrtmp_6604, tmpcur_6597); + CursorTy pvrtmp_6609 = tmp_struct_88.field0; + CursorTy pvrtmp_6610 = tmp_struct_88.field1; + CursorTy pvrtmp_6611 = tmp_struct_88.field2; + CursorTy pvrtmp_6612 = tmp_struct_88.field3; + CursorCursorCursorCursorProd tmp_struct_89 = + _copy_without_ptrs_Content(end_r_2897, pvrtmp_6609, pvrtmp_6612, tmpcur_6599); + CursorTy pvrtmp_6617 = tmp_struct_89.field0; + CursorTy pvrtmp_6618 = tmp_struct_89.field1; + CursorTy pvrtmp_6619 = tmp_struct_89.field2; + CursorTy pvrtmp_6620 = tmp_struct_89.field3; + + *(TagTyPacked *) loc_2896 = 6; + + CursorTy writetag_4659 = loc_2896 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6617, pvrtmp_6618, + loc_2896, pvrtmp_6620}; + break; + } + + case 21: + { + CursorTy tmpcur_6629 = *(CursorTy *) tmpcur_6452; + CursorTy tmpaftercur_6630 = tmpcur_6452 + 8; + CursorTy tmpcur_6631 = *(CursorTy *) tmpaftercur_6630; + CursorTy tmpaftercur_6632 = tmpaftercur_6630 + 8; + CursorTy jump_3958 = tmpaftercur_6630 + 8; + CursorTy jump_3957 = tmpcur_6452 + 8; + CursorTy loc_3360 = loc_2896 + 1; + CursorCursorCursorCursorProd tmp_struct_90 = + _copy_without_ptrs_Content(end_r_2897, end_r_2898, loc_3360, tmpaftercur_6632); + CursorTy pvrtmp_6633 = tmp_struct_90.field0; + CursorTy pvrtmp_6634 = tmp_struct_90.field1; + CursorTy pvrtmp_6635 = tmp_struct_90.field2; + CursorTy pvrtmp_6636 = tmp_struct_90.field3; + CursorCursorCursorCursorProd tmp_struct_91 = + _copy_without_ptrs_Tags(end_r_2897, pvrtmp_6633, pvrtmp_6636, tmpcur_6629); + CursorTy pvrtmp_6641 = tmp_struct_91.field0; + CursorTy pvrtmp_6642 = tmp_struct_91.field1; + CursorTy pvrtmp_6643 = tmp_struct_91.field2; + CursorTy pvrtmp_6644 = tmp_struct_91.field3; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Adt(end_r_2897, pvrtmp_6641, pvrtmp_6644, tmpcur_6631); + CursorTy pvrtmp_6649 = tmp_struct_92.field0; + CursorTy pvrtmp_6650 = tmp_struct_92.field1; + CursorTy pvrtmp_6651 = tmp_struct_92.field2; + CursorTy pvrtmp_6652 = tmp_struct_92.field3; + + *(TagTyPacked *) loc_2896 = 7; + + CursorTy writetag_4670 = loc_2896 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6649, pvrtmp_6650, + loc_2896, pvrtmp_6652}; + break; + } + + case 23: + { + CursorTy tmpcur_6661 = *(CursorTy *) tmpcur_6452; + CursorTy tmpaftercur_6662 = tmpcur_6452 + 8; + CursorTy tmpcur_6663 = *(CursorTy *) tmpaftercur_6662; + CursorTy tmpaftercur_6664 = tmpaftercur_6662 + 8; + CursorTy jump_3964 = tmpaftercur_6662 + 8; + CursorTy jump_3963 = tmpcur_6452 + 8; + CursorTy loc_3380 = loc_2896 + 1; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Content(end_r_2897, end_r_2898, loc_3380, tmpaftercur_6664); + CursorTy pvrtmp_6665 = tmp_struct_93.field0; + CursorTy pvrtmp_6666 = tmp_struct_93.field1; + CursorTy pvrtmp_6667 = tmp_struct_93.field2; + CursorTy pvrtmp_6668 = tmp_struct_93.field3; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2897, pvrtmp_6665, pvrtmp_6668, tmpcur_6661); + CursorTy pvrtmp_6673 = tmp_struct_94.field0; + CursorTy pvrtmp_6674 = tmp_struct_94.field1; + CursorTy pvrtmp_6675 = tmp_struct_94.field2; + CursorTy pvrtmp_6676 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Tags(end_r_2897, pvrtmp_6673, pvrtmp_6676, tmpcur_6663); + CursorTy pvrtmp_6681 = tmp_struct_95.field0; + CursorTy pvrtmp_6682 = tmp_struct_95.field1; + CursorTy pvrtmp_6683 = tmp_struct_95.field2; + CursorTy pvrtmp_6684 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2896 = 8; + + CursorTy writetag_4681 = loc_2896 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6681, pvrtmp_6682, + loc_2896, pvrtmp_6684}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6693 = *(CursorTy *) tmpcur_6452; + CursorTy tmpaftercur_6694 = tmpcur_6452 + 8; + CursorTy jump_4194 = tmpcur_6452 + 8; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Adt(end_r_2897, end_r_2898, loc_2896, tmpcur_6693); + CursorTy pvrtmp_6695 = tmp_struct_96.field0; + CursorTy pvrtmp_6696 = tmp_struct_96.field1; + CursorTy pvrtmp_6697 = tmp_struct_96.field2; + CursorTy pvrtmp_6698 = tmp_struct_96.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6695, jump_4194, + pvrtmp_6697, pvrtmp_6698}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6705 = *(CursorTy *) tmpcur_6452; + CursorTy tmpaftercur_6706 = tmpcur_6452 + 8; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Adt(end_r_2897, end_r_2898, loc_2896, tmpcur_6705); + CursorTy pvrtmp_6707 = tmp_struct_97.field0; + CursorTy pvrtmp_6708 = tmp_struct_97.field1; + CursorTy pvrtmp_6709 = tmp_struct_97.field2; + CursorTy pvrtmp_6710 = tmp_struct_97.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6707, pvrtmp_6708, + pvrtmp_6709, pvrtmp_6710}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6451"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2900, CursorTy arg_775_1386_1695) +{ + TagTyPacked tmpval_6718 = *(TagTyPacked *) arg_775_1386_1695; + CursorTy tmpcur_6719 = arg_775_1386_1695 + 1; + + + switch_6776: + ; + switch (tmpval_6718) { + + case 0: + { + CursorTy jump_3969 = arg_775_1386_1695 + 1; + + return (CursorProd) {jump_3969}; + break; + } + + case 9: + { + CursorTy tmpcur_6720 = *(CursorTy *) tmpcur_6719; + CursorTy tmpaftercur_6721 = tmpcur_6719 + 8; + CursorTy jump_3971 = tmpcur_6719 + 8; + CursorProd tmp_struct_98 = + _traverse_Content(end_r_2900, tmpaftercur_6721); + CursorTy pvrtmp_6722 = tmp_struct_98.field0; + CursorProd tmp_struct_99 = _traverse_Adt(end_r_2900, tmpcur_6720); + CursorTy pvrtmp_6723 = tmp_struct_99.field0; + + return (CursorProd) {pvrtmp_6723}; + break; + } + + case 11: + { + CursorTy tmpcur_6724 = *(CursorTy *) tmpcur_6719; + CursorTy tmpaftercur_6725 = tmpcur_6719 + 8; + CursorTy jump_3975 = tmpcur_6719 + 8; + CursorProd tmp_struct_100 = + _traverse_Adt(end_r_2900, tmpaftercur_6725); + CursorTy pvrtmp_6726 = tmp_struct_100.field0; + CursorProd tmp_struct_101 = + _traverse_Content(end_r_2900, tmpcur_6724); + CursorTy pvrtmp_6727 = tmp_struct_101.field0; + + return (CursorProd) {pvrtmp_6727}; + break; + } + + case 13: + { + CursorTy tmpcur_6728 = *(CursorTy *) tmpcur_6719; + CursorTy tmpaftercur_6729 = tmpcur_6719 + 8; + CursorTy tmpcur_6730 = *(CursorTy *) tmpaftercur_6729; + CursorTy tmpaftercur_6731 = tmpaftercur_6729 + 8; + CursorTy jump_3980 = tmpaftercur_6729 + 8; + CursorTy jump_3979 = tmpcur_6719 + 8; + CursorProd tmp_struct_102 = + _traverse_Tags(end_r_2900, tmpaftercur_6731); + CursorTy pvrtmp_6732 = tmp_struct_102.field0; + CursorProd tmp_struct_103 = + _traverse_Content(end_r_2900, tmpcur_6728); + CursorTy pvrtmp_6733 = tmp_struct_103.field0; + CursorProd tmp_struct_104 = _traverse_Adt(end_r_2900, tmpcur_6730); + CursorTy pvrtmp_6734 = tmp_struct_104.field0; + + return (CursorProd) {pvrtmp_6734}; + break; + } + + case 15: + { + CursorTy tmpcur_6735 = *(CursorTy *) tmpcur_6719; + CursorTy tmpaftercur_6736 = tmpcur_6719 + 8; + CursorTy tmpcur_6737 = *(CursorTy *) tmpaftercur_6736; + CursorTy tmpaftercur_6738 = tmpaftercur_6736 + 8; + CursorTy jump_3986 = tmpaftercur_6736 + 8; + CursorTy jump_3985 = tmpcur_6719 + 8; + CursorProd tmp_struct_105 = + _traverse_Adt(end_r_2900, tmpaftercur_6738); + CursorTy pvrtmp_6739 = tmp_struct_105.field0; + CursorProd tmp_struct_106 = + _traverse_Content(end_r_2900, tmpcur_6735); + CursorTy pvrtmp_6740 = tmp_struct_106.field0; + CursorProd tmp_struct_107 = + _traverse_Tags(end_r_2900, tmpcur_6737); + CursorTy pvrtmp_6741 = tmp_struct_107.field0; + + return (CursorProd) {pvrtmp_6741}; + break; + } + + case 17: + { + CursorTy tmpcur_6742 = *(CursorTy *) tmpcur_6719; + CursorTy tmpaftercur_6743 = tmpcur_6719 + 8; + CursorTy tmpcur_6744 = *(CursorTy *) tmpaftercur_6743; + CursorTy tmpaftercur_6745 = tmpaftercur_6743 + 8; + CursorTy jump_3992 = tmpaftercur_6743 + 8; + CursorTy jump_3991 = tmpcur_6719 + 8; + CursorProd tmp_struct_108 = + _traverse_Tags(end_r_2900, tmpaftercur_6745); + CursorTy pvrtmp_6746 = tmp_struct_108.field0; + CursorProd tmp_struct_109 = _traverse_Adt(end_r_2900, tmpcur_6742); + CursorTy pvrtmp_6747 = tmp_struct_109.field0; + CursorProd tmp_struct_110 = + _traverse_Content(end_r_2900, tmpcur_6744); + CursorTy pvrtmp_6748 = tmp_struct_110.field0; + + return (CursorProd) {pvrtmp_6748}; + break; + } + + case 19: + { + CursorTy tmpcur_6749 = *(CursorTy *) tmpcur_6719; + CursorTy tmpaftercur_6750 = tmpcur_6719 + 8; + CursorTy tmpcur_6751 = *(CursorTy *) tmpaftercur_6750; + CursorTy tmpaftercur_6752 = tmpaftercur_6750 + 8; + CursorTy jump_3998 = tmpaftercur_6750 + 8; + CursorTy jump_3997 = tmpcur_6719 + 8; + CursorProd tmp_struct_111 = + _traverse_Adt(end_r_2900, tmpaftercur_6752); + CursorTy pvrtmp_6753 = tmp_struct_111.field0; + CursorProd tmp_struct_112 = + _traverse_Tags(end_r_2900, tmpcur_6749); + CursorTy pvrtmp_6754 = tmp_struct_112.field0; + CursorProd tmp_struct_113 = + _traverse_Content(end_r_2900, tmpcur_6751); + CursorTy pvrtmp_6755 = tmp_struct_113.field0; + + return (CursorProd) {pvrtmp_6755}; + break; + } + + case 21: + { + CursorTy tmpcur_6756 = *(CursorTy *) tmpcur_6719; + CursorTy tmpaftercur_6757 = tmpcur_6719 + 8; + CursorTy tmpcur_6758 = *(CursorTy *) tmpaftercur_6757; + CursorTy tmpaftercur_6759 = tmpaftercur_6757 + 8; + CursorTy jump_4004 = tmpaftercur_6757 + 8; + CursorTy jump_4003 = tmpcur_6719 + 8; + CursorProd tmp_struct_114 = + _traverse_Content(end_r_2900, tmpaftercur_6759); + CursorTy pvrtmp_6760 = tmp_struct_114.field0; + CursorProd tmp_struct_115 = + _traverse_Tags(end_r_2900, tmpcur_6756); + CursorTy pvrtmp_6761 = tmp_struct_115.field0; + CursorProd tmp_struct_116 = _traverse_Adt(end_r_2900, tmpcur_6758); + CursorTy pvrtmp_6762 = tmp_struct_116.field0; + + return (CursorProd) {pvrtmp_6762}; + break; + } + + case 23: + { + CursorTy tmpcur_6763 = *(CursorTy *) tmpcur_6719; + CursorTy tmpaftercur_6764 = tmpcur_6719 + 8; + CursorTy tmpcur_6765 = *(CursorTy *) tmpaftercur_6764; + CursorTy tmpaftercur_6766 = tmpaftercur_6764 + 8; + CursorTy jump_4010 = tmpaftercur_6764 + 8; + CursorTy jump_4009 = tmpcur_6719 + 8; + CursorProd tmp_struct_117 = + _traverse_Content(end_r_2900, tmpaftercur_6766); + CursorTy pvrtmp_6767 = tmp_struct_117.field0; + CursorProd tmp_struct_118 = _traverse_Adt(end_r_2900, tmpcur_6763); + CursorTy pvrtmp_6768 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Tags(end_r_2900, tmpcur_6765); + CursorTy pvrtmp_6769 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_6769}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6770 = *(CursorTy *) tmpcur_6719; + CursorTy tmpaftercur_6771 = tmpcur_6719 + 8; + CursorTy jump_4200 = tmpcur_6719 + 8; + CursorProd tmp_struct_120 = _traverse_Adt(end_r_2900, tmpcur_6770); + CursorTy pvrtmp_6772 = tmp_struct_120.field0; + + return (CursorProd) {jump_4200}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6773 = *(CursorTy *) tmpcur_6719; + CursorTy tmpaftercur_6774 = tmpcur_6719 + 8; + CursorProd tmp_struct_121 = _traverse_Adt(end_r_2900, tmpcur_6773); + CursorTy pvrtmp_6775 = tmp_struct_121.field0; + + return (CursorProd) {pvrtmp_6775}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6718"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2902, CursorTy arg_820_1431_1740) +{ + TagTyPacked tmpval_6777 = *(TagTyPacked *) arg_820_1431_1740; + CursorTy tmpcur_6778 = arg_820_1431_1740 + 1; + + + switch_6835: + ; + switch (tmpval_6777) { + + case 0: + { + CursorTy jump_4015 = arg_820_1431_1740 + 1; + unsigned char wildcard_821_1432_1741 = print_symbol(5868); + unsigned char wildcard_822_1433_1742 = print_symbol(5862); + + return (CursorProd) {jump_4015}; + break; + } + + case 9: + { + CursorTy tmpcur_6779 = *(CursorTy *) tmpcur_6778; + CursorTy tmpaftercur_6780 = tmpcur_6778 + 8; + CursorTy jump_4017 = tmpcur_6778 + 8; + unsigned char wildcard_827_1436_1745 = print_symbol(5874); + CursorProd tmp_struct_122 = + _print_Content(end_r_2902, tmpaftercur_6780); + CursorTy pvrtmp_6781 = tmp_struct_122.field0; + CursorProd tmp_struct_123 = _print_Adt(end_r_2902, tmpcur_6779); + CursorTy pvrtmp_6782 = tmp_struct_123.field0; + unsigned char wildcard_828_1439_1748 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6782}; + break; + } + + case 11: + { + CursorTy tmpcur_6783 = *(CursorTy *) tmpcur_6778; + CursorTy tmpaftercur_6784 = tmpcur_6778 + 8; + CursorTy jump_4021 = tmpcur_6778 + 8; + unsigned char wildcard_833_1442_1751 = print_symbol(5877); + CursorProd tmp_struct_124 = + _print_Adt(end_r_2902, tmpaftercur_6784); + CursorTy pvrtmp_6785 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _print_Content(end_r_2902, tmpcur_6783); + CursorTy pvrtmp_6786 = tmp_struct_125.field0; + unsigned char wildcard_834_1445_1754 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6786}; + break; + } + + case 13: + { + CursorTy tmpcur_6787 = *(CursorTy *) tmpcur_6778; + CursorTy tmpaftercur_6788 = tmpcur_6778 + 8; + CursorTy tmpcur_6789 = *(CursorTy *) tmpaftercur_6788; + CursorTy tmpaftercur_6790 = tmpaftercur_6788 + 8; + CursorTy jump_4026 = tmpaftercur_6788 + 8; + CursorTy jump_4025 = tmpcur_6778 + 8; + unsigned char wildcard_841_1449_1758 = print_symbol(5865); + CursorProd tmp_struct_126 = + _print_Tags(end_r_2902, tmpaftercur_6790); + CursorTy pvrtmp_6791 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = + _print_Content(end_r_2902, tmpcur_6787); + CursorTy pvrtmp_6792 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = _print_Adt(end_r_2902, tmpcur_6789); + CursorTy pvrtmp_6793 = tmp_struct_128.field0; + unsigned char wildcard_842_1453_1762 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6793}; + break; + } + + case 15: + { + CursorTy tmpcur_6794 = *(CursorTy *) tmpcur_6778; + CursorTy tmpaftercur_6795 = tmpcur_6778 + 8; + CursorTy tmpcur_6796 = *(CursorTy *) tmpaftercur_6795; + CursorTy tmpaftercur_6797 = tmpaftercur_6795 + 8; + CursorTy jump_4032 = tmpaftercur_6795 + 8; + CursorTy jump_4031 = tmpcur_6778 + 8; + unsigned char wildcard_849_1457_1766 = print_symbol(5876); + CursorProd tmp_struct_129 = + _print_Adt(end_r_2902, tmpaftercur_6797); + CursorTy pvrtmp_6798 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _print_Content(end_r_2902, tmpcur_6794); + CursorTy pvrtmp_6799 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = _print_Tags(end_r_2902, tmpcur_6796); + CursorTy pvrtmp_6800 = tmp_struct_131.field0; + unsigned char wildcard_850_1461_1770 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6800}; + break; + } + + case 17: + { + CursorTy tmpcur_6801 = *(CursorTy *) tmpcur_6778; + CursorTy tmpaftercur_6802 = tmpcur_6778 + 8; + CursorTy tmpcur_6803 = *(CursorTy *) tmpaftercur_6802; + CursorTy tmpaftercur_6804 = tmpaftercur_6802 + 8; + CursorTy jump_4038 = tmpaftercur_6802 + 8; + CursorTy jump_4037 = tmpcur_6778 + 8; + unsigned char wildcard_857_1465_1774 = print_symbol(5866); + CursorProd tmp_struct_132 = + _print_Tags(end_r_2902, tmpaftercur_6804); + CursorTy pvrtmp_6805 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = _print_Adt(end_r_2902, tmpcur_6801); + CursorTy pvrtmp_6806 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = + _print_Content(end_r_2902, tmpcur_6803); + CursorTy pvrtmp_6807 = tmp_struct_134.field0; + unsigned char wildcard_858_1469_1778 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6807}; + break; + } + + case 19: + { + CursorTy tmpcur_6808 = *(CursorTy *) tmpcur_6778; + CursorTy tmpaftercur_6809 = tmpcur_6778 + 8; + CursorTy tmpcur_6810 = *(CursorTy *) tmpaftercur_6809; + CursorTy tmpaftercur_6811 = tmpaftercur_6809 + 8; + CursorTy jump_4044 = tmpaftercur_6809 + 8; + CursorTy jump_4043 = tmpcur_6778 + 8; + unsigned char wildcard_865_1473_1782 = print_symbol(5875); + CursorProd tmp_struct_135 = + _print_Adt(end_r_2902, tmpaftercur_6811); + CursorTy pvrtmp_6812 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _print_Tags(end_r_2902, tmpcur_6808); + CursorTy pvrtmp_6813 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _print_Content(end_r_2902, tmpcur_6810); + CursorTy pvrtmp_6814 = tmp_struct_137.field0; + unsigned char wildcard_866_1477_1786 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6814}; + break; + } + + case 21: + { + CursorTy tmpcur_6815 = *(CursorTy *) tmpcur_6778; + CursorTy tmpaftercur_6816 = tmpcur_6778 + 8; + CursorTy tmpcur_6817 = *(CursorTy *) tmpaftercur_6816; + CursorTy tmpaftercur_6818 = tmpaftercur_6816 + 8; + CursorTy jump_4050 = tmpaftercur_6816 + 8; + CursorTy jump_4049 = tmpcur_6778 + 8; + unsigned char wildcard_873_1481_1790 = print_symbol(5872); + CursorProd tmp_struct_138 = + _print_Content(end_r_2902, tmpaftercur_6818); + CursorTy pvrtmp_6819 = tmp_struct_138.field0; + CursorProd tmp_struct_139 = _print_Tags(end_r_2902, tmpcur_6815); + CursorTy pvrtmp_6820 = tmp_struct_139.field0; + CursorProd tmp_struct_140 = _print_Adt(end_r_2902, tmpcur_6817); + CursorTy pvrtmp_6821 = tmp_struct_140.field0; + unsigned char wildcard_874_1485_1794 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6821}; + break; + } + + case 23: + { + CursorTy tmpcur_6822 = *(CursorTy *) tmpcur_6778; + CursorTy tmpaftercur_6823 = tmpcur_6778 + 8; + CursorTy tmpcur_6824 = *(CursorTy *) tmpaftercur_6823; + CursorTy tmpaftercur_6825 = tmpaftercur_6823 + 8; + CursorTy jump_4056 = tmpaftercur_6823 + 8; + CursorTy jump_4055 = tmpcur_6778 + 8; + unsigned char wildcard_881_1489_1798 = print_symbol(5873); + CursorProd tmp_struct_141 = + _print_Content(end_r_2902, tmpaftercur_6825); + CursorTy pvrtmp_6826 = tmp_struct_141.field0; + CursorProd tmp_struct_142 = _print_Adt(end_r_2902, tmpcur_6822); + CursorTy pvrtmp_6827 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = _print_Tags(end_r_2902, tmpcur_6824); + CursorTy pvrtmp_6828 = tmp_struct_143.field0; + unsigned char wildcard_882_1493_1802 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6828}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6829 = *(CursorTy *) tmpcur_6778; + CursorTy tmpaftercur_6830 = tmpcur_6778 + 8; + CursorTy jump_4206 = tmpcur_6778 + 8; + unsigned char wildcard_4209 = print_symbol(5879); + CursorProd tmp_struct_144 = _print_Adt(end_r_2902, tmpcur_6829); + CursorTy pvrtmp_6831 = tmp_struct_144.field0; + + return (CursorProd) {jump_4206}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6832 = *(CursorTy *) tmpcur_6778; + CursorTy tmpaftercur_6833 = tmpcur_6778 + 8; + unsigned char wildcard_4209 = print_symbol(5878); + CursorProd tmp_struct_145 = _print_Adt(end_r_2902, tmpcur_6832); + CursorTy pvrtmp_6834 = tmp_struct_145.field0; + + return (CursorProd) {pvrtmp_6834}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6777"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2905, + CursorTy end_r_2906, CursorTy loc_2904, + CursorTy arg_883_1494_1803) +{ + if (loc_2904 + 32 > end_r_2906) { + ChunkTy new_chunk_149 = alloc_chunk(end_r_2906); + CursorTy chunk_start_150 = new_chunk_149.chunk_start; + CursorTy chunk_end_151 = new_chunk_149.chunk_end; + + end_r_2906 = chunk_end_151; + *(TagTyPacked *) loc_2904 = 255; + + CursorTy redir = loc_2904 + 1; + + *(CursorTy *) redir = chunk_start_150; + loc_2904 = chunk_start_150; + } + + CursorTy loc_3558 = loc_2904 + 1; + CursorTy loc_3559 = loc_3558 + 8; + TagTyPacked tmpval_6836 = *(TagTyPacked *) arg_883_1494_1803; + CursorTy tmpcur_6837 = arg_883_1494_1803 + 1; + + + switch_6880: + ; + switch (tmpval_6836) { + + case 0: + { + CursorTy jump_4061 = arg_883_1494_1803 + 1; + + *(TagTyPacked *) loc_2904 = 0; + + CursorTy writetag_4795 = loc_2904 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2906, jump_4061, + loc_2904, writetag_4795}; + break; + } + + case 1: + { + IntTy tmpval_6842 = *(IntTy *) tmpcur_6837; + CursorTy tmpcur_6843 = tmpcur_6837 + sizeof(IntTy); + CursorTy jump_4063 = tmpcur_6837 + 8; + CursorCursorCursorCursorProd tmp_struct_146 = + _copy_Tags(end_r_2905, end_r_2906, loc_3559, tmpcur_6843); + CursorTy pvrtmp_6844 = tmp_struct_146.field0; + CursorTy pvrtmp_6845 = tmp_struct_146.field1; + CursorTy pvrtmp_6846 = tmp_struct_146.field2; + CursorTy pvrtmp_6847 = tmp_struct_146.field3; + + *(TagTyPacked *) loc_2904 = 1; + + CursorTy writetag_4800 = loc_2904 + 1; + + *(IntTy *) writetag_4800 = tmpval_6842; + + CursorTy writecur_4801 = writetag_4800 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6844, pvrtmp_6845, + loc_2904, pvrtmp_6847}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6856 = *(CursorTy *) tmpcur_6837; + CursorTy tmpaftercur_6857 = tmpcur_6837 + 8; + CursorTy jump_4212 = tmpcur_6837 + 8; + CursorCursorCursorCursorProd tmp_struct_147 = + _copy_Tags(end_r_2905, end_r_2906, loc_2904, tmpcur_6856); + CursorTy pvrtmp_6858 = tmp_struct_147.field0; + CursorTy pvrtmp_6859 = tmp_struct_147.field1; + CursorTy pvrtmp_6860 = tmp_struct_147.field2; + CursorTy pvrtmp_6861 = tmp_struct_147.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6858, jump_4212, + pvrtmp_6860, pvrtmp_6861}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6868 = *(CursorTy *) tmpcur_6837; + CursorTy tmpaftercur_6869 = tmpcur_6837 + 8; + CursorCursorCursorCursorProd tmp_struct_148 = + _copy_Tags(end_r_2905, end_r_2906, loc_2904, tmpcur_6868); + CursorTy pvrtmp_6870 = tmp_struct_148.field0; + CursorTy pvrtmp_6871 = tmp_struct_148.field1; + CursorTy pvrtmp_6872 = tmp_struct_148.field2; + CursorTy pvrtmp_6873 = tmp_struct_148.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6870, pvrtmp_6871, + pvrtmp_6872, pvrtmp_6873}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6836"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2909, + CursorTy end_r_2910, + CursorTy loc_2908, + CursorTy arg_888_1499_1808) +{ + CursorTy loc_3571 = loc_2908 + 1; + CursorTy loc_3572 = loc_3571 + 8; + TagTyPacked tmpval_6881 = *(TagTyPacked *) arg_888_1499_1808; + CursorTy tmpcur_6882 = arg_888_1499_1808 + 1; + + + switch_6925: + ; + switch (tmpval_6881) { + + case 0: + { + CursorTy jump_4066 = arg_888_1499_1808 + 1; + + *(TagTyPacked *) loc_2908 = 0; + + CursorTy writetag_4811 = loc_2908 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2910, jump_4066, + loc_2908, writetag_4811}; + break; + } + + case 1: + { + IntTy tmpval_6887 = *(IntTy *) tmpcur_6882; + CursorTy tmpcur_6888 = tmpcur_6882 + sizeof(IntTy); + CursorTy jump_4068 = tmpcur_6882 + 8; + CursorCursorCursorCursorProd tmp_struct_152 = + _copy_without_ptrs_Tags(end_r_2909, end_r_2910, loc_3572, tmpcur_6888); + CursorTy pvrtmp_6889 = tmp_struct_152.field0; + CursorTy pvrtmp_6890 = tmp_struct_152.field1; + CursorTy pvrtmp_6891 = tmp_struct_152.field2; + CursorTy pvrtmp_6892 = tmp_struct_152.field3; + + *(TagTyPacked *) loc_2908 = 1; + + CursorTy writetag_4816 = loc_2908 + 1; + + *(IntTy *) writetag_4816 = tmpval_6887; + + CursorTy writecur_4817 = writetag_4816 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6889, pvrtmp_6890, + loc_2908, pvrtmp_6892}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6901 = *(CursorTy *) tmpcur_6882; + CursorTy tmpaftercur_6902 = tmpcur_6882 + 8; + CursorTy jump_4218 = tmpcur_6882 + 8; + CursorCursorCursorCursorProd tmp_struct_153 = + _copy_without_ptrs_Tags(end_r_2909, end_r_2910, loc_2908, tmpcur_6901); + CursorTy pvrtmp_6903 = tmp_struct_153.field0; + CursorTy pvrtmp_6904 = tmp_struct_153.field1; + CursorTy pvrtmp_6905 = tmp_struct_153.field2; + CursorTy pvrtmp_6906 = tmp_struct_153.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6903, jump_4218, + pvrtmp_6905, pvrtmp_6906}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6913 = *(CursorTy *) tmpcur_6882; + CursorTy tmpaftercur_6914 = tmpcur_6882 + 8; + CursorCursorCursorCursorProd tmp_struct_154 = + _copy_without_ptrs_Tags(end_r_2909, end_r_2910, loc_2908, tmpcur_6913); + CursorTy pvrtmp_6915 = tmp_struct_154.field0; + CursorTy pvrtmp_6916 = tmp_struct_154.field1; + CursorTy pvrtmp_6917 = tmp_struct_154.field2; + CursorTy pvrtmp_6918 = tmp_struct_154.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6915, pvrtmp_6916, + pvrtmp_6917, pvrtmp_6918}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6881"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2912, CursorTy arg_893_1504_1813) +{ + TagTyPacked tmpval_6926 = *(TagTyPacked *) arg_893_1504_1813; + CursorTy tmpcur_6927 = arg_893_1504_1813 + 1; + + + switch_6937: + ; + switch (tmpval_6926) { + + case 0: + { + CursorTy jump_4071 = arg_893_1504_1813 + 1; + + return (CursorProd) {jump_4071}; + break; + } + + case 1: + { + IntTy tmpval_6928 = *(IntTy *) tmpcur_6927; + CursorTy tmpcur_6929 = tmpcur_6927 + sizeof(IntTy); + CursorTy jump_4073 = tmpcur_6927 + 8; + CursorProd tmp_struct_155 = + _traverse_Tags(end_r_2912, tmpcur_6929); + CursorTy pvrtmp_6930 = tmp_struct_155.field0; + + return (CursorProd) {pvrtmp_6930}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6931 = *(CursorTy *) tmpcur_6927; + CursorTy tmpaftercur_6932 = tmpcur_6927 + 8; + CursorTy jump_4224 = tmpcur_6927 + 8; + CursorProd tmp_struct_156 = + _traverse_Tags(end_r_2912, tmpcur_6931); + CursorTy pvrtmp_6933 = tmp_struct_156.field0; + + return (CursorProd) {jump_4224}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6934 = *(CursorTy *) tmpcur_6927; + CursorTy tmpaftercur_6935 = tmpcur_6927 + 8; + CursorProd tmp_struct_157 = + _traverse_Tags(end_r_2912, tmpcur_6934); + CursorTy pvrtmp_6936 = tmp_struct_157.field0; + + return (CursorProd) {pvrtmp_6936}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6926"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2914, CursorTy arg_898_1508_1817) +{ + TagTyPacked tmpval_6938 = *(TagTyPacked *) arg_898_1508_1817; + CursorTy tmpcur_6939 = arg_898_1508_1817 + 1; + + + switch_6949: + ; + switch (tmpval_6938) { + + case 0: + { + CursorTy jump_4076 = arg_898_1508_1817 + 1; + unsigned char wildcard_899_1509_1818 = print_symbol(5867); + unsigned char wildcard_900_1510_1819 = print_symbol(5862); + + return (CursorProd) {jump_4076}; + break; + } + + case 1: + { + IntTy tmpval_6940 = *(IntTy *) tmpcur_6939; + CursorTy tmpcur_6941 = tmpcur_6939 + sizeof(IntTy); + CursorTy jump_4078 = tmpcur_6939 + 8; + unsigned char wildcard_905_1513_1822 = print_symbol(5864); + unsigned char y_903_1514_1823 = printf("%lld", tmpval_6940); + CursorProd tmp_struct_158 = _print_Tags(end_r_2914, tmpcur_6941); + CursorTy pvrtmp_6942 = tmp_struct_158.field0; + unsigned char wildcard_906_1516_1825 = print_symbol(5862); + + return (CursorProd) {pvrtmp_6942}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6943 = *(CursorTy *) tmpcur_6939; + CursorTy tmpaftercur_6944 = tmpcur_6939 + 8; + CursorTy jump_4230 = tmpcur_6939 + 8; + unsigned char wildcard_4233 = print_symbol(5879); + CursorProd tmp_struct_159 = _print_Tags(end_r_2914, tmpcur_6943); + CursorTy pvrtmp_6945 = tmp_struct_159.field0; + + return (CursorProd) {jump_4230}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6946 = *(CursorTy *) tmpcur_6939; + CursorTy tmpaftercur_6947 = tmpcur_6939 + 8; + unsigned char wildcard_4233 = print_symbol(5878); + CursorProd tmp_struct_160 = _print_Tags(end_r_2914, tmpcur_6946); + CursorTy pvrtmp_6948 = tmp_struct_160.field0; + + return (CursorProd) {pvrtmp_6948}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6938"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2917, + CursorTy end_r_2918, + CursorTy loc_2916, + CursorTy arg_2657) +{ + if (loc_2916 + 32 > end_r_2918) { + ChunkTy new_chunk_164 = alloc_chunk(end_r_2918); + CursorTy chunk_start_165 = new_chunk_164.chunk_start; + CursorTy chunk_end_166 = new_chunk_164.chunk_end; + + end_r_2918 = chunk_end_166; + *(TagTyPacked *) loc_2916 = 255; + + CursorTy redir = loc_2916 + 1; + + *(CursorTy *) redir = chunk_start_165; + loc_2916 = chunk_start_165; + } + + CursorTy loc_3596 = loc_2916 + 1; + CursorTy loc_3597 = loc_3596 + 8; + TagTyPacked tmpval_6950 = *(TagTyPacked *) arg_2657; + CursorTy tmpcur_6951 = arg_2657 + 1; + + + switch_6994: + ; + switch (tmpval_6950) { + + case 0: + { + CursorTy jump_4081 = arg_2657 + 1; + + *(TagTyPacked *) loc_2916 = 0; + + CursorTy writetag_4847 = loc_2916 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2918, jump_4081, + loc_2916, writetag_4847}; + break; + } + + case 1: + { + IntTy tmpval_6956 = *(IntTy *) tmpcur_6951; + CursorTy tmpcur_6957 = tmpcur_6951 + sizeof(IntTy); + CursorTy jump_4083 = tmpcur_6951 + 8; + CursorCursorCursorCursorProd tmp_struct_161 = + _add_size_and_rel_offsets_String(end_r_2917, end_r_2918, loc_3597, tmpcur_6957); + CursorTy pvrtmp_6958 = tmp_struct_161.field0; + CursorTy pvrtmp_6959 = tmp_struct_161.field1; + CursorTy pvrtmp_6960 = tmp_struct_161.field2; + CursorTy pvrtmp_6961 = tmp_struct_161.field3; + + *(TagTyPacked *) loc_2916 = 1; + + CursorTy writetag_4852 = loc_2916 + 1; + + *(IntTy *) writetag_4852 = tmpval_6956; + + CursorTy writecur_4853 = writetag_4852 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6958, pvrtmp_6959, + loc_2916, pvrtmp_6961}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6970 = *(CursorTy *) tmpcur_6951; + CursorTy tmpaftercur_6971 = tmpcur_6951 + 8; + CursorTy jump_4236 = tmpcur_6951 + 8; + CursorCursorCursorCursorProd tmp_struct_162 = + _add_size_and_rel_offsets_String(end_r_2917, end_r_2918, loc_2916, tmpcur_6970); + CursorTy pvrtmp_6972 = tmp_struct_162.field0; + CursorTy pvrtmp_6973 = tmp_struct_162.field1; + CursorTy pvrtmp_6974 = tmp_struct_162.field2; + CursorTy pvrtmp_6975 = tmp_struct_162.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6972, jump_4236, + pvrtmp_6974, pvrtmp_6975}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6982 = *(CursorTy *) tmpcur_6951; + CursorTy tmpaftercur_6983 = tmpcur_6951 + 8; + CursorCursorCursorCursorProd tmp_struct_163 = + _add_size_and_rel_offsets_String(end_r_2917, end_r_2918, loc_2916, tmpcur_6982); + CursorTy pvrtmp_6984 = tmp_struct_163.field0; + CursorTy pvrtmp_6985 = tmp_struct_163.field1; + CursorTy pvrtmp_6986 = tmp_struct_163.field2; + CursorTy pvrtmp_6987 = tmp_struct_163.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6984, pvrtmp_6985, + pvrtmp_6986, pvrtmp_6987}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6950"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2921, + CursorTy end_r_2922, + CursorTy loc_2920, + CursorTy arg_2662) +{ + if (loc_2920 + 32 > end_r_2922) { + ChunkTy new_chunk_171 = alloc_chunk(end_r_2922); + CursorTy chunk_start_172 = new_chunk_171.chunk_start; + CursorTy chunk_end_173 = new_chunk_171.chunk_end; + + end_r_2922 = chunk_end_173; + *(TagTyPacked *) loc_2920 = 255; + + CursorTy redir = loc_2920 + 1; + + *(CursorTy *) redir = chunk_start_172; + loc_2920 = chunk_start_172; + } + + TagTyPacked tmpval_6995 = *(TagTyPacked *) arg_2662; + CursorTy tmpcur_6996 = arg_2662 + 1; + + + switch_7045: + ; + switch (tmpval_6995) { + + case 0: + { + CursorTy loc_3607 = loc_2920 + 1; + CursorCursorCursorCursorProd tmp_struct_167 = + _add_size_and_rel_offsets_String(end_r_2921, end_r_2922, loc_3607, tmpcur_6996); + CursorTy pvrtmp_6997 = tmp_struct_167.field0; + CursorTy pvrtmp_6998 = tmp_struct_167.field1; + CursorTy pvrtmp_6999 = tmp_struct_167.field2; + CursorTy pvrtmp_7000 = tmp_struct_167.field3; + + *(TagTyPacked *) loc_2920 = 0; + + CursorTy writetag_4864 = loc_2920 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6997, pvrtmp_6998, + loc_2920, pvrtmp_7000}; + break; + } + + case 1: + { + CursorTy loc_3613 = loc_2920 + 1; + CursorCursorCursorCursorProd tmp_struct_168 = + _add_size_and_rel_offsets_String(end_r_2921, end_r_2922, loc_3613, tmpcur_6996); + CursorTy pvrtmp_7009 = tmp_struct_168.field0; + CursorTy pvrtmp_7010 = tmp_struct_168.field1; + CursorTy pvrtmp_7011 = tmp_struct_168.field2; + CursorTy pvrtmp_7012 = tmp_struct_168.field3; + + *(TagTyPacked *) loc_2920 = 1; + + CursorTy writetag_4869 = loc_2920 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7009, pvrtmp_7010, + loc_2920, pvrtmp_7012}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7021 = *(CursorTy *) tmpcur_6996; + CursorTy tmpaftercur_7022 = tmpcur_6996 + 8; + CursorTy jump_4242 = tmpcur_6996 + 8; + CursorCursorCursorCursorProd tmp_struct_169 = + _add_size_and_rel_offsets_Content(end_r_2921, end_r_2922, loc_2920, tmpcur_7021); + CursorTy pvrtmp_7023 = tmp_struct_169.field0; + CursorTy pvrtmp_7024 = tmp_struct_169.field1; + CursorTy pvrtmp_7025 = tmp_struct_169.field2; + CursorTy pvrtmp_7026 = tmp_struct_169.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7023, jump_4242, + pvrtmp_7025, pvrtmp_7026}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7033 = *(CursorTy *) tmpcur_6996; + CursorTy tmpaftercur_7034 = tmpcur_6996 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _add_size_and_rel_offsets_Content(end_r_2921, end_r_2922, loc_2920, tmpcur_7033); + CursorTy pvrtmp_7035 = tmp_struct_170.field0; + CursorTy pvrtmp_7036 = tmp_struct_170.field1; + CursorTy pvrtmp_7037 = tmp_struct_170.field2; + CursorTy pvrtmp_7038 = tmp_struct_170.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7035, pvrtmp_7036, + pvrtmp_7037, pvrtmp_7038}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6995"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2925, + CursorTy end_r_2926, + CursorTy loc_2924, + CursorTy arg_2667) +{ + if (loc_2924 + 32 > end_r_2926) { + ChunkTy new_chunk_198 = alloc_chunk(end_r_2926); + CursorTy chunk_start_199 = new_chunk_198.chunk_start; + CursorTy chunk_end_200 = new_chunk_198.chunk_end; + + end_r_2926 = chunk_end_200; + *(TagTyPacked *) loc_2924 = 255; + + CursorTy redir = loc_2924 + 1; + + *(CursorTy *) redir = chunk_start_199; + loc_2924 = chunk_start_199; + } + + CursorTy loc_3626 = loc_2924 + 1; + CursorTy loc_3627 = loc_3626 + 8; + CursorTy loc_3628 = loc_3627 + 8; + CursorTy loc_3644 = loc_2924 + 1; + CursorTy loc_3645 = loc_3644 + 8; + CursorTy loc_3646 = loc_3645 + 8; + CursorTy loc_3666 = loc_2924 + 1; + CursorTy loc_3667 = loc_3666 + 8; + CursorTy loc_3668 = loc_3667 + 8; + CursorTy loc_3669 = loc_3668 + 8; + CursorTy loc_3693 = loc_2924 + 1; + CursorTy loc_3694 = loc_3693 + 8; + CursorTy loc_3695 = loc_3694 + 8; + CursorTy loc_3696 = loc_3695 + 8; + CursorTy loc_3720 = loc_2924 + 1; + CursorTy loc_3721 = loc_3720 + 8; + CursorTy loc_3722 = loc_3721 + 8; + CursorTy loc_3723 = loc_3722 + 8; + CursorTy loc_3747 = loc_2924 + 1; + CursorTy loc_3748 = loc_3747 + 8; + CursorTy loc_3749 = loc_3748 + 8; + CursorTy loc_3750 = loc_3749 + 8; + CursorTy loc_3774 = loc_2924 + 1; + CursorTy loc_3775 = loc_3774 + 8; + CursorTy loc_3776 = loc_3775 + 8; + CursorTy loc_3777 = loc_3776 + 8; + CursorTy loc_3801 = loc_2924 + 1; + CursorTy loc_3802 = loc_3801 + 8; + CursorTy loc_3803 = loc_3802 + 8; + CursorTy loc_3804 = loc_3803 + 8; + TagTyPacked tmpval_7046 = *(TagTyPacked *) arg_2667; + CursorTy tmpcur_7047 = arg_2667 + 1; + + + switch_7284: + ; + switch (tmpval_7046) { + + case 0: + { + CursorTy jump_4090 = arg_2667 + 1; + + *(TagTyPacked *) loc_2924 = 0; + + CursorTy writetag_4879 = loc_2924 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2926, jump_4090, + loc_2924, writetag_4879}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_174 = + _add_size_and_rel_offsets_Content(end_r_2925, end_r_2926, loc_3628, tmpcur_7047); + CursorTy pvrtmp_7052 = tmp_struct_174.field0; + CursorTy pvrtmp_7053 = tmp_struct_174.field1; + CursorTy pvrtmp_7054 = tmp_struct_174.field2; + CursorTy pvrtmp_7055 = tmp_struct_174.field3; + CursorCursorCursorCursorProd tmp_struct_175 = + _add_size_and_rel_offsets_Adt(end_r_2925, pvrtmp_7052, pvrtmp_7055, pvrtmp_7053); + CursorTy pvrtmp_7060 = tmp_struct_175.field0; + CursorTy pvrtmp_7061 = tmp_struct_175.field1; + CursorTy pvrtmp_7062 = tmp_struct_175.field2; + CursorTy pvrtmp_7063 = tmp_struct_175.field3; + IntTy sizeof_y_2670__2672 = pvrtmp_7055 - pvrtmp_7054; + IntTy sizeof_y_2671__2673 = pvrtmp_7063 - pvrtmp_7062; + IntTy fltPrm_2761 = sizeof_y_2670__2672 + 0; + IntTy offset__2674 = 0 + fltPrm_2761; + IntTy fltPrm_2762 = sizeof_y_2670__2672 + sizeof_y_2671__2673; + IntTy size_dcon_2675 = 9 + fltPrm_2762; + + *(TagTyPacked *) loc_2924 = 160; + + CursorTy writetag_4884 = loc_2924 + 1; + + *(IntTy *) writetag_4884 = size_dcon_2675; + + CursorTy writecur_4885 = writetag_4884 + sizeof(IntTy); + + *(IntTy *) writecur_4885 = offset__2674; + + CursorTy writecur_4886 = writecur_4885 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7060, pvrtmp_7061, + loc_2924, pvrtmp_7063}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_176 = + _add_size_and_rel_offsets_Adt(end_r_2925, end_r_2926, loc_3646, tmpcur_7047); + CursorTy pvrtmp_7072 = tmp_struct_176.field0; + CursorTy pvrtmp_7073 = tmp_struct_176.field1; + CursorTy pvrtmp_7074 = tmp_struct_176.field2; + CursorTy pvrtmp_7075 = tmp_struct_176.field3; + CursorCursorCursorCursorProd tmp_struct_177 = + _add_size_and_rel_offsets_Content(end_r_2925, pvrtmp_7072, pvrtmp_7075, pvrtmp_7073); + CursorTy pvrtmp_7080 = tmp_struct_177.field0; + CursorTy pvrtmp_7081 = tmp_struct_177.field1; + CursorTy pvrtmp_7082 = tmp_struct_177.field2; + CursorTy pvrtmp_7083 = tmp_struct_177.field3; + IntTy sizeof_y_2678__2680 = pvrtmp_7075 - pvrtmp_7074; + IntTy sizeof_y_2679__2681 = pvrtmp_7083 - pvrtmp_7082; + IntTy fltPrm_2763 = sizeof_y_2678__2680 + 0; + IntTy offset__2682 = 0 + fltPrm_2763; + IntTy fltPrm_2764 = sizeof_y_2678__2680 + sizeof_y_2679__2681; + IntTy size_dcon_2683 = 9 + fltPrm_2764; + + *(TagTyPacked *) loc_2924 = 162; + + CursorTy writetag_4893 = loc_2924 + 1; + + *(IntTy *) writetag_4893 = size_dcon_2683; + + CursorTy writecur_4894 = writetag_4893 + sizeof(IntTy); + + *(IntTy *) writecur_4894 = offset__2682; + + CursorTy writecur_4895 = writecur_4894 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7080, pvrtmp_7081, + loc_2924, pvrtmp_7083}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_178 = + _add_size_and_rel_offsets_Tags(end_r_2925, end_r_2926, loc_3669, tmpcur_7047); + CursorTy pvrtmp_7092 = tmp_struct_178.field0; + CursorTy pvrtmp_7093 = tmp_struct_178.field1; + CursorTy pvrtmp_7094 = tmp_struct_178.field2; + CursorTy pvrtmp_7095 = tmp_struct_178.field3; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_Content(end_r_2925, pvrtmp_7092, pvrtmp_7095, pvrtmp_7093); + CursorTy pvrtmp_7100 = tmp_struct_179.field0; + CursorTy pvrtmp_7101 = tmp_struct_179.field1; + CursorTy pvrtmp_7102 = tmp_struct_179.field2; + CursorTy pvrtmp_7103 = tmp_struct_179.field3; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_Adt(end_r_2925, pvrtmp_7100, pvrtmp_7103, pvrtmp_7101); + CursorTy pvrtmp_7108 = tmp_struct_180.field0; + CursorTy pvrtmp_7109 = tmp_struct_180.field1; + CursorTy pvrtmp_7110 = tmp_struct_180.field2; + CursorTy pvrtmp_7111 = tmp_struct_180.field3; + IntTy sizeof_y_2687__2690 = pvrtmp_7095 - pvrtmp_7094; + IntTy sizeof_y_2688__2691 = pvrtmp_7103 - pvrtmp_7102; + IntTy sizeof_y_2689__2692 = pvrtmp_7111 - pvrtmp_7110; + IntTy fltPrm_2765 = sizeof_y_2687__2690 + 0; + IntTy offset__2693 = 8 + fltPrm_2765; + IntTy fltPrm_2766 = sizeof_y_2687__2690 + sizeof_y_2688__2691; + IntTy offset__2694 = 0 + fltPrm_2766; + IntTy fltPrm_2768 = sizeof_y_2688__2691 + sizeof_y_2689__2692; + IntTy fltPrm_2767 = sizeof_y_2687__2690 + fltPrm_2768; + IntTy size_dcon_2695 = 17 + fltPrm_2767; + + *(TagTyPacked *) loc_2924 = 164; + + CursorTy writetag_4903 = loc_2924 + 1; + + *(IntTy *) writetag_4903 = size_dcon_2695; + + CursorTy writecur_4904 = writetag_4903 + sizeof(IntTy); + + *(IntTy *) writecur_4904 = offset__2693; + + CursorTy writecur_4905 = writecur_4904 + sizeof(IntTy); + + *(IntTy *) writecur_4905 = offset__2694; + + CursorTy writecur_4906 = writecur_4905 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7108, pvrtmp_7109, + loc_2924, pvrtmp_7111}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_Adt(end_r_2925, end_r_2926, loc_3696, tmpcur_7047); + CursorTy pvrtmp_7120 = tmp_struct_181.field0; + CursorTy pvrtmp_7121 = tmp_struct_181.field1; + CursorTy pvrtmp_7122 = tmp_struct_181.field2; + CursorTy pvrtmp_7123 = tmp_struct_181.field3; + CursorCursorCursorCursorProd tmp_struct_182 = + _add_size_and_rel_offsets_Content(end_r_2925, pvrtmp_7120, pvrtmp_7123, pvrtmp_7121); + CursorTy pvrtmp_7128 = tmp_struct_182.field0; + CursorTy pvrtmp_7129 = tmp_struct_182.field1; + CursorTy pvrtmp_7130 = tmp_struct_182.field2; + CursorTy pvrtmp_7131 = tmp_struct_182.field3; + CursorCursorCursorCursorProd tmp_struct_183 = + _add_size_and_rel_offsets_Tags(end_r_2925, pvrtmp_7128, pvrtmp_7131, pvrtmp_7129); + CursorTy pvrtmp_7136 = tmp_struct_183.field0; + CursorTy pvrtmp_7137 = tmp_struct_183.field1; + CursorTy pvrtmp_7138 = tmp_struct_183.field2; + CursorTy pvrtmp_7139 = tmp_struct_183.field3; + IntTy sizeof_y_2699__2702 = pvrtmp_7123 - pvrtmp_7122; + IntTy sizeof_y_2700__2703 = pvrtmp_7131 - pvrtmp_7130; + IntTy sizeof_y_2701__2704 = pvrtmp_7139 - pvrtmp_7138; + IntTy fltPrm_2769 = sizeof_y_2699__2702 + 0; + IntTy offset__2705 = 8 + fltPrm_2769; + IntTy fltPrm_2770 = sizeof_y_2699__2702 + sizeof_y_2700__2703; + IntTy offset__2706 = 0 + fltPrm_2770; + IntTy fltPrm_2772 = sizeof_y_2700__2703 + sizeof_y_2701__2704; + IntTy fltPrm_2771 = sizeof_y_2699__2702 + fltPrm_2772; + IntTy size_dcon_2707 = 17 + fltPrm_2771; + + *(TagTyPacked *) loc_2924 = 166; + + CursorTy writetag_4915 = loc_2924 + 1; + + *(IntTy *) writetag_4915 = size_dcon_2707; + + CursorTy writecur_4916 = writetag_4915 + sizeof(IntTy); + + *(IntTy *) writecur_4916 = offset__2705; + + CursorTy writecur_4917 = writecur_4916 + sizeof(IntTy); + + *(IntTy *) writecur_4917 = offset__2706; + + CursorTy writecur_4918 = writecur_4917 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7136, pvrtmp_7137, + loc_2924, pvrtmp_7139}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_184 = + _add_size_and_rel_offsets_Tags(end_r_2925, end_r_2926, loc_3723, tmpcur_7047); + CursorTy pvrtmp_7148 = tmp_struct_184.field0; + CursorTy pvrtmp_7149 = tmp_struct_184.field1; + CursorTy pvrtmp_7150 = tmp_struct_184.field2; + CursorTy pvrtmp_7151 = tmp_struct_184.field3; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_Adt(end_r_2925, pvrtmp_7148, pvrtmp_7151, pvrtmp_7149); + CursorTy pvrtmp_7156 = tmp_struct_185.field0; + CursorTy pvrtmp_7157 = tmp_struct_185.field1; + CursorTy pvrtmp_7158 = tmp_struct_185.field2; + CursorTy pvrtmp_7159 = tmp_struct_185.field3; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_Content(end_r_2925, pvrtmp_7156, pvrtmp_7159, pvrtmp_7157); + CursorTy pvrtmp_7164 = tmp_struct_186.field0; + CursorTy pvrtmp_7165 = tmp_struct_186.field1; + CursorTy pvrtmp_7166 = tmp_struct_186.field2; + CursorTy pvrtmp_7167 = tmp_struct_186.field3; + IntTy sizeof_y_2711__2714 = pvrtmp_7151 - pvrtmp_7150; + IntTy sizeof_y_2712__2715 = pvrtmp_7159 - pvrtmp_7158; + IntTy sizeof_y_2713__2716 = pvrtmp_7167 - pvrtmp_7166; + IntTy fltPrm_2773 = sizeof_y_2711__2714 + 0; + IntTy offset__2717 = 8 + fltPrm_2773; + IntTy fltPrm_2774 = sizeof_y_2711__2714 + sizeof_y_2712__2715; + IntTy offset__2718 = 0 + fltPrm_2774; + IntTy fltPrm_2776 = sizeof_y_2712__2715 + sizeof_y_2713__2716; + IntTy fltPrm_2775 = sizeof_y_2711__2714 + fltPrm_2776; + IntTy size_dcon_2719 = 17 + fltPrm_2775; + + *(TagTyPacked *) loc_2924 = 168; + + CursorTy writetag_4927 = loc_2924 + 1; + + *(IntTy *) writetag_4927 = size_dcon_2719; + + CursorTy writecur_4928 = writetag_4927 + sizeof(IntTy); + + *(IntTy *) writecur_4928 = offset__2717; + + CursorTy writecur_4929 = writecur_4928 + sizeof(IntTy); + + *(IntTy *) writecur_4929 = offset__2718; + + CursorTy writecur_4930 = writecur_4929 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7164, pvrtmp_7165, + loc_2924, pvrtmp_7167}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Adt(end_r_2925, end_r_2926, loc_3750, tmpcur_7047); + CursorTy pvrtmp_7176 = tmp_struct_187.field0; + CursorTy pvrtmp_7177 = tmp_struct_187.field1; + CursorTy pvrtmp_7178 = tmp_struct_187.field2; + CursorTy pvrtmp_7179 = tmp_struct_187.field3; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Tags(end_r_2925, pvrtmp_7176, pvrtmp_7179, pvrtmp_7177); + CursorTy pvrtmp_7184 = tmp_struct_188.field0; + CursorTy pvrtmp_7185 = tmp_struct_188.field1; + CursorTy pvrtmp_7186 = tmp_struct_188.field2; + CursorTy pvrtmp_7187 = tmp_struct_188.field3; + CursorCursorCursorCursorProd tmp_struct_189 = + _add_size_and_rel_offsets_Content(end_r_2925, pvrtmp_7184, pvrtmp_7187, pvrtmp_7185); + CursorTy pvrtmp_7192 = tmp_struct_189.field0; + CursorTy pvrtmp_7193 = tmp_struct_189.field1; + CursorTy pvrtmp_7194 = tmp_struct_189.field2; + CursorTy pvrtmp_7195 = tmp_struct_189.field3; + IntTy sizeof_y_2723__2726 = pvrtmp_7179 - pvrtmp_7178; + IntTy sizeof_y_2724__2727 = pvrtmp_7187 - pvrtmp_7186; + IntTy sizeof_y_2725__2728 = pvrtmp_7195 - pvrtmp_7194; + IntTy fltPrm_2777 = sizeof_y_2723__2726 + 0; + IntTy offset__2729 = 8 + fltPrm_2777; + IntTy fltPrm_2778 = sizeof_y_2723__2726 + sizeof_y_2724__2727; + IntTy offset__2730 = 0 + fltPrm_2778; + IntTy fltPrm_2780 = sizeof_y_2724__2727 + sizeof_y_2725__2728; + IntTy fltPrm_2779 = sizeof_y_2723__2726 + fltPrm_2780; + IntTy size_dcon_2731 = 17 + fltPrm_2779; + + *(TagTyPacked *) loc_2924 = 170; + + CursorTy writetag_4939 = loc_2924 + 1; + + *(IntTy *) writetag_4939 = size_dcon_2731; + + CursorTy writecur_4940 = writetag_4939 + sizeof(IntTy); + + *(IntTy *) writecur_4940 = offset__2729; + + CursorTy writecur_4941 = writecur_4940 + sizeof(IntTy); + + *(IntTy *) writecur_4941 = offset__2730; + + CursorTy writecur_4942 = writecur_4941 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7192, pvrtmp_7193, + loc_2924, pvrtmp_7195}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_190 = + _add_size_and_rel_offsets_Content(end_r_2925, end_r_2926, loc_3777, tmpcur_7047); + CursorTy pvrtmp_7204 = tmp_struct_190.field0; + CursorTy pvrtmp_7205 = tmp_struct_190.field1; + CursorTy pvrtmp_7206 = tmp_struct_190.field2; + CursorTy pvrtmp_7207 = tmp_struct_190.field3; + CursorCursorCursorCursorProd tmp_struct_191 = + _add_size_and_rel_offsets_Tags(end_r_2925, pvrtmp_7204, pvrtmp_7207, pvrtmp_7205); + CursorTy pvrtmp_7212 = tmp_struct_191.field0; + CursorTy pvrtmp_7213 = tmp_struct_191.field1; + CursorTy pvrtmp_7214 = tmp_struct_191.field2; + CursorTy pvrtmp_7215 = tmp_struct_191.field3; + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Adt(end_r_2925, pvrtmp_7212, pvrtmp_7215, pvrtmp_7213); + CursorTy pvrtmp_7220 = tmp_struct_192.field0; + CursorTy pvrtmp_7221 = tmp_struct_192.field1; + CursorTy pvrtmp_7222 = tmp_struct_192.field2; + CursorTy pvrtmp_7223 = tmp_struct_192.field3; + IntTy sizeof_y_2735__2738 = pvrtmp_7207 - pvrtmp_7206; + IntTy sizeof_y_2736__2739 = pvrtmp_7215 - pvrtmp_7214; + IntTy sizeof_y_2737__2740 = pvrtmp_7223 - pvrtmp_7222; + IntTy fltPrm_2781 = sizeof_y_2735__2738 + 0; + IntTy offset__2741 = 8 + fltPrm_2781; + IntTy fltPrm_2782 = sizeof_y_2735__2738 + sizeof_y_2736__2739; + IntTy offset__2742 = 0 + fltPrm_2782; + IntTy fltPrm_2784 = sizeof_y_2736__2739 + sizeof_y_2737__2740; + IntTy fltPrm_2783 = sizeof_y_2735__2738 + fltPrm_2784; + IntTy size_dcon_2743 = 17 + fltPrm_2783; + + *(TagTyPacked *) loc_2924 = 172; + + CursorTy writetag_4951 = loc_2924 + 1; + + *(IntTy *) writetag_4951 = size_dcon_2743; + + CursorTy writecur_4952 = writetag_4951 + sizeof(IntTy); + + *(IntTy *) writecur_4952 = offset__2741; + + CursorTy writecur_4953 = writecur_4952 + sizeof(IntTy); + + *(IntTy *) writecur_4953 = offset__2742; + + CursorTy writecur_4954 = writecur_4953 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7220, pvrtmp_7221, + loc_2924, pvrtmp_7223}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Content(end_r_2925, end_r_2926, loc_3804, tmpcur_7047); + CursorTy pvrtmp_7232 = tmp_struct_193.field0; + CursorTy pvrtmp_7233 = tmp_struct_193.field1; + CursorTy pvrtmp_7234 = tmp_struct_193.field2; + CursorTy pvrtmp_7235 = tmp_struct_193.field3; + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2925, pvrtmp_7232, pvrtmp_7235, pvrtmp_7233); + CursorTy pvrtmp_7240 = tmp_struct_194.field0; + CursorTy pvrtmp_7241 = tmp_struct_194.field1; + CursorTy pvrtmp_7242 = tmp_struct_194.field2; + CursorTy pvrtmp_7243 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Tags(end_r_2925, pvrtmp_7240, pvrtmp_7243, pvrtmp_7241); + CursorTy pvrtmp_7248 = tmp_struct_195.field0; + CursorTy pvrtmp_7249 = tmp_struct_195.field1; + CursorTy pvrtmp_7250 = tmp_struct_195.field2; + CursorTy pvrtmp_7251 = tmp_struct_195.field3; + IntTy sizeof_y_2747__2750 = pvrtmp_7235 - pvrtmp_7234; + IntTy sizeof_y_2748__2751 = pvrtmp_7243 - pvrtmp_7242; + IntTy sizeof_y_2749__2752 = pvrtmp_7251 - pvrtmp_7250; + IntTy fltPrm_2785 = sizeof_y_2747__2750 + 0; + IntTy offset__2753 = 8 + fltPrm_2785; + IntTy fltPrm_2786 = sizeof_y_2747__2750 + sizeof_y_2748__2751; + IntTy offset__2754 = 0 + fltPrm_2786; + IntTy fltPrm_2788 = sizeof_y_2748__2751 + sizeof_y_2749__2752; + IntTy fltPrm_2787 = sizeof_y_2747__2750 + fltPrm_2788; + IntTy size_dcon_2755 = 17 + fltPrm_2787; + + *(TagTyPacked *) loc_2924 = 174; + + CursorTy writetag_4963 = loc_2924 + 1; + + *(IntTy *) writetag_4963 = size_dcon_2755; + + CursorTy writecur_4964 = writetag_4963 + sizeof(IntTy); + + *(IntTy *) writecur_4964 = offset__2753; + + CursorTy writecur_4965 = writecur_4964 + sizeof(IntTy); + + *(IntTy *) writecur_4965 = offset__2754; + + CursorTy writecur_4966 = writecur_4965 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7248, pvrtmp_7249, + loc_2924, pvrtmp_7251}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7260 = *(CursorTy *) tmpcur_7047; + CursorTy tmpaftercur_7261 = tmpcur_7047 + 8; + CursorTy jump_4248 = tmpcur_7047 + 8; + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Adt(end_r_2925, end_r_2926, loc_2924, tmpcur_7260); + CursorTy pvrtmp_7262 = tmp_struct_196.field0; + CursorTy pvrtmp_7263 = tmp_struct_196.field1; + CursorTy pvrtmp_7264 = tmp_struct_196.field2; + CursorTy pvrtmp_7265 = tmp_struct_196.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7262, jump_4248, + pvrtmp_7264, pvrtmp_7265}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7272 = *(CursorTy *) tmpcur_7047; + CursorTy tmpaftercur_7273 = tmpcur_7047 + 8; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Adt(end_r_2925, end_r_2926, loc_2924, tmpcur_7272); + CursorTy pvrtmp_7274 = tmp_struct_197.field0; + CursorTy pvrtmp_7275 = tmp_struct_197.field1; + CursorTy pvrtmp_7276 = tmp_struct_197.field2; + CursorTy pvrtmp_7277 = tmp_struct_197.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7274, pvrtmp_7275, + pvrtmp_7276, pvrtmp_7277}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7046"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2929, + CursorTy end_r_2930, + CursorTy loc_2928, + CursorTy arg_2756) +{ + if (loc_2928 + 32 > end_r_2930) { + ChunkTy new_chunk_204 = alloc_chunk(end_r_2930); + CursorTy chunk_start_205 = new_chunk_204.chunk_start; + CursorTy chunk_end_206 = new_chunk_204.chunk_end; + + end_r_2930 = chunk_end_206; + *(TagTyPacked *) loc_2928 = 255; + + CursorTy redir = loc_2928 + 1; + + *(CursorTy *) redir = chunk_start_205; + loc_2928 = chunk_start_205; + } + + CursorTy loc_3824 = loc_2928 + 1; + CursorTy loc_3825 = loc_3824 + 8; + TagTyPacked tmpval_7285 = *(TagTyPacked *) arg_2756; + CursorTy tmpcur_7286 = arg_2756 + 1; + + + switch_7329: + ; + switch (tmpval_7285) { + + case 0: + { + CursorTy jump_4122 = arg_2756 + 1; + + *(TagTyPacked *) loc_2928 = 0; + + CursorTy writetag_4978 = loc_2928 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2930, jump_4122, + loc_2928, writetag_4978}; + break; + } + + case 1: + { + IntTy tmpval_7291 = *(IntTy *) tmpcur_7286; + CursorTy tmpcur_7292 = tmpcur_7286 + sizeof(IntTy); + CursorTy jump_4124 = tmpcur_7286 + 8; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2929, end_r_2930, loc_3825, tmpcur_7292); + CursorTy pvrtmp_7293 = tmp_struct_201.field0; + CursorTy pvrtmp_7294 = tmp_struct_201.field1; + CursorTy pvrtmp_7295 = tmp_struct_201.field2; + CursorTy pvrtmp_7296 = tmp_struct_201.field3; + + *(TagTyPacked *) loc_2928 = 1; + + CursorTy writetag_4983 = loc_2928 + 1; + + *(IntTy *) writetag_4983 = tmpval_7291; + + CursorTy writecur_4984 = writetag_4983 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7293, pvrtmp_7294, + loc_2928, pvrtmp_7296}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7305 = *(CursorTy *) tmpcur_7286; + CursorTy tmpaftercur_7306 = tmpcur_7286 + 8; + CursorTy jump_4254 = tmpcur_7286 + 8; + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2929, end_r_2930, loc_2928, tmpcur_7305); + CursorTy pvrtmp_7307 = tmp_struct_202.field0; + CursorTy pvrtmp_7308 = tmp_struct_202.field1; + CursorTy pvrtmp_7309 = tmp_struct_202.field2; + CursorTy pvrtmp_7310 = tmp_struct_202.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7307, jump_4254, + pvrtmp_7309, pvrtmp_7310}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7317 = *(CursorTy *) tmpcur_7286; + CursorTy tmpaftercur_7318 = tmpcur_7286 + 8; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Tags(end_r_2929, end_r_2930, loc_2928, tmpcur_7317); + CursorTy pvrtmp_7319 = tmp_struct_203.field0; + CursorTy pvrtmp_7320 = tmp_struct_203.field1; + CursorTy pvrtmp_7321 = tmp_struct_203.field2; + CursorTy pvrtmp_7322 = tmp_struct_203.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7319, pvrtmp_7320, + pvrtmp_7321, pvrtmp_7322}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7285"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(5859, "Time for Adt: CA"); + set_newline(5860); + add_symbol(5861, "Count of Adt CA is: "); + add_symbol(5862, ")"); + add_symbol(5863, "(Text "); + add_symbol(5864, "(Tag "); + add_symbol(5865, "(TCA "); + add_symbol(5866, "(TAC "); + add_symbol(5867, "(Nul "); + add_symbol(5868, "(Nil "); + add_symbol(5869, "(Image "); + add_symbol(5870, "(End "); + add_symbol(5871, "(Char "); + add_symbol(5872, "(CTA "); + add_symbol(5873, "(CAT "); + add_symbol(5874, "(CA "); + add_symbol(5875, "(ATC "); + add_symbol(5876, "(ACT "); + add_symbol(5877, "(AC "); + add_symbol(5878, " ->r "); + add_symbol(5879, " ->i "); + + RegionTy *region_5880 = alloc_region(global_init_inf_buf_size); + CursorTy r_2936 = region_5880->reg_heap; + IntTy sizeof_end_r_2936_5881 = global_init_inf_buf_size; + CursorTy end_r_2936 = r_2936 + sizeof_end_r_2936_5881; + CursorCursorCursorProd tmp_struct_207 = + mkCAList(end_r_2936, r_2936, 1000000, 100); + CursorTy pvrtmp_5882 = tmp_struct_207.field0; + CursorTy pvrtmp_5883 = tmp_struct_207.field1; + CursorTy pvrtmp_5884 = tmp_struct_207.field2; + unsigned char wildcard__17_22_914_1533 = print_symbol(5859); + unsigned char wildcard__15_23_915_1534 = print_symbol(5860); + IntTy timed_5282; + VectorTy *times_211 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_timed_5282; + struct timespec end_timed_5282; + + start_counters(); + for (long long iters_timed_5282 = 0; iters_timed_5282 < global_iters_param; + iters_timed_5282++) { + if (iters_timed_5282 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_timed_5282); + + IntTy tailapp_4127 = getLengthTR(pvrtmp_5882, pvrtmp_5883, 0); + + timed_5282 = tailapp_4127; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_timed_5282); + if (iters_timed_5282 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_208 = difftimespecs(&begin_timed_5282, &end_timed_5282); + + vector_inplace_update(times_211, iters_timed_5282, &itertime_208); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_211, compare_doubles); + + double *tmp_212 = (double *) vector_nth(times_211, global_iters_param / 2); + double selftimed_210 = *tmp_212; + double batchtime_209 = sum_timing_array(times_211); + + print_timing_array(times_211); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_209); + printf("SELFTIMED: %e\n", selftimed_210); + + unsigned char wildcard__11_25_917_1536 = print_symbol(5861); + unsigned char wildcard__9_26_918_1537 = printf("%lld", timed_5282); + unsigned char wildcard__7_27_919_1538 = print_symbol(5860); + + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAct.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAct.c new file mode 100644 index 000000000..bdc020a7b --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAct.c @@ -0,0 +1,5070 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2920, CursorTy end_r_2921, + CursorTy loc_2919, + CursorTy adt_16_902_1520); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2924, CursorTy end_r_2925, + CursorTy loc_2923, + CursorTy tags_22_908_1528, + IntTy inVal_23_909_1529); +CursorCursorCursorProd mkACTList(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_26_912_1534, + IntTy tagLen_27_913_1535, + IntTy strLen_28_914_1536); +CursorCursorCursorProd mkString(CursorTy end_r_2929, CursorTy loc_2928, + IntTy len_181_1067_1542); +CursorCursorCursorProd mkContentText(CursorTy end_r_2931, CursorTy loc_2930, + IntTy n_195_1081_1548); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2933, CursorTy loc_2932, + IntTy len_320_1206_1550); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2936, + CursorTy end_r_2937, + CursorTy loc_2935, + CursorTy arg_624_1230_1555); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2940, + CursorTy end_r_2941, + CursorTy loc_2939, + CursorTy arg_629_1235_1560); +CursorProd _traverse_String(CursorTy end_r_2943, CursorTy arg_634_1240_1565); +CursorProd _print_String(CursorTy end_r_2945, CursorTy arg_639_1244_1569); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2948, + CursorTy end_r_2949, + CursorTy loc_2947, + CursorTy arg_648_1253_1578); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2952, + CursorTy end_r_2953, + CursorTy loc_2951, + CursorTy arg_653_1258_1583); +CursorProd _traverse_Content(CursorTy end_r_2955, CursorTy arg_658_1263_1588); +CursorProd _print_Content(CursorTy end_r_2957, CursorTy arg_663_1268_1593); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2960, CursorTy end_r_2961, + CursorTy loc_2959, + CursorTy arg_672_1277_1602); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2964, + CursorTy end_r_2965, + CursorTy loc_2963, + CursorTy arg_717_1322_1647); +CursorProd _traverse_Adt(CursorTy end_r_2967, CursorTy arg_762_1367_1692); +CursorProd _print_Adt(CursorTy end_r_2969, CursorTy arg_807_1412_1737); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2972, + CursorTy end_r_2973, CursorTy loc_2971, + CursorTy arg_870_1475_1800); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2976, + CursorTy end_r_2977, + CursorTy loc_2975, + CursorTy arg_875_1480_1805); +CursorProd _traverse_Tags(CursorTy end_r_2979, CursorTy arg_880_1485_1810); +CursorProd _print_Tags(CursorTy end_r_2981, CursorTy arg_885_1489_1814); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2984, CursorTy end_r_2985, + CursorTy loc_2983, CursorTy arg_2716); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2988, CursorTy end_r_2989, + CursorTy loc_2987, CursorTy arg_2721); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2992, + CursorTy end_r_2993, + CursorTy loc_2991, + CursorTy arg_2726); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2996, + CursorTy end_r_2997, + CursorTy loc_2995, + CursorTy arg_2815); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2920, CursorTy end_r_2921, + CursorTy loc_2919, + CursorTy adt_16_902_1520) +{ + if (loc_2919 + 32 > end_r_2921) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2921); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2921 = chunk_end_6; + *(TagTyPacked *) loc_2919 = 255; + + CursorTy redir = loc_2919 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2919 = chunk_start_5; + } + + CursorTy loc_3029 = loc_2919 + 1; + CursorTy loc_3030 = loc_3029 + 8; + CursorTy loc_3031 = loc_3030 + 8; + TagTyPacked tmpval_6202 = *(TagTyPacked *) adt_16_902_1520; + CursorTy tmpcur_6203 = adt_16_902_1520 + 1; + + + switch_6259: + ; + switch (tmpval_6202) { + + case 0: + { + CursorTy jump_3955 = adt_16_902_1520 + 1; + + *(TagTyPacked *) loc_2919 = 0; + + CursorTy writetag_4514 = loc_2919 + 1; + + return (CursorCursorCursorProd) {end_r_2921, loc_2919, + writetag_4514}; + break; + } + + case 15: + { + RegionTy *region_6208 = alloc_region(global_init_inf_buf_size); + CursorTy r_3041 = region_6208->reg_heap; + IntTy sizeof_end_r_3041_6209 = global_init_inf_buf_size; + CursorTy end_r_3041 = r_3041 + sizeof_end_r_3041_6209; + CursorTy tmpcur_6210 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6211 = tmpcur_6203 + 8; + CursorTy tmpcur_6212 = *(CursorTy *) tmpaftercur_6211; + CursorTy tmpaftercur_6213 = tmpaftercur_6211 + 8; + CursorTy jump_3958 = tmpaftercur_6211 + 8; + CursorTy jump_3957 = tmpcur_6203 + 8; + CursorCursorCursorCursorProd tmp_struct_0 = + addValTag(end_r_2920, end_r_3041, r_3041, tmpcur_6212, 10); + CursorTy pvrtmp_6214 = tmp_struct_0.field0; + CursorTy pvrtmp_6215 = tmp_struct_0.field1; + CursorTy pvrtmp_6216 = tmp_struct_0.field2; + CursorTy pvrtmp_6217 = tmp_struct_0.field3; + CursorCursorCursorProd tmp_struct_1 = + addValTagsAdt(end_r_2920, end_r_2921, loc_3031, tmpaftercur_6213); + CursorTy pvrtmp_6222 = tmp_struct_1.field0; + CursorTy pvrtmp_6223 = tmp_struct_1.field1; + CursorTy pvrtmp_6224 = tmp_struct_1.field2; + + *(TagTyPacked *) pvrtmp_6224 = 254; + + CursorTy writetag_4521 = pvrtmp_6224 + 1; + + *(CursorTy *) writetag_4521 = tmpcur_6210; + + CursorTy writecur_4522 = writetag_4521 + 8; + + *(TagTyPacked *) writecur_4522 = 254; + + CursorTy writetag_4524 = writecur_4522 + 1; + + *(CursorTy *) writetag_4524 = r_3041; + + CursorTy writecur_4525 = writetag_4524 + 8; + + *(TagTyPacked *) loc_2919 = 15; + + CursorTy writetag_4527 = loc_2919 + 1; + + *(CursorTy *) writetag_4527 = pvrtmp_6224; + + CursorTy writecur_4528 = writetag_4527 + 8; + + *(CursorTy *) writecur_4528 = writecur_4522; + + CursorTy writecur_4529 = writecur_4528 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6222, loc_2919, + writecur_4525}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6237 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6238 = tmpcur_6203 + 8; + CursorTy jump_4267 = tmpcur_6203 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2920, end_r_2921, loc_2919, tmpcur_6237); + CursorTy pvrtmp_6239 = tmp_struct_2.field0; + CursorTy pvrtmp_6240 = tmp_struct_2.field1; + CursorTy pvrtmp_6241 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6239, pvrtmp_6240, + pvrtmp_6241}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6248 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6249 = tmpcur_6203 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2920, end_r_2921, loc_2919, tmpcur_6248); + CursorTy pvrtmp_6250 = tmp_struct_3.field0; + CursorTy pvrtmp_6251 = tmp_struct_3.field1; + CursorTy pvrtmp_6252 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6250, pvrtmp_6251, + pvrtmp_6252}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6202"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2924, CursorTy end_r_2925, + CursorTy loc_2923, + CursorTy tags_22_908_1528, + IntTy inVal_23_909_1529) +{ + if (loc_2923 + 32 > end_r_2925) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2925); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2925 = chunk_end_12; + *(TagTyPacked *) loc_2923 = 255; + + CursorTy redir = loc_2923 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2923 = chunk_start_11; + } + + CursorTy loc_3050 = loc_2923 + 1; + CursorTy loc_3051 = loc_3050 + 8; + TagTyPacked tmpval_6260 = *(TagTyPacked *) tags_22_908_1528; + CursorTy tmpcur_6261 = tags_22_908_1528 + 1; + + + switch_6304: + ; + switch (tmpval_6260) { + + case 0: + { + CursorTy jump_3961 = tags_22_908_1528 + 1; + + *(TagTyPacked *) loc_2923 = 0; + + CursorTy writetag_4541 = loc_2923 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2925, jump_3961, + loc_2923, writetag_4541}; + break; + } + + case 1: + { + IntTy tmpval_6266 = *(IntTy *) tmpcur_6261; + CursorTy tmpcur_6267 = tmpcur_6261 + sizeof(IntTy); + CursorTy jump_3963 = tmpcur_6261 + 8; + IntTy fltPkd_1508_1532 = tmpval_6266 + inVal_23_909_1529; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2924, end_r_2925, loc_3051, tmpcur_6267, inVal_23_909_1529); + CursorTy pvrtmp_6268 = tmp_struct_7.field0; + CursorTy pvrtmp_6269 = tmp_struct_7.field1; + CursorTy pvrtmp_6270 = tmp_struct_7.field2; + CursorTy pvrtmp_6271 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2923 = 1; + + CursorTy writetag_4546 = loc_2923 + 1; + + *(IntTy *) writetag_4546 = fltPkd_1508_1532; + + CursorTy writecur_4547 = writetag_4546 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6268, pvrtmp_6269, + loc_2923, pvrtmp_6271}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6280 = *(CursorTy *) tmpcur_6261; + CursorTy tmpaftercur_6281 = tmpcur_6261 + 8; + CursorTy jump_4272 = tmpcur_6261 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2924, end_r_2925, loc_2923, tmpcur_6280, inVal_23_909_1529); + CursorTy pvrtmp_6282 = tmp_struct_8.field0; + CursorTy pvrtmp_6283 = tmp_struct_8.field1; + CursorTy pvrtmp_6284 = tmp_struct_8.field2; + CursorTy pvrtmp_6285 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6282, jump_4272, + pvrtmp_6284, pvrtmp_6285}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6292 = *(CursorTy *) tmpcur_6261; + CursorTy tmpaftercur_6293 = tmpcur_6261 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2924, end_r_2925, loc_2923, tmpcur_6292, inVal_23_909_1529); + CursorTy pvrtmp_6294 = tmp_struct_9.field0; + CursorTy pvrtmp_6295 = tmp_struct_9.field1; + CursorTy pvrtmp_6296 = tmp_struct_9.field2; + CursorTy pvrtmp_6297 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6294, pvrtmp_6295, + pvrtmp_6296, pvrtmp_6297}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6260"); + exit(1); + } + } +} +CursorCursorCursorProd mkACTList(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_26_912_1534, + IntTy tagLen_27_913_1535, + IntTy strLen_28_914_1536) +{ + if (loc_2926 + 32 > end_r_2927) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2927); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2927 = chunk_end_18; + *(TagTyPacked *) loc_2926 = 255; + + CursorTy redir = loc_2926 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2926 = chunk_start_17; + } + + CursorTy loc_3059 = loc_2926 + 1; + CursorTy loc_3060 = loc_3059 + 8; + CursorTy loc_3061 = loc_3060 + 8; + BoolTy fltIf_1510_1537 = len_26_912_1534 <= 0; + + if (fltIf_1510_1537) { + *(TagTyPacked *) loc_2926 = 0; + + CursorTy writetag_4556 = loc_2926 + 1; + + return (CursorCursorCursorProd) {end_r_2927, loc_2926, writetag_4556}; + } else { + IntTy fltAppE_1511_1538 = len_26_912_1534 - 1; + CursorCursorCursorProd tmp_struct_13 = + mkACTList(end_r_2927, loc_3061, fltAppE_1511_1538, tagLen_27_913_1535, strLen_28_914_1536); + CursorTy pvrtmp_6309 = tmp_struct_13.field0; + CursorTy pvrtmp_6310 = tmp_struct_13.field1; + CursorTy pvrtmp_6311 = tmp_struct_13.field2; + CursorCursorCursorProd tmp_struct_14 = + mkContentText(pvrtmp_6309, pvrtmp_6311, strLen_28_914_1536); + CursorTy pvrtmp_6316 = tmp_struct_14.field0; + CursorTy pvrtmp_6317 = tmp_struct_14.field1; + CursorTy pvrtmp_6318 = tmp_struct_14.field2; + CursorCursorCursorProd tmp_struct_15 = + mkRandomTags(pvrtmp_6316, pvrtmp_6318, tagLen_27_913_1535); + CursorTy pvrtmp_6323 = tmp_struct_15.field0; + CursorTy pvrtmp_6324 = tmp_struct_15.field1; + CursorTy pvrtmp_6325 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2926 = 15; + + CursorTy writetag_4561 = loc_2926 + 1; + + *(CursorTy *) writetag_4561 = pvrtmp_6311; + + CursorTy writecur_4562 = writetag_4561 + 8; + + *(CursorTy *) writecur_4562 = pvrtmp_6318; + + CursorTy writecur_4563 = writecur_4562 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6323, loc_2926, pvrtmp_6325}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2929, CursorTy loc_2928, + IntTy len_181_1067_1542) +{ + if (loc_2928 + 32 > end_r_2929) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2929); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2929 = chunk_end_22; + *(TagTyPacked *) loc_2928 = 255; + + CursorTy redir = loc_2928 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2928 = chunk_start_21; + } + + CursorTy loc_3073 = loc_2928 + 1; + CursorTy loc_3074 = loc_3073 + 8; + BoolTy fltIf_1512_1543 = len_181_1067_1542 <= 0; + + if (fltIf_1512_1543) { + *(TagTyPacked *) loc_2928 = 0; + + CursorTy writetag_4568 = loc_2928 + 1; + + return (CursorCursorCursorProd) {end_r_2929, loc_2928, writetag_4568}; + } else { + IntTy fltPrm_1513_1544 = rand(); + IntTy randomChar_182_1068_1545 = fltPrm_1513_1544 % 128; + IntTy fltAppE_1514_1546 = len_181_1067_1542 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2929, loc_3074, fltAppE_1514_1546); + CursorTy pvrtmp_6338 = tmp_struct_19.field0; + CursorTy pvrtmp_6339 = tmp_struct_19.field1; + CursorTy pvrtmp_6340 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2928 = 1; + + CursorTy writetag_4571 = loc_2928 + 1; + + *(IntTy *) writetag_4571 = randomChar_182_1068_1545; + + CursorTy writecur_4572 = writetag_4571 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6338, loc_2928, pvrtmp_6340}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2931, CursorTy loc_2930, + IntTy n_195_1081_1548) +{ + if (loc_2930 + 32 > end_r_2931) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2931); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2931 = chunk_end_26; + *(TagTyPacked *) loc_2930 = 255; + + CursorTy redir = loc_2930 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2930 = chunk_start_25; + } + + CursorTy loc_3079 = loc_2930 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2931, loc_3079, n_195_1081_1548); + CursorTy pvrtmp_6349 = tmp_struct_23.field0; + CursorTy pvrtmp_6350 = tmp_struct_23.field1; + CursorTy pvrtmp_6351 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2930 = 1; + + CursorTy writetag_4576 = loc_2930 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6349, loc_2930, pvrtmp_6351}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2933, CursorTy loc_2932, + IntTy len_320_1206_1550) +{ + if (loc_2932 + 32 > end_r_2933) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2933); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2933 = chunk_end_30; + *(TagTyPacked *) loc_2932 = 255; + + CursorTy redir = loc_2932 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2932 = chunk_start_29; + } + + CursorTy loc_3083 = loc_2932 + 1; + CursorTy loc_3084 = loc_3083 + 8; + BoolTy fltIf_1516_1551 = len_320_1206_1550 <= 0; + + if (fltIf_1516_1551) { + *(TagTyPacked *) loc_2932 = 0; + + CursorTy writetag_4579 = loc_2932 + 1; + + return (CursorCursorCursorProd) {end_r_2933, loc_2932, writetag_4579}; + } else { + IntTy fltAppE_1517_1553 = len_320_1206_1550 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2933, loc_3084, fltAppE_1517_1553); + CursorTy pvrtmp_6364 = tmp_struct_27.field0; + CursorTy pvrtmp_6365 = tmp_struct_27.field1; + CursorTy pvrtmp_6366 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2932 = 1; + + CursorTy writetag_4582 = loc_2932 + 1; + + *(IntTy *) writetag_4582 = 100; + + CursorTy writecur_4583 = writetag_4582 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6364, loc_2932, pvrtmp_6366}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2936, + CursorTy end_r_2937, + CursorTy loc_2935, + CursorTy arg_624_1230_1555) +{ + if (loc_2935 + 32 > end_r_2937) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2937); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2937 = chunk_end_36; + *(TagTyPacked *) loc_2935 = 255; + + CursorTy redir = loc_2935 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2935 = chunk_start_35; + } + + CursorTy loc_3094 = loc_2935 + 1; + CursorTy loc_3095 = loc_3094 + 8; + TagTyPacked tmpval_6375 = *(TagTyPacked *) arg_624_1230_1555; + CursorTy tmpcur_6376 = arg_624_1230_1555 + 1; + + + switch_6419: + ; + switch (tmpval_6375) { + + case 0: + { + CursorTy jump_3973 = arg_624_1230_1555 + 1; + + *(TagTyPacked *) loc_2935 = 0; + + CursorTy writetag_4587 = loc_2935 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2937, jump_3973, + loc_2935, writetag_4587}; + break; + } + + case 1: + { + IntTy tmpval_6381 = *(IntTy *) tmpcur_6376; + CursorTy tmpcur_6382 = tmpcur_6376 + sizeof(IntTy); + CursorTy jump_3975 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2936, end_r_2937, loc_3095, tmpcur_6382); + CursorTy pvrtmp_6383 = tmp_struct_31.field0; + CursorTy pvrtmp_6384 = tmp_struct_31.field1; + CursorTy pvrtmp_6385 = tmp_struct_31.field2; + CursorTy pvrtmp_6386 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2935 = 1; + + CursorTy writetag_4592 = loc_2935 + 1; + + *(IntTy *) writetag_4592 = tmpval_6381; + + CursorTy writecur_4593 = writetag_4592 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6383, pvrtmp_6384, + loc_2935, pvrtmp_6386}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6395 = *(CursorTy *) tmpcur_6376; + CursorTy tmpaftercur_6396 = tmpcur_6376 + 8; + CursorTy jump_4278 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2936, end_r_2937, loc_2935, tmpcur_6395); + CursorTy pvrtmp_6397 = tmp_struct_32.field0; + CursorTy pvrtmp_6398 = tmp_struct_32.field1; + CursorTy pvrtmp_6399 = tmp_struct_32.field2; + CursorTy pvrtmp_6400 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6397, jump_4278, + pvrtmp_6399, pvrtmp_6400}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6407 = *(CursorTy *) tmpcur_6376; + CursorTy tmpaftercur_6408 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2936, end_r_2937, loc_2935, tmpcur_6407); + CursorTy pvrtmp_6409 = tmp_struct_33.field0; + CursorTy pvrtmp_6410 = tmp_struct_33.field1; + CursorTy pvrtmp_6411 = tmp_struct_33.field2; + CursorTy pvrtmp_6412 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6409, pvrtmp_6410, + pvrtmp_6411, pvrtmp_6412}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6375"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2940, + CursorTy end_r_2941, + CursorTy loc_2939, + CursorTy arg_629_1235_1560) +{ + CursorTy loc_3107 = loc_2939 + 1; + CursorTy loc_3108 = loc_3107 + 8; + TagTyPacked tmpval_6420 = *(TagTyPacked *) arg_629_1235_1560; + CursorTy tmpcur_6421 = arg_629_1235_1560 + 1; + + + switch_6464: + ; + switch (tmpval_6420) { + + case 0: + { + CursorTy jump_3978 = arg_629_1235_1560 + 1; + + *(TagTyPacked *) loc_2939 = 0; + + CursorTy writetag_4603 = loc_2939 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2941, jump_3978, + loc_2939, writetag_4603}; + break; + } + + case 1: + { + IntTy tmpval_6426 = *(IntTy *) tmpcur_6421; + CursorTy tmpcur_6427 = tmpcur_6421 + sizeof(IntTy); + CursorTy jump_3980 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_3108, tmpcur_6427); + CursorTy pvrtmp_6428 = tmp_struct_37.field0; + CursorTy pvrtmp_6429 = tmp_struct_37.field1; + CursorTy pvrtmp_6430 = tmp_struct_37.field2; + CursorTy pvrtmp_6431 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2939 = 1; + + CursorTy writetag_4608 = loc_2939 + 1; + + *(IntTy *) writetag_4608 = tmpval_6426; + + CursorTy writecur_4609 = writetag_4608 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6428, pvrtmp_6429, + loc_2939, pvrtmp_6431}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6440 = *(CursorTy *) tmpcur_6421; + CursorTy tmpaftercur_6441 = tmpcur_6421 + 8; + CursorTy jump_4284 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_2939, tmpcur_6440); + CursorTy pvrtmp_6442 = tmp_struct_38.field0; + CursorTy pvrtmp_6443 = tmp_struct_38.field1; + CursorTy pvrtmp_6444 = tmp_struct_38.field2; + CursorTy pvrtmp_6445 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6442, jump_4284, + pvrtmp_6444, pvrtmp_6445}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6452 = *(CursorTy *) tmpcur_6421; + CursorTy tmpaftercur_6453 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_2939, tmpcur_6452); + CursorTy pvrtmp_6454 = tmp_struct_39.field0; + CursorTy pvrtmp_6455 = tmp_struct_39.field1; + CursorTy pvrtmp_6456 = tmp_struct_39.field2; + CursorTy pvrtmp_6457 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6454, pvrtmp_6455, + pvrtmp_6456, pvrtmp_6457}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6420"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2943, CursorTy arg_634_1240_1565) +{ + TagTyPacked tmpval_6465 = *(TagTyPacked *) arg_634_1240_1565; + CursorTy tmpcur_6466 = arg_634_1240_1565 + 1; + + + switch_6476: + ; + switch (tmpval_6465) { + + case 0: + { + CursorTy jump_3983 = arg_634_1240_1565 + 1; + + return (CursorProd) {jump_3983}; + break; + } + + case 1: + { + IntTy tmpval_6467 = *(IntTy *) tmpcur_6466; + CursorTy tmpcur_6468 = tmpcur_6466 + sizeof(IntTy); + CursorTy jump_3985 = tmpcur_6466 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2943, tmpcur_6468); + CursorTy pvrtmp_6469 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6469}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6470 = *(CursorTy *) tmpcur_6466; + CursorTy tmpaftercur_6471 = tmpcur_6466 + 8; + CursorTy jump_4290 = tmpcur_6466 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2943, tmpcur_6470); + CursorTy pvrtmp_6472 = tmp_struct_41.field0; + + return (CursorProd) {jump_4290}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6473 = *(CursorTy *) tmpcur_6466; + CursorTy tmpaftercur_6474 = tmpcur_6466 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2943, tmpcur_6473); + CursorTy pvrtmp_6475 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6475}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6465"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2945, CursorTy arg_639_1244_1569) +{ + TagTyPacked tmpval_6477 = *(TagTyPacked *) arg_639_1244_1569; + CursorTy tmpcur_6478 = arg_639_1244_1569 + 1; + + + switch_6488: + ; + switch (tmpval_6477) { + + case 0: + { + CursorTy jump_3988 = arg_639_1244_1569 + 1; + unsigned char wildcard_640_1245_1570 = print_symbol(6162); + unsigned char wildcard_641_1246_1571 = print_symbol(6154); + + return (CursorProd) {jump_3988}; + break; + } + + case 1: + { + IntTy tmpval_6479 = *(IntTy *) tmpcur_6478; + CursorTy tmpcur_6480 = tmpcur_6478 + sizeof(IntTy); + CursorTy jump_3990 = tmpcur_6478 + 8; + unsigned char wildcard_646_1249_1574 = print_symbol(6163); + unsigned char y_644_1250_1575 = printf("%lld", tmpval_6479); + CursorProd tmp_struct_43 = _print_String(end_r_2945, tmpcur_6480); + CursorTy pvrtmp_6481 = tmp_struct_43.field0; + unsigned char wildcard_647_1252_1577 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6481}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6482 = *(CursorTy *) tmpcur_6478; + CursorTy tmpaftercur_6483 = tmpcur_6478 + 8; + CursorTy jump_4296 = tmpcur_6478 + 8; + unsigned char wildcard_4299 = print_symbol(6171); + CursorProd tmp_struct_44 = _print_String(end_r_2945, tmpcur_6482); + CursorTy pvrtmp_6484 = tmp_struct_44.field0; + + return (CursorProd) {jump_4296}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6485 = *(CursorTy *) tmpcur_6478; + CursorTy tmpaftercur_6486 = tmpcur_6478 + 8; + unsigned char wildcard_4299 = print_symbol(6170); + CursorProd tmp_struct_45 = _print_String(end_r_2945, tmpcur_6485); + CursorTy pvrtmp_6487 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6487}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6477"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2948, + CursorTy end_r_2949, + CursorTy loc_2947, + CursorTy arg_648_1253_1578) +{ + if (loc_2947 + 32 > end_r_2949) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2949); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2949 = chunk_end_52; + *(TagTyPacked *) loc_2947 = 255; + + CursorTy redir = loc_2947 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2947 = chunk_start_51; + } + + TagTyPacked tmpval_6489 = *(TagTyPacked *) arg_648_1253_1578; + CursorTy tmpcur_6490 = arg_648_1253_1578 + 1; + + + switch_6539: + ; + switch (tmpval_6489) { + + case 0: + { + CursorTy loc_3130 = loc_2947 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2948, end_r_2949, loc_3130, tmpcur_6490); + CursorTy pvrtmp_6491 = tmp_struct_46.field0; + CursorTy pvrtmp_6492 = tmp_struct_46.field1; + CursorTy pvrtmp_6493 = tmp_struct_46.field2; + CursorTy pvrtmp_6494 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2947 = 0; + + CursorTy writetag_4640 = loc_2947 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6491, pvrtmp_6492, + loc_2947, pvrtmp_6494}; + break; + } + + case 1: + { + CursorTy loc_3136 = loc_2947 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2948, end_r_2949, loc_3136, tmpcur_6490); + CursorTy pvrtmp_6503 = tmp_struct_47.field0; + CursorTy pvrtmp_6504 = tmp_struct_47.field1; + CursorTy pvrtmp_6505 = tmp_struct_47.field2; + CursorTy pvrtmp_6506 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2947 = 1; + + CursorTy writetag_4645 = loc_2947 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6503, pvrtmp_6504, + loc_2947, pvrtmp_6506}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6515 = *(CursorTy *) tmpcur_6490; + CursorTy tmpaftercur_6516 = tmpcur_6490 + 8; + CursorTy jump_4302 = tmpcur_6490 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2948, end_r_2949, loc_2947, tmpcur_6515); + CursorTy pvrtmp_6517 = tmp_struct_48.field0; + CursorTy pvrtmp_6518 = tmp_struct_48.field1; + CursorTy pvrtmp_6519 = tmp_struct_48.field2; + CursorTy pvrtmp_6520 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6517, jump_4302, + pvrtmp_6519, pvrtmp_6520}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6527 = *(CursorTy *) tmpcur_6490; + CursorTy tmpaftercur_6528 = tmpcur_6490 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2948, end_r_2949, loc_2947, tmpcur_6527); + CursorTy pvrtmp_6529 = tmp_struct_49.field0; + CursorTy pvrtmp_6530 = tmp_struct_49.field1; + CursorTy pvrtmp_6531 = tmp_struct_49.field2; + CursorTy pvrtmp_6532 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6529, pvrtmp_6530, + pvrtmp_6531, pvrtmp_6532}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6489"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2952, + CursorTy end_r_2953, + CursorTy loc_2951, + CursorTy arg_653_1258_1583) +{ + TagTyPacked tmpval_6540 = *(TagTyPacked *) arg_653_1258_1583; + CursorTy tmpcur_6541 = arg_653_1258_1583 + 1; + + + switch_6590: + ; + switch (tmpval_6540) { + + case 0: + { + CursorTy loc_3144 = loc_2951 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2952, end_r_2953, loc_3144, tmpcur_6541); + CursorTy pvrtmp_6542 = tmp_struct_53.field0; + CursorTy pvrtmp_6543 = tmp_struct_53.field1; + CursorTy pvrtmp_6544 = tmp_struct_53.field2; + CursorTy pvrtmp_6545 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2951 = 0; + + CursorTy writetag_4656 = loc_2951 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6542, pvrtmp_6543, + loc_2951, pvrtmp_6545}; + break; + } + + case 1: + { + CursorTy loc_3150 = loc_2951 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2952, end_r_2953, loc_3150, tmpcur_6541); + CursorTy pvrtmp_6554 = tmp_struct_54.field0; + CursorTy pvrtmp_6555 = tmp_struct_54.field1; + CursorTy pvrtmp_6556 = tmp_struct_54.field2; + CursorTy pvrtmp_6557 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2951 = 1; + + CursorTy writetag_4661 = loc_2951 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6554, pvrtmp_6555, + loc_2951, pvrtmp_6557}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6566 = *(CursorTy *) tmpcur_6541; + CursorTy tmpaftercur_6567 = tmpcur_6541 + 8; + CursorTy jump_4308 = tmpcur_6541 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2952, end_r_2953, loc_2951, tmpcur_6566); + CursorTy pvrtmp_6568 = tmp_struct_55.field0; + CursorTy pvrtmp_6569 = tmp_struct_55.field1; + CursorTy pvrtmp_6570 = tmp_struct_55.field2; + CursorTy pvrtmp_6571 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6568, jump_4308, + pvrtmp_6570, pvrtmp_6571}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6578 = *(CursorTy *) tmpcur_6541; + CursorTy tmpaftercur_6579 = tmpcur_6541 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2952, end_r_2953, loc_2951, tmpcur_6578); + CursorTy pvrtmp_6580 = tmp_struct_56.field0; + CursorTy pvrtmp_6581 = tmp_struct_56.field1; + CursorTy pvrtmp_6582 = tmp_struct_56.field2; + CursorTy pvrtmp_6583 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6580, pvrtmp_6581, + pvrtmp_6582, pvrtmp_6583}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6540"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2955, CursorTy arg_658_1263_1588) +{ + TagTyPacked tmpval_6591 = *(TagTyPacked *) arg_658_1263_1588; + CursorTy tmpcur_6592 = arg_658_1263_1588 + 1; + + + switch_6601: + ; + switch (tmpval_6591) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2955, tmpcur_6592); + CursorTy pvrtmp_6593 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6593}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2955, tmpcur_6592); + CursorTy pvrtmp_6594 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6594}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6595 = *(CursorTy *) tmpcur_6592; + CursorTy tmpaftercur_6596 = tmpcur_6592 + 8; + CursorTy jump_4314 = tmpcur_6592 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2955, tmpcur_6595); + CursorTy pvrtmp_6597 = tmp_struct_59.field0; + + return (CursorProd) {jump_4314}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6598 = *(CursorTy *) tmpcur_6592; + CursorTy tmpaftercur_6599 = tmpcur_6592 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2955, tmpcur_6598); + CursorTy pvrtmp_6600 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6600}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6591"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2957, CursorTy arg_663_1268_1593) +{ + TagTyPacked tmpval_6602 = *(TagTyPacked *) arg_663_1268_1593; + CursorTy tmpcur_6603 = arg_663_1268_1593 + 1; + + + switch_6612: + ; + switch (tmpval_6602) { + + case 0: + { + unsigned char wildcard_666_1270_1595 = print_symbol(6161); + CursorProd tmp_struct_61 = _print_String(end_r_2957, tmpcur_6603); + CursorTy pvrtmp_6604 = tmp_struct_61.field0; + unsigned char wildcard_667_1272_1597 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6604}; + break; + } + + case 1: + { + unsigned char wildcard_670_1274_1599 = print_symbol(6155); + CursorProd tmp_struct_62 = _print_String(end_r_2957, tmpcur_6603); + CursorTy pvrtmp_6605 = tmp_struct_62.field0; + unsigned char wildcard_671_1276_1601 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6605}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6606 = *(CursorTy *) tmpcur_6603; + CursorTy tmpaftercur_6607 = tmpcur_6603 + 8; + CursorTy jump_4320 = tmpcur_6603 + 8; + unsigned char wildcard_4323 = print_symbol(6171); + CursorProd tmp_struct_63 = _print_Content(end_r_2957, tmpcur_6606); + CursorTy pvrtmp_6608 = tmp_struct_63.field0; + + return (CursorProd) {jump_4320}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6609 = *(CursorTy *) tmpcur_6603; + CursorTy tmpaftercur_6610 = tmpcur_6603 + 8; + unsigned char wildcard_4323 = print_symbol(6170); + CursorProd tmp_struct_64 = _print_Content(end_r_2957, tmpcur_6609); + CursorTy pvrtmp_6611 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6611}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6602"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2960, CursorTy end_r_2961, + CursorTy loc_2959, + CursorTy arg_672_1277_1602) +{ + if (loc_2959 + 32 > end_r_2961) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2961); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2961 = chunk_end_91; + *(TagTyPacked *) loc_2959 = 255; + + CursorTy redir = loc_2959 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2959 = chunk_start_90; + } + + CursorTy loc_3180 = loc_2959 + 1; + CursorTy loc_3181 = loc_3180 + 8; + CursorTy loc_3196 = loc_2959 + 1; + CursorTy loc_3197 = loc_3196 + 8; + CursorTy loc_3217 = loc_2959 + 1; + CursorTy loc_3218 = loc_3217 + 8; + CursorTy loc_3219 = loc_3218 + 8; + CursorTy loc_3243 = loc_2959 + 1; + CursorTy loc_3244 = loc_3243 + 8; + CursorTy loc_3245 = loc_3244 + 8; + CursorTy loc_3269 = loc_2959 + 1; + CursorTy loc_3270 = loc_3269 + 8; + CursorTy loc_3271 = loc_3270 + 8; + CursorTy loc_3295 = loc_2959 + 1; + CursorTy loc_3296 = loc_3295 + 8; + CursorTy loc_3297 = loc_3296 + 8; + CursorTy loc_3321 = loc_2959 + 1; + CursorTy loc_3322 = loc_3321 + 8; + CursorTy loc_3323 = loc_3322 + 8; + CursorTy loc_3347 = loc_2959 + 1; + CursorTy loc_3348 = loc_3347 + 8; + CursorTy loc_3349 = loc_3348 + 8; + TagTyPacked tmpval_6613 = *(TagTyPacked *) arg_672_1277_1602; + CursorTy tmpcur_6614 = arg_672_1277_1602 + 1; + + + switch_6879: + ; + switch (tmpval_6613) { + + case 0: + { + CursorTy jump_4009 = arg_672_1277_1602 + 1; + + *(TagTyPacked *) loc_2959 = 0; + + CursorTy writetag_4691 = loc_2959 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2961, jump_4009, + loc_2959, writetag_4691}; + break; + } + + case 9: + { + CursorTy tmpcur_6619 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6620 = tmpcur_6614 + 8; + CursorTy jump_4011 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2960, end_r_2961, loc_3181, tmpaftercur_6620); + CursorTy pvrtmp_6621 = tmp_struct_65.field0; + CursorTy pvrtmp_6622 = tmp_struct_65.field1; + CursorTy pvrtmp_6623 = tmp_struct_65.field2; + CursorTy pvrtmp_6624 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2960, pvrtmp_6621, pvrtmp_6624, tmpcur_6619); + CursorTy pvrtmp_6629 = tmp_struct_66.field0; + CursorTy pvrtmp_6630 = tmp_struct_66.field1; + CursorTy pvrtmp_6631 = tmp_struct_66.field2; + CursorTy pvrtmp_6632 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2959 = 9; + + CursorTy writetag_4697 = loc_2959 + 1; + + *(CursorTy *) writetag_4697 = pvrtmp_6624; + + CursorTy writecur_4698 = writetag_4697 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6629, pvrtmp_6630, + loc_2959, pvrtmp_6632}; + break; + } + + case 11: + { + CursorTy tmpcur_6641 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6642 = tmpcur_6614 + 8; + CursorTy jump_4015 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2960, end_r_2961, loc_3197, tmpaftercur_6642); + CursorTy pvrtmp_6643 = tmp_struct_67.field0; + CursorTy pvrtmp_6644 = tmp_struct_67.field1; + CursorTy pvrtmp_6645 = tmp_struct_67.field2; + CursorTy pvrtmp_6646 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2960, pvrtmp_6643, pvrtmp_6646, tmpcur_6641); + CursorTy pvrtmp_6651 = tmp_struct_68.field0; + CursorTy pvrtmp_6652 = tmp_struct_68.field1; + CursorTy pvrtmp_6653 = tmp_struct_68.field2; + CursorTy pvrtmp_6654 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2959 = 11; + + CursorTy writetag_4706 = loc_2959 + 1; + + *(CursorTy *) writetag_4706 = pvrtmp_6646; + + CursorTy writecur_4707 = writetag_4706 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6651, pvrtmp_6652, + loc_2959, pvrtmp_6654}; + break; + } + + case 13: + { + CursorTy tmpcur_6663 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6664 = tmpcur_6614 + 8; + CursorTy tmpcur_6665 = *(CursorTy *) tmpaftercur_6664; + CursorTy tmpaftercur_6666 = tmpaftercur_6664 + 8; + CursorTy jump_4020 = tmpaftercur_6664 + 8; + CursorTy jump_4019 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2960, end_r_2961, loc_3219, tmpaftercur_6666); + CursorTy pvrtmp_6667 = tmp_struct_69.field0; + CursorTy pvrtmp_6668 = tmp_struct_69.field1; + CursorTy pvrtmp_6669 = tmp_struct_69.field2; + CursorTy pvrtmp_6670 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2960, pvrtmp_6667, pvrtmp_6670, tmpcur_6663); + CursorTy pvrtmp_6675 = tmp_struct_70.field0; + CursorTy pvrtmp_6676 = tmp_struct_70.field1; + CursorTy pvrtmp_6677 = tmp_struct_70.field2; + CursorTy pvrtmp_6678 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2960, pvrtmp_6675, pvrtmp_6678, tmpcur_6665); + CursorTy pvrtmp_6683 = tmp_struct_71.field0; + CursorTy pvrtmp_6684 = tmp_struct_71.field1; + CursorTy pvrtmp_6685 = tmp_struct_71.field2; + CursorTy pvrtmp_6686 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2959 = 13; + + CursorTy writetag_4717 = loc_2959 + 1; + + *(CursorTy *) writetag_4717 = pvrtmp_6670; + + CursorTy writecur_4718 = writetag_4717 + 8; + + *(CursorTy *) writecur_4718 = pvrtmp_6678; + + CursorTy writecur_4719 = writecur_4718 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6683, pvrtmp_6684, + loc_2959, pvrtmp_6686}; + break; + } + + case 15: + { + CursorTy tmpcur_6695 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6696 = tmpcur_6614 + 8; + CursorTy tmpcur_6697 = *(CursorTy *) tmpaftercur_6696; + CursorTy tmpaftercur_6698 = tmpaftercur_6696 + 8; + CursorTy jump_4026 = tmpaftercur_6696 + 8; + CursorTy jump_4025 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2960, end_r_2961, loc_3245, tmpaftercur_6698); + CursorTy pvrtmp_6699 = tmp_struct_72.field0; + CursorTy pvrtmp_6700 = tmp_struct_72.field1; + CursorTy pvrtmp_6701 = tmp_struct_72.field2; + CursorTy pvrtmp_6702 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2960, pvrtmp_6699, pvrtmp_6702, tmpcur_6695); + CursorTy pvrtmp_6707 = tmp_struct_73.field0; + CursorTy pvrtmp_6708 = tmp_struct_73.field1; + CursorTy pvrtmp_6709 = tmp_struct_73.field2; + CursorTy pvrtmp_6710 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2960, pvrtmp_6707, pvrtmp_6710, tmpcur_6697); + CursorTy pvrtmp_6715 = tmp_struct_74.field0; + CursorTy pvrtmp_6716 = tmp_struct_74.field1; + CursorTy pvrtmp_6717 = tmp_struct_74.field2; + CursorTy pvrtmp_6718 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2959 = 15; + + CursorTy writetag_4730 = loc_2959 + 1; + + *(CursorTy *) writetag_4730 = pvrtmp_6702; + + CursorTy writecur_4731 = writetag_4730 + 8; + + *(CursorTy *) writecur_4731 = pvrtmp_6710; + + CursorTy writecur_4732 = writecur_4731 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6715, pvrtmp_6716, + loc_2959, pvrtmp_6718}; + break; + } + + case 17: + { + CursorTy tmpcur_6727 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6728 = tmpcur_6614 + 8; + CursorTy tmpcur_6729 = *(CursorTy *) tmpaftercur_6728; + CursorTy tmpaftercur_6730 = tmpaftercur_6728 + 8; + CursorTy jump_4032 = tmpaftercur_6728 + 8; + CursorTy jump_4031 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2960, end_r_2961, loc_3271, tmpaftercur_6730); + CursorTy pvrtmp_6731 = tmp_struct_75.field0; + CursorTy pvrtmp_6732 = tmp_struct_75.field1; + CursorTy pvrtmp_6733 = tmp_struct_75.field2; + CursorTy pvrtmp_6734 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2960, pvrtmp_6731, pvrtmp_6734, tmpcur_6727); + CursorTy pvrtmp_6739 = tmp_struct_76.field0; + CursorTy pvrtmp_6740 = tmp_struct_76.field1; + CursorTy pvrtmp_6741 = tmp_struct_76.field2; + CursorTy pvrtmp_6742 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2960, pvrtmp_6739, pvrtmp_6742, tmpcur_6729); + CursorTy pvrtmp_6747 = tmp_struct_77.field0; + CursorTy pvrtmp_6748 = tmp_struct_77.field1; + CursorTy pvrtmp_6749 = tmp_struct_77.field2; + CursorTy pvrtmp_6750 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2959 = 17; + + CursorTy writetag_4743 = loc_2959 + 1; + + *(CursorTy *) writetag_4743 = pvrtmp_6734; + + CursorTy writecur_4744 = writetag_4743 + 8; + + *(CursorTy *) writecur_4744 = pvrtmp_6742; + + CursorTy writecur_4745 = writecur_4744 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6747, pvrtmp_6748, + loc_2959, pvrtmp_6750}; + break; + } + + case 19: + { + CursorTy tmpcur_6759 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6760 = tmpcur_6614 + 8; + CursorTy tmpcur_6761 = *(CursorTy *) tmpaftercur_6760; + CursorTy tmpaftercur_6762 = tmpaftercur_6760 + 8; + CursorTy jump_4038 = tmpaftercur_6760 + 8; + CursorTy jump_4037 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2960, end_r_2961, loc_3297, tmpaftercur_6762); + CursorTy pvrtmp_6763 = tmp_struct_78.field0; + CursorTy pvrtmp_6764 = tmp_struct_78.field1; + CursorTy pvrtmp_6765 = tmp_struct_78.field2; + CursorTy pvrtmp_6766 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2960, pvrtmp_6763, pvrtmp_6766, tmpcur_6759); + CursorTy pvrtmp_6771 = tmp_struct_79.field0; + CursorTy pvrtmp_6772 = tmp_struct_79.field1; + CursorTy pvrtmp_6773 = tmp_struct_79.field2; + CursorTy pvrtmp_6774 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2960, pvrtmp_6771, pvrtmp_6774, tmpcur_6761); + CursorTy pvrtmp_6779 = tmp_struct_80.field0; + CursorTy pvrtmp_6780 = tmp_struct_80.field1; + CursorTy pvrtmp_6781 = tmp_struct_80.field2; + CursorTy pvrtmp_6782 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2959 = 19; + + CursorTy writetag_4756 = loc_2959 + 1; + + *(CursorTy *) writetag_4756 = pvrtmp_6766; + + CursorTy writecur_4757 = writetag_4756 + 8; + + *(CursorTy *) writecur_4757 = pvrtmp_6774; + + CursorTy writecur_4758 = writecur_4757 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6779, pvrtmp_6780, + loc_2959, pvrtmp_6782}; + break; + } + + case 21: + { + CursorTy tmpcur_6791 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6792 = tmpcur_6614 + 8; + CursorTy tmpcur_6793 = *(CursorTy *) tmpaftercur_6792; + CursorTy tmpaftercur_6794 = tmpaftercur_6792 + 8; + CursorTy jump_4044 = tmpaftercur_6792 + 8; + CursorTy jump_4043 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2960, end_r_2961, loc_3323, tmpaftercur_6794); + CursorTy pvrtmp_6795 = tmp_struct_81.field0; + CursorTy pvrtmp_6796 = tmp_struct_81.field1; + CursorTy pvrtmp_6797 = tmp_struct_81.field2; + CursorTy pvrtmp_6798 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2960, pvrtmp_6795, pvrtmp_6798, tmpcur_6791); + CursorTy pvrtmp_6803 = tmp_struct_82.field0; + CursorTy pvrtmp_6804 = tmp_struct_82.field1; + CursorTy pvrtmp_6805 = tmp_struct_82.field2; + CursorTy pvrtmp_6806 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2960, pvrtmp_6803, pvrtmp_6806, tmpcur_6793); + CursorTy pvrtmp_6811 = tmp_struct_83.field0; + CursorTy pvrtmp_6812 = tmp_struct_83.field1; + CursorTy pvrtmp_6813 = tmp_struct_83.field2; + CursorTy pvrtmp_6814 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2959 = 21; + + CursorTy writetag_4769 = loc_2959 + 1; + + *(CursorTy *) writetag_4769 = pvrtmp_6798; + + CursorTy writecur_4770 = writetag_4769 + 8; + + *(CursorTy *) writecur_4770 = pvrtmp_6806; + + CursorTy writecur_4771 = writecur_4770 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6811, pvrtmp_6812, + loc_2959, pvrtmp_6814}; + break; + } + + case 23: + { + CursorTy tmpcur_6823 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6824 = tmpcur_6614 + 8; + CursorTy tmpcur_6825 = *(CursorTy *) tmpaftercur_6824; + CursorTy tmpaftercur_6826 = tmpaftercur_6824 + 8; + CursorTy jump_4050 = tmpaftercur_6824 + 8; + CursorTy jump_4049 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2960, end_r_2961, loc_3349, tmpaftercur_6826); + CursorTy pvrtmp_6827 = tmp_struct_84.field0; + CursorTy pvrtmp_6828 = tmp_struct_84.field1; + CursorTy pvrtmp_6829 = tmp_struct_84.field2; + CursorTy pvrtmp_6830 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2960, pvrtmp_6827, pvrtmp_6830, tmpcur_6823); + CursorTy pvrtmp_6835 = tmp_struct_85.field0; + CursorTy pvrtmp_6836 = tmp_struct_85.field1; + CursorTy pvrtmp_6837 = tmp_struct_85.field2; + CursorTy pvrtmp_6838 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2960, pvrtmp_6835, pvrtmp_6838, tmpcur_6825); + CursorTy pvrtmp_6843 = tmp_struct_86.field0; + CursorTy pvrtmp_6844 = tmp_struct_86.field1; + CursorTy pvrtmp_6845 = tmp_struct_86.field2; + CursorTy pvrtmp_6846 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2959 = 23; + + CursorTy writetag_4782 = loc_2959 + 1; + + *(CursorTy *) writetag_4782 = pvrtmp_6830; + + CursorTy writecur_4783 = writetag_4782 + 8; + + *(CursorTy *) writecur_4783 = pvrtmp_6838; + + CursorTy writecur_4784 = writecur_4783 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6843, pvrtmp_6844, + loc_2959, pvrtmp_6846}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6855 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6856 = tmpcur_6614 + 8; + CursorTy jump_4326 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2960, end_r_2961, loc_2959, tmpcur_6855); + CursorTy pvrtmp_6857 = tmp_struct_87.field0; + CursorTy pvrtmp_6858 = tmp_struct_87.field1; + CursorTy pvrtmp_6859 = tmp_struct_87.field2; + CursorTy pvrtmp_6860 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6857, jump_4326, + pvrtmp_6859, pvrtmp_6860}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6867 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6868 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2960, end_r_2961, loc_2959, tmpcur_6867); + CursorTy pvrtmp_6869 = tmp_struct_88.field0; + CursorTy pvrtmp_6870 = tmp_struct_88.field1; + CursorTy pvrtmp_6871 = tmp_struct_88.field2; + CursorTy pvrtmp_6872 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6869, pvrtmp_6870, + pvrtmp_6871, pvrtmp_6872}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6613"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2964, + CursorTy end_r_2965, + CursorTy loc_2963, + CursorTy arg_717_1322_1647) +{ + TagTyPacked tmpval_6880 = *(TagTyPacked *) arg_717_1322_1647; + CursorTy tmpcur_6881 = arg_717_1322_1647 + 1; + + + switch_7146: + ; + switch (tmpval_6880) { + + case 0: + { + CursorTy jump_4055 = arg_717_1322_1647 + 1; + + *(TagTyPacked *) loc_2963 = 0; + + CursorTy writetag_4796 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2965, jump_4055, + loc_2963, writetag_4796}; + break; + } + + case 9: + { + CursorTy tmpcur_6886 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6887 = tmpcur_6881 + 8; + CursorTy jump_4057 = tmpcur_6881 + 8; + CursorTy loc_3371 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3371, tmpaftercur_6887); + CursorTy pvrtmp_6888 = tmp_struct_92.field0; + CursorTy pvrtmp_6889 = tmp_struct_92.field1; + CursorTy pvrtmp_6890 = tmp_struct_92.field2; + CursorTy pvrtmp_6891 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6888, pvrtmp_6891, tmpcur_6886); + CursorTy pvrtmp_6896 = tmp_struct_93.field0; + CursorTy pvrtmp_6897 = tmp_struct_93.field1; + CursorTy pvrtmp_6898 = tmp_struct_93.field2; + CursorTy pvrtmp_6899 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2963 = 1; + + CursorTy writetag_4802 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6896, pvrtmp_6897, + loc_2963, pvrtmp_6899}; + break; + } + + case 11: + { + CursorTy tmpcur_6908 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6909 = tmpcur_6881 + 8; + CursorTy jump_4061 = tmpcur_6881 + 8; + CursorTy loc_3384 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3384, tmpaftercur_6909); + CursorTy pvrtmp_6910 = tmp_struct_94.field0; + CursorTy pvrtmp_6911 = tmp_struct_94.field1; + CursorTy pvrtmp_6912 = tmp_struct_94.field2; + CursorTy pvrtmp_6913 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6910, pvrtmp_6913, tmpcur_6908); + CursorTy pvrtmp_6918 = tmp_struct_95.field0; + CursorTy pvrtmp_6919 = tmp_struct_95.field1; + CursorTy pvrtmp_6920 = tmp_struct_95.field2; + CursorTy pvrtmp_6921 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2963 = 2; + + CursorTy writetag_4810 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6918, pvrtmp_6919, + loc_2963, pvrtmp_6921}; + break; + } + + case 13: + { + CursorTy tmpcur_6930 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6931 = tmpcur_6881 + 8; + CursorTy tmpcur_6932 = *(CursorTy *) tmpaftercur_6931; + CursorTy tmpaftercur_6933 = tmpaftercur_6931 + 8; + CursorTy jump_4066 = tmpaftercur_6931 + 8; + CursorTy jump_4065 = tmpcur_6881 + 8; + CursorTy loc_3402 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2964, end_r_2965, loc_3402, tmpaftercur_6933); + CursorTy pvrtmp_6934 = tmp_struct_96.field0; + CursorTy pvrtmp_6935 = tmp_struct_96.field1; + CursorTy pvrtmp_6936 = tmp_struct_96.field2; + CursorTy pvrtmp_6937 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6934, pvrtmp_6937, tmpcur_6930); + CursorTy pvrtmp_6942 = tmp_struct_97.field0; + CursorTy pvrtmp_6943 = tmp_struct_97.field1; + CursorTy pvrtmp_6944 = tmp_struct_97.field2; + CursorTy pvrtmp_6945 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6942, pvrtmp_6945, tmpcur_6932); + CursorTy pvrtmp_6950 = tmp_struct_98.field0; + CursorTy pvrtmp_6951 = tmp_struct_98.field1; + CursorTy pvrtmp_6952 = tmp_struct_98.field2; + CursorTy pvrtmp_6953 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2963 = 3; + + CursorTy writetag_4820 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6950, pvrtmp_6951, + loc_2963, pvrtmp_6953}; + break; + } + + case 15: + { + CursorTy tmpcur_6962 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6963 = tmpcur_6881 + 8; + CursorTy tmpcur_6964 = *(CursorTy *) tmpaftercur_6963; + CursorTy tmpaftercur_6965 = tmpaftercur_6963 + 8; + CursorTy jump_4072 = tmpaftercur_6963 + 8; + CursorTy jump_4071 = tmpcur_6881 + 8; + CursorTy loc_3422 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3422, tmpaftercur_6965); + CursorTy pvrtmp_6966 = tmp_struct_99.field0; + CursorTy pvrtmp_6967 = tmp_struct_99.field1; + CursorTy pvrtmp_6968 = tmp_struct_99.field2; + CursorTy pvrtmp_6969 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6966, pvrtmp_6969, tmpcur_6962); + CursorTy pvrtmp_6974 = tmp_struct_100.field0; + CursorTy pvrtmp_6975 = tmp_struct_100.field1; + CursorTy pvrtmp_6976 = tmp_struct_100.field2; + CursorTy pvrtmp_6977 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_6974, pvrtmp_6977, tmpcur_6964); + CursorTy pvrtmp_6982 = tmp_struct_101.field0; + CursorTy pvrtmp_6983 = tmp_struct_101.field1; + CursorTy pvrtmp_6984 = tmp_struct_101.field2; + CursorTy pvrtmp_6985 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2963 = 4; + + CursorTy writetag_4831 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6982, pvrtmp_6983, + loc_2963, pvrtmp_6985}; + break; + } + + case 17: + { + CursorTy tmpcur_6994 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6995 = tmpcur_6881 + 8; + CursorTy tmpcur_6996 = *(CursorTy *) tmpaftercur_6995; + CursorTy tmpaftercur_6997 = tmpaftercur_6995 + 8; + CursorTy jump_4078 = tmpaftercur_6995 + 8; + CursorTy jump_4077 = tmpcur_6881 + 8; + CursorTy loc_3442 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2964, end_r_2965, loc_3442, tmpaftercur_6997); + CursorTy pvrtmp_6998 = tmp_struct_102.field0; + CursorTy pvrtmp_6999 = tmp_struct_102.field1; + CursorTy pvrtmp_7000 = tmp_struct_102.field2; + CursorTy pvrtmp_7001 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6998, pvrtmp_7001, tmpcur_6994); + CursorTy pvrtmp_7006 = tmp_struct_103.field0; + CursorTy pvrtmp_7007 = tmp_struct_103.field1; + CursorTy pvrtmp_7008 = tmp_struct_103.field2; + CursorTy pvrtmp_7009 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_7006, pvrtmp_7009, tmpcur_6996); + CursorTy pvrtmp_7014 = tmp_struct_104.field0; + CursorTy pvrtmp_7015 = tmp_struct_104.field1; + CursorTy pvrtmp_7016 = tmp_struct_104.field2; + CursorTy pvrtmp_7017 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2963 = 5; + + CursorTy writetag_4842 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7014, pvrtmp_7015, + loc_2963, pvrtmp_7017}; + break; + } + + case 19: + { + CursorTy tmpcur_7026 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7027 = tmpcur_6881 + 8; + CursorTy tmpcur_7028 = *(CursorTy *) tmpaftercur_7027; + CursorTy tmpaftercur_7029 = tmpaftercur_7027 + 8; + CursorTy jump_4084 = tmpaftercur_7027 + 8; + CursorTy jump_4083 = tmpcur_6881 + 8; + CursorTy loc_3462 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3462, tmpaftercur_7029); + CursorTy pvrtmp_7030 = tmp_struct_105.field0; + CursorTy pvrtmp_7031 = tmp_struct_105.field1; + CursorTy pvrtmp_7032 = tmp_struct_105.field2; + CursorTy pvrtmp_7033 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7030, pvrtmp_7033, tmpcur_7026); + CursorTy pvrtmp_7038 = tmp_struct_106.field0; + CursorTy pvrtmp_7039 = tmp_struct_106.field1; + CursorTy pvrtmp_7040 = tmp_struct_106.field2; + CursorTy pvrtmp_7041 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_7038, pvrtmp_7041, tmpcur_7028); + CursorTy pvrtmp_7046 = tmp_struct_107.field0; + CursorTy pvrtmp_7047 = tmp_struct_107.field1; + CursorTy pvrtmp_7048 = tmp_struct_107.field2; + CursorTy pvrtmp_7049 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2963 = 6; + + CursorTy writetag_4853 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7046, pvrtmp_7047, + loc_2963, pvrtmp_7049}; + break; + } + + case 21: + { + CursorTy tmpcur_7058 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7059 = tmpcur_6881 + 8; + CursorTy tmpcur_7060 = *(CursorTy *) tmpaftercur_7059; + CursorTy tmpaftercur_7061 = tmpaftercur_7059 + 8; + CursorTy jump_4090 = tmpaftercur_7059 + 8; + CursorTy jump_4089 = tmpcur_6881 + 8; + CursorTy loc_3482 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3482, tmpaftercur_7061); + CursorTy pvrtmp_7062 = tmp_struct_108.field0; + CursorTy pvrtmp_7063 = tmp_struct_108.field1; + CursorTy pvrtmp_7064 = tmp_struct_108.field2; + CursorTy pvrtmp_7065 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7062, pvrtmp_7065, tmpcur_7058); + CursorTy pvrtmp_7070 = tmp_struct_109.field0; + CursorTy pvrtmp_7071 = tmp_struct_109.field1; + CursorTy pvrtmp_7072 = tmp_struct_109.field2; + CursorTy pvrtmp_7073 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_7070, pvrtmp_7073, tmpcur_7060); + CursorTy pvrtmp_7078 = tmp_struct_110.field0; + CursorTy pvrtmp_7079 = tmp_struct_110.field1; + CursorTy pvrtmp_7080 = tmp_struct_110.field2; + CursorTy pvrtmp_7081 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2963 = 7; + + CursorTy writetag_4864 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7078, pvrtmp_7079, + loc_2963, pvrtmp_7081}; + break; + } + + case 23: + { + CursorTy tmpcur_7090 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7091 = tmpcur_6881 + 8; + CursorTy tmpcur_7092 = *(CursorTy *) tmpaftercur_7091; + CursorTy tmpaftercur_7093 = tmpaftercur_7091 + 8; + CursorTy jump_4096 = tmpaftercur_7091 + 8; + CursorTy jump_4095 = tmpcur_6881 + 8; + CursorTy loc_3502 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3502, tmpaftercur_7093); + CursorTy pvrtmp_7094 = tmp_struct_111.field0; + CursorTy pvrtmp_7095 = tmp_struct_111.field1; + CursorTy pvrtmp_7096 = tmp_struct_111.field2; + CursorTy pvrtmp_7097 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_7094, pvrtmp_7097, tmpcur_7090); + CursorTy pvrtmp_7102 = tmp_struct_112.field0; + CursorTy pvrtmp_7103 = tmp_struct_112.field1; + CursorTy pvrtmp_7104 = tmp_struct_112.field2; + CursorTy pvrtmp_7105 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7102, pvrtmp_7105, tmpcur_7092); + CursorTy pvrtmp_7110 = tmp_struct_113.field0; + CursorTy pvrtmp_7111 = tmp_struct_113.field1; + CursorTy pvrtmp_7112 = tmp_struct_113.field2; + CursorTy pvrtmp_7113 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2963 = 8; + + CursorTy writetag_4875 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7110, pvrtmp_7111, + loc_2963, pvrtmp_7113}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7122 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7123 = tmpcur_6881 + 8; + CursorTy jump_4332 = tmpcur_6881 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_2963, tmpcur_7122); + CursorTy pvrtmp_7124 = tmp_struct_114.field0; + CursorTy pvrtmp_7125 = tmp_struct_114.field1; + CursorTy pvrtmp_7126 = tmp_struct_114.field2; + CursorTy pvrtmp_7127 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7124, jump_4332, + pvrtmp_7126, pvrtmp_7127}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7134 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7135 = tmpcur_6881 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_2963, tmpcur_7134); + CursorTy pvrtmp_7136 = tmp_struct_115.field0; + CursorTy pvrtmp_7137 = tmp_struct_115.field1; + CursorTy pvrtmp_7138 = tmp_struct_115.field2; + CursorTy pvrtmp_7139 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7136, pvrtmp_7137, + pvrtmp_7138, pvrtmp_7139}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6880"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2967, CursorTy arg_762_1367_1692) +{ + TagTyPacked tmpval_7147 = *(TagTyPacked *) arg_762_1367_1692; + CursorTy tmpcur_7148 = arg_762_1367_1692 + 1; + + + switch_7205: + ; + switch (tmpval_7147) { + + case 0: + { + CursorTy jump_4101 = arg_762_1367_1692 + 1; + + return (CursorProd) {jump_4101}; + break; + } + + case 9: + { + CursorTy tmpcur_7149 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7150 = tmpcur_7148 + 8; + CursorTy jump_4103 = tmpcur_7148 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2967, tmpaftercur_7150); + CursorTy pvrtmp_7151 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2967, tmpcur_7149); + CursorTy pvrtmp_7152 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7152}; + break; + } + + case 11: + { + CursorTy tmpcur_7153 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7154 = tmpcur_7148 + 8; + CursorTy jump_4107 = tmpcur_7148 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2967, tmpaftercur_7154); + CursorTy pvrtmp_7155 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2967, tmpcur_7153); + CursorTy pvrtmp_7156 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7156}; + break; + } + + case 13: + { + CursorTy tmpcur_7157 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7158 = tmpcur_7148 + 8; + CursorTy tmpcur_7159 = *(CursorTy *) tmpaftercur_7158; + CursorTy tmpaftercur_7160 = tmpaftercur_7158 + 8; + CursorTy jump_4112 = tmpaftercur_7158 + 8; + CursorTy jump_4111 = tmpcur_7148 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2967, tmpaftercur_7160); + CursorTy pvrtmp_7161 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2967, tmpcur_7157); + CursorTy pvrtmp_7162 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2967, tmpcur_7159); + CursorTy pvrtmp_7163 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7163}; + break; + } + + case 15: + { + CursorTy tmpcur_7164 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7165 = tmpcur_7148 + 8; + CursorTy tmpcur_7166 = *(CursorTy *) tmpaftercur_7165; + CursorTy tmpaftercur_7167 = tmpaftercur_7165 + 8; + CursorTy jump_4118 = tmpaftercur_7165 + 8; + CursorTy jump_4117 = tmpcur_7148 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2967, tmpaftercur_7167); + CursorTy pvrtmp_7168 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2967, tmpcur_7164); + CursorTy pvrtmp_7169 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2967, tmpcur_7166); + CursorTy pvrtmp_7170 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7170}; + break; + } + + case 17: + { + CursorTy tmpcur_7171 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7172 = tmpcur_7148 + 8; + CursorTy tmpcur_7173 = *(CursorTy *) tmpaftercur_7172; + CursorTy tmpaftercur_7174 = tmpaftercur_7172 + 8; + CursorTy jump_4124 = tmpaftercur_7172 + 8; + CursorTy jump_4123 = tmpcur_7148 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2967, tmpaftercur_7174); + CursorTy pvrtmp_7175 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2967, tmpcur_7171); + CursorTy pvrtmp_7176 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2967, tmpcur_7173); + CursorTy pvrtmp_7177 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7177}; + break; + } + + case 19: + { + CursorTy tmpcur_7178 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7179 = tmpcur_7148 + 8; + CursorTy tmpcur_7180 = *(CursorTy *) tmpaftercur_7179; + CursorTy tmpaftercur_7181 = tmpaftercur_7179 + 8; + CursorTy jump_4130 = tmpaftercur_7179 + 8; + CursorTy jump_4129 = tmpcur_7148 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2967, tmpaftercur_7181); + CursorTy pvrtmp_7182 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2967, tmpcur_7178); + CursorTy pvrtmp_7183 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2967, tmpcur_7180); + CursorTy pvrtmp_7184 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7184}; + break; + } + + case 21: + { + CursorTy tmpcur_7185 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7186 = tmpcur_7148 + 8; + CursorTy tmpcur_7187 = *(CursorTy *) tmpaftercur_7186; + CursorTy tmpaftercur_7188 = tmpaftercur_7186 + 8; + CursorTy jump_4136 = tmpaftercur_7186 + 8; + CursorTy jump_4135 = tmpcur_7148 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2967, tmpaftercur_7188); + CursorTy pvrtmp_7189 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2967, tmpcur_7185); + CursorTy pvrtmp_7190 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2967, tmpcur_7187); + CursorTy pvrtmp_7191 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7191}; + break; + } + + case 23: + { + CursorTy tmpcur_7192 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7193 = tmpcur_7148 + 8; + CursorTy tmpcur_7194 = *(CursorTy *) tmpaftercur_7193; + CursorTy tmpaftercur_7195 = tmpaftercur_7193 + 8; + CursorTy jump_4142 = tmpaftercur_7193 + 8; + CursorTy jump_4141 = tmpcur_7148 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2967, tmpaftercur_7195); + CursorTy pvrtmp_7196 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2967, tmpcur_7192); + CursorTy pvrtmp_7197 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2967, tmpcur_7194); + CursorTy pvrtmp_7198 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7198}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7199 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7200 = tmpcur_7148 + 8; + CursorTy jump_4338 = tmpcur_7148 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2967, tmpcur_7199); + CursorTy pvrtmp_7201 = tmp_struct_138.field0; + + return (CursorProd) {jump_4338}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7202 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7203 = tmpcur_7148 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2967, tmpcur_7202); + CursorTy pvrtmp_7204 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7204}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7147"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2969, CursorTy arg_807_1412_1737) +{ + TagTyPacked tmpval_7206 = *(TagTyPacked *) arg_807_1412_1737; + CursorTy tmpcur_7207 = arg_807_1412_1737 + 1; + + + switch_7264: + ; + switch (tmpval_7206) { + + case 0: + { + CursorTy jump_4147 = arg_807_1412_1737 + 1; + unsigned char wildcard_808_1413_1738 = print_symbol(6160); + unsigned char wildcard_809_1414_1739 = print_symbol(6154); + + return (CursorProd) {jump_4147}; + break; + } + + case 9: + { + CursorTy tmpcur_7208 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7209 = tmpcur_7207 + 8; + CursorTy jump_4149 = tmpcur_7207 + 8; + unsigned char wildcard_814_1417_1742 = print_symbol(6166); + CursorProd tmp_struct_140 = + _print_Content(end_r_2969, tmpaftercur_7209); + CursorTy pvrtmp_7210 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2969, tmpcur_7208); + CursorTy pvrtmp_7211 = tmp_struct_141.field0; + unsigned char wildcard_815_1420_1745 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7211}; + break; + } + + case 11: + { + CursorTy tmpcur_7212 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7213 = tmpcur_7207 + 8; + CursorTy jump_4153 = tmpcur_7207 + 8; + unsigned char wildcard_820_1423_1748 = print_symbol(6169); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2969, tmpaftercur_7213); + CursorTy pvrtmp_7214 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2969, tmpcur_7212); + CursorTy pvrtmp_7215 = tmp_struct_143.field0; + unsigned char wildcard_821_1426_1751 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7215}; + break; + } + + case 13: + { + CursorTy tmpcur_7216 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7217 = tmpcur_7207 + 8; + CursorTy tmpcur_7218 = *(CursorTy *) tmpaftercur_7217; + CursorTy tmpaftercur_7219 = tmpaftercur_7217 + 8; + CursorTy jump_4158 = tmpaftercur_7217 + 8; + CursorTy jump_4157 = tmpcur_7207 + 8; + unsigned char wildcard_828_1430_1755 = print_symbol(6157); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2969, tmpaftercur_7219); + CursorTy pvrtmp_7220 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2969, tmpcur_7216); + CursorTy pvrtmp_7221 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2969, tmpcur_7218); + CursorTy pvrtmp_7222 = tmp_struct_146.field0; + unsigned char wildcard_829_1434_1759 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7222}; + break; + } + + case 15: + { + CursorTy tmpcur_7223 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7224 = tmpcur_7207 + 8; + CursorTy tmpcur_7225 = *(CursorTy *) tmpaftercur_7224; + CursorTy tmpaftercur_7226 = tmpaftercur_7224 + 8; + CursorTy jump_4164 = tmpaftercur_7224 + 8; + CursorTy jump_4163 = tmpcur_7207 + 8; + unsigned char wildcard_836_1438_1763 = print_symbol(6168); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2969, tmpaftercur_7226); + CursorTy pvrtmp_7227 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2969, tmpcur_7223); + CursorTy pvrtmp_7228 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2969, tmpcur_7225); + CursorTy pvrtmp_7229 = tmp_struct_149.field0; + unsigned char wildcard_837_1442_1767 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7229}; + break; + } + + case 17: + { + CursorTy tmpcur_7230 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7231 = tmpcur_7207 + 8; + CursorTy tmpcur_7232 = *(CursorTy *) tmpaftercur_7231; + CursorTy tmpaftercur_7233 = tmpaftercur_7231 + 8; + CursorTy jump_4170 = tmpaftercur_7231 + 8; + CursorTy jump_4169 = tmpcur_7207 + 8; + unsigned char wildcard_844_1446_1771 = print_symbol(6158); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2969, tmpaftercur_7233); + CursorTy pvrtmp_7234 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2969, tmpcur_7230); + CursorTy pvrtmp_7235 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2969, tmpcur_7232); + CursorTy pvrtmp_7236 = tmp_struct_152.field0; + unsigned char wildcard_845_1450_1775 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7236}; + break; + } + + case 19: + { + CursorTy tmpcur_7237 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7238 = tmpcur_7207 + 8; + CursorTy tmpcur_7239 = *(CursorTy *) tmpaftercur_7238; + CursorTy tmpaftercur_7240 = tmpaftercur_7238 + 8; + CursorTy jump_4176 = tmpaftercur_7238 + 8; + CursorTy jump_4175 = tmpcur_7207 + 8; + unsigned char wildcard_852_1454_1779 = print_symbol(6167); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2969, tmpaftercur_7240); + CursorTy pvrtmp_7241 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2969, tmpcur_7237); + CursorTy pvrtmp_7242 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2969, tmpcur_7239); + CursorTy pvrtmp_7243 = tmp_struct_155.field0; + unsigned char wildcard_853_1458_1783 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7243}; + break; + } + + case 21: + { + CursorTy tmpcur_7244 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7245 = tmpcur_7207 + 8; + CursorTy tmpcur_7246 = *(CursorTy *) tmpaftercur_7245; + CursorTy tmpaftercur_7247 = tmpaftercur_7245 + 8; + CursorTy jump_4182 = tmpaftercur_7245 + 8; + CursorTy jump_4181 = tmpcur_7207 + 8; + unsigned char wildcard_860_1462_1787 = print_symbol(6164); + CursorProd tmp_struct_156 = + _print_Content(end_r_2969, tmpaftercur_7247); + CursorTy pvrtmp_7248 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2969, tmpcur_7244); + CursorTy pvrtmp_7249 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2969, tmpcur_7246); + CursorTy pvrtmp_7250 = tmp_struct_158.field0; + unsigned char wildcard_861_1466_1791 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7250}; + break; + } + + case 23: + { + CursorTy tmpcur_7251 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7252 = tmpcur_7207 + 8; + CursorTy tmpcur_7253 = *(CursorTy *) tmpaftercur_7252; + CursorTy tmpaftercur_7254 = tmpaftercur_7252 + 8; + CursorTy jump_4188 = tmpaftercur_7252 + 8; + CursorTy jump_4187 = tmpcur_7207 + 8; + unsigned char wildcard_868_1470_1795 = print_symbol(6165); + CursorProd tmp_struct_159 = + _print_Content(end_r_2969, tmpaftercur_7254); + CursorTy pvrtmp_7255 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2969, tmpcur_7251); + CursorTy pvrtmp_7256 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2969, tmpcur_7253); + CursorTy pvrtmp_7257 = tmp_struct_161.field0; + unsigned char wildcard_869_1474_1799 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7257}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7258 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7259 = tmpcur_7207 + 8; + CursorTy jump_4344 = tmpcur_7207 + 8; + unsigned char wildcard_4347 = print_symbol(6171); + CursorProd tmp_struct_162 = _print_Adt(end_r_2969, tmpcur_7258); + CursorTy pvrtmp_7260 = tmp_struct_162.field0; + + return (CursorProd) {jump_4344}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7261 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7262 = tmpcur_7207 + 8; + unsigned char wildcard_4347 = print_symbol(6170); + CursorProd tmp_struct_163 = _print_Adt(end_r_2969, tmpcur_7261); + CursorTy pvrtmp_7263 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7263}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7206"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2972, + CursorTy end_r_2973, CursorTy loc_2971, + CursorTy arg_870_1475_1800) +{ + if (loc_2971 + 32 > end_r_2973) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2973); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2973 = chunk_end_169; + *(TagTyPacked *) loc_2971 = 255; + + CursorTy redir = loc_2971 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2971 = chunk_start_168; + } + + CursorTy loc_3680 = loc_2971 + 1; + CursorTy loc_3681 = loc_3680 + 8; + TagTyPacked tmpval_7265 = *(TagTyPacked *) arg_870_1475_1800; + CursorTy tmpcur_7266 = arg_870_1475_1800 + 1; + + + switch_7309: + ; + switch (tmpval_7265) { + + case 0: + { + CursorTy jump_4193 = arg_870_1475_1800 + 1; + + *(TagTyPacked *) loc_2971 = 0; + + CursorTy writetag_4989 = loc_2971 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2973, jump_4193, + loc_2971, writetag_4989}; + break; + } + + case 1: + { + IntTy tmpval_7271 = *(IntTy *) tmpcur_7266; + CursorTy tmpcur_7272 = tmpcur_7266 + sizeof(IntTy); + CursorTy jump_4195 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2972, end_r_2973, loc_3681, tmpcur_7272); + CursorTy pvrtmp_7273 = tmp_struct_164.field0; + CursorTy pvrtmp_7274 = tmp_struct_164.field1; + CursorTy pvrtmp_7275 = tmp_struct_164.field2; + CursorTy pvrtmp_7276 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2971 = 1; + + CursorTy writetag_4994 = loc_2971 + 1; + + *(IntTy *) writetag_4994 = tmpval_7271; + + CursorTy writecur_4995 = writetag_4994 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7273, pvrtmp_7274, + loc_2971, pvrtmp_7276}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7285 = *(CursorTy *) tmpcur_7266; + CursorTy tmpaftercur_7286 = tmpcur_7266 + 8; + CursorTy jump_4350 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2972, end_r_2973, loc_2971, tmpcur_7285); + CursorTy pvrtmp_7287 = tmp_struct_165.field0; + CursorTy pvrtmp_7288 = tmp_struct_165.field1; + CursorTy pvrtmp_7289 = tmp_struct_165.field2; + CursorTy pvrtmp_7290 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7287, jump_4350, + pvrtmp_7289, pvrtmp_7290}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7297 = *(CursorTy *) tmpcur_7266; + CursorTy tmpaftercur_7298 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2972, end_r_2973, loc_2971, tmpcur_7297); + CursorTy pvrtmp_7299 = tmp_struct_166.field0; + CursorTy pvrtmp_7300 = tmp_struct_166.field1; + CursorTy pvrtmp_7301 = tmp_struct_166.field2; + CursorTy pvrtmp_7302 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7299, pvrtmp_7300, + pvrtmp_7301, pvrtmp_7302}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7265"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2976, + CursorTy end_r_2977, + CursorTy loc_2975, + CursorTy arg_875_1480_1805) +{ + CursorTy loc_3693 = loc_2975 + 1; + CursorTy loc_3694 = loc_3693 + 8; + TagTyPacked tmpval_7310 = *(TagTyPacked *) arg_875_1480_1805; + CursorTy tmpcur_7311 = arg_875_1480_1805 + 1; + + + switch_7354: + ; + switch (tmpval_7310) { + + case 0: + { + CursorTy jump_4198 = arg_875_1480_1805 + 1; + + *(TagTyPacked *) loc_2975 = 0; + + CursorTy writetag_5005 = loc_2975 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2977, jump_4198, + loc_2975, writetag_5005}; + break; + } + + case 1: + { + IntTy tmpval_7316 = *(IntTy *) tmpcur_7311; + CursorTy tmpcur_7317 = tmpcur_7311 + sizeof(IntTy); + CursorTy jump_4200 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_3694, tmpcur_7317); + CursorTy pvrtmp_7318 = tmp_struct_170.field0; + CursorTy pvrtmp_7319 = tmp_struct_170.field1; + CursorTy pvrtmp_7320 = tmp_struct_170.field2; + CursorTy pvrtmp_7321 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2975 = 1; + + CursorTy writetag_5010 = loc_2975 + 1; + + *(IntTy *) writetag_5010 = tmpval_7316; + + CursorTy writecur_5011 = writetag_5010 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7318, pvrtmp_7319, + loc_2975, pvrtmp_7321}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7330 = *(CursorTy *) tmpcur_7311; + CursorTy tmpaftercur_7331 = tmpcur_7311 + 8; + CursorTy jump_4356 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_2975, tmpcur_7330); + CursorTy pvrtmp_7332 = tmp_struct_171.field0; + CursorTy pvrtmp_7333 = tmp_struct_171.field1; + CursorTy pvrtmp_7334 = tmp_struct_171.field2; + CursorTy pvrtmp_7335 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7332, jump_4356, + pvrtmp_7334, pvrtmp_7335}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7342 = *(CursorTy *) tmpcur_7311; + CursorTy tmpaftercur_7343 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_2975, tmpcur_7342); + CursorTy pvrtmp_7344 = tmp_struct_172.field0; + CursorTy pvrtmp_7345 = tmp_struct_172.field1; + CursorTy pvrtmp_7346 = tmp_struct_172.field2; + CursorTy pvrtmp_7347 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7344, pvrtmp_7345, + pvrtmp_7346, pvrtmp_7347}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7310"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2979, CursorTy arg_880_1485_1810) +{ + TagTyPacked tmpval_7355 = *(TagTyPacked *) arg_880_1485_1810; + CursorTy tmpcur_7356 = arg_880_1485_1810 + 1; + + + switch_7366: + ; + switch (tmpval_7355) { + + case 0: + { + CursorTy jump_4203 = arg_880_1485_1810 + 1; + + return (CursorProd) {jump_4203}; + break; + } + + case 1: + { + IntTy tmpval_7357 = *(IntTy *) tmpcur_7356; + CursorTy tmpcur_7358 = tmpcur_7356 + sizeof(IntTy); + CursorTy jump_4205 = tmpcur_7356 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2979, tmpcur_7358); + CursorTy pvrtmp_7359 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7359}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7360 = *(CursorTy *) tmpcur_7356; + CursorTy tmpaftercur_7361 = tmpcur_7356 + 8; + CursorTy jump_4362 = tmpcur_7356 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2979, tmpcur_7360); + CursorTy pvrtmp_7362 = tmp_struct_174.field0; + + return (CursorProd) {jump_4362}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7363 = *(CursorTy *) tmpcur_7356; + CursorTy tmpaftercur_7364 = tmpcur_7356 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2979, tmpcur_7363); + CursorTy pvrtmp_7365 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7365}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7355"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2981, CursorTy arg_885_1489_1814) +{ + TagTyPacked tmpval_7367 = *(TagTyPacked *) arg_885_1489_1814; + CursorTy tmpcur_7368 = arg_885_1489_1814 + 1; + + + switch_7378: + ; + switch (tmpval_7367) { + + case 0: + { + CursorTy jump_4208 = arg_885_1489_1814 + 1; + unsigned char wildcard_886_1490_1815 = print_symbol(6159); + unsigned char wildcard_887_1491_1816 = print_symbol(6154); + + return (CursorProd) {jump_4208}; + break; + } + + case 1: + { + IntTy tmpval_7369 = *(IntTy *) tmpcur_7368; + CursorTy tmpcur_7370 = tmpcur_7368 + sizeof(IntTy); + CursorTy jump_4210 = tmpcur_7368 + 8; + unsigned char wildcard_892_1494_1819 = print_symbol(6156); + unsigned char y_890_1495_1820 = printf("%lld", tmpval_7369); + CursorProd tmp_struct_176 = _print_Tags(end_r_2981, tmpcur_7370); + CursorTy pvrtmp_7371 = tmp_struct_176.field0; + unsigned char wildcard_893_1497_1822 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7371}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7372 = *(CursorTy *) tmpcur_7368; + CursorTy tmpaftercur_7373 = tmpcur_7368 + 8; + CursorTy jump_4368 = tmpcur_7368 + 8; + unsigned char wildcard_4371 = print_symbol(6171); + CursorProd tmp_struct_177 = _print_Tags(end_r_2981, tmpcur_7372); + CursorTy pvrtmp_7374 = tmp_struct_177.field0; + + return (CursorProd) {jump_4368}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7375 = *(CursorTy *) tmpcur_7368; + CursorTy tmpaftercur_7376 = tmpcur_7368 + 8; + unsigned char wildcard_4371 = print_symbol(6170); + CursorProd tmp_struct_178 = _print_Tags(end_r_2981, tmpcur_7375); + CursorTy pvrtmp_7377 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7377}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7367"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2984, + CursorTy end_r_2985, + CursorTy loc_2983, + CursorTy arg_2716) +{ + if (loc_2983 + 32 > end_r_2985) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2985); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2985 = chunk_end_184; + *(TagTyPacked *) loc_2983 = 255; + + CursorTy redir = loc_2983 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2983 = chunk_start_183; + } + + CursorTy loc_3718 = loc_2983 + 1; + CursorTy loc_3719 = loc_3718 + 8; + TagTyPacked tmpval_7379 = *(TagTyPacked *) arg_2716; + CursorTy tmpcur_7380 = arg_2716 + 1; + + + switch_7423: + ; + switch (tmpval_7379) { + + case 0: + { + CursorTy jump_4213 = arg_2716 + 1; + + *(TagTyPacked *) loc_2983 = 0; + + CursorTy writetag_5041 = loc_2983 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2985, jump_4213, + loc_2983, writetag_5041}; + break; + } + + case 1: + { + IntTy tmpval_7385 = *(IntTy *) tmpcur_7380; + CursorTy tmpcur_7386 = tmpcur_7380 + sizeof(IntTy); + CursorTy jump_4215 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_3719, tmpcur_7386); + CursorTy pvrtmp_7387 = tmp_struct_179.field0; + CursorTy pvrtmp_7388 = tmp_struct_179.field1; + CursorTy pvrtmp_7389 = tmp_struct_179.field2; + CursorTy pvrtmp_7390 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2983 = 1; + + CursorTy writetag_5046 = loc_2983 + 1; + + *(IntTy *) writetag_5046 = tmpval_7385; + + CursorTy writecur_5047 = writetag_5046 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7387, pvrtmp_7388, + loc_2983, pvrtmp_7390}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7399 = *(CursorTy *) tmpcur_7380; + CursorTy tmpaftercur_7400 = tmpcur_7380 + 8; + CursorTy jump_4374 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_2983, tmpcur_7399); + CursorTy pvrtmp_7401 = tmp_struct_180.field0; + CursorTy pvrtmp_7402 = tmp_struct_180.field1; + CursorTy pvrtmp_7403 = tmp_struct_180.field2; + CursorTy pvrtmp_7404 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7401, jump_4374, + pvrtmp_7403, pvrtmp_7404}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7411 = *(CursorTy *) tmpcur_7380; + CursorTy tmpaftercur_7412 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_2983, tmpcur_7411); + CursorTy pvrtmp_7413 = tmp_struct_181.field0; + CursorTy pvrtmp_7414 = tmp_struct_181.field1; + CursorTy pvrtmp_7415 = tmp_struct_181.field2; + CursorTy pvrtmp_7416 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7413, pvrtmp_7414, + pvrtmp_7415, pvrtmp_7416}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7379"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2988, + CursorTy end_r_2989, + CursorTy loc_2987, + CursorTy arg_2721) +{ + if (loc_2987 + 32 > end_r_2989) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2989); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2989 = chunk_end_191; + *(TagTyPacked *) loc_2987 = 255; + + CursorTy redir = loc_2987 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2987 = chunk_start_190; + } + + TagTyPacked tmpval_7424 = *(TagTyPacked *) arg_2721; + CursorTy tmpcur_7425 = arg_2721 + 1; + + + switch_7474: + ; + switch (tmpval_7424) { + + case 0: + { + CursorTy loc_3729 = loc_2987 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2988, end_r_2989, loc_3729, tmpcur_7425); + CursorTy pvrtmp_7426 = tmp_struct_185.field0; + CursorTy pvrtmp_7427 = tmp_struct_185.field1; + CursorTy pvrtmp_7428 = tmp_struct_185.field2; + CursorTy pvrtmp_7429 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2987 = 0; + + CursorTy writetag_5058 = loc_2987 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7426, pvrtmp_7427, + loc_2987, pvrtmp_7429}; + break; + } + + case 1: + { + CursorTy loc_3735 = loc_2987 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2988, end_r_2989, loc_3735, tmpcur_7425); + CursorTy pvrtmp_7438 = tmp_struct_186.field0; + CursorTy pvrtmp_7439 = tmp_struct_186.field1; + CursorTy pvrtmp_7440 = tmp_struct_186.field2; + CursorTy pvrtmp_7441 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2987 = 1; + + CursorTy writetag_5063 = loc_2987 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7438, pvrtmp_7439, + loc_2987, pvrtmp_7441}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7450 = *(CursorTy *) tmpcur_7425; + CursorTy tmpaftercur_7451 = tmpcur_7425 + 8; + CursorTy jump_4380 = tmpcur_7425 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2988, end_r_2989, loc_2987, tmpcur_7450); + CursorTy pvrtmp_7452 = tmp_struct_187.field0; + CursorTy pvrtmp_7453 = tmp_struct_187.field1; + CursorTy pvrtmp_7454 = tmp_struct_187.field2; + CursorTy pvrtmp_7455 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7452, jump_4380, + pvrtmp_7454, pvrtmp_7455}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7462 = *(CursorTy *) tmpcur_7425; + CursorTy tmpaftercur_7463 = tmpcur_7425 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2988, end_r_2989, loc_2987, tmpcur_7462); + CursorTy pvrtmp_7464 = tmp_struct_188.field0; + CursorTy pvrtmp_7465 = tmp_struct_188.field1; + CursorTy pvrtmp_7466 = tmp_struct_188.field2; + CursorTy pvrtmp_7467 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7464, pvrtmp_7465, + pvrtmp_7466, pvrtmp_7467}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7424"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2992, + CursorTy end_r_2993, + CursorTy loc_2991, + CursorTy arg_2726) +{ + if (loc_2991 + 32 > end_r_2993) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2993); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2993 = chunk_end_218; + *(TagTyPacked *) loc_2991 = 255; + + CursorTy redir = loc_2991 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2991 = chunk_start_217; + } + + CursorTy loc_3748 = loc_2991 + 1; + CursorTy loc_3749 = loc_3748 + 8; + CursorTy loc_3750 = loc_3749 + 8; + CursorTy loc_3766 = loc_2991 + 1; + CursorTy loc_3767 = loc_3766 + 8; + CursorTy loc_3768 = loc_3767 + 8; + CursorTy loc_3788 = loc_2991 + 1; + CursorTy loc_3789 = loc_3788 + 8; + CursorTy loc_3790 = loc_3789 + 8; + CursorTy loc_3791 = loc_3790 + 8; + CursorTy loc_3815 = loc_2991 + 1; + CursorTy loc_3816 = loc_3815 + 8; + CursorTy loc_3817 = loc_3816 + 8; + CursorTy loc_3818 = loc_3817 + 8; + CursorTy loc_3842 = loc_2991 + 1; + CursorTy loc_3843 = loc_3842 + 8; + CursorTy loc_3844 = loc_3843 + 8; + CursorTy loc_3845 = loc_3844 + 8; + CursorTy loc_3869 = loc_2991 + 1; + CursorTy loc_3870 = loc_3869 + 8; + CursorTy loc_3871 = loc_3870 + 8; + CursorTy loc_3872 = loc_3871 + 8; + CursorTy loc_3896 = loc_2991 + 1; + CursorTy loc_3897 = loc_3896 + 8; + CursorTy loc_3898 = loc_3897 + 8; + CursorTy loc_3899 = loc_3898 + 8; + CursorTy loc_3923 = loc_2991 + 1; + CursorTy loc_3924 = loc_3923 + 8; + CursorTy loc_3925 = loc_3924 + 8; + CursorTy loc_3926 = loc_3925 + 8; + TagTyPacked tmpval_7475 = *(TagTyPacked *) arg_2726; + CursorTy tmpcur_7476 = arg_2726 + 1; + + + switch_7713: + ; + switch (tmpval_7475) { + + case 0: + { + CursorTy jump_4222 = arg_2726 + 1; + + *(TagTyPacked *) loc_2991 = 0; + + CursorTy writetag_5073 = loc_2991 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2993, jump_4222, + loc_2991, writetag_5073}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3750, tmpcur_7476); + CursorTy pvrtmp_7481 = tmp_struct_192.field0; + CursorTy pvrtmp_7482 = tmp_struct_192.field1; + CursorTy pvrtmp_7483 = tmp_struct_192.field2; + CursorTy pvrtmp_7484 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7481, pvrtmp_7484, pvrtmp_7482); + CursorTy pvrtmp_7489 = tmp_struct_193.field0; + CursorTy pvrtmp_7490 = tmp_struct_193.field1; + CursorTy pvrtmp_7491 = tmp_struct_193.field2; + CursorTy pvrtmp_7492 = tmp_struct_193.field3; + IntTy sizeof_y_2729__2731 = pvrtmp_7484 - pvrtmp_7483; + IntTy sizeof_y_2730__2732 = pvrtmp_7492 - pvrtmp_7491; + IntTy fltPrm_2820 = sizeof_y_2729__2731 + 0; + IntTy offset__2733 = 0 + fltPrm_2820; + IntTy fltPrm_2821 = sizeof_y_2729__2731 + sizeof_y_2730__2732; + IntTy size_dcon_2734 = 9 + fltPrm_2821; + + *(TagTyPacked *) loc_2991 = 160; + + CursorTy writetag_5078 = loc_2991 + 1; + + *(IntTy *) writetag_5078 = size_dcon_2734; + + CursorTy writecur_5079 = writetag_5078 + sizeof(IntTy); + + *(IntTy *) writecur_5079 = offset__2733; + + CursorTy writecur_5080 = writecur_5079 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7489, pvrtmp_7490, + loc_2991, pvrtmp_7492}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3768, tmpcur_7476); + CursorTy pvrtmp_7501 = tmp_struct_194.field0; + CursorTy pvrtmp_7502 = tmp_struct_194.field1; + CursorTy pvrtmp_7503 = tmp_struct_194.field2; + CursorTy pvrtmp_7504 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7501, pvrtmp_7504, pvrtmp_7502); + CursorTy pvrtmp_7509 = tmp_struct_195.field0; + CursorTy pvrtmp_7510 = tmp_struct_195.field1; + CursorTy pvrtmp_7511 = tmp_struct_195.field2; + CursorTy pvrtmp_7512 = tmp_struct_195.field3; + IntTy sizeof_y_2737__2739 = pvrtmp_7504 - pvrtmp_7503; + IntTy sizeof_y_2738__2740 = pvrtmp_7512 - pvrtmp_7511; + IntTy fltPrm_2822 = sizeof_y_2737__2739 + 0; + IntTy offset__2741 = 0 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2737__2739 + sizeof_y_2738__2740; + IntTy size_dcon_2742 = 9 + fltPrm_2823; + + *(TagTyPacked *) loc_2991 = 162; + + CursorTy writetag_5087 = loc_2991 + 1; + + *(IntTy *) writetag_5087 = size_dcon_2742; + + CursorTy writecur_5088 = writetag_5087 + sizeof(IntTy); + + *(IntTy *) writecur_5088 = offset__2741; + + CursorTy writecur_5089 = writecur_5088 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7509, pvrtmp_7510, + loc_2991, pvrtmp_7512}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2992, end_r_2993, loc_3791, tmpcur_7476); + CursorTy pvrtmp_7521 = tmp_struct_196.field0; + CursorTy pvrtmp_7522 = tmp_struct_196.field1; + CursorTy pvrtmp_7523 = tmp_struct_196.field2; + CursorTy pvrtmp_7524 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7521, pvrtmp_7524, pvrtmp_7522); + CursorTy pvrtmp_7529 = tmp_struct_197.field0; + CursorTy pvrtmp_7530 = tmp_struct_197.field1; + CursorTy pvrtmp_7531 = tmp_struct_197.field2; + CursorTy pvrtmp_7532 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7529, pvrtmp_7532, pvrtmp_7530); + CursorTy pvrtmp_7537 = tmp_struct_198.field0; + CursorTy pvrtmp_7538 = tmp_struct_198.field1; + CursorTy pvrtmp_7539 = tmp_struct_198.field2; + CursorTy pvrtmp_7540 = tmp_struct_198.field3; + IntTy sizeof_y_2746__2749 = pvrtmp_7524 - pvrtmp_7523; + IntTy sizeof_y_2747__2750 = pvrtmp_7532 - pvrtmp_7531; + IntTy sizeof_y_2748__2751 = pvrtmp_7540 - pvrtmp_7539; + IntTy fltPrm_2824 = sizeof_y_2746__2749 + 0; + IntTy offset__2752 = 8 + fltPrm_2824; + IntTy fltPrm_2825 = sizeof_y_2746__2749 + sizeof_y_2747__2750; + IntTy offset__2753 = 0 + fltPrm_2825; + IntTy fltPrm_2827 = sizeof_y_2747__2750 + sizeof_y_2748__2751; + IntTy fltPrm_2826 = sizeof_y_2746__2749 + fltPrm_2827; + IntTy size_dcon_2754 = 17 + fltPrm_2826; + + *(TagTyPacked *) loc_2991 = 164; + + CursorTy writetag_5097 = loc_2991 + 1; + + *(IntTy *) writetag_5097 = size_dcon_2754; + + CursorTy writecur_5098 = writetag_5097 + sizeof(IntTy); + + *(IntTy *) writecur_5098 = offset__2752; + + CursorTy writecur_5099 = writecur_5098 + sizeof(IntTy); + + *(IntTy *) writecur_5099 = offset__2753; + + CursorTy writecur_5100 = writecur_5099 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7537, pvrtmp_7538, + loc_2991, pvrtmp_7540}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3818, tmpcur_7476); + CursorTy pvrtmp_7549 = tmp_struct_199.field0; + CursorTy pvrtmp_7550 = tmp_struct_199.field1; + CursorTy pvrtmp_7551 = tmp_struct_199.field2; + CursorTy pvrtmp_7552 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7549, pvrtmp_7552, pvrtmp_7550); + CursorTy pvrtmp_7557 = tmp_struct_200.field0; + CursorTy pvrtmp_7558 = tmp_struct_200.field1; + CursorTy pvrtmp_7559 = tmp_struct_200.field2; + CursorTy pvrtmp_7560 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7557, pvrtmp_7560, pvrtmp_7558); + CursorTy pvrtmp_7565 = tmp_struct_201.field0; + CursorTy pvrtmp_7566 = tmp_struct_201.field1; + CursorTy pvrtmp_7567 = tmp_struct_201.field2; + CursorTy pvrtmp_7568 = tmp_struct_201.field3; + IntTy sizeof_y_2758__2761 = pvrtmp_7552 - pvrtmp_7551; + IntTy sizeof_y_2759__2762 = pvrtmp_7560 - pvrtmp_7559; + IntTy sizeof_y_2760__2763 = pvrtmp_7568 - pvrtmp_7567; + IntTy fltPrm_2828 = sizeof_y_2758__2761 + 0; + IntTy offset__2764 = 8 + fltPrm_2828; + IntTy fltPrm_2829 = sizeof_y_2758__2761 + sizeof_y_2759__2762; + IntTy offset__2765 = 0 + fltPrm_2829; + IntTy fltPrm_2831 = sizeof_y_2759__2762 + sizeof_y_2760__2763; + IntTy fltPrm_2830 = sizeof_y_2758__2761 + fltPrm_2831; + IntTy size_dcon_2766 = 17 + fltPrm_2830; + + *(TagTyPacked *) loc_2991 = 166; + + CursorTy writetag_5109 = loc_2991 + 1; + + *(IntTy *) writetag_5109 = size_dcon_2766; + + CursorTy writecur_5110 = writetag_5109 + sizeof(IntTy); + + *(IntTy *) writecur_5110 = offset__2764; + + CursorTy writecur_5111 = writecur_5110 + sizeof(IntTy); + + *(IntTy *) writecur_5111 = offset__2765; + + CursorTy writecur_5112 = writecur_5111 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7565, pvrtmp_7566, + loc_2991, pvrtmp_7568}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2992, end_r_2993, loc_3845, tmpcur_7476); + CursorTy pvrtmp_7577 = tmp_struct_202.field0; + CursorTy pvrtmp_7578 = tmp_struct_202.field1; + CursorTy pvrtmp_7579 = tmp_struct_202.field2; + CursorTy pvrtmp_7580 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7577, pvrtmp_7580, pvrtmp_7578); + CursorTy pvrtmp_7585 = tmp_struct_203.field0; + CursorTy pvrtmp_7586 = tmp_struct_203.field1; + CursorTy pvrtmp_7587 = tmp_struct_203.field2; + CursorTy pvrtmp_7588 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7585, pvrtmp_7588, pvrtmp_7586); + CursorTy pvrtmp_7593 = tmp_struct_204.field0; + CursorTy pvrtmp_7594 = tmp_struct_204.field1; + CursorTy pvrtmp_7595 = tmp_struct_204.field2; + CursorTy pvrtmp_7596 = tmp_struct_204.field3; + IntTy sizeof_y_2770__2773 = pvrtmp_7580 - pvrtmp_7579; + IntTy sizeof_y_2771__2774 = pvrtmp_7588 - pvrtmp_7587; + IntTy sizeof_y_2772__2775 = pvrtmp_7596 - pvrtmp_7595; + IntTy fltPrm_2832 = sizeof_y_2770__2773 + 0; + IntTy offset__2776 = 8 + fltPrm_2832; + IntTy fltPrm_2833 = sizeof_y_2770__2773 + sizeof_y_2771__2774; + IntTy offset__2777 = 0 + fltPrm_2833; + IntTy fltPrm_2835 = sizeof_y_2771__2774 + sizeof_y_2772__2775; + IntTy fltPrm_2834 = sizeof_y_2770__2773 + fltPrm_2835; + IntTy size_dcon_2778 = 17 + fltPrm_2834; + + *(TagTyPacked *) loc_2991 = 168; + + CursorTy writetag_5121 = loc_2991 + 1; + + *(IntTy *) writetag_5121 = size_dcon_2778; + + CursorTy writecur_5122 = writetag_5121 + sizeof(IntTy); + + *(IntTy *) writecur_5122 = offset__2776; + + CursorTy writecur_5123 = writecur_5122 + sizeof(IntTy); + + *(IntTy *) writecur_5123 = offset__2777; + + CursorTy writecur_5124 = writecur_5123 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7593, pvrtmp_7594, + loc_2991, pvrtmp_7596}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3872, tmpcur_7476); + CursorTy pvrtmp_7605 = tmp_struct_205.field0; + CursorTy pvrtmp_7606 = tmp_struct_205.field1; + CursorTy pvrtmp_7607 = tmp_struct_205.field2; + CursorTy pvrtmp_7608 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7605, pvrtmp_7608, pvrtmp_7606); + CursorTy pvrtmp_7613 = tmp_struct_206.field0; + CursorTy pvrtmp_7614 = tmp_struct_206.field1; + CursorTy pvrtmp_7615 = tmp_struct_206.field2; + CursorTy pvrtmp_7616 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7613, pvrtmp_7616, pvrtmp_7614); + CursorTy pvrtmp_7621 = tmp_struct_207.field0; + CursorTy pvrtmp_7622 = tmp_struct_207.field1; + CursorTy pvrtmp_7623 = tmp_struct_207.field2; + CursorTy pvrtmp_7624 = tmp_struct_207.field3; + IntTy sizeof_y_2782__2785 = pvrtmp_7608 - pvrtmp_7607; + IntTy sizeof_y_2783__2786 = pvrtmp_7616 - pvrtmp_7615; + IntTy sizeof_y_2784__2787 = pvrtmp_7624 - pvrtmp_7623; + IntTy fltPrm_2836 = sizeof_y_2782__2785 + 0; + IntTy offset__2788 = 8 + fltPrm_2836; + IntTy fltPrm_2837 = sizeof_y_2782__2785 + sizeof_y_2783__2786; + IntTy offset__2789 = 0 + fltPrm_2837; + IntTy fltPrm_2839 = sizeof_y_2783__2786 + sizeof_y_2784__2787; + IntTy fltPrm_2838 = sizeof_y_2782__2785 + fltPrm_2839; + IntTy size_dcon_2790 = 17 + fltPrm_2838; + + *(TagTyPacked *) loc_2991 = 170; + + CursorTy writetag_5133 = loc_2991 + 1; + + *(IntTy *) writetag_5133 = size_dcon_2790; + + CursorTy writecur_5134 = writetag_5133 + sizeof(IntTy); + + *(IntTy *) writecur_5134 = offset__2788; + + CursorTy writecur_5135 = writecur_5134 + sizeof(IntTy); + + *(IntTy *) writecur_5135 = offset__2789; + + CursorTy writecur_5136 = writecur_5135 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7621, pvrtmp_7622, + loc_2991, pvrtmp_7624}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3899, tmpcur_7476); + CursorTy pvrtmp_7633 = tmp_struct_208.field0; + CursorTy pvrtmp_7634 = tmp_struct_208.field1; + CursorTy pvrtmp_7635 = tmp_struct_208.field2; + CursorTy pvrtmp_7636 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7633, pvrtmp_7636, pvrtmp_7634); + CursorTy pvrtmp_7641 = tmp_struct_209.field0; + CursorTy pvrtmp_7642 = tmp_struct_209.field1; + CursorTy pvrtmp_7643 = tmp_struct_209.field2; + CursorTy pvrtmp_7644 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7641, pvrtmp_7644, pvrtmp_7642); + CursorTy pvrtmp_7649 = tmp_struct_210.field0; + CursorTy pvrtmp_7650 = tmp_struct_210.field1; + CursorTy pvrtmp_7651 = tmp_struct_210.field2; + CursorTy pvrtmp_7652 = tmp_struct_210.field3; + IntTy sizeof_y_2794__2797 = pvrtmp_7636 - pvrtmp_7635; + IntTy sizeof_y_2795__2798 = pvrtmp_7644 - pvrtmp_7643; + IntTy sizeof_y_2796__2799 = pvrtmp_7652 - pvrtmp_7651; + IntTy fltPrm_2840 = sizeof_y_2794__2797 + 0; + IntTy offset__2800 = 8 + fltPrm_2840; + IntTy fltPrm_2841 = sizeof_y_2794__2797 + sizeof_y_2795__2798; + IntTy offset__2801 = 0 + fltPrm_2841; + IntTy fltPrm_2843 = sizeof_y_2795__2798 + sizeof_y_2796__2799; + IntTy fltPrm_2842 = sizeof_y_2794__2797 + fltPrm_2843; + IntTy size_dcon_2802 = 17 + fltPrm_2842; + + *(TagTyPacked *) loc_2991 = 172; + + CursorTy writetag_5145 = loc_2991 + 1; + + *(IntTy *) writetag_5145 = size_dcon_2802; + + CursorTy writecur_5146 = writetag_5145 + sizeof(IntTy); + + *(IntTy *) writecur_5146 = offset__2800; + + CursorTy writecur_5147 = writecur_5146 + sizeof(IntTy); + + *(IntTy *) writecur_5147 = offset__2801; + + CursorTy writecur_5148 = writecur_5147 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7649, pvrtmp_7650, + loc_2991, pvrtmp_7652}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3926, tmpcur_7476); + CursorTy pvrtmp_7661 = tmp_struct_211.field0; + CursorTy pvrtmp_7662 = tmp_struct_211.field1; + CursorTy pvrtmp_7663 = tmp_struct_211.field2; + CursorTy pvrtmp_7664 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7661, pvrtmp_7664, pvrtmp_7662); + CursorTy pvrtmp_7669 = tmp_struct_212.field0; + CursorTy pvrtmp_7670 = tmp_struct_212.field1; + CursorTy pvrtmp_7671 = tmp_struct_212.field2; + CursorTy pvrtmp_7672 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7669, pvrtmp_7672, pvrtmp_7670); + CursorTy pvrtmp_7677 = tmp_struct_213.field0; + CursorTy pvrtmp_7678 = tmp_struct_213.field1; + CursorTy pvrtmp_7679 = tmp_struct_213.field2; + CursorTy pvrtmp_7680 = tmp_struct_213.field3; + IntTy sizeof_y_2806__2809 = pvrtmp_7664 - pvrtmp_7663; + IntTy sizeof_y_2807__2810 = pvrtmp_7672 - pvrtmp_7671; + IntTy sizeof_y_2808__2811 = pvrtmp_7680 - pvrtmp_7679; + IntTy fltPrm_2844 = sizeof_y_2806__2809 + 0; + IntTy offset__2812 = 8 + fltPrm_2844; + IntTy fltPrm_2845 = sizeof_y_2806__2809 + sizeof_y_2807__2810; + IntTy offset__2813 = 0 + fltPrm_2845; + IntTy fltPrm_2847 = sizeof_y_2807__2810 + sizeof_y_2808__2811; + IntTy fltPrm_2846 = sizeof_y_2806__2809 + fltPrm_2847; + IntTy size_dcon_2814 = 17 + fltPrm_2846; + + *(TagTyPacked *) loc_2991 = 174; + + CursorTy writetag_5157 = loc_2991 + 1; + + *(IntTy *) writetag_5157 = size_dcon_2814; + + CursorTy writecur_5158 = writetag_5157 + sizeof(IntTy); + + *(IntTy *) writecur_5158 = offset__2812; + + CursorTy writecur_5159 = writecur_5158 + sizeof(IntTy); + + *(IntTy *) writecur_5159 = offset__2813; + + CursorTy writecur_5160 = writecur_5159 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7677, pvrtmp_7678, + loc_2991, pvrtmp_7680}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7689 = *(CursorTy *) tmpcur_7476; + CursorTy tmpaftercur_7690 = tmpcur_7476 + 8; + CursorTy jump_4386 = tmpcur_7476 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_2991, tmpcur_7689); + CursorTy pvrtmp_7691 = tmp_struct_214.field0; + CursorTy pvrtmp_7692 = tmp_struct_214.field1; + CursorTy pvrtmp_7693 = tmp_struct_214.field2; + CursorTy pvrtmp_7694 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7691, jump_4386, + pvrtmp_7693, pvrtmp_7694}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7701 = *(CursorTy *) tmpcur_7476; + CursorTy tmpaftercur_7702 = tmpcur_7476 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_2991, tmpcur_7701); + CursorTy pvrtmp_7703 = tmp_struct_215.field0; + CursorTy pvrtmp_7704 = tmp_struct_215.field1; + CursorTy pvrtmp_7705 = tmp_struct_215.field2; + CursorTy pvrtmp_7706 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7703, pvrtmp_7704, + pvrtmp_7705, pvrtmp_7706}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7475"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2996, + CursorTy end_r_2997, + CursorTy loc_2995, + CursorTy arg_2815) +{ + if (loc_2995 + 32 > end_r_2997) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2997); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2997 = chunk_end_224; + *(TagTyPacked *) loc_2995 = 255; + + CursorTy redir = loc_2995 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2995 = chunk_start_223; + } + + CursorTy loc_3946 = loc_2995 + 1; + CursorTy loc_3947 = loc_3946 + 8; + TagTyPacked tmpval_7714 = *(TagTyPacked *) arg_2815; + CursorTy tmpcur_7715 = arg_2815 + 1; + + + switch_7758: + ; + switch (tmpval_7714) { + + case 0: + { + CursorTy jump_4254 = arg_2815 + 1; + + *(TagTyPacked *) loc_2995 = 0; + + CursorTy writetag_5172 = loc_2995 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2997, jump_4254, + loc_2995, writetag_5172}; + break; + } + + case 1: + { + IntTy tmpval_7720 = *(IntTy *) tmpcur_7715; + CursorTy tmpcur_7721 = tmpcur_7715 + sizeof(IntTy); + CursorTy jump_4256 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_3947, tmpcur_7721); + CursorTy pvrtmp_7722 = tmp_struct_219.field0; + CursorTy pvrtmp_7723 = tmp_struct_219.field1; + CursorTy pvrtmp_7724 = tmp_struct_219.field2; + CursorTy pvrtmp_7725 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2995 = 1; + + CursorTy writetag_5177 = loc_2995 + 1; + + *(IntTy *) writetag_5177 = tmpval_7720; + + CursorTy writecur_5178 = writetag_5177 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7722, pvrtmp_7723, + loc_2995, pvrtmp_7725}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7734 = *(CursorTy *) tmpcur_7715; + CursorTy tmpaftercur_7735 = tmpcur_7715 + 8; + CursorTy jump_4392 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_2995, tmpcur_7734); + CursorTy pvrtmp_7736 = tmp_struct_220.field0; + CursorTy pvrtmp_7737 = tmp_struct_220.field1; + CursorTy pvrtmp_7738 = tmp_struct_220.field2; + CursorTy pvrtmp_7739 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7736, jump_4392, + pvrtmp_7738, pvrtmp_7739}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7746 = *(CursorTy *) tmpcur_7715; + CursorTy tmpaftercur_7747 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_2995, tmpcur_7746); + CursorTy pvrtmp_7748 = tmp_struct_221.field0; + CursorTy pvrtmp_7749 = tmp_struct_221.field1; + CursorTy pvrtmp_7750 = tmp_struct_221.field2; + CursorTy pvrtmp_7751 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7748, pvrtmp_7749, + pvrtmp_7750, pvrtmp_7751}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7714"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6154, ")"); + add_symbol(6155, "(Text "); + add_symbol(6156, "(Tag "); + add_symbol(6157, "(TCA "); + add_symbol(6158, "(TAC "); + add_symbol(6159, "(Nul "); + add_symbol(6160, "(Nil "); + add_symbol(6161, "(Image "); + add_symbol(6162, "(End "); + add_symbol(6163, "(Char "); + add_symbol(6164, "(CTA "); + add_symbol(6165, "(CAT "); + add_symbol(6166, "(CA "); + add_symbol(6167, "(ATC "); + add_symbol(6168, "(ACT "); + add_symbol(6169, "(AC "); + add_symbol(6170, " ->r "); + add_symbol(6171, " ->i "); + + RegionTy *region_6172 = alloc_region(global_init_inf_buf_size); + CursorTy r_3007 = region_6172->reg_heap; + IntTy sizeof_end_r_3007_6173 = global_init_inf_buf_size; + CursorTy end_r_3007 = r_3007 + sizeof_end_r_3007_6173; + RegionTy *region_6174 = alloc_region(global_init_inf_buf_size); + CursorTy r_3006 = region_6174->reg_heap; + IntTy sizeof_end_r_3006_6175 = global_init_inf_buf_size; + CursorTy end_r_3006 = r_3006 + sizeof_end_r_3006_6175; + CursorCursorCursorProd tmp_struct_225 = + mkACTList(end_r_3007, r_3007, 100000, 10, 2000); + CursorTy pvrtmp_6176 = tmp_struct_225.field0; + CursorTy pvrtmp_6177 = tmp_struct_225.field1; + CursorTy pvrtmp_6178 = tmp_struct_225.field2; + CursorTy pvrtmp_6192; + CursorTy pvrtmp_6193; + CursorTy pvrtmp_6194; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6192; + struct timespec end_pvrtmp_6192; + + start_counters(); + for (long long iters_pvrtmp_6192 = 0; iters_pvrtmp_6192 < + global_iters_param; iters_pvrtmp_6192++) { + if (iters_pvrtmp_6192 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6192); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6176, end_r_3006, r_3006, pvrtmp_6177); + CursorTy pvrtmp_6183 = tmp_struct_226.field0; + CursorTy pvrtmp_6184 = tmp_struct_226.field1; + CursorTy pvrtmp_6185 = tmp_struct_226.field2; + + pvrtmp_6192 = pvrtmp_6183; + pvrtmp_6193 = pvrtmp_6184; + pvrtmp_6194 = pvrtmp_6185; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6192); + if (iters_pvrtmp_6192 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6192, + &end_pvrtmp_6192); + + vector_inplace_update(times_230, iters_pvrtmp_6192, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAct2.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAct2.c new file mode 100644 index 000000000..ea3e62d5b --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAct2.c @@ -0,0 +1,5070 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2920, CursorTy end_r_2921, + CursorTy loc_2919, + CursorTy adt_16_902_1520); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2924, CursorTy end_r_2925, + CursorTy loc_2923, + CursorTy tags_22_908_1528, + IntTy inVal_23_909_1529); +CursorCursorCursorProd mkACTList(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_26_912_1534, + IntTy tagLen_27_913_1535, + IntTy strLen_28_914_1536); +CursorCursorCursorProd mkString(CursorTy end_r_2929, CursorTy loc_2928, + IntTy len_181_1067_1542); +CursorCursorCursorProd mkContentText(CursorTy end_r_2931, CursorTy loc_2930, + IntTy n_195_1081_1548); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2933, CursorTy loc_2932, + IntTy len_320_1206_1550); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2936, + CursorTy end_r_2937, + CursorTy loc_2935, + CursorTy arg_624_1230_1555); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2940, + CursorTy end_r_2941, + CursorTy loc_2939, + CursorTy arg_629_1235_1560); +CursorProd _traverse_String(CursorTy end_r_2943, CursorTy arg_634_1240_1565); +CursorProd _print_String(CursorTy end_r_2945, CursorTy arg_639_1244_1569); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2948, + CursorTy end_r_2949, + CursorTy loc_2947, + CursorTy arg_648_1253_1578); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2952, + CursorTy end_r_2953, + CursorTy loc_2951, + CursorTy arg_653_1258_1583); +CursorProd _traverse_Content(CursorTy end_r_2955, CursorTy arg_658_1263_1588); +CursorProd _print_Content(CursorTy end_r_2957, CursorTy arg_663_1268_1593); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2960, CursorTy end_r_2961, + CursorTy loc_2959, + CursorTy arg_672_1277_1602); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2964, + CursorTy end_r_2965, + CursorTy loc_2963, + CursorTy arg_717_1322_1647); +CursorProd _traverse_Adt(CursorTy end_r_2967, CursorTy arg_762_1367_1692); +CursorProd _print_Adt(CursorTy end_r_2969, CursorTy arg_807_1412_1737); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2972, + CursorTy end_r_2973, CursorTy loc_2971, + CursorTy arg_870_1475_1800); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2976, + CursorTy end_r_2977, + CursorTy loc_2975, + CursorTy arg_875_1480_1805); +CursorProd _traverse_Tags(CursorTy end_r_2979, CursorTy arg_880_1485_1810); +CursorProd _print_Tags(CursorTy end_r_2981, CursorTy arg_885_1489_1814); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2984, CursorTy end_r_2985, + CursorTy loc_2983, CursorTy arg_2716); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2988, CursorTy end_r_2989, + CursorTy loc_2987, CursorTy arg_2721); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2992, + CursorTy end_r_2993, + CursorTy loc_2991, + CursorTy arg_2726); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2996, + CursorTy end_r_2997, + CursorTy loc_2995, + CursorTy arg_2815); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2920, CursorTy end_r_2921, + CursorTy loc_2919, + CursorTy adt_16_902_1520) +{ + if (loc_2919 + 32 > end_r_2921) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2921); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2921 = chunk_end_6; + *(TagTyPacked *) loc_2919 = 255; + + CursorTy redir = loc_2919 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2919 = chunk_start_5; + } + + CursorTy loc_3029 = loc_2919 + 1; + CursorTy loc_3030 = loc_3029 + 8; + CursorTy loc_3031 = loc_3030 + 8; + TagTyPacked tmpval_6202 = *(TagTyPacked *) adt_16_902_1520; + CursorTy tmpcur_6203 = adt_16_902_1520 + 1; + + + switch_6259: + ; + switch (tmpval_6202) { + + case 0: + { + CursorTy jump_3955 = adt_16_902_1520 + 1; + + *(TagTyPacked *) loc_2919 = 0; + + CursorTy writetag_4514 = loc_2919 + 1; + + return (CursorCursorCursorProd) {end_r_2921, loc_2919, + writetag_4514}; + break; + } + + case 15: + { + RegionTy *region_6208 = alloc_region(global_init_inf_buf_size); + CursorTy r_3041 = region_6208->reg_heap; + IntTy sizeof_end_r_3041_6209 = global_init_inf_buf_size; + CursorTy end_r_3041 = r_3041 + sizeof_end_r_3041_6209; + CursorTy tmpcur_6210 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6211 = tmpcur_6203 + 8; + CursorTy tmpcur_6212 = *(CursorTy *) tmpaftercur_6211; + CursorTy tmpaftercur_6213 = tmpaftercur_6211 + 8; + CursorTy jump_3958 = tmpaftercur_6211 + 8; + CursorTy jump_3957 = tmpcur_6203 + 8; + CursorCursorCursorProd tmp_struct_0 = + addValTagsAdt(end_r_2920, end_r_2921, loc_3031, tmpaftercur_6213); + CursorTy pvrtmp_6214 = tmp_struct_0.field0; + CursorTy pvrtmp_6215 = tmp_struct_0.field1; + CursorTy pvrtmp_6216 = tmp_struct_0.field2; + CursorCursorCursorCursorProd tmp_struct_1 = + addValTag(end_r_2920, end_r_3041, r_3041, tmpcur_6212, 10); + CursorTy pvrtmp_6221 = tmp_struct_1.field0; + CursorTy pvrtmp_6222 = tmp_struct_1.field1; + CursorTy pvrtmp_6223 = tmp_struct_1.field2; + CursorTy pvrtmp_6224 = tmp_struct_1.field3; + + *(TagTyPacked *) pvrtmp_6216 = 254; + + CursorTy writetag_4521 = pvrtmp_6216 + 1; + + *(CursorTy *) writetag_4521 = tmpcur_6210; + + CursorTy writecur_4522 = writetag_4521 + 8; + + *(TagTyPacked *) writecur_4522 = 254; + + CursorTy writetag_4524 = writecur_4522 + 1; + + *(CursorTy *) writetag_4524 = r_3041; + + CursorTy writecur_4525 = writetag_4524 + 8; + + *(TagTyPacked *) loc_2919 = 15; + + CursorTy writetag_4527 = loc_2919 + 1; + + *(CursorTy *) writetag_4527 = pvrtmp_6216; + + CursorTy writecur_4528 = writetag_4527 + 8; + + *(CursorTy *) writecur_4528 = writecur_4522; + + CursorTy writecur_4529 = writecur_4528 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6214, loc_2919, + writecur_4525}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6237 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6238 = tmpcur_6203 + 8; + CursorTy jump_4267 = tmpcur_6203 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2920, end_r_2921, loc_2919, tmpcur_6237); + CursorTy pvrtmp_6239 = tmp_struct_2.field0; + CursorTy pvrtmp_6240 = tmp_struct_2.field1; + CursorTy pvrtmp_6241 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6239, pvrtmp_6240, + pvrtmp_6241}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6248 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6249 = tmpcur_6203 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2920, end_r_2921, loc_2919, tmpcur_6248); + CursorTy pvrtmp_6250 = tmp_struct_3.field0; + CursorTy pvrtmp_6251 = tmp_struct_3.field1; + CursorTy pvrtmp_6252 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6250, pvrtmp_6251, + pvrtmp_6252}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6202"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2924, CursorTy end_r_2925, + CursorTy loc_2923, + CursorTy tags_22_908_1528, + IntTy inVal_23_909_1529) +{ + if (loc_2923 + 32 > end_r_2925) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2925); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2925 = chunk_end_12; + *(TagTyPacked *) loc_2923 = 255; + + CursorTy redir = loc_2923 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2923 = chunk_start_11; + } + + CursorTy loc_3050 = loc_2923 + 1; + CursorTy loc_3051 = loc_3050 + 8; + TagTyPacked tmpval_6260 = *(TagTyPacked *) tags_22_908_1528; + CursorTy tmpcur_6261 = tags_22_908_1528 + 1; + + + switch_6304: + ; + switch (tmpval_6260) { + + case 0: + { + CursorTy jump_3961 = tags_22_908_1528 + 1; + + *(TagTyPacked *) loc_2923 = 0; + + CursorTy writetag_4541 = loc_2923 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2925, jump_3961, + loc_2923, writetag_4541}; + break; + } + + case 1: + { + IntTy tmpval_6266 = *(IntTy *) tmpcur_6261; + CursorTy tmpcur_6267 = tmpcur_6261 + sizeof(IntTy); + CursorTy jump_3963 = tmpcur_6261 + 8; + IntTy fltPkd_1508_1532 = tmpval_6266 + inVal_23_909_1529; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2924, end_r_2925, loc_3051, tmpcur_6267, inVal_23_909_1529); + CursorTy pvrtmp_6268 = tmp_struct_7.field0; + CursorTy pvrtmp_6269 = tmp_struct_7.field1; + CursorTy pvrtmp_6270 = tmp_struct_7.field2; + CursorTy pvrtmp_6271 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2923 = 1; + + CursorTy writetag_4546 = loc_2923 + 1; + + *(IntTy *) writetag_4546 = fltPkd_1508_1532; + + CursorTy writecur_4547 = writetag_4546 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6268, pvrtmp_6269, + loc_2923, pvrtmp_6271}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6280 = *(CursorTy *) tmpcur_6261; + CursorTy tmpaftercur_6281 = tmpcur_6261 + 8; + CursorTy jump_4272 = tmpcur_6261 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2924, end_r_2925, loc_2923, tmpcur_6280, inVal_23_909_1529); + CursorTy pvrtmp_6282 = tmp_struct_8.field0; + CursorTy pvrtmp_6283 = tmp_struct_8.field1; + CursorTy pvrtmp_6284 = tmp_struct_8.field2; + CursorTy pvrtmp_6285 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6282, jump_4272, + pvrtmp_6284, pvrtmp_6285}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6292 = *(CursorTy *) tmpcur_6261; + CursorTy tmpaftercur_6293 = tmpcur_6261 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2924, end_r_2925, loc_2923, tmpcur_6292, inVal_23_909_1529); + CursorTy pvrtmp_6294 = tmp_struct_9.field0; + CursorTy pvrtmp_6295 = tmp_struct_9.field1; + CursorTy pvrtmp_6296 = tmp_struct_9.field2; + CursorTy pvrtmp_6297 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6294, pvrtmp_6295, + pvrtmp_6296, pvrtmp_6297}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6260"); + exit(1); + } + } +} +CursorCursorCursorProd mkACTList(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_26_912_1534, + IntTy tagLen_27_913_1535, + IntTy strLen_28_914_1536) +{ + if (loc_2926 + 32 > end_r_2927) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2927); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2927 = chunk_end_18; + *(TagTyPacked *) loc_2926 = 255; + + CursorTy redir = loc_2926 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2926 = chunk_start_17; + } + + CursorTy loc_3059 = loc_2926 + 1; + CursorTy loc_3060 = loc_3059 + 8; + CursorTy loc_3061 = loc_3060 + 8; + BoolTy fltIf_1510_1537 = len_26_912_1534 <= 0; + + if (fltIf_1510_1537) { + *(TagTyPacked *) loc_2926 = 0; + + CursorTy writetag_4556 = loc_2926 + 1; + + return (CursorCursorCursorProd) {end_r_2927, loc_2926, writetag_4556}; + } else { + IntTy fltAppE_1511_1538 = len_26_912_1534 - 1; + CursorCursorCursorProd tmp_struct_13 = + mkACTList(end_r_2927, loc_3061, fltAppE_1511_1538, tagLen_27_913_1535, strLen_28_914_1536); + CursorTy pvrtmp_6309 = tmp_struct_13.field0; + CursorTy pvrtmp_6310 = tmp_struct_13.field1; + CursorTy pvrtmp_6311 = tmp_struct_13.field2; + CursorCursorCursorProd tmp_struct_14 = + mkContentText(pvrtmp_6309, pvrtmp_6311, strLen_28_914_1536); + CursorTy pvrtmp_6316 = tmp_struct_14.field0; + CursorTy pvrtmp_6317 = tmp_struct_14.field1; + CursorTy pvrtmp_6318 = tmp_struct_14.field2; + CursorCursorCursorProd tmp_struct_15 = + mkRandomTags(pvrtmp_6316, pvrtmp_6318, tagLen_27_913_1535); + CursorTy pvrtmp_6323 = tmp_struct_15.field0; + CursorTy pvrtmp_6324 = tmp_struct_15.field1; + CursorTy pvrtmp_6325 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2926 = 15; + + CursorTy writetag_4561 = loc_2926 + 1; + + *(CursorTy *) writetag_4561 = pvrtmp_6311; + + CursorTy writecur_4562 = writetag_4561 + 8; + + *(CursorTy *) writecur_4562 = pvrtmp_6318; + + CursorTy writecur_4563 = writecur_4562 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6323, loc_2926, pvrtmp_6325}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2929, CursorTy loc_2928, + IntTy len_181_1067_1542) +{ + if (loc_2928 + 32 > end_r_2929) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2929); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2929 = chunk_end_22; + *(TagTyPacked *) loc_2928 = 255; + + CursorTy redir = loc_2928 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2928 = chunk_start_21; + } + + CursorTy loc_3073 = loc_2928 + 1; + CursorTy loc_3074 = loc_3073 + 8; + BoolTy fltIf_1512_1543 = len_181_1067_1542 <= 0; + + if (fltIf_1512_1543) { + *(TagTyPacked *) loc_2928 = 0; + + CursorTy writetag_4568 = loc_2928 + 1; + + return (CursorCursorCursorProd) {end_r_2929, loc_2928, writetag_4568}; + } else { + IntTy fltPrm_1513_1544 = rand(); + IntTy randomChar_182_1068_1545 = fltPrm_1513_1544 % 128; + IntTy fltAppE_1514_1546 = len_181_1067_1542 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2929, loc_3074, fltAppE_1514_1546); + CursorTy pvrtmp_6338 = tmp_struct_19.field0; + CursorTy pvrtmp_6339 = tmp_struct_19.field1; + CursorTy pvrtmp_6340 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2928 = 1; + + CursorTy writetag_4571 = loc_2928 + 1; + + *(IntTy *) writetag_4571 = randomChar_182_1068_1545; + + CursorTy writecur_4572 = writetag_4571 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6338, loc_2928, pvrtmp_6340}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2931, CursorTy loc_2930, + IntTy n_195_1081_1548) +{ + if (loc_2930 + 32 > end_r_2931) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2931); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2931 = chunk_end_26; + *(TagTyPacked *) loc_2930 = 255; + + CursorTy redir = loc_2930 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2930 = chunk_start_25; + } + + CursorTy loc_3079 = loc_2930 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2931, loc_3079, n_195_1081_1548); + CursorTy pvrtmp_6349 = tmp_struct_23.field0; + CursorTy pvrtmp_6350 = tmp_struct_23.field1; + CursorTy pvrtmp_6351 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2930 = 1; + + CursorTy writetag_4576 = loc_2930 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6349, loc_2930, pvrtmp_6351}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2933, CursorTy loc_2932, + IntTy len_320_1206_1550) +{ + if (loc_2932 + 32 > end_r_2933) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2933); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2933 = chunk_end_30; + *(TagTyPacked *) loc_2932 = 255; + + CursorTy redir = loc_2932 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2932 = chunk_start_29; + } + + CursorTy loc_3083 = loc_2932 + 1; + CursorTy loc_3084 = loc_3083 + 8; + BoolTy fltIf_1516_1551 = len_320_1206_1550 <= 0; + + if (fltIf_1516_1551) { + *(TagTyPacked *) loc_2932 = 0; + + CursorTy writetag_4579 = loc_2932 + 1; + + return (CursorCursorCursorProd) {end_r_2933, loc_2932, writetag_4579}; + } else { + IntTy fltAppE_1517_1553 = len_320_1206_1550 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2933, loc_3084, fltAppE_1517_1553); + CursorTy pvrtmp_6364 = tmp_struct_27.field0; + CursorTy pvrtmp_6365 = tmp_struct_27.field1; + CursorTy pvrtmp_6366 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2932 = 1; + + CursorTy writetag_4582 = loc_2932 + 1; + + *(IntTy *) writetag_4582 = 100; + + CursorTy writecur_4583 = writetag_4582 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6364, loc_2932, pvrtmp_6366}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2936, + CursorTy end_r_2937, + CursorTy loc_2935, + CursorTy arg_624_1230_1555) +{ + if (loc_2935 + 32 > end_r_2937) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2937); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2937 = chunk_end_36; + *(TagTyPacked *) loc_2935 = 255; + + CursorTy redir = loc_2935 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2935 = chunk_start_35; + } + + CursorTy loc_3094 = loc_2935 + 1; + CursorTy loc_3095 = loc_3094 + 8; + TagTyPacked tmpval_6375 = *(TagTyPacked *) arg_624_1230_1555; + CursorTy tmpcur_6376 = arg_624_1230_1555 + 1; + + + switch_6419: + ; + switch (tmpval_6375) { + + case 0: + { + CursorTy jump_3973 = arg_624_1230_1555 + 1; + + *(TagTyPacked *) loc_2935 = 0; + + CursorTy writetag_4587 = loc_2935 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2937, jump_3973, + loc_2935, writetag_4587}; + break; + } + + case 1: + { + IntTy tmpval_6381 = *(IntTy *) tmpcur_6376; + CursorTy tmpcur_6382 = tmpcur_6376 + sizeof(IntTy); + CursorTy jump_3975 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2936, end_r_2937, loc_3095, tmpcur_6382); + CursorTy pvrtmp_6383 = tmp_struct_31.field0; + CursorTy pvrtmp_6384 = tmp_struct_31.field1; + CursorTy pvrtmp_6385 = tmp_struct_31.field2; + CursorTy pvrtmp_6386 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2935 = 1; + + CursorTy writetag_4592 = loc_2935 + 1; + + *(IntTy *) writetag_4592 = tmpval_6381; + + CursorTy writecur_4593 = writetag_4592 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6383, pvrtmp_6384, + loc_2935, pvrtmp_6386}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6395 = *(CursorTy *) tmpcur_6376; + CursorTy tmpaftercur_6396 = tmpcur_6376 + 8; + CursorTy jump_4278 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2936, end_r_2937, loc_2935, tmpcur_6395); + CursorTy pvrtmp_6397 = tmp_struct_32.field0; + CursorTy pvrtmp_6398 = tmp_struct_32.field1; + CursorTy pvrtmp_6399 = tmp_struct_32.field2; + CursorTy pvrtmp_6400 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6397, jump_4278, + pvrtmp_6399, pvrtmp_6400}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6407 = *(CursorTy *) tmpcur_6376; + CursorTy tmpaftercur_6408 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2936, end_r_2937, loc_2935, tmpcur_6407); + CursorTy pvrtmp_6409 = tmp_struct_33.field0; + CursorTy pvrtmp_6410 = tmp_struct_33.field1; + CursorTy pvrtmp_6411 = tmp_struct_33.field2; + CursorTy pvrtmp_6412 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6409, pvrtmp_6410, + pvrtmp_6411, pvrtmp_6412}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6375"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2940, + CursorTy end_r_2941, + CursorTy loc_2939, + CursorTy arg_629_1235_1560) +{ + CursorTy loc_3107 = loc_2939 + 1; + CursorTy loc_3108 = loc_3107 + 8; + TagTyPacked tmpval_6420 = *(TagTyPacked *) arg_629_1235_1560; + CursorTy tmpcur_6421 = arg_629_1235_1560 + 1; + + + switch_6464: + ; + switch (tmpval_6420) { + + case 0: + { + CursorTy jump_3978 = arg_629_1235_1560 + 1; + + *(TagTyPacked *) loc_2939 = 0; + + CursorTy writetag_4603 = loc_2939 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2941, jump_3978, + loc_2939, writetag_4603}; + break; + } + + case 1: + { + IntTy tmpval_6426 = *(IntTy *) tmpcur_6421; + CursorTy tmpcur_6427 = tmpcur_6421 + sizeof(IntTy); + CursorTy jump_3980 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_3108, tmpcur_6427); + CursorTy pvrtmp_6428 = tmp_struct_37.field0; + CursorTy pvrtmp_6429 = tmp_struct_37.field1; + CursorTy pvrtmp_6430 = tmp_struct_37.field2; + CursorTy pvrtmp_6431 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2939 = 1; + + CursorTy writetag_4608 = loc_2939 + 1; + + *(IntTy *) writetag_4608 = tmpval_6426; + + CursorTy writecur_4609 = writetag_4608 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6428, pvrtmp_6429, + loc_2939, pvrtmp_6431}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6440 = *(CursorTy *) tmpcur_6421; + CursorTy tmpaftercur_6441 = tmpcur_6421 + 8; + CursorTy jump_4284 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_2939, tmpcur_6440); + CursorTy pvrtmp_6442 = tmp_struct_38.field0; + CursorTy pvrtmp_6443 = tmp_struct_38.field1; + CursorTy pvrtmp_6444 = tmp_struct_38.field2; + CursorTy pvrtmp_6445 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6442, jump_4284, + pvrtmp_6444, pvrtmp_6445}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6452 = *(CursorTy *) tmpcur_6421; + CursorTy tmpaftercur_6453 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_2939, tmpcur_6452); + CursorTy pvrtmp_6454 = tmp_struct_39.field0; + CursorTy pvrtmp_6455 = tmp_struct_39.field1; + CursorTy pvrtmp_6456 = tmp_struct_39.field2; + CursorTy pvrtmp_6457 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6454, pvrtmp_6455, + pvrtmp_6456, pvrtmp_6457}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6420"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2943, CursorTy arg_634_1240_1565) +{ + TagTyPacked tmpval_6465 = *(TagTyPacked *) arg_634_1240_1565; + CursorTy tmpcur_6466 = arg_634_1240_1565 + 1; + + + switch_6476: + ; + switch (tmpval_6465) { + + case 0: + { + CursorTy jump_3983 = arg_634_1240_1565 + 1; + + return (CursorProd) {jump_3983}; + break; + } + + case 1: + { + IntTy tmpval_6467 = *(IntTy *) tmpcur_6466; + CursorTy tmpcur_6468 = tmpcur_6466 + sizeof(IntTy); + CursorTy jump_3985 = tmpcur_6466 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2943, tmpcur_6468); + CursorTy pvrtmp_6469 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6469}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6470 = *(CursorTy *) tmpcur_6466; + CursorTy tmpaftercur_6471 = tmpcur_6466 + 8; + CursorTy jump_4290 = tmpcur_6466 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2943, tmpcur_6470); + CursorTy pvrtmp_6472 = tmp_struct_41.field0; + + return (CursorProd) {jump_4290}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6473 = *(CursorTy *) tmpcur_6466; + CursorTy tmpaftercur_6474 = tmpcur_6466 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2943, tmpcur_6473); + CursorTy pvrtmp_6475 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6475}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6465"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2945, CursorTy arg_639_1244_1569) +{ + TagTyPacked tmpval_6477 = *(TagTyPacked *) arg_639_1244_1569; + CursorTy tmpcur_6478 = arg_639_1244_1569 + 1; + + + switch_6488: + ; + switch (tmpval_6477) { + + case 0: + { + CursorTy jump_3988 = arg_639_1244_1569 + 1; + unsigned char wildcard_640_1245_1570 = print_symbol(6162); + unsigned char wildcard_641_1246_1571 = print_symbol(6154); + + return (CursorProd) {jump_3988}; + break; + } + + case 1: + { + IntTy tmpval_6479 = *(IntTy *) tmpcur_6478; + CursorTy tmpcur_6480 = tmpcur_6478 + sizeof(IntTy); + CursorTy jump_3990 = tmpcur_6478 + 8; + unsigned char wildcard_646_1249_1574 = print_symbol(6163); + unsigned char y_644_1250_1575 = printf("%lld", tmpval_6479); + CursorProd tmp_struct_43 = _print_String(end_r_2945, tmpcur_6480); + CursorTy pvrtmp_6481 = tmp_struct_43.field0; + unsigned char wildcard_647_1252_1577 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6481}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6482 = *(CursorTy *) tmpcur_6478; + CursorTy tmpaftercur_6483 = tmpcur_6478 + 8; + CursorTy jump_4296 = tmpcur_6478 + 8; + unsigned char wildcard_4299 = print_symbol(6171); + CursorProd tmp_struct_44 = _print_String(end_r_2945, tmpcur_6482); + CursorTy pvrtmp_6484 = tmp_struct_44.field0; + + return (CursorProd) {jump_4296}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6485 = *(CursorTy *) tmpcur_6478; + CursorTy tmpaftercur_6486 = tmpcur_6478 + 8; + unsigned char wildcard_4299 = print_symbol(6170); + CursorProd tmp_struct_45 = _print_String(end_r_2945, tmpcur_6485); + CursorTy pvrtmp_6487 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6487}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6477"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2948, + CursorTy end_r_2949, + CursorTy loc_2947, + CursorTy arg_648_1253_1578) +{ + if (loc_2947 + 32 > end_r_2949) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2949); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2949 = chunk_end_52; + *(TagTyPacked *) loc_2947 = 255; + + CursorTy redir = loc_2947 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2947 = chunk_start_51; + } + + TagTyPacked tmpval_6489 = *(TagTyPacked *) arg_648_1253_1578; + CursorTy tmpcur_6490 = arg_648_1253_1578 + 1; + + + switch_6539: + ; + switch (tmpval_6489) { + + case 0: + { + CursorTy loc_3130 = loc_2947 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2948, end_r_2949, loc_3130, tmpcur_6490); + CursorTy pvrtmp_6491 = tmp_struct_46.field0; + CursorTy pvrtmp_6492 = tmp_struct_46.field1; + CursorTy pvrtmp_6493 = tmp_struct_46.field2; + CursorTy pvrtmp_6494 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2947 = 0; + + CursorTy writetag_4640 = loc_2947 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6491, pvrtmp_6492, + loc_2947, pvrtmp_6494}; + break; + } + + case 1: + { + CursorTy loc_3136 = loc_2947 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2948, end_r_2949, loc_3136, tmpcur_6490); + CursorTy pvrtmp_6503 = tmp_struct_47.field0; + CursorTy pvrtmp_6504 = tmp_struct_47.field1; + CursorTy pvrtmp_6505 = tmp_struct_47.field2; + CursorTy pvrtmp_6506 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2947 = 1; + + CursorTy writetag_4645 = loc_2947 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6503, pvrtmp_6504, + loc_2947, pvrtmp_6506}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6515 = *(CursorTy *) tmpcur_6490; + CursorTy tmpaftercur_6516 = tmpcur_6490 + 8; + CursorTy jump_4302 = tmpcur_6490 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2948, end_r_2949, loc_2947, tmpcur_6515); + CursorTy pvrtmp_6517 = tmp_struct_48.field0; + CursorTy pvrtmp_6518 = tmp_struct_48.field1; + CursorTy pvrtmp_6519 = tmp_struct_48.field2; + CursorTy pvrtmp_6520 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6517, jump_4302, + pvrtmp_6519, pvrtmp_6520}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6527 = *(CursorTy *) tmpcur_6490; + CursorTy tmpaftercur_6528 = tmpcur_6490 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2948, end_r_2949, loc_2947, tmpcur_6527); + CursorTy pvrtmp_6529 = tmp_struct_49.field0; + CursorTy pvrtmp_6530 = tmp_struct_49.field1; + CursorTy pvrtmp_6531 = tmp_struct_49.field2; + CursorTy pvrtmp_6532 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6529, pvrtmp_6530, + pvrtmp_6531, pvrtmp_6532}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6489"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2952, + CursorTy end_r_2953, + CursorTy loc_2951, + CursorTy arg_653_1258_1583) +{ + TagTyPacked tmpval_6540 = *(TagTyPacked *) arg_653_1258_1583; + CursorTy tmpcur_6541 = arg_653_1258_1583 + 1; + + + switch_6590: + ; + switch (tmpval_6540) { + + case 0: + { + CursorTy loc_3144 = loc_2951 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2952, end_r_2953, loc_3144, tmpcur_6541); + CursorTy pvrtmp_6542 = tmp_struct_53.field0; + CursorTy pvrtmp_6543 = tmp_struct_53.field1; + CursorTy pvrtmp_6544 = tmp_struct_53.field2; + CursorTy pvrtmp_6545 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2951 = 0; + + CursorTy writetag_4656 = loc_2951 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6542, pvrtmp_6543, + loc_2951, pvrtmp_6545}; + break; + } + + case 1: + { + CursorTy loc_3150 = loc_2951 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2952, end_r_2953, loc_3150, tmpcur_6541); + CursorTy pvrtmp_6554 = tmp_struct_54.field0; + CursorTy pvrtmp_6555 = tmp_struct_54.field1; + CursorTy pvrtmp_6556 = tmp_struct_54.field2; + CursorTy pvrtmp_6557 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2951 = 1; + + CursorTy writetag_4661 = loc_2951 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6554, pvrtmp_6555, + loc_2951, pvrtmp_6557}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6566 = *(CursorTy *) tmpcur_6541; + CursorTy tmpaftercur_6567 = tmpcur_6541 + 8; + CursorTy jump_4308 = tmpcur_6541 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2952, end_r_2953, loc_2951, tmpcur_6566); + CursorTy pvrtmp_6568 = tmp_struct_55.field0; + CursorTy pvrtmp_6569 = tmp_struct_55.field1; + CursorTy pvrtmp_6570 = tmp_struct_55.field2; + CursorTy pvrtmp_6571 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6568, jump_4308, + pvrtmp_6570, pvrtmp_6571}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6578 = *(CursorTy *) tmpcur_6541; + CursorTy tmpaftercur_6579 = tmpcur_6541 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2952, end_r_2953, loc_2951, tmpcur_6578); + CursorTy pvrtmp_6580 = tmp_struct_56.field0; + CursorTy pvrtmp_6581 = tmp_struct_56.field1; + CursorTy pvrtmp_6582 = tmp_struct_56.field2; + CursorTy pvrtmp_6583 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6580, pvrtmp_6581, + pvrtmp_6582, pvrtmp_6583}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6540"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2955, CursorTy arg_658_1263_1588) +{ + TagTyPacked tmpval_6591 = *(TagTyPacked *) arg_658_1263_1588; + CursorTy tmpcur_6592 = arg_658_1263_1588 + 1; + + + switch_6601: + ; + switch (tmpval_6591) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2955, tmpcur_6592); + CursorTy pvrtmp_6593 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6593}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2955, tmpcur_6592); + CursorTy pvrtmp_6594 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6594}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6595 = *(CursorTy *) tmpcur_6592; + CursorTy tmpaftercur_6596 = tmpcur_6592 + 8; + CursorTy jump_4314 = tmpcur_6592 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2955, tmpcur_6595); + CursorTy pvrtmp_6597 = tmp_struct_59.field0; + + return (CursorProd) {jump_4314}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6598 = *(CursorTy *) tmpcur_6592; + CursorTy tmpaftercur_6599 = tmpcur_6592 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2955, tmpcur_6598); + CursorTy pvrtmp_6600 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6600}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6591"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2957, CursorTy arg_663_1268_1593) +{ + TagTyPacked tmpval_6602 = *(TagTyPacked *) arg_663_1268_1593; + CursorTy tmpcur_6603 = arg_663_1268_1593 + 1; + + + switch_6612: + ; + switch (tmpval_6602) { + + case 0: + { + unsigned char wildcard_666_1270_1595 = print_symbol(6161); + CursorProd tmp_struct_61 = _print_String(end_r_2957, tmpcur_6603); + CursorTy pvrtmp_6604 = tmp_struct_61.field0; + unsigned char wildcard_667_1272_1597 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6604}; + break; + } + + case 1: + { + unsigned char wildcard_670_1274_1599 = print_symbol(6155); + CursorProd tmp_struct_62 = _print_String(end_r_2957, tmpcur_6603); + CursorTy pvrtmp_6605 = tmp_struct_62.field0; + unsigned char wildcard_671_1276_1601 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6605}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6606 = *(CursorTy *) tmpcur_6603; + CursorTy tmpaftercur_6607 = tmpcur_6603 + 8; + CursorTy jump_4320 = tmpcur_6603 + 8; + unsigned char wildcard_4323 = print_symbol(6171); + CursorProd tmp_struct_63 = _print_Content(end_r_2957, tmpcur_6606); + CursorTy pvrtmp_6608 = tmp_struct_63.field0; + + return (CursorProd) {jump_4320}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6609 = *(CursorTy *) tmpcur_6603; + CursorTy tmpaftercur_6610 = tmpcur_6603 + 8; + unsigned char wildcard_4323 = print_symbol(6170); + CursorProd tmp_struct_64 = _print_Content(end_r_2957, tmpcur_6609); + CursorTy pvrtmp_6611 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6611}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6602"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2960, CursorTy end_r_2961, + CursorTy loc_2959, + CursorTy arg_672_1277_1602) +{ + if (loc_2959 + 32 > end_r_2961) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2961); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2961 = chunk_end_91; + *(TagTyPacked *) loc_2959 = 255; + + CursorTy redir = loc_2959 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2959 = chunk_start_90; + } + + CursorTy loc_3180 = loc_2959 + 1; + CursorTy loc_3181 = loc_3180 + 8; + CursorTy loc_3196 = loc_2959 + 1; + CursorTy loc_3197 = loc_3196 + 8; + CursorTy loc_3217 = loc_2959 + 1; + CursorTy loc_3218 = loc_3217 + 8; + CursorTy loc_3219 = loc_3218 + 8; + CursorTy loc_3243 = loc_2959 + 1; + CursorTy loc_3244 = loc_3243 + 8; + CursorTy loc_3245 = loc_3244 + 8; + CursorTy loc_3269 = loc_2959 + 1; + CursorTy loc_3270 = loc_3269 + 8; + CursorTy loc_3271 = loc_3270 + 8; + CursorTy loc_3295 = loc_2959 + 1; + CursorTy loc_3296 = loc_3295 + 8; + CursorTy loc_3297 = loc_3296 + 8; + CursorTy loc_3321 = loc_2959 + 1; + CursorTy loc_3322 = loc_3321 + 8; + CursorTy loc_3323 = loc_3322 + 8; + CursorTy loc_3347 = loc_2959 + 1; + CursorTy loc_3348 = loc_3347 + 8; + CursorTy loc_3349 = loc_3348 + 8; + TagTyPacked tmpval_6613 = *(TagTyPacked *) arg_672_1277_1602; + CursorTy tmpcur_6614 = arg_672_1277_1602 + 1; + + + switch_6879: + ; + switch (tmpval_6613) { + + case 0: + { + CursorTy jump_4009 = arg_672_1277_1602 + 1; + + *(TagTyPacked *) loc_2959 = 0; + + CursorTy writetag_4691 = loc_2959 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2961, jump_4009, + loc_2959, writetag_4691}; + break; + } + + case 9: + { + CursorTy tmpcur_6619 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6620 = tmpcur_6614 + 8; + CursorTy jump_4011 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2960, end_r_2961, loc_3181, tmpaftercur_6620); + CursorTy pvrtmp_6621 = tmp_struct_65.field0; + CursorTy pvrtmp_6622 = tmp_struct_65.field1; + CursorTy pvrtmp_6623 = tmp_struct_65.field2; + CursorTy pvrtmp_6624 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2960, pvrtmp_6621, pvrtmp_6624, tmpcur_6619); + CursorTy pvrtmp_6629 = tmp_struct_66.field0; + CursorTy pvrtmp_6630 = tmp_struct_66.field1; + CursorTy pvrtmp_6631 = tmp_struct_66.field2; + CursorTy pvrtmp_6632 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2959 = 9; + + CursorTy writetag_4697 = loc_2959 + 1; + + *(CursorTy *) writetag_4697 = pvrtmp_6624; + + CursorTy writecur_4698 = writetag_4697 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6629, pvrtmp_6630, + loc_2959, pvrtmp_6632}; + break; + } + + case 11: + { + CursorTy tmpcur_6641 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6642 = tmpcur_6614 + 8; + CursorTy jump_4015 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2960, end_r_2961, loc_3197, tmpaftercur_6642); + CursorTy pvrtmp_6643 = tmp_struct_67.field0; + CursorTy pvrtmp_6644 = tmp_struct_67.field1; + CursorTy pvrtmp_6645 = tmp_struct_67.field2; + CursorTy pvrtmp_6646 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2960, pvrtmp_6643, pvrtmp_6646, tmpcur_6641); + CursorTy pvrtmp_6651 = tmp_struct_68.field0; + CursorTy pvrtmp_6652 = tmp_struct_68.field1; + CursorTy pvrtmp_6653 = tmp_struct_68.field2; + CursorTy pvrtmp_6654 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2959 = 11; + + CursorTy writetag_4706 = loc_2959 + 1; + + *(CursorTy *) writetag_4706 = pvrtmp_6646; + + CursorTy writecur_4707 = writetag_4706 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6651, pvrtmp_6652, + loc_2959, pvrtmp_6654}; + break; + } + + case 13: + { + CursorTy tmpcur_6663 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6664 = tmpcur_6614 + 8; + CursorTy tmpcur_6665 = *(CursorTy *) tmpaftercur_6664; + CursorTy tmpaftercur_6666 = tmpaftercur_6664 + 8; + CursorTy jump_4020 = tmpaftercur_6664 + 8; + CursorTy jump_4019 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2960, end_r_2961, loc_3219, tmpaftercur_6666); + CursorTy pvrtmp_6667 = tmp_struct_69.field0; + CursorTy pvrtmp_6668 = tmp_struct_69.field1; + CursorTy pvrtmp_6669 = tmp_struct_69.field2; + CursorTy pvrtmp_6670 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2960, pvrtmp_6667, pvrtmp_6670, tmpcur_6663); + CursorTy pvrtmp_6675 = tmp_struct_70.field0; + CursorTy pvrtmp_6676 = tmp_struct_70.field1; + CursorTy pvrtmp_6677 = tmp_struct_70.field2; + CursorTy pvrtmp_6678 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2960, pvrtmp_6675, pvrtmp_6678, tmpcur_6665); + CursorTy pvrtmp_6683 = tmp_struct_71.field0; + CursorTy pvrtmp_6684 = tmp_struct_71.field1; + CursorTy pvrtmp_6685 = tmp_struct_71.field2; + CursorTy pvrtmp_6686 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2959 = 13; + + CursorTy writetag_4717 = loc_2959 + 1; + + *(CursorTy *) writetag_4717 = pvrtmp_6670; + + CursorTy writecur_4718 = writetag_4717 + 8; + + *(CursorTy *) writecur_4718 = pvrtmp_6678; + + CursorTy writecur_4719 = writecur_4718 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6683, pvrtmp_6684, + loc_2959, pvrtmp_6686}; + break; + } + + case 15: + { + CursorTy tmpcur_6695 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6696 = tmpcur_6614 + 8; + CursorTy tmpcur_6697 = *(CursorTy *) tmpaftercur_6696; + CursorTy tmpaftercur_6698 = tmpaftercur_6696 + 8; + CursorTy jump_4026 = tmpaftercur_6696 + 8; + CursorTy jump_4025 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2960, end_r_2961, loc_3245, tmpaftercur_6698); + CursorTy pvrtmp_6699 = tmp_struct_72.field0; + CursorTy pvrtmp_6700 = tmp_struct_72.field1; + CursorTy pvrtmp_6701 = tmp_struct_72.field2; + CursorTy pvrtmp_6702 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2960, pvrtmp_6699, pvrtmp_6702, tmpcur_6695); + CursorTy pvrtmp_6707 = tmp_struct_73.field0; + CursorTy pvrtmp_6708 = tmp_struct_73.field1; + CursorTy pvrtmp_6709 = tmp_struct_73.field2; + CursorTy pvrtmp_6710 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2960, pvrtmp_6707, pvrtmp_6710, tmpcur_6697); + CursorTy pvrtmp_6715 = tmp_struct_74.field0; + CursorTy pvrtmp_6716 = tmp_struct_74.field1; + CursorTy pvrtmp_6717 = tmp_struct_74.field2; + CursorTy pvrtmp_6718 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2959 = 15; + + CursorTy writetag_4730 = loc_2959 + 1; + + *(CursorTy *) writetag_4730 = pvrtmp_6702; + + CursorTy writecur_4731 = writetag_4730 + 8; + + *(CursorTy *) writecur_4731 = pvrtmp_6710; + + CursorTy writecur_4732 = writecur_4731 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6715, pvrtmp_6716, + loc_2959, pvrtmp_6718}; + break; + } + + case 17: + { + CursorTy tmpcur_6727 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6728 = tmpcur_6614 + 8; + CursorTy tmpcur_6729 = *(CursorTy *) tmpaftercur_6728; + CursorTy tmpaftercur_6730 = tmpaftercur_6728 + 8; + CursorTy jump_4032 = tmpaftercur_6728 + 8; + CursorTy jump_4031 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2960, end_r_2961, loc_3271, tmpaftercur_6730); + CursorTy pvrtmp_6731 = tmp_struct_75.field0; + CursorTy pvrtmp_6732 = tmp_struct_75.field1; + CursorTy pvrtmp_6733 = tmp_struct_75.field2; + CursorTy pvrtmp_6734 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2960, pvrtmp_6731, pvrtmp_6734, tmpcur_6727); + CursorTy pvrtmp_6739 = tmp_struct_76.field0; + CursorTy pvrtmp_6740 = tmp_struct_76.field1; + CursorTy pvrtmp_6741 = tmp_struct_76.field2; + CursorTy pvrtmp_6742 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2960, pvrtmp_6739, pvrtmp_6742, tmpcur_6729); + CursorTy pvrtmp_6747 = tmp_struct_77.field0; + CursorTy pvrtmp_6748 = tmp_struct_77.field1; + CursorTy pvrtmp_6749 = tmp_struct_77.field2; + CursorTy pvrtmp_6750 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2959 = 17; + + CursorTy writetag_4743 = loc_2959 + 1; + + *(CursorTy *) writetag_4743 = pvrtmp_6734; + + CursorTy writecur_4744 = writetag_4743 + 8; + + *(CursorTy *) writecur_4744 = pvrtmp_6742; + + CursorTy writecur_4745 = writecur_4744 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6747, pvrtmp_6748, + loc_2959, pvrtmp_6750}; + break; + } + + case 19: + { + CursorTy tmpcur_6759 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6760 = tmpcur_6614 + 8; + CursorTy tmpcur_6761 = *(CursorTy *) tmpaftercur_6760; + CursorTy tmpaftercur_6762 = tmpaftercur_6760 + 8; + CursorTy jump_4038 = tmpaftercur_6760 + 8; + CursorTy jump_4037 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2960, end_r_2961, loc_3297, tmpaftercur_6762); + CursorTy pvrtmp_6763 = tmp_struct_78.field0; + CursorTy pvrtmp_6764 = tmp_struct_78.field1; + CursorTy pvrtmp_6765 = tmp_struct_78.field2; + CursorTy pvrtmp_6766 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2960, pvrtmp_6763, pvrtmp_6766, tmpcur_6759); + CursorTy pvrtmp_6771 = tmp_struct_79.field0; + CursorTy pvrtmp_6772 = tmp_struct_79.field1; + CursorTy pvrtmp_6773 = tmp_struct_79.field2; + CursorTy pvrtmp_6774 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2960, pvrtmp_6771, pvrtmp_6774, tmpcur_6761); + CursorTy pvrtmp_6779 = tmp_struct_80.field0; + CursorTy pvrtmp_6780 = tmp_struct_80.field1; + CursorTy pvrtmp_6781 = tmp_struct_80.field2; + CursorTy pvrtmp_6782 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2959 = 19; + + CursorTy writetag_4756 = loc_2959 + 1; + + *(CursorTy *) writetag_4756 = pvrtmp_6766; + + CursorTy writecur_4757 = writetag_4756 + 8; + + *(CursorTy *) writecur_4757 = pvrtmp_6774; + + CursorTy writecur_4758 = writecur_4757 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6779, pvrtmp_6780, + loc_2959, pvrtmp_6782}; + break; + } + + case 21: + { + CursorTy tmpcur_6791 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6792 = tmpcur_6614 + 8; + CursorTy tmpcur_6793 = *(CursorTy *) tmpaftercur_6792; + CursorTy tmpaftercur_6794 = tmpaftercur_6792 + 8; + CursorTy jump_4044 = tmpaftercur_6792 + 8; + CursorTy jump_4043 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2960, end_r_2961, loc_3323, tmpaftercur_6794); + CursorTy pvrtmp_6795 = tmp_struct_81.field0; + CursorTy pvrtmp_6796 = tmp_struct_81.field1; + CursorTy pvrtmp_6797 = tmp_struct_81.field2; + CursorTy pvrtmp_6798 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2960, pvrtmp_6795, pvrtmp_6798, tmpcur_6791); + CursorTy pvrtmp_6803 = tmp_struct_82.field0; + CursorTy pvrtmp_6804 = tmp_struct_82.field1; + CursorTy pvrtmp_6805 = tmp_struct_82.field2; + CursorTy pvrtmp_6806 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2960, pvrtmp_6803, pvrtmp_6806, tmpcur_6793); + CursorTy pvrtmp_6811 = tmp_struct_83.field0; + CursorTy pvrtmp_6812 = tmp_struct_83.field1; + CursorTy pvrtmp_6813 = tmp_struct_83.field2; + CursorTy pvrtmp_6814 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2959 = 21; + + CursorTy writetag_4769 = loc_2959 + 1; + + *(CursorTy *) writetag_4769 = pvrtmp_6798; + + CursorTy writecur_4770 = writetag_4769 + 8; + + *(CursorTy *) writecur_4770 = pvrtmp_6806; + + CursorTy writecur_4771 = writecur_4770 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6811, pvrtmp_6812, + loc_2959, pvrtmp_6814}; + break; + } + + case 23: + { + CursorTy tmpcur_6823 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6824 = tmpcur_6614 + 8; + CursorTy tmpcur_6825 = *(CursorTy *) tmpaftercur_6824; + CursorTy tmpaftercur_6826 = tmpaftercur_6824 + 8; + CursorTy jump_4050 = tmpaftercur_6824 + 8; + CursorTy jump_4049 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2960, end_r_2961, loc_3349, tmpaftercur_6826); + CursorTy pvrtmp_6827 = tmp_struct_84.field0; + CursorTy pvrtmp_6828 = tmp_struct_84.field1; + CursorTy pvrtmp_6829 = tmp_struct_84.field2; + CursorTy pvrtmp_6830 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2960, pvrtmp_6827, pvrtmp_6830, tmpcur_6823); + CursorTy pvrtmp_6835 = tmp_struct_85.field0; + CursorTy pvrtmp_6836 = tmp_struct_85.field1; + CursorTy pvrtmp_6837 = tmp_struct_85.field2; + CursorTy pvrtmp_6838 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2960, pvrtmp_6835, pvrtmp_6838, tmpcur_6825); + CursorTy pvrtmp_6843 = tmp_struct_86.field0; + CursorTy pvrtmp_6844 = tmp_struct_86.field1; + CursorTy pvrtmp_6845 = tmp_struct_86.field2; + CursorTy pvrtmp_6846 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2959 = 23; + + CursorTy writetag_4782 = loc_2959 + 1; + + *(CursorTy *) writetag_4782 = pvrtmp_6830; + + CursorTy writecur_4783 = writetag_4782 + 8; + + *(CursorTy *) writecur_4783 = pvrtmp_6838; + + CursorTy writecur_4784 = writecur_4783 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6843, pvrtmp_6844, + loc_2959, pvrtmp_6846}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6855 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6856 = tmpcur_6614 + 8; + CursorTy jump_4326 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2960, end_r_2961, loc_2959, tmpcur_6855); + CursorTy pvrtmp_6857 = tmp_struct_87.field0; + CursorTy pvrtmp_6858 = tmp_struct_87.field1; + CursorTy pvrtmp_6859 = tmp_struct_87.field2; + CursorTy pvrtmp_6860 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6857, jump_4326, + pvrtmp_6859, pvrtmp_6860}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6867 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6868 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2960, end_r_2961, loc_2959, tmpcur_6867); + CursorTy pvrtmp_6869 = tmp_struct_88.field0; + CursorTy pvrtmp_6870 = tmp_struct_88.field1; + CursorTy pvrtmp_6871 = tmp_struct_88.field2; + CursorTy pvrtmp_6872 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6869, pvrtmp_6870, + pvrtmp_6871, pvrtmp_6872}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6613"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2964, + CursorTy end_r_2965, + CursorTy loc_2963, + CursorTy arg_717_1322_1647) +{ + TagTyPacked tmpval_6880 = *(TagTyPacked *) arg_717_1322_1647; + CursorTy tmpcur_6881 = arg_717_1322_1647 + 1; + + + switch_7146: + ; + switch (tmpval_6880) { + + case 0: + { + CursorTy jump_4055 = arg_717_1322_1647 + 1; + + *(TagTyPacked *) loc_2963 = 0; + + CursorTy writetag_4796 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2965, jump_4055, + loc_2963, writetag_4796}; + break; + } + + case 9: + { + CursorTy tmpcur_6886 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6887 = tmpcur_6881 + 8; + CursorTy jump_4057 = tmpcur_6881 + 8; + CursorTy loc_3371 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3371, tmpaftercur_6887); + CursorTy pvrtmp_6888 = tmp_struct_92.field0; + CursorTy pvrtmp_6889 = tmp_struct_92.field1; + CursorTy pvrtmp_6890 = tmp_struct_92.field2; + CursorTy pvrtmp_6891 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6888, pvrtmp_6891, tmpcur_6886); + CursorTy pvrtmp_6896 = tmp_struct_93.field0; + CursorTy pvrtmp_6897 = tmp_struct_93.field1; + CursorTy pvrtmp_6898 = tmp_struct_93.field2; + CursorTy pvrtmp_6899 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2963 = 1; + + CursorTy writetag_4802 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6896, pvrtmp_6897, + loc_2963, pvrtmp_6899}; + break; + } + + case 11: + { + CursorTy tmpcur_6908 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6909 = tmpcur_6881 + 8; + CursorTy jump_4061 = tmpcur_6881 + 8; + CursorTy loc_3384 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3384, tmpaftercur_6909); + CursorTy pvrtmp_6910 = tmp_struct_94.field0; + CursorTy pvrtmp_6911 = tmp_struct_94.field1; + CursorTy pvrtmp_6912 = tmp_struct_94.field2; + CursorTy pvrtmp_6913 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6910, pvrtmp_6913, tmpcur_6908); + CursorTy pvrtmp_6918 = tmp_struct_95.field0; + CursorTy pvrtmp_6919 = tmp_struct_95.field1; + CursorTy pvrtmp_6920 = tmp_struct_95.field2; + CursorTy pvrtmp_6921 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2963 = 2; + + CursorTy writetag_4810 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6918, pvrtmp_6919, + loc_2963, pvrtmp_6921}; + break; + } + + case 13: + { + CursorTy tmpcur_6930 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6931 = tmpcur_6881 + 8; + CursorTy tmpcur_6932 = *(CursorTy *) tmpaftercur_6931; + CursorTy tmpaftercur_6933 = tmpaftercur_6931 + 8; + CursorTy jump_4066 = tmpaftercur_6931 + 8; + CursorTy jump_4065 = tmpcur_6881 + 8; + CursorTy loc_3402 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2964, end_r_2965, loc_3402, tmpaftercur_6933); + CursorTy pvrtmp_6934 = tmp_struct_96.field0; + CursorTy pvrtmp_6935 = tmp_struct_96.field1; + CursorTy pvrtmp_6936 = tmp_struct_96.field2; + CursorTy pvrtmp_6937 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6934, pvrtmp_6937, tmpcur_6930); + CursorTy pvrtmp_6942 = tmp_struct_97.field0; + CursorTy pvrtmp_6943 = tmp_struct_97.field1; + CursorTy pvrtmp_6944 = tmp_struct_97.field2; + CursorTy pvrtmp_6945 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6942, pvrtmp_6945, tmpcur_6932); + CursorTy pvrtmp_6950 = tmp_struct_98.field0; + CursorTy pvrtmp_6951 = tmp_struct_98.field1; + CursorTy pvrtmp_6952 = tmp_struct_98.field2; + CursorTy pvrtmp_6953 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2963 = 3; + + CursorTy writetag_4820 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6950, pvrtmp_6951, + loc_2963, pvrtmp_6953}; + break; + } + + case 15: + { + CursorTy tmpcur_6962 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6963 = tmpcur_6881 + 8; + CursorTy tmpcur_6964 = *(CursorTy *) tmpaftercur_6963; + CursorTy tmpaftercur_6965 = tmpaftercur_6963 + 8; + CursorTy jump_4072 = tmpaftercur_6963 + 8; + CursorTy jump_4071 = tmpcur_6881 + 8; + CursorTy loc_3422 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3422, tmpaftercur_6965); + CursorTy pvrtmp_6966 = tmp_struct_99.field0; + CursorTy pvrtmp_6967 = tmp_struct_99.field1; + CursorTy pvrtmp_6968 = tmp_struct_99.field2; + CursorTy pvrtmp_6969 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6966, pvrtmp_6969, tmpcur_6962); + CursorTy pvrtmp_6974 = tmp_struct_100.field0; + CursorTy pvrtmp_6975 = tmp_struct_100.field1; + CursorTy pvrtmp_6976 = tmp_struct_100.field2; + CursorTy pvrtmp_6977 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_6974, pvrtmp_6977, tmpcur_6964); + CursorTy pvrtmp_6982 = tmp_struct_101.field0; + CursorTy pvrtmp_6983 = tmp_struct_101.field1; + CursorTy pvrtmp_6984 = tmp_struct_101.field2; + CursorTy pvrtmp_6985 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2963 = 4; + + CursorTy writetag_4831 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6982, pvrtmp_6983, + loc_2963, pvrtmp_6985}; + break; + } + + case 17: + { + CursorTy tmpcur_6994 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6995 = tmpcur_6881 + 8; + CursorTy tmpcur_6996 = *(CursorTy *) tmpaftercur_6995; + CursorTy tmpaftercur_6997 = tmpaftercur_6995 + 8; + CursorTy jump_4078 = tmpaftercur_6995 + 8; + CursorTy jump_4077 = tmpcur_6881 + 8; + CursorTy loc_3442 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2964, end_r_2965, loc_3442, tmpaftercur_6997); + CursorTy pvrtmp_6998 = tmp_struct_102.field0; + CursorTy pvrtmp_6999 = tmp_struct_102.field1; + CursorTy pvrtmp_7000 = tmp_struct_102.field2; + CursorTy pvrtmp_7001 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6998, pvrtmp_7001, tmpcur_6994); + CursorTy pvrtmp_7006 = tmp_struct_103.field0; + CursorTy pvrtmp_7007 = tmp_struct_103.field1; + CursorTy pvrtmp_7008 = tmp_struct_103.field2; + CursorTy pvrtmp_7009 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_7006, pvrtmp_7009, tmpcur_6996); + CursorTy pvrtmp_7014 = tmp_struct_104.field0; + CursorTy pvrtmp_7015 = tmp_struct_104.field1; + CursorTy pvrtmp_7016 = tmp_struct_104.field2; + CursorTy pvrtmp_7017 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2963 = 5; + + CursorTy writetag_4842 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7014, pvrtmp_7015, + loc_2963, pvrtmp_7017}; + break; + } + + case 19: + { + CursorTy tmpcur_7026 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7027 = tmpcur_6881 + 8; + CursorTy tmpcur_7028 = *(CursorTy *) tmpaftercur_7027; + CursorTy tmpaftercur_7029 = tmpaftercur_7027 + 8; + CursorTy jump_4084 = tmpaftercur_7027 + 8; + CursorTy jump_4083 = tmpcur_6881 + 8; + CursorTy loc_3462 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3462, tmpaftercur_7029); + CursorTy pvrtmp_7030 = tmp_struct_105.field0; + CursorTy pvrtmp_7031 = tmp_struct_105.field1; + CursorTy pvrtmp_7032 = tmp_struct_105.field2; + CursorTy pvrtmp_7033 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7030, pvrtmp_7033, tmpcur_7026); + CursorTy pvrtmp_7038 = tmp_struct_106.field0; + CursorTy pvrtmp_7039 = tmp_struct_106.field1; + CursorTy pvrtmp_7040 = tmp_struct_106.field2; + CursorTy pvrtmp_7041 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_7038, pvrtmp_7041, tmpcur_7028); + CursorTy pvrtmp_7046 = tmp_struct_107.field0; + CursorTy pvrtmp_7047 = tmp_struct_107.field1; + CursorTy pvrtmp_7048 = tmp_struct_107.field2; + CursorTy pvrtmp_7049 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2963 = 6; + + CursorTy writetag_4853 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7046, pvrtmp_7047, + loc_2963, pvrtmp_7049}; + break; + } + + case 21: + { + CursorTy tmpcur_7058 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7059 = tmpcur_6881 + 8; + CursorTy tmpcur_7060 = *(CursorTy *) tmpaftercur_7059; + CursorTy tmpaftercur_7061 = tmpaftercur_7059 + 8; + CursorTy jump_4090 = tmpaftercur_7059 + 8; + CursorTy jump_4089 = tmpcur_6881 + 8; + CursorTy loc_3482 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3482, tmpaftercur_7061); + CursorTy pvrtmp_7062 = tmp_struct_108.field0; + CursorTy pvrtmp_7063 = tmp_struct_108.field1; + CursorTy pvrtmp_7064 = tmp_struct_108.field2; + CursorTy pvrtmp_7065 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7062, pvrtmp_7065, tmpcur_7058); + CursorTy pvrtmp_7070 = tmp_struct_109.field0; + CursorTy pvrtmp_7071 = tmp_struct_109.field1; + CursorTy pvrtmp_7072 = tmp_struct_109.field2; + CursorTy pvrtmp_7073 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_7070, pvrtmp_7073, tmpcur_7060); + CursorTy pvrtmp_7078 = tmp_struct_110.field0; + CursorTy pvrtmp_7079 = tmp_struct_110.field1; + CursorTy pvrtmp_7080 = tmp_struct_110.field2; + CursorTy pvrtmp_7081 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2963 = 7; + + CursorTy writetag_4864 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7078, pvrtmp_7079, + loc_2963, pvrtmp_7081}; + break; + } + + case 23: + { + CursorTy tmpcur_7090 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7091 = tmpcur_6881 + 8; + CursorTy tmpcur_7092 = *(CursorTy *) tmpaftercur_7091; + CursorTy tmpaftercur_7093 = tmpaftercur_7091 + 8; + CursorTy jump_4096 = tmpaftercur_7091 + 8; + CursorTy jump_4095 = tmpcur_6881 + 8; + CursorTy loc_3502 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3502, tmpaftercur_7093); + CursorTy pvrtmp_7094 = tmp_struct_111.field0; + CursorTy pvrtmp_7095 = tmp_struct_111.field1; + CursorTy pvrtmp_7096 = tmp_struct_111.field2; + CursorTy pvrtmp_7097 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_7094, pvrtmp_7097, tmpcur_7090); + CursorTy pvrtmp_7102 = tmp_struct_112.field0; + CursorTy pvrtmp_7103 = tmp_struct_112.field1; + CursorTy pvrtmp_7104 = tmp_struct_112.field2; + CursorTy pvrtmp_7105 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7102, pvrtmp_7105, tmpcur_7092); + CursorTy pvrtmp_7110 = tmp_struct_113.field0; + CursorTy pvrtmp_7111 = tmp_struct_113.field1; + CursorTy pvrtmp_7112 = tmp_struct_113.field2; + CursorTy pvrtmp_7113 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2963 = 8; + + CursorTy writetag_4875 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7110, pvrtmp_7111, + loc_2963, pvrtmp_7113}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7122 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7123 = tmpcur_6881 + 8; + CursorTy jump_4332 = tmpcur_6881 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_2963, tmpcur_7122); + CursorTy pvrtmp_7124 = tmp_struct_114.field0; + CursorTy pvrtmp_7125 = tmp_struct_114.field1; + CursorTy pvrtmp_7126 = tmp_struct_114.field2; + CursorTy pvrtmp_7127 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7124, jump_4332, + pvrtmp_7126, pvrtmp_7127}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7134 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7135 = tmpcur_6881 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_2963, tmpcur_7134); + CursorTy pvrtmp_7136 = tmp_struct_115.field0; + CursorTy pvrtmp_7137 = tmp_struct_115.field1; + CursorTy pvrtmp_7138 = tmp_struct_115.field2; + CursorTy pvrtmp_7139 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7136, pvrtmp_7137, + pvrtmp_7138, pvrtmp_7139}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6880"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2967, CursorTy arg_762_1367_1692) +{ + TagTyPacked tmpval_7147 = *(TagTyPacked *) arg_762_1367_1692; + CursorTy tmpcur_7148 = arg_762_1367_1692 + 1; + + + switch_7205: + ; + switch (tmpval_7147) { + + case 0: + { + CursorTy jump_4101 = arg_762_1367_1692 + 1; + + return (CursorProd) {jump_4101}; + break; + } + + case 9: + { + CursorTy tmpcur_7149 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7150 = tmpcur_7148 + 8; + CursorTy jump_4103 = tmpcur_7148 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2967, tmpaftercur_7150); + CursorTy pvrtmp_7151 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2967, tmpcur_7149); + CursorTy pvrtmp_7152 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7152}; + break; + } + + case 11: + { + CursorTy tmpcur_7153 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7154 = tmpcur_7148 + 8; + CursorTy jump_4107 = tmpcur_7148 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2967, tmpaftercur_7154); + CursorTy pvrtmp_7155 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2967, tmpcur_7153); + CursorTy pvrtmp_7156 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7156}; + break; + } + + case 13: + { + CursorTy tmpcur_7157 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7158 = tmpcur_7148 + 8; + CursorTy tmpcur_7159 = *(CursorTy *) tmpaftercur_7158; + CursorTy tmpaftercur_7160 = tmpaftercur_7158 + 8; + CursorTy jump_4112 = tmpaftercur_7158 + 8; + CursorTy jump_4111 = tmpcur_7148 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2967, tmpaftercur_7160); + CursorTy pvrtmp_7161 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2967, tmpcur_7157); + CursorTy pvrtmp_7162 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2967, tmpcur_7159); + CursorTy pvrtmp_7163 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7163}; + break; + } + + case 15: + { + CursorTy tmpcur_7164 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7165 = tmpcur_7148 + 8; + CursorTy tmpcur_7166 = *(CursorTy *) tmpaftercur_7165; + CursorTy tmpaftercur_7167 = tmpaftercur_7165 + 8; + CursorTy jump_4118 = tmpaftercur_7165 + 8; + CursorTy jump_4117 = tmpcur_7148 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2967, tmpaftercur_7167); + CursorTy pvrtmp_7168 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2967, tmpcur_7164); + CursorTy pvrtmp_7169 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2967, tmpcur_7166); + CursorTy pvrtmp_7170 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7170}; + break; + } + + case 17: + { + CursorTy tmpcur_7171 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7172 = tmpcur_7148 + 8; + CursorTy tmpcur_7173 = *(CursorTy *) tmpaftercur_7172; + CursorTy tmpaftercur_7174 = tmpaftercur_7172 + 8; + CursorTy jump_4124 = tmpaftercur_7172 + 8; + CursorTy jump_4123 = tmpcur_7148 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2967, tmpaftercur_7174); + CursorTy pvrtmp_7175 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2967, tmpcur_7171); + CursorTy pvrtmp_7176 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2967, tmpcur_7173); + CursorTy pvrtmp_7177 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7177}; + break; + } + + case 19: + { + CursorTy tmpcur_7178 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7179 = tmpcur_7148 + 8; + CursorTy tmpcur_7180 = *(CursorTy *) tmpaftercur_7179; + CursorTy tmpaftercur_7181 = tmpaftercur_7179 + 8; + CursorTy jump_4130 = tmpaftercur_7179 + 8; + CursorTy jump_4129 = tmpcur_7148 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2967, tmpaftercur_7181); + CursorTy pvrtmp_7182 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2967, tmpcur_7178); + CursorTy pvrtmp_7183 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2967, tmpcur_7180); + CursorTy pvrtmp_7184 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7184}; + break; + } + + case 21: + { + CursorTy tmpcur_7185 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7186 = tmpcur_7148 + 8; + CursorTy tmpcur_7187 = *(CursorTy *) tmpaftercur_7186; + CursorTy tmpaftercur_7188 = tmpaftercur_7186 + 8; + CursorTy jump_4136 = tmpaftercur_7186 + 8; + CursorTy jump_4135 = tmpcur_7148 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2967, tmpaftercur_7188); + CursorTy pvrtmp_7189 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2967, tmpcur_7185); + CursorTy pvrtmp_7190 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2967, tmpcur_7187); + CursorTy pvrtmp_7191 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7191}; + break; + } + + case 23: + { + CursorTy tmpcur_7192 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7193 = tmpcur_7148 + 8; + CursorTy tmpcur_7194 = *(CursorTy *) tmpaftercur_7193; + CursorTy tmpaftercur_7195 = tmpaftercur_7193 + 8; + CursorTy jump_4142 = tmpaftercur_7193 + 8; + CursorTy jump_4141 = tmpcur_7148 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2967, tmpaftercur_7195); + CursorTy pvrtmp_7196 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2967, tmpcur_7192); + CursorTy pvrtmp_7197 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2967, tmpcur_7194); + CursorTy pvrtmp_7198 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7198}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7199 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7200 = tmpcur_7148 + 8; + CursorTy jump_4338 = tmpcur_7148 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2967, tmpcur_7199); + CursorTy pvrtmp_7201 = tmp_struct_138.field0; + + return (CursorProd) {jump_4338}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7202 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7203 = tmpcur_7148 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2967, tmpcur_7202); + CursorTy pvrtmp_7204 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7204}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7147"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2969, CursorTy arg_807_1412_1737) +{ + TagTyPacked tmpval_7206 = *(TagTyPacked *) arg_807_1412_1737; + CursorTy tmpcur_7207 = arg_807_1412_1737 + 1; + + + switch_7264: + ; + switch (tmpval_7206) { + + case 0: + { + CursorTy jump_4147 = arg_807_1412_1737 + 1; + unsigned char wildcard_808_1413_1738 = print_symbol(6160); + unsigned char wildcard_809_1414_1739 = print_symbol(6154); + + return (CursorProd) {jump_4147}; + break; + } + + case 9: + { + CursorTy tmpcur_7208 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7209 = tmpcur_7207 + 8; + CursorTy jump_4149 = tmpcur_7207 + 8; + unsigned char wildcard_814_1417_1742 = print_symbol(6166); + CursorProd tmp_struct_140 = + _print_Content(end_r_2969, tmpaftercur_7209); + CursorTy pvrtmp_7210 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2969, tmpcur_7208); + CursorTy pvrtmp_7211 = tmp_struct_141.field0; + unsigned char wildcard_815_1420_1745 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7211}; + break; + } + + case 11: + { + CursorTy tmpcur_7212 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7213 = tmpcur_7207 + 8; + CursorTy jump_4153 = tmpcur_7207 + 8; + unsigned char wildcard_820_1423_1748 = print_symbol(6169); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2969, tmpaftercur_7213); + CursorTy pvrtmp_7214 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2969, tmpcur_7212); + CursorTy pvrtmp_7215 = tmp_struct_143.field0; + unsigned char wildcard_821_1426_1751 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7215}; + break; + } + + case 13: + { + CursorTy tmpcur_7216 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7217 = tmpcur_7207 + 8; + CursorTy tmpcur_7218 = *(CursorTy *) tmpaftercur_7217; + CursorTy tmpaftercur_7219 = tmpaftercur_7217 + 8; + CursorTy jump_4158 = tmpaftercur_7217 + 8; + CursorTy jump_4157 = tmpcur_7207 + 8; + unsigned char wildcard_828_1430_1755 = print_symbol(6157); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2969, tmpaftercur_7219); + CursorTy pvrtmp_7220 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2969, tmpcur_7216); + CursorTy pvrtmp_7221 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2969, tmpcur_7218); + CursorTy pvrtmp_7222 = tmp_struct_146.field0; + unsigned char wildcard_829_1434_1759 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7222}; + break; + } + + case 15: + { + CursorTy tmpcur_7223 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7224 = tmpcur_7207 + 8; + CursorTy tmpcur_7225 = *(CursorTy *) tmpaftercur_7224; + CursorTy tmpaftercur_7226 = tmpaftercur_7224 + 8; + CursorTy jump_4164 = tmpaftercur_7224 + 8; + CursorTy jump_4163 = tmpcur_7207 + 8; + unsigned char wildcard_836_1438_1763 = print_symbol(6168); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2969, tmpaftercur_7226); + CursorTy pvrtmp_7227 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2969, tmpcur_7223); + CursorTy pvrtmp_7228 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2969, tmpcur_7225); + CursorTy pvrtmp_7229 = tmp_struct_149.field0; + unsigned char wildcard_837_1442_1767 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7229}; + break; + } + + case 17: + { + CursorTy tmpcur_7230 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7231 = tmpcur_7207 + 8; + CursorTy tmpcur_7232 = *(CursorTy *) tmpaftercur_7231; + CursorTy tmpaftercur_7233 = tmpaftercur_7231 + 8; + CursorTy jump_4170 = tmpaftercur_7231 + 8; + CursorTy jump_4169 = tmpcur_7207 + 8; + unsigned char wildcard_844_1446_1771 = print_symbol(6158); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2969, tmpaftercur_7233); + CursorTy pvrtmp_7234 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2969, tmpcur_7230); + CursorTy pvrtmp_7235 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2969, tmpcur_7232); + CursorTy pvrtmp_7236 = tmp_struct_152.field0; + unsigned char wildcard_845_1450_1775 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7236}; + break; + } + + case 19: + { + CursorTy tmpcur_7237 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7238 = tmpcur_7207 + 8; + CursorTy tmpcur_7239 = *(CursorTy *) tmpaftercur_7238; + CursorTy tmpaftercur_7240 = tmpaftercur_7238 + 8; + CursorTy jump_4176 = tmpaftercur_7238 + 8; + CursorTy jump_4175 = tmpcur_7207 + 8; + unsigned char wildcard_852_1454_1779 = print_symbol(6167); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2969, tmpaftercur_7240); + CursorTy pvrtmp_7241 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2969, tmpcur_7237); + CursorTy pvrtmp_7242 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2969, tmpcur_7239); + CursorTy pvrtmp_7243 = tmp_struct_155.field0; + unsigned char wildcard_853_1458_1783 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7243}; + break; + } + + case 21: + { + CursorTy tmpcur_7244 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7245 = tmpcur_7207 + 8; + CursorTy tmpcur_7246 = *(CursorTy *) tmpaftercur_7245; + CursorTy tmpaftercur_7247 = tmpaftercur_7245 + 8; + CursorTy jump_4182 = tmpaftercur_7245 + 8; + CursorTy jump_4181 = tmpcur_7207 + 8; + unsigned char wildcard_860_1462_1787 = print_symbol(6164); + CursorProd tmp_struct_156 = + _print_Content(end_r_2969, tmpaftercur_7247); + CursorTy pvrtmp_7248 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2969, tmpcur_7244); + CursorTy pvrtmp_7249 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2969, tmpcur_7246); + CursorTy pvrtmp_7250 = tmp_struct_158.field0; + unsigned char wildcard_861_1466_1791 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7250}; + break; + } + + case 23: + { + CursorTy tmpcur_7251 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7252 = tmpcur_7207 + 8; + CursorTy tmpcur_7253 = *(CursorTy *) tmpaftercur_7252; + CursorTy tmpaftercur_7254 = tmpaftercur_7252 + 8; + CursorTy jump_4188 = tmpaftercur_7252 + 8; + CursorTy jump_4187 = tmpcur_7207 + 8; + unsigned char wildcard_868_1470_1795 = print_symbol(6165); + CursorProd tmp_struct_159 = + _print_Content(end_r_2969, tmpaftercur_7254); + CursorTy pvrtmp_7255 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2969, tmpcur_7251); + CursorTy pvrtmp_7256 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2969, tmpcur_7253); + CursorTy pvrtmp_7257 = tmp_struct_161.field0; + unsigned char wildcard_869_1474_1799 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7257}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7258 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7259 = tmpcur_7207 + 8; + CursorTy jump_4344 = tmpcur_7207 + 8; + unsigned char wildcard_4347 = print_symbol(6171); + CursorProd tmp_struct_162 = _print_Adt(end_r_2969, tmpcur_7258); + CursorTy pvrtmp_7260 = tmp_struct_162.field0; + + return (CursorProd) {jump_4344}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7261 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7262 = tmpcur_7207 + 8; + unsigned char wildcard_4347 = print_symbol(6170); + CursorProd tmp_struct_163 = _print_Adt(end_r_2969, tmpcur_7261); + CursorTy pvrtmp_7263 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7263}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7206"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2972, + CursorTy end_r_2973, CursorTy loc_2971, + CursorTy arg_870_1475_1800) +{ + if (loc_2971 + 32 > end_r_2973) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2973); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2973 = chunk_end_169; + *(TagTyPacked *) loc_2971 = 255; + + CursorTy redir = loc_2971 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2971 = chunk_start_168; + } + + CursorTy loc_3680 = loc_2971 + 1; + CursorTy loc_3681 = loc_3680 + 8; + TagTyPacked tmpval_7265 = *(TagTyPacked *) arg_870_1475_1800; + CursorTy tmpcur_7266 = arg_870_1475_1800 + 1; + + + switch_7309: + ; + switch (tmpval_7265) { + + case 0: + { + CursorTy jump_4193 = arg_870_1475_1800 + 1; + + *(TagTyPacked *) loc_2971 = 0; + + CursorTy writetag_4989 = loc_2971 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2973, jump_4193, + loc_2971, writetag_4989}; + break; + } + + case 1: + { + IntTy tmpval_7271 = *(IntTy *) tmpcur_7266; + CursorTy tmpcur_7272 = tmpcur_7266 + sizeof(IntTy); + CursorTy jump_4195 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2972, end_r_2973, loc_3681, tmpcur_7272); + CursorTy pvrtmp_7273 = tmp_struct_164.field0; + CursorTy pvrtmp_7274 = tmp_struct_164.field1; + CursorTy pvrtmp_7275 = tmp_struct_164.field2; + CursorTy pvrtmp_7276 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2971 = 1; + + CursorTy writetag_4994 = loc_2971 + 1; + + *(IntTy *) writetag_4994 = tmpval_7271; + + CursorTy writecur_4995 = writetag_4994 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7273, pvrtmp_7274, + loc_2971, pvrtmp_7276}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7285 = *(CursorTy *) tmpcur_7266; + CursorTy tmpaftercur_7286 = tmpcur_7266 + 8; + CursorTy jump_4350 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2972, end_r_2973, loc_2971, tmpcur_7285); + CursorTy pvrtmp_7287 = tmp_struct_165.field0; + CursorTy pvrtmp_7288 = tmp_struct_165.field1; + CursorTy pvrtmp_7289 = tmp_struct_165.field2; + CursorTy pvrtmp_7290 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7287, jump_4350, + pvrtmp_7289, pvrtmp_7290}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7297 = *(CursorTy *) tmpcur_7266; + CursorTy tmpaftercur_7298 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2972, end_r_2973, loc_2971, tmpcur_7297); + CursorTy pvrtmp_7299 = tmp_struct_166.field0; + CursorTy pvrtmp_7300 = tmp_struct_166.field1; + CursorTy pvrtmp_7301 = tmp_struct_166.field2; + CursorTy pvrtmp_7302 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7299, pvrtmp_7300, + pvrtmp_7301, pvrtmp_7302}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7265"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2976, + CursorTy end_r_2977, + CursorTy loc_2975, + CursorTy arg_875_1480_1805) +{ + CursorTy loc_3693 = loc_2975 + 1; + CursorTy loc_3694 = loc_3693 + 8; + TagTyPacked tmpval_7310 = *(TagTyPacked *) arg_875_1480_1805; + CursorTy tmpcur_7311 = arg_875_1480_1805 + 1; + + + switch_7354: + ; + switch (tmpval_7310) { + + case 0: + { + CursorTy jump_4198 = arg_875_1480_1805 + 1; + + *(TagTyPacked *) loc_2975 = 0; + + CursorTy writetag_5005 = loc_2975 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2977, jump_4198, + loc_2975, writetag_5005}; + break; + } + + case 1: + { + IntTy tmpval_7316 = *(IntTy *) tmpcur_7311; + CursorTy tmpcur_7317 = tmpcur_7311 + sizeof(IntTy); + CursorTy jump_4200 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_3694, tmpcur_7317); + CursorTy pvrtmp_7318 = tmp_struct_170.field0; + CursorTy pvrtmp_7319 = tmp_struct_170.field1; + CursorTy pvrtmp_7320 = tmp_struct_170.field2; + CursorTy pvrtmp_7321 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2975 = 1; + + CursorTy writetag_5010 = loc_2975 + 1; + + *(IntTy *) writetag_5010 = tmpval_7316; + + CursorTy writecur_5011 = writetag_5010 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7318, pvrtmp_7319, + loc_2975, pvrtmp_7321}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7330 = *(CursorTy *) tmpcur_7311; + CursorTy tmpaftercur_7331 = tmpcur_7311 + 8; + CursorTy jump_4356 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_2975, tmpcur_7330); + CursorTy pvrtmp_7332 = tmp_struct_171.field0; + CursorTy pvrtmp_7333 = tmp_struct_171.field1; + CursorTy pvrtmp_7334 = tmp_struct_171.field2; + CursorTy pvrtmp_7335 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7332, jump_4356, + pvrtmp_7334, pvrtmp_7335}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7342 = *(CursorTy *) tmpcur_7311; + CursorTy tmpaftercur_7343 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_2975, tmpcur_7342); + CursorTy pvrtmp_7344 = tmp_struct_172.field0; + CursorTy pvrtmp_7345 = tmp_struct_172.field1; + CursorTy pvrtmp_7346 = tmp_struct_172.field2; + CursorTy pvrtmp_7347 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7344, pvrtmp_7345, + pvrtmp_7346, pvrtmp_7347}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7310"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2979, CursorTy arg_880_1485_1810) +{ + TagTyPacked tmpval_7355 = *(TagTyPacked *) arg_880_1485_1810; + CursorTy tmpcur_7356 = arg_880_1485_1810 + 1; + + + switch_7366: + ; + switch (tmpval_7355) { + + case 0: + { + CursorTy jump_4203 = arg_880_1485_1810 + 1; + + return (CursorProd) {jump_4203}; + break; + } + + case 1: + { + IntTy tmpval_7357 = *(IntTy *) tmpcur_7356; + CursorTy tmpcur_7358 = tmpcur_7356 + sizeof(IntTy); + CursorTy jump_4205 = tmpcur_7356 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2979, tmpcur_7358); + CursorTy pvrtmp_7359 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7359}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7360 = *(CursorTy *) tmpcur_7356; + CursorTy tmpaftercur_7361 = tmpcur_7356 + 8; + CursorTy jump_4362 = tmpcur_7356 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2979, tmpcur_7360); + CursorTy pvrtmp_7362 = tmp_struct_174.field0; + + return (CursorProd) {jump_4362}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7363 = *(CursorTy *) tmpcur_7356; + CursorTy tmpaftercur_7364 = tmpcur_7356 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2979, tmpcur_7363); + CursorTy pvrtmp_7365 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7365}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7355"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2981, CursorTy arg_885_1489_1814) +{ + TagTyPacked tmpval_7367 = *(TagTyPacked *) arg_885_1489_1814; + CursorTy tmpcur_7368 = arg_885_1489_1814 + 1; + + + switch_7378: + ; + switch (tmpval_7367) { + + case 0: + { + CursorTy jump_4208 = arg_885_1489_1814 + 1; + unsigned char wildcard_886_1490_1815 = print_symbol(6159); + unsigned char wildcard_887_1491_1816 = print_symbol(6154); + + return (CursorProd) {jump_4208}; + break; + } + + case 1: + { + IntTy tmpval_7369 = *(IntTy *) tmpcur_7368; + CursorTy tmpcur_7370 = tmpcur_7368 + sizeof(IntTy); + CursorTy jump_4210 = tmpcur_7368 + 8; + unsigned char wildcard_892_1494_1819 = print_symbol(6156); + unsigned char y_890_1495_1820 = printf("%lld", tmpval_7369); + CursorProd tmp_struct_176 = _print_Tags(end_r_2981, tmpcur_7370); + CursorTy pvrtmp_7371 = tmp_struct_176.field0; + unsigned char wildcard_893_1497_1822 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7371}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7372 = *(CursorTy *) tmpcur_7368; + CursorTy tmpaftercur_7373 = tmpcur_7368 + 8; + CursorTy jump_4368 = tmpcur_7368 + 8; + unsigned char wildcard_4371 = print_symbol(6171); + CursorProd tmp_struct_177 = _print_Tags(end_r_2981, tmpcur_7372); + CursorTy pvrtmp_7374 = tmp_struct_177.field0; + + return (CursorProd) {jump_4368}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7375 = *(CursorTy *) tmpcur_7368; + CursorTy tmpaftercur_7376 = tmpcur_7368 + 8; + unsigned char wildcard_4371 = print_symbol(6170); + CursorProd tmp_struct_178 = _print_Tags(end_r_2981, tmpcur_7375); + CursorTy pvrtmp_7377 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7377}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7367"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2984, + CursorTy end_r_2985, + CursorTy loc_2983, + CursorTy arg_2716) +{ + if (loc_2983 + 32 > end_r_2985) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2985); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2985 = chunk_end_184; + *(TagTyPacked *) loc_2983 = 255; + + CursorTy redir = loc_2983 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2983 = chunk_start_183; + } + + CursorTy loc_3718 = loc_2983 + 1; + CursorTy loc_3719 = loc_3718 + 8; + TagTyPacked tmpval_7379 = *(TagTyPacked *) arg_2716; + CursorTy tmpcur_7380 = arg_2716 + 1; + + + switch_7423: + ; + switch (tmpval_7379) { + + case 0: + { + CursorTy jump_4213 = arg_2716 + 1; + + *(TagTyPacked *) loc_2983 = 0; + + CursorTy writetag_5041 = loc_2983 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2985, jump_4213, + loc_2983, writetag_5041}; + break; + } + + case 1: + { + IntTy tmpval_7385 = *(IntTy *) tmpcur_7380; + CursorTy tmpcur_7386 = tmpcur_7380 + sizeof(IntTy); + CursorTy jump_4215 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_3719, tmpcur_7386); + CursorTy pvrtmp_7387 = tmp_struct_179.field0; + CursorTy pvrtmp_7388 = tmp_struct_179.field1; + CursorTy pvrtmp_7389 = tmp_struct_179.field2; + CursorTy pvrtmp_7390 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2983 = 1; + + CursorTy writetag_5046 = loc_2983 + 1; + + *(IntTy *) writetag_5046 = tmpval_7385; + + CursorTy writecur_5047 = writetag_5046 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7387, pvrtmp_7388, + loc_2983, pvrtmp_7390}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7399 = *(CursorTy *) tmpcur_7380; + CursorTy tmpaftercur_7400 = tmpcur_7380 + 8; + CursorTy jump_4374 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_2983, tmpcur_7399); + CursorTy pvrtmp_7401 = tmp_struct_180.field0; + CursorTy pvrtmp_7402 = tmp_struct_180.field1; + CursorTy pvrtmp_7403 = tmp_struct_180.field2; + CursorTy pvrtmp_7404 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7401, jump_4374, + pvrtmp_7403, pvrtmp_7404}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7411 = *(CursorTy *) tmpcur_7380; + CursorTy tmpaftercur_7412 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_2983, tmpcur_7411); + CursorTy pvrtmp_7413 = tmp_struct_181.field0; + CursorTy pvrtmp_7414 = tmp_struct_181.field1; + CursorTy pvrtmp_7415 = tmp_struct_181.field2; + CursorTy pvrtmp_7416 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7413, pvrtmp_7414, + pvrtmp_7415, pvrtmp_7416}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7379"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2988, + CursorTy end_r_2989, + CursorTy loc_2987, + CursorTy arg_2721) +{ + if (loc_2987 + 32 > end_r_2989) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2989); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2989 = chunk_end_191; + *(TagTyPacked *) loc_2987 = 255; + + CursorTy redir = loc_2987 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2987 = chunk_start_190; + } + + TagTyPacked tmpval_7424 = *(TagTyPacked *) arg_2721; + CursorTy tmpcur_7425 = arg_2721 + 1; + + + switch_7474: + ; + switch (tmpval_7424) { + + case 0: + { + CursorTy loc_3729 = loc_2987 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2988, end_r_2989, loc_3729, tmpcur_7425); + CursorTy pvrtmp_7426 = tmp_struct_185.field0; + CursorTy pvrtmp_7427 = tmp_struct_185.field1; + CursorTy pvrtmp_7428 = tmp_struct_185.field2; + CursorTy pvrtmp_7429 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2987 = 0; + + CursorTy writetag_5058 = loc_2987 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7426, pvrtmp_7427, + loc_2987, pvrtmp_7429}; + break; + } + + case 1: + { + CursorTy loc_3735 = loc_2987 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2988, end_r_2989, loc_3735, tmpcur_7425); + CursorTy pvrtmp_7438 = tmp_struct_186.field0; + CursorTy pvrtmp_7439 = tmp_struct_186.field1; + CursorTy pvrtmp_7440 = tmp_struct_186.field2; + CursorTy pvrtmp_7441 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2987 = 1; + + CursorTy writetag_5063 = loc_2987 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7438, pvrtmp_7439, + loc_2987, pvrtmp_7441}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7450 = *(CursorTy *) tmpcur_7425; + CursorTy tmpaftercur_7451 = tmpcur_7425 + 8; + CursorTy jump_4380 = tmpcur_7425 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2988, end_r_2989, loc_2987, tmpcur_7450); + CursorTy pvrtmp_7452 = tmp_struct_187.field0; + CursorTy pvrtmp_7453 = tmp_struct_187.field1; + CursorTy pvrtmp_7454 = tmp_struct_187.field2; + CursorTy pvrtmp_7455 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7452, jump_4380, + pvrtmp_7454, pvrtmp_7455}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7462 = *(CursorTy *) tmpcur_7425; + CursorTy tmpaftercur_7463 = tmpcur_7425 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2988, end_r_2989, loc_2987, tmpcur_7462); + CursorTy pvrtmp_7464 = tmp_struct_188.field0; + CursorTy pvrtmp_7465 = tmp_struct_188.field1; + CursorTy pvrtmp_7466 = tmp_struct_188.field2; + CursorTy pvrtmp_7467 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7464, pvrtmp_7465, + pvrtmp_7466, pvrtmp_7467}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7424"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2992, + CursorTy end_r_2993, + CursorTy loc_2991, + CursorTy arg_2726) +{ + if (loc_2991 + 32 > end_r_2993) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2993); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2993 = chunk_end_218; + *(TagTyPacked *) loc_2991 = 255; + + CursorTy redir = loc_2991 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2991 = chunk_start_217; + } + + CursorTy loc_3748 = loc_2991 + 1; + CursorTy loc_3749 = loc_3748 + 8; + CursorTy loc_3750 = loc_3749 + 8; + CursorTy loc_3766 = loc_2991 + 1; + CursorTy loc_3767 = loc_3766 + 8; + CursorTy loc_3768 = loc_3767 + 8; + CursorTy loc_3788 = loc_2991 + 1; + CursorTy loc_3789 = loc_3788 + 8; + CursorTy loc_3790 = loc_3789 + 8; + CursorTy loc_3791 = loc_3790 + 8; + CursorTy loc_3815 = loc_2991 + 1; + CursorTy loc_3816 = loc_3815 + 8; + CursorTy loc_3817 = loc_3816 + 8; + CursorTy loc_3818 = loc_3817 + 8; + CursorTy loc_3842 = loc_2991 + 1; + CursorTy loc_3843 = loc_3842 + 8; + CursorTy loc_3844 = loc_3843 + 8; + CursorTy loc_3845 = loc_3844 + 8; + CursorTy loc_3869 = loc_2991 + 1; + CursorTy loc_3870 = loc_3869 + 8; + CursorTy loc_3871 = loc_3870 + 8; + CursorTy loc_3872 = loc_3871 + 8; + CursorTy loc_3896 = loc_2991 + 1; + CursorTy loc_3897 = loc_3896 + 8; + CursorTy loc_3898 = loc_3897 + 8; + CursorTy loc_3899 = loc_3898 + 8; + CursorTy loc_3923 = loc_2991 + 1; + CursorTy loc_3924 = loc_3923 + 8; + CursorTy loc_3925 = loc_3924 + 8; + CursorTy loc_3926 = loc_3925 + 8; + TagTyPacked tmpval_7475 = *(TagTyPacked *) arg_2726; + CursorTy tmpcur_7476 = arg_2726 + 1; + + + switch_7713: + ; + switch (tmpval_7475) { + + case 0: + { + CursorTy jump_4222 = arg_2726 + 1; + + *(TagTyPacked *) loc_2991 = 0; + + CursorTy writetag_5073 = loc_2991 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2993, jump_4222, + loc_2991, writetag_5073}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3750, tmpcur_7476); + CursorTy pvrtmp_7481 = tmp_struct_192.field0; + CursorTy pvrtmp_7482 = tmp_struct_192.field1; + CursorTy pvrtmp_7483 = tmp_struct_192.field2; + CursorTy pvrtmp_7484 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7481, pvrtmp_7484, pvrtmp_7482); + CursorTy pvrtmp_7489 = tmp_struct_193.field0; + CursorTy pvrtmp_7490 = tmp_struct_193.field1; + CursorTy pvrtmp_7491 = tmp_struct_193.field2; + CursorTy pvrtmp_7492 = tmp_struct_193.field3; + IntTy sizeof_y_2729__2731 = pvrtmp_7484 - pvrtmp_7483; + IntTy sizeof_y_2730__2732 = pvrtmp_7492 - pvrtmp_7491; + IntTy fltPrm_2820 = sizeof_y_2729__2731 + 0; + IntTy offset__2733 = 0 + fltPrm_2820; + IntTy fltPrm_2821 = sizeof_y_2729__2731 + sizeof_y_2730__2732; + IntTy size_dcon_2734 = 9 + fltPrm_2821; + + *(TagTyPacked *) loc_2991 = 160; + + CursorTy writetag_5078 = loc_2991 + 1; + + *(IntTy *) writetag_5078 = size_dcon_2734; + + CursorTy writecur_5079 = writetag_5078 + sizeof(IntTy); + + *(IntTy *) writecur_5079 = offset__2733; + + CursorTy writecur_5080 = writecur_5079 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7489, pvrtmp_7490, + loc_2991, pvrtmp_7492}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3768, tmpcur_7476); + CursorTy pvrtmp_7501 = tmp_struct_194.field0; + CursorTy pvrtmp_7502 = tmp_struct_194.field1; + CursorTy pvrtmp_7503 = tmp_struct_194.field2; + CursorTy pvrtmp_7504 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7501, pvrtmp_7504, pvrtmp_7502); + CursorTy pvrtmp_7509 = tmp_struct_195.field0; + CursorTy pvrtmp_7510 = tmp_struct_195.field1; + CursorTy pvrtmp_7511 = tmp_struct_195.field2; + CursorTy pvrtmp_7512 = tmp_struct_195.field3; + IntTy sizeof_y_2737__2739 = pvrtmp_7504 - pvrtmp_7503; + IntTy sizeof_y_2738__2740 = pvrtmp_7512 - pvrtmp_7511; + IntTy fltPrm_2822 = sizeof_y_2737__2739 + 0; + IntTy offset__2741 = 0 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2737__2739 + sizeof_y_2738__2740; + IntTy size_dcon_2742 = 9 + fltPrm_2823; + + *(TagTyPacked *) loc_2991 = 162; + + CursorTy writetag_5087 = loc_2991 + 1; + + *(IntTy *) writetag_5087 = size_dcon_2742; + + CursorTy writecur_5088 = writetag_5087 + sizeof(IntTy); + + *(IntTy *) writecur_5088 = offset__2741; + + CursorTy writecur_5089 = writecur_5088 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7509, pvrtmp_7510, + loc_2991, pvrtmp_7512}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2992, end_r_2993, loc_3791, tmpcur_7476); + CursorTy pvrtmp_7521 = tmp_struct_196.field0; + CursorTy pvrtmp_7522 = tmp_struct_196.field1; + CursorTy pvrtmp_7523 = tmp_struct_196.field2; + CursorTy pvrtmp_7524 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7521, pvrtmp_7524, pvrtmp_7522); + CursorTy pvrtmp_7529 = tmp_struct_197.field0; + CursorTy pvrtmp_7530 = tmp_struct_197.field1; + CursorTy pvrtmp_7531 = tmp_struct_197.field2; + CursorTy pvrtmp_7532 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7529, pvrtmp_7532, pvrtmp_7530); + CursorTy pvrtmp_7537 = tmp_struct_198.field0; + CursorTy pvrtmp_7538 = tmp_struct_198.field1; + CursorTy pvrtmp_7539 = tmp_struct_198.field2; + CursorTy pvrtmp_7540 = tmp_struct_198.field3; + IntTy sizeof_y_2746__2749 = pvrtmp_7524 - pvrtmp_7523; + IntTy sizeof_y_2747__2750 = pvrtmp_7532 - pvrtmp_7531; + IntTy sizeof_y_2748__2751 = pvrtmp_7540 - pvrtmp_7539; + IntTy fltPrm_2824 = sizeof_y_2746__2749 + 0; + IntTy offset__2752 = 8 + fltPrm_2824; + IntTy fltPrm_2825 = sizeof_y_2746__2749 + sizeof_y_2747__2750; + IntTy offset__2753 = 0 + fltPrm_2825; + IntTy fltPrm_2827 = sizeof_y_2747__2750 + sizeof_y_2748__2751; + IntTy fltPrm_2826 = sizeof_y_2746__2749 + fltPrm_2827; + IntTy size_dcon_2754 = 17 + fltPrm_2826; + + *(TagTyPacked *) loc_2991 = 164; + + CursorTy writetag_5097 = loc_2991 + 1; + + *(IntTy *) writetag_5097 = size_dcon_2754; + + CursorTy writecur_5098 = writetag_5097 + sizeof(IntTy); + + *(IntTy *) writecur_5098 = offset__2752; + + CursorTy writecur_5099 = writecur_5098 + sizeof(IntTy); + + *(IntTy *) writecur_5099 = offset__2753; + + CursorTy writecur_5100 = writecur_5099 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7537, pvrtmp_7538, + loc_2991, pvrtmp_7540}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3818, tmpcur_7476); + CursorTy pvrtmp_7549 = tmp_struct_199.field0; + CursorTy pvrtmp_7550 = tmp_struct_199.field1; + CursorTy pvrtmp_7551 = tmp_struct_199.field2; + CursorTy pvrtmp_7552 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7549, pvrtmp_7552, pvrtmp_7550); + CursorTy pvrtmp_7557 = tmp_struct_200.field0; + CursorTy pvrtmp_7558 = tmp_struct_200.field1; + CursorTy pvrtmp_7559 = tmp_struct_200.field2; + CursorTy pvrtmp_7560 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7557, pvrtmp_7560, pvrtmp_7558); + CursorTy pvrtmp_7565 = tmp_struct_201.field0; + CursorTy pvrtmp_7566 = tmp_struct_201.field1; + CursorTy pvrtmp_7567 = tmp_struct_201.field2; + CursorTy pvrtmp_7568 = tmp_struct_201.field3; + IntTy sizeof_y_2758__2761 = pvrtmp_7552 - pvrtmp_7551; + IntTy sizeof_y_2759__2762 = pvrtmp_7560 - pvrtmp_7559; + IntTy sizeof_y_2760__2763 = pvrtmp_7568 - pvrtmp_7567; + IntTy fltPrm_2828 = sizeof_y_2758__2761 + 0; + IntTy offset__2764 = 8 + fltPrm_2828; + IntTy fltPrm_2829 = sizeof_y_2758__2761 + sizeof_y_2759__2762; + IntTy offset__2765 = 0 + fltPrm_2829; + IntTy fltPrm_2831 = sizeof_y_2759__2762 + sizeof_y_2760__2763; + IntTy fltPrm_2830 = sizeof_y_2758__2761 + fltPrm_2831; + IntTy size_dcon_2766 = 17 + fltPrm_2830; + + *(TagTyPacked *) loc_2991 = 166; + + CursorTy writetag_5109 = loc_2991 + 1; + + *(IntTy *) writetag_5109 = size_dcon_2766; + + CursorTy writecur_5110 = writetag_5109 + sizeof(IntTy); + + *(IntTy *) writecur_5110 = offset__2764; + + CursorTy writecur_5111 = writecur_5110 + sizeof(IntTy); + + *(IntTy *) writecur_5111 = offset__2765; + + CursorTy writecur_5112 = writecur_5111 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7565, pvrtmp_7566, + loc_2991, pvrtmp_7568}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2992, end_r_2993, loc_3845, tmpcur_7476); + CursorTy pvrtmp_7577 = tmp_struct_202.field0; + CursorTy pvrtmp_7578 = tmp_struct_202.field1; + CursorTy pvrtmp_7579 = tmp_struct_202.field2; + CursorTy pvrtmp_7580 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7577, pvrtmp_7580, pvrtmp_7578); + CursorTy pvrtmp_7585 = tmp_struct_203.field0; + CursorTy pvrtmp_7586 = tmp_struct_203.field1; + CursorTy pvrtmp_7587 = tmp_struct_203.field2; + CursorTy pvrtmp_7588 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7585, pvrtmp_7588, pvrtmp_7586); + CursorTy pvrtmp_7593 = tmp_struct_204.field0; + CursorTy pvrtmp_7594 = tmp_struct_204.field1; + CursorTy pvrtmp_7595 = tmp_struct_204.field2; + CursorTy pvrtmp_7596 = tmp_struct_204.field3; + IntTy sizeof_y_2770__2773 = pvrtmp_7580 - pvrtmp_7579; + IntTy sizeof_y_2771__2774 = pvrtmp_7588 - pvrtmp_7587; + IntTy sizeof_y_2772__2775 = pvrtmp_7596 - pvrtmp_7595; + IntTy fltPrm_2832 = sizeof_y_2770__2773 + 0; + IntTy offset__2776 = 8 + fltPrm_2832; + IntTy fltPrm_2833 = sizeof_y_2770__2773 + sizeof_y_2771__2774; + IntTy offset__2777 = 0 + fltPrm_2833; + IntTy fltPrm_2835 = sizeof_y_2771__2774 + sizeof_y_2772__2775; + IntTy fltPrm_2834 = sizeof_y_2770__2773 + fltPrm_2835; + IntTy size_dcon_2778 = 17 + fltPrm_2834; + + *(TagTyPacked *) loc_2991 = 168; + + CursorTy writetag_5121 = loc_2991 + 1; + + *(IntTy *) writetag_5121 = size_dcon_2778; + + CursorTy writecur_5122 = writetag_5121 + sizeof(IntTy); + + *(IntTy *) writecur_5122 = offset__2776; + + CursorTy writecur_5123 = writecur_5122 + sizeof(IntTy); + + *(IntTy *) writecur_5123 = offset__2777; + + CursorTy writecur_5124 = writecur_5123 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7593, pvrtmp_7594, + loc_2991, pvrtmp_7596}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3872, tmpcur_7476); + CursorTy pvrtmp_7605 = tmp_struct_205.field0; + CursorTy pvrtmp_7606 = tmp_struct_205.field1; + CursorTy pvrtmp_7607 = tmp_struct_205.field2; + CursorTy pvrtmp_7608 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7605, pvrtmp_7608, pvrtmp_7606); + CursorTy pvrtmp_7613 = tmp_struct_206.field0; + CursorTy pvrtmp_7614 = tmp_struct_206.field1; + CursorTy pvrtmp_7615 = tmp_struct_206.field2; + CursorTy pvrtmp_7616 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7613, pvrtmp_7616, pvrtmp_7614); + CursorTy pvrtmp_7621 = tmp_struct_207.field0; + CursorTy pvrtmp_7622 = tmp_struct_207.field1; + CursorTy pvrtmp_7623 = tmp_struct_207.field2; + CursorTy pvrtmp_7624 = tmp_struct_207.field3; + IntTy sizeof_y_2782__2785 = pvrtmp_7608 - pvrtmp_7607; + IntTy sizeof_y_2783__2786 = pvrtmp_7616 - pvrtmp_7615; + IntTy sizeof_y_2784__2787 = pvrtmp_7624 - pvrtmp_7623; + IntTy fltPrm_2836 = sizeof_y_2782__2785 + 0; + IntTy offset__2788 = 8 + fltPrm_2836; + IntTy fltPrm_2837 = sizeof_y_2782__2785 + sizeof_y_2783__2786; + IntTy offset__2789 = 0 + fltPrm_2837; + IntTy fltPrm_2839 = sizeof_y_2783__2786 + sizeof_y_2784__2787; + IntTy fltPrm_2838 = sizeof_y_2782__2785 + fltPrm_2839; + IntTy size_dcon_2790 = 17 + fltPrm_2838; + + *(TagTyPacked *) loc_2991 = 170; + + CursorTy writetag_5133 = loc_2991 + 1; + + *(IntTy *) writetag_5133 = size_dcon_2790; + + CursorTy writecur_5134 = writetag_5133 + sizeof(IntTy); + + *(IntTy *) writecur_5134 = offset__2788; + + CursorTy writecur_5135 = writecur_5134 + sizeof(IntTy); + + *(IntTy *) writecur_5135 = offset__2789; + + CursorTy writecur_5136 = writecur_5135 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7621, pvrtmp_7622, + loc_2991, pvrtmp_7624}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3899, tmpcur_7476); + CursorTy pvrtmp_7633 = tmp_struct_208.field0; + CursorTy pvrtmp_7634 = tmp_struct_208.field1; + CursorTy pvrtmp_7635 = tmp_struct_208.field2; + CursorTy pvrtmp_7636 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7633, pvrtmp_7636, pvrtmp_7634); + CursorTy pvrtmp_7641 = tmp_struct_209.field0; + CursorTy pvrtmp_7642 = tmp_struct_209.field1; + CursorTy pvrtmp_7643 = tmp_struct_209.field2; + CursorTy pvrtmp_7644 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7641, pvrtmp_7644, pvrtmp_7642); + CursorTy pvrtmp_7649 = tmp_struct_210.field0; + CursorTy pvrtmp_7650 = tmp_struct_210.field1; + CursorTy pvrtmp_7651 = tmp_struct_210.field2; + CursorTy pvrtmp_7652 = tmp_struct_210.field3; + IntTy sizeof_y_2794__2797 = pvrtmp_7636 - pvrtmp_7635; + IntTy sizeof_y_2795__2798 = pvrtmp_7644 - pvrtmp_7643; + IntTy sizeof_y_2796__2799 = pvrtmp_7652 - pvrtmp_7651; + IntTy fltPrm_2840 = sizeof_y_2794__2797 + 0; + IntTy offset__2800 = 8 + fltPrm_2840; + IntTy fltPrm_2841 = sizeof_y_2794__2797 + sizeof_y_2795__2798; + IntTy offset__2801 = 0 + fltPrm_2841; + IntTy fltPrm_2843 = sizeof_y_2795__2798 + sizeof_y_2796__2799; + IntTy fltPrm_2842 = sizeof_y_2794__2797 + fltPrm_2843; + IntTy size_dcon_2802 = 17 + fltPrm_2842; + + *(TagTyPacked *) loc_2991 = 172; + + CursorTy writetag_5145 = loc_2991 + 1; + + *(IntTy *) writetag_5145 = size_dcon_2802; + + CursorTy writecur_5146 = writetag_5145 + sizeof(IntTy); + + *(IntTy *) writecur_5146 = offset__2800; + + CursorTy writecur_5147 = writecur_5146 + sizeof(IntTy); + + *(IntTy *) writecur_5147 = offset__2801; + + CursorTy writecur_5148 = writecur_5147 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7649, pvrtmp_7650, + loc_2991, pvrtmp_7652}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3926, tmpcur_7476); + CursorTy pvrtmp_7661 = tmp_struct_211.field0; + CursorTy pvrtmp_7662 = tmp_struct_211.field1; + CursorTy pvrtmp_7663 = tmp_struct_211.field2; + CursorTy pvrtmp_7664 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7661, pvrtmp_7664, pvrtmp_7662); + CursorTy pvrtmp_7669 = tmp_struct_212.field0; + CursorTy pvrtmp_7670 = tmp_struct_212.field1; + CursorTy pvrtmp_7671 = tmp_struct_212.field2; + CursorTy pvrtmp_7672 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7669, pvrtmp_7672, pvrtmp_7670); + CursorTy pvrtmp_7677 = tmp_struct_213.field0; + CursorTy pvrtmp_7678 = tmp_struct_213.field1; + CursorTy pvrtmp_7679 = tmp_struct_213.field2; + CursorTy pvrtmp_7680 = tmp_struct_213.field3; + IntTy sizeof_y_2806__2809 = pvrtmp_7664 - pvrtmp_7663; + IntTy sizeof_y_2807__2810 = pvrtmp_7672 - pvrtmp_7671; + IntTy sizeof_y_2808__2811 = pvrtmp_7680 - pvrtmp_7679; + IntTy fltPrm_2844 = sizeof_y_2806__2809 + 0; + IntTy offset__2812 = 8 + fltPrm_2844; + IntTy fltPrm_2845 = sizeof_y_2806__2809 + sizeof_y_2807__2810; + IntTy offset__2813 = 0 + fltPrm_2845; + IntTy fltPrm_2847 = sizeof_y_2807__2810 + sizeof_y_2808__2811; + IntTy fltPrm_2846 = sizeof_y_2806__2809 + fltPrm_2847; + IntTy size_dcon_2814 = 17 + fltPrm_2846; + + *(TagTyPacked *) loc_2991 = 174; + + CursorTy writetag_5157 = loc_2991 + 1; + + *(IntTy *) writetag_5157 = size_dcon_2814; + + CursorTy writecur_5158 = writetag_5157 + sizeof(IntTy); + + *(IntTy *) writecur_5158 = offset__2812; + + CursorTy writecur_5159 = writecur_5158 + sizeof(IntTy); + + *(IntTy *) writecur_5159 = offset__2813; + + CursorTy writecur_5160 = writecur_5159 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7677, pvrtmp_7678, + loc_2991, pvrtmp_7680}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7689 = *(CursorTy *) tmpcur_7476; + CursorTy tmpaftercur_7690 = tmpcur_7476 + 8; + CursorTy jump_4386 = tmpcur_7476 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_2991, tmpcur_7689); + CursorTy pvrtmp_7691 = tmp_struct_214.field0; + CursorTy pvrtmp_7692 = tmp_struct_214.field1; + CursorTy pvrtmp_7693 = tmp_struct_214.field2; + CursorTy pvrtmp_7694 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7691, jump_4386, + pvrtmp_7693, pvrtmp_7694}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7701 = *(CursorTy *) tmpcur_7476; + CursorTy tmpaftercur_7702 = tmpcur_7476 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_2991, tmpcur_7701); + CursorTy pvrtmp_7703 = tmp_struct_215.field0; + CursorTy pvrtmp_7704 = tmp_struct_215.field1; + CursorTy pvrtmp_7705 = tmp_struct_215.field2; + CursorTy pvrtmp_7706 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7703, pvrtmp_7704, + pvrtmp_7705, pvrtmp_7706}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7475"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2996, + CursorTy end_r_2997, + CursorTy loc_2995, + CursorTy arg_2815) +{ + if (loc_2995 + 32 > end_r_2997) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2997); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2997 = chunk_end_224; + *(TagTyPacked *) loc_2995 = 255; + + CursorTy redir = loc_2995 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2995 = chunk_start_223; + } + + CursorTy loc_3946 = loc_2995 + 1; + CursorTy loc_3947 = loc_3946 + 8; + TagTyPacked tmpval_7714 = *(TagTyPacked *) arg_2815; + CursorTy tmpcur_7715 = arg_2815 + 1; + + + switch_7758: + ; + switch (tmpval_7714) { + + case 0: + { + CursorTy jump_4254 = arg_2815 + 1; + + *(TagTyPacked *) loc_2995 = 0; + + CursorTy writetag_5172 = loc_2995 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2997, jump_4254, + loc_2995, writetag_5172}; + break; + } + + case 1: + { + IntTy tmpval_7720 = *(IntTy *) tmpcur_7715; + CursorTy tmpcur_7721 = tmpcur_7715 + sizeof(IntTy); + CursorTy jump_4256 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_3947, tmpcur_7721); + CursorTy pvrtmp_7722 = tmp_struct_219.field0; + CursorTy pvrtmp_7723 = tmp_struct_219.field1; + CursorTy pvrtmp_7724 = tmp_struct_219.field2; + CursorTy pvrtmp_7725 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2995 = 1; + + CursorTy writetag_5177 = loc_2995 + 1; + + *(IntTy *) writetag_5177 = tmpval_7720; + + CursorTy writecur_5178 = writetag_5177 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7722, pvrtmp_7723, + loc_2995, pvrtmp_7725}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7734 = *(CursorTy *) tmpcur_7715; + CursorTy tmpaftercur_7735 = tmpcur_7715 + 8; + CursorTy jump_4392 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_2995, tmpcur_7734); + CursorTy pvrtmp_7736 = tmp_struct_220.field0; + CursorTy pvrtmp_7737 = tmp_struct_220.field1; + CursorTy pvrtmp_7738 = tmp_struct_220.field2; + CursorTy pvrtmp_7739 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7736, jump_4392, + pvrtmp_7738, pvrtmp_7739}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7746 = *(CursorTy *) tmpcur_7715; + CursorTy tmpaftercur_7747 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_2995, tmpcur_7746); + CursorTy pvrtmp_7748 = tmp_struct_221.field0; + CursorTy pvrtmp_7749 = tmp_struct_221.field1; + CursorTy pvrtmp_7750 = tmp_struct_221.field2; + CursorTy pvrtmp_7751 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7748, pvrtmp_7749, + pvrtmp_7750, pvrtmp_7751}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7714"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6154, ")"); + add_symbol(6155, "(Text "); + add_symbol(6156, "(Tag "); + add_symbol(6157, "(TCA "); + add_symbol(6158, "(TAC "); + add_symbol(6159, "(Nul "); + add_symbol(6160, "(Nil "); + add_symbol(6161, "(Image "); + add_symbol(6162, "(End "); + add_symbol(6163, "(Char "); + add_symbol(6164, "(CTA "); + add_symbol(6165, "(CAT "); + add_symbol(6166, "(CA "); + add_symbol(6167, "(ATC "); + add_symbol(6168, "(ACT "); + add_symbol(6169, "(AC "); + add_symbol(6170, " ->r "); + add_symbol(6171, " ->i "); + + RegionTy *region_6172 = alloc_region(global_init_inf_buf_size); + CursorTy r_3007 = region_6172->reg_heap; + IntTy sizeof_end_r_3007_6173 = global_init_inf_buf_size; + CursorTy end_r_3007 = r_3007 + sizeof_end_r_3007_6173; + RegionTy *region_6174 = alloc_region(global_init_inf_buf_size); + CursorTy r_3006 = region_6174->reg_heap; + IntTy sizeof_end_r_3006_6175 = global_init_inf_buf_size; + CursorTy end_r_3006 = r_3006 + sizeof_end_r_3006_6175; + CursorCursorCursorProd tmp_struct_225 = + mkACTList(end_r_3007, r_3007, 100000, 10, 2000); + CursorTy pvrtmp_6176 = tmp_struct_225.field0; + CursorTy pvrtmp_6177 = tmp_struct_225.field1; + CursorTy pvrtmp_6178 = tmp_struct_225.field2; + CursorTy pvrtmp_6192; + CursorTy pvrtmp_6193; + CursorTy pvrtmp_6194; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6192; + struct timespec end_pvrtmp_6192; + + start_counters(); + for (long long iters_pvrtmp_6192 = 0; iters_pvrtmp_6192 < + global_iters_param; iters_pvrtmp_6192++) { + if (iters_pvrtmp_6192 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6192); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6176, end_r_3006, r_3006, pvrtmp_6177); + CursorTy pvrtmp_6183 = tmp_struct_226.field0; + CursorTy pvrtmp_6184 = tmp_struct_226.field1; + CursorTy pvrtmp_6185 = tmp_struct_226.field2; + + pvrtmp_6192 = pvrtmp_6183; + pvrtmp_6193 = pvrtmp_6184; + pvrtmp_6194 = pvrtmp_6185; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6192); + if (iters_pvrtmp_6192 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6192, + &end_pvrtmp_6192); + + vector_inplace_update(times_230, iters_pvrtmp_6192, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAtc.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAtc.c new file mode 100644 index 000000000..0e38db59f --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAtc.c @@ -0,0 +1,5070 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2914, CursorTy end_r_2915, + CursorTy loc_2913, + CursorTy adt_15_901_1518); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2918, CursorTy end_r_2919, + CursorTy loc_2917, + CursorTy tags_21_907_1525, + IntTy inVal_22_908_1526); +CursorCursorCursorProd mkATCList(CursorTy end_r_2921, CursorTy loc_2920, + IntTy len_25_911_1531, + IntTy tagLen_26_912_1532, + IntTy strLen_27_913_1533); +CursorCursorCursorProd mkString(CursorTy end_r_2923, CursorTy loc_2922, + IntTy len_180_1066_1539); +CursorCursorCursorProd mkContentText(CursorTy end_r_2925, CursorTy loc_2924, + IntTy n_194_1080_1545); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_319_1205_1547); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2930, + CursorTy end_r_2931, + CursorTy loc_2929, + CursorTy arg_623_1229_1552); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_628_1234_1557); +CursorProd _traverse_String(CursorTy end_r_2937, CursorTy arg_633_1239_1562); +CursorProd _print_String(CursorTy end_r_2939, CursorTy arg_638_1243_1566); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2942, + CursorTy end_r_2943, + CursorTy loc_2941, + CursorTy arg_647_1252_1575); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2946, + CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_652_1257_1580); +CursorProd _traverse_Content(CursorTy end_r_2949, CursorTy arg_657_1262_1585); +CursorProd _print_Content(CursorTy end_r_2951, CursorTy arg_662_1267_1590); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2954, CursorTy end_r_2955, + CursorTy loc_2953, + CursorTy arg_671_1276_1599); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2958, + CursorTy end_r_2959, + CursorTy loc_2957, + CursorTy arg_716_1321_1644); +CursorProd _traverse_Adt(CursorTy end_r_2961, CursorTy arg_761_1366_1689); +CursorProd _print_Adt(CursorTy end_r_2963, CursorTy arg_806_1411_1734); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2966, + CursorTy end_r_2967, CursorTy loc_2965, + CursorTy arg_869_1474_1797); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_874_1479_1802); +CursorProd _traverse_Tags(CursorTy end_r_2973, CursorTy arg_879_1484_1807); +CursorProd _print_Tags(CursorTy end_r_2975, CursorTy arg_884_1488_1811); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2978, CursorTy end_r_2979, + CursorTy loc_2977, CursorTy arg_2710); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2982, CursorTy end_r_2983, + CursorTy loc_2981, CursorTy arg_2715); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2986, + CursorTy end_r_2987, + CursorTy loc_2985, + CursorTy arg_2720); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2990, + CursorTy end_r_2991, + CursorTy loc_2989, + CursorTy arg_2809); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2914, CursorTy end_r_2915, + CursorTy loc_2913, + CursorTy adt_15_901_1518) +{ + if (loc_2913 + 32 > end_r_2915) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2915); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2915 = chunk_end_6; + *(TagTyPacked *) loc_2913 = 255; + + CursorTy redir = loc_2913 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2913 = chunk_start_5; + } + + CursorTy loc_3020 = loc_2913 + 1; + CursorTy loc_3021 = loc_3020 + 8; + CursorTy loc_3022 = loc_3021 + 8; + TagTyPacked tmpval_6193 = *(TagTyPacked *) adt_15_901_1518; + CursorTy tmpcur_6194 = adt_15_901_1518 + 1; + + + switch_6250: + ; + switch (tmpval_6193) { + + case 0: + { + CursorTy jump_3946 = adt_15_901_1518 + 1; + + *(TagTyPacked *) loc_2913 = 0; + + CursorTy writetag_4505 = loc_2913 + 1; + + return (CursorCursorCursorProd) {end_r_2915, loc_2913, + writetag_4505}; + break; + } + + case 19: + { + RegionTy *region_6199 = alloc_region(global_init_inf_buf_size); + CursorTy r_3032 = region_6199->reg_heap; + IntTy sizeof_end_r_3032_6200 = global_init_inf_buf_size; + CursorTy end_r_3032 = r_3032 + sizeof_end_r_3032_6200; + CursorTy tmpcur_6201 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6202 = tmpcur_6194 + 8; + CursorTy tmpcur_6203 = *(CursorTy *) tmpaftercur_6202; + CursorTy tmpaftercur_6204 = tmpaftercur_6202 + 8; + CursorTy jump_3949 = tmpaftercur_6202 + 8; + CursorTy jump_3948 = tmpcur_6194 + 8; + CursorCursorCursorCursorProd tmp_struct_0 = + addValTag(end_r_2914, end_r_3032, r_3032, tmpcur_6201, 10); + CursorTy pvrtmp_6205 = tmp_struct_0.field0; + CursorTy pvrtmp_6206 = tmp_struct_0.field1; + CursorTy pvrtmp_6207 = tmp_struct_0.field2; + CursorTy pvrtmp_6208 = tmp_struct_0.field3; + CursorCursorCursorProd tmp_struct_1 = + addValTagsAdt(end_r_2914, end_r_2915, loc_3022, tmpaftercur_6204); + CursorTy pvrtmp_6213 = tmp_struct_1.field0; + CursorTy pvrtmp_6214 = tmp_struct_1.field1; + CursorTy pvrtmp_6215 = tmp_struct_1.field2; + + *(TagTyPacked *) pvrtmp_6215 = 254; + + CursorTy writetag_4512 = pvrtmp_6215 + 1; + + *(CursorTy *) writetag_4512 = r_3032; + + CursorTy writecur_4513 = writetag_4512 + 8; + + *(TagTyPacked *) writecur_4513 = 254; + + CursorTy writetag_4515 = writecur_4513 + 1; + + *(CursorTy *) writetag_4515 = tmpcur_6203; + + CursorTy writecur_4516 = writetag_4515 + 8; + + *(TagTyPacked *) loc_2913 = 19; + + CursorTy writetag_4518 = loc_2913 + 1; + + *(CursorTy *) writetag_4518 = pvrtmp_6215; + + CursorTy writecur_4519 = writetag_4518 + 8; + + *(CursorTy *) writecur_4519 = writecur_4513; + + CursorTy writecur_4520 = writecur_4519 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6213, loc_2913, + writecur_4516}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6228 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6229 = tmpcur_6194 + 8; + CursorTy jump_4258 = tmpcur_6194 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2914, end_r_2915, loc_2913, tmpcur_6228); + CursorTy pvrtmp_6230 = tmp_struct_2.field0; + CursorTy pvrtmp_6231 = tmp_struct_2.field1; + CursorTy pvrtmp_6232 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6230, pvrtmp_6231, + pvrtmp_6232}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6239 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6240 = tmpcur_6194 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2914, end_r_2915, loc_2913, tmpcur_6239); + CursorTy pvrtmp_6241 = tmp_struct_3.field0; + CursorTy pvrtmp_6242 = tmp_struct_3.field1; + CursorTy pvrtmp_6243 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6241, pvrtmp_6242, + pvrtmp_6243}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6193"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2918, CursorTy end_r_2919, + CursorTy loc_2917, + CursorTy tags_21_907_1525, + IntTy inVal_22_908_1526) +{ + if (loc_2917 + 32 > end_r_2919) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2919); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2919 = chunk_end_12; + *(TagTyPacked *) loc_2917 = 255; + + CursorTy redir = loc_2917 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2917 = chunk_start_11; + } + + CursorTy loc_3041 = loc_2917 + 1; + CursorTy loc_3042 = loc_3041 + 8; + TagTyPacked tmpval_6251 = *(TagTyPacked *) tags_21_907_1525; + CursorTy tmpcur_6252 = tags_21_907_1525 + 1; + + + switch_6295: + ; + switch (tmpval_6251) { + + case 0: + { + CursorTy jump_3952 = tags_21_907_1525 + 1; + + *(TagTyPacked *) loc_2917 = 0; + + CursorTy writetag_4532 = loc_2917 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2919, jump_3952, + loc_2917, writetag_4532}; + break; + } + + case 1: + { + IntTy tmpval_6257 = *(IntTy *) tmpcur_6252; + CursorTy tmpcur_6258 = tmpcur_6252 + sizeof(IntTy); + CursorTy jump_3954 = tmpcur_6252 + 8; + IntTy fltPkd_1506_1529 = tmpval_6257 + inVal_22_908_1526; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2918, end_r_2919, loc_3042, tmpcur_6258, inVal_22_908_1526); + CursorTy pvrtmp_6259 = tmp_struct_7.field0; + CursorTy pvrtmp_6260 = tmp_struct_7.field1; + CursorTy pvrtmp_6261 = tmp_struct_7.field2; + CursorTy pvrtmp_6262 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2917 = 1; + + CursorTy writetag_4537 = loc_2917 + 1; + + *(IntTy *) writetag_4537 = fltPkd_1506_1529; + + CursorTy writecur_4538 = writetag_4537 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6259, pvrtmp_6260, + loc_2917, pvrtmp_6262}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6271 = *(CursorTy *) tmpcur_6252; + CursorTy tmpaftercur_6272 = tmpcur_6252 + 8; + CursorTy jump_4263 = tmpcur_6252 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2918, end_r_2919, loc_2917, tmpcur_6271, inVal_22_908_1526); + CursorTy pvrtmp_6273 = tmp_struct_8.field0; + CursorTy pvrtmp_6274 = tmp_struct_8.field1; + CursorTy pvrtmp_6275 = tmp_struct_8.field2; + CursorTy pvrtmp_6276 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6273, jump_4263, + pvrtmp_6275, pvrtmp_6276}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6283 = *(CursorTy *) tmpcur_6252; + CursorTy tmpaftercur_6284 = tmpcur_6252 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2918, end_r_2919, loc_2917, tmpcur_6283, inVal_22_908_1526); + CursorTy pvrtmp_6285 = tmp_struct_9.field0; + CursorTy pvrtmp_6286 = tmp_struct_9.field1; + CursorTy pvrtmp_6287 = tmp_struct_9.field2; + CursorTy pvrtmp_6288 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6285, pvrtmp_6286, + pvrtmp_6287, pvrtmp_6288}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6251"); + exit(1); + } + } +} +CursorCursorCursorProd mkATCList(CursorTy end_r_2921, CursorTy loc_2920, + IntTy len_25_911_1531, + IntTy tagLen_26_912_1532, + IntTy strLen_27_913_1533) +{ + if (loc_2920 + 32 > end_r_2921) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2921); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2921 = chunk_end_18; + *(TagTyPacked *) loc_2920 = 255; + + CursorTy redir = loc_2920 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2920 = chunk_start_17; + } + + CursorTy loc_3050 = loc_2920 + 1; + CursorTy loc_3051 = loc_3050 + 8; + CursorTy loc_3052 = loc_3051 + 8; + BoolTy fltIf_1508_1534 = len_25_911_1531 <= 0; + + if (fltIf_1508_1534) { + *(TagTyPacked *) loc_2920 = 0; + + CursorTy writetag_4547 = loc_2920 + 1; + + return (CursorCursorCursorProd) {end_r_2921, loc_2920, writetag_4547}; + } else { + IntTy fltAppE_1509_1535 = len_25_911_1531 - 1; + CursorCursorCursorProd tmp_struct_13 = + mkATCList(end_r_2921, loc_3052, fltAppE_1509_1535, tagLen_26_912_1532, strLen_27_913_1533); + CursorTy pvrtmp_6300 = tmp_struct_13.field0; + CursorTy pvrtmp_6301 = tmp_struct_13.field1; + CursorTy pvrtmp_6302 = tmp_struct_13.field2; + CursorCursorCursorProd tmp_struct_14 = + mkRandomTags(pvrtmp_6300, pvrtmp_6302, tagLen_26_912_1532); + CursorTy pvrtmp_6307 = tmp_struct_14.field0; + CursorTy pvrtmp_6308 = tmp_struct_14.field1; + CursorTy pvrtmp_6309 = tmp_struct_14.field2; + CursorCursorCursorProd tmp_struct_15 = + mkContentText(pvrtmp_6307, pvrtmp_6309, strLen_27_913_1533); + CursorTy pvrtmp_6314 = tmp_struct_15.field0; + CursorTy pvrtmp_6315 = tmp_struct_15.field1; + CursorTy pvrtmp_6316 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2920 = 19; + + CursorTy writetag_4552 = loc_2920 + 1; + + *(CursorTy *) writetag_4552 = pvrtmp_6302; + + CursorTy writecur_4553 = writetag_4552 + 8; + + *(CursorTy *) writecur_4553 = pvrtmp_6309; + + CursorTy writecur_4554 = writecur_4553 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6314, loc_2920, pvrtmp_6316}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2923, CursorTy loc_2922, + IntTy len_180_1066_1539) +{ + if (loc_2922 + 32 > end_r_2923) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2923); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2923 = chunk_end_22; + *(TagTyPacked *) loc_2922 = 255; + + CursorTy redir = loc_2922 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2922 = chunk_start_21; + } + + CursorTy loc_3064 = loc_2922 + 1; + CursorTy loc_3065 = loc_3064 + 8; + BoolTy fltIf_1510_1540 = len_180_1066_1539 <= 0; + + if (fltIf_1510_1540) { + *(TagTyPacked *) loc_2922 = 0; + + CursorTy writetag_4559 = loc_2922 + 1; + + return (CursorCursorCursorProd) {end_r_2923, loc_2922, writetag_4559}; + } else { + IntTy fltPrm_1511_1541 = rand(); + IntTy randomChar_181_1067_1542 = fltPrm_1511_1541 % 128; + IntTy fltAppE_1512_1543 = len_180_1066_1539 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2923, loc_3065, fltAppE_1512_1543); + CursorTy pvrtmp_6329 = tmp_struct_19.field0; + CursorTy pvrtmp_6330 = tmp_struct_19.field1; + CursorTy pvrtmp_6331 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2922 = 1; + + CursorTy writetag_4562 = loc_2922 + 1; + + *(IntTy *) writetag_4562 = randomChar_181_1067_1542; + + CursorTy writecur_4563 = writetag_4562 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6329, loc_2922, pvrtmp_6331}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2925, CursorTy loc_2924, + IntTy n_194_1080_1545) +{ + if (loc_2924 + 32 > end_r_2925) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2925); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2925 = chunk_end_26; + *(TagTyPacked *) loc_2924 = 255; + + CursorTy redir = loc_2924 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2924 = chunk_start_25; + } + + CursorTy loc_3070 = loc_2924 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2925, loc_3070, n_194_1080_1545); + CursorTy pvrtmp_6340 = tmp_struct_23.field0; + CursorTy pvrtmp_6341 = tmp_struct_23.field1; + CursorTy pvrtmp_6342 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2924 = 1; + + CursorTy writetag_4567 = loc_2924 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6340, loc_2924, pvrtmp_6342}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_319_1205_1547) +{ + if (loc_2926 + 32 > end_r_2927) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2927); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2927 = chunk_end_30; + *(TagTyPacked *) loc_2926 = 255; + + CursorTy redir = loc_2926 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2926 = chunk_start_29; + } + + CursorTy loc_3074 = loc_2926 + 1; + CursorTy loc_3075 = loc_3074 + 8; + BoolTy fltIf_1514_1548 = len_319_1205_1547 <= 0; + + if (fltIf_1514_1548) { + *(TagTyPacked *) loc_2926 = 0; + + CursorTy writetag_4570 = loc_2926 + 1; + + return (CursorCursorCursorProd) {end_r_2927, loc_2926, writetag_4570}; + } else { + IntTy fltAppE_1515_1550 = len_319_1205_1547 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2927, loc_3075, fltAppE_1515_1550); + CursorTy pvrtmp_6355 = tmp_struct_27.field0; + CursorTy pvrtmp_6356 = tmp_struct_27.field1; + CursorTy pvrtmp_6357 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2926 = 1; + + CursorTy writetag_4573 = loc_2926 + 1; + + *(IntTy *) writetag_4573 = 100; + + CursorTy writecur_4574 = writetag_4573 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6355, loc_2926, pvrtmp_6357}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2930, + CursorTy end_r_2931, + CursorTy loc_2929, + CursorTy arg_623_1229_1552) +{ + if (loc_2929 + 32 > end_r_2931) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2931); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2931 = chunk_end_36; + *(TagTyPacked *) loc_2929 = 255; + + CursorTy redir = loc_2929 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2929 = chunk_start_35; + } + + CursorTy loc_3085 = loc_2929 + 1; + CursorTy loc_3086 = loc_3085 + 8; + TagTyPacked tmpval_6366 = *(TagTyPacked *) arg_623_1229_1552; + CursorTy tmpcur_6367 = arg_623_1229_1552 + 1; + + + switch_6410: + ; + switch (tmpval_6366) { + + case 0: + { + CursorTy jump_3964 = arg_623_1229_1552 + 1; + + *(TagTyPacked *) loc_2929 = 0; + + CursorTy writetag_4578 = loc_2929 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2931, jump_3964, + loc_2929, writetag_4578}; + break; + } + + case 1: + { + IntTy tmpval_6372 = *(IntTy *) tmpcur_6367; + CursorTy tmpcur_6373 = tmpcur_6367 + sizeof(IntTy); + CursorTy jump_3966 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2930, end_r_2931, loc_3086, tmpcur_6373); + CursorTy pvrtmp_6374 = tmp_struct_31.field0; + CursorTy pvrtmp_6375 = tmp_struct_31.field1; + CursorTy pvrtmp_6376 = tmp_struct_31.field2; + CursorTy pvrtmp_6377 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2929 = 1; + + CursorTy writetag_4583 = loc_2929 + 1; + + *(IntTy *) writetag_4583 = tmpval_6372; + + CursorTy writecur_4584 = writetag_4583 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6374, pvrtmp_6375, + loc_2929, pvrtmp_6377}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6386 = *(CursorTy *) tmpcur_6367; + CursorTy tmpaftercur_6387 = tmpcur_6367 + 8; + CursorTy jump_4269 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2930, end_r_2931, loc_2929, tmpcur_6386); + CursorTy pvrtmp_6388 = tmp_struct_32.field0; + CursorTy pvrtmp_6389 = tmp_struct_32.field1; + CursorTy pvrtmp_6390 = tmp_struct_32.field2; + CursorTy pvrtmp_6391 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6388, jump_4269, + pvrtmp_6390, pvrtmp_6391}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6398 = *(CursorTy *) tmpcur_6367; + CursorTy tmpaftercur_6399 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2930, end_r_2931, loc_2929, tmpcur_6398); + CursorTy pvrtmp_6400 = tmp_struct_33.field0; + CursorTy pvrtmp_6401 = tmp_struct_33.field1; + CursorTy pvrtmp_6402 = tmp_struct_33.field2; + CursorTy pvrtmp_6403 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6400, pvrtmp_6401, + pvrtmp_6402, pvrtmp_6403}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6366"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_628_1234_1557) +{ + CursorTy loc_3098 = loc_2933 + 1; + CursorTy loc_3099 = loc_3098 + 8; + TagTyPacked tmpval_6411 = *(TagTyPacked *) arg_628_1234_1557; + CursorTy tmpcur_6412 = arg_628_1234_1557 + 1; + + + switch_6455: + ; + switch (tmpval_6411) { + + case 0: + { + CursorTy jump_3969 = arg_628_1234_1557 + 1; + + *(TagTyPacked *) loc_2933 = 0; + + CursorTy writetag_4594 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2935, jump_3969, + loc_2933, writetag_4594}; + break; + } + + case 1: + { + IntTy tmpval_6417 = *(IntTy *) tmpcur_6412; + CursorTy tmpcur_6418 = tmpcur_6412 + sizeof(IntTy); + CursorTy jump_3971 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_3099, tmpcur_6418); + CursorTy pvrtmp_6419 = tmp_struct_37.field0; + CursorTy pvrtmp_6420 = tmp_struct_37.field1; + CursorTy pvrtmp_6421 = tmp_struct_37.field2; + CursorTy pvrtmp_6422 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2933 = 1; + + CursorTy writetag_4599 = loc_2933 + 1; + + *(IntTy *) writetag_4599 = tmpval_6417; + + CursorTy writecur_4600 = writetag_4599 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6419, pvrtmp_6420, + loc_2933, pvrtmp_6422}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6431 = *(CursorTy *) tmpcur_6412; + CursorTy tmpaftercur_6432 = tmpcur_6412 + 8; + CursorTy jump_4275 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_2933, tmpcur_6431); + CursorTy pvrtmp_6433 = tmp_struct_38.field0; + CursorTy pvrtmp_6434 = tmp_struct_38.field1; + CursorTy pvrtmp_6435 = tmp_struct_38.field2; + CursorTy pvrtmp_6436 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6433, jump_4275, + pvrtmp_6435, pvrtmp_6436}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6443 = *(CursorTy *) tmpcur_6412; + CursorTy tmpaftercur_6444 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_2933, tmpcur_6443); + CursorTy pvrtmp_6445 = tmp_struct_39.field0; + CursorTy pvrtmp_6446 = tmp_struct_39.field1; + CursorTy pvrtmp_6447 = tmp_struct_39.field2; + CursorTy pvrtmp_6448 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6445, pvrtmp_6446, + pvrtmp_6447, pvrtmp_6448}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6411"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2937, CursorTy arg_633_1239_1562) +{ + TagTyPacked tmpval_6456 = *(TagTyPacked *) arg_633_1239_1562; + CursorTy tmpcur_6457 = arg_633_1239_1562 + 1; + + + switch_6467: + ; + switch (tmpval_6456) { + + case 0: + { + CursorTy jump_3974 = arg_633_1239_1562 + 1; + + return (CursorProd) {jump_3974}; + break; + } + + case 1: + { + IntTy tmpval_6458 = *(IntTy *) tmpcur_6457; + CursorTy tmpcur_6459 = tmpcur_6457 + sizeof(IntTy); + CursorTy jump_3976 = tmpcur_6457 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2937, tmpcur_6459); + CursorTy pvrtmp_6460 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6460}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6461 = *(CursorTy *) tmpcur_6457; + CursorTy tmpaftercur_6462 = tmpcur_6457 + 8; + CursorTy jump_4281 = tmpcur_6457 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2937, tmpcur_6461); + CursorTy pvrtmp_6463 = tmp_struct_41.field0; + + return (CursorProd) {jump_4281}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6464 = *(CursorTy *) tmpcur_6457; + CursorTy tmpaftercur_6465 = tmpcur_6457 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2937, tmpcur_6464); + CursorTy pvrtmp_6466 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6466}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6456"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2939, CursorTy arg_638_1243_1566) +{ + TagTyPacked tmpval_6468 = *(TagTyPacked *) arg_638_1243_1566; + CursorTy tmpcur_6469 = arg_638_1243_1566 + 1; + + + switch_6479: + ; + switch (tmpval_6468) { + + case 0: + { + CursorTy jump_3979 = arg_638_1243_1566 + 1; + unsigned char wildcard_639_1244_1567 = print_symbol(6153); + unsigned char wildcard_640_1245_1568 = print_symbol(6145); + + return (CursorProd) {jump_3979}; + break; + } + + case 1: + { + IntTy tmpval_6470 = *(IntTy *) tmpcur_6469; + CursorTy tmpcur_6471 = tmpcur_6469 + sizeof(IntTy); + CursorTy jump_3981 = tmpcur_6469 + 8; + unsigned char wildcard_645_1248_1571 = print_symbol(6154); + unsigned char y_643_1249_1572 = printf("%lld", tmpval_6470); + CursorProd tmp_struct_43 = _print_String(end_r_2939, tmpcur_6471); + CursorTy pvrtmp_6472 = tmp_struct_43.field0; + unsigned char wildcard_646_1251_1574 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6472}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6473 = *(CursorTy *) tmpcur_6469; + CursorTy tmpaftercur_6474 = tmpcur_6469 + 8; + CursorTy jump_4287 = tmpcur_6469 + 8; + unsigned char wildcard_4290 = print_symbol(6162); + CursorProd tmp_struct_44 = _print_String(end_r_2939, tmpcur_6473); + CursorTy pvrtmp_6475 = tmp_struct_44.field0; + + return (CursorProd) {jump_4287}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6476 = *(CursorTy *) tmpcur_6469; + CursorTy tmpaftercur_6477 = tmpcur_6469 + 8; + unsigned char wildcard_4290 = print_symbol(6161); + CursorProd tmp_struct_45 = _print_String(end_r_2939, tmpcur_6476); + CursorTy pvrtmp_6478 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6478}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6468"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2942, + CursorTy end_r_2943, + CursorTy loc_2941, + CursorTy arg_647_1252_1575) +{ + if (loc_2941 + 32 > end_r_2943) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2943); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2943 = chunk_end_52; + *(TagTyPacked *) loc_2941 = 255; + + CursorTy redir = loc_2941 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2941 = chunk_start_51; + } + + TagTyPacked tmpval_6480 = *(TagTyPacked *) arg_647_1252_1575; + CursorTy tmpcur_6481 = arg_647_1252_1575 + 1; + + + switch_6530: + ; + switch (tmpval_6480) { + + case 0: + { + CursorTy loc_3121 = loc_2941 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2942, end_r_2943, loc_3121, tmpcur_6481); + CursorTy pvrtmp_6482 = tmp_struct_46.field0; + CursorTy pvrtmp_6483 = tmp_struct_46.field1; + CursorTy pvrtmp_6484 = tmp_struct_46.field2; + CursorTy pvrtmp_6485 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2941 = 0; + + CursorTy writetag_4631 = loc_2941 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6482, pvrtmp_6483, + loc_2941, pvrtmp_6485}; + break; + } + + case 1: + { + CursorTy loc_3127 = loc_2941 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2942, end_r_2943, loc_3127, tmpcur_6481); + CursorTy pvrtmp_6494 = tmp_struct_47.field0; + CursorTy pvrtmp_6495 = tmp_struct_47.field1; + CursorTy pvrtmp_6496 = tmp_struct_47.field2; + CursorTy pvrtmp_6497 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2941 = 1; + + CursorTy writetag_4636 = loc_2941 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6494, pvrtmp_6495, + loc_2941, pvrtmp_6497}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6506 = *(CursorTy *) tmpcur_6481; + CursorTy tmpaftercur_6507 = tmpcur_6481 + 8; + CursorTy jump_4293 = tmpcur_6481 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2942, end_r_2943, loc_2941, tmpcur_6506); + CursorTy pvrtmp_6508 = tmp_struct_48.field0; + CursorTy pvrtmp_6509 = tmp_struct_48.field1; + CursorTy pvrtmp_6510 = tmp_struct_48.field2; + CursorTy pvrtmp_6511 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6508, jump_4293, + pvrtmp_6510, pvrtmp_6511}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6518 = *(CursorTy *) tmpcur_6481; + CursorTy tmpaftercur_6519 = tmpcur_6481 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2942, end_r_2943, loc_2941, tmpcur_6518); + CursorTy pvrtmp_6520 = tmp_struct_49.field0; + CursorTy pvrtmp_6521 = tmp_struct_49.field1; + CursorTy pvrtmp_6522 = tmp_struct_49.field2; + CursorTy pvrtmp_6523 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6520, pvrtmp_6521, + pvrtmp_6522, pvrtmp_6523}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6480"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2946, + CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_652_1257_1580) +{ + TagTyPacked tmpval_6531 = *(TagTyPacked *) arg_652_1257_1580; + CursorTy tmpcur_6532 = arg_652_1257_1580 + 1; + + + switch_6581: + ; + switch (tmpval_6531) { + + case 0: + { + CursorTy loc_3135 = loc_2945 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2946, end_r_2947, loc_3135, tmpcur_6532); + CursorTy pvrtmp_6533 = tmp_struct_53.field0; + CursorTy pvrtmp_6534 = tmp_struct_53.field1; + CursorTy pvrtmp_6535 = tmp_struct_53.field2; + CursorTy pvrtmp_6536 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2945 = 0; + + CursorTy writetag_4647 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6533, pvrtmp_6534, + loc_2945, pvrtmp_6536}; + break; + } + + case 1: + { + CursorTy loc_3141 = loc_2945 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2946, end_r_2947, loc_3141, tmpcur_6532); + CursorTy pvrtmp_6545 = tmp_struct_54.field0; + CursorTy pvrtmp_6546 = tmp_struct_54.field1; + CursorTy pvrtmp_6547 = tmp_struct_54.field2; + CursorTy pvrtmp_6548 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2945 = 1; + + CursorTy writetag_4652 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6545, pvrtmp_6546, + loc_2945, pvrtmp_6548}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6557 = *(CursorTy *) tmpcur_6532; + CursorTy tmpaftercur_6558 = tmpcur_6532 + 8; + CursorTy jump_4299 = tmpcur_6532 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2946, end_r_2947, loc_2945, tmpcur_6557); + CursorTy pvrtmp_6559 = tmp_struct_55.field0; + CursorTy pvrtmp_6560 = tmp_struct_55.field1; + CursorTy pvrtmp_6561 = tmp_struct_55.field2; + CursorTy pvrtmp_6562 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6559, jump_4299, + pvrtmp_6561, pvrtmp_6562}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6569 = *(CursorTy *) tmpcur_6532; + CursorTy tmpaftercur_6570 = tmpcur_6532 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2946, end_r_2947, loc_2945, tmpcur_6569); + CursorTy pvrtmp_6571 = tmp_struct_56.field0; + CursorTy pvrtmp_6572 = tmp_struct_56.field1; + CursorTy pvrtmp_6573 = tmp_struct_56.field2; + CursorTy pvrtmp_6574 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6571, pvrtmp_6572, + pvrtmp_6573, pvrtmp_6574}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6531"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2949, CursorTy arg_657_1262_1585) +{ + TagTyPacked tmpval_6582 = *(TagTyPacked *) arg_657_1262_1585; + CursorTy tmpcur_6583 = arg_657_1262_1585 + 1; + + + switch_6592: + ; + switch (tmpval_6582) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2949, tmpcur_6583); + CursorTy pvrtmp_6584 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6584}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2949, tmpcur_6583); + CursorTy pvrtmp_6585 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6585}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6586 = *(CursorTy *) tmpcur_6583; + CursorTy tmpaftercur_6587 = tmpcur_6583 + 8; + CursorTy jump_4305 = tmpcur_6583 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2949, tmpcur_6586); + CursorTy pvrtmp_6588 = tmp_struct_59.field0; + + return (CursorProd) {jump_4305}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6589 = *(CursorTy *) tmpcur_6583; + CursorTy tmpaftercur_6590 = tmpcur_6583 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2949, tmpcur_6589); + CursorTy pvrtmp_6591 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6591}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6582"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2951, CursorTy arg_662_1267_1590) +{ + TagTyPacked tmpval_6593 = *(TagTyPacked *) arg_662_1267_1590; + CursorTy tmpcur_6594 = arg_662_1267_1590 + 1; + + + switch_6603: + ; + switch (tmpval_6593) { + + case 0: + { + unsigned char wildcard_665_1269_1592 = print_symbol(6152); + CursorProd tmp_struct_61 = _print_String(end_r_2951, tmpcur_6594); + CursorTy pvrtmp_6595 = tmp_struct_61.field0; + unsigned char wildcard_666_1271_1594 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6595}; + break; + } + + case 1: + { + unsigned char wildcard_669_1273_1596 = print_symbol(6146); + CursorProd tmp_struct_62 = _print_String(end_r_2951, tmpcur_6594); + CursorTy pvrtmp_6596 = tmp_struct_62.field0; + unsigned char wildcard_670_1275_1598 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6596}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6597 = *(CursorTy *) tmpcur_6594; + CursorTy tmpaftercur_6598 = tmpcur_6594 + 8; + CursorTy jump_4311 = tmpcur_6594 + 8; + unsigned char wildcard_4314 = print_symbol(6162); + CursorProd tmp_struct_63 = _print_Content(end_r_2951, tmpcur_6597); + CursorTy pvrtmp_6599 = tmp_struct_63.field0; + + return (CursorProd) {jump_4311}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6600 = *(CursorTy *) tmpcur_6594; + CursorTy tmpaftercur_6601 = tmpcur_6594 + 8; + unsigned char wildcard_4314 = print_symbol(6161); + CursorProd tmp_struct_64 = _print_Content(end_r_2951, tmpcur_6600); + CursorTy pvrtmp_6602 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6602}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6593"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2954, CursorTy end_r_2955, + CursorTy loc_2953, + CursorTy arg_671_1276_1599) +{ + if (loc_2953 + 32 > end_r_2955) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2955); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2955 = chunk_end_91; + *(TagTyPacked *) loc_2953 = 255; + + CursorTy redir = loc_2953 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2953 = chunk_start_90; + } + + CursorTy loc_3171 = loc_2953 + 1; + CursorTy loc_3172 = loc_3171 + 8; + CursorTy loc_3187 = loc_2953 + 1; + CursorTy loc_3188 = loc_3187 + 8; + CursorTy loc_3208 = loc_2953 + 1; + CursorTy loc_3209 = loc_3208 + 8; + CursorTy loc_3210 = loc_3209 + 8; + CursorTy loc_3234 = loc_2953 + 1; + CursorTy loc_3235 = loc_3234 + 8; + CursorTy loc_3236 = loc_3235 + 8; + CursorTy loc_3260 = loc_2953 + 1; + CursorTy loc_3261 = loc_3260 + 8; + CursorTy loc_3262 = loc_3261 + 8; + CursorTy loc_3286 = loc_2953 + 1; + CursorTy loc_3287 = loc_3286 + 8; + CursorTy loc_3288 = loc_3287 + 8; + CursorTy loc_3312 = loc_2953 + 1; + CursorTy loc_3313 = loc_3312 + 8; + CursorTy loc_3314 = loc_3313 + 8; + CursorTy loc_3338 = loc_2953 + 1; + CursorTy loc_3339 = loc_3338 + 8; + CursorTy loc_3340 = loc_3339 + 8; + TagTyPacked tmpval_6604 = *(TagTyPacked *) arg_671_1276_1599; + CursorTy tmpcur_6605 = arg_671_1276_1599 + 1; + + + switch_6870: + ; + switch (tmpval_6604) { + + case 0: + { + CursorTy jump_4000 = arg_671_1276_1599 + 1; + + *(TagTyPacked *) loc_2953 = 0; + + CursorTy writetag_4682 = loc_2953 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2955, jump_4000, + loc_2953, writetag_4682}; + break; + } + + case 9: + { + CursorTy tmpcur_6610 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6611 = tmpcur_6605 + 8; + CursorTy jump_4002 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2954, end_r_2955, loc_3172, tmpaftercur_6611); + CursorTy pvrtmp_6612 = tmp_struct_65.field0; + CursorTy pvrtmp_6613 = tmp_struct_65.field1; + CursorTy pvrtmp_6614 = tmp_struct_65.field2; + CursorTy pvrtmp_6615 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2954, pvrtmp_6612, pvrtmp_6615, tmpcur_6610); + CursorTy pvrtmp_6620 = tmp_struct_66.field0; + CursorTy pvrtmp_6621 = tmp_struct_66.field1; + CursorTy pvrtmp_6622 = tmp_struct_66.field2; + CursorTy pvrtmp_6623 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2953 = 9; + + CursorTy writetag_4688 = loc_2953 + 1; + + *(CursorTy *) writetag_4688 = pvrtmp_6615; + + CursorTy writecur_4689 = writetag_4688 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6620, pvrtmp_6621, + loc_2953, pvrtmp_6623}; + break; + } + + case 11: + { + CursorTy tmpcur_6632 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6633 = tmpcur_6605 + 8; + CursorTy jump_4006 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2954, end_r_2955, loc_3188, tmpaftercur_6633); + CursorTy pvrtmp_6634 = tmp_struct_67.field0; + CursorTy pvrtmp_6635 = tmp_struct_67.field1; + CursorTy pvrtmp_6636 = tmp_struct_67.field2; + CursorTy pvrtmp_6637 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2954, pvrtmp_6634, pvrtmp_6637, tmpcur_6632); + CursorTy pvrtmp_6642 = tmp_struct_68.field0; + CursorTy pvrtmp_6643 = tmp_struct_68.field1; + CursorTy pvrtmp_6644 = tmp_struct_68.field2; + CursorTy pvrtmp_6645 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2953 = 11; + + CursorTy writetag_4697 = loc_2953 + 1; + + *(CursorTy *) writetag_4697 = pvrtmp_6637; + + CursorTy writecur_4698 = writetag_4697 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6642, pvrtmp_6643, + loc_2953, pvrtmp_6645}; + break; + } + + case 13: + { + CursorTy tmpcur_6654 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6655 = tmpcur_6605 + 8; + CursorTy tmpcur_6656 = *(CursorTy *) tmpaftercur_6655; + CursorTy tmpaftercur_6657 = tmpaftercur_6655 + 8; + CursorTy jump_4011 = tmpaftercur_6655 + 8; + CursorTy jump_4010 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2954, end_r_2955, loc_3210, tmpaftercur_6657); + CursorTy pvrtmp_6658 = tmp_struct_69.field0; + CursorTy pvrtmp_6659 = tmp_struct_69.field1; + CursorTy pvrtmp_6660 = tmp_struct_69.field2; + CursorTy pvrtmp_6661 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2954, pvrtmp_6658, pvrtmp_6661, tmpcur_6654); + CursorTy pvrtmp_6666 = tmp_struct_70.field0; + CursorTy pvrtmp_6667 = tmp_struct_70.field1; + CursorTy pvrtmp_6668 = tmp_struct_70.field2; + CursorTy pvrtmp_6669 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2954, pvrtmp_6666, pvrtmp_6669, tmpcur_6656); + CursorTy pvrtmp_6674 = tmp_struct_71.field0; + CursorTy pvrtmp_6675 = tmp_struct_71.field1; + CursorTy pvrtmp_6676 = tmp_struct_71.field2; + CursorTy pvrtmp_6677 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2953 = 13; + + CursorTy writetag_4708 = loc_2953 + 1; + + *(CursorTy *) writetag_4708 = pvrtmp_6661; + + CursorTy writecur_4709 = writetag_4708 + 8; + + *(CursorTy *) writecur_4709 = pvrtmp_6669; + + CursorTy writecur_4710 = writecur_4709 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6674, pvrtmp_6675, + loc_2953, pvrtmp_6677}; + break; + } + + case 15: + { + CursorTy tmpcur_6686 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6687 = tmpcur_6605 + 8; + CursorTy tmpcur_6688 = *(CursorTy *) tmpaftercur_6687; + CursorTy tmpaftercur_6689 = tmpaftercur_6687 + 8; + CursorTy jump_4017 = tmpaftercur_6687 + 8; + CursorTy jump_4016 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2954, end_r_2955, loc_3236, tmpaftercur_6689); + CursorTy pvrtmp_6690 = tmp_struct_72.field0; + CursorTy pvrtmp_6691 = tmp_struct_72.field1; + CursorTy pvrtmp_6692 = tmp_struct_72.field2; + CursorTy pvrtmp_6693 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2954, pvrtmp_6690, pvrtmp_6693, tmpcur_6686); + CursorTy pvrtmp_6698 = tmp_struct_73.field0; + CursorTy pvrtmp_6699 = tmp_struct_73.field1; + CursorTy pvrtmp_6700 = tmp_struct_73.field2; + CursorTy pvrtmp_6701 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2954, pvrtmp_6698, pvrtmp_6701, tmpcur_6688); + CursorTy pvrtmp_6706 = tmp_struct_74.field0; + CursorTy pvrtmp_6707 = tmp_struct_74.field1; + CursorTy pvrtmp_6708 = tmp_struct_74.field2; + CursorTy pvrtmp_6709 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2953 = 15; + + CursorTy writetag_4721 = loc_2953 + 1; + + *(CursorTy *) writetag_4721 = pvrtmp_6693; + + CursorTy writecur_4722 = writetag_4721 + 8; + + *(CursorTy *) writecur_4722 = pvrtmp_6701; + + CursorTy writecur_4723 = writecur_4722 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6706, pvrtmp_6707, + loc_2953, pvrtmp_6709}; + break; + } + + case 17: + { + CursorTy tmpcur_6718 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6719 = tmpcur_6605 + 8; + CursorTy tmpcur_6720 = *(CursorTy *) tmpaftercur_6719; + CursorTy tmpaftercur_6721 = tmpaftercur_6719 + 8; + CursorTy jump_4023 = tmpaftercur_6719 + 8; + CursorTy jump_4022 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2954, end_r_2955, loc_3262, tmpaftercur_6721); + CursorTy pvrtmp_6722 = tmp_struct_75.field0; + CursorTy pvrtmp_6723 = tmp_struct_75.field1; + CursorTy pvrtmp_6724 = tmp_struct_75.field2; + CursorTy pvrtmp_6725 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2954, pvrtmp_6722, pvrtmp_6725, tmpcur_6718); + CursorTy pvrtmp_6730 = tmp_struct_76.field0; + CursorTy pvrtmp_6731 = tmp_struct_76.field1; + CursorTy pvrtmp_6732 = tmp_struct_76.field2; + CursorTy pvrtmp_6733 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2954, pvrtmp_6730, pvrtmp_6733, tmpcur_6720); + CursorTy pvrtmp_6738 = tmp_struct_77.field0; + CursorTy pvrtmp_6739 = tmp_struct_77.field1; + CursorTy pvrtmp_6740 = tmp_struct_77.field2; + CursorTy pvrtmp_6741 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2953 = 17; + + CursorTy writetag_4734 = loc_2953 + 1; + + *(CursorTy *) writetag_4734 = pvrtmp_6725; + + CursorTy writecur_4735 = writetag_4734 + 8; + + *(CursorTy *) writecur_4735 = pvrtmp_6733; + + CursorTy writecur_4736 = writecur_4735 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6738, pvrtmp_6739, + loc_2953, pvrtmp_6741}; + break; + } + + case 19: + { + CursorTy tmpcur_6750 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6751 = tmpcur_6605 + 8; + CursorTy tmpcur_6752 = *(CursorTy *) tmpaftercur_6751; + CursorTy tmpaftercur_6753 = tmpaftercur_6751 + 8; + CursorTy jump_4029 = tmpaftercur_6751 + 8; + CursorTy jump_4028 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2954, end_r_2955, loc_3288, tmpaftercur_6753); + CursorTy pvrtmp_6754 = tmp_struct_78.field0; + CursorTy pvrtmp_6755 = tmp_struct_78.field1; + CursorTy pvrtmp_6756 = tmp_struct_78.field2; + CursorTy pvrtmp_6757 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2954, pvrtmp_6754, pvrtmp_6757, tmpcur_6750); + CursorTy pvrtmp_6762 = tmp_struct_79.field0; + CursorTy pvrtmp_6763 = tmp_struct_79.field1; + CursorTy pvrtmp_6764 = tmp_struct_79.field2; + CursorTy pvrtmp_6765 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2954, pvrtmp_6762, pvrtmp_6765, tmpcur_6752); + CursorTy pvrtmp_6770 = tmp_struct_80.field0; + CursorTy pvrtmp_6771 = tmp_struct_80.field1; + CursorTy pvrtmp_6772 = tmp_struct_80.field2; + CursorTy pvrtmp_6773 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2953 = 19; + + CursorTy writetag_4747 = loc_2953 + 1; + + *(CursorTy *) writetag_4747 = pvrtmp_6757; + + CursorTy writecur_4748 = writetag_4747 + 8; + + *(CursorTy *) writecur_4748 = pvrtmp_6765; + + CursorTy writecur_4749 = writecur_4748 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6770, pvrtmp_6771, + loc_2953, pvrtmp_6773}; + break; + } + + case 21: + { + CursorTy tmpcur_6782 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6783 = tmpcur_6605 + 8; + CursorTy tmpcur_6784 = *(CursorTy *) tmpaftercur_6783; + CursorTy tmpaftercur_6785 = tmpaftercur_6783 + 8; + CursorTy jump_4035 = tmpaftercur_6783 + 8; + CursorTy jump_4034 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2954, end_r_2955, loc_3314, tmpaftercur_6785); + CursorTy pvrtmp_6786 = tmp_struct_81.field0; + CursorTy pvrtmp_6787 = tmp_struct_81.field1; + CursorTy pvrtmp_6788 = tmp_struct_81.field2; + CursorTy pvrtmp_6789 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2954, pvrtmp_6786, pvrtmp_6789, tmpcur_6782); + CursorTy pvrtmp_6794 = tmp_struct_82.field0; + CursorTy pvrtmp_6795 = tmp_struct_82.field1; + CursorTy pvrtmp_6796 = tmp_struct_82.field2; + CursorTy pvrtmp_6797 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2954, pvrtmp_6794, pvrtmp_6797, tmpcur_6784); + CursorTy pvrtmp_6802 = tmp_struct_83.field0; + CursorTy pvrtmp_6803 = tmp_struct_83.field1; + CursorTy pvrtmp_6804 = tmp_struct_83.field2; + CursorTy pvrtmp_6805 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2953 = 21; + + CursorTy writetag_4760 = loc_2953 + 1; + + *(CursorTy *) writetag_4760 = pvrtmp_6789; + + CursorTy writecur_4761 = writetag_4760 + 8; + + *(CursorTy *) writecur_4761 = pvrtmp_6797; + + CursorTy writecur_4762 = writecur_4761 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6802, pvrtmp_6803, + loc_2953, pvrtmp_6805}; + break; + } + + case 23: + { + CursorTy tmpcur_6814 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6815 = tmpcur_6605 + 8; + CursorTy tmpcur_6816 = *(CursorTy *) tmpaftercur_6815; + CursorTy tmpaftercur_6817 = tmpaftercur_6815 + 8; + CursorTy jump_4041 = tmpaftercur_6815 + 8; + CursorTy jump_4040 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2954, end_r_2955, loc_3340, tmpaftercur_6817); + CursorTy pvrtmp_6818 = tmp_struct_84.field0; + CursorTy pvrtmp_6819 = tmp_struct_84.field1; + CursorTy pvrtmp_6820 = tmp_struct_84.field2; + CursorTy pvrtmp_6821 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2954, pvrtmp_6818, pvrtmp_6821, tmpcur_6814); + CursorTy pvrtmp_6826 = tmp_struct_85.field0; + CursorTy pvrtmp_6827 = tmp_struct_85.field1; + CursorTy pvrtmp_6828 = tmp_struct_85.field2; + CursorTy pvrtmp_6829 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2954, pvrtmp_6826, pvrtmp_6829, tmpcur_6816); + CursorTy pvrtmp_6834 = tmp_struct_86.field0; + CursorTy pvrtmp_6835 = tmp_struct_86.field1; + CursorTy pvrtmp_6836 = tmp_struct_86.field2; + CursorTy pvrtmp_6837 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2953 = 23; + + CursorTy writetag_4773 = loc_2953 + 1; + + *(CursorTy *) writetag_4773 = pvrtmp_6821; + + CursorTy writecur_4774 = writetag_4773 + 8; + + *(CursorTy *) writecur_4774 = pvrtmp_6829; + + CursorTy writecur_4775 = writecur_4774 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6834, pvrtmp_6835, + loc_2953, pvrtmp_6837}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6846 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6847 = tmpcur_6605 + 8; + CursorTy jump_4317 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2954, end_r_2955, loc_2953, tmpcur_6846); + CursorTy pvrtmp_6848 = tmp_struct_87.field0; + CursorTy pvrtmp_6849 = tmp_struct_87.field1; + CursorTy pvrtmp_6850 = tmp_struct_87.field2; + CursorTy pvrtmp_6851 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6848, jump_4317, + pvrtmp_6850, pvrtmp_6851}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6858 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6859 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2954, end_r_2955, loc_2953, tmpcur_6858); + CursorTy pvrtmp_6860 = tmp_struct_88.field0; + CursorTy pvrtmp_6861 = tmp_struct_88.field1; + CursorTy pvrtmp_6862 = tmp_struct_88.field2; + CursorTy pvrtmp_6863 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6860, pvrtmp_6861, + pvrtmp_6862, pvrtmp_6863}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6604"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2958, + CursorTy end_r_2959, + CursorTy loc_2957, + CursorTy arg_716_1321_1644) +{ + TagTyPacked tmpval_6871 = *(TagTyPacked *) arg_716_1321_1644; + CursorTy tmpcur_6872 = arg_716_1321_1644 + 1; + + + switch_7137: + ; + switch (tmpval_6871) { + + case 0: + { + CursorTy jump_4046 = arg_716_1321_1644 + 1; + + *(TagTyPacked *) loc_2957 = 0; + + CursorTy writetag_4787 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2959, jump_4046, + loc_2957, writetag_4787}; + break; + } + + case 9: + { + CursorTy tmpcur_6877 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6878 = tmpcur_6872 + 8; + CursorTy jump_4048 = tmpcur_6872 + 8; + CursorTy loc_3362 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3362, tmpaftercur_6878); + CursorTy pvrtmp_6879 = tmp_struct_92.field0; + CursorTy pvrtmp_6880 = tmp_struct_92.field1; + CursorTy pvrtmp_6881 = tmp_struct_92.field2; + CursorTy pvrtmp_6882 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6879, pvrtmp_6882, tmpcur_6877); + CursorTy pvrtmp_6887 = tmp_struct_93.field0; + CursorTy pvrtmp_6888 = tmp_struct_93.field1; + CursorTy pvrtmp_6889 = tmp_struct_93.field2; + CursorTy pvrtmp_6890 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2957 = 1; + + CursorTy writetag_4793 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6887, pvrtmp_6888, + loc_2957, pvrtmp_6890}; + break; + } + + case 11: + { + CursorTy tmpcur_6899 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6900 = tmpcur_6872 + 8; + CursorTy jump_4052 = tmpcur_6872 + 8; + CursorTy loc_3375 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3375, tmpaftercur_6900); + CursorTy pvrtmp_6901 = tmp_struct_94.field0; + CursorTy pvrtmp_6902 = tmp_struct_94.field1; + CursorTy pvrtmp_6903 = tmp_struct_94.field2; + CursorTy pvrtmp_6904 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6901, pvrtmp_6904, tmpcur_6899); + CursorTy pvrtmp_6909 = tmp_struct_95.field0; + CursorTy pvrtmp_6910 = tmp_struct_95.field1; + CursorTy pvrtmp_6911 = tmp_struct_95.field2; + CursorTy pvrtmp_6912 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2957 = 2; + + CursorTy writetag_4801 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6909, pvrtmp_6910, + loc_2957, pvrtmp_6912}; + break; + } + + case 13: + { + CursorTy tmpcur_6921 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6922 = tmpcur_6872 + 8; + CursorTy tmpcur_6923 = *(CursorTy *) tmpaftercur_6922; + CursorTy tmpaftercur_6924 = tmpaftercur_6922 + 8; + CursorTy jump_4057 = tmpaftercur_6922 + 8; + CursorTy jump_4056 = tmpcur_6872 + 8; + CursorTy loc_3393 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2958, end_r_2959, loc_3393, tmpaftercur_6924); + CursorTy pvrtmp_6925 = tmp_struct_96.field0; + CursorTy pvrtmp_6926 = tmp_struct_96.field1; + CursorTy pvrtmp_6927 = tmp_struct_96.field2; + CursorTy pvrtmp_6928 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6925, pvrtmp_6928, tmpcur_6921); + CursorTy pvrtmp_6933 = tmp_struct_97.field0; + CursorTy pvrtmp_6934 = tmp_struct_97.field1; + CursorTy pvrtmp_6935 = tmp_struct_97.field2; + CursorTy pvrtmp_6936 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6933, pvrtmp_6936, tmpcur_6923); + CursorTy pvrtmp_6941 = tmp_struct_98.field0; + CursorTy pvrtmp_6942 = tmp_struct_98.field1; + CursorTy pvrtmp_6943 = tmp_struct_98.field2; + CursorTy pvrtmp_6944 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2957 = 3; + + CursorTy writetag_4811 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6941, pvrtmp_6942, + loc_2957, pvrtmp_6944}; + break; + } + + case 15: + { + CursorTy tmpcur_6953 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6954 = tmpcur_6872 + 8; + CursorTy tmpcur_6955 = *(CursorTy *) tmpaftercur_6954; + CursorTy tmpaftercur_6956 = tmpaftercur_6954 + 8; + CursorTy jump_4063 = tmpaftercur_6954 + 8; + CursorTy jump_4062 = tmpcur_6872 + 8; + CursorTy loc_3413 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3413, tmpaftercur_6956); + CursorTy pvrtmp_6957 = tmp_struct_99.field0; + CursorTy pvrtmp_6958 = tmp_struct_99.field1; + CursorTy pvrtmp_6959 = tmp_struct_99.field2; + CursorTy pvrtmp_6960 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6957, pvrtmp_6960, tmpcur_6953); + CursorTy pvrtmp_6965 = tmp_struct_100.field0; + CursorTy pvrtmp_6966 = tmp_struct_100.field1; + CursorTy pvrtmp_6967 = tmp_struct_100.field2; + CursorTy pvrtmp_6968 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_6965, pvrtmp_6968, tmpcur_6955); + CursorTy pvrtmp_6973 = tmp_struct_101.field0; + CursorTy pvrtmp_6974 = tmp_struct_101.field1; + CursorTy pvrtmp_6975 = tmp_struct_101.field2; + CursorTy pvrtmp_6976 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2957 = 4; + + CursorTy writetag_4822 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6973, pvrtmp_6974, + loc_2957, pvrtmp_6976}; + break; + } + + case 17: + { + CursorTy tmpcur_6985 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6986 = tmpcur_6872 + 8; + CursorTy tmpcur_6987 = *(CursorTy *) tmpaftercur_6986; + CursorTy tmpaftercur_6988 = tmpaftercur_6986 + 8; + CursorTy jump_4069 = tmpaftercur_6986 + 8; + CursorTy jump_4068 = tmpcur_6872 + 8; + CursorTy loc_3433 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2958, end_r_2959, loc_3433, tmpaftercur_6988); + CursorTy pvrtmp_6989 = tmp_struct_102.field0; + CursorTy pvrtmp_6990 = tmp_struct_102.field1; + CursorTy pvrtmp_6991 = tmp_struct_102.field2; + CursorTy pvrtmp_6992 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6989, pvrtmp_6992, tmpcur_6985); + CursorTy pvrtmp_6997 = tmp_struct_103.field0; + CursorTy pvrtmp_6998 = tmp_struct_103.field1; + CursorTy pvrtmp_6999 = tmp_struct_103.field2; + CursorTy pvrtmp_7000 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6997, pvrtmp_7000, tmpcur_6987); + CursorTy pvrtmp_7005 = tmp_struct_104.field0; + CursorTy pvrtmp_7006 = tmp_struct_104.field1; + CursorTy pvrtmp_7007 = tmp_struct_104.field2; + CursorTy pvrtmp_7008 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2957 = 5; + + CursorTy writetag_4833 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7005, pvrtmp_7006, + loc_2957, pvrtmp_7008}; + break; + } + + case 19: + { + CursorTy tmpcur_7017 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7018 = tmpcur_6872 + 8; + CursorTy tmpcur_7019 = *(CursorTy *) tmpaftercur_7018; + CursorTy tmpaftercur_7020 = tmpaftercur_7018 + 8; + CursorTy jump_4075 = tmpaftercur_7018 + 8; + CursorTy jump_4074 = tmpcur_6872 + 8; + CursorTy loc_3453 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3453, tmpaftercur_7020); + CursorTy pvrtmp_7021 = tmp_struct_105.field0; + CursorTy pvrtmp_7022 = tmp_struct_105.field1; + CursorTy pvrtmp_7023 = tmp_struct_105.field2; + CursorTy pvrtmp_7024 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7021, pvrtmp_7024, tmpcur_7017); + CursorTy pvrtmp_7029 = tmp_struct_106.field0; + CursorTy pvrtmp_7030 = tmp_struct_106.field1; + CursorTy pvrtmp_7031 = tmp_struct_106.field2; + CursorTy pvrtmp_7032 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_7029, pvrtmp_7032, tmpcur_7019); + CursorTy pvrtmp_7037 = tmp_struct_107.field0; + CursorTy pvrtmp_7038 = tmp_struct_107.field1; + CursorTy pvrtmp_7039 = tmp_struct_107.field2; + CursorTy pvrtmp_7040 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2957 = 6; + + CursorTy writetag_4844 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7037, pvrtmp_7038, + loc_2957, pvrtmp_7040}; + break; + } + + case 21: + { + CursorTy tmpcur_7049 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7050 = tmpcur_6872 + 8; + CursorTy tmpcur_7051 = *(CursorTy *) tmpaftercur_7050; + CursorTy tmpaftercur_7052 = tmpaftercur_7050 + 8; + CursorTy jump_4081 = tmpaftercur_7050 + 8; + CursorTy jump_4080 = tmpcur_6872 + 8; + CursorTy loc_3473 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3473, tmpaftercur_7052); + CursorTy pvrtmp_7053 = tmp_struct_108.field0; + CursorTy pvrtmp_7054 = tmp_struct_108.field1; + CursorTy pvrtmp_7055 = tmp_struct_108.field2; + CursorTy pvrtmp_7056 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7053, pvrtmp_7056, tmpcur_7049); + CursorTy pvrtmp_7061 = tmp_struct_109.field0; + CursorTy pvrtmp_7062 = tmp_struct_109.field1; + CursorTy pvrtmp_7063 = tmp_struct_109.field2; + CursorTy pvrtmp_7064 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_7061, pvrtmp_7064, tmpcur_7051); + CursorTy pvrtmp_7069 = tmp_struct_110.field0; + CursorTy pvrtmp_7070 = tmp_struct_110.field1; + CursorTy pvrtmp_7071 = tmp_struct_110.field2; + CursorTy pvrtmp_7072 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2957 = 7; + + CursorTy writetag_4855 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7069, pvrtmp_7070, + loc_2957, pvrtmp_7072}; + break; + } + + case 23: + { + CursorTy tmpcur_7081 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7082 = tmpcur_6872 + 8; + CursorTy tmpcur_7083 = *(CursorTy *) tmpaftercur_7082; + CursorTy tmpaftercur_7084 = tmpaftercur_7082 + 8; + CursorTy jump_4087 = tmpaftercur_7082 + 8; + CursorTy jump_4086 = tmpcur_6872 + 8; + CursorTy loc_3493 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3493, tmpaftercur_7084); + CursorTy pvrtmp_7085 = tmp_struct_111.field0; + CursorTy pvrtmp_7086 = tmp_struct_111.field1; + CursorTy pvrtmp_7087 = tmp_struct_111.field2; + CursorTy pvrtmp_7088 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_7085, pvrtmp_7088, tmpcur_7081); + CursorTy pvrtmp_7093 = tmp_struct_112.field0; + CursorTy pvrtmp_7094 = tmp_struct_112.field1; + CursorTy pvrtmp_7095 = tmp_struct_112.field2; + CursorTy pvrtmp_7096 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7093, pvrtmp_7096, tmpcur_7083); + CursorTy pvrtmp_7101 = tmp_struct_113.field0; + CursorTy pvrtmp_7102 = tmp_struct_113.field1; + CursorTy pvrtmp_7103 = tmp_struct_113.field2; + CursorTy pvrtmp_7104 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2957 = 8; + + CursorTy writetag_4866 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7101, pvrtmp_7102, + loc_2957, pvrtmp_7104}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7113 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7114 = tmpcur_6872 + 8; + CursorTy jump_4323 = tmpcur_6872 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_2957, tmpcur_7113); + CursorTy pvrtmp_7115 = tmp_struct_114.field0; + CursorTy pvrtmp_7116 = tmp_struct_114.field1; + CursorTy pvrtmp_7117 = tmp_struct_114.field2; + CursorTy pvrtmp_7118 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7115, jump_4323, + pvrtmp_7117, pvrtmp_7118}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7125 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7126 = tmpcur_6872 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_2957, tmpcur_7125); + CursorTy pvrtmp_7127 = tmp_struct_115.field0; + CursorTy pvrtmp_7128 = tmp_struct_115.field1; + CursorTy pvrtmp_7129 = tmp_struct_115.field2; + CursorTy pvrtmp_7130 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7127, pvrtmp_7128, + pvrtmp_7129, pvrtmp_7130}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6871"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2961, CursorTy arg_761_1366_1689) +{ + TagTyPacked tmpval_7138 = *(TagTyPacked *) arg_761_1366_1689; + CursorTy tmpcur_7139 = arg_761_1366_1689 + 1; + + + switch_7196: + ; + switch (tmpval_7138) { + + case 0: + { + CursorTy jump_4092 = arg_761_1366_1689 + 1; + + return (CursorProd) {jump_4092}; + break; + } + + case 9: + { + CursorTy tmpcur_7140 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7141 = tmpcur_7139 + 8; + CursorTy jump_4094 = tmpcur_7139 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2961, tmpaftercur_7141); + CursorTy pvrtmp_7142 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2961, tmpcur_7140); + CursorTy pvrtmp_7143 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7143}; + break; + } + + case 11: + { + CursorTy tmpcur_7144 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7145 = tmpcur_7139 + 8; + CursorTy jump_4098 = tmpcur_7139 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2961, tmpaftercur_7145); + CursorTy pvrtmp_7146 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2961, tmpcur_7144); + CursorTy pvrtmp_7147 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7147}; + break; + } + + case 13: + { + CursorTy tmpcur_7148 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7149 = tmpcur_7139 + 8; + CursorTy tmpcur_7150 = *(CursorTy *) tmpaftercur_7149; + CursorTy tmpaftercur_7151 = tmpaftercur_7149 + 8; + CursorTy jump_4103 = tmpaftercur_7149 + 8; + CursorTy jump_4102 = tmpcur_7139 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2961, tmpaftercur_7151); + CursorTy pvrtmp_7152 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2961, tmpcur_7148); + CursorTy pvrtmp_7153 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2961, tmpcur_7150); + CursorTy pvrtmp_7154 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7154}; + break; + } + + case 15: + { + CursorTy tmpcur_7155 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7156 = tmpcur_7139 + 8; + CursorTy tmpcur_7157 = *(CursorTy *) tmpaftercur_7156; + CursorTy tmpaftercur_7158 = tmpaftercur_7156 + 8; + CursorTy jump_4109 = tmpaftercur_7156 + 8; + CursorTy jump_4108 = tmpcur_7139 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2961, tmpaftercur_7158); + CursorTy pvrtmp_7159 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2961, tmpcur_7155); + CursorTy pvrtmp_7160 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2961, tmpcur_7157); + CursorTy pvrtmp_7161 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7161}; + break; + } + + case 17: + { + CursorTy tmpcur_7162 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7163 = tmpcur_7139 + 8; + CursorTy tmpcur_7164 = *(CursorTy *) tmpaftercur_7163; + CursorTy tmpaftercur_7165 = tmpaftercur_7163 + 8; + CursorTy jump_4115 = tmpaftercur_7163 + 8; + CursorTy jump_4114 = tmpcur_7139 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2961, tmpaftercur_7165); + CursorTy pvrtmp_7166 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2961, tmpcur_7162); + CursorTy pvrtmp_7167 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2961, tmpcur_7164); + CursorTy pvrtmp_7168 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7168}; + break; + } + + case 19: + { + CursorTy tmpcur_7169 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7170 = tmpcur_7139 + 8; + CursorTy tmpcur_7171 = *(CursorTy *) tmpaftercur_7170; + CursorTy tmpaftercur_7172 = tmpaftercur_7170 + 8; + CursorTy jump_4121 = tmpaftercur_7170 + 8; + CursorTy jump_4120 = tmpcur_7139 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2961, tmpaftercur_7172); + CursorTy pvrtmp_7173 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2961, tmpcur_7169); + CursorTy pvrtmp_7174 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2961, tmpcur_7171); + CursorTy pvrtmp_7175 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7175}; + break; + } + + case 21: + { + CursorTy tmpcur_7176 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7177 = tmpcur_7139 + 8; + CursorTy tmpcur_7178 = *(CursorTy *) tmpaftercur_7177; + CursorTy tmpaftercur_7179 = tmpaftercur_7177 + 8; + CursorTy jump_4127 = tmpaftercur_7177 + 8; + CursorTy jump_4126 = tmpcur_7139 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2961, tmpaftercur_7179); + CursorTy pvrtmp_7180 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2961, tmpcur_7176); + CursorTy pvrtmp_7181 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2961, tmpcur_7178); + CursorTy pvrtmp_7182 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7182}; + break; + } + + case 23: + { + CursorTy tmpcur_7183 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7184 = tmpcur_7139 + 8; + CursorTy tmpcur_7185 = *(CursorTy *) tmpaftercur_7184; + CursorTy tmpaftercur_7186 = tmpaftercur_7184 + 8; + CursorTy jump_4133 = tmpaftercur_7184 + 8; + CursorTy jump_4132 = tmpcur_7139 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2961, tmpaftercur_7186); + CursorTy pvrtmp_7187 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2961, tmpcur_7183); + CursorTy pvrtmp_7188 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2961, tmpcur_7185); + CursorTy pvrtmp_7189 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7189}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7190 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7191 = tmpcur_7139 + 8; + CursorTy jump_4329 = tmpcur_7139 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2961, tmpcur_7190); + CursorTy pvrtmp_7192 = tmp_struct_138.field0; + + return (CursorProd) {jump_4329}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7193 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7194 = tmpcur_7139 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2961, tmpcur_7193); + CursorTy pvrtmp_7195 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7195}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7138"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2963, CursorTy arg_806_1411_1734) +{ + TagTyPacked tmpval_7197 = *(TagTyPacked *) arg_806_1411_1734; + CursorTy tmpcur_7198 = arg_806_1411_1734 + 1; + + + switch_7255: + ; + switch (tmpval_7197) { + + case 0: + { + CursorTy jump_4138 = arg_806_1411_1734 + 1; + unsigned char wildcard_807_1412_1735 = print_symbol(6151); + unsigned char wildcard_808_1413_1736 = print_symbol(6145); + + return (CursorProd) {jump_4138}; + break; + } + + case 9: + { + CursorTy tmpcur_7199 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7200 = tmpcur_7198 + 8; + CursorTy jump_4140 = tmpcur_7198 + 8; + unsigned char wildcard_813_1416_1739 = print_symbol(6157); + CursorProd tmp_struct_140 = + _print_Content(end_r_2963, tmpaftercur_7200); + CursorTy pvrtmp_7201 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2963, tmpcur_7199); + CursorTy pvrtmp_7202 = tmp_struct_141.field0; + unsigned char wildcard_814_1419_1742 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7202}; + break; + } + + case 11: + { + CursorTy tmpcur_7203 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7204 = tmpcur_7198 + 8; + CursorTy jump_4144 = tmpcur_7198 + 8; + unsigned char wildcard_819_1422_1745 = print_symbol(6160); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2963, tmpaftercur_7204); + CursorTy pvrtmp_7205 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2963, tmpcur_7203); + CursorTy pvrtmp_7206 = tmp_struct_143.field0; + unsigned char wildcard_820_1425_1748 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7206}; + break; + } + + case 13: + { + CursorTy tmpcur_7207 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7208 = tmpcur_7198 + 8; + CursorTy tmpcur_7209 = *(CursorTy *) tmpaftercur_7208; + CursorTy tmpaftercur_7210 = tmpaftercur_7208 + 8; + CursorTy jump_4149 = tmpaftercur_7208 + 8; + CursorTy jump_4148 = tmpcur_7198 + 8; + unsigned char wildcard_827_1429_1752 = print_symbol(6148); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2963, tmpaftercur_7210); + CursorTy pvrtmp_7211 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2963, tmpcur_7207); + CursorTy pvrtmp_7212 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2963, tmpcur_7209); + CursorTy pvrtmp_7213 = tmp_struct_146.field0; + unsigned char wildcard_828_1433_1756 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7213}; + break; + } + + case 15: + { + CursorTy tmpcur_7214 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7215 = tmpcur_7198 + 8; + CursorTy tmpcur_7216 = *(CursorTy *) tmpaftercur_7215; + CursorTy tmpaftercur_7217 = tmpaftercur_7215 + 8; + CursorTy jump_4155 = tmpaftercur_7215 + 8; + CursorTy jump_4154 = tmpcur_7198 + 8; + unsigned char wildcard_835_1437_1760 = print_symbol(6159); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2963, tmpaftercur_7217); + CursorTy pvrtmp_7218 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2963, tmpcur_7214); + CursorTy pvrtmp_7219 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2963, tmpcur_7216); + CursorTy pvrtmp_7220 = tmp_struct_149.field0; + unsigned char wildcard_836_1441_1764 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7220}; + break; + } + + case 17: + { + CursorTy tmpcur_7221 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7222 = tmpcur_7198 + 8; + CursorTy tmpcur_7223 = *(CursorTy *) tmpaftercur_7222; + CursorTy tmpaftercur_7224 = tmpaftercur_7222 + 8; + CursorTy jump_4161 = tmpaftercur_7222 + 8; + CursorTy jump_4160 = tmpcur_7198 + 8; + unsigned char wildcard_843_1445_1768 = print_symbol(6149); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2963, tmpaftercur_7224); + CursorTy pvrtmp_7225 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2963, tmpcur_7221); + CursorTy pvrtmp_7226 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2963, tmpcur_7223); + CursorTy pvrtmp_7227 = tmp_struct_152.field0; + unsigned char wildcard_844_1449_1772 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7227}; + break; + } + + case 19: + { + CursorTy tmpcur_7228 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7229 = tmpcur_7198 + 8; + CursorTy tmpcur_7230 = *(CursorTy *) tmpaftercur_7229; + CursorTy tmpaftercur_7231 = tmpaftercur_7229 + 8; + CursorTy jump_4167 = tmpaftercur_7229 + 8; + CursorTy jump_4166 = tmpcur_7198 + 8; + unsigned char wildcard_851_1453_1776 = print_symbol(6158); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2963, tmpaftercur_7231); + CursorTy pvrtmp_7232 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2963, tmpcur_7228); + CursorTy pvrtmp_7233 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2963, tmpcur_7230); + CursorTy pvrtmp_7234 = tmp_struct_155.field0; + unsigned char wildcard_852_1457_1780 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7234}; + break; + } + + case 21: + { + CursorTy tmpcur_7235 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7236 = tmpcur_7198 + 8; + CursorTy tmpcur_7237 = *(CursorTy *) tmpaftercur_7236; + CursorTy tmpaftercur_7238 = tmpaftercur_7236 + 8; + CursorTy jump_4173 = tmpaftercur_7236 + 8; + CursorTy jump_4172 = tmpcur_7198 + 8; + unsigned char wildcard_859_1461_1784 = print_symbol(6155); + CursorProd tmp_struct_156 = + _print_Content(end_r_2963, tmpaftercur_7238); + CursorTy pvrtmp_7239 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2963, tmpcur_7235); + CursorTy pvrtmp_7240 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2963, tmpcur_7237); + CursorTy pvrtmp_7241 = tmp_struct_158.field0; + unsigned char wildcard_860_1465_1788 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7241}; + break; + } + + case 23: + { + CursorTy tmpcur_7242 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7243 = tmpcur_7198 + 8; + CursorTy tmpcur_7244 = *(CursorTy *) tmpaftercur_7243; + CursorTy tmpaftercur_7245 = tmpaftercur_7243 + 8; + CursorTy jump_4179 = tmpaftercur_7243 + 8; + CursorTy jump_4178 = tmpcur_7198 + 8; + unsigned char wildcard_867_1469_1792 = print_symbol(6156); + CursorProd tmp_struct_159 = + _print_Content(end_r_2963, tmpaftercur_7245); + CursorTy pvrtmp_7246 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2963, tmpcur_7242); + CursorTy pvrtmp_7247 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2963, tmpcur_7244); + CursorTy pvrtmp_7248 = tmp_struct_161.field0; + unsigned char wildcard_868_1473_1796 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7248}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7249 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7250 = tmpcur_7198 + 8; + CursorTy jump_4335 = tmpcur_7198 + 8; + unsigned char wildcard_4338 = print_symbol(6162); + CursorProd tmp_struct_162 = _print_Adt(end_r_2963, tmpcur_7249); + CursorTy pvrtmp_7251 = tmp_struct_162.field0; + + return (CursorProd) {jump_4335}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7252 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7253 = tmpcur_7198 + 8; + unsigned char wildcard_4338 = print_symbol(6161); + CursorProd tmp_struct_163 = _print_Adt(end_r_2963, tmpcur_7252); + CursorTy pvrtmp_7254 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7254}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7197"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2966, + CursorTy end_r_2967, CursorTy loc_2965, + CursorTy arg_869_1474_1797) +{ + if (loc_2965 + 32 > end_r_2967) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2967); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2967 = chunk_end_169; + *(TagTyPacked *) loc_2965 = 255; + + CursorTy redir = loc_2965 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2965 = chunk_start_168; + } + + CursorTy loc_3671 = loc_2965 + 1; + CursorTy loc_3672 = loc_3671 + 8; + TagTyPacked tmpval_7256 = *(TagTyPacked *) arg_869_1474_1797; + CursorTy tmpcur_7257 = arg_869_1474_1797 + 1; + + + switch_7300: + ; + switch (tmpval_7256) { + + case 0: + { + CursorTy jump_4184 = arg_869_1474_1797 + 1; + + *(TagTyPacked *) loc_2965 = 0; + + CursorTy writetag_4980 = loc_2965 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2967, jump_4184, + loc_2965, writetag_4980}; + break; + } + + case 1: + { + IntTy tmpval_7262 = *(IntTy *) tmpcur_7257; + CursorTy tmpcur_7263 = tmpcur_7257 + sizeof(IntTy); + CursorTy jump_4186 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2966, end_r_2967, loc_3672, tmpcur_7263); + CursorTy pvrtmp_7264 = tmp_struct_164.field0; + CursorTy pvrtmp_7265 = tmp_struct_164.field1; + CursorTy pvrtmp_7266 = tmp_struct_164.field2; + CursorTy pvrtmp_7267 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2965 = 1; + + CursorTy writetag_4985 = loc_2965 + 1; + + *(IntTy *) writetag_4985 = tmpval_7262; + + CursorTy writecur_4986 = writetag_4985 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7264, pvrtmp_7265, + loc_2965, pvrtmp_7267}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7276 = *(CursorTy *) tmpcur_7257; + CursorTy tmpaftercur_7277 = tmpcur_7257 + 8; + CursorTy jump_4341 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2966, end_r_2967, loc_2965, tmpcur_7276); + CursorTy pvrtmp_7278 = tmp_struct_165.field0; + CursorTy pvrtmp_7279 = tmp_struct_165.field1; + CursorTy pvrtmp_7280 = tmp_struct_165.field2; + CursorTy pvrtmp_7281 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7278, jump_4341, + pvrtmp_7280, pvrtmp_7281}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7288 = *(CursorTy *) tmpcur_7257; + CursorTy tmpaftercur_7289 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2966, end_r_2967, loc_2965, tmpcur_7288); + CursorTy pvrtmp_7290 = tmp_struct_166.field0; + CursorTy pvrtmp_7291 = tmp_struct_166.field1; + CursorTy pvrtmp_7292 = tmp_struct_166.field2; + CursorTy pvrtmp_7293 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7290, pvrtmp_7291, + pvrtmp_7292, pvrtmp_7293}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7256"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_874_1479_1802) +{ + CursorTy loc_3684 = loc_2969 + 1; + CursorTy loc_3685 = loc_3684 + 8; + TagTyPacked tmpval_7301 = *(TagTyPacked *) arg_874_1479_1802; + CursorTy tmpcur_7302 = arg_874_1479_1802 + 1; + + + switch_7345: + ; + switch (tmpval_7301) { + + case 0: + { + CursorTy jump_4189 = arg_874_1479_1802 + 1; + + *(TagTyPacked *) loc_2969 = 0; + + CursorTy writetag_4996 = loc_2969 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2971, jump_4189, + loc_2969, writetag_4996}; + break; + } + + case 1: + { + IntTy tmpval_7307 = *(IntTy *) tmpcur_7302; + CursorTy tmpcur_7308 = tmpcur_7302 + sizeof(IntTy); + CursorTy jump_4191 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_3685, tmpcur_7308); + CursorTy pvrtmp_7309 = tmp_struct_170.field0; + CursorTy pvrtmp_7310 = tmp_struct_170.field1; + CursorTy pvrtmp_7311 = tmp_struct_170.field2; + CursorTy pvrtmp_7312 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2969 = 1; + + CursorTy writetag_5001 = loc_2969 + 1; + + *(IntTy *) writetag_5001 = tmpval_7307; + + CursorTy writecur_5002 = writetag_5001 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7309, pvrtmp_7310, + loc_2969, pvrtmp_7312}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7321 = *(CursorTy *) tmpcur_7302; + CursorTy tmpaftercur_7322 = tmpcur_7302 + 8; + CursorTy jump_4347 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_2969, tmpcur_7321); + CursorTy pvrtmp_7323 = tmp_struct_171.field0; + CursorTy pvrtmp_7324 = tmp_struct_171.field1; + CursorTy pvrtmp_7325 = tmp_struct_171.field2; + CursorTy pvrtmp_7326 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7323, jump_4347, + pvrtmp_7325, pvrtmp_7326}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7333 = *(CursorTy *) tmpcur_7302; + CursorTy tmpaftercur_7334 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_2969, tmpcur_7333); + CursorTy pvrtmp_7335 = tmp_struct_172.field0; + CursorTy pvrtmp_7336 = tmp_struct_172.field1; + CursorTy pvrtmp_7337 = tmp_struct_172.field2; + CursorTy pvrtmp_7338 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7335, pvrtmp_7336, + pvrtmp_7337, pvrtmp_7338}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7301"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2973, CursorTy arg_879_1484_1807) +{ + TagTyPacked tmpval_7346 = *(TagTyPacked *) arg_879_1484_1807; + CursorTy tmpcur_7347 = arg_879_1484_1807 + 1; + + + switch_7357: + ; + switch (tmpval_7346) { + + case 0: + { + CursorTy jump_4194 = arg_879_1484_1807 + 1; + + return (CursorProd) {jump_4194}; + break; + } + + case 1: + { + IntTy tmpval_7348 = *(IntTy *) tmpcur_7347; + CursorTy tmpcur_7349 = tmpcur_7347 + sizeof(IntTy); + CursorTy jump_4196 = tmpcur_7347 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2973, tmpcur_7349); + CursorTy pvrtmp_7350 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7350}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7351 = *(CursorTy *) tmpcur_7347; + CursorTy tmpaftercur_7352 = tmpcur_7347 + 8; + CursorTy jump_4353 = tmpcur_7347 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2973, tmpcur_7351); + CursorTy pvrtmp_7353 = tmp_struct_174.field0; + + return (CursorProd) {jump_4353}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7354 = *(CursorTy *) tmpcur_7347; + CursorTy tmpaftercur_7355 = tmpcur_7347 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2973, tmpcur_7354); + CursorTy pvrtmp_7356 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7356}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7346"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2975, CursorTy arg_884_1488_1811) +{ + TagTyPacked tmpval_7358 = *(TagTyPacked *) arg_884_1488_1811; + CursorTy tmpcur_7359 = arg_884_1488_1811 + 1; + + + switch_7369: + ; + switch (tmpval_7358) { + + case 0: + { + CursorTy jump_4199 = arg_884_1488_1811 + 1; + unsigned char wildcard_885_1489_1812 = print_symbol(6150); + unsigned char wildcard_886_1490_1813 = print_symbol(6145); + + return (CursorProd) {jump_4199}; + break; + } + + case 1: + { + IntTy tmpval_7360 = *(IntTy *) tmpcur_7359; + CursorTy tmpcur_7361 = tmpcur_7359 + sizeof(IntTy); + CursorTy jump_4201 = tmpcur_7359 + 8; + unsigned char wildcard_891_1493_1816 = print_symbol(6147); + unsigned char y_889_1494_1817 = printf("%lld", tmpval_7360); + CursorProd tmp_struct_176 = _print_Tags(end_r_2975, tmpcur_7361); + CursorTy pvrtmp_7362 = tmp_struct_176.field0; + unsigned char wildcard_892_1496_1819 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7362}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7363 = *(CursorTy *) tmpcur_7359; + CursorTy tmpaftercur_7364 = tmpcur_7359 + 8; + CursorTy jump_4359 = tmpcur_7359 + 8; + unsigned char wildcard_4362 = print_symbol(6162); + CursorProd tmp_struct_177 = _print_Tags(end_r_2975, tmpcur_7363); + CursorTy pvrtmp_7365 = tmp_struct_177.field0; + + return (CursorProd) {jump_4359}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7366 = *(CursorTy *) tmpcur_7359; + CursorTy tmpaftercur_7367 = tmpcur_7359 + 8; + unsigned char wildcard_4362 = print_symbol(6161); + CursorProd tmp_struct_178 = _print_Tags(end_r_2975, tmpcur_7366); + CursorTy pvrtmp_7368 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7368}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7358"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2710) +{ + if (loc_2977 + 32 > end_r_2979) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2979); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2979 = chunk_end_184; + *(TagTyPacked *) loc_2977 = 255; + + CursorTy redir = loc_2977 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2977 = chunk_start_183; + } + + CursorTy loc_3709 = loc_2977 + 1; + CursorTy loc_3710 = loc_3709 + 8; + TagTyPacked tmpval_7370 = *(TagTyPacked *) arg_2710; + CursorTy tmpcur_7371 = arg_2710 + 1; + + + switch_7414: + ; + switch (tmpval_7370) { + + case 0: + { + CursorTy jump_4204 = arg_2710 + 1; + + *(TagTyPacked *) loc_2977 = 0; + + CursorTy writetag_5032 = loc_2977 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2979, jump_4204, + loc_2977, writetag_5032}; + break; + } + + case 1: + { + IntTy tmpval_7376 = *(IntTy *) tmpcur_7371; + CursorTy tmpcur_7377 = tmpcur_7371 + sizeof(IntTy); + CursorTy jump_4206 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_3710, tmpcur_7377); + CursorTy pvrtmp_7378 = tmp_struct_179.field0; + CursorTy pvrtmp_7379 = tmp_struct_179.field1; + CursorTy pvrtmp_7380 = tmp_struct_179.field2; + CursorTy pvrtmp_7381 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2977 = 1; + + CursorTy writetag_5037 = loc_2977 + 1; + + *(IntTy *) writetag_5037 = tmpval_7376; + + CursorTy writecur_5038 = writetag_5037 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7378, pvrtmp_7379, + loc_2977, pvrtmp_7381}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7390 = *(CursorTy *) tmpcur_7371; + CursorTy tmpaftercur_7391 = tmpcur_7371 + 8; + CursorTy jump_4365 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_2977, tmpcur_7390); + CursorTy pvrtmp_7392 = tmp_struct_180.field0; + CursorTy pvrtmp_7393 = tmp_struct_180.field1; + CursorTy pvrtmp_7394 = tmp_struct_180.field2; + CursorTy pvrtmp_7395 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7392, jump_4365, + pvrtmp_7394, pvrtmp_7395}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7402 = *(CursorTy *) tmpcur_7371; + CursorTy tmpaftercur_7403 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_2977, tmpcur_7402); + CursorTy pvrtmp_7404 = tmp_struct_181.field0; + CursorTy pvrtmp_7405 = tmp_struct_181.field1; + CursorTy pvrtmp_7406 = tmp_struct_181.field2; + CursorTy pvrtmp_7407 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7404, pvrtmp_7405, + pvrtmp_7406, pvrtmp_7407}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7370"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2715) +{ + if (loc_2981 + 32 > end_r_2983) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2983); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2983 = chunk_end_191; + *(TagTyPacked *) loc_2981 = 255; + + CursorTy redir = loc_2981 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2981 = chunk_start_190; + } + + TagTyPacked tmpval_7415 = *(TagTyPacked *) arg_2715; + CursorTy tmpcur_7416 = arg_2715 + 1; + + + switch_7465: + ; + switch (tmpval_7415) { + + case 0: + { + CursorTy loc_3720 = loc_2981 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2982, end_r_2983, loc_3720, tmpcur_7416); + CursorTy pvrtmp_7417 = tmp_struct_185.field0; + CursorTy pvrtmp_7418 = tmp_struct_185.field1; + CursorTy pvrtmp_7419 = tmp_struct_185.field2; + CursorTy pvrtmp_7420 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2981 = 0; + + CursorTy writetag_5049 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7417, pvrtmp_7418, + loc_2981, pvrtmp_7420}; + break; + } + + case 1: + { + CursorTy loc_3726 = loc_2981 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2982, end_r_2983, loc_3726, tmpcur_7416); + CursorTy pvrtmp_7429 = tmp_struct_186.field0; + CursorTy pvrtmp_7430 = tmp_struct_186.field1; + CursorTy pvrtmp_7431 = tmp_struct_186.field2; + CursorTy pvrtmp_7432 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2981 = 1; + + CursorTy writetag_5054 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7429, pvrtmp_7430, + loc_2981, pvrtmp_7432}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7441 = *(CursorTy *) tmpcur_7416; + CursorTy tmpaftercur_7442 = tmpcur_7416 + 8; + CursorTy jump_4371 = tmpcur_7416 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2982, end_r_2983, loc_2981, tmpcur_7441); + CursorTy pvrtmp_7443 = tmp_struct_187.field0; + CursorTy pvrtmp_7444 = tmp_struct_187.field1; + CursorTy pvrtmp_7445 = tmp_struct_187.field2; + CursorTy pvrtmp_7446 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7443, jump_4371, + pvrtmp_7445, pvrtmp_7446}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7453 = *(CursorTy *) tmpcur_7416; + CursorTy tmpaftercur_7454 = tmpcur_7416 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2982, end_r_2983, loc_2981, tmpcur_7453); + CursorTy pvrtmp_7455 = tmp_struct_188.field0; + CursorTy pvrtmp_7456 = tmp_struct_188.field1; + CursorTy pvrtmp_7457 = tmp_struct_188.field2; + CursorTy pvrtmp_7458 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7455, pvrtmp_7456, + pvrtmp_7457, pvrtmp_7458}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7415"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2986, + CursorTy end_r_2987, + CursorTy loc_2985, + CursorTy arg_2720) +{ + if (loc_2985 + 32 > end_r_2987) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2987); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2987 = chunk_end_218; + *(TagTyPacked *) loc_2985 = 255; + + CursorTy redir = loc_2985 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2985 = chunk_start_217; + } + + CursorTy loc_3739 = loc_2985 + 1; + CursorTy loc_3740 = loc_3739 + 8; + CursorTy loc_3741 = loc_3740 + 8; + CursorTy loc_3757 = loc_2985 + 1; + CursorTy loc_3758 = loc_3757 + 8; + CursorTy loc_3759 = loc_3758 + 8; + CursorTy loc_3779 = loc_2985 + 1; + CursorTy loc_3780 = loc_3779 + 8; + CursorTy loc_3781 = loc_3780 + 8; + CursorTy loc_3782 = loc_3781 + 8; + CursorTy loc_3806 = loc_2985 + 1; + CursorTy loc_3807 = loc_3806 + 8; + CursorTy loc_3808 = loc_3807 + 8; + CursorTy loc_3809 = loc_3808 + 8; + CursorTy loc_3833 = loc_2985 + 1; + CursorTy loc_3834 = loc_3833 + 8; + CursorTy loc_3835 = loc_3834 + 8; + CursorTy loc_3836 = loc_3835 + 8; + CursorTy loc_3860 = loc_2985 + 1; + CursorTy loc_3861 = loc_3860 + 8; + CursorTy loc_3862 = loc_3861 + 8; + CursorTy loc_3863 = loc_3862 + 8; + CursorTy loc_3887 = loc_2985 + 1; + CursorTy loc_3888 = loc_3887 + 8; + CursorTy loc_3889 = loc_3888 + 8; + CursorTy loc_3890 = loc_3889 + 8; + CursorTy loc_3914 = loc_2985 + 1; + CursorTy loc_3915 = loc_3914 + 8; + CursorTy loc_3916 = loc_3915 + 8; + CursorTy loc_3917 = loc_3916 + 8; + TagTyPacked tmpval_7466 = *(TagTyPacked *) arg_2720; + CursorTy tmpcur_7467 = arg_2720 + 1; + + + switch_7704: + ; + switch (tmpval_7466) { + + case 0: + { + CursorTy jump_4213 = arg_2720 + 1; + + *(TagTyPacked *) loc_2985 = 0; + + CursorTy writetag_5064 = loc_2985 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2987, jump_4213, + loc_2985, writetag_5064}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3741, tmpcur_7467); + CursorTy pvrtmp_7472 = tmp_struct_192.field0; + CursorTy pvrtmp_7473 = tmp_struct_192.field1; + CursorTy pvrtmp_7474 = tmp_struct_192.field2; + CursorTy pvrtmp_7475 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7472, pvrtmp_7475, pvrtmp_7473); + CursorTy pvrtmp_7480 = tmp_struct_193.field0; + CursorTy pvrtmp_7481 = tmp_struct_193.field1; + CursorTy pvrtmp_7482 = tmp_struct_193.field2; + CursorTy pvrtmp_7483 = tmp_struct_193.field3; + IntTy sizeof_y_2723__2725 = pvrtmp_7475 - pvrtmp_7474; + IntTy sizeof_y_2724__2726 = pvrtmp_7483 - pvrtmp_7482; + IntTy fltPrm_2814 = sizeof_y_2723__2725 + 0; + IntTy offset__2727 = 0 + fltPrm_2814; + IntTy fltPrm_2815 = sizeof_y_2723__2725 + sizeof_y_2724__2726; + IntTy size_dcon_2728 = 9 + fltPrm_2815; + + *(TagTyPacked *) loc_2985 = 160; + + CursorTy writetag_5069 = loc_2985 + 1; + + *(IntTy *) writetag_5069 = size_dcon_2728; + + CursorTy writecur_5070 = writetag_5069 + sizeof(IntTy); + + *(IntTy *) writecur_5070 = offset__2727; + + CursorTy writecur_5071 = writecur_5070 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7480, pvrtmp_7481, + loc_2985, pvrtmp_7483}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3759, tmpcur_7467); + CursorTy pvrtmp_7492 = tmp_struct_194.field0; + CursorTy pvrtmp_7493 = tmp_struct_194.field1; + CursorTy pvrtmp_7494 = tmp_struct_194.field2; + CursorTy pvrtmp_7495 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7492, pvrtmp_7495, pvrtmp_7493); + CursorTy pvrtmp_7500 = tmp_struct_195.field0; + CursorTy pvrtmp_7501 = tmp_struct_195.field1; + CursorTy pvrtmp_7502 = tmp_struct_195.field2; + CursorTy pvrtmp_7503 = tmp_struct_195.field3; + IntTy sizeof_y_2731__2733 = pvrtmp_7495 - pvrtmp_7494; + IntTy sizeof_y_2732__2734 = pvrtmp_7503 - pvrtmp_7502; + IntTy fltPrm_2816 = sizeof_y_2731__2733 + 0; + IntTy offset__2735 = 0 + fltPrm_2816; + IntTy fltPrm_2817 = sizeof_y_2731__2733 + sizeof_y_2732__2734; + IntTy size_dcon_2736 = 9 + fltPrm_2817; + + *(TagTyPacked *) loc_2985 = 162; + + CursorTy writetag_5078 = loc_2985 + 1; + + *(IntTy *) writetag_5078 = size_dcon_2736; + + CursorTy writecur_5079 = writetag_5078 + sizeof(IntTy); + + *(IntTy *) writecur_5079 = offset__2735; + + CursorTy writecur_5080 = writecur_5079 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7500, pvrtmp_7501, + loc_2985, pvrtmp_7503}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2986, end_r_2987, loc_3782, tmpcur_7467); + CursorTy pvrtmp_7512 = tmp_struct_196.field0; + CursorTy pvrtmp_7513 = tmp_struct_196.field1; + CursorTy pvrtmp_7514 = tmp_struct_196.field2; + CursorTy pvrtmp_7515 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7512, pvrtmp_7515, pvrtmp_7513); + CursorTy pvrtmp_7520 = tmp_struct_197.field0; + CursorTy pvrtmp_7521 = tmp_struct_197.field1; + CursorTy pvrtmp_7522 = tmp_struct_197.field2; + CursorTy pvrtmp_7523 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7520, pvrtmp_7523, pvrtmp_7521); + CursorTy pvrtmp_7528 = tmp_struct_198.field0; + CursorTy pvrtmp_7529 = tmp_struct_198.field1; + CursorTy pvrtmp_7530 = tmp_struct_198.field2; + CursorTy pvrtmp_7531 = tmp_struct_198.field3; + IntTy sizeof_y_2740__2743 = pvrtmp_7515 - pvrtmp_7514; + IntTy sizeof_y_2741__2744 = pvrtmp_7523 - pvrtmp_7522; + IntTy sizeof_y_2742__2745 = pvrtmp_7531 - pvrtmp_7530; + IntTy fltPrm_2818 = sizeof_y_2740__2743 + 0; + IntTy offset__2746 = 8 + fltPrm_2818; + IntTy fltPrm_2819 = sizeof_y_2740__2743 + sizeof_y_2741__2744; + IntTy offset__2747 = 0 + fltPrm_2819; + IntTy fltPrm_2821 = sizeof_y_2741__2744 + sizeof_y_2742__2745; + IntTy fltPrm_2820 = sizeof_y_2740__2743 + fltPrm_2821; + IntTy size_dcon_2748 = 17 + fltPrm_2820; + + *(TagTyPacked *) loc_2985 = 164; + + CursorTy writetag_5088 = loc_2985 + 1; + + *(IntTy *) writetag_5088 = size_dcon_2748; + + CursorTy writecur_5089 = writetag_5088 + sizeof(IntTy); + + *(IntTy *) writecur_5089 = offset__2746; + + CursorTy writecur_5090 = writecur_5089 + sizeof(IntTy); + + *(IntTy *) writecur_5090 = offset__2747; + + CursorTy writecur_5091 = writecur_5090 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7528, pvrtmp_7529, + loc_2985, pvrtmp_7531}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3809, tmpcur_7467); + CursorTy pvrtmp_7540 = tmp_struct_199.field0; + CursorTy pvrtmp_7541 = tmp_struct_199.field1; + CursorTy pvrtmp_7542 = tmp_struct_199.field2; + CursorTy pvrtmp_7543 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7540, pvrtmp_7543, pvrtmp_7541); + CursorTy pvrtmp_7548 = tmp_struct_200.field0; + CursorTy pvrtmp_7549 = tmp_struct_200.field1; + CursorTy pvrtmp_7550 = tmp_struct_200.field2; + CursorTy pvrtmp_7551 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7548, pvrtmp_7551, pvrtmp_7549); + CursorTy pvrtmp_7556 = tmp_struct_201.field0; + CursorTy pvrtmp_7557 = tmp_struct_201.field1; + CursorTy pvrtmp_7558 = tmp_struct_201.field2; + CursorTy pvrtmp_7559 = tmp_struct_201.field3; + IntTy sizeof_y_2752__2755 = pvrtmp_7543 - pvrtmp_7542; + IntTy sizeof_y_2753__2756 = pvrtmp_7551 - pvrtmp_7550; + IntTy sizeof_y_2754__2757 = pvrtmp_7559 - pvrtmp_7558; + IntTy fltPrm_2822 = sizeof_y_2752__2755 + 0; + IntTy offset__2758 = 8 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2752__2755 + sizeof_y_2753__2756; + IntTy offset__2759 = 0 + fltPrm_2823; + IntTy fltPrm_2825 = sizeof_y_2753__2756 + sizeof_y_2754__2757; + IntTy fltPrm_2824 = sizeof_y_2752__2755 + fltPrm_2825; + IntTy size_dcon_2760 = 17 + fltPrm_2824; + + *(TagTyPacked *) loc_2985 = 166; + + CursorTy writetag_5100 = loc_2985 + 1; + + *(IntTy *) writetag_5100 = size_dcon_2760; + + CursorTy writecur_5101 = writetag_5100 + sizeof(IntTy); + + *(IntTy *) writecur_5101 = offset__2758; + + CursorTy writecur_5102 = writecur_5101 + sizeof(IntTy); + + *(IntTy *) writecur_5102 = offset__2759; + + CursorTy writecur_5103 = writecur_5102 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7556, pvrtmp_7557, + loc_2985, pvrtmp_7559}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2986, end_r_2987, loc_3836, tmpcur_7467); + CursorTy pvrtmp_7568 = tmp_struct_202.field0; + CursorTy pvrtmp_7569 = tmp_struct_202.field1; + CursorTy pvrtmp_7570 = tmp_struct_202.field2; + CursorTy pvrtmp_7571 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7568, pvrtmp_7571, pvrtmp_7569); + CursorTy pvrtmp_7576 = tmp_struct_203.field0; + CursorTy pvrtmp_7577 = tmp_struct_203.field1; + CursorTy pvrtmp_7578 = tmp_struct_203.field2; + CursorTy pvrtmp_7579 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7576, pvrtmp_7579, pvrtmp_7577); + CursorTy pvrtmp_7584 = tmp_struct_204.field0; + CursorTy pvrtmp_7585 = tmp_struct_204.field1; + CursorTy pvrtmp_7586 = tmp_struct_204.field2; + CursorTy pvrtmp_7587 = tmp_struct_204.field3; + IntTy sizeof_y_2764__2767 = pvrtmp_7571 - pvrtmp_7570; + IntTy sizeof_y_2765__2768 = pvrtmp_7579 - pvrtmp_7578; + IntTy sizeof_y_2766__2769 = pvrtmp_7587 - pvrtmp_7586; + IntTy fltPrm_2826 = sizeof_y_2764__2767 + 0; + IntTy offset__2770 = 8 + fltPrm_2826; + IntTy fltPrm_2827 = sizeof_y_2764__2767 + sizeof_y_2765__2768; + IntTy offset__2771 = 0 + fltPrm_2827; + IntTy fltPrm_2829 = sizeof_y_2765__2768 + sizeof_y_2766__2769; + IntTy fltPrm_2828 = sizeof_y_2764__2767 + fltPrm_2829; + IntTy size_dcon_2772 = 17 + fltPrm_2828; + + *(TagTyPacked *) loc_2985 = 168; + + CursorTy writetag_5112 = loc_2985 + 1; + + *(IntTy *) writetag_5112 = size_dcon_2772; + + CursorTy writecur_5113 = writetag_5112 + sizeof(IntTy); + + *(IntTy *) writecur_5113 = offset__2770; + + CursorTy writecur_5114 = writecur_5113 + sizeof(IntTy); + + *(IntTy *) writecur_5114 = offset__2771; + + CursorTy writecur_5115 = writecur_5114 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7584, pvrtmp_7585, + loc_2985, pvrtmp_7587}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3863, tmpcur_7467); + CursorTy pvrtmp_7596 = tmp_struct_205.field0; + CursorTy pvrtmp_7597 = tmp_struct_205.field1; + CursorTy pvrtmp_7598 = tmp_struct_205.field2; + CursorTy pvrtmp_7599 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7596, pvrtmp_7599, pvrtmp_7597); + CursorTy pvrtmp_7604 = tmp_struct_206.field0; + CursorTy pvrtmp_7605 = tmp_struct_206.field1; + CursorTy pvrtmp_7606 = tmp_struct_206.field2; + CursorTy pvrtmp_7607 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7604, pvrtmp_7607, pvrtmp_7605); + CursorTy pvrtmp_7612 = tmp_struct_207.field0; + CursorTy pvrtmp_7613 = tmp_struct_207.field1; + CursorTy pvrtmp_7614 = tmp_struct_207.field2; + CursorTy pvrtmp_7615 = tmp_struct_207.field3; + IntTy sizeof_y_2776__2779 = pvrtmp_7599 - pvrtmp_7598; + IntTy sizeof_y_2777__2780 = pvrtmp_7607 - pvrtmp_7606; + IntTy sizeof_y_2778__2781 = pvrtmp_7615 - pvrtmp_7614; + IntTy fltPrm_2830 = sizeof_y_2776__2779 + 0; + IntTy offset__2782 = 8 + fltPrm_2830; + IntTy fltPrm_2831 = sizeof_y_2776__2779 + sizeof_y_2777__2780; + IntTy offset__2783 = 0 + fltPrm_2831; + IntTy fltPrm_2833 = sizeof_y_2777__2780 + sizeof_y_2778__2781; + IntTy fltPrm_2832 = sizeof_y_2776__2779 + fltPrm_2833; + IntTy size_dcon_2784 = 17 + fltPrm_2832; + + *(TagTyPacked *) loc_2985 = 170; + + CursorTy writetag_5124 = loc_2985 + 1; + + *(IntTy *) writetag_5124 = size_dcon_2784; + + CursorTy writecur_5125 = writetag_5124 + sizeof(IntTy); + + *(IntTy *) writecur_5125 = offset__2782; + + CursorTy writecur_5126 = writecur_5125 + sizeof(IntTy); + + *(IntTy *) writecur_5126 = offset__2783; + + CursorTy writecur_5127 = writecur_5126 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7612, pvrtmp_7613, + loc_2985, pvrtmp_7615}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3890, tmpcur_7467); + CursorTy pvrtmp_7624 = tmp_struct_208.field0; + CursorTy pvrtmp_7625 = tmp_struct_208.field1; + CursorTy pvrtmp_7626 = tmp_struct_208.field2; + CursorTy pvrtmp_7627 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7624, pvrtmp_7627, pvrtmp_7625); + CursorTy pvrtmp_7632 = tmp_struct_209.field0; + CursorTy pvrtmp_7633 = tmp_struct_209.field1; + CursorTy pvrtmp_7634 = tmp_struct_209.field2; + CursorTy pvrtmp_7635 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7632, pvrtmp_7635, pvrtmp_7633); + CursorTy pvrtmp_7640 = tmp_struct_210.field0; + CursorTy pvrtmp_7641 = tmp_struct_210.field1; + CursorTy pvrtmp_7642 = tmp_struct_210.field2; + CursorTy pvrtmp_7643 = tmp_struct_210.field3; + IntTy sizeof_y_2788__2791 = pvrtmp_7627 - pvrtmp_7626; + IntTy sizeof_y_2789__2792 = pvrtmp_7635 - pvrtmp_7634; + IntTy sizeof_y_2790__2793 = pvrtmp_7643 - pvrtmp_7642; + IntTy fltPrm_2834 = sizeof_y_2788__2791 + 0; + IntTy offset__2794 = 8 + fltPrm_2834; + IntTy fltPrm_2835 = sizeof_y_2788__2791 + sizeof_y_2789__2792; + IntTy offset__2795 = 0 + fltPrm_2835; + IntTy fltPrm_2837 = sizeof_y_2789__2792 + sizeof_y_2790__2793; + IntTy fltPrm_2836 = sizeof_y_2788__2791 + fltPrm_2837; + IntTy size_dcon_2796 = 17 + fltPrm_2836; + + *(TagTyPacked *) loc_2985 = 172; + + CursorTy writetag_5136 = loc_2985 + 1; + + *(IntTy *) writetag_5136 = size_dcon_2796; + + CursorTy writecur_5137 = writetag_5136 + sizeof(IntTy); + + *(IntTy *) writecur_5137 = offset__2794; + + CursorTy writecur_5138 = writecur_5137 + sizeof(IntTy); + + *(IntTy *) writecur_5138 = offset__2795; + + CursorTy writecur_5139 = writecur_5138 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7640, pvrtmp_7641, + loc_2985, pvrtmp_7643}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3917, tmpcur_7467); + CursorTy pvrtmp_7652 = tmp_struct_211.field0; + CursorTy pvrtmp_7653 = tmp_struct_211.field1; + CursorTy pvrtmp_7654 = tmp_struct_211.field2; + CursorTy pvrtmp_7655 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7652, pvrtmp_7655, pvrtmp_7653); + CursorTy pvrtmp_7660 = tmp_struct_212.field0; + CursorTy pvrtmp_7661 = tmp_struct_212.field1; + CursorTy pvrtmp_7662 = tmp_struct_212.field2; + CursorTy pvrtmp_7663 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7660, pvrtmp_7663, pvrtmp_7661); + CursorTy pvrtmp_7668 = tmp_struct_213.field0; + CursorTy pvrtmp_7669 = tmp_struct_213.field1; + CursorTy pvrtmp_7670 = tmp_struct_213.field2; + CursorTy pvrtmp_7671 = tmp_struct_213.field3; + IntTy sizeof_y_2800__2803 = pvrtmp_7655 - pvrtmp_7654; + IntTy sizeof_y_2801__2804 = pvrtmp_7663 - pvrtmp_7662; + IntTy sizeof_y_2802__2805 = pvrtmp_7671 - pvrtmp_7670; + IntTy fltPrm_2838 = sizeof_y_2800__2803 + 0; + IntTy offset__2806 = 8 + fltPrm_2838; + IntTy fltPrm_2839 = sizeof_y_2800__2803 + sizeof_y_2801__2804; + IntTy offset__2807 = 0 + fltPrm_2839; + IntTy fltPrm_2841 = sizeof_y_2801__2804 + sizeof_y_2802__2805; + IntTy fltPrm_2840 = sizeof_y_2800__2803 + fltPrm_2841; + IntTy size_dcon_2808 = 17 + fltPrm_2840; + + *(TagTyPacked *) loc_2985 = 174; + + CursorTy writetag_5148 = loc_2985 + 1; + + *(IntTy *) writetag_5148 = size_dcon_2808; + + CursorTy writecur_5149 = writetag_5148 + sizeof(IntTy); + + *(IntTy *) writecur_5149 = offset__2806; + + CursorTy writecur_5150 = writecur_5149 + sizeof(IntTy); + + *(IntTy *) writecur_5150 = offset__2807; + + CursorTy writecur_5151 = writecur_5150 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7668, pvrtmp_7669, + loc_2985, pvrtmp_7671}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7680 = *(CursorTy *) tmpcur_7467; + CursorTy tmpaftercur_7681 = tmpcur_7467 + 8; + CursorTy jump_4377 = tmpcur_7467 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_2985, tmpcur_7680); + CursorTy pvrtmp_7682 = tmp_struct_214.field0; + CursorTy pvrtmp_7683 = tmp_struct_214.field1; + CursorTy pvrtmp_7684 = tmp_struct_214.field2; + CursorTy pvrtmp_7685 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7682, jump_4377, + pvrtmp_7684, pvrtmp_7685}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7692 = *(CursorTy *) tmpcur_7467; + CursorTy tmpaftercur_7693 = tmpcur_7467 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_2985, tmpcur_7692); + CursorTy pvrtmp_7694 = tmp_struct_215.field0; + CursorTy pvrtmp_7695 = tmp_struct_215.field1; + CursorTy pvrtmp_7696 = tmp_struct_215.field2; + CursorTy pvrtmp_7697 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7694, pvrtmp_7695, + pvrtmp_7696, pvrtmp_7697}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7466"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2990, + CursorTy end_r_2991, + CursorTy loc_2989, + CursorTy arg_2809) +{ + if (loc_2989 + 32 > end_r_2991) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2991); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2991 = chunk_end_224; + *(TagTyPacked *) loc_2989 = 255; + + CursorTy redir = loc_2989 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2989 = chunk_start_223; + } + + CursorTy loc_3937 = loc_2989 + 1; + CursorTy loc_3938 = loc_3937 + 8; + TagTyPacked tmpval_7705 = *(TagTyPacked *) arg_2809; + CursorTy tmpcur_7706 = arg_2809 + 1; + + + switch_7749: + ; + switch (tmpval_7705) { + + case 0: + { + CursorTy jump_4245 = arg_2809 + 1; + + *(TagTyPacked *) loc_2989 = 0; + + CursorTy writetag_5163 = loc_2989 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2991, jump_4245, + loc_2989, writetag_5163}; + break; + } + + case 1: + { + IntTy tmpval_7711 = *(IntTy *) tmpcur_7706; + CursorTy tmpcur_7712 = tmpcur_7706 + sizeof(IntTy); + CursorTy jump_4247 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_3938, tmpcur_7712); + CursorTy pvrtmp_7713 = tmp_struct_219.field0; + CursorTy pvrtmp_7714 = tmp_struct_219.field1; + CursorTy pvrtmp_7715 = tmp_struct_219.field2; + CursorTy pvrtmp_7716 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2989 = 1; + + CursorTy writetag_5168 = loc_2989 + 1; + + *(IntTy *) writetag_5168 = tmpval_7711; + + CursorTy writecur_5169 = writetag_5168 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7713, pvrtmp_7714, + loc_2989, pvrtmp_7716}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7725 = *(CursorTy *) tmpcur_7706; + CursorTy tmpaftercur_7726 = tmpcur_7706 + 8; + CursorTy jump_4383 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_2989, tmpcur_7725); + CursorTy pvrtmp_7727 = tmp_struct_220.field0; + CursorTy pvrtmp_7728 = tmp_struct_220.field1; + CursorTy pvrtmp_7729 = tmp_struct_220.field2; + CursorTy pvrtmp_7730 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7727, jump_4383, + pvrtmp_7729, pvrtmp_7730}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7737 = *(CursorTy *) tmpcur_7706; + CursorTy tmpaftercur_7738 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_2989, tmpcur_7737); + CursorTy pvrtmp_7739 = tmp_struct_221.field0; + CursorTy pvrtmp_7740 = tmp_struct_221.field1; + CursorTy pvrtmp_7741 = tmp_struct_221.field2; + CursorTy pvrtmp_7742 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7739, pvrtmp_7740, + pvrtmp_7741, pvrtmp_7742}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7705"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6145, ")"); + add_symbol(6146, "(Text "); + add_symbol(6147, "(Tag "); + add_symbol(6148, "(TCA "); + add_symbol(6149, "(TAC "); + add_symbol(6150, "(Nul "); + add_symbol(6151, "(Nil "); + add_symbol(6152, "(Image "); + add_symbol(6153, "(End "); + add_symbol(6154, "(Char "); + add_symbol(6155, "(CTA "); + add_symbol(6156, "(CAT "); + add_symbol(6157, "(CA "); + add_symbol(6158, "(ATC "); + add_symbol(6159, "(ACT "); + add_symbol(6160, "(AC "); + add_symbol(6161, " ->r "); + add_symbol(6162, " ->i "); + + RegionTy *region_6163 = alloc_region(global_init_inf_buf_size); + CursorTy r_3001 = region_6163->reg_heap; + IntTy sizeof_end_r_3001_6164 = global_init_inf_buf_size; + CursorTy end_r_3001 = r_3001 + sizeof_end_r_3001_6164; + RegionTy *region_6165 = alloc_region(global_init_inf_buf_size); + CursorTy r_3000 = region_6165->reg_heap; + IntTy sizeof_end_r_3000_6166 = global_init_inf_buf_size; + CursorTy end_r_3000 = r_3000 + sizeof_end_r_3000_6166; + CursorCursorCursorProd tmp_struct_225 = + mkATCList(end_r_3001, r_3001, 100000, 10, 2000); + CursorTy pvrtmp_6167 = tmp_struct_225.field0; + CursorTy pvrtmp_6168 = tmp_struct_225.field1; + CursorTy pvrtmp_6169 = tmp_struct_225.field2; + CursorTy pvrtmp_6183; + CursorTy pvrtmp_6184; + CursorTy pvrtmp_6185; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6183; + struct timespec end_pvrtmp_6183; + + start_counters(); + for (long long iters_pvrtmp_6183 = 0; iters_pvrtmp_6183 < + global_iters_param; iters_pvrtmp_6183++) { + if (iters_pvrtmp_6183 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6183); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6167, end_r_3000, r_3000, pvrtmp_6168); + CursorTy pvrtmp_6174 = tmp_struct_226.field0; + CursorTy pvrtmp_6175 = tmp_struct_226.field1; + CursorTy pvrtmp_6176 = tmp_struct_226.field2; + + pvrtmp_6183 = pvrtmp_6174; + pvrtmp_6184 = pvrtmp_6175; + pvrtmp_6185 = pvrtmp_6176; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6183); + if (iters_pvrtmp_6183 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6183, + &end_pvrtmp_6183); + + vector_inplace_update(times_230, iters_pvrtmp_6183, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAtc2.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAtc2.c new file mode 100644 index 000000000..dd1ee49cd --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsAtc2.c @@ -0,0 +1,5058 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2906, CursorTy end_r_2907, + CursorTy loc_2905, + CursorTy adt_14_900_1516); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2910, CursorTy end_r_2911, + CursorTy loc_2909, + CursorTy tags_20_906_1522, + IntTy inVal_21_907_1523); +CursorCursorCursorProd mkATCList(CursorTy end_r_2913, CursorTy loc_2912, + IntTy len_24_910_1528, + IntTy tagLen_25_911_1529, + IntTy strLen_26_912_1530); +CursorCursorCursorProd mkString(CursorTy end_r_2915, CursorTy loc_2914, + IntTy len_179_1065_1536); +CursorCursorCursorProd mkContentText(CursorTy end_r_2917, CursorTy loc_2916, + IntTy n_193_1079_1542); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2919, CursorTy loc_2918, + IntTy len_318_1204_1544); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2922, + CursorTy end_r_2923, + CursorTy loc_2921, + CursorTy arg_622_1228_1549); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2926, + CursorTy end_r_2927, + CursorTy loc_2925, + CursorTy arg_627_1233_1554); +CursorProd _traverse_String(CursorTy end_r_2929, CursorTy arg_632_1238_1559); +CursorProd _print_String(CursorTy end_r_2931, CursorTy arg_637_1242_1563); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_646_1251_1572); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2938, + CursorTy end_r_2939, + CursorTy loc_2937, + CursorTy arg_651_1256_1577); +CursorProd _traverse_Content(CursorTy end_r_2941, CursorTy arg_656_1261_1582); +CursorProd _print_Content(CursorTy end_r_2943, CursorTy arg_661_1266_1587); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2946, CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_670_1275_1596); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2950, + CursorTy end_r_2951, + CursorTy loc_2949, + CursorTy arg_715_1320_1641); +CursorProd _traverse_Adt(CursorTy end_r_2953, CursorTy arg_760_1365_1686); +CursorProd _print_Adt(CursorTy end_r_2955, CursorTy arg_805_1410_1731); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2958, + CursorTy end_r_2959, CursorTy loc_2957, + CursorTy arg_868_1473_1794); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2962, + CursorTy end_r_2963, + CursorTy loc_2961, + CursorTy arg_873_1478_1799); +CursorProd _traverse_Tags(CursorTy end_r_2965, CursorTy arg_878_1483_1804); +CursorProd _print_Tags(CursorTy end_r_2967, CursorTy arg_883_1487_1808); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2970, CursorTy end_r_2971, + CursorTy loc_2969, CursorTy arg_2702); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2974, CursorTy end_r_2975, + CursorTy loc_2973, CursorTy arg_2707); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2712); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2801); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2906, CursorTy end_r_2907, + CursorTy loc_2905, + CursorTy adt_14_900_1516) +{ + if (loc_2905 + 32 > end_r_2907) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2907); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2907 = chunk_end_6; + *(TagTyPacked *) loc_2905 = 255; + + CursorTy redir = loc_2905 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2905 = chunk_start_5; + } + + CursorTy loc_3008 = loc_2905 + 1; + CursorTy loc_3009 = loc_3008 + 8; + CursorTy loc_3010 = loc_3009 + 8; + TagTyPacked tmpval_6177 = *(TagTyPacked *) adt_14_900_1516; + CursorTy tmpcur_6178 = adt_14_900_1516 + 1; + + + switch_6230: + ; + switch (tmpval_6177) { + + case 0: + { + CursorTy jump_3933 = adt_14_900_1516 + 1; + + *(TagTyPacked *) loc_2905 = 0; + + CursorTy writetag_4492 = loc_2905 + 1; + + return (CursorCursorCursorProd) {end_r_2907, loc_2905, + writetag_4492}; + break; + } + + case 19: + { + CursorTy tmpcur_6183 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6184 = tmpcur_6178 + 8; + CursorTy tmpcur_6185 = *(CursorTy *) tmpaftercur_6184; + CursorTy tmpaftercur_6186 = tmpaftercur_6184 + 8; + CursorTy jump_3936 = tmpaftercur_6184 + 8; + CursorTy jump_3935 = tmpcur_6178 + 8; + CursorCursorCursorProd tmp_struct_0 = + addValTagsAdt(end_r_2906, end_r_2907, loc_3010, tmpaftercur_6186); + CursorTy pvrtmp_6187 = tmp_struct_0.field0; + CursorTy pvrtmp_6188 = tmp_struct_0.field1; + CursorTy pvrtmp_6189 = tmp_struct_0.field2; + CursorCursorCursorCursorProd tmp_struct_1 = + addValTag(end_r_2906, pvrtmp_6187, pvrtmp_6189, tmpcur_6183, 10); + CursorTy pvrtmp_6194 = tmp_struct_1.field0; + CursorTy pvrtmp_6195 = tmp_struct_1.field1; + CursorTy pvrtmp_6196 = tmp_struct_1.field2; + CursorTy pvrtmp_6197 = tmp_struct_1.field3; + + *(TagTyPacked *) pvrtmp_6197 = 254; + + CursorTy writetag_4499 = pvrtmp_6197 + 1; + + *(CursorTy *) writetag_4499 = tmpcur_6185; + + CursorTy writecur_4500 = writetag_4499 + 8; + + *(TagTyPacked *) loc_2905 = 19; + + CursorTy writetag_4502 = loc_2905 + 1; + + *(CursorTy *) writetag_4502 = pvrtmp_6189; + + CursorTy writecur_4503 = writetag_4502 + 8; + + *(CursorTy *) writecur_4503 = pvrtmp_6197; + + CursorTy writecur_4504 = writecur_4503 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6194, loc_2905, + writecur_4500}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6208 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6209 = tmpcur_6178 + 8; + CursorTy jump_4245 = tmpcur_6178 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2906, end_r_2907, loc_2905, tmpcur_6208); + CursorTy pvrtmp_6210 = tmp_struct_2.field0; + CursorTy pvrtmp_6211 = tmp_struct_2.field1; + CursorTy pvrtmp_6212 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6210, pvrtmp_6211, + pvrtmp_6212}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6219 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6220 = tmpcur_6178 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2906, end_r_2907, loc_2905, tmpcur_6219); + CursorTy pvrtmp_6221 = tmp_struct_3.field0; + CursorTy pvrtmp_6222 = tmp_struct_3.field1; + CursorTy pvrtmp_6223 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6221, pvrtmp_6222, + pvrtmp_6223}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6177"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2910, CursorTy end_r_2911, + CursorTy loc_2909, + CursorTy tags_20_906_1522, + IntTy inVal_21_907_1523) +{ + if (loc_2909 + 32 > end_r_2911) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2911); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2911 = chunk_end_12; + *(TagTyPacked *) loc_2909 = 255; + + CursorTy redir = loc_2909 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2909 = chunk_start_11; + } + + CursorTy loc_3028 = loc_2909 + 1; + CursorTy loc_3029 = loc_3028 + 8; + TagTyPacked tmpval_6231 = *(TagTyPacked *) tags_20_906_1522; + CursorTy tmpcur_6232 = tags_20_906_1522 + 1; + + + switch_6275: + ; + switch (tmpval_6231) { + + case 0: + { + CursorTy jump_3939 = tags_20_906_1522 + 1; + + *(TagTyPacked *) loc_2909 = 0; + + CursorTy writetag_4516 = loc_2909 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2911, jump_3939, + loc_2909, writetag_4516}; + break; + } + + case 1: + { + IntTy tmpval_6237 = *(IntTy *) tmpcur_6232; + CursorTy tmpcur_6238 = tmpcur_6232 + sizeof(IntTy); + CursorTy jump_3941 = tmpcur_6232 + 8; + IntTy fltPkd_1504_1526 = tmpval_6237 + inVal_21_907_1523; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2910, end_r_2911, loc_3029, tmpcur_6238, inVal_21_907_1523); + CursorTy pvrtmp_6239 = tmp_struct_7.field0; + CursorTy pvrtmp_6240 = tmp_struct_7.field1; + CursorTy pvrtmp_6241 = tmp_struct_7.field2; + CursorTy pvrtmp_6242 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2909 = 1; + + CursorTy writetag_4521 = loc_2909 + 1; + + *(IntTy *) writetag_4521 = fltPkd_1504_1526; + + CursorTy writecur_4522 = writetag_4521 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6239, pvrtmp_6240, + loc_2909, pvrtmp_6242}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6251 = *(CursorTy *) tmpcur_6232; + CursorTy tmpaftercur_6252 = tmpcur_6232 + 8; + CursorTy jump_4250 = tmpcur_6232 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2910, end_r_2911, loc_2909, tmpcur_6251, inVal_21_907_1523); + CursorTy pvrtmp_6253 = tmp_struct_8.field0; + CursorTy pvrtmp_6254 = tmp_struct_8.field1; + CursorTy pvrtmp_6255 = tmp_struct_8.field2; + CursorTy pvrtmp_6256 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6253, jump_4250, + pvrtmp_6255, pvrtmp_6256}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6263 = *(CursorTy *) tmpcur_6232; + CursorTy tmpaftercur_6264 = tmpcur_6232 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2910, end_r_2911, loc_2909, tmpcur_6263, inVal_21_907_1523); + CursorTy pvrtmp_6265 = tmp_struct_9.field0; + CursorTy pvrtmp_6266 = tmp_struct_9.field1; + CursorTy pvrtmp_6267 = tmp_struct_9.field2; + CursorTy pvrtmp_6268 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6265, pvrtmp_6266, + pvrtmp_6267, pvrtmp_6268}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6231"); + exit(1); + } + } +} +CursorCursorCursorProd mkATCList(CursorTy end_r_2913, CursorTy loc_2912, + IntTy len_24_910_1528, + IntTy tagLen_25_911_1529, + IntTy strLen_26_912_1530) +{ + if (loc_2912 + 32 > end_r_2913) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2913); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2913 = chunk_end_18; + *(TagTyPacked *) loc_2912 = 255; + + CursorTy redir = loc_2912 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2912 = chunk_start_17; + } + + CursorTy loc_3037 = loc_2912 + 1; + CursorTy loc_3038 = loc_3037 + 8; + CursorTy loc_3039 = loc_3038 + 8; + BoolTy fltIf_1506_1531 = len_24_910_1528 <= 0; + + if (fltIf_1506_1531) { + *(TagTyPacked *) loc_2912 = 0; + + CursorTy writetag_4531 = loc_2912 + 1; + + return (CursorCursorCursorProd) {end_r_2913, loc_2912, writetag_4531}; + } else { + IntTy fltAppE_1507_1532 = len_24_910_1528 - 1; + CursorCursorCursorProd tmp_struct_13 = + mkATCList(end_r_2913, loc_3039, fltAppE_1507_1532, tagLen_25_911_1529, strLen_26_912_1530); + CursorTy pvrtmp_6280 = tmp_struct_13.field0; + CursorTy pvrtmp_6281 = tmp_struct_13.field1; + CursorTy pvrtmp_6282 = tmp_struct_13.field2; + CursorCursorCursorProd tmp_struct_14 = + mkRandomTags(pvrtmp_6280, pvrtmp_6282, tagLen_25_911_1529); + CursorTy pvrtmp_6287 = tmp_struct_14.field0; + CursorTy pvrtmp_6288 = tmp_struct_14.field1; + CursorTy pvrtmp_6289 = tmp_struct_14.field2; + CursorCursorCursorProd tmp_struct_15 = + mkContentText(pvrtmp_6287, pvrtmp_6289, strLen_26_912_1530); + CursorTy pvrtmp_6294 = tmp_struct_15.field0; + CursorTy pvrtmp_6295 = tmp_struct_15.field1; + CursorTy pvrtmp_6296 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2912 = 19; + + CursorTy writetag_4536 = loc_2912 + 1; + + *(CursorTy *) writetag_4536 = pvrtmp_6282; + + CursorTy writecur_4537 = writetag_4536 + 8; + + *(CursorTy *) writecur_4537 = pvrtmp_6289; + + CursorTy writecur_4538 = writecur_4537 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6294, loc_2912, pvrtmp_6296}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2915, CursorTy loc_2914, + IntTy len_179_1065_1536) +{ + if (loc_2914 + 32 > end_r_2915) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2915); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2915 = chunk_end_22; + *(TagTyPacked *) loc_2914 = 255; + + CursorTy redir = loc_2914 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2914 = chunk_start_21; + } + + CursorTy loc_3051 = loc_2914 + 1; + CursorTy loc_3052 = loc_3051 + 8; + BoolTy fltIf_1508_1537 = len_179_1065_1536 <= 0; + + if (fltIf_1508_1537) { + *(TagTyPacked *) loc_2914 = 0; + + CursorTy writetag_4543 = loc_2914 + 1; + + return (CursorCursorCursorProd) {end_r_2915, loc_2914, writetag_4543}; + } else { + IntTy fltPrm_1509_1538 = rand(); + IntTy randomChar_180_1066_1539 = fltPrm_1509_1538 % 128; + IntTy fltAppE_1510_1540 = len_179_1065_1536 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2915, loc_3052, fltAppE_1510_1540); + CursorTy pvrtmp_6309 = tmp_struct_19.field0; + CursorTy pvrtmp_6310 = tmp_struct_19.field1; + CursorTy pvrtmp_6311 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2914 = 1; + + CursorTy writetag_4546 = loc_2914 + 1; + + *(IntTy *) writetag_4546 = randomChar_180_1066_1539; + + CursorTy writecur_4547 = writetag_4546 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6309, loc_2914, pvrtmp_6311}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2917, CursorTy loc_2916, + IntTy n_193_1079_1542) +{ + if (loc_2916 + 32 > end_r_2917) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2917); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2917 = chunk_end_26; + *(TagTyPacked *) loc_2916 = 255; + + CursorTy redir = loc_2916 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2916 = chunk_start_25; + } + + CursorTy loc_3057 = loc_2916 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2917, loc_3057, n_193_1079_1542); + CursorTy pvrtmp_6320 = tmp_struct_23.field0; + CursorTy pvrtmp_6321 = tmp_struct_23.field1; + CursorTy pvrtmp_6322 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2916 = 1; + + CursorTy writetag_4551 = loc_2916 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6320, loc_2916, pvrtmp_6322}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2919, CursorTy loc_2918, + IntTy len_318_1204_1544) +{ + if (loc_2918 + 32 > end_r_2919) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2919); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2919 = chunk_end_30; + *(TagTyPacked *) loc_2918 = 255; + + CursorTy redir = loc_2918 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2918 = chunk_start_29; + } + + CursorTy loc_3061 = loc_2918 + 1; + CursorTy loc_3062 = loc_3061 + 8; + BoolTy fltIf_1512_1545 = len_318_1204_1544 <= 0; + + if (fltIf_1512_1545) { + *(TagTyPacked *) loc_2918 = 0; + + CursorTy writetag_4554 = loc_2918 + 1; + + return (CursorCursorCursorProd) {end_r_2919, loc_2918, writetag_4554}; + } else { + IntTy fltAppE_1513_1547 = len_318_1204_1544 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2919, loc_3062, fltAppE_1513_1547); + CursorTy pvrtmp_6335 = tmp_struct_27.field0; + CursorTy pvrtmp_6336 = tmp_struct_27.field1; + CursorTy pvrtmp_6337 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2918 = 1; + + CursorTy writetag_4557 = loc_2918 + 1; + + *(IntTy *) writetag_4557 = 100; + + CursorTy writecur_4558 = writetag_4557 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6335, loc_2918, pvrtmp_6337}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2922, + CursorTy end_r_2923, + CursorTy loc_2921, + CursorTy arg_622_1228_1549) +{ + if (loc_2921 + 32 > end_r_2923) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2923); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2923 = chunk_end_36; + *(TagTyPacked *) loc_2921 = 255; + + CursorTy redir = loc_2921 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2921 = chunk_start_35; + } + + CursorTy loc_3072 = loc_2921 + 1; + CursorTy loc_3073 = loc_3072 + 8; + TagTyPacked tmpval_6346 = *(TagTyPacked *) arg_622_1228_1549; + CursorTy tmpcur_6347 = arg_622_1228_1549 + 1; + + + switch_6390: + ; + switch (tmpval_6346) { + + case 0: + { + CursorTy jump_3951 = arg_622_1228_1549 + 1; + + *(TagTyPacked *) loc_2921 = 0; + + CursorTy writetag_4562 = loc_2921 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2923, jump_3951, + loc_2921, writetag_4562}; + break; + } + + case 1: + { + IntTy tmpval_6352 = *(IntTy *) tmpcur_6347; + CursorTy tmpcur_6353 = tmpcur_6347 + sizeof(IntTy); + CursorTy jump_3953 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2922, end_r_2923, loc_3073, tmpcur_6353); + CursorTy pvrtmp_6354 = tmp_struct_31.field0; + CursorTy pvrtmp_6355 = tmp_struct_31.field1; + CursorTy pvrtmp_6356 = tmp_struct_31.field2; + CursorTy pvrtmp_6357 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2921 = 1; + + CursorTy writetag_4567 = loc_2921 + 1; + + *(IntTy *) writetag_4567 = tmpval_6352; + + CursorTy writecur_4568 = writetag_4567 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6354, pvrtmp_6355, + loc_2921, pvrtmp_6357}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6366 = *(CursorTy *) tmpcur_6347; + CursorTy tmpaftercur_6367 = tmpcur_6347 + 8; + CursorTy jump_4256 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2922, end_r_2923, loc_2921, tmpcur_6366); + CursorTy pvrtmp_6368 = tmp_struct_32.field0; + CursorTy pvrtmp_6369 = tmp_struct_32.field1; + CursorTy pvrtmp_6370 = tmp_struct_32.field2; + CursorTy pvrtmp_6371 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6368, jump_4256, + pvrtmp_6370, pvrtmp_6371}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6378 = *(CursorTy *) tmpcur_6347; + CursorTy tmpaftercur_6379 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2922, end_r_2923, loc_2921, tmpcur_6378); + CursorTy pvrtmp_6380 = tmp_struct_33.field0; + CursorTy pvrtmp_6381 = tmp_struct_33.field1; + CursorTy pvrtmp_6382 = tmp_struct_33.field2; + CursorTy pvrtmp_6383 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6380, pvrtmp_6381, + pvrtmp_6382, pvrtmp_6383}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6346"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2926, + CursorTy end_r_2927, + CursorTy loc_2925, + CursorTy arg_627_1233_1554) +{ + CursorTy loc_3085 = loc_2925 + 1; + CursorTy loc_3086 = loc_3085 + 8; + TagTyPacked tmpval_6391 = *(TagTyPacked *) arg_627_1233_1554; + CursorTy tmpcur_6392 = arg_627_1233_1554 + 1; + + + switch_6435: + ; + switch (tmpval_6391) { + + case 0: + { + CursorTy jump_3956 = arg_627_1233_1554 + 1; + + *(TagTyPacked *) loc_2925 = 0; + + CursorTy writetag_4578 = loc_2925 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2927, jump_3956, + loc_2925, writetag_4578}; + break; + } + + case 1: + { + IntTy tmpval_6397 = *(IntTy *) tmpcur_6392; + CursorTy tmpcur_6398 = tmpcur_6392 + sizeof(IntTy); + CursorTy jump_3958 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_3086, tmpcur_6398); + CursorTy pvrtmp_6399 = tmp_struct_37.field0; + CursorTy pvrtmp_6400 = tmp_struct_37.field1; + CursorTy pvrtmp_6401 = tmp_struct_37.field2; + CursorTy pvrtmp_6402 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2925 = 1; + + CursorTy writetag_4583 = loc_2925 + 1; + + *(IntTy *) writetag_4583 = tmpval_6397; + + CursorTy writecur_4584 = writetag_4583 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6399, pvrtmp_6400, + loc_2925, pvrtmp_6402}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6411 = *(CursorTy *) tmpcur_6392; + CursorTy tmpaftercur_6412 = tmpcur_6392 + 8; + CursorTy jump_4262 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_2925, tmpcur_6411); + CursorTy pvrtmp_6413 = tmp_struct_38.field0; + CursorTy pvrtmp_6414 = tmp_struct_38.field1; + CursorTy pvrtmp_6415 = tmp_struct_38.field2; + CursorTy pvrtmp_6416 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6413, jump_4262, + pvrtmp_6415, pvrtmp_6416}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6423 = *(CursorTy *) tmpcur_6392; + CursorTy tmpaftercur_6424 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_2925, tmpcur_6423); + CursorTy pvrtmp_6425 = tmp_struct_39.field0; + CursorTy pvrtmp_6426 = tmp_struct_39.field1; + CursorTy pvrtmp_6427 = tmp_struct_39.field2; + CursorTy pvrtmp_6428 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6425, pvrtmp_6426, + pvrtmp_6427, pvrtmp_6428}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6391"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2929, CursorTy arg_632_1238_1559) +{ + TagTyPacked tmpval_6436 = *(TagTyPacked *) arg_632_1238_1559; + CursorTy tmpcur_6437 = arg_632_1238_1559 + 1; + + + switch_6447: + ; + switch (tmpval_6436) { + + case 0: + { + CursorTy jump_3961 = arg_632_1238_1559 + 1; + + return (CursorProd) {jump_3961}; + break; + } + + case 1: + { + IntTy tmpval_6438 = *(IntTy *) tmpcur_6437; + CursorTy tmpcur_6439 = tmpcur_6437 + sizeof(IntTy); + CursorTy jump_3963 = tmpcur_6437 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2929, tmpcur_6439); + CursorTy pvrtmp_6440 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6440}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6441 = *(CursorTy *) tmpcur_6437; + CursorTy tmpaftercur_6442 = tmpcur_6437 + 8; + CursorTy jump_4268 = tmpcur_6437 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2929, tmpcur_6441); + CursorTy pvrtmp_6443 = tmp_struct_41.field0; + + return (CursorProd) {jump_4268}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6444 = *(CursorTy *) tmpcur_6437; + CursorTy tmpaftercur_6445 = tmpcur_6437 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2929, tmpcur_6444); + CursorTy pvrtmp_6446 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6446}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6436"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2931, CursorTy arg_637_1242_1563) +{ + TagTyPacked tmpval_6448 = *(TagTyPacked *) arg_637_1242_1563; + CursorTy tmpcur_6449 = arg_637_1242_1563 + 1; + + + switch_6459: + ; + switch (tmpval_6448) { + + case 0: + { + CursorTy jump_3966 = arg_637_1242_1563 + 1; + unsigned char wildcard_638_1243_1564 = print_symbol(6137); + unsigned char wildcard_639_1244_1565 = print_symbol(6129); + + return (CursorProd) {jump_3966}; + break; + } + + case 1: + { + IntTy tmpval_6450 = *(IntTy *) tmpcur_6449; + CursorTy tmpcur_6451 = tmpcur_6449 + sizeof(IntTy); + CursorTy jump_3968 = tmpcur_6449 + 8; + unsigned char wildcard_644_1247_1568 = print_symbol(6138); + unsigned char y_642_1248_1569 = printf("%lld", tmpval_6450); + CursorProd tmp_struct_43 = _print_String(end_r_2931, tmpcur_6451); + CursorTy pvrtmp_6452 = tmp_struct_43.field0; + unsigned char wildcard_645_1250_1571 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6452}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6453 = *(CursorTy *) tmpcur_6449; + CursorTy tmpaftercur_6454 = tmpcur_6449 + 8; + CursorTy jump_4274 = tmpcur_6449 + 8; + unsigned char wildcard_4277 = print_symbol(6146); + CursorProd tmp_struct_44 = _print_String(end_r_2931, tmpcur_6453); + CursorTy pvrtmp_6455 = tmp_struct_44.field0; + + return (CursorProd) {jump_4274}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6456 = *(CursorTy *) tmpcur_6449; + CursorTy tmpaftercur_6457 = tmpcur_6449 + 8; + unsigned char wildcard_4277 = print_symbol(6145); + CursorProd tmp_struct_45 = _print_String(end_r_2931, tmpcur_6456); + CursorTy pvrtmp_6458 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6458}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6448"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_646_1251_1572) +{ + if (loc_2933 + 32 > end_r_2935) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2935); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2935 = chunk_end_52; + *(TagTyPacked *) loc_2933 = 255; + + CursorTy redir = loc_2933 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2933 = chunk_start_51; + } + + TagTyPacked tmpval_6460 = *(TagTyPacked *) arg_646_1251_1572; + CursorTy tmpcur_6461 = arg_646_1251_1572 + 1; + + + switch_6510: + ; + switch (tmpval_6460) { + + case 0: + { + CursorTy loc_3108 = loc_2933 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2934, end_r_2935, loc_3108, tmpcur_6461); + CursorTy pvrtmp_6462 = tmp_struct_46.field0; + CursorTy pvrtmp_6463 = tmp_struct_46.field1; + CursorTy pvrtmp_6464 = tmp_struct_46.field2; + CursorTy pvrtmp_6465 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2933 = 0; + + CursorTy writetag_4615 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6462, pvrtmp_6463, + loc_2933, pvrtmp_6465}; + break; + } + + case 1: + { + CursorTy loc_3114 = loc_2933 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2934, end_r_2935, loc_3114, tmpcur_6461); + CursorTy pvrtmp_6474 = tmp_struct_47.field0; + CursorTy pvrtmp_6475 = tmp_struct_47.field1; + CursorTy pvrtmp_6476 = tmp_struct_47.field2; + CursorTy pvrtmp_6477 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2933 = 1; + + CursorTy writetag_4620 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6474, pvrtmp_6475, + loc_2933, pvrtmp_6477}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6486 = *(CursorTy *) tmpcur_6461; + CursorTy tmpaftercur_6487 = tmpcur_6461 + 8; + CursorTy jump_4280 = tmpcur_6461 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2934, end_r_2935, loc_2933, tmpcur_6486); + CursorTy pvrtmp_6488 = tmp_struct_48.field0; + CursorTy pvrtmp_6489 = tmp_struct_48.field1; + CursorTy pvrtmp_6490 = tmp_struct_48.field2; + CursorTy pvrtmp_6491 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6488, jump_4280, + pvrtmp_6490, pvrtmp_6491}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6498 = *(CursorTy *) tmpcur_6461; + CursorTy tmpaftercur_6499 = tmpcur_6461 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2934, end_r_2935, loc_2933, tmpcur_6498); + CursorTy pvrtmp_6500 = tmp_struct_49.field0; + CursorTy pvrtmp_6501 = tmp_struct_49.field1; + CursorTy pvrtmp_6502 = tmp_struct_49.field2; + CursorTy pvrtmp_6503 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6500, pvrtmp_6501, + pvrtmp_6502, pvrtmp_6503}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6460"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2938, + CursorTy end_r_2939, + CursorTy loc_2937, + CursorTy arg_651_1256_1577) +{ + TagTyPacked tmpval_6511 = *(TagTyPacked *) arg_651_1256_1577; + CursorTy tmpcur_6512 = arg_651_1256_1577 + 1; + + + switch_6561: + ; + switch (tmpval_6511) { + + case 0: + { + CursorTy loc_3122 = loc_2937 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2938, end_r_2939, loc_3122, tmpcur_6512); + CursorTy pvrtmp_6513 = tmp_struct_53.field0; + CursorTy pvrtmp_6514 = tmp_struct_53.field1; + CursorTy pvrtmp_6515 = tmp_struct_53.field2; + CursorTy pvrtmp_6516 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2937 = 0; + + CursorTy writetag_4631 = loc_2937 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6513, pvrtmp_6514, + loc_2937, pvrtmp_6516}; + break; + } + + case 1: + { + CursorTy loc_3128 = loc_2937 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2938, end_r_2939, loc_3128, tmpcur_6512); + CursorTy pvrtmp_6525 = tmp_struct_54.field0; + CursorTy pvrtmp_6526 = tmp_struct_54.field1; + CursorTy pvrtmp_6527 = tmp_struct_54.field2; + CursorTy pvrtmp_6528 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2937 = 1; + + CursorTy writetag_4636 = loc_2937 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6525, pvrtmp_6526, + loc_2937, pvrtmp_6528}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6537 = *(CursorTy *) tmpcur_6512; + CursorTy tmpaftercur_6538 = tmpcur_6512 + 8; + CursorTy jump_4286 = tmpcur_6512 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2938, end_r_2939, loc_2937, tmpcur_6537); + CursorTy pvrtmp_6539 = tmp_struct_55.field0; + CursorTy pvrtmp_6540 = tmp_struct_55.field1; + CursorTy pvrtmp_6541 = tmp_struct_55.field2; + CursorTy pvrtmp_6542 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6539, jump_4286, + pvrtmp_6541, pvrtmp_6542}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6549 = *(CursorTy *) tmpcur_6512; + CursorTy tmpaftercur_6550 = tmpcur_6512 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2938, end_r_2939, loc_2937, tmpcur_6549); + CursorTy pvrtmp_6551 = tmp_struct_56.field0; + CursorTy pvrtmp_6552 = tmp_struct_56.field1; + CursorTy pvrtmp_6553 = tmp_struct_56.field2; + CursorTy pvrtmp_6554 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6551, pvrtmp_6552, + pvrtmp_6553, pvrtmp_6554}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6511"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2941, CursorTy arg_656_1261_1582) +{ + TagTyPacked tmpval_6562 = *(TagTyPacked *) arg_656_1261_1582; + CursorTy tmpcur_6563 = arg_656_1261_1582 + 1; + + + switch_6572: + ; + switch (tmpval_6562) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2941, tmpcur_6563); + CursorTy pvrtmp_6564 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6564}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2941, tmpcur_6563); + CursorTy pvrtmp_6565 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6565}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6566 = *(CursorTy *) tmpcur_6563; + CursorTy tmpaftercur_6567 = tmpcur_6563 + 8; + CursorTy jump_4292 = tmpcur_6563 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2941, tmpcur_6566); + CursorTy pvrtmp_6568 = tmp_struct_59.field0; + + return (CursorProd) {jump_4292}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6569 = *(CursorTy *) tmpcur_6563; + CursorTy tmpaftercur_6570 = tmpcur_6563 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2941, tmpcur_6569); + CursorTy pvrtmp_6571 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6571}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6562"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2943, CursorTy arg_661_1266_1587) +{ + TagTyPacked tmpval_6573 = *(TagTyPacked *) arg_661_1266_1587; + CursorTy tmpcur_6574 = arg_661_1266_1587 + 1; + + + switch_6583: + ; + switch (tmpval_6573) { + + case 0: + { + unsigned char wildcard_664_1268_1589 = print_symbol(6136); + CursorProd tmp_struct_61 = _print_String(end_r_2943, tmpcur_6574); + CursorTy pvrtmp_6575 = tmp_struct_61.field0; + unsigned char wildcard_665_1270_1591 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6575}; + break; + } + + case 1: + { + unsigned char wildcard_668_1272_1593 = print_symbol(6130); + CursorProd tmp_struct_62 = _print_String(end_r_2943, tmpcur_6574); + CursorTy pvrtmp_6576 = tmp_struct_62.field0; + unsigned char wildcard_669_1274_1595 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6576}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6577 = *(CursorTy *) tmpcur_6574; + CursorTy tmpaftercur_6578 = tmpcur_6574 + 8; + CursorTy jump_4298 = tmpcur_6574 + 8; + unsigned char wildcard_4301 = print_symbol(6146); + CursorProd tmp_struct_63 = _print_Content(end_r_2943, tmpcur_6577); + CursorTy pvrtmp_6579 = tmp_struct_63.field0; + + return (CursorProd) {jump_4298}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6580 = *(CursorTy *) tmpcur_6574; + CursorTy tmpaftercur_6581 = tmpcur_6574 + 8; + unsigned char wildcard_4301 = print_symbol(6145); + CursorProd tmp_struct_64 = _print_Content(end_r_2943, tmpcur_6580); + CursorTy pvrtmp_6582 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6582}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6573"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2946, CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_670_1275_1596) +{ + if (loc_2945 + 32 > end_r_2947) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2947); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2947 = chunk_end_91; + *(TagTyPacked *) loc_2945 = 255; + + CursorTy redir = loc_2945 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2945 = chunk_start_90; + } + + CursorTy loc_3158 = loc_2945 + 1; + CursorTy loc_3159 = loc_3158 + 8; + CursorTy loc_3174 = loc_2945 + 1; + CursorTy loc_3175 = loc_3174 + 8; + CursorTy loc_3195 = loc_2945 + 1; + CursorTy loc_3196 = loc_3195 + 8; + CursorTy loc_3197 = loc_3196 + 8; + CursorTy loc_3221 = loc_2945 + 1; + CursorTy loc_3222 = loc_3221 + 8; + CursorTy loc_3223 = loc_3222 + 8; + CursorTy loc_3247 = loc_2945 + 1; + CursorTy loc_3248 = loc_3247 + 8; + CursorTy loc_3249 = loc_3248 + 8; + CursorTy loc_3273 = loc_2945 + 1; + CursorTy loc_3274 = loc_3273 + 8; + CursorTy loc_3275 = loc_3274 + 8; + CursorTy loc_3299 = loc_2945 + 1; + CursorTy loc_3300 = loc_3299 + 8; + CursorTy loc_3301 = loc_3300 + 8; + CursorTy loc_3325 = loc_2945 + 1; + CursorTy loc_3326 = loc_3325 + 8; + CursorTy loc_3327 = loc_3326 + 8; + TagTyPacked tmpval_6584 = *(TagTyPacked *) arg_670_1275_1596; + CursorTy tmpcur_6585 = arg_670_1275_1596 + 1; + + + switch_6850: + ; + switch (tmpval_6584) { + + case 0: + { + CursorTy jump_3987 = arg_670_1275_1596 + 1; + + *(TagTyPacked *) loc_2945 = 0; + + CursorTy writetag_4666 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2947, jump_3987, + loc_2945, writetag_4666}; + break; + } + + case 9: + { + CursorTy tmpcur_6590 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6591 = tmpcur_6585 + 8; + CursorTy jump_3989 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2946, end_r_2947, loc_3159, tmpaftercur_6591); + CursorTy pvrtmp_6592 = tmp_struct_65.field0; + CursorTy pvrtmp_6593 = tmp_struct_65.field1; + CursorTy pvrtmp_6594 = tmp_struct_65.field2; + CursorTy pvrtmp_6595 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2946, pvrtmp_6592, pvrtmp_6595, tmpcur_6590); + CursorTy pvrtmp_6600 = tmp_struct_66.field0; + CursorTy pvrtmp_6601 = tmp_struct_66.field1; + CursorTy pvrtmp_6602 = tmp_struct_66.field2; + CursorTy pvrtmp_6603 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2945 = 9; + + CursorTy writetag_4672 = loc_2945 + 1; + + *(CursorTy *) writetag_4672 = pvrtmp_6595; + + CursorTy writecur_4673 = writetag_4672 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6600, pvrtmp_6601, + loc_2945, pvrtmp_6603}; + break; + } + + case 11: + { + CursorTy tmpcur_6612 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6613 = tmpcur_6585 + 8; + CursorTy jump_3993 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2946, end_r_2947, loc_3175, tmpaftercur_6613); + CursorTy pvrtmp_6614 = tmp_struct_67.field0; + CursorTy pvrtmp_6615 = tmp_struct_67.field1; + CursorTy pvrtmp_6616 = tmp_struct_67.field2; + CursorTy pvrtmp_6617 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2946, pvrtmp_6614, pvrtmp_6617, tmpcur_6612); + CursorTy pvrtmp_6622 = tmp_struct_68.field0; + CursorTy pvrtmp_6623 = tmp_struct_68.field1; + CursorTy pvrtmp_6624 = tmp_struct_68.field2; + CursorTy pvrtmp_6625 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2945 = 11; + + CursorTy writetag_4681 = loc_2945 + 1; + + *(CursorTy *) writetag_4681 = pvrtmp_6617; + + CursorTy writecur_4682 = writetag_4681 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6622, pvrtmp_6623, + loc_2945, pvrtmp_6625}; + break; + } + + case 13: + { + CursorTy tmpcur_6634 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6635 = tmpcur_6585 + 8; + CursorTy tmpcur_6636 = *(CursorTy *) tmpaftercur_6635; + CursorTy tmpaftercur_6637 = tmpaftercur_6635 + 8; + CursorTy jump_3998 = tmpaftercur_6635 + 8; + CursorTy jump_3997 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2946, end_r_2947, loc_3197, tmpaftercur_6637); + CursorTy pvrtmp_6638 = tmp_struct_69.field0; + CursorTy pvrtmp_6639 = tmp_struct_69.field1; + CursorTy pvrtmp_6640 = tmp_struct_69.field2; + CursorTy pvrtmp_6641 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2946, pvrtmp_6638, pvrtmp_6641, tmpcur_6634); + CursorTy pvrtmp_6646 = tmp_struct_70.field0; + CursorTy pvrtmp_6647 = tmp_struct_70.field1; + CursorTy pvrtmp_6648 = tmp_struct_70.field2; + CursorTy pvrtmp_6649 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2946, pvrtmp_6646, pvrtmp_6649, tmpcur_6636); + CursorTy pvrtmp_6654 = tmp_struct_71.field0; + CursorTy pvrtmp_6655 = tmp_struct_71.field1; + CursorTy pvrtmp_6656 = tmp_struct_71.field2; + CursorTy pvrtmp_6657 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2945 = 13; + + CursorTy writetag_4692 = loc_2945 + 1; + + *(CursorTy *) writetag_4692 = pvrtmp_6641; + + CursorTy writecur_4693 = writetag_4692 + 8; + + *(CursorTy *) writecur_4693 = pvrtmp_6649; + + CursorTy writecur_4694 = writecur_4693 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6654, pvrtmp_6655, + loc_2945, pvrtmp_6657}; + break; + } + + case 15: + { + CursorTy tmpcur_6666 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6667 = tmpcur_6585 + 8; + CursorTy tmpcur_6668 = *(CursorTy *) tmpaftercur_6667; + CursorTy tmpaftercur_6669 = tmpaftercur_6667 + 8; + CursorTy jump_4004 = tmpaftercur_6667 + 8; + CursorTy jump_4003 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2946, end_r_2947, loc_3223, tmpaftercur_6669); + CursorTy pvrtmp_6670 = tmp_struct_72.field0; + CursorTy pvrtmp_6671 = tmp_struct_72.field1; + CursorTy pvrtmp_6672 = tmp_struct_72.field2; + CursorTy pvrtmp_6673 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2946, pvrtmp_6670, pvrtmp_6673, tmpcur_6666); + CursorTy pvrtmp_6678 = tmp_struct_73.field0; + CursorTy pvrtmp_6679 = tmp_struct_73.field1; + CursorTy pvrtmp_6680 = tmp_struct_73.field2; + CursorTy pvrtmp_6681 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2946, pvrtmp_6678, pvrtmp_6681, tmpcur_6668); + CursorTy pvrtmp_6686 = tmp_struct_74.field0; + CursorTy pvrtmp_6687 = tmp_struct_74.field1; + CursorTy pvrtmp_6688 = tmp_struct_74.field2; + CursorTy pvrtmp_6689 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2945 = 15; + + CursorTy writetag_4705 = loc_2945 + 1; + + *(CursorTy *) writetag_4705 = pvrtmp_6673; + + CursorTy writecur_4706 = writetag_4705 + 8; + + *(CursorTy *) writecur_4706 = pvrtmp_6681; + + CursorTy writecur_4707 = writecur_4706 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6686, pvrtmp_6687, + loc_2945, pvrtmp_6689}; + break; + } + + case 17: + { + CursorTy tmpcur_6698 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6699 = tmpcur_6585 + 8; + CursorTy tmpcur_6700 = *(CursorTy *) tmpaftercur_6699; + CursorTy tmpaftercur_6701 = tmpaftercur_6699 + 8; + CursorTy jump_4010 = tmpaftercur_6699 + 8; + CursorTy jump_4009 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2946, end_r_2947, loc_3249, tmpaftercur_6701); + CursorTy pvrtmp_6702 = tmp_struct_75.field0; + CursorTy pvrtmp_6703 = tmp_struct_75.field1; + CursorTy pvrtmp_6704 = tmp_struct_75.field2; + CursorTy pvrtmp_6705 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2946, pvrtmp_6702, pvrtmp_6705, tmpcur_6698); + CursorTy pvrtmp_6710 = tmp_struct_76.field0; + CursorTy pvrtmp_6711 = tmp_struct_76.field1; + CursorTy pvrtmp_6712 = tmp_struct_76.field2; + CursorTy pvrtmp_6713 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2946, pvrtmp_6710, pvrtmp_6713, tmpcur_6700); + CursorTy pvrtmp_6718 = tmp_struct_77.field0; + CursorTy pvrtmp_6719 = tmp_struct_77.field1; + CursorTy pvrtmp_6720 = tmp_struct_77.field2; + CursorTy pvrtmp_6721 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2945 = 17; + + CursorTy writetag_4718 = loc_2945 + 1; + + *(CursorTy *) writetag_4718 = pvrtmp_6705; + + CursorTy writecur_4719 = writetag_4718 + 8; + + *(CursorTy *) writecur_4719 = pvrtmp_6713; + + CursorTy writecur_4720 = writecur_4719 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6718, pvrtmp_6719, + loc_2945, pvrtmp_6721}; + break; + } + + case 19: + { + CursorTy tmpcur_6730 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6731 = tmpcur_6585 + 8; + CursorTy tmpcur_6732 = *(CursorTy *) tmpaftercur_6731; + CursorTy tmpaftercur_6733 = tmpaftercur_6731 + 8; + CursorTy jump_4016 = tmpaftercur_6731 + 8; + CursorTy jump_4015 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2946, end_r_2947, loc_3275, tmpaftercur_6733); + CursorTy pvrtmp_6734 = tmp_struct_78.field0; + CursorTy pvrtmp_6735 = tmp_struct_78.field1; + CursorTy pvrtmp_6736 = tmp_struct_78.field2; + CursorTy pvrtmp_6737 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2946, pvrtmp_6734, pvrtmp_6737, tmpcur_6730); + CursorTy pvrtmp_6742 = tmp_struct_79.field0; + CursorTy pvrtmp_6743 = tmp_struct_79.field1; + CursorTy pvrtmp_6744 = tmp_struct_79.field2; + CursorTy pvrtmp_6745 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2946, pvrtmp_6742, pvrtmp_6745, tmpcur_6732); + CursorTy pvrtmp_6750 = tmp_struct_80.field0; + CursorTy pvrtmp_6751 = tmp_struct_80.field1; + CursorTy pvrtmp_6752 = tmp_struct_80.field2; + CursorTy pvrtmp_6753 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2945 = 19; + + CursorTy writetag_4731 = loc_2945 + 1; + + *(CursorTy *) writetag_4731 = pvrtmp_6737; + + CursorTy writecur_4732 = writetag_4731 + 8; + + *(CursorTy *) writecur_4732 = pvrtmp_6745; + + CursorTy writecur_4733 = writecur_4732 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6750, pvrtmp_6751, + loc_2945, pvrtmp_6753}; + break; + } + + case 21: + { + CursorTy tmpcur_6762 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6763 = tmpcur_6585 + 8; + CursorTy tmpcur_6764 = *(CursorTy *) tmpaftercur_6763; + CursorTy tmpaftercur_6765 = tmpaftercur_6763 + 8; + CursorTy jump_4022 = tmpaftercur_6763 + 8; + CursorTy jump_4021 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2946, end_r_2947, loc_3301, tmpaftercur_6765); + CursorTy pvrtmp_6766 = tmp_struct_81.field0; + CursorTy pvrtmp_6767 = tmp_struct_81.field1; + CursorTy pvrtmp_6768 = tmp_struct_81.field2; + CursorTy pvrtmp_6769 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2946, pvrtmp_6766, pvrtmp_6769, tmpcur_6762); + CursorTy pvrtmp_6774 = tmp_struct_82.field0; + CursorTy pvrtmp_6775 = tmp_struct_82.field1; + CursorTy pvrtmp_6776 = tmp_struct_82.field2; + CursorTy pvrtmp_6777 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2946, pvrtmp_6774, pvrtmp_6777, tmpcur_6764); + CursorTy pvrtmp_6782 = tmp_struct_83.field0; + CursorTy pvrtmp_6783 = tmp_struct_83.field1; + CursorTy pvrtmp_6784 = tmp_struct_83.field2; + CursorTy pvrtmp_6785 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2945 = 21; + + CursorTy writetag_4744 = loc_2945 + 1; + + *(CursorTy *) writetag_4744 = pvrtmp_6769; + + CursorTy writecur_4745 = writetag_4744 + 8; + + *(CursorTy *) writecur_4745 = pvrtmp_6777; + + CursorTy writecur_4746 = writecur_4745 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6782, pvrtmp_6783, + loc_2945, pvrtmp_6785}; + break; + } + + case 23: + { + CursorTy tmpcur_6794 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6795 = tmpcur_6585 + 8; + CursorTy tmpcur_6796 = *(CursorTy *) tmpaftercur_6795; + CursorTy tmpaftercur_6797 = tmpaftercur_6795 + 8; + CursorTy jump_4028 = tmpaftercur_6795 + 8; + CursorTy jump_4027 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2946, end_r_2947, loc_3327, tmpaftercur_6797); + CursorTy pvrtmp_6798 = tmp_struct_84.field0; + CursorTy pvrtmp_6799 = tmp_struct_84.field1; + CursorTy pvrtmp_6800 = tmp_struct_84.field2; + CursorTy pvrtmp_6801 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2946, pvrtmp_6798, pvrtmp_6801, tmpcur_6794); + CursorTy pvrtmp_6806 = tmp_struct_85.field0; + CursorTy pvrtmp_6807 = tmp_struct_85.field1; + CursorTy pvrtmp_6808 = tmp_struct_85.field2; + CursorTy pvrtmp_6809 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2946, pvrtmp_6806, pvrtmp_6809, tmpcur_6796); + CursorTy pvrtmp_6814 = tmp_struct_86.field0; + CursorTy pvrtmp_6815 = tmp_struct_86.field1; + CursorTy pvrtmp_6816 = tmp_struct_86.field2; + CursorTy pvrtmp_6817 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2945 = 23; + + CursorTy writetag_4757 = loc_2945 + 1; + + *(CursorTy *) writetag_4757 = pvrtmp_6801; + + CursorTy writecur_4758 = writetag_4757 + 8; + + *(CursorTy *) writecur_4758 = pvrtmp_6809; + + CursorTy writecur_4759 = writecur_4758 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6814, pvrtmp_6815, + loc_2945, pvrtmp_6817}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6826 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6827 = tmpcur_6585 + 8; + CursorTy jump_4304 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2946, end_r_2947, loc_2945, tmpcur_6826); + CursorTy pvrtmp_6828 = tmp_struct_87.field0; + CursorTy pvrtmp_6829 = tmp_struct_87.field1; + CursorTy pvrtmp_6830 = tmp_struct_87.field2; + CursorTy pvrtmp_6831 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6828, jump_4304, + pvrtmp_6830, pvrtmp_6831}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6838 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6839 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2946, end_r_2947, loc_2945, tmpcur_6838); + CursorTy pvrtmp_6840 = tmp_struct_88.field0; + CursorTy pvrtmp_6841 = tmp_struct_88.field1; + CursorTy pvrtmp_6842 = tmp_struct_88.field2; + CursorTy pvrtmp_6843 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6840, pvrtmp_6841, + pvrtmp_6842, pvrtmp_6843}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6584"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2950, + CursorTy end_r_2951, + CursorTy loc_2949, + CursorTy arg_715_1320_1641) +{ + TagTyPacked tmpval_6851 = *(TagTyPacked *) arg_715_1320_1641; + CursorTy tmpcur_6852 = arg_715_1320_1641 + 1; + + + switch_7117: + ; + switch (tmpval_6851) { + + case 0: + { + CursorTy jump_4033 = arg_715_1320_1641 + 1; + + *(TagTyPacked *) loc_2949 = 0; + + CursorTy writetag_4771 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2951, jump_4033, + loc_2949, writetag_4771}; + break; + } + + case 9: + { + CursorTy tmpcur_6857 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6858 = tmpcur_6852 + 8; + CursorTy jump_4035 = tmpcur_6852 + 8; + CursorTy loc_3349 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3349, tmpaftercur_6858); + CursorTy pvrtmp_6859 = tmp_struct_92.field0; + CursorTy pvrtmp_6860 = tmp_struct_92.field1; + CursorTy pvrtmp_6861 = tmp_struct_92.field2; + CursorTy pvrtmp_6862 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6859, pvrtmp_6862, tmpcur_6857); + CursorTy pvrtmp_6867 = tmp_struct_93.field0; + CursorTy pvrtmp_6868 = tmp_struct_93.field1; + CursorTy pvrtmp_6869 = tmp_struct_93.field2; + CursorTy pvrtmp_6870 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2949 = 1; + + CursorTy writetag_4777 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6867, pvrtmp_6868, + loc_2949, pvrtmp_6870}; + break; + } + + case 11: + { + CursorTy tmpcur_6879 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6880 = tmpcur_6852 + 8; + CursorTy jump_4039 = tmpcur_6852 + 8; + CursorTy loc_3362 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3362, tmpaftercur_6880); + CursorTy pvrtmp_6881 = tmp_struct_94.field0; + CursorTy pvrtmp_6882 = tmp_struct_94.field1; + CursorTy pvrtmp_6883 = tmp_struct_94.field2; + CursorTy pvrtmp_6884 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6881, pvrtmp_6884, tmpcur_6879); + CursorTy pvrtmp_6889 = tmp_struct_95.field0; + CursorTy pvrtmp_6890 = tmp_struct_95.field1; + CursorTy pvrtmp_6891 = tmp_struct_95.field2; + CursorTy pvrtmp_6892 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2949 = 2; + + CursorTy writetag_4785 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6889, pvrtmp_6890, + loc_2949, pvrtmp_6892}; + break; + } + + case 13: + { + CursorTy tmpcur_6901 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6902 = tmpcur_6852 + 8; + CursorTy tmpcur_6903 = *(CursorTy *) tmpaftercur_6902; + CursorTy tmpaftercur_6904 = tmpaftercur_6902 + 8; + CursorTy jump_4044 = tmpaftercur_6902 + 8; + CursorTy jump_4043 = tmpcur_6852 + 8; + CursorTy loc_3380 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2950, end_r_2951, loc_3380, tmpaftercur_6904); + CursorTy pvrtmp_6905 = tmp_struct_96.field0; + CursorTy pvrtmp_6906 = tmp_struct_96.field1; + CursorTy pvrtmp_6907 = tmp_struct_96.field2; + CursorTy pvrtmp_6908 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6905, pvrtmp_6908, tmpcur_6901); + CursorTy pvrtmp_6913 = tmp_struct_97.field0; + CursorTy pvrtmp_6914 = tmp_struct_97.field1; + CursorTy pvrtmp_6915 = tmp_struct_97.field2; + CursorTy pvrtmp_6916 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6913, pvrtmp_6916, tmpcur_6903); + CursorTy pvrtmp_6921 = tmp_struct_98.field0; + CursorTy pvrtmp_6922 = tmp_struct_98.field1; + CursorTy pvrtmp_6923 = tmp_struct_98.field2; + CursorTy pvrtmp_6924 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2949 = 3; + + CursorTy writetag_4795 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6921, pvrtmp_6922, + loc_2949, pvrtmp_6924}; + break; + } + + case 15: + { + CursorTy tmpcur_6933 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6934 = tmpcur_6852 + 8; + CursorTy tmpcur_6935 = *(CursorTy *) tmpaftercur_6934; + CursorTy tmpaftercur_6936 = tmpaftercur_6934 + 8; + CursorTy jump_4050 = tmpaftercur_6934 + 8; + CursorTy jump_4049 = tmpcur_6852 + 8; + CursorTy loc_3400 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3400, tmpaftercur_6936); + CursorTy pvrtmp_6937 = tmp_struct_99.field0; + CursorTy pvrtmp_6938 = tmp_struct_99.field1; + CursorTy pvrtmp_6939 = tmp_struct_99.field2; + CursorTy pvrtmp_6940 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6937, pvrtmp_6940, tmpcur_6933); + CursorTy pvrtmp_6945 = tmp_struct_100.field0; + CursorTy pvrtmp_6946 = tmp_struct_100.field1; + CursorTy pvrtmp_6947 = tmp_struct_100.field2; + CursorTy pvrtmp_6948 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_6945, pvrtmp_6948, tmpcur_6935); + CursorTy pvrtmp_6953 = tmp_struct_101.field0; + CursorTy pvrtmp_6954 = tmp_struct_101.field1; + CursorTy pvrtmp_6955 = tmp_struct_101.field2; + CursorTy pvrtmp_6956 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2949 = 4; + + CursorTy writetag_4806 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6953, pvrtmp_6954, + loc_2949, pvrtmp_6956}; + break; + } + + case 17: + { + CursorTy tmpcur_6965 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6966 = tmpcur_6852 + 8; + CursorTy tmpcur_6967 = *(CursorTy *) tmpaftercur_6966; + CursorTy tmpaftercur_6968 = tmpaftercur_6966 + 8; + CursorTy jump_4056 = tmpaftercur_6966 + 8; + CursorTy jump_4055 = tmpcur_6852 + 8; + CursorTy loc_3420 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2950, end_r_2951, loc_3420, tmpaftercur_6968); + CursorTy pvrtmp_6969 = tmp_struct_102.field0; + CursorTy pvrtmp_6970 = tmp_struct_102.field1; + CursorTy pvrtmp_6971 = tmp_struct_102.field2; + CursorTy pvrtmp_6972 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6969, pvrtmp_6972, tmpcur_6965); + CursorTy pvrtmp_6977 = tmp_struct_103.field0; + CursorTy pvrtmp_6978 = tmp_struct_103.field1; + CursorTy pvrtmp_6979 = tmp_struct_103.field2; + CursorTy pvrtmp_6980 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6977, pvrtmp_6980, tmpcur_6967); + CursorTy pvrtmp_6985 = tmp_struct_104.field0; + CursorTy pvrtmp_6986 = tmp_struct_104.field1; + CursorTy pvrtmp_6987 = tmp_struct_104.field2; + CursorTy pvrtmp_6988 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2949 = 5; + + CursorTy writetag_4817 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6985, pvrtmp_6986, + loc_2949, pvrtmp_6988}; + break; + } + + case 19: + { + CursorTy tmpcur_6997 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6998 = tmpcur_6852 + 8; + CursorTy tmpcur_6999 = *(CursorTy *) tmpaftercur_6998; + CursorTy tmpaftercur_7000 = tmpaftercur_6998 + 8; + CursorTy jump_4062 = tmpaftercur_6998 + 8; + CursorTy jump_4061 = tmpcur_6852 + 8; + CursorTy loc_3440 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3440, tmpaftercur_7000); + CursorTy pvrtmp_7001 = tmp_struct_105.field0; + CursorTy pvrtmp_7002 = tmp_struct_105.field1; + CursorTy pvrtmp_7003 = tmp_struct_105.field2; + CursorTy pvrtmp_7004 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7001, pvrtmp_7004, tmpcur_6997); + CursorTy pvrtmp_7009 = tmp_struct_106.field0; + CursorTy pvrtmp_7010 = tmp_struct_106.field1; + CursorTy pvrtmp_7011 = tmp_struct_106.field2; + CursorTy pvrtmp_7012 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_7009, pvrtmp_7012, tmpcur_6999); + CursorTy pvrtmp_7017 = tmp_struct_107.field0; + CursorTy pvrtmp_7018 = tmp_struct_107.field1; + CursorTy pvrtmp_7019 = tmp_struct_107.field2; + CursorTy pvrtmp_7020 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2949 = 6; + + CursorTy writetag_4828 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7017, pvrtmp_7018, + loc_2949, pvrtmp_7020}; + break; + } + + case 21: + { + CursorTy tmpcur_7029 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7030 = tmpcur_6852 + 8; + CursorTy tmpcur_7031 = *(CursorTy *) tmpaftercur_7030; + CursorTy tmpaftercur_7032 = tmpaftercur_7030 + 8; + CursorTy jump_4068 = tmpaftercur_7030 + 8; + CursorTy jump_4067 = tmpcur_6852 + 8; + CursorTy loc_3460 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3460, tmpaftercur_7032); + CursorTy pvrtmp_7033 = tmp_struct_108.field0; + CursorTy pvrtmp_7034 = tmp_struct_108.field1; + CursorTy pvrtmp_7035 = tmp_struct_108.field2; + CursorTy pvrtmp_7036 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7033, pvrtmp_7036, tmpcur_7029); + CursorTy pvrtmp_7041 = tmp_struct_109.field0; + CursorTy pvrtmp_7042 = tmp_struct_109.field1; + CursorTy pvrtmp_7043 = tmp_struct_109.field2; + CursorTy pvrtmp_7044 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_7041, pvrtmp_7044, tmpcur_7031); + CursorTy pvrtmp_7049 = tmp_struct_110.field0; + CursorTy pvrtmp_7050 = tmp_struct_110.field1; + CursorTy pvrtmp_7051 = tmp_struct_110.field2; + CursorTy pvrtmp_7052 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2949 = 7; + + CursorTy writetag_4839 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7049, pvrtmp_7050, + loc_2949, pvrtmp_7052}; + break; + } + + case 23: + { + CursorTy tmpcur_7061 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7062 = tmpcur_6852 + 8; + CursorTy tmpcur_7063 = *(CursorTy *) tmpaftercur_7062; + CursorTy tmpaftercur_7064 = tmpaftercur_7062 + 8; + CursorTy jump_4074 = tmpaftercur_7062 + 8; + CursorTy jump_4073 = tmpcur_6852 + 8; + CursorTy loc_3480 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3480, tmpaftercur_7064); + CursorTy pvrtmp_7065 = tmp_struct_111.field0; + CursorTy pvrtmp_7066 = tmp_struct_111.field1; + CursorTy pvrtmp_7067 = tmp_struct_111.field2; + CursorTy pvrtmp_7068 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_7065, pvrtmp_7068, tmpcur_7061); + CursorTy pvrtmp_7073 = tmp_struct_112.field0; + CursorTy pvrtmp_7074 = tmp_struct_112.field1; + CursorTy pvrtmp_7075 = tmp_struct_112.field2; + CursorTy pvrtmp_7076 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7073, pvrtmp_7076, tmpcur_7063); + CursorTy pvrtmp_7081 = tmp_struct_113.field0; + CursorTy pvrtmp_7082 = tmp_struct_113.field1; + CursorTy pvrtmp_7083 = tmp_struct_113.field2; + CursorTy pvrtmp_7084 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2949 = 8; + + CursorTy writetag_4850 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7081, pvrtmp_7082, + loc_2949, pvrtmp_7084}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7093 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7094 = tmpcur_6852 + 8; + CursorTy jump_4310 = tmpcur_6852 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_2949, tmpcur_7093); + CursorTy pvrtmp_7095 = tmp_struct_114.field0; + CursorTy pvrtmp_7096 = tmp_struct_114.field1; + CursorTy pvrtmp_7097 = tmp_struct_114.field2; + CursorTy pvrtmp_7098 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7095, jump_4310, + pvrtmp_7097, pvrtmp_7098}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7105 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7106 = tmpcur_6852 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_2949, tmpcur_7105); + CursorTy pvrtmp_7107 = tmp_struct_115.field0; + CursorTy pvrtmp_7108 = tmp_struct_115.field1; + CursorTy pvrtmp_7109 = tmp_struct_115.field2; + CursorTy pvrtmp_7110 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7107, pvrtmp_7108, + pvrtmp_7109, pvrtmp_7110}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6851"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2953, CursorTy arg_760_1365_1686) +{ + TagTyPacked tmpval_7118 = *(TagTyPacked *) arg_760_1365_1686; + CursorTy tmpcur_7119 = arg_760_1365_1686 + 1; + + + switch_7176: + ; + switch (tmpval_7118) { + + case 0: + { + CursorTy jump_4079 = arg_760_1365_1686 + 1; + + return (CursorProd) {jump_4079}; + break; + } + + case 9: + { + CursorTy tmpcur_7120 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7121 = tmpcur_7119 + 8; + CursorTy jump_4081 = tmpcur_7119 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2953, tmpaftercur_7121); + CursorTy pvrtmp_7122 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2953, tmpcur_7120); + CursorTy pvrtmp_7123 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7123}; + break; + } + + case 11: + { + CursorTy tmpcur_7124 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7125 = tmpcur_7119 + 8; + CursorTy jump_4085 = tmpcur_7119 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2953, tmpaftercur_7125); + CursorTy pvrtmp_7126 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2953, tmpcur_7124); + CursorTy pvrtmp_7127 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7127}; + break; + } + + case 13: + { + CursorTy tmpcur_7128 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7129 = tmpcur_7119 + 8; + CursorTy tmpcur_7130 = *(CursorTy *) tmpaftercur_7129; + CursorTy tmpaftercur_7131 = tmpaftercur_7129 + 8; + CursorTy jump_4090 = tmpaftercur_7129 + 8; + CursorTy jump_4089 = tmpcur_7119 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2953, tmpaftercur_7131); + CursorTy pvrtmp_7132 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2953, tmpcur_7128); + CursorTy pvrtmp_7133 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2953, tmpcur_7130); + CursorTy pvrtmp_7134 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7134}; + break; + } + + case 15: + { + CursorTy tmpcur_7135 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7136 = tmpcur_7119 + 8; + CursorTy tmpcur_7137 = *(CursorTy *) tmpaftercur_7136; + CursorTy tmpaftercur_7138 = tmpaftercur_7136 + 8; + CursorTy jump_4096 = tmpaftercur_7136 + 8; + CursorTy jump_4095 = tmpcur_7119 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2953, tmpaftercur_7138); + CursorTy pvrtmp_7139 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2953, tmpcur_7135); + CursorTy pvrtmp_7140 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2953, tmpcur_7137); + CursorTy pvrtmp_7141 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7141}; + break; + } + + case 17: + { + CursorTy tmpcur_7142 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7143 = tmpcur_7119 + 8; + CursorTy tmpcur_7144 = *(CursorTy *) tmpaftercur_7143; + CursorTy tmpaftercur_7145 = tmpaftercur_7143 + 8; + CursorTy jump_4102 = tmpaftercur_7143 + 8; + CursorTy jump_4101 = tmpcur_7119 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2953, tmpaftercur_7145); + CursorTy pvrtmp_7146 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2953, tmpcur_7142); + CursorTy pvrtmp_7147 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2953, tmpcur_7144); + CursorTy pvrtmp_7148 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7148}; + break; + } + + case 19: + { + CursorTy tmpcur_7149 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7150 = tmpcur_7119 + 8; + CursorTy tmpcur_7151 = *(CursorTy *) tmpaftercur_7150; + CursorTy tmpaftercur_7152 = tmpaftercur_7150 + 8; + CursorTy jump_4108 = tmpaftercur_7150 + 8; + CursorTy jump_4107 = tmpcur_7119 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2953, tmpaftercur_7152); + CursorTy pvrtmp_7153 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2953, tmpcur_7149); + CursorTy pvrtmp_7154 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2953, tmpcur_7151); + CursorTy pvrtmp_7155 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7155}; + break; + } + + case 21: + { + CursorTy tmpcur_7156 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7157 = tmpcur_7119 + 8; + CursorTy tmpcur_7158 = *(CursorTy *) tmpaftercur_7157; + CursorTy tmpaftercur_7159 = tmpaftercur_7157 + 8; + CursorTy jump_4114 = tmpaftercur_7157 + 8; + CursorTy jump_4113 = tmpcur_7119 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2953, tmpaftercur_7159); + CursorTy pvrtmp_7160 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2953, tmpcur_7156); + CursorTy pvrtmp_7161 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2953, tmpcur_7158); + CursorTy pvrtmp_7162 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7162}; + break; + } + + case 23: + { + CursorTy tmpcur_7163 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7164 = tmpcur_7119 + 8; + CursorTy tmpcur_7165 = *(CursorTy *) tmpaftercur_7164; + CursorTy tmpaftercur_7166 = tmpaftercur_7164 + 8; + CursorTy jump_4120 = tmpaftercur_7164 + 8; + CursorTy jump_4119 = tmpcur_7119 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2953, tmpaftercur_7166); + CursorTy pvrtmp_7167 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2953, tmpcur_7163); + CursorTy pvrtmp_7168 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2953, tmpcur_7165); + CursorTy pvrtmp_7169 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7169}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7170 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7171 = tmpcur_7119 + 8; + CursorTy jump_4316 = tmpcur_7119 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2953, tmpcur_7170); + CursorTy pvrtmp_7172 = tmp_struct_138.field0; + + return (CursorProd) {jump_4316}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7173 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7174 = tmpcur_7119 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2953, tmpcur_7173); + CursorTy pvrtmp_7175 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7175}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7118"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2955, CursorTy arg_805_1410_1731) +{ + TagTyPacked tmpval_7177 = *(TagTyPacked *) arg_805_1410_1731; + CursorTy tmpcur_7178 = arg_805_1410_1731 + 1; + + + switch_7235: + ; + switch (tmpval_7177) { + + case 0: + { + CursorTy jump_4125 = arg_805_1410_1731 + 1; + unsigned char wildcard_806_1411_1732 = print_symbol(6135); + unsigned char wildcard_807_1412_1733 = print_symbol(6129); + + return (CursorProd) {jump_4125}; + break; + } + + case 9: + { + CursorTy tmpcur_7179 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7180 = tmpcur_7178 + 8; + CursorTy jump_4127 = tmpcur_7178 + 8; + unsigned char wildcard_812_1415_1736 = print_symbol(6141); + CursorProd tmp_struct_140 = + _print_Content(end_r_2955, tmpaftercur_7180); + CursorTy pvrtmp_7181 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2955, tmpcur_7179); + CursorTy pvrtmp_7182 = tmp_struct_141.field0; + unsigned char wildcard_813_1418_1739 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7182}; + break; + } + + case 11: + { + CursorTy tmpcur_7183 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7184 = tmpcur_7178 + 8; + CursorTy jump_4131 = tmpcur_7178 + 8; + unsigned char wildcard_818_1421_1742 = print_symbol(6144); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2955, tmpaftercur_7184); + CursorTy pvrtmp_7185 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2955, tmpcur_7183); + CursorTy pvrtmp_7186 = tmp_struct_143.field0; + unsigned char wildcard_819_1424_1745 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7186}; + break; + } + + case 13: + { + CursorTy tmpcur_7187 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7188 = tmpcur_7178 + 8; + CursorTy tmpcur_7189 = *(CursorTy *) tmpaftercur_7188; + CursorTy tmpaftercur_7190 = tmpaftercur_7188 + 8; + CursorTy jump_4136 = tmpaftercur_7188 + 8; + CursorTy jump_4135 = tmpcur_7178 + 8; + unsigned char wildcard_826_1428_1749 = print_symbol(6132); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2955, tmpaftercur_7190); + CursorTy pvrtmp_7191 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2955, tmpcur_7187); + CursorTy pvrtmp_7192 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2955, tmpcur_7189); + CursorTy pvrtmp_7193 = tmp_struct_146.field0; + unsigned char wildcard_827_1432_1753 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7193}; + break; + } + + case 15: + { + CursorTy tmpcur_7194 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7195 = tmpcur_7178 + 8; + CursorTy tmpcur_7196 = *(CursorTy *) tmpaftercur_7195; + CursorTy tmpaftercur_7197 = tmpaftercur_7195 + 8; + CursorTy jump_4142 = tmpaftercur_7195 + 8; + CursorTy jump_4141 = tmpcur_7178 + 8; + unsigned char wildcard_834_1436_1757 = print_symbol(6143); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2955, tmpaftercur_7197); + CursorTy pvrtmp_7198 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2955, tmpcur_7194); + CursorTy pvrtmp_7199 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2955, tmpcur_7196); + CursorTy pvrtmp_7200 = tmp_struct_149.field0; + unsigned char wildcard_835_1440_1761 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7200}; + break; + } + + case 17: + { + CursorTy tmpcur_7201 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7202 = tmpcur_7178 + 8; + CursorTy tmpcur_7203 = *(CursorTy *) tmpaftercur_7202; + CursorTy tmpaftercur_7204 = tmpaftercur_7202 + 8; + CursorTy jump_4148 = tmpaftercur_7202 + 8; + CursorTy jump_4147 = tmpcur_7178 + 8; + unsigned char wildcard_842_1444_1765 = print_symbol(6133); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2955, tmpaftercur_7204); + CursorTy pvrtmp_7205 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2955, tmpcur_7201); + CursorTy pvrtmp_7206 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2955, tmpcur_7203); + CursorTy pvrtmp_7207 = tmp_struct_152.field0; + unsigned char wildcard_843_1448_1769 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7207}; + break; + } + + case 19: + { + CursorTy tmpcur_7208 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7209 = tmpcur_7178 + 8; + CursorTy tmpcur_7210 = *(CursorTy *) tmpaftercur_7209; + CursorTy tmpaftercur_7211 = tmpaftercur_7209 + 8; + CursorTy jump_4154 = tmpaftercur_7209 + 8; + CursorTy jump_4153 = tmpcur_7178 + 8; + unsigned char wildcard_850_1452_1773 = print_symbol(6142); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2955, tmpaftercur_7211); + CursorTy pvrtmp_7212 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2955, tmpcur_7208); + CursorTy pvrtmp_7213 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2955, tmpcur_7210); + CursorTy pvrtmp_7214 = tmp_struct_155.field0; + unsigned char wildcard_851_1456_1777 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7214}; + break; + } + + case 21: + { + CursorTy tmpcur_7215 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7216 = tmpcur_7178 + 8; + CursorTy tmpcur_7217 = *(CursorTy *) tmpaftercur_7216; + CursorTy tmpaftercur_7218 = tmpaftercur_7216 + 8; + CursorTy jump_4160 = tmpaftercur_7216 + 8; + CursorTy jump_4159 = tmpcur_7178 + 8; + unsigned char wildcard_858_1460_1781 = print_symbol(6139); + CursorProd tmp_struct_156 = + _print_Content(end_r_2955, tmpaftercur_7218); + CursorTy pvrtmp_7219 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2955, tmpcur_7215); + CursorTy pvrtmp_7220 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2955, tmpcur_7217); + CursorTy pvrtmp_7221 = tmp_struct_158.field0; + unsigned char wildcard_859_1464_1785 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7221}; + break; + } + + case 23: + { + CursorTy tmpcur_7222 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7223 = tmpcur_7178 + 8; + CursorTy tmpcur_7224 = *(CursorTy *) tmpaftercur_7223; + CursorTy tmpaftercur_7225 = tmpaftercur_7223 + 8; + CursorTy jump_4166 = tmpaftercur_7223 + 8; + CursorTy jump_4165 = tmpcur_7178 + 8; + unsigned char wildcard_866_1468_1789 = print_symbol(6140); + CursorProd tmp_struct_159 = + _print_Content(end_r_2955, tmpaftercur_7225); + CursorTy pvrtmp_7226 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2955, tmpcur_7222); + CursorTy pvrtmp_7227 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2955, tmpcur_7224); + CursorTy pvrtmp_7228 = tmp_struct_161.field0; + unsigned char wildcard_867_1472_1793 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7228}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7229 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7230 = tmpcur_7178 + 8; + CursorTy jump_4322 = tmpcur_7178 + 8; + unsigned char wildcard_4325 = print_symbol(6146); + CursorProd tmp_struct_162 = _print_Adt(end_r_2955, tmpcur_7229); + CursorTy pvrtmp_7231 = tmp_struct_162.field0; + + return (CursorProd) {jump_4322}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7232 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7233 = tmpcur_7178 + 8; + unsigned char wildcard_4325 = print_symbol(6145); + CursorProd tmp_struct_163 = _print_Adt(end_r_2955, tmpcur_7232); + CursorTy pvrtmp_7234 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7234}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7177"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2958, + CursorTy end_r_2959, CursorTy loc_2957, + CursorTy arg_868_1473_1794) +{ + if (loc_2957 + 32 > end_r_2959) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2959); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2959 = chunk_end_169; + *(TagTyPacked *) loc_2957 = 255; + + CursorTy redir = loc_2957 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2957 = chunk_start_168; + } + + CursorTy loc_3658 = loc_2957 + 1; + CursorTy loc_3659 = loc_3658 + 8; + TagTyPacked tmpval_7236 = *(TagTyPacked *) arg_868_1473_1794; + CursorTy tmpcur_7237 = arg_868_1473_1794 + 1; + + + switch_7280: + ; + switch (tmpval_7236) { + + case 0: + { + CursorTy jump_4171 = arg_868_1473_1794 + 1; + + *(TagTyPacked *) loc_2957 = 0; + + CursorTy writetag_4964 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2959, jump_4171, + loc_2957, writetag_4964}; + break; + } + + case 1: + { + IntTy tmpval_7242 = *(IntTy *) tmpcur_7237; + CursorTy tmpcur_7243 = tmpcur_7237 + sizeof(IntTy); + CursorTy jump_4173 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2958, end_r_2959, loc_3659, tmpcur_7243); + CursorTy pvrtmp_7244 = tmp_struct_164.field0; + CursorTy pvrtmp_7245 = tmp_struct_164.field1; + CursorTy pvrtmp_7246 = tmp_struct_164.field2; + CursorTy pvrtmp_7247 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2957 = 1; + + CursorTy writetag_4969 = loc_2957 + 1; + + *(IntTy *) writetag_4969 = tmpval_7242; + + CursorTy writecur_4970 = writetag_4969 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7244, pvrtmp_7245, + loc_2957, pvrtmp_7247}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7256 = *(CursorTy *) tmpcur_7237; + CursorTy tmpaftercur_7257 = tmpcur_7237 + 8; + CursorTy jump_4328 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2958, end_r_2959, loc_2957, tmpcur_7256); + CursorTy pvrtmp_7258 = tmp_struct_165.field0; + CursorTy pvrtmp_7259 = tmp_struct_165.field1; + CursorTy pvrtmp_7260 = tmp_struct_165.field2; + CursorTy pvrtmp_7261 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7258, jump_4328, + pvrtmp_7260, pvrtmp_7261}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7268 = *(CursorTy *) tmpcur_7237; + CursorTy tmpaftercur_7269 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2958, end_r_2959, loc_2957, tmpcur_7268); + CursorTy pvrtmp_7270 = tmp_struct_166.field0; + CursorTy pvrtmp_7271 = tmp_struct_166.field1; + CursorTy pvrtmp_7272 = tmp_struct_166.field2; + CursorTy pvrtmp_7273 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7270, pvrtmp_7271, + pvrtmp_7272, pvrtmp_7273}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7236"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2962, + CursorTy end_r_2963, + CursorTy loc_2961, + CursorTy arg_873_1478_1799) +{ + CursorTy loc_3671 = loc_2961 + 1; + CursorTy loc_3672 = loc_3671 + 8; + TagTyPacked tmpval_7281 = *(TagTyPacked *) arg_873_1478_1799; + CursorTy tmpcur_7282 = arg_873_1478_1799 + 1; + + + switch_7325: + ; + switch (tmpval_7281) { + + case 0: + { + CursorTy jump_4176 = arg_873_1478_1799 + 1; + + *(TagTyPacked *) loc_2961 = 0; + + CursorTy writetag_4980 = loc_2961 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2963, jump_4176, + loc_2961, writetag_4980}; + break; + } + + case 1: + { + IntTy tmpval_7287 = *(IntTy *) tmpcur_7282; + CursorTy tmpcur_7288 = tmpcur_7282 + sizeof(IntTy); + CursorTy jump_4178 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_3672, tmpcur_7288); + CursorTy pvrtmp_7289 = tmp_struct_170.field0; + CursorTy pvrtmp_7290 = tmp_struct_170.field1; + CursorTy pvrtmp_7291 = tmp_struct_170.field2; + CursorTy pvrtmp_7292 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2961 = 1; + + CursorTy writetag_4985 = loc_2961 + 1; + + *(IntTy *) writetag_4985 = tmpval_7287; + + CursorTy writecur_4986 = writetag_4985 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7289, pvrtmp_7290, + loc_2961, pvrtmp_7292}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7301 = *(CursorTy *) tmpcur_7282; + CursorTy tmpaftercur_7302 = tmpcur_7282 + 8; + CursorTy jump_4334 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_2961, tmpcur_7301); + CursorTy pvrtmp_7303 = tmp_struct_171.field0; + CursorTy pvrtmp_7304 = tmp_struct_171.field1; + CursorTy pvrtmp_7305 = tmp_struct_171.field2; + CursorTy pvrtmp_7306 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7303, jump_4334, + pvrtmp_7305, pvrtmp_7306}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7313 = *(CursorTy *) tmpcur_7282; + CursorTy tmpaftercur_7314 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_2961, tmpcur_7313); + CursorTy pvrtmp_7315 = tmp_struct_172.field0; + CursorTy pvrtmp_7316 = tmp_struct_172.field1; + CursorTy pvrtmp_7317 = tmp_struct_172.field2; + CursorTy pvrtmp_7318 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7315, pvrtmp_7316, + pvrtmp_7317, pvrtmp_7318}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7281"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2965, CursorTy arg_878_1483_1804) +{ + TagTyPacked tmpval_7326 = *(TagTyPacked *) arg_878_1483_1804; + CursorTy tmpcur_7327 = arg_878_1483_1804 + 1; + + + switch_7337: + ; + switch (tmpval_7326) { + + case 0: + { + CursorTy jump_4181 = arg_878_1483_1804 + 1; + + return (CursorProd) {jump_4181}; + break; + } + + case 1: + { + IntTy tmpval_7328 = *(IntTy *) tmpcur_7327; + CursorTy tmpcur_7329 = tmpcur_7327 + sizeof(IntTy); + CursorTy jump_4183 = tmpcur_7327 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2965, tmpcur_7329); + CursorTy pvrtmp_7330 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7330}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7331 = *(CursorTy *) tmpcur_7327; + CursorTy tmpaftercur_7332 = tmpcur_7327 + 8; + CursorTy jump_4340 = tmpcur_7327 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2965, tmpcur_7331); + CursorTy pvrtmp_7333 = tmp_struct_174.field0; + + return (CursorProd) {jump_4340}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7334 = *(CursorTy *) tmpcur_7327; + CursorTy tmpaftercur_7335 = tmpcur_7327 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2965, tmpcur_7334); + CursorTy pvrtmp_7336 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7336}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7326"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2967, CursorTy arg_883_1487_1808) +{ + TagTyPacked tmpval_7338 = *(TagTyPacked *) arg_883_1487_1808; + CursorTy tmpcur_7339 = arg_883_1487_1808 + 1; + + + switch_7349: + ; + switch (tmpval_7338) { + + case 0: + { + CursorTy jump_4186 = arg_883_1487_1808 + 1; + unsigned char wildcard_884_1488_1809 = print_symbol(6134); + unsigned char wildcard_885_1489_1810 = print_symbol(6129); + + return (CursorProd) {jump_4186}; + break; + } + + case 1: + { + IntTy tmpval_7340 = *(IntTy *) tmpcur_7339; + CursorTy tmpcur_7341 = tmpcur_7339 + sizeof(IntTy); + CursorTy jump_4188 = tmpcur_7339 + 8; + unsigned char wildcard_890_1492_1813 = print_symbol(6131); + unsigned char y_888_1493_1814 = printf("%lld", tmpval_7340); + CursorProd tmp_struct_176 = _print_Tags(end_r_2967, tmpcur_7341); + CursorTy pvrtmp_7342 = tmp_struct_176.field0; + unsigned char wildcard_891_1495_1816 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7342}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7343 = *(CursorTy *) tmpcur_7339; + CursorTy tmpaftercur_7344 = tmpcur_7339 + 8; + CursorTy jump_4346 = tmpcur_7339 + 8; + unsigned char wildcard_4349 = print_symbol(6146); + CursorProd tmp_struct_177 = _print_Tags(end_r_2967, tmpcur_7343); + CursorTy pvrtmp_7345 = tmp_struct_177.field0; + + return (CursorProd) {jump_4346}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7346 = *(CursorTy *) tmpcur_7339; + CursorTy tmpaftercur_7347 = tmpcur_7339 + 8; + unsigned char wildcard_4349 = print_symbol(6145); + CursorProd tmp_struct_178 = _print_Tags(end_r_2967, tmpcur_7346); + CursorTy pvrtmp_7348 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7348}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7338"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_2702) +{ + if (loc_2969 + 32 > end_r_2971) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2971); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2971 = chunk_end_184; + *(TagTyPacked *) loc_2969 = 255; + + CursorTy redir = loc_2969 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2969 = chunk_start_183; + } + + CursorTy loc_3696 = loc_2969 + 1; + CursorTy loc_3697 = loc_3696 + 8; + TagTyPacked tmpval_7350 = *(TagTyPacked *) arg_2702; + CursorTy tmpcur_7351 = arg_2702 + 1; + + + switch_7394: + ; + switch (tmpval_7350) { + + case 0: + { + CursorTy jump_4191 = arg_2702 + 1; + + *(TagTyPacked *) loc_2969 = 0; + + CursorTy writetag_5016 = loc_2969 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2971, jump_4191, + loc_2969, writetag_5016}; + break; + } + + case 1: + { + IntTy tmpval_7356 = *(IntTy *) tmpcur_7351; + CursorTy tmpcur_7357 = tmpcur_7351 + sizeof(IntTy); + CursorTy jump_4193 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_3697, tmpcur_7357); + CursorTy pvrtmp_7358 = tmp_struct_179.field0; + CursorTy pvrtmp_7359 = tmp_struct_179.field1; + CursorTy pvrtmp_7360 = tmp_struct_179.field2; + CursorTy pvrtmp_7361 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2969 = 1; + + CursorTy writetag_5021 = loc_2969 + 1; + + *(IntTy *) writetag_5021 = tmpval_7356; + + CursorTy writecur_5022 = writetag_5021 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7358, pvrtmp_7359, + loc_2969, pvrtmp_7361}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7370 = *(CursorTy *) tmpcur_7351; + CursorTy tmpaftercur_7371 = tmpcur_7351 + 8; + CursorTy jump_4352 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_2969, tmpcur_7370); + CursorTy pvrtmp_7372 = tmp_struct_180.field0; + CursorTy pvrtmp_7373 = tmp_struct_180.field1; + CursorTy pvrtmp_7374 = tmp_struct_180.field2; + CursorTy pvrtmp_7375 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7372, jump_4352, + pvrtmp_7374, pvrtmp_7375}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7382 = *(CursorTy *) tmpcur_7351; + CursorTy tmpaftercur_7383 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_2969, tmpcur_7382); + CursorTy pvrtmp_7384 = tmp_struct_181.field0; + CursorTy pvrtmp_7385 = tmp_struct_181.field1; + CursorTy pvrtmp_7386 = tmp_struct_181.field2; + CursorTy pvrtmp_7387 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7384, pvrtmp_7385, + pvrtmp_7386, pvrtmp_7387}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7350"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2974, + CursorTy end_r_2975, + CursorTy loc_2973, + CursorTy arg_2707) +{ + if (loc_2973 + 32 > end_r_2975) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2975); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2975 = chunk_end_191; + *(TagTyPacked *) loc_2973 = 255; + + CursorTy redir = loc_2973 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2973 = chunk_start_190; + } + + TagTyPacked tmpval_7395 = *(TagTyPacked *) arg_2707; + CursorTy tmpcur_7396 = arg_2707 + 1; + + + switch_7445: + ; + switch (tmpval_7395) { + + case 0: + { + CursorTy loc_3707 = loc_2973 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2974, end_r_2975, loc_3707, tmpcur_7396); + CursorTy pvrtmp_7397 = tmp_struct_185.field0; + CursorTy pvrtmp_7398 = tmp_struct_185.field1; + CursorTy pvrtmp_7399 = tmp_struct_185.field2; + CursorTy pvrtmp_7400 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2973 = 0; + + CursorTy writetag_5033 = loc_2973 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7397, pvrtmp_7398, + loc_2973, pvrtmp_7400}; + break; + } + + case 1: + { + CursorTy loc_3713 = loc_2973 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2974, end_r_2975, loc_3713, tmpcur_7396); + CursorTy pvrtmp_7409 = tmp_struct_186.field0; + CursorTy pvrtmp_7410 = tmp_struct_186.field1; + CursorTy pvrtmp_7411 = tmp_struct_186.field2; + CursorTy pvrtmp_7412 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2973 = 1; + + CursorTy writetag_5038 = loc_2973 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7409, pvrtmp_7410, + loc_2973, pvrtmp_7412}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7421 = *(CursorTy *) tmpcur_7396; + CursorTy tmpaftercur_7422 = tmpcur_7396 + 8; + CursorTy jump_4358 = tmpcur_7396 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2974, end_r_2975, loc_2973, tmpcur_7421); + CursorTy pvrtmp_7423 = tmp_struct_187.field0; + CursorTy pvrtmp_7424 = tmp_struct_187.field1; + CursorTy pvrtmp_7425 = tmp_struct_187.field2; + CursorTy pvrtmp_7426 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7423, jump_4358, + pvrtmp_7425, pvrtmp_7426}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7433 = *(CursorTy *) tmpcur_7396; + CursorTy tmpaftercur_7434 = tmpcur_7396 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2974, end_r_2975, loc_2973, tmpcur_7433); + CursorTy pvrtmp_7435 = tmp_struct_188.field0; + CursorTy pvrtmp_7436 = tmp_struct_188.field1; + CursorTy pvrtmp_7437 = tmp_struct_188.field2; + CursorTy pvrtmp_7438 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7435, pvrtmp_7436, + pvrtmp_7437, pvrtmp_7438}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7395"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2712) +{ + if (loc_2977 + 32 > end_r_2979) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2979); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2979 = chunk_end_218; + *(TagTyPacked *) loc_2977 = 255; + + CursorTy redir = loc_2977 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2977 = chunk_start_217; + } + + CursorTy loc_3726 = loc_2977 + 1; + CursorTy loc_3727 = loc_3726 + 8; + CursorTy loc_3728 = loc_3727 + 8; + CursorTy loc_3744 = loc_2977 + 1; + CursorTy loc_3745 = loc_3744 + 8; + CursorTy loc_3746 = loc_3745 + 8; + CursorTy loc_3766 = loc_2977 + 1; + CursorTy loc_3767 = loc_3766 + 8; + CursorTy loc_3768 = loc_3767 + 8; + CursorTy loc_3769 = loc_3768 + 8; + CursorTy loc_3793 = loc_2977 + 1; + CursorTy loc_3794 = loc_3793 + 8; + CursorTy loc_3795 = loc_3794 + 8; + CursorTy loc_3796 = loc_3795 + 8; + CursorTy loc_3820 = loc_2977 + 1; + CursorTy loc_3821 = loc_3820 + 8; + CursorTy loc_3822 = loc_3821 + 8; + CursorTy loc_3823 = loc_3822 + 8; + CursorTy loc_3847 = loc_2977 + 1; + CursorTy loc_3848 = loc_3847 + 8; + CursorTy loc_3849 = loc_3848 + 8; + CursorTy loc_3850 = loc_3849 + 8; + CursorTy loc_3874 = loc_2977 + 1; + CursorTy loc_3875 = loc_3874 + 8; + CursorTy loc_3876 = loc_3875 + 8; + CursorTy loc_3877 = loc_3876 + 8; + CursorTy loc_3901 = loc_2977 + 1; + CursorTy loc_3902 = loc_3901 + 8; + CursorTy loc_3903 = loc_3902 + 8; + CursorTy loc_3904 = loc_3903 + 8; + TagTyPacked tmpval_7446 = *(TagTyPacked *) arg_2712; + CursorTy tmpcur_7447 = arg_2712 + 1; + + + switch_7684: + ; + switch (tmpval_7446) { + + case 0: + { + CursorTy jump_4200 = arg_2712 + 1; + + *(TagTyPacked *) loc_2977 = 0; + + CursorTy writetag_5048 = loc_2977 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2979, jump_4200, + loc_2977, writetag_5048}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3728, tmpcur_7447); + CursorTy pvrtmp_7452 = tmp_struct_192.field0; + CursorTy pvrtmp_7453 = tmp_struct_192.field1; + CursorTy pvrtmp_7454 = tmp_struct_192.field2; + CursorTy pvrtmp_7455 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7452, pvrtmp_7455, pvrtmp_7453); + CursorTy pvrtmp_7460 = tmp_struct_193.field0; + CursorTy pvrtmp_7461 = tmp_struct_193.field1; + CursorTy pvrtmp_7462 = tmp_struct_193.field2; + CursorTy pvrtmp_7463 = tmp_struct_193.field3; + IntTy sizeof_y_2715__2717 = pvrtmp_7455 - pvrtmp_7454; + IntTy sizeof_y_2716__2718 = pvrtmp_7463 - pvrtmp_7462; + IntTy fltPrm_2806 = sizeof_y_2715__2717 + 0; + IntTy offset__2719 = 0 + fltPrm_2806; + IntTy fltPrm_2807 = sizeof_y_2715__2717 + sizeof_y_2716__2718; + IntTy size_dcon_2720 = 9 + fltPrm_2807; + + *(TagTyPacked *) loc_2977 = 160; + + CursorTy writetag_5053 = loc_2977 + 1; + + *(IntTy *) writetag_5053 = size_dcon_2720; + + CursorTy writecur_5054 = writetag_5053 + sizeof(IntTy); + + *(IntTy *) writecur_5054 = offset__2719; + + CursorTy writecur_5055 = writecur_5054 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7460, pvrtmp_7461, + loc_2977, pvrtmp_7463}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3746, tmpcur_7447); + CursorTy pvrtmp_7472 = tmp_struct_194.field0; + CursorTy pvrtmp_7473 = tmp_struct_194.field1; + CursorTy pvrtmp_7474 = tmp_struct_194.field2; + CursorTy pvrtmp_7475 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7472, pvrtmp_7475, pvrtmp_7473); + CursorTy pvrtmp_7480 = tmp_struct_195.field0; + CursorTy pvrtmp_7481 = tmp_struct_195.field1; + CursorTy pvrtmp_7482 = tmp_struct_195.field2; + CursorTy pvrtmp_7483 = tmp_struct_195.field3; + IntTy sizeof_y_2723__2725 = pvrtmp_7475 - pvrtmp_7474; + IntTy sizeof_y_2724__2726 = pvrtmp_7483 - pvrtmp_7482; + IntTy fltPrm_2808 = sizeof_y_2723__2725 + 0; + IntTy offset__2727 = 0 + fltPrm_2808; + IntTy fltPrm_2809 = sizeof_y_2723__2725 + sizeof_y_2724__2726; + IntTy size_dcon_2728 = 9 + fltPrm_2809; + + *(TagTyPacked *) loc_2977 = 162; + + CursorTy writetag_5062 = loc_2977 + 1; + + *(IntTy *) writetag_5062 = size_dcon_2728; + + CursorTy writecur_5063 = writetag_5062 + sizeof(IntTy); + + *(IntTy *) writecur_5063 = offset__2727; + + CursorTy writecur_5064 = writecur_5063 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7480, pvrtmp_7481, + loc_2977, pvrtmp_7483}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2978, end_r_2979, loc_3769, tmpcur_7447); + CursorTy pvrtmp_7492 = tmp_struct_196.field0; + CursorTy pvrtmp_7493 = tmp_struct_196.field1; + CursorTy pvrtmp_7494 = tmp_struct_196.field2; + CursorTy pvrtmp_7495 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7492, pvrtmp_7495, pvrtmp_7493); + CursorTy pvrtmp_7500 = tmp_struct_197.field0; + CursorTy pvrtmp_7501 = tmp_struct_197.field1; + CursorTy pvrtmp_7502 = tmp_struct_197.field2; + CursorTy pvrtmp_7503 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7500, pvrtmp_7503, pvrtmp_7501); + CursorTy pvrtmp_7508 = tmp_struct_198.field0; + CursorTy pvrtmp_7509 = tmp_struct_198.field1; + CursorTy pvrtmp_7510 = tmp_struct_198.field2; + CursorTy pvrtmp_7511 = tmp_struct_198.field3; + IntTy sizeof_y_2732__2735 = pvrtmp_7495 - pvrtmp_7494; + IntTy sizeof_y_2733__2736 = pvrtmp_7503 - pvrtmp_7502; + IntTy sizeof_y_2734__2737 = pvrtmp_7511 - pvrtmp_7510; + IntTy fltPrm_2810 = sizeof_y_2732__2735 + 0; + IntTy offset__2738 = 8 + fltPrm_2810; + IntTy fltPrm_2811 = sizeof_y_2732__2735 + sizeof_y_2733__2736; + IntTy offset__2739 = 0 + fltPrm_2811; + IntTy fltPrm_2813 = sizeof_y_2733__2736 + sizeof_y_2734__2737; + IntTy fltPrm_2812 = sizeof_y_2732__2735 + fltPrm_2813; + IntTy size_dcon_2740 = 17 + fltPrm_2812; + + *(TagTyPacked *) loc_2977 = 164; + + CursorTy writetag_5072 = loc_2977 + 1; + + *(IntTy *) writetag_5072 = size_dcon_2740; + + CursorTy writecur_5073 = writetag_5072 + sizeof(IntTy); + + *(IntTy *) writecur_5073 = offset__2738; + + CursorTy writecur_5074 = writecur_5073 + sizeof(IntTy); + + *(IntTy *) writecur_5074 = offset__2739; + + CursorTy writecur_5075 = writecur_5074 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7508, pvrtmp_7509, + loc_2977, pvrtmp_7511}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3796, tmpcur_7447); + CursorTy pvrtmp_7520 = tmp_struct_199.field0; + CursorTy pvrtmp_7521 = tmp_struct_199.field1; + CursorTy pvrtmp_7522 = tmp_struct_199.field2; + CursorTy pvrtmp_7523 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7520, pvrtmp_7523, pvrtmp_7521); + CursorTy pvrtmp_7528 = tmp_struct_200.field0; + CursorTy pvrtmp_7529 = tmp_struct_200.field1; + CursorTy pvrtmp_7530 = tmp_struct_200.field2; + CursorTy pvrtmp_7531 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7528, pvrtmp_7531, pvrtmp_7529); + CursorTy pvrtmp_7536 = tmp_struct_201.field0; + CursorTy pvrtmp_7537 = tmp_struct_201.field1; + CursorTy pvrtmp_7538 = tmp_struct_201.field2; + CursorTy pvrtmp_7539 = tmp_struct_201.field3; + IntTy sizeof_y_2744__2747 = pvrtmp_7523 - pvrtmp_7522; + IntTy sizeof_y_2745__2748 = pvrtmp_7531 - pvrtmp_7530; + IntTy sizeof_y_2746__2749 = pvrtmp_7539 - pvrtmp_7538; + IntTy fltPrm_2814 = sizeof_y_2744__2747 + 0; + IntTy offset__2750 = 8 + fltPrm_2814; + IntTy fltPrm_2815 = sizeof_y_2744__2747 + sizeof_y_2745__2748; + IntTy offset__2751 = 0 + fltPrm_2815; + IntTy fltPrm_2817 = sizeof_y_2745__2748 + sizeof_y_2746__2749; + IntTy fltPrm_2816 = sizeof_y_2744__2747 + fltPrm_2817; + IntTy size_dcon_2752 = 17 + fltPrm_2816; + + *(TagTyPacked *) loc_2977 = 166; + + CursorTy writetag_5084 = loc_2977 + 1; + + *(IntTy *) writetag_5084 = size_dcon_2752; + + CursorTy writecur_5085 = writetag_5084 + sizeof(IntTy); + + *(IntTy *) writecur_5085 = offset__2750; + + CursorTy writecur_5086 = writecur_5085 + sizeof(IntTy); + + *(IntTy *) writecur_5086 = offset__2751; + + CursorTy writecur_5087 = writecur_5086 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7536, pvrtmp_7537, + loc_2977, pvrtmp_7539}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2978, end_r_2979, loc_3823, tmpcur_7447); + CursorTy pvrtmp_7548 = tmp_struct_202.field0; + CursorTy pvrtmp_7549 = tmp_struct_202.field1; + CursorTy pvrtmp_7550 = tmp_struct_202.field2; + CursorTy pvrtmp_7551 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7548, pvrtmp_7551, pvrtmp_7549); + CursorTy pvrtmp_7556 = tmp_struct_203.field0; + CursorTy pvrtmp_7557 = tmp_struct_203.field1; + CursorTy pvrtmp_7558 = tmp_struct_203.field2; + CursorTy pvrtmp_7559 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7556, pvrtmp_7559, pvrtmp_7557); + CursorTy pvrtmp_7564 = tmp_struct_204.field0; + CursorTy pvrtmp_7565 = tmp_struct_204.field1; + CursorTy pvrtmp_7566 = tmp_struct_204.field2; + CursorTy pvrtmp_7567 = tmp_struct_204.field3; + IntTy sizeof_y_2756__2759 = pvrtmp_7551 - pvrtmp_7550; + IntTy sizeof_y_2757__2760 = pvrtmp_7559 - pvrtmp_7558; + IntTy sizeof_y_2758__2761 = pvrtmp_7567 - pvrtmp_7566; + IntTy fltPrm_2818 = sizeof_y_2756__2759 + 0; + IntTy offset__2762 = 8 + fltPrm_2818; + IntTy fltPrm_2819 = sizeof_y_2756__2759 + sizeof_y_2757__2760; + IntTy offset__2763 = 0 + fltPrm_2819; + IntTy fltPrm_2821 = sizeof_y_2757__2760 + sizeof_y_2758__2761; + IntTy fltPrm_2820 = sizeof_y_2756__2759 + fltPrm_2821; + IntTy size_dcon_2764 = 17 + fltPrm_2820; + + *(TagTyPacked *) loc_2977 = 168; + + CursorTy writetag_5096 = loc_2977 + 1; + + *(IntTy *) writetag_5096 = size_dcon_2764; + + CursorTy writecur_5097 = writetag_5096 + sizeof(IntTy); + + *(IntTy *) writecur_5097 = offset__2762; + + CursorTy writecur_5098 = writecur_5097 + sizeof(IntTy); + + *(IntTy *) writecur_5098 = offset__2763; + + CursorTy writecur_5099 = writecur_5098 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7564, pvrtmp_7565, + loc_2977, pvrtmp_7567}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3850, tmpcur_7447); + CursorTy pvrtmp_7576 = tmp_struct_205.field0; + CursorTy pvrtmp_7577 = tmp_struct_205.field1; + CursorTy pvrtmp_7578 = tmp_struct_205.field2; + CursorTy pvrtmp_7579 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7576, pvrtmp_7579, pvrtmp_7577); + CursorTy pvrtmp_7584 = tmp_struct_206.field0; + CursorTy pvrtmp_7585 = tmp_struct_206.field1; + CursorTy pvrtmp_7586 = tmp_struct_206.field2; + CursorTy pvrtmp_7587 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7584, pvrtmp_7587, pvrtmp_7585); + CursorTy pvrtmp_7592 = tmp_struct_207.field0; + CursorTy pvrtmp_7593 = tmp_struct_207.field1; + CursorTy pvrtmp_7594 = tmp_struct_207.field2; + CursorTy pvrtmp_7595 = tmp_struct_207.field3; + IntTy sizeof_y_2768__2771 = pvrtmp_7579 - pvrtmp_7578; + IntTy sizeof_y_2769__2772 = pvrtmp_7587 - pvrtmp_7586; + IntTy sizeof_y_2770__2773 = pvrtmp_7595 - pvrtmp_7594; + IntTy fltPrm_2822 = sizeof_y_2768__2771 + 0; + IntTy offset__2774 = 8 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2768__2771 + sizeof_y_2769__2772; + IntTy offset__2775 = 0 + fltPrm_2823; + IntTy fltPrm_2825 = sizeof_y_2769__2772 + sizeof_y_2770__2773; + IntTy fltPrm_2824 = sizeof_y_2768__2771 + fltPrm_2825; + IntTy size_dcon_2776 = 17 + fltPrm_2824; + + *(TagTyPacked *) loc_2977 = 170; + + CursorTy writetag_5108 = loc_2977 + 1; + + *(IntTy *) writetag_5108 = size_dcon_2776; + + CursorTy writecur_5109 = writetag_5108 + sizeof(IntTy); + + *(IntTy *) writecur_5109 = offset__2774; + + CursorTy writecur_5110 = writecur_5109 + sizeof(IntTy); + + *(IntTy *) writecur_5110 = offset__2775; + + CursorTy writecur_5111 = writecur_5110 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7592, pvrtmp_7593, + loc_2977, pvrtmp_7595}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3877, tmpcur_7447); + CursorTy pvrtmp_7604 = tmp_struct_208.field0; + CursorTy pvrtmp_7605 = tmp_struct_208.field1; + CursorTy pvrtmp_7606 = tmp_struct_208.field2; + CursorTy pvrtmp_7607 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7604, pvrtmp_7607, pvrtmp_7605); + CursorTy pvrtmp_7612 = tmp_struct_209.field0; + CursorTy pvrtmp_7613 = tmp_struct_209.field1; + CursorTy pvrtmp_7614 = tmp_struct_209.field2; + CursorTy pvrtmp_7615 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7612, pvrtmp_7615, pvrtmp_7613); + CursorTy pvrtmp_7620 = tmp_struct_210.field0; + CursorTy pvrtmp_7621 = tmp_struct_210.field1; + CursorTy pvrtmp_7622 = tmp_struct_210.field2; + CursorTy pvrtmp_7623 = tmp_struct_210.field3; + IntTy sizeof_y_2780__2783 = pvrtmp_7607 - pvrtmp_7606; + IntTy sizeof_y_2781__2784 = pvrtmp_7615 - pvrtmp_7614; + IntTy sizeof_y_2782__2785 = pvrtmp_7623 - pvrtmp_7622; + IntTy fltPrm_2826 = sizeof_y_2780__2783 + 0; + IntTy offset__2786 = 8 + fltPrm_2826; + IntTy fltPrm_2827 = sizeof_y_2780__2783 + sizeof_y_2781__2784; + IntTy offset__2787 = 0 + fltPrm_2827; + IntTy fltPrm_2829 = sizeof_y_2781__2784 + sizeof_y_2782__2785; + IntTy fltPrm_2828 = sizeof_y_2780__2783 + fltPrm_2829; + IntTy size_dcon_2788 = 17 + fltPrm_2828; + + *(TagTyPacked *) loc_2977 = 172; + + CursorTy writetag_5120 = loc_2977 + 1; + + *(IntTy *) writetag_5120 = size_dcon_2788; + + CursorTy writecur_5121 = writetag_5120 + sizeof(IntTy); + + *(IntTy *) writecur_5121 = offset__2786; + + CursorTy writecur_5122 = writecur_5121 + sizeof(IntTy); + + *(IntTy *) writecur_5122 = offset__2787; + + CursorTy writecur_5123 = writecur_5122 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7620, pvrtmp_7621, + loc_2977, pvrtmp_7623}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3904, tmpcur_7447); + CursorTy pvrtmp_7632 = tmp_struct_211.field0; + CursorTy pvrtmp_7633 = tmp_struct_211.field1; + CursorTy pvrtmp_7634 = tmp_struct_211.field2; + CursorTy pvrtmp_7635 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7632, pvrtmp_7635, pvrtmp_7633); + CursorTy pvrtmp_7640 = tmp_struct_212.field0; + CursorTy pvrtmp_7641 = tmp_struct_212.field1; + CursorTy pvrtmp_7642 = tmp_struct_212.field2; + CursorTy pvrtmp_7643 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7640, pvrtmp_7643, pvrtmp_7641); + CursorTy pvrtmp_7648 = tmp_struct_213.field0; + CursorTy pvrtmp_7649 = tmp_struct_213.field1; + CursorTy pvrtmp_7650 = tmp_struct_213.field2; + CursorTy pvrtmp_7651 = tmp_struct_213.field3; + IntTy sizeof_y_2792__2795 = pvrtmp_7635 - pvrtmp_7634; + IntTy sizeof_y_2793__2796 = pvrtmp_7643 - pvrtmp_7642; + IntTy sizeof_y_2794__2797 = pvrtmp_7651 - pvrtmp_7650; + IntTy fltPrm_2830 = sizeof_y_2792__2795 + 0; + IntTy offset__2798 = 8 + fltPrm_2830; + IntTy fltPrm_2831 = sizeof_y_2792__2795 + sizeof_y_2793__2796; + IntTy offset__2799 = 0 + fltPrm_2831; + IntTy fltPrm_2833 = sizeof_y_2793__2796 + sizeof_y_2794__2797; + IntTy fltPrm_2832 = sizeof_y_2792__2795 + fltPrm_2833; + IntTy size_dcon_2800 = 17 + fltPrm_2832; + + *(TagTyPacked *) loc_2977 = 174; + + CursorTy writetag_5132 = loc_2977 + 1; + + *(IntTy *) writetag_5132 = size_dcon_2800; + + CursorTy writecur_5133 = writetag_5132 + sizeof(IntTy); + + *(IntTy *) writecur_5133 = offset__2798; + + CursorTy writecur_5134 = writecur_5133 + sizeof(IntTy); + + *(IntTy *) writecur_5134 = offset__2799; + + CursorTy writecur_5135 = writecur_5134 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7648, pvrtmp_7649, + loc_2977, pvrtmp_7651}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7660 = *(CursorTy *) tmpcur_7447; + CursorTy tmpaftercur_7661 = tmpcur_7447 + 8; + CursorTy jump_4364 = tmpcur_7447 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_2977, tmpcur_7660); + CursorTy pvrtmp_7662 = tmp_struct_214.field0; + CursorTy pvrtmp_7663 = tmp_struct_214.field1; + CursorTy pvrtmp_7664 = tmp_struct_214.field2; + CursorTy pvrtmp_7665 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7662, jump_4364, + pvrtmp_7664, pvrtmp_7665}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7672 = *(CursorTy *) tmpcur_7447; + CursorTy tmpaftercur_7673 = tmpcur_7447 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_2977, tmpcur_7672); + CursorTy pvrtmp_7674 = tmp_struct_215.field0; + CursorTy pvrtmp_7675 = tmp_struct_215.field1; + CursorTy pvrtmp_7676 = tmp_struct_215.field2; + CursorTy pvrtmp_7677 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7674, pvrtmp_7675, + pvrtmp_7676, pvrtmp_7677}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7446"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2801) +{ + if (loc_2981 + 32 > end_r_2983) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2983); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2983 = chunk_end_224; + *(TagTyPacked *) loc_2981 = 255; + + CursorTy redir = loc_2981 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2981 = chunk_start_223; + } + + CursorTy loc_3924 = loc_2981 + 1; + CursorTy loc_3925 = loc_3924 + 8; + TagTyPacked tmpval_7685 = *(TagTyPacked *) arg_2801; + CursorTy tmpcur_7686 = arg_2801 + 1; + + + switch_7729: + ; + switch (tmpval_7685) { + + case 0: + { + CursorTy jump_4232 = arg_2801 + 1; + + *(TagTyPacked *) loc_2981 = 0; + + CursorTy writetag_5147 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2983, jump_4232, + loc_2981, writetag_5147}; + break; + } + + case 1: + { + IntTy tmpval_7691 = *(IntTy *) tmpcur_7686; + CursorTy tmpcur_7692 = tmpcur_7686 + sizeof(IntTy); + CursorTy jump_4234 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_3925, tmpcur_7692); + CursorTy pvrtmp_7693 = tmp_struct_219.field0; + CursorTy pvrtmp_7694 = tmp_struct_219.field1; + CursorTy pvrtmp_7695 = tmp_struct_219.field2; + CursorTy pvrtmp_7696 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2981 = 1; + + CursorTy writetag_5152 = loc_2981 + 1; + + *(IntTy *) writetag_5152 = tmpval_7691; + + CursorTy writecur_5153 = writetag_5152 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7693, pvrtmp_7694, + loc_2981, pvrtmp_7696}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7705 = *(CursorTy *) tmpcur_7686; + CursorTy tmpaftercur_7706 = tmpcur_7686 + 8; + CursorTy jump_4370 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_2981, tmpcur_7705); + CursorTy pvrtmp_7707 = tmp_struct_220.field0; + CursorTy pvrtmp_7708 = tmp_struct_220.field1; + CursorTy pvrtmp_7709 = tmp_struct_220.field2; + CursorTy pvrtmp_7710 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7707, jump_4370, + pvrtmp_7709, pvrtmp_7710}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7717 = *(CursorTy *) tmpcur_7686; + CursorTy tmpaftercur_7718 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_2981, tmpcur_7717); + CursorTy pvrtmp_7719 = tmp_struct_221.field0; + CursorTy pvrtmp_7720 = tmp_struct_221.field1; + CursorTy pvrtmp_7721 = tmp_struct_221.field2; + CursorTy pvrtmp_7722 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7719, pvrtmp_7720, + pvrtmp_7721, pvrtmp_7722}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7685"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6129, ")"); + add_symbol(6130, "(Text "); + add_symbol(6131, "(Tag "); + add_symbol(6132, "(TCA "); + add_symbol(6133, "(TAC "); + add_symbol(6134, "(Nul "); + add_symbol(6135, "(Nil "); + add_symbol(6136, "(Image "); + add_symbol(6137, "(End "); + add_symbol(6138, "(Char "); + add_symbol(6139, "(CTA "); + add_symbol(6140, "(CAT "); + add_symbol(6141, "(CA "); + add_symbol(6142, "(ATC "); + add_symbol(6143, "(ACT "); + add_symbol(6144, "(AC "); + add_symbol(6145, " ->r "); + add_symbol(6146, " ->i "); + + RegionTy *region_6147 = alloc_region(global_init_inf_buf_size); + CursorTy r_2993 = region_6147->reg_heap; + IntTy sizeof_end_r_2993_6148 = global_init_inf_buf_size; + CursorTy end_r_2993 = r_2993 + sizeof_end_r_2993_6148; + RegionTy *region_6149 = alloc_region(global_init_inf_buf_size); + CursorTy r_2992 = region_6149->reg_heap; + IntTy sizeof_end_r_2992_6150 = global_init_inf_buf_size; + CursorTy end_r_2992 = r_2992 + sizeof_end_r_2992_6150; + CursorCursorCursorProd tmp_struct_225 = + mkATCList(end_r_2993, r_2993, 100000, 10, 2000); + CursorTy pvrtmp_6151 = tmp_struct_225.field0; + CursorTy pvrtmp_6152 = tmp_struct_225.field1; + CursorTy pvrtmp_6153 = tmp_struct_225.field2; + CursorTy pvrtmp_6167; + CursorTy pvrtmp_6168; + CursorTy pvrtmp_6169; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6167; + struct timespec end_pvrtmp_6167; + + start_counters(); + for (long long iters_pvrtmp_6167 = 0; iters_pvrtmp_6167 < + global_iters_param; iters_pvrtmp_6167++) { + if (iters_pvrtmp_6167 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6167); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6151, end_r_2992, r_2992, pvrtmp_6152); + CursorTy pvrtmp_6158 = tmp_struct_226.field0; + CursorTy pvrtmp_6159 = tmp_struct_226.field1; + CursorTy pvrtmp_6160 = tmp_struct_226.field2; + + pvrtmp_6167 = pvrtmp_6158; + pvrtmp_6168 = pvrtmp_6159; + pvrtmp_6169 = pvrtmp_6160; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6167); + if (iters_pvrtmp_6167 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6167, + &end_pvrtmp_6167); + + vector_inplace_update(times_230, iters_pvrtmp_6167, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCat.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCat.c new file mode 100644 index 000000000..6c035c768 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCat.c @@ -0,0 +1,5070 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2914, CursorTy end_r_2915, + CursorTy loc_2913, + CursorTy adt_15_901_1518); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2918, CursorTy end_r_2919, + CursorTy loc_2917, + CursorTy tags_21_907_1525, + IntTy inVal_22_908_1526); +CursorCursorCursorProd mkCATList(CursorTy end_r_2921, CursorTy loc_2920, + IntTy len_25_911_1531, + IntTy tagLen_26_912_1532, + IntTy strLen_27_913_1533); +CursorCursorCursorProd mkString(CursorTy end_r_2923, CursorTy loc_2922, + IntTy len_180_1066_1539); +CursorCursorCursorProd mkContentText(CursorTy end_r_2925, CursorTy loc_2924, + IntTy n_194_1080_1545); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_319_1205_1547); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2930, + CursorTy end_r_2931, + CursorTy loc_2929, + CursorTy arg_623_1229_1552); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_628_1234_1557); +CursorProd _traverse_String(CursorTy end_r_2937, CursorTy arg_633_1239_1562); +CursorProd _print_String(CursorTy end_r_2939, CursorTy arg_638_1243_1566); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2942, + CursorTy end_r_2943, + CursorTy loc_2941, + CursorTy arg_647_1252_1575); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2946, + CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_652_1257_1580); +CursorProd _traverse_Content(CursorTy end_r_2949, CursorTy arg_657_1262_1585); +CursorProd _print_Content(CursorTy end_r_2951, CursorTy arg_662_1267_1590); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2954, CursorTy end_r_2955, + CursorTy loc_2953, + CursorTy arg_671_1276_1599); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2958, + CursorTy end_r_2959, + CursorTy loc_2957, + CursorTy arg_716_1321_1644); +CursorProd _traverse_Adt(CursorTy end_r_2961, CursorTy arg_761_1366_1689); +CursorProd _print_Adt(CursorTy end_r_2963, CursorTy arg_806_1411_1734); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2966, + CursorTy end_r_2967, CursorTy loc_2965, + CursorTy arg_869_1474_1797); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_874_1479_1802); +CursorProd _traverse_Tags(CursorTy end_r_2973, CursorTy arg_879_1484_1807); +CursorProd _print_Tags(CursorTy end_r_2975, CursorTy arg_884_1488_1811); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2978, CursorTy end_r_2979, + CursorTy loc_2977, CursorTy arg_2710); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2982, CursorTy end_r_2983, + CursorTy loc_2981, CursorTy arg_2715); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2986, + CursorTy end_r_2987, + CursorTy loc_2985, + CursorTy arg_2720); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2990, + CursorTy end_r_2991, + CursorTy loc_2989, + CursorTy arg_2809); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2914, CursorTy end_r_2915, + CursorTy loc_2913, + CursorTy adt_15_901_1518) +{ + if (loc_2913 + 32 > end_r_2915) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2915); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2915 = chunk_end_6; + *(TagTyPacked *) loc_2913 = 255; + + CursorTy redir = loc_2913 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2913 = chunk_start_5; + } + + CursorTy loc_3020 = loc_2913 + 1; + CursorTy loc_3021 = loc_3020 + 8; + CursorTy loc_3022 = loc_3021 + 8; + TagTyPacked tmpval_6193 = *(TagTyPacked *) adt_15_901_1518; + CursorTy tmpcur_6194 = adt_15_901_1518 + 1; + + + switch_6250: + ; + switch (tmpval_6193) { + + case 0: + { + CursorTy jump_3946 = adt_15_901_1518 + 1; + + *(TagTyPacked *) loc_2913 = 0; + + CursorTy writetag_4505 = loc_2913 + 1; + + return (CursorCursorCursorProd) {end_r_2915, loc_2913, + writetag_4505}; + break; + } + + case 23: + { + RegionTy *region_6199 = alloc_region(global_init_inf_buf_size); + CursorTy r_3032 = region_6199->reg_heap; + IntTy sizeof_end_r_3032_6200 = global_init_inf_buf_size; + CursorTy end_r_3032 = r_3032 + sizeof_end_r_3032_6200; + CursorTy tmpcur_6201 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6202 = tmpcur_6194 + 8; + CursorTy tmpcur_6203 = *(CursorTy *) tmpaftercur_6202; + CursorTy tmpaftercur_6204 = tmpaftercur_6202 + 8; + CursorTy jump_3949 = tmpaftercur_6202 + 8; + CursorTy jump_3948 = tmpcur_6194 + 8; + + *(TagTyPacked *) loc_3022 = 254; + + CursorTy writetag_4510 = loc_3022 + 1; + + *(CursorTy *) writetag_4510 = tmpaftercur_6204; + + CursorTy writecur_4511 = writetag_4510 + 8; + CursorCursorCursorCursorProd tmp_struct_0 = + addValTag(end_r_2914, end_r_3032, r_3032, tmpcur_6203, 10); + CursorTy pvrtmp_6207 = tmp_struct_0.field0; + CursorTy pvrtmp_6208 = tmp_struct_0.field1; + CursorTy pvrtmp_6209 = tmp_struct_0.field2; + CursorTy pvrtmp_6210 = tmp_struct_0.field3; + CursorCursorCursorProd tmp_struct_1 = + addValTagsAdt(end_r_2914, end_r_2915, writecur_4511, tmpcur_6201); + CursorTy pvrtmp_6215 = tmp_struct_1.field0; + CursorTy pvrtmp_6216 = tmp_struct_1.field1; + CursorTy pvrtmp_6217 = tmp_struct_1.field2; + + *(TagTyPacked *) pvrtmp_6217 = 254; + + CursorTy writetag_4515 = pvrtmp_6217 + 1; + + *(CursorTy *) writetag_4515 = r_3032; + + CursorTy writecur_4516 = writetag_4515 + 8; + + *(TagTyPacked *) loc_2913 = 23; + + CursorTy writetag_4518 = loc_2913 + 1; + + *(CursorTy *) writetag_4518 = tmpcur_6201; + + CursorTy writecur_4519 = writetag_4518 + 8; + + *(CursorTy *) writecur_4519 = pvrtmp_6217; + + CursorTy writecur_4520 = writecur_4519 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6215, loc_2913, + writecur_4516}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6228 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6229 = tmpcur_6194 + 8; + CursorTy jump_4258 = tmpcur_6194 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2914, end_r_2915, loc_2913, tmpcur_6228); + CursorTy pvrtmp_6230 = tmp_struct_2.field0; + CursorTy pvrtmp_6231 = tmp_struct_2.field1; + CursorTy pvrtmp_6232 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6230, pvrtmp_6231, + pvrtmp_6232}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6239 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6240 = tmpcur_6194 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2914, end_r_2915, loc_2913, tmpcur_6239); + CursorTy pvrtmp_6241 = tmp_struct_3.field0; + CursorTy pvrtmp_6242 = tmp_struct_3.field1; + CursorTy pvrtmp_6243 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6241, pvrtmp_6242, + pvrtmp_6243}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6193"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2918, CursorTy end_r_2919, + CursorTy loc_2917, + CursorTy tags_21_907_1525, + IntTy inVal_22_908_1526) +{ + if (loc_2917 + 32 > end_r_2919) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2919); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2919 = chunk_end_12; + *(TagTyPacked *) loc_2917 = 255; + + CursorTy redir = loc_2917 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2917 = chunk_start_11; + } + + CursorTy loc_3041 = loc_2917 + 1; + CursorTy loc_3042 = loc_3041 + 8; + TagTyPacked tmpval_6251 = *(TagTyPacked *) tags_21_907_1525; + CursorTy tmpcur_6252 = tags_21_907_1525 + 1; + + + switch_6295: + ; + switch (tmpval_6251) { + + case 0: + { + CursorTy jump_3952 = tags_21_907_1525 + 1; + + *(TagTyPacked *) loc_2917 = 0; + + CursorTy writetag_4532 = loc_2917 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2919, jump_3952, + loc_2917, writetag_4532}; + break; + } + + case 1: + { + IntTy tmpval_6257 = *(IntTy *) tmpcur_6252; + CursorTy tmpcur_6258 = tmpcur_6252 + sizeof(IntTy); + CursorTy jump_3954 = tmpcur_6252 + 8; + IntTy fltPkd_1506_1529 = tmpval_6257 + inVal_22_908_1526; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2918, end_r_2919, loc_3042, tmpcur_6258, inVal_22_908_1526); + CursorTy pvrtmp_6259 = tmp_struct_7.field0; + CursorTy pvrtmp_6260 = tmp_struct_7.field1; + CursorTy pvrtmp_6261 = tmp_struct_7.field2; + CursorTy pvrtmp_6262 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2917 = 1; + + CursorTy writetag_4537 = loc_2917 + 1; + + *(IntTy *) writetag_4537 = fltPkd_1506_1529; + + CursorTy writecur_4538 = writetag_4537 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6259, pvrtmp_6260, + loc_2917, pvrtmp_6262}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6271 = *(CursorTy *) tmpcur_6252; + CursorTy tmpaftercur_6272 = tmpcur_6252 + 8; + CursorTy jump_4263 = tmpcur_6252 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2918, end_r_2919, loc_2917, tmpcur_6271, inVal_22_908_1526); + CursorTy pvrtmp_6273 = tmp_struct_8.field0; + CursorTy pvrtmp_6274 = tmp_struct_8.field1; + CursorTy pvrtmp_6275 = tmp_struct_8.field2; + CursorTy pvrtmp_6276 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6273, jump_4263, + pvrtmp_6275, pvrtmp_6276}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6283 = *(CursorTy *) tmpcur_6252; + CursorTy tmpaftercur_6284 = tmpcur_6252 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2918, end_r_2919, loc_2917, tmpcur_6283, inVal_22_908_1526); + CursorTy pvrtmp_6285 = tmp_struct_9.field0; + CursorTy pvrtmp_6286 = tmp_struct_9.field1; + CursorTy pvrtmp_6287 = tmp_struct_9.field2; + CursorTy pvrtmp_6288 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6285, pvrtmp_6286, + pvrtmp_6287, pvrtmp_6288}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6251"); + exit(1); + } + } +} +CursorCursorCursorProd mkCATList(CursorTy end_r_2921, CursorTy loc_2920, + IntTy len_25_911_1531, + IntTy tagLen_26_912_1532, + IntTy strLen_27_913_1533) +{ + if (loc_2920 + 32 > end_r_2921) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2921); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2921 = chunk_end_18; + *(TagTyPacked *) loc_2920 = 255; + + CursorTy redir = loc_2920 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2920 = chunk_start_17; + } + + CursorTy loc_3050 = loc_2920 + 1; + CursorTy loc_3051 = loc_3050 + 8; + CursorTy loc_3052 = loc_3051 + 8; + BoolTy fltIf_1508_1534 = len_25_911_1531 <= 0; + + if (fltIf_1508_1534) { + *(TagTyPacked *) loc_2920 = 0; + + CursorTy writetag_4547 = loc_2920 + 1; + + return (CursorCursorCursorProd) {end_r_2921, loc_2920, writetag_4547}; + } else { + CursorCursorCursorProd tmp_struct_13 = + mkContentText(end_r_2921, loc_3052, strLen_27_913_1533); + CursorTy pvrtmp_6300 = tmp_struct_13.field0; + CursorTy pvrtmp_6301 = tmp_struct_13.field1; + CursorTy pvrtmp_6302 = tmp_struct_13.field2; + IntTy fltAppE_1509_1536 = len_25_911_1531 - 1; + CursorCursorCursorProd tmp_struct_14 = + mkCATList(pvrtmp_6300, pvrtmp_6302, fltAppE_1509_1536, tagLen_26_912_1532, strLen_27_913_1533); + CursorTy pvrtmp_6307 = tmp_struct_14.field0; + CursorTy pvrtmp_6308 = tmp_struct_14.field1; + CursorTy pvrtmp_6309 = tmp_struct_14.field2; + CursorCursorCursorProd tmp_struct_15 = + mkRandomTags(pvrtmp_6307, pvrtmp_6309, tagLen_26_912_1532); + CursorTy pvrtmp_6314 = tmp_struct_15.field0; + CursorTy pvrtmp_6315 = tmp_struct_15.field1; + CursorTy pvrtmp_6316 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2920 = 23; + + CursorTy writetag_4552 = loc_2920 + 1; + + *(CursorTy *) writetag_4552 = pvrtmp_6302; + + CursorTy writecur_4553 = writetag_4552 + 8; + + *(CursorTy *) writecur_4553 = pvrtmp_6309; + + CursorTy writecur_4554 = writecur_4553 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6314, loc_2920, pvrtmp_6316}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2923, CursorTy loc_2922, + IntTy len_180_1066_1539) +{ + if (loc_2922 + 32 > end_r_2923) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2923); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2923 = chunk_end_22; + *(TagTyPacked *) loc_2922 = 255; + + CursorTy redir = loc_2922 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2922 = chunk_start_21; + } + + CursorTy loc_3064 = loc_2922 + 1; + CursorTy loc_3065 = loc_3064 + 8; + BoolTy fltIf_1510_1540 = len_180_1066_1539 <= 0; + + if (fltIf_1510_1540) { + *(TagTyPacked *) loc_2922 = 0; + + CursorTy writetag_4559 = loc_2922 + 1; + + return (CursorCursorCursorProd) {end_r_2923, loc_2922, writetag_4559}; + } else { + IntTy fltPrm_1511_1541 = rand(); + IntTy randomChar_181_1067_1542 = fltPrm_1511_1541 % 128; + IntTy fltAppE_1512_1543 = len_180_1066_1539 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2923, loc_3065, fltAppE_1512_1543); + CursorTy pvrtmp_6329 = tmp_struct_19.field0; + CursorTy pvrtmp_6330 = tmp_struct_19.field1; + CursorTy pvrtmp_6331 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2922 = 1; + + CursorTy writetag_4562 = loc_2922 + 1; + + *(IntTy *) writetag_4562 = randomChar_181_1067_1542; + + CursorTy writecur_4563 = writetag_4562 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6329, loc_2922, pvrtmp_6331}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2925, CursorTy loc_2924, + IntTy n_194_1080_1545) +{ + if (loc_2924 + 32 > end_r_2925) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2925); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2925 = chunk_end_26; + *(TagTyPacked *) loc_2924 = 255; + + CursorTy redir = loc_2924 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2924 = chunk_start_25; + } + + CursorTy loc_3070 = loc_2924 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2925, loc_3070, n_194_1080_1545); + CursorTy pvrtmp_6340 = tmp_struct_23.field0; + CursorTy pvrtmp_6341 = tmp_struct_23.field1; + CursorTy pvrtmp_6342 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2924 = 1; + + CursorTy writetag_4567 = loc_2924 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6340, loc_2924, pvrtmp_6342}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_319_1205_1547) +{ + if (loc_2926 + 32 > end_r_2927) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2927); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2927 = chunk_end_30; + *(TagTyPacked *) loc_2926 = 255; + + CursorTy redir = loc_2926 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2926 = chunk_start_29; + } + + CursorTy loc_3074 = loc_2926 + 1; + CursorTy loc_3075 = loc_3074 + 8; + BoolTy fltIf_1514_1548 = len_319_1205_1547 <= 0; + + if (fltIf_1514_1548) { + *(TagTyPacked *) loc_2926 = 0; + + CursorTy writetag_4570 = loc_2926 + 1; + + return (CursorCursorCursorProd) {end_r_2927, loc_2926, writetag_4570}; + } else { + IntTy fltAppE_1515_1550 = len_319_1205_1547 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2927, loc_3075, fltAppE_1515_1550); + CursorTy pvrtmp_6355 = tmp_struct_27.field0; + CursorTy pvrtmp_6356 = tmp_struct_27.field1; + CursorTy pvrtmp_6357 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2926 = 1; + + CursorTy writetag_4573 = loc_2926 + 1; + + *(IntTy *) writetag_4573 = 100; + + CursorTy writecur_4574 = writetag_4573 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6355, loc_2926, pvrtmp_6357}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2930, + CursorTy end_r_2931, + CursorTy loc_2929, + CursorTy arg_623_1229_1552) +{ + if (loc_2929 + 32 > end_r_2931) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2931); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2931 = chunk_end_36; + *(TagTyPacked *) loc_2929 = 255; + + CursorTy redir = loc_2929 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2929 = chunk_start_35; + } + + CursorTy loc_3085 = loc_2929 + 1; + CursorTy loc_3086 = loc_3085 + 8; + TagTyPacked tmpval_6366 = *(TagTyPacked *) arg_623_1229_1552; + CursorTy tmpcur_6367 = arg_623_1229_1552 + 1; + + + switch_6410: + ; + switch (tmpval_6366) { + + case 0: + { + CursorTy jump_3964 = arg_623_1229_1552 + 1; + + *(TagTyPacked *) loc_2929 = 0; + + CursorTy writetag_4578 = loc_2929 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2931, jump_3964, + loc_2929, writetag_4578}; + break; + } + + case 1: + { + IntTy tmpval_6372 = *(IntTy *) tmpcur_6367; + CursorTy tmpcur_6373 = tmpcur_6367 + sizeof(IntTy); + CursorTy jump_3966 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2930, end_r_2931, loc_3086, tmpcur_6373); + CursorTy pvrtmp_6374 = tmp_struct_31.field0; + CursorTy pvrtmp_6375 = tmp_struct_31.field1; + CursorTy pvrtmp_6376 = tmp_struct_31.field2; + CursorTy pvrtmp_6377 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2929 = 1; + + CursorTy writetag_4583 = loc_2929 + 1; + + *(IntTy *) writetag_4583 = tmpval_6372; + + CursorTy writecur_4584 = writetag_4583 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6374, pvrtmp_6375, + loc_2929, pvrtmp_6377}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6386 = *(CursorTy *) tmpcur_6367; + CursorTy tmpaftercur_6387 = tmpcur_6367 + 8; + CursorTy jump_4269 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2930, end_r_2931, loc_2929, tmpcur_6386); + CursorTy pvrtmp_6388 = tmp_struct_32.field0; + CursorTy pvrtmp_6389 = tmp_struct_32.field1; + CursorTy pvrtmp_6390 = tmp_struct_32.field2; + CursorTy pvrtmp_6391 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6388, jump_4269, + pvrtmp_6390, pvrtmp_6391}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6398 = *(CursorTy *) tmpcur_6367; + CursorTy tmpaftercur_6399 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2930, end_r_2931, loc_2929, tmpcur_6398); + CursorTy pvrtmp_6400 = tmp_struct_33.field0; + CursorTy pvrtmp_6401 = tmp_struct_33.field1; + CursorTy pvrtmp_6402 = tmp_struct_33.field2; + CursorTy pvrtmp_6403 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6400, pvrtmp_6401, + pvrtmp_6402, pvrtmp_6403}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6366"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_628_1234_1557) +{ + CursorTy loc_3098 = loc_2933 + 1; + CursorTy loc_3099 = loc_3098 + 8; + TagTyPacked tmpval_6411 = *(TagTyPacked *) arg_628_1234_1557; + CursorTy tmpcur_6412 = arg_628_1234_1557 + 1; + + + switch_6455: + ; + switch (tmpval_6411) { + + case 0: + { + CursorTy jump_3969 = arg_628_1234_1557 + 1; + + *(TagTyPacked *) loc_2933 = 0; + + CursorTy writetag_4594 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2935, jump_3969, + loc_2933, writetag_4594}; + break; + } + + case 1: + { + IntTy tmpval_6417 = *(IntTy *) tmpcur_6412; + CursorTy tmpcur_6418 = tmpcur_6412 + sizeof(IntTy); + CursorTy jump_3971 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_3099, tmpcur_6418); + CursorTy pvrtmp_6419 = tmp_struct_37.field0; + CursorTy pvrtmp_6420 = tmp_struct_37.field1; + CursorTy pvrtmp_6421 = tmp_struct_37.field2; + CursorTy pvrtmp_6422 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2933 = 1; + + CursorTy writetag_4599 = loc_2933 + 1; + + *(IntTy *) writetag_4599 = tmpval_6417; + + CursorTy writecur_4600 = writetag_4599 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6419, pvrtmp_6420, + loc_2933, pvrtmp_6422}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6431 = *(CursorTy *) tmpcur_6412; + CursorTy tmpaftercur_6432 = tmpcur_6412 + 8; + CursorTy jump_4275 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_2933, tmpcur_6431); + CursorTy pvrtmp_6433 = tmp_struct_38.field0; + CursorTy pvrtmp_6434 = tmp_struct_38.field1; + CursorTy pvrtmp_6435 = tmp_struct_38.field2; + CursorTy pvrtmp_6436 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6433, jump_4275, + pvrtmp_6435, pvrtmp_6436}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6443 = *(CursorTy *) tmpcur_6412; + CursorTy tmpaftercur_6444 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_2933, tmpcur_6443); + CursorTy pvrtmp_6445 = tmp_struct_39.field0; + CursorTy pvrtmp_6446 = tmp_struct_39.field1; + CursorTy pvrtmp_6447 = tmp_struct_39.field2; + CursorTy pvrtmp_6448 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6445, pvrtmp_6446, + pvrtmp_6447, pvrtmp_6448}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6411"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2937, CursorTy arg_633_1239_1562) +{ + TagTyPacked tmpval_6456 = *(TagTyPacked *) arg_633_1239_1562; + CursorTy tmpcur_6457 = arg_633_1239_1562 + 1; + + + switch_6467: + ; + switch (tmpval_6456) { + + case 0: + { + CursorTy jump_3974 = arg_633_1239_1562 + 1; + + return (CursorProd) {jump_3974}; + break; + } + + case 1: + { + IntTy tmpval_6458 = *(IntTy *) tmpcur_6457; + CursorTy tmpcur_6459 = tmpcur_6457 + sizeof(IntTy); + CursorTy jump_3976 = tmpcur_6457 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2937, tmpcur_6459); + CursorTy pvrtmp_6460 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6460}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6461 = *(CursorTy *) tmpcur_6457; + CursorTy tmpaftercur_6462 = tmpcur_6457 + 8; + CursorTy jump_4281 = tmpcur_6457 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2937, tmpcur_6461); + CursorTy pvrtmp_6463 = tmp_struct_41.field0; + + return (CursorProd) {jump_4281}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6464 = *(CursorTy *) tmpcur_6457; + CursorTy tmpaftercur_6465 = tmpcur_6457 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2937, tmpcur_6464); + CursorTy pvrtmp_6466 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6466}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6456"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2939, CursorTy arg_638_1243_1566) +{ + TagTyPacked tmpval_6468 = *(TagTyPacked *) arg_638_1243_1566; + CursorTy tmpcur_6469 = arg_638_1243_1566 + 1; + + + switch_6479: + ; + switch (tmpval_6468) { + + case 0: + { + CursorTy jump_3979 = arg_638_1243_1566 + 1; + unsigned char wildcard_639_1244_1567 = print_symbol(6153); + unsigned char wildcard_640_1245_1568 = print_symbol(6145); + + return (CursorProd) {jump_3979}; + break; + } + + case 1: + { + IntTy tmpval_6470 = *(IntTy *) tmpcur_6469; + CursorTy tmpcur_6471 = tmpcur_6469 + sizeof(IntTy); + CursorTy jump_3981 = tmpcur_6469 + 8; + unsigned char wildcard_645_1248_1571 = print_symbol(6154); + unsigned char y_643_1249_1572 = printf("%lld", tmpval_6470); + CursorProd tmp_struct_43 = _print_String(end_r_2939, tmpcur_6471); + CursorTy pvrtmp_6472 = tmp_struct_43.field0; + unsigned char wildcard_646_1251_1574 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6472}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6473 = *(CursorTy *) tmpcur_6469; + CursorTy tmpaftercur_6474 = tmpcur_6469 + 8; + CursorTy jump_4287 = tmpcur_6469 + 8; + unsigned char wildcard_4290 = print_symbol(6162); + CursorProd tmp_struct_44 = _print_String(end_r_2939, tmpcur_6473); + CursorTy pvrtmp_6475 = tmp_struct_44.field0; + + return (CursorProd) {jump_4287}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6476 = *(CursorTy *) tmpcur_6469; + CursorTy tmpaftercur_6477 = tmpcur_6469 + 8; + unsigned char wildcard_4290 = print_symbol(6161); + CursorProd tmp_struct_45 = _print_String(end_r_2939, tmpcur_6476); + CursorTy pvrtmp_6478 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6478}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6468"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2942, + CursorTy end_r_2943, + CursorTy loc_2941, + CursorTy arg_647_1252_1575) +{ + if (loc_2941 + 32 > end_r_2943) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2943); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2943 = chunk_end_52; + *(TagTyPacked *) loc_2941 = 255; + + CursorTy redir = loc_2941 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2941 = chunk_start_51; + } + + TagTyPacked tmpval_6480 = *(TagTyPacked *) arg_647_1252_1575; + CursorTy tmpcur_6481 = arg_647_1252_1575 + 1; + + + switch_6530: + ; + switch (tmpval_6480) { + + case 0: + { + CursorTy loc_3121 = loc_2941 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2942, end_r_2943, loc_3121, tmpcur_6481); + CursorTy pvrtmp_6482 = tmp_struct_46.field0; + CursorTy pvrtmp_6483 = tmp_struct_46.field1; + CursorTy pvrtmp_6484 = tmp_struct_46.field2; + CursorTy pvrtmp_6485 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2941 = 0; + + CursorTy writetag_4631 = loc_2941 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6482, pvrtmp_6483, + loc_2941, pvrtmp_6485}; + break; + } + + case 1: + { + CursorTy loc_3127 = loc_2941 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2942, end_r_2943, loc_3127, tmpcur_6481); + CursorTy pvrtmp_6494 = tmp_struct_47.field0; + CursorTy pvrtmp_6495 = tmp_struct_47.field1; + CursorTy pvrtmp_6496 = tmp_struct_47.field2; + CursorTy pvrtmp_6497 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2941 = 1; + + CursorTy writetag_4636 = loc_2941 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6494, pvrtmp_6495, + loc_2941, pvrtmp_6497}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6506 = *(CursorTy *) tmpcur_6481; + CursorTy tmpaftercur_6507 = tmpcur_6481 + 8; + CursorTy jump_4293 = tmpcur_6481 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2942, end_r_2943, loc_2941, tmpcur_6506); + CursorTy pvrtmp_6508 = tmp_struct_48.field0; + CursorTy pvrtmp_6509 = tmp_struct_48.field1; + CursorTy pvrtmp_6510 = tmp_struct_48.field2; + CursorTy pvrtmp_6511 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6508, jump_4293, + pvrtmp_6510, pvrtmp_6511}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6518 = *(CursorTy *) tmpcur_6481; + CursorTy tmpaftercur_6519 = tmpcur_6481 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2942, end_r_2943, loc_2941, tmpcur_6518); + CursorTy pvrtmp_6520 = tmp_struct_49.field0; + CursorTy pvrtmp_6521 = tmp_struct_49.field1; + CursorTy pvrtmp_6522 = tmp_struct_49.field2; + CursorTy pvrtmp_6523 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6520, pvrtmp_6521, + pvrtmp_6522, pvrtmp_6523}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6480"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2946, + CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_652_1257_1580) +{ + TagTyPacked tmpval_6531 = *(TagTyPacked *) arg_652_1257_1580; + CursorTy tmpcur_6532 = arg_652_1257_1580 + 1; + + + switch_6581: + ; + switch (tmpval_6531) { + + case 0: + { + CursorTy loc_3135 = loc_2945 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2946, end_r_2947, loc_3135, tmpcur_6532); + CursorTy pvrtmp_6533 = tmp_struct_53.field0; + CursorTy pvrtmp_6534 = tmp_struct_53.field1; + CursorTy pvrtmp_6535 = tmp_struct_53.field2; + CursorTy pvrtmp_6536 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2945 = 0; + + CursorTy writetag_4647 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6533, pvrtmp_6534, + loc_2945, pvrtmp_6536}; + break; + } + + case 1: + { + CursorTy loc_3141 = loc_2945 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2946, end_r_2947, loc_3141, tmpcur_6532); + CursorTy pvrtmp_6545 = tmp_struct_54.field0; + CursorTy pvrtmp_6546 = tmp_struct_54.field1; + CursorTy pvrtmp_6547 = tmp_struct_54.field2; + CursorTy pvrtmp_6548 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2945 = 1; + + CursorTy writetag_4652 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6545, pvrtmp_6546, + loc_2945, pvrtmp_6548}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6557 = *(CursorTy *) tmpcur_6532; + CursorTy tmpaftercur_6558 = tmpcur_6532 + 8; + CursorTy jump_4299 = tmpcur_6532 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2946, end_r_2947, loc_2945, tmpcur_6557); + CursorTy pvrtmp_6559 = tmp_struct_55.field0; + CursorTy pvrtmp_6560 = tmp_struct_55.field1; + CursorTy pvrtmp_6561 = tmp_struct_55.field2; + CursorTy pvrtmp_6562 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6559, jump_4299, + pvrtmp_6561, pvrtmp_6562}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6569 = *(CursorTy *) tmpcur_6532; + CursorTy tmpaftercur_6570 = tmpcur_6532 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2946, end_r_2947, loc_2945, tmpcur_6569); + CursorTy pvrtmp_6571 = tmp_struct_56.field0; + CursorTy pvrtmp_6572 = tmp_struct_56.field1; + CursorTy pvrtmp_6573 = tmp_struct_56.field2; + CursorTy pvrtmp_6574 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6571, pvrtmp_6572, + pvrtmp_6573, pvrtmp_6574}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6531"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2949, CursorTy arg_657_1262_1585) +{ + TagTyPacked tmpval_6582 = *(TagTyPacked *) arg_657_1262_1585; + CursorTy tmpcur_6583 = arg_657_1262_1585 + 1; + + + switch_6592: + ; + switch (tmpval_6582) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2949, tmpcur_6583); + CursorTy pvrtmp_6584 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6584}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2949, tmpcur_6583); + CursorTy pvrtmp_6585 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6585}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6586 = *(CursorTy *) tmpcur_6583; + CursorTy tmpaftercur_6587 = tmpcur_6583 + 8; + CursorTy jump_4305 = tmpcur_6583 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2949, tmpcur_6586); + CursorTy pvrtmp_6588 = tmp_struct_59.field0; + + return (CursorProd) {jump_4305}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6589 = *(CursorTy *) tmpcur_6583; + CursorTy tmpaftercur_6590 = tmpcur_6583 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2949, tmpcur_6589); + CursorTy pvrtmp_6591 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6591}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6582"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2951, CursorTy arg_662_1267_1590) +{ + TagTyPacked tmpval_6593 = *(TagTyPacked *) arg_662_1267_1590; + CursorTy tmpcur_6594 = arg_662_1267_1590 + 1; + + + switch_6603: + ; + switch (tmpval_6593) { + + case 0: + { + unsigned char wildcard_665_1269_1592 = print_symbol(6152); + CursorProd tmp_struct_61 = _print_String(end_r_2951, tmpcur_6594); + CursorTy pvrtmp_6595 = tmp_struct_61.field0; + unsigned char wildcard_666_1271_1594 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6595}; + break; + } + + case 1: + { + unsigned char wildcard_669_1273_1596 = print_symbol(6146); + CursorProd tmp_struct_62 = _print_String(end_r_2951, tmpcur_6594); + CursorTy pvrtmp_6596 = tmp_struct_62.field0; + unsigned char wildcard_670_1275_1598 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6596}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6597 = *(CursorTy *) tmpcur_6594; + CursorTy tmpaftercur_6598 = tmpcur_6594 + 8; + CursorTy jump_4311 = tmpcur_6594 + 8; + unsigned char wildcard_4314 = print_symbol(6162); + CursorProd tmp_struct_63 = _print_Content(end_r_2951, tmpcur_6597); + CursorTy pvrtmp_6599 = tmp_struct_63.field0; + + return (CursorProd) {jump_4311}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6600 = *(CursorTy *) tmpcur_6594; + CursorTy tmpaftercur_6601 = tmpcur_6594 + 8; + unsigned char wildcard_4314 = print_symbol(6161); + CursorProd tmp_struct_64 = _print_Content(end_r_2951, tmpcur_6600); + CursorTy pvrtmp_6602 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6602}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6593"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2954, CursorTy end_r_2955, + CursorTy loc_2953, + CursorTy arg_671_1276_1599) +{ + if (loc_2953 + 32 > end_r_2955) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2955); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2955 = chunk_end_91; + *(TagTyPacked *) loc_2953 = 255; + + CursorTy redir = loc_2953 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2953 = chunk_start_90; + } + + CursorTy loc_3171 = loc_2953 + 1; + CursorTy loc_3172 = loc_3171 + 8; + CursorTy loc_3187 = loc_2953 + 1; + CursorTy loc_3188 = loc_3187 + 8; + CursorTy loc_3208 = loc_2953 + 1; + CursorTy loc_3209 = loc_3208 + 8; + CursorTy loc_3210 = loc_3209 + 8; + CursorTy loc_3234 = loc_2953 + 1; + CursorTy loc_3235 = loc_3234 + 8; + CursorTy loc_3236 = loc_3235 + 8; + CursorTy loc_3260 = loc_2953 + 1; + CursorTy loc_3261 = loc_3260 + 8; + CursorTy loc_3262 = loc_3261 + 8; + CursorTy loc_3286 = loc_2953 + 1; + CursorTy loc_3287 = loc_3286 + 8; + CursorTy loc_3288 = loc_3287 + 8; + CursorTy loc_3312 = loc_2953 + 1; + CursorTy loc_3313 = loc_3312 + 8; + CursorTy loc_3314 = loc_3313 + 8; + CursorTy loc_3338 = loc_2953 + 1; + CursorTy loc_3339 = loc_3338 + 8; + CursorTy loc_3340 = loc_3339 + 8; + TagTyPacked tmpval_6604 = *(TagTyPacked *) arg_671_1276_1599; + CursorTy tmpcur_6605 = arg_671_1276_1599 + 1; + + + switch_6870: + ; + switch (tmpval_6604) { + + case 0: + { + CursorTy jump_4000 = arg_671_1276_1599 + 1; + + *(TagTyPacked *) loc_2953 = 0; + + CursorTy writetag_4682 = loc_2953 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2955, jump_4000, + loc_2953, writetag_4682}; + break; + } + + case 9: + { + CursorTy tmpcur_6610 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6611 = tmpcur_6605 + 8; + CursorTy jump_4002 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2954, end_r_2955, loc_3172, tmpaftercur_6611); + CursorTy pvrtmp_6612 = tmp_struct_65.field0; + CursorTy pvrtmp_6613 = tmp_struct_65.field1; + CursorTy pvrtmp_6614 = tmp_struct_65.field2; + CursorTy pvrtmp_6615 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2954, pvrtmp_6612, pvrtmp_6615, tmpcur_6610); + CursorTy pvrtmp_6620 = tmp_struct_66.field0; + CursorTy pvrtmp_6621 = tmp_struct_66.field1; + CursorTy pvrtmp_6622 = tmp_struct_66.field2; + CursorTy pvrtmp_6623 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2953 = 9; + + CursorTy writetag_4688 = loc_2953 + 1; + + *(CursorTy *) writetag_4688 = pvrtmp_6615; + + CursorTy writecur_4689 = writetag_4688 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6620, pvrtmp_6621, + loc_2953, pvrtmp_6623}; + break; + } + + case 11: + { + CursorTy tmpcur_6632 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6633 = tmpcur_6605 + 8; + CursorTy jump_4006 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2954, end_r_2955, loc_3188, tmpaftercur_6633); + CursorTy pvrtmp_6634 = tmp_struct_67.field0; + CursorTy pvrtmp_6635 = tmp_struct_67.field1; + CursorTy pvrtmp_6636 = tmp_struct_67.field2; + CursorTy pvrtmp_6637 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2954, pvrtmp_6634, pvrtmp_6637, tmpcur_6632); + CursorTy pvrtmp_6642 = tmp_struct_68.field0; + CursorTy pvrtmp_6643 = tmp_struct_68.field1; + CursorTy pvrtmp_6644 = tmp_struct_68.field2; + CursorTy pvrtmp_6645 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2953 = 11; + + CursorTy writetag_4697 = loc_2953 + 1; + + *(CursorTy *) writetag_4697 = pvrtmp_6637; + + CursorTy writecur_4698 = writetag_4697 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6642, pvrtmp_6643, + loc_2953, pvrtmp_6645}; + break; + } + + case 13: + { + CursorTy tmpcur_6654 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6655 = tmpcur_6605 + 8; + CursorTy tmpcur_6656 = *(CursorTy *) tmpaftercur_6655; + CursorTy tmpaftercur_6657 = tmpaftercur_6655 + 8; + CursorTy jump_4011 = tmpaftercur_6655 + 8; + CursorTy jump_4010 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2954, end_r_2955, loc_3210, tmpaftercur_6657); + CursorTy pvrtmp_6658 = tmp_struct_69.field0; + CursorTy pvrtmp_6659 = tmp_struct_69.field1; + CursorTy pvrtmp_6660 = tmp_struct_69.field2; + CursorTy pvrtmp_6661 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2954, pvrtmp_6658, pvrtmp_6661, tmpcur_6654); + CursorTy pvrtmp_6666 = tmp_struct_70.field0; + CursorTy pvrtmp_6667 = tmp_struct_70.field1; + CursorTy pvrtmp_6668 = tmp_struct_70.field2; + CursorTy pvrtmp_6669 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2954, pvrtmp_6666, pvrtmp_6669, tmpcur_6656); + CursorTy pvrtmp_6674 = tmp_struct_71.field0; + CursorTy pvrtmp_6675 = tmp_struct_71.field1; + CursorTy pvrtmp_6676 = tmp_struct_71.field2; + CursorTy pvrtmp_6677 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2953 = 13; + + CursorTy writetag_4708 = loc_2953 + 1; + + *(CursorTy *) writetag_4708 = pvrtmp_6661; + + CursorTy writecur_4709 = writetag_4708 + 8; + + *(CursorTy *) writecur_4709 = pvrtmp_6669; + + CursorTy writecur_4710 = writecur_4709 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6674, pvrtmp_6675, + loc_2953, pvrtmp_6677}; + break; + } + + case 15: + { + CursorTy tmpcur_6686 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6687 = tmpcur_6605 + 8; + CursorTy tmpcur_6688 = *(CursorTy *) tmpaftercur_6687; + CursorTy tmpaftercur_6689 = tmpaftercur_6687 + 8; + CursorTy jump_4017 = tmpaftercur_6687 + 8; + CursorTy jump_4016 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2954, end_r_2955, loc_3236, tmpaftercur_6689); + CursorTy pvrtmp_6690 = tmp_struct_72.field0; + CursorTy pvrtmp_6691 = tmp_struct_72.field1; + CursorTy pvrtmp_6692 = tmp_struct_72.field2; + CursorTy pvrtmp_6693 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2954, pvrtmp_6690, pvrtmp_6693, tmpcur_6686); + CursorTy pvrtmp_6698 = tmp_struct_73.field0; + CursorTy pvrtmp_6699 = tmp_struct_73.field1; + CursorTy pvrtmp_6700 = tmp_struct_73.field2; + CursorTy pvrtmp_6701 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2954, pvrtmp_6698, pvrtmp_6701, tmpcur_6688); + CursorTy pvrtmp_6706 = tmp_struct_74.field0; + CursorTy pvrtmp_6707 = tmp_struct_74.field1; + CursorTy pvrtmp_6708 = tmp_struct_74.field2; + CursorTy pvrtmp_6709 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2953 = 15; + + CursorTy writetag_4721 = loc_2953 + 1; + + *(CursorTy *) writetag_4721 = pvrtmp_6693; + + CursorTy writecur_4722 = writetag_4721 + 8; + + *(CursorTy *) writecur_4722 = pvrtmp_6701; + + CursorTy writecur_4723 = writecur_4722 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6706, pvrtmp_6707, + loc_2953, pvrtmp_6709}; + break; + } + + case 17: + { + CursorTy tmpcur_6718 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6719 = tmpcur_6605 + 8; + CursorTy tmpcur_6720 = *(CursorTy *) tmpaftercur_6719; + CursorTy tmpaftercur_6721 = tmpaftercur_6719 + 8; + CursorTy jump_4023 = tmpaftercur_6719 + 8; + CursorTy jump_4022 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2954, end_r_2955, loc_3262, tmpaftercur_6721); + CursorTy pvrtmp_6722 = tmp_struct_75.field0; + CursorTy pvrtmp_6723 = tmp_struct_75.field1; + CursorTy pvrtmp_6724 = tmp_struct_75.field2; + CursorTy pvrtmp_6725 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2954, pvrtmp_6722, pvrtmp_6725, tmpcur_6718); + CursorTy pvrtmp_6730 = tmp_struct_76.field0; + CursorTy pvrtmp_6731 = tmp_struct_76.field1; + CursorTy pvrtmp_6732 = tmp_struct_76.field2; + CursorTy pvrtmp_6733 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2954, pvrtmp_6730, pvrtmp_6733, tmpcur_6720); + CursorTy pvrtmp_6738 = tmp_struct_77.field0; + CursorTy pvrtmp_6739 = tmp_struct_77.field1; + CursorTy pvrtmp_6740 = tmp_struct_77.field2; + CursorTy pvrtmp_6741 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2953 = 17; + + CursorTy writetag_4734 = loc_2953 + 1; + + *(CursorTy *) writetag_4734 = pvrtmp_6725; + + CursorTy writecur_4735 = writetag_4734 + 8; + + *(CursorTy *) writecur_4735 = pvrtmp_6733; + + CursorTy writecur_4736 = writecur_4735 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6738, pvrtmp_6739, + loc_2953, pvrtmp_6741}; + break; + } + + case 19: + { + CursorTy tmpcur_6750 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6751 = tmpcur_6605 + 8; + CursorTy tmpcur_6752 = *(CursorTy *) tmpaftercur_6751; + CursorTy tmpaftercur_6753 = tmpaftercur_6751 + 8; + CursorTy jump_4029 = tmpaftercur_6751 + 8; + CursorTy jump_4028 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2954, end_r_2955, loc_3288, tmpaftercur_6753); + CursorTy pvrtmp_6754 = tmp_struct_78.field0; + CursorTy pvrtmp_6755 = tmp_struct_78.field1; + CursorTy pvrtmp_6756 = tmp_struct_78.field2; + CursorTy pvrtmp_6757 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2954, pvrtmp_6754, pvrtmp_6757, tmpcur_6750); + CursorTy pvrtmp_6762 = tmp_struct_79.field0; + CursorTy pvrtmp_6763 = tmp_struct_79.field1; + CursorTy pvrtmp_6764 = tmp_struct_79.field2; + CursorTy pvrtmp_6765 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2954, pvrtmp_6762, pvrtmp_6765, tmpcur_6752); + CursorTy pvrtmp_6770 = tmp_struct_80.field0; + CursorTy pvrtmp_6771 = tmp_struct_80.field1; + CursorTy pvrtmp_6772 = tmp_struct_80.field2; + CursorTy pvrtmp_6773 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2953 = 19; + + CursorTy writetag_4747 = loc_2953 + 1; + + *(CursorTy *) writetag_4747 = pvrtmp_6757; + + CursorTy writecur_4748 = writetag_4747 + 8; + + *(CursorTy *) writecur_4748 = pvrtmp_6765; + + CursorTy writecur_4749 = writecur_4748 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6770, pvrtmp_6771, + loc_2953, pvrtmp_6773}; + break; + } + + case 21: + { + CursorTy tmpcur_6782 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6783 = tmpcur_6605 + 8; + CursorTy tmpcur_6784 = *(CursorTy *) tmpaftercur_6783; + CursorTy tmpaftercur_6785 = tmpaftercur_6783 + 8; + CursorTy jump_4035 = tmpaftercur_6783 + 8; + CursorTy jump_4034 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2954, end_r_2955, loc_3314, tmpaftercur_6785); + CursorTy pvrtmp_6786 = tmp_struct_81.field0; + CursorTy pvrtmp_6787 = tmp_struct_81.field1; + CursorTy pvrtmp_6788 = tmp_struct_81.field2; + CursorTy pvrtmp_6789 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2954, pvrtmp_6786, pvrtmp_6789, tmpcur_6782); + CursorTy pvrtmp_6794 = tmp_struct_82.field0; + CursorTy pvrtmp_6795 = tmp_struct_82.field1; + CursorTy pvrtmp_6796 = tmp_struct_82.field2; + CursorTy pvrtmp_6797 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2954, pvrtmp_6794, pvrtmp_6797, tmpcur_6784); + CursorTy pvrtmp_6802 = tmp_struct_83.field0; + CursorTy pvrtmp_6803 = tmp_struct_83.field1; + CursorTy pvrtmp_6804 = tmp_struct_83.field2; + CursorTy pvrtmp_6805 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2953 = 21; + + CursorTy writetag_4760 = loc_2953 + 1; + + *(CursorTy *) writetag_4760 = pvrtmp_6789; + + CursorTy writecur_4761 = writetag_4760 + 8; + + *(CursorTy *) writecur_4761 = pvrtmp_6797; + + CursorTy writecur_4762 = writecur_4761 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6802, pvrtmp_6803, + loc_2953, pvrtmp_6805}; + break; + } + + case 23: + { + CursorTy tmpcur_6814 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6815 = tmpcur_6605 + 8; + CursorTy tmpcur_6816 = *(CursorTy *) tmpaftercur_6815; + CursorTy tmpaftercur_6817 = tmpaftercur_6815 + 8; + CursorTy jump_4041 = tmpaftercur_6815 + 8; + CursorTy jump_4040 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2954, end_r_2955, loc_3340, tmpaftercur_6817); + CursorTy pvrtmp_6818 = tmp_struct_84.field0; + CursorTy pvrtmp_6819 = tmp_struct_84.field1; + CursorTy pvrtmp_6820 = tmp_struct_84.field2; + CursorTy pvrtmp_6821 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2954, pvrtmp_6818, pvrtmp_6821, tmpcur_6814); + CursorTy pvrtmp_6826 = tmp_struct_85.field0; + CursorTy pvrtmp_6827 = tmp_struct_85.field1; + CursorTy pvrtmp_6828 = tmp_struct_85.field2; + CursorTy pvrtmp_6829 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2954, pvrtmp_6826, pvrtmp_6829, tmpcur_6816); + CursorTy pvrtmp_6834 = tmp_struct_86.field0; + CursorTy pvrtmp_6835 = tmp_struct_86.field1; + CursorTy pvrtmp_6836 = tmp_struct_86.field2; + CursorTy pvrtmp_6837 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2953 = 23; + + CursorTy writetag_4773 = loc_2953 + 1; + + *(CursorTy *) writetag_4773 = pvrtmp_6821; + + CursorTy writecur_4774 = writetag_4773 + 8; + + *(CursorTy *) writecur_4774 = pvrtmp_6829; + + CursorTy writecur_4775 = writecur_4774 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6834, pvrtmp_6835, + loc_2953, pvrtmp_6837}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6846 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6847 = tmpcur_6605 + 8; + CursorTy jump_4317 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2954, end_r_2955, loc_2953, tmpcur_6846); + CursorTy pvrtmp_6848 = tmp_struct_87.field0; + CursorTy pvrtmp_6849 = tmp_struct_87.field1; + CursorTy pvrtmp_6850 = tmp_struct_87.field2; + CursorTy pvrtmp_6851 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6848, jump_4317, + pvrtmp_6850, pvrtmp_6851}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6858 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6859 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2954, end_r_2955, loc_2953, tmpcur_6858); + CursorTy pvrtmp_6860 = tmp_struct_88.field0; + CursorTy pvrtmp_6861 = tmp_struct_88.field1; + CursorTy pvrtmp_6862 = tmp_struct_88.field2; + CursorTy pvrtmp_6863 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6860, pvrtmp_6861, + pvrtmp_6862, pvrtmp_6863}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6604"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2958, + CursorTy end_r_2959, + CursorTy loc_2957, + CursorTy arg_716_1321_1644) +{ + TagTyPacked tmpval_6871 = *(TagTyPacked *) arg_716_1321_1644; + CursorTy tmpcur_6872 = arg_716_1321_1644 + 1; + + + switch_7137: + ; + switch (tmpval_6871) { + + case 0: + { + CursorTy jump_4046 = arg_716_1321_1644 + 1; + + *(TagTyPacked *) loc_2957 = 0; + + CursorTy writetag_4787 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2959, jump_4046, + loc_2957, writetag_4787}; + break; + } + + case 9: + { + CursorTy tmpcur_6877 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6878 = tmpcur_6872 + 8; + CursorTy jump_4048 = tmpcur_6872 + 8; + CursorTy loc_3362 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3362, tmpaftercur_6878); + CursorTy pvrtmp_6879 = tmp_struct_92.field0; + CursorTy pvrtmp_6880 = tmp_struct_92.field1; + CursorTy pvrtmp_6881 = tmp_struct_92.field2; + CursorTy pvrtmp_6882 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6879, pvrtmp_6882, tmpcur_6877); + CursorTy pvrtmp_6887 = tmp_struct_93.field0; + CursorTy pvrtmp_6888 = tmp_struct_93.field1; + CursorTy pvrtmp_6889 = tmp_struct_93.field2; + CursorTy pvrtmp_6890 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2957 = 1; + + CursorTy writetag_4793 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6887, pvrtmp_6888, + loc_2957, pvrtmp_6890}; + break; + } + + case 11: + { + CursorTy tmpcur_6899 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6900 = tmpcur_6872 + 8; + CursorTy jump_4052 = tmpcur_6872 + 8; + CursorTy loc_3375 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3375, tmpaftercur_6900); + CursorTy pvrtmp_6901 = tmp_struct_94.field0; + CursorTy pvrtmp_6902 = tmp_struct_94.field1; + CursorTy pvrtmp_6903 = tmp_struct_94.field2; + CursorTy pvrtmp_6904 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6901, pvrtmp_6904, tmpcur_6899); + CursorTy pvrtmp_6909 = tmp_struct_95.field0; + CursorTy pvrtmp_6910 = tmp_struct_95.field1; + CursorTy pvrtmp_6911 = tmp_struct_95.field2; + CursorTy pvrtmp_6912 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2957 = 2; + + CursorTy writetag_4801 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6909, pvrtmp_6910, + loc_2957, pvrtmp_6912}; + break; + } + + case 13: + { + CursorTy tmpcur_6921 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6922 = tmpcur_6872 + 8; + CursorTy tmpcur_6923 = *(CursorTy *) tmpaftercur_6922; + CursorTy tmpaftercur_6924 = tmpaftercur_6922 + 8; + CursorTy jump_4057 = tmpaftercur_6922 + 8; + CursorTy jump_4056 = tmpcur_6872 + 8; + CursorTy loc_3393 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2958, end_r_2959, loc_3393, tmpaftercur_6924); + CursorTy pvrtmp_6925 = tmp_struct_96.field0; + CursorTy pvrtmp_6926 = tmp_struct_96.field1; + CursorTy pvrtmp_6927 = tmp_struct_96.field2; + CursorTy pvrtmp_6928 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6925, pvrtmp_6928, tmpcur_6921); + CursorTy pvrtmp_6933 = tmp_struct_97.field0; + CursorTy pvrtmp_6934 = tmp_struct_97.field1; + CursorTy pvrtmp_6935 = tmp_struct_97.field2; + CursorTy pvrtmp_6936 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6933, pvrtmp_6936, tmpcur_6923); + CursorTy pvrtmp_6941 = tmp_struct_98.field0; + CursorTy pvrtmp_6942 = tmp_struct_98.field1; + CursorTy pvrtmp_6943 = tmp_struct_98.field2; + CursorTy pvrtmp_6944 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2957 = 3; + + CursorTy writetag_4811 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6941, pvrtmp_6942, + loc_2957, pvrtmp_6944}; + break; + } + + case 15: + { + CursorTy tmpcur_6953 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6954 = tmpcur_6872 + 8; + CursorTy tmpcur_6955 = *(CursorTy *) tmpaftercur_6954; + CursorTy tmpaftercur_6956 = tmpaftercur_6954 + 8; + CursorTy jump_4063 = tmpaftercur_6954 + 8; + CursorTy jump_4062 = tmpcur_6872 + 8; + CursorTy loc_3413 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3413, tmpaftercur_6956); + CursorTy pvrtmp_6957 = tmp_struct_99.field0; + CursorTy pvrtmp_6958 = tmp_struct_99.field1; + CursorTy pvrtmp_6959 = tmp_struct_99.field2; + CursorTy pvrtmp_6960 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6957, pvrtmp_6960, tmpcur_6953); + CursorTy pvrtmp_6965 = tmp_struct_100.field0; + CursorTy pvrtmp_6966 = tmp_struct_100.field1; + CursorTy pvrtmp_6967 = tmp_struct_100.field2; + CursorTy pvrtmp_6968 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_6965, pvrtmp_6968, tmpcur_6955); + CursorTy pvrtmp_6973 = tmp_struct_101.field0; + CursorTy pvrtmp_6974 = tmp_struct_101.field1; + CursorTy pvrtmp_6975 = tmp_struct_101.field2; + CursorTy pvrtmp_6976 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2957 = 4; + + CursorTy writetag_4822 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6973, pvrtmp_6974, + loc_2957, pvrtmp_6976}; + break; + } + + case 17: + { + CursorTy tmpcur_6985 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6986 = tmpcur_6872 + 8; + CursorTy tmpcur_6987 = *(CursorTy *) tmpaftercur_6986; + CursorTy tmpaftercur_6988 = tmpaftercur_6986 + 8; + CursorTy jump_4069 = tmpaftercur_6986 + 8; + CursorTy jump_4068 = tmpcur_6872 + 8; + CursorTy loc_3433 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2958, end_r_2959, loc_3433, tmpaftercur_6988); + CursorTy pvrtmp_6989 = tmp_struct_102.field0; + CursorTy pvrtmp_6990 = tmp_struct_102.field1; + CursorTy pvrtmp_6991 = tmp_struct_102.field2; + CursorTy pvrtmp_6992 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6989, pvrtmp_6992, tmpcur_6985); + CursorTy pvrtmp_6997 = tmp_struct_103.field0; + CursorTy pvrtmp_6998 = tmp_struct_103.field1; + CursorTy pvrtmp_6999 = tmp_struct_103.field2; + CursorTy pvrtmp_7000 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6997, pvrtmp_7000, tmpcur_6987); + CursorTy pvrtmp_7005 = tmp_struct_104.field0; + CursorTy pvrtmp_7006 = tmp_struct_104.field1; + CursorTy pvrtmp_7007 = tmp_struct_104.field2; + CursorTy pvrtmp_7008 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2957 = 5; + + CursorTy writetag_4833 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7005, pvrtmp_7006, + loc_2957, pvrtmp_7008}; + break; + } + + case 19: + { + CursorTy tmpcur_7017 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7018 = tmpcur_6872 + 8; + CursorTy tmpcur_7019 = *(CursorTy *) tmpaftercur_7018; + CursorTy tmpaftercur_7020 = tmpaftercur_7018 + 8; + CursorTy jump_4075 = tmpaftercur_7018 + 8; + CursorTy jump_4074 = tmpcur_6872 + 8; + CursorTy loc_3453 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3453, tmpaftercur_7020); + CursorTy pvrtmp_7021 = tmp_struct_105.field0; + CursorTy pvrtmp_7022 = tmp_struct_105.field1; + CursorTy pvrtmp_7023 = tmp_struct_105.field2; + CursorTy pvrtmp_7024 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7021, pvrtmp_7024, tmpcur_7017); + CursorTy pvrtmp_7029 = tmp_struct_106.field0; + CursorTy pvrtmp_7030 = tmp_struct_106.field1; + CursorTy pvrtmp_7031 = tmp_struct_106.field2; + CursorTy pvrtmp_7032 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_7029, pvrtmp_7032, tmpcur_7019); + CursorTy pvrtmp_7037 = tmp_struct_107.field0; + CursorTy pvrtmp_7038 = tmp_struct_107.field1; + CursorTy pvrtmp_7039 = tmp_struct_107.field2; + CursorTy pvrtmp_7040 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2957 = 6; + + CursorTy writetag_4844 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7037, pvrtmp_7038, + loc_2957, pvrtmp_7040}; + break; + } + + case 21: + { + CursorTy tmpcur_7049 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7050 = tmpcur_6872 + 8; + CursorTy tmpcur_7051 = *(CursorTy *) tmpaftercur_7050; + CursorTy tmpaftercur_7052 = tmpaftercur_7050 + 8; + CursorTy jump_4081 = tmpaftercur_7050 + 8; + CursorTy jump_4080 = tmpcur_6872 + 8; + CursorTy loc_3473 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3473, tmpaftercur_7052); + CursorTy pvrtmp_7053 = tmp_struct_108.field0; + CursorTy pvrtmp_7054 = tmp_struct_108.field1; + CursorTy pvrtmp_7055 = tmp_struct_108.field2; + CursorTy pvrtmp_7056 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7053, pvrtmp_7056, tmpcur_7049); + CursorTy pvrtmp_7061 = tmp_struct_109.field0; + CursorTy pvrtmp_7062 = tmp_struct_109.field1; + CursorTy pvrtmp_7063 = tmp_struct_109.field2; + CursorTy pvrtmp_7064 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_7061, pvrtmp_7064, tmpcur_7051); + CursorTy pvrtmp_7069 = tmp_struct_110.field0; + CursorTy pvrtmp_7070 = tmp_struct_110.field1; + CursorTy pvrtmp_7071 = tmp_struct_110.field2; + CursorTy pvrtmp_7072 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2957 = 7; + + CursorTy writetag_4855 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7069, pvrtmp_7070, + loc_2957, pvrtmp_7072}; + break; + } + + case 23: + { + CursorTy tmpcur_7081 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7082 = tmpcur_6872 + 8; + CursorTy tmpcur_7083 = *(CursorTy *) tmpaftercur_7082; + CursorTy tmpaftercur_7084 = tmpaftercur_7082 + 8; + CursorTy jump_4087 = tmpaftercur_7082 + 8; + CursorTy jump_4086 = tmpcur_6872 + 8; + CursorTy loc_3493 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3493, tmpaftercur_7084); + CursorTy pvrtmp_7085 = tmp_struct_111.field0; + CursorTy pvrtmp_7086 = tmp_struct_111.field1; + CursorTy pvrtmp_7087 = tmp_struct_111.field2; + CursorTy pvrtmp_7088 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_7085, pvrtmp_7088, tmpcur_7081); + CursorTy pvrtmp_7093 = tmp_struct_112.field0; + CursorTy pvrtmp_7094 = tmp_struct_112.field1; + CursorTy pvrtmp_7095 = tmp_struct_112.field2; + CursorTy pvrtmp_7096 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7093, pvrtmp_7096, tmpcur_7083); + CursorTy pvrtmp_7101 = tmp_struct_113.field0; + CursorTy pvrtmp_7102 = tmp_struct_113.field1; + CursorTy pvrtmp_7103 = tmp_struct_113.field2; + CursorTy pvrtmp_7104 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2957 = 8; + + CursorTy writetag_4866 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7101, pvrtmp_7102, + loc_2957, pvrtmp_7104}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7113 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7114 = tmpcur_6872 + 8; + CursorTy jump_4323 = tmpcur_6872 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_2957, tmpcur_7113); + CursorTy pvrtmp_7115 = tmp_struct_114.field0; + CursorTy pvrtmp_7116 = tmp_struct_114.field1; + CursorTy pvrtmp_7117 = tmp_struct_114.field2; + CursorTy pvrtmp_7118 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7115, jump_4323, + pvrtmp_7117, pvrtmp_7118}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7125 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7126 = tmpcur_6872 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_2957, tmpcur_7125); + CursorTy pvrtmp_7127 = tmp_struct_115.field0; + CursorTy pvrtmp_7128 = tmp_struct_115.field1; + CursorTy pvrtmp_7129 = tmp_struct_115.field2; + CursorTy pvrtmp_7130 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7127, pvrtmp_7128, + pvrtmp_7129, pvrtmp_7130}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6871"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2961, CursorTy arg_761_1366_1689) +{ + TagTyPacked tmpval_7138 = *(TagTyPacked *) arg_761_1366_1689; + CursorTy tmpcur_7139 = arg_761_1366_1689 + 1; + + + switch_7196: + ; + switch (tmpval_7138) { + + case 0: + { + CursorTy jump_4092 = arg_761_1366_1689 + 1; + + return (CursorProd) {jump_4092}; + break; + } + + case 9: + { + CursorTy tmpcur_7140 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7141 = tmpcur_7139 + 8; + CursorTy jump_4094 = tmpcur_7139 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2961, tmpaftercur_7141); + CursorTy pvrtmp_7142 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2961, tmpcur_7140); + CursorTy pvrtmp_7143 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7143}; + break; + } + + case 11: + { + CursorTy tmpcur_7144 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7145 = tmpcur_7139 + 8; + CursorTy jump_4098 = tmpcur_7139 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2961, tmpaftercur_7145); + CursorTy pvrtmp_7146 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2961, tmpcur_7144); + CursorTy pvrtmp_7147 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7147}; + break; + } + + case 13: + { + CursorTy tmpcur_7148 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7149 = tmpcur_7139 + 8; + CursorTy tmpcur_7150 = *(CursorTy *) tmpaftercur_7149; + CursorTy tmpaftercur_7151 = tmpaftercur_7149 + 8; + CursorTy jump_4103 = tmpaftercur_7149 + 8; + CursorTy jump_4102 = tmpcur_7139 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2961, tmpaftercur_7151); + CursorTy pvrtmp_7152 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2961, tmpcur_7148); + CursorTy pvrtmp_7153 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2961, tmpcur_7150); + CursorTy pvrtmp_7154 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7154}; + break; + } + + case 15: + { + CursorTy tmpcur_7155 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7156 = tmpcur_7139 + 8; + CursorTy tmpcur_7157 = *(CursorTy *) tmpaftercur_7156; + CursorTy tmpaftercur_7158 = tmpaftercur_7156 + 8; + CursorTy jump_4109 = tmpaftercur_7156 + 8; + CursorTy jump_4108 = tmpcur_7139 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2961, tmpaftercur_7158); + CursorTy pvrtmp_7159 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2961, tmpcur_7155); + CursorTy pvrtmp_7160 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2961, tmpcur_7157); + CursorTy pvrtmp_7161 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7161}; + break; + } + + case 17: + { + CursorTy tmpcur_7162 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7163 = tmpcur_7139 + 8; + CursorTy tmpcur_7164 = *(CursorTy *) tmpaftercur_7163; + CursorTy tmpaftercur_7165 = tmpaftercur_7163 + 8; + CursorTy jump_4115 = tmpaftercur_7163 + 8; + CursorTy jump_4114 = tmpcur_7139 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2961, tmpaftercur_7165); + CursorTy pvrtmp_7166 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2961, tmpcur_7162); + CursorTy pvrtmp_7167 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2961, tmpcur_7164); + CursorTy pvrtmp_7168 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7168}; + break; + } + + case 19: + { + CursorTy tmpcur_7169 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7170 = tmpcur_7139 + 8; + CursorTy tmpcur_7171 = *(CursorTy *) tmpaftercur_7170; + CursorTy tmpaftercur_7172 = tmpaftercur_7170 + 8; + CursorTy jump_4121 = tmpaftercur_7170 + 8; + CursorTy jump_4120 = tmpcur_7139 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2961, tmpaftercur_7172); + CursorTy pvrtmp_7173 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2961, tmpcur_7169); + CursorTy pvrtmp_7174 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2961, tmpcur_7171); + CursorTy pvrtmp_7175 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7175}; + break; + } + + case 21: + { + CursorTy tmpcur_7176 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7177 = tmpcur_7139 + 8; + CursorTy tmpcur_7178 = *(CursorTy *) tmpaftercur_7177; + CursorTy tmpaftercur_7179 = tmpaftercur_7177 + 8; + CursorTy jump_4127 = tmpaftercur_7177 + 8; + CursorTy jump_4126 = tmpcur_7139 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2961, tmpaftercur_7179); + CursorTy pvrtmp_7180 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2961, tmpcur_7176); + CursorTy pvrtmp_7181 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2961, tmpcur_7178); + CursorTy pvrtmp_7182 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7182}; + break; + } + + case 23: + { + CursorTy tmpcur_7183 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7184 = tmpcur_7139 + 8; + CursorTy tmpcur_7185 = *(CursorTy *) tmpaftercur_7184; + CursorTy tmpaftercur_7186 = tmpaftercur_7184 + 8; + CursorTy jump_4133 = tmpaftercur_7184 + 8; + CursorTy jump_4132 = tmpcur_7139 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2961, tmpaftercur_7186); + CursorTy pvrtmp_7187 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2961, tmpcur_7183); + CursorTy pvrtmp_7188 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2961, tmpcur_7185); + CursorTy pvrtmp_7189 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7189}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7190 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7191 = tmpcur_7139 + 8; + CursorTy jump_4329 = tmpcur_7139 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2961, tmpcur_7190); + CursorTy pvrtmp_7192 = tmp_struct_138.field0; + + return (CursorProd) {jump_4329}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7193 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7194 = tmpcur_7139 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2961, tmpcur_7193); + CursorTy pvrtmp_7195 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7195}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7138"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2963, CursorTy arg_806_1411_1734) +{ + TagTyPacked tmpval_7197 = *(TagTyPacked *) arg_806_1411_1734; + CursorTy tmpcur_7198 = arg_806_1411_1734 + 1; + + + switch_7255: + ; + switch (tmpval_7197) { + + case 0: + { + CursorTy jump_4138 = arg_806_1411_1734 + 1; + unsigned char wildcard_807_1412_1735 = print_symbol(6151); + unsigned char wildcard_808_1413_1736 = print_symbol(6145); + + return (CursorProd) {jump_4138}; + break; + } + + case 9: + { + CursorTy tmpcur_7199 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7200 = tmpcur_7198 + 8; + CursorTy jump_4140 = tmpcur_7198 + 8; + unsigned char wildcard_813_1416_1739 = print_symbol(6157); + CursorProd tmp_struct_140 = + _print_Content(end_r_2963, tmpaftercur_7200); + CursorTy pvrtmp_7201 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2963, tmpcur_7199); + CursorTy pvrtmp_7202 = tmp_struct_141.field0; + unsigned char wildcard_814_1419_1742 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7202}; + break; + } + + case 11: + { + CursorTy tmpcur_7203 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7204 = tmpcur_7198 + 8; + CursorTy jump_4144 = tmpcur_7198 + 8; + unsigned char wildcard_819_1422_1745 = print_symbol(6160); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2963, tmpaftercur_7204); + CursorTy pvrtmp_7205 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2963, tmpcur_7203); + CursorTy pvrtmp_7206 = tmp_struct_143.field0; + unsigned char wildcard_820_1425_1748 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7206}; + break; + } + + case 13: + { + CursorTy tmpcur_7207 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7208 = tmpcur_7198 + 8; + CursorTy tmpcur_7209 = *(CursorTy *) tmpaftercur_7208; + CursorTy tmpaftercur_7210 = tmpaftercur_7208 + 8; + CursorTy jump_4149 = tmpaftercur_7208 + 8; + CursorTy jump_4148 = tmpcur_7198 + 8; + unsigned char wildcard_827_1429_1752 = print_symbol(6148); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2963, tmpaftercur_7210); + CursorTy pvrtmp_7211 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2963, tmpcur_7207); + CursorTy pvrtmp_7212 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2963, tmpcur_7209); + CursorTy pvrtmp_7213 = tmp_struct_146.field0; + unsigned char wildcard_828_1433_1756 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7213}; + break; + } + + case 15: + { + CursorTy tmpcur_7214 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7215 = tmpcur_7198 + 8; + CursorTy tmpcur_7216 = *(CursorTy *) tmpaftercur_7215; + CursorTy tmpaftercur_7217 = tmpaftercur_7215 + 8; + CursorTy jump_4155 = tmpaftercur_7215 + 8; + CursorTy jump_4154 = tmpcur_7198 + 8; + unsigned char wildcard_835_1437_1760 = print_symbol(6159); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2963, tmpaftercur_7217); + CursorTy pvrtmp_7218 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2963, tmpcur_7214); + CursorTy pvrtmp_7219 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2963, tmpcur_7216); + CursorTy pvrtmp_7220 = tmp_struct_149.field0; + unsigned char wildcard_836_1441_1764 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7220}; + break; + } + + case 17: + { + CursorTy tmpcur_7221 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7222 = tmpcur_7198 + 8; + CursorTy tmpcur_7223 = *(CursorTy *) tmpaftercur_7222; + CursorTy tmpaftercur_7224 = tmpaftercur_7222 + 8; + CursorTy jump_4161 = tmpaftercur_7222 + 8; + CursorTy jump_4160 = tmpcur_7198 + 8; + unsigned char wildcard_843_1445_1768 = print_symbol(6149); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2963, tmpaftercur_7224); + CursorTy pvrtmp_7225 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2963, tmpcur_7221); + CursorTy pvrtmp_7226 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2963, tmpcur_7223); + CursorTy pvrtmp_7227 = tmp_struct_152.field0; + unsigned char wildcard_844_1449_1772 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7227}; + break; + } + + case 19: + { + CursorTy tmpcur_7228 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7229 = tmpcur_7198 + 8; + CursorTy tmpcur_7230 = *(CursorTy *) tmpaftercur_7229; + CursorTy tmpaftercur_7231 = tmpaftercur_7229 + 8; + CursorTy jump_4167 = tmpaftercur_7229 + 8; + CursorTy jump_4166 = tmpcur_7198 + 8; + unsigned char wildcard_851_1453_1776 = print_symbol(6158); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2963, tmpaftercur_7231); + CursorTy pvrtmp_7232 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2963, tmpcur_7228); + CursorTy pvrtmp_7233 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2963, tmpcur_7230); + CursorTy pvrtmp_7234 = tmp_struct_155.field0; + unsigned char wildcard_852_1457_1780 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7234}; + break; + } + + case 21: + { + CursorTy tmpcur_7235 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7236 = tmpcur_7198 + 8; + CursorTy tmpcur_7237 = *(CursorTy *) tmpaftercur_7236; + CursorTy tmpaftercur_7238 = tmpaftercur_7236 + 8; + CursorTy jump_4173 = tmpaftercur_7236 + 8; + CursorTy jump_4172 = tmpcur_7198 + 8; + unsigned char wildcard_859_1461_1784 = print_symbol(6155); + CursorProd tmp_struct_156 = + _print_Content(end_r_2963, tmpaftercur_7238); + CursorTy pvrtmp_7239 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2963, tmpcur_7235); + CursorTy pvrtmp_7240 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2963, tmpcur_7237); + CursorTy pvrtmp_7241 = tmp_struct_158.field0; + unsigned char wildcard_860_1465_1788 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7241}; + break; + } + + case 23: + { + CursorTy tmpcur_7242 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7243 = tmpcur_7198 + 8; + CursorTy tmpcur_7244 = *(CursorTy *) tmpaftercur_7243; + CursorTy tmpaftercur_7245 = tmpaftercur_7243 + 8; + CursorTy jump_4179 = tmpaftercur_7243 + 8; + CursorTy jump_4178 = tmpcur_7198 + 8; + unsigned char wildcard_867_1469_1792 = print_symbol(6156); + CursorProd tmp_struct_159 = + _print_Content(end_r_2963, tmpaftercur_7245); + CursorTy pvrtmp_7246 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2963, tmpcur_7242); + CursorTy pvrtmp_7247 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2963, tmpcur_7244); + CursorTy pvrtmp_7248 = tmp_struct_161.field0; + unsigned char wildcard_868_1473_1796 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7248}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7249 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7250 = tmpcur_7198 + 8; + CursorTy jump_4335 = tmpcur_7198 + 8; + unsigned char wildcard_4338 = print_symbol(6162); + CursorProd tmp_struct_162 = _print_Adt(end_r_2963, tmpcur_7249); + CursorTy pvrtmp_7251 = tmp_struct_162.field0; + + return (CursorProd) {jump_4335}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7252 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7253 = tmpcur_7198 + 8; + unsigned char wildcard_4338 = print_symbol(6161); + CursorProd tmp_struct_163 = _print_Adt(end_r_2963, tmpcur_7252); + CursorTy pvrtmp_7254 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7254}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7197"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2966, + CursorTy end_r_2967, CursorTy loc_2965, + CursorTy arg_869_1474_1797) +{ + if (loc_2965 + 32 > end_r_2967) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2967); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2967 = chunk_end_169; + *(TagTyPacked *) loc_2965 = 255; + + CursorTy redir = loc_2965 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2965 = chunk_start_168; + } + + CursorTy loc_3671 = loc_2965 + 1; + CursorTy loc_3672 = loc_3671 + 8; + TagTyPacked tmpval_7256 = *(TagTyPacked *) arg_869_1474_1797; + CursorTy tmpcur_7257 = arg_869_1474_1797 + 1; + + + switch_7300: + ; + switch (tmpval_7256) { + + case 0: + { + CursorTy jump_4184 = arg_869_1474_1797 + 1; + + *(TagTyPacked *) loc_2965 = 0; + + CursorTy writetag_4980 = loc_2965 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2967, jump_4184, + loc_2965, writetag_4980}; + break; + } + + case 1: + { + IntTy tmpval_7262 = *(IntTy *) tmpcur_7257; + CursorTy tmpcur_7263 = tmpcur_7257 + sizeof(IntTy); + CursorTy jump_4186 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2966, end_r_2967, loc_3672, tmpcur_7263); + CursorTy pvrtmp_7264 = tmp_struct_164.field0; + CursorTy pvrtmp_7265 = tmp_struct_164.field1; + CursorTy pvrtmp_7266 = tmp_struct_164.field2; + CursorTy pvrtmp_7267 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2965 = 1; + + CursorTy writetag_4985 = loc_2965 + 1; + + *(IntTy *) writetag_4985 = tmpval_7262; + + CursorTy writecur_4986 = writetag_4985 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7264, pvrtmp_7265, + loc_2965, pvrtmp_7267}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7276 = *(CursorTy *) tmpcur_7257; + CursorTy tmpaftercur_7277 = tmpcur_7257 + 8; + CursorTy jump_4341 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2966, end_r_2967, loc_2965, tmpcur_7276); + CursorTy pvrtmp_7278 = tmp_struct_165.field0; + CursorTy pvrtmp_7279 = tmp_struct_165.field1; + CursorTy pvrtmp_7280 = tmp_struct_165.field2; + CursorTy pvrtmp_7281 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7278, jump_4341, + pvrtmp_7280, pvrtmp_7281}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7288 = *(CursorTy *) tmpcur_7257; + CursorTy tmpaftercur_7289 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2966, end_r_2967, loc_2965, tmpcur_7288); + CursorTy pvrtmp_7290 = tmp_struct_166.field0; + CursorTy pvrtmp_7291 = tmp_struct_166.field1; + CursorTy pvrtmp_7292 = tmp_struct_166.field2; + CursorTy pvrtmp_7293 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7290, pvrtmp_7291, + pvrtmp_7292, pvrtmp_7293}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7256"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_874_1479_1802) +{ + CursorTy loc_3684 = loc_2969 + 1; + CursorTy loc_3685 = loc_3684 + 8; + TagTyPacked tmpval_7301 = *(TagTyPacked *) arg_874_1479_1802; + CursorTy tmpcur_7302 = arg_874_1479_1802 + 1; + + + switch_7345: + ; + switch (tmpval_7301) { + + case 0: + { + CursorTy jump_4189 = arg_874_1479_1802 + 1; + + *(TagTyPacked *) loc_2969 = 0; + + CursorTy writetag_4996 = loc_2969 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2971, jump_4189, + loc_2969, writetag_4996}; + break; + } + + case 1: + { + IntTy tmpval_7307 = *(IntTy *) tmpcur_7302; + CursorTy tmpcur_7308 = tmpcur_7302 + sizeof(IntTy); + CursorTy jump_4191 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_3685, tmpcur_7308); + CursorTy pvrtmp_7309 = tmp_struct_170.field0; + CursorTy pvrtmp_7310 = tmp_struct_170.field1; + CursorTy pvrtmp_7311 = tmp_struct_170.field2; + CursorTy pvrtmp_7312 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2969 = 1; + + CursorTy writetag_5001 = loc_2969 + 1; + + *(IntTy *) writetag_5001 = tmpval_7307; + + CursorTy writecur_5002 = writetag_5001 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7309, pvrtmp_7310, + loc_2969, pvrtmp_7312}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7321 = *(CursorTy *) tmpcur_7302; + CursorTy tmpaftercur_7322 = tmpcur_7302 + 8; + CursorTy jump_4347 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_2969, tmpcur_7321); + CursorTy pvrtmp_7323 = tmp_struct_171.field0; + CursorTy pvrtmp_7324 = tmp_struct_171.field1; + CursorTy pvrtmp_7325 = tmp_struct_171.field2; + CursorTy pvrtmp_7326 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7323, jump_4347, + pvrtmp_7325, pvrtmp_7326}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7333 = *(CursorTy *) tmpcur_7302; + CursorTy tmpaftercur_7334 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_2969, tmpcur_7333); + CursorTy pvrtmp_7335 = tmp_struct_172.field0; + CursorTy pvrtmp_7336 = tmp_struct_172.field1; + CursorTy pvrtmp_7337 = tmp_struct_172.field2; + CursorTy pvrtmp_7338 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7335, pvrtmp_7336, + pvrtmp_7337, pvrtmp_7338}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7301"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2973, CursorTy arg_879_1484_1807) +{ + TagTyPacked tmpval_7346 = *(TagTyPacked *) arg_879_1484_1807; + CursorTy tmpcur_7347 = arg_879_1484_1807 + 1; + + + switch_7357: + ; + switch (tmpval_7346) { + + case 0: + { + CursorTy jump_4194 = arg_879_1484_1807 + 1; + + return (CursorProd) {jump_4194}; + break; + } + + case 1: + { + IntTy tmpval_7348 = *(IntTy *) tmpcur_7347; + CursorTy tmpcur_7349 = tmpcur_7347 + sizeof(IntTy); + CursorTy jump_4196 = tmpcur_7347 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2973, tmpcur_7349); + CursorTy pvrtmp_7350 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7350}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7351 = *(CursorTy *) tmpcur_7347; + CursorTy tmpaftercur_7352 = tmpcur_7347 + 8; + CursorTy jump_4353 = tmpcur_7347 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2973, tmpcur_7351); + CursorTy pvrtmp_7353 = tmp_struct_174.field0; + + return (CursorProd) {jump_4353}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7354 = *(CursorTy *) tmpcur_7347; + CursorTy tmpaftercur_7355 = tmpcur_7347 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2973, tmpcur_7354); + CursorTy pvrtmp_7356 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7356}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7346"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2975, CursorTy arg_884_1488_1811) +{ + TagTyPacked tmpval_7358 = *(TagTyPacked *) arg_884_1488_1811; + CursorTy tmpcur_7359 = arg_884_1488_1811 + 1; + + + switch_7369: + ; + switch (tmpval_7358) { + + case 0: + { + CursorTy jump_4199 = arg_884_1488_1811 + 1; + unsigned char wildcard_885_1489_1812 = print_symbol(6150); + unsigned char wildcard_886_1490_1813 = print_symbol(6145); + + return (CursorProd) {jump_4199}; + break; + } + + case 1: + { + IntTy tmpval_7360 = *(IntTy *) tmpcur_7359; + CursorTy tmpcur_7361 = tmpcur_7359 + sizeof(IntTy); + CursorTy jump_4201 = tmpcur_7359 + 8; + unsigned char wildcard_891_1493_1816 = print_symbol(6147); + unsigned char y_889_1494_1817 = printf("%lld", tmpval_7360); + CursorProd tmp_struct_176 = _print_Tags(end_r_2975, tmpcur_7361); + CursorTy pvrtmp_7362 = tmp_struct_176.field0; + unsigned char wildcard_892_1496_1819 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7362}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7363 = *(CursorTy *) tmpcur_7359; + CursorTy tmpaftercur_7364 = tmpcur_7359 + 8; + CursorTy jump_4359 = tmpcur_7359 + 8; + unsigned char wildcard_4362 = print_symbol(6162); + CursorProd tmp_struct_177 = _print_Tags(end_r_2975, tmpcur_7363); + CursorTy pvrtmp_7365 = tmp_struct_177.field0; + + return (CursorProd) {jump_4359}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7366 = *(CursorTy *) tmpcur_7359; + CursorTy tmpaftercur_7367 = tmpcur_7359 + 8; + unsigned char wildcard_4362 = print_symbol(6161); + CursorProd tmp_struct_178 = _print_Tags(end_r_2975, tmpcur_7366); + CursorTy pvrtmp_7368 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7368}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7358"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2710) +{ + if (loc_2977 + 32 > end_r_2979) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2979); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2979 = chunk_end_184; + *(TagTyPacked *) loc_2977 = 255; + + CursorTy redir = loc_2977 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2977 = chunk_start_183; + } + + CursorTy loc_3709 = loc_2977 + 1; + CursorTy loc_3710 = loc_3709 + 8; + TagTyPacked tmpval_7370 = *(TagTyPacked *) arg_2710; + CursorTy tmpcur_7371 = arg_2710 + 1; + + + switch_7414: + ; + switch (tmpval_7370) { + + case 0: + { + CursorTy jump_4204 = arg_2710 + 1; + + *(TagTyPacked *) loc_2977 = 0; + + CursorTy writetag_5032 = loc_2977 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2979, jump_4204, + loc_2977, writetag_5032}; + break; + } + + case 1: + { + IntTy tmpval_7376 = *(IntTy *) tmpcur_7371; + CursorTy tmpcur_7377 = tmpcur_7371 + sizeof(IntTy); + CursorTy jump_4206 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_3710, tmpcur_7377); + CursorTy pvrtmp_7378 = tmp_struct_179.field0; + CursorTy pvrtmp_7379 = tmp_struct_179.field1; + CursorTy pvrtmp_7380 = tmp_struct_179.field2; + CursorTy pvrtmp_7381 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2977 = 1; + + CursorTy writetag_5037 = loc_2977 + 1; + + *(IntTy *) writetag_5037 = tmpval_7376; + + CursorTy writecur_5038 = writetag_5037 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7378, pvrtmp_7379, + loc_2977, pvrtmp_7381}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7390 = *(CursorTy *) tmpcur_7371; + CursorTy tmpaftercur_7391 = tmpcur_7371 + 8; + CursorTy jump_4365 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_2977, tmpcur_7390); + CursorTy pvrtmp_7392 = tmp_struct_180.field0; + CursorTy pvrtmp_7393 = tmp_struct_180.field1; + CursorTy pvrtmp_7394 = tmp_struct_180.field2; + CursorTy pvrtmp_7395 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7392, jump_4365, + pvrtmp_7394, pvrtmp_7395}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7402 = *(CursorTy *) tmpcur_7371; + CursorTy tmpaftercur_7403 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_2977, tmpcur_7402); + CursorTy pvrtmp_7404 = tmp_struct_181.field0; + CursorTy pvrtmp_7405 = tmp_struct_181.field1; + CursorTy pvrtmp_7406 = tmp_struct_181.field2; + CursorTy pvrtmp_7407 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7404, pvrtmp_7405, + pvrtmp_7406, pvrtmp_7407}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7370"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2715) +{ + if (loc_2981 + 32 > end_r_2983) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2983); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2983 = chunk_end_191; + *(TagTyPacked *) loc_2981 = 255; + + CursorTy redir = loc_2981 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2981 = chunk_start_190; + } + + TagTyPacked tmpval_7415 = *(TagTyPacked *) arg_2715; + CursorTy tmpcur_7416 = arg_2715 + 1; + + + switch_7465: + ; + switch (tmpval_7415) { + + case 0: + { + CursorTy loc_3720 = loc_2981 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2982, end_r_2983, loc_3720, tmpcur_7416); + CursorTy pvrtmp_7417 = tmp_struct_185.field0; + CursorTy pvrtmp_7418 = tmp_struct_185.field1; + CursorTy pvrtmp_7419 = tmp_struct_185.field2; + CursorTy pvrtmp_7420 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2981 = 0; + + CursorTy writetag_5049 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7417, pvrtmp_7418, + loc_2981, pvrtmp_7420}; + break; + } + + case 1: + { + CursorTy loc_3726 = loc_2981 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2982, end_r_2983, loc_3726, tmpcur_7416); + CursorTy pvrtmp_7429 = tmp_struct_186.field0; + CursorTy pvrtmp_7430 = tmp_struct_186.field1; + CursorTy pvrtmp_7431 = tmp_struct_186.field2; + CursorTy pvrtmp_7432 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2981 = 1; + + CursorTy writetag_5054 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7429, pvrtmp_7430, + loc_2981, pvrtmp_7432}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7441 = *(CursorTy *) tmpcur_7416; + CursorTy tmpaftercur_7442 = tmpcur_7416 + 8; + CursorTy jump_4371 = tmpcur_7416 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2982, end_r_2983, loc_2981, tmpcur_7441); + CursorTy pvrtmp_7443 = tmp_struct_187.field0; + CursorTy pvrtmp_7444 = tmp_struct_187.field1; + CursorTy pvrtmp_7445 = tmp_struct_187.field2; + CursorTy pvrtmp_7446 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7443, jump_4371, + pvrtmp_7445, pvrtmp_7446}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7453 = *(CursorTy *) tmpcur_7416; + CursorTy tmpaftercur_7454 = tmpcur_7416 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2982, end_r_2983, loc_2981, tmpcur_7453); + CursorTy pvrtmp_7455 = tmp_struct_188.field0; + CursorTy pvrtmp_7456 = tmp_struct_188.field1; + CursorTy pvrtmp_7457 = tmp_struct_188.field2; + CursorTy pvrtmp_7458 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7455, pvrtmp_7456, + pvrtmp_7457, pvrtmp_7458}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7415"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2986, + CursorTy end_r_2987, + CursorTy loc_2985, + CursorTy arg_2720) +{ + if (loc_2985 + 32 > end_r_2987) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2987); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2987 = chunk_end_218; + *(TagTyPacked *) loc_2985 = 255; + + CursorTy redir = loc_2985 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2985 = chunk_start_217; + } + + CursorTy loc_3739 = loc_2985 + 1; + CursorTy loc_3740 = loc_3739 + 8; + CursorTy loc_3741 = loc_3740 + 8; + CursorTy loc_3757 = loc_2985 + 1; + CursorTy loc_3758 = loc_3757 + 8; + CursorTy loc_3759 = loc_3758 + 8; + CursorTy loc_3779 = loc_2985 + 1; + CursorTy loc_3780 = loc_3779 + 8; + CursorTy loc_3781 = loc_3780 + 8; + CursorTy loc_3782 = loc_3781 + 8; + CursorTy loc_3806 = loc_2985 + 1; + CursorTy loc_3807 = loc_3806 + 8; + CursorTy loc_3808 = loc_3807 + 8; + CursorTy loc_3809 = loc_3808 + 8; + CursorTy loc_3833 = loc_2985 + 1; + CursorTy loc_3834 = loc_3833 + 8; + CursorTy loc_3835 = loc_3834 + 8; + CursorTy loc_3836 = loc_3835 + 8; + CursorTy loc_3860 = loc_2985 + 1; + CursorTy loc_3861 = loc_3860 + 8; + CursorTy loc_3862 = loc_3861 + 8; + CursorTy loc_3863 = loc_3862 + 8; + CursorTy loc_3887 = loc_2985 + 1; + CursorTy loc_3888 = loc_3887 + 8; + CursorTy loc_3889 = loc_3888 + 8; + CursorTy loc_3890 = loc_3889 + 8; + CursorTy loc_3914 = loc_2985 + 1; + CursorTy loc_3915 = loc_3914 + 8; + CursorTy loc_3916 = loc_3915 + 8; + CursorTy loc_3917 = loc_3916 + 8; + TagTyPacked tmpval_7466 = *(TagTyPacked *) arg_2720; + CursorTy tmpcur_7467 = arg_2720 + 1; + + + switch_7704: + ; + switch (tmpval_7466) { + + case 0: + { + CursorTy jump_4213 = arg_2720 + 1; + + *(TagTyPacked *) loc_2985 = 0; + + CursorTy writetag_5064 = loc_2985 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2987, jump_4213, + loc_2985, writetag_5064}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3741, tmpcur_7467); + CursorTy pvrtmp_7472 = tmp_struct_192.field0; + CursorTy pvrtmp_7473 = tmp_struct_192.field1; + CursorTy pvrtmp_7474 = tmp_struct_192.field2; + CursorTy pvrtmp_7475 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7472, pvrtmp_7475, pvrtmp_7473); + CursorTy pvrtmp_7480 = tmp_struct_193.field0; + CursorTy pvrtmp_7481 = tmp_struct_193.field1; + CursorTy pvrtmp_7482 = tmp_struct_193.field2; + CursorTy pvrtmp_7483 = tmp_struct_193.field3; + IntTy sizeof_y_2723__2725 = pvrtmp_7475 - pvrtmp_7474; + IntTy sizeof_y_2724__2726 = pvrtmp_7483 - pvrtmp_7482; + IntTy fltPrm_2814 = sizeof_y_2723__2725 + 0; + IntTy offset__2727 = 0 + fltPrm_2814; + IntTy fltPrm_2815 = sizeof_y_2723__2725 + sizeof_y_2724__2726; + IntTy size_dcon_2728 = 9 + fltPrm_2815; + + *(TagTyPacked *) loc_2985 = 160; + + CursorTy writetag_5069 = loc_2985 + 1; + + *(IntTy *) writetag_5069 = size_dcon_2728; + + CursorTy writecur_5070 = writetag_5069 + sizeof(IntTy); + + *(IntTy *) writecur_5070 = offset__2727; + + CursorTy writecur_5071 = writecur_5070 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7480, pvrtmp_7481, + loc_2985, pvrtmp_7483}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3759, tmpcur_7467); + CursorTy pvrtmp_7492 = tmp_struct_194.field0; + CursorTy pvrtmp_7493 = tmp_struct_194.field1; + CursorTy pvrtmp_7494 = tmp_struct_194.field2; + CursorTy pvrtmp_7495 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7492, pvrtmp_7495, pvrtmp_7493); + CursorTy pvrtmp_7500 = tmp_struct_195.field0; + CursorTy pvrtmp_7501 = tmp_struct_195.field1; + CursorTy pvrtmp_7502 = tmp_struct_195.field2; + CursorTy pvrtmp_7503 = tmp_struct_195.field3; + IntTy sizeof_y_2731__2733 = pvrtmp_7495 - pvrtmp_7494; + IntTy sizeof_y_2732__2734 = pvrtmp_7503 - pvrtmp_7502; + IntTy fltPrm_2816 = sizeof_y_2731__2733 + 0; + IntTy offset__2735 = 0 + fltPrm_2816; + IntTy fltPrm_2817 = sizeof_y_2731__2733 + sizeof_y_2732__2734; + IntTy size_dcon_2736 = 9 + fltPrm_2817; + + *(TagTyPacked *) loc_2985 = 162; + + CursorTy writetag_5078 = loc_2985 + 1; + + *(IntTy *) writetag_5078 = size_dcon_2736; + + CursorTy writecur_5079 = writetag_5078 + sizeof(IntTy); + + *(IntTy *) writecur_5079 = offset__2735; + + CursorTy writecur_5080 = writecur_5079 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7500, pvrtmp_7501, + loc_2985, pvrtmp_7503}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2986, end_r_2987, loc_3782, tmpcur_7467); + CursorTy pvrtmp_7512 = tmp_struct_196.field0; + CursorTy pvrtmp_7513 = tmp_struct_196.field1; + CursorTy pvrtmp_7514 = tmp_struct_196.field2; + CursorTy pvrtmp_7515 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7512, pvrtmp_7515, pvrtmp_7513); + CursorTy pvrtmp_7520 = tmp_struct_197.field0; + CursorTy pvrtmp_7521 = tmp_struct_197.field1; + CursorTy pvrtmp_7522 = tmp_struct_197.field2; + CursorTy pvrtmp_7523 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7520, pvrtmp_7523, pvrtmp_7521); + CursorTy pvrtmp_7528 = tmp_struct_198.field0; + CursorTy pvrtmp_7529 = tmp_struct_198.field1; + CursorTy pvrtmp_7530 = tmp_struct_198.field2; + CursorTy pvrtmp_7531 = tmp_struct_198.field3; + IntTy sizeof_y_2740__2743 = pvrtmp_7515 - pvrtmp_7514; + IntTy sizeof_y_2741__2744 = pvrtmp_7523 - pvrtmp_7522; + IntTy sizeof_y_2742__2745 = pvrtmp_7531 - pvrtmp_7530; + IntTy fltPrm_2818 = sizeof_y_2740__2743 + 0; + IntTy offset__2746 = 8 + fltPrm_2818; + IntTy fltPrm_2819 = sizeof_y_2740__2743 + sizeof_y_2741__2744; + IntTy offset__2747 = 0 + fltPrm_2819; + IntTy fltPrm_2821 = sizeof_y_2741__2744 + sizeof_y_2742__2745; + IntTy fltPrm_2820 = sizeof_y_2740__2743 + fltPrm_2821; + IntTy size_dcon_2748 = 17 + fltPrm_2820; + + *(TagTyPacked *) loc_2985 = 164; + + CursorTy writetag_5088 = loc_2985 + 1; + + *(IntTy *) writetag_5088 = size_dcon_2748; + + CursorTy writecur_5089 = writetag_5088 + sizeof(IntTy); + + *(IntTy *) writecur_5089 = offset__2746; + + CursorTy writecur_5090 = writecur_5089 + sizeof(IntTy); + + *(IntTy *) writecur_5090 = offset__2747; + + CursorTy writecur_5091 = writecur_5090 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7528, pvrtmp_7529, + loc_2985, pvrtmp_7531}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3809, tmpcur_7467); + CursorTy pvrtmp_7540 = tmp_struct_199.field0; + CursorTy pvrtmp_7541 = tmp_struct_199.field1; + CursorTy pvrtmp_7542 = tmp_struct_199.field2; + CursorTy pvrtmp_7543 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7540, pvrtmp_7543, pvrtmp_7541); + CursorTy pvrtmp_7548 = tmp_struct_200.field0; + CursorTy pvrtmp_7549 = tmp_struct_200.field1; + CursorTy pvrtmp_7550 = tmp_struct_200.field2; + CursorTy pvrtmp_7551 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7548, pvrtmp_7551, pvrtmp_7549); + CursorTy pvrtmp_7556 = tmp_struct_201.field0; + CursorTy pvrtmp_7557 = tmp_struct_201.field1; + CursorTy pvrtmp_7558 = tmp_struct_201.field2; + CursorTy pvrtmp_7559 = tmp_struct_201.field3; + IntTy sizeof_y_2752__2755 = pvrtmp_7543 - pvrtmp_7542; + IntTy sizeof_y_2753__2756 = pvrtmp_7551 - pvrtmp_7550; + IntTy sizeof_y_2754__2757 = pvrtmp_7559 - pvrtmp_7558; + IntTy fltPrm_2822 = sizeof_y_2752__2755 + 0; + IntTy offset__2758 = 8 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2752__2755 + sizeof_y_2753__2756; + IntTy offset__2759 = 0 + fltPrm_2823; + IntTy fltPrm_2825 = sizeof_y_2753__2756 + sizeof_y_2754__2757; + IntTy fltPrm_2824 = sizeof_y_2752__2755 + fltPrm_2825; + IntTy size_dcon_2760 = 17 + fltPrm_2824; + + *(TagTyPacked *) loc_2985 = 166; + + CursorTy writetag_5100 = loc_2985 + 1; + + *(IntTy *) writetag_5100 = size_dcon_2760; + + CursorTy writecur_5101 = writetag_5100 + sizeof(IntTy); + + *(IntTy *) writecur_5101 = offset__2758; + + CursorTy writecur_5102 = writecur_5101 + sizeof(IntTy); + + *(IntTy *) writecur_5102 = offset__2759; + + CursorTy writecur_5103 = writecur_5102 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7556, pvrtmp_7557, + loc_2985, pvrtmp_7559}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2986, end_r_2987, loc_3836, tmpcur_7467); + CursorTy pvrtmp_7568 = tmp_struct_202.field0; + CursorTy pvrtmp_7569 = tmp_struct_202.field1; + CursorTy pvrtmp_7570 = tmp_struct_202.field2; + CursorTy pvrtmp_7571 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7568, pvrtmp_7571, pvrtmp_7569); + CursorTy pvrtmp_7576 = tmp_struct_203.field0; + CursorTy pvrtmp_7577 = tmp_struct_203.field1; + CursorTy pvrtmp_7578 = tmp_struct_203.field2; + CursorTy pvrtmp_7579 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7576, pvrtmp_7579, pvrtmp_7577); + CursorTy pvrtmp_7584 = tmp_struct_204.field0; + CursorTy pvrtmp_7585 = tmp_struct_204.field1; + CursorTy pvrtmp_7586 = tmp_struct_204.field2; + CursorTy pvrtmp_7587 = tmp_struct_204.field3; + IntTy sizeof_y_2764__2767 = pvrtmp_7571 - pvrtmp_7570; + IntTy sizeof_y_2765__2768 = pvrtmp_7579 - pvrtmp_7578; + IntTy sizeof_y_2766__2769 = pvrtmp_7587 - pvrtmp_7586; + IntTy fltPrm_2826 = sizeof_y_2764__2767 + 0; + IntTy offset__2770 = 8 + fltPrm_2826; + IntTy fltPrm_2827 = sizeof_y_2764__2767 + sizeof_y_2765__2768; + IntTy offset__2771 = 0 + fltPrm_2827; + IntTy fltPrm_2829 = sizeof_y_2765__2768 + sizeof_y_2766__2769; + IntTy fltPrm_2828 = sizeof_y_2764__2767 + fltPrm_2829; + IntTy size_dcon_2772 = 17 + fltPrm_2828; + + *(TagTyPacked *) loc_2985 = 168; + + CursorTy writetag_5112 = loc_2985 + 1; + + *(IntTy *) writetag_5112 = size_dcon_2772; + + CursorTy writecur_5113 = writetag_5112 + sizeof(IntTy); + + *(IntTy *) writecur_5113 = offset__2770; + + CursorTy writecur_5114 = writecur_5113 + sizeof(IntTy); + + *(IntTy *) writecur_5114 = offset__2771; + + CursorTy writecur_5115 = writecur_5114 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7584, pvrtmp_7585, + loc_2985, pvrtmp_7587}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3863, tmpcur_7467); + CursorTy pvrtmp_7596 = tmp_struct_205.field0; + CursorTy pvrtmp_7597 = tmp_struct_205.field1; + CursorTy pvrtmp_7598 = tmp_struct_205.field2; + CursorTy pvrtmp_7599 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7596, pvrtmp_7599, pvrtmp_7597); + CursorTy pvrtmp_7604 = tmp_struct_206.field0; + CursorTy pvrtmp_7605 = tmp_struct_206.field1; + CursorTy pvrtmp_7606 = tmp_struct_206.field2; + CursorTy pvrtmp_7607 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7604, pvrtmp_7607, pvrtmp_7605); + CursorTy pvrtmp_7612 = tmp_struct_207.field0; + CursorTy pvrtmp_7613 = tmp_struct_207.field1; + CursorTy pvrtmp_7614 = tmp_struct_207.field2; + CursorTy pvrtmp_7615 = tmp_struct_207.field3; + IntTy sizeof_y_2776__2779 = pvrtmp_7599 - pvrtmp_7598; + IntTy sizeof_y_2777__2780 = pvrtmp_7607 - pvrtmp_7606; + IntTy sizeof_y_2778__2781 = pvrtmp_7615 - pvrtmp_7614; + IntTy fltPrm_2830 = sizeof_y_2776__2779 + 0; + IntTy offset__2782 = 8 + fltPrm_2830; + IntTy fltPrm_2831 = sizeof_y_2776__2779 + sizeof_y_2777__2780; + IntTy offset__2783 = 0 + fltPrm_2831; + IntTy fltPrm_2833 = sizeof_y_2777__2780 + sizeof_y_2778__2781; + IntTy fltPrm_2832 = sizeof_y_2776__2779 + fltPrm_2833; + IntTy size_dcon_2784 = 17 + fltPrm_2832; + + *(TagTyPacked *) loc_2985 = 170; + + CursorTy writetag_5124 = loc_2985 + 1; + + *(IntTy *) writetag_5124 = size_dcon_2784; + + CursorTy writecur_5125 = writetag_5124 + sizeof(IntTy); + + *(IntTy *) writecur_5125 = offset__2782; + + CursorTy writecur_5126 = writecur_5125 + sizeof(IntTy); + + *(IntTy *) writecur_5126 = offset__2783; + + CursorTy writecur_5127 = writecur_5126 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7612, pvrtmp_7613, + loc_2985, pvrtmp_7615}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3890, tmpcur_7467); + CursorTy pvrtmp_7624 = tmp_struct_208.field0; + CursorTy pvrtmp_7625 = tmp_struct_208.field1; + CursorTy pvrtmp_7626 = tmp_struct_208.field2; + CursorTy pvrtmp_7627 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7624, pvrtmp_7627, pvrtmp_7625); + CursorTy pvrtmp_7632 = tmp_struct_209.field0; + CursorTy pvrtmp_7633 = tmp_struct_209.field1; + CursorTy pvrtmp_7634 = tmp_struct_209.field2; + CursorTy pvrtmp_7635 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7632, pvrtmp_7635, pvrtmp_7633); + CursorTy pvrtmp_7640 = tmp_struct_210.field0; + CursorTy pvrtmp_7641 = tmp_struct_210.field1; + CursorTy pvrtmp_7642 = tmp_struct_210.field2; + CursorTy pvrtmp_7643 = tmp_struct_210.field3; + IntTy sizeof_y_2788__2791 = pvrtmp_7627 - pvrtmp_7626; + IntTy sizeof_y_2789__2792 = pvrtmp_7635 - pvrtmp_7634; + IntTy sizeof_y_2790__2793 = pvrtmp_7643 - pvrtmp_7642; + IntTy fltPrm_2834 = sizeof_y_2788__2791 + 0; + IntTy offset__2794 = 8 + fltPrm_2834; + IntTy fltPrm_2835 = sizeof_y_2788__2791 + sizeof_y_2789__2792; + IntTy offset__2795 = 0 + fltPrm_2835; + IntTy fltPrm_2837 = sizeof_y_2789__2792 + sizeof_y_2790__2793; + IntTy fltPrm_2836 = sizeof_y_2788__2791 + fltPrm_2837; + IntTy size_dcon_2796 = 17 + fltPrm_2836; + + *(TagTyPacked *) loc_2985 = 172; + + CursorTy writetag_5136 = loc_2985 + 1; + + *(IntTy *) writetag_5136 = size_dcon_2796; + + CursorTy writecur_5137 = writetag_5136 + sizeof(IntTy); + + *(IntTy *) writecur_5137 = offset__2794; + + CursorTy writecur_5138 = writecur_5137 + sizeof(IntTy); + + *(IntTy *) writecur_5138 = offset__2795; + + CursorTy writecur_5139 = writecur_5138 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7640, pvrtmp_7641, + loc_2985, pvrtmp_7643}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3917, tmpcur_7467); + CursorTy pvrtmp_7652 = tmp_struct_211.field0; + CursorTy pvrtmp_7653 = tmp_struct_211.field1; + CursorTy pvrtmp_7654 = tmp_struct_211.field2; + CursorTy pvrtmp_7655 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7652, pvrtmp_7655, pvrtmp_7653); + CursorTy pvrtmp_7660 = tmp_struct_212.field0; + CursorTy pvrtmp_7661 = tmp_struct_212.field1; + CursorTy pvrtmp_7662 = tmp_struct_212.field2; + CursorTy pvrtmp_7663 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7660, pvrtmp_7663, pvrtmp_7661); + CursorTy pvrtmp_7668 = tmp_struct_213.field0; + CursorTy pvrtmp_7669 = tmp_struct_213.field1; + CursorTy pvrtmp_7670 = tmp_struct_213.field2; + CursorTy pvrtmp_7671 = tmp_struct_213.field3; + IntTy sizeof_y_2800__2803 = pvrtmp_7655 - pvrtmp_7654; + IntTy sizeof_y_2801__2804 = pvrtmp_7663 - pvrtmp_7662; + IntTy sizeof_y_2802__2805 = pvrtmp_7671 - pvrtmp_7670; + IntTy fltPrm_2838 = sizeof_y_2800__2803 + 0; + IntTy offset__2806 = 8 + fltPrm_2838; + IntTy fltPrm_2839 = sizeof_y_2800__2803 + sizeof_y_2801__2804; + IntTy offset__2807 = 0 + fltPrm_2839; + IntTy fltPrm_2841 = sizeof_y_2801__2804 + sizeof_y_2802__2805; + IntTy fltPrm_2840 = sizeof_y_2800__2803 + fltPrm_2841; + IntTy size_dcon_2808 = 17 + fltPrm_2840; + + *(TagTyPacked *) loc_2985 = 174; + + CursorTy writetag_5148 = loc_2985 + 1; + + *(IntTy *) writetag_5148 = size_dcon_2808; + + CursorTy writecur_5149 = writetag_5148 + sizeof(IntTy); + + *(IntTy *) writecur_5149 = offset__2806; + + CursorTy writecur_5150 = writecur_5149 + sizeof(IntTy); + + *(IntTy *) writecur_5150 = offset__2807; + + CursorTy writecur_5151 = writecur_5150 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7668, pvrtmp_7669, + loc_2985, pvrtmp_7671}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7680 = *(CursorTy *) tmpcur_7467; + CursorTy tmpaftercur_7681 = tmpcur_7467 + 8; + CursorTy jump_4377 = tmpcur_7467 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_2985, tmpcur_7680); + CursorTy pvrtmp_7682 = tmp_struct_214.field0; + CursorTy pvrtmp_7683 = tmp_struct_214.field1; + CursorTy pvrtmp_7684 = tmp_struct_214.field2; + CursorTy pvrtmp_7685 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7682, jump_4377, + pvrtmp_7684, pvrtmp_7685}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7692 = *(CursorTy *) tmpcur_7467; + CursorTy tmpaftercur_7693 = tmpcur_7467 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_2985, tmpcur_7692); + CursorTy pvrtmp_7694 = tmp_struct_215.field0; + CursorTy pvrtmp_7695 = tmp_struct_215.field1; + CursorTy pvrtmp_7696 = tmp_struct_215.field2; + CursorTy pvrtmp_7697 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7694, pvrtmp_7695, + pvrtmp_7696, pvrtmp_7697}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7466"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2990, + CursorTy end_r_2991, + CursorTy loc_2989, + CursorTy arg_2809) +{ + if (loc_2989 + 32 > end_r_2991) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2991); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2991 = chunk_end_224; + *(TagTyPacked *) loc_2989 = 255; + + CursorTy redir = loc_2989 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2989 = chunk_start_223; + } + + CursorTy loc_3937 = loc_2989 + 1; + CursorTy loc_3938 = loc_3937 + 8; + TagTyPacked tmpval_7705 = *(TagTyPacked *) arg_2809; + CursorTy tmpcur_7706 = arg_2809 + 1; + + + switch_7749: + ; + switch (tmpval_7705) { + + case 0: + { + CursorTy jump_4245 = arg_2809 + 1; + + *(TagTyPacked *) loc_2989 = 0; + + CursorTy writetag_5163 = loc_2989 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2991, jump_4245, + loc_2989, writetag_5163}; + break; + } + + case 1: + { + IntTy tmpval_7711 = *(IntTy *) tmpcur_7706; + CursorTy tmpcur_7712 = tmpcur_7706 + sizeof(IntTy); + CursorTy jump_4247 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_3938, tmpcur_7712); + CursorTy pvrtmp_7713 = tmp_struct_219.field0; + CursorTy pvrtmp_7714 = tmp_struct_219.field1; + CursorTy pvrtmp_7715 = tmp_struct_219.field2; + CursorTy pvrtmp_7716 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2989 = 1; + + CursorTy writetag_5168 = loc_2989 + 1; + + *(IntTy *) writetag_5168 = tmpval_7711; + + CursorTy writecur_5169 = writetag_5168 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7713, pvrtmp_7714, + loc_2989, pvrtmp_7716}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7725 = *(CursorTy *) tmpcur_7706; + CursorTy tmpaftercur_7726 = tmpcur_7706 + 8; + CursorTy jump_4383 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_2989, tmpcur_7725); + CursorTy pvrtmp_7727 = tmp_struct_220.field0; + CursorTy pvrtmp_7728 = tmp_struct_220.field1; + CursorTy pvrtmp_7729 = tmp_struct_220.field2; + CursorTy pvrtmp_7730 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7727, jump_4383, + pvrtmp_7729, pvrtmp_7730}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7737 = *(CursorTy *) tmpcur_7706; + CursorTy tmpaftercur_7738 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_2989, tmpcur_7737); + CursorTy pvrtmp_7739 = tmp_struct_221.field0; + CursorTy pvrtmp_7740 = tmp_struct_221.field1; + CursorTy pvrtmp_7741 = tmp_struct_221.field2; + CursorTy pvrtmp_7742 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7739, pvrtmp_7740, + pvrtmp_7741, pvrtmp_7742}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7705"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6145, ")"); + add_symbol(6146, "(Text "); + add_symbol(6147, "(Tag "); + add_symbol(6148, "(TCA "); + add_symbol(6149, "(TAC "); + add_symbol(6150, "(Nul "); + add_symbol(6151, "(Nil "); + add_symbol(6152, "(Image "); + add_symbol(6153, "(End "); + add_symbol(6154, "(Char "); + add_symbol(6155, "(CTA "); + add_symbol(6156, "(CAT "); + add_symbol(6157, "(CA "); + add_symbol(6158, "(ATC "); + add_symbol(6159, "(ACT "); + add_symbol(6160, "(AC "); + add_symbol(6161, " ->r "); + add_symbol(6162, " ->i "); + + RegionTy *region_6163 = alloc_region(global_init_inf_buf_size); + CursorTy r_3001 = region_6163->reg_heap; + IntTy sizeof_end_r_3001_6164 = global_init_inf_buf_size; + CursorTy end_r_3001 = r_3001 + sizeof_end_r_3001_6164; + RegionTy *region_6165 = alloc_region(global_init_inf_buf_size); + CursorTy r_3000 = region_6165->reg_heap; + IntTy sizeof_end_r_3000_6166 = global_init_inf_buf_size; + CursorTy end_r_3000 = r_3000 + sizeof_end_r_3000_6166; + CursorCursorCursorProd tmp_struct_225 = + mkCATList(end_r_3001, r_3001, 100000, 10, 2000); + CursorTy pvrtmp_6167 = tmp_struct_225.field0; + CursorTy pvrtmp_6168 = tmp_struct_225.field1; + CursorTy pvrtmp_6169 = tmp_struct_225.field2; + CursorTy pvrtmp_6183; + CursorTy pvrtmp_6184; + CursorTy pvrtmp_6185; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6183; + struct timespec end_pvrtmp_6183; + + start_counters(); + for (long long iters_pvrtmp_6183 = 0; iters_pvrtmp_6183 < + global_iters_param; iters_pvrtmp_6183++) { + if (iters_pvrtmp_6183 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6183); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6167, end_r_3000, r_3000, pvrtmp_6168); + CursorTy pvrtmp_6174 = tmp_struct_226.field0; + CursorTy pvrtmp_6175 = tmp_struct_226.field1; + CursorTy pvrtmp_6176 = tmp_struct_226.field2; + + pvrtmp_6183 = pvrtmp_6174; + pvrtmp_6184 = pvrtmp_6175; + pvrtmp_6185 = pvrtmp_6176; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6183); + if (iters_pvrtmp_6183 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6183, + &end_pvrtmp_6183); + + vector_inplace_update(times_230, iters_pvrtmp_6183, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCat2.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCat2.c new file mode 100644 index 000000000..db5194166 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCat2.c @@ -0,0 +1,5058 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2906, CursorTy end_r_2907, + CursorTy loc_2905, + CursorTy adt_14_900_1516); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2910, CursorTy end_r_2911, + CursorTy loc_2909, + CursorTy tags_20_906_1522, + IntTy inVal_21_907_1523); +CursorCursorCursorProd mkCATList(CursorTy end_r_2913, CursorTy loc_2912, + IntTy len_24_910_1528, + IntTy tagLen_25_911_1529, + IntTy strLen_26_912_1530); +CursorCursorCursorProd mkString(CursorTy end_r_2915, CursorTy loc_2914, + IntTy len_179_1065_1536); +CursorCursorCursorProd mkContentText(CursorTy end_r_2917, CursorTy loc_2916, + IntTy n_193_1079_1542); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2919, CursorTy loc_2918, + IntTy len_318_1204_1544); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2922, + CursorTy end_r_2923, + CursorTy loc_2921, + CursorTy arg_622_1228_1549); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2926, + CursorTy end_r_2927, + CursorTy loc_2925, + CursorTy arg_627_1233_1554); +CursorProd _traverse_String(CursorTy end_r_2929, CursorTy arg_632_1238_1559); +CursorProd _print_String(CursorTy end_r_2931, CursorTy arg_637_1242_1563); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_646_1251_1572); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2938, + CursorTy end_r_2939, + CursorTy loc_2937, + CursorTy arg_651_1256_1577); +CursorProd _traverse_Content(CursorTy end_r_2941, CursorTy arg_656_1261_1582); +CursorProd _print_Content(CursorTy end_r_2943, CursorTy arg_661_1266_1587); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2946, CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_670_1275_1596); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2950, + CursorTy end_r_2951, + CursorTy loc_2949, + CursorTy arg_715_1320_1641); +CursorProd _traverse_Adt(CursorTy end_r_2953, CursorTy arg_760_1365_1686); +CursorProd _print_Adt(CursorTy end_r_2955, CursorTy arg_805_1410_1731); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2958, + CursorTy end_r_2959, CursorTy loc_2957, + CursorTy arg_868_1473_1794); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2962, + CursorTy end_r_2963, + CursorTy loc_2961, + CursorTy arg_873_1478_1799); +CursorProd _traverse_Tags(CursorTy end_r_2965, CursorTy arg_878_1483_1804); +CursorProd _print_Tags(CursorTy end_r_2967, CursorTy arg_883_1487_1808); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2970, CursorTy end_r_2971, + CursorTy loc_2969, CursorTy arg_2702); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2974, CursorTy end_r_2975, + CursorTy loc_2973, CursorTy arg_2707); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2712); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2801); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2906, CursorTy end_r_2907, + CursorTy loc_2905, + CursorTy adt_14_900_1516) +{ + if (loc_2905 + 32 > end_r_2907) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2907); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2907 = chunk_end_6; + *(TagTyPacked *) loc_2905 = 255; + + CursorTy redir = loc_2905 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2905 = chunk_start_5; + } + + CursorTy loc_3008 = loc_2905 + 1; + CursorTy loc_3009 = loc_3008 + 8; + CursorTy loc_3010 = loc_3009 + 8; + TagTyPacked tmpval_6177 = *(TagTyPacked *) adt_14_900_1516; + CursorTy tmpcur_6178 = adt_14_900_1516 + 1; + + + switch_6230: + ; + switch (tmpval_6177) { + + case 0: + { + CursorTy jump_3933 = adt_14_900_1516 + 1; + + *(TagTyPacked *) loc_2905 = 0; + + CursorTy writetag_4492 = loc_2905 + 1; + + return (CursorCursorCursorProd) {end_r_2907, loc_2905, + writetag_4492}; + break; + } + + case 23: + { + CursorTy tmpcur_6183 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6184 = tmpcur_6178 + 8; + CursorTy tmpcur_6185 = *(CursorTy *) tmpaftercur_6184; + CursorTy tmpaftercur_6186 = tmpaftercur_6184 + 8; + CursorTy jump_3936 = tmpaftercur_6184 + 8; + CursorTy jump_3935 = tmpcur_6178 + 8; + + *(TagTyPacked *) loc_3010 = 254; + + CursorTy writetag_4497 = loc_3010 + 1; + + *(CursorTy *) writetag_4497 = tmpaftercur_6186; + + CursorTy writecur_4498 = writetag_4497 + 8; + CursorCursorCursorProd tmp_struct_0 = + addValTagsAdt(end_r_2906, end_r_2907, writecur_4498, tmpcur_6183); + CursorTy pvrtmp_6189 = tmp_struct_0.field0; + CursorTy pvrtmp_6190 = tmp_struct_0.field1; + CursorTy pvrtmp_6191 = tmp_struct_0.field2; + CursorCursorCursorCursorProd tmp_struct_1 = + addValTag(end_r_2906, pvrtmp_6189, pvrtmp_6191, tmpcur_6185, 10); + CursorTy pvrtmp_6196 = tmp_struct_1.field0; + CursorTy pvrtmp_6197 = tmp_struct_1.field1; + CursorTy pvrtmp_6198 = tmp_struct_1.field2; + CursorTy pvrtmp_6199 = tmp_struct_1.field3; + + *(TagTyPacked *) loc_2905 = 23; + + CursorTy writetag_4502 = loc_2905 + 1; + + *(CursorTy *) writetag_4502 = tmpcur_6183; + + CursorTy writecur_4503 = writetag_4502 + 8; + + *(CursorTy *) writecur_4503 = pvrtmp_6191; + + CursorTy writecur_4504 = writecur_4503 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6196, loc_2905, + pvrtmp_6199}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6208 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6209 = tmpcur_6178 + 8; + CursorTy jump_4245 = tmpcur_6178 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2906, end_r_2907, loc_2905, tmpcur_6208); + CursorTy pvrtmp_6210 = tmp_struct_2.field0; + CursorTy pvrtmp_6211 = tmp_struct_2.field1; + CursorTy pvrtmp_6212 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6210, pvrtmp_6211, + pvrtmp_6212}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6219 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6220 = tmpcur_6178 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2906, end_r_2907, loc_2905, tmpcur_6219); + CursorTy pvrtmp_6221 = tmp_struct_3.field0; + CursorTy pvrtmp_6222 = tmp_struct_3.field1; + CursorTy pvrtmp_6223 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6221, pvrtmp_6222, + pvrtmp_6223}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6177"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2910, CursorTy end_r_2911, + CursorTy loc_2909, + CursorTy tags_20_906_1522, + IntTy inVal_21_907_1523) +{ + if (loc_2909 + 32 > end_r_2911) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2911); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2911 = chunk_end_12; + *(TagTyPacked *) loc_2909 = 255; + + CursorTy redir = loc_2909 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2909 = chunk_start_11; + } + + CursorTy loc_3028 = loc_2909 + 1; + CursorTy loc_3029 = loc_3028 + 8; + TagTyPacked tmpval_6231 = *(TagTyPacked *) tags_20_906_1522; + CursorTy tmpcur_6232 = tags_20_906_1522 + 1; + + + switch_6275: + ; + switch (tmpval_6231) { + + case 0: + { + CursorTy jump_3939 = tags_20_906_1522 + 1; + + *(TagTyPacked *) loc_2909 = 0; + + CursorTy writetag_4516 = loc_2909 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2911, jump_3939, + loc_2909, writetag_4516}; + break; + } + + case 1: + { + IntTy tmpval_6237 = *(IntTy *) tmpcur_6232; + CursorTy tmpcur_6238 = tmpcur_6232 + sizeof(IntTy); + CursorTy jump_3941 = tmpcur_6232 + 8; + IntTy fltPkd_1504_1526 = tmpval_6237 + inVal_21_907_1523; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2910, end_r_2911, loc_3029, tmpcur_6238, inVal_21_907_1523); + CursorTy pvrtmp_6239 = tmp_struct_7.field0; + CursorTy pvrtmp_6240 = tmp_struct_7.field1; + CursorTy pvrtmp_6241 = tmp_struct_7.field2; + CursorTy pvrtmp_6242 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2909 = 1; + + CursorTy writetag_4521 = loc_2909 + 1; + + *(IntTy *) writetag_4521 = fltPkd_1504_1526; + + CursorTy writecur_4522 = writetag_4521 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6239, pvrtmp_6240, + loc_2909, pvrtmp_6242}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6251 = *(CursorTy *) tmpcur_6232; + CursorTy tmpaftercur_6252 = tmpcur_6232 + 8; + CursorTy jump_4250 = tmpcur_6232 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2910, end_r_2911, loc_2909, tmpcur_6251, inVal_21_907_1523); + CursorTy pvrtmp_6253 = tmp_struct_8.field0; + CursorTy pvrtmp_6254 = tmp_struct_8.field1; + CursorTy pvrtmp_6255 = tmp_struct_8.field2; + CursorTy pvrtmp_6256 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6253, jump_4250, + pvrtmp_6255, pvrtmp_6256}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6263 = *(CursorTy *) tmpcur_6232; + CursorTy tmpaftercur_6264 = tmpcur_6232 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2910, end_r_2911, loc_2909, tmpcur_6263, inVal_21_907_1523); + CursorTy pvrtmp_6265 = tmp_struct_9.field0; + CursorTy pvrtmp_6266 = tmp_struct_9.field1; + CursorTy pvrtmp_6267 = tmp_struct_9.field2; + CursorTy pvrtmp_6268 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6265, pvrtmp_6266, + pvrtmp_6267, pvrtmp_6268}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6231"); + exit(1); + } + } +} +CursorCursorCursorProd mkCATList(CursorTy end_r_2913, CursorTy loc_2912, + IntTy len_24_910_1528, + IntTy tagLen_25_911_1529, + IntTy strLen_26_912_1530) +{ + if (loc_2912 + 32 > end_r_2913) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2913); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2913 = chunk_end_18; + *(TagTyPacked *) loc_2912 = 255; + + CursorTy redir = loc_2912 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2912 = chunk_start_17; + } + + CursorTy loc_3037 = loc_2912 + 1; + CursorTy loc_3038 = loc_3037 + 8; + CursorTy loc_3039 = loc_3038 + 8; + BoolTy fltIf_1506_1531 = len_24_910_1528 <= 0; + + if (fltIf_1506_1531) { + *(TagTyPacked *) loc_2912 = 0; + + CursorTy writetag_4531 = loc_2912 + 1; + + return (CursorCursorCursorProd) {end_r_2913, loc_2912, writetag_4531}; + } else { + CursorCursorCursorProd tmp_struct_13 = + mkContentText(end_r_2913, loc_3039, strLen_26_912_1530); + CursorTy pvrtmp_6280 = tmp_struct_13.field0; + CursorTy pvrtmp_6281 = tmp_struct_13.field1; + CursorTy pvrtmp_6282 = tmp_struct_13.field2; + IntTy fltAppE_1507_1533 = len_24_910_1528 - 1; + CursorCursorCursorProd tmp_struct_14 = + mkCATList(pvrtmp_6280, pvrtmp_6282, fltAppE_1507_1533, tagLen_25_911_1529, strLen_26_912_1530); + CursorTy pvrtmp_6287 = tmp_struct_14.field0; + CursorTy pvrtmp_6288 = tmp_struct_14.field1; + CursorTy pvrtmp_6289 = tmp_struct_14.field2; + CursorCursorCursorProd tmp_struct_15 = + mkRandomTags(pvrtmp_6287, pvrtmp_6289, tagLen_25_911_1529); + CursorTy pvrtmp_6294 = tmp_struct_15.field0; + CursorTy pvrtmp_6295 = tmp_struct_15.field1; + CursorTy pvrtmp_6296 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2912 = 23; + + CursorTy writetag_4536 = loc_2912 + 1; + + *(CursorTy *) writetag_4536 = pvrtmp_6282; + + CursorTy writecur_4537 = writetag_4536 + 8; + + *(CursorTy *) writecur_4537 = pvrtmp_6289; + + CursorTy writecur_4538 = writecur_4537 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6294, loc_2912, pvrtmp_6296}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2915, CursorTy loc_2914, + IntTy len_179_1065_1536) +{ + if (loc_2914 + 32 > end_r_2915) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2915); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2915 = chunk_end_22; + *(TagTyPacked *) loc_2914 = 255; + + CursorTy redir = loc_2914 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2914 = chunk_start_21; + } + + CursorTy loc_3051 = loc_2914 + 1; + CursorTy loc_3052 = loc_3051 + 8; + BoolTy fltIf_1508_1537 = len_179_1065_1536 <= 0; + + if (fltIf_1508_1537) { + *(TagTyPacked *) loc_2914 = 0; + + CursorTy writetag_4543 = loc_2914 + 1; + + return (CursorCursorCursorProd) {end_r_2915, loc_2914, writetag_4543}; + } else { + IntTy fltPrm_1509_1538 = rand(); + IntTy randomChar_180_1066_1539 = fltPrm_1509_1538 % 128; + IntTy fltAppE_1510_1540 = len_179_1065_1536 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2915, loc_3052, fltAppE_1510_1540); + CursorTy pvrtmp_6309 = tmp_struct_19.field0; + CursorTy pvrtmp_6310 = tmp_struct_19.field1; + CursorTy pvrtmp_6311 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2914 = 1; + + CursorTy writetag_4546 = loc_2914 + 1; + + *(IntTy *) writetag_4546 = randomChar_180_1066_1539; + + CursorTy writecur_4547 = writetag_4546 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6309, loc_2914, pvrtmp_6311}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2917, CursorTy loc_2916, + IntTy n_193_1079_1542) +{ + if (loc_2916 + 32 > end_r_2917) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2917); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2917 = chunk_end_26; + *(TagTyPacked *) loc_2916 = 255; + + CursorTy redir = loc_2916 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2916 = chunk_start_25; + } + + CursorTy loc_3057 = loc_2916 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2917, loc_3057, n_193_1079_1542); + CursorTy pvrtmp_6320 = tmp_struct_23.field0; + CursorTy pvrtmp_6321 = tmp_struct_23.field1; + CursorTy pvrtmp_6322 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2916 = 1; + + CursorTy writetag_4551 = loc_2916 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6320, loc_2916, pvrtmp_6322}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2919, CursorTy loc_2918, + IntTy len_318_1204_1544) +{ + if (loc_2918 + 32 > end_r_2919) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2919); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2919 = chunk_end_30; + *(TagTyPacked *) loc_2918 = 255; + + CursorTy redir = loc_2918 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2918 = chunk_start_29; + } + + CursorTy loc_3061 = loc_2918 + 1; + CursorTy loc_3062 = loc_3061 + 8; + BoolTy fltIf_1512_1545 = len_318_1204_1544 <= 0; + + if (fltIf_1512_1545) { + *(TagTyPacked *) loc_2918 = 0; + + CursorTy writetag_4554 = loc_2918 + 1; + + return (CursorCursorCursorProd) {end_r_2919, loc_2918, writetag_4554}; + } else { + IntTy fltAppE_1513_1547 = len_318_1204_1544 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2919, loc_3062, fltAppE_1513_1547); + CursorTy pvrtmp_6335 = tmp_struct_27.field0; + CursorTy pvrtmp_6336 = tmp_struct_27.field1; + CursorTy pvrtmp_6337 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2918 = 1; + + CursorTy writetag_4557 = loc_2918 + 1; + + *(IntTy *) writetag_4557 = 100; + + CursorTy writecur_4558 = writetag_4557 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6335, loc_2918, pvrtmp_6337}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2922, + CursorTy end_r_2923, + CursorTy loc_2921, + CursorTy arg_622_1228_1549) +{ + if (loc_2921 + 32 > end_r_2923) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2923); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2923 = chunk_end_36; + *(TagTyPacked *) loc_2921 = 255; + + CursorTy redir = loc_2921 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2921 = chunk_start_35; + } + + CursorTy loc_3072 = loc_2921 + 1; + CursorTy loc_3073 = loc_3072 + 8; + TagTyPacked tmpval_6346 = *(TagTyPacked *) arg_622_1228_1549; + CursorTy tmpcur_6347 = arg_622_1228_1549 + 1; + + + switch_6390: + ; + switch (tmpval_6346) { + + case 0: + { + CursorTy jump_3951 = arg_622_1228_1549 + 1; + + *(TagTyPacked *) loc_2921 = 0; + + CursorTy writetag_4562 = loc_2921 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2923, jump_3951, + loc_2921, writetag_4562}; + break; + } + + case 1: + { + IntTy tmpval_6352 = *(IntTy *) tmpcur_6347; + CursorTy tmpcur_6353 = tmpcur_6347 + sizeof(IntTy); + CursorTy jump_3953 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2922, end_r_2923, loc_3073, tmpcur_6353); + CursorTy pvrtmp_6354 = tmp_struct_31.field0; + CursorTy pvrtmp_6355 = tmp_struct_31.field1; + CursorTy pvrtmp_6356 = tmp_struct_31.field2; + CursorTy pvrtmp_6357 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2921 = 1; + + CursorTy writetag_4567 = loc_2921 + 1; + + *(IntTy *) writetag_4567 = tmpval_6352; + + CursorTy writecur_4568 = writetag_4567 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6354, pvrtmp_6355, + loc_2921, pvrtmp_6357}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6366 = *(CursorTy *) tmpcur_6347; + CursorTy tmpaftercur_6367 = tmpcur_6347 + 8; + CursorTy jump_4256 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2922, end_r_2923, loc_2921, tmpcur_6366); + CursorTy pvrtmp_6368 = tmp_struct_32.field0; + CursorTy pvrtmp_6369 = tmp_struct_32.field1; + CursorTy pvrtmp_6370 = tmp_struct_32.field2; + CursorTy pvrtmp_6371 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6368, jump_4256, + pvrtmp_6370, pvrtmp_6371}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6378 = *(CursorTy *) tmpcur_6347; + CursorTy tmpaftercur_6379 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2922, end_r_2923, loc_2921, tmpcur_6378); + CursorTy pvrtmp_6380 = tmp_struct_33.field0; + CursorTy pvrtmp_6381 = tmp_struct_33.field1; + CursorTy pvrtmp_6382 = tmp_struct_33.field2; + CursorTy pvrtmp_6383 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6380, pvrtmp_6381, + pvrtmp_6382, pvrtmp_6383}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6346"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2926, + CursorTy end_r_2927, + CursorTy loc_2925, + CursorTy arg_627_1233_1554) +{ + CursorTy loc_3085 = loc_2925 + 1; + CursorTy loc_3086 = loc_3085 + 8; + TagTyPacked tmpval_6391 = *(TagTyPacked *) arg_627_1233_1554; + CursorTy tmpcur_6392 = arg_627_1233_1554 + 1; + + + switch_6435: + ; + switch (tmpval_6391) { + + case 0: + { + CursorTy jump_3956 = arg_627_1233_1554 + 1; + + *(TagTyPacked *) loc_2925 = 0; + + CursorTy writetag_4578 = loc_2925 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2927, jump_3956, + loc_2925, writetag_4578}; + break; + } + + case 1: + { + IntTy tmpval_6397 = *(IntTy *) tmpcur_6392; + CursorTy tmpcur_6398 = tmpcur_6392 + sizeof(IntTy); + CursorTy jump_3958 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_3086, tmpcur_6398); + CursorTy pvrtmp_6399 = tmp_struct_37.field0; + CursorTy pvrtmp_6400 = tmp_struct_37.field1; + CursorTy pvrtmp_6401 = tmp_struct_37.field2; + CursorTy pvrtmp_6402 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2925 = 1; + + CursorTy writetag_4583 = loc_2925 + 1; + + *(IntTy *) writetag_4583 = tmpval_6397; + + CursorTy writecur_4584 = writetag_4583 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6399, pvrtmp_6400, + loc_2925, pvrtmp_6402}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6411 = *(CursorTy *) tmpcur_6392; + CursorTy tmpaftercur_6412 = tmpcur_6392 + 8; + CursorTy jump_4262 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_2925, tmpcur_6411); + CursorTy pvrtmp_6413 = tmp_struct_38.field0; + CursorTy pvrtmp_6414 = tmp_struct_38.field1; + CursorTy pvrtmp_6415 = tmp_struct_38.field2; + CursorTy pvrtmp_6416 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6413, jump_4262, + pvrtmp_6415, pvrtmp_6416}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6423 = *(CursorTy *) tmpcur_6392; + CursorTy tmpaftercur_6424 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_2925, tmpcur_6423); + CursorTy pvrtmp_6425 = tmp_struct_39.field0; + CursorTy pvrtmp_6426 = tmp_struct_39.field1; + CursorTy pvrtmp_6427 = tmp_struct_39.field2; + CursorTy pvrtmp_6428 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6425, pvrtmp_6426, + pvrtmp_6427, pvrtmp_6428}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6391"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2929, CursorTy arg_632_1238_1559) +{ + TagTyPacked tmpval_6436 = *(TagTyPacked *) arg_632_1238_1559; + CursorTy tmpcur_6437 = arg_632_1238_1559 + 1; + + + switch_6447: + ; + switch (tmpval_6436) { + + case 0: + { + CursorTy jump_3961 = arg_632_1238_1559 + 1; + + return (CursorProd) {jump_3961}; + break; + } + + case 1: + { + IntTy tmpval_6438 = *(IntTy *) tmpcur_6437; + CursorTy tmpcur_6439 = tmpcur_6437 + sizeof(IntTy); + CursorTy jump_3963 = tmpcur_6437 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2929, tmpcur_6439); + CursorTy pvrtmp_6440 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6440}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6441 = *(CursorTy *) tmpcur_6437; + CursorTy tmpaftercur_6442 = tmpcur_6437 + 8; + CursorTy jump_4268 = tmpcur_6437 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2929, tmpcur_6441); + CursorTy pvrtmp_6443 = tmp_struct_41.field0; + + return (CursorProd) {jump_4268}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6444 = *(CursorTy *) tmpcur_6437; + CursorTy tmpaftercur_6445 = tmpcur_6437 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2929, tmpcur_6444); + CursorTy pvrtmp_6446 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6446}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6436"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2931, CursorTy arg_637_1242_1563) +{ + TagTyPacked tmpval_6448 = *(TagTyPacked *) arg_637_1242_1563; + CursorTy tmpcur_6449 = arg_637_1242_1563 + 1; + + + switch_6459: + ; + switch (tmpval_6448) { + + case 0: + { + CursorTy jump_3966 = arg_637_1242_1563 + 1; + unsigned char wildcard_638_1243_1564 = print_symbol(6137); + unsigned char wildcard_639_1244_1565 = print_symbol(6129); + + return (CursorProd) {jump_3966}; + break; + } + + case 1: + { + IntTy tmpval_6450 = *(IntTy *) tmpcur_6449; + CursorTy tmpcur_6451 = tmpcur_6449 + sizeof(IntTy); + CursorTy jump_3968 = tmpcur_6449 + 8; + unsigned char wildcard_644_1247_1568 = print_symbol(6138); + unsigned char y_642_1248_1569 = printf("%lld", tmpval_6450); + CursorProd tmp_struct_43 = _print_String(end_r_2931, tmpcur_6451); + CursorTy pvrtmp_6452 = tmp_struct_43.field0; + unsigned char wildcard_645_1250_1571 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6452}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6453 = *(CursorTy *) tmpcur_6449; + CursorTy tmpaftercur_6454 = tmpcur_6449 + 8; + CursorTy jump_4274 = tmpcur_6449 + 8; + unsigned char wildcard_4277 = print_symbol(6146); + CursorProd tmp_struct_44 = _print_String(end_r_2931, tmpcur_6453); + CursorTy pvrtmp_6455 = tmp_struct_44.field0; + + return (CursorProd) {jump_4274}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6456 = *(CursorTy *) tmpcur_6449; + CursorTy tmpaftercur_6457 = tmpcur_6449 + 8; + unsigned char wildcard_4277 = print_symbol(6145); + CursorProd tmp_struct_45 = _print_String(end_r_2931, tmpcur_6456); + CursorTy pvrtmp_6458 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6458}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6448"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_646_1251_1572) +{ + if (loc_2933 + 32 > end_r_2935) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2935); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2935 = chunk_end_52; + *(TagTyPacked *) loc_2933 = 255; + + CursorTy redir = loc_2933 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2933 = chunk_start_51; + } + + TagTyPacked tmpval_6460 = *(TagTyPacked *) arg_646_1251_1572; + CursorTy tmpcur_6461 = arg_646_1251_1572 + 1; + + + switch_6510: + ; + switch (tmpval_6460) { + + case 0: + { + CursorTy loc_3108 = loc_2933 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2934, end_r_2935, loc_3108, tmpcur_6461); + CursorTy pvrtmp_6462 = tmp_struct_46.field0; + CursorTy pvrtmp_6463 = tmp_struct_46.field1; + CursorTy pvrtmp_6464 = tmp_struct_46.field2; + CursorTy pvrtmp_6465 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2933 = 0; + + CursorTy writetag_4615 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6462, pvrtmp_6463, + loc_2933, pvrtmp_6465}; + break; + } + + case 1: + { + CursorTy loc_3114 = loc_2933 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2934, end_r_2935, loc_3114, tmpcur_6461); + CursorTy pvrtmp_6474 = tmp_struct_47.field0; + CursorTy pvrtmp_6475 = tmp_struct_47.field1; + CursorTy pvrtmp_6476 = tmp_struct_47.field2; + CursorTy pvrtmp_6477 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2933 = 1; + + CursorTy writetag_4620 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6474, pvrtmp_6475, + loc_2933, pvrtmp_6477}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6486 = *(CursorTy *) tmpcur_6461; + CursorTy tmpaftercur_6487 = tmpcur_6461 + 8; + CursorTy jump_4280 = tmpcur_6461 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2934, end_r_2935, loc_2933, tmpcur_6486); + CursorTy pvrtmp_6488 = tmp_struct_48.field0; + CursorTy pvrtmp_6489 = tmp_struct_48.field1; + CursorTy pvrtmp_6490 = tmp_struct_48.field2; + CursorTy pvrtmp_6491 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6488, jump_4280, + pvrtmp_6490, pvrtmp_6491}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6498 = *(CursorTy *) tmpcur_6461; + CursorTy tmpaftercur_6499 = tmpcur_6461 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2934, end_r_2935, loc_2933, tmpcur_6498); + CursorTy pvrtmp_6500 = tmp_struct_49.field0; + CursorTy pvrtmp_6501 = tmp_struct_49.field1; + CursorTy pvrtmp_6502 = tmp_struct_49.field2; + CursorTy pvrtmp_6503 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6500, pvrtmp_6501, + pvrtmp_6502, pvrtmp_6503}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6460"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2938, + CursorTy end_r_2939, + CursorTy loc_2937, + CursorTy arg_651_1256_1577) +{ + TagTyPacked tmpval_6511 = *(TagTyPacked *) arg_651_1256_1577; + CursorTy tmpcur_6512 = arg_651_1256_1577 + 1; + + + switch_6561: + ; + switch (tmpval_6511) { + + case 0: + { + CursorTy loc_3122 = loc_2937 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2938, end_r_2939, loc_3122, tmpcur_6512); + CursorTy pvrtmp_6513 = tmp_struct_53.field0; + CursorTy pvrtmp_6514 = tmp_struct_53.field1; + CursorTy pvrtmp_6515 = tmp_struct_53.field2; + CursorTy pvrtmp_6516 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2937 = 0; + + CursorTy writetag_4631 = loc_2937 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6513, pvrtmp_6514, + loc_2937, pvrtmp_6516}; + break; + } + + case 1: + { + CursorTy loc_3128 = loc_2937 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2938, end_r_2939, loc_3128, tmpcur_6512); + CursorTy pvrtmp_6525 = tmp_struct_54.field0; + CursorTy pvrtmp_6526 = tmp_struct_54.field1; + CursorTy pvrtmp_6527 = tmp_struct_54.field2; + CursorTy pvrtmp_6528 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2937 = 1; + + CursorTy writetag_4636 = loc_2937 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6525, pvrtmp_6526, + loc_2937, pvrtmp_6528}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6537 = *(CursorTy *) tmpcur_6512; + CursorTy tmpaftercur_6538 = tmpcur_6512 + 8; + CursorTy jump_4286 = tmpcur_6512 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2938, end_r_2939, loc_2937, tmpcur_6537); + CursorTy pvrtmp_6539 = tmp_struct_55.field0; + CursorTy pvrtmp_6540 = tmp_struct_55.field1; + CursorTy pvrtmp_6541 = tmp_struct_55.field2; + CursorTy pvrtmp_6542 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6539, jump_4286, + pvrtmp_6541, pvrtmp_6542}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6549 = *(CursorTy *) tmpcur_6512; + CursorTy tmpaftercur_6550 = tmpcur_6512 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2938, end_r_2939, loc_2937, tmpcur_6549); + CursorTy pvrtmp_6551 = tmp_struct_56.field0; + CursorTy pvrtmp_6552 = tmp_struct_56.field1; + CursorTy pvrtmp_6553 = tmp_struct_56.field2; + CursorTy pvrtmp_6554 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6551, pvrtmp_6552, + pvrtmp_6553, pvrtmp_6554}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6511"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2941, CursorTy arg_656_1261_1582) +{ + TagTyPacked tmpval_6562 = *(TagTyPacked *) arg_656_1261_1582; + CursorTy tmpcur_6563 = arg_656_1261_1582 + 1; + + + switch_6572: + ; + switch (tmpval_6562) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2941, tmpcur_6563); + CursorTy pvrtmp_6564 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6564}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2941, tmpcur_6563); + CursorTy pvrtmp_6565 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6565}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6566 = *(CursorTy *) tmpcur_6563; + CursorTy tmpaftercur_6567 = tmpcur_6563 + 8; + CursorTy jump_4292 = tmpcur_6563 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2941, tmpcur_6566); + CursorTy pvrtmp_6568 = tmp_struct_59.field0; + + return (CursorProd) {jump_4292}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6569 = *(CursorTy *) tmpcur_6563; + CursorTy tmpaftercur_6570 = tmpcur_6563 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2941, tmpcur_6569); + CursorTy pvrtmp_6571 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6571}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6562"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2943, CursorTy arg_661_1266_1587) +{ + TagTyPacked tmpval_6573 = *(TagTyPacked *) arg_661_1266_1587; + CursorTy tmpcur_6574 = arg_661_1266_1587 + 1; + + + switch_6583: + ; + switch (tmpval_6573) { + + case 0: + { + unsigned char wildcard_664_1268_1589 = print_symbol(6136); + CursorProd tmp_struct_61 = _print_String(end_r_2943, tmpcur_6574); + CursorTy pvrtmp_6575 = tmp_struct_61.field0; + unsigned char wildcard_665_1270_1591 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6575}; + break; + } + + case 1: + { + unsigned char wildcard_668_1272_1593 = print_symbol(6130); + CursorProd tmp_struct_62 = _print_String(end_r_2943, tmpcur_6574); + CursorTy pvrtmp_6576 = tmp_struct_62.field0; + unsigned char wildcard_669_1274_1595 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6576}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6577 = *(CursorTy *) tmpcur_6574; + CursorTy tmpaftercur_6578 = tmpcur_6574 + 8; + CursorTy jump_4298 = tmpcur_6574 + 8; + unsigned char wildcard_4301 = print_symbol(6146); + CursorProd tmp_struct_63 = _print_Content(end_r_2943, tmpcur_6577); + CursorTy pvrtmp_6579 = tmp_struct_63.field0; + + return (CursorProd) {jump_4298}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6580 = *(CursorTy *) tmpcur_6574; + CursorTy tmpaftercur_6581 = tmpcur_6574 + 8; + unsigned char wildcard_4301 = print_symbol(6145); + CursorProd tmp_struct_64 = _print_Content(end_r_2943, tmpcur_6580); + CursorTy pvrtmp_6582 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6582}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6573"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2946, CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_670_1275_1596) +{ + if (loc_2945 + 32 > end_r_2947) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2947); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2947 = chunk_end_91; + *(TagTyPacked *) loc_2945 = 255; + + CursorTy redir = loc_2945 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2945 = chunk_start_90; + } + + CursorTy loc_3158 = loc_2945 + 1; + CursorTy loc_3159 = loc_3158 + 8; + CursorTy loc_3174 = loc_2945 + 1; + CursorTy loc_3175 = loc_3174 + 8; + CursorTy loc_3195 = loc_2945 + 1; + CursorTy loc_3196 = loc_3195 + 8; + CursorTy loc_3197 = loc_3196 + 8; + CursorTy loc_3221 = loc_2945 + 1; + CursorTy loc_3222 = loc_3221 + 8; + CursorTy loc_3223 = loc_3222 + 8; + CursorTy loc_3247 = loc_2945 + 1; + CursorTy loc_3248 = loc_3247 + 8; + CursorTy loc_3249 = loc_3248 + 8; + CursorTy loc_3273 = loc_2945 + 1; + CursorTy loc_3274 = loc_3273 + 8; + CursorTy loc_3275 = loc_3274 + 8; + CursorTy loc_3299 = loc_2945 + 1; + CursorTy loc_3300 = loc_3299 + 8; + CursorTy loc_3301 = loc_3300 + 8; + CursorTy loc_3325 = loc_2945 + 1; + CursorTy loc_3326 = loc_3325 + 8; + CursorTy loc_3327 = loc_3326 + 8; + TagTyPacked tmpval_6584 = *(TagTyPacked *) arg_670_1275_1596; + CursorTy tmpcur_6585 = arg_670_1275_1596 + 1; + + + switch_6850: + ; + switch (tmpval_6584) { + + case 0: + { + CursorTy jump_3987 = arg_670_1275_1596 + 1; + + *(TagTyPacked *) loc_2945 = 0; + + CursorTy writetag_4666 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2947, jump_3987, + loc_2945, writetag_4666}; + break; + } + + case 9: + { + CursorTy tmpcur_6590 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6591 = tmpcur_6585 + 8; + CursorTy jump_3989 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2946, end_r_2947, loc_3159, tmpaftercur_6591); + CursorTy pvrtmp_6592 = tmp_struct_65.field0; + CursorTy pvrtmp_6593 = tmp_struct_65.field1; + CursorTy pvrtmp_6594 = tmp_struct_65.field2; + CursorTy pvrtmp_6595 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2946, pvrtmp_6592, pvrtmp_6595, tmpcur_6590); + CursorTy pvrtmp_6600 = tmp_struct_66.field0; + CursorTy pvrtmp_6601 = tmp_struct_66.field1; + CursorTy pvrtmp_6602 = tmp_struct_66.field2; + CursorTy pvrtmp_6603 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2945 = 9; + + CursorTy writetag_4672 = loc_2945 + 1; + + *(CursorTy *) writetag_4672 = pvrtmp_6595; + + CursorTy writecur_4673 = writetag_4672 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6600, pvrtmp_6601, + loc_2945, pvrtmp_6603}; + break; + } + + case 11: + { + CursorTy tmpcur_6612 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6613 = tmpcur_6585 + 8; + CursorTy jump_3993 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2946, end_r_2947, loc_3175, tmpaftercur_6613); + CursorTy pvrtmp_6614 = tmp_struct_67.field0; + CursorTy pvrtmp_6615 = tmp_struct_67.field1; + CursorTy pvrtmp_6616 = tmp_struct_67.field2; + CursorTy pvrtmp_6617 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2946, pvrtmp_6614, pvrtmp_6617, tmpcur_6612); + CursorTy pvrtmp_6622 = tmp_struct_68.field0; + CursorTy pvrtmp_6623 = tmp_struct_68.field1; + CursorTy pvrtmp_6624 = tmp_struct_68.field2; + CursorTy pvrtmp_6625 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2945 = 11; + + CursorTy writetag_4681 = loc_2945 + 1; + + *(CursorTy *) writetag_4681 = pvrtmp_6617; + + CursorTy writecur_4682 = writetag_4681 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6622, pvrtmp_6623, + loc_2945, pvrtmp_6625}; + break; + } + + case 13: + { + CursorTy tmpcur_6634 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6635 = tmpcur_6585 + 8; + CursorTy tmpcur_6636 = *(CursorTy *) tmpaftercur_6635; + CursorTy tmpaftercur_6637 = tmpaftercur_6635 + 8; + CursorTy jump_3998 = tmpaftercur_6635 + 8; + CursorTy jump_3997 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2946, end_r_2947, loc_3197, tmpaftercur_6637); + CursorTy pvrtmp_6638 = tmp_struct_69.field0; + CursorTy pvrtmp_6639 = tmp_struct_69.field1; + CursorTy pvrtmp_6640 = tmp_struct_69.field2; + CursorTy pvrtmp_6641 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2946, pvrtmp_6638, pvrtmp_6641, tmpcur_6634); + CursorTy pvrtmp_6646 = tmp_struct_70.field0; + CursorTy pvrtmp_6647 = tmp_struct_70.field1; + CursorTy pvrtmp_6648 = tmp_struct_70.field2; + CursorTy pvrtmp_6649 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2946, pvrtmp_6646, pvrtmp_6649, tmpcur_6636); + CursorTy pvrtmp_6654 = tmp_struct_71.field0; + CursorTy pvrtmp_6655 = tmp_struct_71.field1; + CursorTy pvrtmp_6656 = tmp_struct_71.field2; + CursorTy pvrtmp_6657 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2945 = 13; + + CursorTy writetag_4692 = loc_2945 + 1; + + *(CursorTy *) writetag_4692 = pvrtmp_6641; + + CursorTy writecur_4693 = writetag_4692 + 8; + + *(CursorTy *) writecur_4693 = pvrtmp_6649; + + CursorTy writecur_4694 = writecur_4693 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6654, pvrtmp_6655, + loc_2945, pvrtmp_6657}; + break; + } + + case 15: + { + CursorTy tmpcur_6666 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6667 = tmpcur_6585 + 8; + CursorTy tmpcur_6668 = *(CursorTy *) tmpaftercur_6667; + CursorTy tmpaftercur_6669 = tmpaftercur_6667 + 8; + CursorTy jump_4004 = tmpaftercur_6667 + 8; + CursorTy jump_4003 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2946, end_r_2947, loc_3223, tmpaftercur_6669); + CursorTy pvrtmp_6670 = tmp_struct_72.field0; + CursorTy pvrtmp_6671 = tmp_struct_72.field1; + CursorTy pvrtmp_6672 = tmp_struct_72.field2; + CursorTy pvrtmp_6673 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2946, pvrtmp_6670, pvrtmp_6673, tmpcur_6666); + CursorTy pvrtmp_6678 = tmp_struct_73.field0; + CursorTy pvrtmp_6679 = tmp_struct_73.field1; + CursorTy pvrtmp_6680 = tmp_struct_73.field2; + CursorTy pvrtmp_6681 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2946, pvrtmp_6678, pvrtmp_6681, tmpcur_6668); + CursorTy pvrtmp_6686 = tmp_struct_74.field0; + CursorTy pvrtmp_6687 = tmp_struct_74.field1; + CursorTy pvrtmp_6688 = tmp_struct_74.field2; + CursorTy pvrtmp_6689 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2945 = 15; + + CursorTy writetag_4705 = loc_2945 + 1; + + *(CursorTy *) writetag_4705 = pvrtmp_6673; + + CursorTy writecur_4706 = writetag_4705 + 8; + + *(CursorTy *) writecur_4706 = pvrtmp_6681; + + CursorTy writecur_4707 = writecur_4706 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6686, pvrtmp_6687, + loc_2945, pvrtmp_6689}; + break; + } + + case 17: + { + CursorTy tmpcur_6698 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6699 = tmpcur_6585 + 8; + CursorTy tmpcur_6700 = *(CursorTy *) tmpaftercur_6699; + CursorTy tmpaftercur_6701 = tmpaftercur_6699 + 8; + CursorTy jump_4010 = tmpaftercur_6699 + 8; + CursorTy jump_4009 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2946, end_r_2947, loc_3249, tmpaftercur_6701); + CursorTy pvrtmp_6702 = tmp_struct_75.field0; + CursorTy pvrtmp_6703 = tmp_struct_75.field1; + CursorTy pvrtmp_6704 = tmp_struct_75.field2; + CursorTy pvrtmp_6705 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2946, pvrtmp_6702, pvrtmp_6705, tmpcur_6698); + CursorTy pvrtmp_6710 = tmp_struct_76.field0; + CursorTy pvrtmp_6711 = tmp_struct_76.field1; + CursorTy pvrtmp_6712 = tmp_struct_76.field2; + CursorTy pvrtmp_6713 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2946, pvrtmp_6710, pvrtmp_6713, tmpcur_6700); + CursorTy pvrtmp_6718 = tmp_struct_77.field0; + CursorTy pvrtmp_6719 = tmp_struct_77.field1; + CursorTy pvrtmp_6720 = tmp_struct_77.field2; + CursorTy pvrtmp_6721 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2945 = 17; + + CursorTy writetag_4718 = loc_2945 + 1; + + *(CursorTy *) writetag_4718 = pvrtmp_6705; + + CursorTy writecur_4719 = writetag_4718 + 8; + + *(CursorTy *) writecur_4719 = pvrtmp_6713; + + CursorTy writecur_4720 = writecur_4719 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6718, pvrtmp_6719, + loc_2945, pvrtmp_6721}; + break; + } + + case 19: + { + CursorTy tmpcur_6730 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6731 = tmpcur_6585 + 8; + CursorTy tmpcur_6732 = *(CursorTy *) tmpaftercur_6731; + CursorTy tmpaftercur_6733 = tmpaftercur_6731 + 8; + CursorTy jump_4016 = tmpaftercur_6731 + 8; + CursorTy jump_4015 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2946, end_r_2947, loc_3275, tmpaftercur_6733); + CursorTy pvrtmp_6734 = tmp_struct_78.field0; + CursorTy pvrtmp_6735 = tmp_struct_78.field1; + CursorTy pvrtmp_6736 = tmp_struct_78.field2; + CursorTy pvrtmp_6737 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2946, pvrtmp_6734, pvrtmp_6737, tmpcur_6730); + CursorTy pvrtmp_6742 = tmp_struct_79.field0; + CursorTy pvrtmp_6743 = tmp_struct_79.field1; + CursorTy pvrtmp_6744 = tmp_struct_79.field2; + CursorTy pvrtmp_6745 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2946, pvrtmp_6742, pvrtmp_6745, tmpcur_6732); + CursorTy pvrtmp_6750 = tmp_struct_80.field0; + CursorTy pvrtmp_6751 = tmp_struct_80.field1; + CursorTy pvrtmp_6752 = tmp_struct_80.field2; + CursorTy pvrtmp_6753 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2945 = 19; + + CursorTy writetag_4731 = loc_2945 + 1; + + *(CursorTy *) writetag_4731 = pvrtmp_6737; + + CursorTy writecur_4732 = writetag_4731 + 8; + + *(CursorTy *) writecur_4732 = pvrtmp_6745; + + CursorTy writecur_4733 = writecur_4732 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6750, pvrtmp_6751, + loc_2945, pvrtmp_6753}; + break; + } + + case 21: + { + CursorTy tmpcur_6762 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6763 = tmpcur_6585 + 8; + CursorTy tmpcur_6764 = *(CursorTy *) tmpaftercur_6763; + CursorTy tmpaftercur_6765 = tmpaftercur_6763 + 8; + CursorTy jump_4022 = tmpaftercur_6763 + 8; + CursorTy jump_4021 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2946, end_r_2947, loc_3301, tmpaftercur_6765); + CursorTy pvrtmp_6766 = tmp_struct_81.field0; + CursorTy pvrtmp_6767 = tmp_struct_81.field1; + CursorTy pvrtmp_6768 = tmp_struct_81.field2; + CursorTy pvrtmp_6769 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2946, pvrtmp_6766, pvrtmp_6769, tmpcur_6762); + CursorTy pvrtmp_6774 = tmp_struct_82.field0; + CursorTy pvrtmp_6775 = tmp_struct_82.field1; + CursorTy pvrtmp_6776 = tmp_struct_82.field2; + CursorTy pvrtmp_6777 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2946, pvrtmp_6774, pvrtmp_6777, tmpcur_6764); + CursorTy pvrtmp_6782 = tmp_struct_83.field0; + CursorTy pvrtmp_6783 = tmp_struct_83.field1; + CursorTy pvrtmp_6784 = tmp_struct_83.field2; + CursorTy pvrtmp_6785 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2945 = 21; + + CursorTy writetag_4744 = loc_2945 + 1; + + *(CursorTy *) writetag_4744 = pvrtmp_6769; + + CursorTy writecur_4745 = writetag_4744 + 8; + + *(CursorTy *) writecur_4745 = pvrtmp_6777; + + CursorTy writecur_4746 = writecur_4745 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6782, pvrtmp_6783, + loc_2945, pvrtmp_6785}; + break; + } + + case 23: + { + CursorTy tmpcur_6794 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6795 = tmpcur_6585 + 8; + CursorTy tmpcur_6796 = *(CursorTy *) tmpaftercur_6795; + CursorTy tmpaftercur_6797 = tmpaftercur_6795 + 8; + CursorTy jump_4028 = tmpaftercur_6795 + 8; + CursorTy jump_4027 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2946, end_r_2947, loc_3327, tmpaftercur_6797); + CursorTy pvrtmp_6798 = tmp_struct_84.field0; + CursorTy pvrtmp_6799 = tmp_struct_84.field1; + CursorTy pvrtmp_6800 = tmp_struct_84.field2; + CursorTy pvrtmp_6801 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2946, pvrtmp_6798, pvrtmp_6801, tmpcur_6794); + CursorTy pvrtmp_6806 = tmp_struct_85.field0; + CursorTy pvrtmp_6807 = tmp_struct_85.field1; + CursorTy pvrtmp_6808 = tmp_struct_85.field2; + CursorTy pvrtmp_6809 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2946, pvrtmp_6806, pvrtmp_6809, tmpcur_6796); + CursorTy pvrtmp_6814 = tmp_struct_86.field0; + CursorTy pvrtmp_6815 = tmp_struct_86.field1; + CursorTy pvrtmp_6816 = tmp_struct_86.field2; + CursorTy pvrtmp_6817 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2945 = 23; + + CursorTy writetag_4757 = loc_2945 + 1; + + *(CursorTy *) writetag_4757 = pvrtmp_6801; + + CursorTy writecur_4758 = writetag_4757 + 8; + + *(CursorTy *) writecur_4758 = pvrtmp_6809; + + CursorTy writecur_4759 = writecur_4758 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6814, pvrtmp_6815, + loc_2945, pvrtmp_6817}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6826 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6827 = tmpcur_6585 + 8; + CursorTy jump_4304 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2946, end_r_2947, loc_2945, tmpcur_6826); + CursorTy pvrtmp_6828 = tmp_struct_87.field0; + CursorTy pvrtmp_6829 = tmp_struct_87.field1; + CursorTy pvrtmp_6830 = tmp_struct_87.field2; + CursorTy pvrtmp_6831 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6828, jump_4304, + pvrtmp_6830, pvrtmp_6831}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6838 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6839 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2946, end_r_2947, loc_2945, tmpcur_6838); + CursorTy pvrtmp_6840 = tmp_struct_88.field0; + CursorTy pvrtmp_6841 = tmp_struct_88.field1; + CursorTy pvrtmp_6842 = tmp_struct_88.field2; + CursorTy pvrtmp_6843 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6840, pvrtmp_6841, + pvrtmp_6842, pvrtmp_6843}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6584"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2950, + CursorTy end_r_2951, + CursorTy loc_2949, + CursorTy arg_715_1320_1641) +{ + TagTyPacked tmpval_6851 = *(TagTyPacked *) arg_715_1320_1641; + CursorTy tmpcur_6852 = arg_715_1320_1641 + 1; + + + switch_7117: + ; + switch (tmpval_6851) { + + case 0: + { + CursorTy jump_4033 = arg_715_1320_1641 + 1; + + *(TagTyPacked *) loc_2949 = 0; + + CursorTy writetag_4771 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2951, jump_4033, + loc_2949, writetag_4771}; + break; + } + + case 9: + { + CursorTy tmpcur_6857 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6858 = tmpcur_6852 + 8; + CursorTy jump_4035 = tmpcur_6852 + 8; + CursorTy loc_3349 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3349, tmpaftercur_6858); + CursorTy pvrtmp_6859 = tmp_struct_92.field0; + CursorTy pvrtmp_6860 = tmp_struct_92.field1; + CursorTy pvrtmp_6861 = tmp_struct_92.field2; + CursorTy pvrtmp_6862 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6859, pvrtmp_6862, tmpcur_6857); + CursorTy pvrtmp_6867 = tmp_struct_93.field0; + CursorTy pvrtmp_6868 = tmp_struct_93.field1; + CursorTy pvrtmp_6869 = tmp_struct_93.field2; + CursorTy pvrtmp_6870 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2949 = 1; + + CursorTy writetag_4777 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6867, pvrtmp_6868, + loc_2949, pvrtmp_6870}; + break; + } + + case 11: + { + CursorTy tmpcur_6879 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6880 = tmpcur_6852 + 8; + CursorTy jump_4039 = tmpcur_6852 + 8; + CursorTy loc_3362 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3362, tmpaftercur_6880); + CursorTy pvrtmp_6881 = tmp_struct_94.field0; + CursorTy pvrtmp_6882 = tmp_struct_94.field1; + CursorTy pvrtmp_6883 = tmp_struct_94.field2; + CursorTy pvrtmp_6884 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6881, pvrtmp_6884, tmpcur_6879); + CursorTy pvrtmp_6889 = tmp_struct_95.field0; + CursorTy pvrtmp_6890 = tmp_struct_95.field1; + CursorTy pvrtmp_6891 = tmp_struct_95.field2; + CursorTy pvrtmp_6892 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2949 = 2; + + CursorTy writetag_4785 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6889, pvrtmp_6890, + loc_2949, pvrtmp_6892}; + break; + } + + case 13: + { + CursorTy tmpcur_6901 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6902 = tmpcur_6852 + 8; + CursorTy tmpcur_6903 = *(CursorTy *) tmpaftercur_6902; + CursorTy tmpaftercur_6904 = tmpaftercur_6902 + 8; + CursorTy jump_4044 = tmpaftercur_6902 + 8; + CursorTy jump_4043 = tmpcur_6852 + 8; + CursorTy loc_3380 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2950, end_r_2951, loc_3380, tmpaftercur_6904); + CursorTy pvrtmp_6905 = tmp_struct_96.field0; + CursorTy pvrtmp_6906 = tmp_struct_96.field1; + CursorTy pvrtmp_6907 = tmp_struct_96.field2; + CursorTy pvrtmp_6908 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6905, pvrtmp_6908, tmpcur_6901); + CursorTy pvrtmp_6913 = tmp_struct_97.field0; + CursorTy pvrtmp_6914 = tmp_struct_97.field1; + CursorTy pvrtmp_6915 = tmp_struct_97.field2; + CursorTy pvrtmp_6916 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6913, pvrtmp_6916, tmpcur_6903); + CursorTy pvrtmp_6921 = tmp_struct_98.field0; + CursorTy pvrtmp_6922 = tmp_struct_98.field1; + CursorTy pvrtmp_6923 = tmp_struct_98.field2; + CursorTy pvrtmp_6924 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2949 = 3; + + CursorTy writetag_4795 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6921, pvrtmp_6922, + loc_2949, pvrtmp_6924}; + break; + } + + case 15: + { + CursorTy tmpcur_6933 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6934 = tmpcur_6852 + 8; + CursorTy tmpcur_6935 = *(CursorTy *) tmpaftercur_6934; + CursorTy tmpaftercur_6936 = tmpaftercur_6934 + 8; + CursorTy jump_4050 = tmpaftercur_6934 + 8; + CursorTy jump_4049 = tmpcur_6852 + 8; + CursorTy loc_3400 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3400, tmpaftercur_6936); + CursorTy pvrtmp_6937 = tmp_struct_99.field0; + CursorTy pvrtmp_6938 = tmp_struct_99.field1; + CursorTy pvrtmp_6939 = tmp_struct_99.field2; + CursorTy pvrtmp_6940 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6937, pvrtmp_6940, tmpcur_6933); + CursorTy pvrtmp_6945 = tmp_struct_100.field0; + CursorTy pvrtmp_6946 = tmp_struct_100.field1; + CursorTy pvrtmp_6947 = tmp_struct_100.field2; + CursorTy pvrtmp_6948 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_6945, pvrtmp_6948, tmpcur_6935); + CursorTy pvrtmp_6953 = tmp_struct_101.field0; + CursorTy pvrtmp_6954 = tmp_struct_101.field1; + CursorTy pvrtmp_6955 = tmp_struct_101.field2; + CursorTy pvrtmp_6956 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2949 = 4; + + CursorTy writetag_4806 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6953, pvrtmp_6954, + loc_2949, pvrtmp_6956}; + break; + } + + case 17: + { + CursorTy tmpcur_6965 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6966 = tmpcur_6852 + 8; + CursorTy tmpcur_6967 = *(CursorTy *) tmpaftercur_6966; + CursorTy tmpaftercur_6968 = tmpaftercur_6966 + 8; + CursorTy jump_4056 = tmpaftercur_6966 + 8; + CursorTy jump_4055 = tmpcur_6852 + 8; + CursorTy loc_3420 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2950, end_r_2951, loc_3420, tmpaftercur_6968); + CursorTy pvrtmp_6969 = tmp_struct_102.field0; + CursorTy pvrtmp_6970 = tmp_struct_102.field1; + CursorTy pvrtmp_6971 = tmp_struct_102.field2; + CursorTy pvrtmp_6972 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6969, pvrtmp_6972, tmpcur_6965); + CursorTy pvrtmp_6977 = tmp_struct_103.field0; + CursorTy pvrtmp_6978 = tmp_struct_103.field1; + CursorTy pvrtmp_6979 = tmp_struct_103.field2; + CursorTy pvrtmp_6980 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6977, pvrtmp_6980, tmpcur_6967); + CursorTy pvrtmp_6985 = tmp_struct_104.field0; + CursorTy pvrtmp_6986 = tmp_struct_104.field1; + CursorTy pvrtmp_6987 = tmp_struct_104.field2; + CursorTy pvrtmp_6988 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2949 = 5; + + CursorTy writetag_4817 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6985, pvrtmp_6986, + loc_2949, pvrtmp_6988}; + break; + } + + case 19: + { + CursorTy tmpcur_6997 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6998 = tmpcur_6852 + 8; + CursorTy tmpcur_6999 = *(CursorTy *) tmpaftercur_6998; + CursorTy tmpaftercur_7000 = tmpaftercur_6998 + 8; + CursorTy jump_4062 = tmpaftercur_6998 + 8; + CursorTy jump_4061 = tmpcur_6852 + 8; + CursorTy loc_3440 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3440, tmpaftercur_7000); + CursorTy pvrtmp_7001 = tmp_struct_105.field0; + CursorTy pvrtmp_7002 = tmp_struct_105.field1; + CursorTy pvrtmp_7003 = tmp_struct_105.field2; + CursorTy pvrtmp_7004 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7001, pvrtmp_7004, tmpcur_6997); + CursorTy pvrtmp_7009 = tmp_struct_106.field0; + CursorTy pvrtmp_7010 = tmp_struct_106.field1; + CursorTy pvrtmp_7011 = tmp_struct_106.field2; + CursorTy pvrtmp_7012 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_7009, pvrtmp_7012, tmpcur_6999); + CursorTy pvrtmp_7017 = tmp_struct_107.field0; + CursorTy pvrtmp_7018 = tmp_struct_107.field1; + CursorTy pvrtmp_7019 = tmp_struct_107.field2; + CursorTy pvrtmp_7020 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2949 = 6; + + CursorTy writetag_4828 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7017, pvrtmp_7018, + loc_2949, pvrtmp_7020}; + break; + } + + case 21: + { + CursorTy tmpcur_7029 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7030 = tmpcur_6852 + 8; + CursorTy tmpcur_7031 = *(CursorTy *) tmpaftercur_7030; + CursorTy tmpaftercur_7032 = tmpaftercur_7030 + 8; + CursorTy jump_4068 = tmpaftercur_7030 + 8; + CursorTy jump_4067 = tmpcur_6852 + 8; + CursorTy loc_3460 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3460, tmpaftercur_7032); + CursorTy pvrtmp_7033 = tmp_struct_108.field0; + CursorTy pvrtmp_7034 = tmp_struct_108.field1; + CursorTy pvrtmp_7035 = tmp_struct_108.field2; + CursorTy pvrtmp_7036 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7033, pvrtmp_7036, tmpcur_7029); + CursorTy pvrtmp_7041 = tmp_struct_109.field0; + CursorTy pvrtmp_7042 = tmp_struct_109.field1; + CursorTy pvrtmp_7043 = tmp_struct_109.field2; + CursorTy pvrtmp_7044 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_7041, pvrtmp_7044, tmpcur_7031); + CursorTy pvrtmp_7049 = tmp_struct_110.field0; + CursorTy pvrtmp_7050 = tmp_struct_110.field1; + CursorTy pvrtmp_7051 = tmp_struct_110.field2; + CursorTy pvrtmp_7052 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2949 = 7; + + CursorTy writetag_4839 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7049, pvrtmp_7050, + loc_2949, pvrtmp_7052}; + break; + } + + case 23: + { + CursorTy tmpcur_7061 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7062 = tmpcur_6852 + 8; + CursorTy tmpcur_7063 = *(CursorTy *) tmpaftercur_7062; + CursorTy tmpaftercur_7064 = tmpaftercur_7062 + 8; + CursorTy jump_4074 = tmpaftercur_7062 + 8; + CursorTy jump_4073 = tmpcur_6852 + 8; + CursorTy loc_3480 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3480, tmpaftercur_7064); + CursorTy pvrtmp_7065 = tmp_struct_111.field0; + CursorTy pvrtmp_7066 = tmp_struct_111.field1; + CursorTy pvrtmp_7067 = tmp_struct_111.field2; + CursorTy pvrtmp_7068 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_7065, pvrtmp_7068, tmpcur_7061); + CursorTy pvrtmp_7073 = tmp_struct_112.field0; + CursorTy pvrtmp_7074 = tmp_struct_112.field1; + CursorTy pvrtmp_7075 = tmp_struct_112.field2; + CursorTy pvrtmp_7076 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7073, pvrtmp_7076, tmpcur_7063); + CursorTy pvrtmp_7081 = tmp_struct_113.field0; + CursorTy pvrtmp_7082 = tmp_struct_113.field1; + CursorTy pvrtmp_7083 = tmp_struct_113.field2; + CursorTy pvrtmp_7084 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2949 = 8; + + CursorTy writetag_4850 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7081, pvrtmp_7082, + loc_2949, pvrtmp_7084}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7093 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7094 = tmpcur_6852 + 8; + CursorTy jump_4310 = tmpcur_6852 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_2949, tmpcur_7093); + CursorTy pvrtmp_7095 = tmp_struct_114.field0; + CursorTy pvrtmp_7096 = tmp_struct_114.field1; + CursorTy pvrtmp_7097 = tmp_struct_114.field2; + CursorTy pvrtmp_7098 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7095, jump_4310, + pvrtmp_7097, pvrtmp_7098}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7105 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7106 = tmpcur_6852 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_2949, tmpcur_7105); + CursorTy pvrtmp_7107 = tmp_struct_115.field0; + CursorTy pvrtmp_7108 = tmp_struct_115.field1; + CursorTy pvrtmp_7109 = tmp_struct_115.field2; + CursorTy pvrtmp_7110 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7107, pvrtmp_7108, + pvrtmp_7109, pvrtmp_7110}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6851"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2953, CursorTy arg_760_1365_1686) +{ + TagTyPacked tmpval_7118 = *(TagTyPacked *) arg_760_1365_1686; + CursorTy tmpcur_7119 = arg_760_1365_1686 + 1; + + + switch_7176: + ; + switch (tmpval_7118) { + + case 0: + { + CursorTy jump_4079 = arg_760_1365_1686 + 1; + + return (CursorProd) {jump_4079}; + break; + } + + case 9: + { + CursorTy tmpcur_7120 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7121 = tmpcur_7119 + 8; + CursorTy jump_4081 = tmpcur_7119 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2953, tmpaftercur_7121); + CursorTy pvrtmp_7122 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2953, tmpcur_7120); + CursorTy pvrtmp_7123 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7123}; + break; + } + + case 11: + { + CursorTy tmpcur_7124 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7125 = tmpcur_7119 + 8; + CursorTy jump_4085 = tmpcur_7119 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2953, tmpaftercur_7125); + CursorTy pvrtmp_7126 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2953, tmpcur_7124); + CursorTy pvrtmp_7127 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7127}; + break; + } + + case 13: + { + CursorTy tmpcur_7128 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7129 = tmpcur_7119 + 8; + CursorTy tmpcur_7130 = *(CursorTy *) tmpaftercur_7129; + CursorTy tmpaftercur_7131 = tmpaftercur_7129 + 8; + CursorTy jump_4090 = tmpaftercur_7129 + 8; + CursorTy jump_4089 = tmpcur_7119 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2953, tmpaftercur_7131); + CursorTy pvrtmp_7132 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2953, tmpcur_7128); + CursorTy pvrtmp_7133 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2953, tmpcur_7130); + CursorTy pvrtmp_7134 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7134}; + break; + } + + case 15: + { + CursorTy tmpcur_7135 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7136 = tmpcur_7119 + 8; + CursorTy tmpcur_7137 = *(CursorTy *) tmpaftercur_7136; + CursorTy tmpaftercur_7138 = tmpaftercur_7136 + 8; + CursorTy jump_4096 = tmpaftercur_7136 + 8; + CursorTy jump_4095 = tmpcur_7119 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2953, tmpaftercur_7138); + CursorTy pvrtmp_7139 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2953, tmpcur_7135); + CursorTy pvrtmp_7140 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2953, tmpcur_7137); + CursorTy pvrtmp_7141 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7141}; + break; + } + + case 17: + { + CursorTy tmpcur_7142 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7143 = tmpcur_7119 + 8; + CursorTy tmpcur_7144 = *(CursorTy *) tmpaftercur_7143; + CursorTy tmpaftercur_7145 = tmpaftercur_7143 + 8; + CursorTy jump_4102 = tmpaftercur_7143 + 8; + CursorTy jump_4101 = tmpcur_7119 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2953, tmpaftercur_7145); + CursorTy pvrtmp_7146 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2953, tmpcur_7142); + CursorTy pvrtmp_7147 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2953, tmpcur_7144); + CursorTy pvrtmp_7148 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7148}; + break; + } + + case 19: + { + CursorTy tmpcur_7149 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7150 = tmpcur_7119 + 8; + CursorTy tmpcur_7151 = *(CursorTy *) tmpaftercur_7150; + CursorTy tmpaftercur_7152 = tmpaftercur_7150 + 8; + CursorTy jump_4108 = tmpaftercur_7150 + 8; + CursorTy jump_4107 = tmpcur_7119 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2953, tmpaftercur_7152); + CursorTy pvrtmp_7153 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2953, tmpcur_7149); + CursorTy pvrtmp_7154 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2953, tmpcur_7151); + CursorTy pvrtmp_7155 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7155}; + break; + } + + case 21: + { + CursorTy tmpcur_7156 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7157 = tmpcur_7119 + 8; + CursorTy tmpcur_7158 = *(CursorTy *) tmpaftercur_7157; + CursorTy tmpaftercur_7159 = tmpaftercur_7157 + 8; + CursorTy jump_4114 = tmpaftercur_7157 + 8; + CursorTy jump_4113 = tmpcur_7119 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2953, tmpaftercur_7159); + CursorTy pvrtmp_7160 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2953, tmpcur_7156); + CursorTy pvrtmp_7161 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2953, tmpcur_7158); + CursorTy pvrtmp_7162 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7162}; + break; + } + + case 23: + { + CursorTy tmpcur_7163 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7164 = tmpcur_7119 + 8; + CursorTy tmpcur_7165 = *(CursorTy *) tmpaftercur_7164; + CursorTy tmpaftercur_7166 = tmpaftercur_7164 + 8; + CursorTy jump_4120 = tmpaftercur_7164 + 8; + CursorTy jump_4119 = tmpcur_7119 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2953, tmpaftercur_7166); + CursorTy pvrtmp_7167 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2953, tmpcur_7163); + CursorTy pvrtmp_7168 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2953, tmpcur_7165); + CursorTy pvrtmp_7169 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7169}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7170 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7171 = tmpcur_7119 + 8; + CursorTy jump_4316 = tmpcur_7119 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2953, tmpcur_7170); + CursorTy pvrtmp_7172 = tmp_struct_138.field0; + + return (CursorProd) {jump_4316}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7173 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7174 = tmpcur_7119 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2953, tmpcur_7173); + CursorTy pvrtmp_7175 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7175}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7118"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2955, CursorTy arg_805_1410_1731) +{ + TagTyPacked tmpval_7177 = *(TagTyPacked *) arg_805_1410_1731; + CursorTy tmpcur_7178 = arg_805_1410_1731 + 1; + + + switch_7235: + ; + switch (tmpval_7177) { + + case 0: + { + CursorTy jump_4125 = arg_805_1410_1731 + 1; + unsigned char wildcard_806_1411_1732 = print_symbol(6135); + unsigned char wildcard_807_1412_1733 = print_symbol(6129); + + return (CursorProd) {jump_4125}; + break; + } + + case 9: + { + CursorTy tmpcur_7179 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7180 = tmpcur_7178 + 8; + CursorTy jump_4127 = tmpcur_7178 + 8; + unsigned char wildcard_812_1415_1736 = print_symbol(6141); + CursorProd tmp_struct_140 = + _print_Content(end_r_2955, tmpaftercur_7180); + CursorTy pvrtmp_7181 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2955, tmpcur_7179); + CursorTy pvrtmp_7182 = tmp_struct_141.field0; + unsigned char wildcard_813_1418_1739 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7182}; + break; + } + + case 11: + { + CursorTy tmpcur_7183 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7184 = tmpcur_7178 + 8; + CursorTy jump_4131 = tmpcur_7178 + 8; + unsigned char wildcard_818_1421_1742 = print_symbol(6144); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2955, tmpaftercur_7184); + CursorTy pvrtmp_7185 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2955, tmpcur_7183); + CursorTy pvrtmp_7186 = tmp_struct_143.field0; + unsigned char wildcard_819_1424_1745 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7186}; + break; + } + + case 13: + { + CursorTy tmpcur_7187 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7188 = tmpcur_7178 + 8; + CursorTy tmpcur_7189 = *(CursorTy *) tmpaftercur_7188; + CursorTy tmpaftercur_7190 = tmpaftercur_7188 + 8; + CursorTy jump_4136 = tmpaftercur_7188 + 8; + CursorTy jump_4135 = tmpcur_7178 + 8; + unsigned char wildcard_826_1428_1749 = print_symbol(6132); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2955, tmpaftercur_7190); + CursorTy pvrtmp_7191 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2955, tmpcur_7187); + CursorTy pvrtmp_7192 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2955, tmpcur_7189); + CursorTy pvrtmp_7193 = tmp_struct_146.field0; + unsigned char wildcard_827_1432_1753 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7193}; + break; + } + + case 15: + { + CursorTy tmpcur_7194 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7195 = tmpcur_7178 + 8; + CursorTy tmpcur_7196 = *(CursorTy *) tmpaftercur_7195; + CursorTy tmpaftercur_7197 = tmpaftercur_7195 + 8; + CursorTy jump_4142 = tmpaftercur_7195 + 8; + CursorTy jump_4141 = tmpcur_7178 + 8; + unsigned char wildcard_834_1436_1757 = print_symbol(6143); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2955, tmpaftercur_7197); + CursorTy pvrtmp_7198 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2955, tmpcur_7194); + CursorTy pvrtmp_7199 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2955, tmpcur_7196); + CursorTy pvrtmp_7200 = tmp_struct_149.field0; + unsigned char wildcard_835_1440_1761 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7200}; + break; + } + + case 17: + { + CursorTy tmpcur_7201 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7202 = tmpcur_7178 + 8; + CursorTy tmpcur_7203 = *(CursorTy *) tmpaftercur_7202; + CursorTy tmpaftercur_7204 = tmpaftercur_7202 + 8; + CursorTy jump_4148 = tmpaftercur_7202 + 8; + CursorTy jump_4147 = tmpcur_7178 + 8; + unsigned char wildcard_842_1444_1765 = print_symbol(6133); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2955, tmpaftercur_7204); + CursorTy pvrtmp_7205 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2955, tmpcur_7201); + CursorTy pvrtmp_7206 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2955, tmpcur_7203); + CursorTy pvrtmp_7207 = tmp_struct_152.field0; + unsigned char wildcard_843_1448_1769 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7207}; + break; + } + + case 19: + { + CursorTy tmpcur_7208 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7209 = tmpcur_7178 + 8; + CursorTy tmpcur_7210 = *(CursorTy *) tmpaftercur_7209; + CursorTy tmpaftercur_7211 = tmpaftercur_7209 + 8; + CursorTy jump_4154 = tmpaftercur_7209 + 8; + CursorTy jump_4153 = tmpcur_7178 + 8; + unsigned char wildcard_850_1452_1773 = print_symbol(6142); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2955, tmpaftercur_7211); + CursorTy pvrtmp_7212 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2955, tmpcur_7208); + CursorTy pvrtmp_7213 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2955, tmpcur_7210); + CursorTy pvrtmp_7214 = tmp_struct_155.field0; + unsigned char wildcard_851_1456_1777 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7214}; + break; + } + + case 21: + { + CursorTy tmpcur_7215 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7216 = tmpcur_7178 + 8; + CursorTy tmpcur_7217 = *(CursorTy *) tmpaftercur_7216; + CursorTy tmpaftercur_7218 = tmpaftercur_7216 + 8; + CursorTy jump_4160 = tmpaftercur_7216 + 8; + CursorTy jump_4159 = tmpcur_7178 + 8; + unsigned char wildcard_858_1460_1781 = print_symbol(6139); + CursorProd tmp_struct_156 = + _print_Content(end_r_2955, tmpaftercur_7218); + CursorTy pvrtmp_7219 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2955, tmpcur_7215); + CursorTy pvrtmp_7220 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2955, tmpcur_7217); + CursorTy pvrtmp_7221 = tmp_struct_158.field0; + unsigned char wildcard_859_1464_1785 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7221}; + break; + } + + case 23: + { + CursorTy tmpcur_7222 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7223 = tmpcur_7178 + 8; + CursorTy tmpcur_7224 = *(CursorTy *) tmpaftercur_7223; + CursorTy tmpaftercur_7225 = tmpaftercur_7223 + 8; + CursorTy jump_4166 = tmpaftercur_7223 + 8; + CursorTy jump_4165 = tmpcur_7178 + 8; + unsigned char wildcard_866_1468_1789 = print_symbol(6140); + CursorProd tmp_struct_159 = + _print_Content(end_r_2955, tmpaftercur_7225); + CursorTy pvrtmp_7226 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2955, tmpcur_7222); + CursorTy pvrtmp_7227 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2955, tmpcur_7224); + CursorTy pvrtmp_7228 = tmp_struct_161.field0; + unsigned char wildcard_867_1472_1793 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7228}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7229 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7230 = tmpcur_7178 + 8; + CursorTy jump_4322 = tmpcur_7178 + 8; + unsigned char wildcard_4325 = print_symbol(6146); + CursorProd tmp_struct_162 = _print_Adt(end_r_2955, tmpcur_7229); + CursorTy pvrtmp_7231 = tmp_struct_162.field0; + + return (CursorProd) {jump_4322}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7232 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7233 = tmpcur_7178 + 8; + unsigned char wildcard_4325 = print_symbol(6145); + CursorProd tmp_struct_163 = _print_Adt(end_r_2955, tmpcur_7232); + CursorTy pvrtmp_7234 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7234}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7177"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2958, + CursorTy end_r_2959, CursorTy loc_2957, + CursorTy arg_868_1473_1794) +{ + if (loc_2957 + 32 > end_r_2959) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2959); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2959 = chunk_end_169; + *(TagTyPacked *) loc_2957 = 255; + + CursorTy redir = loc_2957 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2957 = chunk_start_168; + } + + CursorTy loc_3658 = loc_2957 + 1; + CursorTy loc_3659 = loc_3658 + 8; + TagTyPacked tmpval_7236 = *(TagTyPacked *) arg_868_1473_1794; + CursorTy tmpcur_7237 = arg_868_1473_1794 + 1; + + + switch_7280: + ; + switch (tmpval_7236) { + + case 0: + { + CursorTy jump_4171 = arg_868_1473_1794 + 1; + + *(TagTyPacked *) loc_2957 = 0; + + CursorTy writetag_4964 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2959, jump_4171, + loc_2957, writetag_4964}; + break; + } + + case 1: + { + IntTy tmpval_7242 = *(IntTy *) tmpcur_7237; + CursorTy tmpcur_7243 = tmpcur_7237 + sizeof(IntTy); + CursorTy jump_4173 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2958, end_r_2959, loc_3659, tmpcur_7243); + CursorTy pvrtmp_7244 = tmp_struct_164.field0; + CursorTy pvrtmp_7245 = tmp_struct_164.field1; + CursorTy pvrtmp_7246 = tmp_struct_164.field2; + CursorTy pvrtmp_7247 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2957 = 1; + + CursorTy writetag_4969 = loc_2957 + 1; + + *(IntTy *) writetag_4969 = tmpval_7242; + + CursorTy writecur_4970 = writetag_4969 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7244, pvrtmp_7245, + loc_2957, pvrtmp_7247}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7256 = *(CursorTy *) tmpcur_7237; + CursorTy tmpaftercur_7257 = tmpcur_7237 + 8; + CursorTy jump_4328 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2958, end_r_2959, loc_2957, tmpcur_7256); + CursorTy pvrtmp_7258 = tmp_struct_165.field0; + CursorTy pvrtmp_7259 = tmp_struct_165.field1; + CursorTy pvrtmp_7260 = tmp_struct_165.field2; + CursorTy pvrtmp_7261 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7258, jump_4328, + pvrtmp_7260, pvrtmp_7261}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7268 = *(CursorTy *) tmpcur_7237; + CursorTy tmpaftercur_7269 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2958, end_r_2959, loc_2957, tmpcur_7268); + CursorTy pvrtmp_7270 = tmp_struct_166.field0; + CursorTy pvrtmp_7271 = tmp_struct_166.field1; + CursorTy pvrtmp_7272 = tmp_struct_166.field2; + CursorTy pvrtmp_7273 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7270, pvrtmp_7271, + pvrtmp_7272, pvrtmp_7273}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7236"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2962, + CursorTy end_r_2963, + CursorTy loc_2961, + CursorTy arg_873_1478_1799) +{ + CursorTy loc_3671 = loc_2961 + 1; + CursorTy loc_3672 = loc_3671 + 8; + TagTyPacked tmpval_7281 = *(TagTyPacked *) arg_873_1478_1799; + CursorTy tmpcur_7282 = arg_873_1478_1799 + 1; + + + switch_7325: + ; + switch (tmpval_7281) { + + case 0: + { + CursorTy jump_4176 = arg_873_1478_1799 + 1; + + *(TagTyPacked *) loc_2961 = 0; + + CursorTy writetag_4980 = loc_2961 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2963, jump_4176, + loc_2961, writetag_4980}; + break; + } + + case 1: + { + IntTy tmpval_7287 = *(IntTy *) tmpcur_7282; + CursorTy tmpcur_7288 = tmpcur_7282 + sizeof(IntTy); + CursorTy jump_4178 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_3672, tmpcur_7288); + CursorTy pvrtmp_7289 = tmp_struct_170.field0; + CursorTy pvrtmp_7290 = tmp_struct_170.field1; + CursorTy pvrtmp_7291 = tmp_struct_170.field2; + CursorTy pvrtmp_7292 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2961 = 1; + + CursorTy writetag_4985 = loc_2961 + 1; + + *(IntTy *) writetag_4985 = tmpval_7287; + + CursorTy writecur_4986 = writetag_4985 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7289, pvrtmp_7290, + loc_2961, pvrtmp_7292}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7301 = *(CursorTy *) tmpcur_7282; + CursorTy tmpaftercur_7302 = tmpcur_7282 + 8; + CursorTy jump_4334 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_2961, tmpcur_7301); + CursorTy pvrtmp_7303 = tmp_struct_171.field0; + CursorTy pvrtmp_7304 = tmp_struct_171.field1; + CursorTy pvrtmp_7305 = tmp_struct_171.field2; + CursorTy pvrtmp_7306 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7303, jump_4334, + pvrtmp_7305, pvrtmp_7306}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7313 = *(CursorTy *) tmpcur_7282; + CursorTy tmpaftercur_7314 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_2961, tmpcur_7313); + CursorTy pvrtmp_7315 = tmp_struct_172.field0; + CursorTy pvrtmp_7316 = tmp_struct_172.field1; + CursorTy pvrtmp_7317 = tmp_struct_172.field2; + CursorTy pvrtmp_7318 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7315, pvrtmp_7316, + pvrtmp_7317, pvrtmp_7318}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7281"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2965, CursorTy arg_878_1483_1804) +{ + TagTyPacked tmpval_7326 = *(TagTyPacked *) arg_878_1483_1804; + CursorTy tmpcur_7327 = arg_878_1483_1804 + 1; + + + switch_7337: + ; + switch (tmpval_7326) { + + case 0: + { + CursorTy jump_4181 = arg_878_1483_1804 + 1; + + return (CursorProd) {jump_4181}; + break; + } + + case 1: + { + IntTy tmpval_7328 = *(IntTy *) tmpcur_7327; + CursorTy tmpcur_7329 = tmpcur_7327 + sizeof(IntTy); + CursorTy jump_4183 = tmpcur_7327 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2965, tmpcur_7329); + CursorTy pvrtmp_7330 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7330}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7331 = *(CursorTy *) tmpcur_7327; + CursorTy tmpaftercur_7332 = tmpcur_7327 + 8; + CursorTy jump_4340 = tmpcur_7327 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2965, tmpcur_7331); + CursorTy pvrtmp_7333 = tmp_struct_174.field0; + + return (CursorProd) {jump_4340}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7334 = *(CursorTy *) tmpcur_7327; + CursorTy tmpaftercur_7335 = tmpcur_7327 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2965, tmpcur_7334); + CursorTy pvrtmp_7336 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7336}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7326"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2967, CursorTy arg_883_1487_1808) +{ + TagTyPacked tmpval_7338 = *(TagTyPacked *) arg_883_1487_1808; + CursorTy tmpcur_7339 = arg_883_1487_1808 + 1; + + + switch_7349: + ; + switch (tmpval_7338) { + + case 0: + { + CursorTy jump_4186 = arg_883_1487_1808 + 1; + unsigned char wildcard_884_1488_1809 = print_symbol(6134); + unsigned char wildcard_885_1489_1810 = print_symbol(6129); + + return (CursorProd) {jump_4186}; + break; + } + + case 1: + { + IntTy tmpval_7340 = *(IntTy *) tmpcur_7339; + CursorTy tmpcur_7341 = tmpcur_7339 + sizeof(IntTy); + CursorTy jump_4188 = tmpcur_7339 + 8; + unsigned char wildcard_890_1492_1813 = print_symbol(6131); + unsigned char y_888_1493_1814 = printf("%lld", tmpval_7340); + CursorProd tmp_struct_176 = _print_Tags(end_r_2967, tmpcur_7341); + CursorTy pvrtmp_7342 = tmp_struct_176.field0; + unsigned char wildcard_891_1495_1816 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7342}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7343 = *(CursorTy *) tmpcur_7339; + CursorTy tmpaftercur_7344 = tmpcur_7339 + 8; + CursorTy jump_4346 = tmpcur_7339 + 8; + unsigned char wildcard_4349 = print_symbol(6146); + CursorProd tmp_struct_177 = _print_Tags(end_r_2967, tmpcur_7343); + CursorTy pvrtmp_7345 = tmp_struct_177.field0; + + return (CursorProd) {jump_4346}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7346 = *(CursorTy *) tmpcur_7339; + CursorTy tmpaftercur_7347 = tmpcur_7339 + 8; + unsigned char wildcard_4349 = print_symbol(6145); + CursorProd tmp_struct_178 = _print_Tags(end_r_2967, tmpcur_7346); + CursorTy pvrtmp_7348 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7348}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7338"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_2702) +{ + if (loc_2969 + 32 > end_r_2971) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2971); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2971 = chunk_end_184; + *(TagTyPacked *) loc_2969 = 255; + + CursorTy redir = loc_2969 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2969 = chunk_start_183; + } + + CursorTy loc_3696 = loc_2969 + 1; + CursorTy loc_3697 = loc_3696 + 8; + TagTyPacked tmpval_7350 = *(TagTyPacked *) arg_2702; + CursorTy tmpcur_7351 = arg_2702 + 1; + + + switch_7394: + ; + switch (tmpval_7350) { + + case 0: + { + CursorTy jump_4191 = arg_2702 + 1; + + *(TagTyPacked *) loc_2969 = 0; + + CursorTy writetag_5016 = loc_2969 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2971, jump_4191, + loc_2969, writetag_5016}; + break; + } + + case 1: + { + IntTy tmpval_7356 = *(IntTy *) tmpcur_7351; + CursorTy tmpcur_7357 = tmpcur_7351 + sizeof(IntTy); + CursorTy jump_4193 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_3697, tmpcur_7357); + CursorTy pvrtmp_7358 = tmp_struct_179.field0; + CursorTy pvrtmp_7359 = tmp_struct_179.field1; + CursorTy pvrtmp_7360 = tmp_struct_179.field2; + CursorTy pvrtmp_7361 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2969 = 1; + + CursorTy writetag_5021 = loc_2969 + 1; + + *(IntTy *) writetag_5021 = tmpval_7356; + + CursorTy writecur_5022 = writetag_5021 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7358, pvrtmp_7359, + loc_2969, pvrtmp_7361}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7370 = *(CursorTy *) tmpcur_7351; + CursorTy tmpaftercur_7371 = tmpcur_7351 + 8; + CursorTy jump_4352 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_2969, tmpcur_7370); + CursorTy pvrtmp_7372 = tmp_struct_180.field0; + CursorTy pvrtmp_7373 = tmp_struct_180.field1; + CursorTy pvrtmp_7374 = tmp_struct_180.field2; + CursorTy pvrtmp_7375 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7372, jump_4352, + pvrtmp_7374, pvrtmp_7375}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7382 = *(CursorTy *) tmpcur_7351; + CursorTy tmpaftercur_7383 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_2969, tmpcur_7382); + CursorTy pvrtmp_7384 = tmp_struct_181.field0; + CursorTy pvrtmp_7385 = tmp_struct_181.field1; + CursorTy pvrtmp_7386 = tmp_struct_181.field2; + CursorTy pvrtmp_7387 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7384, pvrtmp_7385, + pvrtmp_7386, pvrtmp_7387}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7350"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2974, + CursorTy end_r_2975, + CursorTy loc_2973, + CursorTy arg_2707) +{ + if (loc_2973 + 32 > end_r_2975) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2975); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2975 = chunk_end_191; + *(TagTyPacked *) loc_2973 = 255; + + CursorTy redir = loc_2973 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2973 = chunk_start_190; + } + + TagTyPacked tmpval_7395 = *(TagTyPacked *) arg_2707; + CursorTy tmpcur_7396 = arg_2707 + 1; + + + switch_7445: + ; + switch (tmpval_7395) { + + case 0: + { + CursorTy loc_3707 = loc_2973 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2974, end_r_2975, loc_3707, tmpcur_7396); + CursorTy pvrtmp_7397 = tmp_struct_185.field0; + CursorTy pvrtmp_7398 = tmp_struct_185.field1; + CursorTy pvrtmp_7399 = tmp_struct_185.field2; + CursorTy pvrtmp_7400 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2973 = 0; + + CursorTy writetag_5033 = loc_2973 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7397, pvrtmp_7398, + loc_2973, pvrtmp_7400}; + break; + } + + case 1: + { + CursorTy loc_3713 = loc_2973 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2974, end_r_2975, loc_3713, tmpcur_7396); + CursorTy pvrtmp_7409 = tmp_struct_186.field0; + CursorTy pvrtmp_7410 = tmp_struct_186.field1; + CursorTy pvrtmp_7411 = tmp_struct_186.field2; + CursorTy pvrtmp_7412 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2973 = 1; + + CursorTy writetag_5038 = loc_2973 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7409, pvrtmp_7410, + loc_2973, pvrtmp_7412}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7421 = *(CursorTy *) tmpcur_7396; + CursorTy tmpaftercur_7422 = tmpcur_7396 + 8; + CursorTy jump_4358 = tmpcur_7396 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2974, end_r_2975, loc_2973, tmpcur_7421); + CursorTy pvrtmp_7423 = tmp_struct_187.field0; + CursorTy pvrtmp_7424 = tmp_struct_187.field1; + CursorTy pvrtmp_7425 = tmp_struct_187.field2; + CursorTy pvrtmp_7426 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7423, jump_4358, + pvrtmp_7425, pvrtmp_7426}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7433 = *(CursorTy *) tmpcur_7396; + CursorTy tmpaftercur_7434 = tmpcur_7396 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2974, end_r_2975, loc_2973, tmpcur_7433); + CursorTy pvrtmp_7435 = tmp_struct_188.field0; + CursorTy pvrtmp_7436 = tmp_struct_188.field1; + CursorTy pvrtmp_7437 = tmp_struct_188.field2; + CursorTy pvrtmp_7438 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7435, pvrtmp_7436, + pvrtmp_7437, pvrtmp_7438}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7395"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2712) +{ + if (loc_2977 + 32 > end_r_2979) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2979); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2979 = chunk_end_218; + *(TagTyPacked *) loc_2977 = 255; + + CursorTy redir = loc_2977 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2977 = chunk_start_217; + } + + CursorTy loc_3726 = loc_2977 + 1; + CursorTy loc_3727 = loc_3726 + 8; + CursorTy loc_3728 = loc_3727 + 8; + CursorTy loc_3744 = loc_2977 + 1; + CursorTy loc_3745 = loc_3744 + 8; + CursorTy loc_3746 = loc_3745 + 8; + CursorTy loc_3766 = loc_2977 + 1; + CursorTy loc_3767 = loc_3766 + 8; + CursorTy loc_3768 = loc_3767 + 8; + CursorTy loc_3769 = loc_3768 + 8; + CursorTy loc_3793 = loc_2977 + 1; + CursorTy loc_3794 = loc_3793 + 8; + CursorTy loc_3795 = loc_3794 + 8; + CursorTy loc_3796 = loc_3795 + 8; + CursorTy loc_3820 = loc_2977 + 1; + CursorTy loc_3821 = loc_3820 + 8; + CursorTy loc_3822 = loc_3821 + 8; + CursorTy loc_3823 = loc_3822 + 8; + CursorTy loc_3847 = loc_2977 + 1; + CursorTy loc_3848 = loc_3847 + 8; + CursorTy loc_3849 = loc_3848 + 8; + CursorTy loc_3850 = loc_3849 + 8; + CursorTy loc_3874 = loc_2977 + 1; + CursorTy loc_3875 = loc_3874 + 8; + CursorTy loc_3876 = loc_3875 + 8; + CursorTy loc_3877 = loc_3876 + 8; + CursorTy loc_3901 = loc_2977 + 1; + CursorTy loc_3902 = loc_3901 + 8; + CursorTy loc_3903 = loc_3902 + 8; + CursorTy loc_3904 = loc_3903 + 8; + TagTyPacked tmpval_7446 = *(TagTyPacked *) arg_2712; + CursorTy tmpcur_7447 = arg_2712 + 1; + + + switch_7684: + ; + switch (tmpval_7446) { + + case 0: + { + CursorTy jump_4200 = arg_2712 + 1; + + *(TagTyPacked *) loc_2977 = 0; + + CursorTy writetag_5048 = loc_2977 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2979, jump_4200, + loc_2977, writetag_5048}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3728, tmpcur_7447); + CursorTy pvrtmp_7452 = tmp_struct_192.field0; + CursorTy pvrtmp_7453 = tmp_struct_192.field1; + CursorTy pvrtmp_7454 = tmp_struct_192.field2; + CursorTy pvrtmp_7455 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7452, pvrtmp_7455, pvrtmp_7453); + CursorTy pvrtmp_7460 = tmp_struct_193.field0; + CursorTy pvrtmp_7461 = tmp_struct_193.field1; + CursorTy pvrtmp_7462 = tmp_struct_193.field2; + CursorTy pvrtmp_7463 = tmp_struct_193.field3; + IntTy sizeof_y_2715__2717 = pvrtmp_7455 - pvrtmp_7454; + IntTy sizeof_y_2716__2718 = pvrtmp_7463 - pvrtmp_7462; + IntTy fltPrm_2806 = sizeof_y_2715__2717 + 0; + IntTy offset__2719 = 0 + fltPrm_2806; + IntTy fltPrm_2807 = sizeof_y_2715__2717 + sizeof_y_2716__2718; + IntTy size_dcon_2720 = 9 + fltPrm_2807; + + *(TagTyPacked *) loc_2977 = 160; + + CursorTy writetag_5053 = loc_2977 + 1; + + *(IntTy *) writetag_5053 = size_dcon_2720; + + CursorTy writecur_5054 = writetag_5053 + sizeof(IntTy); + + *(IntTy *) writecur_5054 = offset__2719; + + CursorTy writecur_5055 = writecur_5054 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7460, pvrtmp_7461, + loc_2977, pvrtmp_7463}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3746, tmpcur_7447); + CursorTy pvrtmp_7472 = tmp_struct_194.field0; + CursorTy pvrtmp_7473 = tmp_struct_194.field1; + CursorTy pvrtmp_7474 = tmp_struct_194.field2; + CursorTy pvrtmp_7475 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7472, pvrtmp_7475, pvrtmp_7473); + CursorTy pvrtmp_7480 = tmp_struct_195.field0; + CursorTy pvrtmp_7481 = tmp_struct_195.field1; + CursorTy pvrtmp_7482 = tmp_struct_195.field2; + CursorTy pvrtmp_7483 = tmp_struct_195.field3; + IntTy sizeof_y_2723__2725 = pvrtmp_7475 - pvrtmp_7474; + IntTy sizeof_y_2724__2726 = pvrtmp_7483 - pvrtmp_7482; + IntTy fltPrm_2808 = sizeof_y_2723__2725 + 0; + IntTy offset__2727 = 0 + fltPrm_2808; + IntTy fltPrm_2809 = sizeof_y_2723__2725 + sizeof_y_2724__2726; + IntTy size_dcon_2728 = 9 + fltPrm_2809; + + *(TagTyPacked *) loc_2977 = 162; + + CursorTy writetag_5062 = loc_2977 + 1; + + *(IntTy *) writetag_5062 = size_dcon_2728; + + CursorTy writecur_5063 = writetag_5062 + sizeof(IntTy); + + *(IntTy *) writecur_5063 = offset__2727; + + CursorTy writecur_5064 = writecur_5063 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7480, pvrtmp_7481, + loc_2977, pvrtmp_7483}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2978, end_r_2979, loc_3769, tmpcur_7447); + CursorTy pvrtmp_7492 = tmp_struct_196.field0; + CursorTy pvrtmp_7493 = tmp_struct_196.field1; + CursorTy pvrtmp_7494 = tmp_struct_196.field2; + CursorTy pvrtmp_7495 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7492, pvrtmp_7495, pvrtmp_7493); + CursorTy pvrtmp_7500 = tmp_struct_197.field0; + CursorTy pvrtmp_7501 = tmp_struct_197.field1; + CursorTy pvrtmp_7502 = tmp_struct_197.field2; + CursorTy pvrtmp_7503 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7500, pvrtmp_7503, pvrtmp_7501); + CursorTy pvrtmp_7508 = tmp_struct_198.field0; + CursorTy pvrtmp_7509 = tmp_struct_198.field1; + CursorTy pvrtmp_7510 = tmp_struct_198.field2; + CursorTy pvrtmp_7511 = tmp_struct_198.field3; + IntTy sizeof_y_2732__2735 = pvrtmp_7495 - pvrtmp_7494; + IntTy sizeof_y_2733__2736 = pvrtmp_7503 - pvrtmp_7502; + IntTy sizeof_y_2734__2737 = pvrtmp_7511 - pvrtmp_7510; + IntTy fltPrm_2810 = sizeof_y_2732__2735 + 0; + IntTy offset__2738 = 8 + fltPrm_2810; + IntTy fltPrm_2811 = sizeof_y_2732__2735 + sizeof_y_2733__2736; + IntTy offset__2739 = 0 + fltPrm_2811; + IntTy fltPrm_2813 = sizeof_y_2733__2736 + sizeof_y_2734__2737; + IntTy fltPrm_2812 = sizeof_y_2732__2735 + fltPrm_2813; + IntTy size_dcon_2740 = 17 + fltPrm_2812; + + *(TagTyPacked *) loc_2977 = 164; + + CursorTy writetag_5072 = loc_2977 + 1; + + *(IntTy *) writetag_5072 = size_dcon_2740; + + CursorTy writecur_5073 = writetag_5072 + sizeof(IntTy); + + *(IntTy *) writecur_5073 = offset__2738; + + CursorTy writecur_5074 = writecur_5073 + sizeof(IntTy); + + *(IntTy *) writecur_5074 = offset__2739; + + CursorTy writecur_5075 = writecur_5074 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7508, pvrtmp_7509, + loc_2977, pvrtmp_7511}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3796, tmpcur_7447); + CursorTy pvrtmp_7520 = tmp_struct_199.field0; + CursorTy pvrtmp_7521 = tmp_struct_199.field1; + CursorTy pvrtmp_7522 = tmp_struct_199.field2; + CursorTy pvrtmp_7523 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7520, pvrtmp_7523, pvrtmp_7521); + CursorTy pvrtmp_7528 = tmp_struct_200.field0; + CursorTy pvrtmp_7529 = tmp_struct_200.field1; + CursorTy pvrtmp_7530 = tmp_struct_200.field2; + CursorTy pvrtmp_7531 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7528, pvrtmp_7531, pvrtmp_7529); + CursorTy pvrtmp_7536 = tmp_struct_201.field0; + CursorTy pvrtmp_7537 = tmp_struct_201.field1; + CursorTy pvrtmp_7538 = tmp_struct_201.field2; + CursorTy pvrtmp_7539 = tmp_struct_201.field3; + IntTy sizeof_y_2744__2747 = pvrtmp_7523 - pvrtmp_7522; + IntTy sizeof_y_2745__2748 = pvrtmp_7531 - pvrtmp_7530; + IntTy sizeof_y_2746__2749 = pvrtmp_7539 - pvrtmp_7538; + IntTy fltPrm_2814 = sizeof_y_2744__2747 + 0; + IntTy offset__2750 = 8 + fltPrm_2814; + IntTy fltPrm_2815 = sizeof_y_2744__2747 + sizeof_y_2745__2748; + IntTy offset__2751 = 0 + fltPrm_2815; + IntTy fltPrm_2817 = sizeof_y_2745__2748 + sizeof_y_2746__2749; + IntTy fltPrm_2816 = sizeof_y_2744__2747 + fltPrm_2817; + IntTy size_dcon_2752 = 17 + fltPrm_2816; + + *(TagTyPacked *) loc_2977 = 166; + + CursorTy writetag_5084 = loc_2977 + 1; + + *(IntTy *) writetag_5084 = size_dcon_2752; + + CursorTy writecur_5085 = writetag_5084 + sizeof(IntTy); + + *(IntTy *) writecur_5085 = offset__2750; + + CursorTy writecur_5086 = writecur_5085 + sizeof(IntTy); + + *(IntTy *) writecur_5086 = offset__2751; + + CursorTy writecur_5087 = writecur_5086 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7536, pvrtmp_7537, + loc_2977, pvrtmp_7539}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2978, end_r_2979, loc_3823, tmpcur_7447); + CursorTy pvrtmp_7548 = tmp_struct_202.field0; + CursorTy pvrtmp_7549 = tmp_struct_202.field1; + CursorTy pvrtmp_7550 = tmp_struct_202.field2; + CursorTy pvrtmp_7551 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7548, pvrtmp_7551, pvrtmp_7549); + CursorTy pvrtmp_7556 = tmp_struct_203.field0; + CursorTy pvrtmp_7557 = tmp_struct_203.field1; + CursorTy pvrtmp_7558 = tmp_struct_203.field2; + CursorTy pvrtmp_7559 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7556, pvrtmp_7559, pvrtmp_7557); + CursorTy pvrtmp_7564 = tmp_struct_204.field0; + CursorTy pvrtmp_7565 = tmp_struct_204.field1; + CursorTy pvrtmp_7566 = tmp_struct_204.field2; + CursorTy pvrtmp_7567 = tmp_struct_204.field3; + IntTy sizeof_y_2756__2759 = pvrtmp_7551 - pvrtmp_7550; + IntTy sizeof_y_2757__2760 = pvrtmp_7559 - pvrtmp_7558; + IntTy sizeof_y_2758__2761 = pvrtmp_7567 - pvrtmp_7566; + IntTy fltPrm_2818 = sizeof_y_2756__2759 + 0; + IntTy offset__2762 = 8 + fltPrm_2818; + IntTy fltPrm_2819 = sizeof_y_2756__2759 + sizeof_y_2757__2760; + IntTy offset__2763 = 0 + fltPrm_2819; + IntTy fltPrm_2821 = sizeof_y_2757__2760 + sizeof_y_2758__2761; + IntTy fltPrm_2820 = sizeof_y_2756__2759 + fltPrm_2821; + IntTy size_dcon_2764 = 17 + fltPrm_2820; + + *(TagTyPacked *) loc_2977 = 168; + + CursorTy writetag_5096 = loc_2977 + 1; + + *(IntTy *) writetag_5096 = size_dcon_2764; + + CursorTy writecur_5097 = writetag_5096 + sizeof(IntTy); + + *(IntTy *) writecur_5097 = offset__2762; + + CursorTy writecur_5098 = writecur_5097 + sizeof(IntTy); + + *(IntTy *) writecur_5098 = offset__2763; + + CursorTy writecur_5099 = writecur_5098 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7564, pvrtmp_7565, + loc_2977, pvrtmp_7567}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3850, tmpcur_7447); + CursorTy pvrtmp_7576 = tmp_struct_205.field0; + CursorTy pvrtmp_7577 = tmp_struct_205.field1; + CursorTy pvrtmp_7578 = tmp_struct_205.field2; + CursorTy pvrtmp_7579 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7576, pvrtmp_7579, pvrtmp_7577); + CursorTy pvrtmp_7584 = tmp_struct_206.field0; + CursorTy pvrtmp_7585 = tmp_struct_206.field1; + CursorTy pvrtmp_7586 = tmp_struct_206.field2; + CursorTy pvrtmp_7587 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7584, pvrtmp_7587, pvrtmp_7585); + CursorTy pvrtmp_7592 = tmp_struct_207.field0; + CursorTy pvrtmp_7593 = tmp_struct_207.field1; + CursorTy pvrtmp_7594 = tmp_struct_207.field2; + CursorTy pvrtmp_7595 = tmp_struct_207.field3; + IntTy sizeof_y_2768__2771 = pvrtmp_7579 - pvrtmp_7578; + IntTy sizeof_y_2769__2772 = pvrtmp_7587 - pvrtmp_7586; + IntTy sizeof_y_2770__2773 = pvrtmp_7595 - pvrtmp_7594; + IntTy fltPrm_2822 = sizeof_y_2768__2771 + 0; + IntTy offset__2774 = 8 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2768__2771 + sizeof_y_2769__2772; + IntTy offset__2775 = 0 + fltPrm_2823; + IntTy fltPrm_2825 = sizeof_y_2769__2772 + sizeof_y_2770__2773; + IntTy fltPrm_2824 = sizeof_y_2768__2771 + fltPrm_2825; + IntTy size_dcon_2776 = 17 + fltPrm_2824; + + *(TagTyPacked *) loc_2977 = 170; + + CursorTy writetag_5108 = loc_2977 + 1; + + *(IntTy *) writetag_5108 = size_dcon_2776; + + CursorTy writecur_5109 = writetag_5108 + sizeof(IntTy); + + *(IntTy *) writecur_5109 = offset__2774; + + CursorTy writecur_5110 = writecur_5109 + sizeof(IntTy); + + *(IntTy *) writecur_5110 = offset__2775; + + CursorTy writecur_5111 = writecur_5110 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7592, pvrtmp_7593, + loc_2977, pvrtmp_7595}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3877, tmpcur_7447); + CursorTy pvrtmp_7604 = tmp_struct_208.field0; + CursorTy pvrtmp_7605 = tmp_struct_208.field1; + CursorTy pvrtmp_7606 = tmp_struct_208.field2; + CursorTy pvrtmp_7607 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7604, pvrtmp_7607, pvrtmp_7605); + CursorTy pvrtmp_7612 = tmp_struct_209.field0; + CursorTy pvrtmp_7613 = tmp_struct_209.field1; + CursorTy pvrtmp_7614 = tmp_struct_209.field2; + CursorTy pvrtmp_7615 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7612, pvrtmp_7615, pvrtmp_7613); + CursorTy pvrtmp_7620 = tmp_struct_210.field0; + CursorTy pvrtmp_7621 = tmp_struct_210.field1; + CursorTy pvrtmp_7622 = tmp_struct_210.field2; + CursorTy pvrtmp_7623 = tmp_struct_210.field3; + IntTy sizeof_y_2780__2783 = pvrtmp_7607 - pvrtmp_7606; + IntTy sizeof_y_2781__2784 = pvrtmp_7615 - pvrtmp_7614; + IntTy sizeof_y_2782__2785 = pvrtmp_7623 - pvrtmp_7622; + IntTy fltPrm_2826 = sizeof_y_2780__2783 + 0; + IntTy offset__2786 = 8 + fltPrm_2826; + IntTy fltPrm_2827 = sizeof_y_2780__2783 + sizeof_y_2781__2784; + IntTy offset__2787 = 0 + fltPrm_2827; + IntTy fltPrm_2829 = sizeof_y_2781__2784 + sizeof_y_2782__2785; + IntTy fltPrm_2828 = sizeof_y_2780__2783 + fltPrm_2829; + IntTy size_dcon_2788 = 17 + fltPrm_2828; + + *(TagTyPacked *) loc_2977 = 172; + + CursorTy writetag_5120 = loc_2977 + 1; + + *(IntTy *) writetag_5120 = size_dcon_2788; + + CursorTy writecur_5121 = writetag_5120 + sizeof(IntTy); + + *(IntTy *) writecur_5121 = offset__2786; + + CursorTy writecur_5122 = writecur_5121 + sizeof(IntTy); + + *(IntTy *) writecur_5122 = offset__2787; + + CursorTy writecur_5123 = writecur_5122 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7620, pvrtmp_7621, + loc_2977, pvrtmp_7623}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3904, tmpcur_7447); + CursorTy pvrtmp_7632 = tmp_struct_211.field0; + CursorTy pvrtmp_7633 = tmp_struct_211.field1; + CursorTy pvrtmp_7634 = tmp_struct_211.field2; + CursorTy pvrtmp_7635 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7632, pvrtmp_7635, pvrtmp_7633); + CursorTy pvrtmp_7640 = tmp_struct_212.field0; + CursorTy pvrtmp_7641 = tmp_struct_212.field1; + CursorTy pvrtmp_7642 = tmp_struct_212.field2; + CursorTy pvrtmp_7643 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7640, pvrtmp_7643, pvrtmp_7641); + CursorTy pvrtmp_7648 = tmp_struct_213.field0; + CursorTy pvrtmp_7649 = tmp_struct_213.field1; + CursorTy pvrtmp_7650 = tmp_struct_213.field2; + CursorTy pvrtmp_7651 = tmp_struct_213.field3; + IntTy sizeof_y_2792__2795 = pvrtmp_7635 - pvrtmp_7634; + IntTy sizeof_y_2793__2796 = pvrtmp_7643 - pvrtmp_7642; + IntTy sizeof_y_2794__2797 = pvrtmp_7651 - pvrtmp_7650; + IntTy fltPrm_2830 = sizeof_y_2792__2795 + 0; + IntTy offset__2798 = 8 + fltPrm_2830; + IntTy fltPrm_2831 = sizeof_y_2792__2795 + sizeof_y_2793__2796; + IntTy offset__2799 = 0 + fltPrm_2831; + IntTy fltPrm_2833 = sizeof_y_2793__2796 + sizeof_y_2794__2797; + IntTy fltPrm_2832 = sizeof_y_2792__2795 + fltPrm_2833; + IntTy size_dcon_2800 = 17 + fltPrm_2832; + + *(TagTyPacked *) loc_2977 = 174; + + CursorTy writetag_5132 = loc_2977 + 1; + + *(IntTy *) writetag_5132 = size_dcon_2800; + + CursorTy writecur_5133 = writetag_5132 + sizeof(IntTy); + + *(IntTy *) writecur_5133 = offset__2798; + + CursorTy writecur_5134 = writecur_5133 + sizeof(IntTy); + + *(IntTy *) writecur_5134 = offset__2799; + + CursorTy writecur_5135 = writecur_5134 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7648, pvrtmp_7649, + loc_2977, pvrtmp_7651}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7660 = *(CursorTy *) tmpcur_7447; + CursorTy tmpaftercur_7661 = tmpcur_7447 + 8; + CursorTy jump_4364 = tmpcur_7447 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_2977, tmpcur_7660); + CursorTy pvrtmp_7662 = tmp_struct_214.field0; + CursorTy pvrtmp_7663 = tmp_struct_214.field1; + CursorTy pvrtmp_7664 = tmp_struct_214.field2; + CursorTy pvrtmp_7665 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7662, jump_4364, + pvrtmp_7664, pvrtmp_7665}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7672 = *(CursorTy *) tmpcur_7447; + CursorTy tmpaftercur_7673 = tmpcur_7447 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_2977, tmpcur_7672); + CursorTy pvrtmp_7674 = tmp_struct_215.field0; + CursorTy pvrtmp_7675 = tmp_struct_215.field1; + CursorTy pvrtmp_7676 = tmp_struct_215.field2; + CursorTy pvrtmp_7677 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7674, pvrtmp_7675, + pvrtmp_7676, pvrtmp_7677}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7446"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2801) +{ + if (loc_2981 + 32 > end_r_2983) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2983); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2983 = chunk_end_224; + *(TagTyPacked *) loc_2981 = 255; + + CursorTy redir = loc_2981 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2981 = chunk_start_223; + } + + CursorTy loc_3924 = loc_2981 + 1; + CursorTy loc_3925 = loc_3924 + 8; + TagTyPacked tmpval_7685 = *(TagTyPacked *) arg_2801; + CursorTy tmpcur_7686 = arg_2801 + 1; + + + switch_7729: + ; + switch (tmpval_7685) { + + case 0: + { + CursorTy jump_4232 = arg_2801 + 1; + + *(TagTyPacked *) loc_2981 = 0; + + CursorTy writetag_5147 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2983, jump_4232, + loc_2981, writetag_5147}; + break; + } + + case 1: + { + IntTy tmpval_7691 = *(IntTy *) tmpcur_7686; + CursorTy tmpcur_7692 = tmpcur_7686 + sizeof(IntTy); + CursorTy jump_4234 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_3925, tmpcur_7692); + CursorTy pvrtmp_7693 = tmp_struct_219.field0; + CursorTy pvrtmp_7694 = tmp_struct_219.field1; + CursorTy pvrtmp_7695 = tmp_struct_219.field2; + CursorTy pvrtmp_7696 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2981 = 1; + + CursorTy writetag_5152 = loc_2981 + 1; + + *(IntTy *) writetag_5152 = tmpval_7691; + + CursorTy writecur_5153 = writetag_5152 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7693, pvrtmp_7694, + loc_2981, pvrtmp_7696}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7705 = *(CursorTy *) tmpcur_7686; + CursorTy tmpaftercur_7706 = tmpcur_7686 + 8; + CursorTy jump_4370 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_2981, tmpcur_7705); + CursorTy pvrtmp_7707 = tmp_struct_220.field0; + CursorTy pvrtmp_7708 = tmp_struct_220.field1; + CursorTy pvrtmp_7709 = tmp_struct_220.field2; + CursorTy pvrtmp_7710 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7707, jump_4370, + pvrtmp_7709, pvrtmp_7710}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7717 = *(CursorTy *) tmpcur_7686; + CursorTy tmpaftercur_7718 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_2981, tmpcur_7717); + CursorTy pvrtmp_7719 = tmp_struct_221.field0; + CursorTy pvrtmp_7720 = tmp_struct_221.field1; + CursorTy pvrtmp_7721 = tmp_struct_221.field2; + CursorTy pvrtmp_7722 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7719, pvrtmp_7720, + pvrtmp_7721, pvrtmp_7722}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7685"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6129, ")"); + add_symbol(6130, "(Text "); + add_symbol(6131, "(Tag "); + add_symbol(6132, "(TCA "); + add_symbol(6133, "(TAC "); + add_symbol(6134, "(Nul "); + add_symbol(6135, "(Nil "); + add_symbol(6136, "(Image "); + add_symbol(6137, "(End "); + add_symbol(6138, "(Char "); + add_symbol(6139, "(CTA "); + add_symbol(6140, "(CAT "); + add_symbol(6141, "(CA "); + add_symbol(6142, "(ATC "); + add_symbol(6143, "(ACT "); + add_symbol(6144, "(AC "); + add_symbol(6145, " ->r "); + add_symbol(6146, " ->i "); + + RegionTy *region_6147 = alloc_region(global_init_inf_buf_size); + CursorTy r_2993 = region_6147->reg_heap; + IntTy sizeof_end_r_2993_6148 = global_init_inf_buf_size; + CursorTy end_r_2993 = r_2993 + sizeof_end_r_2993_6148; + RegionTy *region_6149 = alloc_region(global_init_inf_buf_size); + CursorTy r_2992 = region_6149->reg_heap; + IntTy sizeof_end_r_2992_6150 = global_init_inf_buf_size; + CursorTy end_r_2992 = r_2992 + sizeof_end_r_2992_6150; + CursorCursorCursorProd tmp_struct_225 = + mkCATList(end_r_2993, r_2993, 100000, 10, 2000); + CursorTy pvrtmp_6151 = tmp_struct_225.field0; + CursorTy pvrtmp_6152 = tmp_struct_225.field1; + CursorTy pvrtmp_6153 = tmp_struct_225.field2; + CursorTy pvrtmp_6167; + CursorTy pvrtmp_6168; + CursorTy pvrtmp_6169; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6167; + struct timespec end_pvrtmp_6167; + + start_counters(); + for (long long iters_pvrtmp_6167 = 0; iters_pvrtmp_6167 < + global_iters_param; iters_pvrtmp_6167++) { + if (iters_pvrtmp_6167 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6167); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6151, end_r_2992, r_2992, pvrtmp_6152); + CursorTy pvrtmp_6158 = tmp_struct_226.field0; + CursorTy pvrtmp_6159 = tmp_struct_226.field1; + CursorTy pvrtmp_6160 = tmp_struct_226.field2; + + pvrtmp_6167 = pvrtmp_6158; + pvrtmp_6168 = pvrtmp_6159; + pvrtmp_6169 = pvrtmp_6160; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6167); + if (iters_pvrtmp_6167 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6167, + &end_pvrtmp_6167); + + vector_inplace_update(times_230, iters_pvrtmp_6167, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCta.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCta.c new file mode 100644 index 000000000..cb53ccc5c --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCta.c @@ -0,0 +1,5058 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2906, CursorTy end_r_2907, + CursorTy loc_2905, + CursorTy adt_14_900_1516); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2910, CursorTy end_r_2911, + CursorTy loc_2909, + CursorTy tags_20_906_1522, + IntTy inVal_21_907_1523); +CursorCursorCursorProd mkCTAList(CursorTy end_r_2913, CursorTy loc_2912, + IntTy len_24_910_1528, + IntTy tagLen_25_911_1529, + IntTy strLen_26_912_1530); +CursorCursorCursorProd mkString(CursorTy end_r_2915, CursorTy loc_2914, + IntTy len_179_1065_1536); +CursorCursorCursorProd mkContentText(CursorTy end_r_2917, CursorTy loc_2916, + IntTy n_193_1079_1542); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2919, CursorTy loc_2918, + IntTy len_318_1204_1544); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2922, + CursorTy end_r_2923, + CursorTy loc_2921, + CursorTy arg_622_1228_1549); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2926, + CursorTy end_r_2927, + CursorTy loc_2925, + CursorTy arg_627_1233_1554); +CursorProd _traverse_String(CursorTy end_r_2929, CursorTy arg_632_1238_1559); +CursorProd _print_String(CursorTy end_r_2931, CursorTy arg_637_1242_1563); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_646_1251_1572); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2938, + CursorTy end_r_2939, + CursorTy loc_2937, + CursorTy arg_651_1256_1577); +CursorProd _traverse_Content(CursorTy end_r_2941, CursorTy arg_656_1261_1582); +CursorProd _print_Content(CursorTy end_r_2943, CursorTy arg_661_1266_1587); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2946, CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_670_1275_1596); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2950, + CursorTy end_r_2951, + CursorTy loc_2949, + CursorTy arg_715_1320_1641); +CursorProd _traverse_Adt(CursorTy end_r_2953, CursorTy arg_760_1365_1686); +CursorProd _print_Adt(CursorTy end_r_2955, CursorTy arg_805_1410_1731); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2958, + CursorTy end_r_2959, CursorTy loc_2957, + CursorTy arg_868_1473_1794); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2962, + CursorTy end_r_2963, + CursorTy loc_2961, + CursorTy arg_873_1478_1799); +CursorProd _traverse_Tags(CursorTy end_r_2965, CursorTy arg_878_1483_1804); +CursorProd _print_Tags(CursorTy end_r_2967, CursorTy arg_883_1487_1808); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2970, CursorTy end_r_2971, + CursorTy loc_2969, CursorTy arg_2702); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2974, CursorTy end_r_2975, + CursorTy loc_2973, CursorTy arg_2707); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2712); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2801); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2906, CursorTy end_r_2907, + CursorTy loc_2905, + CursorTy adt_14_900_1516) +{ + if (loc_2905 + 32 > end_r_2907) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2907); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2907 = chunk_end_6; + *(TagTyPacked *) loc_2905 = 255; + + CursorTy redir = loc_2905 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2905 = chunk_start_5; + } + + CursorTy loc_3008 = loc_2905 + 1; + CursorTy loc_3009 = loc_3008 + 8; + CursorTy loc_3010 = loc_3009 + 8; + TagTyPacked tmpval_6177 = *(TagTyPacked *) adt_14_900_1516; + CursorTy tmpcur_6178 = adt_14_900_1516 + 1; + + + switch_6230: + ; + switch (tmpval_6177) { + + case 0: + { + CursorTy jump_3933 = adt_14_900_1516 + 1; + + *(TagTyPacked *) loc_2905 = 0; + + CursorTy writetag_4492 = loc_2905 + 1; + + return (CursorCursorCursorProd) {end_r_2907, loc_2905, + writetag_4492}; + break; + } + + case 21: + { + CursorTy tmpcur_6183 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6184 = tmpcur_6178 + 8; + CursorTy tmpcur_6185 = *(CursorTy *) tmpaftercur_6184; + CursorTy tmpaftercur_6186 = tmpaftercur_6184 + 8; + CursorTy jump_3936 = tmpaftercur_6184 + 8; + CursorTy jump_3935 = tmpcur_6178 + 8; + + *(TagTyPacked *) loc_3010 = 254; + + CursorTy writetag_4497 = loc_3010 + 1; + + *(CursorTy *) writetag_4497 = tmpaftercur_6186; + + CursorTy writecur_4498 = writetag_4497 + 8; + CursorCursorCursorCursorProd tmp_struct_0 = + addValTag(end_r_2906, end_r_2907, writecur_4498, tmpcur_6183, 10); + CursorTy pvrtmp_6189 = tmp_struct_0.field0; + CursorTy pvrtmp_6190 = tmp_struct_0.field1; + CursorTy pvrtmp_6191 = tmp_struct_0.field2; + CursorTy pvrtmp_6192 = tmp_struct_0.field3; + CursorCursorCursorProd tmp_struct_1 = + addValTagsAdt(end_r_2906, pvrtmp_6189, pvrtmp_6192, tmpcur_6185); + CursorTy pvrtmp_6197 = tmp_struct_1.field0; + CursorTy pvrtmp_6198 = tmp_struct_1.field1; + CursorTy pvrtmp_6199 = tmp_struct_1.field2; + + *(TagTyPacked *) loc_2905 = 21; + + CursorTy writetag_4502 = loc_2905 + 1; + + *(CursorTy *) writetag_4502 = tmpcur_6183; + + CursorTy writecur_4503 = writetag_4502 + 8; + + *(CursorTy *) writecur_4503 = pvrtmp_6192; + + CursorTy writecur_4504 = writecur_4503 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6197, loc_2905, + pvrtmp_6199}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6208 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6209 = tmpcur_6178 + 8; + CursorTy jump_4245 = tmpcur_6178 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2906, end_r_2907, loc_2905, tmpcur_6208); + CursorTy pvrtmp_6210 = tmp_struct_2.field0; + CursorTy pvrtmp_6211 = tmp_struct_2.field1; + CursorTy pvrtmp_6212 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6210, pvrtmp_6211, + pvrtmp_6212}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6219 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6220 = tmpcur_6178 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2906, end_r_2907, loc_2905, tmpcur_6219); + CursorTy pvrtmp_6221 = tmp_struct_3.field0; + CursorTy pvrtmp_6222 = tmp_struct_3.field1; + CursorTy pvrtmp_6223 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6221, pvrtmp_6222, + pvrtmp_6223}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6177"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2910, CursorTy end_r_2911, + CursorTy loc_2909, + CursorTy tags_20_906_1522, + IntTy inVal_21_907_1523) +{ + if (loc_2909 + 32 > end_r_2911) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2911); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2911 = chunk_end_12; + *(TagTyPacked *) loc_2909 = 255; + + CursorTy redir = loc_2909 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2909 = chunk_start_11; + } + + CursorTy loc_3028 = loc_2909 + 1; + CursorTy loc_3029 = loc_3028 + 8; + TagTyPacked tmpval_6231 = *(TagTyPacked *) tags_20_906_1522; + CursorTy tmpcur_6232 = tags_20_906_1522 + 1; + + + switch_6275: + ; + switch (tmpval_6231) { + + case 0: + { + CursorTy jump_3939 = tags_20_906_1522 + 1; + + *(TagTyPacked *) loc_2909 = 0; + + CursorTy writetag_4516 = loc_2909 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2911, jump_3939, + loc_2909, writetag_4516}; + break; + } + + case 1: + { + IntTy tmpval_6237 = *(IntTy *) tmpcur_6232; + CursorTy tmpcur_6238 = tmpcur_6232 + sizeof(IntTy); + CursorTy jump_3941 = tmpcur_6232 + 8; + IntTy fltPkd_1504_1526 = tmpval_6237 + inVal_21_907_1523; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2910, end_r_2911, loc_3029, tmpcur_6238, inVal_21_907_1523); + CursorTy pvrtmp_6239 = tmp_struct_7.field0; + CursorTy pvrtmp_6240 = tmp_struct_7.field1; + CursorTy pvrtmp_6241 = tmp_struct_7.field2; + CursorTy pvrtmp_6242 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2909 = 1; + + CursorTy writetag_4521 = loc_2909 + 1; + + *(IntTy *) writetag_4521 = fltPkd_1504_1526; + + CursorTy writecur_4522 = writetag_4521 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6239, pvrtmp_6240, + loc_2909, pvrtmp_6242}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6251 = *(CursorTy *) tmpcur_6232; + CursorTy tmpaftercur_6252 = tmpcur_6232 + 8; + CursorTy jump_4250 = tmpcur_6232 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2910, end_r_2911, loc_2909, tmpcur_6251, inVal_21_907_1523); + CursorTy pvrtmp_6253 = tmp_struct_8.field0; + CursorTy pvrtmp_6254 = tmp_struct_8.field1; + CursorTy pvrtmp_6255 = tmp_struct_8.field2; + CursorTy pvrtmp_6256 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6253, jump_4250, + pvrtmp_6255, pvrtmp_6256}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6263 = *(CursorTy *) tmpcur_6232; + CursorTy tmpaftercur_6264 = tmpcur_6232 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2910, end_r_2911, loc_2909, tmpcur_6263, inVal_21_907_1523); + CursorTy pvrtmp_6265 = tmp_struct_9.field0; + CursorTy pvrtmp_6266 = tmp_struct_9.field1; + CursorTy pvrtmp_6267 = tmp_struct_9.field2; + CursorTy pvrtmp_6268 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6265, pvrtmp_6266, + pvrtmp_6267, pvrtmp_6268}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6231"); + exit(1); + } + } +} +CursorCursorCursorProd mkCTAList(CursorTy end_r_2913, CursorTy loc_2912, + IntTy len_24_910_1528, + IntTy tagLen_25_911_1529, + IntTy strLen_26_912_1530) +{ + if (loc_2912 + 32 > end_r_2913) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2913); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2913 = chunk_end_18; + *(TagTyPacked *) loc_2912 = 255; + + CursorTy redir = loc_2912 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2912 = chunk_start_17; + } + + CursorTy loc_3037 = loc_2912 + 1; + CursorTy loc_3038 = loc_3037 + 8; + CursorTy loc_3039 = loc_3038 + 8; + BoolTy fltIf_1506_1531 = len_24_910_1528 <= 0; + + if (fltIf_1506_1531) { + *(TagTyPacked *) loc_2912 = 0; + + CursorTy writetag_4531 = loc_2912 + 1; + + return (CursorCursorCursorProd) {end_r_2913, loc_2912, writetag_4531}; + } else { + CursorCursorCursorProd tmp_struct_13 = + mkContentText(end_r_2913, loc_3039, strLen_26_912_1530); + CursorTy pvrtmp_6280 = tmp_struct_13.field0; + CursorTy pvrtmp_6281 = tmp_struct_13.field1; + CursorTy pvrtmp_6282 = tmp_struct_13.field2; + CursorCursorCursorProd tmp_struct_14 = + mkRandomTags(pvrtmp_6280, pvrtmp_6282, tagLen_25_911_1529); + CursorTy pvrtmp_6287 = tmp_struct_14.field0; + CursorTy pvrtmp_6288 = tmp_struct_14.field1; + CursorTy pvrtmp_6289 = tmp_struct_14.field2; + IntTy fltAppE_1507_1534 = len_24_910_1528 - 1; + CursorCursorCursorProd tmp_struct_15 = + mkCTAList(pvrtmp_6287, pvrtmp_6289, fltAppE_1507_1534, tagLen_25_911_1529, strLen_26_912_1530); + CursorTy pvrtmp_6294 = tmp_struct_15.field0; + CursorTy pvrtmp_6295 = tmp_struct_15.field1; + CursorTy pvrtmp_6296 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2912 = 21; + + CursorTy writetag_4536 = loc_2912 + 1; + + *(CursorTy *) writetag_4536 = pvrtmp_6282; + + CursorTy writecur_4537 = writetag_4536 + 8; + + *(CursorTy *) writecur_4537 = pvrtmp_6289; + + CursorTy writecur_4538 = writecur_4537 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6294, loc_2912, pvrtmp_6296}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2915, CursorTy loc_2914, + IntTy len_179_1065_1536) +{ + if (loc_2914 + 32 > end_r_2915) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2915); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2915 = chunk_end_22; + *(TagTyPacked *) loc_2914 = 255; + + CursorTy redir = loc_2914 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2914 = chunk_start_21; + } + + CursorTy loc_3051 = loc_2914 + 1; + CursorTy loc_3052 = loc_3051 + 8; + BoolTy fltIf_1508_1537 = len_179_1065_1536 <= 0; + + if (fltIf_1508_1537) { + *(TagTyPacked *) loc_2914 = 0; + + CursorTy writetag_4543 = loc_2914 + 1; + + return (CursorCursorCursorProd) {end_r_2915, loc_2914, writetag_4543}; + } else { + IntTy fltPrm_1509_1538 = rand(); + IntTy randomChar_180_1066_1539 = fltPrm_1509_1538 % 128; + IntTy fltAppE_1510_1540 = len_179_1065_1536 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2915, loc_3052, fltAppE_1510_1540); + CursorTy pvrtmp_6309 = tmp_struct_19.field0; + CursorTy pvrtmp_6310 = tmp_struct_19.field1; + CursorTy pvrtmp_6311 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2914 = 1; + + CursorTy writetag_4546 = loc_2914 + 1; + + *(IntTy *) writetag_4546 = randomChar_180_1066_1539; + + CursorTy writecur_4547 = writetag_4546 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6309, loc_2914, pvrtmp_6311}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2917, CursorTy loc_2916, + IntTy n_193_1079_1542) +{ + if (loc_2916 + 32 > end_r_2917) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2917); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2917 = chunk_end_26; + *(TagTyPacked *) loc_2916 = 255; + + CursorTy redir = loc_2916 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2916 = chunk_start_25; + } + + CursorTy loc_3057 = loc_2916 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2917, loc_3057, n_193_1079_1542); + CursorTy pvrtmp_6320 = tmp_struct_23.field0; + CursorTy pvrtmp_6321 = tmp_struct_23.field1; + CursorTy pvrtmp_6322 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2916 = 1; + + CursorTy writetag_4551 = loc_2916 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6320, loc_2916, pvrtmp_6322}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2919, CursorTy loc_2918, + IntTy len_318_1204_1544) +{ + if (loc_2918 + 32 > end_r_2919) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2919); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2919 = chunk_end_30; + *(TagTyPacked *) loc_2918 = 255; + + CursorTy redir = loc_2918 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2918 = chunk_start_29; + } + + CursorTy loc_3061 = loc_2918 + 1; + CursorTy loc_3062 = loc_3061 + 8; + BoolTy fltIf_1512_1545 = len_318_1204_1544 <= 0; + + if (fltIf_1512_1545) { + *(TagTyPacked *) loc_2918 = 0; + + CursorTy writetag_4554 = loc_2918 + 1; + + return (CursorCursorCursorProd) {end_r_2919, loc_2918, writetag_4554}; + } else { + IntTy fltAppE_1513_1547 = len_318_1204_1544 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2919, loc_3062, fltAppE_1513_1547); + CursorTy pvrtmp_6335 = tmp_struct_27.field0; + CursorTy pvrtmp_6336 = tmp_struct_27.field1; + CursorTy pvrtmp_6337 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2918 = 1; + + CursorTy writetag_4557 = loc_2918 + 1; + + *(IntTy *) writetag_4557 = 100; + + CursorTy writecur_4558 = writetag_4557 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6335, loc_2918, pvrtmp_6337}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2922, + CursorTy end_r_2923, + CursorTy loc_2921, + CursorTy arg_622_1228_1549) +{ + if (loc_2921 + 32 > end_r_2923) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2923); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2923 = chunk_end_36; + *(TagTyPacked *) loc_2921 = 255; + + CursorTy redir = loc_2921 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2921 = chunk_start_35; + } + + CursorTy loc_3072 = loc_2921 + 1; + CursorTy loc_3073 = loc_3072 + 8; + TagTyPacked tmpval_6346 = *(TagTyPacked *) arg_622_1228_1549; + CursorTy tmpcur_6347 = arg_622_1228_1549 + 1; + + + switch_6390: + ; + switch (tmpval_6346) { + + case 0: + { + CursorTy jump_3951 = arg_622_1228_1549 + 1; + + *(TagTyPacked *) loc_2921 = 0; + + CursorTy writetag_4562 = loc_2921 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2923, jump_3951, + loc_2921, writetag_4562}; + break; + } + + case 1: + { + IntTy tmpval_6352 = *(IntTy *) tmpcur_6347; + CursorTy tmpcur_6353 = tmpcur_6347 + sizeof(IntTy); + CursorTy jump_3953 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2922, end_r_2923, loc_3073, tmpcur_6353); + CursorTy pvrtmp_6354 = tmp_struct_31.field0; + CursorTy pvrtmp_6355 = tmp_struct_31.field1; + CursorTy pvrtmp_6356 = tmp_struct_31.field2; + CursorTy pvrtmp_6357 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2921 = 1; + + CursorTy writetag_4567 = loc_2921 + 1; + + *(IntTy *) writetag_4567 = tmpval_6352; + + CursorTy writecur_4568 = writetag_4567 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6354, pvrtmp_6355, + loc_2921, pvrtmp_6357}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6366 = *(CursorTy *) tmpcur_6347; + CursorTy tmpaftercur_6367 = tmpcur_6347 + 8; + CursorTy jump_4256 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2922, end_r_2923, loc_2921, tmpcur_6366); + CursorTy pvrtmp_6368 = tmp_struct_32.field0; + CursorTy pvrtmp_6369 = tmp_struct_32.field1; + CursorTy pvrtmp_6370 = tmp_struct_32.field2; + CursorTy pvrtmp_6371 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6368, jump_4256, + pvrtmp_6370, pvrtmp_6371}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6378 = *(CursorTy *) tmpcur_6347; + CursorTy tmpaftercur_6379 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2922, end_r_2923, loc_2921, tmpcur_6378); + CursorTy pvrtmp_6380 = tmp_struct_33.field0; + CursorTy pvrtmp_6381 = tmp_struct_33.field1; + CursorTy pvrtmp_6382 = tmp_struct_33.field2; + CursorTy pvrtmp_6383 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6380, pvrtmp_6381, + pvrtmp_6382, pvrtmp_6383}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6346"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2926, + CursorTy end_r_2927, + CursorTy loc_2925, + CursorTy arg_627_1233_1554) +{ + CursorTy loc_3085 = loc_2925 + 1; + CursorTy loc_3086 = loc_3085 + 8; + TagTyPacked tmpval_6391 = *(TagTyPacked *) arg_627_1233_1554; + CursorTy tmpcur_6392 = arg_627_1233_1554 + 1; + + + switch_6435: + ; + switch (tmpval_6391) { + + case 0: + { + CursorTy jump_3956 = arg_627_1233_1554 + 1; + + *(TagTyPacked *) loc_2925 = 0; + + CursorTy writetag_4578 = loc_2925 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2927, jump_3956, + loc_2925, writetag_4578}; + break; + } + + case 1: + { + IntTy tmpval_6397 = *(IntTy *) tmpcur_6392; + CursorTy tmpcur_6398 = tmpcur_6392 + sizeof(IntTy); + CursorTy jump_3958 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_3086, tmpcur_6398); + CursorTy pvrtmp_6399 = tmp_struct_37.field0; + CursorTy pvrtmp_6400 = tmp_struct_37.field1; + CursorTy pvrtmp_6401 = tmp_struct_37.field2; + CursorTy pvrtmp_6402 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2925 = 1; + + CursorTy writetag_4583 = loc_2925 + 1; + + *(IntTy *) writetag_4583 = tmpval_6397; + + CursorTy writecur_4584 = writetag_4583 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6399, pvrtmp_6400, + loc_2925, pvrtmp_6402}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6411 = *(CursorTy *) tmpcur_6392; + CursorTy tmpaftercur_6412 = tmpcur_6392 + 8; + CursorTy jump_4262 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_2925, tmpcur_6411); + CursorTy pvrtmp_6413 = tmp_struct_38.field0; + CursorTy pvrtmp_6414 = tmp_struct_38.field1; + CursorTy pvrtmp_6415 = tmp_struct_38.field2; + CursorTy pvrtmp_6416 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6413, jump_4262, + pvrtmp_6415, pvrtmp_6416}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6423 = *(CursorTy *) tmpcur_6392; + CursorTy tmpaftercur_6424 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_2925, tmpcur_6423); + CursorTy pvrtmp_6425 = tmp_struct_39.field0; + CursorTy pvrtmp_6426 = tmp_struct_39.field1; + CursorTy pvrtmp_6427 = tmp_struct_39.field2; + CursorTy pvrtmp_6428 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6425, pvrtmp_6426, + pvrtmp_6427, pvrtmp_6428}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6391"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2929, CursorTy arg_632_1238_1559) +{ + TagTyPacked tmpval_6436 = *(TagTyPacked *) arg_632_1238_1559; + CursorTy tmpcur_6437 = arg_632_1238_1559 + 1; + + + switch_6447: + ; + switch (tmpval_6436) { + + case 0: + { + CursorTy jump_3961 = arg_632_1238_1559 + 1; + + return (CursorProd) {jump_3961}; + break; + } + + case 1: + { + IntTy tmpval_6438 = *(IntTy *) tmpcur_6437; + CursorTy tmpcur_6439 = tmpcur_6437 + sizeof(IntTy); + CursorTy jump_3963 = tmpcur_6437 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2929, tmpcur_6439); + CursorTy pvrtmp_6440 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6440}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6441 = *(CursorTy *) tmpcur_6437; + CursorTy tmpaftercur_6442 = tmpcur_6437 + 8; + CursorTy jump_4268 = tmpcur_6437 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2929, tmpcur_6441); + CursorTy pvrtmp_6443 = tmp_struct_41.field0; + + return (CursorProd) {jump_4268}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6444 = *(CursorTy *) tmpcur_6437; + CursorTy tmpaftercur_6445 = tmpcur_6437 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2929, tmpcur_6444); + CursorTy pvrtmp_6446 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6446}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6436"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2931, CursorTy arg_637_1242_1563) +{ + TagTyPacked tmpval_6448 = *(TagTyPacked *) arg_637_1242_1563; + CursorTy tmpcur_6449 = arg_637_1242_1563 + 1; + + + switch_6459: + ; + switch (tmpval_6448) { + + case 0: + { + CursorTy jump_3966 = arg_637_1242_1563 + 1; + unsigned char wildcard_638_1243_1564 = print_symbol(6137); + unsigned char wildcard_639_1244_1565 = print_symbol(6129); + + return (CursorProd) {jump_3966}; + break; + } + + case 1: + { + IntTy tmpval_6450 = *(IntTy *) tmpcur_6449; + CursorTy tmpcur_6451 = tmpcur_6449 + sizeof(IntTy); + CursorTy jump_3968 = tmpcur_6449 + 8; + unsigned char wildcard_644_1247_1568 = print_symbol(6138); + unsigned char y_642_1248_1569 = printf("%lld", tmpval_6450); + CursorProd tmp_struct_43 = _print_String(end_r_2931, tmpcur_6451); + CursorTy pvrtmp_6452 = tmp_struct_43.field0; + unsigned char wildcard_645_1250_1571 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6452}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6453 = *(CursorTy *) tmpcur_6449; + CursorTy tmpaftercur_6454 = tmpcur_6449 + 8; + CursorTy jump_4274 = tmpcur_6449 + 8; + unsigned char wildcard_4277 = print_symbol(6146); + CursorProd tmp_struct_44 = _print_String(end_r_2931, tmpcur_6453); + CursorTy pvrtmp_6455 = tmp_struct_44.field0; + + return (CursorProd) {jump_4274}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6456 = *(CursorTy *) tmpcur_6449; + CursorTy tmpaftercur_6457 = tmpcur_6449 + 8; + unsigned char wildcard_4277 = print_symbol(6145); + CursorProd tmp_struct_45 = _print_String(end_r_2931, tmpcur_6456); + CursorTy pvrtmp_6458 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6458}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6448"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_646_1251_1572) +{ + if (loc_2933 + 32 > end_r_2935) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2935); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2935 = chunk_end_52; + *(TagTyPacked *) loc_2933 = 255; + + CursorTy redir = loc_2933 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2933 = chunk_start_51; + } + + TagTyPacked tmpval_6460 = *(TagTyPacked *) arg_646_1251_1572; + CursorTy tmpcur_6461 = arg_646_1251_1572 + 1; + + + switch_6510: + ; + switch (tmpval_6460) { + + case 0: + { + CursorTy loc_3108 = loc_2933 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2934, end_r_2935, loc_3108, tmpcur_6461); + CursorTy pvrtmp_6462 = tmp_struct_46.field0; + CursorTy pvrtmp_6463 = tmp_struct_46.field1; + CursorTy pvrtmp_6464 = tmp_struct_46.field2; + CursorTy pvrtmp_6465 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2933 = 0; + + CursorTy writetag_4615 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6462, pvrtmp_6463, + loc_2933, pvrtmp_6465}; + break; + } + + case 1: + { + CursorTy loc_3114 = loc_2933 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2934, end_r_2935, loc_3114, tmpcur_6461); + CursorTy pvrtmp_6474 = tmp_struct_47.field0; + CursorTy pvrtmp_6475 = tmp_struct_47.field1; + CursorTy pvrtmp_6476 = tmp_struct_47.field2; + CursorTy pvrtmp_6477 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2933 = 1; + + CursorTy writetag_4620 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6474, pvrtmp_6475, + loc_2933, pvrtmp_6477}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6486 = *(CursorTy *) tmpcur_6461; + CursorTy tmpaftercur_6487 = tmpcur_6461 + 8; + CursorTy jump_4280 = tmpcur_6461 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2934, end_r_2935, loc_2933, tmpcur_6486); + CursorTy pvrtmp_6488 = tmp_struct_48.field0; + CursorTy pvrtmp_6489 = tmp_struct_48.field1; + CursorTy pvrtmp_6490 = tmp_struct_48.field2; + CursorTy pvrtmp_6491 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6488, jump_4280, + pvrtmp_6490, pvrtmp_6491}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6498 = *(CursorTy *) tmpcur_6461; + CursorTy tmpaftercur_6499 = tmpcur_6461 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2934, end_r_2935, loc_2933, tmpcur_6498); + CursorTy pvrtmp_6500 = tmp_struct_49.field0; + CursorTy pvrtmp_6501 = tmp_struct_49.field1; + CursorTy pvrtmp_6502 = tmp_struct_49.field2; + CursorTy pvrtmp_6503 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6500, pvrtmp_6501, + pvrtmp_6502, pvrtmp_6503}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6460"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2938, + CursorTy end_r_2939, + CursorTy loc_2937, + CursorTy arg_651_1256_1577) +{ + TagTyPacked tmpval_6511 = *(TagTyPacked *) arg_651_1256_1577; + CursorTy tmpcur_6512 = arg_651_1256_1577 + 1; + + + switch_6561: + ; + switch (tmpval_6511) { + + case 0: + { + CursorTy loc_3122 = loc_2937 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2938, end_r_2939, loc_3122, tmpcur_6512); + CursorTy pvrtmp_6513 = tmp_struct_53.field0; + CursorTy pvrtmp_6514 = tmp_struct_53.field1; + CursorTy pvrtmp_6515 = tmp_struct_53.field2; + CursorTy pvrtmp_6516 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2937 = 0; + + CursorTy writetag_4631 = loc_2937 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6513, pvrtmp_6514, + loc_2937, pvrtmp_6516}; + break; + } + + case 1: + { + CursorTy loc_3128 = loc_2937 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2938, end_r_2939, loc_3128, tmpcur_6512); + CursorTy pvrtmp_6525 = tmp_struct_54.field0; + CursorTy pvrtmp_6526 = tmp_struct_54.field1; + CursorTy pvrtmp_6527 = tmp_struct_54.field2; + CursorTy pvrtmp_6528 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2937 = 1; + + CursorTy writetag_4636 = loc_2937 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6525, pvrtmp_6526, + loc_2937, pvrtmp_6528}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6537 = *(CursorTy *) tmpcur_6512; + CursorTy tmpaftercur_6538 = tmpcur_6512 + 8; + CursorTy jump_4286 = tmpcur_6512 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2938, end_r_2939, loc_2937, tmpcur_6537); + CursorTy pvrtmp_6539 = tmp_struct_55.field0; + CursorTy pvrtmp_6540 = tmp_struct_55.field1; + CursorTy pvrtmp_6541 = tmp_struct_55.field2; + CursorTy pvrtmp_6542 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6539, jump_4286, + pvrtmp_6541, pvrtmp_6542}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6549 = *(CursorTy *) tmpcur_6512; + CursorTy tmpaftercur_6550 = tmpcur_6512 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2938, end_r_2939, loc_2937, tmpcur_6549); + CursorTy pvrtmp_6551 = tmp_struct_56.field0; + CursorTy pvrtmp_6552 = tmp_struct_56.field1; + CursorTy pvrtmp_6553 = tmp_struct_56.field2; + CursorTy pvrtmp_6554 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6551, pvrtmp_6552, + pvrtmp_6553, pvrtmp_6554}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6511"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2941, CursorTy arg_656_1261_1582) +{ + TagTyPacked tmpval_6562 = *(TagTyPacked *) arg_656_1261_1582; + CursorTy tmpcur_6563 = arg_656_1261_1582 + 1; + + + switch_6572: + ; + switch (tmpval_6562) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2941, tmpcur_6563); + CursorTy pvrtmp_6564 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6564}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2941, tmpcur_6563); + CursorTy pvrtmp_6565 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6565}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6566 = *(CursorTy *) tmpcur_6563; + CursorTy tmpaftercur_6567 = tmpcur_6563 + 8; + CursorTy jump_4292 = tmpcur_6563 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2941, tmpcur_6566); + CursorTy pvrtmp_6568 = tmp_struct_59.field0; + + return (CursorProd) {jump_4292}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6569 = *(CursorTy *) tmpcur_6563; + CursorTy tmpaftercur_6570 = tmpcur_6563 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2941, tmpcur_6569); + CursorTy pvrtmp_6571 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6571}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6562"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2943, CursorTy arg_661_1266_1587) +{ + TagTyPacked tmpval_6573 = *(TagTyPacked *) arg_661_1266_1587; + CursorTy tmpcur_6574 = arg_661_1266_1587 + 1; + + + switch_6583: + ; + switch (tmpval_6573) { + + case 0: + { + unsigned char wildcard_664_1268_1589 = print_symbol(6136); + CursorProd tmp_struct_61 = _print_String(end_r_2943, tmpcur_6574); + CursorTy pvrtmp_6575 = tmp_struct_61.field0; + unsigned char wildcard_665_1270_1591 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6575}; + break; + } + + case 1: + { + unsigned char wildcard_668_1272_1593 = print_symbol(6130); + CursorProd tmp_struct_62 = _print_String(end_r_2943, tmpcur_6574); + CursorTy pvrtmp_6576 = tmp_struct_62.field0; + unsigned char wildcard_669_1274_1595 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6576}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6577 = *(CursorTy *) tmpcur_6574; + CursorTy tmpaftercur_6578 = tmpcur_6574 + 8; + CursorTy jump_4298 = tmpcur_6574 + 8; + unsigned char wildcard_4301 = print_symbol(6146); + CursorProd tmp_struct_63 = _print_Content(end_r_2943, tmpcur_6577); + CursorTy pvrtmp_6579 = tmp_struct_63.field0; + + return (CursorProd) {jump_4298}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6580 = *(CursorTy *) tmpcur_6574; + CursorTy tmpaftercur_6581 = tmpcur_6574 + 8; + unsigned char wildcard_4301 = print_symbol(6145); + CursorProd tmp_struct_64 = _print_Content(end_r_2943, tmpcur_6580); + CursorTy pvrtmp_6582 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6582}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6573"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2946, CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_670_1275_1596) +{ + if (loc_2945 + 32 > end_r_2947) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2947); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2947 = chunk_end_91; + *(TagTyPacked *) loc_2945 = 255; + + CursorTy redir = loc_2945 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2945 = chunk_start_90; + } + + CursorTy loc_3158 = loc_2945 + 1; + CursorTy loc_3159 = loc_3158 + 8; + CursorTy loc_3174 = loc_2945 + 1; + CursorTy loc_3175 = loc_3174 + 8; + CursorTy loc_3195 = loc_2945 + 1; + CursorTy loc_3196 = loc_3195 + 8; + CursorTy loc_3197 = loc_3196 + 8; + CursorTy loc_3221 = loc_2945 + 1; + CursorTy loc_3222 = loc_3221 + 8; + CursorTy loc_3223 = loc_3222 + 8; + CursorTy loc_3247 = loc_2945 + 1; + CursorTy loc_3248 = loc_3247 + 8; + CursorTy loc_3249 = loc_3248 + 8; + CursorTy loc_3273 = loc_2945 + 1; + CursorTy loc_3274 = loc_3273 + 8; + CursorTy loc_3275 = loc_3274 + 8; + CursorTy loc_3299 = loc_2945 + 1; + CursorTy loc_3300 = loc_3299 + 8; + CursorTy loc_3301 = loc_3300 + 8; + CursorTy loc_3325 = loc_2945 + 1; + CursorTy loc_3326 = loc_3325 + 8; + CursorTy loc_3327 = loc_3326 + 8; + TagTyPacked tmpval_6584 = *(TagTyPacked *) arg_670_1275_1596; + CursorTy tmpcur_6585 = arg_670_1275_1596 + 1; + + + switch_6850: + ; + switch (tmpval_6584) { + + case 0: + { + CursorTy jump_3987 = arg_670_1275_1596 + 1; + + *(TagTyPacked *) loc_2945 = 0; + + CursorTy writetag_4666 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2947, jump_3987, + loc_2945, writetag_4666}; + break; + } + + case 9: + { + CursorTy tmpcur_6590 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6591 = tmpcur_6585 + 8; + CursorTy jump_3989 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2946, end_r_2947, loc_3159, tmpaftercur_6591); + CursorTy pvrtmp_6592 = tmp_struct_65.field0; + CursorTy pvrtmp_6593 = tmp_struct_65.field1; + CursorTy pvrtmp_6594 = tmp_struct_65.field2; + CursorTy pvrtmp_6595 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2946, pvrtmp_6592, pvrtmp_6595, tmpcur_6590); + CursorTy pvrtmp_6600 = tmp_struct_66.field0; + CursorTy pvrtmp_6601 = tmp_struct_66.field1; + CursorTy pvrtmp_6602 = tmp_struct_66.field2; + CursorTy pvrtmp_6603 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2945 = 9; + + CursorTy writetag_4672 = loc_2945 + 1; + + *(CursorTy *) writetag_4672 = pvrtmp_6595; + + CursorTy writecur_4673 = writetag_4672 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6600, pvrtmp_6601, + loc_2945, pvrtmp_6603}; + break; + } + + case 11: + { + CursorTy tmpcur_6612 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6613 = tmpcur_6585 + 8; + CursorTy jump_3993 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2946, end_r_2947, loc_3175, tmpaftercur_6613); + CursorTy pvrtmp_6614 = tmp_struct_67.field0; + CursorTy pvrtmp_6615 = tmp_struct_67.field1; + CursorTy pvrtmp_6616 = tmp_struct_67.field2; + CursorTy pvrtmp_6617 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2946, pvrtmp_6614, pvrtmp_6617, tmpcur_6612); + CursorTy pvrtmp_6622 = tmp_struct_68.field0; + CursorTy pvrtmp_6623 = tmp_struct_68.field1; + CursorTy pvrtmp_6624 = tmp_struct_68.field2; + CursorTy pvrtmp_6625 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2945 = 11; + + CursorTy writetag_4681 = loc_2945 + 1; + + *(CursorTy *) writetag_4681 = pvrtmp_6617; + + CursorTy writecur_4682 = writetag_4681 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6622, pvrtmp_6623, + loc_2945, pvrtmp_6625}; + break; + } + + case 13: + { + CursorTy tmpcur_6634 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6635 = tmpcur_6585 + 8; + CursorTy tmpcur_6636 = *(CursorTy *) tmpaftercur_6635; + CursorTy tmpaftercur_6637 = tmpaftercur_6635 + 8; + CursorTy jump_3998 = tmpaftercur_6635 + 8; + CursorTy jump_3997 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2946, end_r_2947, loc_3197, tmpaftercur_6637); + CursorTy pvrtmp_6638 = tmp_struct_69.field0; + CursorTy pvrtmp_6639 = tmp_struct_69.field1; + CursorTy pvrtmp_6640 = tmp_struct_69.field2; + CursorTy pvrtmp_6641 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2946, pvrtmp_6638, pvrtmp_6641, tmpcur_6634); + CursorTy pvrtmp_6646 = tmp_struct_70.field0; + CursorTy pvrtmp_6647 = tmp_struct_70.field1; + CursorTy pvrtmp_6648 = tmp_struct_70.field2; + CursorTy pvrtmp_6649 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2946, pvrtmp_6646, pvrtmp_6649, tmpcur_6636); + CursorTy pvrtmp_6654 = tmp_struct_71.field0; + CursorTy pvrtmp_6655 = tmp_struct_71.field1; + CursorTy pvrtmp_6656 = tmp_struct_71.field2; + CursorTy pvrtmp_6657 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2945 = 13; + + CursorTy writetag_4692 = loc_2945 + 1; + + *(CursorTy *) writetag_4692 = pvrtmp_6641; + + CursorTy writecur_4693 = writetag_4692 + 8; + + *(CursorTy *) writecur_4693 = pvrtmp_6649; + + CursorTy writecur_4694 = writecur_4693 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6654, pvrtmp_6655, + loc_2945, pvrtmp_6657}; + break; + } + + case 15: + { + CursorTy tmpcur_6666 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6667 = tmpcur_6585 + 8; + CursorTy tmpcur_6668 = *(CursorTy *) tmpaftercur_6667; + CursorTy tmpaftercur_6669 = tmpaftercur_6667 + 8; + CursorTy jump_4004 = tmpaftercur_6667 + 8; + CursorTy jump_4003 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2946, end_r_2947, loc_3223, tmpaftercur_6669); + CursorTy pvrtmp_6670 = tmp_struct_72.field0; + CursorTy pvrtmp_6671 = tmp_struct_72.field1; + CursorTy pvrtmp_6672 = tmp_struct_72.field2; + CursorTy pvrtmp_6673 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2946, pvrtmp_6670, pvrtmp_6673, tmpcur_6666); + CursorTy pvrtmp_6678 = tmp_struct_73.field0; + CursorTy pvrtmp_6679 = tmp_struct_73.field1; + CursorTy pvrtmp_6680 = tmp_struct_73.field2; + CursorTy pvrtmp_6681 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2946, pvrtmp_6678, pvrtmp_6681, tmpcur_6668); + CursorTy pvrtmp_6686 = tmp_struct_74.field0; + CursorTy pvrtmp_6687 = tmp_struct_74.field1; + CursorTy pvrtmp_6688 = tmp_struct_74.field2; + CursorTy pvrtmp_6689 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2945 = 15; + + CursorTy writetag_4705 = loc_2945 + 1; + + *(CursorTy *) writetag_4705 = pvrtmp_6673; + + CursorTy writecur_4706 = writetag_4705 + 8; + + *(CursorTy *) writecur_4706 = pvrtmp_6681; + + CursorTy writecur_4707 = writecur_4706 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6686, pvrtmp_6687, + loc_2945, pvrtmp_6689}; + break; + } + + case 17: + { + CursorTy tmpcur_6698 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6699 = tmpcur_6585 + 8; + CursorTy tmpcur_6700 = *(CursorTy *) tmpaftercur_6699; + CursorTy tmpaftercur_6701 = tmpaftercur_6699 + 8; + CursorTy jump_4010 = tmpaftercur_6699 + 8; + CursorTy jump_4009 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2946, end_r_2947, loc_3249, tmpaftercur_6701); + CursorTy pvrtmp_6702 = tmp_struct_75.field0; + CursorTy pvrtmp_6703 = tmp_struct_75.field1; + CursorTy pvrtmp_6704 = tmp_struct_75.field2; + CursorTy pvrtmp_6705 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2946, pvrtmp_6702, pvrtmp_6705, tmpcur_6698); + CursorTy pvrtmp_6710 = tmp_struct_76.field0; + CursorTy pvrtmp_6711 = tmp_struct_76.field1; + CursorTy pvrtmp_6712 = tmp_struct_76.field2; + CursorTy pvrtmp_6713 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2946, pvrtmp_6710, pvrtmp_6713, tmpcur_6700); + CursorTy pvrtmp_6718 = tmp_struct_77.field0; + CursorTy pvrtmp_6719 = tmp_struct_77.field1; + CursorTy pvrtmp_6720 = tmp_struct_77.field2; + CursorTy pvrtmp_6721 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2945 = 17; + + CursorTy writetag_4718 = loc_2945 + 1; + + *(CursorTy *) writetag_4718 = pvrtmp_6705; + + CursorTy writecur_4719 = writetag_4718 + 8; + + *(CursorTy *) writecur_4719 = pvrtmp_6713; + + CursorTy writecur_4720 = writecur_4719 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6718, pvrtmp_6719, + loc_2945, pvrtmp_6721}; + break; + } + + case 19: + { + CursorTy tmpcur_6730 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6731 = tmpcur_6585 + 8; + CursorTy tmpcur_6732 = *(CursorTy *) tmpaftercur_6731; + CursorTy tmpaftercur_6733 = tmpaftercur_6731 + 8; + CursorTy jump_4016 = tmpaftercur_6731 + 8; + CursorTy jump_4015 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2946, end_r_2947, loc_3275, tmpaftercur_6733); + CursorTy pvrtmp_6734 = tmp_struct_78.field0; + CursorTy pvrtmp_6735 = tmp_struct_78.field1; + CursorTy pvrtmp_6736 = tmp_struct_78.field2; + CursorTy pvrtmp_6737 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2946, pvrtmp_6734, pvrtmp_6737, tmpcur_6730); + CursorTy pvrtmp_6742 = tmp_struct_79.field0; + CursorTy pvrtmp_6743 = tmp_struct_79.field1; + CursorTy pvrtmp_6744 = tmp_struct_79.field2; + CursorTy pvrtmp_6745 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2946, pvrtmp_6742, pvrtmp_6745, tmpcur_6732); + CursorTy pvrtmp_6750 = tmp_struct_80.field0; + CursorTy pvrtmp_6751 = tmp_struct_80.field1; + CursorTy pvrtmp_6752 = tmp_struct_80.field2; + CursorTy pvrtmp_6753 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2945 = 19; + + CursorTy writetag_4731 = loc_2945 + 1; + + *(CursorTy *) writetag_4731 = pvrtmp_6737; + + CursorTy writecur_4732 = writetag_4731 + 8; + + *(CursorTy *) writecur_4732 = pvrtmp_6745; + + CursorTy writecur_4733 = writecur_4732 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6750, pvrtmp_6751, + loc_2945, pvrtmp_6753}; + break; + } + + case 21: + { + CursorTy tmpcur_6762 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6763 = tmpcur_6585 + 8; + CursorTy tmpcur_6764 = *(CursorTy *) tmpaftercur_6763; + CursorTy tmpaftercur_6765 = tmpaftercur_6763 + 8; + CursorTy jump_4022 = tmpaftercur_6763 + 8; + CursorTy jump_4021 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2946, end_r_2947, loc_3301, tmpaftercur_6765); + CursorTy pvrtmp_6766 = tmp_struct_81.field0; + CursorTy pvrtmp_6767 = tmp_struct_81.field1; + CursorTy pvrtmp_6768 = tmp_struct_81.field2; + CursorTy pvrtmp_6769 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2946, pvrtmp_6766, pvrtmp_6769, tmpcur_6762); + CursorTy pvrtmp_6774 = tmp_struct_82.field0; + CursorTy pvrtmp_6775 = tmp_struct_82.field1; + CursorTy pvrtmp_6776 = tmp_struct_82.field2; + CursorTy pvrtmp_6777 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2946, pvrtmp_6774, pvrtmp_6777, tmpcur_6764); + CursorTy pvrtmp_6782 = tmp_struct_83.field0; + CursorTy pvrtmp_6783 = tmp_struct_83.field1; + CursorTy pvrtmp_6784 = tmp_struct_83.field2; + CursorTy pvrtmp_6785 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2945 = 21; + + CursorTy writetag_4744 = loc_2945 + 1; + + *(CursorTy *) writetag_4744 = pvrtmp_6769; + + CursorTy writecur_4745 = writetag_4744 + 8; + + *(CursorTy *) writecur_4745 = pvrtmp_6777; + + CursorTy writecur_4746 = writecur_4745 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6782, pvrtmp_6783, + loc_2945, pvrtmp_6785}; + break; + } + + case 23: + { + CursorTy tmpcur_6794 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6795 = tmpcur_6585 + 8; + CursorTy tmpcur_6796 = *(CursorTy *) tmpaftercur_6795; + CursorTy tmpaftercur_6797 = tmpaftercur_6795 + 8; + CursorTy jump_4028 = tmpaftercur_6795 + 8; + CursorTy jump_4027 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2946, end_r_2947, loc_3327, tmpaftercur_6797); + CursorTy pvrtmp_6798 = tmp_struct_84.field0; + CursorTy pvrtmp_6799 = tmp_struct_84.field1; + CursorTy pvrtmp_6800 = tmp_struct_84.field2; + CursorTy pvrtmp_6801 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2946, pvrtmp_6798, pvrtmp_6801, tmpcur_6794); + CursorTy pvrtmp_6806 = tmp_struct_85.field0; + CursorTy pvrtmp_6807 = tmp_struct_85.field1; + CursorTy pvrtmp_6808 = tmp_struct_85.field2; + CursorTy pvrtmp_6809 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2946, pvrtmp_6806, pvrtmp_6809, tmpcur_6796); + CursorTy pvrtmp_6814 = tmp_struct_86.field0; + CursorTy pvrtmp_6815 = tmp_struct_86.field1; + CursorTy pvrtmp_6816 = tmp_struct_86.field2; + CursorTy pvrtmp_6817 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2945 = 23; + + CursorTy writetag_4757 = loc_2945 + 1; + + *(CursorTy *) writetag_4757 = pvrtmp_6801; + + CursorTy writecur_4758 = writetag_4757 + 8; + + *(CursorTy *) writecur_4758 = pvrtmp_6809; + + CursorTy writecur_4759 = writecur_4758 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6814, pvrtmp_6815, + loc_2945, pvrtmp_6817}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6826 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6827 = tmpcur_6585 + 8; + CursorTy jump_4304 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2946, end_r_2947, loc_2945, tmpcur_6826); + CursorTy pvrtmp_6828 = tmp_struct_87.field0; + CursorTy pvrtmp_6829 = tmp_struct_87.field1; + CursorTy pvrtmp_6830 = tmp_struct_87.field2; + CursorTy pvrtmp_6831 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6828, jump_4304, + pvrtmp_6830, pvrtmp_6831}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6838 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6839 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2946, end_r_2947, loc_2945, tmpcur_6838); + CursorTy pvrtmp_6840 = tmp_struct_88.field0; + CursorTy pvrtmp_6841 = tmp_struct_88.field1; + CursorTy pvrtmp_6842 = tmp_struct_88.field2; + CursorTy pvrtmp_6843 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6840, pvrtmp_6841, + pvrtmp_6842, pvrtmp_6843}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6584"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2950, + CursorTy end_r_2951, + CursorTy loc_2949, + CursorTy arg_715_1320_1641) +{ + TagTyPacked tmpval_6851 = *(TagTyPacked *) arg_715_1320_1641; + CursorTy tmpcur_6852 = arg_715_1320_1641 + 1; + + + switch_7117: + ; + switch (tmpval_6851) { + + case 0: + { + CursorTy jump_4033 = arg_715_1320_1641 + 1; + + *(TagTyPacked *) loc_2949 = 0; + + CursorTy writetag_4771 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2951, jump_4033, + loc_2949, writetag_4771}; + break; + } + + case 9: + { + CursorTy tmpcur_6857 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6858 = tmpcur_6852 + 8; + CursorTy jump_4035 = tmpcur_6852 + 8; + CursorTy loc_3349 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3349, tmpaftercur_6858); + CursorTy pvrtmp_6859 = tmp_struct_92.field0; + CursorTy pvrtmp_6860 = tmp_struct_92.field1; + CursorTy pvrtmp_6861 = tmp_struct_92.field2; + CursorTy pvrtmp_6862 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6859, pvrtmp_6862, tmpcur_6857); + CursorTy pvrtmp_6867 = tmp_struct_93.field0; + CursorTy pvrtmp_6868 = tmp_struct_93.field1; + CursorTy pvrtmp_6869 = tmp_struct_93.field2; + CursorTy pvrtmp_6870 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2949 = 1; + + CursorTy writetag_4777 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6867, pvrtmp_6868, + loc_2949, pvrtmp_6870}; + break; + } + + case 11: + { + CursorTy tmpcur_6879 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6880 = tmpcur_6852 + 8; + CursorTy jump_4039 = tmpcur_6852 + 8; + CursorTy loc_3362 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3362, tmpaftercur_6880); + CursorTy pvrtmp_6881 = tmp_struct_94.field0; + CursorTy pvrtmp_6882 = tmp_struct_94.field1; + CursorTy pvrtmp_6883 = tmp_struct_94.field2; + CursorTy pvrtmp_6884 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6881, pvrtmp_6884, tmpcur_6879); + CursorTy pvrtmp_6889 = tmp_struct_95.field0; + CursorTy pvrtmp_6890 = tmp_struct_95.field1; + CursorTy pvrtmp_6891 = tmp_struct_95.field2; + CursorTy pvrtmp_6892 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2949 = 2; + + CursorTy writetag_4785 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6889, pvrtmp_6890, + loc_2949, pvrtmp_6892}; + break; + } + + case 13: + { + CursorTy tmpcur_6901 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6902 = tmpcur_6852 + 8; + CursorTy tmpcur_6903 = *(CursorTy *) tmpaftercur_6902; + CursorTy tmpaftercur_6904 = tmpaftercur_6902 + 8; + CursorTy jump_4044 = tmpaftercur_6902 + 8; + CursorTy jump_4043 = tmpcur_6852 + 8; + CursorTy loc_3380 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2950, end_r_2951, loc_3380, tmpaftercur_6904); + CursorTy pvrtmp_6905 = tmp_struct_96.field0; + CursorTy pvrtmp_6906 = tmp_struct_96.field1; + CursorTy pvrtmp_6907 = tmp_struct_96.field2; + CursorTy pvrtmp_6908 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6905, pvrtmp_6908, tmpcur_6901); + CursorTy pvrtmp_6913 = tmp_struct_97.field0; + CursorTy pvrtmp_6914 = tmp_struct_97.field1; + CursorTy pvrtmp_6915 = tmp_struct_97.field2; + CursorTy pvrtmp_6916 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6913, pvrtmp_6916, tmpcur_6903); + CursorTy pvrtmp_6921 = tmp_struct_98.field0; + CursorTy pvrtmp_6922 = tmp_struct_98.field1; + CursorTy pvrtmp_6923 = tmp_struct_98.field2; + CursorTy pvrtmp_6924 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2949 = 3; + + CursorTy writetag_4795 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6921, pvrtmp_6922, + loc_2949, pvrtmp_6924}; + break; + } + + case 15: + { + CursorTy tmpcur_6933 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6934 = tmpcur_6852 + 8; + CursorTy tmpcur_6935 = *(CursorTy *) tmpaftercur_6934; + CursorTy tmpaftercur_6936 = tmpaftercur_6934 + 8; + CursorTy jump_4050 = tmpaftercur_6934 + 8; + CursorTy jump_4049 = tmpcur_6852 + 8; + CursorTy loc_3400 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3400, tmpaftercur_6936); + CursorTy pvrtmp_6937 = tmp_struct_99.field0; + CursorTy pvrtmp_6938 = tmp_struct_99.field1; + CursorTy pvrtmp_6939 = tmp_struct_99.field2; + CursorTy pvrtmp_6940 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6937, pvrtmp_6940, tmpcur_6933); + CursorTy pvrtmp_6945 = tmp_struct_100.field0; + CursorTy pvrtmp_6946 = tmp_struct_100.field1; + CursorTy pvrtmp_6947 = tmp_struct_100.field2; + CursorTy pvrtmp_6948 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_6945, pvrtmp_6948, tmpcur_6935); + CursorTy pvrtmp_6953 = tmp_struct_101.field0; + CursorTy pvrtmp_6954 = tmp_struct_101.field1; + CursorTy pvrtmp_6955 = tmp_struct_101.field2; + CursorTy pvrtmp_6956 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2949 = 4; + + CursorTy writetag_4806 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6953, pvrtmp_6954, + loc_2949, pvrtmp_6956}; + break; + } + + case 17: + { + CursorTy tmpcur_6965 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6966 = tmpcur_6852 + 8; + CursorTy tmpcur_6967 = *(CursorTy *) tmpaftercur_6966; + CursorTy tmpaftercur_6968 = tmpaftercur_6966 + 8; + CursorTy jump_4056 = tmpaftercur_6966 + 8; + CursorTy jump_4055 = tmpcur_6852 + 8; + CursorTy loc_3420 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2950, end_r_2951, loc_3420, tmpaftercur_6968); + CursorTy pvrtmp_6969 = tmp_struct_102.field0; + CursorTy pvrtmp_6970 = tmp_struct_102.field1; + CursorTy pvrtmp_6971 = tmp_struct_102.field2; + CursorTy pvrtmp_6972 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6969, pvrtmp_6972, tmpcur_6965); + CursorTy pvrtmp_6977 = tmp_struct_103.field0; + CursorTy pvrtmp_6978 = tmp_struct_103.field1; + CursorTy pvrtmp_6979 = tmp_struct_103.field2; + CursorTy pvrtmp_6980 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6977, pvrtmp_6980, tmpcur_6967); + CursorTy pvrtmp_6985 = tmp_struct_104.field0; + CursorTy pvrtmp_6986 = tmp_struct_104.field1; + CursorTy pvrtmp_6987 = tmp_struct_104.field2; + CursorTy pvrtmp_6988 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2949 = 5; + + CursorTy writetag_4817 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6985, pvrtmp_6986, + loc_2949, pvrtmp_6988}; + break; + } + + case 19: + { + CursorTy tmpcur_6997 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6998 = tmpcur_6852 + 8; + CursorTy tmpcur_6999 = *(CursorTy *) tmpaftercur_6998; + CursorTy tmpaftercur_7000 = tmpaftercur_6998 + 8; + CursorTy jump_4062 = tmpaftercur_6998 + 8; + CursorTy jump_4061 = tmpcur_6852 + 8; + CursorTy loc_3440 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3440, tmpaftercur_7000); + CursorTy pvrtmp_7001 = tmp_struct_105.field0; + CursorTy pvrtmp_7002 = tmp_struct_105.field1; + CursorTy pvrtmp_7003 = tmp_struct_105.field2; + CursorTy pvrtmp_7004 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7001, pvrtmp_7004, tmpcur_6997); + CursorTy pvrtmp_7009 = tmp_struct_106.field0; + CursorTy pvrtmp_7010 = tmp_struct_106.field1; + CursorTy pvrtmp_7011 = tmp_struct_106.field2; + CursorTy pvrtmp_7012 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_7009, pvrtmp_7012, tmpcur_6999); + CursorTy pvrtmp_7017 = tmp_struct_107.field0; + CursorTy pvrtmp_7018 = tmp_struct_107.field1; + CursorTy pvrtmp_7019 = tmp_struct_107.field2; + CursorTy pvrtmp_7020 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2949 = 6; + + CursorTy writetag_4828 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7017, pvrtmp_7018, + loc_2949, pvrtmp_7020}; + break; + } + + case 21: + { + CursorTy tmpcur_7029 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7030 = tmpcur_6852 + 8; + CursorTy tmpcur_7031 = *(CursorTy *) tmpaftercur_7030; + CursorTy tmpaftercur_7032 = tmpaftercur_7030 + 8; + CursorTy jump_4068 = tmpaftercur_7030 + 8; + CursorTy jump_4067 = tmpcur_6852 + 8; + CursorTy loc_3460 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3460, tmpaftercur_7032); + CursorTy pvrtmp_7033 = tmp_struct_108.field0; + CursorTy pvrtmp_7034 = tmp_struct_108.field1; + CursorTy pvrtmp_7035 = tmp_struct_108.field2; + CursorTy pvrtmp_7036 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7033, pvrtmp_7036, tmpcur_7029); + CursorTy pvrtmp_7041 = tmp_struct_109.field0; + CursorTy pvrtmp_7042 = tmp_struct_109.field1; + CursorTy pvrtmp_7043 = tmp_struct_109.field2; + CursorTy pvrtmp_7044 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_7041, pvrtmp_7044, tmpcur_7031); + CursorTy pvrtmp_7049 = tmp_struct_110.field0; + CursorTy pvrtmp_7050 = tmp_struct_110.field1; + CursorTy pvrtmp_7051 = tmp_struct_110.field2; + CursorTy pvrtmp_7052 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2949 = 7; + + CursorTy writetag_4839 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7049, pvrtmp_7050, + loc_2949, pvrtmp_7052}; + break; + } + + case 23: + { + CursorTy tmpcur_7061 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7062 = tmpcur_6852 + 8; + CursorTy tmpcur_7063 = *(CursorTy *) tmpaftercur_7062; + CursorTy tmpaftercur_7064 = tmpaftercur_7062 + 8; + CursorTy jump_4074 = tmpaftercur_7062 + 8; + CursorTy jump_4073 = tmpcur_6852 + 8; + CursorTy loc_3480 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3480, tmpaftercur_7064); + CursorTy pvrtmp_7065 = tmp_struct_111.field0; + CursorTy pvrtmp_7066 = tmp_struct_111.field1; + CursorTy pvrtmp_7067 = tmp_struct_111.field2; + CursorTy pvrtmp_7068 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_7065, pvrtmp_7068, tmpcur_7061); + CursorTy pvrtmp_7073 = tmp_struct_112.field0; + CursorTy pvrtmp_7074 = tmp_struct_112.field1; + CursorTy pvrtmp_7075 = tmp_struct_112.field2; + CursorTy pvrtmp_7076 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7073, pvrtmp_7076, tmpcur_7063); + CursorTy pvrtmp_7081 = tmp_struct_113.field0; + CursorTy pvrtmp_7082 = tmp_struct_113.field1; + CursorTy pvrtmp_7083 = tmp_struct_113.field2; + CursorTy pvrtmp_7084 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2949 = 8; + + CursorTy writetag_4850 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7081, pvrtmp_7082, + loc_2949, pvrtmp_7084}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7093 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7094 = tmpcur_6852 + 8; + CursorTy jump_4310 = tmpcur_6852 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_2949, tmpcur_7093); + CursorTy pvrtmp_7095 = tmp_struct_114.field0; + CursorTy pvrtmp_7096 = tmp_struct_114.field1; + CursorTy pvrtmp_7097 = tmp_struct_114.field2; + CursorTy pvrtmp_7098 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7095, jump_4310, + pvrtmp_7097, pvrtmp_7098}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7105 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7106 = tmpcur_6852 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_2949, tmpcur_7105); + CursorTy pvrtmp_7107 = tmp_struct_115.field0; + CursorTy pvrtmp_7108 = tmp_struct_115.field1; + CursorTy pvrtmp_7109 = tmp_struct_115.field2; + CursorTy pvrtmp_7110 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7107, pvrtmp_7108, + pvrtmp_7109, pvrtmp_7110}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6851"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2953, CursorTy arg_760_1365_1686) +{ + TagTyPacked tmpval_7118 = *(TagTyPacked *) arg_760_1365_1686; + CursorTy tmpcur_7119 = arg_760_1365_1686 + 1; + + + switch_7176: + ; + switch (tmpval_7118) { + + case 0: + { + CursorTy jump_4079 = arg_760_1365_1686 + 1; + + return (CursorProd) {jump_4079}; + break; + } + + case 9: + { + CursorTy tmpcur_7120 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7121 = tmpcur_7119 + 8; + CursorTy jump_4081 = tmpcur_7119 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2953, tmpaftercur_7121); + CursorTy pvrtmp_7122 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2953, tmpcur_7120); + CursorTy pvrtmp_7123 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7123}; + break; + } + + case 11: + { + CursorTy tmpcur_7124 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7125 = tmpcur_7119 + 8; + CursorTy jump_4085 = tmpcur_7119 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2953, tmpaftercur_7125); + CursorTy pvrtmp_7126 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2953, tmpcur_7124); + CursorTy pvrtmp_7127 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7127}; + break; + } + + case 13: + { + CursorTy tmpcur_7128 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7129 = tmpcur_7119 + 8; + CursorTy tmpcur_7130 = *(CursorTy *) tmpaftercur_7129; + CursorTy tmpaftercur_7131 = tmpaftercur_7129 + 8; + CursorTy jump_4090 = tmpaftercur_7129 + 8; + CursorTy jump_4089 = tmpcur_7119 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2953, tmpaftercur_7131); + CursorTy pvrtmp_7132 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2953, tmpcur_7128); + CursorTy pvrtmp_7133 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2953, tmpcur_7130); + CursorTy pvrtmp_7134 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7134}; + break; + } + + case 15: + { + CursorTy tmpcur_7135 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7136 = tmpcur_7119 + 8; + CursorTy tmpcur_7137 = *(CursorTy *) tmpaftercur_7136; + CursorTy tmpaftercur_7138 = tmpaftercur_7136 + 8; + CursorTy jump_4096 = tmpaftercur_7136 + 8; + CursorTy jump_4095 = tmpcur_7119 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2953, tmpaftercur_7138); + CursorTy pvrtmp_7139 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2953, tmpcur_7135); + CursorTy pvrtmp_7140 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2953, tmpcur_7137); + CursorTy pvrtmp_7141 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7141}; + break; + } + + case 17: + { + CursorTy tmpcur_7142 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7143 = tmpcur_7119 + 8; + CursorTy tmpcur_7144 = *(CursorTy *) tmpaftercur_7143; + CursorTy tmpaftercur_7145 = tmpaftercur_7143 + 8; + CursorTy jump_4102 = tmpaftercur_7143 + 8; + CursorTy jump_4101 = tmpcur_7119 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2953, tmpaftercur_7145); + CursorTy pvrtmp_7146 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2953, tmpcur_7142); + CursorTy pvrtmp_7147 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2953, tmpcur_7144); + CursorTy pvrtmp_7148 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7148}; + break; + } + + case 19: + { + CursorTy tmpcur_7149 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7150 = tmpcur_7119 + 8; + CursorTy tmpcur_7151 = *(CursorTy *) tmpaftercur_7150; + CursorTy tmpaftercur_7152 = tmpaftercur_7150 + 8; + CursorTy jump_4108 = tmpaftercur_7150 + 8; + CursorTy jump_4107 = tmpcur_7119 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2953, tmpaftercur_7152); + CursorTy pvrtmp_7153 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2953, tmpcur_7149); + CursorTy pvrtmp_7154 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2953, tmpcur_7151); + CursorTy pvrtmp_7155 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7155}; + break; + } + + case 21: + { + CursorTy tmpcur_7156 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7157 = tmpcur_7119 + 8; + CursorTy tmpcur_7158 = *(CursorTy *) tmpaftercur_7157; + CursorTy tmpaftercur_7159 = tmpaftercur_7157 + 8; + CursorTy jump_4114 = tmpaftercur_7157 + 8; + CursorTy jump_4113 = tmpcur_7119 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2953, tmpaftercur_7159); + CursorTy pvrtmp_7160 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2953, tmpcur_7156); + CursorTy pvrtmp_7161 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2953, tmpcur_7158); + CursorTy pvrtmp_7162 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7162}; + break; + } + + case 23: + { + CursorTy tmpcur_7163 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7164 = tmpcur_7119 + 8; + CursorTy tmpcur_7165 = *(CursorTy *) tmpaftercur_7164; + CursorTy tmpaftercur_7166 = tmpaftercur_7164 + 8; + CursorTy jump_4120 = tmpaftercur_7164 + 8; + CursorTy jump_4119 = tmpcur_7119 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2953, tmpaftercur_7166); + CursorTy pvrtmp_7167 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2953, tmpcur_7163); + CursorTy pvrtmp_7168 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2953, tmpcur_7165); + CursorTy pvrtmp_7169 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7169}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7170 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7171 = tmpcur_7119 + 8; + CursorTy jump_4316 = tmpcur_7119 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2953, tmpcur_7170); + CursorTy pvrtmp_7172 = tmp_struct_138.field0; + + return (CursorProd) {jump_4316}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7173 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7174 = tmpcur_7119 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2953, tmpcur_7173); + CursorTy pvrtmp_7175 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7175}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7118"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2955, CursorTy arg_805_1410_1731) +{ + TagTyPacked tmpval_7177 = *(TagTyPacked *) arg_805_1410_1731; + CursorTy tmpcur_7178 = arg_805_1410_1731 + 1; + + + switch_7235: + ; + switch (tmpval_7177) { + + case 0: + { + CursorTy jump_4125 = arg_805_1410_1731 + 1; + unsigned char wildcard_806_1411_1732 = print_symbol(6135); + unsigned char wildcard_807_1412_1733 = print_symbol(6129); + + return (CursorProd) {jump_4125}; + break; + } + + case 9: + { + CursorTy tmpcur_7179 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7180 = tmpcur_7178 + 8; + CursorTy jump_4127 = tmpcur_7178 + 8; + unsigned char wildcard_812_1415_1736 = print_symbol(6141); + CursorProd tmp_struct_140 = + _print_Content(end_r_2955, tmpaftercur_7180); + CursorTy pvrtmp_7181 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2955, tmpcur_7179); + CursorTy pvrtmp_7182 = tmp_struct_141.field0; + unsigned char wildcard_813_1418_1739 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7182}; + break; + } + + case 11: + { + CursorTy tmpcur_7183 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7184 = tmpcur_7178 + 8; + CursorTy jump_4131 = tmpcur_7178 + 8; + unsigned char wildcard_818_1421_1742 = print_symbol(6144); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2955, tmpaftercur_7184); + CursorTy pvrtmp_7185 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2955, tmpcur_7183); + CursorTy pvrtmp_7186 = tmp_struct_143.field0; + unsigned char wildcard_819_1424_1745 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7186}; + break; + } + + case 13: + { + CursorTy tmpcur_7187 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7188 = tmpcur_7178 + 8; + CursorTy tmpcur_7189 = *(CursorTy *) tmpaftercur_7188; + CursorTy tmpaftercur_7190 = tmpaftercur_7188 + 8; + CursorTy jump_4136 = tmpaftercur_7188 + 8; + CursorTy jump_4135 = tmpcur_7178 + 8; + unsigned char wildcard_826_1428_1749 = print_symbol(6132); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2955, tmpaftercur_7190); + CursorTy pvrtmp_7191 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2955, tmpcur_7187); + CursorTy pvrtmp_7192 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2955, tmpcur_7189); + CursorTy pvrtmp_7193 = tmp_struct_146.field0; + unsigned char wildcard_827_1432_1753 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7193}; + break; + } + + case 15: + { + CursorTy tmpcur_7194 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7195 = tmpcur_7178 + 8; + CursorTy tmpcur_7196 = *(CursorTy *) tmpaftercur_7195; + CursorTy tmpaftercur_7197 = tmpaftercur_7195 + 8; + CursorTy jump_4142 = tmpaftercur_7195 + 8; + CursorTy jump_4141 = tmpcur_7178 + 8; + unsigned char wildcard_834_1436_1757 = print_symbol(6143); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2955, tmpaftercur_7197); + CursorTy pvrtmp_7198 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2955, tmpcur_7194); + CursorTy pvrtmp_7199 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2955, tmpcur_7196); + CursorTy pvrtmp_7200 = tmp_struct_149.field0; + unsigned char wildcard_835_1440_1761 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7200}; + break; + } + + case 17: + { + CursorTy tmpcur_7201 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7202 = tmpcur_7178 + 8; + CursorTy tmpcur_7203 = *(CursorTy *) tmpaftercur_7202; + CursorTy tmpaftercur_7204 = tmpaftercur_7202 + 8; + CursorTy jump_4148 = tmpaftercur_7202 + 8; + CursorTy jump_4147 = tmpcur_7178 + 8; + unsigned char wildcard_842_1444_1765 = print_symbol(6133); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2955, tmpaftercur_7204); + CursorTy pvrtmp_7205 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2955, tmpcur_7201); + CursorTy pvrtmp_7206 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2955, tmpcur_7203); + CursorTy pvrtmp_7207 = tmp_struct_152.field0; + unsigned char wildcard_843_1448_1769 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7207}; + break; + } + + case 19: + { + CursorTy tmpcur_7208 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7209 = tmpcur_7178 + 8; + CursorTy tmpcur_7210 = *(CursorTy *) tmpaftercur_7209; + CursorTy tmpaftercur_7211 = tmpaftercur_7209 + 8; + CursorTy jump_4154 = tmpaftercur_7209 + 8; + CursorTy jump_4153 = tmpcur_7178 + 8; + unsigned char wildcard_850_1452_1773 = print_symbol(6142); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2955, tmpaftercur_7211); + CursorTy pvrtmp_7212 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2955, tmpcur_7208); + CursorTy pvrtmp_7213 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2955, tmpcur_7210); + CursorTy pvrtmp_7214 = tmp_struct_155.field0; + unsigned char wildcard_851_1456_1777 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7214}; + break; + } + + case 21: + { + CursorTy tmpcur_7215 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7216 = tmpcur_7178 + 8; + CursorTy tmpcur_7217 = *(CursorTy *) tmpaftercur_7216; + CursorTy tmpaftercur_7218 = tmpaftercur_7216 + 8; + CursorTy jump_4160 = tmpaftercur_7216 + 8; + CursorTy jump_4159 = tmpcur_7178 + 8; + unsigned char wildcard_858_1460_1781 = print_symbol(6139); + CursorProd tmp_struct_156 = + _print_Content(end_r_2955, tmpaftercur_7218); + CursorTy pvrtmp_7219 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2955, tmpcur_7215); + CursorTy pvrtmp_7220 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2955, tmpcur_7217); + CursorTy pvrtmp_7221 = tmp_struct_158.field0; + unsigned char wildcard_859_1464_1785 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7221}; + break; + } + + case 23: + { + CursorTy tmpcur_7222 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7223 = tmpcur_7178 + 8; + CursorTy tmpcur_7224 = *(CursorTy *) tmpaftercur_7223; + CursorTy tmpaftercur_7225 = tmpaftercur_7223 + 8; + CursorTy jump_4166 = tmpaftercur_7223 + 8; + CursorTy jump_4165 = tmpcur_7178 + 8; + unsigned char wildcard_866_1468_1789 = print_symbol(6140); + CursorProd tmp_struct_159 = + _print_Content(end_r_2955, tmpaftercur_7225); + CursorTy pvrtmp_7226 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2955, tmpcur_7222); + CursorTy pvrtmp_7227 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2955, tmpcur_7224); + CursorTy pvrtmp_7228 = tmp_struct_161.field0; + unsigned char wildcard_867_1472_1793 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7228}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7229 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7230 = tmpcur_7178 + 8; + CursorTy jump_4322 = tmpcur_7178 + 8; + unsigned char wildcard_4325 = print_symbol(6146); + CursorProd tmp_struct_162 = _print_Adt(end_r_2955, tmpcur_7229); + CursorTy pvrtmp_7231 = tmp_struct_162.field0; + + return (CursorProd) {jump_4322}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7232 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7233 = tmpcur_7178 + 8; + unsigned char wildcard_4325 = print_symbol(6145); + CursorProd tmp_struct_163 = _print_Adt(end_r_2955, tmpcur_7232); + CursorTy pvrtmp_7234 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7234}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7177"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2958, + CursorTy end_r_2959, CursorTy loc_2957, + CursorTy arg_868_1473_1794) +{ + if (loc_2957 + 32 > end_r_2959) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2959); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2959 = chunk_end_169; + *(TagTyPacked *) loc_2957 = 255; + + CursorTy redir = loc_2957 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2957 = chunk_start_168; + } + + CursorTy loc_3658 = loc_2957 + 1; + CursorTy loc_3659 = loc_3658 + 8; + TagTyPacked tmpval_7236 = *(TagTyPacked *) arg_868_1473_1794; + CursorTy tmpcur_7237 = arg_868_1473_1794 + 1; + + + switch_7280: + ; + switch (tmpval_7236) { + + case 0: + { + CursorTy jump_4171 = arg_868_1473_1794 + 1; + + *(TagTyPacked *) loc_2957 = 0; + + CursorTy writetag_4964 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2959, jump_4171, + loc_2957, writetag_4964}; + break; + } + + case 1: + { + IntTy tmpval_7242 = *(IntTy *) tmpcur_7237; + CursorTy tmpcur_7243 = tmpcur_7237 + sizeof(IntTy); + CursorTy jump_4173 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2958, end_r_2959, loc_3659, tmpcur_7243); + CursorTy pvrtmp_7244 = tmp_struct_164.field0; + CursorTy pvrtmp_7245 = tmp_struct_164.field1; + CursorTy pvrtmp_7246 = tmp_struct_164.field2; + CursorTy pvrtmp_7247 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2957 = 1; + + CursorTy writetag_4969 = loc_2957 + 1; + + *(IntTy *) writetag_4969 = tmpval_7242; + + CursorTy writecur_4970 = writetag_4969 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7244, pvrtmp_7245, + loc_2957, pvrtmp_7247}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7256 = *(CursorTy *) tmpcur_7237; + CursorTy tmpaftercur_7257 = tmpcur_7237 + 8; + CursorTy jump_4328 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2958, end_r_2959, loc_2957, tmpcur_7256); + CursorTy pvrtmp_7258 = tmp_struct_165.field0; + CursorTy pvrtmp_7259 = tmp_struct_165.field1; + CursorTy pvrtmp_7260 = tmp_struct_165.field2; + CursorTy pvrtmp_7261 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7258, jump_4328, + pvrtmp_7260, pvrtmp_7261}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7268 = *(CursorTy *) tmpcur_7237; + CursorTy tmpaftercur_7269 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2958, end_r_2959, loc_2957, tmpcur_7268); + CursorTy pvrtmp_7270 = tmp_struct_166.field0; + CursorTy pvrtmp_7271 = tmp_struct_166.field1; + CursorTy pvrtmp_7272 = tmp_struct_166.field2; + CursorTy pvrtmp_7273 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7270, pvrtmp_7271, + pvrtmp_7272, pvrtmp_7273}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7236"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2962, + CursorTy end_r_2963, + CursorTy loc_2961, + CursorTy arg_873_1478_1799) +{ + CursorTy loc_3671 = loc_2961 + 1; + CursorTy loc_3672 = loc_3671 + 8; + TagTyPacked tmpval_7281 = *(TagTyPacked *) arg_873_1478_1799; + CursorTy tmpcur_7282 = arg_873_1478_1799 + 1; + + + switch_7325: + ; + switch (tmpval_7281) { + + case 0: + { + CursorTy jump_4176 = arg_873_1478_1799 + 1; + + *(TagTyPacked *) loc_2961 = 0; + + CursorTy writetag_4980 = loc_2961 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2963, jump_4176, + loc_2961, writetag_4980}; + break; + } + + case 1: + { + IntTy tmpval_7287 = *(IntTy *) tmpcur_7282; + CursorTy tmpcur_7288 = tmpcur_7282 + sizeof(IntTy); + CursorTy jump_4178 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_3672, tmpcur_7288); + CursorTy pvrtmp_7289 = tmp_struct_170.field0; + CursorTy pvrtmp_7290 = tmp_struct_170.field1; + CursorTy pvrtmp_7291 = tmp_struct_170.field2; + CursorTy pvrtmp_7292 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2961 = 1; + + CursorTy writetag_4985 = loc_2961 + 1; + + *(IntTy *) writetag_4985 = tmpval_7287; + + CursorTy writecur_4986 = writetag_4985 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7289, pvrtmp_7290, + loc_2961, pvrtmp_7292}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7301 = *(CursorTy *) tmpcur_7282; + CursorTy tmpaftercur_7302 = tmpcur_7282 + 8; + CursorTy jump_4334 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_2961, tmpcur_7301); + CursorTy pvrtmp_7303 = tmp_struct_171.field0; + CursorTy pvrtmp_7304 = tmp_struct_171.field1; + CursorTy pvrtmp_7305 = tmp_struct_171.field2; + CursorTy pvrtmp_7306 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7303, jump_4334, + pvrtmp_7305, pvrtmp_7306}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7313 = *(CursorTy *) tmpcur_7282; + CursorTy tmpaftercur_7314 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_2961, tmpcur_7313); + CursorTy pvrtmp_7315 = tmp_struct_172.field0; + CursorTy pvrtmp_7316 = tmp_struct_172.field1; + CursorTy pvrtmp_7317 = tmp_struct_172.field2; + CursorTy pvrtmp_7318 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7315, pvrtmp_7316, + pvrtmp_7317, pvrtmp_7318}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7281"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2965, CursorTy arg_878_1483_1804) +{ + TagTyPacked tmpval_7326 = *(TagTyPacked *) arg_878_1483_1804; + CursorTy tmpcur_7327 = arg_878_1483_1804 + 1; + + + switch_7337: + ; + switch (tmpval_7326) { + + case 0: + { + CursorTy jump_4181 = arg_878_1483_1804 + 1; + + return (CursorProd) {jump_4181}; + break; + } + + case 1: + { + IntTy tmpval_7328 = *(IntTy *) tmpcur_7327; + CursorTy tmpcur_7329 = tmpcur_7327 + sizeof(IntTy); + CursorTy jump_4183 = tmpcur_7327 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2965, tmpcur_7329); + CursorTy pvrtmp_7330 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7330}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7331 = *(CursorTy *) tmpcur_7327; + CursorTy tmpaftercur_7332 = tmpcur_7327 + 8; + CursorTy jump_4340 = tmpcur_7327 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2965, tmpcur_7331); + CursorTy pvrtmp_7333 = tmp_struct_174.field0; + + return (CursorProd) {jump_4340}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7334 = *(CursorTy *) tmpcur_7327; + CursorTy tmpaftercur_7335 = tmpcur_7327 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2965, tmpcur_7334); + CursorTy pvrtmp_7336 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7336}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7326"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2967, CursorTy arg_883_1487_1808) +{ + TagTyPacked tmpval_7338 = *(TagTyPacked *) arg_883_1487_1808; + CursorTy tmpcur_7339 = arg_883_1487_1808 + 1; + + + switch_7349: + ; + switch (tmpval_7338) { + + case 0: + { + CursorTy jump_4186 = arg_883_1487_1808 + 1; + unsigned char wildcard_884_1488_1809 = print_symbol(6134); + unsigned char wildcard_885_1489_1810 = print_symbol(6129); + + return (CursorProd) {jump_4186}; + break; + } + + case 1: + { + IntTy tmpval_7340 = *(IntTy *) tmpcur_7339; + CursorTy tmpcur_7341 = tmpcur_7339 + sizeof(IntTy); + CursorTy jump_4188 = tmpcur_7339 + 8; + unsigned char wildcard_890_1492_1813 = print_symbol(6131); + unsigned char y_888_1493_1814 = printf("%lld", tmpval_7340); + CursorProd tmp_struct_176 = _print_Tags(end_r_2967, tmpcur_7341); + CursorTy pvrtmp_7342 = tmp_struct_176.field0; + unsigned char wildcard_891_1495_1816 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7342}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7343 = *(CursorTy *) tmpcur_7339; + CursorTy tmpaftercur_7344 = tmpcur_7339 + 8; + CursorTy jump_4346 = tmpcur_7339 + 8; + unsigned char wildcard_4349 = print_symbol(6146); + CursorProd tmp_struct_177 = _print_Tags(end_r_2967, tmpcur_7343); + CursorTy pvrtmp_7345 = tmp_struct_177.field0; + + return (CursorProd) {jump_4346}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7346 = *(CursorTy *) tmpcur_7339; + CursorTy tmpaftercur_7347 = tmpcur_7339 + 8; + unsigned char wildcard_4349 = print_symbol(6145); + CursorProd tmp_struct_178 = _print_Tags(end_r_2967, tmpcur_7346); + CursorTy pvrtmp_7348 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7348}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7338"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_2702) +{ + if (loc_2969 + 32 > end_r_2971) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2971); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2971 = chunk_end_184; + *(TagTyPacked *) loc_2969 = 255; + + CursorTy redir = loc_2969 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2969 = chunk_start_183; + } + + CursorTy loc_3696 = loc_2969 + 1; + CursorTy loc_3697 = loc_3696 + 8; + TagTyPacked tmpval_7350 = *(TagTyPacked *) arg_2702; + CursorTy tmpcur_7351 = arg_2702 + 1; + + + switch_7394: + ; + switch (tmpval_7350) { + + case 0: + { + CursorTy jump_4191 = arg_2702 + 1; + + *(TagTyPacked *) loc_2969 = 0; + + CursorTy writetag_5016 = loc_2969 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2971, jump_4191, + loc_2969, writetag_5016}; + break; + } + + case 1: + { + IntTy tmpval_7356 = *(IntTy *) tmpcur_7351; + CursorTy tmpcur_7357 = tmpcur_7351 + sizeof(IntTy); + CursorTy jump_4193 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_3697, tmpcur_7357); + CursorTy pvrtmp_7358 = tmp_struct_179.field0; + CursorTy pvrtmp_7359 = tmp_struct_179.field1; + CursorTy pvrtmp_7360 = tmp_struct_179.field2; + CursorTy pvrtmp_7361 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2969 = 1; + + CursorTy writetag_5021 = loc_2969 + 1; + + *(IntTy *) writetag_5021 = tmpval_7356; + + CursorTy writecur_5022 = writetag_5021 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7358, pvrtmp_7359, + loc_2969, pvrtmp_7361}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7370 = *(CursorTy *) tmpcur_7351; + CursorTy tmpaftercur_7371 = tmpcur_7351 + 8; + CursorTy jump_4352 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_2969, tmpcur_7370); + CursorTy pvrtmp_7372 = tmp_struct_180.field0; + CursorTy pvrtmp_7373 = tmp_struct_180.field1; + CursorTy pvrtmp_7374 = tmp_struct_180.field2; + CursorTy pvrtmp_7375 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7372, jump_4352, + pvrtmp_7374, pvrtmp_7375}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7382 = *(CursorTy *) tmpcur_7351; + CursorTy tmpaftercur_7383 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_2969, tmpcur_7382); + CursorTy pvrtmp_7384 = tmp_struct_181.field0; + CursorTy pvrtmp_7385 = tmp_struct_181.field1; + CursorTy pvrtmp_7386 = tmp_struct_181.field2; + CursorTy pvrtmp_7387 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7384, pvrtmp_7385, + pvrtmp_7386, pvrtmp_7387}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7350"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2974, + CursorTy end_r_2975, + CursorTy loc_2973, + CursorTy arg_2707) +{ + if (loc_2973 + 32 > end_r_2975) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2975); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2975 = chunk_end_191; + *(TagTyPacked *) loc_2973 = 255; + + CursorTy redir = loc_2973 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2973 = chunk_start_190; + } + + TagTyPacked tmpval_7395 = *(TagTyPacked *) arg_2707; + CursorTy tmpcur_7396 = arg_2707 + 1; + + + switch_7445: + ; + switch (tmpval_7395) { + + case 0: + { + CursorTy loc_3707 = loc_2973 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2974, end_r_2975, loc_3707, tmpcur_7396); + CursorTy pvrtmp_7397 = tmp_struct_185.field0; + CursorTy pvrtmp_7398 = tmp_struct_185.field1; + CursorTy pvrtmp_7399 = tmp_struct_185.field2; + CursorTy pvrtmp_7400 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2973 = 0; + + CursorTy writetag_5033 = loc_2973 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7397, pvrtmp_7398, + loc_2973, pvrtmp_7400}; + break; + } + + case 1: + { + CursorTy loc_3713 = loc_2973 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2974, end_r_2975, loc_3713, tmpcur_7396); + CursorTy pvrtmp_7409 = tmp_struct_186.field0; + CursorTy pvrtmp_7410 = tmp_struct_186.field1; + CursorTy pvrtmp_7411 = tmp_struct_186.field2; + CursorTy pvrtmp_7412 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2973 = 1; + + CursorTy writetag_5038 = loc_2973 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7409, pvrtmp_7410, + loc_2973, pvrtmp_7412}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7421 = *(CursorTy *) tmpcur_7396; + CursorTy tmpaftercur_7422 = tmpcur_7396 + 8; + CursorTy jump_4358 = tmpcur_7396 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2974, end_r_2975, loc_2973, tmpcur_7421); + CursorTy pvrtmp_7423 = tmp_struct_187.field0; + CursorTy pvrtmp_7424 = tmp_struct_187.field1; + CursorTy pvrtmp_7425 = tmp_struct_187.field2; + CursorTy pvrtmp_7426 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7423, jump_4358, + pvrtmp_7425, pvrtmp_7426}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7433 = *(CursorTy *) tmpcur_7396; + CursorTy tmpaftercur_7434 = tmpcur_7396 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2974, end_r_2975, loc_2973, tmpcur_7433); + CursorTy pvrtmp_7435 = tmp_struct_188.field0; + CursorTy pvrtmp_7436 = tmp_struct_188.field1; + CursorTy pvrtmp_7437 = tmp_struct_188.field2; + CursorTy pvrtmp_7438 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7435, pvrtmp_7436, + pvrtmp_7437, pvrtmp_7438}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7395"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2712) +{ + if (loc_2977 + 32 > end_r_2979) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2979); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2979 = chunk_end_218; + *(TagTyPacked *) loc_2977 = 255; + + CursorTy redir = loc_2977 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2977 = chunk_start_217; + } + + CursorTy loc_3726 = loc_2977 + 1; + CursorTy loc_3727 = loc_3726 + 8; + CursorTy loc_3728 = loc_3727 + 8; + CursorTy loc_3744 = loc_2977 + 1; + CursorTy loc_3745 = loc_3744 + 8; + CursorTy loc_3746 = loc_3745 + 8; + CursorTy loc_3766 = loc_2977 + 1; + CursorTy loc_3767 = loc_3766 + 8; + CursorTy loc_3768 = loc_3767 + 8; + CursorTy loc_3769 = loc_3768 + 8; + CursorTy loc_3793 = loc_2977 + 1; + CursorTy loc_3794 = loc_3793 + 8; + CursorTy loc_3795 = loc_3794 + 8; + CursorTy loc_3796 = loc_3795 + 8; + CursorTy loc_3820 = loc_2977 + 1; + CursorTy loc_3821 = loc_3820 + 8; + CursorTy loc_3822 = loc_3821 + 8; + CursorTy loc_3823 = loc_3822 + 8; + CursorTy loc_3847 = loc_2977 + 1; + CursorTy loc_3848 = loc_3847 + 8; + CursorTy loc_3849 = loc_3848 + 8; + CursorTy loc_3850 = loc_3849 + 8; + CursorTy loc_3874 = loc_2977 + 1; + CursorTy loc_3875 = loc_3874 + 8; + CursorTy loc_3876 = loc_3875 + 8; + CursorTy loc_3877 = loc_3876 + 8; + CursorTy loc_3901 = loc_2977 + 1; + CursorTy loc_3902 = loc_3901 + 8; + CursorTy loc_3903 = loc_3902 + 8; + CursorTy loc_3904 = loc_3903 + 8; + TagTyPacked tmpval_7446 = *(TagTyPacked *) arg_2712; + CursorTy tmpcur_7447 = arg_2712 + 1; + + + switch_7684: + ; + switch (tmpval_7446) { + + case 0: + { + CursorTy jump_4200 = arg_2712 + 1; + + *(TagTyPacked *) loc_2977 = 0; + + CursorTy writetag_5048 = loc_2977 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2979, jump_4200, + loc_2977, writetag_5048}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3728, tmpcur_7447); + CursorTy pvrtmp_7452 = tmp_struct_192.field0; + CursorTy pvrtmp_7453 = tmp_struct_192.field1; + CursorTy pvrtmp_7454 = tmp_struct_192.field2; + CursorTy pvrtmp_7455 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7452, pvrtmp_7455, pvrtmp_7453); + CursorTy pvrtmp_7460 = tmp_struct_193.field0; + CursorTy pvrtmp_7461 = tmp_struct_193.field1; + CursorTy pvrtmp_7462 = tmp_struct_193.field2; + CursorTy pvrtmp_7463 = tmp_struct_193.field3; + IntTy sizeof_y_2715__2717 = pvrtmp_7455 - pvrtmp_7454; + IntTy sizeof_y_2716__2718 = pvrtmp_7463 - pvrtmp_7462; + IntTy fltPrm_2806 = sizeof_y_2715__2717 + 0; + IntTy offset__2719 = 0 + fltPrm_2806; + IntTy fltPrm_2807 = sizeof_y_2715__2717 + sizeof_y_2716__2718; + IntTy size_dcon_2720 = 9 + fltPrm_2807; + + *(TagTyPacked *) loc_2977 = 160; + + CursorTy writetag_5053 = loc_2977 + 1; + + *(IntTy *) writetag_5053 = size_dcon_2720; + + CursorTy writecur_5054 = writetag_5053 + sizeof(IntTy); + + *(IntTy *) writecur_5054 = offset__2719; + + CursorTy writecur_5055 = writecur_5054 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7460, pvrtmp_7461, + loc_2977, pvrtmp_7463}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3746, tmpcur_7447); + CursorTy pvrtmp_7472 = tmp_struct_194.field0; + CursorTy pvrtmp_7473 = tmp_struct_194.field1; + CursorTy pvrtmp_7474 = tmp_struct_194.field2; + CursorTy pvrtmp_7475 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7472, pvrtmp_7475, pvrtmp_7473); + CursorTy pvrtmp_7480 = tmp_struct_195.field0; + CursorTy pvrtmp_7481 = tmp_struct_195.field1; + CursorTy pvrtmp_7482 = tmp_struct_195.field2; + CursorTy pvrtmp_7483 = tmp_struct_195.field3; + IntTy sizeof_y_2723__2725 = pvrtmp_7475 - pvrtmp_7474; + IntTy sizeof_y_2724__2726 = pvrtmp_7483 - pvrtmp_7482; + IntTy fltPrm_2808 = sizeof_y_2723__2725 + 0; + IntTy offset__2727 = 0 + fltPrm_2808; + IntTy fltPrm_2809 = sizeof_y_2723__2725 + sizeof_y_2724__2726; + IntTy size_dcon_2728 = 9 + fltPrm_2809; + + *(TagTyPacked *) loc_2977 = 162; + + CursorTy writetag_5062 = loc_2977 + 1; + + *(IntTy *) writetag_5062 = size_dcon_2728; + + CursorTy writecur_5063 = writetag_5062 + sizeof(IntTy); + + *(IntTy *) writecur_5063 = offset__2727; + + CursorTy writecur_5064 = writecur_5063 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7480, pvrtmp_7481, + loc_2977, pvrtmp_7483}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2978, end_r_2979, loc_3769, tmpcur_7447); + CursorTy pvrtmp_7492 = tmp_struct_196.field0; + CursorTy pvrtmp_7493 = tmp_struct_196.field1; + CursorTy pvrtmp_7494 = tmp_struct_196.field2; + CursorTy pvrtmp_7495 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7492, pvrtmp_7495, pvrtmp_7493); + CursorTy pvrtmp_7500 = tmp_struct_197.field0; + CursorTy pvrtmp_7501 = tmp_struct_197.field1; + CursorTy pvrtmp_7502 = tmp_struct_197.field2; + CursorTy pvrtmp_7503 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7500, pvrtmp_7503, pvrtmp_7501); + CursorTy pvrtmp_7508 = tmp_struct_198.field0; + CursorTy pvrtmp_7509 = tmp_struct_198.field1; + CursorTy pvrtmp_7510 = tmp_struct_198.field2; + CursorTy pvrtmp_7511 = tmp_struct_198.field3; + IntTy sizeof_y_2732__2735 = pvrtmp_7495 - pvrtmp_7494; + IntTy sizeof_y_2733__2736 = pvrtmp_7503 - pvrtmp_7502; + IntTy sizeof_y_2734__2737 = pvrtmp_7511 - pvrtmp_7510; + IntTy fltPrm_2810 = sizeof_y_2732__2735 + 0; + IntTy offset__2738 = 8 + fltPrm_2810; + IntTy fltPrm_2811 = sizeof_y_2732__2735 + sizeof_y_2733__2736; + IntTy offset__2739 = 0 + fltPrm_2811; + IntTy fltPrm_2813 = sizeof_y_2733__2736 + sizeof_y_2734__2737; + IntTy fltPrm_2812 = sizeof_y_2732__2735 + fltPrm_2813; + IntTy size_dcon_2740 = 17 + fltPrm_2812; + + *(TagTyPacked *) loc_2977 = 164; + + CursorTy writetag_5072 = loc_2977 + 1; + + *(IntTy *) writetag_5072 = size_dcon_2740; + + CursorTy writecur_5073 = writetag_5072 + sizeof(IntTy); + + *(IntTy *) writecur_5073 = offset__2738; + + CursorTy writecur_5074 = writecur_5073 + sizeof(IntTy); + + *(IntTy *) writecur_5074 = offset__2739; + + CursorTy writecur_5075 = writecur_5074 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7508, pvrtmp_7509, + loc_2977, pvrtmp_7511}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3796, tmpcur_7447); + CursorTy pvrtmp_7520 = tmp_struct_199.field0; + CursorTy pvrtmp_7521 = tmp_struct_199.field1; + CursorTy pvrtmp_7522 = tmp_struct_199.field2; + CursorTy pvrtmp_7523 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7520, pvrtmp_7523, pvrtmp_7521); + CursorTy pvrtmp_7528 = tmp_struct_200.field0; + CursorTy pvrtmp_7529 = tmp_struct_200.field1; + CursorTy pvrtmp_7530 = tmp_struct_200.field2; + CursorTy pvrtmp_7531 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7528, pvrtmp_7531, pvrtmp_7529); + CursorTy pvrtmp_7536 = tmp_struct_201.field0; + CursorTy pvrtmp_7537 = tmp_struct_201.field1; + CursorTy pvrtmp_7538 = tmp_struct_201.field2; + CursorTy pvrtmp_7539 = tmp_struct_201.field3; + IntTy sizeof_y_2744__2747 = pvrtmp_7523 - pvrtmp_7522; + IntTy sizeof_y_2745__2748 = pvrtmp_7531 - pvrtmp_7530; + IntTy sizeof_y_2746__2749 = pvrtmp_7539 - pvrtmp_7538; + IntTy fltPrm_2814 = sizeof_y_2744__2747 + 0; + IntTy offset__2750 = 8 + fltPrm_2814; + IntTy fltPrm_2815 = sizeof_y_2744__2747 + sizeof_y_2745__2748; + IntTy offset__2751 = 0 + fltPrm_2815; + IntTy fltPrm_2817 = sizeof_y_2745__2748 + sizeof_y_2746__2749; + IntTy fltPrm_2816 = sizeof_y_2744__2747 + fltPrm_2817; + IntTy size_dcon_2752 = 17 + fltPrm_2816; + + *(TagTyPacked *) loc_2977 = 166; + + CursorTy writetag_5084 = loc_2977 + 1; + + *(IntTy *) writetag_5084 = size_dcon_2752; + + CursorTy writecur_5085 = writetag_5084 + sizeof(IntTy); + + *(IntTy *) writecur_5085 = offset__2750; + + CursorTy writecur_5086 = writecur_5085 + sizeof(IntTy); + + *(IntTy *) writecur_5086 = offset__2751; + + CursorTy writecur_5087 = writecur_5086 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7536, pvrtmp_7537, + loc_2977, pvrtmp_7539}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2978, end_r_2979, loc_3823, tmpcur_7447); + CursorTy pvrtmp_7548 = tmp_struct_202.field0; + CursorTy pvrtmp_7549 = tmp_struct_202.field1; + CursorTy pvrtmp_7550 = tmp_struct_202.field2; + CursorTy pvrtmp_7551 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7548, pvrtmp_7551, pvrtmp_7549); + CursorTy pvrtmp_7556 = tmp_struct_203.field0; + CursorTy pvrtmp_7557 = tmp_struct_203.field1; + CursorTy pvrtmp_7558 = tmp_struct_203.field2; + CursorTy pvrtmp_7559 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7556, pvrtmp_7559, pvrtmp_7557); + CursorTy pvrtmp_7564 = tmp_struct_204.field0; + CursorTy pvrtmp_7565 = tmp_struct_204.field1; + CursorTy pvrtmp_7566 = tmp_struct_204.field2; + CursorTy pvrtmp_7567 = tmp_struct_204.field3; + IntTy sizeof_y_2756__2759 = pvrtmp_7551 - pvrtmp_7550; + IntTy sizeof_y_2757__2760 = pvrtmp_7559 - pvrtmp_7558; + IntTy sizeof_y_2758__2761 = pvrtmp_7567 - pvrtmp_7566; + IntTy fltPrm_2818 = sizeof_y_2756__2759 + 0; + IntTy offset__2762 = 8 + fltPrm_2818; + IntTy fltPrm_2819 = sizeof_y_2756__2759 + sizeof_y_2757__2760; + IntTy offset__2763 = 0 + fltPrm_2819; + IntTy fltPrm_2821 = sizeof_y_2757__2760 + sizeof_y_2758__2761; + IntTy fltPrm_2820 = sizeof_y_2756__2759 + fltPrm_2821; + IntTy size_dcon_2764 = 17 + fltPrm_2820; + + *(TagTyPacked *) loc_2977 = 168; + + CursorTy writetag_5096 = loc_2977 + 1; + + *(IntTy *) writetag_5096 = size_dcon_2764; + + CursorTy writecur_5097 = writetag_5096 + sizeof(IntTy); + + *(IntTy *) writecur_5097 = offset__2762; + + CursorTy writecur_5098 = writecur_5097 + sizeof(IntTy); + + *(IntTy *) writecur_5098 = offset__2763; + + CursorTy writecur_5099 = writecur_5098 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7564, pvrtmp_7565, + loc_2977, pvrtmp_7567}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3850, tmpcur_7447); + CursorTy pvrtmp_7576 = tmp_struct_205.field0; + CursorTy pvrtmp_7577 = tmp_struct_205.field1; + CursorTy pvrtmp_7578 = tmp_struct_205.field2; + CursorTy pvrtmp_7579 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7576, pvrtmp_7579, pvrtmp_7577); + CursorTy pvrtmp_7584 = tmp_struct_206.field0; + CursorTy pvrtmp_7585 = tmp_struct_206.field1; + CursorTy pvrtmp_7586 = tmp_struct_206.field2; + CursorTy pvrtmp_7587 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7584, pvrtmp_7587, pvrtmp_7585); + CursorTy pvrtmp_7592 = tmp_struct_207.field0; + CursorTy pvrtmp_7593 = tmp_struct_207.field1; + CursorTy pvrtmp_7594 = tmp_struct_207.field2; + CursorTy pvrtmp_7595 = tmp_struct_207.field3; + IntTy sizeof_y_2768__2771 = pvrtmp_7579 - pvrtmp_7578; + IntTy sizeof_y_2769__2772 = pvrtmp_7587 - pvrtmp_7586; + IntTy sizeof_y_2770__2773 = pvrtmp_7595 - pvrtmp_7594; + IntTy fltPrm_2822 = sizeof_y_2768__2771 + 0; + IntTy offset__2774 = 8 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2768__2771 + sizeof_y_2769__2772; + IntTy offset__2775 = 0 + fltPrm_2823; + IntTy fltPrm_2825 = sizeof_y_2769__2772 + sizeof_y_2770__2773; + IntTy fltPrm_2824 = sizeof_y_2768__2771 + fltPrm_2825; + IntTy size_dcon_2776 = 17 + fltPrm_2824; + + *(TagTyPacked *) loc_2977 = 170; + + CursorTy writetag_5108 = loc_2977 + 1; + + *(IntTy *) writetag_5108 = size_dcon_2776; + + CursorTy writecur_5109 = writetag_5108 + sizeof(IntTy); + + *(IntTy *) writecur_5109 = offset__2774; + + CursorTy writecur_5110 = writecur_5109 + sizeof(IntTy); + + *(IntTy *) writecur_5110 = offset__2775; + + CursorTy writecur_5111 = writecur_5110 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7592, pvrtmp_7593, + loc_2977, pvrtmp_7595}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3877, tmpcur_7447); + CursorTy pvrtmp_7604 = tmp_struct_208.field0; + CursorTy pvrtmp_7605 = tmp_struct_208.field1; + CursorTy pvrtmp_7606 = tmp_struct_208.field2; + CursorTy pvrtmp_7607 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7604, pvrtmp_7607, pvrtmp_7605); + CursorTy pvrtmp_7612 = tmp_struct_209.field0; + CursorTy pvrtmp_7613 = tmp_struct_209.field1; + CursorTy pvrtmp_7614 = tmp_struct_209.field2; + CursorTy pvrtmp_7615 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7612, pvrtmp_7615, pvrtmp_7613); + CursorTy pvrtmp_7620 = tmp_struct_210.field0; + CursorTy pvrtmp_7621 = tmp_struct_210.field1; + CursorTy pvrtmp_7622 = tmp_struct_210.field2; + CursorTy pvrtmp_7623 = tmp_struct_210.field3; + IntTy sizeof_y_2780__2783 = pvrtmp_7607 - pvrtmp_7606; + IntTy sizeof_y_2781__2784 = pvrtmp_7615 - pvrtmp_7614; + IntTy sizeof_y_2782__2785 = pvrtmp_7623 - pvrtmp_7622; + IntTy fltPrm_2826 = sizeof_y_2780__2783 + 0; + IntTy offset__2786 = 8 + fltPrm_2826; + IntTy fltPrm_2827 = sizeof_y_2780__2783 + sizeof_y_2781__2784; + IntTy offset__2787 = 0 + fltPrm_2827; + IntTy fltPrm_2829 = sizeof_y_2781__2784 + sizeof_y_2782__2785; + IntTy fltPrm_2828 = sizeof_y_2780__2783 + fltPrm_2829; + IntTy size_dcon_2788 = 17 + fltPrm_2828; + + *(TagTyPacked *) loc_2977 = 172; + + CursorTy writetag_5120 = loc_2977 + 1; + + *(IntTy *) writetag_5120 = size_dcon_2788; + + CursorTy writecur_5121 = writetag_5120 + sizeof(IntTy); + + *(IntTy *) writecur_5121 = offset__2786; + + CursorTy writecur_5122 = writecur_5121 + sizeof(IntTy); + + *(IntTy *) writecur_5122 = offset__2787; + + CursorTy writecur_5123 = writecur_5122 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7620, pvrtmp_7621, + loc_2977, pvrtmp_7623}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3904, tmpcur_7447); + CursorTy pvrtmp_7632 = tmp_struct_211.field0; + CursorTy pvrtmp_7633 = tmp_struct_211.field1; + CursorTy pvrtmp_7634 = tmp_struct_211.field2; + CursorTy pvrtmp_7635 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7632, pvrtmp_7635, pvrtmp_7633); + CursorTy pvrtmp_7640 = tmp_struct_212.field0; + CursorTy pvrtmp_7641 = tmp_struct_212.field1; + CursorTy pvrtmp_7642 = tmp_struct_212.field2; + CursorTy pvrtmp_7643 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7640, pvrtmp_7643, pvrtmp_7641); + CursorTy pvrtmp_7648 = tmp_struct_213.field0; + CursorTy pvrtmp_7649 = tmp_struct_213.field1; + CursorTy pvrtmp_7650 = tmp_struct_213.field2; + CursorTy pvrtmp_7651 = tmp_struct_213.field3; + IntTy sizeof_y_2792__2795 = pvrtmp_7635 - pvrtmp_7634; + IntTy sizeof_y_2793__2796 = pvrtmp_7643 - pvrtmp_7642; + IntTy sizeof_y_2794__2797 = pvrtmp_7651 - pvrtmp_7650; + IntTy fltPrm_2830 = sizeof_y_2792__2795 + 0; + IntTy offset__2798 = 8 + fltPrm_2830; + IntTy fltPrm_2831 = sizeof_y_2792__2795 + sizeof_y_2793__2796; + IntTy offset__2799 = 0 + fltPrm_2831; + IntTy fltPrm_2833 = sizeof_y_2793__2796 + sizeof_y_2794__2797; + IntTy fltPrm_2832 = sizeof_y_2792__2795 + fltPrm_2833; + IntTy size_dcon_2800 = 17 + fltPrm_2832; + + *(TagTyPacked *) loc_2977 = 174; + + CursorTy writetag_5132 = loc_2977 + 1; + + *(IntTy *) writetag_5132 = size_dcon_2800; + + CursorTy writecur_5133 = writetag_5132 + sizeof(IntTy); + + *(IntTy *) writecur_5133 = offset__2798; + + CursorTy writecur_5134 = writecur_5133 + sizeof(IntTy); + + *(IntTy *) writecur_5134 = offset__2799; + + CursorTy writecur_5135 = writecur_5134 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7648, pvrtmp_7649, + loc_2977, pvrtmp_7651}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7660 = *(CursorTy *) tmpcur_7447; + CursorTy tmpaftercur_7661 = tmpcur_7447 + 8; + CursorTy jump_4364 = tmpcur_7447 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_2977, tmpcur_7660); + CursorTy pvrtmp_7662 = tmp_struct_214.field0; + CursorTy pvrtmp_7663 = tmp_struct_214.field1; + CursorTy pvrtmp_7664 = tmp_struct_214.field2; + CursorTy pvrtmp_7665 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7662, jump_4364, + pvrtmp_7664, pvrtmp_7665}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7672 = *(CursorTy *) tmpcur_7447; + CursorTy tmpaftercur_7673 = tmpcur_7447 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_2977, tmpcur_7672); + CursorTy pvrtmp_7674 = tmp_struct_215.field0; + CursorTy pvrtmp_7675 = tmp_struct_215.field1; + CursorTy pvrtmp_7676 = tmp_struct_215.field2; + CursorTy pvrtmp_7677 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7674, pvrtmp_7675, + pvrtmp_7676, pvrtmp_7677}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7446"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2801) +{ + if (loc_2981 + 32 > end_r_2983) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2983); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2983 = chunk_end_224; + *(TagTyPacked *) loc_2981 = 255; + + CursorTy redir = loc_2981 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2981 = chunk_start_223; + } + + CursorTy loc_3924 = loc_2981 + 1; + CursorTy loc_3925 = loc_3924 + 8; + TagTyPacked tmpval_7685 = *(TagTyPacked *) arg_2801; + CursorTy tmpcur_7686 = arg_2801 + 1; + + + switch_7729: + ; + switch (tmpval_7685) { + + case 0: + { + CursorTy jump_4232 = arg_2801 + 1; + + *(TagTyPacked *) loc_2981 = 0; + + CursorTy writetag_5147 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2983, jump_4232, + loc_2981, writetag_5147}; + break; + } + + case 1: + { + IntTy tmpval_7691 = *(IntTy *) tmpcur_7686; + CursorTy tmpcur_7692 = tmpcur_7686 + sizeof(IntTy); + CursorTy jump_4234 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_3925, tmpcur_7692); + CursorTy pvrtmp_7693 = tmp_struct_219.field0; + CursorTy pvrtmp_7694 = tmp_struct_219.field1; + CursorTy pvrtmp_7695 = tmp_struct_219.field2; + CursorTy pvrtmp_7696 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2981 = 1; + + CursorTy writetag_5152 = loc_2981 + 1; + + *(IntTy *) writetag_5152 = tmpval_7691; + + CursorTy writecur_5153 = writetag_5152 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7693, pvrtmp_7694, + loc_2981, pvrtmp_7696}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7705 = *(CursorTy *) tmpcur_7686; + CursorTy tmpaftercur_7706 = tmpcur_7686 + 8; + CursorTy jump_4370 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_2981, tmpcur_7705); + CursorTy pvrtmp_7707 = tmp_struct_220.field0; + CursorTy pvrtmp_7708 = tmp_struct_220.field1; + CursorTy pvrtmp_7709 = tmp_struct_220.field2; + CursorTy pvrtmp_7710 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7707, jump_4370, + pvrtmp_7709, pvrtmp_7710}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7717 = *(CursorTy *) tmpcur_7686; + CursorTy tmpaftercur_7718 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_2981, tmpcur_7717); + CursorTy pvrtmp_7719 = tmp_struct_221.field0; + CursorTy pvrtmp_7720 = tmp_struct_221.field1; + CursorTy pvrtmp_7721 = tmp_struct_221.field2; + CursorTy pvrtmp_7722 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7719, pvrtmp_7720, + pvrtmp_7721, pvrtmp_7722}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7685"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6129, ")"); + add_symbol(6130, "(Text "); + add_symbol(6131, "(Tag "); + add_symbol(6132, "(TCA "); + add_symbol(6133, "(TAC "); + add_symbol(6134, "(Nul "); + add_symbol(6135, "(Nil "); + add_symbol(6136, "(Image "); + add_symbol(6137, "(End "); + add_symbol(6138, "(Char "); + add_symbol(6139, "(CTA "); + add_symbol(6140, "(CAT "); + add_symbol(6141, "(CA "); + add_symbol(6142, "(ATC "); + add_symbol(6143, "(ACT "); + add_symbol(6144, "(AC "); + add_symbol(6145, " ->r "); + add_symbol(6146, " ->i "); + + RegionTy *region_6147 = alloc_region(global_init_inf_buf_size); + CursorTy r_2993 = region_6147->reg_heap; + IntTy sizeof_end_r_2993_6148 = global_init_inf_buf_size; + CursorTy end_r_2993 = r_2993 + sizeof_end_r_2993_6148; + RegionTy *region_6149 = alloc_region(global_init_inf_buf_size); + CursorTy r_2992 = region_6149->reg_heap; + IntTy sizeof_end_r_2992_6150 = global_init_inf_buf_size; + CursorTy end_r_2992 = r_2992 + sizeof_end_r_2992_6150; + CursorCursorCursorProd tmp_struct_225 = + mkCTAList(end_r_2993, r_2993, 100000, 10, 2000); + CursorTy pvrtmp_6151 = tmp_struct_225.field0; + CursorTy pvrtmp_6152 = tmp_struct_225.field1; + CursorTy pvrtmp_6153 = tmp_struct_225.field2; + CursorTy pvrtmp_6167; + CursorTy pvrtmp_6168; + CursorTy pvrtmp_6169; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6167; + struct timespec end_pvrtmp_6167; + + start_counters(); + for (long long iters_pvrtmp_6167 = 0; iters_pvrtmp_6167 < + global_iters_param; iters_pvrtmp_6167++) { + if (iters_pvrtmp_6167 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6167); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6151, end_r_2992, r_2992, pvrtmp_6152); + CursorTy pvrtmp_6158 = tmp_struct_226.field0; + CursorTy pvrtmp_6159 = tmp_struct_226.field1; + CursorTy pvrtmp_6160 = tmp_struct_226.field2; + + pvrtmp_6167 = pvrtmp_6158; + pvrtmp_6168 = pvrtmp_6159; + pvrtmp_6169 = pvrtmp_6160; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6167); + if (iters_pvrtmp_6167 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6167, + &end_pvrtmp_6167); + + vector_inplace_update(times_230, iters_pvrtmp_6167, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCta2.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCta2.c new file mode 100644 index 000000000..6c3cff236 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsCta2.c @@ -0,0 +1,5070 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2914, CursorTy end_r_2915, + CursorTy loc_2913, + CursorTy adt_15_901_1518); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2918, CursorTy end_r_2919, + CursorTy loc_2917, + CursorTy tags_21_907_1525, + IntTy inVal_22_908_1526); +CursorCursorCursorProd mkCTAList(CursorTy end_r_2921, CursorTy loc_2920, + IntTy len_25_911_1531, + IntTy tagLen_26_912_1532, + IntTy strLen_27_913_1533); +CursorCursorCursorProd mkString(CursorTy end_r_2923, CursorTy loc_2922, + IntTy len_180_1066_1539); +CursorCursorCursorProd mkContentText(CursorTy end_r_2925, CursorTy loc_2924, + IntTy n_194_1080_1545); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_319_1205_1547); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2930, + CursorTy end_r_2931, + CursorTy loc_2929, + CursorTy arg_623_1229_1552); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_628_1234_1557); +CursorProd _traverse_String(CursorTy end_r_2937, CursorTy arg_633_1239_1562); +CursorProd _print_String(CursorTy end_r_2939, CursorTy arg_638_1243_1566); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2942, + CursorTy end_r_2943, + CursorTy loc_2941, + CursorTy arg_647_1252_1575); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2946, + CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_652_1257_1580); +CursorProd _traverse_Content(CursorTy end_r_2949, CursorTy arg_657_1262_1585); +CursorProd _print_Content(CursorTy end_r_2951, CursorTy arg_662_1267_1590); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2954, CursorTy end_r_2955, + CursorTy loc_2953, + CursorTy arg_671_1276_1599); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2958, + CursorTy end_r_2959, + CursorTy loc_2957, + CursorTy arg_716_1321_1644); +CursorProd _traverse_Adt(CursorTy end_r_2961, CursorTy arg_761_1366_1689); +CursorProd _print_Adt(CursorTy end_r_2963, CursorTy arg_806_1411_1734); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2966, + CursorTy end_r_2967, CursorTy loc_2965, + CursorTy arg_869_1474_1797); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_874_1479_1802); +CursorProd _traverse_Tags(CursorTy end_r_2973, CursorTy arg_879_1484_1807); +CursorProd _print_Tags(CursorTy end_r_2975, CursorTy arg_884_1488_1811); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2978, CursorTy end_r_2979, + CursorTy loc_2977, CursorTy arg_2710); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2982, CursorTy end_r_2983, + CursorTy loc_2981, CursorTy arg_2715); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2986, + CursorTy end_r_2987, + CursorTy loc_2985, + CursorTy arg_2720); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2990, + CursorTy end_r_2991, + CursorTy loc_2989, + CursorTy arg_2809); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2914, CursorTy end_r_2915, + CursorTy loc_2913, + CursorTy adt_15_901_1518) +{ + if (loc_2913 + 32 > end_r_2915) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2915); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2915 = chunk_end_6; + *(TagTyPacked *) loc_2913 = 255; + + CursorTy redir = loc_2913 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2913 = chunk_start_5; + } + + CursorTy loc_3020 = loc_2913 + 1; + CursorTy loc_3021 = loc_3020 + 8; + CursorTy loc_3022 = loc_3021 + 8; + TagTyPacked tmpval_6193 = *(TagTyPacked *) adt_15_901_1518; + CursorTy tmpcur_6194 = adt_15_901_1518 + 1; + + + switch_6250: + ; + switch (tmpval_6193) { + + case 0: + { + CursorTy jump_3946 = adt_15_901_1518 + 1; + + *(TagTyPacked *) loc_2913 = 0; + + CursorTy writetag_4505 = loc_2913 + 1; + + return (CursorCursorCursorProd) {end_r_2915, loc_2913, + writetag_4505}; + break; + } + + case 21: + { + RegionTy *region_6199 = alloc_region(global_init_inf_buf_size); + CursorTy r_3032 = region_6199->reg_heap; + IntTy sizeof_end_r_3032_6200 = global_init_inf_buf_size; + CursorTy end_r_3032 = r_3032 + sizeof_end_r_3032_6200; + CursorTy tmpcur_6201 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6202 = tmpcur_6194 + 8; + CursorTy tmpcur_6203 = *(CursorTy *) tmpaftercur_6202; + CursorTy tmpaftercur_6204 = tmpaftercur_6202 + 8; + CursorTy jump_3949 = tmpaftercur_6202 + 8; + CursorTy jump_3948 = tmpcur_6194 + 8; + + *(TagTyPacked *) loc_3022 = 254; + + CursorTy writetag_4510 = loc_3022 + 1; + + *(CursorTy *) writetag_4510 = tmpaftercur_6204; + + CursorTy writecur_4511 = writetag_4510 + 8; + CursorCursorCursorProd tmp_struct_0 = + addValTagsAdt(end_r_2914, end_r_3032, r_3032, tmpcur_6203); + CursorTy pvrtmp_6207 = tmp_struct_0.field0; + CursorTy pvrtmp_6208 = tmp_struct_0.field1; + CursorTy pvrtmp_6209 = tmp_struct_0.field2; + CursorCursorCursorCursorProd tmp_struct_1 = + addValTag(end_r_2914, end_r_2915, writecur_4511, tmpcur_6201, 10); + CursorTy pvrtmp_6214 = tmp_struct_1.field0; + CursorTy pvrtmp_6215 = tmp_struct_1.field1; + CursorTy pvrtmp_6216 = tmp_struct_1.field2; + CursorTy pvrtmp_6217 = tmp_struct_1.field3; + + *(TagTyPacked *) pvrtmp_6217 = 254; + + CursorTy writetag_4515 = pvrtmp_6217 + 1; + + *(CursorTy *) writetag_4515 = r_3032; + + CursorTy writecur_4516 = writetag_4515 + 8; + + *(TagTyPacked *) loc_2913 = 21; + + CursorTy writetag_4518 = loc_2913 + 1; + + *(CursorTy *) writetag_4518 = tmpcur_6201; + + CursorTy writecur_4519 = writetag_4518 + 8; + + *(CursorTy *) writecur_4519 = pvrtmp_6217; + + CursorTy writecur_4520 = writecur_4519 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6214, loc_2913, + writecur_4516}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6228 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6229 = tmpcur_6194 + 8; + CursorTy jump_4258 = tmpcur_6194 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2914, end_r_2915, loc_2913, tmpcur_6228); + CursorTy pvrtmp_6230 = tmp_struct_2.field0; + CursorTy pvrtmp_6231 = tmp_struct_2.field1; + CursorTy pvrtmp_6232 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6230, pvrtmp_6231, + pvrtmp_6232}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6239 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6240 = tmpcur_6194 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2914, end_r_2915, loc_2913, tmpcur_6239); + CursorTy pvrtmp_6241 = tmp_struct_3.field0; + CursorTy pvrtmp_6242 = tmp_struct_3.field1; + CursorTy pvrtmp_6243 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6241, pvrtmp_6242, + pvrtmp_6243}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6193"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2918, CursorTy end_r_2919, + CursorTy loc_2917, + CursorTy tags_21_907_1525, + IntTy inVal_22_908_1526) +{ + if (loc_2917 + 32 > end_r_2919) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2919); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2919 = chunk_end_12; + *(TagTyPacked *) loc_2917 = 255; + + CursorTy redir = loc_2917 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2917 = chunk_start_11; + } + + CursorTy loc_3041 = loc_2917 + 1; + CursorTy loc_3042 = loc_3041 + 8; + TagTyPacked tmpval_6251 = *(TagTyPacked *) tags_21_907_1525; + CursorTy tmpcur_6252 = tags_21_907_1525 + 1; + + + switch_6295: + ; + switch (tmpval_6251) { + + case 0: + { + CursorTy jump_3952 = tags_21_907_1525 + 1; + + *(TagTyPacked *) loc_2917 = 0; + + CursorTy writetag_4532 = loc_2917 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2919, jump_3952, + loc_2917, writetag_4532}; + break; + } + + case 1: + { + IntTy tmpval_6257 = *(IntTy *) tmpcur_6252; + CursorTy tmpcur_6258 = tmpcur_6252 + sizeof(IntTy); + CursorTy jump_3954 = tmpcur_6252 + 8; + IntTy fltPkd_1506_1529 = tmpval_6257 + inVal_22_908_1526; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2918, end_r_2919, loc_3042, tmpcur_6258, inVal_22_908_1526); + CursorTy pvrtmp_6259 = tmp_struct_7.field0; + CursorTy pvrtmp_6260 = tmp_struct_7.field1; + CursorTy pvrtmp_6261 = tmp_struct_7.field2; + CursorTy pvrtmp_6262 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2917 = 1; + + CursorTy writetag_4537 = loc_2917 + 1; + + *(IntTy *) writetag_4537 = fltPkd_1506_1529; + + CursorTy writecur_4538 = writetag_4537 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6259, pvrtmp_6260, + loc_2917, pvrtmp_6262}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6271 = *(CursorTy *) tmpcur_6252; + CursorTy tmpaftercur_6272 = tmpcur_6252 + 8; + CursorTy jump_4263 = tmpcur_6252 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2918, end_r_2919, loc_2917, tmpcur_6271, inVal_22_908_1526); + CursorTy pvrtmp_6273 = tmp_struct_8.field0; + CursorTy pvrtmp_6274 = tmp_struct_8.field1; + CursorTy pvrtmp_6275 = tmp_struct_8.field2; + CursorTy pvrtmp_6276 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6273, jump_4263, + pvrtmp_6275, pvrtmp_6276}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6283 = *(CursorTy *) tmpcur_6252; + CursorTy tmpaftercur_6284 = tmpcur_6252 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2918, end_r_2919, loc_2917, tmpcur_6283, inVal_22_908_1526); + CursorTy pvrtmp_6285 = tmp_struct_9.field0; + CursorTy pvrtmp_6286 = tmp_struct_9.field1; + CursorTy pvrtmp_6287 = tmp_struct_9.field2; + CursorTy pvrtmp_6288 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6285, pvrtmp_6286, + pvrtmp_6287, pvrtmp_6288}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6251"); + exit(1); + } + } +} +CursorCursorCursorProd mkCTAList(CursorTy end_r_2921, CursorTy loc_2920, + IntTy len_25_911_1531, + IntTy tagLen_26_912_1532, + IntTy strLen_27_913_1533) +{ + if (loc_2920 + 32 > end_r_2921) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2921); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2921 = chunk_end_18; + *(TagTyPacked *) loc_2920 = 255; + + CursorTy redir = loc_2920 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2920 = chunk_start_17; + } + + CursorTy loc_3050 = loc_2920 + 1; + CursorTy loc_3051 = loc_3050 + 8; + CursorTy loc_3052 = loc_3051 + 8; + BoolTy fltIf_1508_1534 = len_25_911_1531 <= 0; + + if (fltIf_1508_1534) { + *(TagTyPacked *) loc_2920 = 0; + + CursorTy writetag_4547 = loc_2920 + 1; + + return (CursorCursorCursorProd) {end_r_2921, loc_2920, writetag_4547}; + } else { + CursorCursorCursorProd tmp_struct_13 = + mkContentText(end_r_2921, loc_3052, strLen_27_913_1533); + CursorTy pvrtmp_6300 = tmp_struct_13.field0; + CursorTy pvrtmp_6301 = tmp_struct_13.field1; + CursorTy pvrtmp_6302 = tmp_struct_13.field2; + CursorCursorCursorProd tmp_struct_14 = + mkRandomTags(pvrtmp_6300, pvrtmp_6302, tagLen_26_912_1532); + CursorTy pvrtmp_6307 = tmp_struct_14.field0; + CursorTy pvrtmp_6308 = tmp_struct_14.field1; + CursorTy pvrtmp_6309 = tmp_struct_14.field2; + IntTy fltAppE_1509_1537 = len_25_911_1531 - 1; + CursorCursorCursorProd tmp_struct_15 = + mkCTAList(pvrtmp_6307, pvrtmp_6309, fltAppE_1509_1537, tagLen_26_912_1532, strLen_27_913_1533); + CursorTy pvrtmp_6314 = tmp_struct_15.field0; + CursorTy pvrtmp_6315 = tmp_struct_15.field1; + CursorTy pvrtmp_6316 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2920 = 21; + + CursorTy writetag_4552 = loc_2920 + 1; + + *(CursorTy *) writetag_4552 = pvrtmp_6302; + + CursorTy writecur_4553 = writetag_4552 + 8; + + *(CursorTy *) writecur_4553 = pvrtmp_6309; + + CursorTy writecur_4554 = writecur_4553 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6314, loc_2920, pvrtmp_6316}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2923, CursorTy loc_2922, + IntTy len_180_1066_1539) +{ + if (loc_2922 + 32 > end_r_2923) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2923); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2923 = chunk_end_22; + *(TagTyPacked *) loc_2922 = 255; + + CursorTy redir = loc_2922 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2922 = chunk_start_21; + } + + CursorTy loc_3064 = loc_2922 + 1; + CursorTy loc_3065 = loc_3064 + 8; + BoolTy fltIf_1510_1540 = len_180_1066_1539 <= 0; + + if (fltIf_1510_1540) { + *(TagTyPacked *) loc_2922 = 0; + + CursorTy writetag_4559 = loc_2922 + 1; + + return (CursorCursorCursorProd) {end_r_2923, loc_2922, writetag_4559}; + } else { + IntTy fltPrm_1511_1541 = rand(); + IntTy randomChar_181_1067_1542 = fltPrm_1511_1541 % 128; + IntTy fltAppE_1512_1543 = len_180_1066_1539 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2923, loc_3065, fltAppE_1512_1543); + CursorTy pvrtmp_6329 = tmp_struct_19.field0; + CursorTy pvrtmp_6330 = tmp_struct_19.field1; + CursorTy pvrtmp_6331 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2922 = 1; + + CursorTy writetag_4562 = loc_2922 + 1; + + *(IntTy *) writetag_4562 = randomChar_181_1067_1542; + + CursorTy writecur_4563 = writetag_4562 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6329, loc_2922, pvrtmp_6331}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2925, CursorTy loc_2924, + IntTy n_194_1080_1545) +{ + if (loc_2924 + 32 > end_r_2925) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2925); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2925 = chunk_end_26; + *(TagTyPacked *) loc_2924 = 255; + + CursorTy redir = loc_2924 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2924 = chunk_start_25; + } + + CursorTy loc_3070 = loc_2924 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2925, loc_3070, n_194_1080_1545); + CursorTy pvrtmp_6340 = tmp_struct_23.field0; + CursorTy pvrtmp_6341 = tmp_struct_23.field1; + CursorTy pvrtmp_6342 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2924 = 1; + + CursorTy writetag_4567 = loc_2924 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6340, loc_2924, pvrtmp_6342}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_319_1205_1547) +{ + if (loc_2926 + 32 > end_r_2927) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2927); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2927 = chunk_end_30; + *(TagTyPacked *) loc_2926 = 255; + + CursorTy redir = loc_2926 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2926 = chunk_start_29; + } + + CursorTy loc_3074 = loc_2926 + 1; + CursorTy loc_3075 = loc_3074 + 8; + BoolTy fltIf_1514_1548 = len_319_1205_1547 <= 0; + + if (fltIf_1514_1548) { + *(TagTyPacked *) loc_2926 = 0; + + CursorTy writetag_4570 = loc_2926 + 1; + + return (CursorCursorCursorProd) {end_r_2927, loc_2926, writetag_4570}; + } else { + IntTy fltAppE_1515_1550 = len_319_1205_1547 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2927, loc_3075, fltAppE_1515_1550); + CursorTy pvrtmp_6355 = tmp_struct_27.field0; + CursorTy pvrtmp_6356 = tmp_struct_27.field1; + CursorTy pvrtmp_6357 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2926 = 1; + + CursorTy writetag_4573 = loc_2926 + 1; + + *(IntTy *) writetag_4573 = 100; + + CursorTy writecur_4574 = writetag_4573 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6355, loc_2926, pvrtmp_6357}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2930, + CursorTy end_r_2931, + CursorTy loc_2929, + CursorTy arg_623_1229_1552) +{ + if (loc_2929 + 32 > end_r_2931) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2931); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2931 = chunk_end_36; + *(TagTyPacked *) loc_2929 = 255; + + CursorTy redir = loc_2929 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2929 = chunk_start_35; + } + + CursorTy loc_3085 = loc_2929 + 1; + CursorTy loc_3086 = loc_3085 + 8; + TagTyPacked tmpval_6366 = *(TagTyPacked *) arg_623_1229_1552; + CursorTy tmpcur_6367 = arg_623_1229_1552 + 1; + + + switch_6410: + ; + switch (tmpval_6366) { + + case 0: + { + CursorTy jump_3964 = arg_623_1229_1552 + 1; + + *(TagTyPacked *) loc_2929 = 0; + + CursorTy writetag_4578 = loc_2929 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2931, jump_3964, + loc_2929, writetag_4578}; + break; + } + + case 1: + { + IntTy tmpval_6372 = *(IntTy *) tmpcur_6367; + CursorTy tmpcur_6373 = tmpcur_6367 + sizeof(IntTy); + CursorTy jump_3966 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2930, end_r_2931, loc_3086, tmpcur_6373); + CursorTy pvrtmp_6374 = tmp_struct_31.field0; + CursorTy pvrtmp_6375 = tmp_struct_31.field1; + CursorTy pvrtmp_6376 = tmp_struct_31.field2; + CursorTy pvrtmp_6377 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2929 = 1; + + CursorTy writetag_4583 = loc_2929 + 1; + + *(IntTy *) writetag_4583 = tmpval_6372; + + CursorTy writecur_4584 = writetag_4583 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6374, pvrtmp_6375, + loc_2929, pvrtmp_6377}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6386 = *(CursorTy *) tmpcur_6367; + CursorTy tmpaftercur_6387 = tmpcur_6367 + 8; + CursorTy jump_4269 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2930, end_r_2931, loc_2929, tmpcur_6386); + CursorTy pvrtmp_6388 = tmp_struct_32.field0; + CursorTy pvrtmp_6389 = tmp_struct_32.field1; + CursorTy pvrtmp_6390 = tmp_struct_32.field2; + CursorTy pvrtmp_6391 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6388, jump_4269, + pvrtmp_6390, pvrtmp_6391}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6398 = *(CursorTy *) tmpcur_6367; + CursorTy tmpaftercur_6399 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2930, end_r_2931, loc_2929, tmpcur_6398); + CursorTy pvrtmp_6400 = tmp_struct_33.field0; + CursorTy pvrtmp_6401 = tmp_struct_33.field1; + CursorTy pvrtmp_6402 = tmp_struct_33.field2; + CursorTy pvrtmp_6403 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6400, pvrtmp_6401, + pvrtmp_6402, pvrtmp_6403}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6366"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_628_1234_1557) +{ + CursorTy loc_3098 = loc_2933 + 1; + CursorTy loc_3099 = loc_3098 + 8; + TagTyPacked tmpval_6411 = *(TagTyPacked *) arg_628_1234_1557; + CursorTy tmpcur_6412 = arg_628_1234_1557 + 1; + + + switch_6455: + ; + switch (tmpval_6411) { + + case 0: + { + CursorTy jump_3969 = arg_628_1234_1557 + 1; + + *(TagTyPacked *) loc_2933 = 0; + + CursorTy writetag_4594 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2935, jump_3969, + loc_2933, writetag_4594}; + break; + } + + case 1: + { + IntTy tmpval_6417 = *(IntTy *) tmpcur_6412; + CursorTy tmpcur_6418 = tmpcur_6412 + sizeof(IntTy); + CursorTy jump_3971 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_3099, tmpcur_6418); + CursorTy pvrtmp_6419 = tmp_struct_37.field0; + CursorTy pvrtmp_6420 = tmp_struct_37.field1; + CursorTy pvrtmp_6421 = tmp_struct_37.field2; + CursorTy pvrtmp_6422 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2933 = 1; + + CursorTy writetag_4599 = loc_2933 + 1; + + *(IntTy *) writetag_4599 = tmpval_6417; + + CursorTy writecur_4600 = writetag_4599 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6419, pvrtmp_6420, + loc_2933, pvrtmp_6422}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6431 = *(CursorTy *) tmpcur_6412; + CursorTy tmpaftercur_6432 = tmpcur_6412 + 8; + CursorTy jump_4275 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_2933, tmpcur_6431); + CursorTy pvrtmp_6433 = tmp_struct_38.field0; + CursorTy pvrtmp_6434 = tmp_struct_38.field1; + CursorTy pvrtmp_6435 = tmp_struct_38.field2; + CursorTy pvrtmp_6436 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6433, jump_4275, + pvrtmp_6435, pvrtmp_6436}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6443 = *(CursorTy *) tmpcur_6412; + CursorTy tmpaftercur_6444 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_2933, tmpcur_6443); + CursorTy pvrtmp_6445 = tmp_struct_39.field0; + CursorTy pvrtmp_6446 = tmp_struct_39.field1; + CursorTy pvrtmp_6447 = tmp_struct_39.field2; + CursorTy pvrtmp_6448 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6445, pvrtmp_6446, + pvrtmp_6447, pvrtmp_6448}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6411"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2937, CursorTy arg_633_1239_1562) +{ + TagTyPacked tmpval_6456 = *(TagTyPacked *) arg_633_1239_1562; + CursorTy tmpcur_6457 = arg_633_1239_1562 + 1; + + + switch_6467: + ; + switch (tmpval_6456) { + + case 0: + { + CursorTy jump_3974 = arg_633_1239_1562 + 1; + + return (CursorProd) {jump_3974}; + break; + } + + case 1: + { + IntTy tmpval_6458 = *(IntTy *) tmpcur_6457; + CursorTy tmpcur_6459 = tmpcur_6457 + sizeof(IntTy); + CursorTy jump_3976 = tmpcur_6457 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2937, tmpcur_6459); + CursorTy pvrtmp_6460 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6460}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6461 = *(CursorTy *) tmpcur_6457; + CursorTy tmpaftercur_6462 = tmpcur_6457 + 8; + CursorTy jump_4281 = tmpcur_6457 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2937, tmpcur_6461); + CursorTy pvrtmp_6463 = tmp_struct_41.field0; + + return (CursorProd) {jump_4281}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6464 = *(CursorTy *) tmpcur_6457; + CursorTy tmpaftercur_6465 = tmpcur_6457 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2937, tmpcur_6464); + CursorTy pvrtmp_6466 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6466}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6456"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2939, CursorTy arg_638_1243_1566) +{ + TagTyPacked tmpval_6468 = *(TagTyPacked *) arg_638_1243_1566; + CursorTy tmpcur_6469 = arg_638_1243_1566 + 1; + + + switch_6479: + ; + switch (tmpval_6468) { + + case 0: + { + CursorTy jump_3979 = arg_638_1243_1566 + 1; + unsigned char wildcard_639_1244_1567 = print_symbol(6153); + unsigned char wildcard_640_1245_1568 = print_symbol(6145); + + return (CursorProd) {jump_3979}; + break; + } + + case 1: + { + IntTy tmpval_6470 = *(IntTy *) tmpcur_6469; + CursorTy tmpcur_6471 = tmpcur_6469 + sizeof(IntTy); + CursorTy jump_3981 = tmpcur_6469 + 8; + unsigned char wildcard_645_1248_1571 = print_symbol(6154); + unsigned char y_643_1249_1572 = printf("%lld", tmpval_6470); + CursorProd tmp_struct_43 = _print_String(end_r_2939, tmpcur_6471); + CursorTy pvrtmp_6472 = tmp_struct_43.field0; + unsigned char wildcard_646_1251_1574 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6472}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6473 = *(CursorTy *) tmpcur_6469; + CursorTy tmpaftercur_6474 = tmpcur_6469 + 8; + CursorTy jump_4287 = tmpcur_6469 + 8; + unsigned char wildcard_4290 = print_symbol(6162); + CursorProd tmp_struct_44 = _print_String(end_r_2939, tmpcur_6473); + CursorTy pvrtmp_6475 = tmp_struct_44.field0; + + return (CursorProd) {jump_4287}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6476 = *(CursorTy *) tmpcur_6469; + CursorTy tmpaftercur_6477 = tmpcur_6469 + 8; + unsigned char wildcard_4290 = print_symbol(6161); + CursorProd tmp_struct_45 = _print_String(end_r_2939, tmpcur_6476); + CursorTy pvrtmp_6478 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6478}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6468"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2942, + CursorTy end_r_2943, + CursorTy loc_2941, + CursorTy arg_647_1252_1575) +{ + if (loc_2941 + 32 > end_r_2943) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2943); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2943 = chunk_end_52; + *(TagTyPacked *) loc_2941 = 255; + + CursorTy redir = loc_2941 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2941 = chunk_start_51; + } + + TagTyPacked tmpval_6480 = *(TagTyPacked *) arg_647_1252_1575; + CursorTy tmpcur_6481 = arg_647_1252_1575 + 1; + + + switch_6530: + ; + switch (tmpval_6480) { + + case 0: + { + CursorTy loc_3121 = loc_2941 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2942, end_r_2943, loc_3121, tmpcur_6481); + CursorTy pvrtmp_6482 = tmp_struct_46.field0; + CursorTy pvrtmp_6483 = tmp_struct_46.field1; + CursorTy pvrtmp_6484 = tmp_struct_46.field2; + CursorTy pvrtmp_6485 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2941 = 0; + + CursorTy writetag_4631 = loc_2941 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6482, pvrtmp_6483, + loc_2941, pvrtmp_6485}; + break; + } + + case 1: + { + CursorTy loc_3127 = loc_2941 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2942, end_r_2943, loc_3127, tmpcur_6481); + CursorTy pvrtmp_6494 = tmp_struct_47.field0; + CursorTy pvrtmp_6495 = tmp_struct_47.field1; + CursorTy pvrtmp_6496 = tmp_struct_47.field2; + CursorTy pvrtmp_6497 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2941 = 1; + + CursorTy writetag_4636 = loc_2941 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6494, pvrtmp_6495, + loc_2941, pvrtmp_6497}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6506 = *(CursorTy *) tmpcur_6481; + CursorTy tmpaftercur_6507 = tmpcur_6481 + 8; + CursorTy jump_4293 = tmpcur_6481 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2942, end_r_2943, loc_2941, tmpcur_6506); + CursorTy pvrtmp_6508 = tmp_struct_48.field0; + CursorTy pvrtmp_6509 = tmp_struct_48.field1; + CursorTy pvrtmp_6510 = tmp_struct_48.field2; + CursorTy pvrtmp_6511 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6508, jump_4293, + pvrtmp_6510, pvrtmp_6511}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6518 = *(CursorTy *) tmpcur_6481; + CursorTy tmpaftercur_6519 = tmpcur_6481 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2942, end_r_2943, loc_2941, tmpcur_6518); + CursorTy pvrtmp_6520 = tmp_struct_49.field0; + CursorTy pvrtmp_6521 = tmp_struct_49.field1; + CursorTy pvrtmp_6522 = tmp_struct_49.field2; + CursorTy pvrtmp_6523 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6520, pvrtmp_6521, + pvrtmp_6522, pvrtmp_6523}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6480"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2946, + CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_652_1257_1580) +{ + TagTyPacked tmpval_6531 = *(TagTyPacked *) arg_652_1257_1580; + CursorTy tmpcur_6532 = arg_652_1257_1580 + 1; + + + switch_6581: + ; + switch (tmpval_6531) { + + case 0: + { + CursorTy loc_3135 = loc_2945 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2946, end_r_2947, loc_3135, tmpcur_6532); + CursorTy pvrtmp_6533 = tmp_struct_53.field0; + CursorTy pvrtmp_6534 = tmp_struct_53.field1; + CursorTy pvrtmp_6535 = tmp_struct_53.field2; + CursorTy pvrtmp_6536 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2945 = 0; + + CursorTy writetag_4647 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6533, pvrtmp_6534, + loc_2945, pvrtmp_6536}; + break; + } + + case 1: + { + CursorTy loc_3141 = loc_2945 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2946, end_r_2947, loc_3141, tmpcur_6532); + CursorTy pvrtmp_6545 = tmp_struct_54.field0; + CursorTy pvrtmp_6546 = tmp_struct_54.field1; + CursorTy pvrtmp_6547 = tmp_struct_54.field2; + CursorTy pvrtmp_6548 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2945 = 1; + + CursorTy writetag_4652 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6545, pvrtmp_6546, + loc_2945, pvrtmp_6548}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6557 = *(CursorTy *) tmpcur_6532; + CursorTy tmpaftercur_6558 = tmpcur_6532 + 8; + CursorTy jump_4299 = tmpcur_6532 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2946, end_r_2947, loc_2945, tmpcur_6557); + CursorTy pvrtmp_6559 = tmp_struct_55.field0; + CursorTy pvrtmp_6560 = tmp_struct_55.field1; + CursorTy pvrtmp_6561 = tmp_struct_55.field2; + CursorTy pvrtmp_6562 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6559, jump_4299, + pvrtmp_6561, pvrtmp_6562}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6569 = *(CursorTy *) tmpcur_6532; + CursorTy tmpaftercur_6570 = tmpcur_6532 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2946, end_r_2947, loc_2945, tmpcur_6569); + CursorTy pvrtmp_6571 = tmp_struct_56.field0; + CursorTy pvrtmp_6572 = tmp_struct_56.field1; + CursorTy pvrtmp_6573 = tmp_struct_56.field2; + CursorTy pvrtmp_6574 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6571, pvrtmp_6572, + pvrtmp_6573, pvrtmp_6574}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6531"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2949, CursorTy arg_657_1262_1585) +{ + TagTyPacked tmpval_6582 = *(TagTyPacked *) arg_657_1262_1585; + CursorTy tmpcur_6583 = arg_657_1262_1585 + 1; + + + switch_6592: + ; + switch (tmpval_6582) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2949, tmpcur_6583); + CursorTy pvrtmp_6584 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6584}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2949, tmpcur_6583); + CursorTy pvrtmp_6585 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6585}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6586 = *(CursorTy *) tmpcur_6583; + CursorTy tmpaftercur_6587 = tmpcur_6583 + 8; + CursorTy jump_4305 = tmpcur_6583 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2949, tmpcur_6586); + CursorTy pvrtmp_6588 = tmp_struct_59.field0; + + return (CursorProd) {jump_4305}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6589 = *(CursorTy *) tmpcur_6583; + CursorTy tmpaftercur_6590 = tmpcur_6583 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2949, tmpcur_6589); + CursorTy pvrtmp_6591 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6591}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6582"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2951, CursorTy arg_662_1267_1590) +{ + TagTyPacked tmpval_6593 = *(TagTyPacked *) arg_662_1267_1590; + CursorTy tmpcur_6594 = arg_662_1267_1590 + 1; + + + switch_6603: + ; + switch (tmpval_6593) { + + case 0: + { + unsigned char wildcard_665_1269_1592 = print_symbol(6152); + CursorProd tmp_struct_61 = _print_String(end_r_2951, tmpcur_6594); + CursorTy pvrtmp_6595 = tmp_struct_61.field0; + unsigned char wildcard_666_1271_1594 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6595}; + break; + } + + case 1: + { + unsigned char wildcard_669_1273_1596 = print_symbol(6146); + CursorProd tmp_struct_62 = _print_String(end_r_2951, tmpcur_6594); + CursorTy pvrtmp_6596 = tmp_struct_62.field0; + unsigned char wildcard_670_1275_1598 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6596}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6597 = *(CursorTy *) tmpcur_6594; + CursorTy tmpaftercur_6598 = tmpcur_6594 + 8; + CursorTy jump_4311 = tmpcur_6594 + 8; + unsigned char wildcard_4314 = print_symbol(6162); + CursorProd tmp_struct_63 = _print_Content(end_r_2951, tmpcur_6597); + CursorTy pvrtmp_6599 = tmp_struct_63.field0; + + return (CursorProd) {jump_4311}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6600 = *(CursorTy *) tmpcur_6594; + CursorTy tmpaftercur_6601 = tmpcur_6594 + 8; + unsigned char wildcard_4314 = print_symbol(6161); + CursorProd tmp_struct_64 = _print_Content(end_r_2951, tmpcur_6600); + CursorTy pvrtmp_6602 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6602}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6593"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2954, CursorTy end_r_2955, + CursorTy loc_2953, + CursorTy arg_671_1276_1599) +{ + if (loc_2953 + 32 > end_r_2955) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2955); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2955 = chunk_end_91; + *(TagTyPacked *) loc_2953 = 255; + + CursorTy redir = loc_2953 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2953 = chunk_start_90; + } + + CursorTy loc_3171 = loc_2953 + 1; + CursorTy loc_3172 = loc_3171 + 8; + CursorTy loc_3187 = loc_2953 + 1; + CursorTy loc_3188 = loc_3187 + 8; + CursorTy loc_3208 = loc_2953 + 1; + CursorTy loc_3209 = loc_3208 + 8; + CursorTy loc_3210 = loc_3209 + 8; + CursorTy loc_3234 = loc_2953 + 1; + CursorTy loc_3235 = loc_3234 + 8; + CursorTy loc_3236 = loc_3235 + 8; + CursorTy loc_3260 = loc_2953 + 1; + CursorTy loc_3261 = loc_3260 + 8; + CursorTy loc_3262 = loc_3261 + 8; + CursorTy loc_3286 = loc_2953 + 1; + CursorTy loc_3287 = loc_3286 + 8; + CursorTy loc_3288 = loc_3287 + 8; + CursorTy loc_3312 = loc_2953 + 1; + CursorTy loc_3313 = loc_3312 + 8; + CursorTy loc_3314 = loc_3313 + 8; + CursorTy loc_3338 = loc_2953 + 1; + CursorTy loc_3339 = loc_3338 + 8; + CursorTy loc_3340 = loc_3339 + 8; + TagTyPacked tmpval_6604 = *(TagTyPacked *) arg_671_1276_1599; + CursorTy tmpcur_6605 = arg_671_1276_1599 + 1; + + + switch_6870: + ; + switch (tmpval_6604) { + + case 0: + { + CursorTy jump_4000 = arg_671_1276_1599 + 1; + + *(TagTyPacked *) loc_2953 = 0; + + CursorTy writetag_4682 = loc_2953 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2955, jump_4000, + loc_2953, writetag_4682}; + break; + } + + case 9: + { + CursorTy tmpcur_6610 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6611 = tmpcur_6605 + 8; + CursorTy jump_4002 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2954, end_r_2955, loc_3172, tmpaftercur_6611); + CursorTy pvrtmp_6612 = tmp_struct_65.field0; + CursorTy pvrtmp_6613 = tmp_struct_65.field1; + CursorTy pvrtmp_6614 = tmp_struct_65.field2; + CursorTy pvrtmp_6615 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2954, pvrtmp_6612, pvrtmp_6615, tmpcur_6610); + CursorTy pvrtmp_6620 = tmp_struct_66.field0; + CursorTy pvrtmp_6621 = tmp_struct_66.field1; + CursorTy pvrtmp_6622 = tmp_struct_66.field2; + CursorTy pvrtmp_6623 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2953 = 9; + + CursorTy writetag_4688 = loc_2953 + 1; + + *(CursorTy *) writetag_4688 = pvrtmp_6615; + + CursorTy writecur_4689 = writetag_4688 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6620, pvrtmp_6621, + loc_2953, pvrtmp_6623}; + break; + } + + case 11: + { + CursorTy tmpcur_6632 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6633 = tmpcur_6605 + 8; + CursorTy jump_4006 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2954, end_r_2955, loc_3188, tmpaftercur_6633); + CursorTy pvrtmp_6634 = tmp_struct_67.field0; + CursorTy pvrtmp_6635 = tmp_struct_67.field1; + CursorTy pvrtmp_6636 = tmp_struct_67.field2; + CursorTy pvrtmp_6637 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2954, pvrtmp_6634, pvrtmp_6637, tmpcur_6632); + CursorTy pvrtmp_6642 = tmp_struct_68.field0; + CursorTy pvrtmp_6643 = tmp_struct_68.field1; + CursorTy pvrtmp_6644 = tmp_struct_68.field2; + CursorTy pvrtmp_6645 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2953 = 11; + + CursorTy writetag_4697 = loc_2953 + 1; + + *(CursorTy *) writetag_4697 = pvrtmp_6637; + + CursorTy writecur_4698 = writetag_4697 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6642, pvrtmp_6643, + loc_2953, pvrtmp_6645}; + break; + } + + case 13: + { + CursorTy tmpcur_6654 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6655 = tmpcur_6605 + 8; + CursorTy tmpcur_6656 = *(CursorTy *) tmpaftercur_6655; + CursorTy tmpaftercur_6657 = tmpaftercur_6655 + 8; + CursorTy jump_4011 = tmpaftercur_6655 + 8; + CursorTy jump_4010 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2954, end_r_2955, loc_3210, tmpaftercur_6657); + CursorTy pvrtmp_6658 = tmp_struct_69.field0; + CursorTy pvrtmp_6659 = tmp_struct_69.field1; + CursorTy pvrtmp_6660 = tmp_struct_69.field2; + CursorTy pvrtmp_6661 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2954, pvrtmp_6658, pvrtmp_6661, tmpcur_6654); + CursorTy pvrtmp_6666 = tmp_struct_70.field0; + CursorTy pvrtmp_6667 = tmp_struct_70.field1; + CursorTy pvrtmp_6668 = tmp_struct_70.field2; + CursorTy pvrtmp_6669 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2954, pvrtmp_6666, pvrtmp_6669, tmpcur_6656); + CursorTy pvrtmp_6674 = tmp_struct_71.field0; + CursorTy pvrtmp_6675 = tmp_struct_71.field1; + CursorTy pvrtmp_6676 = tmp_struct_71.field2; + CursorTy pvrtmp_6677 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2953 = 13; + + CursorTy writetag_4708 = loc_2953 + 1; + + *(CursorTy *) writetag_4708 = pvrtmp_6661; + + CursorTy writecur_4709 = writetag_4708 + 8; + + *(CursorTy *) writecur_4709 = pvrtmp_6669; + + CursorTy writecur_4710 = writecur_4709 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6674, pvrtmp_6675, + loc_2953, pvrtmp_6677}; + break; + } + + case 15: + { + CursorTy tmpcur_6686 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6687 = tmpcur_6605 + 8; + CursorTy tmpcur_6688 = *(CursorTy *) tmpaftercur_6687; + CursorTy tmpaftercur_6689 = tmpaftercur_6687 + 8; + CursorTy jump_4017 = tmpaftercur_6687 + 8; + CursorTy jump_4016 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2954, end_r_2955, loc_3236, tmpaftercur_6689); + CursorTy pvrtmp_6690 = tmp_struct_72.field0; + CursorTy pvrtmp_6691 = tmp_struct_72.field1; + CursorTy pvrtmp_6692 = tmp_struct_72.field2; + CursorTy pvrtmp_6693 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2954, pvrtmp_6690, pvrtmp_6693, tmpcur_6686); + CursorTy pvrtmp_6698 = tmp_struct_73.field0; + CursorTy pvrtmp_6699 = tmp_struct_73.field1; + CursorTy pvrtmp_6700 = tmp_struct_73.field2; + CursorTy pvrtmp_6701 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2954, pvrtmp_6698, pvrtmp_6701, tmpcur_6688); + CursorTy pvrtmp_6706 = tmp_struct_74.field0; + CursorTy pvrtmp_6707 = tmp_struct_74.field1; + CursorTy pvrtmp_6708 = tmp_struct_74.field2; + CursorTy pvrtmp_6709 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2953 = 15; + + CursorTy writetag_4721 = loc_2953 + 1; + + *(CursorTy *) writetag_4721 = pvrtmp_6693; + + CursorTy writecur_4722 = writetag_4721 + 8; + + *(CursorTy *) writecur_4722 = pvrtmp_6701; + + CursorTy writecur_4723 = writecur_4722 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6706, pvrtmp_6707, + loc_2953, pvrtmp_6709}; + break; + } + + case 17: + { + CursorTy tmpcur_6718 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6719 = tmpcur_6605 + 8; + CursorTy tmpcur_6720 = *(CursorTy *) tmpaftercur_6719; + CursorTy tmpaftercur_6721 = tmpaftercur_6719 + 8; + CursorTy jump_4023 = tmpaftercur_6719 + 8; + CursorTy jump_4022 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2954, end_r_2955, loc_3262, tmpaftercur_6721); + CursorTy pvrtmp_6722 = tmp_struct_75.field0; + CursorTy pvrtmp_6723 = tmp_struct_75.field1; + CursorTy pvrtmp_6724 = tmp_struct_75.field2; + CursorTy pvrtmp_6725 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2954, pvrtmp_6722, pvrtmp_6725, tmpcur_6718); + CursorTy pvrtmp_6730 = tmp_struct_76.field0; + CursorTy pvrtmp_6731 = tmp_struct_76.field1; + CursorTy pvrtmp_6732 = tmp_struct_76.field2; + CursorTy pvrtmp_6733 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2954, pvrtmp_6730, pvrtmp_6733, tmpcur_6720); + CursorTy pvrtmp_6738 = tmp_struct_77.field0; + CursorTy pvrtmp_6739 = tmp_struct_77.field1; + CursorTy pvrtmp_6740 = tmp_struct_77.field2; + CursorTy pvrtmp_6741 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2953 = 17; + + CursorTy writetag_4734 = loc_2953 + 1; + + *(CursorTy *) writetag_4734 = pvrtmp_6725; + + CursorTy writecur_4735 = writetag_4734 + 8; + + *(CursorTy *) writecur_4735 = pvrtmp_6733; + + CursorTy writecur_4736 = writecur_4735 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6738, pvrtmp_6739, + loc_2953, pvrtmp_6741}; + break; + } + + case 19: + { + CursorTy tmpcur_6750 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6751 = tmpcur_6605 + 8; + CursorTy tmpcur_6752 = *(CursorTy *) tmpaftercur_6751; + CursorTy tmpaftercur_6753 = tmpaftercur_6751 + 8; + CursorTy jump_4029 = tmpaftercur_6751 + 8; + CursorTy jump_4028 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2954, end_r_2955, loc_3288, tmpaftercur_6753); + CursorTy pvrtmp_6754 = tmp_struct_78.field0; + CursorTy pvrtmp_6755 = tmp_struct_78.field1; + CursorTy pvrtmp_6756 = tmp_struct_78.field2; + CursorTy pvrtmp_6757 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2954, pvrtmp_6754, pvrtmp_6757, tmpcur_6750); + CursorTy pvrtmp_6762 = tmp_struct_79.field0; + CursorTy pvrtmp_6763 = tmp_struct_79.field1; + CursorTy pvrtmp_6764 = tmp_struct_79.field2; + CursorTy pvrtmp_6765 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2954, pvrtmp_6762, pvrtmp_6765, tmpcur_6752); + CursorTy pvrtmp_6770 = tmp_struct_80.field0; + CursorTy pvrtmp_6771 = tmp_struct_80.field1; + CursorTy pvrtmp_6772 = tmp_struct_80.field2; + CursorTy pvrtmp_6773 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2953 = 19; + + CursorTy writetag_4747 = loc_2953 + 1; + + *(CursorTy *) writetag_4747 = pvrtmp_6757; + + CursorTy writecur_4748 = writetag_4747 + 8; + + *(CursorTy *) writecur_4748 = pvrtmp_6765; + + CursorTy writecur_4749 = writecur_4748 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6770, pvrtmp_6771, + loc_2953, pvrtmp_6773}; + break; + } + + case 21: + { + CursorTy tmpcur_6782 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6783 = tmpcur_6605 + 8; + CursorTy tmpcur_6784 = *(CursorTy *) tmpaftercur_6783; + CursorTy tmpaftercur_6785 = tmpaftercur_6783 + 8; + CursorTy jump_4035 = tmpaftercur_6783 + 8; + CursorTy jump_4034 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2954, end_r_2955, loc_3314, tmpaftercur_6785); + CursorTy pvrtmp_6786 = tmp_struct_81.field0; + CursorTy pvrtmp_6787 = tmp_struct_81.field1; + CursorTy pvrtmp_6788 = tmp_struct_81.field2; + CursorTy pvrtmp_6789 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2954, pvrtmp_6786, pvrtmp_6789, tmpcur_6782); + CursorTy pvrtmp_6794 = tmp_struct_82.field0; + CursorTy pvrtmp_6795 = tmp_struct_82.field1; + CursorTy pvrtmp_6796 = tmp_struct_82.field2; + CursorTy pvrtmp_6797 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2954, pvrtmp_6794, pvrtmp_6797, tmpcur_6784); + CursorTy pvrtmp_6802 = tmp_struct_83.field0; + CursorTy pvrtmp_6803 = tmp_struct_83.field1; + CursorTy pvrtmp_6804 = tmp_struct_83.field2; + CursorTy pvrtmp_6805 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2953 = 21; + + CursorTy writetag_4760 = loc_2953 + 1; + + *(CursorTy *) writetag_4760 = pvrtmp_6789; + + CursorTy writecur_4761 = writetag_4760 + 8; + + *(CursorTy *) writecur_4761 = pvrtmp_6797; + + CursorTy writecur_4762 = writecur_4761 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6802, pvrtmp_6803, + loc_2953, pvrtmp_6805}; + break; + } + + case 23: + { + CursorTy tmpcur_6814 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6815 = tmpcur_6605 + 8; + CursorTy tmpcur_6816 = *(CursorTy *) tmpaftercur_6815; + CursorTy tmpaftercur_6817 = tmpaftercur_6815 + 8; + CursorTy jump_4041 = tmpaftercur_6815 + 8; + CursorTy jump_4040 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2954, end_r_2955, loc_3340, tmpaftercur_6817); + CursorTy pvrtmp_6818 = tmp_struct_84.field0; + CursorTy pvrtmp_6819 = tmp_struct_84.field1; + CursorTy pvrtmp_6820 = tmp_struct_84.field2; + CursorTy pvrtmp_6821 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2954, pvrtmp_6818, pvrtmp_6821, tmpcur_6814); + CursorTy pvrtmp_6826 = tmp_struct_85.field0; + CursorTy pvrtmp_6827 = tmp_struct_85.field1; + CursorTy pvrtmp_6828 = tmp_struct_85.field2; + CursorTy pvrtmp_6829 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2954, pvrtmp_6826, pvrtmp_6829, tmpcur_6816); + CursorTy pvrtmp_6834 = tmp_struct_86.field0; + CursorTy pvrtmp_6835 = tmp_struct_86.field1; + CursorTy pvrtmp_6836 = tmp_struct_86.field2; + CursorTy pvrtmp_6837 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2953 = 23; + + CursorTy writetag_4773 = loc_2953 + 1; + + *(CursorTy *) writetag_4773 = pvrtmp_6821; + + CursorTy writecur_4774 = writetag_4773 + 8; + + *(CursorTy *) writecur_4774 = pvrtmp_6829; + + CursorTy writecur_4775 = writecur_4774 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6834, pvrtmp_6835, + loc_2953, pvrtmp_6837}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6846 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6847 = tmpcur_6605 + 8; + CursorTy jump_4317 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2954, end_r_2955, loc_2953, tmpcur_6846); + CursorTy pvrtmp_6848 = tmp_struct_87.field0; + CursorTy pvrtmp_6849 = tmp_struct_87.field1; + CursorTy pvrtmp_6850 = tmp_struct_87.field2; + CursorTy pvrtmp_6851 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6848, jump_4317, + pvrtmp_6850, pvrtmp_6851}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6858 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6859 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2954, end_r_2955, loc_2953, tmpcur_6858); + CursorTy pvrtmp_6860 = tmp_struct_88.field0; + CursorTy pvrtmp_6861 = tmp_struct_88.field1; + CursorTy pvrtmp_6862 = tmp_struct_88.field2; + CursorTy pvrtmp_6863 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6860, pvrtmp_6861, + pvrtmp_6862, pvrtmp_6863}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6604"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2958, + CursorTy end_r_2959, + CursorTy loc_2957, + CursorTy arg_716_1321_1644) +{ + TagTyPacked tmpval_6871 = *(TagTyPacked *) arg_716_1321_1644; + CursorTy tmpcur_6872 = arg_716_1321_1644 + 1; + + + switch_7137: + ; + switch (tmpval_6871) { + + case 0: + { + CursorTy jump_4046 = arg_716_1321_1644 + 1; + + *(TagTyPacked *) loc_2957 = 0; + + CursorTy writetag_4787 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2959, jump_4046, + loc_2957, writetag_4787}; + break; + } + + case 9: + { + CursorTy tmpcur_6877 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6878 = tmpcur_6872 + 8; + CursorTy jump_4048 = tmpcur_6872 + 8; + CursorTy loc_3362 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3362, tmpaftercur_6878); + CursorTy pvrtmp_6879 = tmp_struct_92.field0; + CursorTy pvrtmp_6880 = tmp_struct_92.field1; + CursorTy pvrtmp_6881 = tmp_struct_92.field2; + CursorTy pvrtmp_6882 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6879, pvrtmp_6882, tmpcur_6877); + CursorTy pvrtmp_6887 = tmp_struct_93.field0; + CursorTy pvrtmp_6888 = tmp_struct_93.field1; + CursorTy pvrtmp_6889 = tmp_struct_93.field2; + CursorTy pvrtmp_6890 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2957 = 1; + + CursorTy writetag_4793 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6887, pvrtmp_6888, + loc_2957, pvrtmp_6890}; + break; + } + + case 11: + { + CursorTy tmpcur_6899 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6900 = tmpcur_6872 + 8; + CursorTy jump_4052 = tmpcur_6872 + 8; + CursorTy loc_3375 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3375, tmpaftercur_6900); + CursorTy pvrtmp_6901 = tmp_struct_94.field0; + CursorTy pvrtmp_6902 = tmp_struct_94.field1; + CursorTy pvrtmp_6903 = tmp_struct_94.field2; + CursorTy pvrtmp_6904 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6901, pvrtmp_6904, tmpcur_6899); + CursorTy pvrtmp_6909 = tmp_struct_95.field0; + CursorTy pvrtmp_6910 = tmp_struct_95.field1; + CursorTy pvrtmp_6911 = tmp_struct_95.field2; + CursorTy pvrtmp_6912 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2957 = 2; + + CursorTy writetag_4801 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6909, pvrtmp_6910, + loc_2957, pvrtmp_6912}; + break; + } + + case 13: + { + CursorTy tmpcur_6921 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6922 = tmpcur_6872 + 8; + CursorTy tmpcur_6923 = *(CursorTy *) tmpaftercur_6922; + CursorTy tmpaftercur_6924 = tmpaftercur_6922 + 8; + CursorTy jump_4057 = tmpaftercur_6922 + 8; + CursorTy jump_4056 = tmpcur_6872 + 8; + CursorTy loc_3393 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2958, end_r_2959, loc_3393, tmpaftercur_6924); + CursorTy pvrtmp_6925 = tmp_struct_96.field0; + CursorTy pvrtmp_6926 = tmp_struct_96.field1; + CursorTy pvrtmp_6927 = tmp_struct_96.field2; + CursorTy pvrtmp_6928 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6925, pvrtmp_6928, tmpcur_6921); + CursorTy pvrtmp_6933 = tmp_struct_97.field0; + CursorTy pvrtmp_6934 = tmp_struct_97.field1; + CursorTy pvrtmp_6935 = tmp_struct_97.field2; + CursorTy pvrtmp_6936 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6933, pvrtmp_6936, tmpcur_6923); + CursorTy pvrtmp_6941 = tmp_struct_98.field0; + CursorTy pvrtmp_6942 = tmp_struct_98.field1; + CursorTy pvrtmp_6943 = tmp_struct_98.field2; + CursorTy pvrtmp_6944 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2957 = 3; + + CursorTy writetag_4811 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6941, pvrtmp_6942, + loc_2957, pvrtmp_6944}; + break; + } + + case 15: + { + CursorTy tmpcur_6953 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6954 = tmpcur_6872 + 8; + CursorTy tmpcur_6955 = *(CursorTy *) tmpaftercur_6954; + CursorTy tmpaftercur_6956 = tmpaftercur_6954 + 8; + CursorTy jump_4063 = tmpaftercur_6954 + 8; + CursorTy jump_4062 = tmpcur_6872 + 8; + CursorTy loc_3413 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3413, tmpaftercur_6956); + CursorTy pvrtmp_6957 = tmp_struct_99.field0; + CursorTy pvrtmp_6958 = tmp_struct_99.field1; + CursorTy pvrtmp_6959 = tmp_struct_99.field2; + CursorTy pvrtmp_6960 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6957, pvrtmp_6960, tmpcur_6953); + CursorTy pvrtmp_6965 = tmp_struct_100.field0; + CursorTy pvrtmp_6966 = tmp_struct_100.field1; + CursorTy pvrtmp_6967 = tmp_struct_100.field2; + CursorTy pvrtmp_6968 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_6965, pvrtmp_6968, tmpcur_6955); + CursorTy pvrtmp_6973 = tmp_struct_101.field0; + CursorTy pvrtmp_6974 = tmp_struct_101.field1; + CursorTy pvrtmp_6975 = tmp_struct_101.field2; + CursorTy pvrtmp_6976 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2957 = 4; + + CursorTy writetag_4822 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6973, pvrtmp_6974, + loc_2957, pvrtmp_6976}; + break; + } + + case 17: + { + CursorTy tmpcur_6985 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6986 = tmpcur_6872 + 8; + CursorTy tmpcur_6987 = *(CursorTy *) tmpaftercur_6986; + CursorTy tmpaftercur_6988 = tmpaftercur_6986 + 8; + CursorTy jump_4069 = tmpaftercur_6986 + 8; + CursorTy jump_4068 = tmpcur_6872 + 8; + CursorTy loc_3433 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2958, end_r_2959, loc_3433, tmpaftercur_6988); + CursorTy pvrtmp_6989 = tmp_struct_102.field0; + CursorTy pvrtmp_6990 = tmp_struct_102.field1; + CursorTy pvrtmp_6991 = tmp_struct_102.field2; + CursorTy pvrtmp_6992 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6989, pvrtmp_6992, tmpcur_6985); + CursorTy pvrtmp_6997 = tmp_struct_103.field0; + CursorTy pvrtmp_6998 = tmp_struct_103.field1; + CursorTy pvrtmp_6999 = tmp_struct_103.field2; + CursorTy pvrtmp_7000 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6997, pvrtmp_7000, tmpcur_6987); + CursorTy pvrtmp_7005 = tmp_struct_104.field0; + CursorTy pvrtmp_7006 = tmp_struct_104.field1; + CursorTy pvrtmp_7007 = tmp_struct_104.field2; + CursorTy pvrtmp_7008 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2957 = 5; + + CursorTy writetag_4833 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7005, pvrtmp_7006, + loc_2957, pvrtmp_7008}; + break; + } + + case 19: + { + CursorTy tmpcur_7017 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7018 = tmpcur_6872 + 8; + CursorTy tmpcur_7019 = *(CursorTy *) tmpaftercur_7018; + CursorTy tmpaftercur_7020 = tmpaftercur_7018 + 8; + CursorTy jump_4075 = tmpaftercur_7018 + 8; + CursorTy jump_4074 = tmpcur_6872 + 8; + CursorTy loc_3453 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3453, tmpaftercur_7020); + CursorTy pvrtmp_7021 = tmp_struct_105.field0; + CursorTy pvrtmp_7022 = tmp_struct_105.field1; + CursorTy pvrtmp_7023 = tmp_struct_105.field2; + CursorTy pvrtmp_7024 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7021, pvrtmp_7024, tmpcur_7017); + CursorTy pvrtmp_7029 = tmp_struct_106.field0; + CursorTy pvrtmp_7030 = tmp_struct_106.field1; + CursorTy pvrtmp_7031 = tmp_struct_106.field2; + CursorTy pvrtmp_7032 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_7029, pvrtmp_7032, tmpcur_7019); + CursorTy pvrtmp_7037 = tmp_struct_107.field0; + CursorTy pvrtmp_7038 = tmp_struct_107.field1; + CursorTy pvrtmp_7039 = tmp_struct_107.field2; + CursorTy pvrtmp_7040 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2957 = 6; + + CursorTy writetag_4844 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7037, pvrtmp_7038, + loc_2957, pvrtmp_7040}; + break; + } + + case 21: + { + CursorTy tmpcur_7049 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7050 = tmpcur_6872 + 8; + CursorTy tmpcur_7051 = *(CursorTy *) tmpaftercur_7050; + CursorTy tmpaftercur_7052 = tmpaftercur_7050 + 8; + CursorTy jump_4081 = tmpaftercur_7050 + 8; + CursorTy jump_4080 = tmpcur_6872 + 8; + CursorTy loc_3473 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3473, tmpaftercur_7052); + CursorTy pvrtmp_7053 = tmp_struct_108.field0; + CursorTy pvrtmp_7054 = tmp_struct_108.field1; + CursorTy pvrtmp_7055 = tmp_struct_108.field2; + CursorTy pvrtmp_7056 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7053, pvrtmp_7056, tmpcur_7049); + CursorTy pvrtmp_7061 = tmp_struct_109.field0; + CursorTy pvrtmp_7062 = tmp_struct_109.field1; + CursorTy pvrtmp_7063 = tmp_struct_109.field2; + CursorTy pvrtmp_7064 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_7061, pvrtmp_7064, tmpcur_7051); + CursorTy pvrtmp_7069 = tmp_struct_110.field0; + CursorTy pvrtmp_7070 = tmp_struct_110.field1; + CursorTy pvrtmp_7071 = tmp_struct_110.field2; + CursorTy pvrtmp_7072 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2957 = 7; + + CursorTy writetag_4855 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7069, pvrtmp_7070, + loc_2957, pvrtmp_7072}; + break; + } + + case 23: + { + CursorTy tmpcur_7081 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7082 = tmpcur_6872 + 8; + CursorTy tmpcur_7083 = *(CursorTy *) tmpaftercur_7082; + CursorTy tmpaftercur_7084 = tmpaftercur_7082 + 8; + CursorTy jump_4087 = tmpaftercur_7082 + 8; + CursorTy jump_4086 = tmpcur_6872 + 8; + CursorTy loc_3493 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3493, tmpaftercur_7084); + CursorTy pvrtmp_7085 = tmp_struct_111.field0; + CursorTy pvrtmp_7086 = tmp_struct_111.field1; + CursorTy pvrtmp_7087 = tmp_struct_111.field2; + CursorTy pvrtmp_7088 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_7085, pvrtmp_7088, tmpcur_7081); + CursorTy pvrtmp_7093 = tmp_struct_112.field0; + CursorTy pvrtmp_7094 = tmp_struct_112.field1; + CursorTy pvrtmp_7095 = tmp_struct_112.field2; + CursorTy pvrtmp_7096 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7093, pvrtmp_7096, tmpcur_7083); + CursorTy pvrtmp_7101 = tmp_struct_113.field0; + CursorTy pvrtmp_7102 = tmp_struct_113.field1; + CursorTy pvrtmp_7103 = tmp_struct_113.field2; + CursorTy pvrtmp_7104 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2957 = 8; + + CursorTy writetag_4866 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7101, pvrtmp_7102, + loc_2957, pvrtmp_7104}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7113 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7114 = tmpcur_6872 + 8; + CursorTy jump_4323 = tmpcur_6872 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_2957, tmpcur_7113); + CursorTy pvrtmp_7115 = tmp_struct_114.field0; + CursorTy pvrtmp_7116 = tmp_struct_114.field1; + CursorTy pvrtmp_7117 = tmp_struct_114.field2; + CursorTy pvrtmp_7118 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7115, jump_4323, + pvrtmp_7117, pvrtmp_7118}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7125 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7126 = tmpcur_6872 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_2957, tmpcur_7125); + CursorTy pvrtmp_7127 = tmp_struct_115.field0; + CursorTy pvrtmp_7128 = tmp_struct_115.field1; + CursorTy pvrtmp_7129 = tmp_struct_115.field2; + CursorTy pvrtmp_7130 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7127, pvrtmp_7128, + pvrtmp_7129, pvrtmp_7130}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6871"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2961, CursorTy arg_761_1366_1689) +{ + TagTyPacked tmpval_7138 = *(TagTyPacked *) arg_761_1366_1689; + CursorTy tmpcur_7139 = arg_761_1366_1689 + 1; + + + switch_7196: + ; + switch (tmpval_7138) { + + case 0: + { + CursorTy jump_4092 = arg_761_1366_1689 + 1; + + return (CursorProd) {jump_4092}; + break; + } + + case 9: + { + CursorTy tmpcur_7140 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7141 = tmpcur_7139 + 8; + CursorTy jump_4094 = tmpcur_7139 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2961, tmpaftercur_7141); + CursorTy pvrtmp_7142 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2961, tmpcur_7140); + CursorTy pvrtmp_7143 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7143}; + break; + } + + case 11: + { + CursorTy tmpcur_7144 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7145 = tmpcur_7139 + 8; + CursorTy jump_4098 = tmpcur_7139 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2961, tmpaftercur_7145); + CursorTy pvrtmp_7146 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2961, tmpcur_7144); + CursorTy pvrtmp_7147 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7147}; + break; + } + + case 13: + { + CursorTy tmpcur_7148 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7149 = tmpcur_7139 + 8; + CursorTy tmpcur_7150 = *(CursorTy *) tmpaftercur_7149; + CursorTy tmpaftercur_7151 = tmpaftercur_7149 + 8; + CursorTy jump_4103 = tmpaftercur_7149 + 8; + CursorTy jump_4102 = tmpcur_7139 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2961, tmpaftercur_7151); + CursorTy pvrtmp_7152 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2961, tmpcur_7148); + CursorTy pvrtmp_7153 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2961, tmpcur_7150); + CursorTy pvrtmp_7154 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7154}; + break; + } + + case 15: + { + CursorTy tmpcur_7155 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7156 = tmpcur_7139 + 8; + CursorTy tmpcur_7157 = *(CursorTy *) tmpaftercur_7156; + CursorTy tmpaftercur_7158 = tmpaftercur_7156 + 8; + CursorTy jump_4109 = tmpaftercur_7156 + 8; + CursorTy jump_4108 = tmpcur_7139 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2961, tmpaftercur_7158); + CursorTy pvrtmp_7159 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2961, tmpcur_7155); + CursorTy pvrtmp_7160 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2961, tmpcur_7157); + CursorTy pvrtmp_7161 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7161}; + break; + } + + case 17: + { + CursorTy tmpcur_7162 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7163 = tmpcur_7139 + 8; + CursorTy tmpcur_7164 = *(CursorTy *) tmpaftercur_7163; + CursorTy tmpaftercur_7165 = tmpaftercur_7163 + 8; + CursorTy jump_4115 = tmpaftercur_7163 + 8; + CursorTy jump_4114 = tmpcur_7139 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2961, tmpaftercur_7165); + CursorTy pvrtmp_7166 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2961, tmpcur_7162); + CursorTy pvrtmp_7167 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2961, tmpcur_7164); + CursorTy pvrtmp_7168 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7168}; + break; + } + + case 19: + { + CursorTy tmpcur_7169 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7170 = tmpcur_7139 + 8; + CursorTy tmpcur_7171 = *(CursorTy *) tmpaftercur_7170; + CursorTy tmpaftercur_7172 = tmpaftercur_7170 + 8; + CursorTy jump_4121 = tmpaftercur_7170 + 8; + CursorTy jump_4120 = tmpcur_7139 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2961, tmpaftercur_7172); + CursorTy pvrtmp_7173 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2961, tmpcur_7169); + CursorTy pvrtmp_7174 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2961, tmpcur_7171); + CursorTy pvrtmp_7175 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7175}; + break; + } + + case 21: + { + CursorTy tmpcur_7176 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7177 = tmpcur_7139 + 8; + CursorTy tmpcur_7178 = *(CursorTy *) tmpaftercur_7177; + CursorTy tmpaftercur_7179 = tmpaftercur_7177 + 8; + CursorTy jump_4127 = tmpaftercur_7177 + 8; + CursorTy jump_4126 = tmpcur_7139 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2961, tmpaftercur_7179); + CursorTy pvrtmp_7180 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2961, tmpcur_7176); + CursorTy pvrtmp_7181 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2961, tmpcur_7178); + CursorTy pvrtmp_7182 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7182}; + break; + } + + case 23: + { + CursorTy tmpcur_7183 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7184 = tmpcur_7139 + 8; + CursorTy tmpcur_7185 = *(CursorTy *) tmpaftercur_7184; + CursorTy tmpaftercur_7186 = tmpaftercur_7184 + 8; + CursorTy jump_4133 = tmpaftercur_7184 + 8; + CursorTy jump_4132 = tmpcur_7139 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2961, tmpaftercur_7186); + CursorTy pvrtmp_7187 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2961, tmpcur_7183); + CursorTy pvrtmp_7188 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2961, tmpcur_7185); + CursorTy pvrtmp_7189 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7189}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7190 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7191 = tmpcur_7139 + 8; + CursorTy jump_4329 = tmpcur_7139 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2961, tmpcur_7190); + CursorTy pvrtmp_7192 = tmp_struct_138.field0; + + return (CursorProd) {jump_4329}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7193 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7194 = tmpcur_7139 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2961, tmpcur_7193); + CursorTy pvrtmp_7195 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7195}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7138"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2963, CursorTy arg_806_1411_1734) +{ + TagTyPacked tmpval_7197 = *(TagTyPacked *) arg_806_1411_1734; + CursorTy tmpcur_7198 = arg_806_1411_1734 + 1; + + + switch_7255: + ; + switch (tmpval_7197) { + + case 0: + { + CursorTy jump_4138 = arg_806_1411_1734 + 1; + unsigned char wildcard_807_1412_1735 = print_symbol(6151); + unsigned char wildcard_808_1413_1736 = print_symbol(6145); + + return (CursorProd) {jump_4138}; + break; + } + + case 9: + { + CursorTy tmpcur_7199 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7200 = tmpcur_7198 + 8; + CursorTy jump_4140 = tmpcur_7198 + 8; + unsigned char wildcard_813_1416_1739 = print_symbol(6157); + CursorProd tmp_struct_140 = + _print_Content(end_r_2963, tmpaftercur_7200); + CursorTy pvrtmp_7201 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2963, tmpcur_7199); + CursorTy pvrtmp_7202 = tmp_struct_141.field0; + unsigned char wildcard_814_1419_1742 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7202}; + break; + } + + case 11: + { + CursorTy tmpcur_7203 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7204 = tmpcur_7198 + 8; + CursorTy jump_4144 = tmpcur_7198 + 8; + unsigned char wildcard_819_1422_1745 = print_symbol(6160); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2963, tmpaftercur_7204); + CursorTy pvrtmp_7205 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2963, tmpcur_7203); + CursorTy pvrtmp_7206 = tmp_struct_143.field0; + unsigned char wildcard_820_1425_1748 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7206}; + break; + } + + case 13: + { + CursorTy tmpcur_7207 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7208 = tmpcur_7198 + 8; + CursorTy tmpcur_7209 = *(CursorTy *) tmpaftercur_7208; + CursorTy tmpaftercur_7210 = tmpaftercur_7208 + 8; + CursorTy jump_4149 = tmpaftercur_7208 + 8; + CursorTy jump_4148 = tmpcur_7198 + 8; + unsigned char wildcard_827_1429_1752 = print_symbol(6148); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2963, tmpaftercur_7210); + CursorTy pvrtmp_7211 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2963, tmpcur_7207); + CursorTy pvrtmp_7212 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2963, tmpcur_7209); + CursorTy pvrtmp_7213 = tmp_struct_146.field0; + unsigned char wildcard_828_1433_1756 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7213}; + break; + } + + case 15: + { + CursorTy tmpcur_7214 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7215 = tmpcur_7198 + 8; + CursorTy tmpcur_7216 = *(CursorTy *) tmpaftercur_7215; + CursorTy tmpaftercur_7217 = tmpaftercur_7215 + 8; + CursorTy jump_4155 = tmpaftercur_7215 + 8; + CursorTy jump_4154 = tmpcur_7198 + 8; + unsigned char wildcard_835_1437_1760 = print_symbol(6159); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2963, tmpaftercur_7217); + CursorTy pvrtmp_7218 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2963, tmpcur_7214); + CursorTy pvrtmp_7219 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2963, tmpcur_7216); + CursorTy pvrtmp_7220 = tmp_struct_149.field0; + unsigned char wildcard_836_1441_1764 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7220}; + break; + } + + case 17: + { + CursorTy tmpcur_7221 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7222 = tmpcur_7198 + 8; + CursorTy tmpcur_7223 = *(CursorTy *) tmpaftercur_7222; + CursorTy tmpaftercur_7224 = tmpaftercur_7222 + 8; + CursorTy jump_4161 = tmpaftercur_7222 + 8; + CursorTy jump_4160 = tmpcur_7198 + 8; + unsigned char wildcard_843_1445_1768 = print_symbol(6149); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2963, tmpaftercur_7224); + CursorTy pvrtmp_7225 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2963, tmpcur_7221); + CursorTy pvrtmp_7226 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2963, tmpcur_7223); + CursorTy pvrtmp_7227 = tmp_struct_152.field0; + unsigned char wildcard_844_1449_1772 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7227}; + break; + } + + case 19: + { + CursorTy tmpcur_7228 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7229 = tmpcur_7198 + 8; + CursorTy tmpcur_7230 = *(CursorTy *) tmpaftercur_7229; + CursorTy tmpaftercur_7231 = tmpaftercur_7229 + 8; + CursorTy jump_4167 = tmpaftercur_7229 + 8; + CursorTy jump_4166 = tmpcur_7198 + 8; + unsigned char wildcard_851_1453_1776 = print_symbol(6158); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2963, tmpaftercur_7231); + CursorTy pvrtmp_7232 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2963, tmpcur_7228); + CursorTy pvrtmp_7233 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2963, tmpcur_7230); + CursorTy pvrtmp_7234 = tmp_struct_155.field0; + unsigned char wildcard_852_1457_1780 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7234}; + break; + } + + case 21: + { + CursorTy tmpcur_7235 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7236 = tmpcur_7198 + 8; + CursorTy tmpcur_7237 = *(CursorTy *) tmpaftercur_7236; + CursorTy tmpaftercur_7238 = tmpaftercur_7236 + 8; + CursorTy jump_4173 = tmpaftercur_7236 + 8; + CursorTy jump_4172 = tmpcur_7198 + 8; + unsigned char wildcard_859_1461_1784 = print_symbol(6155); + CursorProd tmp_struct_156 = + _print_Content(end_r_2963, tmpaftercur_7238); + CursorTy pvrtmp_7239 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2963, tmpcur_7235); + CursorTy pvrtmp_7240 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2963, tmpcur_7237); + CursorTy pvrtmp_7241 = tmp_struct_158.field0; + unsigned char wildcard_860_1465_1788 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7241}; + break; + } + + case 23: + { + CursorTy tmpcur_7242 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7243 = tmpcur_7198 + 8; + CursorTy tmpcur_7244 = *(CursorTy *) tmpaftercur_7243; + CursorTy tmpaftercur_7245 = tmpaftercur_7243 + 8; + CursorTy jump_4179 = tmpaftercur_7243 + 8; + CursorTy jump_4178 = tmpcur_7198 + 8; + unsigned char wildcard_867_1469_1792 = print_symbol(6156); + CursorProd tmp_struct_159 = + _print_Content(end_r_2963, tmpaftercur_7245); + CursorTy pvrtmp_7246 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2963, tmpcur_7242); + CursorTy pvrtmp_7247 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2963, tmpcur_7244); + CursorTy pvrtmp_7248 = tmp_struct_161.field0; + unsigned char wildcard_868_1473_1796 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7248}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7249 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7250 = tmpcur_7198 + 8; + CursorTy jump_4335 = tmpcur_7198 + 8; + unsigned char wildcard_4338 = print_symbol(6162); + CursorProd tmp_struct_162 = _print_Adt(end_r_2963, tmpcur_7249); + CursorTy pvrtmp_7251 = tmp_struct_162.field0; + + return (CursorProd) {jump_4335}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7252 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7253 = tmpcur_7198 + 8; + unsigned char wildcard_4338 = print_symbol(6161); + CursorProd tmp_struct_163 = _print_Adt(end_r_2963, tmpcur_7252); + CursorTy pvrtmp_7254 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7254}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7197"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2966, + CursorTy end_r_2967, CursorTy loc_2965, + CursorTy arg_869_1474_1797) +{ + if (loc_2965 + 32 > end_r_2967) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2967); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2967 = chunk_end_169; + *(TagTyPacked *) loc_2965 = 255; + + CursorTy redir = loc_2965 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2965 = chunk_start_168; + } + + CursorTy loc_3671 = loc_2965 + 1; + CursorTy loc_3672 = loc_3671 + 8; + TagTyPacked tmpval_7256 = *(TagTyPacked *) arg_869_1474_1797; + CursorTy tmpcur_7257 = arg_869_1474_1797 + 1; + + + switch_7300: + ; + switch (tmpval_7256) { + + case 0: + { + CursorTy jump_4184 = arg_869_1474_1797 + 1; + + *(TagTyPacked *) loc_2965 = 0; + + CursorTy writetag_4980 = loc_2965 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2967, jump_4184, + loc_2965, writetag_4980}; + break; + } + + case 1: + { + IntTy tmpval_7262 = *(IntTy *) tmpcur_7257; + CursorTy tmpcur_7263 = tmpcur_7257 + sizeof(IntTy); + CursorTy jump_4186 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2966, end_r_2967, loc_3672, tmpcur_7263); + CursorTy pvrtmp_7264 = tmp_struct_164.field0; + CursorTy pvrtmp_7265 = tmp_struct_164.field1; + CursorTy pvrtmp_7266 = tmp_struct_164.field2; + CursorTy pvrtmp_7267 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2965 = 1; + + CursorTy writetag_4985 = loc_2965 + 1; + + *(IntTy *) writetag_4985 = tmpval_7262; + + CursorTy writecur_4986 = writetag_4985 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7264, pvrtmp_7265, + loc_2965, pvrtmp_7267}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7276 = *(CursorTy *) tmpcur_7257; + CursorTy tmpaftercur_7277 = tmpcur_7257 + 8; + CursorTy jump_4341 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2966, end_r_2967, loc_2965, tmpcur_7276); + CursorTy pvrtmp_7278 = tmp_struct_165.field0; + CursorTy pvrtmp_7279 = tmp_struct_165.field1; + CursorTy pvrtmp_7280 = tmp_struct_165.field2; + CursorTy pvrtmp_7281 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7278, jump_4341, + pvrtmp_7280, pvrtmp_7281}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7288 = *(CursorTy *) tmpcur_7257; + CursorTy tmpaftercur_7289 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2966, end_r_2967, loc_2965, tmpcur_7288); + CursorTy pvrtmp_7290 = tmp_struct_166.field0; + CursorTy pvrtmp_7291 = tmp_struct_166.field1; + CursorTy pvrtmp_7292 = tmp_struct_166.field2; + CursorTy pvrtmp_7293 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7290, pvrtmp_7291, + pvrtmp_7292, pvrtmp_7293}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7256"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_874_1479_1802) +{ + CursorTy loc_3684 = loc_2969 + 1; + CursorTy loc_3685 = loc_3684 + 8; + TagTyPacked tmpval_7301 = *(TagTyPacked *) arg_874_1479_1802; + CursorTy tmpcur_7302 = arg_874_1479_1802 + 1; + + + switch_7345: + ; + switch (tmpval_7301) { + + case 0: + { + CursorTy jump_4189 = arg_874_1479_1802 + 1; + + *(TagTyPacked *) loc_2969 = 0; + + CursorTy writetag_4996 = loc_2969 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2971, jump_4189, + loc_2969, writetag_4996}; + break; + } + + case 1: + { + IntTy tmpval_7307 = *(IntTy *) tmpcur_7302; + CursorTy tmpcur_7308 = tmpcur_7302 + sizeof(IntTy); + CursorTy jump_4191 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_3685, tmpcur_7308); + CursorTy pvrtmp_7309 = tmp_struct_170.field0; + CursorTy pvrtmp_7310 = tmp_struct_170.field1; + CursorTy pvrtmp_7311 = tmp_struct_170.field2; + CursorTy pvrtmp_7312 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2969 = 1; + + CursorTy writetag_5001 = loc_2969 + 1; + + *(IntTy *) writetag_5001 = tmpval_7307; + + CursorTy writecur_5002 = writetag_5001 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7309, pvrtmp_7310, + loc_2969, pvrtmp_7312}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7321 = *(CursorTy *) tmpcur_7302; + CursorTy tmpaftercur_7322 = tmpcur_7302 + 8; + CursorTy jump_4347 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_2969, tmpcur_7321); + CursorTy pvrtmp_7323 = tmp_struct_171.field0; + CursorTy pvrtmp_7324 = tmp_struct_171.field1; + CursorTy pvrtmp_7325 = tmp_struct_171.field2; + CursorTy pvrtmp_7326 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7323, jump_4347, + pvrtmp_7325, pvrtmp_7326}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7333 = *(CursorTy *) tmpcur_7302; + CursorTy tmpaftercur_7334 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_2969, tmpcur_7333); + CursorTy pvrtmp_7335 = tmp_struct_172.field0; + CursorTy pvrtmp_7336 = tmp_struct_172.field1; + CursorTy pvrtmp_7337 = tmp_struct_172.field2; + CursorTy pvrtmp_7338 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7335, pvrtmp_7336, + pvrtmp_7337, pvrtmp_7338}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7301"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2973, CursorTy arg_879_1484_1807) +{ + TagTyPacked tmpval_7346 = *(TagTyPacked *) arg_879_1484_1807; + CursorTy tmpcur_7347 = arg_879_1484_1807 + 1; + + + switch_7357: + ; + switch (tmpval_7346) { + + case 0: + { + CursorTy jump_4194 = arg_879_1484_1807 + 1; + + return (CursorProd) {jump_4194}; + break; + } + + case 1: + { + IntTy tmpval_7348 = *(IntTy *) tmpcur_7347; + CursorTy tmpcur_7349 = tmpcur_7347 + sizeof(IntTy); + CursorTy jump_4196 = tmpcur_7347 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2973, tmpcur_7349); + CursorTy pvrtmp_7350 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7350}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7351 = *(CursorTy *) tmpcur_7347; + CursorTy tmpaftercur_7352 = tmpcur_7347 + 8; + CursorTy jump_4353 = tmpcur_7347 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2973, tmpcur_7351); + CursorTy pvrtmp_7353 = tmp_struct_174.field0; + + return (CursorProd) {jump_4353}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7354 = *(CursorTy *) tmpcur_7347; + CursorTy tmpaftercur_7355 = tmpcur_7347 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2973, tmpcur_7354); + CursorTy pvrtmp_7356 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7356}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7346"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2975, CursorTy arg_884_1488_1811) +{ + TagTyPacked tmpval_7358 = *(TagTyPacked *) arg_884_1488_1811; + CursorTy tmpcur_7359 = arg_884_1488_1811 + 1; + + + switch_7369: + ; + switch (tmpval_7358) { + + case 0: + { + CursorTy jump_4199 = arg_884_1488_1811 + 1; + unsigned char wildcard_885_1489_1812 = print_symbol(6150); + unsigned char wildcard_886_1490_1813 = print_symbol(6145); + + return (CursorProd) {jump_4199}; + break; + } + + case 1: + { + IntTy tmpval_7360 = *(IntTy *) tmpcur_7359; + CursorTy tmpcur_7361 = tmpcur_7359 + sizeof(IntTy); + CursorTy jump_4201 = tmpcur_7359 + 8; + unsigned char wildcard_891_1493_1816 = print_symbol(6147); + unsigned char y_889_1494_1817 = printf("%lld", tmpval_7360); + CursorProd tmp_struct_176 = _print_Tags(end_r_2975, tmpcur_7361); + CursorTy pvrtmp_7362 = tmp_struct_176.field0; + unsigned char wildcard_892_1496_1819 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7362}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7363 = *(CursorTy *) tmpcur_7359; + CursorTy tmpaftercur_7364 = tmpcur_7359 + 8; + CursorTy jump_4359 = tmpcur_7359 + 8; + unsigned char wildcard_4362 = print_symbol(6162); + CursorProd tmp_struct_177 = _print_Tags(end_r_2975, tmpcur_7363); + CursorTy pvrtmp_7365 = tmp_struct_177.field0; + + return (CursorProd) {jump_4359}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7366 = *(CursorTy *) tmpcur_7359; + CursorTy tmpaftercur_7367 = tmpcur_7359 + 8; + unsigned char wildcard_4362 = print_symbol(6161); + CursorProd tmp_struct_178 = _print_Tags(end_r_2975, tmpcur_7366); + CursorTy pvrtmp_7368 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7368}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7358"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2710) +{ + if (loc_2977 + 32 > end_r_2979) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2979); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2979 = chunk_end_184; + *(TagTyPacked *) loc_2977 = 255; + + CursorTy redir = loc_2977 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2977 = chunk_start_183; + } + + CursorTy loc_3709 = loc_2977 + 1; + CursorTy loc_3710 = loc_3709 + 8; + TagTyPacked tmpval_7370 = *(TagTyPacked *) arg_2710; + CursorTy tmpcur_7371 = arg_2710 + 1; + + + switch_7414: + ; + switch (tmpval_7370) { + + case 0: + { + CursorTy jump_4204 = arg_2710 + 1; + + *(TagTyPacked *) loc_2977 = 0; + + CursorTy writetag_5032 = loc_2977 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2979, jump_4204, + loc_2977, writetag_5032}; + break; + } + + case 1: + { + IntTy tmpval_7376 = *(IntTy *) tmpcur_7371; + CursorTy tmpcur_7377 = tmpcur_7371 + sizeof(IntTy); + CursorTy jump_4206 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_3710, tmpcur_7377); + CursorTy pvrtmp_7378 = tmp_struct_179.field0; + CursorTy pvrtmp_7379 = tmp_struct_179.field1; + CursorTy pvrtmp_7380 = tmp_struct_179.field2; + CursorTy pvrtmp_7381 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2977 = 1; + + CursorTy writetag_5037 = loc_2977 + 1; + + *(IntTy *) writetag_5037 = tmpval_7376; + + CursorTy writecur_5038 = writetag_5037 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7378, pvrtmp_7379, + loc_2977, pvrtmp_7381}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7390 = *(CursorTy *) tmpcur_7371; + CursorTy tmpaftercur_7391 = tmpcur_7371 + 8; + CursorTy jump_4365 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_2977, tmpcur_7390); + CursorTy pvrtmp_7392 = tmp_struct_180.field0; + CursorTy pvrtmp_7393 = tmp_struct_180.field1; + CursorTy pvrtmp_7394 = tmp_struct_180.field2; + CursorTy pvrtmp_7395 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7392, jump_4365, + pvrtmp_7394, pvrtmp_7395}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7402 = *(CursorTy *) tmpcur_7371; + CursorTy tmpaftercur_7403 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_2977, tmpcur_7402); + CursorTy pvrtmp_7404 = tmp_struct_181.field0; + CursorTy pvrtmp_7405 = tmp_struct_181.field1; + CursorTy pvrtmp_7406 = tmp_struct_181.field2; + CursorTy pvrtmp_7407 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7404, pvrtmp_7405, + pvrtmp_7406, pvrtmp_7407}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7370"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2715) +{ + if (loc_2981 + 32 > end_r_2983) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2983); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2983 = chunk_end_191; + *(TagTyPacked *) loc_2981 = 255; + + CursorTy redir = loc_2981 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2981 = chunk_start_190; + } + + TagTyPacked tmpval_7415 = *(TagTyPacked *) arg_2715; + CursorTy tmpcur_7416 = arg_2715 + 1; + + + switch_7465: + ; + switch (tmpval_7415) { + + case 0: + { + CursorTy loc_3720 = loc_2981 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2982, end_r_2983, loc_3720, tmpcur_7416); + CursorTy pvrtmp_7417 = tmp_struct_185.field0; + CursorTy pvrtmp_7418 = tmp_struct_185.field1; + CursorTy pvrtmp_7419 = tmp_struct_185.field2; + CursorTy pvrtmp_7420 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2981 = 0; + + CursorTy writetag_5049 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7417, pvrtmp_7418, + loc_2981, pvrtmp_7420}; + break; + } + + case 1: + { + CursorTy loc_3726 = loc_2981 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2982, end_r_2983, loc_3726, tmpcur_7416); + CursorTy pvrtmp_7429 = tmp_struct_186.field0; + CursorTy pvrtmp_7430 = tmp_struct_186.field1; + CursorTy pvrtmp_7431 = tmp_struct_186.field2; + CursorTy pvrtmp_7432 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2981 = 1; + + CursorTy writetag_5054 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7429, pvrtmp_7430, + loc_2981, pvrtmp_7432}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7441 = *(CursorTy *) tmpcur_7416; + CursorTy tmpaftercur_7442 = tmpcur_7416 + 8; + CursorTy jump_4371 = tmpcur_7416 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2982, end_r_2983, loc_2981, tmpcur_7441); + CursorTy pvrtmp_7443 = tmp_struct_187.field0; + CursorTy pvrtmp_7444 = tmp_struct_187.field1; + CursorTy pvrtmp_7445 = tmp_struct_187.field2; + CursorTy pvrtmp_7446 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7443, jump_4371, + pvrtmp_7445, pvrtmp_7446}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7453 = *(CursorTy *) tmpcur_7416; + CursorTy tmpaftercur_7454 = tmpcur_7416 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2982, end_r_2983, loc_2981, tmpcur_7453); + CursorTy pvrtmp_7455 = tmp_struct_188.field0; + CursorTy pvrtmp_7456 = tmp_struct_188.field1; + CursorTy pvrtmp_7457 = tmp_struct_188.field2; + CursorTy pvrtmp_7458 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7455, pvrtmp_7456, + pvrtmp_7457, pvrtmp_7458}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7415"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2986, + CursorTy end_r_2987, + CursorTy loc_2985, + CursorTy arg_2720) +{ + if (loc_2985 + 32 > end_r_2987) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2987); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2987 = chunk_end_218; + *(TagTyPacked *) loc_2985 = 255; + + CursorTy redir = loc_2985 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2985 = chunk_start_217; + } + + CursorTy loc_3739 = loc_2985 + 1; + CursorTy loc_3740 = loc_3739 + 8; + CursorTy loc_3741 = loc_3740 + 8; + CursorTy loc_3757 = loc_2985 + 1; + CursorTy loc_3758 = loc_3757 + 8; + CursorTy loc_3759 = loc_3758 + 8; + CursorTy loc_3779 = loc_2985 + 1; + CursorTy loc_3780 = loc_3779 + 8; + CursorTy loc_3781 = loc_3780 + 8; + CursorTy loc_3782 = loc_3781 + 8; + CursorTy loc_3806 = loc_2985 + 1; + CursorTy loc_3807 = loc_3806 + 8; + CursorTy loc_3808 = loc_3807 + 8; + CursorTy loc_3809 = loc_3808 + 8; + CursorTy loc_3833 = loc_2985 + 1; + CursorTy loc_3834 = loc_3833 + 8; + CursorTy loc_3835 = loc_3834 + 8; + CursorTy loc_3836 = loc_3835 + 8; + CursorTy loc_3860 = loc_2985 + 1; + CursorTy loc_3861 = loc_3860 + 8; + CursorTy loc_3862 = loc_3861 + 8; + CursorTy loc_3863 = loc_3862 + 8; + CursorTy loc_3887 = loc_2985 + 1; + CursorTy loc_3888 = loc_3887 + 8; + CursorTy loc_3889 = loc_3888 + 8; + CursorTy loc_3890 = loc_3889 + 8; + CursorTy loc_3914 = loc_2985 + 1; + CursorTy loc_3915 = loc_3914 + 8; + CursorTy loc_3916 = loc_3915 + 8; + CursorTy loc_3917 = loc_3916 + 8; + TagTyPacked tmpval_7466 = *(TagTyPacked *) arg_2720; + CursorTy tmpcur_7467 = arg_2720 + 1; + + + switch_7704: + ; + switch (tmpval_7466) { + + case 0: + { + CursorTy jump_4213 = arg_2720 + 1; + + *(TagTyPacked *) loc_2985 = 0; + + CursorTy writetag_5064 = loc_2985 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2987, jump_4213, + loc_2985, writetag_5064}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3741, tmpcur_7467); + CursorTy pvrtmp_7472 = tmp_struct_192.field0; + CursorTy pvrtmp_7473 = tmp_struct_192.field1; + CursorTy pvrtmp_7474 = tmp_struct_192.field2; + CursorTy pvrtmp_7475 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7472, pvrtmp_7475, pvrtmp_7473); + CursorTy pvrtmp_7480 = tmp_struct_193.field0; + CursorTy pvrtmp_7481 = tmp_struct_193.field1; + CursorTy pvrtmp_7482 = tmp_struct_193.field2; + CursorTy pvrtmp_7483 = tmp_struct_193.field3; + IntTy sizeof_y_2723__2725 = pvrtmp_7475 - pvrtmp_7474; + IntTy sizeof_y_2724__2726 = pvrtmp_7483 - pvrtmp_7482; + IntTy fltPrm_2814 = sizeof_y_2723__2725 + 0; + IntTy offset__2727 = 0 + fltPrm_2814; + IntTy fltPrm_2815 = sizeof_y_2723__2725 + sizeof_y_2724__2726; + IntTy size_dcon_2728 = 9 + fltPrm_2815; + + *(TagTyPacked *) loc_2985 = 160; + + CursorTy writetag_5069 = loc_2985 + 1; + + *(IntTy *) writetag_5069 = size_dcon_2728; + + CursorTy writecur_5070 = writetag_5069 + sizeof(IntTy); + + *(IntTy *) writecur_5070 = offset__2727; + + CursorTy writecur_5071 = writecur_5070 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7480, pvrtmp_7481, + loc_2985, pvrtmp_7483}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3759, tmpcur_7467); + CursorTy pvrtmp_7492 = tmp_struct_194.field0; + CursorTy pvrtmp_7493 = tmp_struct_194.field1; + CursorTy pvrtmp_7494 = tmp_struct_194.field2; + CursorTy pvrtmp_7495 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7492, pvrtmp_7495, pvrtmp_7493); + CursorTy pvrtmp_7500 = tmp_struct_195.field0; + CursorTy pvrtmp_7501 = tmp_struct_195.field1; + CursorTy pvrtmp_7502 = tmp_struct_195.field2; + CursorTy pvrtmp_7503 = tmp_struct_195.field3; + IntTy sizeof_y_2731__2733 = pvrtmp_7495 - pvrtmp_7494; + IntTy sizeof_y_2732__2734 = pvrtmp_7503 - pvrtmp_7502; + IntTy fltPrm_2816 = sizeof_y_2731__2733 + 0; + IntTy offset__2735 = 0 + fltPrm_2816; + IntTy fltPrm_2817 = sizeof_y_2731__2733 + sizeof_y_2732__2734; + IntTy size_dcon_2736 = 9 + fltPrm_2817; + + *(TagTyPacked *) loc_2985 = 162; + + CursorTy writetag_5078 = loc_2985 + 1; + + *(IntTy *) writetag_5078 = size_dcon_2736; + + CursorTy writecur_5079 = writetag_5078 + sizeof(IntTy); + + *(IntTy *) writecur_5079 = offset__2735; + + CursorTy writecur_5080 = writecur_5079 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7500, pvrtmp_7501, + loc_2985, pvrtmp_7503}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2986, end_r_2987, loc_3782, tmpcur_7467); + CursorTy pvrtmp_7512 = tmp_struct_196.field0; + CursorTy pvrtmp_7513 = tmp_struct_196.field1; + CursorTy pvrtmp_7514 = tmp_struct_196.field2; + CursorTy pvrtmp_7515 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7512, pvrtmp_7515, pvrtmp_7513); + CursorTy pvrtmp_7520 = tmp_struct_197.field0; + CursorTy pvrtmp_7521 = tmp_struct_197.field1; + CursorTy pvrtmp_7522 = tmp_struct_197.field2; + CursorTy pvrtmp_7523 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7520, pvrtmp_7523, pvrtmp_7521); + CursorTy pvrtmp_7528 = tmp_struct_198.field0; + CursorTy pvrtmp_7529 = tmp_struct_198.field1; + CursorTy pvrtmp_7530 = tmp_struct_198.field2; + CursorTy pvrtmp_7531 = tmp_struct_198.field3; + IntTy sizeof_y_2740__2743 = pvrtmp_7515 - pvrtmp_7514; + IntTy sizeof_y_2741__2744 = pvrtmp_7523 - pvrtmp_7522; + IntTy sizeof_y_2742__2745 = pvrtmp_7531 - pvrtmp_7530; + IntTy fltPrm_2818 = sizeof_y_2740__2743 + 0; + IntTy offset__2746 = 8 + fltPrm_2818; + IntTy fltPrm_2819 = sizeof_y_2740__2743 + sizeof_y_2741__2744; + IntTy offset__2747 = 0 + fltPrm_2819; + IntTy fltPrm_2821 = sizeof_y_2741__2744 + sizeof_y_2742__2745; + IntTy fltPrm_2820 = sizeof_y_2740__2743 + fltPrm_2821; + IntTy size_dcon_2748 = 17 + fltPrm_2820; + + *(TagTyPacked *) loc_2985 = 164; + + CursorTy writetag_5088 = loc_2985 + 1; + + *(IntTy *) writetag_5088 = size_dcon_2748; + + CursorTy writecur_5089 = writetag_5088 + sizeof(IntTy); + + *(IntTy *) writecur_5089 = offset__2746; + + CursorTy writecur_5090 = writecur_5089 + sizeof(IntTy); + + *(IntTy *) writecur_5090 = offset__2747; + + CursorTy writecur_5091 = writecur_5090 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7528, pvrtmp_7529, + loc_2985, pvrtmp_7531}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3809, tmpcur_7467); + CursorTy pvrtmp_7540 = tmp_struct_199.field0; + CursorTy pvrtmp_7541 = tmp_struct_199.field1; + CursorTy pvrtmp_7542 = tmp_struct_199.field2; + CursorTy pvrtmp_7543 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7540, pvrtmp_7543, pvrtmp_7541); + CursorTy pvrtmp_7548 = tmp_struct_200.field0; + CursorTy pvrtmp_7549 = tmp_struct_200.field1; + CursorTy pvrtmp_7550 = tmp_struct_200.field2; + CursorTy pvrtmp_7551 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7548, pvrtmp_7551, pvrtmp_7549); + CursorTy pvrtmp_7556 = tmp_struct_201.field0; + CursorTy pvrtmp_7557 = tmp_struct_201.field1; + CursorTy pvrtmp_7558 = tmp_struct_201.field2; + CursorTy pvrtmp_7559 = tmp_struct_201.field3; + IntTy sizeof_y_2752__2755 = pvrtmp_7543 - pvrtmp_7542; + IntTy sizeof_y_2753__2756 = pvrtmp_7551 - pvrtmp_7550; + IntTy sizeof_y_2754__2757 = pvrtmp_7559 - pvrtmp_7558; + IntTy fltPrm_2822 = sizeof_y_2752__2755 + 0; + IntTy offset__2758 = 8 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2752__2755 + sizeof_y_2753__2756; + IntTy offset__2759 = 0 + fltPrm_2823; + IntTy fltPrm_2825 = sizeof_y_2753__2756 + sizeof_y_2754__2757; + IntTy fltPrm_2824 = sizeof_y_2752__2755 + fltPrm_2825; + IntTy size_dcon_2760 = 17 + fltPrm_2824; + + *(TagTyPacked *) loc_2985 = 166; + + CursorTy writetag_5100 = loc_2985 + 1; + + *(IntTy *) writetag_5100 = size_dcon_2760; + + CursorTy writecur_5101 = writetag_5100 + sizeof(IntTy); + + *(IntTy *) writecur_5101 = offset__2758; + + CursorTy writecur_5102 = writecur_5101 + sizeof(IntTy); + + *(IntTy *) writecur_5102 = offset__2759; + + CursorTy writecur_5103 = writecur_5102 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7556, pvrtmp_7557, + loc_2985, pvrtmp_7559}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2986, end_r_2987, loc_3836, tmpcur_7467); + CursorTy pvrtmp_7568 = tmp_struct_202.field0; + CursorTy pvrtmp_7569 = tmp_struct_202.field1; + CursorTy pvrtmp_7570 = tmp_struct_202.field2; + CursorTy pvrtmp_7571 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7568, pvrtmp_7571, pvrtmp_7569); + CursorTy pvrtmp_7576 = tmp_struct_203.field0; + CursorTy pvrtmp_7577 = tmp_struct_203.field1; + CursorTy pvrtmp_7578 = tmp_struct_203.field2; + CursorTy pvrtmp_7579 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7576, pvrtmp_7579, pvrtmp_7577); + CursorTy pvrtmp_7584 = tmp_struct_204.field0; + CursorTy pvrtmp_7585 = tmp_struct_204.field1; + CursorTy pvrtmp_7586 = tmp_struct_204.field2; + CursorTy pvrtmp_7587 = tmp_struct_204.field3; + IntTy sizeof_y_2764__2767 = pvrtmp_7571 - pvrtmp_7570; + IntTy sizeof_y_2765__2768 = pvrtmp_7579 - pvrtmp_7578; + IntTy sizeof_y_2766__2769 = pvrtmp_7587 - pvrtmp_7586; + IntTy fltPrm_2826 = sizeof_y_2764__2767 + 0; + IntTy offset__2770 = 8 + fltPrm_2826; + IntTy fltPrm_2827 = sizeof_y_2764__2767 + sizeof_y_2765__2768; + IntTy offset__2771 = 0 + fltPrm_2827; + IntTy fltPrm_2829 = sizeof_y_2765__2768 + sizeof_y_2766__2769; + IntTy fltPrm_2828 = sizeof_y_2764__2767 + fltPrm_2829; + IntTy size_dcon_2772 = 17 + fltPrm_2828; + + *(TagTyPacked *) loc_2985 = 168; + + CursorTy writetag_5112 = loc_2985 + 1; + + *(IntTy *) writetag_5112 = size_dcon_2772; + + CursorTy writecur_5113 = writetag_5112 + sizeof(IntTy); + + *(IntTy *) writecur_5113 = offset__2770; + + CursorTy writecur_5114 = writecur_5113 + sizeof(IntTy); + + *(IntTy *) writecur_5114 = offset__2771; + + CursorTy writecur_5115 = writecur_5114 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7584, pvrtmp_7585, + loc_2985, pvrtmp_7587}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3863, tmpcur_7467); + CursorTy pvrtmp_7596 = tmp_struct_205.field0; + CursorTy pvrtmp_7597 = tmp_struct_205.field1; + CursorTy pvrtmp_7598 = tmp_struct_205.field2; + CursorTy pvrtmp_7599 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7596, pvrtmp_7599, pvrtmp_7597); + CursorTy pvrtmp_7604 = tmp_struct_206.field0; + CursorTy pvrtmp_7605 = tmp_struct_206.field1; + CursorTy pvrtmp_7606 = tmp_struct_206.field2; + CursorTy pvrtmp_7607 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7604, pvrtmp_7607, pvrtmp_7605); + CursorTy pvrtmp_7612 = tmp_struct_207.field0; + CursorTy pvrtmp_7613 = tmp_struct_207.field1; + CursorTy pvrtmp_7614 = tmp_struct_207.field2; + CursorTy pvrtmp_7615 = tmp_struct_207.field3; + IntTy sizeof_y_2776__2779 = pvrtmp_7599 - pvrtmp_7598; + IntTy sizeof_y_2777__2780 = pvrtmp_7607 - pvrtmp_7606; + IntTy sizeof_y_2778__2781 = pvrtmp_7615 - pvrtmp_7614; + IntTy fltPrm_2830 = sizeof_y_2776__2779 + 0; + IntTy offset__2782 = 8 + fltPrm_2830; + IntTy fltPrm_2831 = sizeof_y_2776__2779 + sizeof_y_2777__2780; + IntTy offset__2783 = 0 + fltPrm_2831; + IntTy fltPrm_2833 = sizeof_y_2777__2780 + sizeof_y_2778__2781; + IntTy fltPrm_2832 = sizeof_y_2776__2779 + fltPrm_2833; + IntTy size_dcon_2784 = 17 + fltPrm_2832; + + *(TagTyPacked *) loc_2985 = 170; + + CursorTy writetag_5124 = loc_2985 + 1; + + *(IntTy *) writetag_5124 = size_dcon_2784; + + CursorTy writecur_5125 = writetag_5124 + sizeof(IntTy); + + *(IntTy *) writecur_5125 = offset__2782; + + CursorTy writecur_5126 = writecur_5125 + sizeof(IntTy); + + *(IntTy *) writecur_5126 = offset__2783; + + CursorTy writecur_5127 = writecur_5126 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7612, pvrtmp_7613, + loc_2985, pvrtmp_7615}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3890, tmpcur_7467); + CursorTy pvrtmp_7624 = tmp_struct_208.field0; + CursorTy pvrtmp_7625 = tmp_struct_208.field1; + CursorTy pvrtmp_7626 = tmp_struct_208.field2; + CursorTy pvrtmp_7627 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7624, pvrtmp_7627, pvrtmp_7625); + CursorTy pvrtmp_7632 = tmp_struct_209.field0; + CursorTy pvrtmp_7633 = tmp_struct_209.field1; + CursorTy pvrtmp_7634 = tmp_struct_209.field2; + CursorTy pvrtmp_7635 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7632, pvrtmp_7635, pvrtmp_7633); + CursorTy pvrtmp_7640 = tmp_struct_210.field0; + CursorTy pvrtmp_7641 = tmp_struct_210.field1; + CursorTy pvrtmp_7642 = tmp_struct_210.field2; + CursorTy pvrtmp_7643 = tmp_struct_210.field3; + IntTy sizeof_y_2788__2791 = pvrtmp_7627 - pvrtmp_7626; + IntTy sizeof_y_2789__2792 = pvrtmp_7635 - pvrtmp_7634; + IntTy sizeof_y_2790__2793 = pvrtmp_7643 - pvrtmp_7642; + IntTy fltPrm_2834 = sizeof_y_2788__2791 + 0; + IntTy offset__2794 = 8 + fltPrm_2834; + IntTy fltPrm_2835 = sizeof_y_2788__2791 + sizeof_y_2789__2792; + IntTy offset__2795 = 0 + fltPrm_2835; + IntTy fltPrm_2837 = sizeof_y_2789__2792 + sizeof_y_2790__2793; + IntTy fltPrm_2836 = sizeof_y_2788__2791 + fltPrm_2837; + IntTy size_dcon_2796 = 17 + fltPrm_2836; + + *(TagTyPacked *) loc_2985 = 172; + + CursorTy writetag_5136 = loc_2985 + 1; + + *(IntTy *) writetag_5136 = size_dcon_2796; + + CursorTy writecur_5137 = writetag_5136 + sizeof(IntTy); + + *(IntTy *) writecur_5137 = offset__2794; + + CursorTy writecur_5138 = writecur_5137 + sizeof(IntTy); + + *(IntTy *) writecur_5138 = offset__2795; + + CursorTy writecur_5139 = writecur_5138 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7640, pvrtmp_7641, + loc_2985, pvrtmp_7643}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3917, tmpcur_7467); + CursorTy pvrtmp_7652 = tmp_struct_211.field0; + CursorTy pvrtmp_7653 = tmp_struct_211.field1; + CursorTy pvrtmp_7654 = tmp_struct_211.field2; + CursorTy pvrtmp_7655 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7652, pvrtmp_7655, pvrtmp_7653); + CursorTy pvrtmp_7660 = tmp_struct_212.field0; + CursorTy pvrtmp_7661 = tmp_struct_212.field1; + CursorTy pvrtmp_7662 = tmp_struct_212.field2; + CursorTy pvrtmp_7663 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7660, pvrtmp_7663, pvrtmp_7661); + CursorTy pvrtmp_7668 = tmp_struct_213.field0; + CursorTy pvrtmp_7669 = tmp_struct_213.field1; + CursorTy pvrtmp_7670 = tmp_struct_213.field2; + CursorTy pvrtmp_7671 = tmp_struct_213.field3; + IntTy sizeof_y_2800__2803 = pvrtmp_7655 - pvrtmp_7654; + IntTy sizeof_y_2801__2804 = pvrtmp_7663 - pvrtmp_7662; + IntTy sizeof_y_2802__2805 = pvrtmp_7671 - pvrtmp_7670; + IntTy fltPrm_2838 = sizeof_y_2800__2803 + 0; + IntTy offset__2806 = 8 + fltPrm_2838; + IntTy fltPrm_2839 = sizeof_y_2800__2803 + sizeof_y_2801__2804; + IntTy offset__2807 = 0 + fltPrm_2839; + IntTy fltPrm_2841 = sizeof_y_2801__2804 + sizeof_y_2802__2805; + IntTy fltPrm_2840 = sizeof_y_2800__2803 + fltPrm_2841; + IntTy size_dcon_2808 = 17 + fltPrm_2840; + + *(TagTyPacked *) loc_2985 = 174; + + CursorTy writetag_5148 = loc_2985 + 1; + + *(IntTy *) writetag_5148 = size_dcon_2808; + + CursorTy writecur_5149 = writetag_5148 + sizeof(IntTy); + + *(IntTy *) writecur_5149 = offset__2806; + + CursorTy writecur_5150 = writecur_5149 + sizeof(IntTy); + + *(IntTy *) writecur_5150 = offset__2807; + + CursorTy writecur_5151 = writecur_5150 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7668, pvrtmp_7669, + loc_2985, pvrtmp_7671}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7680 = *(CursorTy *) tmpcur_7467; + CursorTy tmpaftercur_7681 = tmpcur_7467 + 8; + CursorTy jump_4377 = tmpcur_7467 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_2985, tmpcur_7680); + CursorTy pvrtmp_7682 = tmp_struct_214.field0; + CursorTy pvrtmp_7683 = tmp_struct_214.field1; + CursorTy pvrtmp_7684 = tmp_struct_214.field2; + CursorTy pvrtmp_7685 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7682, jump_4377, + pvrtmp_7684, pvrtmp_7685}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7692 = *(CursorTy *) tmpcur_7467; + CursorTy tmpaftercur_7693 = tmpcur_7467 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_2985, tmpcur_7692); + CursorTy pvrtmp_7694 = tmp_struct_215.field0; + CursorTy pvrtmp_7695 = tmp_struct_215.field1; + CursorTy pvrtmp_7696 = tmp_struct_215.field2; + CursorTy pvrtmp_7697 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7694, pvrtmp_7695, + pvrtmp_7696, pvrtmp_7697}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7466"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2990, + CursorTy end_r_2991, + CursorTy loc_2989, + CursorTy arg_2809) +{ + if (loc_2989 + 32 > end_r_2991) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2991); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2991 = chunk_end_224; + *(TagTyPacked *) loc_2989 = 255; + + CursorTy redir = loc_2989 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2989 = chunk_start_223; + } + + CursorTy loc_3937 = loc_2989 + 1; + CursorTy loc_3938 = loc_3937 + 8; + TagTyPacked tmpval_7705 = *(TagTyPacked *) arg_2809; + CursorTy tmpcur_7706 = arg_2809 + 1; + + + switch_7749: + ; + switch (tmpval_7705) { + + case 0: + { + CursorTy jump_4245 = arg_2809 + 1; + + *(TagTyPacked *) loc_2989 = 0; + + CursorTy writetag_5163 = loc_2989 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2991, jump_4245, + loc_2989, writetag_5163}; + break; + } + + case 1: + { + IntTy tmpval_7711 = *(IntTy *) tmpcur_7706; + CursorTy tmpcur_7712 = tmpcur_7706 + sizeof(IntTy); + CursorTy jump_4247 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_3938, tmpcur_7712); + CursorTy pvrtmp_7713 = tmp_struct_219.field0; + CursorTy pvrtmp_7714 = tmp_struct_219.field1; + CursorTy pvrtmp_7715 = tmp_struct_219.field2; + CursorTy pvrtmp_7716 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2989 = 1; + + CursorTy writetag_5168 = loc_2989 + 1; + + *(IntTy *) writetag_5168 = tmpval_7711; + + CursorTy writecur_5169 = writetag_5168 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7713, pvrtmp_7714, + loc_2989, pvrtmp_7716}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7725 = *(CursorTy *) tmpcur_7706; + CursorTy tmpaftercur_7726 = tmpcur_7706 + 8; + CursorTy jump_4383 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_2989, tmpcur_7725); + CursorTy pvrtmp_7727 = tmp_struct_220.field0; + CursorTy pvrtmp_7728 = tmp_struct_220.field1; + CursorTy pvrtmp_7729 = tmp_struct_220.field2; + CursorTy pvrtmp_7730 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7727, jump_4383, + pvrtmp_7729, pvrtmp_7730}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7737 = *(CursorTy *) tmpcur_7706; + CursorTy tmpaftercur_7738 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_2989, tmpcur_7737); + CursorTy pvrtmp_7739 = tmp_struct_221.field0; + CursorTy pvrtmp_7740 = tmp_struct_221.field1; + CursorTy pvrtmp_7741 = tmp_struct_221.field2; + CursorTy pvrtmp_7742 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7739, pvrtmp_7740, + pvrtmp_7741, pvrtmp_7742}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7705"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6145, ")"); + add_symbol(6146, "(Text "); + add_symbol(6147, "(Tag "); + add_symbol(6148, "(TCA "); + add_symbol(6149, "(TAC "); + add_symbol(6150, "(Nul "); + add_symbol(6151, "(Nil "); + add_symbol(6152, "(Image "); + add_symbol(6153, "(End "); + add_symbol(6154, "(Char "); + add_symbol(6155, "(CTA "); + add_symbol(6156, "(CAT "); + add_symbol(6157, "(CA "); + add_symbol(6158, "(ATC "); + add_symbol(6159, "(ACT "); + add_symbol(6160, "(AC "); + add_symbol(6161, " ->r "); + add_symbol(6162, " ->i "); + + RegionTy *region_6163 = alloc_region(global_init_inf_buf_size); + CursorTy r_3001 = region_6163->reg_heap; + IntTy sizeof_end_r_3001_6164 = global_init_inf_buf_size; + CursorTy end_r_3001 = r_3001 + sizeof_end_r_3001_6164; + RegionTy *region_6165 = alloc_region(global_init_inf_buf_size); + CursorTy r_3000 = region_6165->reg_heap; + IntTy sizeof_end_r_3000_6166 = global_init_inf_buf_size; + CursorTy end_r_3000 = r_3000 + sizeof_end_r_3000_6166; + CursorCursorCursorProd tmp_struct_225 = + mkCTAList(end_r_3001, r_3001, 100000, 10, 2000); + CursorTy pvrtmp_6167 = tmp_struct_225.field0; + CursorTy pvrtmp_6168 = tmp_struct_225.field1; + CursorTy pvrtmp_6169 = tmp_struct_225.field2; + CursorTy pvrtmp_6183; + CursorTy pvrtmp_6184; + CursorTy pvrtmp_6185; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6183; + struct timespec end_pvrtmp_6183; + + start_counters(); + for (long long iters_pvrtmp_6183 = 0; iters_pvrtmp_6183 < + global_iters_param; iters_pvrtmp_6183++) { + if (iters_pvrtmp_6183 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6183); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6167, end_r_3000, r_3000, pvrtmp_6168); + CursorTy pvrtmp_6174 = tmp_struct_226.field0; + CursorTy pvrtmp_6175 = tmp_struct_226.field1; + CursorTy pvrtmp_6176 = tmp_struct_226.field2; + + pvrtmp_6183 = pvrtmp_6174; + pvrtmp_6184 = pvrtmp_6175; + pvrtmp_6185 = pvrtmp_6176; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6183); + if (iters_pvrtmp_6183 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6183, + &end_pvrtmp_6183); + + vector_inplace_update(times_230, iters_pvrtmp_6183, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTac.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTac.c new file mode 100644 index 000000000..a3ce7b1ce --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTac.c @@ -0,0 +1,5058 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2906, CursorTy end_r_2907, + CursorTy loc_2905, + CursorTy adt_14_900_1516); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2910, CursorTy end_r_2911, + CursorTy loc_2909, + CursorTy tags_20_906_1522, + IntTy inVal_21_907_1523); +CursorCursorCursorProd mkTACList(CursorTy end_r_2913, CursorTy loc_2912, + IntTy len_24_910_1528, + IntTy tagLen_25_911_1529, + IntTy strLen_26_912_1530); +CursorCursorCursorProd mkString(CursorTy end_r_2915, CursorTy loc_2914, + IntTy len_179_1065_1536); +CursorCursorCursorProd mkContentText(CursorTy end_r_2917, CursorTy loc_2916, + IntTy n_193_1079_1542); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2919, CursorTy loc_2918, + IntTy len_318_1204_1544); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2922, + CursorTy end_r_2923, + CursorTy loc_2921, + CursorTy arg_622_1228_1549); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2926, + CursorTy end_r_2927, + CursorTy loc_2925, + CursorTy arg_627_1233_1554); +CursorProd _traverse_String(CursorTy end_r_2929, CursorTy arg_632_1238_1559); +CursorProd _print_String(CursorTy end_r_2931, CursorTy arg_637_1242_1563); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_646_1251_1572); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2938, + CursorTy end_r_2939, + CursorTy loc_2937, + CursorTy arg_651_1256_1577); +CursorProd _traverse_Content(CursorTy end_r_2941, CursorTy arg_656_1261_1582); +CursorProd _print_Content(CursorTy end_r_2943, CursorTy arg_661_1266_1587); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2946, CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_670_1275_1596); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2950, + CursorTy end_r_2951, + CursorTy loc_2949, + CursorTy arg_715_1320_1641); +CursorProd _traverse_Adt(CursorTy end_r_2953, CursorTy arg_760_1365_1686); +CursorProd _print_Adt(CursorTy end_r_2955, CursorTy arg_805_1410_1731); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2958, + CursorTy end_r_2959, CursorTy loc_2957, + CursorTy arg_868_1473_1794); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2962, + CursorTy end_r_2963, + CursorTy loc_2961, + CursorTy arg_873_1478_1799); +CursorProd _traverse_Tags(CursorTy end_r_2965, CursorTy arg_878_1483_1804); +CursorProd _print_Tags(CursorTy end_r_2967, CursorTy arg_883_1487_1808); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2970, CursorTy end_r_2971, + CursorTy loc_2969, CursorTy arg_2702); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2974, CursorTy end_r_2975, + CursorTy loc_2973, CursorTy arg_2707); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2712); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2801); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2906, CursorTy end_r_2907, + CursorTy loc_2905, + CursorTy adt_14_900_1516) +{ + if (loc_2905 + 32 > end_r_2907) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2907); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2907 = chunk_end_6; + *(TagTyPacked *) loc_2905 = 255; + + CursorTy redir = loc_2905 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2905 = chunk_start_5; + } + + CursorTy loc_3008 = loc_2905 + 1; + CursorTy loc_3009 = loc_3008 + 8; + CursorTy loc_3010 = loc_3009 + 8; + TagTyPacked tmpval_6177 = *(TagTyPacked *) adt_14_900_1516; + CursorTy tmpcur_6178 = adt_14_900_1516 + 1; + + + switch_6230: + ; + switch (tmpval_6177) { + + case 0: + { + CursorTy jump_3933 = adt_14_900_1516 + 1; + + *(TagTyPacked *) loc_2905 = 0; + + CursorTy writetag_4492 = loc_2905 + 1; + + return (CursorCursorCursorProd) {end_r_2907, loc_2905, + writetag_4492}; + break; + } + + case 17: + { + CursorTy tmpcur_6183 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6184 = tmpcur_6178 + 8; + CursorTy tmpcur_6185 = *(CursorTy *) tmpaftercur_6184; + CursorTy tmpaftercur_6186 = tmpaftercur_6184 + 8; + CursorTy jump_3936 = tmpaftercur_6184 + 8; + CursorTy jump_3935 = tmpcur_6178 + 8; + CursorCursorCursorCursorProd tmp_struct_0 = + addValTag(end_r_2906, end_r_2907, loc_3010, tmpaftercur_6186, 10); + CursorTy pvrtmp_6187 = tmp_struct_0.field0; + CursorTy pvrtmp_6188 = tmp_struct_0.field1; + CursorTy pvrtmp_6189 = tmp_struct_0.field2; + CursorTy pvrtmp_6190 = tmp_struct_0.field3; + CursorCursorCursorProd tmp_struct_1 = + addValTagsAdt(end_r_2906, pvrtmp_6187, pvrtmp_6190, tmpcur_6183); + CursorTy pvrtmp_6195 = tmp_struct_1.field0; + CursorTy pvrtmp_6196 = tmp_struct_1.field1; + CursorTy pvrtmp_6197 = tmp_struct_1.field2; + + *(TagTyPacked *) pvrtmp_6197 = 254; + + CursorTy writetag_4499 = pvrtmp_6197 + 1; + + *(CursorTy *) writetag_4499 = tmpcur_6185; + + CursorTy writecur_4500 = writetag_4499 + 8; + + *(TagTyPacked *) loc_2905 = 17; + + CursorTy writetag_4502 = loc_2905 + 1; + + *(CursorTy *) writetag_4502 = pvrtmp_6190; + + CursorTy writecur_4503 = writetag_4502 + 8; + + *(CursorTy *) writecur_4503 = pvrtmp_6197; + + CursorTy writecur_4504 = writecur_4503 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6195, loc_2905, + writecur_4500}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6208 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6209 = tmpcur_6178 + 8; + CursorTy jump_4245 = tmpcur_6178 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2906, end_r_2907, loc_2905, tmpcur_6208); + CursorTy pvrtmp_6210 = tmp_struct_2.field0; + CursorTy pvrtmp_6211 = tmp_struct_2.field1; + CursorTy pvrtmp_6212 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6210, pvrtmp_6211, + pvrtmp_6212}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6219 = *(CursorTy *) tmpcur_6178; + CursorTy tmpaftercur_6220 = tmpcur_6178 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2906, end_r_2907, loc_2905, tmpcur_6219); + CursorTy pvrtmp_6221 = tmp_struct_3.field0; + CursorTy pvrtmp_6222 = tmp_struct_3.field1; + CursorTy pvrtmp_6223 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6221, pvrtmp_6222, + pvrtmp_6223}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6177"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2910, CursorTy end_r_2911, + CursorTy loc_2909, + CursorTy tags_20_906_1522, + IntTy inVal_21_907_1523) +{ + if (loc_2909 + 32 > end_r_2911) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2911); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2911 = chunk_end_12; + *(TagTyPacked *) loc_2909 = 255; + + CursorTy redir = loc_2909 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2909 = chunk_start_11; + } + + CursorTy loc_3028 = loc_2909 + 1; + CursorTy loc_3029 = loc_3028 + 8; + TagTyPacked tmpval_6231 = *(TagTyPacked *) tags_20_906_1522; + CursorTy tmpcur_6232 = tags_20_906_1522 + 1; + + + switch_6275: + ; + switch (tmpval_6231) { + + case 0: + { + CursorTy jump_3939 = tags_20_906_1522 + 1; + + *(TagTyPacked *) loc_2909 = 0; + + CursorTy writetag_4516 = loc_2909 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2911, jump_3939, + loc_2909, writetag_4516}; + break; + } + + case 1: + { + IntTy tmpval_6237 = *(IntTy *) tmpcur_6232; + CursorTy tmpcur_6238 = tmpcur_6232 + sizeof(IntTy); + CursorTy jump_3941 = tmpcur_6232 + 8; + IntTy fltPkd_1504_1526 = tmpval_6237 + inVal_21_907_1523; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2910, end_r_2911, loc_3029, tmpcur_6238, inVal_21_907_1523); + CursorTy pvrtmp_6239 = tmp_struct_7.field0; + CursorTy pvrtmp_6240 = tmp_struct_7.field1; + CursorTy pvrtmp_6241 = tmp_struct_7.field2; + CursorTy pvrtmp_6242 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2909 = 1; + + CursorTy writetag_4521 = loc_2909 + 1; + + *(IntTy *) writetag_4521 = fltPkd_1504_1526; + + CursorTy writecur_4522 = writetag_4521 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6239, pvrtmp_6240, + loc_2909, pvrtmp_6242}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6251 = *(CursorTy *) tmpcur_6232; + CursorTy tmpaftercur_6252 = tmpcur_6232 + 8; + CursorTy jump_4250 = tmpcur_6232 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2910, end_r_2911, loc_2909, tmpcur_6251, inVal_21_907_1523); + CursorTy pvrtmp_6253 = tmp_struct_8.field0; + CursorTy pvrtmp_6254 = tmp_struct_8.field1; + CursorTy pvrtmp_6255 = tmp_struct_8.field2; + CursorTy pvrtmp_6256 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6253, jump_4250, + pvrtmp_6255, pvrtmp_6256}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6263 = *(CursorTy *) tmpcur_6232; + CursorTy tmpaftercur_6264 = tmpcur_6232 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2910, end_r_2911, loc_2909, tmpcur_6263, inVal_21_907_1523); + CursorTy pvrtmp_6265 = tmp_struct_9.field0; + CursorTy pvrtmp_6266 = tmp_struct_9.field1; + CursorTy pvrtmp_6267 = tmp_struct_9.field2; + CursorTy pvrtmp_6268 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6265, pvrtmp_6266, + pvrtmp_6267, pvrtmp_6268}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6231"); + exit(1); + } + } +} +CursorCursorCursorProd mkTACList(CursorTy end_r_2913, CursorTy loc_2912, + IntTy len_24_910_1528, + IntTy tagLen_25_911_1529, + IntTy strLen_26_912_1530) +{ + if (loc_2912 + 32 > end_r_2913) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2913); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2913 = chunk_end_18; + *(TagTyPacked *) loc_2912 = 255; + + CursorTy redir = loc_2912 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2912 = chunk_start_17; + } + + CursorTy loc_3037 = loc_2912 + 1; + CursorTy loc_3038 = loc_3037 + 8; + CursorTy loc_3039 = loc_3038 + 8; + BoolTy fltIf_1506_1531 = len_24_910_1528 <= 0; + + if (fltIf_1506_1531) { + *(TagTyPacked *) loc_2912 = 0; + + CursorTy writetag_4531 = loc_2912 + 1; + + return (CursorCursorCursorProd) {end_r_2913, loc_2912, writetag_4531}; + } else { + CursorCursorCursorProd tmp_struct_13 = + mkRandomTags(end_r_2913, loc_3039, tagLen_25_911_1529); + CursorTy pvrtmp_6280 = tmp_struct_13.field0; + CursorTy pvrtmp_6281 = tmp_struct_13.field1; + CursorTy pvrtmp_6282 = tmp_struct_13.field2; + IntTy fltAppE_1507_1533 = len_24_910_1528 - 1; + CursorCursorCursorProd tmp_struct_14 = + mkTACList(pvrtmp_6280, pvrtmp_6282, fltAppE_1507_1533, tagLen_25_911_1529, strLen_26_912_1530); + CursorTy pvrtmp_6287 = tmp_struct_14.field0; + CursorTy pvrtmp_6288 = tmp_struct_14.field1; + CursorTy pvrtmp_6289 = tmp_struct_14.field2; + CursorCursorCursorProd tmp_struct_15 = + mkContentText(pvrtmp_6287, pvrtmp_6289, strLen_26_912_1530); + CursorTy pvrtmp_6294 = tmp_struct_15.field0; + CursorTy pvrtmp_6295 = tmp_struct_15.field1; + CursorTy pvrtmp_6296 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2912 = 17; + + CursorTy writetag_4536 = loc_2912 + 1; + + *(CursorTy *) writetag_4536 = pvrtmp_6282; + + CursorTy writecur_4537 = writetag_4536 + 8; + + *(CursorTy *) writecur_4537 = pvrtmp_6289; + + CursorTy writecur_4538 = writecur_4537 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6294, loc_2912, pvrtmp_6296}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2915, CursorTy loc_2914, + IntTy len_179_1065_1536) +{ + if (loc_2914 + 32 > end_r_2915) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2915); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2915 = chunk_end_22; + *(TagTyPacked *) loc_2914 = 255; + + CursorTy redir = loc_2914 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2914 = chunk_start_21; + } + + CursorTy loc_3051 = loc_2914 + 1; + CursorTy loc_3052 = loc_3051 + 8; + BoolTy fltIf_1508_1537 = len_179_1065_1536 <= 0; + + if (fltIf_1508_1537) { + *(TagTyPacked *) loc_2914 = 0; + + CursorTy writetag_4543 = loc_2914 + 1; + + return (CursorCursorCursorProd) {end_r_2915, loc_2914, writetag_4543}; + } else { + IntTy fltPrm_1509_1538 = rand(); + IntTy randomChar_180_1066_1539 = fltPrm_1509_1538 % 128; + IntTy fltAppE_1510_1540 = len_179_1065_1536 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2915, loc_3052, fltAppE_1510_1540); + CursorTy pvrtmp_6309 = tmp_struct_19.field0; + CursorTy pvrtmp_6310 = tmp_struct_19.field1; + CursorTy pvrtmp_6311 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2914 = 1; + + CursorTy writetag_4546 = loc_2914 + 1; + + *(IntTy *) writetag_4546 = randomChar_180_1066_1539; + + CursorTy writecur_4547 = writetag_4546 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6309, loc_2914, pvrtmp_6311}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2917, CursorTy loc_2916, + IntTy n_193_1079_1542) +{ + if (loc_2916 + 32 > end_r_2917) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2917); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2917 = chunk_end_26; + *(TagTyPacked *) loc_2916 = 255; + + CursorTy redir = loc_2916 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2916 = chunk_start_25; + } + + CursorTy loc_3057 = loc_2916 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2917, loc_3057, n_193_1079_1542); + CursorTy pvrtmp_6320 = tmp_struct_23.field0; + CursorTy pvrtmp_6321 = tmp_struct_23.field1; + CursorTy pvrtmp_6322 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2916 = 1; + + CursorTy writetag_4551 = loc_2916 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6320, loc_2916, pvrtmp_6322}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2919, CursorTy loc_2918, + IntTy len_318_1204_1544) +{ + if (loc_2918 + 32 > end_r_2919) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2919); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2919 = chunk_end_30; + *(TagTyPacked *) loc_2918 = 255; + + CursorTy redir = loc_2918 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2918 = chunk_start_29; + } + + CursorTy loc_3061 = loc_2918 + 1; + CursorTy loc_3062 = loc_3061 + 8; + BoolTy fltIf_1512_1545 = len_318_1204_1544 <= 0; + + if (fltIf_1512_1545) { + *(TagTyPacked *) loc_2918 = 0; + + CursorTy writetag_4554 = loc_2918 + 1; + + return (CursorCursorCursorProd) {end_r_2919, loc_2918, writetag_4554}; + } else { + IntTy fltAppE_1513_1547 = len_318_1204_1544 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2919, loc_3062, fltAppE_1513_1547); + CursorTy pvrtmp_6335 = tmp_struct_27.field0; + CursorTy pvrtmp_6336 = tmp_struct_27.field1; + CursorTy pvrtmp_6337 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2918 = 1; + + CursorTy writetag_4557 = loc_2918 + 1; + + *(IntTy *) writetag_4557 = 100; + + CursorTy writecur_4558 = writetag_4557 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6335, loc_2918, pvrtmp_6337}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2922, + CursorTy end_r_2923, + CursorTy loc_2921, + CursorTy arg_622_1228_1549) +{ + if (loc_2921 + 32 > end_r_2923) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2923); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2923 = chunk_end_36; + *(TagTyPacked *) loc_2921 = 255; + + CursorTy redir = loc_2921 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2921 = chunk_start_35; + } + + CursorTy loc_3072 = loc_2921 + 1; + CursorTy loc_3073 = loc_3072 + 8; + TagTyPacked tmpval_6346 = *(TagTyPacked *) arg_622_1228_1549; + CursorTy tmpcur_6347 = arg_622_1228_1549 + 1; + + + switch_6390: + ; + switch (tmpval_6346) { + + case 0: + { + CursorTy jump_3951 = arg_622_1228_1549 + 1; + + *(TagTyPacked *) loc_2921 = 0; + + CursorTy writetag_4562 = loc_2921 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2923, jump_3951, + loc_2921, writetag_4562}; + break; + } + + case 1: + { + IntTy tmpval_6352 = *(IntTy *) tmpcur_6347; + CursorTy tmpcur_6353 = tmpcur_6347 + sizeof(IntTy); + CursorTy jump_3953 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2922, end_r_2923, loc_3073, tmpcur_6353); + CursorTy pvrtmp_6354 = tmp_struct_31.field0; + CursorTy pvrtmp_6355 = tmp_struct_31.field1; + CursorTy pvrtmp_6356 = tmp_struct_31.field2; + CursorTy pvrtmp_6357 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2921 = 1; + + CursorTy writetag_4567 = loc_2921 + 1; + + *(IntTy *) writetag_4567 = tmpval_6352; + + CursorTy writecur_4568 = writetag_4567 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6354, pvrtmp_6355, + loc_2921, pvrtmp_6357}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6366 = *(CursorTy *) tmpcur_6347; + CursorTy tmpaftercur_6367 = tmpcur_6347 + 8; + CursorTy jump_4256 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2922, end_r_2923, loc_2921, tmpcur_6366); + CursorTy pvrtmp_6368 = tmp_struct_32.field0; + CursorTy pvrtmp_6369 = tmp_struct_32.field1; + CursorTy pvrtmp_6370 = tmp_struct_32.field2; + CursorTy pvrtmp_6371 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6368, jump_4256, + pvrtmp_6370, pvrtmp_6371}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6378 = *(CursorTy *) tmpcur_6347; + CursorTy tmpaftercur_6379 = tmpcur_6347 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2922, end_r_2923, loc_2921, tmpcur_6378); + CursorTy pvrtmp_6380 = tmp_struct_33.field0; + CursorTy pvrtmp_6381 = tmp_struct_33.field1; + CursorTy pvrtmp_6382 = tmp_struct_33.field2; + CursorTy pvrtmp_6383 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6380, pvrtmp_6381, + pvrtmp_6382, pvrtmp_6383}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6346"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2926, + CursorTy end_r_2927, + CursorTy loc_2925, + CursorTy arg_627_1233_1554) +{ + CursorTy loc_3085 = loc_2925 + 1; + CursorTy loc_3086 = loc_3085 + 8; + TagTyPacked tmpval_6391 = *(TagTyPacked *) arg_627_1233_1554; + CursorTy tmpcur_6392 = arg_627_1233_1554 + 1; + + + switch_6435: + ; + switch (tmpval_6391) { + + case 0: + { + CursorTy jump_3956 = arg_627_1233_1554 + 1; + + *(TagTyPacked *) loc_2925 = 0; + + CursorTy writetag_4578 = loc_2925 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2927, jump_3956, + loc_2925, writetag_4578}; + break; + } + + case 1: + { + IntTy tmpval_6397 = *(IntTy *) tmpcur_6392; + CursorTy tmpcur_6398 = tmpcur_6392 + sizeof(IntTy); + CursorTy jump_3958 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_3086, tmpcur_6398); + CursorTy pvrtmp_6399 = tmp_struct_37.field0; + CursorTy pvrtmp_6400 = tmp_struct_37.field1; + CursorTy pvrtmp_6401 = tmp_struct_37.field2; + CursorTy pvrtmp_6402 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2925 = 1; + + CursorTy writetag_4583 = loc_2925 + 1; + + *(IntTy *) writetag_4583 = tmpval_6397; + + CursorTy writecur_4584 = writetag_4583 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6399, pvrtmp_6400, + loc_2925, pvrtmp_6402}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6411 = *(CursorTy *) tmpcur_6392; + CursorTy tmpaftercur_6412 = tmpcur_6392 + 8; + CursorTy jump_4262 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_2925, tmpcur_6411); + CursorTy pvrtmp_6413 = tmp_struct_38.field0; + CursorTy pvrtmp_6414 = tmp_struct_38.field1; + CursorTy pvrtmp_6415 = tmp_struct_38.field2; + CursorTy pvrtmp_6416 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6413, jump_4262, + pvrtmp_6415, pvrtmp_6416}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6423 = *(CursorTy *) tmpcur_6392; + CursorTy tmpaftercur_6424 = tmpcur_6392 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2926, end_r_2927, loc_2925, tmpcur_6423); + CursorTy pvrtmp_6425 = tmp_struct_39.field0; + CursorTy pvrtmp_6426 = tmp_struct_39.field1; + CursorTy pvrtmp_6427 = tmp_struct_39.field2; + CursorTy pvrtmp_6428 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6425, pvrtmp_6426, + pvrtmp_6427, pvrtmp_6428}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6391"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2929, CursorTy arg_632_1238_1559) +{ + TagTyPacked tmpval_6436 = *(TagTyPacked *) arg_632_1238_1559; + CursorTy tmpcur_6437 = arg_632_1238_1559 + 1; + + + switch_6447: + ; + switch (tmpval_6436) { + + case 0: + { + CursorTy jump_3961 = arg_632_1238_1559 + 1; + + return (CursorProd) {jump_3961}; + break; + } + + case 1: + { + IntTy tmpval_6438 = *(IntTy *) tmpcur_6437; + CursorTy tmpcur_6439 = tmpcur_6437 + sizeof(IntTy); + CursorTy jump_3963 = tmpcur_6437 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2929, tmpcur_6439); + CursorTy pvrtmp_6440 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6440}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6441 = *(CursorTy *) tmpcur_6437; + CursorTy tmpaftercur_6442 = tmpcur_6437 + 8; + CursorTy jump_4268 = tmpcur_6437 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2929, tmpcur_6441); + CursorTy pvrtmp_6443 = tmp_struct_41.field0; + + return (CursorProd) {jump_4268}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6444 = *(CursorTy *) tmpcur_6437; + CursorTy tmpaftercur_6445 = tmpcur_6437 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2929, tmpcur_6444); + CursorTy pvrtmp_6446 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6446}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6436"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2931, CursorTy arg_637_1242_1563) +{ + TagTyPacked tmpval_6448 = *(TagTyPacked *) arg_637_1242_1563; + CursorTy tmpcur_6449 = arg_637_1242_1563 + 1; + + + switch_6459: + ; + switch (tmpval_6448) { + + case 0: + { + CursorTy jump_3966 = arg_637_1242_1563 + 1; + unsigned char wildcard_638_1243_1564 = print_symbol(6137); + unsigned char wildcard_639_1244_1565 = print_symbol(6129); + + return (CursorProd) {jump_3966}; + break; + } + + case 1: + { + IntTy tmpval_6450 = *(IntTy *) tmpcur_6449; + CursorTy tmpcur_6451 = tmpcur_6449 + sizeof(IntTy); + CursorTy jump_3968 = tmpcur_6449 + 8; + unsigned char wildcard_644_1247_1568 = print_symbol(6138); + unsigned char y_642_1248_1569 = printf("%lld", tmpval_6450); + CursorProd tmp_struct_43 = _print_String(end_r_2931, tmpcur_6451); + CursorTy pvrtmp_6452 = tmp_struct_43.field0; + unsigned char wildcard_645_1250_1571 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6452}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6453 = *(CursorTy *) tmpcur_6449; + CursorTy tmpaftercur_6454 = tmpcur_6449 + 8; + CursorTy jump_4274 = tmpcur_6449 + 8; + unsigned char wildcard_4277 = print_symbol(6146); + CursorProd tmp_struct_44 = _print_String(end_r_2931, tmpcur_6453); + CursorTy pvrtmp_6455 = tmp_struct_44.field0; + + return (CursorProd) {jump_4274}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6456 = *(CursorTy *) tmpcur_6449; + CursorTy tmpaftercur_6457 = tmpcur_6449 + 8; + unsigned char wildcard_4277 = print_symbol(6145); + CursorProd tmp_struct_45 = _print_String(end_r_2931, tmpcur_6456); + CursorTy pvrtmp_6458 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6458}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6448"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_646_1251_1572) +{ + if (loc_2933 + 32 > end_r_2935) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2935); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2935 = chunk_end_52; + *(TagTyPacked *) loc_2933 = 255; + + CursorTy redir = loc_2933 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2933 = chunk_start_51; + } + + TagTyPacked tmpval_6460 = *(TagTyPacked *) arg_646_1251_1572; + CursorTy tmpcur_6461 = arg_646_1251_1572 + 1; + + + switch_6510: + ; + switch (tmpval_6460) { + + case 0: + { + CursorTy loc_3108 = loc_2933 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2934, end_r_2935, loc_3108, tmpcur_6461); + CursorTy pvrtmp_6462 = tmp_struct_46.field0; + CursorTy pvrtmp_6463 = tmp_struct_46.field1; + CursorTy pvrtmp_6464 = tmp_struct_46.field2; + CursorTy pvrtmp_6465 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2933 = 0; + + CursorTy writetag_4615 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6462, pvrtmp_6463, + loc_2933, pvrtmp_6465}; + break; + } + + case 1: + { + CursorTy loc_3114 = loc_2933 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2934, end_r_2935, loc_3114, tmpcur_6461); + CursorTy pvrtmp_6474 = tmp_struct_47.field0; + CursorTy pvrtmp_6475 = tmp_struct_47.field1; + CursorTy pvrtmp_6476 = tmp_struct_47.field2; + CursorTy pvrtmp_6477 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2933 = 1; + + CursorTy writetag_4620 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6474, pvrtmp_6475, + loc_2933, pvrtmp_6477}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6486 = *(CursorTy *) tmpcur_6461; + CursorTy tmpaftercur_6487 = tmpcur_6461 + 8; + CursorTy jump_4280 = tmpcur_6461 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2934, end_r_2935, loc_2933, tmpcur_6486); + CursorTy pvrtmp_6488 = tmp_struct_48.field0; + CursorTy pvrtmp_6489 = tmp_struct_48.field1; + CursorTy pvrtmp_6490 = tmp_struct_48.field2; + CursorTy pvrtmp_6491 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6488, jump_4280, + pvrtmp_6490, pvrtmp_6491}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6498 = *(CursorTy *) tmpcur_6461; + CursorTy tmpaftercur_6499 = tmpcur_6461 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2934, end_r_2935, loc_2933, tmpcur_6498); + CursorTy pvrtmp_6500 = tmp_struct_49.field0; + CursorTy pvrtmp_6501 = tmp_struct_49.field1; + CursorTy pvrtmp_6502 = tmp_struct_49.field2; + CursorTy pvrtmp_6503 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6500, pvrtmp_6501, + pvrtmp_6502, pvrtmp_6503}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6460"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2938, + CursorTy end_r_2939, + CursorTy loc_2937, + CursorTy arg_651_1256_1577) +{ + TagTyPacked tmpval_6511 = *(TagTyPacked *) arg_651_1256_1577; + CursorTy tmpcur_6512 = arg_651_1256_1577 + 1; + + + switch_6561: + ; + switch (tmpval_6511) { + + case 0: + { + CursorTy loc_3122 = loc_2937 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2938, end_r_2939, loc_3122, tmpcur_6512); + CursorTy pvrtmp_6513 = tmp_struct_53.field0; + CursorTy pvrtmp_6514 = tmp_struct_53.field1; + CursorTy pvrtmp_6515 = tmp_struct_53.field2; + CursorTy pvrtmp_6516 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2937 = 0; + + CursorTy writetag_4631 = loc_2937 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6513, pvrtmp_6514, + loc_2937, pvrtmp_6516}; + break; + } + + case 1: + { + CursorTy loc_3128 = loc_2937 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2938, end_r_2939, loc_3128, tmpcur_6512); + CursorTy pvrtmp_6525 = tmp_struct_54.field0; + CursorTy pvrtmp_6526 = tmp_struct_54.field1; + CursorTy pvrtmp_6527 = tmp_struct_54.field2; + CursorTy pvrtmp_6528 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2937 = 1; + + CursorTy writetag_4636 = loc_2937 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6525, pvrtmp_6526, + loc_2937, pvrtmp_6528}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6537 = *(CursorTy *) tmpcur_6512; + CursorTy tmpaftercur_6538 = tmpcur_6512 + 8; + CursorTy jump_4286 = tmpcur_6512 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2938, end_r_2939, loc_2937, tmpcur_6537); + CursorTy pvrtmp_6539 = tmp_struct_55.field0; + CursorTy pvrtmp_6540 = tmp_struct_55.field1; + CursorTy pvrtmp_6541 = tmp_struct_55.field2; + CursorTy pvrtmp_6542 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6539, jump_4286, + pvrtmp_6541, pvrtmp_6542}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6549 = *(CursorTy *) tmpcur_6512; + CursorTy tmpaftercur_6550 = tmpcur_6512 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2938, end_r_2939, loc_2937, tmpcur_6549); + CursorTy pvrtmp_6551 = tmp_struct_56.field0; + CursorTy pvrtmp_6552 = tmp_struct_56.field1; + CursorTy pvrtmp_6553 = tmp_struct_56.field2; + CursorTy pvrtmp_6554 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6551, pvrtmp_6552, + pvrtmp_6553, pvrtmp_6554}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6511"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2941, CursorTy arg_656_1261_1582) +{ + TagTyPacked tmpval_6562 = *(TagTyPacked *) arg_656_1261_1582; + CursorTy tmpcur_6563 = arg_656_1261_1582 + 1; + + + switch_6572: + ; + switch (tmpval_6562) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2941, tmpcur_6563); + CursorTy pvrtmp_6564 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6564}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2941, tmpcur_6563); + CursorTy pvrtmp_6565 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6565}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6566 = *(CursorTy *) tmpcur_6563; + CursorTy tmpaftercur_6567 = tmpcur_6563 + 8; + CursorTy jump_4292 = tmpcur_6563 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2941, tmpcur_6566); + CursorTy pvrtmp_6568 = tmp_struct_59.field0; + + return (CursorProd) {jump_4292}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6569 = *(CursorTy *) tmpcur_6563; + CursorTy tmpaftercur_6570 = tmpcur_6563 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2941, tmpcur_6569); + CursorTy pvrtmp_6571 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6571}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6562"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2943, CursorTy arg_661_1266_1587) +{ + TagTyPacked tmpval_6573 = *(TagTyPacked *) arg_661_1266_1587; + CursorTy tmpcur_6574 = arg_661_1266_1587 + 1; + + + switch_6583: + ; + switch (tmpval_6573) { + + case 0: + { + unsigned char wildcard_664_1268_1589 = print_symbol(6136); + CursorProd tmp_struct_61 = _print_String(end_r_2943, tmpcur_6574); + CursorTy pvrtmp_6575 = tmp_struct_61.field0; + unsigned char wildcard_665_1270_1591 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6575}; + break; + } + + case 1: + { + unsigned char wildcard_668_1272_1593 = print_symbol(6130); + CursorProd tmp_struct_62 = _print_String(end_r_2943, tmpcur_6574); + CursorTy pvrtmp_6576 = tmp_struct_62.field0; + unsigned char wildcard_669_1274_1595 = print_symbol(6129); + + return (CursorProd) {pvrtmp_6576}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6577 = *(CursorTy *) tmpcur_6574; + CursorTy tmpaftercur_6578 = tmpcur_6574 + 8; + CursorTy jump_4298 = tmpcur_6574 + 8; + unsigned char wildcard_4301 = print_symbol(6146); + CursorProd tmp_struct_63 = _print_Content(end_r_2943, tmpcur_6577); + CursorTy pvrtmp_6579 = tmp_struct_63.field0; + + return (CursorProd) {jump_4298}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6580 = *(CursorTy *) tmpcur_6574; + CursorTy tmpaftercur_6581 = tmpcur_6574 + 8; + unsigned char wildcard_4301 = print_symbol(6145); + CursorProd tmp_struct_64 = _print_Content(end_r_2943, tmpcur_6580); + CursorTy pvrtmp_6582 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6582}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6573"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2946, CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_670_1275_1596) +{ + if (loc_2945 + 32 > end_r_2947) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2947); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2947 = chunk_end_91; + *(TagTyPacked *) loc_2945 = 255; + + CursorTy redir = loc_2945 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2945 = chunk_start_90; + } + + CursorTy loc_3158 = loc_2945 + 1; + CursorTy loc_3159 = loc_3158 + 8; + CursorTy loc_3174 = loc_2945 + 1; + CursorTy loc_3175 = loc_3174 + 8; + CursorTy loc_3195 = loc_2945 + 1; + CursorTy loc_3196 = loc_3195 + 8; + CursorTy loc_3197 = loc_3196 + 8; + CursorTy loc_3221 = loc_2945 + 1; + CursorTy loc_3222 = loc_3221 + 8; + CursorTy loc_3223 = loc_3222 + 8; + CursorTy loc_3247 = loc_2945 + 1; + CursorTy loc_3248 = loc_3247 + 8; + CursorTy loc_3249 = loc_3248 + 8; + CursorTy loc_3273 = loc_2945 + 1; + CursorTy loc_3274 = loc_3273 + 8; + CursorTy loc_3275 = loc_3274 + 8; + CursorTy loc_3299 = loc_2945 + 1; + CursorTy loc_3300 = loc_3299 + 8; + CursorTy loc_3301 = loc_3300 + 8; + CursorTy loc_3325 = loc_2945 + 1; + CursorTy loc_3326 = loc_3325 + 8; + CursorTy loc_3327 = loc_3326 + 8; + TagTyPacked tmpval_6584 = *(TagTyPacked *) arg_670_1275_1596; + CursorTy tmpcur_6585 = arg_670_1275_1596 + 1; + + + switch_6850: + ; + switch (tmpval_6584) { + + case 0: + { + CursorTy jump_3987 = arg_670_1275_1596 + 1; + + *(TagTyPacked *) loc_2945 = 0; + + CursorTy writetag_4666 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2947, jump_3987, + loc_2945, writetag_4666}; + break; + } + + case 9: + { + CursorTy tmpcur_6590 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6591 = tmpcur_6585 + 8; + CursorTy jump_3989 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2946, end_r_2947, loc_3159, tmpaftercur_6591); + CursorTy pvrtmp_6592 = tmp_struct_65.field0; + CursorTy pvrtmp_6593 = tmp_struct_65.field1; + CursorTy pvrtmp_6594 = tmp_struct_65.field2; + CursorTy pvrtmp_6595 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2946, pvrtmp_6592, pvrtmp_6595, tmpcur_6590); + CursorTy pvrtmp_6600 = tmp_struct_66.field0; + CursorTy pvrtmp_6601 = tmp_struct_66.field1; + CursorTy pvrtmp_6602 = tmp_struct_66.field2; + CursorTy pvrtmp_6603 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2945 = 9; + + CursorTy writetag_4672 = loc_2945 + 1; + + *(CursorTy *) writetag_4672 = pvrtmp_6595; + + CursorTy writecur_4673 = writetag_4672 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6600, pvrtmp_6601, + loc_2945, pvrtmp_6603}; + break; + } + + case 11: + { + CursorTy tmpcur_6612 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6613 = tmpcur_6585 + 8; + CursorTy jump_3993 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2946, end_r_2947, loc_3175, tmpaftercur_6613); + CursorTy pvrtmp_6614 = tmp_struct_67.field0; + CursorTy pvrtmp_6615 = tmp_struct_67.field1; + CursorTy pvrtmp_6616 = tmp_struct_67.field2; + CursorTy pvrtmp_6617 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2946, pvrtmp_6614, pvrtmp_6617, tmpcur_6612); + CursorTy pvrtmp_6622 = tmp_struct_68.field0; + CursorTy pvrtmp_6623 = tmp_struct_68.field1; + CursorTy pvrtmp_6624 = tmp_struct_68.field2; + CursorTy pvrtmp_6625 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2945 = 11; + + CursorTy writetag_4681 = loc_2945 + 1; + + *(CursorTy *) writetag_4681 = pvrtmp_6617; + + CursorTy writecur_4682 = writetag_4681 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6622, pvrtmp_6623, + loc_2945, pvrtmp_6625}; + break; + } + + case 13: + { + CursorTy tmpcur_6634 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6635 = tmpcur_6585 + 8; + CursorTy tmpcur_6636 = *(CursorTy *) tmpaftercur_6635; + CursorTy tmpaftercur_6637 = tmpaftercur_6635 + 8; + CursorTy jump_3998 = tmpaftercur_6635 + 8; + CursorTy jump_3997 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2946, end_r_2947, loc_3197, tmpaftercur_6637); + CursorTy pvrtmp_6638 = tmp_struct_69.field0; + CursorTy pvrtmp_6639 = tmp_struct_69.field1; + CursorTy pvrtmp_6640 = tmp_struct_69.field2; + CursorTy pvrtmp_6641 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2946, pvrtmp_6638, pvrtmp_6641, tmpcur_6634); + CursorTy pvrtmp_6646 = tmp_struct_70.field0; + CursorTy pvrtmp_6647 = tmp_struct_70.field1; + CursorTy pvrtmp_6648 = tmp_struct_70.field2; + CursorTy pvrtmp_6649 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2946, pvrtmp_6646, pvrtmp_6649, tmpcur_6636); + CursorTy pvrtmp_6654 = tmp_struct_71.field0; + CursorTy pvrtmp_6655 = tmp_struct_71.field1; + CursorTy pvrtmp_6656 = tmp_struct_71.field2; + CursorTy pvrtmp_6657 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2945 = 13; + + CursorTy writetag_4692 = loc_2945 + 1; + + *(CursorTy *) writetag_4692 = pvrtmp_6641; + + CursorTy writecur_4693 = writetag_4692 + 8; + + *(CursorTy *) writecur_4693 = pvrtmp_6649; + + CursorTy writecur_4694 = writecur_4693 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6654, pvrtmp_6655, + loc_2945, pvrtmp_6657}; + break; + } + + case 15: + { + CursorTy tmpcur_6666 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6667 = tmpcur_6585 + 8; + CursorTy tmpcur_6668 = *(CursorTy *) tmpaftercur_6667; + CursorTy tmpaftercur_6669 = tmpaftercur_6667 + 8; + CursorTy jump_4004 = tmpaftercur_6667 + 8; + CursorTy jump_4003 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2946, end_r_2947, loc_3223, tmpaftercur_6669); + CursorTy pvrtmp_6670 = tmp_struct_72.field0; + CursorTy pvrtmp_6671 = tmp_struct_72.field1; + CursorTy pvrtmp_6672 = tmp_struct_72.field2; + CursorTy pvrtmp_6673 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2946, pvrtmp_6670, pvrtmp_6673, tmpcur_6666); + CursorTy pvrtmp_6678 = tmp_struct_73.field0; + CursorTy pvrtmp_6679 = tmp_struct_73.field1; + CursorTy pvrtmp_6680 = tmp_struct_73.field2; + CursorTy pvrtmp_6681 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2946, pvrtmp_6678, pvrtmp_6681, tmpcur_6668); + CursorTy pvrtmp_6686 = tmp_struct_74.field0; + CursorTy pvrtmp_6687 = tmp_struct_74.field1; + CursorTy pvrtmp_6688 = tmp_struct_74.field2; + CursorTy pvrtmp_6689 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2945 = 15; + + CursorTy writetag_4705 = loc_2945 + 1; + + *(CursorTy *) writetag_4705 = pvrtmp_6673; + + CursorTy writecur_4706 = writetag_4705 + 8; + + *(CursorTy *) writecur_4706 = pvrtmp_6681; + + CursorTy writecur_4707 = writecur_4706 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6686, pvrtmp_6687, + loc_2945, pvrtmp_6689}; + break; + } + + case 17: + { + CursorTy tmpcur_6698 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6699 = tmpcur_6585 + 8; + CursorTy tmpcur_6700 = *(CursorTy *) tmpaftercur_6699; + CursorTy tmpaftercur_6701 = tmpaftercur_6699 + 8; + CursorTy jump_4010 = tmpaftercur_6699 + 8; + CursorTy jump_4009 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2946, end_r_2947, loc_3249, tmpaftercur_6701); + CursorTy pvrtmp_6702 = tmp_struct_75.field0; + CursorTy pvrtmp_6703 = tmp_struct_75.field1; + CursorTy pvrtmp_6704 = tmp_struct_75.field2; + CursorTy pvrtmp_6705 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2946, pvrtmp_6702, pvrtmp_6705, tmpcur_6698); + CursorTy pvrtmp_6710 = tmp_struct_76.field0; + CursorTy pvrtmp_6711 = tmp_struct_76.field1; + CursorTy pvrtmp_6712 = tmp_struct_76.field2; + CursorTy pvrtmp_6713 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2946, pvrtmp_6710, pvrtmp_6713, tmpcur_6700); + CursorTy pvrtmp_6718 = tmp_struct_77.field0; + CursorTy pvrtmp_6719 = tmp_struct_77.field1; + CursorTy pvrtmp_6720 = tmp_struct_77.field2; + CursorTy pvrtmp_6721 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2945 = 17; + + CursorTy writetag_4718 = loc_2945 + 1; + + *(CursorTy *) writetag_4718 = pvrtmp_6705; + + CursorTy writecur_4719 = writetag_4718 + 8; + + *(CursorTy *) writecur_4719 = pvrtmp_6713; + + CursorTy writecur_4720 = writecur_4719 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6718, pvrtmp_6719, + loc_2945, pvrtmp_6721}; + break; + } + + case 19: + { + CursorTy tmpcur_6730 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6731 = tmpcur_6585 + 8; + CursorTy tmpcur_6732 = *(CursorTy *) tmpaftercur_6731; + CursorTy tmpaftercur_6733 = tmpaftercur_6731 + 8; + CursorTy jump_4016 = tmpaftercur_6731 + 8; + CursorTy jump_4015 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2946, end_r_2947, loc_3275, tmpaftercur_6733); + CursorTy pvrtmp_6734 = tmp_struct_78.field0; + CursorTy pvrtmp_6735 = tmp_struct_78.field1; + CursorTy pvrtmp_6736 = tmp_struct_78.field2; + CursorTy pvrtmp_6737 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2946, pvrtmp_6734, pvrtmp_6737, tmpcur_6730); + CursorTy pvrtmp_6742 = tmp_struct_79.field0; + CursorTy pvrtmp_6743 = tmp_struct_79.field1; + CursorTy pvrtmp_6744 = tmp_struct_79.field2; + CursorTy pvrtmp_6745 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2946, pvrtmp_6742, pvrtmp_6745, tmpcur_6732); + CursorTy pvrtmp_6750 = tmp_struct_80.field0; + CursorTy pvrtmp_6751 = tmp_struct_80.field1; + CursorTy pvrtmp_6752 = tmp_struct_80.field2; + CursorTy pvrtmp_6753 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2945 = 19; + + CursorTy writetag_4731 = loc_2945 + 1; + + *(CursorTy *) writetag_4731 = pvrtmp_6737; + + CursorTy writecur_4732 = writetag_4731 + 8; + + *(CursorTy *) writecur_4732 = pvrtmp_6745; + + CursorTy writecur_4733 = writecur_4732 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6750, pvrtmp_6751, + loc_2945, pvrtmp_6753}; + break; + } + + case 21: + { + CursorTy tmpcur_6762 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6763 = tmpcur_6585 + 8; + CursorTy tmpcur_6764 = *(CursorTy *) tmpaftercur_6763; + CursorTy tmpaftercur_6765 = tmpaftercur_6763 + 8; + CursorTy jump_4022 = tmpaftercur_6763 + 8; + CursorTy jump_4021 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2946, end_r_2947, loc_3301, tmpaftercur_6765); + CursorTy pvrtmp_6766 = tmp_struct_81.field0; + CursorTy pvrtmp_6767 = tmp_struct_81.field1; + CursorTy pvrtmp_6768 = tmp_struct_81.field2; + CursorTy pvrtmp_6769 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2946, pvrtmp_6766, pvrtmp_6769, tmpcur_6762); + CursorTy pvrtmp_6774 = tmp_struct_82.field0; + CursorTy pvrtmp_6775 = tmp_struct_82.field1; + CursorTy pvrtmp_6776 = tmp_struct_82.field2; + CursorTy pvrtmp_6777 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2946, pvrtmp_6774, pvrtmp_6777, tmpcur_6764); + CursorTy pvrtmp_6782 = tmp_struct_83.field0; + CursorTy pvrtmp_6783 = tmp_struct_83.field1; + CursorTy pvrtmp_6784 = tmp_struct_83.field2; + CursorTy pvrtmp_6785 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2945 = 21; + + CursorTy writetag_4744 = loc_2945 + 1; + + *(CursorTy *) writetag_4744 = pvrtmp_6769; + + CursorTy writecur_4745 = writetag_4744 + 8; + + *(CursorTy *) writecur_4745 = pvrtmp_6777; + + CursorTy writecur_4746 = writecur_4745 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6782, pvrtmp_6783, + loc_2945, pvrtmp_6785}; + break; + } + + case 23: + { + CursorTy tmpcur_6794 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6795 = tmpcur_6585 + 8; + CursorTy tmpcur_6796 = *(CursorTy *) tmpaftercur_6795; + CursorTy tmpaftercur_6797 = tmpaftercur_6795 + 8; + CursorTy jump_4028 = tmpaftercur_6795 + 8; + CursorTy jump_4027 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2946, end_r_2947, loc_3327, tmpaftercur_6797); + CursorTy pvrtmp_6798 = tmp_struct_84.field0; + CursorTy pvrtmp_6799 = tmp_struct_84.field1; + CursorTy pvrtmp_6800 = tmp_struct_84.field2; + CursorTy pvrtmp_6801 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2946, pvrtmp_6798, pvrtmp_6801, tmpcur_6794); + CursorTy pvrtmp_6806 = tmp_struct_85.field0; + CursorTy pvrtmp_6807 = tmp_struct_85.field1; + CursorTy pvrtmp_6808 = tmp_struct_85.field2; + CursorTy pvrtmp_6809 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2946, pvrtmp_6806, pvrtmp_6809, tmpcur_6796); + CursorTy pvrtmp_6814 = tmp_struct_86.field0; + CursorTy pvrtmp_6815 = tmp_struct_86.field1; + CursorTy pvrtmp_6816 = tmp_struct_86.field2; + CursorTy pvrtmp_6817 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2945 = 23; + + CursorTy writetag_4757 = loc_2945 + 1; + + *(CursorTy *) writetag_4757 = pvrtmp_6801; + + CursorTy writecur_4758 = writetag_4757 + 8; + + *(CursorTy *) writecur_4758 = pvrtmp_6809; + + CursorTy writecur_4759 = writecur_4758 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6814, pvrtmp_6815, + loc_2945, pvrtmp_6817}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6826 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6827 = tmpcur_6585 + 8; + CursorTy jump_4304 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2946, end_r_2947, loc_2945, tmpcur_6826); + CursorTy pvrtmp_6828 = tmp_struct_87.field0; + CursorTy pvrtmp_6829 = tmp_struct_87.field1; + CursorTy pvrtmp_6830 = tmp_struct_87.field2; + CursorTy pvrtmp_6831 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6828, jump_4304, + pvrtmp_6830, pvrtmp_6831}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6838 = *(CursorTy *) tmpcur_6585; + CursorTy tmpaftercur_6839 = tmpcur_6585 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2946, end_r_2947, loc_2945, tmpcur_6838); + CursorTy pvrtmp_6840 = tmp_struct_88.field0; + CursorTy pvrtmp_6841 = tmp_struct_88.field1; + CursorTy pvrtmp_6842 = tmp_struct_88.field2; + CursorTy pvrtmp_6843 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6840, pvrtmp_6841, + pvrtmp_6842, pvrtmp_6843}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6584"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2950, + CursorTy end_r_2951, + CursorTy loc_2949, + CursorTy arg_715_1320_1641) +{ + TagTyPacked tmpval_6851 = *(TagTyPacked *) arg_715_1320_1641; + CursorTy tmpcur_6852 = arg_715_1320_1641 + 1; + + + switch_7117: + ; + switch (tmpval_6851) { + + case 0: + { + CursorTy jump_4033 = arg_715_1320_1641 + 1; + + *(TagTyPacked *) loc_2949 = 0; + + CursorTy writetag_4771 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2951, jump_4033, + loc_2949, writetag_4771}; + break; + } + + case 9: + { + CursorTy tmpcur_6857 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6858 = tmpcur_6852 + 8; + CursorTy jump_4035 = tmpcur_6852 + 8; + CursorTy loc_3349 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3349, tmpaftercur_6858); + CursorTy pvrtmp_6859 = tmp_struct_92.field0; + CursorTy pvrtmp_6860 = tmp_struct_92.field1; + CursorTy pvrtmp_6861 = tmp_struct_92.field2; + CursorTy pvrtmp_6862 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6859, pvrtmp_6862, tmpcur_6857); + CursorTy pvrtmp_6867 = tmp_struct_93.field0; + CursorTy pvrtmp_6868 = tmp_struct_93.field1; + CursorTy pvrtmp_6869 = tmp_struct_93.field2; + CursorTy pvrtmp_6870 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2949 = 1; + + CursorTy writetag_4777 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6867, pvrtmp_6868, + loc_2949, pvrtmp_6870}; + break; + } + + case 11: + { + CursorTy tmpcur_6879 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6880 = tmpcur_6852 + 8; + CursorTy jump_4039 = tmpcur_6852 + 8; + CursorTy loc_3362 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3362, tmpaftercur_6880); + CursorTy pvrtmp_6881 = tmp_struct_94.field0; + CursorTy pvrtmp_6882 = tmp_struct_94.field1; + CursorTy pvrtmp_6883 = tmp_struct_94.field2; + CursorTy pvrtmp_6884 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6881, pvrtmp_6884, tmpcur_6879); + CursorTy pvrtmp_6889 = tmp_struct_95.field0; + CursorTy pvrtmp_6890 = tmp_struct_95.field1; + CursorTy pvrtmp_6891 = tmp_struct_95.field2; + CursorTy pvrtmp_6892 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2949 = 2; + + CursorTy writetag_4785 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6889, pvrtmp_6890, + loc_2949, pvrtmp_6892}; + break; + } + + case 13: + { + CursorTy tmpcur_6901 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6902 = tmpcur_6852 + 8; + CursorTy tmpcur_6903 = *(CursorTy *) tmpaftercur_6902; + CursorTy tmpaftercur_6904 = tmpaftercur_6902 + 8; + CursorTy jump_4044 = tmpaftercur_6902 + 8; + CursorTy jump_4043 = tmpcur_6852 + 8; + CursorTy loc_3380 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2950, end_r_2951, loc_3380, tmpaftercur_6904); + CursorTy pvrtmp_6905 = tmp_struct_96.field0; + CursorTy pvrtmp_6906 = tmp_struct_96.field1; + CursorTy pvrtmp_6907 = tmp_struct_96.field2; + CursorTy pvrtmp_6908 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6905, pvrtmp_6908, tmpcur_6901); + CursorTy pvrtmp_6913 = tmp_struct_97.field0; + CursorTy pvrtmp_6914 = tmp_struct_97.field1; + CursorTy pvrtmp_6915 = tmp_struct_97.field2; + CursorTy pvrtmp_6916 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6913, pvrtmp_6916, tmpcur_6903); + CursorTy pvrtmp_6921 = tmp_struct_98.field0; + CursorTy pvrtmp_6922 = tmp_struct_98.field1; + CursorTy pvrtmp_6923 = tmp_struct_98.field2; + CursorTy pvrtmp_6924 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2949 = 3; + + CursorTy writetag_4795 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6921, pvrtmp_6922, + loc_2949, pvrtmp_6924}; + break; + } + + case 15: + { + CursorTy tmpcur_6933 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6934 = tmpcur_6852 + 8; + CursorTy tmpcur_6935 = *(CursorTy *) tmpaftercur_6934; + CursorTy tmpaftercur_6936 = tmpaftercur_6934 + 8; + CursorTy jump_4050 = tmpaftercur_6934 + 8; + CursorTy jump_4049 = tmpcur_6852 + 8; + CursorTy loc_3400 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3400, tmpaftercur_6936); + CursorTy pvrtmp_6937 = tmp_struct_99.field0; + CursorTy pvrtmp_6938 = tmp_struct_99.field1; + CursorTy pvrtmp_6939 = tmp_struct_99.field2; + CursorTy pvrtmp_6940 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6937, pvrtmp_6940, tmpcur_6933); + CursorTy pvrtmp_6945 = tmp_struct_100.field0; + CursorTy pvrtmp_6946 = tmp_struct_100.field1; + CursorTy pvrtmp_6947 = tmp_struct_100.field2; + CursorTy pvrtmp_6948 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_6945, pvrtmp_6948, tmpcur_6935); + CursorTy pvrtmp_6953 = tmp_struct_101.field0; + CursorTy pvrtmp_6954 = tmp_struct_101.field1; + CursorTy pvrtmp_6955 = tmp_struct_101.field2; + CursorTy pvrtmp_6956 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2949 = 4; + + CursorTy writetag_4806 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6953, pvrtmp_6954, + loc_2949, pvrtmp_6956}; + break; + } + + case 17: + { + CursorTy tmpcur_6965 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6966 = tmpcur_6852 + 8; + CursorTy tmpcur_6967 = *(CursorTy *) tmpaftercur_6966; + CursorTy tmpaftercur_6968 = tmpaftercur_6966 + 8; + CursorTy jump_4056 = tmpaftercur_6966 + 8; + CursorTy jump_4055 = tmpcur_6852 + 8; + CursorTy loc_3420 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2950, end_r_2951, loc_3420, tmpaftercur_6968); + CursorTy pvrtmp_6969 = tmp_struct_102.field0; + CursorTy pvrtmp_6970 = tmp_struct_102.field1; + CursorTy pvrtmp_6971 = tmp_struct_102.field2; + CursorTy pvrtmp_6972 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_6969, pvrtmp_6972, tmpcur_6965); + CursorTy pvrtmp_6977 = tmp_struct_103.field0; + CursorTy pvrtmp_6978 = tmp_struct_103.field1; + CursorTy pvrtmp_6979 = tmp_struct_103.field2; + CursorTy pvrtmp_6980 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_6977, pvrtmp_6980, tmpcur_6967); + CursorTy pvrtmp_6985 = tmp_struct_104.field0; + CursorTy pvrtmp_6986 = tmp_struct_104.field1; + CursorTy pvrtmp_6987 = tmp_struct_104.field2; + CursorTy pvrtmp_6988 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2949 = 5; + + CursorTy writetag_4817 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6985, pvrtmp_6986, + loc_2949, pvrtmp_6988}; + break; + } + + case 19: + { + CursorTy tmpcur_6997 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_6998 = tmpcur_6852 + 8; + CursorTy tmpcur_6999 = *(CursorTy *) tmpaftercur_6998; + CursorTy tmpaftercur_7000 = tmpaftercur_6998 + 8; + CursorTy jump_4062 = tmpaftercur_6998 + 8; + CursorTy jump_4061 = tmpcur_6852 + 8; + CursorTy loc_3440 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_3440, tmpaftercur_7000); + CursorTy pvrtmp_7001 = tmp_struct_105.field0; + CursorTy pvrtmp_7002 = tmp_struct_105.field1; + CursorTy pvrtmp_7003 = tmp_struct_105.field2; + CursorTy pvrtmp_7004 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7001, pvrtmp_7004, tmpcur_6997); + CursorTy pvrtmp_7009 = tmp_struct_106.field0; + CursorTy pvrtmp_7010 = tmp_struct_106.field1; + CursorTy pvrtmp_7011 = tmp_struct_106.field2; + CursorTy pvrtmp_7012 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2950, pvrtmp_7009, pvrtmp_7012, tmpcur_6999); + CursorTy pvrtmp_7017 = tmp_struct_107.field0; + CursorTy pvrtmp_7018 = tmp_struct_107.field1; + CursorTy pvrtmp_7019 = tmp_struct_107.field2; + CursorTy pvrtmp_7020 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2949 = 6; + + CursorTy writetag_4828 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7017, pvrtmp_7018, + loc_2949, pvrtmp_7020}; + break; + } + + case 21: + { + CursorTy tmpcur_7029 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7030 = tmpcur_6852 + 8; + CursorTy tmpcur_7031 = *(CursorTy *) tmpaftercur_7030; + CursorTy tmpaftercur_7032 = tmpaftercur_7030 + 8; + CursorTy jump_4068 = tmpaftercur_7030 + 8; + CursorTy jump_4067 = tmpcur_6852 + 8; + CursorTy loc_3460 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3460, tmpaftercur_7032); + CursorTy pvrtmp_7033 = tmp_struct_108.field0; + CursorTy pvrtmp_7034 = tmp_struct_108.field1; + CursorTy pvrtmp_7035 = tmp_struct_108.field2; + CursorTy pvrtmp_7036 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7033, pvrtmp_7036, tmpcur_7029); + CursorTy pvrtmp_7041 = tmp_struct_109.field0; + CursorTy pvrtmp_7042 = tmp_struct_109.field1; + CursorTy pvrtmp_7043 = tmp_struct_109.field2; + CursorTy pvrtmp_7044 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_7041, pvrtmp_7044, tmpcur_7031); + CursorTy pvrtmp_7049 = tmp_struct_110.field0; + CursorTy pvrtmp_7050 = tmp_struct_110.field1; + CursorTy pvrtmp_7051 = tmp_struct_110.field2; + CursorTy pvrtmp_7052 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2949 = 7; + + CursorTy writetag_4839 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7049, pvrtmp_7050, + loc_2949, pvrtmp_7052}; + break; + } + + case 23: + { + CursorTy tmpcur_7061 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7062 = tmpcur_6852 + 8; + CursorTy tmpcur_7063 = *(CursorTy *) tmpaftercur_7062; + CursorTy tmpaftercur_7064 = tmpaftercur_7062 + 8; + CursorTy jump_4074 = tmpaftercur_7062 + 8; + CursorTy jump_4073 = tmpcur_6852 + 8; + CursorTy loc_3480 = loc_2949 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2950, end_r_2951, loc_3480, tmpaftercur_7064); + CursorTy pvrtmp_7065 = tmp_struct_111.field0; + CursorTy pvrtmp_7066 = tmp_struct_111.field1; + CursorTy pvrtmp_7067 = tmp_struct_111.field2; + CursorTy pvrtmp_7068 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2950, pvrtmp_7065, pvrtmp_7068, tmpcur_7061); + CursorTy pvrtmp_7073 = tmp_struct_112.field0; + CursorTy pvrtmp_7074 = tmp_struct_112.field1; + CursorTy pvrtmp_7075 = tmp_struct_112.field2; + CursorTy pvrtmp_7076 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2950, pvrtmp_7073, pvrtmp_7076, tmpcur_7063); + CursorTy pvrtmp_7081 = tmp_struct_113.field0; + CursorTy pvrtmp_7082 = tmp_struct_113.field1; + CursorTy pvrtmp_7083 = tmp_struct_113.field2; + CursorTy pvrtmp_7084 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2949 = 8; + + CursorTy writetag_4850 = loc_2949 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7081, pvrtmp_7082, + loc_2949, pvrtmp_7084}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7093 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7094 = tmpcur_6852 + 8; + CursorTy jump_4310 = tmpcur_6852 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_2949, tmpcur_7093); + CursorTy pvrtmp_7095 = tmp_struct_114.field0; + CursorTy pvrtmp_7096 = tmp_struct_114.field1; + CursorTy pvrtmp_7097 = tmp_struct_114.field2; + CursorTy pvrtmp_7098 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7095, jump_4310, + pvrtmp_7097, pvrtmp_7098}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7105 = *(CursorTy *) tmpcur_6852; + CursorTy tmpaftercur_7106 = tmpcur_6852 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2950, end_r_2951, loc_2949, tmpcur_7105); + CursorTy pvrtmp_7107 = tmp_struct_115.field0; + CursorTy pvrtmp_7108 = tmp_struct_115.field1; + CursorTy pvrtmp_7109 = tmp_struct_115.field2; + CursorTy pvrtmp_7110 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7107, pvrtmp_7108, + pvrtmp_7109, pvrtmp_7110}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6851"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2953, CursorTy arg_760_1365_1686) +{ + TagTyPacked tmpval_7118 = *(TagTyPacked *) arg_760_1365_1686; + CursorTy tmpcur_7119 = arg_760_1365_1686 + 1; + + + switch_7176: + ; + switch (tmpval_7118) { + + case 0: + { + CursorTy jump_4079 = arg_760_1365_1686 + 1; + + return (CursorProd) {jump_4079}; + break; + } + + case 9: + { + CursorTy tmpcur_7120 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7121 = tmpcur_7119 + 8; + CursorTy jump_4081 = tmpcur_7119 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2953, tmpaftercur_7121); + CursorTy pvrtmp_7122 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2953, tmpcur_7120); + CursorTy pvrtmp_7123 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7123}; + break; + } + + case 11: + { + CursorTy tmpcur_7124 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7125 = tmpcur_7119 + 8; + CursorTy jump_4085 = tmpcur_7119 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2953, tmpaftercur_7125); + CursorTy pvrtmp_7126 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2953, tmpcur_7124); + CursorTy pvrtmp_7127 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7127}; + break; + } + + case 13: + { + CursorTy tmpcur_7128 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7129 = tmpcur_7119 + 8; + CursorTy tmpcur_7130 = *(CursorTy *) tmpaftercur_7129; + CursorTy tmpaftercur_7131 = tmpaftercur_7129 + 8; + CursorTy jump_4090 = tmpaftercur_7129 + 8; + CursorTy jump_4089 = tmpcur_7119 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2953, tmpaftercur_7131); + CursorTy pvrtmp_7132 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2953, tmpcur_7128); + CursorTy pvrtmp_7133 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2953, tmpcur_7130); + CursorTy pvrtmp_7134 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7134}; + break; + } + + case 15: + { + CursorTy tmpcur_7135 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7136 = tmpcur_7119 + 8; + CursorTy tmpcur_7137 = *(CursorTy *) tmpaftercur_7136; + CursorTy tmpaftercur_7138 = tmpaftercur_7136 + 8; + CursorTy jump_4096 = tmpaftercur_7136 + 8; + CursorTy jump_4095 = tmpcur_7119 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2953, tmpaftercur_7138); + CursorTy pvrtmp_7139 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2953, tmpcur_7135); + CursorTy pvrtmp_7140 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2953, tmpcur_7137); + CursorTy pvrtmp_7141 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7141}; + break; + } + + case 17: + { + CursorTy tmpcur_7142 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7143 = tmpcur_7119 + 8; + CursorTy tmpcur_7144 = *(CursorTy *) tmpaftercur_7143; + CursorTy tmpaftercur_7145 = tmpaftercur_7143 + 8; + CursorTy jump_4102 = tmpaftercur_7143 + 8; + CursorTy jump_4101 = tmpcur_7119 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2953, tmpaftercur_7145); + CursorTy pvrtmp_7146 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2953, tmpcur_7142); + CursorTy pvrtmp_7147 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2953, tmpcur_7144); + CursorTy pvrtmp_7148 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7148}; + break; + } + + case 19: + { + CursorTy tmpcur_7149 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7150 = tmpcur_7119 + 8; + CursorTy tmpcur_7151 = *(CursorTy *) tmpaftercur_7150; + CursorTy tmpaftercur_7152 = tmpaftercur_7150 + 8; + CursorTy jump_4108 = tmpaftercur_7150 + 8; + CursorTy jump_4107 = tmpcur_7119 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2953, tmpaftercur_7152); + CursorTy pvrtmp_7153 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2953, tmpcur_7149); + CursorTy pvrtmp_7154 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2953, tmpcur_7151); + CursorTy pvrtmp_7155 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7155}; + break; + } + + case 21: + { + CursorTy tmpcur_7156 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7157 = tmpcur_7119 + 8; + CursorTy tmpcur_7158 = *(CursorTy *) tmpaftercur_7157; + CursorTy tmpaftercur_7159 = tmpaftercur_7157 + 8; + CursorTy jump_4114 = tmpaftercur_7157 + 8; + CursorTy jump_4113 = tmpcur_7119 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2953, tmpaftercur_7159); + CursorTy pvrtmp_7160 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2953, tmpcur_7156); + CursorTy pvrtmp_7161 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2953, tmpcur_7158); + CursorTy pvrtmp_7162 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7162}; + break; + } + + case 23: + { + CursorTy tmpcur_7163 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7164 = tmpcur_7119 + 8; + CursorTy tmpcur_7165 = *(CursorTy *) tmpaftercur_7164; + CursorTy tmpaftercur_7166 = tmpaftercur_7164 + 8; + CursorTy jump_4120 = tmpaftercur_7164 + 8; + CursorTy jump_4119 = tmpcur_7119 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2953, tmpaftercur_7166); + CursorTy pvrtmp_7167 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2953, tmpcur_7163); + CursorTy pvrtmp_7168 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2953, tmpcur_7165); + CursorTy pvrtmp_7169 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7169}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7170 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7171 = tmpcur_7119 + 8; + CursorTy jump_4316 = tmpcur_7119 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2953, tmpcur_7170); + CursorTy pvrtmp_7172 = tmp_struct_138.field0; + + return (CursorProd) {jump_4316}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7173 = *(CursorTy *) tmpcur_7119; + CursorTy tmpaftercur_7174 = tmpcur_7119 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2953, tmpcur_7173); + CursorTy pvrtmp_7175 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7175}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7118"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2955, CursorTy arg_805_1410_1731) +{ + TagTyPacked tmpval_7177 = *(TagTyPacked *) arg_805_1410_1731; + CursorTy tmpcur_7178 = arg_805_1410_1731 + 1; + + + switch_7235: + ; + switch (tmpval_7177) { + + case 0: + { + CursorTy jump_4125 = arg_805_1410_1731 + 1; + unsigned char wildcard_806_1411_1732 = print_symbol(6135); + unsigned char wildcard_807_1412_1733 = print_symbol(6129); + + return (CursorProd) {jump_4125}; + break; + } + + case 9: + { + CursorTy tmpcur_7179 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7180 = tmpcur_7178 + 8; + CursorTy jump_4127 = tmpcur_7178 + 8; + unsigned char wildcard_812_1415_1736 = print_symbol(6141); + CursorProd tmp_struct_140 = + _print_Content(end_r_2955, tmpaftercur_7180); + CursorTy pvrtmp_7181 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2955, tmpcur_7179); + CursorTy pvrtmp_7182 = tmp_struct_141.field0; + unsigned char wildcard_813_1418_1739 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7182}; + break; + } + + case 11: + { + CursorTy tmpcur_7183 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7184 = tmpcur_7178 + 8; + CursorTy jump_4131 = tmpcur_7178 + 8; + unsigned char wildcard_818_1421_1742 = print_symbol(6144); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2955, tmpaftercur_7184); + CursorTy pvrtmp_7185 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2955, tmpcur_7183); + CursorTy pvrtmp_7186 = tmp_struct_143.field0; + unsigned char wildcard_819_1424_1745 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7186}; + break; + } + + case 13: + { + CursorTy tmpcur_7187 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7188 = tmpcur_7178 + 8; + CursorTy tmpcur_7189 = *(CursorTy *) tmpaftercur_7188; + CursorTy tmpaftercur_7190 = tmpaftercur_7188 + 8; + CursorTy jump_4136 = tmpaftercur_7188 + 8; + CursorTy jump_4135 = tmpcur_7178 + 8; + unsigned char wildcard_826_1428_1749 = print_symbol(6132); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2955, tmpaftercur_7190); + CursorTy pvrtmp_7191 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2955, tmpcur_7187); + CursorTy pvrtmp_7192 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2955, tmpcur_7189); + CursorTy pvrtmp_7193 = tmp_struct_146.field0; + unsigned char wildcard_827_1432_1753 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7193}; + break; + } + + case 15: + { + CursorTy tmpcur_7194 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7195 = tmpcur_7178 + 8; + CursorTy tmpcur_7196 = *(CursorTy *) tmpaftercur_7195; + CursorTy tmpaftercur_7197 = tmpaftercur_7195 + 8; + CursorTy jump_4142 = tmpaftercur_7195 + 8; + CursorTy jump_4141 = tmpcur_7178 + 8; + unsigned char wildcard_834_1436_1757 = print_symbol(6143); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2955, tmpaftercur_7197); + CursorTy pvrtmp_7198 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2955, tmpcur_7194); + CursorTy pvrtmp_7199 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2955, tmpcur_7196); + CursorTy pvrtmp_7200 = tmp_struct_149.field0; + unsigned char wildcard_835_1440_1761 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7200}; + break; + } + + case 17: + { + CursorTy tmpcur_7201 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7202 = tmpcur_7178 + 8; + CursorTy tmpcur_7203 = *(CursorTy *) tmpaftercur_7202; + CursorTy tmpaftercur_7204 = tmpaftercur_7202 + 8; + CursorTy jump_4148 = tmpaftercur_7202 + 8; + CursorTy jump_4147 = tmpcur_7178 + 8; + unsigned char wildcard_842_1444_1765 = print_symbol(6133); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2955, tmpaftercur_7204); + CursorTy pvrtmp_7205 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2955, tmpcur_7201); + CursorTy pvrtmp_7206 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2955, tmpcur_7203); + CursorTy pvrtmp_7207 = tmp_struct_152.field0; + unsigned char wildcard_843_1448_1769 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7207}; + break; + } + + case 19: + { + CursorTy tmpcur_7208 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7209 = tmpcur_7178 + 8; + CursorTy tmpcur_7210 = *(CursorTy *) tmpaftercur_7209; + CursorTy tmpaftercur_7211 = tmpaftercur_7209 + 8; + CursorTy jump_4154 = tmpaftercur_7209 + 8; + CursorTy jump_4153 = tmpcur_7178 + 8; + unsigned char wildcard_850_1452_1773 = print_symbol(6142); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2955, tmpaftercur_7211); + CursorTy pvrtmp_7212 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2955, tmpcur_7208); + CursorTy pvrtmp_7213 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2955, tmpcur_7210); + CursorTy pvrtmp_7214 = tmp_struct_155.field0; + unsigned char wildcard_851_1456_1777 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7214}; + break; + } + + case 21: + { + CursorTy tmpcur_7215 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7216 = tmpcur_7178 + 8; + CursorTy tmpcur_7217 = *(CursorTy *) tmpaftercur_7216; + CursorTy tmpaftercur_7218 = tmpaftercur_7216 + 8; + CursorTy jump_4160 = tmpaftercur_7216 + 8; + CursorTy jump_4159 = tmpcur_7178 + 8; + unsigned char wildcard_858_1460_1781 = print_symbol(6139); + CursorProd tmp_struct_156 = + _print_Content(end_r_2955, tmpaftercur_7218); + CursorTy pvrtmp_7219 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2955, tmpcur_7215); + CursorTy pvrtmp_7220 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2955, tmpcur_7217); + CursorTy pvrtmp_7221 = tmp_struct_158.field0; + unsigned char wildcard_859_1464_1785 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7221}; + break; + } + + case 23: + { + CursorTy tmpcur_7222 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7223 = tmpcur_7178 + 8; + CursorTy tmpcur_7224 = *(CursorTy *) tmpaftercur_7223; + CursorTy tmpaftercur_7225 = tmpaftercur_7223 + 8; + CursorTy jump_4166 = tmpaftercur_7223 + 8; + CursorTy jump_4165 = tmpcur_7178 + 8; + unsigned char wildcard_866_1468_1789 = print_symbol(6140); + CursorProd tmp_struct_159 = + _print_Content(end_r_2955, tmpaftercur_7225); + CursorTy pvrtmp_7226 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2955, tmpcur_7222); + CursorTy pvrtmp_7227 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2955, tmpcur_7224); + CursorTy pvrtmp_7228 = tmp_struct_161.field0; + unsigned char wildcard_867_1472_1793 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7228}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7229 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7230 = tmpcur_7178 + 8; + CursorTy jump_4322 = tmpcur_7178 + 8; + unsigned char wildcard_4325 = print_symbol(6146); + CursorProd tmp_struct_162 = _print_Adt(end_r_2955, tmpcur_7229); + CursorTy pvrtmp_7231 = tmp_struct_162.field0; + + return (CursorProd) {jump_4322}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7232 = *(CursorTy *) tmpcur_7178; + CursorTy tmpaftercur_7233 = tmpcur_7178 + 8; + unsigned char wildcard_4325 = print_symbol(6145); + CursorProd tmp_struct_163 = _print_Adt(end_r_2955, tmpcur_7232); + CursorTy pvrtmp_7234 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7234}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7177"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2958, + CursorTy end_r_2959, CursorTy loc_2957, + CursorTy arg_868_1473_1794) +{ + if (loc_2957 + 32 > end_r_2959) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2959); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2959 = chunk_end_169; + *(TagTyPacked *) loc_2957 = 255; + + CursorTy redir = loc_2957 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2957 = chunk_start_168; + } + + CursorTy loc_3658 = loc_2957 + 1; + CursorTy loc_3659 = loc_3658 + 8; + TagTyPacked tmpval_7236 = *(TagTyPacked *) arg_868_1473_1794; + CursorTy tmpcur_7237 = arg_868_1473_1794 + 1; + + + switch_7280: + ; + switch (tmpval_7236) { + + case 0: + { + CursorTy jump_4171 = arg_868_1473_1794 + 1; + + *(TagTyPacked *) loc_2957 = 0; + + CursorTy writetag_4964 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2959, jump_4171, + loc_2957, writetag_4964}; + break; + } + + case 1: + { + IntTy tmpval_7242 = *(IntTy *) tmpcur_7237; + CursorTy tmpcur_7243 = tmpcur_7237 + sizeof(IntTy); + CursorTy jump_4173 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2958, end_r_2959, loc_3659, tmpcur_7243); + CursorTy pvrtmp_7244 = tmp_struct_164.field0; + CursorTy pvrtmp_7245 = tmp_struct_164.field1; + CursorTy pvrtmp_7246 = tmp_struct_164.field2; + CursorTy pvrtmp_7247 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2957 = 1; + + CursorTy writetag_4969 = loc_2957 + 1; + + *(IntTy *) writetag_4969 = tmpval_7242; + + CursorTy writecur_4970 = writetag_4969 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7244, pvrtmp_7245, + loc_2957, pvrtmp_7247}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7256 = *(CursorTy *) tmpcur_7237; + CursorTy tmpaftercur_7257 = tmpcur_7237 + 8; + CursorTy jump_4328 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2958, end_r_2959, loc_2957, tmpcur_7256); + CursorTy pvrtmp_7258 = tmp_struct_165.field0; + CursorTy pvrtmp_7259 = tmp_struct_165.field1; + CursorTy pvrtmp_7260 = tmp_struct_165.field2; + CursorTy pvrtmp_7261 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7258, jump_4328, + pvrtmp_7260, pvrtmp_7261}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7268 = *(CursorTy *) tmpcur_7237; + CursorTy tmpaftercur_7269 = tmpcur_7237 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2958, end_r_2959, loc_2957, tmpcur_7268); + CursorTy pvrtmp_7270 = tmp_struct_166.field0; + CursorTy pvrtmp_7271 = tmp_struct_166.field1; + CursorTy pvrtmp_7272 = tmp_struct_166.field2; + CursorTy pvrtmp_7273 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7270, pvrtmp_7271, + pvrtmp_7272, pvrtmp_7273}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7236"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2962, + CursorTy end_r_2963, + CursorTy loc_2961, + CursorTy arg_873_1478_1799) +{ + CursorTy loc_3671 = loc_2961 + 1; + CursorTy loc_3672 = loc_3671 + 8; + TagTyPacked tmpval_7281 = *(TagTyPacked *) arg_873_1478_1799; + CursorTy tmpcur_7282 = arg_873_1478_1799 + 1; + + + switch_7325: + ; + switch (tmpval_7281) { + + case 0: + { + CursorTy jump_4176 = arg_873_1478_1799 + 1; + + *(TagTyPacked *) loc_2961 = 0; + + CursorTy writetag_4980 = loc_2961 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2963, jump_4176, + loc_2961, writetag_4980}; + break; + } + + case 1: + { + IntTy tmpval_7287 = *(IntTy *) tmpcur_7282; + CursorTy tmpcur_7288 = tmpcur_7282 + sizeof(IntTy); + CursorTy jump_4178 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_3672, tmpcur_7288); + CursorTy pvrtmp_7289 = tmp_struct_170.field0; + CursorTy pvrtmp_7290 = tmp_struct_170.field1; + CursorTy pvrtmp_7291 = tmp_struct_170.field2; + CursorTy pvrtmp_7292 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2961 = 1; + + CursorTy writetag_4985 = loc_2961 + 1; + + *(IntTy *) writetag_4985 = tmpval_7287; + + CursorTy writecur_4986 = writetag_4985 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7289, pvrtmp_7290, + loc_2961, pvrtmp_7292}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7301 = *(CursorTy *) tmpcur_7282; + CursorTy tmpaftercur_7302 = tmpcur_7282 + 8; + CursorTy jump_4334 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_2961, tmpcur_7301); + CursorTy pvrtmp_7303 = tmp_struct_171.field0; + CursorTy pvrtmp_7304 = tmp_struct_171.field1; + CursorTy pvrtmp_7305 = tmp_struct_171.field2; + CursorTy pvrtmp_7306 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7303, jump_4334, + pvrtmp_7305, pvrtmp_7306}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7313 = *(CursorTy *) tmpcur_7282; + CursorTy tmpaftercur_7314 = tmpcur_7282 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2962, end_r_2963, loc_2961, tmpcur_7313); + CursorTy pvrtmp_7315 = tmp_struct_172.field0; + CursorTy pvrtmp_7316 = tmp_struct_172.field1; + CursorTy pvrtmp_7317 = tmp_struct_172.field2; + CursorTy pvrtmp_7318 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7315, pvrtmp_7316, + pvrtmp_7317, pvrtmp_7318}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7281"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2965, CursorTy arg_878_1483_1804) +{ + TagTyPacked tmpval_7326 = *(TagTyPacked *) arg_878_1483_1804; + CursorTy tmpcur_7327 = arg_878_1483_1804 + 1; + + + switch_7337: + ; + switch (tmpval_7326) { + + case 0: + { + CursorTy jump_4181 = arg_878_1483_1804 + 1; + + return (CursorProd) {jump_4181}; + break; + } + + case 1: + { + IntTy tmpval_7328 = *(IntTy *) tmpcur_7327; + CursorTy tmpcur_7329 = tmpcur_7327 + sizeof(IntTy); + CursorTy jump_4183 = tmpcur_7327 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2965, tmpcur_7329); + CursorTy pvrtmp_7330 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7330}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7331 = *(CursorTy *) tmpcur_7327; + CursorTy tmpaftercur_7332 = tmpcur_7327 + 8; + CursorTy jump_4340 = tmpcur_7327 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2965, tmpcur_7331); + CursorTy pvrtmp_7333 = tmp_struct_174.field0; + + return (CursorProd) {jump_4340}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7334 = *(CursorTy *) tmpcur_7327; + CursorTy tmpaftercur_7335 = tmpcur_7327 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2965, tmpcur_7334); + CursorTy pvrtmp_7336 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7336}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7326"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2967, CursorTy arg_883_1487_1808) +{ + TagTyPacked tmpval_7338 = *(TagTyPacked *) arg_883_1487_1808; + CursorTy tmpcur_7339 = arg_883_1487_1808 + 1; + + + switch_7349: + ; + switch (tmpval_7338) { + + case 0: + { + CursorTy jump_4186 = arg_883_1487_1808 + 1; + unsigned char wildcard_884_1488_1809 = print_symbol(6134); + unsigned char wildcard_885_1489_1810 = print_symbol(6129); + + return (CursorProd) {jump_4186}; + break; + } + + case 1: + { + IntTy tmpval_7340 = *(IntTy *) tmpcur_7339; + CursorTy tmpcur_7341 = tmpcur_7339 + sizeof(IntTy); + CursorTy jump_4188 = tmpcur_7339 + 8; + unsigned char wildcard_890_1492_1813 = print_symbol(6131); + unsigned char y_888_1493_1814 = printf("%lld", tmpval_7340); + CursorProd tmp_struct_176 = _print_Tags(end_r_2967, tmpcur_7341); + CursorTy pvrtmp_7342 = tmp_struct_176.field0; + unsigned char wildcard_891_1495_1816 = print_symbol(6129); + + return (CursorProd) {pvrtmp_7342}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7343 = *(CursorTy *) tmpcur_7339; + CursorTy tmpaftercur_7344 = tmpcur_7339 + 8; + CursorTy jump_4346 = tmpcur_7339 + 8; + unsigned char wildcard_4349 = print_symbol(6146); + CursorProd tmp_struct_177 = _print_Tags(end_r_2967, tmpcur_7343); + CursorTy pvrtmp_7345 = tmp_struct_177.field0; + + return (CursorProd) {jump_4346}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7346 = *(CursorTy *) tmpcur_7339; + CursorTy tmpaftercur_7347 = tmpcur_7339 + 8; + unsigned char wildcard_4349 = print_symbol(6145); + CursorProd tmp_struct_178 = _print_Tags(end_r_2967, tmpcur_7346); + CursorTy pvrtmp_7348 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7348}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7338"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_2702) +{ + if (loc_2969 + 32 > end_r_2971) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2971); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2971 = chunk_end_184; + *(TagTyPacked *) loc_2969 = 255; + + CursorTy redir = loc_2969 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2969 = chunk_start_183; + } + + CursorTy loc_3696 = loc_2969 + 1; + CursorTy loc_3697 = loc_3696 + 8; + TagTyPacked tmpval_7350 = *(TagTyPacked *) arg_2702; + CursorTy tmpcur_7351 = arg_2702 + 1; + + + switch_7394: + ; + switch (tmpval_7350) { + + case 0: + { + CursorTy jump_4191 = arg_2702 + 1; + + *(TagTyPacked *) loc_2969 = 0; + + CursorTy writetag_5016 = loc_2969 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2971, jump_4191, + loc_2969, writetag_5016}; + break; + } + + case 1: + { + IntTy tmpval_7356 = *(IntTy *) tmpcur_7351; + CursorTy tmpcur_7357 = tmpcur_7351 + sizeof(IntTy); + CursorTy jump_4193 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_3697, tmpcur_7357); + CursorTy pvrtmp_7358 = tmp_struct_179.field0; + CursorTy pvrtmp_7359 = tmp_struct_179.field1; + CursorTy pvrtmp_7360 = tmp_struct_179.field2; + CursorTy pvrtmp_7361 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2969 = 1; + + CursorTy writetag_5021 = loc_2969 + 1; + + *(IntTy *) writetag_5021 = tmpval_7356; + + CursorTy writecur_5022 = writetag_5021 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7358, pvrtmp_7359, + loc_2969, pvrtmp_7361}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7370 = *(CursorTy *) tmpcur_7351; + CursorTy tmpaftercur_7371 = tmpcur_7351 + 8; + CursorTy jump_4352 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_2969, tmpcur_7370); + CursorTy pvrtmp_7372 = tmp_struct_180.field0; + CursorTy pvrtmp_7373 = tmp_struct_180.field1; + CursorTy pvrtmp_7374 = tmp_struct_180.field2; + CursorTy pvrtmp_7375 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7372, jump_4352, + pvrtmp_7374, pvrtmp_7375}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7382 = *(CursorTy *) tmpcur_7351; + CursorTy tmpaftercur_7383 = tmpcur_7351 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2970, end_r_2971, loc_2969, tmpcur_7382); + CursorTy pvrtmp_7384 = tmp_struct_181.field0; + CursorTy pvrtmp_7385 = tmp_struct_181.field1; + CursorTy pvrtmp_7386 = tmp_struct_181.field2; + CursorTy pvrtmp_7387 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7384, pvrtmp_7385, + pvrtmp_7386, pvrtmp_7387}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7350"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2974, + CursorTy end_r_2975, + CursorTy loc_2973, + CursorTy arg_2707) +{ + if (loc_2973 + 32 > end_r_2975) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2975); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2975 = chunk_end_191; + *(TagTyPacked *) loc_2973 = 255; + + CursorTy redir = loc_2973 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2973 = chunk_start_190; + } + + TagTyPacked tmpval_7395 = *(TagTyPacked *) arg_2707; + CursorTy tmpcur_7396 = arg_2707 + 1; + + + switch_7445: + ; + switch (tmpval_7395) { + + case 0: + { + CursorTy loc_3707 = loc_2973 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2974, end_r_2975, loc_3707, tmpcur_7396); + CursorTy pvrtmp_7397 = tmp_struct_185.field0; + CursorTy pvrtmp_7398 = tmp_struct_185.field1; + CursorTy pvrtmp_7399 = tmp_struct_185.field2; + CursorTy pvrtmp_7400 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2973 = 0; + + CursorTy writetag_5033 = loc_2973 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7397, pvrtmp_7398, + loc_2973, pvrtmp_7400}; + break; + } + + case 1: + { + CursorTy loc_3713 = loc_2973 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2974, end_r_2975, loc_3713, tmpcur_7396); + CursorTy pvrtmp_7409 = tmp_struct_186.field0; + CursorTy pvrtmp_7410 = tmp_struct_186.field1; + CursorTy pvrtmp_7411 = tmp_struct_186.field2; + CursorTy pvrtmp_7412 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2973 = 1; + + CursorTy writetag_5038 = loc_2973 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7409, pvrtmp_7410, + loc_2973, pvrtmp_7412}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7421 = *(CursorTy *) tmpcur_7396; + CursorTy tmpaftercur_7422 = tmpcur_7396 + 8; + CursorTy jump_4358 = tmpcur_7396 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2974, end_r_2975, loc_2973, tmpcur_7421); + CursorTy pvrtmp_7423 = tmp_struct_187.field0; + CursorTy pvrtmp_7424 = tmp_struct_187.field1; + CursorTy pvrtmp_7425 = tmp_struct_187.field2; + CursorTy pvrtmp_7426 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7423, jump_4358, + pvrtmp_7425, pvrtmp_7426}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7433 = *(CursorTy *) tmpcur_7396; + CursorTy tmpaftercur_7434 = tmpcur_7396 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2974, end_r_2975, loc_2973, tmpcur_7433); + CursorTy pvrtmp_7435 = tmp_struct_188.field0; + CursorTy pvrtmp_7436 = tmp_struct_188.field1; + CursorTy pvrtmp_7437 = tmp_struct_188.field2; + CursorTy pvrtmp_7438 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7435, pvrtmp_7436, + pvrtmp_7437, pvrtmp_7438}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7395"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2712) +{ + if (loc_2977 + 32 > end_r_2979) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2979); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2979 = chunk_end_218; + *(TagTyPacked *) loc_2977 = 255; + + CursorTy redir = loc_2977 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2977 = chunk_start_217; + } + + CursorTy loc_3726 = loc_2977 + 1; + CursorTy loc_3727 = loc_3726 + 8; + CursorTy loc_3728 = loc_3727 + 8; + CursorTy loc_3744 = loc_2977 + 1; + CursorTy loc_3745 = loc_3744 + 8; + CursorTy loc_3746 = loc_3745 + 8; + CursorTy loc_3766 = loc_2977 + 1; + CursorTy loc_3767 = loc_3766 + 8; + CursorTy loc_3768 = loc_3767 + 8; + CursorTy loc_3769 = loc_3768 + 8; + CursorTy loc_3793 = loc_2977 + 1; + CursorTy loc_3794 = loc_3793 + 8; + CursorTy loc_3795 = loc_3794 + 8; + CursorTy loc_3796 = loc_3795 + 8; + CursorTy loc_3820 = loc_2977 + 1; + CursorTy loc_3821 = loc_3820 + 8; + CursorTy loc_3822 = loc_3821 + 8; + CursorTy loc_3823 = loc_3822 + 8; + CursorTy loc_3847 = loc_2977 + 1; + CursorTy loc_3848 = loc_3847 + 8; + CursorTy loc_3849 = loc_3848 + 8; + CursorTy loc_3850 = loc_3849 + 8; + CursorTy loc_3874 = loc_2977 + 1; + CursorTy loc_3875 = loc_3874 + 8; + CursorTy loc_3876 = loc_3875 + 8; + CursorTy loc_3877 = loc_3876 + 8; + CursorTy loc_3901 = loc_2977 + 1; + CursorTy loc_3902 = loc_3901 + 8; + CursorTy loc_3903 = loc_3902 + 8; + CursorTy loc_3904 = loc_3903 + 8; + TagTyPacked tmpval_7446 = *(TagTyPacked *) arg_2712; + CursorTy tmpcur_7447 = arg_2712 + 1; + + + switch_7684: + ; + switch (tmpval_7446) { + + case 0: + { + CursorTy jump_4200 = arg_2712 + 1; + + *(TagTyPacked *) loc_2977 = 0; + + CursorTy writetag_5048 = loc_2977 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2979, jump_4200, + loc_2977, writetag_5048}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3728, tmpcur_7447); + CursorTy pvrtmp_7452 = tmp_struct_192.field0; + CursorTy pvrtmp_7453 = tmp_struct_192.field1; + CursorTy pvrtmp_7454 = tmp_struct_192.field2; + CursorTy pvrtmp_7455 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7452, pvrtmp_7455, pvrtmp_7453); + CursorTy pvrtmp_7460 = tmp_struct_193.field0; + CursorTy pvrtmp_7461 = tmp_struct_193.field1; + CursorTy pvrtmp_7462 = tmp_struct_193.field2; + CursorTy pvrtmp_7463 = tmp_struct_193.field3; + IntTy sizeof_y_2715__2717 = pvrtmp_7455 - pvrtmp_7454; + IntTy sizeof_y_2716__2718 = pvrtmp_7463 - pvrtmp_7462; + IntTy fltPrm_2806 = sizeof_y_2715__2717 + 0; + IntTy offset__2719 = 0 + fltPrm_2806; + IntTy fltPrm_2807 = sizeof_y_2715__2717 + sizeof_y_2716__2718; + IntTy size_dcon_2720 = 9 + fltPrm_2807; + + *(TagTyPacked *) loc_2977 = 160; + + CursorTy writetag_5053 = loc_2977 + 1; + + *(IntTy *) writetag_5053 = size_dcon_2720; + + CursorTy writecur_5054 = writetag_5053 + sizeof(IntTy); + + *(IntTy *) writecur_5054 = offset__2719; + + CursorTy writecur_5055 = writecur_5054 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7460, pvrtmp_7461, + loc_2977, pvrtmp_7463}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3746, tmpcur_7447); + CursorTy pvrtmp_7472 = tmp_struct_194.field0; + CursorTy pvrtmp_7473 = tmp_struct_194.field1; + CursorTy pvrtmp_7474 = tmp_struct_194.field2; + CursorTy pvrtmp_7475 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7472, pvrtmp_7475, pvrtmp_7473); + CursorTy pvrtmp_7480 = tmp_struct_195.field0; + CursorTy pvrtmp_7481 = tmp_struct_195.field1; + CursorTy pvrtmp_7482 = tmp_struct_195.field2; + CursorTy pvrtmp_7483 = tmp_struct_195.field3; + IntTy sizeof_y_2723__2725 = pvrtmp_7475 - pvrtmp_7474; + IntTy sizeof_y_2724__2726 = pvrtmp_7483 - pvrtmp_7482; + IntTy fltPrm_2808 = sizeof_y_2723__2725 + 0; + IntTy offset__2727 = 0 + fltPrm_2808; + IntTy fltPrm_2809 = sizeof_y_2723__2725 + sizeof_y_2724__2726; + IntTy size_dcon_2728 = 9 + fltPrm_2809; + + *(TagTyPacked *) loc_2977 = 162; + + CursorTy writetag_5062 = loc_2977 + 1; + + *(IntTy *) writetag_5062 = size_dcon_2728; + + CursorTy writecur_5063 = writetag_5062 + sizeof(IntTy); + + *(IntTy *) writecur_5063 = offset__2727; + + CursorTy writecur_5064 = writecur_5063 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7480, pvrtmp_7481, + loc_2977, pvrtmp_7483}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2978, end_r_2979, loc_3769, tmpcur_7447); + CursorTy pvrtmp_7492 = tmp_struct_196.field0; + CursorTy pvrtmp_7493 = tmp_struct_196.field1; + CursorTy pvrtmp_7494 = tmp_struct_196.field2; + CursorTy pvrtmp_7495 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7492, pvrtmp_7495, pvrtmp_7493); + CursorTy pvrtmp_7500 = tmp_struct_197.field0; + CursorTy pvrtmp_7501 = tmp_struct_197.field1; + CursorTy pvrtmp_7502 = tmp_struct_197.field2; + CursorTy pvrtmp_7503 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7500, pvrtmp_7503, pvrtmp_7501); + CursorTy pvrtmp_7508 = tmp_struct_198.field0; + CursorTy pvrtmp_7509 = tmp_struct_198.field1; + CursorTy pvrtmp_7510 = tmp_struct_198.field2; + CursorTy pvrtmp_7511 = tmp_struct_198.field3; + IntTy sizeof_y_2732__2735 = pvrtmp_7495 - pvrtmp_7494; + IntTy sizeof_y_2733__2736 = pvrtmp_7503 - pvrtmp_7502; + IntTy sizeof_y_2734__2737 = pvrtmp_7511 - pvrtmp_7510; + IntTy fltPrm_2810 = sizeof_y_2732__2735 + 0; + IntTy offset__2738 = 8 + fltPrm_2810; + IntTy fltPrm_2811 = sizeof_y_2732__2735 + sizeof_y_2733__2736; + IntTy offset__2739 = 0 + fltPrm_2811; + IntTy fltPrm_2813 = sizeof_y_2733__2736 + sizeof_y_2734__2737; + IntTy fltPrm_2812 = sizeof_y_2732__2735 + fltPrm_2813; + IntTy size_dcon_2740 = 17 + fltPrm_2812; + + *(TagTyPacked *) loc_2977 = 164; + + CursorTy writetag_5072 = loc_2977 + 1; + + *(IntTy *) writetag_5072 = size_dcon_2740; + + CursorTy writecur_5073 = writetag_5072 + sizeof(IntTy); + + *(IntTy *) writecur_5073 = offset__2738; + + CursorTy writecur_5074 = writecur_5073 + sizeof(IntTy); + + *(IntTy *) writecur_5074 = offset__2739; + + CursorTy writecur_5075 = writecur_5074 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7508, pvrtmp_7509, + loc_2977, pvrtmp_7511}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3796, tmpcur_7447); + CursorTy pvrtmp_7520 = tmp_struct_199.field0; + CursorTy pvrtmp_7521 = tmp_struct_199.field1; + CursorTy pvrtmp_7522 = tmp_struct_199.field2; + CursorTy pvrtmp_7523 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7520, pvrtmp_7523, pvrtmp_7521); + CursorTy pvrtmp_7528 = tmp_struct_200.field0; + CursorTy pvrtmp_7529 = tmp_struct_200.field1; + CursorTy pvrtmp_7530 = tmp_struct_200.field2; + CursorTy pvrtmp_7531 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7528, pvrtmp_7531, pvrtmp_7529); + CursorTy pvrtmp_7536 = tmp_struct_201.field0; + CursorTy pvrtmp_7537 = tmp_struct_201.field1; + CursorTy pvrtmp_7538 = tmp_struct_201.field2; + CursorTy pvrtmp_7539 = tmp_struct_201.field3; + IntTy sizeof_y_2744__2747 = pvrtmp_7523 - pvrtmp_7522; + IntTy sizeof_y_2745__2748 = pvrtmp_7531 - pvrtmp_7530; + IntTy sizeof_y_2746__2749 = pvrtmp_7539 - pvrtmp_7538; + IntTy fltPrm_2814 = sizeof_y_2744__2747 + 0; + IntTy offset__2750 = 8 + fltPrm_2814; + IntTy fltPrm_2815 = sizeof_y_2744__2747 + sizeof_y_2745__2748; + IntTy offset__2751 = 0 + fltPrm_2815; + IntTy fltPrm_2817 = sizeof_y_2745__2748 + sizeof_y_2746__2749; + IntTy fltPrm_2816 = sizeof_y_2744__2747 + fltPrm_2817; + IntTy size_dcon_2752 = 17 + fltPrm_2816; + + *(TagTyPacked *) loc_2977 = 166; + + CursorTy writetag_5084 = loc_2977 + 1; + + *(IntTy *) writetag_5084 = size_dcon_2752; + + CursorTy writecur_5085 = writetag_5084 + sizeof(IntTy); + + *(IntTy *) writecur_5085 = offset__2750; + + CursorTy writecur_5086 = writecur_5085 + sizeof(IntTy); + + *(IntTy *) writecur_5086 = offset__2751; + + CursorTy writecur_5087 = writecur_5086 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7536, pvrtmp_7537, + loc_2977, pvrtmp_7539}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2978, end_r_2979, loc_3823, tmpcur_7447); + CursorTy pvrtmp_7548 = tmp_struct_202.field0; + CursorTy pvrtmp_7549 = tmp_struct_202.field1; + CursorTy pvrtmp_7550 = tmp_struct_202.field2; + CursorTy pvrtmp_7551 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7548, pvrtmp_7551, pvrtmp_7549); + CursorTy pvrtmp_7556 = tmp_struct_203.field0; + CursorTy pvrtmp_7557 = tmp_struct_203.field1; + CursorTy pvrtmp_7558 = tmp_struct_203.field2; + CursorTy pvrtmp_7559 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7556, pvrtmp_7559, pvrtmp_7557); + CursorTy pvrtmp_7564 = tmp_struct_204.field0; + CursorTy pvrtmp_7565 = tmp_struct_204.field1; + CursorTy pvrtmp_7566 = tmp_struct_204.field2; + CursorTy pvrtmp_7567 = tmp_struct_204.field3; + IntTy sizeof_y_2756__2759 = pvrtmp_7551 - pvrtmp_7550; + IntTy sizeof_y_2757__2760 = pvrtmp_7559 - pvrtmp_7558; + IntTy sizeof_y_2758__2761 = pvrtmp_7567 - pvrtmp_7566; + IntTy fltPrm_2818 = sizeof_y_2756__2759 + 0; + IntTy offset__2762 = 8 + fltPrm_2818; + IntTy fltPrm_2819 = sizeof_y_2756__2759 + sizeof_y_2757__2760; + IntTy offset__2763 = 0 + fltPrm_2819; + IntTy fltPrm_2821 = sizeof_y_2757__2760 + sizeof_y_2758__2761; + IntTy fltPrm_2820 = sizeof_y_2756__2759 + fltPrm_2821; + IntTy size_dcon_2764 = 17 + fltPrm_2820; + + *(TagTyPacked *) loc_2977 = 168; + + CursorTy writetag_5096 = loc_2977 + 1; + + *(IntTy *) writetag_5096 = size_dcon_2764; + + CursorTy writecur_5097 = writetag_5096 + sizeof(IntTy); + + *(IntTy *) writecur_5097 = offset__2762; + + CursorTy writecur_5098 = writecur_5097 + sizeof(IntTy); + + *(IntTy *) writecur_5098 = offset__2763; + + CursorTy writecur_5099 = writecur_5098 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7564, pvrtmp_7565, + loc_2977, pvrtmp_7567}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_3850, tmpcur_7447); + CursorTy pvrtmp_7576 = tmp_struct_205.field0; + CursorTy pvrtmp_7577 = tmp_struct_205.field1; + CursorTy pvrtmp_7578 = tmp_struct_205.field2; + CursorTy pvrtmp_7579 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7576, pvrtmp_7579, pvrtmp_7577); + CursorTy pvrtmp_7584 = tmp_struct_206.field0; + CursorTy pvrtmp_7585 = tmp_struct_206.field1; + CursorTy pvrtmp_7586 = tmp_struct_206.field2; + CursorTy pvrtmp_7587 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2978, pvrtmp_7584, pvrtmp_7587, pvrtmp_7585); + CursorTy pvrtmp_7592 = tmp_struct_207.field0; + CursorTy pvrtmp_7593 = tmp_struct_207.field1; + CursorTy pvrtmp_7594 = tmp_struct_207.field2; + CursorTy pvrtmp_7595 = tmp_struct_207.field3; + IntTy sizeof_y_2768__2771 = pvrtmp_7579 - pvrtmp_7578; + IntTy sizeof_y_2769__2772 = pvrtmp_7587 - pvrtmp_7586; + IntTy sizeof_y_2770__2773 = pvrtmp_7595 - pvrtmp_7594; + IntTy fltPrm_2822 = sizeof_y_2768__2771 + 0; + IntTy offset__2774 = 8 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2768__2771 + sizeof_y_2769__2772; + IntTy offset__2775 = 0 + fltPrm_2823; + IntTy fltPrm_2825 = sizeof_y_2769__2772 + sizeof_y_2770__2773; + IntTy fltPrm_2824 = sizeof_y_2768__2771 + fltPrm_2825; + IntTy size_dcon_2776 = 17 + fltPrm_2824; + + *(TagTyPacked *) loc_2977 = 170; + + CursorTy writetag_5108 = loc_2977 + 1; + + *(IntTy *) writetag_5108 = size_dcon_2776; + + CursorTy writecur_5109 = writetag_5108 + sizeof(IntTy); + + *(IntTy *) writecur_5109 = offset__2774; + + CursorTy writecur_5110 = writecur_5109 + sizeof(IntTy); + + *(IntTy *) writecur_5110 = offset__2775; + + CursorTy writecur_5111 = writecur_5110 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7592, pvrtmp_7593, + loc_2977, pvrtmp_7595}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3877, tmpcur_7447); + CursorTy pvrtmp_7604 = tmp_struct_208.field0; + CursorTy pvrtmp_7605 = tmp_struct_208.field1; + CursorTy pvrtmp_7606 = tmp_struct_208.field2; + CursorTy pvrtmp_7607 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7604, pvrtmp_7607, pvrtmp_7605); + CursorTy pvrtmp_7612 = tmp_struct_209.field0; + CursorTy pvrtmp_7613 = tmp_struct_209.field1; + CursorTy pvrtmp_7614 = tmp_struct_209.field2; + CursorTy pvrtmp_7615 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7612, pvrtmp_7615, pvrtmp_7613); + CursorTy pvrtmp_7620 = tmp_struct_210.field0; + CursorTy pvrtmp_7621 = tmp_struct_210.field1; + CursorTy pvrtmp_7622 = tmp_struct_210.field2; + CursorTy pvrtmp_7623 = tmp_struct_210.field3; + IntTy sizeof_y_2780__2783 = pvrtmp_7607 - pvrtmp_7606; + IntTy sizeof_y_2781__2784 = pvrtmp_7615 - pvrtmp_7614; + IntTy sizeof_y_2782__2785 = pvrtmp_7623 - pvrtmp_7622; + IntTy fltPrm_2826 = sizeof_y_2780__2783 + 0; + IntTy offset__2786 = 8 + fltPrm_2826; + IntTy fltPrm_2827 = sizeof_y_2780__2783 + sizeof_y_2781__2784; + IntTy offset__2787 = 0 + fltPrm_2827; + IntTy fltPrm_2829 = sizeof_y_2781__2784 + sizeof_y_2782__2785; + IntTy fltPrm_2828 = sizeof_y_2780__2783 + fltPrm_2829; + IntTy size_dcon_2788 = 17 + fltPrm_2828; + + *(TagTyPacked *) loc_2977 = 172; + + CursorTy writetag_5120 = loc_2977 + 1; + + *(IntTy *) writetag_5120 = size_dcon_2788; + + CursorTy writecur_5121 = writetag_5120 + sizeof(IntTy); + + *(IntTy *) writecur_5121 = offset__2786; + + CursorTy writecur_5122 = writecur_5121 + sizeof(IntTy); + + *(IntTy *) writecur_5122 = offset__2787; + + CursorTy writecur_5123 = writecur_5122 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7620, pvrtmp_7621, + loc_2977, pvrtmp_7623}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2978, end_r_2979, loc_3904, tmpcur_7447); + CursorTy pvrtmp_7632 = tmp_struct_211.field0; + CursorTy pvrtmp_7633 = tmp_struct_211.field1; + CursorTy pvrtmp_7634 = tmp_struct_211.field2; + CursorTy pvrtmp_7635 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2978, pvrtmp_7632, pvrtmp_7635, pvrtmp_7633); + CursorTy pvrtmp_7640 = tmp_struct_212.field0; + CursorTy pvrtmp_7641 = tmp_struct_212.field1; + CursorTy pvrtmp_7642 = tmp_struct_212.field2; + CursorTy pvrtmp_7643 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2978, pvrtmp_7640, pvrtmp_7643, pvrtmp_7641); + CursorTy pvrtmp_7648 = tmp_struct_213.field0; + CursorTy pvrtmp_7649 = tmp_struct_213.field1; + CursorTy pvrtmp_7650 = tmp_struct_213.field2; + CursorTy pvrtmp_7651 = tmp_struct_213.field3; + IntTy sizeof_y_2792__2795 = pvrtmp_7635 - pvrtmp_7634; + IntTy sizeof_y_2793__2796 = pvrtmp_7643 - pvrtmp_7642; + IntTy sizeof_y_2794__2797 = pvrtmp_7651 - pvrtmp_7650; + IntTy fltPrm_2830 = sizeof_y_2792__2795 + 0; + IntTy offset__2798 = 8 + fltPrm_2830; + IntTy fltPrm_2831 = sizeof_y_2792__2795 + sizeof_y_2793__2796; + IntTy offset__2799 = 0 + fltPrm_2831; + IntTy fltPrm_2833 = sizeof_y_2793__2796 + sizeof_y_2794__2797; + IntTy fltPrm_2832 = sizeof_y_2792__2795 + fltPrm_2833; + IntTy size_dcon_2800 = 17 + fltPrm_2832; + + *(TagTyPacked *) loc_2977 = 174; + + CursorTy writetag_5132 = loc_2977 + 1; + + *(IntTy *) writetag_5132 = size_dcon_2800; + + CursorTy writecur_5133 = writetag_5132 + sizeof(IntTy); + + *(IntTy *) writecur_5133 = offset__2798; + + CursorTy writecur_5134 = writecur_5133 + sizeof(IntTy); + + *(IntTy *) writecur_5134 = offset__2799; + + CursorTy writecur_5135 = writecur_5134 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7648, pvrtmp_7649, + loc_2977, pvrtmp_7651}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7660 = *(CursorTy *) tmpcur_7447; + CursorTy tmpaftercur_7661 = tmpcur_7447 + 8; + CursorTy jump_4364 = tmpcur_7447 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_2977, tmpcur_7660); + CursorTy pvrtmp_7662 = tmp_struct_214.field0; + CursorTy pvrtmp_7663 = tmp_struct_214.field1; + CursorTy pvrtmp_7664 = tmp_struct_214.field2; + CursorTy pvrtmp_7665 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7662, jump_4364, + pvrtmp_7664, pvrtmp_7665}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7672 = *(CursorTy *) tmpcur_7447; + CursorTy tmpaftercur_7673 = tmpcur_7447 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2978, end_r_2979, loc_2977, tmpcur_7672); + CursorTy pvrtmp_7674 = tmp_struct_215.field0; + CursorTy pvrtmp_7675 = tmp_struct_215.field1; + CursorTy pvrtmp_7676 = tmp_struct_215.field2; + CursorTy pvrtmp_7677 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7674, pvrtmp_7675, + pvrtmp_7676, pvrtmp_7677}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7446"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2801) +{ + if (loc_2981 + 32 > end_r_2983) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2983); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2983 = chunk_end_224; + *(TagTyPacked *) loc_2981 = 255; + + CursorTy redir = loc_2981 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2981 = chunk_start_223; + } + + CursorTy loc_3924 = loc_2981 + 1; + CursorTy loc_3925 = loc_3924 + 8; + TagTyPacked tmpval_7685 = *(TagTyPacked *) arg_2801; + CursorTy tmpcur_7686 = arg_2801 + 1; + + + switch_7729: + ; + switch (tmpval_7685) { + + case 0: + { + CursorTy jump_4232 = arg_2801 + 1; + + *(TagTyPacked *) loc_2981 = 0; + + CursorTy writetag_5147 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2983, jump_4232, + loc_2981, writetag_5147}; + break; + } + + case 1: + { + IntTy tmpval_7691 = *(IntTy *) tmpcur_7686; + CursorTy tmpcur_7692 = tmpcur_7686 + sizeof(IntTy); + CursorTy jump_4234 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_3925, tmpcur_7692); + CursorTy pvrtmp_7693 = tmp_struct_219.field0; + CursorTy pvrtmp_7694 = tmp_struct_219.field1; + CursorTy pvrtmp_7695 = tmp_struct_219.field2; + CursorTy pvrtmp_7696 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2981 = 1; + + CursorTy writetag_5152 = loc_2981 + 1; + + *(IntTy *) writetag_5152 = tmpval_7691; + + CursorTy writecur_5153 = writetag_5152 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7693, pvrtmp_7694, + loc_2981, pvrtmp_7696}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7705 = *(CursorTy *) tmpcur_7686; + CursorTy tmpaftercur_7706 = tmpcur_7686 + 8; + CursorTy jump_4370 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_2981, tmpcur_7705); + CursorTy pvrtmp_7707 = tmp_struct_220.field0; + CursorTy pvrtmp_7708 = tmp_struct_220.field1; + CursorTy pvrtmp_7709 = tmp_struct_220.field2; + CursorTy pvrtmp_7710 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7707, jump_4370, + pvrtmp_7709, pvrtmp_7710}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7717 = *(CursorTy *) tmpcur_7686; + CursorTy tmpaftercur_7718 = tmpcur_7686 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2982, end_r_2983, loc_2981, tmpcur_7717); + CursorTy pvrtmp_7719 = tmp_struct_221.field0; + CursorTy pvrtmp_7720 = tmp_struct_221.field1; + CursorTy pvrtmp_7721 = tmp_struct_221.field2; + CursorTy pvrtmp_7722 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7719, pvrtmp_7720, + pvrtmp_7721, pvrtmp_7722}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7685"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6129, ")"); + add_symbol(6130, "(Text "); + add_symbol(6131, "(Tag "); + add_symbol(6132, "(TCA "); + add_symbol(6133, "(TAC "); + add_symbol(6134, "(Nul "); + add_symbol(6135, "(Nil "); + add_symbol(6136, "(Image "); + add_symbol(6137, "(End "); + add_symbol(6138, "(Char "); + add_symbol(6139, "(CTA "); + add_symbol(6140, "(CAT "); + add_symbol(6141, "(CA "); + add_symbol(6142, "(ATC "); + add_symbol(6143, "(ACT "); + add_symbol(6144, "(AC "); + add_symbol(6145, " ->r "); + add_symbol(6146, " ->i "); + + RegionTy *region_6147 = alloc_region(global_init_inf_buf_size); + CursorTy r_2993 = region_6147->reg_heap; + IntTy sizeof_end_r_2993_6148 = global_init_inf_buf_size; + CursorTy end_r_2993 = r_2993 + sizeof_end_r_2993_6148; + RegionTy *region_6149 = alloc_region(global_init_inf_buf_size); + CursorTy r_2992 = region_6149->reg_heap; + IntTy sizeof_end_r_2992_6150 = global_init_inf_buf_size; + CursorTy end_r_2992 = r_2992 + sizeof_end_r_2992_6150; + CursorCursorCursorProd tmp_struct_225 = + mkTACList(end_r_2993, r_2993, 100000, 10, 2000); + CursorTy pvrtmp_6151 = tmp_struct_225.field0; + CursorTy pvrtmp_6152 = tmp_struct_225.field1; + CursorTy pvrtmp_6153 = tmp_struct_225.field2; + CursorTy pvrtmp_6167; + CursorTy pvrtmp_6168; + CursorTy pvrtmp_6169; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6167; + struct timespec end_pvrtmp_6167; + + start_counters(); + for (long long iters_pvrtmp_6167 = 0; iters_pvrtmp_6167 < + global_iters_param; iters_pvrtmp_6167++) { + if (iters_pvrtmp_6167 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6167); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6151, end_r_2992, r_2992, pvrtmp_6152); + CursorTy pvrtmp_6158 = tmp_struct_226.field0; + CursorTy pvrtmp_6159 = tmp_struct_226.field1; + CursorTy pvrtmp_6160 = tmp_struct_226.field2; + + pvrtmp_6167 = pvrtmp_6158; + pvrtmp_6168 = pvrtmp_6159; + pvrtmp_6169 = pvrtmp_6160; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6167); + if (iters_pvrtmp_6167 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6167, + &end_pvrtmp_6167); + + vector_inplace_update(times_230, iters_pvrtmp_6167, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTac2.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTac2.c new file mode 100644 index 000000000..0300ea9dd --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTac2.c @@ -0,0 +1,5070 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2914, CursorTy end_r_2915, + CursorTy loc_2913, + CursorTy adt_15_901_1518); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2918, CursorTy end_r_2919, + CursorTy loc_2917, + CursorTy tags_21_907_1525, + IntTy inVal_22_908_1526); +CursorCursorCursorProd mkTACList(CursorTy end_r_2921, CursorTy loc_2920, + IntTy len_25_911_1531, + IntTy tagLen_26_912_1532, + IntTy strLen_27_913_1533); +CursorCursorCursorProd mkString(CursorTy end_r_2923, CursorTy loc_2922, + IntTy len_180_1066_1539); +CursorCursorCursorProd mkContentText(CursorTy end_r_2925, CursorTy loc_2924, + IntTy n_194_1080_1545); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_319_1205_1547); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2930, + CursorTy end_r_2931, + CursorTy loc_2929, + CursorTy arg_623_1229_1552); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_628_1234_1557); +CursorProd _traverse_String(CursorTy end_r_2937, CursorTy arg_633_1239_1562); +CursorProd _print_String(CursorTy end_r_2939, CursorTy arg_638_1243_1566); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2942, + CursorTy end_r_2943, + CursorTy loc_2941, + CursorTy arg_647_1252_1575); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2946, + CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_652_1257_1580); +CursorProd _traverse_Content(CursorTy end_r_2949, CursorTy arg_657_1262_1585); +CursorProd _print_Content(CursorTy end_r_2951, CursorTy arg_662_1267_1590); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2954, CursorTy end_r_2955, + CursorTy loc_2953, + CursorTy arg_671_1276_1599); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2958, + CursorTy end_r_2959, + CursorTy loc_2957, + CursorTy arg_716_1321_1644); +CursorProd _traverse_Adt(CursorTy end_r_2961, CursorTy arg_761_1366_1689); +CursorProd _print_Adt(CursorTy end_r_2963, CursorTy arg_806_1411_1734); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2966, + CursorTy end_r_2967, CursorTy loc_2965, + CursorTy arg_869_1474_1797); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_874_1479_1802); +CursorProd _traverse_Tags(CursorTy end_r_2973, CursorTy arg_879_1484_1807); +CursorProd _print_Tags(CursorTy end_r_2975, CursorTy arg_884_1488_1811); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2978, CursorTy end_r_2979, + CursorTy loc_2977, CursorTy arg_2710); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2982, CursorTy end_r_2983, + CursorTy loc_2981, CursorTy arg_2715); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2986, + CursorTy end_r_2987, + CursorTy loc_2985, + CursorTy arg_2720); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2990, + CursorTy end_r_2991, + CursorTy loc_2989, + CursorTy arg_2809); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2914, CursorTy end_r_2915, + CursorTy loc_2913, + CursorTy adt_15_901_1518) +{ + if (loc_2913 + 32 > end_r_2915) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2915); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2915 = chunk_end_6; + *(TagTyPacked *) loc_2913 = 255; + + CursorTy redir = loc_2913 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2913 = chunk_start_5; + } + + CursorTy loc_3020 = loc_2913 + 1; + CursorTy loc_3021 = loc_3020 + 8; + CursorTy loc_3022 = loc_3021 + 8; + TagTyPacked tmpval_6193 = *(TagTyPacked *) adt_15_901_1518; + CursorTy tmpcur_6194 = adt_15_901_1518 + 1; + + + switch_6250: + ; + switch (tmpval_6193) { + + case 0: + { + CursorTy jump_3946 = adt_15_901_1518 + 1; + + *(TagTyPacked *) loc_2913 = 0; + + CursorTy writetag_4505 = loc_2913 + 1; + + return (CursorCursorCursorProd) {end_r_2915, loc_2913, + writetag_4505}; + break; + } + + case 17: + { + RegionTy *region_6199 = alloc_region(global_init_inf_buf_size); + CursorTy r_3032 = region_6199->reg_heap; + IntTy sizeof_end_r_3032_6200 = global_init_inf_buf_size; + CursorTy end_r_3032 = r_3032 + sizeof_end_r_3032_6200; + CursorTy tmpcur_6201 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6202 = tmpcur_6194 + 8; + CursorTy tmpcur_6203 = *(CursorTy *) tmpaftercur_6202; + CursorTy tmpaftercur_6204 = tmpaftercur_6202 + 8; + CursorTy jump_3949 = tmpaftercur_6202 + 8; + CursorTy jump_3948 = tmpcur_6194 + 8; + CursorCursorCursorProd tmp_struct_0 = + addValTagsAdt(end_r_2914, end_r_3032, r_3032, tmpcur_6201); + CursorTy pvrtmp_6205 = tmp_struct_0.field0; + CursorTy pvrtmp_6206 = tmp_struct_0.field1; + CursorTy pvrtmp_6207 = tmp_struct_0.field2; + CursorCursorCursorCursorProd tmp_struct_1 = + addValTag(end_r_2914, end_r_2915, loc_3022, tmpaftercur_6204, 10); + CursorTy pvrtmp_6212 = tmp_struct_1.field0; + CursorTy pvrtmp_6213 = tmp_struct_1.field1; + CursorTy pvrtmp_6214 = tmp_struct_1.field2; + CursorTy pvrtmp_6215 = tmp_struct_1.field3; + + *(TagTyPacked *) pvrtmp_6215 = 254; + + CursorTy writetag_4512 = pvrtmp_6215 + 1; + + *(CursorTy *) writetag_4512 = r_3032; + + CursorTy writecur_4513 = writetag_4512 + 8; + + *(TagTyPacked *) writecur_4513 = 254; + + CursorTy writetag_4515 = writecur_4513 + 1; + + *(CursorTy *) writetag_4515 = tmpcur_6203; + + CursorTy writecur_4516 = writetag_4515 + 8; + + *(TagTyPacked *) loc_2913 = 17; + + CursorTy writetag_4518 = loc_2913 + 1; + + *(CursorTy *) writetag_4518 = pvrtmp_6215; + + CursorTy writecur_4519 = writetag_4518 + 8; + + *(CursorTy *) writecur_4519 = writecur_4513; + + CursorTy writecur_4520 = writecur_4519 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6212, loc_2913, + writecur_4516}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6228 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6229 = tmpcur_6194 + 8; + CursorTy jump_4258 = tmpcur_6194 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2914, end_r_2915, loc_2913, tmpcur_6228); + CursorTy pvrtmp_6230 = tmp_struct_2.field0; + CursorTy pvrtmp_6231 = tmp_struct_2.field1; + CursorTy pvrtmp_6232 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6230, pvrtmp_6231, + pvrtmp_6232}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6239 = *(CursorTy *) tmpcur_6194; + CursorTy tmpaftercur_6240 = tmpcur_6194 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2914, end_r_2915, loc_2913, tmpcur_6239); + CursorTy pvrtmp_6241 = tmp_struct_3.field0; + CursorTy pvrtmp_6242 = tmp_struct_3.field1; + CursorTy pvrtmp_6243 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6241, pvrtmp_6242, + pvrtmp_6243}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6193"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2918, CursorTy end_r_2919, + CursorTy loc_2917, + CursorTy tags_21_907_1525, + IntTy inVal_22_908_1526) +{ + if (loc_2917 + 32 > end_r_2919) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2919); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2919 = chunk_end_12; + *(TagTyPacked *) loc_2917 = 255; + + CursorTy redir = loc_2917 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2917 = chunk_start_11; + } + + CursorTy loc_3041 = loc_2917 + 1; + CursorTy loc_3042 = loc_3041 + 8; + TagTyPacked tmpval_6251 = *(TagTyPacked *) tags_21_907_1525; + CursorTy tmpcur_6252 = tags_21_907_1525 + 1; + + + switch_6295: + ; + switch (tmpval_6251) { + + case 0: + { + CursorTy jump_3952 = tags_21_907_1525 + 1; + + *(TagTyPacked *) loc_2917 = 0; + + CursorTy writetag_4532 = loc_2917 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2919, jump_3952, + loc_2917, writetag_4532}; + break; + } + + case 1: + { + IntTy tmpval_6257 = *(IntTy *) tmpcur_6252; + CursorTy tmpcur_6258 = tmpcur_6252 + sizeof(IntTy); + CursorTy jump_3954 = tmpcur_6252 + 8; + IntTy fltPkd_1506_1529 = tmpval_6257 + inVal_22_908_1526; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2918, end_r_2919, loc_3042, tmpcur_6258, inVal_22_908_1526); + CursorTy pvrtmp_6259 = tmp_struct_7.field0; + CursorTy pvrtmp_6260 = tmp_struct_7.field1; + CursorTy pvrtmp_6261 = tmp_struct_7.field2; + CursorTy pvrtmp_6262 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2917 = 1; + + CursorTy writetag_4537 = loc_2917 + 1; + + *(IntTy *) writetag_4537 = fltPkd_1506_1529; + + CursorTy writecur_4538 = writetag_4537 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6259, pvrtmp_6260, + loc_2917, pvrtmp_6262}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6271 = *(CursorTy *) tmpcur_6252; + CursorTy tmpaftercur_6272 = tmpcur_6252 + 8; + CursorTy jump_4263 = tmpcur_6252 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2918, end_r_2919, loc_2917, tmpcur_6271, inVal_22_908_1526); + CursorTy pvrtmp_6273 = tmp_struct_8.field0; + CursorTy pvrtmp_6274 = tmp_struct_8.field1; + CursorTy pvrtmp_6275 = tmp_struct_8.field2; + CursorTy pvrtmp_6276 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6273, jump_4263, + pvrtmp_6275, pvrtmp_6276}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6283 = *(CursorTy *) tmpcur_6252; + CursorTy tmpaftercur_6284 = tmpcur_6252 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2918, end_r_2919, loc_2917, tmpcur_6283, inVal_22_908_1526); + CursorTy pvrtmp_6285 = tmp_struct_9.field0; + CursorTy pvrtmp_6286 = tmp_struct_9.field1; + CursorTy pvrtmp_6287 = tmp_struct_9.field2; + CursorTy pvrtmp_6288 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6285, pvrtmp_6286, + pvrtmp_6287, pvrtmp_6288}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6251"); + exit(1); + } + } +} +CursorCursorCursorProd mkTACList(CursorTy end_r_2921, CursorTy loc_2920, + IntTy len_25_911_1531, + IntTy tagLen_26_912_1532, + IntTy strLen_27_913_1533) +{ + if (loc_2920 + 32 > end_r_2921) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2921); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2921 = chunk_end_18; + *(TagTyPacked *) loc_2920 = 255; + + CursorTy redir = loc_2920 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2920 = chunk_start_17; + } + + CursorTy loc_3050 = loc_2920 + 1; + CursorTy loc_3051 = loc_3050 + 8; + CursorTy loc_3052 = loc_3051 + 8; + BoolTy fltIf_1508_1534 = len_25_911_1531 <= 0; + + if (fltIf_1508_1534) { + *(TagTyPacked *) loc_2920 = 0; + + CursorTy writetag_4547 = loc_2920 + 1; + + return (CursorCursorCursorProd) {end_r_2921, loc_2920, writetag_4547}; + } else { + CursorCursorCursorProd tmp_struct_13 = + mkRandomTags(end_r_2921, loc_3052, tagLen_26_912_1532); + CursorTy pvrtmp_6300 = tmp_struct_13.field0; + CursorTy pvrtmp_6301 = tmp_struct_13.field1; + CursorTy pvrtmp_6302 = tmp_struct_13.field2; + IntTy fltAppE_1509_1536 = len_25_911_1531 - 1; + CursorCursorCursorProd tmp_struct_14 = + mkTACList(pvrtmp_6300, pvrtmp_6302, fltAppE_1509_1536, tagLen_26_912_1532, strLen_27_913_1533); + CursorTy pvrtmp_6307 = tmp_struct_14.field0; + CursorTy pvrtmp_6308 = tmp_struct_14.field1; + CursorTy pvrtmp_6309 = tmp_struct_14.field2; + CursorCursorCursorProd tmp_struct_15 = + mkContentText(pvrtmp_6307, pvrtmp_6309, strLen_27_913_1533); + CursorTy pvrtmp_6314 = tmp_struct_15.field0; + CursorTy pvrtmp_6315 = tmp_struct_15.field1; + CursorTy pvrtmp_6316 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2920 = 17; + + CursorTy writetag_4552 = loc_2920 + 1; + + *(CursorTy *) writetag_4552 = pvrtmp_6302; + + CursorTy writecur_4553 = writetag_4552 + 8; + + *(CursorTy *) writecur_4553 = pvrtmp_6309; + + CursorTy writecur_4554 = writecur_4553 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6314, loc_2920, pvrtmp_6316}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2923, CursorTy loc_2922, + IntTy len_180_1066_1539) +{ + if (loc_2922 + 32 > end_r_2923) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2923); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2923 = chunk_end_22; + *(TagTyPacked *) loc_2922 = 255; + + CursorTy redir = loc_2922 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2922 = chunk_start_21; + } + + CursorTy loc_3064 = loc_2922 + 1; + CursorTy loc_3065 = loc_3064 + 8; + BoolTy fltIf_1510_1540 = len_180_1066_1539 <= 0; + + if (fltIf_1510_1540) { + *(TagTyPacked *) loc_2922 = 0; + + CursorTy writetag_4559 = loc_2922 + 1; + + return (CursorCursorCursorProd) {end_r_2923, loc_2922, writetag_4559}; + } else { + IntTy fltPrm_1511_1541 = rand(); + IntTy randomChar_181_1067_1542 = fltPrm_1511_1541 % 128; + IntTy fltAppE_1512_1543 = len_180_1066_1539 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2923, loc_3065, fltAppE_1512_1543); + CursorTy pvrtmp_6329 = tmp_struct_19.field0; + CursorTy pvrtmp_6330 = tmp_struct_19.field1; + CursorTy pvrtmp_6331 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2922 = 1; + + CursorTy writetag_4562 = loc_2922 + 1; + + *(IntTy *) writetag_4562 = randomChar_181_1067_1542; + + CursorTy writecur_4563 = writetag_4562 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6329, loc_2922, pvrtmp_6331}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2925, CursorTy loc_2924, + IntTy n_194_1080_1545) +{ + if (loc_2924 + 32 > end_r_2925) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2925); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2925 = chunk_end_26; + *(TagTyPacked *) loc_2924 = 255; + + CursorTy redir = loc_2924 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2924 = chunk_start_25; + } + + CursorTy loc_3070 = loc_2924 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2925, loc_3070, n_194_1080_1545); + CursorTy pvrtmp_6340 = tmp_struct_23.field0; + CursorTy pvrtmp_6341 = tmp_struct_23.field1; + CursorTy pvrtmp_6342 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2924 = 1; + + CursorTy writetag_4567 = loc_2924 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6340, loc_2924, pvrtmp_6342}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_319_1205_1547) +{ + if (loc_2926 + 32 > end_r_2927) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2927); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2927 = chunk_end_30; + *(TagTyPacked *) loc_2926 = 255; + + CursorTy redir = loc_2926 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2926 = chunk_start_29; + } + + CursorTy loc_3074 = loc_2926 + 1; + CursorTy loc_3075 = loc_3074 + 8; + BoolTy fltIf_1514_1548 = len_319_1205_1547 <= 0; + + if (fltIf_1514_1548) { + *(TagTyPacked *) loc_2926 = 0; + + CursorTy writetag_4570 = loc_2926 + 1; + + return (CursorCursorCursorProd) {end_r_2927, loc_2926, writetag_4570}; + } else { + IntTy fltAppE_1515_1550 = len_319_1205_1547 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2927, loc_3075, fltAppE_1515_1550); + CursorTy pvrtmp_6355 = tmp_struct_27.field0; + CursorTy pvrtmp_6356 = tmp_struct_27.field1; + CursorTy pvrtmp_6357 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2926 = 1; + + CursorTy writetag_4573 = loc_2926 + 1; + + *(IntTy *) writetag_4573 = 100; + + CursorTy writecur_4574 = writetag_4573 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6355, loc_2926, pvrtmp_6357}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2930, + CursorTy end_r_2931, + CursorTy loc_2929, + CursorTy arg_623_1229_1552) +{ + if (loc_2929 + 32 > end_r_2931) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2931); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2931 = chunk_end_36; + *(TagTyPacked *) loc_2929 = 255; + + CursorTy redir = loc_2929 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2929 = chunk_start_35; + } + + CursorTy loc_3085 = loc_2929 + 1; + CursorTy loc_3086 = loc_3085 + 8; + TagTyPacked tmpval_6366 = *(TagTyPacked *) arg_623_1229_1552; + CursorTy tmpcur_6367 = arg_623_1229_1552 + 1; + + + switch_6410: + ; + switch (tmpval_6366) { + + case 0: + { + CursorTy jump_3964 = arg_623_1229_1552 + 1; + + *(TagTyPacked *) loc_2929 = 0; + + CursorTy writetag_4578 = loc_2929 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2931, jump_3964, + loc_2929, writetag_4578}; + break; + } + + case 1: + { + IntTy tmpval_6372 = *(IntTy *) tmpcur_6367; + CursorTy tmpcur_6373 = tmpcur_6367 + sizeof(IntTy); + CursorTy jump_3966 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2930, end_r_2931, loc_3086, tmpcur_6373); + CursorTy pvrtmp_6374 = tmp_struct_31.field0; + CursorTy pvrtmp_6375 = tmp_struct_31.field1; + CursorTy pvrtmp_6376 = tmp_struct_31.field2; + CursorTy pvrtmp_6377 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2929 = 1; + + CursorTy writetag_4583 = loc_2929 + 1; + + *(IntTy *) writetag_4583 = tmpval_6372; + + CursorTy writecur_4584 = writetag_4583 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6374, pvrtmp_6375, + loc_2929, pvrtmp_6377}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6386 = *(CursorTy *) tmpcur_6367; + CursorTy tmpaftercur_6387 = tmpcur_6367 + 8; + CursorTy jump_4269 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2930, end_r_2931, loc_2929, tmpcur_6386); + CursorTy pvrtmp_6388 = tmp_struct_32.field0; + CursorTy pvrtmp_6389 = tmp_struct_32.field1; + CursorTy pvrtmp_6390 = tmp_struct_32.field2; + CursorTy pvrtmp_6391 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6388, jump_4269, + pvrtmp_6390, pvrtmp_6391}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6398 = *(CursorTy *) tmpcur_6367; + CursorTy tmpaftercur_6399 = tmpcur_6367 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2930, end_r_2931, loc_2929, tmpcur_6398); + CursorTy pvrtmp_6400 = tmp_struct_33.field0; + CursorTy pvrtmp_6401 = tmp_struct_33.field1; + CursorTy pvrtmp_6402 = tmp_struct_33.field2; + CursorTy pvrtmp_6403 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6400, pvrtmp_6401, + pvrtmp_6402, pvrtmp_6403}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6366"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2934, + CursorTy end_r_2935, + CursorTy loc_2933, + CursorTy arg_628_1234_1557) +{ + CursorTy loc_3098 = loc_2933 + 1; + CursorTy loc_3099 = loc_3098 + 8; + TagTyPacked tmpval_6411 = *(TagTyPacked *) arg_628_1234_1557; + CursorTy tmpcur_6412 = arg_628_1234_1557 + 1; + + + switch_6455: + ; + switch (tmpval_6411) { + + case 0: + { + CursorTy jump_3969 = arg_628_1234_1557 + 1; + + *(TagTyPacked *) loc_2933 = 0; + + CursorTy writetag_4594 = loc_2933 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2935, jump_3969, + loc_2933, writetag_4594}; + break; + } + + case 1: + { + IntTy tmpval_6417 = *(IntTy *) tmpcur_6412; + CursorTy tmpcur_6418 = tmpcur_6412 + sizeof(IntTy); + CursorTy jump_3971 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_3099, tmpcur_6418); + CursorTy pvrtmp_6419 = tmp_struct_37.field0; + CursorTy pvrtmp_6420 = tmp_struct_37.field1; + CursorTy pvrtmp_6421 = tmp_struct_37.field2; + CursorTy pvrtmp_6422 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2933 = 1; + + CursorTy writetag_4599 = loc_2933 + 1; + + *(IntTy *) writetag_4599 = tmpval_6417; + + CursorTy writecur_4600 = writetag_4599 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6419, pvrtmp_6420, + loc_2933, pvrtmp_6422}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6431 = *(CursorTy *) tmpcur_6412; + CursorTy tmpaftercur_6432 = tmpcur_6412 + 8; + CursorTy jump_4275 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_2933, tmpcur_6431); + CursorTy pvrtmp_6433 = tmp_struct_38.field0; + CursorTy pvrtmp_6434 = tmp_struct_38.field1; + CursorTy pvrtmp_6435 = tmp_struct_38.field2; + CursorTy pvrtmp_6436 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6433, jump_4275, + pvrtmp_6435, pvrtmp_6436}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6443 = *(CursorTy *) tmpcur_6412; + CursorTy tmpaftercur_6444 = tmpcur_6412 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2934, end_r_2935, loc_2933, tmpcur_6443); + CursorTy pvrtmp_6445 = tmp_struct_39.field0; + CursorTy pvrtmp_6446 = tmp_struct_39.field1; + CursorTy pvrtmp_6447 = tmp_struct_39.field2; + CursorTy pvrtmp_6448 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6445, pvrtmp_6446, + pvrtmp_6447, pvrtmp_6448}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6411"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2937, CursorTy arg_633_1239_1562) +{ + TagTyPacked tmpval_6456 = *(TagTyPacked *) arg_633_1239_1562; + CursorTy tmpcur_6457 = arg_633_1239_1562 + 1; + + + switch_6467: + ; + switch (tmpval_6456) { + + case 0: + { + CursorTy jump_3974 = arg_633_1239_1562 + 1; + + return (CursorProd) {jump_3974}; + break; + } + + case 1: + { + IntTy tmpval_6458 = *(IntTy *) tmpcur_6457; + CursorTy tmpcur_6459 = tmpcur_6457 + sizeof(IntTy); + CursorTy jump_3976 = tmpcur_6457 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2937, tmpcur_6459); + CursorTy pvrtmp_6460 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6460}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6461 = *(CursorTy *) tmpcur_6457; + CursorTy tmpaftercur_6462 = tmpcur_6457 + 8; + CursorTy jump_4281 = tmpcur_6457 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2937, tmpcur_6461); + CursorTy pvrtmp_6463 = tmp_struct_41.field0; + + return (CursorProd) {jump_4281}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6464 = *(CursorTy *) tmpcur_6457; + CursorTy tmpaftercur_6465 = tmpcur_6457 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2937, tmpcur_6464); + CursorTy pvrtmp_6466 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6466}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6456"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2939, CursorTy arg_638_1243_1566) +{ + TagTyPacked tmpval_6468 = *(TagTyPacked *) arg_638_1243_1566; + CursorTy tmpcur_6469 = arg_638_1243_1566 + 1; + + + switch_6479: + ; + switch (tmpval_6468) { + + case 0: + { + CursorTy jump_3979 = arg_638_1243_1566 + 1; + unsigned char wildcard_639_1244_1567 = print_symbol(6153); + unsigned char wildcard_640_1245_1568 = print_symbol(6145); + + return (CursorProd) {jump_3979}; + break; + } + + case 1: + { + IntTy tmpval_6470 = *(IntTy *) tmpcur_6469; + CursorTy tmpcur_6471 = tmpcur_6469 + sizeof(IntTy); + CursorTy jump_3981 = tmpcur_6469 + 8; + unsigned char wildcard_645_1248_1571 = print_symbol(6154); + unsigned char y_643_1249_1572 = printf("%lld", tmpval_6470); + CursorProd tmp_struct_43 = _print_String(end_r_2939, tmpcur_6471); + CursorTy pvrtmp_6472 = tmp_struct_43.field0; + unsigned char wildcard_646_1251_1574 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6472}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6473 = *(CursorTy *) tmpcur_6469; + CursorTy tmpaftercur_6474 = tmpcur_6469 + 8; + CursorTy jump_4287 = tmpcur_6469 + 8; + unsigned char wildcard_4290 = print_symbol(6162); + CursorProd tmp_struct_44 = _print_String(end_r_2939, tmpcur_6473); + CursorTy pvrtmp_6475 = tmp_struct_44.field0; + + return (CursorProd) {jump_4287}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6476 = *(CursorTy *) tmpcur_6469; + CursorTy tmpaftercur_6477 = tmpcur_6469 + 8; + unsigned char wildcard_4290 = print_symbol(6161); + CursorProd tmp_struct_45 = _print_String(end_r_2939, tmpcur_6476); + CursorTy pvrtmp_6478 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6478}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6468"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2942, + CursorTy end_r_2943, + CursorTy loc_2941, + CursorTy arg_647_1252_1575) +{ + if (loc_2941 + 32 > end_r_2943) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2943); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2943 = chunk_end_52; + *(TagTyPacked *) loc_2941 = 255; + + CursorTy redir = loc_2941 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2941 = chunk_start_51; + } + + TagTyPacked tmpval_6480 = *(TagTyPacked *) arg_647_1252_1575; + CursorTy tmpcur_6481 = arg_647_1252_1575 + 1; + + + switch_6530: + ; + switch (tmpval_6480) { + + case 0: + { + CursorTy loc_3121 = loc_2941 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2942, end_r_2943, loc_3121, tmpcur_6481); + CursorTy pvrtmp_6482 = tmp_struct_46.field0; + CursorTy pvrtmp_6483 = tmp_struct_46.field1; + CursorTy pvrtmp_6484 = tmp_struct_46.field2; + CursorTy pvrtmp_6485 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2941 = 0; + + CursorTy writetag_4631 = loc_2941 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6482, pvrtmp_6483, + loc_2941, pvrtmp_6485}; + break; + } + + case 1: + { + CursorTy loc_3127 = loc_2941 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2942, end_r_2943, loc_3127, tmpcur_6481); + CursorTy pvrtmp_6494 = tmp_struct_47.field0; + CursorTy pvrtmp_6495 = tmp_struct_47.field1; + CursorTy pvrtmp_6496 = tmp_struct_47.field2; + CursorTy pvrtmp_6497 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2941 = 1; + + CursorTy writetag_4636 = loc_2941 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6494, pvrtmp_6495, + loc_2941, pvrtmp_6497}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6506 = *(CursorTy *) tmpcur_6481; + CursorTy tmpaftercur_6507 = tmpcur_6481 + 8; + CursorTy jump_4293 = tmpcur_6481 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2942, end_r_2943, loc_2941, tmpcur_6506); + CursorTy pvrtmp_6508 = tmp_struct_48.field0; + CursorTy pvrtmp_6509 = tmp_struct_48.field1; + CursorTy pvrtmp_6510 = tmp_struct_48.field2; + CursorTy pvrtmp_6511 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6508, jump_4293, + pvrtmp_6510, pvrtmp_6511}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6518 = *(CursorTy *) tmpcur_6481; + CursorTy tmpaftercur_6519 = tmpcur_6481 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2942, end_r_2943, loc_2941, tmpcur_6518); + CursorTy pvrtmp_6520 = tmp_struct_49.field0; + CursorTy pvrtmp_6521 = tmp_struct_49.field1; + CursorTy pvrtmp_6522 = tmp_struct_49.field2; + CursorTy pvrtmp_6523 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6520, pvrtmp_6521, + pvrtmp_6522, pvrtmp_6523}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6480"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2946, + CursorTy end_r_2947, + CursorTy loc_2945, + CursorTy arg_652_1257_1580) +{ + TagTyPacked tmpval_6531 = *(TagTyPacked *) arg_652_1257_1580; + CursorTy tmpcur_6532 = arg_652_1257_1580 + 1; + + + switch_6581: + ; + switch (tmpval_6531) { + + case 0: + { + CursorTy loc_3135 = loc_2945 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2946, end_r_2947, loc_3135, tmpcur_6532); + CursorTy pvrtmp_6533 = tmp_struct_53.field0; + CursorTy pvrtmp_6534 = tmp_struct_53.field1; + CursorTy pvrtmp_6535 = tmp_struct_53.field2; + CursorTy pvrtmp_6536 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2945 = 0; + + CursorTy writetag_4647 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6533, pvrtmp_6534, + loc_2945, pvrtmp_6536}; + break; + } + + case 1: + { + CursorTy loc_3141 = loc_2945 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2946, end_r_2947, loc_3141, tmpcur_6532); + CursorTy pvrtmp_6545 = tmp_struct_54.field0; + CursorTy pvrtmp_6546 = tmp_struct_54.field1; + CursorTy pvrtmp_6547 = tmp_struct_54.field2; + CursorTy pvrtmp_6548 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2945 = 1; + + CursorTy writetag_4652 = loc_2945 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6545, pvrtmp_6546, + loc_2945, pvrtmp_6548}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6557 = *(CursorTy *) tmpcur_6532; + CursorTy tmpaftercur_6558 = tmpcur_6532 + 8; + CursorTy jump_4299 = tmpcur_6532 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2946, end_r_2947, loc_2945, tmpcur_6557); + CursorTy pvrtmp_6559 = tmp_struct_55.field0; + CursorTy pvrtmp_6560 = tmp_struct_55.field1; + CursorTy pvrtmp_6561 = tmp_struct_55.field2; + CursorTy pvrtmp_6562 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6559, jump_4299, + pvrtmp_6561, pvrtmp_6562}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6569 = *(CursorTy *) tmpcur_6532; + CursorTy tmpaftercur_6570 = tmpcur_6532 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2946, end_r_2947, loc_2945, tmpcur_6569); + CursorTy pvrtmp_6571 = tmp_struct_56.field0; + CursorTy pvrtmp_6572 = tmp_struct_56.field1; + CursorTy pvrtmp_6573 = tmp_struct_56.field2; + CursorTy pvrtmp_6574 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6571, pvrtmp_6572, + pvrtmp_6573, pvrtmp_6574}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6531"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2949, CursorTy arg_657_1262_1585) +{ + TagTyPacked tmpval_6582 = *(TagTyPacked *) arg_657_1262_1585; + CursorTy tmpcur_6583 = arg_657_1262_1585 + 1; + + + switch_6592: + ; + switch (tmpval_6582) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2949, tmpcur_6583); + CursorTy pvrtmp_6584 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6584}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2949, tmpcur_6583); + CursorTy pvrtmp_6585 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6585}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6586 = *(CursorTy *) tmpcur_6583; + CursorTy tmpaftercur_6587 = tmpcur_6583 + 8; + CursorTy jump_4305 = tmpcur_6583 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2949, tmpcur_6586); + CursorTy pvrtmp_6588 = tmp_struct_59.field0; + + return (CursorProd) {jump_4305}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6589 = *(CursorTy *) tmpcur_6583; + CursorTy tmpaftercur_6590 = tmpcur_6583 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2949, tmpcur_6589); + CursorTy pvrtmp_6591 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6591}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6582"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2951, CursorTy arg_662_1267_1590) +{ + TagTyPacked tmpval_6593 = *(TagTyPacked *) arg_662_1267_1590; + CursorTy tmpcur_6594 = arg_662_1267_1590 + 1; + + + switch_6603: + ; + switch (tmpval_6593) { + + case 0: + { + unsigned char wildcard_665_1269_1592 = print_symbol(6152); + CursorProd tmp_struct_61 = _print_String(end_r_2951, tmpcur_6594); + CursorTy pvrtmp_6595 = tmp_struct_61.field0; + unsigned char wildcard_666_1271_1594 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6595}; + break; + } + + case 1: + { + unsigned char wildcard_669_1273_1596 = print_symbol(6146); + CursorProd tmp_struct_62 = _print_String(end_r_2951, tmpcur_6594); + CursorTy pvrtmp_6596 = tmp_struct_62.field0; + unsigned char wildcard_670_1275_1598 = print_symbol(6145); + + return (CursorProd) {pvrtmp_6596}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6597 = *(CursorTy *) tmpcur_6594; + CursorTy tmpaftercur_6598 = tmpcur_6594 + 8; + CursorTy jump_4311 = tmpcur_6594 + 8; + unsigned char wildcard_4314 = print_symbol(6162); + CursorProd tmp_struct_63 = _print_Content(end_r_2951, tmpcur_6597); + CursorTy pvrtmp_6599 = tmp_struct_63.field0; + + return (CursorProd) {jump_4311}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6600 = *(CursorTy *) tmpcur_6594; + CursorTy tmpaftercur_6601 = tmpcur_6594 + 8; + unsigned char wildcard_4314 = print_symbol(6161); + CursorProd tmp_struct_64 = _print_Content(end_r_2951, tmpcur_6600); + CursorTy pvrtmp_6602 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6602}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6593"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2954, CursorTy end_r_2955, + CursorTy loc_2953, + CursorTy arg_671_1276_1599) +{ + if (loc_2953 + 32 > end_r_2955) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2955); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2955 = chunk_end_91; + *(TagTyPacked *) loc_2953 = 255; + + CursorTy redir = loc_2953 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2953 = chunk_start_90; + } + + CursorTy loc_3171 = loc_2953 + 1; + CursorTy loc_3172 = loc_3171 + 8; + CursorTy loc_3187 = loc_2953 + 1; + CursorTy loc_3188 = loc_3187 + 8; + CursorTy loc_3208 = loc_2953 + 1; + CursorTy loc_3209 = loc_3208 + 8; + CursorTy loc_3210 = loc_3209 + 8; + CursorTy loc_3234 = loc_2953 + 1; + CursorTy loc_3235 = loc_3234 + 8; + CursorTy loc_3236 = loc_3235 + 8; + CursorTy loc_3260 = loc_2953 + 1; + CursorTy loc_3261 = loc_3260 + 8; + CursorTy loc_3262 = loc_3261 + 8; + CursorTy loc_3286 = loc_2953 + 1; + CursorTy loc_3287 = loc_3286 + 8; + CursorTy loc_3288 = loc_3287 + 8; + CursorTy loc_3312 = loc_2953 + 1; + CursorTy loc_3313 = loc_3312 + 8; + CursorTy loc_3314 = loc_3313 + 8; + CursorTy loc_3338 = loc_2953 + 1; + CursorTy loc_3339 = loc_3338 + 8; + CursorTy loc_3340 = loc_3339 + 8; + TagTyPacked tmpval_6604 = *(TagTyPacked *) arg_671_1276_1599; + CursorTy tmpcur_6605 = arg_671_1276_1599 + 1; + + + switch_6870: + ; + switch (tmpval_6604) { + + case 0: + { + CursorTy jump_4000 = arg_671_1276_1599 + 1; + + *(TagTyPacked *) loc_2953 = 0; + + CursorTy writetag_4682 = loc_2953 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2955, jump_4000, + loc_2953, writetag_4682}; + break; + } + + case 9: + { + CursorTy tmpcur_6610 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6611 = tmpcur_6605 + 8; + CursorTy jump_4002 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2954, end_r_2955, loc_3172, tmpaftercur_6611); + CursorTy pvrtmp_6612 = tmp_struct_65.field0; + CursorTy pvrtmp_6613 = tmp_struct_65.field1; + CursorTy pvrtmp_6614 = tmp_struct_65.field2; + CursorTy pvrtmp_6615 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2954, pvrtmp_6612, pvrtmp_6615, tmpcur_6610); + CursorTy pvrtmp_6620 = tmp_struct_66.field0; + CursorTy pvrtmp_6621 = tmp_struct_66.field1; + CursorTy pvrtmp_6622 = tmp_struct_66.field2; + CursorTy pvrtmp_6623 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2953 = 9; + + CursorTy writetag_4688 = loc_2953 + 1; + + *(CursorTy *) writetag_4688 = pvrtmp_6615; + + CursorTy writecur_4689 = writetag_4688 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6620, pvrtmp_6621, + loc_2953, pvrtmp_6623}; + break; + } + + case 11: + { + CursorTy tmpcur_6632 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6633 = tmpcur_6605 + 8; + CursorTy jump_4006 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2954, end_r_2955, loc_3188, tmpaftercur_6633); + CursorTy pvrtmp_6634 = tmp_struct_67.field0; + CursorTy pvrtmp_6635 = tmp_struct_67.field1; + CursorTy pvrtmp_6636 = tmp_struct_67.field2; + CursorTy pvrtmp_6637 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2954, pvrtmp_6634, pvrtmp_6637, tmpcur_6632); + CursorTy pvrtmp_6642 = tmp_struct_68.field0; + CursorTy pvrtmp_6643 = tmp_struct_68.field1; + CursorTy pvrtmp_6644 = tmp_struct_68.field2; + CursorTy pvrtmp_6645 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2953 = 11; + + CursorTy writetag_4697 = loc_2953 + 1; + + *(CursorTy *) writetag_4697 = pvrtmp_6637; + + CursorTy writecur_4698 = writetag_4697 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6642, pvrtmp_6643, + loc_2953, pvrtmp_6645}; + break; + } + + case 13: + { + CursorTy tmpcur_6654 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6655 = tmpcur_6605 + 8; + CursorTy tmpcur_6656 = *(CursorTy *) tmpaftercur_6655; + CursorTy tmpaftercur_6657 = tmpaftercur_6655 + 8; + CursorTy jump_4011 = tmpaftercur_6655 + 8; + CursorTy jump_4010 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2954, end_r_2955, loc_3210, tmpaftercur_6657); + CursorTy pvrtmp_6658 = tmp_struct_69.field0; + CursorTy pvrtmp_6659 = tmp_struct_69.field1; + CursorTy pvrtmp_6660 = tmp_struct_69.field2; + CursorTy pvrtmp_6661 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2954, pvrtmp_6658, pvrtmp_6661, tmpcur_6654); + CursorTy pvrtmp_6666 = tmp_struct_70.field0; + CursorTy pvrtmp_6667 = tmp_struct_70.field1; + CursorTy pvrtmp_6668 = tmp_struct_70.field2; + CursorTy pvrtmp_6669 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2954, pvrtmp_6666, pvrtmp_6669, tmpcur_6656); + CursorTy pvrtmp_6674 = tmp_struct_71.field0; + CursorTy pvrtmp_6675 = tmp_struct_71.field1; + CursorTy pvrtmp_6676 = tmp_struct_71.field2; + CursorTy pvrtmp_6677 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2953 = 13; + + CursorTy writetag_4708 = loc_2953 + 1; + + *(CursorTy *) writetag_4708 = pvrtmp_6661; + + CursorTy writecur_4709 = writetag_4708 + 8; + + *(CursorTy *) writecur_4709 = pvrtmp_6669; + + CursorTy writecur_4710 = writecur_4709 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6674, pvrtmp_6675, + loc_2953, pvrtmp_6677}; + break; + } + + case 15: + { + CursorTy tmpcur_6686 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6687 = tmpcur_6605 + 8; + CursorTy tmpcur_6688 = *(CursorTy *) tmpaftercur_6687; + CursorTy tmpaftercur_6689 = tmpaftercur_6687 + 8; + CursorTy jump_4017 = tmpaftercur_6687 + 8; + CursorTy jump_4016 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2954, end_r_2955, loc_3236, tmpaftercur_6689); + CursorTy pvrtmp_6690 = tmp_struct_72.field0; + CursorTy pvrtmp_6691 = tmp_struct_72.field1; + CursorTy pvrtmp_6692 = tmp_struct_72.field2; + CursorTy pvrtmp_6693 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2954, pvrtmp_6690, pvrtmp_6693, tmpcur_6686); + CursorTy pvrtmp_6698 = tmp_struct_73.field0; + CursorTy pvrtmp_6699 = tmp_struct_73.field1; + CursorTy pvrtmp_6700 = tmp_struct_73.field2; + CursorTy pvrtmp_6701 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2954, pvrtmp_6698, pvrtmp_6701, tmpcur_6688); + CursorTy pvrtmp_6706 = tmp_struct_74.field0; + CursorTy pvrtmp_6707 = tmp_struct_74.field1; + CursorTy pvrtmp_6708 = tmp_struct_74.field2; + CursorTy pvrtmp_6709 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2953 = 15; + + CursorTy writetag_4721 = loc_2953 + 1; + + *(CursorTy *) writetag_4721 = pvrtmp_6693; + + CursorTy writecur_4722 = writetag_4721 + 8; + + *(CursorTy *) writecur_4722 = pvrtmp_6701; + + CursorTy writecur_4723 = writecur_4722 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6706, pvrtmp_6707, + loc_2953, pvrtmp_6709}; + break; + } + + case 17: + { + CursorTy tmpcur_6718 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6719 = tmpcur_6605 + 8; + CursorTy tmpcur_6720 = *(CursorTy *) tmpaftercur_6719; + CursorTy tmpaftercur_6721 = tmpaftercur_6719 + 8; + CursorTy jump_4023 = tmpaftercur_6719 + 8; + CursorTy jump_4022 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2954, end_r_2955, loc_3262, tmpaftercur_6721); + CursorTy pvrtmp_6722 = tmp_struct_75.field0; + CursorTy pvrtmp_6723 = tmp_struct_75.field1; + CursorTy pvrtmp_6724 = tmp_struct_75.field2; + CursorTy pvrtmp_6725 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2954, pvrtmp_6722, pvrtmp_6725, tmpcur_6718); + CursorTy pvrtmp_6730 = tmp_struct_76.field0; + CursorTy pvrtmp_6731 = tmp_struct_76.field1; + CursorTy pvrtmp_6732 = tmp_struct_76.field2; + CursorTy pvrtmp_6733 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2954, pvrtmp_6730, pvrtmp_6733, tmpcur_6720); + CursorTy pvrtmp_6738 = tmp_struct_77.field0; + CursorTy pvrtmp_6739 = tmp_struct_77.field1; + CursorTy pvrtmp_6740 = tmp_struct_77.field2; + CursorTy pvrtmp_6741 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2953 = 17; + + CursorTy writetag_4734 = loc_2953 + 1; + + *(CursorTy *) writetag_4734 = pvrtmp_6725; + + CursorTy writecur_4735 = writetag_4734 + 8; + + *(CursorTy *) writecur_4735 = pvrtmp_6733; + + CursorTy writecur_4736 = writecur_4735 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6738, pvrtmp_6739, + loc_2953, pvrtmp_6741}; + break; + } + + case 19: + { + CursorTy tmpcur_6750 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6751 = tmpcur_6605 + 8; + CursorTy tmpcur_6752 = *(CursorTy *) tmpaftercur_6751; + CursorTy tmpaftercur_6753 = tmpaftercur_6751 + 8; + CursorTy jump_4029 = tmpaftercur_6751 + 8; + CursorTy jump_4028 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2954, end_r_2955, loc_3288, tmpaftercur_6753); + CursorTy pvrtmp_6754 = tmp_struct_78.field0; + CursorTy pvrtmp_6755 = tmp_struct_78.field1; + CursorTy pvrtmp_6756 = tmp_struct_78.field2; + CursorTy pvrtmp_6757 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2954, pvrtmp_6754, pvrtmp_6757, tmpcur_6750); + CursorTy pvrtmp_6762 = tmp_struct_79.field0; + CursorTy pvrtmp_6763 = tmp_struct_79.field1; + CursorTy pvrtmp_6764 = tmp_struct_79.field2; + CursorTy pvrtmp_6765 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2954, pvrtmp_6762, pvrtmp_6765, tmpcur_6752); + CursorTy pvrtmp_6770 = tmp_struct_80.field0; + CursorTy pvrtmp_6771 = tmp_struct_80.field1; + CursorTy pvrtmp_6772 = tmp_struct_80.field2; + CursorTy pvrtmp_6773 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2953 = 19; + + CursorTy writetag_4747 = loc_2953 + 1; + + *(CursorTy *) writetag_4747 = pvrtmp_6757; + + CursorTy writecur_4748 = writetag_4747 + 8; + + *(CursorTy *) writecur_4748 = pvrtmp_6765; + + CursorTy writecur_4749 = writecur_4748 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6770, pvrtmp_6771, + loc_2953, pvrtmp_6773}; + break; + } + + case 21: + { + CursorTy tmpcur_6782 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6783 = tmpcur_6605 + 8; + CursorTy tmpcur_6784 = *(CursorTy *) tmpaftercur_6783; + CursorTy tmpaftercur_6785 = tmpaftercur_6783 + 8; + CursorTy jump_4035 = tmpaftercur_6783 + 8; + CursorTy jump_4034 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2954, end_r_2955, loc_3314, tmpaftercur_6785); + CursorTy pvrtmp_6786 = tmp_struct_81.field0; + CursorTy pvrtmp_6787 = tmp_struct_81.field1; + CursorTy pvrtmp_6788 = tmp_struct_81.field2; + CursorTy pvrtmp_6789 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2954, pvrtmp_6786, pvrtmp_6789, tmpcur_6782); + CursorTy pvrtmp_6794 = tmp_struct_82.field0; + CursorTy pvrtmp_6795 = tmp_struct_82.field1; + CursorTy pvrtmp_6796 = tmp_struct_82.field2; + CursorTy pvrtmp_6797 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2954, pvrtmp_6794, pvrtmp_6797, tmpcur_6784); + CursorTy pvrtmp_6802 = tmp_struct_83.field0; + CursorTy pvrtmp_6803 = tmp_struct_83.field1; + CursorTy pvrtmp_6804 = tmp_struct_83.field2; + CursorTy pvrtmp_6805 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2953 = 21; + + CursorTy writetag_4760 = loc_2953 + 1; + + *(CursorTy *) writetag_4760 = pvrtmp_6789; + + CursorTy writecur_4761 = writetag_4760 + 8; + + *(CursorTy *) writecur_4761 = pvrtmp_6797; + + CursorTy writecur_4762 = writecur_4761 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6802, pvrtmp_6803, + loc_2953, pvrtmp_6805}; + break; + } + + case 23: + { + CursorTy tmpcur_6814 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6815 = tmpcur_6605 + 8; + CursorTy tmpcur_6816 = *(CursorTy *) tmpaftercur_6815; + CursorTy tmpaftercur_6817 = tmpaftercur_6815 + 8; + CursorTy jump_4041 = tmpaftercur_6815 + 8; + CursorTy jump_4040 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2954, end_r_2955, loc_3340, tmpaftercur_6817); + CursorTy pvrtmp_6818 = tmp_struct_84.field0; + CursorTy pvrtmp_6819 = tmp_struct_84.field1; + CursorTy pvrtmp_6820 = tmp_struct_84.field2; + CursorTy pvrtmp_6821 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2954, pvrtmp_6818, pvrtmp_6821, tmpcur_6814); + CursorTy pvrtmp_6826 = tmp_struct_85.field0; + CursorTy pvrtmp_6827 = tmp_struct_85.field1; + CursorTy pvrtmp_6828 = tmp_struct_85.field2; + CursorTy pvrtmp_6829 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2954, pvrtmp_6826, pvrtmp_6829, tmpcur_6816); + CursorTy pvrtmp_6834 = tmp_struct_86.field0; + CursorTy pvrtmp_6835 = tmp_struct_86.field1; + CursorTy pvrtmp_6836 = tmp_struct_86.field2; + CursorTy pvrtmp_6837 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2953 = 23; + + CursorTy writetag_4773 = loc_2953 + 1; + + *(CursorTy *) writetag_4773 = pvrtmp_6821; + + CursorTy writecur_4774 = writetag_4773 + 8; + + *(CursorTy *) writecur_4774 = pvrtmp_6829; + + CursorTy writecur_4775 = writecur_4774 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6834, pvrtmp_6835, + loc_2953, pvrtmp_6837}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6846 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6847 = tmpcur_6605 + 8; + CursorTy jump_4317 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2954, end_r_2955, loc_2953, tmpcur_6846); + CursorTy pvrtmp_6848 = tmp_struct_87.field0; + CursorTy pvrtmp_6849 = tmp_struct_87.field1; + CursorTy pvrtmp_6850 = tmp_struct_87.field2; + CursorTy pvrtmp_6851 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6848, jump_4317, + pvrtmp_6850, pvrtmp_6851}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6858 = *(CursorTy *) tmpcur_6605; + CursorTy tmpaftercur_6859 = tmpcur_6605 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2954, end_r_2955, loc_2953, tmpcur_6858); + CursorTy pvrtmp_6860 = tmp_struct_88.field0; + CursorTy pvrtmp_6861 = tmp_struct_88.field1; + CursorTy pvrtmp_6862 = tmp_struct_88.field2; + CursorTy pvrtmp_6863 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6860, pvrtmp_6861, + pvrtmp_6862, pvrtmp_6863}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6604"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2958, + CursorTy end_r_2959, + CursorTy loc_2957, + CursorTy arg_716_1321_1644) +{ + TagTyPacked tmpval_6871 = *(TagTyPacked *) arg_716_1321_1644; + CursorTy tmpcur_6872 = arg_716_1321_1644 + 1; + + + switch_7137: + ; + switch (tmpval_6871) { + + case 0: + { + CursorTy jump_4046 = arg_716_1321_1644 + 1; + + *(TagTyPacked *) loc_2957 = 0; + + CursorTy writetag_4787 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2959, jump_4046, + loc_2957, writetag_4787}; + break; + } + + case 9: + { + CursorTy tmpcur_6877 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6878 = tmpcur_6872 + 8; + CursorTy jump_4048 = tmpcur_6872 + 8; + CursorTy loc_3362 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3362, tmpaftercur_6878); + CursorTy pvrtmp_6879 = tmp_struct_92.field0; + CursorTy pvrtmp_6880 = tmp_struct_92.field1; + CursorTy pvrtmp_6881 = tmp_struct_92.field2; + CursorTy pvrtmp_6882 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6879, pvrtmp_6882, tmpcur_6877); + CursorTy pvrtmp_6887 = tmp_struct_93.field0; + CursorTy pvrtmp_6888 = tmp_struct_93.field1; + CursorTy pvrtmp_6889 = tmp_struct_93.field2; + CursorTy pvrtmp_6890 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2957 = 1; + + CursorTy writetag_4793 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6887, pvrtmp_6888, + loc_2957, pvrtmp_6890}; + break; + } + + case 11: + { + CursorTy tmpcur_6899 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6900 = tmpcur_6872 + 8; + CursorTy jump_4052 = tmpcur_6872 + 8; + CursorTy loc_3375 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3375, tmpaftercur_6900); + CursorTy pvrtmp_6901 = tmp_struct_94.field0; + CursorTy pvrtmp_6902 = tmp_struct_94.field1; + CursorTy pvrtmp_6903 = tmp_struct_94.field2; + CursorTy pvrtmp_6904 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6901, pvrtmp_6904, tmpcur_6899); + CursorTy pvrtmp_6909 = tmp_struct_95.field0; + CursorTy pvrtmp_6910 = tmp_struct_95.field1; + CursorTy pvrtmp_6911 = tmp_struct_95.field2; + CursorTy pvrtmp_6912 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2957 = 2; + + CursorTy writetag_4801 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6909, pvrtmp_6910, + loc_2957, pvrtmp_6912}; + break; + } + + case 13: + { + CursorTy tmpcur_6921 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6922 = tmpcur_6872 + 8; + CursorTy tmpcur_6923 = *(CursorTy *) tmpaftercur_6922; + CursorTy tmpaftercur_6924 = tmpaftercur_6922 + 8; + CursorTy jump_4057 = tmpaftercur_6922 + 8; + CursorTy jump_4056 = tmpcur_6872 + 8; + CursorTy loc_3393 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2958, end_r_2959, loc_3393, tmpaftercur_6924); + CursorTy pvrtmp_6925 = tmp_struct_96.field0; + CursorTy pvrtmp_6926 = tmp_struct_96.field1; + CursorTy pvrtmp_6927 = tmp_struct_96.field2; + CursorTy pvrtmp_6928 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6925, pvrtmp_6928, tmpcur_6921); + CursorTy pvrtmp_6933 = tmp_struct_97.field0; + CursorTy pvrtmp_6934 = tmp_struct_97.field1; + CursorTy pvrtmp_6935 = tmp_struct_97.field2; + CursorTy pvrtmp_6936 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6933, pvrtmp_6936, tmpcur_6923); + CursorTy pvrtmp_6941 = tmp_struct_98.field0; + CursorTy pvrtmp_6942 = tmp_struct_98.field1; + CursorTy pvrtmp_6943 = tmp_struct_98.field2; + CursorTy pvrtmp_6944 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2957 = 3; + + CursorTy writetag_4811 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6941, pvrtmp_6942, + loc_2957, pvrtmp_6944}; + break; + } + + case 15: + { + CursorTy tmpcur_6953 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6954 = tmpcur_6872 + 8; + CursorTy tmpcur_6955 = *(CursorTy *) tmpaftercur_6954; + CursorTy tmpaftercur_6956 = tmpaftercur_6954 + 8; + CursorTy jump_4063 = tmpaftercur_6954 + 8; + CursorTy jump_4062 = tmpcur_6872 + 8; + CursorTy loc_3413 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3413, tmpaftercur_6956); + CursorTy pvrtmp_6957 = tmp_struct_99.field0; + CursorTy pvrtmp_6958 = tmp_struct_99.field1; + CursorTy pvrtmp_6959 = tmp_struct_99.field2; + CursorTy pvrtmp_6960 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6957, pvrtmp_6960, tmpcur_6953); + CursorTy pvrtmp_6965 = tmp_struct_100.field0; + CursorTy pvrtmp_6966 = tmp_struct_100.field1; + CursorTy pvrtmp_6967 = tmp_struct_100.field2; + CursorTy pvrtmp_6968 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_6965, pvrtmp_6968, tmpcur_6955); + CursorTy pvrtmp_6973 = tmp_struct_101.field0; + CursorTy pvrtmp_6974 = tmp_struct_101.field1; + CursorTy pvrtmp_6975 = tmp_struct_101.field2; + CursorTy pvrtmp_6976 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2957 = 4; + + CursorTy writetag_4822 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6973, pvrtmp_6974, + loc_2957, pvrtmp_6976}; + break; + } + + case 17: + { + CursorTy tmpcur_6985 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_6986 = tmpcur_6872 + 8; + CursorTy tmpcur_6987 = *(CursorTy *) tmpaftercur_6986; + CursorTy tmpaftercur_6988 = tmpaftercur_6986 + 8; + CursorTy jump_4069 = tmpaftercur_6986 + 8; + CursorTy jump_4068 = tmpcur_6872 + 8; + CursorTy loc_3433 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2958, end_r_2959, loc_3433, tmpaftercur_6988); + CursorTy pvrtmp_6989 = tmp_struct_102.field0; + CursorTy pvrtmp_6990 = tmp_struct_102.field1; + CursorTy pvrtmp_6991 = tmp_struct_102.field2; + CursorTy pvrtmp_6992 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_6989, pvrtmp_6992, tmpcur_6985); + CursorTy pvrtmp_6997 = tmp_struct_103.field0; + CursorTy pvrtmp_6998 = tmp_struct_103.field1; + CursorTy pvrtmp_6999 = tmp_struct_103.field2; + CursorTy pvrtmp_7000 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_6997, pvrtmp_7000, tmpcur_6987); + CursorTy pvrtmp_7005 = tmp_struct_104.field0; + CursorTy pvrtmp_7006 = tmp_struct_104.field1; + CursorTy pvrtmp_7007 = tmp_struct_104.field2; + CursorTy pvrtmp_7008 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2957 = 5; + + CursorTy writetag_4833 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7005, pvrtmp_7006, + loc_2957, pvrtmp_7008}; + break; + } + + case 19: + { + CursorTy tmpcur_7017 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7018 = tmpcur_6872 + 8; + CursorTy tmpcur_7019 = *(CursorTy *) tmpaftercur_7018; + CursorTy tmpaftercur_7020 = tmpaftercur_7018 + 8; + CursorTy jump_4075 = tmpaftercur_7018 + 8; + CursorTy jump_4074 = tmpcur_6872 + 8; + CursorTy loc_3453 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_3453, tmpaftercur_7020); + CursorTy pvrtmp_7021 = tmp_struct_105.field0; + CursorTy pvrtmp_7022 = tmp_struct_105.field1; + CursorTy pvrtmp_7023 = tmp_struct_105.field2; + CursorTy pvrtmp_7024 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7021, pvrtmp_7024, tmpcur_7017); + CursorTy pvrtmp_7029 = tmp_struct_106.field0; + CursorTy pvrtmp_7030 = tmp_struct_106.field1; + CursorTy pvrtmp_7031 = tmp_struct_106.field2; + CursorTy pvrtmp_7032 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2958, pvrtmp_7029, pvrtmp_7032, tmpcur_7019); + CursorTy pvrtmp_7037 = tmp_struct_107.field0; + CursorTy pvrtmp_7038 = tmp_struct_107.field1; + CursorTy pvrtmp_7039 = tmp_struct_107.field2; + CursorTy pvrtmp_7040 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2957 = 6; + + CursorTy writetag_4844 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7037, pvrtmp_7038, + loc_2957, pvrtmp_7040}; + break; + } + + case 21: + { + CursorTy tmpcur_7049 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7050 = tmpcur_6872 + 8; + CursorTy tmpcur_7051 = *(CursorTy *) tmpaftercur_7050; + CursorTy tmpaftercur_7052 = tmpaftercur_7050 + 8; + CursorTy jump_4081 = tmpaftercur_7050 + 8; + CursorTy jump_4080 = tmpcur_6872 + 8; + CursorTy loc_3473 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3473, tmpaftercur_7052); + CursorTy pvrtmp_7053 = tmp_struct_108.field0; + CursorTy pvrtmp_7054 = tmp_struct_108.field1; + CursorTy pvrtmp_7055 = tmp_struct_108.field2; + CursorTy pvrtmp_7056 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7053, pvrtmp_7056, tmpcur_7049); + CursorTy pvrtmp_7061 = tmp_struct_109.field0; + CursorTy pvrtmp_7062 = tmp_struct_109.field1; + CursorTy pvrtmp_7063 = tmp_struct_109.field2; + CursorTy pvrtmp_7064 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_7061, pvrtmp_7064, tmpcur_7051); + CursorTy pvrtmp_7069 = tmp_struct_110.field0; + CursorTy pvrtmp_7070 = tmp_struct_110.field1; + CursorTy pvrtmp_7071 = tmp_struct_110.field2; + CursorTy pvrtmp_7072 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2957 = 7; + + CursorTy writetag_4855 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7069, pvrtmp_7070, + loc_2957, pvrtmp_7072}; + break; + } + + case 23: + { + CursorTy tmpcur_7081 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7082 = tmpcur_6872 + 8; + CursorTy tmpcur_7083 = *(CursorTy *) tmpaftercur_7082; + CursorTy tmpaftercur_7084 = tmpaftercur_7082 + 8; + CursorTy jump_4087 = tmpaftercur_7082 + 8; + CursorTy jump_4086 = tmpcur_6872 + 8; + CursorTy loc_3493 = loc_2957 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2958, end_r_2959, loc_3493, tmpaftercur_7084); + CursorTy pvrtmp_7085 = tmp_struct_111.field0; + CursorTy pvrtmp_7086 = tmp_struct_111.field1; + CursorTy pvrtmp_7087 = tmp_struct_111.field2; + CursorTy pvrtmp_7088 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2958, pvrtmp_7085, pvrtmp_7088, tmpcur_7081); + CursorTy pvrtmp_7093 = tmp_struct_112.field0; + CursorTy pvrtmp_7094 = tmp_struct_112.field1; + CursorTy pvrtmp_7095 = tmp_struct_112.field2; + CursorTy pvrtmp_7096 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2958, pvrtmp_7093, pvrtmp_7096, tmpcur_7083); + CursorTy pvrtmp_7101 = tmp_struct_113.field0; + CursorTy pvrtmp_7102 = tmp_struct_113.field1; + CursorTy pvrtmp_7103 = tmp_struct_113.field2; + CursorTy pvrtmp_7104 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2957 = 8; + + CursorTy writetag_4866 = loc_2957 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7101, pvrtmp_7102, + loc_2957, pvrtmp_7104}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7113 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7114 = tmpcur_6872 + 8; + CursorTy jump_4323 = tmpcur_6872 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_2957, tmpcur_7113); + CursorTy pvrtmp_7115 = tmp_struct_114.field0; + CursorTy pvrtmp_7116 = tmp_struct_114.field1; + CursorTy pvrtmp_7117 = tmp_struct_114.field2; + CursorTy pvrtmp_7118 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7115, jump_4323, + pvrtmp_7117, pvrtmp_7118}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7125 = *(CursorTy *) tmpcur_6872; + CursorTy tmpaftercur_7126 = tmpcur_6872 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2958, end_r_2959, loc_2957, tmpcur_7125); + CursorTy pvrtmp_7127 = tmp_struct_115.field0; + CursorTy pvrtmp_7128 = tmp_struct_115.field1; + CursorTy pvrtmp_7129 = tmp_struct_115.field2; + CursorTy pvrtmp_7130 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7127, pvrtmp_7128, + pvrtmp_7129, pvrtmp_7130}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6871"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2961, CursorTy arg_761_1366_1689) +{ + TagTyPacked tmpval_7138 = *(TagTyPacked *) arg_761_1366_1689; + CursorTy tmpcur_7139 = arg_761_1366_1689 + 1; + + + switch_7196: + ; + switch (tmpval_7138) { + + case 0: + { + CursorTy jump_4092 = arg_761_1366_1689 + 1; + + return (CursorProd) {jump_4092}; + break; + } + + case 9: + { + CursorTy tmpcur_7140 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7141 = tmpcur_7139 + 8; + CursorTy jump_4094 = tmpcur_7139 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2961, tmpaftercur_7141); + CursorTy pvrtmp_7142 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2961, tmpcur_7140); + CursorTy pvrtmp_7143 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7143}; + break; + } + + case 11: + { + CursorTy tmpcur_7144 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7145 = tmpcur_7139 + 8; + CursorTy jump_4098 = tmpcur_7139 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2961, tmpaftercur_7145); + CursorTy pvrtmp_7146 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2961, tmpcur_7144); + CursorTy pvrtmp_7147 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7147}; + break; + } + + case 13: + { + CursorTy tmpcur_7148 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7149 = tmpcur_7139 + 8; + CursorTy tmpcur_7150 = *(CursorTy *) tmpaftercur_7149; + CursorTy tmpaftercur_7151 = tmpaftercur_7149 + 8; + CursorTy jump_4103 = tmpaftercur_7149 + 8; + CursorTy jump_4102 = tmpcur_7139 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2961, tmpaftercur_7151); + CursorTy pvrtmp_7152 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2961, tmpcur_7148); + CursorTy pvrtmp_7153 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2961, tmpcur_7150); + CursorTy pvrtmp_7154 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7154}; + break; + } + + case 15: + { + CursorTy tmpcur_7155 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7156 = tmpcur_7139 + 8; + CursorTy tmpcur_7157 = *(CursorTy *) tmpaftercur_7156; + CursorTy tmpaftercur_7158 = tmpaftercur_7156 + 8; + CursorTy jump_4109 = tmpaftercur_7156 + 8; + CursorTy jump_4108 = tmpcur_7139 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2961, tmpaftercur_7158); + CursorTy pvrtmp_7159 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2961, tmpcur_7155); + CursorTy pvrtmp_7160 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2961, tmpcur_7157); + CursorTy pvrtmp_7161 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7161}; + break; + } + + case 17: + { + CursorTy tmpcur_7162 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7163 = tmpcur_7139 + 8; + CursorTy tmpcur_7164 = *(CursorTy *) tmpaftercur_7163; + CursorTy tmpaftercur_7165 = tmpaftercur_7163 + 8; + CursorTy jump_4115 = tmpaftercur_7163 + 8; + CursorTy jump_4114 = tmpcur_7139 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2961, tmpaftercur_7165); + CursorTy pvrtmp_7166 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2961, tmpcur_7162); + CursorTy pvrtmp_7167 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2961, tmpcur_7164); + CursorTy pvrtmp_7168 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7168}; + break; + } + + case 19: + { + CursorTy tmpcur_7169 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7170 = tmpcur_7139 + 8; + CursorTy tmpcur_7171 = *(CursorTy *) tmpaftercur_7170; + CursorTy tmpaftercur_7172 = tmpaftercur_7170 + 8; + CursorTy jump_4121 = tmpaftercur_7170 + 8; + CursorTy jump_4120 = tmpcur_7139 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2961, tmpaftercur_7172); + CursorTy pvrtmp_7173 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2961, tmpcur_7169); + CursorTy pvrtmp_7174 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2961, tmpcur_7171); + CursorTy pvrtmp_7175 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7175}; + break; + } + + case 21: + { + CursorTy tmpcur_7176 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7177 = tmpcur_7139 + 8; + CursorTy tmpcur_7178 = *(CursorTy *) tmpaftercur_7177; + CursorTy tmpaftercur_7179 = tmpaftercur_7177 + 8; + CursorTy jump_4127 = tmpaftercur_7177 + 8; + CursorTy jump_4126 = tmpcur_7139 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2961, tmpaftercur_7179); + CursorTy pvrtmp_7180 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2961, tmpcur_7176); + CursorTy pvrtmp_7181 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2961, tmpcur_7178); + CursorTy pvrtmp_7182 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7182}; + break; + } + + case 23: + { + CursorTy tmpcur_7183 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7184 = tmpcur_7139 + 8; + CursorTy tmpcur_7185 = *(CursorTy *) tmpaftercur_7184; + CursorTy tmpaftercur_7186 = tmpaftercur_7184 + 8; + CursorTy jump_4133 = tmpaftercur_7184 + 8; + CursorTy jump_4132 = tmpcur_7139 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2961, tmpaftercur_7186); + CursorTy pvrtmp_7187 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2961, tmpcur_7183); + CursorTy pvrtmp_7188 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2961, tmpcur_7185); + CursorTy pvrtmp_7189 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7189}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7190 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7191 = tmpcur_7139 + 8; + CursorTy jump_4329 = tmpcur_7139 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2961, tmpcur_7190); + CursorTy pvrtmp_7192 = tmp_struct_138.field0; + + return (CursorProd) {jump_4329}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7193 = *(CursorTy *) tmpcur_7139; + CursorTy tmpaftercur_7194 = tmpcur_7139 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2961, tmpcur_7193); + CursorTy pvrtmp_7195 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7195}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7138"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2963, CursorTy arg_806_1411_1734) +{ + TagTyPacked tmpval_7197 = *(TagTyPacked *) arg_806_1411_1734; + CursorTy tmpcur_7198 = arg_806_1411_1734 + 1; + + + switch_7255: + ; + switch (tmpval_7197) { + + case 0: + { + CursorTy jump_4138 = arg_806_1411_1734 + 1; + unsigned char wildcard_807_1412_1735 = print_symbol(6151); + unsigned char wildcard_808_1413_1736 = print_symbol(6145); + + return (CursorProd) {jump_4138}; + break; + } + + case 9: + { + CursorTy tmpcur_7199 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7200 = tmpcur_7198 + 8; + CursorTy jump_4140 = tmpcur_7198 + 8; + unsigned char wildcard_813_1416_1739 = print_symbol(6157); + CursorProd tmp_struct_140 = + _print_Content(end_r_2963, tmpaftercur_7200); + CursorTy pvrtmp_7201 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2963, tmpcur_7199); + CursorTy pvrtmp_7202 = tmp_struct_141.field0; + unsigned char wildcard_814_1419_1742 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7202}; + break; + } + + case 11: + { + CursorTy tmpcur_7203 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7204 = tmpcur_7198 + 8; + CursorTy jump_4144 = tmpcur_7198 + 8; + unsigned char wildcard_819_1422_1745 = print_symbol(6160); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2963, tmpaftercur_7204); + CursorTy pvrtmp_7205 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2963, tmpcur_7203); + CursorTy pvrtmp_7206 = tmp_struct_143.field0; + unsigned char wildcard_820_1425_1748 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7206}; + break; + } + + case 13: + { + CursorTy tmpcur_7207 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7208 = tmpcur_7198 + 8; + CursorTy tmpcur_7209 = *(CursorTy *) tmpaftercur_7208; + CursorTy tmpaftercur_7210 = tmpaftercur_7208 + 8; + CursorTy jump_4149 = tmpaftercur_7208 + 8; + CursorTy jump_4148 = tmpcur_7198 + 8; + unsigned char wildcard_827_1429_1752 = print_symbol(6148); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2963, tmpaftercur_7210); + CursorTy pvrtmp_7211 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2963, tmpcur_7207); + CursorTy pvrtmp_7212 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2963, tmpcur_7209); + CursorTy pvrtmp_7213 = tmp_struct_146.field0; + unsigned char wildcard_828_1433_1756 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7213}; + break; + } + + case 15: + { + CursorTy tmpcur_7214 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7215 = tmpcur_7198 + 8; + CursorTy tmpcur_7216 = *(CursorTy *) tmpaftercur_7215; + CursorTy tmpaftercur_7217 = tmpaftercur_7215 + 8; + CursorTy jump_4155 = tmpaftercur_7215 + 8; + CursorTy jump_4154 = tmpcur_7198 + 8; + unsigned char wildcard_835_1437_1760 = print_symbol(6159); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2963, tmpaftercur_7217); + CursorTy pvrtmp_7218 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2963, tmpcur_7214); + CursorTy pvrtmp_7219 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2963, tmpcur_7216); + CursorTy pvrtmp_7220 = tmp_struct_149.field0; + unsigned char wildcard_836_1441_1764 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7220}; + break; + } + + case 17: + { + CursorTy tmpcur_7221 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7222 = tmpcur_7198 + 8; + CursorTy tmpcur_7223 = *(CursorTy *) tmpaftercur_7222; + CursorTy tmpaftercur_7224 = tmpaftercur_7222 + 8; + CursorTy jump_4161 = tmpaftercur_7222 + 8; + CursorTy jump_4160 = tmpcur_7198 + 8; + unsigned char wildcard_843_1445_1768 = print_symbol(6149); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2963, tmpaftercur_7224); + CursorTy pvrtmp_7225 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2963, tmpcur_7221); + CursorTy pvrtmp_7226 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2963, tmpcur_7223); + CursorTy pvrtmp_7227 = tmp_struct_152.field0; + unsigned char wildcard_844_1449_1772 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7227}; + break; + } + + case 19: + { + CursorTy tmpcur_7228 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7229 = tmpcur_7198 + 8; + CursorTy tmpcur_7230 = *(CursorTy *) tmpaftercur_7229; + CursorTy tmpaftercur_7231 = tmpaftercur_7229 + 8; + CursorTy jump_4167 = tmpaftercur_7229 + 8; + CursorTy jump_4166 = tmpcur_7198 + 8; + unsigned char wildcard_851_1453_1776 = print_symbol(6158); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2963, tmpaftercur_7231); + CursorTy pvrtmp_7232 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2963, tmpcur_7228); + CursorTy pvrtmp_7233 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2963, tmpcur_7230); + CursorTy pvrtmp_7234 = tmp_struct_155.field0; + unsigned char wildcard_852_1457_1780 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7234}; + break; + } + + case 21: + { + CursorTy tmpcur_7235 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7236 = tmpcur_7198 + 8; + CursorTy tmpcur_7237 = *(CursorTy *) tmpaftercur_7236; + CursorTy tmpaftercur_7238 = tmpaftercur_7236 + 8; + CursorTy jump_4173 = tmpaftercur_7236 + 8; + CursorTy jump_4172 = tmpcur_7198 + 8; + unsigned char wildcard_859_1461_1784 = print_symbol(6155); + CursorProd tmp_struct_156 = + _print_Content(end_r_2963, tmpaftercur_7238); + CursorTy pvrtmp_7239 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2963, tmpcur_7235); + CursorTy pvrtmp_7240 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2963, tmpcur_7237); + CursorTy pvrtmp_7241 = tmp_struct_158.field0; + unsigned char wildcard_860_1465_1788 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7241}; + break; + } + + case 23: + { + CursorTy tmpcur_7242 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7243 = tmpcur_7198 + 8; + CursorTy tmpcur_7244 = *(CursorTy *) tmpaftercur_7243; + CursorTy tmpaftercur_7245 = tmpaftercur_7243 + 8; + CursorTy jump_4179 = tmpaftercur_7243 + 8; + CursorTy jump_4178 = tmpcur_7198 + 8; + unsigned char wildcard_867_1469_1792 = print_symbol(6156); + CursorProd tmp_struct_159 = + _print_Content(end_r_2963, tmpaftercur_7245); + CursorTy pvrtmp_7246 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2963, tmpcur_7242); + CursorTy pvrtmp_7247 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2963, tmpcur_7244); + CursorTy pvrtmp_7248 = tmp_struct_161.field0; + unsigned char wildcard_868_1473_1796 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7248}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7249 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7250 = tmpcur_7198 + 8; + CursorTy jump_4335 = tmpcur_7198 + 8; + unsigned char wildcard_4338 = print_symbol(6162); + CursorProd tmp_struct_162 = _print_Adt(end_r_2963, tmpcur_7249); + CursorTy pvrtmp_7251 = tmp_struct_162.field0; + + return (CursorProd) {jump_4335}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7252 = *(CursorTy *) tmpcur_7198; + CursorTy tmpaftercur_7253 = tmpcur_7198 + 8; + unsigned char wildcard_4338 = print_symbol(6161); + CursorProd tmp_struct_163 = _print_Adt(end_r_2963, tmpcur_7252); + CursorTy pvrtmp_7254 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7254}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7197"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2966, + CursorTy end_r_2967, CursorTy loc_2965, + CursorTy arg_869_1474_1797) +{ + if (loc_2965 + 32 > end_r_2967) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2967); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2967 = chunk_end_169; + *(TagTyPacked *) loc_2965 = 255; + + CursorTy redir = loc_2965 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2965 = chunk_start_168; + } + + CursorTy loc_3671 = loc_2965 + 1; + CursorTy loc_3672 = loc_3671 + 8; + TagTyPacked tmpval_7256 = *(TagTyPacked *) arg_869_1474_1797; + CursorTy tmpcur_7257 = arg_869_1474_1797 + 1; + + + switch_7300: + ; + switch (tmpval_7256) { + + case 0: + { + CursorTy jump_4184 = arg_869_1474_1797 + 1; + + *(TagTyPacked *) loc_2965 = 0; + + CursorTy writetag_4980 = loc_2965 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2967, jump_4184, + loc_2965, writetag_4980}; + break; + } + + case 1: + { + IntTy tmpval_7262 = *(IntTy *) tmpcur_7257; + CursorTy tmpcur_7263 = tmpcur_7257 + sizeof(IntTy); + CursorTy jump_4186 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2966, end_r_2967, loc_3672, tmpcur_7263); + CursorTy pvrtmp_7264 = tmp_struct_164.field0; + CursorTy pvrtmp_7265 = tmp_struct_164.field1; + CursorTy pvrtmp_7266 = tmp_struct_164.field2; + CursorTy pvrtmp_7267 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2965 = 1; + + CursorTy writetag_4985 = loc_2965 + 1; + + *(IntTy *) writetag_4985 = tmpval_7262; + + CursorTy writecur_4986 = writetag_4985 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7264, pvrtmp_7265, + loc_2965, pvrtmp_7267}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7276 = *(CursorTy *) tmpcur_7257; + CursorTy tmpaftercur_7277 = tmpcur_7257 + 8; + CursorTy jump_4341 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2966, end_r_2967, loc_2965, tmpcur_7276); + CursorTy pvrtmp_7278 = tmp_struct_165.field0; + CursorTy pvrtmp_7279 = tmp_struct_165.field1; + CursorTy pvrtmp_7280 = tmp_struct_165.field2; + CursorTy pvrtmp_7281 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7278, jump_4341, + pvrtmp_7280, pvrtmp_7281}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7288 = *(CursorTy *) tmpcur_7257; + CursorTy tmpaftercur_7289 = tmpcur_7257 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2966, end_r_2967, loc_2965, tmpcur_7288); + CursorTy pvrtmp_7290 = tmp_struct_166.field0; + CursorTy pvrtmp_7291 = tmp_struct_166.field1; + CursorTy pvrtmp_7292 = tmp_struct_166.field2; + CursorTy pvrtmp_7293 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7290, pvrtmp_7291, + pvrtmp_7292, pvrtmp_7293}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7256"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2970, + CursorTy end_r_2971, + CursorTy loc_2969, + CursorTy arg_874_1479_1802) +{ + CursorTy loc_3684 = loc_2969 + 1; + CursorTy loc_3685 = loc_3684 + 8; + TagTyPacked tmpval_7301 = *(TagTyPacked *) arg_874_1479_1802; + CursorTy tmpcur_7302 = arg_874_1479_1802 + 1; + + + switch_7345: + ; + switch (tmpval_7301) { + + case 0: + { + CursorTy jump_4189 = arg_874_1479_1802 + 1; + + *(TagTyPacked *) loc_2969 = 0; + + CursorTy writetag_4996 = loc_2969 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2971, jump_4189, + loc_2969, writetag_4996}; + break; + } + + case 1: + { + IntTy tmpval_7307 = *(IntTy *) tmpcur_7302; + CursorTy tmpcur_7308 = tmpcur_7302 + sizeof(IntTy); + CursorTy jump_4191 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_3685, tmpcur_7308); + CursorTy pvrtmp_7309 = tmp_struct_170.field0; + CursorTy pvrtmp_7310 = tmp_struct_170.field1; + CursorTy pvrtmp_7311 = tmp_struct_170.field2; + CursorTy pvrtmp_7312 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2969 = 1; + + CursorTy writetag_5001 = loc_2969 + 1; + + *(IntTy *) writetag_5001 = tmpval_7307; + + CursorTy writecur_5002 = writetag_5001 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7309, pvrtmp_7310, + loc_2969, pvrtmp_7312}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7321 = *(CursorTy *) tmpcur_7302; + CursorTy tmpaftercur_7322 = tmpcur_7302 + 8; + CursorTy jump_4347 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_2969, tmpcur_7321); + CursorTy pvrtmp_7323 = tmp_struct_171.field0; + CursorTy pvrtmp_7324 = tmp_struct_171.field1; + CursorTy pvrtmp_7325 = tmp_struct_171.field2; + CursorTy pvrtmp_7326 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7323, jump_4347, + pvrtmp_7325, pvrtmp_7326}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7333 = *(CursorTy *) tmpcur_7302; + CursorTy tmpaftercur_7334 = tmpcur_7302 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2970, end_r_2971, loc_2969, tmpcur_7333); + CursorTy pvrtmp_7335 = tmp_struct_172.field0; + CursorTy pvrtmp_7336 = tmp_struct_172.field1; + CursorTy pvrtmp_7337 = tmp_struct_172.field2; + CursorTy pvrtmp_7338 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7335, pvrtmp_7336, + pvrtmp_7337, pvrtmp_7338}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7301"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2973, CursorTy arg_879_1484_1807) +{ + TagTyPacked tmpval_7346 = *(TagTyPacked *) arg_879_1484_1807; + CursorTy tmpcur_7347 = arg_879_1484_1807 + 1; + + + switch_7357: + ; + switch (tmpval_7346) { + + case 0: + { + CursorTy jump_4194 = arg_879_1484_1807 + 1; + + return (CursorProd) {jump_4194}; + break; + } + + case 1: + { + IntTy tmpval_7348 = *(IntTy *) tmpcur_7347; + CursorTy tmpcur_7349 = tmpcur_7347 + sizeof(IntTy); + CursorTy jump_4196 = tmpcur_7347 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2973, tmpcur_7349); + CursorTy pvrtmp_7350 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7350}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7351 = *(CursorTy *) tmpcur_7347; + CursorTy tmpaftercur_7352 = tmpcur_7347 + 8; + CursorTy jump_4353 = tmpcur_7347 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2973, tmpcur_7351); + CursorTy pvrtmp_7353 = tmp_struct_174.field0; + + return (CursorProd) {jump_4353}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7354 = *(CursorTy *) tmpcur_7347; + CursorTy tmpaftercur_7355 = tmpcur_7347 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2973, tmpcur_7354); + CursorTy pvrtmp_7356 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7356}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7346"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2975, CursorTy arg_884_1488_1811) +{ + TagTyPacked tmpval_7358 = *(TagTyPacked *) arg_884_1488_1811; + CursorTy tmpcur_7359 = arg_884_1488_1811 + 1; + + + switch_7369: + ; + switch (tmpval_7358) { + + case 0: + { + CursorTy jump_4199 = arg_884_1488_1811 + 1; + unsigned char wildcard_885_1489_1812 = print_symbol(6150); + unsigned char wildcard_886_1490_1813 = print_symbol(6145); + + return (CursorProd) {jump_4199}; + break; + } + + case 1: + { + IntTy tmpval_7360 = *(IntTy *) tmpcur_7359; + CursorTy tmpcur_7361 = tmpcur_7359 + sizeof(IntTy); + CursorTy jump_4201 = tmpcur_7359 + 8; + unsigned char wildcard_891_1493_1816 = print_symbol(6147); + unsigned char y_889_1494_1817 = printf("%lld", tmpval_7360); + CursorProd tmp_struct_176 = _print_Tags(end_r_2975, tmpcur_7361); + CursorTy pvrtmp_7362 = tmp_struct_176.field0; + unsigned char wildcard_892_1496_1819 = print_symbol(6145); + + return (CursorProd) {pvrtmp_7362}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7363 = *(CursorTy *) tmpcur_7359; + CursorTy tmpaftercur_7364 = tmpcur_7359 + 8; + CursorTy jump_4359 = tmpcur_7359 + 8; + unsigned char wildcard_4362 = print_symbol(6162); + CursorProd tmp_struct_177 = _print_Tags(end_r_2975, tmpcur_7363); + CursorTy pvrtmp_7365 = tmp_struct_177.field0; + + return (CursorProd) {jump_4359}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7366 = *(CursorTy *) tmpcur_7359; + CursorTy tmpaftercur_7367 = tmpcur_7359 + 8; + unsigned char wildcard_4362 = print_symbol(6161); + CursorProd tmp_struct_178 = _print_Tags(end_r_2975, tmpcur_7366); + CursorTy pvrtmp_7368 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7368}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7358"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2978, + CursorTy end_r_2979, + CursorTy loc_2977, + CursorTy arg_2710) +{ + if (loc_2977 + 32 > end_r_2979) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2979); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2979 = chunk_end_184; + *(TagTyPacked *) loc_2977 = 255; + + CursorTy redir = loc_2977 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2977 = chunk_start_183; + } + + CursorTy loc_3709 = loc_2977 + 1; + CursorTy loc_3710 = loc_3709 + 8; + TagTyPacked tmpval_7370 = *(TagTyPacked *) arg_2710; + CursorTy tmpcur_7371 = arg_2710 + 1; + + + switch_7414: + ; + switch (tmpval_7370) { + + case 0: + { + CursorTy jump_4204 = arg_2710 + 1; + + *(TagTyPacked *) loc_2977 = 0; + + CursorTy writetag_5032 = loc_2977 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2979, jump_4204, + loc_2977, writetag_5032}; + break; + } + + case 1: + { + IntTy tmpval_7376 = *(IntTy *) tmpcur_7371; + CursorTy tmpcur_7377 = tmpcur_7371 + sizeof(IntTy); + CursorTy jump_4206 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_3710, tmpcur_7377); + CursorTy pvrtmp_7378 = tmp_struct_179.field0; + CursorTy pvrtmp_7379 = tmp_struct_179.field1; + CursorTy pvrtmp_7380 = tmp_struct_179.field2; + CursorTy pvrtmp_7381 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2977 = 1; + + CursorTy writetag_5037 = loc_2977 + 1; + + *(IntTy *) writetag_5037 = tmpval_7376; + + CursorTy writecur_5038 = writetag_5037 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7378, pvrtmp_7379, + loc_2977, pvrtmp_7381}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7390 = *(CursorTy *) tmpcur_7371; + CursorTy tmpaftercur_7391 = tmpcur_7371 + 8; + CursorTy jump_4365 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_2977, tmpcur_7390); + CursorTy pvrtmp_7392 = tmp_struct_180.field0; + CursorTy pvrtmp_7393 = tmp_struct_180.field1; + CursorTy pvrtmp_7394 = tmp_struct_180.field2; + CursorTy pvrtmp_7395 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7392, jump_4365, + pvrtmp_7394, pvrtmp_7395}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7402 = *(CursorTy *) tmpcur_7371; + CursorTy tmpaftercur_7403 = tmpcur_7371 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2978, end_r_2979, loc_2977, tmpcur_7402); + CursorTy pvrtmp_7404 = tmp_struct_181.field0; + CursorTy pvrtmp_7405 = tmp_struct_181.field1; + CursorTy pvrtmp_7406 = tmp_struct_181.field2; + CursorTy pvrtmp_7407 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7404, pvrtmp_7405, + pvrtmp_7406, pvrtmp_7407}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7370"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2982, + CursorTy end_r_2983, + CursorTy loc_2981, + CursorTy arg_2715) +{ + if (loc_2981 + 32 > end_r_2983) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2983); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2983 = chunk_end_191; + *(TagTyPacked *) loc_2981 = 255; + + CursorTy redir = loc_2981 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2981 = chunk_start_190; + } + + TagTyPacked tmpval_7415 = *(TagTyPacked *) arg_2715; + CursorTy tmpcur_7416 = arg_2715 + 1; + + + switch_7465: + ; + switch (tmpval_7415) { + + case 0: + { + CursorTy loc_3720 = loc_2981 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2982, end_r_2983, loc_3720, tmpcur_7416); + CursorTy pvrtmp_7417 = tmp_struct_185.field0; + CursorTy pvrtmp_7418 = tmp_struct_185.field1; + CursorTy pvrtmp_7419 = tmp_struct_185.field2; + CursorTy pvrtmp_7420 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2981 = 0; + + CursorTy writetag_5049 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7417, pvrtmp_7418, + loc_2981, pvrtmp_7420}; + break; + } + + case 1: + { + CursorTy loc_3726 = loc_2981 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2982, end_r_2983, loc_3726, tmpcur_7416); + CursorTy pvrtmp_7429 = tmp_struct_186.field0; + CursorTy pvrtmp_7430 = tmp_struct_186.field1; + CursorTy pvrtmp_7431 = tmp_struct_186.field2; + CursorTy pvrtmp_7432 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2981 = 1; + + CursorTy writetag_5054 = loc_2981 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7429, pvrtmp_7430, + loc_2981, pvrtmp_7432}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7441 = *(CursorTy *) tmpcur_7416; + CursorTy tmpaftercur_7442 = tmpcur_7416 + 8; + CursorTy jump_4371 = tmpcur_7416 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2982, end_r_2983, loc_2981, tmpcur_7441); + CursorTy pvrtmp_7443 = tmp_struct_187.field0; + CursorTy pvrtmp_7444 = tmp_struct_187.field1; + CursorTy pvrtmp_7445 = tmp_struct_187.field2; + CursorTy pvrtmp_7446 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7443, jump_4371, + pvrtmp_7445, pvrtmp_7446}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7453 = *(CursorTy *) tmpcur_7416; + CursorTy tmpaftercur_7454 = tmpcur_7416 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2982, end_r_2983, loc_2981, tmpcur_7453); + CursorTy pvrtmp_7455 = tmp_struct_188.field0; + CursorTy pvrtmp_7456 = tmp_struct_188.field1; + CursorTy pvrtmp_7457 = tmp_struct_188.field2; + CursorTy pvrtmp_7458 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7455, pvrtmp_7456, + pvrtmp_7457, pvrtmp_7458}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7415"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2986, + CursorTy end_r_2987, + CursorTy loc_2985, + CursorTy arg_2720) +{ + if (loc_2985 + 32 > end_r_2987) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2987); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2987 = chunk_end_218; + *(TagTyPacked *) loc_2985 = 255; + + CursorTy redir = loc_2985 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2985 = chunk_start_217; + } + + CursorTy loc_3739 = loc_2985 + 1; + CursorTy loc_3740 = loc_3739 + 8; + CursorTy loc_3741 = loc_3740 + 8; + CursorTy loc_3757 = loc_2985 + 1; + CursorTy loc_3758 = loc_3757 + 8; + CursorTy loc_3759 = loc_3758 + 8; + CursorTy loc_3779 = loc_2985 + 1; + CursorTy loc_3780 = loc_3779 + 8; + CursorTy loc_3781 = loc_3780 + 8; + CursorTy loc_3782 = loc_3781 + 8; + CursorTy loc_3806 = loc_2985 + 1; + CursorTy loc_3807 = loc_3806 + 8; + CursorTy loc_3808 = loc_3807 + 8; + CursorTy loc_3809 = loc_3808 + 8; + CursorTy loc_3833 = loc_2985 + 1; + CursorTy loc_3834 = loc_3833 + 8; + CursorTy loc_3835 = loc_3834 + 8; + CursorTy loc_3836 = loc_3835 + 8; + CursorTy loc_3860 = loc_2985 + 1; + CursorTy loc_3861 = loc_3860 + 8; + CursorTy loc_3862 = loc_3861 + 8; + CursorTy loc_3863 = loc_3862 + 8; + CursorTy loc_3887 = loc_2985 + 1; + CursorTy loc_3888 = loc_3887 + 8; + CursorTy loc_3889 = loc_3888 + 8; + CursorTy loc_3890 = loc_3889 + 8; + CursorTy loc_3914 = loc_2985 + 1; + CursorTy loc_3915 = loc_3914 + 8; + CursorTy loc_3916 = loc_3915 + 8; + CursorTy loc_3917 = loc_3916 + 8; + TagTyPacked tmpval_7466 = *(TagTyPacked *) arg_2720; + CursorTy tmpcur_7467 = arg_2720 + 1; + + + switch_7704: + ; + switch (tmpval_7466) { + + case 0: + { + CursorTy jump_4213 = arg_2720 + 1; + + *(TagTyPacked *) loc_2985 = 0; + + CursorTy writetag_5064 = loc_2985 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2987, jump_4213, + loc_2985, writetag_5064}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3741, tmpcur_7467); + CursorTy pvrtmp_7472 = tmp_struct_192.field0; + CursorTy pvrtmp_7473 = tmp_struct_192.field1; + CursorTy pvrtmp_7474 = tmp_struct_192.field2; + CursorTy pvrtmp_7475 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7472, pvrtmp_7475, pvrtmp_7473); + CursorTy pvrtmp_7480 = tmp_struct_193.field0; + CursorTy pvrtmp_7481 = tmp_struct_193.field1; + CursorTy pvrtmp_7482 = tmp_struct_193.field2; + CursorTy pvrtmp_7483 = tmp_struct_193.field3; + IntTy sizeof_y_2723__2725 = pvrtmp_7475 - pvrtmp_7474; + IntTy sizeof_y_2724__2726 = pvrtmp_7483 - pvrtmp_7482; + IntTy fltPrm_2814 = sizeof_y_2723__2725 + 0; + IntTy offset__2727 = 0 + fltPrm_2814; + IntTy fltPrm_2815 = sizeof_y_2723__2725 + sizeof_y_2724__2726; + IntTy size_dcon_2728 = 9 + fltPrm_2815; + + *(TagTyPacked *) loc_2985 = 160; + + CursorTy writetag_5069 = loc_2985 + 1; + + *(IntTy *) writetag_5069 = size_dcon_2728; + + CursorTy writecur_5070 = writetag_5069 + sizeof(IntTy); + + *(IntTy *) writecur_5070 = offset__2727; + + CursorTy writecur_5071 = writecur_5070 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7480, pvrtmp_7481, + loc_2985, pvrtmp_7483}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3759, tmpcur_7467); + CursorTy pvrtmp_7492 = tmp_struct_194.field0; + CursorTy pvrtmp_7493 = tmp_struct_194.field1; + CursorTy pvrtmp_7494 = tmp_struct_194.field2; + CursorTy pvrtmp_7495 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7492, pvrtmp_7495, pvrtmp_7493); + CursorTy pvrtmp_7500 = tmp_struct_195.field0; + CursorTy pvrtmp_7501 = tmp_struct_195.field1; + CursorTy pvrtmp_7502 = tmp_struct_195.field2; + CursorTy pvrtmp_7503 = tmp_struct_195.field3; + IntTy sizeof_y_2731__2733 = pvrtmp_7495 - pvrtmp_7494; + IntTy sizeof_y_2732__2734 = pvrtmp_7503 - pvrtmp_7502; + IntTy fltPrm_2816 = sizeof_y_2731__2733 + 0; + IntTy offset__2735 = 0 + fltPrm_2816; + IntTy fltPrm_2817 = sizeof_y_2731__2733 + sizeof_y_2732__2734; + IntTy size_dcon_2736 = 9 + fltPrm_2817; + + *(TagTyPacked *) loc_2985 = 162; + + CursorTy writetag_5078 = loc_2985 + 1; + + *(IntTy *) writetag_5078 = size_dcon_2736; + + CursorTy writecur_5079 = writetag_5078 + sizeof(IntTy); + + *(IntTy *) writecur_5079 = offset__2735; + + CursorTy writecur_5080 = writecur_5079 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7500, pvrtmp_7501, + loc_2985, pvrtmp_7503}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2986, end_r_2987, loc_3782, tmpcur_7467); + CursorTy pvrtmp_7512 = tmp_struct_196.field0; + CursorTy pvrtmp_7513 = tmp_struct_196.field1; + CursorTy pvrtmp_7514 = tmp_struct_196.field2; + CursorTy pvrtmp_7515 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7512, pvrtmp_7515, pvrtmp_7513); + CursorTy pvrtmp_7520 = tmp_struct_197.field0; + CursorTy pvrtmp_7521 = tmp_struct_197.field1; + CursorTy pvrtmp_7522 = tmp_struct_197.field2; + CursorTy pvrtmp_7523 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7520, pvrtmp_7523, pvrtmp_7521); + CursorTy pvrtmp_7528 = tmp_struct_198.field0; + CursorTy pvrtmp_7529 = tmp_struct_198.field1; + CursorTy pvrtmp_7530 = tmp_struct_198.field2; + CursorTy pvrtmp_7531 = tmp_struct_198.field3; + IntTy sizeof_y_2740__2743 = pvrtmp_7515 - pvrtmp_7514; + IntTy sizeof_y_2741__2744 = pvrtmp_7523 - pvrtmp_7522; + IntTy sizeof_y_2742__2745 = pvrtmp_7531 - pvrtmp_7530; + IntTy fltPrm_2818 = sizeof_y_2740__2743 + 0; + IntTy offset__2746 = 8 + fltPrm_2818; + IntTy fltPrm_2819 = sizeof_y_2740__2743 + sizeof_y_2741__2744; + IntTy offset__2747 = 0 + fltPrm_2819; + IntTy fltPrm_2821 = sizeof_y_2741__2744 + sizeof_y_2742__2745; + IntTy fltPrm_2820 = sizeof_y_2740__2743 + fltPrm_2821; + IntTy size_dcon_2748 = 17 + fltPrm_2820; + + *(TagTyPacked *) loc_2985 = 164; + + CursorTy writetag_5088 = loc_2985 + 1; + + *(IntTy *) writetag_5088 = size_dcon_2748; + + CursorTy writecur_5089 = writetag_5088 + sizeof(IntTy); + + *(IntTy *) writecur_5089 = offset__2746; + + CursorTy writecur_5090 = writecur_5089 + sizeof(IntTy); + + *(IntTy *) writecur_5090 = offset__2747; + + CursorTy writecur_5091 = writecur_5090 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7528, pvrtmp_7529, + loc_2985, pvrtmp_7531}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3809, tmpcur_7467); + CursorTy pvrtmp_7540 = tmp_struct_199.field0; + CursorTy pvrtmp_7541 = tmp_struct_199.field1; + CursorTy pvrtmp_7542 = tmp_struct_199.field2; + CursorTy pvrtmp_7543 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7540, pvrtmp_7543, pvrtmp_7541); + CursorTy pvrtmp_7548 = tmp_struct_200.field0; + CursorTy pvrtmp_7549 = tmp_struct_200.field1; + CursorTy pvrtmp_7550 = tmp_struct_200.field2; + CursorTy pvrtmp_7551 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7548, pvrtmp_7551, pvrtmp_7549); + CursorTy pvrtmp_7556 = tmp_struct_201.field0; + CursorTy pvrtmp_7557 = tmp_struct_201.field1; + CursorTy pvrtmp_7558 = tmp_struct_201.field2; + CursorTy pvrtmp_7559 = tmp_struct_201.field3; + IntTy sizeof_y_2752__2755 = pvrtmp_7543 - pvrtmp_7542; + IntTy sizeof_y_2753__2756 = pvrtmp_7551 - pvrtmp_7550; + IntTy sizeof_y_2754__2757 = pvrtmp_7559 - pvrtmp_7558; + IntTy fltPrm_2822 = sizeof_y_2752__2755 + 0; + IntTy offset__2758 = 8 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2752__2755 + sizeof_y_2753__2756; + IntTy offset__2759 = 0 + fltPrm_2823; + IntTy fltPrm_2825 = sizeof_y_2753__2756 + sizeof_y_2754__2757; + IntTy fltPrm_2824 = sizeof_y_2752__2755 + fltPrm_2825; + IntTy size_dcon_2760 = 17 + fltPrm_2824; + + *(TagTyPacked *) loc_2985 = 166; + + CursorTy writetag_5100 = loc_2985 + 1; + + *(IntTy *) writetag_5100 = size_dcon_2760; + + CursorTy writecur_5101 = writetag_5100 + sizeof(IntTy); + + *(IntTy *) writecur_5101 = offset__2758; + + CursorTy writecur_5102 = writecur_5101 + sizeof(IntTy); + + *(IntTy *) writecur_5102 = offset__2759; + + CursorTy writecur_5103 = writecur_5102 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7556, pvrtmp_7557, + loc_2985, pvrtmp_7559}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2986, end_r_2987, loc_3836, tmpcur_7467); + CursorTy pvrtmp_7568 = tmp_struct_202.field0; + CursorTy pvrtmp_7569 = tmp_struct_202.field1; + CursorTy pvrtmp_7570 = tmp_struct_202.field2; + CursorTy pvrtmp_7571 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7568, pvrtmp_7571, pvrtmp_7569); + CursorTy pvrtmp_7576 = tmp_struct_203.field0; + CursorTy pvrtmp_7577 = tmp_struct_203.field1; + CursorTy pvrtmp_7578 = tmp_struct_203.field2; + CursorTy pvrtmp_7579 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7576, pvrtmp_7579, pvrtmp_7577); + CursorTy pvrtmp_7584 = tmp_struct_204.field0; + CursorTy pvrtmp_7585 = tmp_struct_204.field1; + CursorTy pvrtmp_7586 = tmp_struct_204.field2; + CursorTy pvrtmp_7587 = tmp_struct_204.field3; + IntTy sizeof_y_2764__2767 = pvrtmp_7571 - pvrtmp_7570; + IntTy sizeof_y_2765__2768 = pvrtmp_7579 - pvrtmp_7578; + IntTy sizeof_y_2766__2769 = pvrtmp_7587 - pvrtmp_7586; + IntTy fltPrm_2826 = sizeof_y_2764__2767 + 0; + IntTy offset__2770 = 8 + fltPrm_2826; + IntTy fltPrm_2827 = sizeof_y_2764__2767 + sizeof_y_2765__2768; + IntTy offset__2771 = 0 + fltPrm_2827; + IntTy fltPrm_2829 = sizeof_y_2765__2768 + sizeof_y_2766__2769; + IntTy fltPrm_2828 = sizeof_y_2764__2767 + fltPrm_2829; + IntTy size_dcon_2772 = 17 + fltPrm_2828; + + *(TagTyPacked *) loc_2985 = 168; + + CursorTy writetag_5112 = loc_2985 + 1; + + *(IntTy *) writetag_5112 = size_dcon_2772; + + CursorTy writecur_5113 = writetag_5112 + sizeof(IntTy); + + *(IntTy *) writecur_5113 = offset__2770; + + CursorTy writecur_5114 = writecur_5113 + sizeof(IntTy); + + *(IntTy *) writecur_5114 = offset__2771; + + CursorTy writecur_5115 = writecur_5114 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7584, pvrtmp_7585, + loc_2985, pvrtmp_7587}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_3863, tmpcur_7467); + CursorTy pvrtmp_7596 = tmp_struct_205.field0; + CursorTy pvrtmp_7597 = tmp_struct_205.field1; + CursorTy pvrtmp_7598 = tmp_struct_205.field2; + CursorTy pvrtmp_7599 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7596, pvrtmp_7599, pvrtmp_7597); + CursorTy pvrtmp_7604 = tmp_struct_206.field0; + CursorTy pvrtmp_7605 = tmp_struct_206.field1; + CursorTy pvrtmp_7606 = tmp_struct_206.field2; + CursorTy pvrtmp_7607 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2986, pvrtmp_7604, pvrtmp_7607, pvrtmp_7605); + CursorTy pvrtmp_7612 = tmp_struct_207.field0; + CursorTy pvrtmp_7613 = tmp_struct_207.field1; + CursorTy pvrtmp_7614 = tmp_struct_207.field2; + CursorTy pvrtmp_7615 = tmp_struct_207.field3; + IntTy sizeof_y_2776__2779 = pvrtmp_7599 - pvrtmp_7598; + IntTy sizeof_y_2777__2780 = pvrtmp_7607 - pvrtmp_7606; + IntTy sizeof_y_2778__2781 = pvrtmp_7615 - pvrtmp_7614; + IntTy fltPrm_2830 = sizeof_y_2776__2779 + 0; + IntTy offset__2782 = 8 + fltPrm_2830; + IntTy fltPrm_2831 = sizeof_y_2776__2779 + sizeof_y_2777__2780; + IntTy offset__2783 = 0 + fltPrm_2831; + IntTy fltPrm_2833 = sizeof_y_2777__2780 + sizeof_y_2778__2781; + IntTy fltPrm_2832 = sizeof_y_2776__2779 + fltPrm_2833; + IntTy size_dcon_2784 = 17 + fltPrm_2832; + + *(TagTyPacked *) loc_2985 = 170; + + CursorTy writetag_5124 = loc_2985 + 1; + + *(IntTy *) writetag_5124 = size_dcon_2784; + + CursorTy writecur_5125 = writetag_5124 + sizeof(IntTy); + + *(IntTy *) writecur_5125 = offset__2782; + + CursorTy writecur_5126 = writecur_5125 + sizeof(IntTy); + + *(IntTy *) writecur_5126 = offset__2783; + + CursorTy writecur_5127 = writecur_5126 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7612, pvrtmp_7613, + loc_2985, pvrtmp_7615}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3890, tmpcur_7467); + CursorTy pvrtmp_7624 = tmp_struct_208.field0; + CursorTy pvrtmp_7625 = tmp_struct_208.field1; + CursorTy pvrtmp_7626 = tmp_struct_208.field2; + CursorTy pvrtmp_7627 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7624, pvrtmp_7627, pvrtmp_7625); + CursorTy pvrtmp_7632 = tmp_struct_209.field0; + CursorTy pvrtmp_7633 = tmp_struct_209.field1; + CursorTy pvrtmp_7634 = tmp_struct_209.field2; + CursorTy pvrtmp_7635 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7632, pvrtmp_7635, pvrtmp_7633); + CursorTy pvrtmp_7640 = tmp_struct_210.field0; + CursorTy pvrtmp_7641 = tmp_struct_210.field1; + CursorTy pvrtmp_7642 = tmp_struct_210.field2; + CursorTy pvrtmp_7643 = tmp_struct_210.field3; + IntTy sizeof_y_2788__2791 = pvrtmp_7627 - pvrtmp_7626; + IntTy sizeof_y_2789__2792 = pvrtmp_7635 - pvrtmp_7634; + IntTy sizeof_y_2790__2793 = pvrtmp_7643 - pvrtmp_7642; + IntTy fltPrm_2834 = sizeof_y_2788__2791 + 0; + IntTy offset__2794 = 8 + fltPrm_2834; + IntTy fltPrm_2835 = sizeof_y_2788__2791 + sizeof_y_2789__2792; + IntTy offset__2795 = 0 + fltPrm_2835; + IntTy fltPrm_2837 = sizeof_y_2789__2792 + sizeof_y_2790__2793; + IntTy fltPrm_2836 = sizeof_y_2788__2791 + fltPrm_2837; + IntTy size_dcon_2796 = 17 + fltPrm_2836; + + *(TagTyPacked *) loc_2985 = 172; + + CursorTy writetag_5136 = loc_2985 + 1; + + *(IntTy *) writetag_5136 = size_dcon_2796; + + CursorTy writecur_5137 = writetag_5136 + sizeof(IntTy); + + *(IntTy *) writecur_5137 = offset__2794; + + CursorTy writecur_5138 = writecur_5137 + sizeof(IntTy); + + *(IntTy *) writecur_5138 = offset__2795; + + CursorTy writecur_5139 = writecur_5138 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7640, pvrtmp_7641, + loc_2985, pvrtmp_7643}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2986, end_r_2987, loc_3917, tmpcur_7467); + CursorTy pvrtmp_7652 = tmp_struct_211.field0; + CursorTy pvrtmp_7653 = tmp_struct_211.field1; + CursorTy pvrtmp_7654 = tmp_struct_211.field2; + CursorTy pvrtmp_7655 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2986, pvrtmp_7652, pvrtmp_7655, pvrtmp_7653); + CursorTy pvrtmp_7660 = tmp_struct_212.field0; + CursorTy pvrtmp_7661 = tmp_struct_212.field1; + CursorTy pvrtmp_7662 = tmp_struct_212.field2; + CursorTy pvrtmp_7663 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2986, pvrtmp_7660, pvrtmp_7663, pvrtmp_7661); + CursorTy pvrtmp_7668 = tmp_struct_213.field0; + CursorTy pvrtmp_7669 = tmp_struct_213.field1; + CursorTy pvrtmp_7670 = tmp_struct_213.field2; + CursorTy pvrtmp_7671 = tmp_struct_213.field3; + IntTy sizeof_y_2800__2803 = pvrtmp_7655 - pvrtmp_7654; + IntTy sizeof_y_2801__2804 = pvrtmp_7663 - pvrtmp_7662; + IntTy sizeof_y_2802__2805 = pvrtmp_7671 - pvrtmp_7670; + IntTy fltPrm_2838 = sizeof_y_2800__2803 + 0; + IntTy offset__2806 = 8 + fltPrm_2838; + IntTy fltPrm_2839 = sizeof_y_2800__2803 + sizeof_y_2801__2804; + IntTy offset__2807 = 0 + fltPrm_2839; + IntTy fltPrm_2841 = sizeof_y_2801__2804 + sizeof_y_2802__2805; + IntTy fltPrm_2840 = sizeof_y_2800__2803 + fltPrm_2841; + IntTy size_dcon_2808 = 17 + fltPrm_2840; + + *(TagTyPacked *) loc_2985 = 174; + + CursorTy writetag_5148 = loc_2985 + 1; + + *(IntTy *) writetag_5148 = size_dcon_2808; + + CursorTy writecur_5149 = writetag_5148 + sizeof(IntTy); + + *(IntTy *) writecur_5149 = offset__2806; + + CursorTy writecur_5150 = writecur_5149 + sizeof(IntTy); + + *(IntTy *) writecur_5150 = offset__2807; + + CursorTy writecur_5151 = writecur_5150 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7668, pvrtmp_7669, + loc_2985, pvrtmp_7671}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7680 = *(CursorTy *) tmpcur_7467; + CursorTy tmpaftercur_7681 = tmpcur_7467 + 8; + CursorTy jump_4377 = tmpcur_7467 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_2985, tmpcur_7680); + CursorTy pvrtmp_7682 = tmp_struct_214.field0; + CursorTy pvrtmp_7683 = tmp_struct_214.field1; + CursorTy pvrtmp_7684 = tmp_struct_214.field2; + CursorTy pvrtmp_7685 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7682, jump_4377, + pvrtmp_7684, pvrtmp_7685}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7692 = *(CursorTy *) tmpcur_7467; + CursorTy tmpaftercur_7693 = tmpcur_7467 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2986, end_r_2987, loc_2985, tmpcur_7692); + CursorTy pvrtmp_7694 = tmp_struct_215.field0; + CursorTy pvrtmp_7695 = tmp_struct_215.field1; + CursorTy pvrtmp_7696 = tmp_struct_215.field2; + CursorTy pvrtmp_7697 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7694, pvrtmp_7695, + pvrtmp_7696, pvrtmp_7697}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7466"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2990, + CursorTy end_r_2991, + CursorTy loc_2989, + CursorTy arg_2809) +{ + if (loc_2989 + 32 > end_r_2991) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2991); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2991 = chunk_end_224; + *(TagTyPacked *) loc_2989 = 255; + + CursorTy redir = loc_2989 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2989 = chunk_start_223; + } + + CursorTy loc_3937 = loc_2989 + 1; + CursorTy loc_3938 = loc_3937 + 8; + TagTyPacked tmpval_7705 = *(TagTyPacked *) arg_2809; + CursorTy tmpcur_7706 = arg_2809 + 1; + + + switch_7749: + ; + switch (tmpval_7705) { + + case 0: + { + CursorTy jump_4245 = arg_2809 + 1; + + *(TagTyPacked *) loc_2989 = 0; + + CursorTy writetag_5163 = loc_2989 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2991, jump_4245, + loc_2989, writetag_5163}; + break; + } + + case 1: + { + IntTy tmpval_7711 = *(IntTy *) tmpcur_7706; + CursorTy tmpcur_7712 = tmpcur_7706 + sizeof(IntTy); + CursorTy jump_4247 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_3938, tmpcur_7712); + CursorTy pvrtmp_7713 = tmp_struct_219.field0; + CursorTy pvrtmp_7714 = tmp_struct_219.field1; + CursorTy pvrtmp_7715 = tmp_struct_219.field2; + CursorTy pvrtmp_7716 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2989 = 1; + + CursorTy writetag_5168 = loc_2989 + 1; + + *(IntTy *) writetag_5168 = tmpval_7711; + + CursorTy writecur_5169 = writetag_5168 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7713, pvrtmp_7714, + loc_2989, pvrtmp_7716}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7725 = *(CursorTy *) tmpcur_7706; + CursorTy tmpaftercur_7726 = tmpcur_7706 + 8; + CursorTy jump_4383 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_2989, tmpcur_7725); + CursorTy pvrtmp_7727 = tmp_struct_220.field0; + CursorTy pvrtmp_7728 = tmp_struct_220.field1; + CursorTy pvrtmp_7729 = tmp_struct_220.field2; + CursorTy pvrtmp_7730 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7727, jump_4383, + pvrtmp_7729, pvrtmp_7730}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7737 = *(CursorTy *) tmpcur_7706; + CursorTy tmpaftercur_7738 = tmpcur_7706 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2990, end_r_2991, loc_2989, tmpcur_7737); + CursorTy pvrtmp_7739 = tmp_struct_221.field0; + CursorTy pvrtmp_7740 = tmp_struct_221.field1; + CursorTy pvrtmp_7741 = tmp_struct_221.field2; + CursorTy pvrtmp_7742 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7739, pvrtmp_7740, + pvrtmp_7741, pvrtmp_7742}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7705"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6145, ")"); + add_symbol(6146, "(Text "); + add_symbol(6147, "(Tag "); + add_symbol(6148, "(TCA "); + add_symbol(6149, "(TAC "); + add_symbol(6150, "(Nul "); + add_symbol(6151, "(Nil "); + add_symbol(6152, "(Image "); + add_symbol(6153, "(End "); + add_symbol(6154, "(Char "); + add_symbol(6155, "(CTA "); + add_symbol(6156, "(CAT "); + add_symbol(6157, "(CA "); + add_symbol(6158, "(ATC "); + add_symbol(6159, "(ACT "); + add_symbol(6160, "(AC "); + add_symbol(6161, " ->r "); + add_symbol(6162, " ->i "); + + RegionTy *region_6163 = alloc_region(global_init_inf_buf_size); + CursorTy r_3001 = region_6163->reg_heap; + IntTy sizeof_end_r_3001_6164 = global_init_inf_buf_size; + CursorTy end_r_3001 = r_3001 + sizeof_end_r_3001_6164; + RegionTy *region_6165 = alloc_region(global_init_inf_buf_size); + CursorTy r_3000 = region_6165->reg_heap; + IntTy sizeof_end_r_3000_6166 = global_init_inf_buf_size; + CursorTy end_r_3000 = r_3000 + sizeof_end_r_3000_6166; + CursorCursorCursorProd tmp_struct_225 = + mkTACList(end_r_3001, r_3001, 100000, 10, 2000); + CursorTy pvrtmp_6167 = tmp_struct_225.field0; + CursorTy pvrtmp_6168 = tmp_struct_225.field1; + CursorTy pvrtmp_6169 = tmp_struct_225.field2; + CursorTy pvrtmp_6183; + CursorTy pvrtmp_6184; + CursorTy pvrtmp_6185; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6183; + struct timespec end_pvrtmp_6183; + + start_counters(); + for (long long iters_pvrtmp_6183 = 0; iters_pvrtmp_6183 < + global_iters_param; iters_pvrtmp_6183++) { + if (iters_pvrtmp_6183 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6183); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6167, end_r_3000, r_3000, pvrtmp_6168); + CursorTy pvrtmp_6174 = tmp_struct_226.field0; + CursorTy pvrtmp_6175 = tmp_struct_226.field1; + CursorTy pvrtmp_6176 = tmp_struct_226.field2; + + pvrtmp_6183 = pvrtmp_6174; + pvrtmp_6184 = pvrtmp_6175; + pvrtmp_6185 = pvrtmp_6176; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6183); + if (iters_pvrtmp_6183 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6183, + &end_pvrtmp_6183); + + vector_inplace_update(times_230, iters_pvrtmp_6183, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTca.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTca.c new file mode 100644 index 000000000..2ee30d758 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTca.c @@ -0,0 +1,5070 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2920, CursorTy end_r_2921, + CursorTy loc_2919, + CursorTy adt_16_902_1520); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2924, CursorTy end_r_2925, + CursorTy loc_2923, + CursorTy tags_22_908_1528, + IntTy inVal_23_909_1529); +CursorCursorCursorProd mkTCAList(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_26_912_1534, + IntTy tagLen_27_913_1535, + IntTy strLen_28_914_1536); +CursorCursorCursorProd mkString(CursorTy end_r_2929, CursorTy loc_2928, + IntTy len_181_1067_1542); +CursorCursorCursorProd mkContentText(CursorTy end_r_2931, CursorTy loc_2930, + IntTy n_195_1081_1548); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2933, CursorTy loc_2932, + IntTy len_320_1206_1550); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2936, + CursorTy end_r_2937, + CursorTy loc_2935, + CursorTy arg_624_1230_1555); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2940, + CursorTy end_r_2941, + CursorTy loc_2939, + CursorTy arg_629_1235_1560); +CursorProd _traverse_String(CursorTy end_r_2943, CursorTy arg_634_1240_1565); +CursorProd _print_String(CursorTy end_r_2945, CursorTy arg_639_1244_1569); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2948, + CursorTy end_r_2949, + CursorTy loc_2947, + CursorTy arg_648_1253_1578); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2952, + CursorTy end_r_2953, + CursorTy loc_2951, + CursorTy arg_653_1258_1583); +CursorProd _traverse_Content(CursorTy end_r_2955, CursorTy arg_658_1263_1588); +CursorProd _print_Content(CursorTy end_r_2957, CursorTy arg_663_1268_1593); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2960, CursorTy end_r_2961, + CursorTy loc_2959, + CursorTy arg_672_1277_1602); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2964, + CursorTy end_r_2965, + CursorTy loc_2963, + CursorTy arg_717_1322_1647); +CursorProd _traverse_Adt(CursorTy end_r_2967, CursorTy arg_762_1367_1692); +CursorProd _print_Adt(CursorTy end_r_2969, CursorTy arg_807_1412_1737); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2972, + CursorTy end_r_2973, CursorTy loc_2971, + CursorTy arg_870_1475_1800); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2976, + CursorTy end_r_2977, + CursorTy loc_2975, + CursorTy arg_875_1480_1805); +CursorProd _traverse_Tags(CursorTy end_r_2979, CursorTy arg_880_1485_1810); +CursorProd _print_Tags(CursorTy end_r_2981, CursorTy arg_885_1489_1814); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2984, CursorTy end_r_2985, + CursorTy loc_2983, CursorTy arg_2716); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2988, CursorTy end_r_2989, + CursorTy loc_2987, CursorTy arg_2721); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2992, + CursorTy end_r_2993, + CursorTy loc_2991, + CursorTy arg_2726); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2996, + CursorTy end_r_2997, + CursorTy loc_2995, + CursorTy arg_2815); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2920, CursorTy end_r_2921, + CursorTy loc_2919, + CursorTy adt_16_902_1520) +{ + if (loc_2919 + 32 > end_r_2921) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2921); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2921 = chunk_end_6; + *(TagTyPacked *) loc_2919 = 255; + + CursorTy redir = loc_2919 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2919 = chunk_start_5; + } + + CursorTy loc_3029 = loc_2919 + 1; + CursorTy loc_3030 = loc_3029 + 8; + CursorTy loc_3031 = loc_3030 + 8; + TagTyPacked tmpval_6202 = *(TagTyPacked *) adt_16_902_1520; + CursorTy tmpcur_6203 = adt_16_902_1520 + 1; + + + switch_6259: + ; + switch (tmpval_6202) { + + case 0: + { + CursorTy jump_3955 = adt_16_902_1520 + 1; + + *(TagTyPacked *) loc_2919 = 0; + + CursorTy writetag_4514 = loc_2919 + 1; + + return (CursorCursorCursorProd) {end_r_2921, loc_2919, + writetag_4514}; + break; + } + + case 13: + { + RegionTy *region_6208 = alloc_region(global_init_inf_buf_size); + CursorTy r_3041 = region_6208->reg_heap; + IntTy sizeof_end_r_3041_6209 = global_init_inf_buf_size; + CursorTy end_r_3041 = r_3041 + sizeof_end_r_3041_6209; + CursorTy tmpcur_6210 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6211 = tmpcur_6203 + 8; + CursorTy tmpcur_6212 = *(CursorTy *) tmpaftercur_6211; + CursorTy tmpaftercur_6213 = tmpaftercur_6211 + 8; + CursorTy jump_3958 = tmpaftercur_6211 + 8; + CursorTy jump_3957 = tmpcur_6203 + 8; + CursorCursorCursorCursorProd tmp_struct_0 = + addValTag(end_r_2920, end_r_2921, loc_3031, tmpaftercur_6213, 10); + CursorTy pvrtmp_6214 = tmp_struct_0.field0; + CursorTy pvrtmp_6215 = tmp_struct_0.field1; + CursorTy pvrtmp_6216 = tmp_struct_0.field2; + CursorTy pvrtmp_6217 = tmp_struct_0.field3; + CursorCursorCursorProd tmp_struct_1 = + addValTagsAdt(end_r_2920, end_r_3041, r_3041, tmpcur_6212); + CursorTy pvrtmp_6222 = tmp_struct_1.field0; + CursorTy pvrtmp_6223 = tmp_struct_1.field1; + CursorTy pvrtmp_6224 = tmp_struct_1.field2; + + *(TagTyPacked *) pvrtmp_6217 = 254; + + CursorTy writetag_4521 = pvrtmp_6217 + 1; + + *(CursorTy *) writetag_4521 = tmpcur_6210; + + CursorTy writecur_4522 = writetag_4521 + 8; + + *(TagTyPacked *) writecur_4522 = 254; + + CursorTy writetag_4524 = writecur_4522 + 1; + + *(CursorTy *) writetag_4524 = r_3041; + + CursorTy writecur_4525 = writetag_4524 + 8; + + *(TagTyPacked *) loc_2919 = 13; + + CursorTy writetag_4527 = loc_2919 + 1; + + *(CursorTy *) writetag_4527 = pvrtmp_6217; + + CursorTy writecur_4528 = writetag_4527 + 8; + + *(CursorTy *) writecur_4528 = writecur_4522; + + CursorTy writecur_4529 = writecur_4528 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6214, loc_2919, + writecur_4525}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6237 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6238 = tmpcur_6203 + 8; + CursorTy jump_4267 = tmpcur_6203 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2920, end_r_2921, loc_2919, tmpcur_6237); + CursorTy pvrtmp_6239 = tmp_struct_2.field0; + CursorTy pvrtmp_6240 = tmp_struct_2.field1; + CursorTy pvrtmp_6241 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6239, pvrtmp_6240, + pvrtmp_6241}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6248 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6249 = tmpcur_6203 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2920, end_r_2921, loc_2919, tmpcur_6248); + CursorTy pvrtmp_6250 = tmp_struct_3.field0; + CursorTy pvrtmp_6251 = tmp_struct_3.field1; + CursorTy pvrtmp_6252 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6250, pvrtmp_6251, + pvrtmp_6252}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6202"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2924, CursorTy end_r_2925, + CursorTy loc_2923, + CursorTy tags_22_908_1528, + IntTy inVal_23_909_1529) +{ + if (loc_2923 + 32 > end_r_2925) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2925); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2925 = chunk_end_12; + *(TagTyPacked *) loc_2923 = 255; + + CursorTy redir = loc_2923 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2923 = chunk_start_11; + } + + CursorTy loc_3050 = loc_2923 + 1; + CursorTy loc_3051 = loc_3050 + 8; + TagTyPacked tmpval_6260 = *(TagTyPacked *) tags_22_908_1528; + CursorTy tmpcur_6261 = tags_22_908_1528 + 1; + + + switch_6304: + ; + switch (tmpval_6260) { + + case 0: + { + CursorTy jump_3961 = tags_22_908_1528 + 1; + + *(TagTyPacked *) loc_2923 = 0; + + CursorTy writetag_4541 = loc_2923 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2925, jump_3961, + loc_2923, writetag_4541}; + break; + } + + case 1: + { + IntTy tmpval_6266 = *(IntTy *) tmpcur_6261; + CursorTy tmpcur_6267 = tmpcur_6261 + sizeof(IntTy); + CursorTy jump_3963 = tmpcur_6261 + 8; + IntTy fltPkd_1508_1532 = tmpval_6266 + inVal_23_909_1529; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2924, end_r_2925, loc_3051, tmpcur_6267, inVal_23_909_1529); + CursorTy pvrtmp_6268 = tmp_struct_7.field0; + CursorTy pvrtmp_6269 = tmp_struct_7.field1; + CursorTy pvrtmp_6270 = tmp_struct_7.field2; + CursorTy pvrtmp_6271 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2923 = 1; + + CursorTy writetag_4546 = loc_2923 + 1; + + *(IntTy *) writetag_4546 = fltPkd_1508_1532; + + CursorTy writecur_4547 = writetag_4546 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6268, pvrtmp_6269, + loc_2923, pvrtmp_6271}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6280 = *(CursorTy *) tmpcur_6261; + CursorTy tmpaftercur_6281 = tmpcur_6261 + 8; + CursorTy jump_4272 = tmpcur_6261 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2924, end_r_2925, loc_2923, tmpcur_6280, inVal_23_909_1529); + CursorTy pvrtmp_6282 = tmp_struct_8.field0; + CursorTy pvrtmp_6283 = tmp_struct_8.field1; + CursorTy pvrtmp_6284 = tmp_struct_8.field2; + CursorTy pvrtmp_6285 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6282, jump_4272, + pvrtmp_6284, pvrtmp_6285}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6292 = *(CursorTy *) tmpcur_6261; + CursorTy tmpaftercur_6293 = tmpcur_6261 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2924, end_r_2925, loc_2923, tmpcur_6292, inVal_23_909_1529); + CursorTy pvrtmp_6294 = tmp_struct_9.field0; + CursorTy pvrtmp_6295 = tmp_struct_9.field1; + CursorTy pvrtmp_6296 = tmp_struct_9.field2; + CursorTy pvrtmp_6297 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6294, pvrtmp_6295, + pvrtmp_6296, pvrtmp_6297}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6260"); + exit(1); + } + } +} +CursorCursorCursorProd mkTCAList(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_26_912_1534, + IntTy tagLen_27_913_1535, + IntTy strLen_28_914_1536) +{ + if (loc_2926 + 32 > end_r_2927) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2927); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2927 = chunk_end_18; + *(TagTyPacked *) loc_2926 = 255; + + CursorTy redir = loc_2926 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2926 = chunk_start_17; + } + + CursorTy loc_3059 = loc_2926 + 1; + CursorTy loc_3060 = loc_3059 + 8; + CursorTy loc_3061 = loc_3060 + 8; + BoolTy fltIf_1510_1537 = len_26_912_1534 <= 0; + + if (fltIf_1510_1537) { + *(TagTyPacked *) loc_2926 = 0; + + CursorTy writetag_4556 = loc_2926 + 1; + + return (CursorCursorCursorProd) {end_r_2927, loc_2926, writetag_4556}; + } else { + CursorCursorCursorProd tmp_struct_13 = + mkRandomTags(end_r_2927, loc_3061, tagLen_27_913_1535); + CursorTy pvrtmp_6309 = tmp_struct_13.field0; + CursorTy pvrtmp_6310 = tmp_struct_13.field1; + CursorTy pvrtmp_6311 = tmp_struct_13.field2; + CursorCursorCursorProd tmp_struct_14 = + mkContentText(pvrtmp_6309, pvrtmp_6311, strLen_28_914_1536); + CursorTy pvrtmp_6316 = tmp_struct_14.field0; + CursorTy pvrtmp_6317 = tmp_struct_14.field1; + CursorTy pvrtmp_6318 = tmp_struct_14.field2; + IntTy fltAppE_1511_1540 = len_26_912_1534 - 1; + CursorCursorCursorProd tmp_struct_15 = + mkTCAList(pvrtmp_6316, pvrtmp_6318, fltAppE_1511_1540, tagLen_27_913_1535, strLen_28_914_1536); + CursorTy pvrtmp_6323 = tmp_struct_15.field0; + CursorTy pvrtmp_6324 = tmp_struct_15.field1; + CursorTy pvrtmp_6325 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2926 = 13; + + CursorTy writetag_4561 = loc_2926 + 1; + + *(CursorTy *) writetag_4561 = pvrtmp_6311; + + CursorTy writecur_4562 = writetag_4561 + 8; + + *(CursorTy *) writecur_4562 = pvrtmp_6318; + + CursorTy writecur_4563 = writecur_4562 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6323, loc_2926, pvrtmp_6325}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2929, CursorTy loc_2928, + IntTy len_181_1067_1542) +{ + if (loc_2928 + 32 > end_r_2929) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2929); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2929 = chunk_end_22; + *(TagTyPacked *) loc_2928 = 255; + + CursorTy redir = loc_2928 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2928 = chunk_start_21; + } + + CursorTy loc_3073 = loc_2928 + 1; + CursorTy loc_3074 = loc_3073 + 8; + BoolTy fltIf_1512_1543 = len_181_1067_1542 <= 0; + + if (fltIf_1512_1543) { + *(TagTyPacked *) loc_2928 = 0; + + CursorTy writetag_4568 = loc_2928 + 1; + + return (CursorCursorCursorProd) {end_r_2929, loc_2928, writetag_4568}; + } else { + IntTy fltPrm_1513_1544 = rand(); + IntTy randomChar_182_1068_1545 = fltPrm_1513_1544 % 128; + IntTy fltAppE_1514_1546 = len_181_1067_1542 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2929, loc_3074, fltAppE_1514_1546); + CursorTy pvrtmp_6338 = tmp_struct_19.field0; + CursorTy pvrtmp_6339 = tmp_struct_19.field1; + CursorTy pvrtmp_6340 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2928 = 1; + + CursorTy writetag_4571 = loc_2928 + 1; + + *(IntTy *) writetag_4571 = randomChar_182_1068_1545; + + CursorTy writecur_4572 = writetag_4571 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6338, loc_2928, pvrtmp_6340}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2931, CursorTy loc_2930, + IntTy n_195_1081_1548) +{ + if (loc_2930 + 32 > end_r_2931) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2931); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2931 = chunk_end_26; + *(TagTyPacked *) loc_2930 = 255; + + CursorTy redir = loc_2930 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2930 = chunk_start_25; + } + + CursorTy loc_3079 = loc_2930 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2931, loc_3079, n_195_1081_1548); + CursorTy pvrtmp_6349 = tmp_struct_23.field0; + CursorTy pvrtmp_6350 = tmp_struct_23.field1; + CursorTy pvrtmp_6351 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2930 = 1; + + CursorTy writetag_4576 = loc_2930 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6349, loc_2930, pvrtmp_6351}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2933, CursorTy loc_2932, + IntTy len_320_1206_1550) +{ + if (loc_2932 + 32 > end_r_2933) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2933); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2933 = chunk_end_30; + *(TagTyPacked *) loc_2932 = 255; + + CursorTy redir = loc_2932 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2932 = chunk_start_29; + } + + CursorTy loc_3083 = loc_2932 + 1; + CursorTy loc_3084 = loc_3083 + 8; + BoolTy fltIf_1516_1551 = len_320_1206_1550 <= 0; + + if (fltIf_1516_1551) { + *(TagTyPacked *) loc_2932 = 0; + + CursorTy writetag_4579 = loc_2932 + 1; + + return (CursorCursorCursorProd) {end_r_2933, loc_2932, writetag_4579}; + } else { + IntTy fltAppE_1517_1553 = len_320_1206_1550 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2933, loc_3084, fltAppE_1517_1553); + CursorTy pvrtmp_6364 = tmp_struct_27.field0; + CursorTy pvrtmp_6365 = tmp_struct_27.field1; + CursorTy pvrtmp_6366 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2932 = 1; + + CursorTy writetag_4582 = loc_2932 + 1; + + *(IntTy *) writetag_4582 = 100; + + CursorTy writecur_4583 = writetag_4582 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6364, loc_2932, pvrtmp_6366}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2936, + CursorTy end_r_2937, + CursorTy loc_2935, + CursorTy arg_624_1230_1555) +{ + if (loc_2935 + 32 > end_r_2937) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2937); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2937 = chunk_end_36; + *(TagTyPacked *) loc_2935 = 255; + + CursorTy redir = loc_2935 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2935 = chunk_start_35; + } + + CursorTy loc_3094 = loc_2935 + 1; + CursorTy loc_3095 = loc_3094 + 8; + TagTyPacked tmpval_6375 = *(TagTyPacked *) arg_624_1230_1555; + CursorTy tmpcur_6376 = arg_624_1230_1555 + 1; + + + switch_6419: + ; + switch (tmpval_6375) { + + case 0: + { + CursorTy jump_3973 = arg_624_1230_1555 + 1; + + *(TagTyPacked *) loc_2935 = 0; + + CursorTy writetag_4587 = loc_2935 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2937, jump_3973, + loc_2935, writetag_4587}; + break; + } + + case 1: + { + IntTy tmpval_6381 = *(IntTy *) tmpcur_6376; + CursorTy tmpcur_6382 = tmpcur_6376 + sizeof(IntTy); + CursorTy jump_3975 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2936, end_r_2937, loc_3095, tmpcur_6382); + CursorTy pvrtmp_6383 = tmp_struct_31.field0; + CursorTy pvrtmp_6384 = tmp_struct_31.field1; + CursorTy pvrtmp_6385 = tmp_struct_31.field2; + CursorTy pvrtmp_6386 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2935 = 1; + + CursorTy writetag_4592 = loc_2935 + 1; + + *(IntTy *) writetag_4592 = tmpval_6381; + + CursorTy writecur_4593 = writetag_4592 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6383, pvrtmp_6384, + loc_2935, pvrtmp_6386}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6395 = *(CursorTy *) tmpcur_6376; + CursorTy tmpaftercur_6396 = tmpcur_6376 + 8; + CursorTy jump_4278 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2936, end_r_2937, loc_2935, tmpcur_6395); + CursorTy pvrtmp_6397 = tmp_struct_32.field0; + CursorTy pvrtmp_6398 = tmp_struct_32.field1; + CursorTy pvrtmp_6399 = tmp_struct_32.field2; + CursorTy pvrtmp_6400 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6397, jump_4278, + pvrtmp_6399, pvrtmp_6400}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6407 = *(CursorTy *) tmpcur_6376; + CursorTy tmpaftercur_6408 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2936, end_r_2937, loc_2935, tmpcur_6407); + CursorTy pvrtmp_6409 = tmp_struct_33.field0; + CursorTy pvrtmp_6410 = tmp_struct_33.field1; + CursorTy pvrtmp_6411 = tmp_struct_33.field2; + CursorTy pvrtmp_6412 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6409, pvrtmp_6410, + pvrtmp_6411, pvrtmp_6412}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6375"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2940, + CursorTy end_r_2941, + CursorTy loc_2939, + CursorTy arg_629_1235_1560) +{ + CursorTy loc_3107 = loc_2939 + 1; + CursorTy loc_3108 = loc_3107 + 8; + TagTyPacked tmpval_6420 = *(TagTyPacked *) arg_629_1235_1560; + CursorTy tmpcur_6421 = arg_629_1235_1560 + 1; + + + switch_6464: + ; + switch (tmpval_6420) { + + case 0: + { + CursorTy jump_3978 = arg_629_1235_1560 + 1; + + *(TagTyPacked *) loc_2939 = 0; + + CursorTy writetag_4603 = loc_2939 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2941, jump_3978, + loc_2939, writetag_4603}; + break; + } + + case 1: + { + IntTy tmpval_6426 = *(IntTy *) tmpcur_6421; + CursorTy tmpcur_6427 = tmpcur_6421 + sizeof(IntTy); + CursorTy jump_3980 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_3108, tmpcur_6427); + CursorTy pvrtmp_6428 = tmp_struct_37.field0; + CursorTy pvrtmp_6429 = tmp_struct_37.field1; + CursorTy pvrtmp_6430 = tmp_struct_37.field2; + CursorTy pvrtmp_6431 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2939 = 1; + + CursorTy writetag_4608 = loc_2939 + 1; + + *(IntTy *) writetag_4608 = tmpval_6426; + + CursorTy writecur_4609 = writetag_4608 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6428, pvrtmp_6429, + loc_2939, pvrtmp_6431}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6440 = *(CursorTy *) tmpcur_6421; + CursorTy tmpaftercur_6441 = tmpcur_6421 + 8; + CursorTy jump_4284 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_2939, tmpcur_6440); + CursorTy pvrtmp_6442 = tmp_struct_38.field0; + CursorTy pvrtmp_6443 = tmp_struct_38.field1; + CursorTy pvrtmp_6444 = tmp_struct_38.field2; + CursorTy pvrtmp_6445 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6442, jump_4284, + pvrtmp_6444, pvrtmp_6445}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6452 = *(CursorTy *) tmpcur_6421; + CursorTy tmpaftercur_6453 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_2939, tmpcur_6452); + CursorTy pvrtmp_6454 = tmp_struct_39.field0; + CursorTy pvrtmp_6455 = tmp_struct_39.field1; + CursorTy pvrtmp_6456 = tmp_struct_39.field2; + CursorTy pvrtmp_6457 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6454, pvrtmp_6455, + pvrtmp_6456, pvrtmp_6457}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6420"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2943, CursorTy arg_634_1240_1565) +{ + TagTyPacked tmpval_6465 = *(TagTyPacked *) arg_634_1240_1565; + CursorTy tmpcur_6466 = arg_634_1240_1565 + 1; + + + switch_6476: + ; + switch (tmpval_6465) { + + case 0: + { + CursorTy jump_3983 = arg_634_1240_1565 + 1; + + return (CursorProd) {jump_3983}; + break; + } + + case 1: + { + IntTy tmpval_6467 = *(IntTy *) tmpcur_6466; + CursorTy tmpcur_6468 = tmpcur_6466 + sizeof(IntTy); + CursorTy jump_3985 = tmpcur_6466 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2943, tmpcur_6468); + CursorTy pvrtmp_6469 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6469}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6470 = *(CursorTy *) tmpcur_6466; + CursorTy tmpaftercur_6471 = tmpcur_6466 + 8; + CursorTy jump_4290 = tmpcur_6466 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2943, tmpcur_6470); + CursorTy pvrtmp_6472 = tmp_struct_41.field0; + + return (CursorProd) {jump_4290}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6473 = *(CursorTy *) tmpcur_6466; + CursorTy tmpaftercur_6474 = tmpcur_6466 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2943, tmpcur_6473); + CursorTy pvrtmp_6475 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6475}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6465"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2945, CursorTy arg_639_1244_1569) +{ + TagTyPacked tmpval_6477 = *(TagTyPacked *) arg_639_1244_1569; + CursorTy tmpcur_6478 = arg_639_1244_1569 + 1; + + + switch_6488: + ; + switch (tmpval_6477) { + + case 0: + { + CursorTy jump_3988 = arg_639_1244_1569 + 1; + unsigned char wildcard_640_1245_1570 = print_symbol(6162); + unsigned char wildcard_641_1246_1571 = print_symbol(6154); + + return (CursorProd) {jump_3988}; + break; + } + + case 1: + { + IntTy tmpval_6479 = *(IntTy *) tmpcur_6478; + CursorTy tmpcur_6480 = tmpcur_6478 + sizeof(IntTy); + CursorTy jump_3990 = tmpcur_6478 + 8; + unsigned char wildcard_646_1249_1574 = print_symbol(6163); + unsigned char y_644_1250_1575 = printf("%lld", tmpval_6479); + CursorProd tmp_struct_43 = _print_String(end_r_2945, tmpcur_6480); + CursorTy pvrtmp_6481 = tmp_struct_43.field0; + unsigned char wildcard_647_1252_1577 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6481}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6482 = *(CursorTy *) tmpcur_6478; + CursorTy tmpaftercur_6483 = tmpcur_6478 + 8; + CursorTy jump_4296 = tmpcur_6478 + 8; + unsigned char wildcard_4299 = print_symbol(6171); + CursorProd tmp_struct_44 = _print_String(end_r_2945, tmpcur_6482); + CursorTy pvrtmp_6484 = tmp_struct_44.field0; + + return (CursorProd) {jump_4296}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6485 = *(CursorTy *) tmpcur_6478; + CursorTy tmpaftercur_6486 = tmpcur_6478 + 8; + unsigned char wildcard_4299 = print_symbol(6170); + CursorProd tmp_struct_45 = _print_String(end_r_2945, tmpcur_6485); + CursorTy pvrtmp_6487 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6487}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6477"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2948, + CursorTy end_r_2949, + CursorTy loc_2947, + CursorTy arg_648_1253_1578) +{ + if (loc_2947 + 32 > end_r_2949) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2949); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2949 = chunk_end_52; + *(TagTyPacked *) loc_2947 = 255; + + CursorTy redir = loc_2947 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2947 = chunk_start_51; + } + + TagTyPacked tmpval_6489 = *(TagTyPacked *) arg_648_1253_1578; + CursorTy tmpcur_6490 = arg_648_1253_1578 + 1; + + + switch_6539: + ; + switch (tmpval_6489) { + + case 0: + { + CursorTy loc_3130 = loc_2947 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2948, end_r_2949, loc_3130, tmpcur_6490); + CursorTy pvrtmp_6491 = tmp_struct_46.field0; + CursorTy pvrtmp_6492 = tmp_struct_46.field1; + CursorTy pvrtmp_6493 = tmp_struct_46.field2; + CursorTy pvrtmp_6494 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2947 = 0; + + CursorTy writetag_4640 = loc_2947 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6491, pvrtmp_6492, + loc_2947, pvrtmp_6494}; + break; + } + + case 1: + { + CursorTy loc_3136 = loc_2947 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2948, end_r_2949, loc_3136, tmpcur_6490); + CursorTy pvrtmp_6503 = tmp_struct_47.field0; + CursorTy pvrtmp_6504 = tmp_struct_47.field1; + CursorTy pvrtmp_6505 = tmp_struct_47.field2; + CursorTy pvrtmp_6506 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2947 = 1; + + CursorTy writetag_4645 = loc_2947 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6503, pvrtmp_6504, + loc_2947, pvrtmp_6506}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6515 = *(CursorTy *) tmpcur_6490; + CursorTy tmpaftercur_6516 = tmpcur_6490 + 8; + CursorTy jump_4302 = tmpcur_6490 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2948, end_r_2949, loc_2947, tmpcur_6515); + CursorTy pvrtmp_6517 = tmp_struct_48.field0; + CursorTy pvrtmp_6518 = tmp_struct_48.field1; + CursorTy pvrtmp_6519 = tmp_struct_48.field2; + CursorTy pvrtmp_6520 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6517, jump_4302, + pvrtmp_6519, pvrtmp_6520}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6527 = *(CursorTy *) tmpcur_6490; + CursorTy tmpaftercur_6528 = tmpcur_6490 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2948, end_r_2949, loc_2947, tmpcur_6527); + CursorTy pvrtmp_6529 = tmp_struct_49.field0; + CursorTy pvrtmp_6530 = tmp_struct_49.field1; + CursorTy pvrtmp_6531 = tmp_struct_49.field2; + CursorTy pvrtmp_6532 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6529, pvrtmp_6530, + pvrtmp_6531, pvrtmp_6532}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6489"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2952, + CursorTy end_r_2953, + CursorTy loc_2951, + CursorTy arg_653_1258_1583) +{ + TagTyPacked tmpval_6540 = *(TagTyPacked *) arg_653_1258_1583; + CursorTy tmpcur_6541 = arg_653_1258_1583 + 1; + + + switch_6590: + ; + switch (tmpval_6540) { + + case 0: + { + CursorTy loc_3144 = loc_2951 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2952, end_r_2953, loc_3144, tmpcur_6541); + CursorTy pvrtmp_6542 = tmp_struct_53.field0; + CursorTy pvrtmp_6543 = tmp_struct_53.field1; + CursorTy pvrtmp_6544 = tmp_struct_53.field2; + CursorTy pvrtmp_6545 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2951 = 0; + + CursorTy writetag_4656 = loc_2951 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6542, pvrtmp_6543, + loc_2951, pvrtmp_6545}; + break; + } + + case 1: + { + CursorTy loc_3150 = loc_2951 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2952, end_r_2953, loc_3150, tmpcur_6541); + CursorTy pvrtmp_6554 = tmp_struct_54.field0; + CursorTy pvrtmp_6555 = tmp_struct_54.field1; + CursorTy pvrtmp_6556 = tmp_struct_54.field2; + CursorTy pvrtmp_6557 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2951 = 1; + + CursorTy writetag_4661 = loc_2951 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6554, pvrtmp_6555, + loc_2951, pvrtmp_6557}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6566 = *(CursorTy *) tmpcur_6541; + CursorTy tmpaftercur_6567 = tmpcur_6541 + 8; + CursorTy jump_4308 = tmpcur_6541 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2952, end_r_2953, loc_2951, tmpcur_6566); + CursorTy pvrtmp_6568 = tmp_struct_55.field0; + CursorTy pvrtmp_6569 = tmp_struct_55.field1; + CursorTy pvrtmp_6570 = tmp_struct_55.field2; + CursorTy pvrtmp_6571 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6568, jump_4308, + pvrtmp_6570, pvrtmp_6571}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6578 = *(CursorTy *) tmpcur_6541; + CursorTy tmpaftercur_6579 = tmpcur_6541 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2952, end_r_2953, loc_2951, tmpcur_6578); + CursorTy pvrtmp_6580 = tmp_struct_56.field0; + CursorTy pvrtmp_6581 = tmp_struct_56.field1; + CursorTy pvrtmp_6582 = tmp_struct_56.field2; + CursorTy pvrtmp_6583 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6580, pvrtmp_6581, + pvrtmp_6582, pvrtmp_6583}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6540"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2955, CursorTy arg_658_1263_1588) +{ + TagTyPacked tmpval_6591 = *(TagTyPacked *) arg_658_1263_1588; + CursorTy tmpcur_6592 = arg_658_1263_1588 + 1; + + + switch_6601: + ; + switch (tmpval_6591) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2955, tmpcur_6592); + CursorTy pvrtmp_6593 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6593}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2955, tmpcur_6592); + CursorTy pvrtmp_6594 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6594}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6595 = *(CursorTy *) tmpcur_6592; + CursorTy tmpaftercur_6596 = tmpcur_6592 + 8; + CursorTy jump_4314 = tmpcur_6592 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2955, tmpcur_6595); + CursorTy pvrtmp_6597 = tmp_struct_59.field0; + + return (CursorProd) {jump_4314}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6598 = *(CursorTy *) tmpcur_6592; + CursorTy tmpaftercur_6599 = tmpcur_6592 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2955, tmpcur_6598); + CursorTy pvrtmp_6600 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6600}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6591"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2957, CursorTy arg_663_1268_1593) +{ + TagTyPacked tmpval_6602 = *(TagTyPacked *) arg_663_1268_1593; + CursorTy tmpcur_6603 = arg_663_1268_1593 + 1; + + + switch_6612: + ; + switch (tmpval_6602) { + + case 0: + { + unsigned char wildcard_666_1270_1595 = print_symbol(6161); + CursorProd tmp_struct_61 = _print_String(end_r_2957, tmpcur_6603); + CursorTy pvrtmp_6604 = tmp_struct_61.field0; + unsigned char wildcard_667_1272_1597 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6604}; + break; + } + + case 1: + { + unsigned char wildcard_670_1274_1599 = print_symbol(6155); + CursorProd tmp_struct_62 = _print_String(end_r_2957, tmpcur_6603); + CursorTy pvrtmp_6605 = tmp_struct_62.field0; + unsigned char wildcard_671_1276_1601 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6605}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6606 = *(CursorTy *) tmpcur_6603; + CursorTy tmpaftercur_6607 = tmpcur_6603 + 8; + CursorTy jump_4320 = tmpcur_6603 + 8; + unsigned char wildcard_4323 = print_symbol(6171); + CursorProd tmp_struct_63 = _print_Content(end_r_2957, tmpcur_6606); + CursorTy pvrtmp_6608 = tmp_struct_63.field0; + + return (CursorProd) {jump_4320}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6609 = *(CursorTy *) tmpcur_6603; + CursorTy tmpaftercur_6610 = tmpcur_6603 + 8; + unsigned char wildcard_4323 = print_symbol(6170); + CursorProd tmp_struct_64 = _print_Content(end_r_2957, tmpcur_6609); + CursorTy pvrtmp_6611 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6611}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6602"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2960, CursorTy end_r_2961, + CursorTy loc_2959, + CursorTy arg_672_1277_1602) +{ + if (loc_2959 + 32 > end_r_2961) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2961); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2961 = chunk_end_91; + *(TagTyPacked *) loc_2959 = 255; + + CursorTy redir = loc_2959 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2959 = chunk_start_90; + } + + CursorTy loc_3180 = loc_2959 + 1; + CursorTy loc_3181 = loc_3180 + 8; + CursorTy loc_3196 = loc_2959 + 1; + CursorTy loc_3197 = loc_3196 + 8; + CursorTy loc_3217 = loc_2959 + 1; + CursorTy loc_3218 = loc_3217 + 8; + CursorTy loc_3219 = loc_3218 + 8; + CursorTy loc_3243 = loc_2959 + 1; + CursorTy loc_3244 = loc_3243 + 8; + CursorTy loc_3245 = loc_3244 + 8; + CursorTy loc_3269 = loc_2959 + 1; + CursorTy loc_3270 = loc_3269 + 8; + CursorTy loc_3271 = loc_3270 + 8; + CursorTy loc_3295 = loc_2959 + 1; + CursorTy loc_3296 = loc_3295 + 8; + CursorTy loc_3297 = loc_3296 + 8; + CursorTy loc_3321 = loc_2959 + 1; + CursorTy loc_3322 = loc_3321 + 8; + CursorTy loc_3323 = loc_3322 + 8; + CursorTy loc_3347 = loc_2959 + 1; + CursorTy loc_3348 = loc_3347 + 8; + CursorTy loc_3349 = loc_3348 + 8; + TagTyPacked tmpval_6613 = *(TagTyPacked *) arg_672_1277_1602; + CursorTy tmpcur_6614 = arg_672_1277_1602 + 1; + + + switch_6879: + ; + switch (tmpval_6613) { + + case 0: + { + CursorTy jump_4009 = arg_672_1277_1602 + 1; + + *(TagTyPacked *) loc_2959 = 0; + + CursorTy writetag_4691 = loc_2959 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2961, jump_4009, + loc_2959, writetag_4691}; + break; + } + + case 9: + { + CursorTy tmpcur_6619 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6620 = tmpcur_6614 + 8; + CursorTy jump_4011 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2960, end_r_2961, loc_3181, tmpaftercur_6620); + CursorTy pvrtmp_6621 = tmp_struct_65.field0; + CursorTy pvrtmp_6622 = tmp_struct_65.field1; + CursorTy pvrtmp_6623 = tmp_struct_65.field2; + CursorTy pvrtmp_6624 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2960, pvrtmp_6621, pvrtmp_6624, tmpcur_6619); + CursorTy pvrtmp_6629 = tmp_struct_66.field0; + CursorTy pvrtmp_6630 = tmp_struct_66.field1; + CursorTy pvrtmp_6631 = tmp_struct_66.field2; + CursorTy pvrtmp_6632 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2959 = 9; + + CursorTy writetag_4697 = loc_2959 + 1; + + *(CursorTy *) writetag_4697 = pvrtmp_6624; + + CursorTy writecur_4698 = writetag_4697 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6629, pvrtmp_6630, + loc_2959, pvrtmp_6632}; + break; + } + + case 11: + { + CursorTy tmpcur_6641 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6642 = tmpcur_6614 + 8; + CursorTy jump_4015 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2960, end_r_2961, loc_3197, tmpaftercur_6642); + CursorTy pvrtmp_6643 = tmp_struct_67.field0; + CursorTy pvrtmp_6644 = tmp_struct_67.field1; + CursorTy pvrtmp_6645 = tmp_struct_67.field2; + CursorTy pvrtmp_6646 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2960, pvrtmp_6643, pvrtmp_6646, tmpcur_6641); + CursorTy pvrtmp_6651 = tmp_struct_68.field0; + CursorTy pvrtmp_6652 = tmp_struct_68.field1; + CursorTy pvrtmp_6653 = tmp_struct_68.field2; + CursorTy pvrtmp_6654 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2959 = 11; + + CursorTy writetag_4706 = loc_2959 + 1; + + *(CursorTy *) writetag_4706 = pvrtmp_6646; + + CursorTy writecur_4707 = writetag_4706 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6651, pvrtmp_6652, + loc_2959, pvrtmp_6654}; + break; + } + + case 13: + { + CursorTy tmpcur_6663 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6664 = tmpcur_6614 + 8; + CursorTy tmpcur_6665 = *(CursorTy *) tmpaftercur_6664; + CursorTy tmpaftercur_6666 = tmpaftercur_6664 + 8; + CursorTy jump_4020 = tmpaftercur_6664 + 8; + CursorTy jump_4019 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2960, end_r_2961, loc_3219, tmpaftercur_6666); + CursorTy pvrtmp_6667 = tmp_struct_69.field0; + CursorTy pvrtmp_6668 = tmp_struct_69.field1; + CursorTy pvrtmp_6669 = tmp_struct_69.field2; + CursorTy pvrtmp_6670 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2960, pvrtmp_6667, pvrtmp_6670, tmpcur_6663); + CursorTy pvrtmp_6675 = tmp_struct_70.field0; + CursorTy pvrtmp_6676 = tmp_struct_70.field1; + CursorTy pvrtmp_6677 = tmp_struct_70.field2; + CursorTy pvrtmp_6678 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2960, pvrtmp_6675, pvrtmp_6678, tmpcur_6665); + CursorTy pvrtmp_6683 = tmp_struct_71.field0; + CursorTy pvrtmp_6684 = tmp_struct_71.field1; + CursorTy pvrtmp_6685 = tmp_struct_71.field2; + CursorTy pvrtmp_6686 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2959 = 13; + + CursorTy writetag_4717 = loc_2959 + 1; + + *(CursorTy *) writetag_4717 = pvrtmp_6670; + + CursorTy writecur_4718 = writetag_4717 + 8; + + *(CursorTy *) writecur_4718 = pvrtmp_6678; + + CursorTy writecur_4719 = writecur_4718 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6683, pvrtmp_6684, + loc_2959, pvrtmp_6686}; + break; + } + + case 15: + { + CursorTy tmpcur_6695 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6696 = tmpcur_6614 + 8; + CursorTy tmpcur_6697 = *(CursorTy *) tmpaftercur_6696; + CursorTy tmpaftercur_6698 = tmpaftercur_6696 + 8; + CursorTy jump_4026 = tmpaftercur_6696 + 8; + CursorTy jump_4025 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2960, end_r_2961, loc_3245, tmpaftercur_6698); + CursorTy pvrtmp_6699 = tmp_struct_72.field0; + CursorTy pvrtmp_6700 = tmp_struct_72.field1; + CursorTy pvrtmp_6701 = tmp_struct_72.field2; + CursorTy pvrtmp_6702 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2960, pvrtmp_6699, pvrtmp_6702, tmpcur_6695); + CursorTy pvrtmp_6707 = tmp_struct_73.field0; + CursorTy pvrtmp_6708 = tmp_struct_73.field1; + CursorTy pvrtmp_6709 = tmp_struct_73.field2; + CursorTy pvrtmp_6710 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2960, pvrtmp_6707, pvrtmp_6710, tmpcur_6697); + CursorTy pvrtmp_6715 = tmp_struct_74.field0; + CursorTy pvrtmp_6716 = tmp_struct_74.field1; + CursorTy pvrtmp_6717 = tmp_struct_74.field2; + CursorTy pvrtmp_6718 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2959 = 15; + + CursorTy writetag_4730 = loc_2959 + 1; + + *(CursorTy *) writetag_4730 = pvrtmp_6702; + + CursorTy writecur_4731 = writetag_4730 + 8; + + *(CursorTy *) writecur_4731 = pvrtmp_6710; + + CursorTy writecur_4732 = writecur_4731 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6715, pvrtmp_6716, + loc_2959, pvrtmp_6718}; + break; + } + + case 17: + { + CursorTy tmpcur_6727 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6728 = tmpcur_6614 + 8; + CursorTy tmpcur_6729 = *(CursorTy *) tmpaftercur_6728; + CursorTy tmpaftercur_6730 = tmpaftercur_6728 + 8; + CursorTy jump_4032 = tmpaftercur_6728 + 8; + CursorTy jump_4031 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2960, end_r_2961, loc_3271, tmpaftercur_6730); + CursorTy pvrtmp_6731 = tmp_struct_75.field0; + CursorTy pvrtmp_6732 = tmp_struct_75.field1; + CursorTy pvrtmp_6733 = tmp_struct_75.field2; + CursorTy pvrtmp_6734 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2960, pvrtmp_6731, pvrtmp_6734, tmpcur_6727); + CursorTy pvrtmp_6739 = tmp_struct_76.field0; + CursorTy pvrtmp_6740 = tmp_struct_76.field1; + CursorTy pvrtmp_6741 = tmp_struct_76.field2; + CursorTy pvrtmp_6742 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2960, pvrtmp_6739, pvrtmp_6742, tmpcur_6729); + CursorTy pvrtmp_6747 = tmp_struct_77.field0; + CursorTy pvrtmp_6748 = tmp_struct_77.field1; + CursorTy pvrtmp_6749 = tmp_struct_77.field2; + CursorTy pvrtmp_6750 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2959 = 17; + + CursorTy writetag_4743 = loc_2959 + 1; + + *(CursorTy *) writetag_4743 = pvrtmp_6734; + + CursorTy writecur_4744 = writetag_4743 + 8; + + *(CursorTy *) writecur_4744 = pvrtmp_6742; + + CursorTy writecur_4745 = writecur_4744 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6747, pvrtmp_6748, + loc_2959, pvrtmp_6750}; + break; + } + + case 19: + { + CursorTy tmpcur_6759 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6760 = tmpcur_6614 + 8; + CursorTy tmpcur_6761 = *(CursorTy *) tmpaftercur_6760; + CursorTy tmpaftercur_6762 = tmpaftercur_6760 + 8; + CursorTy jump_4038 = tmpaftercur_6760 + 8; + CursorTy jump_4037 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2960, end_r_2961, loc_3297, tmpaftercur_6762); + CursorTy pvrtmp_6763 = tmp_struct_78.field0; + CursorTy pvrtmp_6764 = tmp_struct_78.field1; + CursorTy pvrtmp_6765 = tmp_struct_78.field2; + CursorTy pvrtmp_6766 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2960, pvrtmp_6763, pvrtmp_6766, tmpcur_6759); + CursorTy pvrtmp_6771 = tmp_struct_79.field0; + CursorTy pvrtmp_6772 = tmp_struct_79.field1; + CursorTy pvrtmp_6773 = tmp_struct_79.field2; + CursorTy pvrtmp_6774 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2960, pvrtmp_6771, pvrtmp_6774, tmpcur_6761); + CursorTy pvrtmp_6779 = tmp_struct_80.field0; + CursorTy pvrtmp_6780 = tmp_struct_80.field1; + CursorTy pvrtmp_6781 = tmp_struct_80.field2; + CursorTy pvrtmp_6782 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2959 = 19; + + CursorTy writetag_4756 = loc_2959 + 1; + + *(CursorTy *) writetag_4756 = pvrtmp_6766; + + CursorTy writecur_4757 = writetag_4756 + 8; + + *(CursorTy *) writecur_4757 = pvrtmp_6774; + + CursorTy writecur_4758 = writecur_4757 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6779, pvrtmp_6780, + loc_2959, pvrtmp_6782}; + break; + } + + case 21: + { + CursorTy tmpcur_6791 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6792 = tmpcur_6614 + 8; + CursorTy tmpcur_6793 = *(CursorTy *) tmpaftercur_6792; + CursorTy tmpaftercur_6794 = tmpaftercur_6792 + 8; + CursorTy jump_4044 = tmpaftercur_6792 + 8; + CursorTy jump_4043 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2960, end_r_2961, loc_3323, tmpaftercur_6794); + CursorTy pvrtmp_6795 = tmp_struct_81.field0; + CursorTy pvrtmp_6796 = tmp_struct_81.field1; + CursorTy pvrtmp_6797 = tmp_struct_81.field2; + CursorTy pvrtmp_6798 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2960, pvrtmp_6795, pvrtmp_6798, tmpcur_6791); + CursorTy pvrtmp_6803 = tmp_struct_82.field0; + CursorTy pvrtmp_6804 = tmp_struct_82.field1; + CursorTy pvrtmp_6805 = tmp_struct_82.field2; + CursorTy pvrtmp_6806 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2960, pvrtmp_6803, pvrtmp_6806, tmpcur_6793); + CursorTy pvrtmp_6811 = tmp_struct_83.field0; + CursorTy pvrtmp_6812 = tmp_struct_83.field1; + CursorTy pvrtmp_6813 = tmp_struct_83.field2; + CursorTy pvrtmp_6814 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2959 = 21; + + CursorTy writetag_4769 = loc_2959 + 1; + + *(CursorTy *) writetag_4769 = pvrtmp_6798; + + CursorTy writecur_4770 = writetag_4769 + 8; + + *(CursorTy *) writecur_4770 = pvrtmp_6806; + + CursorTy writecur_4771 = writecur_4770 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6811, pvrtmp_6812, + loc_2959, pvrtmp_6814}; + break; + } + + case 23: + { + CursorTy tmpcur_6823 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6824 = tmpcur_6614 + 8; + CursorTy tmpcur_6825 = *(CursorTy *) tmpaftercur_6824; + CursorTy tmpaftercur_6826 = tmpaftercur_6824 + 8; + CursorTy jump_4050 = tmpaftercur_6824 + 8; + CursorTy jump_4049 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2960, end_r_2961, loc_3349, tmpaftercur_6826); + CursorTy pvrtmp_6827 = tmp_struct_84.field0; + CursorTy pvrtmp_6828 = tmp_struct_84.field1; + CursorTy pvrtmp_6829 = tmp_struct_84.field2; + CursorTy pvrtmp_6830 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2960, pvrtmp_6827, pvrtmp_6830, tmpcur_6823); + CursorTy pvrtmp_6835 = tmp_struct_85.field0; + CursorTy pvrtmp_6836 = tmp_struct_85.field1; + CursorTy pvrtmp_6837 = tmp_struct_85.field2; + CursorTy pvrtmp_6838 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2960, pvrtmp_6835, pvrtmp_6838, tmpcur_6825); + CursorTy pvrtmp_6843 = tmp_struct_86.field0; + CursorTy pvrtmp_6844 = tmp_struct_86.field1; + CursorTy pvrtmp_6845 = tmp_struct_86.field2; + CursorTy pvrtmp_6846 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2959 = 23; + + CursorTy writetag_4782 = loc_2959 + 1; + + *(CursorTy *) writetag_4782 = pvrtmp_6830; + + CursorTy writecur_4783 = writetag_4782 + 8; + + *(CursorTy *) writecur_4783 = pvrtmp_6838; + + CursorTy writecur_4784 = writecur_4783 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6843, pvrtmp_6844, + loc_2959, pvrtmp_6846}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6855 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6856 = tmpcur_6614 + 8; + CursorTy jump_4326 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2960, end_r_2961, loc_2959, tmpcur_6855); + CursorTy pvrtmp_6857 = tmp_struct_87.field0; + CursorTy pvrtmp_6858 = tmp_struct_87.field1; + CursorTy pvrtmp_6859 = tmp_struct_87.field2; + CursorTy pvrtmp_6860 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6857, jump_4326, + pvrtmp_6859, pvrtmp_6860}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6867 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6868 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2960, end_r_2961, loc_2959, tmpcur_6867); + CursorTy pvrtmp_6869 = tmp_struct_88.field0; + CursorTy pvrtmp_6870 = tmp_struct_88.field1; + CursorTy pvrtmp_6871 = tmp_struct_88.field2; + CursorTy pvrtmp_6872 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6869, pvrtmp_6870, + pvrtmp_6871, pvrtmp_6872}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6613"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2964, + CursorTy end_r_2965, + CursorTy loc_2963, + CursorTy arg_717_1322_1647) +{ + TagTyPacked tmpval_6880 = *(TagTyPacked *) arg_717_1322_1647; + CursorTy tmpcur_6881 = arg_717_1322_1647 + 1; + + + switch_7146: + ; + switch (tmpval_6880) { + + case 0: + { + CursorTy jump_4055 = arg_717_1322_1647 + 1; + + *(TagTyPacked *) loc_2963 = 0; + + CursorTy writetag_4796 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2965, jump_4055, + loc_2963, writetag_4796}; + break; + } + + case 9: + { + CursorTy tmpcur_6886 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6887 = tmpcur_6881 + 8; + CursorTy jump_4057 = tmpcur_6881 + 8; + CursorTy loc_3371 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3371, tmpaftercur_6887); + CursorTy pvrtmp_6888 = tmp_struct_92.field0; + CursorTy pvrtmp_6889 = tmp_struct_92.field1; + CursorTy pvrtmp_6890 = tmp_struct_92.field2; + CursorTy pvrtmp_6891 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6888, pvrtmp_6891, tmpcur_6886); + CursorTy pvrtmp_6896 = tmp_struct_93.field0; + CursorTy pvrtmp_6897 = tmp_struct_93.field1; + CursorTy pvrtmp_6898 = tmp_struct_93.field2; + CursorTy pvrtmp_6899 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2963 = 1; + + CursorTy writetag_4802 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6896, pvrtmp_6897, + loc_2963, pvrtmp_6899}; + break; + } + + case 11: + { + CursorTy tmpcur_6908 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6909 = tmpcur_6881 + 8; + CursorTy jump_4061 = tmpcur_6881 + 8; + CursorTy loc_3384 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3384, tmpaftercur_6909); + CursorTy pvrtmp_6910 = tmp_struct_94.field0; + CursorTy pvrtmp_6911 = tmp_struct_94.field1; + CursorTy pvrtmp_6912 = tmp_struct_94.field2; + CursorTy pvrtmp_6913 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6910, pvrtmp_6913, tmpcur_6908); + CursorTy pvrtmp_6918 = tmp_struct_95.field0; + CursorTy pvrtmp_6919 = tmp_struct_95.field1; + CursorTy pvrtmp_6920 = tmp_struct_95.field2; + CursorTy pvrtmp_6921 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2963 = 2; + + CursorTy writetag_4810 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6918, pvrtmp_6919, + loc_2963, pvrtmp_6921}; + break; + } + + case 13: + { + CursorTy tmpcur_6930 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6931 = tmpcur_6881 + 8; + CursorTy tmpcur_6932 = *(CursorTy *) tmpaftercur_6931; + CursorTy tmpaftercur_6933 = tmpaftercur_6931 + 8; + CursorTy jump_4066 = tmpaftercur_6931 + 8; + CursorTy jump_4065 = tmpcur_6881 + 8; + CursorTy loc_3402 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2964, end_r_2965, loc_3402, tmpaftercur_6933); + CursorTy pvrtmp_6934 = tmp_struct_96.field0; + CursorTy pvrtmp_6935 = tmp_struct_96.field1; + CursorTy pvrtmp_6936 = tmp_struct_96.field2; + CursorTy pvrtmp_6937 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6934, pvrtmp_6937, tmpcur_6930); + CursorTy pvrtmp_6942 = tmp_struct_97.field0; + CursorTy pvrtmp_6943 = tmp_struct_97.field1; + CursorTy pvrtmp_6944 = tmp_struct_97.field2; + CursorTy pvrtmp_6945 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6942, pvrtmp_6945, tmpcur_6932); + CursorTy pvrtmp_6950 = tmp_struct_98.field0; + CursorTy pvrtmp_6951 = tmp_struct_98.field1; + CursorTy pvrtmp_6952 = tmp_struct_98.field2; + CursorTy pvrtmp_6953 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2963 = 3; + + CursorTy writetag_4820 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6950, pvrtmp_6951, + loc_2963, pvrtmp_6953}; + break; + } + + case 15: + { + CursorTy tmpcur_6962 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6963 = tmpcur_6881 + 8; + CursorTy tmpcur_6964 = *(CursorTy *) tmpaftercur_6963; + CursorTy tmpaftercur_6965 = tmpaftercur_6963 + 8; + CursorTy jump_4072 = tmpaftercur_6963 + 8; + CursorTy jump_4071 = tmpcur_6881 + 8; + CursorTy loc_3422 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3422, tmpaftercur_6965); + CursorTy pvrtmp_6966 = tmp_struct_99.field0; + CursorTy pvrtmp_6967 = tmp_struct_99.field1; + CursorTy pvrtmp_6968 = tmp_struct_99.field2; + CursorTy pvrtmp_6969 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6966, pvrtmp_6969, tmpcur_6962); + CursorTy pvrtmp_6974 = tmp_struct_100.field0; + CursorTy pvrtmp_6975 = tmp_struct_100.field1; + CursorTy pvrtmp_6976 = tmp_struct_100.field2; + CursorTy pvrtmp_6977 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_6974, pvrtmp_6977, tmpcur_6964); + CursorTy pvrtmp_6982 = tmp_struct_101.field0; + CursorTy pvrtmp_6983 = tmp_struct_101.field1; + CursorTy pvrtmp_6984 = tmp_struct_101.field2; + CursorTy pvrtmp_6985 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2963 = 4; + + CursorTy writetag_4831 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6982, pvrtmp_6983, + loc_2963, pvrtmp_6985}; + break; + } + + case 17: + { + CursorTy tmpcur_6994 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6995 = tmpcur_6881 + 8; + CursorTy tmpcur_6996 = *(CursorTy *) tmpaftercur_6995; + CursorTy tmpaftercur_6997 = tmpaftercur_6995 + 8; + CursorTy jump_4078 = tmpaftercur_6995 + 8; + CursorTy jump_4077 = tmpcur_6881 + 8; + CursorTy loc_3442 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2964, end_r_2965, loc_3442, tmpaftercur_6997); + CursorTy pvrtmp_6998 = tmp_struct_102.field0; + CursorTy pvrtmp_6999 = tmp_struct_102.field1; + CursorTy pvrtmp_7000 = tmp_struct_102.field2; + CursorTy pvrtmp_7001 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6998, pvrtmp_7001, tmpcur_6994); + CursorTy pvrtmp_7006 = tmp_struct_103.field0; + CursorTy pvrtmp_7007 = tmp_struct_103.field1; + CursorTy pvrtmp_7008 = tmp_struct_103.field2; + CursorTy pvrtmp_7009 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_7006, pvrtmp_7009, tmpcur_6996); + CursorTy pvrtmp_7014 = tmp_struct_104.field0; + CursorTy pvrtmp_7015 = tmp_struct_104.field1; + CursorTy pvrtmp_7016 = tmp_struct_104.field2; + CursorTy pvrtmp_7017 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2963 = 5; + + CursorTy writetag_4842 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7014, pvrtmp_7015, + loc_2963, pvrtmp_7017}; + break; + } + + case 19: + { + CursorTy tmpcur_7026 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7027 = tmpcur_6881 + 8; + CursorTy tmpcur_7028 = *(CursorTy *) tmpaftercur_7027; + CursorTy tmpaftercur_7029 = tmpaftercur_7027 + 8; + CursorTy jump_4084 = tmpaftercur_7027 + 8; + CursorTy jump_4083 = tmpcur_6881 + 8; + CursorTy loc_3462 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3462, tmpaftercur_7029); + CursorTy pvrtmp_7030 = tmp_struct_105.field0; + CursorTy pvrtmp_7031 = tmp_struct_105.field1; + CursorTy pvrtmp_7032 = tmp_struct_105.field2; + CursorTy pvrtmp_7033 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7030, pvrtmp_7033, tmpcur_7026); + CursorTy pvrtmp_7038 = tmp_struct_106.field0; + CursorTy pvrtmp_7039 = tmp_struct_106.field1; + CursorTy pvrtmp_7040 = tmp_struct_106.field2; + CursorTy pvrtmp_7041 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_7038, pvrtmp_7041, tmpcur_7028); + CursorTy pvrtmp_7046 = tmp_struct_107.field0; + CursorTy pvrtmp_7047 = tmp_struct_107.field1; + CursorTy pvrtmp_7048 = tmp_struct_107.field2; + CursorTy pvrtmp_7049 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2963 = 6; + + CursorTy writetag_4853 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7046, pvrtmp_7047, + loc_2963, pvrtmp_7049}; + break; + } + + case 21: + { + CursorTy tmpcur_7058 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7059 = tmpcur_6881 + 8; + CursorTy tmpcur_7060 = *(CursorTy *) tmpaftercur_7059; + CursorTy tmpaftercur_7061 = tmpaftercur_7059 + 8; + CursorTy jump_4090 = tmpaftercur_7059 + 8; + CursorTy jump_4089 = tmpcur_6881 + 8; + CursorTy loc_3482 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3482, tmpaftercur_7061); + CursorTy pvrtmp_7062 = tmp_struct_108.field0; + CursorTy pvrtmp_7063 = tmp_struct_108.field1; + CursorTy pvrtmp_7064 = tmp_struct_108.field2; + CursorTy pvrtmp_7065 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7062, pvrtmp_7065, tmpcur_7058); + CursorTy pvrtmp_7070 = tmp_struct_109.field0; + CursorTy pvrtmp_7071 = tmp_struct_109.field1; + CursorTy pvrtmp_7072 = tmp_struct_109.field2; + CursorTy pvrtmp_7073 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_7070, pvrtmp_7073, tmpcur_7060); + CursorTy pvrtmp_7078 = tmp_struct_110.field0; + CursorTy pvrtmp_7079 = tmp_struct_110.field1; + CursorTy pvrtmp_7080 = tmp_struct_110.field2; + CursorTy pvrtmp_7081 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2963 = 7; + + CursorTy writetag_4864 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7078, pvrtmp_7079, + loc_2963, pvrtmp_7081}; + break; + } + + case 23: + { + CursorTy tmpcur_7090 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7091 = tmpcur_6881 + 8; + CursorTy tmpcur_7092 = *(CursorTy *) tmpaftercur_7091; + CursorTy tmpaftercur_7093 = tmpaftercur_7091 + 8; + CursorTy jump_4096 = tmpaftercur_7091 + 8; + CursorTy jump_4095 = tmpcur_6881 + 8; + CursorTy loc_3502 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3502, tmpaftercur_7093); + CursorTy pvrtmp_7094 = tmp_struct_111.field0; + CursorTy pvrtmp_7095 = tmp_struct_111.field1; + CursorTy pvrtmp_7096 = tmp_struct_111.field2; + CursorTy pvrtmp_7097 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_7094, pvrtmp_7097, tmpcur_7090); + CursorTy pvrtmp_7102 = tmp_struct_112.field0; + CursorTy pvrtmp_7103 = tmp_struct_112.field1; + CursorTy pvrtmp_7104 = tmp_struct_112.field2; + CursorTy pvrtmp_7105 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7102, pvrtmp_7105, tmpcur_7092); + CursorTy pvrtmp_7110 = tmp_struct_113.field0; + CursorTy pvrtmp_7111 = tmp_struct_113.field1; + CursorTy pvrtmp_7112 = tmp_struct_113.field2; + CursorTy pvrtmp_7113 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2963 = 8; + + CursorTy writetag_4875 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7110, pvrtmp_7111, + loc_2963, pvrtmp_7113}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7122 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7123 = tmpcur_6881 + 8; + CursorTy jump_4332 = tmpcur_6881 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_2963, tmpcur_7122); + CursorTy pvrtmp_7124 = tmp_struct_114.field0; + CursorTy pvrtmp_7125 = tmp_struct_114.field1; + CursorTy pvrtmp_7126 = tmp_struct_114.field2; + CursorTy pvrtmp_7127 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7124, jump_4332, + pvrtmp_7126, pvrtmp_7127}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7134 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7135 = tmpcur_6881 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_2963, tmpcur_7134); + CursorTy pvrtmp_7136 = tmp_struct_115.field0; + CursorTy pvrtmp_7137 = tmp_struct_115.field1; + CursorTy pvrtmp_7138 = tmp_struct_115.field2; + CursorTy pvrtmp_7139 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7136, pvrtmp_7137, + pvrtmp_7138, pvrtmp_7139}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6880"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2967, CursorTy arg_762_1367_1692) +{ + TagTyPacked tmpval_7147 = *(TagTyPacked *) arg_762_1367_1692; + CursorTy tmpcur_7148 = arg_762_1367_1692 + 1; + + + switch_7205: + ; + switch (tmpval_7147) { + + case 0: + { + CursorTy jump_4101 = arg_762_1367_1692 + 1; + + return (CursorProd) {jump_4101}; + break; + } + + case 9: + { + CursorTy tmpcur_7149 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7150 = tmpcur_7148 + 8; + CursorTy jump_4103 = tmpcur_7148 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2967, tmpaftercur_7150); + CursorTy pvrtmp_7151 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2967, tmpcur_7149); + CursorTy pvrtmp_7152 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7152}; + break; + } + + case 11: + { + CursorTy tmpcur_7153 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7154 = tmpcur_7148 + 8; + CursorTy jump_4107 = tmpcur_7148 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2967, tmpaftercur_7154); + CursorTy pvrtmp_7155 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2967, tmpcur_7153); + CursorTy pvrtmp_7156 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7156}; + break; + } + + case 13: + { + CursorTy tmpcur_7157 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7158 = tmpcur_7148 + 8; + CursorTy tmpcur_7159 = *(CursorTy *) tmpaftercur_7158; + CursorTy tmpaftercur_7160 = tmpaftercur_7158 + 8; + CursorTy jump_4112 = tmpaftercur_7158 + 8; + CursorTy jump_4111 = tmpcur_7148 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2967, tmpaftercur_7160); + CursorTy pvrtmp_7161 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2967, tmpcur_7157); + CursorTy pvrtmp_7162 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2967, tmpcur_7159); + CursorTy pvrtmp_7163 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7163}; + break; + } + + case 15: + { + CursorTy tmpcur_7164 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7165 = tmpcur_7148 + 8; + CursorTy tmpcur_7166 = *(CursorTy *) tmpaftercur_7165; + CursorTy tmpaftercur_7167 = tmpaftercur_7165 + 8; + CursorTy jump_4118 = tmpaftercur_7165 + 8; + CursorTy jump_4117 = tmpcur_7148 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2967, tmpaftercur_7167); + CursorTy pvrtmp_7168 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2967, tmpcur_7164); + CursorTy pvrtmp_7169 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2967, tmpcur_7166); + CursorTy pvrtmp_7170 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7170}; + break; + } + + case 17: + { + CursorTy tmpcur_7171 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7172 = tmpcur_7148 + 8; + CursorTy tmpcur_7173 = *(CursorTy *) tmpaftercur_7172; + CursorTy tmpaftercur_7174 = tmpaftercur_7172 + 8; + CursorTy jump_4124 = tmpaftercur_7172 + 8; + CursorTy jump_4123 = tmpcur_7148 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2967, tmpaftercur_7174); + CursorTy pvrtmp_7175 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2967, tmpcur_7171); + CursorTy pvrtmp_7176 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2967, tmpcur_7173); + CursorTy pvrtmp_7177 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7177}; + break; + } + + case 19: + { + CursorTy tmpcur_7178 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7179 = tmpcur_7148 + 8; + CursorTy tmpcur_7180 = *(CursorTy *) tmpaftercur_7179; + CursorTy tmpaftercur_7181 = tmpaftercur_7179 + 8; + CursorTy jump_4130 = tmpaftercur_7179 + 8; + CursorTy jump_4129 = tmpcur_7148 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2967, tmpaftercur_7181); + CursorTy pvrtmp_7182 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2967, tmpcur_7178); + CursorTy pvrtmp_7183 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2967, tmpcur_7180); + CursorTy pvrtmp_7184 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7184}; + break; + } + + case 21: + { + CursorTy tmpcur_7185 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7186 = tmpcur_7148 + 8; + CursorTy tmpcur_7187 = *(CursorTy *) tmpaftercur_7186; + CursorTy tmpaftercur_7188 = tmpaftercur_7186 + 8; + CursorTy jump_4136 = tmpaftercur_7186 + 8; + CursorTy jump_4135 = tmpcur_7148 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2967, tmpaftercur_7188); + CursorTy pvrtmp_7189 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2967, tmpcur_7185); + CursorTy pvrtmp_7190 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2967, tmpcur_7187); + CursorTy pvrtmp_7191 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7191}; + break; + } + + case 23: + { + CursorTy tmpcur_7192 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7193 = tmpcur_7148 + 8; + CursorTy tmpcur_7194 = *(CursorTy *) tmpaftercur_7193; + CursorTy tmpaftercur_7195 = tmpaftercur_7193 + 8; + CursorTy jump_4142 = tmpaftercur_7193 + 8; + CursorTy jump_4141 = tmpcur_7148 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2967, tmpaftercur_7195); + CursorTy pvrtmp_7196 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2967, tmpcur_7192); + CursorTy pvrtmp_7197 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2967, tmpcur_7194); + CursorTy pvrtmp_7198 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7198}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7199 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7200 = tmpcur_7148 + 8; + CursorTy jump_4338 = tmpcur_7148 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2967, tmpcur_7199); + CursorTy pvrtmp_7201 = tmp_struct_138.field0; + + return (CursorProd) {jump_4338}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7202 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7203 = tmpcur_7148 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2967, tmpcur_7202); + CursorTy pvrtmp_7204 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7204}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7147"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2969, CursorTy arg_807_1412_1737) +{ + TagTyPacked tmpval_7206 = *(TagTyPacked *) arg_807_1412_1737; + CursorTy tmpcur_7207 = arg_807_1412_1737 + 1; + + + switch_7264: + ; + switch (tmpval_7206) { + + case 0: + { + CursorTy jump_4147 = arg_807_1412_1737 + 1; + unsigned char wildcard_808_1413_1738 = print_symbol(6160); + unsigned char wildcard_809_1414_1739 = print_symbol(6154); + + return (CursorProd) {jump_4147}; + break; + } + + case 9: + { + CursorTy tmpcur_7208 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7209 = tmpcur_7207 + 8; + CursorTy jump_4149 = tmpcur_7207 + 8; + unsigned char wildcard_814_1417_1742 = print_symbol(6166); + CursorProd tmp_struct_140 = + _print_Content(end_r_2969, tmpaftercur_7209); + CursorTy pvrtmp_7210 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2969, tmpcur_7208); + CursorTy pvrtmp_7211 = tmp_struct_141.field0; + unsigned char wildcard_815_1420_1745 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7211}; + break; + } + + case 11: + { + CursorTy tmpcur_7212 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7213 = tmpcur_7207 + 8; + CursorTy jump_4153 = tmpcur_7207 + 8; + unsigned char wildcard_820_1423_1748 = print_symbol(6169); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2969, tmpaftercur_7213); + CursorTy pvrtmp_7214 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2969, tmpcur_7212); + CursorTy pvrtmp_7215 = tmp_struct_143.field0; + unsigned char wildcard_821_1426_1751 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7215}; + break; + } + + case 13: + { + CursorTy tmpcur_7216 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7217 = tmpcur_7207 + 8; + CursorTy tmpcur_7218 = *(CursorTy *) tmpaftercur_7217; + CursorTy tmpaftercur_7219 = tmpaftercur_7217 + 8; + CursorTy jump_4158 = tmpaftercur_7217 + 8; + CursorTy jump_4157 = tmpcur_7207 + 8; + unsigned char wildcard_828_1430_1755 = print_symbol(6157); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2969, tmpaftercur_7219); + CursorTy pvrtmp_7220 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2969, tmpcur_7216); + CursorTy pvrtmp_7221 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2969, tmpcur_7218); + CursorTy pvrtmp_7222 = tmp_struct_146.field0; + unsigned char wildcard_829_1434_1759 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7222}; + break; + } + + case 15: + { + CursorTy tmpcur_7223 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7224 = tmpcur_7207 + 8; + CursorTy tmpcur_7225 = *(CursorTy *) tmpaftercur_7224; + CursorTy tmpaftercur_7226 = tmpaftercur_7224 + 8; + CursorTy jump_4164 = tmpaftercur_7224 + 8; + CursorTy jump_4163 = tmpcur_7207 + 8; + unsigned char wildcard_836_1438_1763 = print_symbol(6168); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2969, tmpaftercur_7226); + CursorTy pvrtmp_7227 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2969, tmpcur_7223); + CursorTy pvrtmp_7228 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2969, tmpcur_7225); + CursorTy pvrtmp_7229 = tmp_struct_149.field0; + unsigned char wildcard_837_1442_1767 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7229}; + break; + } + + case 17: + { + CursorTy tmpcur_7230 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7231 = tmpcur_7207 + 8; + CursorTy tmpcur_7232 = *(CursorTy *) tmpaftercur_7231; + CursorTy tmpaftercur_7233 = tmpaftercur_7231 + 8; + CursorTy jump_4170 = tmpaftercur_7231 + 8; + CursorTy jump_4169 = tmpcur_7207 + 8; + unsigned char wildcard_844_1446_1771 = print_symbol(6158); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2969, tmpaftercur_7233); + CursorTy pvrtmp_7234 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2969, tmpcur_7230); + CursorTy pvrtmp_7235 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2969, tmpcur_7232); + CursorTy pvrtmp_7236 = tmp_struct_152.field0; + unsigned char wildcard_845_1450_1775 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7236}; + break; + } + + case 19: + { + CursorTy tmpcur_7237 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7238 = tmpcur_7207 + 8; + CursorTy tmpcur_7239 = *(CursorTy *) tmpaftercur_7238; + CursorTy tmpaftercur_7240 = tmpaftercur_7238 + 8; + CursorTy jump_4176 = tmpaftercur_7238 + 8; + CursorTy jump_4175 = tmpcur_7207 + 8; + unsigned char wildcard_852_1454_1779 = print_symbol(6167); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2969, tmpaftercur_7240); + CursorTy pvrtmp_7241 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2969, tmpcur_7237); + CursorTy pvrtmp_7242 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2969, tmpcur_7239); + CursorTy pvrtmp_7243 = tmp_struct_155.field0; + unsigned char wildcard_853_1458_1783 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7243}; + break; + } + + case 21: + { + CursorTy tmpcur_7244 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7245 = tmpcur_7207 + 8; + CursorTy tmpcur_7246 = *(CursorTy *) tmpaftercur_7245; + CursorTy tmpaftercur_7247 = tmpaftercur_7245 + 8; + CursorTy jump_4182 = tmpaftercur_7245 + 8; + CursorTy jump_4181 = tmpcur_7207 + 8; + unsigned char wildcard_860_1462_1787 = print_symbol(6164); + CursorProd tmp_struct_156 = + _print_Content(end_r_2969, tmpaftercur_7247); + CursorTy pvrtmp_7248 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2969, tmpcur_7244); + CursorTy pvrtmp_7249 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2969, tmpcur_7246); + CursorTy pvrtmp_7250 = tmp_struct_158.field0; + unsigned char wildcard_861_1466_1791 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7250}; + break; + } + + case 23: + { + CursorTy tmpcur_7251 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7252 = tmpcur_7207 + 8; + CursorTy tmpcur_7253 = *(CursorTy *) tmpaftercur_7252; + CursorTy tmpaftercur_7254 = tmpaftercur_7252 + 8; + CursorTy jump_4188 = tmpaftercur_7252 + 8; + CursorTy jump_4187 = tmpcur_7207 + 8; + unsigned char wildcard_868_1470_1795 = print_symbol(6165); + CursorProd tmp_struct_159 = + _print_Content(end_r_2969, tmpaftercur_7254); + CursorTy pvrtmp_7255 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2969, tmpcur_7251); + CursorTy pvrtmp_7256 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2969, tmpcur_7253); + CursorTy pvrtmp_7257 = tmp_struct_161.field0; + unsigned char wildcard_869_1474_1799 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7257}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7258 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7259 = tmpcur_7207 + 8; + CursorTy jump_4344 = tmpcur_7207 + 8; + unsigned char wildcard_4347 = print_symbol(6171); + CursorProd tmp_struct_162 = _print_Adt(end_r_2969, tmpcur_7258); + CursorTy pvrtmp_7260 = tmp_struct_162.field0; + + return (CursorProd) {jump_4344}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7261 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7262 = tmpcur_7207 + 8; + unsigned char wildcard_4347 = print_symbol(6170); + CursorProd tmp_struct_163 = _print_Adt(end_r_2969, tmpcur_7261); + CursorTy pvrtmp_7263 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7263}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7206"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2972, + CursorTy end_r_2973, CursorTy loc_2971, + CursorTy arg_870_1475_1800) +{ + if (loc_2971 + 32 > end_r_2973) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2973); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2973 = chunk_end_169; + *(TagTyPacked *) loc_2971 = 255; + + CursorTy redir = loc_2971 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2971 = chunk_start_168; + } + + CursorTy loc_3680 = loc_2971 + 1; + CursorTy loc_3681 = loc_3680 + 8; + TagTyPacked tmpval_7265 = *(TagTyPacked *) arg_870_1475_1800; + CursorTy tmpcur_7266 = arg_870_1475_1800 + 1; + + + switch_7309: + ; + switch (tmpval_7265) { + + case 0: + { + CursorTy jump_4193 = arg_870_1475_1800 + 1; + + *(TagTyPacked *) loc_2971 = 0; + + CursorTy writetag_4989 = loc_2971 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2973, jump_4193, + loc_2971, writetag_4989}; + break; + } + + case 1: + { + IntTy tmpval_7271 = *(IntTy *) tmpcur_7266; + CursorTy tmpcur_7272 = tmpcur_7266 + sizeof(IntTy); + CursorTy jump_4195 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2972, end_r_2973, loc_3681, tmpcur_7272); + CursorTy pvrtmp_7273 = tmp_struct_164.field0; + CursorTy pvrtmp_7274 = tmp_struct_164.field1; + CursorTy pvrtmp_7275 = tmp_struct_164.field2; + CursorTy pvrtmp_7276 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2971 = 1; + + CursorTy writetag_4994 = loc_2971 + 1; + + *(IntTy *) writetag_4994 = tmpval_7271; + + CursorTy writecur_4995 = writetag_4994 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7273, pvrtmp_7274, + loc_2971, pvrtmp_7276}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7285 = *(CursorTy *) tmpcur_7266; + CursorTy tmpaftercur_7286 = tmpcur_7266 + 8; + CursorTy jump_4350 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2972, end_r_2973, loc_2971, tmpcur_7285); + CursorTy pvrtmp_7287 = tmp_struct_165.field0; + CursorTy pvrtmp_7288 = tmp_struct_165.field1; + CursorTy pvrtmp_7289 = tmp_struct_165.field2; + CursorTy pvrtmp_7290 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7287, jump_4350, + pvrtmp_7289, pvrtmp_7290}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7297 = *(CursorTy *) tmpcur_7266; + CursorTy tmpaftercur_7298 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2972, end_r_2973, loc_2971, tmpcur_7297); + CursorTy pvrtmp_7299 = tmp_struct_166.field0; + CursorTy pvrtmp_7300 = tmp_struct_166.field1; + CursorTy pvrtmp_7301 = tmp_struct_166.field2; + CursorTy pvrtmp_7302 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7299, pvrtmp_7300, + pvrtmp_7301, pvrtmp_7302}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7265"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2976, + CursorTy end_r_2977, + CursorTy loc_2975, + CursorTy arg_875_1480_1805) +{ + CursorTy loc_3693 = loc_2975 + 1; + CursorTy loc_3694 = loc_3693 + 8; + TagTyPacked tmpval_7310 = *(TagTyPacked *) arg_875_1480_1805; + CursorTy tmpcur_7311 = arg_875_1480_1805 + 1; + + + switch_7354: + ; + switch (tmpval_7310) { + + case 0: + { + CursorTy jump_4198 = arg_875_1480_1805 + 1; + + *(TagTyPacked *) loc_2975 = 0; + + CursorTy writetag_5005 = loc_2975 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2977, jump_4198, + loc_2975, writetag_5005}; + break; + } + + case 1: + { + IntTy tmpval_7316 = *(IntTy *) tmpcur_7311; + CursorTy tmpcur_7317 = tmpcur_7311 + sizeof(IntTy); + CursorTy jump_4200 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_3694, tmpcur_7317); + CursorTy pvrtmp_7318 = tmp_struct_170.field0; + CursorTy pvrtmp_7319 = tmp_struct_170.field1; + CursorTy pvrtmp_7320 = tmp_struct_170.field2; + CursorTy pvrtmp_7321 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2975 = 1; + + CursorTy writetag_5010 = loc_2975 + 1; + + *(IntTy *) writetag_5010 = tmpval_7316; + + CursorTy writecur_5011 = writetag_5010 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7318, pvrtmp_7319, + loc_2975, pvrtmp_7321}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7330 = *(CursorTy *) tmpcur_7311; + CursorTy tmpaftercur_7331 = tmpcur_7311 + 8; + CursorTy jump_4356 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_2975, tmpcur_7330); + CursorTy pvrtmp_7332 = tmp_struct_171.field0; + CursorTy pvrtmp_7333 = tmp_struct_171.field1; + CursorTy pvrtmp_7334 = tmp_struct_171.field2; + CursorTy pvrtmp_7335 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7332, jump_4356, + pvrtmp_7334, pvrtmp_7335}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7342 = *(CursorTy *) tmpcur_7311; + CursorTy tmpaftercur_7343 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_2975, tmpcur_7342); + CursorTy pvrtmp_7344 = tmp_struct_172.field0; + CursorTy pvrtmp_7345 = tmp_struct_172.field1; + CursorTy pvrtmp_7346 = tmp_struct_172.field2; + CursorTy pvrtmp_7347 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7344, pvrtmp_7345, + pvrtmp_7346, pvrtmp_7347}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7310"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2979, CursorTy arg_880_1485_1810) +{ + TagTyPacked tmpval_7355 = *(TagTyPacked *) arg_880_1485_1810; + CursorTy tmpcur_7356 = arg_880_1485_1810 + 1; + + + switch_7366: + ; + switch (tmpval_7355) { + + case 0: + { + CursorTy jump_4203 = arg_880_1485_1810 + 1; + + return (CursorProd) {jump_4203}; + break; + } + + case 1: + { + IntTy tmpval_7357 = *(IntTy *) tmpcur_7356; + CursorTy tmpcur_7358 = tmpcur_7356 + sizeof(IntTy); + CursorTy jump_4205 = tmpcur_7356 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2979, tmpcur_7358); + CursorTy pvrtmp_7359 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7359}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7360 = *(CursorTy *) tmpcur_7356; + CursorTy tmpaftercur_7361 = tmpcur_7356 + 8; + CursorTy jump_4362 = tmpcur_7356 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2979, tmpcur_7360); + CursorTy pvrtmp_7362 = tmp_struct_174.field0; + + return (CursorProd) {jump_4362}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7363 = *(CursorTy *) tmpcur_7356; + CursorTy tmpaftercur_7364 = tmpcur_7356 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2979, tmpcur_7363); + CursorTy pvrtmp_7365 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7365}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7355"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2981, CursorTy arg_885_1489_1814) +{ + TagTyPacked tmpval_7367 = *(TagTyPacked *) arg_885_1489_1814; + CursorTy tmpcur_7368 = arg_885_1489_1814 + 1; + + + switch_7378: + ; + switch (tmpval_7367) { + + case 0: + { + CursorTy jump_4208 = arg_885_1489_1814 + 1; + unsigned char wildcard_886_1490_1815 = print_symbol(6159); + unsigned char wildcard_887_1491_1816 = print_symbol(6154); + + return (CursorProd) {jump_4208}; + break; + } + + case 1: + { + IntTy tmpval_7369 = *(IntTy *) tmpcur_7368; + CursorTy tmpcur_7370 = tmpcur_7368 + sizeof(IntTy); + CursorTy jump_4210 = tmpcur_7368 + 8; + unsigned char wildcard_892_1494_1819 = print_symbol(6156); + unsigned char y_890_1495_1820 = printf("%lld", tmpval_7369); + CursorProd tmp_struct_176 = _print_Tags(end_r_2981, tmpcur_7370); + CursorTy pvrtmp_7371 = tmp_struct_176.field0; + unsigned char wildcard_893_1497_1822 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7371}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7372 = *(CursorTy *) tmpcur_7368; + CursorTy tmpaftercur_7373 = tmpcur_7368 + 8; + CursorTy jump_4368 = tmpcur_7368 + 8; + unsigned char wildcard_4371 = print_symbol(6171); + CursorProd tmp_struct_177 = _print_Tags(end_r_2981, tmpcur_7372); + CursorTy pvrtmp_7374 = tmp_struct_177.field0; + + return (CursorProd) {jump_4368}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7375 = *(CursorTy *) tmpcur_7368; + CursorTy tmpaftercur_7376 = tmpcur_7368 + 8; + unsigned char wildcard_4371 = print_symbol(6170); + CursorProd tmp_struct_178 = _print_Tags(end_r_2981, tmpcur_7375); + CursorTy pvrtmp_7377 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7377}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7367"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2984, + CursorTy end_r_2985, + CursorTy loc_2983, + CursorTy arg_2716) +{ + if (loc_2983 + 32 > end_r_2985) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2985); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2985 = chunk_end_184; + *(TagTyPacked *) loc_2983 = 255; + + CursorTy redir = loc_2983 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2983 = chunk_start_183; + } + + CursorTy loc_3718 = loc_2983 + 1; + CursorTy loc_3719 = loc_3718 + 8; + TagTyPacked tmpval_7379 = *(TagTyPacked *) arg_2716; + CursorTy tmpcur_7380 = arg_2716 + 1; + + + switch_7423: + ; + switch (tmpval_7379) { + + case 0: + { + CursorTy jump_4213 = arg_2716 + 1; + + *(TagTyPacked *) loc_2983 = 0; + + CursorTy writetag_5041 = loc_2983 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2985, jump_4213, + loc_2983, writetag_5041}; + break; + } + + case 1: + { + IntTy tmpval_7385 = *(IntTy *) tmpcur_7380; + CursorTy tmpcur_7386 = tmpcur_7380 + sizeof(IntTy); + CursorTy jump_4215 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_3719, tmpcur_7386); + CursorTy pvrtmp_7387 = tmp_struct_179.field0; + CursorTy pvrtmp_7388 = tmp_struct_179.field1; + CursorTy pvrtmp_7389 = tmp_struct_179.field2; + CursorTy pvrtmp_7390 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2983 = 1; + + CursorTy writetag_5046 = loc_2983 + 1; + + *(IntTy *) writetag_5046 = tmpval_7385; + + CursorTy writecur_5047 = writetag_5046 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7387, pvrtmp_7388, + loc_2983, pvrtmp_7390}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7399 = *(CursorTy *) tmpcur_7380; + CursorTy tmpaftercur_7400 = tmpcur_7380 + 8; + CursorTy jump_4374 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_2983, tmpcur_7399); + CursorTy pvrtmp_7401 = tmp_struct_180.field0; + CursorTy pvrtmp_7402 = tmp_struct_180.field1; + CursorTy pvrtmp_7403 = tmp_struct_180.field2; + CursorTy pvrtmp_7404 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7401, jump_4374, + pvrtmp_7403, pvrtmp_7404}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7411 = *(CursorTy *) tmpcur_7380; + CursorTy tmpaftercur_7412 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_2983, tmpcur_7411); + CursorTy pvrtmp_7413 = tmp_struct_181.field0; + CursorTy pvrtmp_7414 = tmp_struct_181.field1; + CursorTy pvrtmp_7415 = tmp_struct_181.field2; + CursorTy pvrtmp_7416 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7413, pvrtmp_7414, + pvrtmp_7415, pvrtmp_7416}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7379"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2988, + CursorTy end_r_2989, + CursorTy loc_2987, + CursorTy arg_2721) +{ + if (loc_2987 + 32 > end_r_2989) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2989); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2989 = chunk_end_191; + *(TagTyPacked *) loc_2987 = 255; + + CursorTy redir = loc_2987 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2987 = chunk_start_190; + } + + TagTyPacked tmpval_7424 = *(TagTyPacked *) arg_2721; + CursorTy tmpcur_7425 = arg_2721 + 1; + + + switch_7474: + ; + switch (tmpval_7424) { + + case 0: + { + CursorTy loc_3729 = loc_2987 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2988, end_r_2989, loc_3729, tmpcur_7425); + CursorTy pvrtmp_7426 = tmp_struct_185.field0; + CursorTy pvrtmp_7427 = tmp_struct_185.field1; + CursorTy pvrtmp_7428 = tmp_struct_185.field2; + CursorTy pvrtmp_7429 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2987 = 0; + + CursorTy writetag_5058 = loc_2987 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7426, pvrtmp_7427, + loc_2987, pvrtmp_7429}; + break; + } + + case 1: + { + CursorTy loc_3735 = loc_2987 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2988, end_r_2989, loc_3735, tmpcur_7425); + CursorTy pvrtmp_7438 = tmp_struct_186.field0; + CursorTy pvrtmp_7439 = tmp_struct_186.field1; + CursorTy pvrtmp_7440 = tmp_struct_186.field2; + CursorTy pvrtmp_7441 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2987 = 1; + + CursorTy writetag_5063 = loc_2987 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7438, pvrtmp_7439, + loc_2987, pvrtmp_7441}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7450 = *(CursorTy *) tmpcur_7425; + CursorTy tmpaftercur_7451 = tmpcur_7425 + 8; + CursorTy jump_4380 = tmpcur_7425 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2988, end_r_2989, loc_2987, tmpcur_7450); + CursorTy pvrtmp_7452 = tmp_struct_187.field0; + CursorTy pvrtmp_7453 = tmp_struct_187.field1; + CursorTy pvrtmp_7454 = tmp_struct_187.field2; + CursorTy pvrtmp_7455 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7452, jump_4380, + pvrtmp_7454, pvrtmp_7455}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7462 = *(CursorTy *) tmpcur_7425; + CursorTy tmpaftercur_7463 = tmpcur_7425 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2988, end_r_2989, loc_2987, tmpcur_7462); + CursorTy pvrtmp_7464 = tmp_struct_188.field0; + CursorTy pvrtmp_7465 = tmp_struct_188.field1; + CursorTy pvrtmp_7466 = tmp_struct_188.field2; + CursorTy pvrtmp_7467 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7464, pvrtmp_7465, + pvrtmp_7466, pvrtmp_7467}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7424"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2992, + CursorTy end_r_2993, + CursorTy loc_2991, + CursorTy arg_2726) +{ + if (loc_2991 + 32 > end_r_2993) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2993); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2993 = chunk_end_218; + *(TagTyPacked *) loc_2991 = 255; + + CursorTy redir = loc_2991 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2991 = chunk_start_217; + } + + CursorTy loc_3748 = loc_2991 + 1; + CursorTy loc_3749 = loc_3748 + 8; + CursorTy loc_3750 = loc_3749 + 8; + CursorTy loc_3766 = loc_2991 + 1; + CursorTy loc_3767 = loc_3766 + 8; + CursorTy loc_3768 = loc_3767 + 8; + CursorTy loc_3788 = loc_2991 + 1; + CursorTy loc_3789 = loc_3788 + 8; + CursorTy loc_3790 = loc_3789 + 8; + CursorTy loc_3791 = loc_3790 + 8; + CursorTy loc_3815 = loc_2991 + 1; + CursorTy loc_3816 = loc_3815 + 8; + CursorTy loc_3817 = loc_3816 + 8; + CursorTy loc_3818 = loc_3817 + 8; + CursorTy loc_3842 = loc_2991 + 1; + CursorTy loc_3843 = loc_3842 + 8; + CursorTy loc_3844 = loc_3843 + 8; + CursorTy loc_3845 = loc_3844 + 8; + CursorTy loc_3869 = loc_2991 + 1; + CursorTy loc_3870 = loc_3869 + 8; + CursorTy loc_3871 = loc_3870 + 8; + CursorTy loc_3872 = loc_3871 + 8; + CursorTy loc_3896 = loc_2991 + 1; + CursorTy loc_3897 = loc_3896 + 8; + CursorTy loc_3898 = loc_3897 + 8; + CursorTy loc_3899 = loc_3898 + 8; + CursorTy loc_3923 = loc_2991 + 1; + CursorTy loc_3924 = loc_3923 + 8; + CursorTy loc_3925 = loc_3924 + 8; + CursorTy loc_3926 = loc_3925 + 8; + TagTyPacked tmpval_7475 = *(TagTyPacked *) arg_2726; + CursorTy tmpcur_7476 = arg_2726 + 1; + + + switch_7713: + ; + switch (tmpval_7475) { + + case 0: + { + CursorTy jump_4222 = arg_2726 + 1; + + *(TagTyPacked *) loc_2991 = 0; + + CursorTy writetag_5073 = loc_2991 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2993, jump_4222, + loc_2991, writetag_5073}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3750, tmpcur_7476); + CursorTy pvrtmp_7481 = tmp_struct_192.field0; + CursorTy pvrtmp_7482 = tmp_struct_192.field1; + CursorTy pvrtmp_7483 = tmp_struct_192.field2; + CursorTy pvrtmp_7484 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7481, pvrtmp_7484, pvrtmp_7482); + CursorTy pvrtmp_7489 = tmp_struct_193.field0; + CursorTy pvrtmp_7490 = tmp_struct_193.field1; + CursorTy pvrtmp_7491 = tmp_struct_193.field2; + CursorTy pvrtmp_7492 = tmp_struct_193.field3; + IntTy sizeof_y_2729__2731 = pvrtmp_7484 - pvrtmp_7483; + IntTy sizeof_y_2730__2732 = pvrtmp_7492 - pvrtmp_7491; + IntTy fltPrm_2820 = sizeof_y_2729__2731 + 0; + IntTy offset__2733 = 0 + fltPrm_2820; + IntTy fltPrm_2821 = sizeof_y_2729__2731 + sizeof_y_2730__2732; + IntTy size_dcon_2734 = 9 + fltPrm_2821; + + *(TagTyPacked *) loc_2991 = 160; + + CursorTy writetag_5078 = loc_2991 + 1; + + *(IntTy *) writetag_5078 = size_dcon_2734; + + CursorTy writecur_5079 = writetag_5078 + sizeof(IntTy); + + *(IntTy *) writecur_5079 = offset__2733; + + CursorTy writecur_5080 = writecur_5079 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7489, pvrtmp_7490, + loc_2991, pvrtmp_7492}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3768, tmpcur_7476); + CursorTy pvrtmp_7501 = tmp_struct_194.field0; + CursorTy pvrtmp_7502 = tmp_struct_194.field1; + CursorTy pvrtmp_7503 = tmp_struct_194.field2; + CursorTy pvrtmp_7504 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7501, pvrtmp_7504, pvrtmp_7502); + CursorTy pvrtmp_7509 = tmp_struct_195.field0; + CursorTy pvrtmp_7510 = tmp_struct_195.field1; + CursorTy pvrtmp_7511 = tmp_struct_195.field2; + CursorTy pvrtmp_7512 = tmp_struct_195.field3; + IntTy sizeof_y_2737__2739 = pvrtmp_7504 - pvrtmp_7503; + IntTy sizeof_y_2738__2740 = pvrtmp_7512 - pvrtmp_7511; + IntTy fltPrm_2822 = sizeof_y_2737__2739 + 0; + IntTy offset__2741 = 0 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2737__2739 + sizeof_y_2738__2740; + IntTy size_dcon_2742 = 9 + fltPrm_2823; + + *(TagTyPacked *) loc_2991 = 162; + + CursorTy writetag_5087 = loc_2991 + 1; + + *(IntTy *) writetag_5087 = size_dcon_2742; + + CursorTy writecur_5088 = writetag_5087 + sizeof(IntTy); + + *(IntTy *) writecur_5088 = offset__2741; + + CursorTy writecur_5089 = writecur_5088 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7509, pvrtmp_7510, + loc_2991, pvrtmp_7512}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2992, end_r_2993, loc_3791, tmpcur_7476); + CursorTy pvrtmp_7521 = tmp_struct_196.field0; + CursorTy pvrtmp_7522 = tmp_struct_196.field1; + CursorTy pvrtmp_7523 = tmp_struct_196.field2; + CursorTy pvrtmp_7524 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7521, pvrtmp_7524, pvrtmp_7522); + CursorTy pvrtmp_7529 = tmp_struct_197.field0; + CursorTy pvrtmp_7530 = tmp_struct_197.field1; + CursorTy pvrtmp_7531 = tmp_struct_197.field2; + CursorTy pvrtmp_7532 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7529, pvrtmp_7532, pvrtmp_7530); + CursorTy pvrtmp_7537 = tmp_struct_198.field0; + CursorTy pvrtmp_7538 = tmp_struct_198.field1; + CursorTy pvrtmp_7539 = tmp_struct_198.field2; + CursorTy pvrtmp_7540 = tmp_struct_198.field3; + IntTy sizeof_y_2746__2749 = pvrtmp_7524 - pvrtmp_7523; + IntTy sizeof_y_2747__2750 = pvrtmp_7532 - pvrtmp_7531; + IntTy sizeof_y_2748__2751 = pvrtmp_7540 - pvrtmp_7539; + IntTy fltPrm_2824 = sizeof_y_2746__2749 + 0; + IntTy offset__2752 = 8 + fltPrm_2824; + IntTy fltPrm_2825 = sizeof_y_2746__2749 + sizeof_y_2747__2750; + IntTy offset__2753 = 0 + fltPrm_2825; + IntTy fltPrm_2827 = sizeof_y_2747__2750 + sizeof_y_2748__2751; + IntTy fltPrm_2826 = sizeof_y_2746__2749 + fltPrm_2827; + IntTy size_dcon_2754 = 17 + fltPrm_2826; + + *(TagTyPacked *) loc_2991 = 164; + + CursorTy writetag_5097 = loc_2991 + 1; + + *(IntTy *) writetag_5097 = size_dcon_2754; + + CursorTy writecur_5098 = writetag_5097 + sizeof(IntTy); + + *(IntTy *) writecur_5098 = offset__2752; + + CursorTy writecur_5099 = writecur_5098 + sizeof(IntTy); + + *(IntTy *) writecur_5099 = offset__2753; + + CursorTy writecur_5100 = writecur_5099 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7537, pvrtmp_7538, + loc_2991, pvrtmp_7540}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3818, tmpcur_7476); + CursorTy pvrtmp_7549 = tmp_struct_199.field0; + CursorTy pvrtmp_7550 = tmp_struct_199.field1; + CursorTy pvrtmp_7551 = tmp_struct_199.field2; + CursorTy pvrtmp_7552 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7549, pvrtmp_7552, pvrtmp_7550); + CursorTy pvrtmp_7557 = tmp_struct_200.field0; + CursorTy pvrtmp_7558 = tmp_struct_200.field1; + CursorTy pvrtmp_7559 = tmp_struct_200.field2; + CursorTy pvrtmp_7560 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7557, pvrtmp_7560, pvrtmp_7558); + CursorTy pvrtmp_7565 = tmp_struct_201.field0; + CursorTy pvrtmp_7566 = tmp_struct_201.field1; + CursorTy pvrtmp_7567 = tmp_struct_201.field2; + CursorTy pvrtmp_7568 = tmp_struct_201.field3; + IntTy sizeof_y_2758__2761 = pvrtmp_7552 - pvrtmp_7551; + IntTy sizeof_y_2759__2762 = pvrtmp_7560 - pvrtmp_7559; + IntTy sizeof_y_2760__2763 = pvrtmp_7568 - pvrtmp_7567; + IntTy fltPrm_2828 = sizeof_y_2758__2761 + 0; + IntTy offset__2764 = 8 + fltPrm_2828; + IntTy fltPrm_2829 = sizeof_y_2758__2761 + sizeof_y_2759__2762; + IntTy offset__2765 = 0 + fltPrm_2829; + IntTy fltPrm_2831 = sizeof_y_2759__2762 + sizeof_y_2760__2763; + IntTy fltPrm_2830 = sizeof_y_2758__2761 + fltPrm_2831; + IntTy size_dcon_2766 = 17 + fltPrm_2830; + + *(TagTyPacked *) loc_2991 = 166; + + CursorTy writetag_5109 = loc_2991 + 1; + + *(IntTy *) writetag_5109 = size_dcon_2766; + + CursorTy writecur_5110 = writetag_5109 + sizeof(IntTy); + + *(IntTy *) writecur_5110 = offset__2764; + + CursorTy writecur_5111 = writecur_5110 + sizeof(IntTy); + + *(IntTy *) writecur_5111 = offset__2765; + + CursorTy writecur_5112 = writecur_5111 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7565, pvrtmp_7566, + loc_2991, pvrtmp_7568}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2992, end_r_2993, loc_3845, tmpcur_7476); + CursorTy pvrtmp_7577 = tmp_struct_202.field0; + CursorTy pvrtmp_7578 = tmp_struct_202.field1; + CursorTy pvrtmp_7579 = tmp_struct_202.field2; + CursorTy pvrtmp_7580 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7577, pvrtmp_7580, pvrtmp_7578); + CursorTy pvrtmp_7585 = tmp_struct_203.field0; + CursorTy pvrtmp_7586 = tmp_struct_203.field1; + CursorTy pvrtmp_7587 = tmp_struct_203.field2; + CursorTy pvrtmp_7588 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7585, pvrtmp_7588, pvrtmp_7586); + CursorTy pvrtmp_7593 = tmp_struct_204.field0; + CursorTy pvrtmp_7594 = tmp_struct_204.field1; + CursorTy pvrtmp_7595 = tmp_struct_204.field2; + CursorTy pvrtmp_7596 = tmp_struct_204.field3; + IntTy sizeof_y_2770__2773 = pvrtmp_7580 - pvrtmp_7579; + IntTy sizeof_y_2771__2774 = pvrtmp_7588 - pvrtmp_7587; + IntTy sizeof_y_2772__2775 = pvrtmp_7596 - pvrtmp_7595; + IntTy fltPrm_2832 = sizeof_y_2770__2773 + 0; + IntTy offset__2776 = 8 + fltPrm_2832; + IntTy fltPrm_2833 = sizeof_y_2770__2773 + sizeof_y_2771__2774; + IntTy offset__2777 = 0 + fltPrm_2833; + IntTy fltPrm_2835 = sizeof_y_2771__2774 + sizeof_y_2772__2775; + IntTy fltPrm_2834 = sizeof_y_2770__2773 + fltPrm_2835; + IntTy size_dcon_2778 = 17 + fltPrm_2834; + + *(TagTyPacked *) loc_2991 = 168; + + CursorTy writetag_5121 = loc_2991 + 1; + + *(IntTy *) writetag_5121 = size_dcon_2778; + + CursorTy writecur_5122 = writetag_5121 + sizeof(IntTy); + + *(IntTy *) writecur_5122 = offset__2776; + + CursorTy writecur_5123 = writecur_5122 + sizeof(IntTy); + + *(IntTy *) writecur_5123 = offset__2777; + + CursorTy writecur_5124 = writecur_5123 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7593, pvrtmp_7594, + loc_2991, pvrtmp_7596}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3872, tmpcur_7476); + CursorTy pvrtmp_7605 = tmp_struct_205.field0; + CursorTy pvrtmp_7606 = tmp_struct_205.field1; + CursorTy pvrtmp_7607 = tmp_struct_205.field2; + CursorTy pvrtmp_7608 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7605, pvrtmp_7608, pvrtmp_7606); + CursorTy pvrtmp_7613 = tmp_struct_206.field0; + CursorTy pvrtmp_7614 = tmp_struct_206.field1; + CursorTy pvrtmp_7615 = tmp_struct_206.field2; + CursorTy pvrtmp_7616 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7613, pvrtmp_7616, pvrtmp_7614); + CursorTy pvrtmp_7621 = tmp_struct_207.field0; + CursorTy pvrtmp_7622 = tmp_struct_207.field1; + CursorTy pvrtmp_7623 = tmp_struct_207.field2; + CursorTy pvrtmp_7624 = tmp_struct_207.field3; + IntTy sizeof_y_2782__2785 = pvrtmp_7608 - pvrtmp_7607; + IntTy sizeof_y_2783__2786 = pvrtmp_7616 - pvrtmp_7615; + IntTy sizeof_y_2784__2787 = pvrtmp_7624 - pvrtmp_7623; + IntTy fltPrm_2836 = sizeof_y_2782__2785 + 0; + IntTy offset__2788 = 8 + fltPrm_2836; + IntTy fltPrm_2837 = sizeof_y_2782__2785 + sizeof_y_2783__2786; + IntTy offset__2789 = 0 + fltPrm_2837; + IntTy fltPrm_2839 = sizeof_y_2783__2786 + sizeof_y_2784__2787; + IntTy fltPrm_2838 = sizeof_y_2782__2785 + fltPrm_2839; + IntTy size_dcon_2790 = 17 + fltPrm_2838; + + *(TagTyPacked *) loc_2991 = 170; + + CursorTy writetag_5133 = loc_2991 + 1; + + *(IntTy *) writetag_5133 = size_dcon_2790; + + CursorTy writecur_5134 = writetag_5133 + sizeof(IntTy); + + *(IntTy *) writecur_5134 = offset__2788; + + CursorTy writecur_5135 = writecur_5134 + sizeof(IntTy); + + *(IntTy *) writecur_5135 = offset__2789; + + CursorTy writecur_5136 = writecur_5135 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7621, pvrtmp_7622, + loc_2991, pvrtmp_7624}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3899, tmpcur_7476); + CursorTy pvrtmp_7633 = tmp_struct_208.field0; + CursorTy pvrtmp_7634 = tmp_struct_208.field1; + CursorTy pvrtmp_7635 = tmp_struct_208.field2; + CursorTy pvrtmp_7636 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7633, pvrtmp_7636, pvrtmp_7634); + CursorTy pvrtmp_7641 = tmp_struct_209.field0; + CursorTy pvrtmp_7642 = tmp_struct_209.field1; + CursorTy pvrtmp_7643 = tmp_struct_209.field2; + CursorTy pvrtmp_7644 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7641, pvrtmp_7644, pvrtmp_7642); + CursorTy pvrtmp_7649 = tmp_struct_210.field0; + CursorTy pvrtmp_7650 = tmp_struct_210.field1; + CursorTy pvrtmp_7651 = tmp_struct_210.field2; + CursorTy pvrtmp_7652 = tmp_struct_210.field3; + IntTy sizeof_y_2794__2797 = pvrtmp_7636 - pvrtmp_7635; + IntTy sizeof_y_2795__2798 = pvrtmp_7644 - pvrtmp_7643; + IntTy sizeof_y_2796__2799 = pvrtmp_7652 - pvrtmp_7651; + IntTy fltPrm_2840 = sizeof_y_2794__2797 + 0; + IntTy offset__2800 = 8 + fltPrm_2840; + IntTy fltPrm_2841 = sizeof_y_2794__2797 + sizeof_y_2795__2798; + IntTy offset__2801 = 0 + fltPrm_2841; + IntTy fltPrm_2843 = sizeof_y_2795__2798 + sizeof_y_2796__2799; + IntTy fltPrm_2842 = sizeof_y_2794__2797 + fltPrm_2843; + IntTy size_dcon_2802 = 17 + fltPrm_2842; + + *(TagTyPacked *) loc_2991 = 172; + + CursorTy writetag_5145 = loc_2991 + 1; + + *(IntTy *) writetag_5145 = size_dcon_2802; + + CursorTy writecur_5146 = writetag_5145 + sizeof(IntTy); + + *(IntTy *) writecur_5146 = offset__2800; + + CursorTy writecur_5147 = writecur_5146 + sizeof(IntTy); + + *(IntTy *) writecur_5147 = offset__2801; + + CursorTy writecur_5148 = writecur_5147 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7649, pvrtmp_7650, + loc_2991, pvrtmp_7652}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3926, tmpcur_7476); + CursorTy pvrtmp_7661 = tmp_struct_211.field0; + CursorTy pvrtmp_7662 = tmp_struct_211.field1; + CursorTy pvrtmp_7663 = tmp_struct_211.field2; + CursorTy pvrtmp_7664 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7661, pvrtmp_7664, pvrtmp_7662); + CursorTy pvrtmp_7669 = tmp_struct_212.field0; + CursorTy pvrtmp_7670 = tmp_struct_212.field1; + CursorTy pvrtmp_7671 = tmp_struct_212.field2; + CursorTy pvrtmp_7672 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7669, pvrtmp_7672, pvrtmp_7670); + CursorTy pvrtmp_7677 = tmp_struct_213.field0; + CursorTy pvrtmp_7678 = tmp_struct_213.field1; + CursorTy pvrtmp_7679 = tmp_struct_213.field2; + CursorTy pvrtmp_7680 = tmp_struct_213.field3; + IntTy sizeof_y_2806__2809 = pvrtmp_7664 - pvrtmp_7663; + IntTy sizeof_y_2807__2810 = pvrtmp_7672 - pvrtmp_7671; + IntTy sizeof_y_2808__2811 = pvrtmp_7680 - pvrtmp_7679; + IntTy fltPrm_2844 = sizeof_y_2806__2809 + 0; + IntTy offset__2812 = 8 + fltPrm_2844; + IntTy fltPrm_2845 = sizeof_y_2806__2809 + sizeof_y_2807__2810; + IntTy offset__2813 = 0 + fltPrm_2845; + IntTy fltPrm_2847 = sizeof_y_2807__2810 + sizeof_y_2808__2811; + IntTy fltPrm_2846 = sizeof_y_2806__2809 + fltPrm_2847; + IntTy size_dcon_2814 = 17 + fltPrm_2846; + + *(TagTyPacked *) loc_2991 = 174; + + CursorTy writetag_5157 = loc_2991 + 1; + + *(IntTy *) writetag_5157 = size_dcon_2814; + + CursorTy writecur_5158 = writetag_5157 + sizeof(IntTy); + + *(IntTy *) writecur_5158 = offset__2812; + + CursorTy writecur_5159 = writecur_5158 + sizeof(IntTy); + + *(IntTy *) writecur_5159 = offset__2813; + + CursorTy writecur_5160 = writecur_5159 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7677, pvrtmp_7678, + loc_2991, pvrtmp_7680}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7689 = *(CursorTy *) tmpcur_7476; + CursorTy tmpaftercur_7690 = tmpcur_7476 + 8; + CursorTy jump_4386 = tmpcur_7476 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_2991, tmpcur_7689); + CursorTy pvrtmp_7691 = tmp_struct_214.field0; + CursorTy pvrtmp_7692 = tmp_struct_214.field1; + CursorTy pvrtmp_7693 = tmp_struct_214.field2; + CursorTy pvrtmp_7694 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7691, jump_4386, + pvrtmp_7693, pvrtmp_7694}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7701 = *(CursorTy *) tmpcur_7476; + CursorTy tmpaftercur_7702 = tmpcur_7476 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_2991, tmpcur_7701); + CursorTy pvrtmp_7703 = tmp_struct_215.field0; + CursorTy pvrtmp_7704 = tmp_struct_215.field1; + CursorTy pvrtmp_7705 = tmp_struct_215.field2; + CursorTy pvrtmp_7706 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7703, pvrtmp_7704, + pvrtmp_7705, pvrtmp_7706}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7475"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2996, + CursorTy end_r_2997, + CursorTy loc_2995, + CursorTy arg_2815) +{ + if (loc_2995 + 32 > end_r_2997) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2997); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2997 = chunk_end_224; + *(TagTyPacked *) loc_2995 = 255; + + CursorTy redir = loc_2995 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2995 = chunk_start_223; + } + + CursorTy loc_3946 = loc_2995 + 1; + CursorTy loc_3947 = loc_3946 + 8; + TagTyPacked tmpval_7714 = *(TagTyPacked *) arg_2815; + CursorTy tmpcur_7715 = arg_2815 + 1; + + + switch_7758: + ; + switch (tmpval_7714) { + + case 0: + { + CursorTy jump_4254 = arg_2815 + 1; + + *(TagTyPacked *) loc_2995 = 0; + + CursorTy writetag_5172 = loc_2995 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2997, jump_4254, + loc_2995, writetag_5172}; + break; + } + + case 1: + { + IntTy tmpval_7720 = *(IntTy *) tmpcur_7715; + CursorTy tmpcur_7721 = tmpcur_7715 + sizeof(IntTy); + CursorTy jump_4256 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_3947, tmpcur_7721); + CursorTy pvrtmp_7722 = tmp_struct_219.field0; + CursorTy pvrtmp_7723 = tmp_struct_219.field1; + CursorTy pvrtmp_7724 = tmp_struct_219.field2; + CursorTy pvrtmp_7725 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2995 = 1; + + CursorTy writetag_5177 = loc_2995 + 1; + + *(IntTy *) writetag_5177 = tmpval_7720; + + CursorTy writecur_5178 = writetag_5177 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7722, pvrtmp_7723, + loc_2995, pvrtmp_7725}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7734 = *(CursorTy *) tmpcur_7715; + CursorTy tmpaftercur_7735 = tmpcur_7715 + 8; + CursorTy jump_4392 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_2995, tmpcur_7734); + CursorTy pvrtmp_7736 = tmp_struct_220.field0; + CursorTy pvrtmp_7737 = tmp_struct_220.field1; + CursorTy pvrtmp_7738 = tmp_struct_220.field2; + CursorTy pvrtmp_7739 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7736, jump_4392, + pvrtmp_7738, pvrtmp_7739}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7746 = *(CursorTy *) tmpcur_7715; + CursorTy tmpaftercur_7747 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_2995, tmpcur_7746); + CursorTy pvrtmp_7748 = tmp_struct_221.field0; + CursorTy pvrtmp_7749 = tmp_struct_221.field1; + CursorTy pvrtmp_7750 = tmp_struct_221.field2; + CursorTy pvrtmp_7751 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7748, pvrtmp_7749, + pvrtmp_7750, pvrtmp_7751}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7714"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6154, ")"); + add_symbol(6155, "(Text "); + add_symbol(6156, "(Tag "); + add_symbol(6157, "(TCA "); + add_symbol(6158, "(TAC "); + add_symbol(6159, "(Nul "); + add_symbol(6160, "(Nil "); + add_symbol(6161, "(Image "); + add_symbol(6162, "(End "); + add_symbol(6163, "(Char "); + add_symbol(6164, "(CTA "); + add_symbol(6165, "(CAT "); + add_symbol(6166, "(CA "); + add_symbol(6167, "(ATC "); + add_symbol(6168, "(ACT "); + add_symbol(6169, "(AC "); + add_symbol(6170, " ->r "); + add_symbol(6171, " ->i "); + + RegionTy *region_6172 = alloc_region(global_init_inf_buf_size); + CursorTy r_3007 = region_6172->reg_heap; + IntTy sizeof_end_r_3007_6173 = global_init_inf_buf_size; + CursorTy end_r_3007 = r_3007 + sizeof_end_r_3007_6173; + RegionTy *region_6174 = alloc_region(global_init_inf_buf_size); + CursorTy r_3006 = region_6174->reg_heap; + IntTy sizeof_end_r_3006_6175 = global_init_inf_buf_size; + CursorTy end_r_3006 = r_3006 + sizeof_end_r_3006_6175; + CursorCursorCursorProd tmp_struct_225 = + mkTCAList(end_r_3007, r_3007, 100000, 10, 2000); + CursorTy pvrtmp_6176 = tmp_struct_225.field0; + CursorTy pvrtmp_6177 = tmp_struct_225.field1; + CursorTy pvrtmp_6178 = tmp_struct_225.field2; + CursorTy pvrtmp_6192; + CursorTy pvrtmp_6193; + CursorTy pvrtmp_6194; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6192; + struct timespec end_pvrtmp_6192; + + start_counters(); + for (long long iters_pvrtmp_6192 = 0; iters_pvrtmp_6192 < + global_iters_param; iters_pvrtmp_6192++) { + if (iters_pvrtmp_6192 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6192); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6176, end_r_3006, r_3006, pvrtmp_6177); + CursorTy pvrtmp_6183 = tmp_struct_226.field0; + CursorTy pvrtmp_6184 = tmp_struct_226.field1; + CursorTy pvrtmp_6185 = tmp_struct_226.field2; + + pvrtmp_6192 = pvrtmp_6183; + pvrtmp_6193 = pvrtmp_6184; + pvrtmp_6194 = pvrtmp_6185; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6192); + if (iters_pvrtmp_6192 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6192, + &end_pvrtmp_6192); + + vector_inplace_update(times_230, iters_pvrtmp_6192, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTca2.c b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTca2.c new file mode 100644 index 000000000..99425b38a --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/c_benchmarking/processAdtTagsTca2.c @@ -0,0 +1,5070 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#ifdef _WIN64 +#include +#endif +#include +#include +#include // For va_start etc +#include +#include +#include +#include +#ifdef _POINTER +#include +#endif +#ifdef _PARALLEL +#include +#include +#endif + +#define KB 1024lu +#define MB (KB * 1000lu) +#define GB (MB * 1000lu) + +#define REDIRECTION_TAG 255 +#define INDIRECTION_TAG 254 + +#include "_papi.h" + +// Initial size of BigInfinite buffers +static long long global_init_biginf_buf_size = (4 * GB); + +// Initial size of Infinite buffers +static long long global_init_inf_buf_size = 1 * KB; + +// Maximum size of a chunk, see GitHub #110. +static long long global_inf_buf_max_chunk_size = 1 * GB; + +static long long global_size_param = 1; +static long long global_iters_param = 1; + +static char* global_benchfile_param = NULL; +static char* global_arrayfile_param = NULL; +// Number of lines in the arrayfile +static long long global_arrayfile_length_param = -1; + +// Sequential for now: +static const int num_workers = 1; + +// Count the number of regions allocated. +static long long global_region_count = 0; +static bool global_region_count_flag = false; + +#ifdef _PARALLEL +static inline void bump_global_region_count() { + __atomic_add_fetch(&global_region_count, 1, __ATOMIC_SEQ_CST); + return; +} +#else +static inline void bump_global_region_count() { + global_region_count++; + return; +} +#endif + +static inline void print_global_region_count() { + printf("REGION_COUNT: %lld\n", global_region_count); + return; +} + +#define REDIRECTION_NODE_SIZE 9 +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + +// https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux +static int get_num_processors() { +#ifdef _WIN64 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + return sysconf(_SC_NPROCESSORS_ONLN); +#endif +} + +// Requires -std=gnu11 +int dbgprintf(const char *format, ...) { + int code = 0; + va_list args; + va_start(args, format); +#ifdef _DEBUG + code = vprintf(format, args); +#endif + va_end(args); + return code; +} + + +// ----------------------------------------------------------------------------- +// Allocators +// ----------------------------------------------------------------------------- + + +// ------------------------------------- +// Bump allocation for linked-lists +// ------------------------------------- + + +#ifdef _BUMPALLOC +// #define _DEBUG +#warning "Using bump allocator." + +__thread char* bumpalloc_heap_ptr = (char*)NULL; +__thread char* bumpalloc_heap_ptr_end = (char*)NULL; + +char* saved_heap_ptr_stack[100]; +int num_saved_heap_ptr = 0; + +// For simplicity just use a single large slab: +static inline void INITBUMPALLOC() { + bumpalloc_heap_ptr = (char*)malloc(global_init_biginf_buf_size); + bumpalloc_heap_ptr_end = bumpalloc_heap_ptr + global_init_biginf_buf_size; +#ifdef _DEBUG + printf("Arena size for bump alloc: %lld\n", global_init_biginf_buf_size); + printf("BUMPALLOC/INITBUMPALLOC DONE: heap_ptr = %p\n", bumpalloc_heap_ptr); +#endif +} + +static inline void* BUMPALLOC(long long n) { + if (! bumpalloc_heap_ptr) { + INITBUMPALLOC(); + } + if (bumpalloc_heap_ptr + n < bumpalloc_heap_ptr_end) { + char* old= bumpalloc_heap_ptr; + bumpalloc_heap_ptr += n; + return old; + } else { + fprintf(stderr, "Warning: bump allocator ran out of memory."); + exit(1); + } +} + +// Snapshot the current heap pointer value across all threads. +void save_alloc_state() { + dbgprintf("Saving(%p): pos %d", heap_ptr, num_saved_heap_ptr); + saved_heap_ptr_stack[num_saved_heap_ptr] = heap_ptr; + num_saved_heap_ptr++; + dbgprintf("\n"); +} + +void restore_alloc_state() { + if(num_saved_heap_ptr <= 0) { + fprintf(stderr, "Bad call to restore_alloc_state! Saved stack empty!\ne"); + exit(1); + } + num_saved_heap_ptr--; + dbgprintf("Restoring(%p): pos %d, discarding %p", + saved_heap_ptr_stack[num_saved_heap_ptr], num_saved_heap_ptr, bumpalloc_heap_ptr); + bumpalloc_heap_ptr = saved_heap_ptr_stack[num_saved_heap_ptr]; +} + + +#else +// Regular malloc mode: +void INITBUMPALLOC() {} +void save_alloc_state() {} +void restore_alloc_state() {} + +#define BUMPALLOC(n) malloc(n) + +#endif // BUMPALLOC + + +// ------------------------------------- +// Bump allocated nursery for regions +// ------------------------------------- + +// See https://github.com/iu-parfunc/gibbon/issues/122. + +__thread char* nursery_heap_ptr = (char*)NULL; +__thread char* nursery_heap_ptr_end = (char*)NULL; + +#define NURSERY_SIZE 0 +// #define NURSERY_SIZE global_init_biginf_buf_size +#define NURSERY_ALLOC_UPPER_BOUND 1024 + +static inline void init_nursery() { + nursery_heap_ptr = (char*)malloc(NURSERY_SIZE); + if (nursery_heap_ptr == NULL) { + printf("init_region: malloc failed: %d", NURSERY_SIZE); + exit(1); + } + nursery_heap_ptr_end = nursery_heap_ptr + NURSERY_SIZE; +#ifdef _DEBUG + printf("init_nursery: DONE, heap_ptr = %p\n", nursery_heap_ptr); +#endif +} + +static inline void* alloc_in_nursery(long long n) { + if (! nursery_heap_ptr) { + init_nursery(); + } + if (nursery_heap_ptr + n < nursery_heap_ptr_end) { + char* old = nursery_heap_ptr; + nursery_heap_ptr += n; +#ifdef _DEBUG + printf("alloc_in_nursery: DONE, %lld\n", n); +#endif + return old; + } else { + return NULL; + } +} + +// ------------------------------------- +// ALLOC and ALLOC_PACKED macros +// ------------------------------------- + + +/* + +If parallelism is enabled, we always use a nursery/malloc based allocator +since Boehm GC is not thread-safe in its default configuration. It can be +made thread-safe by building it with appropriate flags, but we don't do that. +Presently, all parallel pointer-based programs will leak memory. + +*/ + +#ifdef _PARALLEL +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} +#else + #ifdef _POINTER +#define ALLOC(n) GC_MALLOC(n) +#define ALLOC_PACKED_SMALL(n) GC_MALLOC(n) +#define ALLOC_PACKED_BIG(n) GC_MALLOC(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return GC_MALLOC(size); +} + #else +#define ALLOC(n) malloc(n) +#define ALLOC_PACKED_SMALL(n) alloc_in_nursery(n) +#define ALLOC_PACKED_BIG(n) malloc(n) +char *ALLOC_COUNTED(size_t size) { + bump_global_region_count(); + return ALLOC(size); +} + #endif // _POINTER +#endif // _PARALLEL + + +// Could try alloca() here. Better yet, we could keep our own, +// separate stack and insert our own code to restore the pointer +// before any function that (may have) called ALLOC_SCOPED returns. + +// #define ALLOC_SCOPED() alloca(1024) +#define ALLOC_SCOPED(n) alloca(n) +// #define ALLOC_SCOPED() alloc_scoped() + +// Stack allocation is either too small or blows our stack. +// We need a way to make a giant stack if we want to use alloca. +// #define ALLOC_SCOPED() ALLOC(global_init_biginf_buf_size) + +// Our global pointer. No parallelism. +// static char* stack_scoped_region; +// char* alloc_scoped() { return stack_scoped_region; } + + + +// ------------------------------------- +// Basic types +// ------------------------------------- + +// Must be consistent with sizeOfTy defined in Gibbon.Language.Syntax. + +typedef unsigned char TagTyPacked; +typedef unsigned char TagTyBoxed; +typedef long long IntTy; +typedef float FloatTy; +typedef unsigned long long SymTy; +typedef bool BoolTy; +typedef char* PtrTy; +typedef char* CursorTy; + +// ------------------------------------- +// Arenas and dictionaries +// ------------------------------------- + +typedef struct mem_arena { + int ind; + char* mem; // TODO(vollmerm): make this a list of chunks? + void* reflist; +} mem_arena_t; + +typedef mem_arena_t* ArenaTy; + +ArenaTy alloc_arena() { + ArenaTy ar = ALLOC(sizeof(mem_arena_t)); + ar->ind = 0; + ar->mem = malloc(global_inf_buf_max_chunk_size); + ar->reflist = 0; + return ar; +} + +void free_arena(ArenaTy ar) { + free(ar->mem); + // TODO(vollmerm): free everything in ar->reflist + free(ar); +} + +CursorTy extend_arena(ArenaTy ar, int size) { + CursorTy ret = ar->mem + ar->ind; + ar->ind += size; + return ret; +} + +typedef struct dict_item { + struct dict_item * next; + int key; + void * ptrval; +} dict_item_t; + +dict_item_t * dict_alloc(ArenaTy ar) { + return (dict_item_t *) extend_arena(ar, sizeof(dict_item_t)); // ALLOC(sizeof(dict_item_t)); +} + +dict_item_t *dict_insert_ptr(ArenaTy ar, dict_item_t *ptr, SymTy key, PtrTy val) { + dict_item_t *ret = dict_alloc(ar); + ret->key = key; + ret->ptrval = val; + ret->next = ptr; + return ret; +} + +PtrTy dict_lookup_ptr(dict_item_t *ptr, SymTy key) { + while (ptr != 0) { + if (ptr->key == key) { + return ptr->ptrval; + } else { + ptr = ptr->next; + } + } + printf("Error, key %lld not found!\n",key); + exit(1); +} + +// ------------------------------------- +// Sets +// ------------------------------------- + + +struct set_elem { + int val; + UT_hash_handle hh; +}; + +typedef struct set_elem* SymSetTy; + +SymSetTy empty_set() { + return NULL; +} + +SymSetTy insert_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); /* sym already in the hash? */ + if (s==NULL) { + s = malloc(sizeof(struct set_elem)); + s->val = sym; + HASH_ADD_INT(set,val,s); + } + return set; +} + +BoolTy contains_set(SymSetTy set, int sym) { + SymSetTy s; + HASH_FIND_INT(set, &sym, s); + return (s!=NULL); +} + +// ------------------------------------- +// Sym Hash +// ------------------------------------- + +struct sym_hash_elem { + int key; + int val; + UT_hash_handle hh; +}; + +typedef struct sym_hash_elem* SymHashTy; + +typedef struct sym_hash_elem* IntHashTy; + +SymHashTy empty_hash() { + return NULL; +} + +SymHashTy insert_hash(SymHashTy hash, int k, int v) { + SymHashTy s; + // NOTE: not checking for duplicates! + // s = malloc(sizeof(struct sym_hash_elem)); + s = ALLOC(sizeof(struct sym_hash_elem)); + s->val = v; + s->key = k; + HASH_ADD_INT(hash,key,s); + + return hash; +} + +IntTy lookup_hash(SymHashTy hash, int k) { + SymHashTy s; + HASH_FIND_INT(hash,&k,s); + if (s==NULL) { + return k; // NOTE: return original key if val not found + // TODO(vollmerm): come up with something better to do here + } else { + return s->val; + } +} + +BoolTy contains_hash(SymHashTy hash, int sym) { + SymHashTy s; + HASH_FIND_INT(hash,&sym,s); + return (s!=NULL); +} + +// ------------------------------------- +// Helpers +// ------------------------------------- + +char* read_benchfile_param() { + if (global_benchfile_param == NULL) { + fprintf(stderr, "read_benchfile_param: benchmark input file was not set! Set using --bench-input.\n"); + exit(1); + } else + return global_benchfile_param; +} + +char* read_arrayfile_param() { + if (global_arrayfile_param == NULL) { + fprintf(stderr, "read_arrayfile_param: array input file was not set! Set using --array-input.\n"); + exit(1); + } else + return global_arrayfile_param; +} + +IntTy read_arrayfile_length_param() { + if (global_arrayfile_length_param == -1) { + fprintf(stderr, "read_arrayfile_length_param: array input file length was not set! Set using --array-input-length.\n"); + exit(1); + } else + return global_arrayfile_length_param; +} + + +// fun fact: __ prefix is actually reserved and this is an undefined behavior. +// These functions must be provided by the code generator. +int __main_expr(); + + +void show_usage(char** argv) +{ + printf("\n"); + printf("This binary was generated by the Gibbon compiler.\n"); + printf("\n"); + printf("Usage: %s [OPTS] [size] [iters]\n", argv[0]); + + printf("\n"); + printf("Options:\n"); + printf(" --buffer-size Set the buffer size (default %lld).\n", global_init_biginf_buf_size); + printf(" --bench-input Set the input file read for benchmarking. Applies only\n"); + printf(" IF the program was *compiled* with --bench-fun. \n"); + return; +} + +double avg(const double* arr, int n) +{ + double sum = 0.0; + for(int i=0; itv_sec - t0->tv_sec) + + ((double)(t1->tv_nsec - t0->tv_nsec) / 1000000000.0); +} + +int compare_doubles(const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +// Exponentiation +IntTy expll(IntTy base, IntTy pow) { + if (base == 2) { + return (1 << pow); + } else { + IntTy i, result = 1; + for (i = 0; i < pow; i++) + result *= base; + return result; + } + } + +// ------------------------------------- +// Symbol table +// ------------------------------------- + +#define global_max_symbol_len 256 + +// Invariant: should always be equal to max(sym_table_keys) +static SymTy global_gensym_counter = 0; + +// Its value is updated by the flags parser. +static char *global_bench_prog_param; + +static SymTy newline_symbol = -1; +static SymTy space_symbol = -1; +static SymTy comma_symbol = -1; +static SymTy leftparen_symbol = -1; +static SymTy rightparen_symbol = -1; + +typedef struct SymTable_elem { + SymTy idx; /* key */ + char value[global_max_symbol_len]; + UT_hash_handle hh; /* makes this structure hashable */ +} SymTable_elem; + +// important! initialize to NULL +SymTable_elem *global_sym_table = NULL; + +void add_symbol(SymTy idx, char *value) { + struct SymTable_elem *s; + s = ALLOC(sizeof(struct SymTable_elem)); + s->idx = idx; + strcpy(s->value, value); + HASH_ADD(hh, global_sym_table, idx, sizeof(IntTy), s); + if (idx > global_gensym_counter) { + global_gensym_counter = idx; + } +} + +void set_newline(SymTy idx) { + newline_symbol = idx; + add_symbol(idx,"NEWLINE"); +} + +void set_space(SymTy idx) { + space_symbol = idx; + add_symbol(idx,"SPACE"); +} + +void set_comma(SymTy idx) { + comma_symbol = idx; + add_symbol(idx,"COMMA"); +} + +void set_leftparen(SymTy idx) { + leftparen_symbol = idx; + add_symbol(idx,"LEFTPAREN"); +} + +void set_rightparen(SymTy idx) { + rightparen_symbol = idx; + add_symbol(idx,"RIGHTPAREN"); +} + +IntTy print_symbol(SymTy idx) { + if (idx == comma_symbol) { + return printf(","); + } else if (idx == newline_symbol) { + return printf("\n"); + } else if (idx == space_symbol) { + return printf(" "); + } else if (idx == leftparen_symbol) { + return printf("("); + } else if (idx == rightparen_symbol) { + return printf(")"); + } else { + struct SymTable_elem *s; + HASH_FIND(hh, global_sym_table, &idx, sizeof(SymTy), s); + if (s == NULL) { + return printf("%lld", idx); + } else { + return printf("%s", s->value); + } + + } +} + +#ifdef _PARALLEL +SymTy gensym() { + SymTy idx = __atomic_add_fetch(&global_gensym_counter, 1, __ATOMIC_SEQ_CST); + return idx; +} +#else +SymTy gensym() { + global_gensym_counter += 1; + SymTy idx = global_gensym_counter; + return idx; +} +#endif + +void free_symtable() { + struct SymTable_elem *elt, *tmp; + HASH_ITER(hh, global_sym_table, elt, tmp) { + HASH_DEL(global_sym_table,elt); + } + free(elt); + free(tmp); +} + +/* + +---------------------------------------- +Garbage collection +---------------------------------------- + + Gibbon has "growing regions" i.e each logical region is backed by a doubly linked-list + of smaller chunks which grows as required. In addition to actual data, each chunk + stores some additional metadata (RegionFooter) to chain the chunks together in a list + and for garbage collection. The footer: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + serialized data | rf_reg_metadata_ptr | rf_seq_no | rf_nursery_allocated | rf_size | rf_next | rf_prev + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The metadata after the serialized data serves various purposes: + + - rf_reg_metadata_ptr: A pointer to a RegionTy struct that contains various metadata. + Of particular interest to us are the fields: + + = reg_id: A unique identifier for a region. + + = refcount and outset: Whenever an inter-region indirection is created, we record that information + using these two fields. Suppose we have an indirection from region A that points to some chunk + in region B. Then A's outset will store a pointer to that chunk's footer, and B's refcount will + be bumped by 1. Note that all there's only 1 refcount cell, and 1 outset per logical region, + and chunks only store a pointer to them. + + - rf_seq_no: The index of this particular chunk in the list. + + - rf_nursery_allocated: Whether this chunk was allocated in a nursery. + + - rf_size: Used during bounds checking to calculate the size of the next region in + the linked list. + + - rf_next / rf_prev: Point to the next and previous chunk respectively. + + +There are two ways in which a region may be freed: + +(1) Whenever it goes out of scope + + The RTS tries to free a region whenever it goes out of scope. But this doesn't always succeed as + regions sometimes contain values that "escape". One reason why this'll happen is if there's an + indirection from A->B, and A lives longer than B. + In such a case, when B goes out of scope it's refcount won't be 0, and the RTS won't free it. + This brings us to (2). + +(2) + + When the RTS successfully frees a region, it decrements the refcounts of all the regions it + points to (via the outset). At the same time, if it encounters a region in the outset whoose + refcount becomes 0 after the decrement, it calls free_region on that. This way we can be sure + that all regions will eventually be garbage collected before the program exits. + + + +Why is it a doubly linked-list? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to way that bounds-checking works, the pointers in the outset may actually point to any +arbitrary chunk in the chain. However, we must call free_region on the first one to ensure that +all of them are GC'd. So we need pointers to traverse backward get to the first one. +'trav_to_first_chunk' accomplishes this. + + */ + +#define MAX_OUTSET_LENGTH 10 + +typedef struct RegionTy_struct { + SymTy reg_id; + uint reg_refcount; + CursorTy reg_heap; + uint reg_outset_len; + CursorTy reg_outset[MAX_OUTSET_LENGTH]; +} RegionTy; + +typedef struct RegionFooter_struct { + RegionTy *rf_reg_metadata_ptr; + + IntTy rf_seq_no; + bool rf_nursery_allocated; + IntTy rf_size; + struct RegionFooter_struct *rf_next; + struct RegionFooter_struct *rf_prev; +} RegionFooter; + +typedef struct ChunkTy_struct { + CursorTy chunk_start; + CursorTy chunk_end; +} ChunkTy; + +static inline void insert_into_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + // Check for duplicates. + for (uint i = 0; i < outset_len; i++) { + if (ptr == reg->reg_outset[i]) { + return; + } + } + // Otherwise, insert into the outset. + reg->reg_outset[outset_len] = ptr; + reg->reg_outset_len = outset_len + 1; + return; +} + +static inline void remove_from_outset(CursorTy ptr, RegionTy *reg) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + int i; + if (outset_len == 0) { + fprintf(stderr, "remove_from_outset: empty outset\n"); + exit(1); + } + // Position of 'ptr' in the outset. + int elt_idx = -1; + for (i = 0; i < outset_len; i++) { + if (ptr == outset[i]) { + elt_idx = i; + } + } + if (elt_idx == -1) { + fprintf(stderr, "remove_from_outset: element not found\n"); + exit(1); + } + // Move all elements ahead of 'elt_idx' back by one position. + for (i = elt_idx; i < outset_len; i++) { + outset[i] = outset[i+1]; + } + return; +} + +RegionTy *alloc_region(IntTy size) { + // Allocate the region metadata. + RegionTy *reg = ALLOC(sizeof(RegionTy)); + if (reg == NULL) { + printf("alloc_region: allocation failed: %ld", sizeof(RegionTy)); + exit(1); + } + + // Allocate the first chunk. + IntTy total_size = size + sizeof(RegionFooter); + CursorTy heap; + bool nursery_allocated = true; + if (size <= NURSERY_ALLOC_UPPER_BOUND) { + heap = ALLOC_PACKED_SMALL(total_size); + if (heap == NULL) { + heap = malloc(total_size); + nursery_allocated = false; + } + } else { + heap = ALLOC_PACKED_BIG(total_size); + nursery_allocated = false; + } + if (heap == NULL) { + printf("alloc_region: malloc failed: %lld", total_size); + exit(1); + } + // Not heap+total_size, since we must keep space for the footer. + CursorTy heap_end = heap + size; + + // Initialize metadata fields. + reg->reg_id = gensym(); + reg->reg_refcount = 1; + reg->reg_heap = heap; + reg->reg_outset_len = 0; + +#ifdef _DEBUG + printf("Allocated a region(%lld): %lld bytes, nursery=%d.\n", reg->reg_id, size, nursery_allocated); +#endif + + // Write the footer. + RegionFooter *footer = (RegionFooter *) heap_end; + footer->rf_reg_metadata_ptr = reg; + footer->rf_seq_no = 1; + footer->rf_nursery_allocated = nursery_allocated; + footer->rf_size = size; + footer->rf_next = NULL; + footer->rf_prev = NULL; + + return reg; +} + +RegionTy *alloc_counted_region(IntTy size) { + // Bump the count. + bump_global_region_count(); + return alloc_region(size); +} + +ChunkTy alloc_chunk(CursorTy end_old_chunk) { + // Get size from current footer. + RegionFooter *footer = (RegionFooter *) end_old_chunk; + IntTy newsize = footer->rf_size * 2; + // See #110. + if (newsize > global_inf_buf_max_chunk_size) { + newsize = global_inf_buf_max_chunk_size; + } + IntTy total_size = newsize + sizeof(RegionFooter); + + // Allocate. + CursorTy start = ALLOC_PACKED_BIG(total_size); + if (start == NULL) { + printf("alloc_chunk: malloc failed: %lld", total_size); + exit(1); + } + CursorTy end = start + newsize; + + // Link the next chunk's footer. + footer->rf_next = (RegionFooter *) end; + + // Write the footer. + RegionFooter* new_footer = (RegionFooter *) end; + new_footer->rf_reg_metadata_ptr = footer->rf_reg_metadata_ptr; + new_footer->rf_seq_no = footer->rf_seq_no + 1; + new_footer->rf_nursery_allocated = false; + new_footer->rf_size = newsize; + new_footer->rf_next = NULL; + new_footer->rf_prev = footer; + +#ifdef _DEBUG + RegionTy *reg = (RegionTy*) new_footer->rf_reg_metadata_ptr; + printf("alloc_chunk: allocated %lld bytes for region %lld.\n", total_size, reg->reg_id); +#endif + + return (ChunkTy) {start , end}; +} + +RegionFooter* trav_to_first_chunk(RegionFooter *footer) { + if (footer->rf_seq_no == 1) { + return footer; + } else if (footer->rf_prev == NULL) { + fprintf(stderr, "No previous chunk found at rf_seq_no: %lld", footer->rf_seq_no); + return NULL; + } else { + trav_to_first_chunk((RegionFooter *) footer->rf_prev); + } + return NULL; +} + +uint get_ref_count(CursorTy end_ptr) { + RegionFooter *footer = (RegionFooter *) end_ptr; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + return reg->reg_refcount; +} + +// B is the pointer, and A is the pointee (i.e B -> A). +// Bump A's refcount and update B's outset. +static inline void bump_ref_count(CursorTy end_b, CursorTy end_a) { + // Grab footers. + RegionFooter *footer_a = (RegionFooter *) end_a; + RegionFooter *footer_b = (RegionFooter *) end_b; + + // Grab metadata. + RegionTy *reg_a = (RegionTy *) footer_a->rf_reg_metadata_ptr; + RegionTy *reg_b = (RegionTy *) footer_b->rf_reg_metadata_ptr; + + // Bump A's refcount. + uint current_refcount, new_refcount; + current_refcount = reg_a->reg_refcount; + new_refcount = current_refcount + 1; + reg_a->reg_refcount = new_refcount; + +#ifdef _DEBUG + printf("bump_ref_count: %lld -> %lld\n", reg_b->reg_id, reg_a->reg_id); + printf("bump_ref_count: old-refcount=%d, old-outset-len=%d:\n", current_refcount, reg_b->reg_outset_len); + assert(current_refcount == reg_b->reg_outset_len+1); +#endif + + // Add A to B's outset. + insert_into_outset(end_a, reg_b); + +#ifdef _DEBUG + // printf("bump_ref_count: Added %p to %lld's outset, %p.\n", end_a, reg_b->reg_id, reg_b); + printf("bump_ref_count: new-refcount=%d, new-outset-len=%d\n", new_refcount, reg_b->reg_outset_len); + assert(new_refcount == reg_b->reg_outset_len+1); +#endif + + return; +} + +void free_region(CursorTy end_reg) { + // Grab footer and the metadata. + RegionFooter *footer = (RegionFooter *) end_reg; + RegionTy *reg = (RegionTy *) footer->rf_reg_metadata_ptr; + + // + RegionFooter *first_chunk_footer, *next_chunk_footer; + CursorTy first_chunk, next_chunk; + + // Decrement current reference count. + uint current_refcount, new_refcount; + current_refcount = reg->reg_refcount; + new_refcount = 0; + if (current_refcount != 0) { + new_refcount = current_refcount - 1; + reg->reg_refcount = new_refcount; + } + +#ifdef _DEBUG + printf("free_region(%lld): refcounts (1): old-refcount=%d, new-refcount=%d:\n", reg->reg_id, current_refcount, new_refcount); +#endif + + + // Free this region recount is 0. + if (new_refcount == 0) { + +#ifdef _DEBUG + printf("free_region(%lld): outset length: %d\n", reg->reg_id, reg->reg_outset_len); +#endif + + // Decrement refcounts, free regions with refcount==0 and also free + // elements of the outset. + if (reg->reg_outset_len != 0) { + uint outset_len = reg->reg_outset_len; + CursorTy *outset = reg->reg_outset; + RegionFooter *elt_footer; + RegionTy *elt_reg; + uint elt_current_refcount, elt_new_refcount; + CursorTy to_be_removed[MAX_OUTSET_LENGTH]; + uint to_be_removed_idx = 0; + for (int i = 0; i < outset_len; i++) { + elt_footer = (RegionFooter *) outset[i]; + elt_reg = (RegionTy *) elt_footer->rf_reg_metadata_ptr; +#ifdef _DEBUG + elt_current_refcount = elt_reg->reg_refcount; +#endif + elt_new_refcount = elt_current_refcount - 1; + elt_reg->reg_refcount = elt_new_refcount; +#ifdef _DEBUG + printf("free_region(%lld): old-refcount=%d, new-refcount=%d:\n", + elt_reg->reg_id, elt_current_refcount, elt_reg->reg_refcount); +#endif + if (elt_new_refcount == 0) { + // See [Why is it a doubly linked-list?] above + first_chunk_footer = trav_to_first_chunk(elt_footer); + if (first_chunk_footer != NULL) { + free_region((CursorTy) first_chunk_footer); + } + } + to_be_removed[to_be_removed_idx] = outset[i]; + to_be_removed_idx++; + } + // Remove elements from the outset. + for (uint i = 0; i < to_be_removed_idx; i++) { + remove_from_outset(to_be_removed[i], reg); + } + } + + +#ifdef _DEBUG + // Bookkeeping + IntTy num_freed_chunks = 0, total_bytesize = 0; +#endif + + // Free the chunks in this region. + first_chunk = end_reg - footer->rf_size; + first_chunk_footer = footer; + next_chunk = (char*) footer->rf_next; + +#ifdef _DEBUG + printf("free_region(%lld): first chunk in nursery: %d\n", + reg->reg_id, + first_chunk_footer->rf_nursery_allocated); +#endif + + if (! first_chunk_footer->rf_nursery_allocated) { + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + first_chunk_footer->rf_size; + #endif + free(first_chunk); + } + + while (next_chunk != NULL) { + next_chunk_footer = (RegionFooter *) next_chunk; + #ifdef _DEBUG + num_freed_chunks++; + total_bytesize = total_bytesize + next_chunk_footer->rf_size; + #endif + free(next_chunk - next_chunk_footer->rf_size); + next_chunk = (char*) next_chunk_footer->rf_next; + } + +#ifdef _DEBUG + printf("free_region(%lld): Freed %lld bytes across %lld chunks.\n", + reg->reg_id, total_bytesize, num_freed_chunks); +#endif + + // Free the metadata. + free(reg); + + } else { +#ifdef _DEBUG + printf("free_region(%lld): non-zero refcount: %d.\n", + reg->reg_id, reg->reg_refcount); +#endif + } +} + +// Assume that all nodes with size information have tags >= 150. +BoolTy is_big(IntTy i, CursorTy cur) { + TagTyPacked tag = *(TagTyPacked *) cur; + if (tag >= 150) { + cur += 1; + IntTy size = *(IntTy *) cur; + if (size >= i) { + return true; + } else { + return false; + } + } + return false; +} + +// ------------------------------------- +// Vectors +// ------------------------------------- + +typedef struct VectorTy_struct { + // Bounds on the vector. + IntTy vec_lower, vec_upper; + + // Size of each element. + IntTy vec_elt_size; + + // Actual elements of the vector. + void* vec_data; +} VectorTy; + +VectorTy* vector_alloc(IntTy num, IntTy elt_size) { + VectorTy *vec = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + void* data = ALLOC(num * elt_size); + if (data == NULL) { + printf("alloc_vector: malloc failed: %ld", sizeof(num * elt_size)); + exit(1); + } + vec->vec_lower = 0; + vec->vec_upper = num; + vec->vec_elt_size = elt_size; + vec->vec_data = data; + return vec; +} + +IntTy vector_length(VectorTy *vec) { + return (vec->vec_upper - vec->vec_lower); +} + +BoolTy vector_is_empty(VectorTy *vec) { + return (vector_length(vec) == 0); +} + +VectorTy* vector_slice(IntTy i, IntTy n, VectorTy *vec) { + IntTy lower = vec->vec_lower + i; + IntTy upper = vec->vec_lower + i + n; + if ((lower > vec->vec_upper)) { + printf("vector_slice: lower out of bounds, %lld > %lld", lower, vec->vec_upper); + exit(1); + } + if ((upper > vec->vec_upper)) { + printf("vector_slice: upper out of bounds: %lld > %lld", upper, vec->vec_upper); + exit(1); + } + VectorTy *vec2 = ALLOC(sizeof(VectorTy)); + if (vec == NULL) { + printf("vector_slice: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + vec2->vec_lower = lower; + vec2->vec_upper = upper; + vec2->vec_elt_size = vec->vec_elt_size; + vec2->vec_data = vec->vec_data; + return vec2; +} + +// The callers must cast the return value. +static inline void* vector_nth(VectorTy *vec, IntTy i) { + // if (i < vec->lower || i > vec->upper) { + // printf("vector_nth index out of bounds: %lld (%lld,%lld) \n", i, vec->vec_lower, vec->vec_upper); + // exit(1); + // } + return (vec->vec_data + (vec->vec_elt_size * (vec->vec_lower + i))); +} + +static inline VectorTy* vector_inplace_update(VectorTy *vec, IntTy i, void* elt) { + void* dst = vector_nth(vec, i); + memcpy(dst, elt, vec->vec_elt_size); + return vec; +} + +static inline VectorTy* vector_copy(VectorTy *vec) { + IntTy len = vector_length(vec); + void *start = vector_nth(vec, 0); + VectorTy *vec2 = vector_alloc(len, vec->vec_elt_size); + memcpy(vec2->vec_data, start, len * vec->vec_elt_size); + return vec2; +} + +static inline VectorTy* vector_inplace_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + void *start = vector_nth(vec, 0); + qsort(start, vector_length(vec), vec->vec_elt_size, compar); + return vec; +} + +static inline VectorTy* vector_sort(VectorTy *vec, int (*compar)(const void *, const void*)) { + VectorTy *vec2 = vector_copy(vec); + vector_inplace_sort(vec2, compar); + return vec2; +} + +static inline VectorTy* vector_concat(VectorTy *vec) { + // Length of the input vector. + IntTy len = vector_length(vec); + // Length of the concatenated vector. + IntTy result_len = 0; + // Size of each element in the concatenated vector. + IntTy result_elt_size = 0; + VectorTy **elt_ref, *elt; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + result_elt_size = elt->vec_elt_size; + result_len += vector_length(elt); + } + + // Concatenated vector. + VectorTy *result = vector_alloc(result_len, result_elt_size); + IntTy elt_len; + // A counter that tracks the index of elements in 'result'. + IntTy k = 0; + for (IntTy i = 0; i < len; i++) { + elt_ref = vector_nth(vec, i); + elt = *elt_ref; + elt_len = vector_length(elt); + + for (IntTy j = 0; j < elt_len; j++) { + void* k_elt = vector_nth(elt, j); + vector_inplace_update(result, k, k_elt); + k++; + } + } + + return result; +} + +static inline void vector_free(VectorTy *vec) { + free(vec->vec_data); + free(vec); + return; +} + +static inline VectorTy* vector_merge(VectorTy *vec1, VectorTy *vec2) { + if (vec1->vec_upper != vec2->vec_lower) { + printf("vector_merge: non-contiguous slices, (%lld,%lld), (%lld,%lld).", + vec1->vec_lower, vec1->vec_upper, vec2->vec_lower, vec2->vec_upper); + exit(1); + } + VectorTy *merged = ALLOC(sizeof(VectorTy)); + if (merged == NULL) { + printf("vector_merge: malloc failed: %ld", sizeof(VectorTy)); + exit(1); + } + merged->vec_lower = vec1->vec_lower; + merged->vec_upper = vec2->vec_upper; + merged->vec_elt_size = vec1->vec_elt_size; + merged->vec_data = vec1->vec_data; + return merged; +} + +void print_timing_array(VectorTy *times) { + printf("TIMES: ["); + double *d; + IntTy n = vector_length(times); + for(int i = 0; i < n; i++) { + d = vector_nth(times, i); + if (i == (n-1)) { + printf("%f",*d); + } + else { + printf("%f, ",*d); + } + } + printf("]\n"); +} + +double sum_timing_array(VectorTy *times) { + double *d; + double acc = 0; + for(int i = 0; i < vector_length(times); i++) { + d = vector_nth(times, i); + acc += *d; + } + return acc; +} + +// ------------------------------------- +// Linked lists +// ------------------------------------- + +typedef struct ListTy_struct { + IntTy ll_data_size; + void* ll_data; + struct ListTy_struct* ll_next; +} ListTy; + +static inline ListTy* list_alloc(IntTy data_size) { + // ListTy *ls = ALLOC(sizeof(ListTy)); + ListTy *ls = BUMPALLOC(sizeof(ListTy)); + ls->ll_data_size = data_size; + ls->ll_data = NULL; + ls->ll_next = NULL; + return ls; +} + +static inline BoolTy list_is_empty(ListTy *ls) { + return ls->ll_next == NULL; +} + +static inline ListTy* list_cons(void* elt, ListTy *ls) { + // void* data = ALLOC(ls->data_size); + void* data = BUMPALLOC(ls->ll_data_size); + if (data == NULL) { + printf("list_cons: malloc failed: %lld", ls->ll_data_size); + exit(1); + } + memcpy(data, elt, ls->ll_data_size); + // ListTy *res = ALLOC(sizeof(ListTy)); + ListTy *res = BUMPALLOC(sizeof(ListTy)); + res->ll_data_size = ls->ll_data_size; + res->ll_data = data; + res->ll_next = (ListTy*) ls; + return res; +} + +static inline void* list_head(ListTy *ls) { + return ls->ll_data; +} + +static inline ListTy* list_tail(ListTy *ls) { + return ls->ll_next; +} + +static inline void list_free(ListTy *ls) { + free(ls->ll_data); + free(ls); + return; +} + +static inline ListTy* list_copy(ListTy *ls) { + ListTy *ls2 = list_alloc(ls->ll_data_size); + if (ls->ll_data != NULL) { + void* data = BUMPALLOC(ls->ll_data_size); + memcpy(data, ls->ll_data, ls->ll_data_size); + ls2->ll_data = data; + } + ls2->ll_next = ls->ll_next; + return ls2; +} + +// ------------------------------------- +// Ppm Images +// ------------------------------------- + +typedef struct __Pixel_struct { + IntTy field0; + IntTy field1; + IntTy field2; +} __Pixel; + +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels); +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels); + +// Example: writePpm("gibbon_rgb_1000.ppm", 1000, 1000, pixels); +void writePpm(char* filename, IntTy width, IntTy height, VectorTy *pixels) +{ + FILE *fp; + fp = fopen(filename, "w+"); + fprintf(fp, "P3\n"); + fprintf(fp, "%lld %lld\n255\n", width, height); + IntTy len = vector_length(pixels); + writePpm_loop(fp, 0, len, pixels); + fclose(fp); + return; +} + +void writePpm_loop(FILE *fp, IntTy idx, IntTy end, VectorTy *pixels) +{ + BoolTy fltIf_5768_6575 = idx == end; + + if (fltIf_5768_6575) { + return; + } else { + __Pixel *tmp_112; + tmp_112 = (__Pixel *) vector_nth(pixels, idx); + __Pixel tup = *tmp_112; + IntTy x = tup.field0; + IntTy y = tup.field1; + IntTy z = tup.field2; + // write to file. + fprintf(fp, "%lld %lld %lld\n", x, y, z); + writePpm_loop(fp, (idx+1), end, pixels); + } +} + +/* -------------------------------------------------------------------------------- */ + +int main(int argc, char** argv) +{ + // parameters to parse: + // + // num iterations: How many times to repeat a benchmark. + // tree size: An integer passes to `build_tree()`. + + struct rlimit lim; + int code; + if ( (code = getrlimit(RLIMIT_STACK, &lim)) ) { + fprintf(stderr, " [gibbon rts] failed to getrlimit, code %d\n", code); + exit(1); + } + + // lim.rlim_cur = 1024LU * 1024LU * 1024LU; // 1GB stack. + lim.rlim_cur = 512LU * 1024LU * 1024LU; // 500MB stack. + // lim.rlim_max = lim.rlim_cur; // Normal users may only be able to decrease this. + + // WARNING: Haven't yet figured out why this doesn't work on MacOS... +#ifndef __APPLE__ + code = setrlimit(RLIMIT_STACK, &lim); + while (code) { + fprintf(stderr, " [gibbon rts] Failed to set stack size to %llu, code %d\n", (unsigned long long)lim.rlim_cur, code); + lim.rlim_cur /= 2; + // lim.rlim_max /= 2; + if(lim.rlim_cur < 100 * 1024) { + fprintf(stderr, " [gibbon rts] Failed setrlimit stack size to something reasonable; giving up.\n"); + break; // abort(); + } + int code = setrlimit(RLIMIT_STACK, &lim); + } +#endif + + int got_numargs = 0; // How many numeric arguments have we got. + + int i; + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + show_usage(argv); + exit(0); + } + else if (strcmp(argv[i], "--biginf-buffer-size") == 0 && i < argc - 1) + { + global_init_biginf_buf_size = atoll(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "--inf-buffer-size") == 0 && i < argc - 1) + { + global_init_inf_buf_size = atoll(argv[i + 1]); + i++; + } + else if ((strcmp(argv[i], "--bench-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --bench-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_benchfile_param = argv[i+1]; + i++; + } + else if ((strcmp(argv[i], "--array-input") == 0)) { + if (i+1 >= argc) { + fprintf(stderr, "Not enough arguments after --array-input, expected .\n"); + show_usage(argv); + exit(1); + } + global_arrayfile_param = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "--array-input-length") == 0 && i < argc - 1) { + global_arrayfile_length_param = atoll(argv[i+1]); + i++; + } + else if (strcmp(argv[i], "--bench-prog") == 0 && i < argc - 1) { + int len = strlen(argv[i+1]); + global_bench_prog_param = (char*) malloc((len+1)*sizeof(char)); + strncpy(global_bench_prog_param,argv[i+1],len); + i++; + } + // If present, we expect the two arguments to be + else if (got_numargs >= 2) { + fprintf(stderr, "Extra arguments left over: "); + for(; i < argc; i++) fprintf(stderr, "%s ", argv[i]); + show_usage(argv); + exit(1); + } else { + if (got_numargs == 0) { + global_size_param = atoll(argv[i]); + got_numargs ++; + } else { + global_iters_param = atoll(argv[i]); + } + } + } + + // Initialize global_bench_prog_param to an empty string in case + // the runtime argument --bench-prog isn't passed. + if (global_bench_prog_param == NULL) { + global_bench_prog_param = (char*) malloc(1*sizeof(char)); + *global_bench_prog_param = '\n'; + } + + __main_expr(); + + return 0; +} + +// ----------------------------------------------------------------------------- +// Program starts here +// ----------------------------------------------------------------------------- + +typedef struct Prod_struct { } Prod; +typedef struct Int64Prod_struct { + IntTy field0; + } Int64Prod; +typedef struct Int64CursorProd_struct { + IntTy field0; + CursorTy field1; + } Int64CursorProd; +typedef struct BoolProd_struct { + BoolTy field0; + } BoolProd; +typedef struct TagCursorProd_struct { + TagTyPacked field0; + CursorTy field1; + } TagCursorProd; +typedef struct CursorProd_struct { + CursorTy field0; + } CursorProd; +typedef struct CursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + } CursorCursorProd; +typedef struct CursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + } CursorCursorCursorProd; +typedef struct CursorCursorCursorCursorProd_struct { + CursorTy field0; + CursorTy field1; + CursorTy field2; + CursorTy field3; + } CursorCursorCursorCursorProd; +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2920, CursorTy end_r_2921, + CursorTy loc_2919, + CursorTy adt_16_902_1520); +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2924, CursorTy end_r_2925, + CursorTy loc_2923, + CursorTy tags_22_908_1528, + IntTy inVal_23_909_1529); +CursorCursorCursorProd mkTCAList(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_26_912_1534, + IntTy tagLen_27_913_1535, + IntTy strLen_28_914_1536); +CursorCursorCursorProd mkString(CursorTy end_r_2929, CursorTy loc_2928, + IntTy len_181_1067_1542); +CursorCursorCursorProd mkContentText(CursorTy end_r_2931, CursorTy loc_2930, + IntTy n_195_1081_1548); +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2933, CursorTy loc_2932, + IntTy len_320_1206_1550); +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2936, + CursorTy end_r_2937, + CursorTy loc_2935, + CursorTy arg_624_1230_1555); +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2940, + CursorTy end_r_2941, + CursorTy loc_2939, + CursorTy arg_629_1235_1560); +CursorProd _traverse_String(CursorTy end_r_2943, CursorTy arg_634_1240_1565); +CursorProd _print_String(CursorTy end_r_2945, CursorTy arg_639_1244_1569); +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2948, + CursorTy end_r_2949, + CursorTy loc_2947, + CursorTy arg_648_1253_1578); +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2952, + CursorTy end_r_2953, + CursorTy loc_2951, + CursorTy arg_653_1258_1583); +CursorProd _traverse_Content(CursorTy end_r_2955, CursorTy arg_658_1263_1588); +CursorProd _print_Content(CursorTy end_r_2957, CursorTy arg_663_1268_1593); +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2960, CursorTy end_r_2961, + CursorTy loc_2959, + CursorTy arg_672_1277_1602); +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2964, + CursorTy end_r_2965, + CursorTy loc_2963, + CursorTy arg_717_1322_1647); +CursorProd _traverse_Adt(CursorTy end_r_2967, CursorTy arg_762_1367_1692); +CursorProd _print_Adt(CursorTy end_r_2969, CursorTy arg_807_1412_1737); +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2972, + CursorTy end_r_2973, CursorTy loc_2971, + CursorTy arg_870_1475_1800); +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2976, + CursorTy end_r_2977, + CursorTy loc_2975, + CursorTy arg_875_1480_1805); +CursorProd _traverse_Tags(CursorTy end_r_2979, CursorTy arg_880_1485_1810); +CursorProd _print_Tags(CursorTy end_r_2981, CursorTy arg_885_1489_1814); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_String(CursorTy end_r_2984, CursorTy end_r_2985, + CursorTy loc_2983, CursorTy arg_2716); +CursorCursorCursorCursorProd +_add_size_and_rel_offsets_Content(CursorTy end_r_2988, CursorTy end_r_2989, + CursorTy loc_2987, CursorTy arg_2721); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2992, + CursorTy end_r_2993, + CursorTy loc_2991, + CursorTy arg_2726); +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2996, + CursorTy end_r_2997, + CursorTy loc_2995, + CursorTy arg_2815); +CursorCursorCursorProd addValTagsAdt(CursorTy end_r_2920, CursorTy end_r_2921, + CursorTy loc_2919, + CursorTy adt_16_902_1520) +{ + if (loc_2919 + 32 > end_r_2921) { + ChunkTy new_chunk_4 = alloc_chunk(end_r_2921); + CursorTy chunk_start_5 = new_chunk_4.chunk_start; + CursorTy chunk_end_6 = new_chunk_4.chunk_end; + + end_r_2921 = chunk_end_6; + *(TagTyPacked *) loc_2919 = 255; + + CursorTy redir = loc_2919 + 1; + + *(CursorTy *) redir = chunk_start_5; + loc_2919 = chunk_start_5; + } + + CursorTy loc_3029 = loc_2919 + 1; + CursorTy loc_3030 = loc_3029 + 8; + CursorTy loc_3031 = loc_3030 + 8; + TagTyPacked tmpval_6202 = *(TagTyPacked *) adt_16_902_1520; + CursorTy tmpcur_6203 = adt_16_902_1520 + 1; + + + switch_6259: + ; + switch (tmpval_6202) { + + case 0: + { + CursorTy jump_3955 = adt_16_902_1520 + 1; + + *(TagTyPacked *) loc_2919 = 0; + + CursorTy writetag_4514 = loc_2919 + 1; + + return (CursorCursorCursorProd) {end_r_2921, loc_2919, + writetag_4514}; + break; + } + + case 13: + { + RegionTy *region_6208 = alloc_region(global_init_inf_buf_size); + CursorTy r_3041 = region_6208->reg_heap; + IntTy sizeof_end_r_3041_6209 = global_init_inf_buf_size; + CursorTy end_r_3041 = r_3041 + sizeof_end_r_3041_6209; + CursorTy tmpcur_6210 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6211 = tmpcur_6203 + 8; + CursorTy tmpcur_6212 = *(CursorTy *) tmpaftercur_6211; + CursorTy tmpaftercur_6213 = tmpaftercur_6211 + 8; + CursorTy jump_3958 = tmpaftercur_6211 + 8; + CursorTy jump_3957 = tmpcur_6203 + 8; + CursorCursorCursorProd tmp_struct_0 = + addValTagsAdt(end_r_2920, end_r_3041, r_3041, tmpcur_6212); + CursorTy pvrtmp_6214 = tmp_struct_0.field0; + CursorTy pvrtmp_6215 = tmp_struct_0.field1; + CursorTy pvrtmp_6216 = tmp_struct_0.field2; + CursorCursorCursorCursorProd tmp_struct_1 = + addValTag(end_r_2920, end_r_2921, loc_3031, tmpaftercur_6213, 10); + CursorTy pvrtmp_6221 = tmp_struct_1.field0; + CursorTy pvrtmp_6222 = tmp_struct_1.field1; + CursorTy pvrtmp_6223 = tmp_struct_1.field2; + CursorTy pvrtmp_6224 = tmp_struct_1.field3; + + *(TagTyPacked *) pvrtmp_6224 = 254; + + CursorTy writetag_4521 = pvrtmp_6224 + 1; + + *(CursorTy *) writetag_4521 = tmpcur_6210; + + CursorTy writecur_4522 = writetag_4521 + 8; + + *(TagTyPacked *) writecur_4522 = 254; + + CursorTy writetag_4524 = writecur_4522 + 1; + + *(CursorTy *) writetag_4524 = r_3041; + + CursorTy writecur_4525 = writetag_4524 + 8; + + *(TagTyPacked *) loc_2919 = 13; + + CursorTy writetag_4527 = loc_2919 + 1; + + *(CursorTy *) writetag_4527 = pvrtmp_6224; + + CursorTy writecur_4528 = writetag_4527 + 8; + + *(CursorTy *) writecur_4528 = writecur_4522; + + CursorTy writecur_4529 = writecur_4528 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6221, loc_2919, + writecur_4525}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6237 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6238 = tmpcur_6203 + 8; + CursorTy jump_4267 = tmpcur_6203 + 8; + CursorCursorCursorProd tmp_struct_2 = + addValTagsAdt(end_r_2920, end_r_2921, loc_2919, tmpcur_6237); + CursorTy pvrtmp_6239 = tmp_struct_2.field0; + CursorTy pvrtmp_6240 = tmp_struct_2.field1; + CursorTy pvrtmp_6241 = tmp_struct_2.field2; + + return (CursorCursorCursorProd) {pvrtmp_6239, pvrtmp_6240, + pvrtmp_6241}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6248 = *(CursorTy *) tmpcur_6203; + CursorTy tmpaftercur_6249 = tmpcur_6203 + 8; + CursorCursorCursorProd tmp_struct_3 = + addValTagsAdt(end_r_2920, end_r_2921, loc_2919, tmpcur_6248); + CursorTy pvrtmp_6250 = tmp_struct_3.field0; + CursorTy pvrtmp_6251 = tmp_struct_3.field1; + CursorTy pvrtmp_6252 = tmp_struct_3.field2; + + return (CursorCursorCursorProd) {pvrtmp_6250, pvrtmp_6251, + pvrtmp_6252}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6202"); + exit(1); + } + } +} +CursorCursorCursorCursorProd addValTag(CursorTy end_r_2924, CursorTy end_r_2925, + CursorTy loc_2923, + CursorTy tags_22_908_1528, + IntTy inVal_23_909_1529) +{ + if (loc_2923 + 32 > end_r_2925) { + ChunkTy new_chunk_10 = alloc_chunk(end_r_2925); + CursorTy chunk_start_11 = new_chunk_10.chunk_start; + CursorTy chunk_end_12 = new_chunk_10.chunk_end; + + end_r_2925 = chunk_end_12; + *(TagTyPacked *) loc_2923 = 255; + + CursorTy redir = loc_2923 + 1; + + *(CursorTy *) redir = chunk_start_11; + loc_2923 = chunk_start_11; + } + + CursorTy loc_3050 = loc_2923 + 1; + CursorTy loc_3051 = loc_3050 + 8; + TagTyPacked tmpval_6260 = *(TagTyPacked *) tags_22_908_1528; + CursorTy tmpcur_6261 = tags_22_908_1528 + 1; + + + switch_6304: + ; + switch (tmpval_6260) { + + case 0: + { + CursorTy jump_3961 = tags_22_908_1528 + 1; + + *(TagTyPacked *) loc_2923 = 0; + + CursorTy writetag_4541 = loc_2923 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2925, jump_3961, + loc_2923, writetag_4541}; + break; + } + + case 1: + { + IntTy tmpval_6266 = *(IntTy *) tmpcur_6261; + CursorTy tmpcur_6267 = tmpcur_6261 + sizeof(IntTy); + CursorTy jump_3963 = tmpcur_6261 + 8; + IntTy fltPkd_1508_1532 = tmpval_6266 + inVal_23_909_1529; + CursorCursorCursorCursorProd tmp_struct_7 = + addValTag(end_r_2924, end_r_2925, loc_3051, tmpcur_6267, inVal_23_909_1529); + CursorTy pvrtmp_6268 = tmp_struct_7.field0; + CursorTy pvrtmp_6269 = tmp_struct_7.field1; + CursorTy pvrtmp_6270 = tmp_struct_7.field2; + CursorTy pvrtmp_6271 = tmp_struct_7.field3; + + *(TagTyPacked *) loc_2923 = 1; + + CursorTy writetag_4546 = loc_2923 + 1; + + *(IntTy *) writetag_4546 = fltPkd_1508_1532; + + CursorTy writecur_4547 = writetag_4546 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6268, pvrtmp_6269, + loc_2923, pvrtmp_6271}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6280 = *(CursorTy *) tmpcur_6261; + CursorTy tmpaftercur_6281 = tmpcur_6261 + 8; + CursorTy jump_4272 = tmpcur_6261 + 8; + CursorCursorCursorCursorProd tmp_struct_8 = + addValTag(end_r_2924, end_r_2925, loc_2923, tmpcur_6280, inVal_23_909_1529); + CursorTy pvrtmp_6282 = tmp_struct_8.field0; + CursorTy pvrtmp_6283 = tmp_struct_8.field1; + CursorTy pvrtmp_6284 = tmp_struct_8.field2; + CursorTy pvrtmp_6285 = tmp_struct_8.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6282, jump_4272, + pvrtmp_6284, pvrtmp_6285}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6292 = *(CursorTy *) tmpcur_6261; + CursorTy tmpaftercur_6293 = tmpcur_6261 + 8; + CursorCursorCursorCursorProd tmp_struct_9 = + addValTag(end_r_2924, end_r_2925, loc_2923, tmpcur_6292, inVal_23_909_1529); + CursorTy pvrtmp_6294 = tmp_struct_9.field0; + CursorTy pvrtmp_6295 = tmp_struct_9.field1; + CursorTy pvrtmp_6296 = tmp_struct_9.field2; + CursorTy pvrtmp_6297 = tmp_struct_9.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6294, pvrtmp_6295, + pvrtmp_6296, pvrtmp_6297}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6260"); + exit(1); + } + } +} +CursorCursorCursorProd mkTCAList(CursorTy end_r_2927, CursorTy loc_2926, + IntTy len_26_912_1534, + IntTy tagLen_27_913_1535, + IntTy strLen_28_914_1536) +{ + if (loc_2926 + 32 > end_r_2927) { + ChunkTy new_chunk_16 = alloc_chunk(end_r_2927); + CursorTy chunk_start_17 = new_chunk_16.chunk_start; + CursorTy chunk_end_18 = new_chunk_16.chunk_end; + + end_r_2927 = chunk_end_18; + *(TagTyPacked *) loc_2926 = 255; + + CursorTy redir = loc_2926 + 1; + + *(CursorTy *) redir = chunk_start_17; + loc_2926 = chunk_start_17; + } + + CursorTy loc_3059 = loc_2926 + 1; + CursorTy loc_3060 = loc_3059 + 8; + CursorTy loc_3061 = loc_3060 + 8; + BoolTy fltIf_1510_1537 = len_26_912_1534 <= 0; + + if (fltIf_1510_1537) { + *(TagTyPacked *) loc_2926 = 0; + + CursorTy writetag_4556 = loc_2926 + 1; + + return (CursorCursorCursorProd) {end_r_2927, loc_2926, writetag_4556}; + } else { + CursorCursorCursorProd tmp_struct_13 = + mkRandomTags(end_r_2927, loc_3061, tagLen_27_913_1535); + CursorTy pvrtmp_6309 = tmp_struct_13.field0; + CursorTy pvrtmp_6310 = tmp_struct_13.field1; + CursorTy pvrtmp_6311 = tmp_struct_13.field2; + CursorCursorCursorProd tmp_struct_14 = + mkContentText(pvrtmp_6309, pvrtmp_6311, strLen_28_914_1536); + CursorTy pvrtmp_6316 = tmp_struct_14.field0; + CursorTy pvrtmp_6317 = tmp_struct_14.field1; + CursorTy pvrtmp_6318 = tmp_struct_14.field2; + IntTy fltAppE_1511_1540 = len_26_912_1534 - 1; + CursorCursorCursorProd tmp_struct_15 = + mkTCAList(pvrtmp_6316, pvrtmp_6318, fltAppE_1511_1540, tagLen_27_913_1535, strLen_28_914_1536); + CursorTy pvrtmp_6323 = tmp_struct_15.field0; + CursorTy pvrtmp_6324 = tmp_struct_15.field1; + CursorTy pvrtmp_6325 = tmp_struct_15.field2; + + *(TagTyPacked *) loc_2926 = 13; + + CursorTy writetag_4561 = loc_2926 + 1; + + *(CursorTy *) writetag_4561 = pvrtmp_6311; + + CursorTy writecur_4562 = writetag_4561 + 8; + + *(CursorTy *) writecur_4562 = pvrtmp_6318; + + CursorTy writecur_4563 = writecur_4562 + 8; + + return (CursorCursorCursorProd) {pvrtmp_6323, loc_2926, pvrtmp_6325}; + } +} +CursorCursorCursorProd mkString(CursorTy end_r_2929, CursorTy loc_2928, + IntTy len_181_1067_1542) +{ + if (loc_2928 + 32 > end_r_2929) { + ChunkTy new_chunk_20 = alloc_chunk(end_r_2929); + CursorTy chunk_start_21 = new_chunk_20.chunk_start; + CursorTy chunk_end_22 = new_chunk_20.chunk_end; + + end_r_2929 = chunk_end_22; + *(TagTyPacked *) loc_2928 = 255; + + CursorTy redir = loc_2928 + 1; + + *(CursorTy *) redir = chunk_start_21; + loc_2928 = chunk_start_21; + } + + CursorTy loc_3073 = loc_2928 + 1; + CursorTy loc_3074 = loc_3073 + 8; + BoolTy fltIf_1512_1543 = len_181_1067_1542 <= 0; + + if (fltIf_1512_1543) { + *(TagTyPacked *) loc_2928 = 0; + + CursorTy writetag_4568 = loc_2928 + 1; + + return (CursorCursorCursorProd) {end_r_2929, loc_2928, writetag_4568}; + } else { + IntTy fltPrm_1513_1544 = rand(); + IntTy randomChar_182_1068_1545 = fltPrm_1513_1544 % 128; + IntTy fltAppE_1514_1546 = len_181_1067_1542 - 1; + CursorCursorCursorProd tmp_struct_19 = + mkString(end_r_2929, loc_3074, fltAppE_1514_1546); + CursorTy pvrtmp_6338 = tmp_struct_19.field0; + CursorTy pvrtmp_6339 = tmp_struct_19.field1; + CursorTy pvrtmp_6340 = tmp_struct_19.field2; + + *(TagTyPacked *) loc_2928 = 1; + + CursorTy writetag_4571 = loc_2928 + 1; + + *(IntTy *) writetag_4571 = randomChar_182_1068_1545; + + CursorTy writecur_4572 = writetag_4571 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6338, loc_2928, pvrtmp_6340}; + } +} +CursorCursorCursorProd mkContentText(CursorTy end_r_2931, CursorTy loc_2930, + IntTy n_195_1081_1548) +{ + if (loc_2930 + 32 > end_r_2931) { + ChunkTy new_chunk_24 = alloc_chunk(end_r_2931); + CursorTy chunk_start_25 = new_chunk_24.chunk_start; + CursorTy chunk_end_26 = new_chunk_24.chunk_end; + + end_r_2931 = chunk_end_26; + *(TagTyPacked *) loc_2930 = 255; + + CursorTy redir = loc_2930 + 1; + + *(CursorTy *) redir = chunk_start_25; + loc_2930 = chunk_start_25; + } + + CursorTy loc_3079 = loc_2930 + 1; + CursorCursorCursorProd tmp_struct_23 = + mkString(end_r_2931, loc_3079, n_195_1081_1548); + CursorTy pvrtmp_6349 = tmp_struct_23.field0; + CursorTy pvrtmp_6350 = tmp_struct_23.field1; + CursorTy pvrtmp_6351 = tmp_struct_23.field2; + + *(TagTyPacked *) loc_2930 = 1; + + CursorTy writetag_4576 = loc_2930 + 1; + + return (CursorCursorCursorProd) {pvrtmp_6349, loc_2930, pvrtmp_6351}; +} +CursorCursorCursorProd mkRandomTags(CursorTy end_r_2933, CursorTy loc_2932, + IntTy len_320_1206_1550) +{ + if (loc_2932 + 32 > end_r_2933) { + ChunkTy new_chunk_28 = alloc_chunk(end_r_2933); + CursorTy chunk_start_29 = new_chunk_28.chunk_start; + CursorTy chunk_end_30 = new_chunk_28.chunk_end; + + end_r_2933 = chunk_end_30; + *(TagTyPacked *) loc_2932 = 255; + + CursorTy redir = loc_2932 + 1; + + *(CursorTy *) redir = chunk_start_29; + loc_2932 = chunk_start_29; + } + + CursorTy loc_3083 = loc_2932 + 1; + CursorTy loc_3084 = loc_3083 + 8; + BoolTy fltIf_1516_1551 = len_320_1206_1550 <= 0; + + if (fltIf_1516_1551) { + *(TagTyPacked *) loc_2932 = 0; + + CursorTy writetag_4579 = loc_2932 + 1; + + return (CursorCursorCursorProd) {end_r_2933, loc_2932, writetag_4579}; + } else { + IntTy fltAppE_1517_1553 = len_320_1206_1550 - 1; + CursorCursorCursorProd tmp_struct_27 = + mkRandomTags(end_r_2933, loc_3084, fltAppE_1517_1553); + CursorTy pvrtmp_6364 = tmp_struct_27.field0; + CursorTy pvrtmp_6365 = tmp_struct_27.field1; + CursorTy pvrtmp_6366 = tmp_struct_27.field2; + + *(TagTyPacked *) loc_2932 = 1; + + CursorTy writetag_4582 = loc_2932 + 1; + + *(IntTy *) writetag_4582 = 100; + + CursorTy writecur_4583 = writetag_4582 + sizeof(IntTy); + + return (CursorCursorCursorProd) {pvrtmp_6364, loc_2932, pvrtmp_6366}; + } +} +CursorCursorCursorCursorProd _copy_String(CursorTy end_r_2936, + CursorTy end_r_2937, + CursorTy loc_2935, + CursorTy arg_624_1230_1555) +{ + if (loc_2935 + 32 > end_r_2937) { + ChunkTy new_chunk_34 = alloc_chunk(end_r_2937); + CursorTy chunk_start_35 = new_chunk_34.chunk_start; + CursorTy chunk_end_36 = new_chunk_34.chunk_end; + + end_r_2937 = chunk_end_36; + *(TagTyPacked *) loc_2935 = 255; + + CursorTy redir = loc_2935 + 1; + + *(CursorTy *) redir = chunk_start_35; + loc_2935 = chunk_start_35; + } + + CursorTy loc_3094 = loc_2935 + 1; + CursorTy loc_3095 = loc_3094 + 8; + TagTyPacked tmpval_6375 = *(TagTyPacked *) arg_624_1230_1555; + CursorTy tmpcur_6376 = arg_624_1230_1555 + 1; + + + switch_6419: + ; + switch (tmpval_6375) { + + case 0: + { + CursorTy jump_3973 = arg_624_1230_1555 + 1; + + *(TagTyPacked *) loc_2935 = 0; + + CursorTy writetag_4587 = loc_2935 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2937, jump_3973, + loc_2935, writetag_4587}; + break; + } + + case 1: + { + IntTy tmpval_6381 = *(IntTy *) tmpcur_6376; + CursorTy tmpcur_6382 = tmpcur_6376 + sizeof(IntTy); + CursorTy jump_3975 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_31 = + _copy_String(end_r_2936, end_r_2937, loc_3095, tmpcur_6382); + CursorTy pvrtmp_6383 = tmp_struct_31.field0; + CursorTy pvrtmp_6384 = tmp_struct_31.field1; + CursorTy pvrtmp_6385 = tmp_struct_31.field2; + CursorTy pvrtmp_6386 = tmp_struct_31.field3; + + *(TagTyPacked *) loc_2935 = 1; + + CursorTy writetag_4592 = loc_2935 + 1; + + *(IntTy *) writetag_4592 = tmpval_6381; + + CursorTy writecur_4593 = writetag_4592 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6383, pvrtmp_6384, + loc_2935, pvrtmp_6386}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6395 = *(CursorTy *) tmpcur_6376; + CursorTy tmpaftercur_6396 = tmpcur_6376 + 8; + CursorTy jump_4278 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_32 = + _copy_String(end_r_2936, end_r_2937, loc_2935, tmpcur_6395); + CursorTy pvrtmp_6397 = tmp_struct_32.field0; + CursorTy pvrtmp_6398 = tmp_struct_32.field1; + CursorTy pvrtmp_6399 = tmp_struct_32.field2; + CursorTy pvrtmp_6400 = tmp_struct_32.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6397, jump_4278, + pvrtmp_6399, pvrtmp_6400}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6407 = *(CursorTy *) tmpcur_6376; + CursorTy tmpaftercur_6408 = tmpcur_6376 + 8; + CursorCursorCursorCursorProd tmp_struct_33 = + _copy_String(end_r_2936, end_r_2937, loc_2935, tmpcur_6407); + CursorTy pvrtmp_6409 = tmp_struct_33.field0; + CursorTy pvrtmp_6410 = tmp_struct_33.field1; + CursorTy pvrtmp_6411 = tmp_struct_33.field2; + CursorTy pvrtmp_6412 = tmp_struct_33.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6409, pvrtmp_6410, + pvrtmp_6411, pvrtmp_6412}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6375"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_String(CursorTy end_r_2940, + CursorTy end_r_2941, + CursorTy loc_2939, + CursorTy arg_629_1235_1560) +{ + CursorTy loc_3107 = loc_2939 + 1; + CursorTy loc_3108 = loc_3107 + 8; + TagTyPacked tmpval_6420 = *(TagTyPacked *) arg_629_1235_1560; + CursorTy tmpcur_6421 = arg_629_1235_1560 + 1; + + + switch_6464: + ; + switch (tmpval_6420) { + + case 0: + { + CursorTy jump_3978 = arg_629_1235_1560 + 1; + + *(TagTyPacked *) loc_2939 = 0; + + CursorTy writetag_4603 = loc_2939 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2941, jump_3978, + loc_2939, writetag_4603}; + break; + } + + case 1: + { + IntTy tmpval_6426 = *(IntTy *) tmpcur_6421; + CursorTy tmpcur_6427 = tmpcur_6421 + sizeof(IntTy); + CursorTy jump_3980 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_37 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_3108, tmpcur_6427); + CursorTy pvrtmp_6428 = tmp_struct_37.field0; + CursorTy pvrtmp_6429 = tmp_struct_37.field1; + CursorTy pvrtmp_6430 = tmp_struct_37.field2; + CursorTy pvrtmp_6431 = tmp_struct_37.field3; + + *(TagTyPacked *) loc_2939 = 1; + + CursorTy writetag_4608 = loc_2939 + 1; + + *(IntTy *) writetag_4608 = tmpval_6426; + + CursorTy writecur_4609 = writetag_4608 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_6428, pvrtmp_6429, + loc_2939, pvrtmp_6431}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6440 = *(CursorTy *) tmpcur_6421; + CursorTy tmpaftercur_6441 = tmpcur_6421 + 8; + CursorTy jump_4284 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_38 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_2939, tmpcur_6440); + CursorTy pvrtmp_6442 = tmp_struct_38.field0; + CursorTy pvrtmp_6443 = tmp_struct_38.field1; + CursorTy pvrtmp_6444 = tmp_struct_38.field2; + CursorTy pvrtmp_6445 = tmp_struct_38.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6442, jump_4284, + pvrtmp_6444, pvrtmp_6445}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6452 = *(CursorTy *) tmpcur_6421; + CursorTy tmpaftercur_6453 = tmpcur_6421 + 8; + CursorCursorCursorCursorProd tmp_struct_39 = + _copy_without_ptrs_String(end_r_2940, end_r_2941, loc_2939, tmpcur_6452); + CursorTy pvrtmp_6454 = tmp_struct_39.field0; + CursorTy pvrtmp_6455 = tmp_struct_39.field1; + CursorTy pvrtmp_6456 = tmp_struct_39.field2; + CursorTy pvrtmp_6457 = tmp_struct_39.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6454, pvrtmp_6455, + pvrtmp_6456, pvrtmp_6457}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6420"); + exit(1); + } + } +} +CursorProd _traverse_String(CursorTy end_r_2943, CursorTy arg_634_1240_1565) +{ + TagTyPacked tmpval_6465 = *(TagTyPacked *) arg_634_1240_1565; + CursorTy tmpcur_6466 = arg_634_1240_1565 + 1; + + + switch_6476: + ; + switch (tmpval_6465) { + + case 0: + { + CursorTy jump_3983 = arg_634_1240_1565 + 1; + + return (CursorProd) {jump_3983}; + break; + } + + case 1: + { + IntTy tmpval_6467 = *(IntTy *) tmpcur_6466; + CursorTy tmpcur_6468 = tmpcur_6466 + sizeof(IntTy); + CursorTy jump_3985 = tmpcur_6466 + 8; + CursorProd tmp_struct_40 = + _traverse_String(end_r_2943, tmpcur_6468); + CursorTy pvrtmp_6469 = tmp_struct_40.field0; + + return (CursorProd) {pvrtmp_6469}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6470 = *(CursorTy *) tmpcur_6466; + CursorTy tmpaftercur_6471 = tmpcur_6466 + 8; + CursorTy jump_4290 = tmpcur_6466 + 8; + CursorProd tmp_struct_41 = + _traverse_String(end_r_2943, tmpcur_6470); + CursorTy pvrtmp_6472 = tmp_struct_41.field0; + + return (CursorProd) {jump_4290}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6473 = *(CursorTy *) tmpcur_6466; + CursorTy tmpaftercur_6474 = tmpcur_6466 + 8; + CursorProd tmp_struct_42 = + _traverse_String(end_r_2943, tmpcur_6473); + CursorTy pvrtmp_6475 = tmp_struct_42.field0; + + return (CursorProd) {pvrtmp_6475}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6465"); + exit(1); + } + } +} +CursorProd _print_String(CursorTy end_r_2945, CursorTy arg_639_1244_1569) +{ + TagTyPacked tmpval_6477 = *(TagTyPacked *) arg_639_1244_1569; + CursorTy tmpcur_6478 = arg_639_1244_1569 + 1; + + + switch_6488: + ; + switch (tmpval_6477) { + + case 0: + { + CursorTy jump_3988 = arg_639_1244_1569 + 1; + unsigned char wildcard_640_1245_1570 = print_symbol(6162); + unsigned char wildcard_641_1246_1571 = print_symbol(6154); + + return (CursorProd) {jump_3988}; + break; + } + + case 1: + { + IntTy tmpval_6479 = *(IntTy *) tmpcur_6478; + CursorTy tmpcur_6480 = tmpcur_6478 + sizeof(IntTy); + CursorTy jump_3990 = tmpcur_6478 + 8; + unsigned char wildcard_646_1249_1574 = print_symbol(6163); + unsigned char y_644_1250_1575 = printf("%lld", tmpval_6479); + CursorProd tmp_struct_43 = _print_String(end_r_2945, tmpcur_6480); + CursorTy pvrtmp_6481 = tmp_struct_43.field0; + unsigned char wildcard_647_1252_1577 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6481}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6482 = *(CursorTy *) tmpcur_6478; + CursorTy tmpaftercur_6483 = tmpcur_6478 + 8; + CursorTy jump_4296 = tmpcur_6478 + 8; + unsigned char wildcard_4299 = print_symbol(6171); + CursorProd tmp_struct_44 = _print_String(end_r_2945, tmpcur_6482); + CursorTy pvrtmp_6484 = tmp_struct_44.field0; + + return (CursorProd) {jump_4296}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6485 = *(CursorTy *) tmpcur_6478; + CursorTy tmpaftercur_6486 = tmpcur_6478 + 8; + unsigned char wildcard_4299 = print_symbol(6170); + CursorProd tmp_struct_45 = _print_String(end_r_2945, tmpcur_6485); + CursorTy pvrtmp_6487 = tmp_struct_45.field0; + + return (CursorProd) {pvrtmp_6487}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6477"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Content(CursorTy end_r_2948, + CursorTy end_r_2949, + CursorTy loc_2947, + CursorTy arg_648_1253_1578) +{ + if (loc_2947 + 32 > end_r_2949) { + ChunkTy new_chunk_50 = alloc_chunk(end_r_2949); + CursorTy chunk_start_51 = new_chunk_50.chunk_start; + CursorTy chunk_end_52 = new_chunk_50.chunk_end; + + end_r_2949 = chunk_end_52; + *(TagTyPacked *) loc_2947 = 255; + + CursorTy redir = loc_2947 + 1; + + *(CursorTy *) redir = chunk_start_51; + loc_2947 = chunk_start_51; + } + + TagTyPacked tmpval_6489 = *(TagTyPacked *) arg_648_1253_1578; + CursorTy tmpcur_6490 = arg_648_1253_1578 + 1; + + + switch_6539: + ; + switch (tmpval_6489) { + + case 0: + { + CursorTy loc_3130 = loc_2947 + 1; + CursorCursorCursorCursorProd tmp_struct_46 = + _copy_String(end_r_2948, end_r_2949, loc_3130, tmpcur_6490); + CursorTy pvrtmp_6491 = tmp_struct_46.field0; + CursorTy pvrtmp_6492 = tmp_struct_46.field1; + CursorTy pvrtmp_6493 = tmp_struct_46.field2; + CursorTy pvrtmp_6494 = tmp_struct_46.field3; + + *(TagTyPacked *) loc_2947 = 0; + + CursorTy writetag_4640 = loc_2947 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6491, pvrtmp_6492, + loc_2947, pvrtmp_6494}; + break; + } + + case 1: + { + CursorTy loc_3136 = loc_2947 + 1; + CursorCursorCursorCursorProd tmp_struct_47 = + _copy_String(end_r_2948, end_r_2949, loc_3136, tmpcur_6490); + CursorTy pvrtmp_6503 = tmp_struct_47.field0; + CursorTy pvrtmp_6504 = tmp_struct_47.field1; + CursorTy pvrtmp_6505 = tmp_struct_47.field2; + CursorTy pvrtmp_6506 = tmp_struct_47.field3; + + *(TagTyPacked *) loc_2947 = 1; + + CursorTy writetag_4645 = loc_2947 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6503, pvrtmp_6504, + loc_2947, pvrtmp_6506}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6515 = *(CursorTy *) tmpcur_6490; + CursorTy tmpaftercur_6516 = tmpcur_6490 + 8; + CursorTy jump_4302 = tmpcur_6490 + 8; + CursorCursorCursorCursorProd tmp_struct_48 = + _copy_Content(end_r_2948, end_r_2949, loc_2947, tmpcur_6515); + CursorTy pvrtmp_6517 = tmp_struct_48.field0; + CursorTy pvrtmp_6518 = tmp_struct_48.field1; + CursorTy pvrtmp_6519 = tmp_struct_48.field2; + CursorTy pvrtmp_6520 = tmp_struct_48.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6517, jump_4302, + pvrtmp_6519, pvrtmp_6520}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6527 = *(CursorTy *) tmpcur_6490; + CursorTy tmpaftercur_6528 = tmpcur_6490 + 8; + CursorCursorCursorCursorProd tmp_struct_49 = + _copy_Content(end_r_2948, end_r_2949, loc_2947, tmpcur_6527); + CursorTy pvrtmp_6529 = tmp_struct_49.field0; + CursorTy pvrtmp_6530 = tmp_struct_49.field1; + CursorTy pvrtmp_6531 = tmp_struct_49.field2; + CursorTy pvrtmp_6532 = tmp_struct_49.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6529, pvrtmp_6530, + pvrtmp_6531, pvrtmp_6532}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6489"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Content(CursorTy end_r_2952, + CursorTy end_r_2953, + CursorTy loc_2951, + CursorTy arg_653_1258_1583) +{ + TagTyPacked tmpval_6540 = *(TagTyPacked *) arg_653_1258_1583; + CursorTy tmpcur_6541 = arg_653_1258_1583 + 1; + + + switch_6590: + ; + switch (tmpval_6540) { + + case 0: + { + CursorTy loc_3144 = loc_2951 + 1; + CursorCursorCursorCursorProd tmp_struct_53 = + _copy_without_ptrs_String(end_r_2952, end_r_2953, loc_3144, tmpcur_6541); + CursorTy pvrtmp_6542 = tmp_struct_53.field0; + CursorTy pvrtmp_6543 = tmp_struct_53.field1; + CursorTy pvrtmp_6544 = tmp_struct_53.field2; + CursorTy pvrtmp_6545 = tmp_struct_53.field3; + + *(TagTyPacked *) loc_2951 = 0; + + CursorTy writetag_4656 = loc_2951 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6542, pvrtmp_6543, + loc_2951, pvrtmp_6545}; + break; + } + + case 1: + { + CursorTy loc_3150 = loc_2951 + 1; + CursorCursorCursorCursorProd tmp_struct_54 = + _copy_without_ptrs_String(end_r_2952, end_r_2953, loc_3150, tmpcur_6541); + CursorTy pvrtmp_6554 = tmp_struct_54.field0; + CursorTy pvrtmp_6555 = tmp_struct_54.field1; + CursorTy pvrtmp_6556 = tmp_struct_54.field2; + CursorTy pvrtmp_6557 = tmp_struct_54.field3; + + *(TagTyPacked *) loc_2951 = 1; + + CursorTy writetag_4661 = loc_2951 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6554, pvrtmp_6555, + loc_2951, pvrtmp_6557}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6566 = *(CursorTy *) tmpcur_6541; + CursorTy tmpaftercur_6567 = tmpcur_6541 + 8; + CursorTy jump_4308 = tmpcur_6541 + 8; + CursorCursorCursorCursorProd tmp_struct_55 = + _copy_without_ptrs_Content(end_r_2952, end_r_2953, loc_2951, tmpcur_6566); + CursorTy pvrtmp_6568 = tmp_struct_55.field0; + CursorTy pvrtmp_6569 = tmp_struct_55.field1; + CursorTy pvrtmp_6570 = tmp_struct_55.field2; + CursorTy pvrtmp_6571 = tmp_struct_55.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6568, jump_4308, + pvrtmp_6570, pvrtmp_6571}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6578 = *(CursorTy *) tmpcur_6541; + CursorTy tmpaftercur_6579 = tmpcur_6541 + 8; + CursorCursorCursorCursorProd tmp_struct_56 = + _copy_without_ptrs_Content(end_r_2952, end_r_2953, loc_2951, tmpcur_6578); + CursorTy pvrtmp_6580 = tmp_struct_56.field0; + CursorTy pvrtmp_6581 = tmp_struct_56.field1; + CursorTy pvrtmp_6582 = tmp_struct_56.field2; + CursorTy pvrtmp_6583 = tmp_struct_56.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6580, pvrtmp_6581, + pvrtmp_6582, pvrtmp_6583}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6540"); + exit(1); + } + } +} +CursorProd _traverse_Content(CursorTy end_r_2955, CursorTy arg_658_1263_1588) +{ + TagTyPacked tmpval_6591 = *(TagTyPacked *) arg_658_1263_1588; + CursorTy tmpcur_6592 = arg_658_1263_1588 + 1; + + + switch_6601: + ; + switch (tmpval_6591) { + + case 0: + { + CursorProd tmp_struct_57 = + _traverse_String(end_r_2955, tmpcur_6592); + CursorTy pvrtmp_6593 = tmp_struct_57.field0; + + return (CursorProd) {pvrtmp_6593}; + break; + } + + case 1: + { + CursorProd tmp_struct_58 = + _traverse_String(end_r_2955, tmpcur_6592); + CursorTy pvrtmp_6594 = tmp_struct_58.field0; + + return (CursorProd) {pvrtmp_6594}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6595 = *(CursorTy *) tmpcur_6592; + CursorTy tmpaftercur_6596 = tmpcur_6592 + 8; + CursorTy jump_4314 = tmpcur_6592 + 8; + CursorProd tmp_struct_59 = + _traverse_Content(end_r_2955, tmpcur_6595); + CursorTy pvrtmp_6597 = tmp_struct_59.field0; + + return (CursorProd) {jump_4314}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6598 = *(CursorTy *) tmpcur_6592; + CursorTy tmpaftercur_6599 = tmpcur_6592 + 8; + CursorProd tmp_struct_60 = + _traverse_Content(end_r_2955, tmpcur_6598); + CursorTy pvrtmp_6600 = tmp_struct_60.field0; + + return (CursorProd) {pvrtmp_6600}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6591"); + exit(1); + } + } +} +CursorProd _print_Content(CursorTy end_r_2957, CursorTy arg_663_1268_1593) +{ + TagTyPacked tmpval_6602 = *(TagTyPacked *) arg_663_1268_1593; + CursorTy tmpcur_6603 = arg_663_1268_1593 + 1; + + + switch_6612: + ; + switch (tmpval_6602) { + + case 0: + { + unsigned char wildcard_666_1270_1595 = print_symbol(6161); + CursorProd tmp_struct_61 = _print_String(end_r_2957, tmpcur_6603); + CursorTy pvrtmp_6604 = tmp_struct_61.field0; + unsigned char wildcard_667_1272_1597 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6604}; + break; + } + + case 1: + { + unsigned char wildcard_670_1274_1599 = print_symbol(6155); + CursorProd tmp_struct_62 = _print_String(end_r_2957, tmpcur_6603); + CursorTy pvrtmp_6605 = tmp_struct_62.field0; + unsigned char wildcard_671_1276_1601 = print_symbol(6154); + + return (CursorProd) {pvrtmp_6605}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6606 = *(CursorTy *) tmpcur_6603; + CursorTy tmpaftercur_6607 = tmpcur_6603 + 8; + CursorTy jump_4320 = tmpcur_6603 + 8; + unsigned char wildcard_4323 = print_symbol(6171); + CursorProd tmp_struct_63 = _print_Content(end_r_2957, tmpcur_6606); + CursorTy pvrtmp_6608 = tmp_struct_63.field0; + + return (CursorProd) {jump_4320}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6609 = *(CursorTy *) tmpcur_6603; + CursorTy tmpaftercur_6610 = tmpcur_6603 + 8; + unsigned char wildcard_4323 = print_symbol(6170); + CursorProd tmp_struct_64 = _print_Content(end_r_2957, tmpcur_6609); + CursorTy pvrtmp_6611 = tmp_struct_64.field0; + + return (CursorProd) {pvrtmp_6611}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6602"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Adt(CursorTy end_r_2960, CursorTy end_r_2961, + CursorTy loc_2959, + CursorTy arg_672_1277_1602) +{ + if (loc_2959 + 32 > end_r_2961) { + ChunkTy new_chunk_89 = alloc_chunk(end_r_2961); + CursorTy chunk_start_90 = new_chunk_89.chunk_start; + CursorTy chunk_end_91 = new_chunk_89.chunk_end; + + end_r_2961 = chunk_end_91; + *(TagTyPacked *) loc_2959 = 255; + + CursorTy redir = loc_2959 + 1; + + *(CursorTy *) redir = chunk_start_90; + loc_2959 = chunk_start_90; + } + + CursorTy loc_3180 = loc_2959 + 1; + CursorTy loc_3181 = loc_3180 + 8; + CursorTy loc_3196 = loc_2959 + 1; + CursorTy loc_3197 = loc_3196 + 8; + CursorTy loc_3217 = loc_2959 + 1; + CursorTy loc_3218 = loc_3217 + 8; + CursorTy loc_3219 = loc_3218 + 8; + CursorTy loc_3243 = loc_2959 + 1; + CursorTy loc_3244 = loc_3243 + 8; + CursorTy loc_3245 = loc_3244 + 8; + CursorTy loc_3269 = loc_2959 + 1; + CursorTy loc_3270 = loc_3269 + 8; + CursorTy loc_3271 = loc_3270 + 8; + CursorTy loc_3295 = loc_2959 + 1; + CursorTy loc_3296 = loc_3295 + 8; + CursorTy loc_3297 = loc_3296 + 8; + CursorTy loc_3321 = loc_2959 + 1; + CursorTy loc_3322 = loc_3321 + 8; + CursorTy loc_3323 = loc_3322 + 8; + CursorTy loc_3347 = loc_2959 + 1; + CursorTy loc_3348 = loc_3347 + 8; + CursorTy loc_3349 = loc_3348 + 8; + TagTyPacked tmpval_6613 = *(TagTyPacked *) arg_672_1277_1602; + CursorTy tmpcur_6614 = arg_672_1277_1602 + 1; + + + switch_6879: + ; + switch (tmpval_6613) { + + case 0: + { + CursorTy jump_4009 = arg_672_1277_1602 + 1; + + *(TagTyPacked *) loc_2959 = 0; + + CursorTy writetag_4691 = loc_2959 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2961, jump_4009, + loc_2959, writetag_4691}; + break; + } + + case 9: + { + CursorTy tmpcur_6619 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6620 = tmpcur_6614 + 8; + CursorTy jump_4011 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_65 = + _copy_Content(end_r_2960, end_r_2961, loc_3181, tmpaftercur_6620); + CursorTy pvrtmp_6621 = tmp_struct_65.field0; + CursorTy pvrtmp_6622 = tmp_struct_65.field1; + CursorTy pvrtmp_6623 = tmp_struct_65.field2; + CursorTy pvrtmp_6624 = tmp_struct_65.field3; + CursorCursorCursorCursorProd tmp_struct_66 = + _copy_Adt(end_r_2960, pvrtmp_6621, pvrtmp_6624, tmpcur_6619); + CursorTy pvrtmp_6629 = tmp_struct_66.field0; + CursorTy pvrtmp_6630 = tmp_struct_66.field1; + CursorTy pvrtmp_6631 = tmp_struct_66.field2; + CursorTy pvrtmp_6632 = tmp_struct_66.field3; + + *(TagTyPacked *) loc_2959 = 9; + + CursorTy writetag_4697 = loc_2959 + 1; + + *(CursorTy *) writetag_4697 = pvrtmp_6624; + + CursorTy writecur_4698 = writetag_4697 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6629, pvrtmp_6630, + loc_2959, pvrtmp_6632}; + break; + } + + case 11: + { + CursorTy tmpcur_6641 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6642 = tmpcur_6614 + 8; + CursorTy jump_4015 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_67 = + _copy_Adt(end_r_2960, end_r_2961, loc_3197, tmpaftercur_6642); + CursorTy pvrtmp_6643 = tmp_struct_67.field0; + CursorTy pvrtmp_6644 = tmp_struct_67.field1; + CursorTy pvrtmp_6645 = tmp_struct_67.field2; + CursorTy pvrtmp_6646 = tmp_struct_67.field3; + CursorCursorCursorCursorProd tmp_struct_68 = + _copy_Content(end_r_2960, pvrtmp_6643, pvrtmp_6646, tmpcur_6641); + CursorTy pvrtmp_6651 = tmp_struct_68.field0; + CursorTy pvrtmp_6652 = tmp_struct_68.field1; + CursorTy pvrtmp_6653 = tmp_struct_68.field2; + CursorTy pvrtmp_6654 = tmp_struct_68.field3; + + *(TagTyPacked *) loc_2959 = 11; + + CursorTy writetag_4706 = loc_2959 + 1; + + *(CursorTy *) writetag_4706 = pvrtmp_6646; + + CursorTy writecur_4707 = writetag_4706 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6651, pvrtmp_6652, + loc_2959, pvrtmp_6654}; + break; + } + + case 13: + { + CursorTy tmpcur_6663 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6664 = tmpcur_6614 + 8; + CursorTy tmpcur_6665 = *(CursorTy *) tmpaftercur_6664; + CursorTy tmpaftercur_6666 = tmpaftercur_6664 + 8; + CursorTy jump_4020 = tmpaftercur_6664 + 8; + CursorTy jump_4019 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_69 = + _copy_Tags(end_r_2960, end_r_2961, loc_3219, tmpaftercur_6666); + CursorTy pvrtmp_6667 = tmp_struct_69.field0; + CursorTy pvrtmp_6668 = tmp_struct_69.field1; + CursorTy pvrtmp_6669 = tmp_struct_69.field2; + CursorTy pvrtmp_6670 = tmp_struct_69.field3; + CursorCursorCursorCursorProd tmp_struct_70 = + _copy_Content(end_r_2960, pvrtmp_6667, pvrtmp_6670, tmpcur_6663); + CursorTy pvrtmp_6675 = tmp_struct_70.field0; + CursorTy pvrtmp_6676 = tmp_struct_70.field1; + CursorTy pvrtmp_6677 = tmp_struct_70.field2; + CursorTy pvrtmp_6678 = tmp_struct_70.field3; + CursorCursorCursorCursorProd tmp_struct_71 = + _copy_Adt(end_r_2960, pvrtmp_6675, pvrtmp_6678, tmpcur_6665); + CursorTy pvrtmp_6683 = tmp_struct_71.field0; + CursorTy pvrtmp_6684 = tmp_struct_71.field1; + CursorTy pvrtmp_6685 = tmp_struct_71.field2; + CursorTy pvrtmp_6686 = tmp_struct_71.field3; + + *(TagTyPacked *) loc_2959 = 13; + + CursorTy writetag_4717 = loc_2959 + 1; + + *(CursorTy *) writetag_4717 = pvrtmp_6670; + + CursorTy writecur_4718 = writetag_4717 + 8; + + *(CursorTy *) writecur_4718 = pvrtmp_6678; + + CursorTy writecur_4719 = writecur_4718 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6683, pvrtmp_6684, + loc_2959, pvrtmp_6686}; + break; + } + + case 15: + { + CursorTy tmpcur_6695 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6696 = tmpcur_6614 + 8; + CursorTy tmpcur_6697 = *(CursorTy *) tmpaftercur_6696; + CursorTy tmpaftercur_6698 = tmpaftercur_6696 + 8; + CursorTy jump_4026 = tmpaftercur_6696 + 8; + CursorTy jump_4025 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_72 = + _copy_Adt(end_r_2960, end_r_2961, loc_3245, tmpaftercur_6698); + CursorTy pvrtmp_6699 = tmp_struct_72.field0; + CursorTy pvrtmp_6700 = tmp_struct_72.field1; + CursorTy pvrtmp_6701 = tmp_struct_72.field2; + CursorTy pvrtmp_6702 = tmp_struct_72.field3; + CursorCursorCursorCursorProd tmp_struct_73 = + _copy_Content(end_r_2960, pvrtmp_6699, pvrtmp_6702, tmpcur_6695); + CursorTy pvrtmp_6707 = tmp_struct_73.field0; + CursorTy pvrtmp_6708 = tmp_struct_73.field1; + CursorTy pvrtmp_6709 = tmp_struct_73.field2; + CursorTy pvrtmp_6710 = tmp_struct_73.field3; + CursorCursorCursorCursorProd tmp_struct_74 = + _copy_Tags(end_r_2960, pvrtmp_6707, pvrtmp_6710, tmpcur_6697); + CursorTy pvrtmp_6715 = tmp_struct_74.field0; + CursorTy pvrtmp_6716 = tmp_struct_74.field1; + CursorTy pvrtmp_6717 = tmp_struct_74.field2; + CursorTy pvrtmp_6718 = tmp_struct_74.field3; + + *(TagTyPacked *) loc_2959 = 15; + + CursorTy writetag_4730 = loc_2959 + 1; + + *(CursorTy *) writetag_4730 = pvrtmp_6702; + + CursorTy writecur_4731 = writetag_4730 + 8; + + *(CursorTy *) writecur_4731 = pvrtmp_6710; + + CursorTy writecur_4732 = writecur_4731 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6715, pvrtmp_6716, + loc_2959, pvrtmp_6718}; + break; + } + + case 17: + { + CursorTy tmpcur_6727 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6728 = tmpcur_6614 + 8; + CursorTy tmpcur_6729 = *(CursorTy *) tmpaftercur_6728; + CursorTy tmpaftercur_6730 = tmpaftercur_6728 + 8; + CursorTy jump_4032 = tmpaftercur_6728 + 8; + CursorTy jump_4031 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_75 = + _copy_Tags(end_r_2960, end_r_2961, loc_3271, tmpaftercur_6730); + CursorTy pvrtmp_6731 = tmp_struct_75.field0; + CursorTy pvrtmp_6732 = tmp_struct_75.field1; + CursorTy pvrtmp_6733 = tmp_struct_75.field2; + CursorTy pvrtmp_6734 = tmp_struct_75.field3; + CursorCursorCursorCursorProd tmp_struct_76 = + _copy_Adt(end_r_2960, pvrtmp_6731, pvrtmp_6734, tmpcur_6727); + CursorTy pvrtmp_6739 = tmp_struct_76.field0; + CursorTy pvrtmp_6740 = tmp_struct_76.field1; + CursorTy pvrtmp_6741 = tmp_struct_76.field2; + CursorTy pvrtmp_6742 = tmp_struct_76.field3; + CursorCursorCursorCursorProd tmp_struct_77 = + _copy_Content(end_r_2960, pvrtmp_6739, pvrtmp_6742, tmpcur_6729); + CursorTy pvrtmp_6747 = tmp_struct_77.field0; + CursorTy pvrtmp_6748 = tmp_struct_77.field1; + CursorTy pvrtmp_6749 = tmp_struct_77.field2; + CursorTy pvrtmp_6750 = tmp_struct_77.field3; + + *(TagTyPacked *) loc_2959 = 17; + + CursorTy writetag_4743 = loc_2959 + 1; + + *(CursorTy *) writetag_4743 = pvrtmp_6734; + + CursorTy writecur_4744 = writetag_4743 + 8; + + *(CursorTy *) writecur_4744 = pvrtmp_6742; + + CursorTy writecur_4745 = writecur_4744 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6747, pvrtmp_6748, + loc_2959, pvrtmp_6750}; + break; + } + + case 19: + { + CursorTy tmpcur_6759 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6760 = tmpcur_6614 + 8; + CursorTy tmpcur_6761 = *(CursorTy *) tmpaftercur_6760; + CursorTy tmpaftercur_6762 = tmpaftercur_6760 + 8; + CursorTy jump_4038 = tmpaftercur_6760 + 8; + CursorTy jump_4037 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_78 = + _copy_Adt(end_r_2960, end_r_2961, loc_3297, tmpaftercur_6762); + CursorTy pvrtmp_6763 = tmp_struct_78.field0; + CursorTy pvrtmp_6764 = tmp_struct_78.field1; + CursorTy pvrtmp_6765 = tmp_struct_78.field2; + CursorTy pvrtmp_6766 = tmp_struct_78.field3; + CursorCursorCursorCursorProd tmp_struct_79 = + _copy_Tags(end_r_2960, pvrtmp_6763, pvrtmp_6766, tmpcur_6759); + CursorTy pvrtmp_6771 = tmp_struct_79.field0; + CursorTy pvrtmp_6772 = tmp_struct_79.field1; + CursorTy pvrtmp_6773 = tmp_struct_79.field2; + CursorTy pvrtmp_6774 = tmp_struct_79.field3; + CursorCursorCursorCursorProd tmp_struct_80 = + _copy_Content(end_r_2960, pvrtmp_6771, pvrtmp_6774, tmpcur_6761); + CursorTy pvrtmp_6779 = tmp_struct_80.field0; + CursorTy pvrtmp_6780 = tmp_struct_80.field1; + CursorTy pvrtmp_6781 = tmp_struct_80.field2; + CursorTy pvrtmp_6782 = tmp_struct_80.field3; + + *(TagTyPacked *) loc_2959 = 19; + + CursorTy writetag_4756 = loc_2959 + 1; + + *(CursorTy *) writetag_4756 = pvrtmp_6766; + + CursorTy writecur_4757 = writetag_4756 + 8; + + *(CursorTy *) writecur_4757 = pvrtmp_6774; + + CursorTy writecur_4758 = writecur_4757 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6779, pvrtmp_6780, + loc_2959, pvrtmp_6782}; + break; + } + + case 21: + { + CursorTy tmpcur_6791 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6792 = tmpcur_6614 + 8; + CursorTy tmpcur_6793 = *(CursorTy *) tmpaftercur_6792; + CursorTy tmpaftercur_6794 = tmpaftercur_6792 + 8; + CursorTy jump_4044 = tmpaftercur_6792 + 8; + CursorTy jump_4043 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_81 = + _copy_Content(end_r_2960, end_r_2961, loc_3323, tmpaftercur_6794); + CursorTy pvrtmp_6795 = tmp_struct_81.field0; + CursorTy pvrtmp_6796 = tmp_struct_81.field1; + CursorTy pvrtmp_6797 = tmp_struct_81.field2; + CursorTy pvrtmp_6798 = tmp_struct_81.field3; + CursorCursorCursorCursorProd tmp_struct_82 = + _copy_Tags(end_r_2960, pvrtmp_6795, pvrtmp_6798, tmpcur_6791); + CursorTy pvrtmp_6803 = tmp_struct_82.field0; + CursorTy pvrtmp_6804 = tmp_struct_82.field1; + CursorTy pvrtmp_6805 = tmp_struct_82.field2; + CursorTy pvrtmp_6806 = tmp_struct_82.field3; + CursorCursorCursorCursorProd tmp_struct_83 = + _copy_Adt(end_r_2960, pvrtmp_6803, pvrtmp_6806, tmpcur_6793); + CursorTy pvrtmp_6811 = tmp_struct_83.field0; + CursorTy pvrtmp_6812 = tmp_struct_83.field1; + CursorTy pvrtmp_6813 = tmp_struct_83.field2; + CursorTy pvrtmp_6814 = tmp_struct_83.field3; + + *(TagTyPacked *) loc_2959 = 21; + + CursorTy writetag_4769 = loc_2959 + 1; + + *(CursorTy *) writetag_4769 = pvrtmp_6798; + + CursorTy writecur_4770 = writetag_4769 + 8; + + *(CursorTy *) writecur_4770 = pvrtmp_6806; + + CursorTy writecur_4771 = writecur_4770 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6811, pvrtmp_6812, + loc_2959, pvrtmp_6814}; + break; + } + + case 23: + { + CursorTy tmpcur_6823 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6824 = tmpcur_6614 + 8; + CursorTy tmpcur_6825 = *(CursorTy *) tmpaftercur_6824; + CursorTy tmpaftercur_6826 = tmpaftercur_6824 + 8; + CursorTy jump_4050 = tmpaftercur_6824 + 8; + CursorTy jump_4049 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_84 = + _copy_Content(end_r_2960, end_r_2961, loc_3349, tmpaftercur_6826); + CursorTy pvrtmp_6827 = tmp_struct_84.field0; + CursorTy pvrtmp_6828 = tmp_struct_84.field1; + CursorTy pvrtmp_6829 = tmp_struct_84.field2; + CursorTy pvrtmp_6830 = tmp_struct_84.field3; + CursorCursorCursorCursorProd tmp_struct_85 = + _copy_Adt(end_r_2960, pvrtmp_6827, pvrtmp_6830, tmpcur_6823); + CursorTy pvrtmp_6835 = tmp_struct_85.field0; + CursorTy pvrtmp_6836 = tmp_struct_85.field1; + CursorTy pvrtmp_6837 = tmp_struct_85.field2; + CursorTy pvrtmp_6838 = tmp_struct_85.field3; + CursorCursorCursorCursorProd tmp_struct_86 = + _copy_Tags(end_r_2960, pvrtmp_6835, pvrtmp_6838, tmpcur_6825); + CursorTy pvrtmp_6843 = tmp_struct_86.field0; + CursorTy pvrtmp_6844 = tmp_struct_86.field1; + CursorTy pvrtmp_6845 = tmp_struct_86.field2; + CursorTy pvrtmp_6846 = tmp_struct_86.field3; + + *(TagTyPacked *) loc_2959 = 23; + + CursorTy writetag_4782 = loc_2959 + 1; + + *(CursorTy *) writetag_4782 = pvrtmp_6830; + + CursorTy writecur_4783 = writetag_4782 + 8; + + *(CursorTy *) writecur_4783 = pvrtmp_6838; + + CursorTy writecur_4784 = writecur_4783 + 8; + + return (CursorCursorCursorCursorProd) {pvrtmp_6843, pvrtmp_6844, + loc_2959, pvrtmp_6846}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_6855 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6856 = tmpcur_6614 + 8; + CursorTy jump_4326 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_87 = + _copy_Adt(end_r_2960, end_r_2961, loc_2959, tmpcur_6855); + CursorTy pvrtmp_6857 = tmp_struct_87.field0; + CursorTy pvrtmp_6858 = tmp_struct_87.field1; + CursorTy pvrtmp_6859 = tmp_struct_87.field2; + CursorTy pvrtmp_6860 = tmp_struct_87.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6857, jump_4326, + pvrtmp_6859, pvrtmp_6860}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_6867 = *(CursorTy *) tmpcur_6614; + CursorTy tmpaftercur_6868 = tmpcur_6614 + 8; + CursorCursorCursorCursorProd tmp_struct_88 = + _copy_Adt(end_r_2960, end_r_2961, loc_2959, tmpcur_6867); + CursorTy pvrtmp_6869 = tmp_struct_88.field0; + CursorTy pvrtmp_6870 = tmp_struct_88.field1; + CursorTy pvrtmp_6871 = tmp_struct_88.field2; + CursorTy pvrtmp_6872 = tmp_struct_88.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_6869, pvrtmp_6870, + pvrtmp_6871, pvrtmp_6872}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6613"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Adt(CursorTy end_r_2964, + CursorTy end_r_2965, + CursorTy loc_2963, + CursorTy arg_717_1322_1647) +{ + TagTyPacked tmpval_6880 = *(TagTyPacked *) arg_717_1322_1647; + CursorTy tmpcur_6881 = arg_717_1322_1647 + 1; + + + switch_7146: + ; + switch (tmpval_6880) { + + case 0: + { + CursorTy jump_4055 = arg_717_1322_1647 + 1; + + *(TagTyPacked *) loc_2963 = 0; + + CursorTy writetag_4796 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2965, jump_4055, + loc_2963, writetag_4796}; + break; + } + + case 9: + { + CursorTy tmpcur_6886 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6887 = tmpcur_6881 + 8; + CursorTy jump_4057 = tmpcur_6881 + 8; + CursorTy loc_3371 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_92 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3371, tmpaftercur_6887); + CursorTy pvrtmp_6888 = tmp_struct_92.field0; + CursorTy pvrtmp_6889 = tmp_struct_92.field1; + CursorTy pvrtmp_6890 = tmp_struct_92.field2; + CursorTy pvrtmp_6891 = tmp_struct_92.field3; + CursorCursorCursorCursorProd tmp_struct_93 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6888, pvrtmp_6891, tmpcur_6886); + CursorTy pvrtmp_6896 = tmp_struct_93.field0; + CursorTy pvrtmp_6897 = tmp_struct_93.field1; + CursorTy pvrtmp_6898 = tmp_struct_93.field2; + CursorTy pvrtmp_6899 = tmp_struct_93.field3; + + *(TagTyPacked *) loc_2963 = 1; + + CursorTy writetag_4802 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6896, pvrtmp_6897, + loc_2963, pvrtmp_6899}; + break; + } + + case 11: + { + CursorTy tmpcur_6908 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6909 = tmpcur_6881 + 8; + CursorTy jump_4061 = tmpcur_6881 + 8; + CursorTy loc_3384 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_94 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3384, tmpaftercur_6909); + CursorTy pvrtmp_6910 = tmp_struct_94.field0; + CursorTy pvrtmp_6911 = tmp_struct_94.field1; + CursorTy pvrtmp_6912 = tmp_struct_94.field2; + CursorTy pvrtmp_6913 = tmp_struct_94.field3; + CursorCursorCursorCursorProd tmp_struct_95 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6910, pvrtmp_6913, tmpcur_6908); + CursorTy pvrtmp_6918 = tmp_struct_95.field0; + CursorTy pvrtmp_6919 = tmp_struct_95.field1; + CursorTy pvrtmp_6920 = tmp_struct_95.field2; + CursorTy pvrtmp_6921 = tmp_struct_95.field3; + + *(TagTyPacked *) loc_2963 = 2; + + CursorTy writetag_4810 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6918, pvrtmp_6919, + loc_2963, pvrtmp_6921}; + break; + } + + case 13: + { + CursorTy tmpcur_6930 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6931 = tmpcur_6881 + 8; + CursorTy tmpcur_6932 = *(CursorTy *) tmpaftercur_6931; + CursorTy tmpaftercur_6933 = tmpaftercur_6931 + 8; + CursorTy jump_4066 = tmpaftercur_6931 + 8; + CursorTy jump_4065 = tmpcur_6881 + 8; + CursorTy loc_3402 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_96 = + _copy_without_ptrs_Tags(end_r_2964, end_r_2965, loc_3402, tmpaftercur_6933); + CursorTy pvrtmp_6934 = tmp_struct_96.field0; + CursorTy pvrtmp_6935 = tmp_struct_96.field1; + CursorTy pvrtmp_6936 = tmp_struct_96.field2; + CursorTy pvrtmp_6937 = tmp_struct_96.field3; + CursorCursorCursorCursorProd tmp_struct_97 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6934, pvrtmp_6937, tmpcur_6930); + CursorTy pvrtmp_6942 = tmp_struct_97.field0; + CursorTy pvrtmp_6943 = tmp_struct_97.field1; + CursorTy pvrtmp_6944 = tmp_struct_97.field2; + CursorTy pvrtmp_6945 = tmp_struct_97.field3; + CursorCursorCursorCursorProd tmp_struct_98 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6942, pvrtmp_6945, tmpcur_6932); + CursorTy pvrtmp_6950 = tmp_struct_98.field0; + CursorTy pvrtmp_6951 = tmp_struct_98.field1; + CursorTy pvrtmp_6952 = tmp_struct_98.field2; + CursorTy pvrtmp_6953 = tmp_struct_98.field3; + + *(TagTyPacked *) loc_2963 = 3; + + CursorTy writetag_4820 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6950, pvrtmp_6951, + loc_2963, pvrtmp_6953}; + break; + } + + case 15: + { + CursorTy tmpcur_6962 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6963 = tmpcur_6881 + 8; + CursorTy tmpcur_6964 = *(CursorTy *) tmpaftercur_6963; + CursorTy tmpaftercur_6965 = tmpaftercur_6963 + 8; + CursorTy jump_4072 = tmpaftercur_6963 + 8; + CursorTy jump_4071 = tmpcur_6881 + 8; + CursorTy loc_3422 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_99 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3422, tmpaftercur_6965); + CursorTy pvrtmp_6966 = tmp_struct_99.field0; + CursorTy pvrtmp_6967 = tmp_struct_99.field1; + CursorTy pvrtmp_6968 = tmp_struct_99.field2; + CursorTy pvrtmp_6969 = tmp_struct_99.field3; + CursorCursorCursorCursorProd tmp_struct_100 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_6966, pvrtmp_6969, tmpcur_6962); + CursorTy pvrtmp_6974 = tmp_struct_100.field0; + CursorTy pvrtmp_6975 = tmp_struct_100.field1; + CursorTy pvrtmp_6976 = tmp_struct_100.field2; + CursorTy pvrtmp_6977 = tmp_struct_100.field3; + CursorCursorCursorCursorProd tmp_struct_101 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_6974, pvrtmp_6977, tmpcur_6964); + CursorTy pvrtmp_6982 = tmp_struct_101.field0; + CursorTy pvrtmp_6983 = tmp_struct_101.field1; + CursorTy pvrtmp_6984 = tmp_struct_101.field2; + CursorTy pvrtmp_6985 = tmp_struct_101.field3; + + *(TagTyPacked *) loc_2963 = 4; + + CursorTy writetag_4831 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_6982, pvrtmp_6983, + loc_2963, pvrtmp_6985}; + break; + } + + case 17: + { + CursorTy tmpcur_6994 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_6995 = tmpcur_6881 + 8; + CursorTy tmpcur_6996 = *(CursorTy *) tmpaftercur_6995; + CursorTy tmpaftercur_6997 = tmpaftercur_6995 + 8; + CursorTy jump_4078 = tmpaftercur_6995 + 8; + CursorTy jump_4077 = tmpcur_6881 + 8; + CursorTy loc_3442 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_102 = + _copy_without_ptrs_Tags(end_r_2964, end_r_2965, loc_3442, tmpaftercur_6997); + CursorTy pvrtmp_6998 = tmp_struct_102.field0; + CursorTy pvrtmp_6999 = tmp_struct_102.field1; + CursorTy pvrtmp_7000 = tmp_struct_102.field2; + CursorTy pvrtmp_7001 = tmp_struct_102.field3; + CursorCursorCursorCursorProd tmp_struct_103 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_6998, pvrtmp_7001, tmpcur_6994); + CursorTy pvrtmp_7006 = tmp_struct_103.field0; + CursorTy pvrtmp_7007 = tmp_struct_103.field1; + CursorTy pvrtmp_7008 = tmp_struct_103.field2; + CursorTy pvrtmp_7009 = tmp_struct_103.field3; + CursorCursorCursorCursorProd tmp_struct_104 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_7006, pvrtmp_7009, tmpcur_6996); + CursorTy pvrtmp_7014 = tmp_struct_104.field0; + CursorTy pvrtmp_7015 = tmp_struct_104.field1; + CursorTy pvrtmp_7016 = tmp_struct_104.field2; + CursorTy pvrtmp_7017 = tmp_struct_104.field3; + + *(TagTyPacked *) loc_2963 = 5; + + CursorTy writetag_4842 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7014, pvrtmp_7015, + loc_2963, pvrtmp_7017}; + break; + } + + case 19: + { + CursorTy tmpcur_7026 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7027 = tmpcur_6881 + 8; + CursorTy tmpcur_7028 = *(CursorTy *) tmpaftercur_7027; + CursorTy tmpaftercur_7029 = tmpaftercur_7027 + 8; + CursorTy jump_4084 = tmpaftercur_7027 + 8; + CursorTy jump_4083 = tmpcur_6881 + 8; + CursorTy loc_3462 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_105 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_3462, tmpaftercur_7029); + CursorTy pvrtmp_7030 = tmp_struct_105.field0; + CursorTy pvrtmp_7031 = tmp_struct_105.field1; + CursorTy pvrtmp_7032 = tmp_struct_105.field2; + CursorTy pvrtmp_7033 = tmp_struct_105.field3; + CursorCursorCursorCursorProd tmp_struct_106 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7030, pvrtmp_7033, tmpcur_7026); + CursorTy pvrtmp_7038 = tmp_struct_106.field0; + CursorTy pvrtmp_7039 = tmp_struct_106.field1; + CursorTy pvrtmp_7040 = tmp_struct_106.field2; + CursorTy pvrtmp_7041 = tmp_struct_106.field3; + CursorCursorCursorCursorProd tmp_struct_107 = + _copy_without_ptrs_Content(end_r_2964, pvrtmp_7038, pvrtmp_7041, tmpcur_7028); + CursorTy pvrtmp_7046 = tmp_struct_107.field0; + CursorTy pvrtmp_7047 = tmp_struct_107.field1; + CursorTy pvrtmp_7048 = tmp_struct_107.field2; + CursorTy pvrtmp_7049 = tmp_struct_107.field3; + + *(TagTyPacked *) loc_2963 = 6; + + CursorTy writetag_4853 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7046, pvrtmp_7047, + loc_2963, pvrtmp_7049}; + break; + } + + case 21: + { + CursorTy tmpcur_7058 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7059 = tmpcur_6881 + 8; + CursorTy tmpcur_7060 = *(CursorTy *) tmpaftercur_7059; + CursorTy tmpaftercur_7061 = tmpaftercur_7059 + 8; + CursorTy jump_4090 = tmpaftercur_7059 + 8; + CursorTy jump_4089 = tmpcur_6881 + 8; + CursorTy loc_3482 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_108 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3482, tmpaftercur_7061); + CursorTy pvrtmp_7062 = tmp_struct_108.field0; + CursorTy pvrtmp_7063 = tmp_struct_108.field1; + CursorTy pvrtmp_7064 = tmp_struct_108.field2; + CursorTy pvrtmp_7065 = tmp_struct_108.field3; + CursorCursorCursorCursorProd tmp_struct_109 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7062, pvrtmp_7065, tmpcur_7058); + CursorTy pvrtmp_7070 = tmp_struct_109.field0; + CursorTy pvrtmp_7071 = tmp_struct_109.field1; + CursorTy pvrtmp_7072 = tmp_struct_109.field2; + CursorTy pvrtmp_7073 = tmp_struct_109.field3; + CursorCursorCursorCursorProd tmp_struct_110 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_7070, pvrtmp_7073, tmpcur_7060); + CursorTy pvrtmp_7078 = tmp_struct_110.field0; + CursorTy pvrtmp_7079 = tmp_struct_110.field1; + CursorTy pvrtmp_7080 = tmp_struct_110.field2; + CursorTy pvrtmp_7081 = tmp_struct_110.field3; + + *(TagTyPacked *) loc_2963 = 7; + + CursorTy writetag_4864 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7078, pvrtmp_7079, + loc_2963, pvrtmp_7081}; + break; + } + + case 23: + { + CursorTy tmpcur_7090 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7091 = tmpcur_6881 + 8; + CursorTy tmpcur_7092 = *(CursorTy *) tmpaftercur_7091; + CursorTy tmpaftercur_7093 = tmpaftercur_7091 + 8; + CursorTy jump_4096 = tmpaftercur_7091 + 8; + CursorTy jump_4095 = tmpcur_6881 + 8; + CursorTy loc_3502 = loc_2963 + 1; + CursorCursorCursorCursorProd tmp_struct_111 = + _copy_without_ptrs_Content(end_r_2964, end_r_2965, loc_3502, tmpaftercur_7093); + CursorTy pvrtmp_7094 = tmp_struct_111.field0; + CursorTy pvrtmp_7095 = tmp_struct_111.field1; + CursorTy pvrtmp_7096 = tmp_struct_111.field2; + CursorTy pvrtmp_7097 = tmp_struct_111.field3; + CursorCursorCursorCursorProd tmp_struct_112 = + _copy_without_ptrs_Adt(end_r_2964, pvrtmp_7094, pvrtmp_7097, tmpcur_7090); + CursorTy pvrtmp_7102 = tmp_struct_112.field0; + CursorTy pvrtmp_7103 = tmp_struct_112.field1; + CursorTy pvrtmp_7104 = tmp_struct_112.field2; + CursorTy pvrtmp_7105 = tmp_struct_112.field3; + CursorCursorCursorCursorProd tmp_struct_113 = + _copy_without_ptrs_Tags(end_r_2964, pvrtmp_7102, pvrtmp_7105, tmpcur_7092); + CursorTy pvrtmp_7110 = tmp_struct_113.field0; + CursorTy pvrtmp_7111 = tmp_struct_113.field1; + CursorTy pvrtmp_7112 = tmp_struct_113.field2; + CursorTy pvrtmp_7113 = tmp_struct_113.field3; + + *(TagTyPacked *) loc_2963 = 8; + + CursorTy writetag_4875 = loc_2963 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7110, pvrtmp_7111, + loc_2963, pvrtmp_7113}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7122 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7123 = tmpcur_6881 + 8; + CursorTy jump_4332 = tmpcur_6881 + 8; + CursorCursorCursorCursorProd tmp_struct_114 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_2963, tmpcur_7122); + CursorTy pvrtmp_7124 = tmp_struct_114.field0; + CursorTy pvrtmp_7125 = tmp_struct_114.field1; + CursorTy pvrtmp_7126 = tmp_struct_114.field2; + CursorTy pvrtmp_7127 = tmp_struct_114.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7124, jump_4332, + pvrtmp_7126, pvrtmp_7127}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7134 = *(CursorTy *) tmpcur_6881; + CursorTy tmpaftercur_7135 = tmpcur_6881 + 8; + CursorCursorCursorCursorProd tmp_struct_115 = + _copy_without_ptrs_Adt(end_r_2964, end_r_2965, loc_2963, tmpcur_7134); + CursorTy pvrtmp_7136 = tmp_struct_115.field0; + CursorTy pvrtmp_7137 = tmp_struct_115.field1; + CursorTy pvrtmp_7138 = tmp_struct_115.field2; + CursorTy pvrtmp_7139 = tmp_struct_115.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7136, pvrtmp_7137, + pvrtmp_7138, pvrtmp_7139}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_6880"); + exit(1); + } + } +} +CursorProd _traverse_Adt(CursorTy end_r_2967, CursorTy arg_762_1367_1692) +{ + TagTyPacked tmpval_7147 = *(TagTyPacked *) arg_762_1367_1692; + CursorTy tmpcur_7148 = arg_762_1367_1692 + 1; + + + switch_7205: + ; + switch (tmpval_7147) { + + case 0: + { + CursorTy jump_4101 = arg_762_1367_1692 + 1; + + return (CursorProd) {jump_4101}; + break; + } + + case 9: + { + CursorTy tmpcur_7149 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7150 = tmpcur_7148 + 8; + CursorTy jump_4103 = tmpcur_7148 + 8; + CursorProd tmp_struct_116 = + _traverse_Content(end_r_2967, tmpaftercur_7150); + CursorTy pvrtmp_7151 = tmp_struct_116.field0; + CursorProd tmp_struct_117 = _traverse_Adt(end_r_2967, tmpcur_7149); + CursorTy pvrtmp_7152 = tmp_struct_117.field0; + + return (CursorProd) {pvrtmp_7152}; + break; + } + + case 11: + { + CursorTy tmpcur_7153 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7154 = tmpcur_7148 + 8; + CursorTy jump_4107 = tmpcur_7148 + 8; + CursorProd tmp_struct_118 = + _traverse_Adt(end_r_2967, tmpaftercur_7154); + CursorTy pvrtmp_7155 = tmp_struct_118.field0; + CursorProd tmp_struct_119 = + _traverse_Content(end_r_2967, tmpcur_7153); + CursorTy pvrtmp_7156 = tmp_struct_119.field0; + + return (CursorProd) {pvrtmp_7156}; + break; + } + + case 13: + { + CursorTy tmpcur_7157 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7158 = tmpcur_7148 + 8; + CursorTy tmpcur_7159 = *(CursorTy *) tmpaftercur_7158; + CursorTy tmpaftercur_7160 = tmpaftercur_7158 + 8; + CursorTy jump_4112 = tmpaftercur_7158 + 8; + CursorTy jump_4111 = tmpcur_7148 + 8; + CursorProd tmp_struct_120 = + _traverse_Tags(end_r_2967, tmpaftercur_7160); + CursorTy pvrtmp_7161 = tmp_struct_120.field0; + CursorProd tmp_struct_121 = + _traverse_Content(end_r_2967, tmpcur_7157); + CursorTy pvrtmp_7162 = tmp_struct_121.field0; + CursorProd tmp_struct_122 = _traverse_Adt(end_r_2967, tmpcur_7159); + CursorTy pvrtmp_7163 = tmp_struct_122.field0; + + return (CursorProd) {pvrtmp_7163}; + break; + } + + case 15: + { + CursorTy tmpcur_7164 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7165 = tmpcur_7148 + 8; + CursorTy tmpcur_7166 = *(CursorTy *) tmpaftercur_7165; + CursorTy tmpaftercur_7167 = tmpaftercur_7165 + 8; + CursorTy jump_4118 = tmpaftercur_7165 + 8; + CursorTy jump_4117 = tmpcur_7148 + 8; + CursorProd tmp_struct_123 = + _traverse_Adt(end_r_2967, tmpaftercur_7167); + CursorTy pvrtmp_7168 = tmp_struct_123.field0; + CursorProd tmp_struct_124 = + _traverse_Content(end_r_2967, tmpcur_7164); + CursorTy pvrtmp_7169 = tmp_struct_124.field0; + CursorProd tmp_struct_125 = + _traverse_Tags(end_r_2967, tmpcur_7166); + CursorTy pvrtmp_7170 = tmp_struct_125.field0; + + return (CursorProd) {pvrtmp_7170}; + break; + } + + case 17: + { + CursorTy tmpcur_7171 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7172 = tmpcur_7148 + 8; + CursorTy tmpcur_7173 = *(CursorTy *) tmpaftercur_7172; + CursorTy tmpaftercur_7174 = tmpaftercur_7172 + 8; + CursorTy jump_4124 = tmpaftercur_7172 + 8; + CursorTy jump_4123 = tmpcur_7148 + 8; + CursorProd tmp_struct_126 = + _traverse_Tags(end_r_2967, tmpaftercur_7174); + CursorTy pvrtmp_7175 = tmp_struct_126.field0; + CursorProd tmp_struct_127 = _traverse_Adt(end_r_2967, tmpcur_7171); + CursorTy pvrtmp_7176 = tmp_struct_127.field0; + CursorProd tmp_struct_128 = + _traverse_Content(end_r_2967, tmpcur_7173); + CursorTy pvrtmp_7177 = tmp_struct_128.field0; + + return (CursorProd) {pvrtmp_7177}; + break; + } + + case 19: + { + CursorTy tmpcur_7178 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7179 = tmpcur_7148 + 8; + CursorTy tmpcur_7180 = *(CursorTy *) tmpaftercur_7179; + CursorTy tmpaftercur_7181 = tmpaftercur_7179 + 8; + CursorTy jump_4130 = tmpaftercur_7179 + 8; + CursorTy jump_4129 = tmpcur_7148 + 8; + CursorProd tmp_struct_129 = + _traverse_Adt(end_r_2967, tmpaftercur_7181); + CursorTy pvrtmp_7182 = tmp_struct_129.field0; + CursorProd tmp_struct_130 = + _traverse_Tags(end_r_2967, tmpcur_7178); + CursorTy pvrtmp_7183 = tmp_struct_130.field0; + CursorProd tmp_struct_131 = + _traverse_Content(end_r_2967, tmpcur_7180); + CursorTy pvrtmp_7184 = tmp_struct_131.field0; + + return (CursorProd) {pvrtmp_7184}; + break; + } + + case 21: + { + CursorTy tmpcur_7185 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7186 = tmpcur_7148 + 8; + CursorTy tmpcur_7187 = *(CursorTy *) tmpaftercur_7186; + CursorTy tmpaftercur_7188 = tmpaftercur_7186 + 8; + CursorTy jump_4136 = tmpaftercur_7186 + 8; + CursorTy jump_4135 = tmpcur_7148 + 8; + CursorProd tmp_struct_132 = + _traverse_Content(end_r_2967, tmpaftercur_7188); + CursorTy pvrtmp_7189 = tmp_struct_132.field0; + CursorProd tmp_struct_133 = + _traverse_Tags(end_r_2967, tmpcur_7185); + CursorTy pvrtmp_7190 = tmp_struct_133.field0; + CursorProd tmp_struct_134 = _traverse_Adt(end_r_2967, tmpcur_7187); + CursorTy pvrtmp_7191 = tmp_struct_134.field0; + + return (CursorProd) {pvrtmp_7191}; + break; + } + + case 23: + { + CursorTy tmpcur_7192 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7193 = tmpcur_7148 + 8; + CursorTy tmpcur_7194 = *(CursorTy *) tmpaftercur_7193; + CursorTy tmpaftercur_7195 = tmpaftercur_7193 + 8; + CursorTy jump_4142 = tmpaftercur_7193 + 8; + CursorTy jump_4141 = tmpcur_7148 + 8; + CursorProd tmp_struct_135 = + _traverse_Content(end_r_2967, tmpaftercur_7195); + CursorTy pvrtmp_7196 = tmp_struct_135.field0; + CursorProd tmp_struct_136 = _traverse_Adt(end_r_2967, tmpcur_7192); + CursorTy pvrtmp_7197 = tmp_struct_136.field0; + CursorProd tmp_struct_137 = + _traverse_Tags(end_r_2967, tmpcur_7194); + CursorTy pvrtmp_7198 = tmp_struct_137.field0; + + return (CursorProd) {pvrtmp_7198}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7199 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7200 = tmpcur_7148 + 8; + CursorTy jump_4338 = tmpcur_7148 + 8; + CursorProd tmp_struct_138 = _traverse_Adt(end_r_2967, tmpcur_7199); + CursorTy pvrtmp_7201 = tmp_struct_138.field0; + + return (CursorProd) {jump_4338}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7202 = *(CursorTy *) tmpcur_7148; + CursorTy tmpaftercur_7203 = tmpcur_7148 + 8; + CursorProd tmp_struct_139 = _traverse_Adt(end_r_2967, tmpcur_7202); + CursorTy pvrtmp_7204 = tmp_struct_139.field0; + + return (CursorProd) {pvrtmp_7204}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7147"); + exit(1); + } + } +} +CursorProd _print_Adt(CursorTy end_r_2969, CursorTy arg_807_1412_1737) +{ + TagTyPacked tmpval_7206 = *(TagTyPacked *) arg_807_1412_1737; + CursorTy tmpcur_7207 = arg_807_1412_1737 + 1; + + + switch_7264: + ; + switch (tmpval_7206) { + + case 0: + { + CursorTy jump_4147 = arg_807_1412_1737 + 1; + unsigned char wildcard_808_1413_1738 = print_symbol(6160); + unsigned char wildcard_809_1414_1739 = print_symbol(6154); + + return (CursorProd) {jump_4147}; + break; + } + + case 9: + { + CursorTy tmpcur_7208 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7209 = tmpcur_7207 + 8; + CursorTy jump_4149 = tmpcur_7207 + 8; + unsigned char wildcard_814_1417_1742 = print_symbol(6166); + CursorProd tmp_struct_140 = + _print_Content(end_r_2969, tmpaftercur_7209); + CursorTy pvrtmp_7210 = tmp_struct_140.field0; + CursorProd tmp_struct_141 = _print_Adt(end_r_2969, tmpcur_7208); + CursorTy pvrtmp_7211 = tmp_struct_141.field0; + unsigned char wildcard_815_1420_1745 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7211}; + break; + } + + case 11: + { + CursorTy tmpcur_7212 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7213 = tmpcur_7207 + 8; + CursorTy jump_4153 = tmpcur_7207 + 8; + unsigned char wildcard_820_1423_1748 = print_symbol(6169); + CursorProd tmp_struct_142 = + _print_Adt(end_r_2969, tmpaftercur_7213); + CursorTy pvrtmp_7214 = tmp_struct_142.field0; + CursorProd tmp_struct_143 = + _print_Content(end_r_2969, tmpcur_7212); + CursorTy pvrtmp_7215 = tmp_struct_143.field0; + unsigned char wildcard_821_1426_1751 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7215}; + break; + } + + case 13: + { + CursorTy tmpcur_7216 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7217 = tmpcur_7207 + 8; + CursorTy tmpcur_7218 = *(CursorTy *) tmpaftercur_7217; + CursorTy tmpaftercur_7219 = tmpaftercur_7217 + 8; + CursorTy jump_4158 = tmpaftercur_7217 + 8; + CursorTy jump_4157 = tmpcur_7207 + 8; + unsigned char wildcard_828_1430_1755 = print_symbol(6157); + CursorProd tmp_struct_144 = + _print_Tags(end_r_2969, tmpaftercur_7219); + CursorTy pvrtmp_7220 = tmp_struct_144.field0; + CursorProd tmp_struct_145 = + _print_Content(end_r_2969, tmpcur_7216); + CursorTy pvrtmp_7221 = tmp_struct_145.field0; + CursorProd tmp_struct_146 = _print_Adt(end_r_2969, tmpcur_7218); + CursorTy pvrtmp_7222 = tmp_struct_146.field0; + unsigned char wildcard_829_1434_1759 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7222}; + break; + } + + case 15: + { + CursorTy tmpcur_7223 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7224 = tmpcur_7207 + 8; + CursorTy tmpcur_7225 = *(CursorTy *) tmpaftercur_7224; + CursorTy tmpaftercur_7226 = tmpaftercur_7224 + 8; + CursorTy jump_4164 = tmpaftercur_7224 + 8; + CursorTy jump_4163 = tmpcur_7207 + 8; + unsigned char wildcard_836_1438_1763 = print_symbol(6168); + CursorProd tmp_struct_147 = + _print_Adt(end_r_2969, tmpaftercur_7226); + CursorTy pvrtmp_7227 = tmp_struct_147.field0; + CursorProd tmp_struct_148 = + _print_Content(end_r_2969, tmpcur_7223); + CursorTy pvrtmp_7228 = tmp_struct_148.field0; + CursorProd tmp_struct_149 = _print_Tags(end_r_2969, tmpcur_7225); + CursorTy pvrtmp_7229 = tmp_struct_149.field0; + unsigned char wildcard_837_1442_1767 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7229}; + break; + } + + case 17: + { + CursorTy tmpcur_7230 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7231 = tmpcur_7207 + 8; + CursorTy tmpcur_7232 = *(CursorTy *) tmpaftercur_7231; + CursorTy tmpaftercur_7233 = tmpaftercur_7231 + 8; + CursorTy jump_4170 = tmpaftercur_7231 + 8; + CursorTy jump_4169 = tmpcur_7207 + 8; + unsigned char wildcard_844_1446_1771 = print_symbol(6158); + CursorProd tmp_struct_150 = + _print_Tags(end_r_2969, tmpaftercur_7233); + CursorTy pvrtmp_7234 = tmp_struct_150.field0; + CursorProd tmp_struct_151 = _print_Adt(end_r_2969, tmpcur_7230); + CursorTy pvrtmp_7235 = tmp_struct_151.field0; + CursorProd tmp_struct_152 = + _print_Content(end_r_2969, tmpcur_7232); + CursorTy pvrtmp_7236 = tmp_struct_152.field0; + unsigned char wildcard_845_1450_1775 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7236}; + break; + } + + case 19: + { + CursorTy tmpcur_7237 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7238 = tmpcur_7207 + 8; + CursorTy tmpcur_7239 = *(CursorTy *) tmpaftercur_7238; + CursorTy tmpaftercur_7240 = tmpaftercur_7238 + 8; + CursorTy jump_4176 = tmpaftercur_7238 + 8; + CursorTy jump_4175 = tmpcur_7207 + 8; + unsigned char wildcard_852_1454_1779 = print_symbol(6167); + CursorProd tmp_struct_153 = + _print_Adt(end_r_2969, tmpaftercur_7240); + CursorTy pvrtmp_7241 = tmp_struct_153.field0; + CursorProd tmp_struct_154 = _print_Tags(end_r_2969, tmpcur_7237); + CursorTy pvrtmp_7242 = tmp_struct_154.field0; + CursorProd tmp_struct_155 = + _print_Content(end_r_2969, tmpcur_7239); + CursorTy pvrtmp_7243 = tmp_struct_155.field0; + unsigned char wildcard_853_1458_1783 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7243}; + break; + } + + case 21: + { + CursorTy tmpcur_7244 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7245 = tmpcur_7207 + 8; + CursorTy tmpcur_7246 = *(CursorTy *) tmpaftercur_7245; + CursorTy tmpaftercur_7247 = tmpaftercur_7245 + 8; + CursorTy jump_4182 = tmpaftercur_7245 + 8; + CursorTy jump_4181 = tmpcur_7207 + 8; + unsigned char wildcard_860_1462_1787 = print_symbol(6164); + CursorProd tmp_struct_156 = + _print_Content(end_r_2969, tmpaftercur_7247); + CursorTy pvrtmp_7248 = tmp_struct_156.field0; + CursorProd tmp_struct_157 = _print_Tags(end_r_2969, tmpcur_7244); + CursorTy pvrtmp_7249 = tmp_struct_157.field0; + CursorProd tmp_struct_158 = _print_Adt(end_r_2969, tmpcur_7246); + CursorTy pvrtmp_7250 = tmp_struct_158.field0; + unsigned char wildcard_861_1466_1791 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7250}; + break; + } + + case 23: + { + CursorTy tmpcur_7251 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7252 = tmpcur_7207 + 8; + CursorTy tmpcur_7253 = *(CursorTy *) tmpaftercur_7252; + CursorTy tmpaftercur_7254 = tmpaftercur_7252 + 8; + CursorTy jump_4188 = tmpaftercur_7252 + 8; + CursorTy jump_4187 = tmpcur_7207 + 8; + unsigned char wildcard_868_1470_1795 = print_symbol(6165); + CursorProd tmp_struct_159 = + _print_Content(end_r_2969, tmpaftercur_7254); + CursorTy pvrtmp_7255 = tmp_struct_159.field0; + CursorProd tmp_struct_160 = _print_Adt(end_r_2969, tmpcur_7251); + CursorTy pvrtmp_7256 = tmp_struct_160.field0; + CursorProd tmp_struct_161 = _print_Tags(end_r_2969, tmpcur_7253); + CursorTy pvrtmp_7257 = tmp_struct_161.field0; + unsigned char wildcard_869_1474_1799 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7257}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7258 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7259 = tmpcur_7207 + 8; + CursorTy jump_4344 = tmpcur_7207 + 8; + unsigned char wildcard_4347 = print_symbol(6171); + CursorProd tmp_struct_162 = _print_Adt(end_r_2969, tmpcur_7258); + CursorTy pvrtmp_7260 = tmp_struct_162.field0; + + return (CursorProd) {jump_4344}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7261 = *(CursorTy *) tmpcur_7207; + CursorTy tmpaftercur_7262 = tmpcur_7207 + 8; + unsigned char wildcard_4347 = print_symbol(6170); + CursorProd tmp_struct_163 = _print_Adt(end_r_2969, tmpcur_7261); + CursorTy pvrtmp_7263 = tmp_struct_163.field0; + + return (CursorProd) {pvrtmp_7263}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7206"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_Tags(CursorTy end_r_2972, + CursorTy end_r_2973, CursorTy loc_2971, + CursorTy arg_870_1475_1800) +{ + if (loc_2971 + 32 > end_r_2973) { + ChunkTy new_chunk_167 = alloc_chunk(end_r_2973); + CursorTy chunk_start_168 = new_chunk_167.chunk_start; + CursorTy chunk_end_169 = new_chunk_167.chunk_end; + + end_r_2973 = chunk_end_169; + *(TagTyPacked *) loc_2971 = 255; + + CursorTy redir = loc_2971 + 1; + + *(CursorTy *) redir = chunk_start_168; + loc_2971 = chunk_start_168; + } + + CursorTy loc_3680 = loc_2971 + 1; + CursorTy loc_3681 = loc_3680 + 8; + TagTyPacked tmpval_7265 = *(TagTyPacked *) arg_870_1475_1800; + CursorTy tmpcur_7266 = arg_870_1475_1800 + 1; + + + switch_7309: + ; + switch (tmpval_7265) { + + case 0: + { + CursorTy jump_4193 = arg_870_1475_1800 + 1; + + *(TagTyPacked *) loc_2971 = 0; + + CursorTy writetag_4989 = loc_2971 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2973, jump_4193, + loc_2971, writetag_4989}; + break; + } + + case 1: + { + IntTy tmpval_7271 = *(IntTy *) tmpcur_7266; + CursorTy tmpcur_7272 = tmpcur_7266 + sizeof(IntTy); + CursorTy jump_4195 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_164 = + _copy_Tags(end_r_2972, end_r_2973, loc_3681, tmpcur_7272); + CursorTy pvrtmp_7273 = tmp_struct_164.field0; + CursorTy pvrtmp_7274 = tmp_struct_164.field1; + CursorTy pvrtmp_7275 = tmp_struct_164.field2; + CursorTy pvrtmp_7276 = tmp_struct_164.field3; + + *(TagTyPacked *) loc_2971 = 1; + + CursorTy writetag_4994 = loc_2971 + 1; + + *(IntTy *) writetag_4994 = tmpval_7271; + + CursorTy writecur_4995 = writetag_4994 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7273, pvrtmp_7274, + loc_2971, pvrtmp_7276}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7285 = *(CursorTy *) tmpcur_7266; + CursorTy tmpaftercur_7286 = tmpcur_7266 + 8; + CursorTy jump_4350 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_165 = + _copy_Tags(end_r_2972, end_r_2973, loc_2971, tmpcur_7285); + CursorTy pvrtmp_7287 = tmp_struct_165.field0; + CursorTy pvrtmp_7288 = tmp_struct_165.field1; + CursorTy pvrtmp_7289 = tmp_struct_165.field2; + CursorTy pvrtmp_7290 = tmp_struct_165.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7287, jump_4350, + pvrtmp_7289, pvrtmp_7290}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7297 = *(CursorTy *) tmpcur_7266; + CursorTy tmpaftercur_7298 = tmpcur_7266 + 8; + CursorCursorCursorCursorProd tmp_struct_166 = + _copy_Tags(end_r_2972, end_r_2973, loc_2971, tmpcur_7297); + CursorTy pvrtmp_7299 = tmp_struct_166.field0; + CursorTy pvrtmp_7300 = tmp_struct_166.field1; + CursorTy pvrtmp_7301 = tmp_struct_166.field2; + CursorTy pvrtmp_7302 = tmp_struct_166.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7299, pvrtmp_7300, + pvrtmp_7301, pvrtmp_7302}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7265"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _copy_without_ptrs_Tags(CursorTy end_r_2976, + CursorTy end_r_2977, + CursorTy loc_2975, + CursorTy arg_875_1480_1805) +{ + CursorTy loc_3693 = loc_2975 + 1; + CursorTy loc_3694 = loc_3693 + 8; + TagTyPacked tmpval_7310 = *(TagTyPacked *) arg_875_1480_1805; + CursorTy tmpcur_7311 = arg_875_1480_1805 + 1; + + + switch_7354: + ; + switch (tmpval_7310) { + + case 0: + { + CursorTy jump_4198 = arg_875_1480_1805 + 1; + + *(TagTyPacked *) loc_2975 = 0; + + CursorTy writetag_5005 = loc_2975 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2977, jump_4198, + loc_2975, writetag_5005}; + break; + } + + case 1: + { + IntTy tmpval_7316 = *(IntTy *) tmpcur_7311; + CursorTy tmpcur_7317 = tmpcur_7311 + sizeof(IntTy); + CursorTy jump_4200 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_170 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_3694, tmpcur_7317); + CursorTy pvrtmp_7318 = tmp_struct_170.field0; + CursorTy pvrtmp_7319 = tmp_struct_170.field1; + CursorTy pvrtmp_7320 = tmp_struct_170.field2; + CursorTy pvrtmp_7321 = tmp_struct_170.field3; + + *(TagTyPacked *) loc_2975 = 1; + + CursorTy writetag_5010 = loc_2975 + 1; + + *(IntTy *) writetag_5010 = tmpval_7316; + + CursorTy writecur_5011 = writetag_5010 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7318, pvrtmp_7319, + loc_2975, pvrtmp_7321}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7330 = *(CursorTy *) tmpcur_7311; + CursorTy tmpaftercur_7331 = tmpcur_7311 + 8; + CursorTy jump_4356 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_171 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_2975, tmpcur_7330); + CursorTy pvrtmp_7332 = tmp_struct_171.field0; + CursorTy pvrtmp_7333 = tmp_struct_171.field1; + CursorTy pvrtmp_7334 = tmp_struct_171.field2; + CursorTy pvrtmp_7335 = tmp_struct_171.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7332, jump_4356, + pvrtmp_7334, pvrtmp_7335}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7342 = *(CursorTy *) tmpcur_7311; + CursorTy tmpaftercur_7343 = tmpcur_7311 + 8; + CursorCursorCursorCursorProd tmp_struct_172 = + _copy_without_ptrs_Tags(end_r_2976, end_r_2977, loc_2975, tmpcur_7342); + CursorTy pvrtmp_7344 = tmp_struct_172.field0; + CursorTy pvrtmp_7345 = tmp_struct_172.field1; + CursorTy pvrtmp_7346 = tmp_struct_172.field2; + CursorTy pvrtmp_7347 = tmp_struct_172.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7344, pvrtmp_7345, + pvrtmp_7346, pvrtmp_7347}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7310"); + exit(1); + } + } +} +CursorProd _traverse_Tags(CursorTy end_r_2979, CursorTy arg_880_1485_1810) +{ + TagTyPacked tmpval_7355 = *(TagTyPacked *) arg_880_1485_1810; + CursorTy tmpcur_7356 = arg_880_1485_1810 + 1; + + + switch_7366: + ; + switch (tmpval_7355) { + + case 0: + { + CursorTy jump_4203 = arg_880_1485_1810 + 1; + + return (CursorProd) {jump_4203}; + break; + } + + case 1: + { + IntTy tmpval_7357 = *(IntTy *) tmpcur_7356; + CursorTy tmpcur_7358 = tmpcur_7356 + sizeof(IntTy); + CursorTy jump_4205 = tmpcur_7356 + 8; + CursorProd tmp_struct_173 = + _traverse_Tags(end_r_2979, tmpcur_7358); + CursorTy pvrtmp_7359 = tmp_struct_173.field0; + + return (CursorProd) {pvrtmp_7359}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7360 = *(CursorTy *) tmpcur_7356; + CursorTy tmpaftercur_7361 = tmpcur_7356 + 8; + CursorTy jump_4362 = tmpcur_7356 + 8; + CursorProd tmp_struct_174 = + _traverse_Tags(end_r_2979, tmpcur_7360); + CursorTy pvrtmp_7362 = tmp_struct_174.field0; + + return (CursorProd) {jump_4362}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7363 = *(CursorTy *) tmpcur_7356; + CursorTy tmpaftercur_7364 = tmpcur_7356 + 8; + CursorProd tmp_struct_175 = + _traverse_Tags(end_r_2979, tmpcur_7363); + CursorTy pvrtmp_7365 = tmp_struct_175.field0; + + return (CursorProd) {pvrtmp_7365}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7355"); + exit(1); + } + } +} +CursorProd _print_Tags(CursorTy end_r_2981, CursorTy arg_885_1489_1814) +{ + TagTyPacked tmpval_7367 = *(TagTyPacked *) arg_885_1489_1814; + CursorTy tmpcur_7368 = arg_885_1489_1814 + 1; + + + switch_7378: + ; + switch (tmpval_7367) { + + case 0: + { + CursorTy jump_4208 = arg_885_1489_1814 + 1; + unsigned char wildcard_886_1490_1815 = print_symbol(6159); + unsigned char wildcard_887_1491_1816 = print_symbol(6154); + + return (CursorProd) {jump_4208}; + break; + } + + case 1: + { + IntTy tmpval_7369 = *(IntTy *) tmpcur_7368; + CursorTy tmpcur_7370 = tmpcur_7368 + sizeof(IntTy); + CursorTy jump_4210 = tmpcur_7368 + 8; + unsigned char wildcard_892_1494_1819 = print_symbol(6156); + unsigned char y_890_1495_1820 = printf("%lld", tmpval_7369); + CursorProd tmp_struct_176 = _print_Tags(end_r_2981, tmpcur_7370); + CursorTy pvrtmp_7371 = tmp_struct_176.field0; + unsigned char wildcard_893_1497_1822 = print_symbol(6154); + + return (CursorProd) {pvrtmp_7371}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7372 = *(CursorTy *) tmpcur_7368; + CursorTy tmpaftercur_7373 = tmpcur_7368 + 8; + CursorTy jump_4368 = tmpcur_7368 + 8; + unsigned char wildcard_4371 = print_symbol(6171); + CursorProd tmp_struct_177 = _print_Tags(end_r_2981, tmpcur_7372); + CursorTy pvrtmp_7374 = tmp_struct_177.field0; + + return (CursorProd) {jump_4368}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7375 = *(CursorTy *) tmpcur_7368; + CursorTy tmpaftercur_7376 = tmpcur_7368 + 8; + unsigned char wildcard_4371 = print_symbol(6170); + CursorProd tmp_struct_178 = _print_Tags(end_r_2981, tmpcur_7375); + CursorTy pvrtmp_7377 = tmp_struct_178.field0; + + return (CursorProd) {pvrtmp_7377}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7367"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_String(CursorTy end_r_2984, + CursorTy end_r_2985, + CursorTy loc_2983, + CursorTy arg_2716) +{ + if (loc_2983 + 32 > end_r_2985) { + ChunkTy new_chunk_182 = alloc_chunk(end_r_2985); + CursorTy chunk_start_183 = new_chunk_182.chunk_start; + CursorTy chunk_end_184 = new_chunk_182.chunk_end; + + end_r_2985 = chunk_end_184; + *(TagTyPacked *) loc_2983 = 255; + + CursorTy redir = loc_2983 + 1; + + *(CursorTy *) redir = chunk_start_183; + loc_2983 = chunk_start_183; + } + + CursorTy loc_3718 = loc_2983 + 1; + CursorTy loc_3719 = loc_3718 + 8; + TagTyPacked tmpval_7379 = *(TagTyPacked *) arg_2716; + CursorTy tmpcur_7380 = arg_2716 + 1; + + + switch_7423: + ; + switch (tmpval_7379) { + + case 0: + { + CursorTy jump_4213 = arg_2716 + 1; + + *(TagTyPacked *) loc_2983 = 0; + + CursorTy writetag_5041 = loc_2983 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2985, jump_4213, + loc_2983, writetag_5041}; + break; + } + + case 1: + { + IntTy tmpval_7385 = *(IntTy *) tmpcur_7380; + CursorTy tmpcur_7386 = tmpcur_7380 + sizeof(IntTy); + CursorTy jump_4215 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_179 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_3719, tmpcur_7386); + CursorTy pvrtmp_7387 = tmp_struct_179.field0; + CursorTy pvrtmp_7388 = tmp_struct_179.field1; + CursorTy pvrtmp_7389 = tmp_struct_179.field2; + CursorTy pvrtmp_7390 = tmp_struct_179.field3; + + *(TagTyPacked *) loc_2983 = 1; + + CursorTy writetag_5046 = loc_2983 + 1; + + *(IntTy *) writetag_5046 = tmpval_7385; + + CursorTy writecur_5047 = writetag_5046 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7387, pvrtmp_7388, + loc_2983, pvrtmp_7390}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7399 = *(CursorTy *) tmpcur_7380; + CursorTy tmpaftercur_7400 = tmpcur_7380 + 8; + CursorTy jump_4374 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_180 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_2983, tmpcur_7399); + CursorTy pvrtmp_7401 = tmp_struct_180.field0; + CursorTy pvrtmp_7402 = tmp_struct_180.field1; + CursorTy pvrtmp_7403 = tmp_struct_180.field2; + CursorTy pvrtmp_7404 = tmp_struct_180.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7401, jump_4374, + pvrtmp_7403, pvrtmp_7404}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7411 = *(CursorTy *) tmpcur_7380; + CursorTy tmpaftercur_7412 = tmpcur_7380 + 8; + CursorCursorCursorCursorProd tmp_struct_181 = + _add_size_and_rel_offsets_String(end_r_2984, end_r_2985, loc_2983, tmpcur_7411); + CursorTy pvrtmp_7413 = tmp_struct_181.field0; + CursorTy pvrtmp_7414 = tmp_struct_181.field1; + CursorTy pvrtmp_7415 = tmp_struct_181.field2; + CursorTy pvrtmp_7416 = tmp_struct_181.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7413, pvrtmp_7414, + pvrtmp_7415, pvrtmp_7416}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7379"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Content(CursorTy end_r_2988, + CursorTy end_r_2989, + CursorTy loc_2987, + CursorTy arg_2721) +{ + if (loc_2987 + 32 > end_r_2989) { + ChunkTy new_chunk_189 = alloc_chunk(end_r_2989); + CursorTy chunk_start_190 = new_chunk_189.chunk_start; + CursorTy chunk_end_191 = new_chunk_189.chunk_end; + + end_r_2989 = chunk_end_191; + *(TagTyPacked *) loc_2987 = 255; + + CursorTy redir = loc_2987 + 1; + + *(CursorTy *) redir = chunk_start_190; + loc_2987 = chunk_start_190; + } + + TagTyPacked tmpval_7424 = *(TagTyPacked *) arg_2721; + CursorTy tmpcur_7425 = arg_2721 + 1; + + + switch_7474: + ; + switch (tmpval_7424) { + + case 0: + { + CursorTy loc_3729 = loc_2987 + 1; + CursorCursorCursorCursorProd tmp_struct_185 = + _add_size_and_rel_offsets_String(end_r_2988, end_r_2989, loc_3729, tmpcur_7425); + CursorTy pvrtmp_7426 = tmp_struct_185.field0; + CursorTy pvrtmp_7427 = tmp_struct_185.field1; + CursorTy pvrtmp_7428 = tmp_struct_185.field2; + CursorTy pvrtmp_7429 = tmp_struct_185.field3; + + *(TagTyPacked *) loc_2987 = 0; + + CursorTy writetag_5058 = loc_2987 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7426, pvrtmp_7427, + loc_2987, pvrtmp_7429}; + break; + } + + case 1: + { + CursorTy loc_3735 = loc_2987 + 1; + CursorCursorCursorCursorProd tmp_struct_186 = + _add_size_and_rel_offsets_String(end_r_2988, end_r_2989, loc_3735, tmpcur_7425); + CursorTy pvrtmp_7438 = tmp_struct_186.field0; + CursorTy pvrtmp_7439 = tmp_struct_186.field1; + CursorTy pvrtmp_7440 = tmp_struct_186.field2; + CursorTy pvrtmp_7441 = tmp_struct_186.field3; + + *(TagTyPacked *) loc_2987 = 1; + + CursorTy writetag_5063 = loc_2987 + 1; + + return (CursorCursorCursorCursorProd) {pvrtmp_7438, pvrtmp_7439, + loc_2987, pvrtmp_7441}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7450 = *(CursorTy *) tmpcur_7425; + CursorTy tmpaftercur_7451 = tmpcur_7425 + 8; + CursorTy jump_4380 = tmpcur_7425 + 8; + CursorCursorCursorCursorProd tmp_struct_187 = + _add_size_and_rel_offsets_Content(end_r_2988, end_r_2989, loc_2987, tmpcur_7450); + CursorTy pvrtmp_7452 = tmp_struct_187.field0; + CursorTy pvrtmp_7453 = tmp_struct_187.field1; + CursorTy pvrtmp_7454 = tmp_struct_187.field2; + CursorTy pvrtmp_7455 = tmp_struct_187.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7452, jump_4380, + pvrtmp_7454, pvrtmp_7455}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7462 = *(CursorTy *) tmpcur_7425; + CursorTy tmpaftercur_7463 = tmpcur_7425 + 8; + CursorCursorCursorCursorProd tmp_struct_188 = + _add_size_and_rel_offsets_Content(end_r_2988, end_r_2989, loc_2987, tmpcur_7462); + CursorTy pvrtmp_7464 = tmp_struct_188.field0; + CursorTy pvrtmp_7465 = tmp_struct_188.field1; + CursorTy pvrtmp_7466 = tmp_struct_188.field2; + CursorTy pvrtmp_7467 = tmp_struct_188.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7464, pvrtmp_7465, + pvrtmp_7466, pvrtmp_7467}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7424"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Adt(CursorTy end_r_2992, + CursorTy end_r_2993, + CursorTy loc_2991, + CursorTy arg_2726) +{ + if (loc_2991 + 32 > end_r_2993) { + ChunkTy new_chunk_216 = alloc_chunk(end_r_2993); + CursorTy chunk_start_217 = new_chunk_216.chunk_start; + CursorTy chunk_end_218 = new_chunk_216.chunk_end; + + end_r_2993 = chunk_end_218; + *(TagTyPacked *) loc_2991 = 255; + + CursorTy redir = loc_2991 + 1; + + *(CursorTy *) redir = chunk_start_217; + loc_2991 = chunk_start_217; + } + + CursorTy loc_3748 = loc_2991 + 1; + CursorTy loc_3749 = loc_3748 + 8; + CursorTy loc_3750 = loc_3749 + 8; + CursorTy loc_3766 = loc_2991 + 1; + CursorTy loc_3767 = loc_3766 + 8; + CursorTy loc_3768 = loc_3767 + 8; + CursorTy loc_3788 = loc_2991 + 1; + CursorTy loc_3789 = loc_3788 + 8; + CursorTy loc_3790 = loc_3789 + 8; + CursorTy loc_3791 = loc_3790 + 8; + CursorTy loc_3815 = loc_2991 + 1; + CursorTy loc_3816 = loc_3815 + 8; + CursorTy loc_3817 = loc_3816 + 8; + CursorTy loc_3818 = loc_3817 + 8; + CursorTy loc_3842 = loc_2991 + 1; + CursorTy loc_3843 = loc_3842 + 8; + CursorTy loc_3844 = loc_3843 + 8; + CursorTy loc_3845 = loc_3844 + 8; + CursorTy loc_3869 = loc_2991 + 1; + CursorTy loc_3870 = loc_3869 + 8; + CursorTy loc_3871 = loc_3870 + 8; + CursorTy loc_3872 = loc_3871 + 8; + CursorTy loc_3896 = loc_2991 + 1; + CursorTy loc_3897 = loc_3896 + 8; + CursorTy loc_3898 = loc_3897 + 8; + CursorTy loc_3899 = loc_3898 + 8; + CursorTy loc_3923 = loc_2991 + 1; + CursorTy loc_3924 = loc_3923 + 8; + CursorTy loc_3925 = loc_3924 + 8; + CursorTy loc_3926 = loc_3925 + 8; + TagTyPacked tmpval_7475 = *(TagTyPacked *) arg_2726; + CursorTy tmpcur_7476 = arg_2726 + 1; + + + switch_7713: + ; + switch (tmpval_7475) { + + case 0: + { + CursorTy jump_4222 = arg_2726 + 1; + + *(TagTyPacked *) loc_2991 = 0; + + CursorTy writetag_5073 = loc_2991 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2993, jump_4222, + loc_2991, writetag_5073}; + break; + } + + case 1: + { + CursorCursorCursorCursorProd tmp_struct_192 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3750, tmpcur_7476); + CursorTy pvrtmp_7481 = tmp_struct_192.field0; + CursorTy pvrtmp_7482 = tmp_struct_192.field1; + CursorTy pvrtmp_7483 = tmp_struct_192.field2; + CursorTy pvrtmp_7484 = tmp_struct_192.field3; + CursorCursorCursorCursorProd tmp_struct_193 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7481, pvrtmp_7484, pvrtmp_7482); + CursorTy pvrtmp_7489 = tmp_struct_193.field0; + CursorTy pvrtmp_7490 = tmp_struct_193.field1; + CursorTy pvrtmp_7491 = tmp_struct_193.field2; + CursorTy pvrtmp_7492 = tmp_struct_193.field3; + IntTy sizeof_y_2729__2731 = pvrtmp_7484 - pvrtmp_7483; + IntTy sizeof_y_2730__2732 = pvrtmp_7492 - pvrtmp_7491; + IntTy fltPrm_2820 = sizeof_y_2729__2731 + 0; + IntTy offset__2733 = 0 + fltPrm_2820; + IntTy fltPrm_2821 = sizeof_y_2729__2731 + sizeof_y_2730__2732; + IntTy size_dcon_2734 = 9 + fltPrm_2821; + + *(TagTyPacked *) loc_2991 = 160; + + CursorTy writetag_5078 = loc_2991 + 1; + + *(IntTy *) writetag_5078 = size_dcon_2734; + + CursorTy writecur_5079 = writetag_5078 + sizeof(IntTy); + + *(IntTy *) writecur_5079 = offset__2733; + + CursorTy writecur_5080 = writecur_5079 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7489, pvrtmp_7490, + loc_2991, pvrtmp_7492}; + break; + } + + case 2: + { + CursorCursorCursorCursorProd tmp_struct_194 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3768, tmpcur_7476); + CursorTy pvrtmp_7501 = tmp_struct_194.field0; + CursorTy pvrtmp_7502 = tmp_struct_194.field1; + CursorTy pvrtmp_7503 = tmp_struct_194.field2; + CursorTy pvrtmp_7504 = tmp_struct_194.field3; + CursorCursorCursorCursorProd tmp_struct_195 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7501, pvrtmp_7504, pvrtmp_7502); + CursorTy pvrtmp_7509 = tmp_struct_195.field0; + CursorTy pvrtmp_7510 = tmp_struct_195.field1; + CursorTy pvrtmp_7511 = tmp_struct_195.field2; + CursorTy pvrtmp_7512 = tmp_struct_195.field3; + IntTy sizeof_y_2737__2739 = pvrtmp_7504 - pvrtmp_7503; + IntTy sizeof_y_2738__2740 = pvrtmp_7512 - pvrtmp_7511; + IntTy fltPrm_2822 = sizeof_y_2737__2739 + 0; + IntTy offset__2741 = 0 + fltPrm_2822; + IntTy fltPrm_2823 = sizeof_y_2737__2739 + sizeof_y_2738__2740; + IntTy size_dcon_2742 = 9 + fltPrm_2823; + + *(TagTyPacked *) loc_2991 = 162; + + CursorTy writetag_5087 = loc_2991 + 1; + + *(IntTy *) writetag_5087 = size_dcon_2742; + + CursorTy writecur_5088 = writetag_5087 + sizeof(IntTy); + + *(IntTy *) writecur_5088 = offset__2741; + + CursorTy writecur_5089 = writecur_5088 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7509, pvrtmp_7510, + loc_2991, pvrtmp_7512}; + break; + } + + case 3: + { + CursorCursorCursorCursorProd tmp_struct_196 = + _add_size_and_rel_offsets_Tags(end_r_2992, end_r_2993, loc_3791, tmpcur_7476); + CursorTy pvrtmp_7521 = tmp_struct_196.field0; + CursorTy pvrtmp_7522 = tmp_struct_196.field1; + CursorTy pvrtmp_7523 = tmp_struct_196.field2; + CursorTy pvrtmp_7524 = tmp_struct_196.field3; + CursorCursorCursorCursorProd tmp_struct_197 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7521, pvrtmp_7524, pvrtmp_7522); + CursorTy pvrtmp_7529 = tmp_struct_197.field0; + CursorTy pvrtmp_7530 = tmp_struct_197.field1; + CursorTy pvrtmp_7531 = tmp_struct_197.field2; + CursorTy pvrtmp_7532 = tmp_struct_197.field3; + CursorCursorCursorCursorProd tmp_struct_198 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7529, pvrtmp_7532, pvrtmp_7530); + CursorTy pvrtmp_7537 = tmp_struct_198.field0; + CursorTy pvrtmp_7538 = tmp_struct_198.field1; + CursorTy pvrtmp_7539 = tmp_struct_198.field2; + CursorTy pvrtmp_7540 = tmp_struct_198.field3; + IntTy sizeof_y_2746__2749 = pvrtmp_7524 - pvrtmp_7523; + IntTy sizeof_y_2747__2750 = pvrtmp_7532 - pvrtmp_7531; + IntTy sizeof_y_2748__2751 = pvrtmp_7540 - pvrtmp_7539; + IntTy fltPrm_2824 = sizeof_y_2746__2749 + 0; + IntTy offset__2752 = 8 + fltPrm_2824; + IntTy fltPrm_2825 = sizeof_y_2746__2749 + sizeof_y_2747__2750; + IntTy offset__2753 = 0 + fltPrm_2825; + IntTy fltPrm_2827 = sizeof_y_2747__2750 + sizeof_y_2748__2751; + IntTy fltPrm_2826 = sizeof_y_2746__2749 + fltPrm_2827; + IntTy size_dcon_2754 = 17 + fltPrm_2826; + + *(TagTyPacked *) loc_2991 = 164; + + CursorTy writetag_5097 = loc_2991 + 1; + + *(IntTy *) writetag_5097 = size_dcon_2754; + + CursorTy writecur_5098 = writetag_5097 + sizeof(IntTy); + + *(IntTy *) writecur_5098 = offset__2752; + + CursorTy writecur_5099 = writecur_5098 + sizeof(IntTy); + + *(IntTy *) writecur_5099 = offset__2753; + + CursorTy writecur_5100 = writecur_5099 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7537, pvrtmp_7538, + loc_2991, pvrtmp_7540}; + break; + } + + case 4: + { + CursorCursorCursorCursorProd tmp_struct_199 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3818, tmpcur_7476); + CursorTy pvrtmp_7549 = tmp_struct_199.field0; + CursorTy pvrtmp_7550 = tmp_struct_199.field1; + CursorTy pvrtmp_7551 = tmp_struct_199.field2; + CursorTy pvrtmp_7552 = tmp_struct_199.field3; + CursorCursorCursorCursorProd tmp_struct_200 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7549, pvrtmp_7552, pvrtmp_7550); + CursorTy pvrtmp_7557 = tmp_struct_200.field0; + CursorTy pvrtmp_7558 = tmp_struct_200.field1; + CursorTy pvrtmp_7559 = tmp_struct_200.field2; + CursorTy pvrtmp_7560 = tmp_struct_200.field3; + CursorCursorCursorCursorProd tmp_struct_201 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7557, pvrtmp_7560, pvrtmp_7558); + CursorTy pvrtmp_7565 = tmp_struct_201.field0; + CursorTy pvrtmp_7566 = tmp_struct_201.field1; + CursorTy pvrtmp_7567 = tmp_struct_201.field2; + CursorTy pvrtmp_7568 = tmp_struct_201.field3; + IntTy sizeof_y_2758__2761 = pvrtmp_7552 - pvrtmp_7551; + IntTy sizeof_y_2759__2762 = pvrtmp_7560 - pvrtmp_7559; + IntTy sizeof_y_2760__2763 = pvrtmp_7568 - pvrtmp_7567; + IntTy fltPrm_2828 = sizeof_y_2758__2761 + 0; + IntTy offset__2764 = 8 + fltPrm_2828; + IntTy fltPrm_2829 = sizeof_y_2758__2761 + sizeof_y_2759__2762; + IntTy offset__2765 = 0 + fltPrm_2829; + IntTy fltPrm_2831 = sizeof_y_2759__2762 + sizeof_y_2760__2763; + IntTy fltPrm_2830 = sizeof_y_2758__2761 + fltPrm_2831; + IntTy size_dcon_2766 = 17 + fltPrm_2830; + + *(TagTyPacked *) loc_2991 = 166; + + CursorTy writetag_5109 = loc_2991 + 1; + + *(IntTy *) writetag_5109 = size_dcon_2766; + + CursorTy writecur_5110 = writetag_5109 + sizeof(IntTy); + + *(IntTy *) writecur_5110 = offset__2764; + + CursorTy writecur_5111 = writecur_5110 + sizeof(IntTy); + + *(IntTy *) writecur_5111 = offset__2765; + + CursorTy writecur_5112 = writecur_5111 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7565, pvrtmp_7566, + loc_2991, pvrtmp_7568}; + break; + } + + case 5: + { + CursorCursorCursorCursorProd tmp_struct_202 = + _add_size_and_rel_offsets_Tags(end_r_2992, end_r_2993, loc_3845, tmpcur_7476); + CursorTy pvrtmp_7577 = tmp_struct_202.field0; + CursorTy pvrtmp_7578 = tmp_struct_202.field1; + CursorTy pvrtmp_7579 = tmp_struct_202.field2; + CursorTy pvrtmp_7580 = tmp_struct_202.field3; + CursorCursorCursorCursorProd tmp_struct_203 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7577, pvrtmp_7580, pvrtmp_7578); + CursorTy pvrtmp_7585 = tmp_struct_203.field0; + CursorTy pvrtmp_7586 = tmp_struct_203.field1; + CursorTy pvrtmp_7587 = tmp_struct_203.field2; + CursorTy pvrtmp_7588 = tmp_struct_203.field3; + CursorCursorCursorCursorProd tmp_struct_204 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7585, pvrtmp_7588, pvrtmp_7586); + CursorTy pvrtmp_7593 = tmp_struct_204.field0; + CursorTy pvrtmp_7594 = tmp_struct_204.field1; + CursorTy pvrtmp_7595 = tmp_struct_204.field2; + CursorTy pvrtmp_7596 = tmp_struct_204.field3; + IntTy sizeof_y_2770__2773 = pvrtmp_7580 - pvrtmp_7579; + IntTy sizeof_y_2771__2774 = pvrtmp_7588 - pvrtmp_7587; + IntTy sizeof_y_2772__2775 = pvrtmp_7596 - pvrtmp_7595; + IntTy fltPrm_2832 = sizeof_y_2770__2773 + 0; + IntTy offset__2776 = 8 + fltPrm_2832; + IntTy fltPrm_2833 = sizeof_y_2770__2773 + sizeof_y_2771__2774; + IntTy offset__2777 = 0 + fltPrm_2833; + IntTy fltPrm_2835 = sizeof_y_2771__2774 + sizeof_y_2772__2775; + IntTy fltPrm_2834 = sizeof_y_2770__2773 + fltPrm_2835; + IntTy size_dcon_2778 = 17 + fltPrm_2834; + + *(TagTyPacked *) loc_2991 = 168; + + CursorTy writetag_5121 = loc_2991 + 1; + + *(IntTy *) writetag_5121 = size_dcon_2778; + + CursorTy writecur_5122 = writetag_5121 + sizeof(IntTy); + + *(IntTy *) writecur_5122 = offset__2776; + + CursorTy writecur_5123 = writecur_5122 + sizeof(IntTy); + + *(IntTy *) writecur_5123 = offset__2777; + + CursorTy writecur_5124 = writecur_5123 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7593, pvrtmp_7594, + loc_2991, pvrtmp_7596}; + break; + } + + case 6: + { + CursorCursorCursorCursorProd tmp_struct_205 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_3872, tmpcur_7476); + CursorTy pvrtmp_7605 = tmp_struct_205.field0; + CursorTy pvrtmp_7606 = tmp_struct_205.field1; + CursorTy pvrtmp_7607 = tmp_struct_205.field2; + CursorTy pvrtmp_7608 = tmp_struct_205.field3; + CursorCursorCursorCursorProd tmp_struct_206 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7605, pvrtmp_7608, pvrtmp_7606); + CursorTy pvrtmp_7613 = tmp_struct_206.field0; + CursorTy pvrtmp_7614 = tmp_struct_206.field1; + CursorTy pvrtmp_7615 = tmp_struct_206.field2; + CursorTy pvrtmp_7616 = tmp_struct_206.field3; + CursorCursorCursorCursorProd tmp_struct_207 = + _add_size_and_rel_offsets_Content(end_r_2992, pvrtmp_7613, pvrtmp_7616, pvrtmp_7614); + CursorTy pvrtmp_7621 = tmp_struct_207.field0; + CursorTy pvrtmp_7622 = tmp_struct_207.field1; + CursorTy pvrtmp_7623 = tmp_struct_207.field2; + CursorTy pvrtmp_7624 = tmp_struct_207.field3; + IntTy sizeof_y_2782__2785 = pvrtmp_7608 - pvrtmp_7607; + IntTy sizeof_y_2783__2786 = pvrtmp_7616 - pvrtmp_7615; + IntTy sizeof_y_2784__2787 = pvrtmp_7624 - pvrtmp_7623; + IntTy fltPrm_2836 = sizeof_y_2782__2785 + 0; + IntTy offset__2788 = 8 + fltPrm_2836; + IntTy fltPrm_2837 = sizeof_y_2782__2785 + sizeof_y_2783__2786; + IntTy offset__2789 = 0 + fltPrm_2837; + IntTy fltPrm_2839 = sizeof_y_2783__2786 + sizeof_y_2784__2787; + IntTy fltPrm_2838 = sizeof_y_2782__2785 + fltPrm_2839; + IntTy size_dcon_2790 = 17 + fltPrm_2838; + + *(TagTyPacked *) loc_2991 = 170; + + CursorTy writetag_5133 = loc_2991 + 1; + + *(IntTy *) writetag_5133 = size_dcon_2790; + + CursorTy writecur_5134 = writetag_5133 + sizeof(IntTy); + + *(IntTy *) writecur_5134 = offset__2788; + + CursorTy writecur_5135 = writecur_5134 + sizeof(IntTy); + + *(IntTy *) writecur_5135 = offset__2789; + + CursorTy writecur_5136 = writecur_5135 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7621, pvrtmp_7622, + loc_2991, pvrtmp_7624}; + break; + } + + case 7: + { + CursorCursorCursorCursorProd tmp_struct_208 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3899, tmpcur_7476); + CursorTy pvrtmp_7633 = tmp_struct_208.field0; + CursorTy pvrtmp_7634 = tmp_struct_208.field1; + CursorTy pvrtmp_7635 = tmp_struct_208.field2; + CursorTy pvrtmp_7636 = tmp_struct_208.field3; + CursorCursorCursorCursorProd tmp_struct_209 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7633, pvrtmp_7636, pvrtmp_7634); + CursorTy pvrtmp_7641 = tmp_struct_209.field0; + CursorTy pvrtmp_7642 = tmp_struct_209.field1; + CursorTy pvrtmp_7643 = tmp_struct_209.field2; + CursorTy pvrtmp_7644 = tmp_struct_209.field3; + CursorCursorCursorCursorProd tmp_struct_210 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7641, pvrtmp_7644, pvrtmp_7642); + CursorTy pvrtmp_7649 = tmp_struct_210.field0; + CursorTy pvrtmp_7650 = tmp_struct_210.field1; + CursorTy pvrtmp_7651 = tmp_struct_210.field2; + CursorTy pvrtmp_7652 = tmp_struct_210.field3; + IntTy sizeof_y_2794__2797 = pvrtmp_7636 - pvrtmp_7635; + IntTy sizeof_y_2795__2798 = pvrtmp_7644 - pvrtmp_7643; + IntTy sizeof_y_2796__2799 = pvrtmp_7652 - pvrtmp_7651; + IntTy fltPrm_2840 = sizeof_y_2794__2797 + 0; + IntTy offset__2800 = 8 + fltPrm_2840; + IntTy fltPrm_2841 = sizeof_y_2794__2797 + sizeof_y_2795__2798; + IntTy offset__2801 = 0 + fltPrm_2841; + IntTy fltPrm_2843 = sizeof_y_2795__2798 + sizeof_y_2796__2799; + IntTy fltPrm_2842 = sizeof_y_2794__2797 + fltPrm_2843; + IntTy size_dcon_2802 = 17 + fltPrm_2842; + + *(TagTyPacked *) loc_2991 = 172; + + CursorTy writetag_5145 = loc_2991 + 1; + + *(IntTy *) writetag_5145 = size_dcon_2802; + + CursorTy writecur_5146 = writetag_5145 + sizeof(IntTy); + + *(IntTy *) writecur_5146 = offset__2800; + + CursorTy writecur_5147 = writecur_5146 + sizeof(IntTy); + + *(IntTy *) writecur_5147 = offset__2801; + + CursorTy writecur_5148 = writecur_5147 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7649, pvrtmp_7650, + loc_2991, pvrtmp_7652}; + break; + } + + case 8: + { + CursorCursorCursorCursorProd tmp_struct_211 = + _add_size_and_rel_offsets_Content(end_r_2992, end_r_2993, loc_3926, tmpcur_7476); + CursorTy pvrtmp_7661 = tmp_struct_211.field0; + CursorTy pvrtmp_7662 = tmp_struct_211.field1; + CursorTy pvrtmp_7663 = tmp_struct_211.field2; + CursorTy pvrtmp_7664 = tmp_struct_211.field3; + CursorCursorCursorCursorProd tmp_struct_212 = + _add_size_and_rel_offsets_Adt(end_r_2992, pvrtmp_7661, pvrtmp_7664, pvrtmp_7662); + CursorTy pvrtmp_7669 = tmp_struct_212.field0; + CursorTy pvrtmp_7670 = tmp_struct_212.field1; + CursorTy pvrtmp_7671 = tmp_struct_212.field2; + CursorTy pvrtmp_7672 = tmp_struct_212.field3; + CursorCursorCursorCursorProd tmp_struct_213 = + _add_size_and_rel_offsets_Tags(end_r_2992, pvrtmp_7669, pvrtmp_7672, pvrtmp_7670); + CursorTy pvrtmp_7677 = tmp_struct_213.field0; + CursorTy pvrtmp_7678 = tmp_struct_213.field1; + CursorTy pvrtmp_7679 = tmp_struct_213.field2; + CursorTy pvrtmp_7680 = tmp_struct_213.field3; + IntTy sizeof_y_2806__2809 = pvrtmp_7664 - pvrtmp_7663; + IntTy sizeof_y_2807__2810 = pvrtmp_7672 - pvrtmp_7671; + IntTy sizeof_y_2808__2811 = pvrtmp_7680 - pvrtmp_7679; + IntTy fltPrm_2844 = sizeof_y_2806__2809 + 0; + IntTy offset__2812 = 8 + fltPrm_2844; + IntTy fltPrm_2845 = sizeof_y_2806__2809 + sizeof_y_2807__2810; + IntTy offset__2813 = 0 + fltPrm_2845; + IntTy fltPrm_2847 = sizeof_y_2807__2810 + sizeof_y_2808__2811; + IntTy fltPrm_2846 = sizeof_y_2806__2809 + fltPrm_2847; + IntTy size_dcon_2814 = 17 + fltPrm_2846; + + *(TagTyPacked *) loc_2991 = 174; + + CursorTy writetag_5157 = loc_2991 + 1; + + *(IntTy *) writetag_5157 = size_dcon_2814; + + CursorTy writecur_5158 = writetag_5157 + sizeof(IntTy); + + *(IntTy *) writecur_5158 = offset__2812; + + CursorTy writecur_5159 = writecur_5158 + sizeof(IntTy); + + *(IntTy *) writecur_5159 = offset__2813; + + CursorTy writecur_5160 = writecur_5159 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7677, pvrtmp_7678, + loc_2991, pvrtmp_7680}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7689 = *(CursorTy *) tmpcur_7476; + CursorTy tmpaftercur_7690 = tmpcur_7476 + 8; + CursorTy jump_4386 = tmpcur_7476 + 8; + CursorCursorCursorCursorProd tmp_struct_214 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_2991, tmpcur_7689); + CursorTy pvrtmp_7691 = tmp_struct_214.field0; + CursorTy pvrtmp_7692 = tmp_struct_214.field1; + CursorTy pvrtmp_7693 = tmp_struct_214.field2; + CursorTy pvrtmp_7694 = tmp_struct_214.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7691, jump_4386, + pvrtmp_7693, pvrtmp_7694}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7701 = *(CursorTy *) tmpcur_7476; + CursorTy tmpaftercur_7702 = tmpcur_7476 + 8; + CursorCursorCursorCursorProd tmp_struct_215 = + _add_size_and_rel_offsets_Adt(end_r_2992, end_r_2993, loc_2991, tmpcur_7701); + CursorTy pvrtmp_7703 = tmp_struct_215.field0; + CursorTy pvrtmp_7704 = tmp_struct_215.field1; + CursorTy pvrtmp_7705 = tmp_struct_215.field2; + CursorTy pvrtmp_7706 = tmp_struct_215.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7703, pvrtmp_7704, + pvrtmp_7705, pvrtmp_7706}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7475"); + exit(1); + } + } +} +CursorCursorCursorCursorProd _add_size_and_rel_offsets_Tags(CursorTy end_r_2996, + CursorTy end_r_2997, + CursorTy loc_2995, + CursorTy arg_2815) +{ + if (loc_2995 + 32 > end_r_2997) { + ChunkTy new_chunk_222 = alloc_chunk(end_r_2997); + CursorTy chunk_start_223 = new_chunk_222.chunk_start; + CursorTy chunk_end_224 = new_chunk_222.chunk_end; + + end_r_2997 = chunk_end_224; + *(TagTyPacked *) loc_2995 = 255; + + CursorTy redir = loc_2995 + 1; + + *(CursorTy *) redir = chunk_start_223; + loc_2995 = chunk_start_223; + } + + CursorTy loc_3946 = loc_2995 + 1; + CursorTy loc_3947 = loc_3946 + 8; + TagTyPacked tmpval_7714 = *(TagTyPacked *) arg_2815; + CursorTy tmpcur_7715 = arg_2815 + 1; + + + switch_7758: + ; + switch (tmpval_7714) { + + case 0: + { + CursorTy jump_4254 = arg_2815 + 1; + + *(TagTyPacked *) loc_2995 = 0; + + CursorTy writetag_5172 = loc_2995 + 1; + + return (CursorCursorCursorCursorProd) {end_r_2997, jump_4254, + loc_2995, writetag_5172}; + break; + } + + case 1: + { + IntTy tmpval_7720 = *(IntTy *) tmpcur_7715; + CursorTy tmpcur_7721 = tmpcur_7715 + sizeof(IntTy); + CursorTy jump_4256 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_219 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_3947, tmpcur_7721); + CursorTy pvrtmp_7722 = tmp_struct_219.field0; + CursorTy pvrtmp_7723 = tmp_struct_219.field1; + CursorTy pvrtmp_7724 = tmp_struct_219.field2; + CursorTy pvrtmp_7725 = tmp_struct_219.field3; + + *(TagTyPacked *) loc_2995 = 1; + + CursorTy writetag_5177 = loc_2995 + 1; + + *(IntTy *) writetag_5177 = tmpval_7720; + + CursorTy writecur_5178 = writetag_5177 + sizeof(IntTy); + + return (CursorCursorCursorCursorProd) {pvrtmp_7722, pvrtmp_7723, + loc_2995, pvrtmp_7725}; + break; + } + + case INDIRECTION_TAG: + { + CursorTy tmpcur_7734 = *(CursorTy *) tmpcur_7715; + CursorTy tmpaftercur_7735 = tmpcur_7715 + 8; + CursorTy jump_4392 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_220 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_2995, tmpcur_7734); + CursorTy pvrtmp_7736 = tmp_struct_220.field0; + CursorTy pvrtmp_7737 = tmp_struct_220.field1; + CursorTy pvrtmp_7738 = tmp_struct_220.field2; + CursorTy pvrtmp_7739 = tmp_struct_220.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7736, jump_4392, + pvrtmp_7738, pvrtmp_7739}; + break; + } + + case REDIRECTION_TAG: + { + CursorTy tmpcur_7746 = *(CursorTy *) tmpcur_7715; + CursorTy tmpaftercur_7747 = tmpcur_7715 + 8; + CursorCursorCursorCursorProd tmp_struct_221 = + _add_size_and_rel_offsets_Tags(end_r_2996, end_r_2997, loc_2995, tmpcur_7746); + CursorTy pvrtmp_7748 = tmp_struct_221.field0; + CursorTy pvrtmp_7749 = tmp_struct_221.field1; + CursorTy pvrtmp_7750 = tmp_struct_221.field2; + CursorTy pvrtmp_7751 = tmp_struct_221.field3; + + return (CursorCursorCursorCursorProd) {pvrtmp_7748, pvrtmp_7749, + pvrtmp_7750, pvrtmp_7751}; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tmpval_7714"); + exit(1); + } + } +} +int __main_expr() +{ + add_symbol(6154, ")"); + add_symbol(6155, "(Text "); + add_symbol(6156, "(Tag "); + add_symbol(6157, "(TCA "); + add_symbol(6158, "(TAC "); + add_symbol(6159, "(Nul "); + add_symbol(6160, "(Nil "); + add_symbol(6161, "(Image "); + add_symbol(6162, "(End "); + add_symbol(6163, "(Char "); + add_symbol(6164, "(CTA "); + add_symbol(6165, "(CAT "); + add_symbol(6166, "(CA "); + add_symbol(6167, "(ATC "); + add_symbol(6168, "(ACT "); + add_symbol(6169, "(AC "); + add_symbol(6170, " ->r "); + add_symbol(6171, " ->i "); + + RegionTy *region_6172 = alloc_region(global_init_inf_buf_size); + CursorTy r_3007 = region_6172->reg_heap; + IntTy sizeof_end_r_3007_6173 = global_init_inf_buf_size; + CursorTy end_r_3007 = r_3007 + sizeof_end_r_3007_6173; + RegionTy *region_6174 = alloc_region(global_init_inf_buf_size); + CursorTy r_3006 = region_6174->reg_heap; + IntTy sizeof_end_r_3006_6175 = global_init_inf_buf_size; + CursorTy end_r_3006 = r_3006 + sizeof_end_r_3006_6175; + CursorCursorCursorProd tmp_struct_225 = + mkTCAList(end_r_3007, r_3007, 100000, 10, 2000); + CursorTy pvrtmp_6176 = tmp_struct_225.field0; + CursorTy pvrtmp_6177 = tmp_struct_225.field1; + CursorTy pvrtmp_6178 = tmp_struct_225.field2; + CursorTy pvrtmp_6192; + CursorTy pvrtmp_6193; + CursorTy pvrtmp_6194; + VectorTy *times_230 = vector_alloc(global_iters_param, sizeof(double)); + struct timespec begin_pvrtmp_6192; + struct timespec end_pvrtmp_6192; + + start_counters(); + for (long long iters_pvrtmp_6192 = 0; iters_pvrtmp_6192 < + global_iters_param; iters_pvrtmp_6192++) { + if (iters_pvrtmp_6192 != global_iters_param - 1) + save_alloc_state(); + clock_gettime(CLOCK_MONOTONIC_RAW, &begin_pvrtmp_6192); + + CursorCursorCursorProd tmp_struct_226 = + addValTagsAdt(pvrtmp_6176, end_r_3006, r_3006, pvrtmp_6177); + CursorTy pvrtmp_6183 = tmp_struct_226.field0; + CursorTy pvrtmp_6184 = tmp_struct_226.field1; + CursorTy pvrtmp_6185 = tmp_struct_226.field2; + + pvrtmp_6192 = pvrtmp_6183; + pvrtmp_6193 = pvrtmp_6184; + pvrtmp_6194 = pvrtmp_6185; + clock_gettime(CLOCK_MONOTONIC_RAW, &end_pvrtmp_6192); + if (iters_pvrtmp_6192 != global_iters_param - 1) + restore_alloc_state(); + + double itertime_227 = difftimespecs(&begin_pvrtmp_6192, + &end_pvrtmp_6192); + + vector_inplace_update(times_230, iters_pvrtmp_6192, &itertime_227); + } + read_counters(); + print_counters(); + vector_inplace_sort(times_230, compare_doubles); + + double *tmp_231 = (double *) vector_nth(times_230, global_iters_param / 2); + double selftimed_229 = *tmp_231; + double batchtime_228 = sum_timing_array(times_230); + + print_timing_array(times_230); + printf("ITERS: %lld\n", global_iters_param); + printf("SIZE: %lld\n", global_size_param); + printf("BATCHTIME: %e\n", batchtime_228); + printf("SELFTIMED: %e\n", selftimed_229); + printf("'#()"); + printf("\n"); + free_symtable(); + return 0; +} diff --git a/gibbon-compiler/examples/layout_benchmarks/calcAdtLengthAc.hs b/gibbon-compiler/examples/layout_benchmarks/calcAdtLengthAc.hs new file mode 100644 index 000000000..493f6c20d --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/calcAdtLengthAc.hs @@ -0,0 +1,38 @@ +module Main where + +import Strings +import Contents +import Adts + +-- Recursive function to get length +getLength :: Adt -> Int +getLength adt = case adt of + Nil -> 0 + AC next content -> 1 + getLength next + + +-- Tail recursice function to get length, using the tail recursice version +getLengthTR :: Adt -> Int -> Int +getLengthTR adt accumulator = case adt of + Nil -> accumulator + AC next content -> getLengthTR next (1+accumulator) + + + +-- This is an example testing the performance of the AC style layout +-- AC -> next Adt first, Content comes after the Adt +-- This example simply counts the length of this Abstract Data type +-- The Adt layout AC is theoretically suppoed to be faster since that layout will traverse a much smaller part of the list. It only needs to keep traversing next until it hits Nil. +-- At which point it can termintate and not traverse the content part. + +gibbon_main = + let ac = mkACList 1000000 100 + --_ = printAdt ac + --_ = printsym (quote "NEWLINE") + _ = printsym (quote "Time for Adt: AC") + _ = printsym (quote "NEWLINE") + count1 = iterate (getLengthTR ac 0) + _ = printsym (quote "Count of Adt AC is: ") + _ = printint count1 + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/calcAdtLengthCa.hs b/gibbon-compiler/examples/layout_benchmarks/calcAdtLengthCa.hs new file mode 100644 index 000000000..4435ae0cc --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/calcAdtLengthCa.hs @@ -0,0 +1,37 @@ +module Main where + +import Strings +import Contents +import Adts + +-- Recursive function to get length +getLength :: Adt -> Int +getLength adt = case adt of + Nil -> 0 + CA content next -> 1 + getLength next + + +-- Tail recursice function to get length, using the tail recursice version +getLengthTR :: Adt -> Int -> Int +getLengthTR adt accumulator = case adt of + Nil -> accumulator + CA content next -> getLengthTR next (1+accumulator) + + + +-- This is an example testing the performance of the CA layout +-- CA -> Content comes first, next Adt comes after the content +-- This example counts the length of the CA abstract data type +-- The Adt layout CA is supposed to have a slower performence since it has to chase pointers to the next Adt to skip the content and traverse the complete list to get to Nil + +gibbon_main = + let ca = mkCAList 1000000 100 + --_ = printAdt ca + --_ = printsym (quote "NEWLINE") + _ = printsym (quote "Time for Adt: CA") + _ = printsym (quote "NEWLINE") + count2 = iterate (getLengthTR ca 0) + _ = printsym (quote "Count of Adt CA is: ") + _ = printint count2 + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtContentAC.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtContentAC.hs new file mode 100644 index 000000000..618359e9d --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtContentAC.hs @@ -0,0 +1,42 @@ +module Main where + +import Strings +import Contents +import Adts + +processAdt :: Adt -> Adt +processAdt adt = case adt of + Nil -> Nil + AC rst content -> let newContent = processContent content + newRst = processAdt rst + in AC newRst (copyPacked newContent) + + +--loop :: Adt -> Int -> Adt +--loop adtIn iters = if (iters <= 0) +-- then adtIn +-- else let newAdt = processAdt adtIn +-- in loop adtIn (iters-1) + +--processAdtTR :: Adt -> Adt -> Adt +--processAdtTR adt accumulator = case adt of +-- Nil -> accumulator +-- AC rst content -> +-- let newContent = processContent content +-- append = AC accumulator newContent +-- in processAdtTR rst append + +gibbon_main = + let ac = mkACList 3000000 10 + -- _ = printsym (quote "AC Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked ac + -- _ = printsym (quote "NEWLINE") + -- _ = printsym (quote "CA Adt Time to process content: ") + -- _ = printsym (quote "NEWLINE") + ac_new = iterate (processAdt ac) + -- _ = printsym (quote "New AC Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked ac_new + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtContentCA.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtContentCA.hs new file mode 100644 index 000000000..8d608b9ad --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtContentCA.hs @@ -0,0 +1,47 @@ +module Main where + +import Strings +import Contents +import Adts + +processAdt :: Adt -> Adt +processAdt adt = case adt of + Nil -> Nil + CA content rst -> + let newContent = processContent content + newRst = processAdt rst + in CA newContent newRst + + +--processAdtTR :: Adt -> Adt -> Adt +--processAdtTR adt accumulator = case adt of +-- Nil -> accumulator +-- CA content rst -> +-- let newContent = processContent content +-- append = CA newContent accumulator +-- in processAdtTR rst append + +--loop :: Adt -> Int -> Adt +--loop adtIn iters = if (iters <= 0) +-- then adtIn +-- else let newAdt = processAdt adtIn +-- in loop adtIn (iters-1) + + + + +gibbon_main = + let len_list = 3000000 + len_string = 10 + ca = mkCAList len_list len_string + -- _ = printsym (quote "CA Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printAdt ca + -- _ = printsym (quote "NEWLINE") + ca_new = iterate (processAdt ca) + -- _ = printsym (quote "New CA Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printAdt ca_new + -- _ = printsym (quote "NEWLINE") + + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAct.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAct.hs new file mode 100644 index 000000000..4d947e1c2 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAct.hs @@ -0,0 +1,44 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- ACT rst content tags -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then ACT newRst ( copyPacked content) tags else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + ACT rst content tags -> let newTags = addValTag tags 10 + newRst = addValTagsAdt rst + in ACT newRst ( copyPacked content) ( copyPacked newTags) + + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let act = mkACTList 100000 10 2000 + -- _ = printsym (quote "ACT Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked act + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_act = iterate (searchTagsAdt act tag) + -- _ = printsym (quote "ACT Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_act + -- _ = printsym (quote "NEWLINE") + -- _ = printsym (quote "==============================================================================================================================") + -- _ = printsym (quote "NEWLINE") + add_act = iterate (addValTagsAdt act) + -- _ = printsym (quote "ACT Adt after add tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_act + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAct2.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAct2.hs new file mode 100644 index 000000000..5c51b952a --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAct2.hs @@ -0,0 +1,44 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- ACT rst content tags -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then ACT newRst ( copyPacked content) tags else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + ACT rst content tags -> let newRst = addValTagsAdt rst + newTags = addValTag tags 10 + in ACT newRst (copyPacked content) (copyPacked newTags) + + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let act = mkACTList 100000 10 2000 + -- _ = printsym (quote "ACT Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked act + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_act = iterate (searchTagsAdt act tag) + -- _ = printsym (quote "ACT Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_act + -- _ = printsym (quote "NEWLINE") + -- _ = printsym (quote "==============================================================================================================================") + -- _ = printsym (quote "NEWLINE") + add_act = iterate (addValTagsAdt act) + -- _ = printsym (quote "ACT Adt after add tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_act + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAtc.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAtc.hs new file mode 100644 index 000000000..ac3692105 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAtc.hs @@ -0,0 +1,45 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- ATC rst tags content -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then ATC newRst ( copyPacked tags ) content else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + ATC rst tags content -> let newTags = addValTag tags 10 + newRst = addValTagsAdt rst + in ATC newRst ( copyPacked newTags ) content + + + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let atc = mkATCList 100000 10 2000 + -- _ = printsym (quote "ATC Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked atc + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_atc = iterate (searchTagsAdt atc tag) + -- _ = printsym (quote "ATC Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_atc + -- _ = printsym (quote "NEWLINE") + -- _ = printsym (quote "==============================================================================================================================") + -- _ = printsym (quote "NEWLINE") + add_atc = iterate (addValTagsAdt atc) + -- _ = printsym (quote "ATC Adt after add tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_atc + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAtc2.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAtc2.hs new file mode 100644 index 000000000..cea6c6305 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsAtc2.hs @@ -0,0 +1,45 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- ATC rst tags content -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then ATC newRst ( copyPacked tags ) content else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + ATC rst tags content -> let newRst = addValTagsAdt rst + newTags = addValTag tags 10 + in ATC newRst (newTags) content + + + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let atc = mkATCList 100000 10 2000 + -- _ = printsym (quote "ATC Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked atc + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_atc = iterate (searchTagsAdt atc tag) + -- _ = printsym (quote "ATC Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_atc + -- _ = printsym (quote "NEWLINE") + -- _ = printsym (quote "==============================================================================================================================") + -- _ = printsym (quote "NEWLINE") + add_atc = iterate (addValTagsAdt atc) + -- _ = printsym (quote "ATC Adt after add tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_atc + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCat.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCat.hs new file mode 100644 index 000000000..2460dd313 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCat.hs @@ -0,0 +1,43 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- CAT content rst tags -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then CAT content newRst tags else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + CAT content rst tags -> let newTags = addValTag tags 10 + newRst = addValTagsAdt rst + in CAT content newRst ( copyPacked newTags) + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let cat = mkCATList 100000 10 2000 + -- _ = printsym (quote "CAT Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked cat + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_cat = iterate (searchTagsAdt cat tag) + -- _ = printsym (quote "CAT Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_cat + -- _ = printsym (quote "NEWLINE") + -- _ = printsym (quote "==============================================================================================================================") + -- _ = printsym (quote "NEWLINE") + add_cat = iterate (addValTagsAdt cat) + -- _ = printsym (quote "CAT Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_cat + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCat2.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCat2.hs new file mode 100644 index 000000000..ce9d920ba --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCat2.hs @@ -0,0 +1,43 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- CAT content rst tags -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then CAT content newRst tags else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + CAT content rst tags -> let newRst = addValTagsAdt rst + newTags = addValTag tags 10 + in CAT content newRst (newTags) + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let cat = mkCATList 100000 10 2000 + -- _ = printsym (quote "CAT Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked cat + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_cat = iterate (searchTagsAdt cat tag) + -- _ = printsym (quote "CAT Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_cat + -- _ = printsym (quote "NEWLINE") + -- _ = printsym (quote "==============================================================================================================================") + -- _ = printsym (quote "NEWLINE") + add_cat = iterate (addValTagsAdt cat) + -- _ = printsym (quote "CAT Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_cat + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCta.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCta.hs new file mode 100644 index 000000000..2bbd2706a --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCta.hs @@ -0,0 +1,63 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- CTA content tags rst -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then CTA content tags newRst else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + CTA content tags rst -> let newTags = addValTag tags 10 + newRst = addValTagsAdt rst + in CTA content newTags newRst + +{- +sumTagsAdt :: Adt -> Tags -> Adt +sumTagsAdt adt tag = case adt of + Nil -> Nil + TCA tags content rst -> let present = searchTag tag tags + newRst = searchTagsAdt rst tag + in if (present) then TCA tags content newRst else newRst + ACT rst content tags -> let present = searchTag tag tags + newRst = searchTagsAdt rst tag + in if (present) then ACT newRst content tags else newRst + TAC tags rst content -> let present = searchTag tag tags + newRst = searchTagsAdt rst tag + in if (present) then TAC tags newRst content else newRst + ATC rst tags content -> let present = searchTag tag tags + newRst = searchTagsAdt rst tag + in if (present) then ATC newRst tags content else newRst + CTA content tags rst -> let present = searchTag tag tags + newRst = searchTagsAdt rst tag + in if (present) then CTA content tags newRst else newRst-} + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let cta = mkCTAList 100000 10 2000 + -- _ = printsym (quote "CTA Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked cta + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_cta = iterate (searchTagsAdt cta tag) + -- _ = printsym (quote "CTA Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_cta + -- _ = printsym (quote "NEWLINE") + --_ = printsym (quote "==============================================================================================================================") + --_ = printsym (quote "NEWLINE") + add_cta = iterate (addValTagsAdt cta) + -- _ = printsym (quote "CTA Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_cta + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCta2.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCta2.hs new file mode 100644 index 000000000..0216b4f64 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsCta2.hs @@ -0,0 +1,63 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- CTA content tags rst -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then CTA content tags newRst else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + CTA content tags rst -> let newRst = addValTagsAdt rst + newTags = addValTag tags 10 + in CTA content (newTags) (copyPacked newRst) + +{- +sumTagsAdt :: Adt -> Tags -> Adt +sumTagsAdt adt tag = case adt of + Nil -> Nil + TCA tags content rst -> let present = searchTag tag tags + newRst = searchTagsAdt rst tag + in if (present) then TCA tags content newRst else newRst + ACT rst content tags -> let present = searchTag tag tags + newRst = searchTagsAdt rst tag + in if (present) then ACT newRst content tags else newRst + TAC tags rst content -> let present = searchTag tag tags + newRst = searchTagsAdt rst tag + in if (present) then TAC tags newRst content else newRst + ATC rst tags content -> let present = searchTag tag tags + newRst = searchTagsAdt rst tag + in if (present) then ATC newRst tags content else newRst + CTA content tags rst -> let present = searchTag tag tags + newRst = searchTagsAdt rst tag + in if (present) then CTA content tags newRst else newRst-} + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let cta = mkCTAList 100000 10 2000 + -- _ = printsym (quote "CTA Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked cta + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_cta = iterate (searchTagsAdt cta tag) + -- _ = printsym (quote "CTA Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_cta + -- _ = printsym (quote "NEWLINE") + --_ = printsym (quote "==============================================================================================================================") + --_ = printsym (quote "NEWLINE") + add_cta = iterate (addValTagsAdt cta) + -- _ = printsym (quote "CTA Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_cta + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTac.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTac.hs new file mode 100644 index 000000000..b8103a330 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTac.hs @@ -0,0 +1,43 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- TAC tags rst content -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then TAC tags newRst content else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + TAC tags rst content -> let newTags = addValTag tags 10 + newRst = addValTagsAdt rst + in TAC newTags newRst content + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let tac = mkTACList 100000 10 2000 + -- _ = printsym (quote "TAC Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked tac + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_tac = iterate (searchTagsAdt tac tag) + -- _ = printsym (quote "TAC Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_tac + -- _ = printsym (quote "NEWLINE") + --_ = printsym (quote "==============================================================================================================================") + --_ = printsym (quote "NEWLINE") + add_tac = iterate (addValTagsAdt tac) + -- _ = printsym (quote "TAC Adt after add tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_tac + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTac2.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTac2.hs new file mode 100644 index 000000000..58b8ddce6 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTac2.hs @@ -0,0 +1,43 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- TAC tags rst content -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then TAC tags newRst content else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + TAC tags rst content -> let newRst = addValTagsAdt rst + newTags = addValTag tags 10 + in TAC newTags (copyPacked newRst) content + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let tac = mkTACList 100000 10 2000 + -- _ = printsym (quote "TAC Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked tac + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_tac = iterate (searchTagsAdt tac tag) + -- _ = printsym (quote "TAC Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_tac + -- _ = printsym (quote "NEWLINE") + --_ = printsym (quote "==============================================================================================================================") + --_ = printsym (quote "NEWLINE") + add_tac = iterate (addValTagsAdt tac) + -- _ = printsym (quote "TAC Adt after add tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_tac + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTca.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTca.hs new file mode 100644 index 000000000..672f0f073 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTca.hs @@ -0,0 +1,43 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- TCA tags content rst -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then TCA tags content newRst else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + TCA tags content rst -> let newTags = addValTag tags 10 + newRst = addValTagsAdt rst + in TCA newTags ( copyPacked content) ( copyPacked newRst) + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let tca = mkTCAList 100000 10 2000 + -- _ = printsym (quote "TCA Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked tca + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_tca = iterate (searchTagsAdt tca tag) + -- _ = printsym (quote "TCA Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_tca + -- _ = printsym (quote "NEWLINE") + -- _ = printsym (quote "==============================================================================================================================") + -- _ = printsym (quote "NEWLINE") + add_tca = iterate (addValTagsAdt tca) + -- _ = printsym (quote "TCA Adt after add tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_tca + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTca2.hs b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTca2.hs new file mode 100644 index 000000000..fcc07dfbc --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/processAdtTagsTca2.hs @@ -0,0 +1,43 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- searchTagsAdt :: Adt -> Tags -> Adt +-- searchTagsAdt adt tag = case adt of +-- Nil -> Nil +-- TCA tags content rst -> let present = searchTag tag tags +-- newRst = searchTagsAdt rst tag +-- in if (present) then TCA tags content newRst else newRst + + +addValTagsAdt :: Adt -> Adt +addValTagsAdt adt = case adt of + Nil -> Nil + TCA tags content rst -> let newRst = addValTagsAdt rst + newTags = addValTag tags 10 + in TCA newTags ( copyPacked content) ( copyPacked newRst) + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let tca = mkTCAList 100000 10 2000 + -- _ = printsym (quote "TCA Adt: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked tca + -- _ = printsym (quote "NEWLINE") + --tag = Tag 1000000 Nul + --search_tca = iterate (searchTagsAdt tca tag) + -- _ = printsym (quote "TCA Adt after search tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked search_tca + -- _ = printsym (quote "NEWLINE") + -- _ = printsym (quote "==============================================================================================================================") + -- _ = printsym (quote "NEWLINE") + add_tca = iterate (addValTagsAdt tca) + -- _ = printsym (quote "TCA Adt after add tags: ") + -- _ = printsym (quote "NEWLINE") + -- _ = printPacked add_tca + -- _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/replicate_calculateBounds_bug.hs b/gibbon-compiler/examples/layout_benchmarks/replicate_calculateBounds_bug.hs new file mode 100644 index 000000000..95b318148 --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/replicate_calculateBounds_bug.hs @@ -0,0 +1,43 @@ +module Main where + +import Strings +import Contents +import Adts +import Tags + +-- Trigger the bug in the calculate bounds pass. +-- Error message: +-- recovertype/primapp: MkTrue [] +-- recovertype/primapp: MkFalse [] +-- gibbon: Map lookup failed on key: Var "cpy_3273" in map: +-- [] +-- CallStack (from HasCallStack): +-- error, called at src/Gibbon/Common.hs:289:7 in gibbon-0.2-inplace:Gibbon.Common +-- err, called at src/Gibbon/Common.hs:302:22 in gibbon-0.2-inplace:Gibbon.Common +-- #, called at src/Gibbon/Passes/CalculateBounds.hs:174:110 in gibbon-0.2-inplace:Gibbon.Passes.CalculateBounds +-- current work around is commenting out the this line else go "inferRegSize" inferRegSize l2 in Compiler.hs pass and replacing it with pure l2 +-- compiled via: gibbon --packed --no-gc --to-exe replicate_calculateBounds_bug.hs + +searchTagAdt :: Adt -> Tags -> Adt +searchTagAdt inList tag = case inList of + Nil -> Nil + TCA tags content rst -> let present = searchTag tag tags + newRst = searchTagAdt rst tag + in if (present) then TCA tags content newRst else newRst + TAC tags rst content -> let present = searchTag tag tags + newRst = searchTagAdt rst tag + in if (present) then TAC tags newRst content else newRst + ACT rst content tags -> let present = searchTag tag tags + newRst = searchTagAdt rst tag + in if (present) then ACT newRst content tags else newRst + ATC rst tags content -> let present = searchTag tag tags + newRst = searchTagAdt rst tag + in if (present) then ATC newRst tags content else newRst + + +-- mk for 3 parameter Adt take, len, tagLen, strLen +gibbon_main = + let act = mkACTList 100000 50 1000 + tag = Tag 1000000 Nul + add_act = iterate (searchTagAdt act tag) + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/replicate_copyPacked_bug.hs b/gibbon-compiler/examples/layout_benchmarks/replicate_copyPacked_bug.hs new file mode 100644 index 000000000..c8e2a56bf --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/replicate_copyPacked_bug.hs @@ -0,0 +1,43 @@ +module Main where + +import Strings +import Contents +import Adts + + +-- This program is for re-creating the copy packed bug. +-- processAdtCorrect genertes the correct file, but to do so we have to insert a copyPacked call at the front end which the compiler should ideally do automatically. +-- processAdtInCorrect is the same function but without the call to copyPacked. +-- The Adt is printed after every function call. +-- Compilation command used: gibbon --packed --no-gc --to-exe replicate_copyPacked_bug.hs +-- TODO: Paste C code to show what exactly is happening here. + +processAdtCorrect :: Adt -> Adt +processAdtCorrect adt = case adt of + Nil -> Nil + AC rst content -> let newContent = processContent content + newRst = processAdtCorrect rst + in AC newRst (copyPacked newContent) + +processAdtInCorrect :: Adt -> Adt +processAdtInCorrect adt = case adt of + Nil -> Nil + AC rst content -> let newContent = processContent content + newRst = processAdtCorrect rst + in AC newRst newContent + + +gibbon_main = + let ac = mkACList 3 5 + _ = printsym (quote "Printing the AC Adt right after constructing it\n") + _ = printPacked ac + _ = printsym (quote "NEWLINE") + ac_correct = processAdtCorrect ac + _ = printsym (quote "Print the new Adt after calling processAdtCorrect function\n") + _ = printPacked ac_correct + _ = printsym (quote "NEWLINE") + ac_incorrect = processAdtInCorrect ac + _ = printsym (quote "Printing the new Adt after calling processAdtInCorrect function\n") + _ = printPacked ac_incorrect + _ = printsym (quote "NEWLINE") + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/replicate_failing_gc.hs b/gibbon-compiler/examples/layout_benchmarks/replicate_failing_gc.hs new file mode 100644 index 000000000..b3ef5e80f --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/replicate_failing_gc.hs @@ -0,0 +1,28 @@ +module Main where + +import Strings +import Contents +import Adts + +-- When running the code, it segfaults in the free_region function. +-- Compile command -> gibbon --packed --to-exe replicate_failing_gc.hs +-- +-- GDB Backtrace +-- Program received signal SIGSEGV, Segmentation fault. +-- free_region (end_reg=end_reg@entry=0x555555562550 "\260 VUUU") at replicate_failing_gc.c:1011 +-- 1011 next_chunk = (char*) next_chunk_footer->rf_next; +-- (gdb) bt +-- #0 free_region (end_reg=end_reg@entry=0x555555562550 "\260 VUUU") at replicate_failing_gc.c:1011 +-- #1 0x000055555555b79a in __main_expr () at replicate_failing_gc.c:4371 +-- #2 0x00005555555554f4 in main (argc=1, argv=0x7fffffffdde8) at replicate_failing_gc.c:1443 + +getLength :: Adt -> Int +getLength adt = case adt of + Nil -> 0 + AC next content -> 1 + getLength next + + +gibbon_main = + let ac = mkACList 1000 100 + count1 = iterate (getLength ac) + in () diff --git a/gibbon-compiler/examples/layout_benchmarks/replicate_traverse_copyPacked_bug.hs b/gibbon-compiler/examples/layout_benchmarks/replicate_traverse_copyPacked_bug.hs new file mode 100644 index 000000000..8dc50b42e --- /dev/null +++ b/gibbon-compiler/examples/layout_benchmarks/replicate_traverse_copyPacked_bug.hs @@ -0,0 +1,29 @@ +module Main where + +import Strings +import Contents +import Adts + +-- This error occurs when you try to traverse the list make via the copy Packed call again. +-- The loop function below gets the newAdt which has indirection and redirection tags but when it tries to +-- re-run the processAdt function again it hits a null byte and exits with the messgage: "Unknown tag in: tmpval_6290" + +processAdt :: Adt -> Adt +processAdt adt = case adt of + Nil -> Nil + AC rst content -> let newContent = processContent content + newRst = processAdt rst + in AC newRst (copyPacked newContent) + + +loop :: Adt -> Int -> Adt +loop adtIn iters = if (iters <= 0) + then adtIn + else let newAdt = processAdt adtIn + in loop newAdt (iters-1) + + +gibbon_main = + let ac = mkACList 80000 100 + ac_new = iterate (loop ac 2) + in () diff --git a/gibbon-compiler/examples/test_printpacked.hs b/gibbon-compiler/examples/test_printpacked.hs index 76c83d778..a2a9b603e 100644 --- a/gibbon-compiler/examples/test_printpacked.hs +++ b/gibbon-compiler/examples/test_printpacked.hs @@ -8,7 +8,9 @@ rightmost :: Tree -> Int rightmost tr = case tr of Leaf i -> i - Node l r -> rightmost r + Node l r -> + -- let _ = travPacked l + rightmost r mkTree :: Int -> Tree mkTree i = diff --git a/gibbon-compiler/examples/test_scalar_after_packed.hs b/gibbon-compiler/examples/test_scalar_after_packed.hs new file mode 100644 index 000000000..fd8d067d9 --- /dev/null +++ b/gibbon-compiler/examples/test_scalar_after_packed.hs @@ -0,0 +1,8 @@ +module Main where + +data ScalarAfterPacked = A ScalarAfterPacked Int | Nil + + +gibbon_main = + let a = (A (A Nil 4) 4) + in printPacked a diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 910754f4e..560cb864a 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -386,6 +386,7 @@ compileRTS Config{verbosity,optc,dynflags} = do ++ (if pointer then " POINTER=1 " else "") ++ (if parallel then " PARALLEL=1 " else "") ++ (if bumpAlloc then " BUMPALLOC=1 " else "") + ++ (if papi then " PAPI=1 " else "") ++ (" USER_CFLAGS=\"" ++ optc ++ "\"") ++ (" VERBOSITY=" ++ show verbosity) execCmd @@ -401,6 +402,7 @@ compileRTS Config{verbosity,optc,dynflags} = do rts_debug = gopt Opt_RtsDebug dynflags print_gc_stats = gopt Opt_PrintGcStats dynflags genGC = gopt Opt_GenGc dynflags + papi = gopt Opt_PapiInstrumentation dynflags -- | Compile and run the generated code if appropriate @@ -435,6 +437,10 @@ compileAndRunExe cfg@Config{backend,arrayInput,benchInput,mode,cfile,exefile} fp links = if pointer then " -lgc -lm " else " -lm " + papi = gopt Opt_PapiInstrumentation (dynflags cfg) + links' = if papi + then links ++ "-l:libpapi.a " + else links compile_program = do compileRTS cfg lib_dir <- getRTSBuildDir @@ -445,7 +451,7 @@ compileAndRunExe cfg@Config{backend,arrayInput,benchInput,mode,cfile,exefile} fp ++" -L" ++ lib_dir ++ " -Wl,-rpath=" ++ lib_dir ++ " " ++ outfile ++ " " ++ rts_o_path - ++ links ++ " -lgibbon_rts_ng" + ++ links' ++ " -lgibbon_rts_ng" execCmd Nothing @@ -533,6 +539,7 @@ compilationCmd C config = (cc config) ++" -std=gnu11 " ++ (if not genGC then " -D_GIBBON_GENGC=0 " else " -D_GIBBON_GENGC=1 ") ++ (if simpleWriteBarrier then " -D_GIBBON_SIMPLE_WRITE_BARRIER=1 " else " -D_GIBBON_SIMPLE_WRITE_BARRIER=0 ") ++ (if lazyPromote then " -D_GIBBON_EAGER_PROMOTION=0 " else " -D_GIBBON_EAGER_PROMOTION=1 ") + ++ (if papi then " -D_GIBBON_ENABLE_PAPI " else "") where dflags = dynflags config bumpAlloc = gopt Opt_BumpAlloc dflags pointer = gopt Opt_Pointer dflags @@ -543,6 +550,7 @@ compilationCmd C config = (cc config) ++" -std=gnu11 " genGC = gopt Opt_GenGc dflags simpleWriteBarrier = gopt Opt_SimpleWriteBarrier dflags lazyPromote = gopt Opt_NoEagerPromote dflags + papi = gopt Opt_PapiInstrumentation dflags -- | isBench :: Mode -> Bool diff --git a/gibbon-compiler/src/Gibbon/DynFlags.hs b/gibbon-compiler/src/Gibbon/DynFlags.hs index f887db342..5bfc2c5e8 100644 --- a/gibbon-compiler/src/Gibbon/DynFlags.hs +++ b/gibbon-compiler/src/Gibbon/DynFlags.hs @@ -14,34 +14,36 @@ import Data.Set as S import Options.Applicative data GeneralFlag - = Opt_Gibbon1 -- ^ Set Opt_No_RemoveCopies & Opt_BigInfiniteRegions - | Opt_Gibbon2 -- ^ Set Opt_RemoveCopies & Opt_InfiniteRegions - | Opt_RemoveCopies -- ^ Calls to copy functions are converted to indirections - | Opt_No_RemoveCopies -- ^ Unset Opt_RemoveCopies - | Opt_InfiniteRegions -- ^ Use infinite regions - | Opt_BigInfiniteRegions -- ^ Use big infinite regions - | Opt_BenchPrint -- ^ Should the benchamrked function have its output printed? - | Opt_Packed -- ^ Use packed representation - | Opt_Pointer -- ^ Use pointer representation - | Opt_BumpAlloc -- ^ Use bump-pointer allocation if using the non-packed backend - | Opt_Warnc -- ^ Show warnings from the C compiler - | Opt_DisableGC -- ^ Don't run the the garbage collector (used by Codegen). - | Opt_No_PureAnnot -- ^ Don't use 'pure' annotations (a GCC optimization) - | Opt_Fusion -- ^ Enable fusion. - | Opt_Parallel -- ^ Fork/join parallelism. - | Opt_RegionOnSpawn -- ^ Allocate into fresh regions for every spawn, not steal. - | Opt_GhcTc -- ^ Typecheck with GHC before compiling with Gibbon. - | Opt_RelativeOffsets -- ^ Enable relative offsets. - | Opt_CountParRegions -- ^ Count and print the number of regions allocated for parallelism. - | Opt_CountAllRegions -- ^ Count and print the number of all the regions allocated. - | Opt_RtsDebug -- ^ Compile the RTS in debugging mode. - | Opt_PrintGcStats -- ^ Record and print GC statistics. - | Opt_GenGc -- ^ Use the new non-generational GC. - | Opt_NoEagerPromote -- ^ Disable eager promotion. - | Opt_SimpleWriteBarrier -- ^ Disables eliminate-indirection-chains optimization. - | Opt_Layout_Local -- ^ Optimize the layout of Algebraic data types locally - | Opt_Layout_Global -- ^ Optimize the layout of Algebraic data types globally - | Opt_Layout_Use_Solver -- ^ Use the Solver to optimize the layout of the data types. + = Opt_Gibbon1 -- ^ Set Opt_No_RemoveCopies & Opt_BigInfiniteRegions + | Opt_Gibbon2 -- ^ Set Opt_RemoveCopies & Opt_InfiniteRegions + | Opt_RemoveCopies -- ^ Calls to copy functions are converted to indirections + | Opt_No_RemoveCopies -- ^ Unset Opt_RemoveCopies + | Opt_InfiniteRegions -- ^ Use infinite regions + | Opt_BigInfiniteRegions -- ^ Use big infinite regions + | Opt_BenchPrint -- ^ Should the benchamrked function have its output printed? + | Opt_Packed -- ^ Use packed representation + | Opt_Pointer -- ^ Use pointer representation + | Opt_BumpAlloc -- ^ Use bump-pointer allocation if using the non-packed backend + | Opt_Warnc -- ^ Show warnings from the C compiler + | Opt_DisableGC -- ^ Don't run the the garbage collector (used by Codegen). + | Opt_No_PureAnnot -- ^ Don't use 'pure' annotations (a GCC optimization) + | Opt_Fusion -- ^ Enable fusion. + | Opt_Parallel -- ^ Fork/join parallelism. + | Opt_RegionOnSpawn -- ^ Allocate into fresh regions for every spawn, not steal. + | Opt_GhcTc -- ^ Typecheck with GHC before compiling with Gibbon. + | Opt_RelativeOffsets -- ^ Enable relative offsets. + | Opt_CountParRegions -- ^ Count and print the number of regions allocated for parallelism. + | Opt_CountAllRegions -- ^ Count and print the number of all the regions allocated. + | Opt_RtsDebug -- ^ Compile the RTS in debugging mode. + | Opt_PrintGcStats -- ^ Record and print GC statistics. + | Opt_GenGc -- ^ Use the new non-generational GC. + | Opt_NoEagerPromote -- ^ Disable eager promotion. + | Opt_SimpleWriteBarrier -- ^ Disables eliminate-indirection-chains optimization. + | Opt_Layout_Local -- ^ Optimize the layout of Algebraic data types locally + | Opt_Layout_Global -- ^ Optimize the layout of Algebraic data types globally + | Opt_Layout_Use_Solver -- ^ Use the Solver to optimize the layout of the data types. + | Opt_PapiInstrumentation -- ^ Enable PAPI instrumentation while compiling the gibbon binary. + deriving (Show,Read,Eq,Ord) -- | Exactly like GHC's ddump flags. @@ -120,7 +122,8 @@ dynflagsParser = DynFlags <$> (S.fromList <$> many gflagsParser) <*> (S.fromList flag' Opt_SimpleWriteBarrier (long "simple-write-barrier" <> help "Disables eliminate-indirection-chains optimization.") <|> flag' Opt_Layout_Local (long "opt-layout-local" <> help "Optimizes the Layout of Algebraic data types locally") <|> flag' Opt_Layout_Global (long "opt-layout-global" <> help "Optimizes the Layout of Algebraic data types globally") <|> - flag' Opt_Layout_Use_Solver (long "opt-layout-use-solver" <> help "Use the solver instead of a Greedy Heuristic") + flag' Opt_Layout_Use_Solver (long "opt-layout-use-solver" <> help "Use the solver instead of a Greedy Heuristic") <|> + flag' Opt_PapiInstrumentation (long "enable-papi" <> help "Enable instrumentation using papi, extends the iterate timing function." ) dflagsParser :: Parser DebugFlag diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 88a5730b0..577966097 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -199,8 +199,8 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports toplevels <- catMaybes <$> mapM (collectTopLevel type_syns funtys) decls let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels - userOrderings' = M.fromList $ coalese_constraints userOrderings - funs' = + userOrderings' = {-dbgTraceIt (sdoc userOrderings)-} M.fromList $ coalese_constraints userOrderings + funs' = {-dbgTraceIt (sdoc userOrderings')-} foldr (\v acc -> M.update @@ -1698,6 +1698,7 @@ collectTopLevel type_syns env decl = , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } }) @@ -1721,6 +1722,7 @@ collectTopLevel type_syns env decl = , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } }) FunBind {} -> do @@ -1740,6 +1742,7 @@ collectTopLevel type_syns env decl = , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } }) InlineSig _ _ _ qname -> @@ -1790,7 +1793,7 @@ collectTopLevel type_syns env decl = (M.singleton (toVar funcName) (M.singleton conName contrs)) - in pure $ + in {-(dbgTraceIt (show userConstrs))-} pure $ Just $ UserConstraints (M.singleton diff --git a/gibbon-compiler/src/Gibbon/L0/Specialize2.hs b/gibbon-compiler/src/Gibbon/L0/Specialize2.hs index c7108ad3e..51148a2d6 100644 --- a/gibbon-compiler/src/Gibbon/L0/Specialize2.hs +++ b/gibbon-compiler/src/Gibbon/L0/Specialize2.hs @@ -1158,6 +1158,7 @@ specLambdasExp ddefs env2 ex = , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } } env2' = extendFEnv v' ty' env2 @@ -1194,6 +1195,7 @@ specLambdasExp ddefs env2 ex = , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } } env2' = extendFEnv v' (ForAll [] ty) env2 @@ -1292,6 +1294,7 @@ specLambdasExp ddefs env2 ex = , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } } pure (Just fn, binds, AppE fnname [] (map VarE args)) @@ -1790,6 +1793,7 @@ genCopyFn DDef {tyName, dataCons} = do , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } } @@ -1835,6 +1839,7 @@ genCopySansPtrsFn DDef {tyName, dataCons} = do , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } } @@ -1875,6 +1880,7 @@ genTravFn DDef {tyName, dataCons} = do , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } } @@ -1992,6 +1998,7 @@ genPrintFn DDef {tyName, dataCons} = do , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } } @@ -2046,7 +2053,7 @@ floatOutCase (Prog ddefs fundefs mainExp) = do args fn_ty ex' - (FunMeta NotRec NoInline False NoLayoutOpt Nothing) + (FunMeta NotRec NoInline False NoLayoutOpt Nothing Nothing) state (\s -> ((AppE fn_name [] (map VarE free)), M.insert fn_name fn s)) go :: Bool -> Env2 Ty0 -> Exp0 -> FloatM Exp0 go float env2 ex = diff --git a/gibbon-compiler/src/Gibbon/L1/Examples.hs b/gibbon-compiler/src/Gibbon/L1/Examples.hs index a075acfb9..50a0c6425 100644 --- a/gibbon-compiler/src/Gibbon/L1/Examples.hs +++ b/gibbon-compiler/src/Gibbon/L1/Examples.hs @@ -31,7 +31,7 @@ mkAdd1Fun bod = ["tr"] ([treeTy], treeTy) bod - (FunMeta Rec NoInline False NoLayoutOpt Nothing) + (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) ---------------- @@ -102,7 +102,7 @@ add1ProgChallenge = [ ("Leaf", [("n", ())], PrimAppE MkTrue []) , ("Node", [("x", ()), ("y", ())], PrimAppE MkFalse []) ]) - (FunMeta Rec NoInline False NoLayoutOpt Nothing)) + (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing)) ]) Nothing where diff --git a/gibbon-compiler/src/Gibbon/L1/Typecheck.hs b/gibbon-compiler/src/Gibbon/L1/Typecheck.hs index 1d7e5639c..bba14668d 100644 --- a/gibbon-compiler/src/Gibbon/L1/Typecheck.hs +++ b/gibbon-compiler/src/Gibbon/L1/Typecheck.hs @@ -753,9 +753,9 @@ tcProg prg@Prog{ddefs,fundefs,mainExp} = do Just fp -> case scalars of [] -> return () _ -> if (last scalars) > fp - then error ("Gibbon-TODO: Constructor " ++ dcon ++ - " has a scalar field after a packed field which isn't" ++ - " allowed at the moment.") + then return () --error ("Gibbon-TODO: Constructor " ++ dcon ++ + -- " has a scalar field after a packed field which isn't" ++ + -- " allowed at the moment.") else return () diff --git a/gibbon-compiler/src/Gibbon/L2/Examples.hs b/gibbon-compiler/src/Gibbon/L2/Examples.hs index f6cc67762..a4d9f68b8 100644 --- a/gibbon-compiler/src/Gibbon/L2/Examples.hs +++ b/gibbon-compiler/src/Gibbon/L2/Examples.hs @@ -45,12 +45,12 @@ testTypeable = gRecoverType ddtree emptyEnv2 tTypeable -- Add1 add1TraversedFun :: FunDef2 -add1TraversedFun = FunDef "add1" ["tr1"] add1TraversedFunTy add1FunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +add1TraversedFun = FunDef "add1" ["tr1"] add1TraversedFunTy add1FunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where add1TraversedFunTy = add1FunTy { arrEffs = S.fromList [Traverse "lin2"] } add1Fun :: FunDef2 -add1Fun = FunDef "add1" ["tr1"] add1FunTy add1FunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +add1Fun = FunDef "add1" ["tr1"] add1FunTy add1FunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) add1FunTy :: ArrowTy2 Ty2 @@ -142,7 +142,7 @@ nodeProg = Prog ddtree M.empty (Just (nodeMainExp, PackedTy "Tree" "l156")) -------------------------------------------------------------------------------- id1Fun :: FunDef2 -id1Fun = FunDef "id1" ["tr18"] idFunTy idFunBod (FunMeta NotRec NoInline False NoLayoutOpt Nothing) +id1Fun = FunDef "id1" ["tr18"] idFunTy idFunBod (FunMeta NotRec NoInline False NoLayoutOpt Nothing Nothing) where idFunBod = VarE "tr18" @@ -162,7 +162,7 @@ id1Prog = Prog ddtree (M.fromList [("id1", id1Fun)]) Nothing -------------------------------------------------------------------------------- copyTreeFun :: FunDef2 -copyTreeFun = FunDef "copyTree" ["tr22"] copyFunTy copyBod (FunMeta NotRec NoInline False NoLayoutOpt Nothing) +copyTreeFun = FunDef "copyTree" ["tr22"] copyFunTy copyBod (FunMeta NotRec NoInline False NoLayoutOpt Nothing Nothing) where copyFunTy = ArrowTy2 [LRM "lin23" (VarR "r24") Input, LRM "lout25" (VarR "r752") Output] @@ -212,7 +212,7 @@ copyTreeProg = Prog ddtree (M.fromList [("copyTree", copyTreeFun)]) $ -------------------------------------------------------------------------------- id2Fun :: FunDef2 -id2Fun = FunDef "id2" ["tr41"] id2Ty id2Bod (FunMeta NotRec NoInline False NoLayoutOpt Nothing) +id2Fun = FunDef "id2" ["tr41"] id2Ty id2Bod (FunMeta NotRec NoInline False NoLayoutOpt Nothing Nothing) where id2Ty :: ArrowTy2 Ty2 id2Ty = ArrowTy2 @@ -264,7 +264,7 @@ id1WithCopyFun = id1Fun { funBody = AppE "copyTree" ["lin19","lout21"] -------------------------------------------------------------------------------- id3Fun :: FunDef2 -id3Fun = FunDef "id3" ["i42"] id3Ty id3Bod (FunMeta NotRec NoInline False NoLayoutOpt Nothing) +id3Fun = FunDef "id3" ["i42"] id3Ty id3Bod (FunMeta NotRec NoInline False NoLayoutOpt Nothing Nothing) where id3Ty :: ArrowTy2 Ty2 id3Ty = ArrowTy2 @@ -286,7 +286,7 @@ id3Prog = Prog ddtree (M.fromList [("id3", id3Fun)]) $ Just (id3MainExp, IntTy) -------------------------------------------------------------------------------- intAddFun :: FunDef2 -intAddFun = FunDef "intAdd" ["i109"] intAddTy id3Bod (FunMeta NotRec NoInline False NoLayoutOpt Nothing) +intAddFun = FunDef "intAdd" ["i109"] intAddTy id3Bod (FunMeta NotRec NoInline False NoLayoutOpt Nothing Nothing) where intAddTy :: ArrowTy2 Ty2 intAddTy = ArrowTy2 @@ -310,7 +310,7 @@ intAddProg = Prog M.empty (M.fromList [("intAdd", intAddFun)]) (Just (intAddMain -------------------------------------------------------------------------------- leftmostFun :: FunDef2 -leftmostFun = FunDef "leftmost" ["t111"] leftmostTy leftmostBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +leftmostFun = FunDef "leftmost" ["t111"] leftmostTy leftmostBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where leftmostTy :: ArrowTy2 Ty2 leftmostTy = ArrowTy2 @@ -351,7 +351,7 @@ leftmostProg = Prog ddtree (M.fromList [("leftmost", leftmostFun)]) (Just (leftm -------------------------------------------------------------------------------- rightmostFun :: FunDef2 -rightmostFun = FunDef "rightmost" ["t242"] rightmostTy rightmostBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +rightmostFun = FunDef "rightmost" ["t242"] rightmostTy rightmostBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where rightmostTy :: ArrowTy2 Ty2 rightmostTy = ArrowTy2 @@ -397,7 +397,7 @@ rightmostProg = Prog ddtree (M.fromList [("rightmost", rightmostFun)]) -------------------------------------------------------------------------------- buildLeafFun :: FunDef2 -buildLeafFun = FunDef "buildLeaf" ["i125"] buildLeafTy buildLeafBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +buildLeafFun = FunDef "buildLeaf" ["i125"] buildLeafTy buildLeafBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where buildLeafTy :: ArrowTy2 Ty2 buildLeafTy = ArrowTy2 @@ -424,7 +424,7 @@ buildLeafProg = Prog ddtree (M.fromList [("buildLeaf", buildLeafFun)]) (Just (bu -------------------------------------------------------------------------------- buildTreeFun :: FunDef2 -buildTreeFun = FunDef "buildTree" ["i270"] buildTreeTy buildTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +buildTreeFun = FunDef "buildTree" ["i270"] buildTreeTy buildTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where buildTreeTy :: ArrowTy2 Ty2 buildTreeTy = ArrowTy2 @@ -464,7 +464,7 @@ buildTreeProg = Prog ddtree (M.fromList [("buildTree", buildTreeFun)]) (Just (bu buildTwoTreesFun :: FunDef2 -buildTwoTreesFun = FunDef "buildTwoTrees" ["i750"] buildTreeTy buildTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +buildTwoTreesFun = FunDef "buildTwoTrees" ["i750"] buildTreeTy buildTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where buildTreeTy :: ArrowTy2 Ty2 buildTreeTy = ArrowTy2 @@ -501,7 +501,7 @@ buildTwoTreesProg = Prog ddtree (M.fromList [("buildTree", buildTreeFun), -------------------------------------------------------------------------------- buildTreeSumFun :: FunDef2 -buildTreeSumFun = FunDef "buildTreeSum" ["i302"] buildTreeSumTy buildTreeSumBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +buildTreeSumFun = FunDef "buildTreeSum" ["i302"] buildTreeSumTy buildTreeSumBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where buildTreeSumTy :: ArrowTy2 Ty2 buildTreeSumTy = ArrowTy2 @@ -553,7 +553,7 @@ buildTreeSumProg = Prog ddtree (M.fromList [("buildTreeSum", buildTreeSumFun)]) -------------------------------------------------------------------------------- sumTreeFun :: FunDef2 -sumTreeFun = FunDef "sumTree" ["tr762"] sumTreeTy sumTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +sumTreeFun = FunDef "sumTree" ["tr762"] sumTreeTy sumTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where sumTreeTy :: ArrowTy2 Ty2 sumTreeTy = ArrowTy2 @@ -643,7 +643,7 @@ addTrees t1 t2 = -} addTreesFun :: FunDef2 -addTreesFun = FunDef "addTrees" ["trees354"] addTreesTy addTreesBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +addTreesFun = FunDef "addTrees" ["trees354"] addTreesTy addTreesBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where addTreesTy :: ArrowTy2 Ty2 addTreesTy = ArrowTy2 @@ -718,7 +718,7 @@ addTreesProg = Prog ddtree (M.fromList [("addTrees", addTreesFun) -------------------------------------------------------------------------------- testProdFun :: FunDef2 -testProdFun = FunDef "testprod" ["tup130"] testprodTy testprodBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +testProdFun = FunDef "testprod" ["tup130"] testprodTy testprodBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where testprodTy = ArrowTy2 [LRM "lin131" (VarR "r132") Input, LRM "lout133" (VarR "r755") Output] @@ -811,7 +811,7 @@ sumUp tree = -} sumUpFun :: FunDef2 -sumUpFun = FunDef "sumUp" ["tr1"] sumUpFunTy sumUpFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +sumUpFun = FunDef "sumUp" ["tr1"] sumUpFunTy sumUpFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where sumUpFunTy :: ArrowTy2 Ty2 sumUpFunTy = ArrowTy2 @@ -850,7 +850,7 @@ sumUpFun = FunDef "sumUp" ["tr1"] sumUpFunTy sumUpFunBod (FunMeta Rec NoInline F valueSTreeFun :: FunDef2 -valueSTreeFun = FunDef "valueSTree" ["tr522"] valueSTreeFunTy valueSTreeFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +valueSTreeFun = FunDef "valueSTree" ["tr522"] valueSTreeFunTy valueSTreeFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where valueSTreeFunTy :: ArrowTy2 Ty2 valueSTreeFunTy = ArrowTy2 @@ -872,7 +872,7 @@ valueSTreeFun = FunDef "valueSTree" ["tr522"] valueSTreeFunTy valueSTreeFunBod ( buildSTreeFun :: FunDef2 -buildSTreeFun = FunDef "buildSTree" ["i543"] buildSTreeTy buildSTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +buildSTreeFun = FunDef "buildSTree" ["i543"] buildSTreeTy buildSTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where buildSTreeTy :: ArrowTy2 Ty2 buildSTreeTy = ArrowTy2 @@ -920,7 +920,7 @@ buildSTreeProg = Prog stree (M.fromList [("buildSTree", buildSTreeFun)]) -------------------------------------------------------------------------------- sumSTreeFun :: FunDef2 -sumSTreeFun = FunDef "sumSTree" ["tr762"] sumSTreeTy sumSTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +sumSTreeFun = FunDef "sumSTree" ["tr762"] sumSTreeTy sumSTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where sumSTreeTy :: ArrowTy2 Ty2 sumSTreeTy = ArrowTy2 @@ -983,7 +983,7 @@ sumUpProg = Prog stree (M.fromList [("sumUp", sumUpFun) -------------------------------------------------------------------------------- evenFun :: FunDef2 -evenFun = FunDef "even" ["i560"] evenFunTy evenFunBod (FunMeta NotRec NoInline False NoLayoutOpt Nothing) +evenFun = FunDef "even" ["i560"] evenFunTy evenFunBod (FunMeta NotRec NoInline False NoLayoutOpt Nothing Nothing) where evenFunTy :: ArrowTy2 Ty2 evenFunTy = ArrowTy2 @@ -1019,7 +1019,7 @@ setEven tree = setEvenFun :: FunDef2 -setEvenFun = FunDef "setEven" ["tr570"] setEvenFunTy setEvenFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +setEvenFun = FunDef "setEven" ["tr570"] setEvenFunTy setEvenFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where setEvenFunTy :: ArrowTy2 Ty2 setEvenFunTy = ArrowTy2 @@ -1102,7 +1102,7 @@ merged tr = -} sumUpSetEvenFun :: FunDef2 -sumUpSetEvenFun = FunDef "sumUpSetEven" ["tr600"] sumUpSetEvenFunTy sumUpSetEvenFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +sumUpSetEvenFun = FunDef "sumUpSetEven" ["tr600"] sumUpSetEvenFunTy sumUpSetEvenFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where sumUpSetEvenFunTy :: ArrowTy2 Ty2 sumUpSetEvenFunTy = ArrowTy2 @@ -1195,7 +1195,7 @@ ddexpr = fromListDD [DDef (toVar "Expr") [] ]] copyExprFun :: FunDef2 -copyExprFun = FunDef "copyExpr" ["e700"] copyExprFunTy copyExprFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +copyExprFun = FunDef "copyExpr" ["e700"] copyExprFunTy copyExprFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where copyExprFunTy :: ArrowTy2 Ty2 copyExprFunTy = ArrowTy2 @@ -1227,7 +1227,7 @@ copyExprFun = FunDef "copyExpr" ["e700"] copyExprFunTy copyExprFunBod (FunMeta R substFun :: FunDef2 -substFun = FunDef "subst" ["tr653"] substFunTy substFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +substFun = FunDef "subst" ["tr653"] substFunTy substFunBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where substFunTy :: ArrowTy2 Ty2 substFunTy = ArrowTy2 @@ -1322,7 +1322,7 @@ ddtree' = fromListDD [DDef (toVar "Tree") [] -- indirection pointers to get to the rightmost node of the tree. indrBuildTreeFun :: FunDef2 -indrBuildTreeFun = FunDef "indrBuildTree" ["i270"] indrBuildTreeTy indrBuildTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +indrBuildTreeFun = FunDef "indrBuildTree" ["i270"] indrBuildTreeTy indrBuildTreeBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where indrBuildTreeTy :: ArrowTy2 Ty2 indrBuildTreeTy = ArrowTy2 @@ -1367,7 +1367,7 @@ indrBuildTreeProg = Prog ddtree' (M.fromList [("indrBuildTree", indrBuildTreeFun indrRightmostFun :: FunDef2 -indrRightmostFun = FunDef "indrRightmost" ["t742"] indrRightmostTy indrRightmostBod (FunMeta Rec NoInline False NoLayoutOpt Nothing) +indrRightmostFun = FunDef "indrRightmost" ["t742"] indrRightmostTy indrRightmostBod (FunMeta Rec NoInline False NoLayoutOpt Nothing Nothing) where indrRightmostTy :: ArrowTy2 Ty2 indrRightmostTy = ArrowTy2 @@ -1403,7 +1403,7 @@ indrRightmostProg = Prog ddtree' (M.fromList [("indrRightmost", indrRightmostFun -------------------------------------------------------------------------------- indrIDFun :: FunDef2 -indrIDFun = FunDef "indrID" ["tr800"] indrIDTy indrIDBod (FunMeta NotRec NoInline False NoLayoutOpt Nothing) +indrIDFun = FunDef "indrID" ["tr800"] indrIDTy indrIDBod (FunMeta NotRec NoInline False NoLayoutOpt Nothing Nothing) where indrIDTy :: ArrowTy2 Ty2 indrIDTy = ArrowTy2 diff --git a/gibbon-compiler/src/Gibbon/Language/Syntax.hs b/gibbon-compiler/src/Gibbon/Language/Syntax.hs index b0f7bde91..0373abb19 100644 --- a/gibbon-compiler/src/Gibbon/Language/Syntax.hs +++ b/gibbon-compiler/src/Gibbon/Language/Syntax.hs @@ -22,6 +22,9 @@ module Gibbon.Language.Syntax , DataConMap , UserOrdering(..) , Constr(..) + , ConstrEdgeWeightTy + , Edge + , DataConFieldType(..) , lookupDDef , getConOrdering , getTyOfDataCon @@ -295,20 +298,44 @@ data UserOrdering deriving (Read, Show, Eq, Ord, Generic, NFData, Out) +type FieldIndexTy = Integer +type ConstrEdgeWeightTy = Integer + -- Constraints and Edges used in the ILP solver +-- Edge signifies an access that happened. +-- (a, b) means a was accessed right before b. type Edge - = ( Integer {- from -} - , Integer {- to -} + = ( FieldIndexTy {- from -} + , FieldIndexTy {- to -} ) +-- An Edge for generating Constraints where an additional element of field type is provided in the tuple. +type ConstraintEdge + = ( (FieldIndexTy, [DataConFieldType]) {- from -} + , (FieldIndexTy, [DataConFieldType]) {- to -} + ) + +-- The type of Constraints +-- WeakConstr is induced by accesses that are data independent. +-- StrongConstr is induced by accesses that arise due to a data dependency. data Constr - = Soft (Edge, Integer) - | Imm Edge - | Absolute Edge + = WeakConstr (ConstraintEdge, ConstrEdgeWeightTy) + | StrongConstr (ConstraintEdge, ConstrEdgeWeightTy) + | ImmAfterUserConstr Edge + | AbsoluteIndexUserConstr Edge deriving (Read, Show, Eq, Ord, Generic, NFData, Out) type DataConMap = M.Map DataCon [UserOrdering] +data DataConFieldType + = SelfRecursive + | Recursive + | Scalar + | IsInlineable + deriving (Read, Show, Eq, Ord, Generic, NFData, Out) + +type DataConFieldTypeInfo = M.Map DataCon (M.Map Int [DataConFieldType]) + data FunMeta = FunMeta { funRec :: FunRec @@ -317,6 +344,7 @@ data FunMeta = , funCanTriggerGC :: Bool , funOptLayout :: FunOptimizeLayout , userConstraintsDataCon :: Maybe DataConMap + , dataConFieldTypeInfo :: Maybe DataConFieldTypeInfo } deriving (Read, Show, Eq, Ord, Generic, NFData, Out) diff --git a/gibbon-compiler/src/Gibbon/Passes/AccessPatternsAnalysis.hs b/gibbon-compiler/src/Gibbon/Passes/AccessPatternsAnalysis.hs index 7434d9a7c..0713a4879 100644 --- a/gibbon-compiler/src/Gibbon/Passes/AccessPatternsAnalysis.hs +++ b/gibbon-compiler/src/Gibbon/Passes/AccessPatternsAnalysis.hs @@ -1,6 +1,7 @@ module Gibbon.Passes.AccessPatternsAnalysis ( generateAccessGraphs, getGreedyOrder, + generateSolverEdges, FieldMap, DataConAccessMap, ) @@ -17,7 +18,18 @@ import Data.Set as S import Gibbon.Common import Gibbon.Language import Gibbon.Language.Syntax +import Gibbon.L1.Syntax as L1 import Gibbon.Passes.ControlFlowGraph (CFGfunctionMap) + +import Gibbon.Passes.DefinitionUseChains + ( DefUseChainsFunctionMap (..), + generateDefUseChainsFunction, + progToVEnv, + getDefinitionsReachingLetExp, + UseDefChainsFunctionMap (..) + ) + + -- Haskell imports import Text.PrettyPrint.GenericPretty @@ -39,7 +51,7 @@ generateAccessGraphs :: (FreeVars (e l d), Ord l, Ord d, Ord (e l d), Out d, Out l) => CFGfunctionMap (PreExp e l d) -> FieldMap -> - FunDef (PreExp e l d) -> + FunDef1 -> DataCon -> FieldMap generateAccessGraphs @@ -58,7 +70,11 @@ generateAccessGraphs topologicallySortedNodes = P.map nodeFromVertex topologicallySortedVertices map = backtrackVariablesToDataConFields topologicallySortedNodes dcons - edges = S.toList $ S.fromList $ + (defUseChainsMap :: UseDefChainsFunctionMap Exp1) = getDefinitionsReachingLetExp funDef + elem = M.lookup funName defUseChainsMap + (g, f, f'') = fromJust elem + vertices = P.map (\v -> f v) (topSort g) + edges = S.toList $ S.fromList $ --dbgTraceIt ("DefUseChains:\n") dbgTraceIt ((M.elems defUseChainsMap)) dbgTraceIt ("\n") ( constructFieldGraph Nothing nodeFromVertex @@ -68,12 +84,61 @@ generateAccessGraphs map ) dcons - accessMapsList = zipWith (\x y -> (x, y)) [dcons] [edges] - accessMaps = M.fromList accessMapsList - in M.insert funName accessMaps fieldMap --dbgTraceIt (sdoc topologicallySortedVertices) dbgTraceIt ("\n") dbgTraceIt (sdoc (topologicallySortedVertices, edges)) dbgTraceIt ("\n") + -- Check if there is only a single field in the data con used. + set = isSingleFieldUse dcons funBody + singleFieldVal = catMaybes $ S.toList set + edges' = if (P.length singleFieldVal) == 1 + then [((P.head singleFieldVal, P.head singleFieldVal), 100)] + else edges + accessMapsList = {-dbgTraceIt (sdoc (dcons, edges', singleFieldVal))-} zipWith (\x y -> (x, y)) [dcons] [edges'] + accessMaps = {-dbgTraceIt ("STAGE2\n")-} M.fromList accessMapsList + fieldMap' = {-dbgTraceIt ("STAGE3\n")-} M.insert funName accessMaps fieldMap --dbgTraceIt (sdoc topologicallySortedVertices) dbgTraceIt ("\n") dbgTraceIt (sdoc (topologicallySortedVertices, edges)) dbgTraceIt ("\n") + s'' = {-dbgTraceIt ("STAGE4\n")-} generateSolverEdges funDef dcons fieldMap' + in {-dbgTraceIt ("STAGE5:\n") dbgTraceIt (sdoc (funName, vertices, edges, findDataFlowDependencies funDef, s'')) dbgTraceIt ("\n")-} fieldMap' Nothing -> error "generateAccessGraphs: no CFG for function found!" +-- Special case if only a single field in the data con is used. +isSingleFieldUse :: DataCon -> Exp1 -> S.Set (Maybe Integer) +isSingleFieldUse dcon exp = case exp of + DataConE _ dcon args -> S.singleton Nothing + VarE {} -> S.singleton Nothing + LitE {} -> S.singleton Nothing + CharE {} -> S.singleton Nothing + FloatE {} -> S.singleton Nothing + LitSymE {} -> S.singleton Nothing + AppE f locs args -> S.unions $ P.map (isSingleFieldUse dcon) args + PrimAppE f args -> S.unions $ P.map (isSingleFieldUse dcon) args + LetE (v, loc, ty, rhs) bod -> S.union (isSingleFieldUse dcon rhs) (isSingleFieldUse dcon bod) + -- a == DataCon + -- b == [(Var, loc)] + -- c == Case Body + CaseE scrt mp -> S.unions $ P.map (\(a, b, c) -> if a == dcon + then + let useMap = P.concatMap (\e@(var, x) -> let freeVars = S.fromList (freeVarsInOrder c) + in if (S.member var freeVars) then {-dbgTraceIt (sdoc $ S.toList freeVars)-} [(var, True, elemIndex e b)] else [] + ) b + recC = isSingleFieldUse dcon c + in if P.length useMap == 1 + then + let val = case useMap of + [(_, _, Just intVal)] -> S.singleton (Just (P.toInteger intVal)) + in {-dbgTraceIt (sdoc useMap)-} S.union recC val + else recC + else isSingleFieldUse dcon c + ) mp + IfE a b c -> S.unions $ [isSingleFieldUse dcon a] ++ [isSingleFieldUse dcon b] ++ [isSingleFieldUse dcon c] + MkProdE xs -> S.unions $ P.map (isSingleFieldUse dcon) xs + ProjE i e -> error "getGeneratedVariable: TODO ProjE" + TimeIt e ty b -> isSingleFieldUse dcon e + WithArenaE v e -> error "getGeneratedVariable: TODO WithArenaE" + SpawnE f locs args -> error "getGeneratedVariable: TODO SpawnE" + SyncE -> error "getGeneratedVariable: TODO SyncE" + Ext _ -> error "getGeneratedVariable: TODO Ext" + MapE {} -> error "getGeneratedVariable: TODO MapE" + FoldE {} -> error "getGeneratedVariable: TODO FoldE" + + getGreedyOrder :: [((Integer, Integer), Integer)] -> Int -> [Integer] getGreedyOrder edges fieldLength = @@ -97,7 +162,7 @@ greedyOrderOfVertices ee = let edges' = P.map (\((a, b), c) -> ((P.fromInteg graph = buildG bounds edgesWithoutWeight weightMap = P.foldr (\(e, w) mm -> M.insert e w mm) M.empty edges' v'' = greedyOrderOfVerticesHelper graph (topSort graph) weightMap S.empty - in v'' -- dbgTraceIt (sdoc (v'', (M.elems weightMap))) + in v'' -- dbgTraceIt (sdoc ((topSort graph), (M.elems weightMap))) dbgTraceIt (sdoc (v'', (M.elems weightMap))) greedyOrderOfVerticesHelper :: Graph -> [Int] -> M.Map (Int, Int) Int -> S.Set Int -> [Int] @@ -105,14 +170,26 @@ greedyOrderOfVerticesHelper graph vertices' weightMap visited = case vertices' o [] -> [] x:xs -> if S.member x visited then greedyOrderOfVerticesHelper graph xs weightMap visited - else let successors = reachable graph x + else let successors = succGraph x (G.edges graph) visited removeCurr = S.toList $ S.delete x (S.fromList successors) orderedSucc = orderedSuccsByWeight removeCurr x weightMap visited - visited' = P.foldr S.insert S.empty orderedSucc + visited' = P.foldr S.insert visited orderedSucc v'' = greedyOrderOfVerticesHelper graph xs weightMap visited' - in if successors == [x] - then orderedSucc ++ v'' --dbgTraceIt (sdoc (v'', orderedSucc)) - else [x] ++ orderedSucc ++ v'' + in [x] ++ orderedSucc ++ v'' + -- dbgTraceIt (sdoc (x, successors, removeCurr, orderedSucc, v'', S.toList visited' , S.toList visited )) + --then dbgTraceIt (sdoc (x, successors, removeCurr, orderedSucc, v'', S.toList visited')) orderedSucc ++ v'' --dbgTraceIt (sdoc (v'', orderedSucc)) + --else dbgTraceIt (sdoc (x, successors, removeCurr, orderedSucc, v'', S.toList visited')) [x] ++ orderedSucc ++ v'' + + +succGraph :: Int -> [(Int, Int)] -> S.Set Int -> [Int] +succGraph node edges visited = case edges of + [] -> [] + (a, b):xs -> if S.member b visited || S.member a visited + then succGraph node xs visited + else + if node == a then [b] ++ succGraph node xs visited + else succGraph node xs visited + orderedSuccsByWeight :: [Int] -> Int -> M.Map (Int, Int) Int -> S.Set Int -> [Int] orderedSuccsByWeight s i weightMap visited = case s of @@ -223,7 +300,7 @@ freeVarsInOrder exp = let var_list_list = P.map (freeVarsInOrder) args var_list = L.concat var_list_list in var_list - LetE (v, loc, ty, rhs) bod -> freeVarsInOrder rhs + LetE (v, loc, ty, rhs) bod -> freeVarsInOrder rhs ++ freeVarsInOrder bod CaseE scrt mp -> (freeVarsInOrder scrt) ++ ( L.concat @@ -268,10 +345,12 @@ removeDuplicates list = -- | TODO: any FIXMEs in the function. +-- | TODO: Fix single fields use. When only one field is used in a datacon, not working yet. + -- | a.) Multiple datacon fields read in the same expression. -- | Since this will be run after flatten, it is safe to assume that only possibly a maximum of two variables can be read in one let binding. -- | Except function calls! where more than two fields can be passed as arguments. -evaluateExpressionFieldGraph :: +evaluateExpressionFieldGraph :: (Out l, Out d, Out (e l d)) => Maybe (DataCon, Integer) -> (G.Vertex -> (((PreExp e l d), Integer), Integer, [Integer])) -> (Integer -> Maybe G.Vertex) -> @@ -293,8 +372,8 @@ evaluateExpressionFieldGraph currField nodeFromVertex vertexFromNode graph xs ma justDcons = [Just x | Just x <- fromDataCon'] fromDataCon'' = if P.null justDcons - then [Nothing] - else justDcons + then {-dbgTraceIt ("justDcons:") dbgTraceIt (sdoc justDcons)-} [Nothing] + else {-dbgTraceIt ("justDcons:") dbgTraceIt (sdoc justDcons)-} justDcons in case fromDataCon'' of [a] -> case a of @@ -327,7 +406,7 @@ evaluateExpressionFieldGraph currField nodeFromVertex vertexFromNode graph xs ma ) succExp {- list of tuples, where each tuple == ([(dcon, id), ... ], likelihood) -} - succDataCon' = + succDataCon' = {-dbgTraceIt ("succDataCon:") dbgTraceIt (sdoc succDataCon)-} P.zipWith (\x y -> (x, y)) succDataCon succprob newEdges = P.concat $ @@ -392,8 +471,8 @@ evaluateExpressionFieldGraph currField nodeFromVertex vertexFromNode graph xs ma justDcons = [Just x | Just x <- fromDataCon'] fromDataCon'' = if P.null justDcons - then [Nothing] - else justDcons + then {-dbgTraceIt ("justDcons:") dbgTraceIt (sdoc justDcons)-} [Nothing] + else {-dbgTraceIt ("justDcons:") dbgTraceIt (sdoc justDcons)-} justDcons in case fromDataCon'' of [a] -> case a of @@ -414,9 +493,12 @@ evaluateExpressionFieldGraph currField nodeFromVertex vertexFromNode graph xs ma ) succExp {- list of tuples, where each tuple == ([(dcon, id), ... ], likelihood) -} - succDataCon' = + succDataCon' = {-dbgTraceIt ("succDataCon:") dbgTraceIt (sdoc succDataCon)-} P.zipWith (\x y -> (x, y)) succDataCon succprob - newEdges = + -- FIXME: TODO: This might be needed for the other cases in this function as well. + -- This is to make sure we recurse on all possible successors. + newEdges' = constructFieldGraph (Just (dcon, pred)) nodeFromVertex vertexFromNode graph succVertices map datacon + newEdges = newEdges' ++ ( P.concat $ P.map ( \x -> @@ -424,11 +506,11 @@ evaluateExpressionFieldGraph currField nodeFromVertex vertexFromNode graph xs ma (varsl, prob) -> P.map (\y -> ((pred, snd y), prob)) varsl ) - succDataCon' + succDataCon' ) in case newEdges of [] -> case successors of - [] -> + [] -> --dbgTraceIt (sdoc (currField, succVertices, newEdges, newEdges')) [] ++ constructFieldGraph Nothing @@ -438,7 +520,7 @@ evaluateExpressionFieldGraph currField nodeFromVertex vertexFromNode graph xs ma xs map datacon - _ -> + _ -> --dbgTraceIt (sdoc (currField, succVertices, newEdges, newEdges')) newEdges ++ constructFieldGraph (Just (dcon, pred)) @@ -448,7 +530,7 @@ evaluateExpressionFieldGraph currField nodeFromVertex vertexFromNode graph xs ma xs map datacon - _ -> + _ -> --dbgTraceIt (sdoc (currField, succVertices, newEdges, newEdges')) newEdges ++ constructFieldGraph Nothing @@ -476,7 +558,7 @@ evaluateExpressionFieldGraph currField nodeFromVertex vertexFromNode graph xs ma datacon ) succExp - succDataCon' = + succDataCon' = {-dbgTraceIt ("succDataCon:") dbgTraceIt (sdoc succDataCon)-} P.zipWith (\x y -> (x, y)) succDataCon succprob newEdges = P.concat $ @@ -511,7 +593,7 @@ evaluateExpressionFieldGraph currField nodeFromVertex vertexFromNode graph xs ma error "evaluateExpressionFieldGraph: More than one variable from DataCon in a let binding not modelled into Field dependence graph yet!" -constructFieldGraph :: +constructFieldGraph :: (Out l, Out d, Out (e l d)) => Maybe (DataCon, Integer) -> (G.Vertex -> (((PreExp e l d), Integer), Integer, [Integer])) -> (Integer -> Maybe G.Vertex) -> @@ -694,7 +776,7 @@ constructFieldGraph currField nodeFromVertex vertexFromNode graph progress map d _ -> error "not expected" -- | From an expression provided, Recursively find all the variables that come from a DataCon expression, that is, are fields in a DataConE. -findFieldInDataConFromVariableInExpression :: +findFieldInDataConFromVariableInExpression :: (Out l, Out d, Out (e l d)) => (PreExp e l d) -> [(((PreExp e l d), Integer), Integer, [Integer])] -> VariableMap -> @@ -722,7 +804,7 @@ findFieldInDataConFromVariableInExpression exp graph map datacon = let freeVars = freeVarsInOrder rhs fromDataCon = P.map (\v -> M.findWithDefault Nothing v map) freeVars removeMaybe = Mb.catMaybes fromDataCon - newDatacons = + newDatacons = --dbgTraceIt (sdoc (v, freeVars)) [ if dcon == datacon then Just (dcon, id') else Nothing @@ -781,3 +863,175 @@ findFieldInDataConFromVariableInExpression exp graph map datacon = Ext _ -> error "findFieldInDataConFromVariableInExpression: TODO Ext" MapE {} -> error "findFieldInDataConFromVariableInExpression: TODO MapE" FoldE {} -> error "findFieldInDataConFromVariableInExpression: TODO FoldE" + + + + +findIndexOfFields :: FunDef1 -> DataCon -> M.Map Int [Var] +findIndexOfFields f@FunDef{funName, funBody, funTy, funArgs} dcon = findIndexOfFieldsFunBody funBody dcon M.empty + + +findIndexOfFieldsFunBody :: Exp1 -> DataCon -> M.Map Int [Var] -> M.Map Int [Var] +findIndexOfFieldsFunBody exp dcon m = case exp of + -- Assumption that args will be flattened. + DataConE loc dcon args -> M.unions $ P.map (\exp -> findIndexOfFieldsFunBody exp dcon m) args --P.foldr (\exp m -> findIndexOfFieldsFunBody exp dcon) M.empty args + -- DataConE loc dcon args -> P.foldr (\exp m -> case exp of + -- VarE v -> let idx = elemIndex exp args + -- in case idx of + -- Nothing -> error "Did not expect empty idx." + -- Just idx' -> case M.lookup idx' m of + -- Nothing -> M.insert idx' [v] m + -- Just lst -> M.insert idx' (lst ++ [v]) m + -- LitSymE v -> error "TODO: implememt for LitSymE." + -- ) M.empty args + VarE {} -> m + LitE {} -> m + CharE {} -> m + FloatE {} -> m + LitSymE {} -> m + AppE f locs args -> M.unions $ P.map (\exp -> findIndexOfFieldsFunBody exp dcon m) args + PrimAppE f args -> M.unions $ P.map (\exp -> findIndexOfFieldsFunBody exp dcon m) args + LetE (v, loc, ty, rhs) bod -> let m' = findIndexOfFieldsFunBody rhs dcon m + m'' = findIndexOfFieldsFunBody bod dcon m' + in m'' + -- mp == [(DataCon, [(Var, loc)], PreExp ext loc dec)] + -- Change this to take from the Case expression instead. + CaseE scrt mp -> M.unions $ P.map (\(a, b, c) -> if (a == dcon) + then let ms' = M.unions $ P.map (\vv@(var, loc)-> let idx = elemIndex vv b + in case idx of + Nothing -> error "Did not expect empty idx." + Just idx' -> case M.lookup idx' m of + Nothing -> M.insert idx' [var] m + Just lst -> M.insert idx' (lst ++ [var]) m + ) b + --m'' = findIndexOfFieldsFunBody c dcon ms' + in ms' + else m --let m' = findIndexOfFieldsFunBody c dcon m + --in m' + ) mp + -- CaseE scrt mp -> P.foldr (\(a, b, c) m -> let m' = findIndexOfFieldsFunBody c dcon + -- in M.union m m' + -- ) M.empty mp + IfE a b c -> let mapA = findIndexOfFieldsFunBody a dcon m + mapB = findIndexOfFieldsFunBody b dcon mapA + mapC = findIndexOfFieldsFunBody c dcon mapB + in mapC -- M.unions [mapA, mapB, mapC] + MkProdE xs -> M.unions $ P.map (\exp -> findIndexOfFieldsFunBody exp dcon m) xs + ProjE {} -> error "findIndexOfFieldsFunBody: TODO ProjE" + TimeIt {} -> error "findIndexOfFieldsFunBody: TODO TimeIt" + WithArenaE {} -> error "findIndexOfFieldsFunBody: TODO WithArenaE" + SpawnE {} -> error "findIndexOfFieldsFunBody: TODO SpawnE" + SyncE -> error "findIndexOfFieldsFunBody: TODO SyncE" + Ext{} -> error "findIndexOfFieldsFunBody: TODO Ext" + MapE {} -> error "findIndexOfFieldsFunBody: TODO MapE" + FoldE {} -> error "findIndexOfFieldsFunBody: TODO FoldE" + +findDataFlowDependencies :: FunDef1 -> M.Map Var [Var] +findDataFlowDependencies f@FunDef{funName, funBody, funTy, funArgs} = findDataFlowDependenciesFunBody funBody + + +-- Want to capture Read -> Read and Read -> Write dependencies. +findDataFlowDependenciesFunBody :: Exp1 -> M.Map Var [Var] +findDataFlowDependenciesFunBody exp = case exp of + DataConE loc dcon args -> M.unions $ P.map findDataFlowDependenciesFunBody args + VarE {} -> M.empty + LitE {} -> M.empty + CharE {} -> M.empty + FloatE {} -> M.empty + LitSymE {} -> M.empty + AppE f locs args -> M.unions $ P.map findDataFlowDependenciesFunBody args + PrimAppE f args -> M.unions $ P.map findDataFlowDependenciesFunBody args + -- RW dependence, rhs read, v is written to. + LetE (v, loc, ty, rhs) bod -> let vars_read = gFreeVars rhs + newMap = P.foldr (\v' m -> let elem = M.lookup v' m + in case elem of + Nothing -> M.insert v' [v] m + Just lst -> M.insert v' (lst ++ [v]) m + ) M.empty vars_read + m' = findDataFlowDependenciesFunBody rhs + m'' = findDataFlowDependenciesFunBody bod + in M.unions [newMap, m', m''] + -- mp == [(DataCon, [(Var, loc)], PreExp ext loc dec)] + CaseE scrt mp -> let vars_read = S.toList $ gFreeVars scrt + vars_dep = P.foldr (\(a, b, c) st -> let vars = S.fromList $ P.map (\(vv, ll) -> vv) b + vars' = gFreeVars c + in S.union vars vars' + ) S.empty mp + newMap = P.foldr (\v' m -> let elem = M.lookup v' m + in case elem of + Nothing -> M.insert v' (S.toList vars_dep) m + Just lst -> M.insert v' (lst ++ (S.toList vars_dep)) m + ) M.empty vars_read + -- newMap' = P.foldr (\(a, b, c) mm -> let mm' = P.foldr (\(var, l) m'' -> let dep_vars = gFreeVars c + -- in case M.lookup var m'' of + -- Nothing -> M.insert var (S.toList dep_vars) m'' + -- Just x -> M.insert var (x ++ S.toList dep_vars) m'' + -- ) M.empty b + -- in M.union mm mm' + -- ) M.empty mp + newMap'' = P.foldr (\(a, b, c) mm -> let mm' = findDataFlowDependenciesFunBody c + in M.union mm mm' + ) M.empty mp + in M.unions [newMap, newMap''] + -- RW dependence, vars in a are read, b and c all could have Read or written to vars. + IfE a b c -> let vars_read = gFreeVars a + vars_dep = {-dbgTraceIt ("Vars Read: ") dbgTraceIt (show vars_read) dbgTraceIt ("\n")-} S.union (gFreeVars b) (gFreeVars c) + newMap = P.foldr (\v' m -> let elem = M.lookup v' m + in case elem of + Nothing -> M.insert v' (S.toList vars_dep) m + Just lst -> M.insert v' (lst ++ (S.toList vars_dep)) m + ) M.empty vars_read + mapA = findDataFlowDependenciesFunBody b + mapB = findDataFlowDependenciesFunBody c + in M.unions [newMap, mapA, mapB] + MkProdE xs -> M.unions $ P.map findDataFlowDependenciesFunBody xs + ProjE _ e -> findDataFlowDependenciesFunBody e + TimeIt e _ _ -> findDataFlowDependenciesFunBody e + WithArenaE _ e -> findDataFlowDependenciesFunBody e + SpawnE _ _ e -> M.unions $ P.map findDataFlowDependenciesFunBody e + SyncE -> error "TODO: FindDataFlowDependenciesFunBody implement for SyncE" + Ext{} -> error "TODO: FindDataFlowDependenciesFunBody implement for Ext{}" + MapE {} -> error "TODO: FindDataFlowDependenciesFunBody implement for MapE{}" + FoldE {} -> error "TODO: FindDataFlowDependenciesFunBody implement for FoldE{}" + + +-- TODO: need to generate the right type of edges. + +generateSolverEdges :: FunDef1 -> DataCon -> FieldMap -> [Constr] +generateSolverEdges fundef@FunDef{funName, funBody, funTy, funArgs, funMeta} dcon fmap = + let functionEdges = {-dbgTraceIt ("STARTED!")-} M.lookup funName fmap + in case functionEdges of + Nothing -> error "generateSolverEdges: functon does not exist.\n" + Just k -> case M.lookup dcon k of + Nothing -> error "generateSolverEdges: No associated edges exist for the function.\n" + Just edges -> let indexToVariables = findIndexOfFields fundef dcon + dataFlowDependencies = {-dbgTraceIt ("ENDED") dbgTraceIt (sdoc indexToVariables) dbgTraceIt ("Print FunDef") dbgTraceIt (sdoc fundef)-} findDataFlowDependencies fundef + newEdges = {-dbgTraceIt ("FLOWDEPS") dbgTraceIt (sdoc dataFlowDependencies)-} (\FunMeta{dataConFieldTypeInfo} -> case dataConFieldTypeInfo of + Nothing -> error "No associated field type record.\n" + Just x -> case M.lookup dcon x of + Nothing -> error "No field type for dcon.\n" + Just y -> P.map (\((a, b), weight) -> ((a, fromJust (M.lookup (P.fromInteger a) y)), (b, fromJust (M.lookup (P.fromInteger b) y)), weight)) edges + ) funMeta + newEdges' = P.map (\e@((a,a'),(b,b'), wt) -> let varA = M.findWithDefault ( [(toVar "")]) (P.fromInteger a) indexToVariables + varB = M.findWithDefault ( [(toVar "")]) (P.fromInteger b) indexToVariables + lambda = (\var l s -> let b = S.member var s + in if b + then l + else case M.lookup var dataFlowDependencies of + Nothing -> l + Just lst -> let s' = S.insert var s + in P.foldr (\v l' -> lambda v l' s') (lst ++ l) lst + ) + varA' = if P.length varA /= 1 then error "TODO: multiple variables to optimize." else P.head varA + varB' = if P.length varB /= 1 then error "TODO: multiple variables to optimize." else P.head varB + reachable = lambda varA' [] S.empty + in case (elem varB' reachable) of + False -> WeakConstr (((a,a'),(b,b')), wt) + True -> StrongConstr (((a,a'),(b,b')), wt) + + + ) newEdges + -- TODO: make the Weak vs Strong Constraints out of these edges. + in {-dbgTraceIt ("PrintEdges with the types embedded:\n") dbgTraceIt (sdoc (newEdges', fundef))-} newEdges' + --fMeta{dataConFieldTypeInfo = fieldTypeInfo} = funMeta + --newEdges = P.map (((a, b), weight) -> let ) edges \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/Codegen.hs b/gibbon-compiler/src/Gibbon/Passes/Codegen.hs index c30aa7cd1..a39e14dba 100644 --- a/gibbon-compiler/src/Gibbon/Passes/Codegen.hs +++ b/gibbon-compiler/src/Gibbon/Passes/Codegen.hs @@ -184,8 +184,10 @@ sortFns (Prog _ _ funs mtal) = foldl go S.empty allTails -------------------------------------------------------------------------------- -- * C codegen --- | Compile a program to C code that has the side effect of the --- "gibbon_main" expression in that program. +-- | Compile a program to C code which has the side effect of the +-- "main" expression in that program. +-- +-- The boolean flag is true when we are compiling in "Packed" mode. codegenProg :: Config -> Prog -> IO String codegenProg cfg prg@(Prog info_tbl sym_tbl funs mtal) = return (hashIncludes ++ pretty 80 (stack (map ppr defs))) @@ -324,6 +326,9 @@ codegenProg cfg prg@(Prog info_tbl sym_tbl funs mtal) = \#include \n\ \#include \n\ \#endif\n\n\ + \#ifdef _GIBBON_ENABLE_PAPI\n\ + \#include \n\ + \#endif\n\n\ \/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\ \ * Program starts here\n\ \ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\ @@ -627,6 +632,8 @@ codegenTail venv fenv sort_fns (LetTimedT flg bnds rhs body) ty sync_deps = selftimed <- gensym "selftimed" times <- gensym "times" tmp <- gensym "tmp" + papi_retval <- gensym "papi_retval" + papi_region <- gensym "papi_region" let ident = case bnds of ((v,_):_) -> v _ -> (toVar "") @@ -654,16 +661,39 @@ codegenTail venv fenv sort_fns (LetTimedT flg bnds rhs body) ty sync_deps = gib_ptr_bumpalloc_restore_state(); } |] , C.BlockDecl [cdecl| double $id:itertime = gib_difftimespecs(&$(cid (toVar begn)), &$(cid (toVar end))); |] - , C.BlockStm [cstm| printf("itertime: %lf\n", $id:itertime); |] + , C.BlockStm [cstm| printf("itertime: %e\n", $id:itertime); |] , C.BlockStm [cstm| gib_vector_inplace_update($id:times, $id:iters, &($id:itertime)); |] ] - in [ C.BlockStm [cstm| for (long long $id:iters = 0; $id:iters < gib_get_iters_param(); $id:iters ++) { $items:body } |] - , C.BlockStm [cstm| gib_vector_inplace_sort($id:times, gib_compare_doubles); |] - , C.BlockDecl [cdecl| double *$id:tmp = (double*) gib_vector_nth($id:times, (gib_get_iters_param() / 2)); |] - , C.BlockDecl [cdecl| double $id:selftimed = *($id:tmp); |] - , C.BlockDecl [cdecl| double $id:batchtime = gib_sum_timing_array($id:times); |] - , C.BlockStm [cstm| gib_print_timing_array($id:times); |] - , C.BlockStm [cstm| gib_vector_free($id:times); |] + -- TODO: Find a better way to get a name for the region id. + ifdef = "#ifdef _GIBBON_ENABLE_PAPI" + endif = "#endif" + body' = [ C.BlockStm [cstm| $escstm:ifdef |] + , C.BlockStm [cstm| sprintf($id:papi_region, "%d", get_papi_region_id());|] + , C.BlockDecl [cdecl| int $id:papi_retval = PAPI_hl_region_begin($id:papi_region);|] + , C.BlockStm [cstm| if ( $id:papi_retval != PAPI_OK ) { + exit(1); + } |] + , C.BlockStm [cstm| $escstm:endif |] + ] ++ + body ++ + [ C.BlockStm [cstm| $escstm:ifdef |] + , C.BlockStm [cstm| $id:papi_retval = PAPI_hl_region_end($id:papi_region);|] + , C.BlockStm [cstm| if ( $id:papi_retval != PAPI_OK ) { + exit(1); + } |] + , C.BlockStm [cstm| increment_papi_region_id(); |] + , C.BlockStm [cstm| $escstm:endif |] + ] + in [ C.BlockStm [cstm| $escstm:ifdef |] + , C.BlockDecl [cdecl| char $id:papi_region[128];|] + , C.BlockStm [cstm| $escstm:endif |] + , C.BlockStm [cstm| for (long long $id:iters = 0; $id:iters < gib_get_iters_param(); $id:iters ++) { $items:body' } |] + , C.BlockStm [cstm| gib_vector_inplace_sort($id:times, gib_compare_doubles); |] + , C.BlockDecl [cdecl| double *$id:tmp = (double*) gib_vector_nth($id:times, (gib_get_iters_param() / 2)); |] + , C.BlockDecl [cdecl| double $id:selftimed = *($id:tmp); |] + , C.BlockDecl [cdecl| double $id:batchtime = gib_sum_timing_array($id:times); |] + , C.BlockStm [cstm| gib_print_timing_array($id:times); |] + , C.BlockStm [cstm| gib_vector_free($id:times); |] ]) -- else diff --git a/gibbon-compiler/src/Gibbon/Passes/ControlFlowGraph.hs b/gibbon-compiler/src/Gibbon/Passes/ControlFlowGraph.hs index d24ae03c9..46a4f1f94 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ControlFlowGraph.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ControlFlowGraph.hs @@ -18,7 +18,7 @@ import Data.Set as S -- Haskell Imports import Prelude as P - +import Text.PrettyPrint.GenericPretty -- | CFGfunctionMap ex, a map storing a function, represented by Var (function name) to its control flow graph -- | Edge == (ex, Integer) the IR expression and its corresponding probability @@ -58,11 +58,11 @@ type CFGfunctionMap ex -- | Generate a CFG out of a Function definition. -- | Returns a map mapping a function to its corresponding CFG -getFunctionCFG :: FunDef (PreExp e l d) -> CFGfunctionMap (PreExp e l d) +getFunctionCFG :: (Out l, Out d, Out (e l d)) => FunDef (PreExp e l d) -> CFGfunctionMap (PreExp e l d) getFunctionCFG f@FunDef {funName, funBody, funTy, funArgs} = let (edgeList, _, _) = generateCFGExp 0 100 funBody (graph, nodeFromVertex, vertexFromKey) = G.graphFromEdges edgeList - in M.insert funName (graph, nodeFromVertex, vertexFromKey) (M.empty) + in M.insert funName (graph, nodeFromVertex, vertexFromKey) (M.empty) --dbgTraceIt (sdoc edgeList) -- | generate the Edges from the IR expression. diff --git a/gibbon-compiler/src/Gibbon/Passes/Fusion2.hs b/gibbon-compiler/src/Gibbon/Passes/Fusion2.hs index 4ba5376ac..44d276a2e 100644 --- a/gibbon-compiler/src/Gibbon/Passes/Fusion2.hs +++ b/gibbon-compiler/src/Gibbon/Passes/Fusion2.hs @@ -982,7 +982,7 @@ tupleListOfFunctions ddefs funcList newName syncedArgs = do newArgs (newFuncInputType, newRetType) finalBody - (FunMeta NotRec NoInline False NoLayoutOpt Nothing)) + (FunMeta NotRec NoInline False NoLayoutOpt Nothing Nothing)) where createOutVar index subscript = toVar ("f" L.++ show index L.++ "out" L.++ show subscript) diff --git a/gibbon-compiler/src/Gibbon/Passes/OptimizeADTLayout.hs b/gibbon-compiler/src/Gibbon/Passes/OptimizeADTLayout.hs index 060377814..6b2db71e5 100644 --- a/gibbon-compiler/src/Gibbon/Passes/OptimizeADTLayout.hs +++ b/gibbon-compiler/src/Gibbon/Passes/OptimizeADTLayout.hs @@ -34,7 +34,8 @@ import Gibbon.Passes.AccessPatternsAnalysis ( DataConAccessMap, FieldMap, generateAccessGraphs, - getGreedyOrder + getGreedyOrder, + generateSolverEdges ) import Gibbon.Passes.CallGraph ( ProducersMap (..), @@ -55,6 +56,7 @@ import System.IO.Unsafe as U import System.TimeIt import Text.PrettyPrint.GenericPretty import Prelude as P +import Data.Either import Data.Data (Data) import qualified Gibbon.L2.Syntax as L1 import qualified Data.Foldable as P @@ -194,7 +196,7 @@ producerConsumerLayoutOptimization prg@Prog{ddefs, fundefs, mainExp} useGreedy = Just x -> x Nothing -> error "producerConsumerLayoutOptimization: expected a function definition!!" let fieldOrder = getAccessGraph f dcon - let result = optimizeFunctionWRTDataCon dd fd dcon (fromVar newSymDcon) fieldOrder useGreedy + let result = {-dbgTraceIt ("CHECKPOINTA\n")-} optimizeFunctionWRTDataCon dd fd dcon (fromVar newSymDcon) fieldOrder useGreedy case result of Nothing -> pure pr --dbgTraceIt (sdoc (result, fname, fieldOrder)) Just (ddefs', fundef', fieldorder) -> let fundefs' = M.delete fname fds @@ -203,7 +205,7 @@ producerConsumerLayoutOptimization prg@Prog{ddefs, fundefs, mainExp} useGreedy = venv = progToVEnv p pmap = generateProducerGraph p prg' = genNewProducersAndRewriteProgram fname (fromVar newSymDcon) fieldorder venv pmap p - in pure prg' --dbgTraceIt (sdoc (result, fname, fundef', fieldOrder)) + in {-dbgTraceIt ("Producer Graph:\n") dbgTraceIt (sdoc pmap) dbgTraceIt ("End\n")-} pure prg' --dbgTraceIt (sdoc (result, fname, fundef', fieldOrder)) ) P.foldrM lambda prg linearizeDcons --dbgTraceIt (sdoc linearizeDcons) @@ -211,8 +213,9 @@ producerConsumerLayoutOptimization prg@Prog{ddefs, fundefs, mainExp} useGreedy = globallyOptimizeDataConLayout :: Bool -> Prog1 -> PassM Prog1 globallyOptimizeDataConLayout useGreedy prg@Prog{ddefs, fundefs, mainExp} = do -- TODO: make a custom function name printer that guarantees that functions starting with _ are auto-generated. - let funsToOptimize = P.concatMap (\FunDef{funName} -> ([funName | not $ isInfixOf "_" (fromVar funName)]) - ) $ M.elems fundefs + -- let f' = P.map (deduceFieldSolverTypes ddefs) (M.elems fundefs) + let funsToOptimize = P.concatMap (\FunDef{funName} -> ([funName | not (isInfixOf "_" (fromVar funName))]) + ) $ M.elems fundefs --f' let pairDataConFuns = P.concatMap (\name -> case M.lookup name fundefs of Just f@FunDef{funName, funBody} -> [(f, dataConsInFunBody funBody)] Nothing -> [] @@ -246,43 +249,133 @@ globallyOptimizeDataConLayout useGreedy prg@Prog{ddefs, fundefs, mainExp} = do in M.insert dcon e' m'' ) M.empty dconToFieldOrder - + let funsToOptimizeTripleGreedy = P.concatMap + (\(dcon, funList) -> let edges' = M.lookup dcon mergedEdges + in case edges' of + Nothing -> [] + Just x -> [(funList, dcon, x)] + ) lstElements + let funsToOptimizeTriple = P.concatMap (\(dcon, funList) -> let edges' = M.lookup dcon mergedEdges in case edges' of Nothing -> [] Just x -> let m = M.insert dcon x M.empty - --lst = P.map (\f@FunDef{funName} -> (f, dcon, M.insert funName m M.empty)) funList - --in lst in [(funList, dcon, m)] ) lstElements - - let lambda' = (\(f@FunDef{funName=fname}, (dcon, newSymDcon), edgeOrder) pr@Prog{ddefs=dd, fundefs=fds, mainExp=mexp} -> do + + let funsToOptimizeTriple' = P.map (\(funList, dcon, m) -> (P.map (\f -> deduceFieldSolverTypes ddefs f) funList, dcon, m)) funsToOptimizeTriple + + let funsToOptimizeTripleSolver = {-dbgTraceIt (sdoc funsToOptimizeTriple')-} P.map + (\(funList, dcon, m) -> let constraints = S.toList $ S.fromList $ P.concatMap (\f@FunDef{funName=fname, funMeta=fmeta@FunMeta{userConstraintsDataCon=userConstraints}} -> let fieldOrder = M.insert fname m M.empty + constrs = generateSolverEdges f dcon fieldOrder + --userConstrs = ... + in case userConstraints of + Nothing -> constrs + Just dconUseConstrMap -> let + dconConstrs = M.lookup dcon dconUseConstrMap + in case dconConstrs of + Nothing -> constrs + Just userConstrs -> let + userConstrs' = genUserConstrs userConstrs + in constrs ++ userConstrs' + + ) funList + --collectUserConstrs = + mergedConstraints = {-dbgTraceIt (sdoc constraints)-} mergeConstraints $ constraints + in (funList, dcon, mergedConstraints) + ) funsToOptimizeTriple' + + let solverOptimization = {-dbgTraceIt (sdoc funsToOptimizeTripleSolver)-} + (\(f@FunDef{funName=fname}, (dcon, newSymDcon), constrs) pr@Prog{ddefs=dd, fundefs=fds, mainExp=mexp} -> do let maybeFd = M.lookup fname fds - let fieldOrder = M.insert fname edgeOrder M.empty let fd = case maybeFd of Just x -> x Nothing -> error "globallyOptimizeDataConLayout: expected a function definition!!" - let result = optimizeFunctionWRTDataCon dd fd dcon (fromVar newSymDcon) fieldOrder useGreedy + let result = optimizeFunctionWRTDataConGlobal dd fd dcon (fromVar newSymDcon) (Left constrs) useGreedy case result of - Nothing -> pure pr + Nothing -> pure pr Just (ddefs', fundef', fieldorder) -> let fundefs' = M.delete fname fds fundefs'' = M.insert fname fundef' fundefs' p = Prog{ddefs = ddefs', fundefs = fundefs'', mainExp = mexp} - venv = progToVEnv p - pmap = generateProducerGraph p - prg' = genNewProducersAndRewriteProgram fname (fromVar newSymDcon) fieldorder venv pmap p - in pure prg' + prg' = globallyChangeDataConstructorLayout dcon (fromVar newSymDcon) fieldorder p + in pure prg' ) - let lambda = (\(fList, dcon, fieldOrder) pr@Prog{ddefs=dd, fundefs=fds, mainExp=mexp} -> do + let solverMain = + (\(fList, dcon, constrs) pr@Prog{ddefs=dd, fundefs=fds, mainExp=mexp} -> do newSymDcon <- gensym (toVar dcon) - let vals = P.map (\f -> (f, (dcon, newSymDcon), fieldOrder)) fList - P.foldrM lambda' pr vals - ) - - - P.foldrM lambda prg funsToOptimizeTriple + let vals = P.map (\f -> (f, (dcon, newSymDcon), constrs)) fList + P.foldrM solverOptimization pr vals + ) + let greedyOptimization = + (\(f@FunDef{funName=fname}, (dcon, newSymDcon), edges) pr@Prog{ddefs=dd, fundefs=fds, mainExp=mexp} -> do + let maybeFd = M.lookup fname fds + let fd = case maybeFd of + Just x -> x + Nothing -> error "globallyOptimizeDataConLayout: greedy: expected a function definition!!" + let result = optimizeFunctionWRTDataConGlobal dd fd dcon (fromVar newSymDcon) (Right edges) useGreedy + case result of + Nothing -> pure pr + Just (ddefs', fundef', fieldorder) -> let fundefs' = M.delete fname fds + fundefs'' = M.insert fname fundef' fundefs' + p = Prog{ddefs = ddefs', fundefs = fundefs'', mainExp = mexp} + prg' = globallyChangeDataConstructorLayout dcon (fromVar newSymDcon) fieldorder p + in pure prg' + ) + + let greedyMain = + (\(fList, dcon, edges) pr@Prog{ddefs=dd, fundefs=fds, mainExp=mexp} -> do + newSymDcon <- gensym (toVar dcon) + let vals = P.map (\f -> (f, (dcon, newSymDcon), edges)) fList + P.foldrM greedyOptimization pr vals + ) + if useGreedy then P.foldrM greedyMain prg funsToOptimizeTripleGreedy else P.foldrM solverMain prg funsToOptimizeTripleSolver + + +isStrongConstr :: Constr -> Bool +isStrongConstr constr = case constr of + StrongConstr _ -> True + _ -> False + +-- Fold over all constraints to make sure we are not using duplicate constraints across different functions with possibly +-- different field meta data. Union all the meta data about a field globally by merding constraints. +mergeConstraints :: [Constr] -> [Constr] +mergeConstraints lst = case lst of + [] -> [] + [x] -> [x] + x@(WeakConstr e@(((a, ma), (b, mb)), _)):y -> let (x', y') = P.foldr (\constr (newConstr, tail) -> case constr of + WeakConstr e'@(((a', ma'), (b', mb')), wt) -> if (a, b) == (a', b') + then + if isStrongConstr constr + then (StrongConstr (((a', removeDuplicates $ ma' ++ ma), (b', removeDuplicates $ mb' ++ mb)), wt), tail) + else (WeakConstr (((a', removeDuplicates $ ma' ++ ma), (b', removeDuplicates $ mb' ++ mb)), wt), tail) + else (newConstr, tail ++ [constr]) + StrongConstr e'@(((a', ma'), (b', mb')), wt) -> if (a, b) == (a', b') + then (StrongConstr (((a', removeDuplicates $ ma' ++ ma), (b', removeDuplicates $ mb' ++ mb)), wt), tail) + else (newConstr, tail ++ [constr]) + + _ -> (constr, tail ++ [constr]) -- This isn't really corrent right now? + + + + ) (x, []) y + in [x'] ++ (mergeConstraints y') + + x@(StrongConstr e@(((a, ma), (b, mb)), _)):y -> let (x', y') = P.foldr (\constr (newConstr, tail) -> case constr of + WeakConstr e'@(((a', ma'), (b', mb')), wt) -> if (a, b) == (a', b') + then (StrongConstr (((a', removeDuplicates $ ma' ++ ma), (b', removeDuplicates $ mb' ++ mb)), wt), tail) + else (newConstr, tail ++ [constr]) + StrongConstr e'@(((a', ma'), (b', mb')), wt) -> if (a, b) == (a', b') + then (StrongConstr (((a', removeDuplicates $ ma' ++ ma), (b', removeDuplicates $ mb' ++ mb)), wt), tail) + else (newConstr, tail ++ [constr]) + + _ -> (constr, tail ++ [constr]) + + + ) (x, []) y + in [x'] ++ (mergeConstraints y') + x:y -> [x] ++ (mergeConstraints y) generateCopyFunctionsForFunctionsThatUseOptimizedVariable :: Var -> DataCon -> FieldOrder -> Prog1 -> PassM Prog1 @@ -517,11 +610,11 @@ optimizeFunctionWRTDataCon useGreedy = case useGreedy of False -> let field_len = P.length $ snd . snd $ lkp' ddefs datacon - fieldorder = + fieldorder = {-dbgTraceIt (sdoc funName) dbgTraceIt ("End1\n")-} optimizeDataConOrderFunc fieldMap M.empty - fundef + (deduceFieldSolverTypes ddefs fundef) --deduceFieldSolverTypes ddefs f) [(datacon, field_len)] M.empty -- make a function to generate a new data con as a value instead of changing the order of fields in the original one. @@ -530,13 +623,13 @@ optimizeFunctionWRTDataCon --fundef' = shuffleDataConFunBody True fieldorder fundef newDcon --(newDDefs, fundef', fieldorder) in case M.toList fieldorder of - [] -> Nothing --dbgTraceIt (sdoc fieldorder) + [] -> {-dbgTraceIt (sdoc funName) dbgTraceIt ("End2\n")-} Nothing --dbgTraceIt (sdoc fieldorder) [(dcon, order)] -> let orignal_order = [0..(P.length order - 1)] in if orignal_order == P.map P.fromInteger order - then Nothing + then {-dbgTraceIt (sdoc funName) dbgTraceIt ("End2\n")-} Nothing else let newDDefs = optimizeDataCon (dcon, order) ddefs newDcon fundef' = shuffleDataConFunBody True fieldorder fundef newDcon - in Just (newDDefs, fundef', fieldorder) --dbgTraceIt (sdoc order) -- dbgTraceIt (sdoc fieldorder) + in {-dbgTraceIt ("CHECKPOINT2\n")-} Just (newDDefs, fundef', fieldorder) --dbgTraceIt (sdoc order) -- dbgTraceIt (sdoc fieldorder) _ -> error "more than one" True -> let field_len = P.length $ snd . snd $ lkp' ddefs datacon @@ -557,6 +650,59 @@ optimizeFunctionWRTDataCon in Just (newDDefs, fundef', fieldorder) --dbgTraceIt (sdoc order) -- dbgTraceIt (sdoc fieldorder) dbgTraceIt (sdoc greedy_order) _ -> error "more than one" + + +getLeft :: Either [Constr] [(L1.Edge, ConstrEdgeWeightTy)] -> [Constr] +getLeft (Left x) = x + +getRight :: Either [Constr] [(L1.Edge, ConstrEdgeWeightTy)] -> [(L1.Edge, ConstrEdgeWeightTy)] +getRight (Right x) = x + +optimizeFunctionWRTDataConGlobal :: + DDefs1 -> + FunDef1 -> + DataCon -> + DataCon -> + Either [Constr] [(L1.Edge, ConstrEdgeWeightTy)] -> + Bool -> + Maybe (DDefs1, FunDef1, FieldOrder) +optimizeFunctionWRTDataConGlobal + ddefs + fundef@FunDef + { funName, + funBody, + funTy, + funArgs + } + datacon + newDcon + constrsOrEdges + useGreedy = case useGreedy of + False -> + let newFieldOrder = optimizeDataConOrderGlobal (getLeft constrsOrEdges) ddefs datacon + in case M.toList newFieldOrder of + [] -> Nothing + [(dcon, order)] -> let orignal_order = [0..(P.length order - 1)] + in if orignal_order == P.map P.fromInteger order + then Nothing + else let newDDefs = optimizeDataCon (dcon, order) ddefs newDcon + fundef' = shuffleDataConFunBody True newFieldOrder fundef newDcon + in Just (newDDefs, fundef', newFieldOrder) + _ -> error "Error: function did not expect more than one dcon to optimize." + True -> + let field_len = P.length $ snd . snd $ lkp' ddefs datacon + greedy_order = getGreedyOrder (getRight constrsOrEdges) field_len + fieldorder = M.insert datacon greedy_order M.empty + in case M.toList fieldorder of + [] -> Nothing + [(dcon, order)] -> let orignal_order = [0..(P.length order - 1)] + in if orignal_order == P.map P.fromInteger order + then Nothing + else let newDDefs = optimizeDataCon (dcon, order) ddefs newDcon + fundef' = shuffleDataConFunBody True fieldorder fundef newDcon + in Just (newDDefs, fundef', fieldorder) + _ -> error "Error: function did not expect more than one dcon to optimize." + changeCallNameInRecFunction :: Var -> FunDef1 -> FunDef1 changeCallNameInRecFunction @@ -619,6 +765,11 @@ changeCallNameInRecFunction MapE {} -> error "getExpTyEnv: TODO MapE" FoldE {} -> error "getExpTyEnv: TODO FoldE" + +-- Rather than backtracking all the producers, which seems like a lot trickier of a prospect. +-- For a new data constructor, why not just change all the occurences of this data constructor to the new one? This is much simpler. +-- However for the producer / consumer boundary optimization. The backtracking needs to be done. + genNewProducersAndRewriteProgram :: Var -> DataCon -> @@ -642,10 +793,12 @@ genNewProducersAndRewriteProgram Nothing -> error "genNewProducersAndRewriteProgram : Program has no main expression." Just (mexp, ty) -> - let variablesAndProducers = removeDuplicates $ getVariableAndProducer funName pmap venv ddefs newDataConName mexp + let + --variablesAndProducers' = dbgTraceIt ("Variables and Producers") dbgTraceIt (sdoc (funName, newDataConName)) P.concatMap (\f@FunDef{funName=fnName, funBody=fnb} -> if fnName /= funName then getVariableAndProducer funName pmap venv ddefs newDataConName fnb else []) (M.elems fundefs) + variablesAndProducers = {-dbgTraceIt ("End\n")-} removeDuplicates $ (getVariableAndProducer funName pmap venv ddefs newDataConName mexp) -- ++ variablesAndProducers' in case variablesAndProducers of - [] -> prg --error "no variable and producers found to modify" - [(var, producer)] -> + [] -> prg-- error "no variable and producers found to modify" -- Error here, has no producers to modify, figure out a way to find all producers correctly. + [(var, producer)] -> let newProducerName = producer -- toVar (fromVar producer ++ "_new") oldProducerBody = M.lookup producer fundefs in case oldProducerBody of @@ -694,6 +847,66 @@ genNewProducersAndRewriteProgram _ -> error "" x : xs -> error ("more than one variable and producer not handled yet." ++ show variablesAndProducers) + +globallyChangeDataConstructorLayout :: DataCon -> DataCon -> FieldOrder -> Prog Exp1 -> Prog Exp1 +globallyChangeDataConstructorLayout oldDcon newDcon fieldOrder prg@Prog{ddefs, fundefs, mainExp} = + let fundefs' = P.foldr (\f@FunDef{funName, funBody} funMap -> + let dconsInFunBody = dataConsInFunBody funBody + in if S.member oldDcon dconsInFunBody + then + let f' = shuffleDataConFunBody False fieldOrder f newDcon + f'' = shuffleDataConFunBody True fieldOrder f' newDcon + (m :: UseDefChainsFunctionMap Exp1) = getDefinitionsReachingLetExp f'' + funRemoveAllLets = + (\FunDef{funName=fName, funBody=fBody, funTy=fTy, funArgs=fArgs, funMeta=fMeta} -> + let removeLets = delAllLetBindings fBody + in FunDef{funName=fName, funBody=removeLets, funTy=fTy, funArgs=fArgs, funMeta=fMeta} + ) f'' + -- TODO: release let bindings based on read order. Not based on what variables are written. + var_order = S.toList $ (\FunDef{funBody=fb} -> gFreeVars fb) funRemoveAllLets + depLets = {-dbgTraceIt (sdoc var_order) dbgTraceIt "\n"-} P.map (\vv -> getDependentLetBindings vv funName m) var_order + var_order' = P.map Just var_order + var_order'' = P.zip var_order' depLets + newFuncDef = P.foldl (\fundef (insertPosition, dl) -> reOrderLetExp insertPosition dl fundef + ) funRemoveAllLets var_order'' + m' = M.insert funName newFuncDef funMap + in m' + else M.insert funName f funMap + ) M.empty (M.elems fundefs) + in Prog{ddefs=ddefs, fundefs=fundefs', mainExp=mainExp} + +order_vars_case :: Exp1 -> [Var] +order_vars_case exp = case exp of + VarE v -> [] + LitE _ -> [] + CharE _ -> [] + FloatE{} -> [] + LitSymE _ -> [] + ProjE _ e -> order_vars_case e + IfE a b c -> (order_vars_case a) ++ (order_vars_case b) ++ (order_vars_case c) + AppE v _ ls -> (L.concat $ (L.map order_vars_case ls)) + PrimAppE _ ls -> L.concat $ (L.map order_vars_case ls) + LetE (v,_,_,rhs) bod -> (order_vars_case rhs) ++ (deleteOne v (order_vars_case bod)) + CaseE e ls -> (order_vars_case e) ++ (L.concat $ + (L.map (\(_, vlocs, ee) -> + let (vars,_) = unzip vlocs + in deleteMany (order_vars_case ee) vars) ls) ) + MkProdE ls -> L.concat $ L.map order_vars_case ls + DataConE _ _ ls -> [] --L.concatMap (\exp -> case exp of + -- VarE v -> [v] + -- LitSymE v -> [v] + -- _ -> [] ) ls + TimeIt e _ _ -> order_vars_case e + MapE (v,_t,rhs) bod -> (order_vars_case rhs) ++ (deleteOne v (order_vars_case bod)) + WithArenaE v e -> deleteOne v $ order_vars_case e + FoldE{} -> error "TODO: FoldE" + SpawnE{} -> error "TODO: SpawnE" + SyncE -> error "TODO: SyncE" + Ext{} -> error "TODO: Ext" + + + + -- Function to find the the variable/s that have the type that's being optimized for the given function f -- Also return the producer of) those variable/s -- Arguments @@ -746,7 +959,7 @@ getVariableAndProducer funName pMap venv@Env2{vEnv, fEnv} ddefs dconName exp = justVariables = Maybe.catMaybes potentialVarsOfTy in if P.null justVariables -- dbgTraceIt (sdoc (funName, dconName, args, venv)) - then error "getVariableAndProducer: no variables of Ty to optimize found!" + then Nothing-- dbgTraceIt (sdoc (funName, dconName, args, venv)) error "getVariableAndProducer: no variables of Ty to optimize found!" else if P.length justVariables > 1 then error "getVariableAndProducer: More than one variable of the type being optimized is passed to function call. Not implemented yet!" @@ -791,9 +1004,9 @@ getVariableAndProducer funName pMap venv@Env2{vEnv, fEnv} ddefs dconName exp = Just (AppE f locs args) -> (var, f) : producers Just (TimeIt e _ _) -> case e of AppE f locs args -> (var, f) : producers - _ -> error "getVariableAndProducer1: producer other than a function call not expected." + _ -> {-dbgTraceIt (sdoc e)-} error "getVariableAndProducer1: producer other than a function call not expected." - _ -> + _ -> {-dbgTraceIt (sdoc (varOf, producerExp))-} error "getVariableAndProducer2: producer other than a function call not expected." Nothing -> [] @@ -1017,8 +1230,8 @@ locallyOptimizeFieldOrdering fieldMap dcons fundefs funcName field_len orderIn m genUserConstrs :: [UserOrdering] -> [Constr] genUserConstrs userOrdering = case userOrdering of - (Strong a b) : xs -> Absolute (a, b) : genUserConstrs xs - (Immediate a b) : xs -> Imm (a, b) : genUserConstrs xs + (Strong a b) : xs -> AbsoluteIndexUserConstr (a, b) : genUserConstrs xs + (Immediate a b) : xs -> ImmAfterUserConstr (a, b) : genUserConstrs xs [] -> [] -- Takes in Field access map @@ -1037,7 +1250,7 @@ timeSolver f f' = do a <- evaluate (f f') t2 <- getCurrentTime let delt = fromRational (toRational (diffUTCTime t2 t1)) - --putStrLn ("iter time: " ++ show delt) + putStrLn ("iter time: " ++ show delt) return (a, delt) optimizeDataConOrderFunc :: @@ -1062,18 +1275,19 @@ optimizeDataConOrderFunc in case datacons of [] -> orderIn [(x, field_len)] -> - let softEdges = M.findWithDefault [] x lstDconEdges - softConstrs = P.map Soft softEdges - userOrdering = M.findWithDefault [] x dconUserConstr - userConstrs = genUserConstrs userOrdering - allConstrs = softConstrs ++ userConstrs + let accessEdges = M.findWithDefault [] x lstDconEdges + solverConstraints = generateSolverEdges fundef x dconAccessMap + --softConstrs = P.map Soft softEdges + --userOrdering = dbgTraceIt ("Constraints: ") dbgTraceIt (sdoc (lstDconEdges)) M.findWithDefault [] x dconUserConstr + --userConstrs = genUserConstrs userOrdering + allConstrs = solverConstraints --userConstrs --softConstrs ++ in -- field_len = P.length $ snd . snd $ lkp ddefs x case allConstrs of [] -> orderIn - _ -> - let (layout, t) = - U.unsafePerformIO $ - timeSolver U.unsafePerformIO (solveConstrs allConstrs) + _ -> + let (layout, t) = --([], 0.0) --dbgTraceIt ("Constraints: ") dbgTraceIt (sdoc (allConstrs)) + U.unsafePerformIO $ + timeSolver U.unsafePerformIO (solveConstrs allConstrs) -- In case we don't get orderings for some of the fields in the data con -- to be safe we should complete the layout orderings of the missing fields. fix_missing = @@ -1089,12 +1303,37 @@ optimizeDataConOrderFunc else let layout' = L.sort layout in P.map snd layout' - fieldorder = M.insert x (integerList fix_missing) orderIn + fieldorder = {-dbgTraceIt ("NewOrder.") dbgTraceIt (sdoc fix_missing) dbgTraceIt ("End.\n")-} M.insert x (integerList fix_missing) orderIn in fieldorder _ -> error "OptimizeFieldOrder: optimizeDataConOrderFunc more that one data constructor per function not implemented yet." + +optimizeDataConOrderGlobal :: [Constr] -> DDefs1 -> DataCon -> FieldOrder +optimizeDataConOrderGlobal constrs ddefs dcon = + let field_len = P.length $ snd . snd $ lkp ddefs dcon + in case constrs of + [] -> M.empty + _ -> let (layout, t) = U.unsafePerformIO $ timeSolver U.unsafePerformIO (solveConstrs constrs) + -- In case we don't get orderings for some of the fields in the data con + -- to be safe we should complete the layout orderings of the missing fields. + fix_missing = if P.length layout < field_len + then + let indices = [0 .. (field_len - 1)] + minuslist = makeneg field_len + partial = fillList minuslist layout + avail = P.map fst layout + navail = deleteMany avail indices + new = fillminus1 partial navail + in new + else + let layout' = L.sort layout + in P.map snd layout' + fieldorder = {-dbgTraceIt ("NewOrder.") dbgTraceIt (sdoc fix_missing) dbgTraceIt ("End.\n")-} M.insert dcon (integerList fix_missing) M.empty + in fieldorder + _ -> error "OptimizeFieldOrder: optimizeDataConOrderFunc more that one data constructor per function not implemented yet." + -- for the function for which we are locally optimizing for, find the optimal layout of the data constructors that we care about. -- "Locally optimizing for the function" generateLocallyOptimalOrderings :: @@ -1126,12 +1365,12 @@ generateLocallyOptimalOrderings [] -> orderIn x : xs -> let dconEdges = M.findWithDefault [] x lstDconEdges - dconEdges' = P.map Soft dconEdges + dconEdges' = [] --P.map Soft dconEdges in case dconEdges' of [] -> orderIn _ -> - let layout = - U.unsafePerformIO (solveConstrs dconEdges') + let layout = [] + -- U.unsafePerformIO (solveConstrs dconEdges') -- In case we don't get orderings for some of the fields in the data con -- to be safe we should complete the layout orderings of the missing fields. fix_missing = @@ -1145,7 +1384,7 @@ generateLocallyOptimalOrderings new = fillminus1 partial navail in new else - let layout' = L.sort layout + let layout' = [] --L.sort layout in P.map snd layout' fieldorder = M.insert x (integerList fix_missing) orderIn @@ -1657,4 +1896,98 @@ mkLets' :: [(Var, [()], Ty1, PreExp E1Ext () Ty1)] -> Exp1 -> Exp1 -mkLets' bs bod = P.foldr LetE bod bs \ No newline at end of file +mkLets' bs bod = P.foldr LetE bod bs + + + +-- For a given Function, deduce the types of each field of a dataconstructor relavant for the solver +deduceFieldSolverTypes :: DDefs1 -> FunDef1 -> FunDef1 +deduceFieldSolverTypes dataDefinitions f@FunDef {funName, funBody, funTy, funArgs, funMeta} = + let dconsUsedInFunction = dataConsInFunBody funBody + dataConFieldTypeInfo = P.foldr (\dcon map -> let flds = lookupDataCon dataDefinitions dcon + (_, meta) = {-dbgTraceIt (sdoc flds)-} P.foldr (\fld (index::Int, map) -> + let isInline = maybeInlineable fld funTy dataDefinitions funName funBody + (isRec, m) = {-([], M.empty)-} isRecursive fld dataDefinitions M.empty + isSc = {-[]-} isScalar fld dataDefinitions dcon M.empty + isSR = isSelfRecursive fld dataDefinitions dcon + ind' = index-1 + in (ind', M.insert index (isInline ++ isRec ++ isSc ++ isSR) map) + --index = elemIndex fld flds + --in case index of + -- Nothing -> map + -- Just val -> M.insert index (isInline ++ isRec ++ isSc ++ isSR) map + ) ((P.length flds) - 1, M.empty) flds + in M.insert dcon meta map + ) M.empty (S.toList dconsUsedInFunction) + in {-dbgTraceIt (sdoc (funName, dataConFieldTypeInfo, snd funTy, funArgs))-} FunDef{funName=funName, funBody=funBody, funTy=funTy, funArgs=funArgs, funMeta=funMeta{dataConFieldTypeInfo=Just dataConFieldTypeInfo}} + + +maybeInlineable :: Ty1 -> ArrowTy Ty1 -> DDefs1 -> Var -> Exp1 -> [DataConFieldType] +maybeInlineable fld funty dataDefinitions funname exp = if (elem fld (fst funty) && (fst (isRecursive fld dataDefinitions M.empty) == [Recursive])) then [IsInlineable] else [] + +-- only for packed mode +-- TODO: update check for pointer mode. +isSelfRecursive :: Ty1 -> DDefs1 -> DataCon -> [DataConFieldType] +isSelfRecursive fld ddefs dcon = let tycon = getTyOfDataCon ddefs dcon + urty = PackedTy tycon () + in if urty == fld then [SelfRecursive] else [] + +-- isScalar :: Ty1 -> DDefs1 -> DataCon -> [DataConFieldType] +-- isScalar fld ddefs dcon = case fld of +-- PackedTy tycon () -> let d@DDef{tyName=tn, tyArgs=targ, dataCons=dcons} = lookupDDef ddefs tycon +-- len = P.length dcons +-- in if len == 1 then +-- let scl = checkScalar (fst (P.head dcons)) ddefs +-- in if scl then [Scalar] +-- else [] +-- else [] + +-- -- TODO: check for other types is not implemented yet. +-- _ -> [] + +isScalar :: Ty1 -> DDefs1 -> DataCon -> M.Map Ty1 DataConFieldType -> [DataConFieldType] +isScalar fld ddefs dcon map = case (isRecursive fld ddefs map) of + ([Recursive], _ ) -> [] + _ -> if isPackedTy fld + then [] + else [Scalar] + +-- checkScalar :: DataCon -> DDefs1 -> Bool +-- checkScalar dcon ddefs = let flds = lookupDataCon ddefs dcon +-- in case flds of +-- [a] -> case a of +-- IntTy -> True +-- CharTy -> True +-- FloatTy -> True +-- BoolTy -> True +-- _ -> False +-- _ -> False + + + +isRecursive :: Ty1 -> DDefs1 -> M.Map Ty1 DataConFieldType -> ([DataConFieldType], M.Map Ty1 DataConFieldType) +isRecursive fld ddefs map = case M.lookup fld map of + Nothing -> case fld of --[(DataCon, [(IsBoxed, a)])] + PackedTy tycon () -> let d@DDef{tyName=tn, tyArgs=targ, dataCons=dcons} = lookupDDef ddefs tycon + fld' = P.concatMap (\(a, b) -> P.concatMap (\(d, c) -> [c]) b) dcons + (check, map') = P.foldr (\ty (accum, m) -> + if not (M.member ty m) + then + let (r', m') = if (ty == fld) then (accum || True, M.insert ty Recursive m) else (accum || False, m) --isRecursive ty ddefs m'' + in case r' of + True -> (accum || True, M.insert ty Recursive m') + False -> let (r'', m'') = isRecursive ty ddefs m' + in case r'' of + [Recursive] -> (accum || True, M.insert ty Recursive m'') + [] -> (accum || False, M.insert ty Recursive m'') + else + case M.lookup ty m of + Just k -> (accum || True, m) + Nothing -> (accum || False, m) + ) (False, map) fld' + in if check + then ([Recursive], M.insert fld Recursive map') + else ([], map') + _ -> ([], map) + Just val -> ([val], map) + \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/SolveLayoutConstrs.hs b/gibbon-compiler/src/Gibbon/Passes/SolveLayoutConstrs.hs index d859859fa..a1d6ac381 100644 --- a/gibbon-compiler/src/Gibbon/Passes/SolveLayoutConstrs.hs +++ b/gibbon-compiler/src/Gibbon/Passes/SolveLayoutConstrs.hs @@ -36,7 +36,7 @@ python3 = "python3" solveConstrs :: [Constr] -> IO Layout solveConstrs constrs = do - let pycode = fst $ defaultRunPassM (pythonCodegen constrs) + let pycode = fst $ defaultRunPassM (pythonCodegenNew constrs) uniq <- randomIO :: IO Int8 let fp = "./solve_ilp_" ++ show uniq ++ ".py" writeFile fp pycode @@ -55,87 +55,507 @@ solveConstrs constrs = do "Running docplex program in file " ++ fp ++ " exited with error code " ++ show n -pythonCodegen :: [Constr] -> PassM String -pythonCodegen constrs - -- There should be a map mapping indexes to the generated variables - -- 3 maps for different constraints - -- Here have a map to seperate the soft constraints and pass as usual - = do - let idxs = - L.nub $ - P.concatMap - (\a -> - case a of - Soft ((a, b), _) -> [a, b] - _ -> []) - constrs - let softConstr = - P.concatMap - (\a -> - case a of - Soft a -> [a] - _ -> []) - constrs - let immediateConstrVariables = - L.nub $ - P.concatMap - (\a -> - case a of - Imm (a, b) -> [a, b] - _ -> []) - constrs +-- pythonCodegen :: [Constr] -> PassM String +-- pythonCodegen constrs +-- -- There should be a map mapping indexes to the generated variables +-- -- 3 maps for different constraints +-- -- Here have a map to seperate the soft constraints and pass as usual +-- = do +-- let idxs = +-- L.nub $ +-- P.concatMap +-- (\a -> +-- case a of +-- Soft ((a, b), _) -> [a, b] +-- _ -> []) +-- constrs +-- let softConstr = +-- P.concatMap +-- (\a -> +-- case a of +-- Soft a -> [a] +-- _ -> []) +-- constrs +-- let immediateConstrVariables = +-- L.nub $ +-- P.concatMap +-- (\a -> +-- case a of +-- Imm (a, b) -> [a, b] +-- _ -> []) +-- constrs --- filter out the relative constraints. - -- don't need integers in snd part of tuple since they are positions that need to be assigned not for creating variables. - let relativeConstrs = - P.concatMap - (\a -> - case a of - Imm a -> [a] - _ -> []) - constrs - let absConstrVariables = - L.nub $ - P.concatMap - (\a -> - case a of - Absolute (a, b) -> [a] - _ -> []) - constrs - let strongConstraints = - P.concatMap - (\a -> - case a of - Absolute a -> [a] - _ -> []) - constrs +-- -- filter out the relative constraints. +-- -- don't need integers in snd part of tuple since they are positions that need to be assigned not for creating variables. +-- let relativeConstrs = +-- P.concatMap +-- (\a -> +-- case a of +-- Imm a -> [a] +-- _ -> []) +-- constrs +-- let absConstrVariables = +-- L.nub $ +-- P.concatMap +-- (\a -> +-- case a of +-- Absolute (a, b) -> [a] +-- _ -> []) +-- constrs +-- let strongConstraints = +-- P.concatMap +-- (\a -> +-- case a of +-- Absolute a -> [a] +-- _ -> []) +-- constrs --- [ (field_index, variable_name) ] - node_map <- - mapM - (\i -> (i, ) <$> fromVar <$> gensym (toVar ("x_" ++ show i))) - (L.nub $ (idxs ++ immediateConstrVariables ++ absConstrVariables)) - let node_vars = P.concatMap (\(i, var) -> [var]) node_map - model_var <- (\i -> "model_" ++ show i) <$> newUniq - let init_model = - Py.Assign - [Py.Var (pyident model_var) ()] - (Py.Call (Py.Var (pyident "Model") ()) [] ()) - () +-- -- [ (field_index, variable_name) ] +-- node_map <- +-- mapM +-- (\i -> (i, ) <$> fromVar <$> gensym (toVar ("x_" ++ show i))) +-- (L.nub $ (idxs ++ immediateConstrVariables ++ absConstrVariables)) +-- let node_vars = P.concatMap (\(i, var) -> [var]) node_map +-- model_var <- (\i -> "model_" ++ show i) <$> newUniq +-- let init_model = +-- Py.Assign +-- [Py.Var (pyident model_var) ()] +-- (Py.Call (Py.Var (pyident "Model") ()) [] ()) +-- () --- make a map for upper, lower bounds. - let (lb, ub) = +-- -- make a map for upper, lower bounds. +-- let (lb, ub) = +-- ( fromIntegral $ 0 +-- , fromIntegral $ +-- (P.length (L.nub $ (idxs ++ immediateConstrVariables))) - 1) +-- let soft_rel_to_ub = +-- P.map +-- (\index -> (fromJust $ lookup index node_map, ub)) +-- (idxs ++ immediateConstrVariables) +-- let abs_ub = +-- P.map (\(x, y) -> (fromJust $ lookup x node_map, y)) strongConstraints +-- let vars_ub = soft_rel_to_ub ++ abs_ub +-- let init_nodes = +-- map +-- (\x -> +-- pyassign1 +-- x +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "integer_var") ()) +-- [ Py.ArgKeyword (pyident "lb") (Py.Int lb (show lb) ()) () +-- , Py.ArgKeyword +-- (pyident "ub") +-- (Py.Int +-- (fromJust $ lookup x vars_ub) +-- (show (fromJust $ lookup x vars_ub)) +-- ()) +-- () +-- , Py.ArgKeyword (pyident "name") (Py.Strings [show x] ()) () +-- ] +-- ())) +-- node_vars +-- let num_edges = +-- P.sum $ +-- P.map +-- (\a -> +-- case a of +-- Soft _ -> 1 +-- _ -> 0) +-- constrs +-- cost_map <- +-- mapM (\i -> (i, ) <$> fromVar <$> gensym (toVar "cost")) [1 .. num_edges] +-- let cost_vars = map snd cost_map +-- let import_doplex = +-- Py.FromImport +-- (Py.ImportRelative +-- 0 +-- (Just [pyident "docplex", pyident "mp", pyident "model"]) +-- ()) +-- (Py.FromItems [Py.FromItem (pyident "Model") Nothing ()] ()) +-- () +-- let init_costs = +-- map +-- (\x -> +-- pyassign1 +-- x +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "integer_var") ()) +-- [Py.ArgKeyword (pyident "name") (Py.Strings [show x] ()) ()] +-- ())) +-- cost_vars +-- minimize_parts <- +-- mapM (\_ -> fromVar <$> gensym (toVar "min")) [1 .. num_edges] +-- let constrs_for_edge = +-- (\(((from, to), wt), cost, minimize_part) -> do +-- let x = fromJust $ lookup from node_map +-- let y = fromJust $ lookup to node_map +-- -- let cost_x = fromJust $ lookup from cost_map -- Vidush review +-- eq_minus_one <- fromVar <$> (gensym "cost") +-- leq_minus_one <- fromVar <$> (gensym "cost") +-- eq_one <- fromVar <$> (gensym "cost") +-- geq_one <- fromVar <$> (gensym "cost") +-- neq_minus_one <- fromVar <$> (gensym "cost") +-- neq_one <- fromVar <$> (gensym "cost") +-- x_minus_y <- fromVar <$> (gensym "x_minus_y") +-- pure $ +-- [ pyassign1 +-- x_minus_y +-- (Py.Paren (Py.BinaryOp (Py.Minus ()) (pyvar x) (pyvar y) ()) ()) +-- , pyassign1 +-- eq_minus_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar x_minus_y) +-- (Py.Int (-1) (show (-1)) ()) +-- ()) +-- ()) +-- , pyassign1 +-- leq_minus_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.LessThanEquals ()) +-- (pyvar x_minus_y) +-- (Py.Int (-1) (show (-1)) ()) +-- ()) +-- ()) +-- , pyassign1 +-- eq_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar x_minus_y) +-- (Py.Int 1 (show 1) ()) +-- ()) +-- ()) +-- , pyassign1 +-- geq_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.GreaterThanEquals ()) +-- (pyvar x_minus_y) +-- (Py.Int 1 (show 1) ()) +-- ()) +-- ()) +-- , pyassign1 +-- neq_minus_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.NotEquals ()) +-- (pyvar x_minus_y) +-- (Py.Int (-1) (show (-1)) ()) +-- ()) +-- ()) +-- , pyassign1 +-- neq_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.NotEquals ()) +-- (pyvar x_minus_y) +-- (Py.Int 1 (show 1) ()) +-- ()) +-- ()) +-- , Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp +-- (Py.LessThanEquals ()) +-- (pyvar eq_minus_one) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar cost) +-- (Py.Int 0 (show 0) ()) +-- ()) +-- ()) +-- ()) +-- () +-- ] +-- ()) +-- () +-- , Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp +-- (Py.LessThanEquals ()) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.BinaryAnd ()) +-- (pyvar leq_minus_one) +-- (pyvar neq_minus_one) +-- ()) +-- ()) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar cost) +-- (Py.Int 100 (show 100) ()) +-- ()) +-- ()) +-- ()) +-- () +-- ] +-- ()) +-- () +-- , Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp +-- (Py.LessThanEquals ()) +-- (pyvar eq_one) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar cost) +-- (Py.Int 200 (show 200) ()) +-- ()) +-- ()) +-- ()) +-- () +-- ] +-- ()) +-- () +-- , Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp +-- (Py.LessThanEquals ()) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.BinaryAnd ()) +-- (pyvar geq_one) +-- (pyvar neq_one) +-- ()) +-- ()) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar cost) +-- (Py.Int 300 (show 300) ()) +-- ()) +-- ()) +-- ()) +-- () +-- ] +-- ()) +-- () +-- , pyassign1 +-- minimize_part +-- (Py.BinaryOp +-- (Py.Multiply ()) +-- (pyvar cost) +-- (Py.Int wt (show wt) ()) +-- ()) +-- ]) :: ((((Integer, Integer), Integer), String, String) -> PassM [(Py.Statement ())]) +-- constrs_for_edges <- +-- concat <$> mapM constrs_for_edge (zip3 softConstr cost_vars minimize_parts) +-- let expr_to_minimize = +-- foldr +-- (\x acc -> Py.BinaryOp (Py.Plus ()) (pyvar x) acc ()) +-- (Py.Int 0 (show 0) ()) +-- minimize_parts +-- let call_minimize = +-- Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "minimize") ()) +-- [(Py.ArgExpr expr_to_minimize ())] +-- ()) +-- () +-- -- All the fields should have unique index positions. +-- let uniq_constrs = +-- map +-- (\[i, j] -> +-- Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp (Py.NotEquals ()) (pyvar i) (pyvar j) ()) +-- () +-- ] +-- ()) +-- ()) +-- (combinations 2 node_vars) +-- soln_var <- fromVar <$> (gensym "soln") +-- let call_solve = +-- pyassign1 +-- soln_var +-- (Py.Call (Py.Dot (pyvar model_var) (pyident "solve") ()) [] ()) +-- let answer_format_str = "({},{})" +-- let print_left_bracket = +-- Py.StmtExpr +-- (Py.Call +-- (pyvar "print") +-- [Py.ArgExpr (Py.Strings [(show "[")] ()) ()] +-- ()) +-- () +-- let print_right_bracket = +-- Py.StmtExpr +-- (Py.Call +-- (pyvar "print") +-- [Py.ArgExpr (Py.Strings [(show "]")] ()) ()] +-- ()) +-- () +-- let print_answers = +-- map +-- (\(i, v) -> +-- Py.StmtExpr +-- (Py.Call +-- (pyvar "print") +-- [ (Py.ArgExpr +-- (Py.Call +-- (Py.Dot +-- (Py.Strings [show answer_format_str] ()) +-- (pyident "format") +-- ()) +-- [ Py.ArgExpr (Py.Int i (show i) ()) () +-- , Py.ArgExpr +-- (Py.Call +-- (Py.Dot +-- (pyvar soln_var) +-- (pyident "get_value") +-- ()) +-- [Py.ArgExpr (pyvar v) ()] +-- ()) +-- () +-- ] +-- ()) +-- ()) +-- ] +-- ()) +-- ()) +-- node_map + +-- -- make the relative constraints is they exist +-- let relativeConstrsBindings = +-- P.map +-- (\(x, y) -> +-- Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar (fromJust $ lookup y node_map)) +-- (Py.BinaryOp +-- (Py.Plus ()) +-- (pyvar (fromJust $ lookup x node_map)) +-- ((Py.Int 1 (show 1) ())) +-- ()) +-- ()) +-- () +-- ] +-- ()) +-- ()) +-- relativeConstrs +-- let absolute_ordering_constrs = +-- P.map +-- (\(x, y) -> +-- Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar (fromJust $ lookup x node_map)) +-- ((Py.Int y (show y) ())) +-- ()) +-- () +-- ] +-- ()) +-- ()) +-- strongConstraints +-- let stmts = +-- [import_doplex, init_model] ++ +-- init_nodes ++ +-- init_costs ++ +-- constrs_for_edges ++ +-- uniq_constrs ++ +-- relativeConstrsBindings ++ +-- absolute_ordering_constrs ++ +-- [call_minimize, call_solve] ++ print_answers +-- let pycode = Py.prettyText (Py.Module stmts) +-- pure pycode --dbgTraceIt (sdoc node_vars) (dbgTraceIt "\n") + + +-- https://stackoverflow.com/a/52605612 +combinations :: Int -> [a] -> [[a]] +combinations k ns = filter ((k ==) . length) $ L.subsequences ns + + +-------------------------------------------------------------------------------- +pyident :: String -> Py.Ident () +pyident s = Py.Ident s () + +pyvar :: String -> Py.Expr () +pyvar s = Py.Var (pyident s) () + +pyassign1 :: String -> Py.Expr () -> Py.Statement () +pyassign1 v rhs = Py.Assign [pyvar v] rhs () + + +pythonCodegenNew :: [Constr] -> PassM String +pythonCodegenNew constrs = do + let idxs = {-dbgTraceIt (sdoc constrs)-} + L.nub $ + P.concatMap + (\a -> case a of + WeakConstr (((a, _), (b, _)) , _) -> [a, b] + StrongConstr (((a, _), (b, _)) , _) -> [a, b] + _ -> [] + ) constrs + let weakEdges = P.concatMap (\constr -> case constr of + WeakConstr a -> [a] + _ -> [] + ) constrs + let strongEdges = P.concatMap (\constr -> case constr of + StrongConstr a -> [a] + _ -> [] + ) constrs + let immediateAfterUserVariables = P.concatMap (\constr -> case constr of + ImmAfterUserConstr (a, b) -> [a, b] + _ -> [] + ) constrs + let absoluteIndexUserVariables = P.concatMap (\constr -> case constr of + AbsoluteIndexUserConstr (a, b) -> [a, b] + _ -> [] + ) constrs + + let immediateAfterUserConstraints = P.concatMap (\constr -> case constr of + ImmAfterUserConstr a -> [a] + _ -> [] + ) constrs + + let absoluteIndexUserConstraints = P.concatMap (\constr -> case constr of + AbsoluteIndexUserConstr a -> [a] + _ -> [] + ) constrs + node_map <- + mapM + (\i -> (i, ) <$> fromVar <$> gensym (toVar ("x_" ++ show i))) + (L.nub $ idxs ++ immediateAfterUserVariables ++ absoluteIndexUserVariables) + let node_vars = P.concatMap (\(i, var) -> [var]) node_map + model_var <- (\i -> "model_" ++ show i) <$> newUniq + let init_model = + Py.Assign + [Py.Var (pyident model_var) ()] + (Py.Call (Py.Var (pyident "Model") ()) [] ()) + () + -- make a map for upper, lower bounds. + let (lb :: Integer, ub :: Integer) = ( fromIntegral $ 0 , fromIntegral $ - (P.length (L.nub $ (idxs ++ immediateConstrVariables))) - 1) - let soft_rel_to_ub = - P.map - (\index -> (fromJust $ lookup index node_map, ub)) - (idxs ++ immediateConstrVariables) - let abs_ub = - P.map (\(x, y) -> (fromJust $ lookup x node_map, y)) strongConstraints - let vars_ub = soft_rel_to_ub ++ abs_ub - let init_nodes = + (P.length (L.nub $ idxs ++ immediateAfterUserVariables ++ absoluteIndexUserVariables)) - 1) + let soft_rel_to_ub = + P.map + (\index -> (fromJust $ lookup index node_map, ub)) + (idxs ++ immediateAfterUserVariables) + let abs_ub = P.map (\(x, y) -> (fromJust $ lookup x node_map, y)) absoluteIndexUserConstraints + let vars_ub = soft_rel_to_ub ++ abs_ub + let init_nodes = map (\x -> pyassign1 @@ -154,18 +574,7 @@ pythonCodegen constrs ] ())) node_vars - let num_edges = - P.sum $ - P.map - (\a -> - case a of - Soft _ -> 1 - _ -> 0) - constrs - cost_map <- - mapM (\i -> (i, ) <$> fromVar <$> gensym (toVar "cost")) [1 .. num_edges] - let cost_vars = map snd cost_map - let import_doplex = + let import_doplex = Py.FromImport (Py.ImportRelative 0 @@ -173,200 +582,702 @@ pythonCodegen constrs ()) (Py.FromItems [Py.FromItem (pyident "Model") Nothing ()] ()) () - let init_costs = - map - (\x -> - pyassign1 - x - (Py.Call - (Py.Dot (pyvar model_var) (pyident "integer_var") ()) - [Py.ArgKeyword (pyident "name") (Py.Strings [show x] ()) ()] - ())) - cost_vars - minimize_parts <- - mapM (\_ -> fromVar <$> gensym (toVar "min")) [1 .. num_edges] - let constrs_for_edge = - (\(((from, to), wt), cost, minimize_part) -> do - let x = fromJust $ lookup from node_map - let y = fromJust $ lookup to node_map - -- let cost_x = fromJust $ lookup from cost_map -- Vidush review - eq_minus_one <- fromVar <$> (gensym "cost") - leq_minus_one <- fromVar <$> (gensym "cost") - eq_one <- fromVar <$> (gensym "cost") - geq_one <- fromVar <$> (gensym "cost") - neq_minus_one <- fromVar <$> (gensym "cost") - neq_one <- fromVar <$> (gensym "cost") - x_minus_y <- fromVar <$> (gensym "x_minus_y") - pure $ - [ pyassign1 - x_minus_y - (Py.Paren (Py.BinaryOp (Py.Minus ()) (pyvar x) (pyvar y) ()) ()) - , pyassign1 - eq_minus_one - (Py.Paren - (Py.BinaryOp - (Py.Equality ()) - (pyvar x_minus_y) - (Py.Int (-1) (show (-1)) ()) - ()) - ()) - , pyassign1 - leq_minus_one - (Py.Paren - (Py.BinaryOp - (Py.LessThanEquals ()) - (pyvar x_minus_y) - (Py.Int (-1) (show (-1)) ()) - ()) - ()) - , pyassign1 - eq_one - (Py.Paren - (Py.BinaryOp - (Py.Equality ()) - (pyvar x_minus_y) - (Py.Int 1 (show 1) ()) - ()) - ()) - , pyassign1 - geq_one - (Py.Paren - (Py.BinaryOp - (Py.GreaterThanEquals ()) - (pyvar x_minus_y) - (Py.Int 1 (show 1) ()) - ()) - ()) - , pyassign1 - neq_minus_one - (Py.Paren - (Py.BinaryOp - (Py.NotEquals ()) - (pyvar x_minus_y) - (Py.Int (-1) (show (-1)) ()) - ()) - ()) - , pyassign1 - neq_one - (Py.Paren - (Py.BinaryOp - (Py.NotEquals ()) - (pyvar x_minus_y) - (Py.Int 1 (show 1) ()) - ()) - ()) - , Py.StmtExpr - (Py.Call - (Py.Dot (pyvar model_var) (pyident "add") ()) - [ Py.ArgExpr - (Py.BinaryOp - (Py.LessThanEquals ()) - (pyvar eq_minus_one) - (Py.Paren - (Py.BinaryOp - (Py.Equality ()) - (pyvar cost) - (Py.Int 0 (show 0) ()) + let init_model = + Py.Assign + [Py.Var (pyident model_var) ()] + (Py.Call (Py.Var (pyident "Model") ()) [] ()) + () + let num_weak_edges = + P.sum $ + P.map + (\a -> + case a of + WeakConstr _ -> 1 + _ -> 0 + ) + constrs + let num_strong_edges = + P.sum $ + P.map + (\a -> + case a of + StrongConstr _ -> 1 + _ -> 0) + constrs + let total_edges = num_weak_edges + num_strong_edges + cost_map <- mapM (\i -> (i, ) <$> fromVar <$> gensym (toVar "cost")) [1 .. total_edges] + let cost_vars = map snd cost_map + let init_costs = + map + (\x -> + pyassign1 + x + (Py.Call + (Py.Dot (pyvar model_var) (pyident "integer_var") ()) + [Py.ArgKeyword (pyident "name") (Py.Strings [show x] ()) ()] + ())) + cost_vars + minimize_parts <- mapM (\_ -> fromVar <$> gensym (toVar "min")) [1 .. total_edges] + let constrs_for_edge = + (\(constr, cost, minimize_part) -> do + case constr of + WeakConstr (((from, fromTy), (to, toTy)), wt) -> do + let x = fromJust $ lookup from node_map + let y = fromJust $ lookup to node_map + eq_minus_one <- fromVar <$> (gensym "cost") + leq_minus_one <- fromVar <$> (gensym "cost") + eq_one <- fromVar <$> (gensym "cost") + geq_one <- fromVar <$> (gensym "cost") + neq_minus_one <- fromVar <$> (gensym "cost") + neq_one <- fromVar <$> (gensym "cost") + x_minus_y <- fromVar <$> (gensym "x_minus_y") + case (returnFieldTypeBasedOnHeirarchy fromTy, returnFieldTypeBasedOnHeirarchy toTy) of + -- Due to compiler being un-implemendted, make sure scalar is put before inlineable. + -- This should be removed once this part is implemented. + -- That is scalar fields can be placed after recursive fields. + (Just Scalar, Just IsInlineable) -> + pure $ + [ pyassign1 + x_minus_y + (Py.Paren (Py.BinaryOp (Py.Minus ()) (pyvar x) (pyvar y) ()) ()) + , pyassign1 + eq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) ()) - ()) - ()) - () - ] - ()) - () - , Py.StmtExpr - (Py.Call - (Py.Dot (pyvar model_var) (pyident "add") ()) - [ Py.ArgExpr - (Py.BinaryOp - (Py.LessThanEquals ()) - (Py.Paren - (Py.BinaryOp - (Py.BinaryAnd ()) - (pyvar leq_minus_one) - (pyvar neq_minus_one) + , pyassign1 + leq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) ()) - ()) - (Py.Paren - (Py.BinaryOp - (Py.Equality ()) - (pyvar cost) - (Py.Int 100 (show 100) ()) + , pyassign1 + eq_one + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , pyassign1 + geq_one + (Py.Paren + (Py.BinaryOp + (Py.GreaterThanEquals ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , pyassign1 + neq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.NotEquals ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) + ()) + , pyassign1 + neq_one + (Py.Paren + (Py.BinaryOp + (Py.NotEquals ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar eq_minus_one) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 0 (show 0) ()) + ()) + ()) + ()) + () + ] + ()) + () + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (Py.Paren + (Py.BinaryOp + (Py.BinaryAnd ()) + (pyvar leq_minus_one) + (pyvar neq_minus_one) + ()) + ()) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 200 (show 200) ()) + ()) + ()) + ()) + () + ] + ()) + () + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar eq_one) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 400 (show 400) ()) + ()) + ()) + ()) + () + ] ()) + () + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (Py.Paren + (Py.BinaryOp + (Py.BinaryAnd ()) + (pyvar geq_one) + (pyvar neq_one) + ()) + ()) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 600 (show 600) ()) + ()) + ()) + ()) + () + ] + ()) + () + , pyassign1 + minimize_part + (Py.BinaryOp + (Py.Multiply ()) + (pyvar cost) + (Py.Int wt (show wt) ()) + ()) + ] + (_, Just IsInlineable) -> pure $ + [ pyassign1 + x_minus_y + (Py.Paren (Py.BinaryOp (Py.Minus ()) (pyvar x) (pyvar y) ()) ()) + , pyassign1 + eq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) + ()) + , pyassign1 + leq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) + ()) + , pyassign1 + eq_one + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , pyassign1 + geq_one + (Py.Paren + (Py.BinaryOp + (Py.GreaterThanEquals ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , pyassign1 + neq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.NotEquals ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) + ()) + , pyassign1 + neq_one + (Py.Paren + (Py.BinaryOp + (Py.NotEquals ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar eq_minus_one) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 400 (show 400) ()) + ()) + ()) + ()) + () + ] + ()) + () + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (Py.Paren + (Py.BinaryOp + (Py.BinaryAnd ()) + (pyvar leq_minus_one) + (pyvar neq_minus_one) + ()) + ()) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 600 (show 600) ()) + ()) + ()) + ()) + () + ] + ()) + () + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar eq_one) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 0 (show 0) ()) + ()) + ()) + ()) + () + ] + ()) + () + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (Py.Paren + (Py.BinaryOp + (Py.BinaryAnd ()) + (pyvar geq_one) + (pyvar neq_one) + ()) + ()) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 200 (show 200) ()) + ()) + ()) + ()) + () + ] + ()) + () + , pyassign1 + minimize_part + (Py.BinaryOp + (Py.Multiply ()) + (pyvar cost) + (Py.Int wt (show wt) ()) + ()) + ] + _ -> pure $ + [ pyassign1 + x_minus_y + (Py.Paren (Py.BinaryOp (Py.Minus ()) (pyvar x) (pyvar y) ()) ()) + , pyassign1 + eq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) + ()) + , pyassign1 + leq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) + ()) + , pyassign1 + eq_one + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , pyassign1 + geq_one + (Py.Paren + (Py.BinaryOp + (Py.GreaterThanEquals ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , pyassign1 + neq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.NotEquals ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) + ()) + , pyassign1 + neq_one + (Py.Paren + (Py.BinaryOp + (Py.NotEquals ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar eq_minus_one) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 0 (show 0) ()) + ()) + ()) + ()) + () + ] + ()) + () + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (Py.Paren + (Py.BinaryOp + (Py.BinaryAnd ()) + (pyvar leq_minus_one) + (pyvar neq_minus_one) + ()) + ()) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 200 (show 200) ()) + ()) + ()) + ()) + () + ] + ()) + () + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar eq_one) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 400 (show 400) ()) + ()) + ()) + ()) + () + ] + ()) + () + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (Py.Paren + (Py.BinaryOp + (Py.BinaryAnd ()) + (pyvar geq_one) + (pyvar neq_one) + ()) + ()) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 600 (show 600) ()) + ()) + ()) + ()) + () + ] + ()) + () + , pyassign1 + minimize_part + (Py.BinaryOp + (Py.Multiply ()) + (pyvar cost) + (Py.Int wt (show wt) ()) + ()) + ] + StrongConstr (((from, fromTy), (to, toTy)), wt) -> do + let x = fromJust $ lookup from node_map + let y = fromJust $ lookup to node_map + eq_minus_one <- fromVar <$> (gensym "cost") + leq_minus_one <- fromVar <$> (gensym "cost") + eq_one <- fromVar <$> (gensym "cost") + geq_one <- fromVar <$> (gensym "cost") + neq_minus_one <- fromVar <$> (gensym "cost") + neq_one <- fromVar <$> (gensym "cost") + x_minus_y <- fromVar <$> (gensym "x_minus_y") + pure $ + [ pyassign1 + x_minus_y + (Py.Paren (Py.BinaryOp (Py.Minus ()) (pyvar x) (pyvar y) ()) ()) + , pyassign1 + eq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) + ()) + , pyassign1 + leq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) ()) + ()) + , pyassign1 + eq_one + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) ()) - () - ] - ()) - () - , Py.StmtExpr - (Py.Call - (Py.Dot (pyvar model_var) (pyident "add") ()) - [ Py.ArgExpr - (Py.BinaryOp - (Py.LessThanEquals ()) - (pyvar eq_one) - (Py.Paren + ()) + , pyassign1 + geq_one + (Py.Paren + (Py.BinaryOp + (Py.GreaterThanEquals ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , pyassign1 + neq_minus_one + (Py.Paren + (Py.BinaryOp + (Py.NotEquals ()) + (pyvar x_minus_y) + (Py.Int (-1) (show (-1)) ()) + ()) + ()) + , pyassign1 + neq_one + (Py.Paren + (Py.BinaryOp + (Py.NotEquals ()) + (pyvar x_minus_y) + (Py.Int 1 (show 1) ()) + ()) + ()) + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr (Py.BinaryOp - (Py.Equality ()) - (pyvar cost) - (Py.Int 200 (show 200) ()) + (Py.LessThanEquals ()) + (pyvar eq_minus_one) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 0 (show 0) ()) + ()) ()) ()) - ()) + () + ] + ()) () - ] - ()) - () - , Py.StmtExpr - (Py.Call - (Py.Dot (pyvar model_var) (pyident "add") ()) - [ Py.ArgExpr - (Py.BinaryOp - (Py.LessThanEquals ()) - (Py.Paren + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr (Py.BinaryOp - (Py.BinaryAnd ()) - (pyvar geq_one) - (pyvar neq_one) + (Py.LessThanEquals ()) + (Py.Paren + (Py.BinaryOp + (Py.BinaryAnd ()) + (pyvar leq_minus_one) + (pyvar neq_minus_one) + ()) ()) - ()) - (Py.Paren - (Py.BinaryOp - (Py.Equality ()) - (pyvar cost) - (Py.Int 300 (show 300) ()) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 100 (show 100) ()) + ()) ()) ()) - ()) + () + ] + ()) () - ] - ()) - () - , pyassign1 - minimize_part - (Py.BinaryOp - (Py.Multiply ()) - (pyvar cost) - (Py.Int wt (show wt) ()) - ()) - ]) :: ((((Integer, Integer), Integer), String, String) -> PassM [(Py.Statement ())]) - constrs_for_edges <- - concat <$> mapM constrs_for_edge (zip3 softConstr cost_vars minimize_parts) - let expr_to_minimize = + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (pyvar eq_one) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 200 (show 200) ()) + ()) + ()) + ()) + () + ] + ()) + () + , Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.LessThanEquals ()) + (Py.Paren + (Py.BinaryOp + (Py.BinaryAnd ()) + (pyvar geq_one) + (pyvar neq_one) + ()) + ()) + (Py.Paren + (Py.BinaryOp + (Py.Equality ()) + (pyvar cost) + (Py.Int 300 (show 300) ()) + ()) + ()) + ()) + () + ] + ()) + () + , pyassign1 + minimize_part + (Py.BinaryOp + (Py.Multiply ()) + (pyvar cost) + (Py.Int wt (show wt) ()) + ()) + ] + ) :: ((Constr, String, String) -> PassM [(Py.Statement ())]) + constrs_for_edges <- concat <$> mapM constrs_for_edge (zip3 constrs cost_vars minimize_parts) + let expr_to_minimize = foldr (\x acc -> Py.BinaryOp (Py.Plus ()) (pyvar x) acc ()) (Py.Int 0 (show 0) ()) minimize_parts - let call_minimize = + let call_minimize = Py.StmtExpr (Py.Call (Py.Dot (pyvar model_var) (pyident "minimize") ()) [(Py.ArgExpr expr_to_minimize ())] ()) () - -- All the fields should have unique index positions. - let uniq_constrs = + -- All the fields should have unique index positions. + let uniq_constrs = map (\[i, j] -> Py.StmtExpr @@ -379,27 +1290,66 @@ pythonCodegen constrs ()) ()) (combinations 2 node_vars) - soln_var <- fromVar <$> (gensym "soln") - let call_solve = + -- make the relative constraints is they exist + let relativeConstrsBindings = + P.map + (\(x, y) -> + Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.Equality ()) + (pyvar (fromJust $ lookup y node_map)) + (Py.BinaryOp + (Py.Plus ()) + (pyvar (fromJust $ lookup x node_map)) + ((Py.Int 1 (show 1) ())) + ()) + ()) + () + ] + ()) + ()) + immediateAfterUserConstraints + let absolute_ordering_constrs = + P.map + (\(x, y) -> + Py.StmtExpr + (Py.Call + (Py.Dot (pyvar model_var) (pyident "add") ()) + [ Py.ArgExpr + (Py.BinaryOp + (Py.Equality ()) + (pyvar (fromJust $ lookup x node_map)) + ((Py.Int y (show y) ())) + ()) + () + ] + ()) + ()) + absoluteIndexUserConstraints + soln_var <- fromVar <$> (gensym "soln") + let call_solve = pyassign1 soln_var (Py.Call (Py.Dot (pyvar model_var) (pyident "solve") ()) [] ()) - let answer_format_str = "({},{})" - let print_left_bracket = + let answer_format_str = "({},{})" + let print_left_bracket = Py.StmtExpr (Py.Call (pyvar "print") [Py.ArgExpr (Py.Strings [(show "[")] ()) ()] ()) () - let print_right_bracket = + let print_right_bracket = Py.StmtExpr (Py.Call (pyvar "print") [Py.ArgExpr (Py.Strings [(show "]")] ()) ()] ()) () - let print_answers = + let print_answers = map (\(i, v) -> Py.StmtExpr @@ -428,70 +1378,196 @@ pythonCodegen constrs ()) ()) node_map - --- make the relative constraints is they exist - let relativeConstrsBindings = - P.map - (\(x, y) -> - Py.StmtExpr - (Py.Call - (Py.Dot (pyvar model_var) (pyident "add") ()) - [ Py.ArgExpr - (Py.BinaryOp - (Py.Equality ()) - (pyvar (fromJust $ lookup y node_map)) - (Py.BinaryOp - (Py.Plus ()) - (pyvar (fromJust $ lookup x node_map)) - ((Py.Int 1 (show 1) ())) - ()) - ()) - () - ] - ()) - ()) - relativeConstrs - let absolute_ordering_constrs = - P.map - (\(x, y) -> - Py.StmtExpr - (Py.Call - (Py.Dot (pyvar model_var) (pyident "add") ()) - [ Py.ArgExpr - (Py.BinaryOp - (Py.Equality ()) - (pyvar (fromJust $ lookup x node_map)) - ((Py.Int y (show y) ())) - ()) - () - ] - ()) - ()) - strongConstraints - let stmts = - [import_doplex, init_model] ++ - init_nodes ++ - init_costs ++ - constrs_for_edges ++ - uniq_constrs ++ - relativeConstrsBindings ++ - absolute_ordering_constrs ++ - [call_minimize, call_solve] ++ print_answers - let pycode = Py.prettyText (Py.Module stmts) - pure pycode --dbgTraceIt (sdoc node_vars) (dbgTraceIt "\n") - + let stmts = + [import_doplex, init_model] ++ + init_nodes ++ + init_costs ++ + constrs_for_edges ++ + uniq_constrs ++ + relativeConstrsBindings ++ + absolute_ordering_constrs ++ + [call_minimize, call_solve] ++ print_answers + let pycode = Py.prettyText (Py.Module stmts) + pure pycode {-dbgTraceIt ("Print in solver: ") dbgTraceIt (sdoc (node_vars, lb, ub, minimize_parts)) (dbgTraceIt "\n")-} --dbgTraceIt (sdoc node_vars) (dbgTraceIt "\n") + --- https://stackoverflow.com/a/52605612 -combinations :: Int -> [a] -> [[a]] -combinations k ns = filter ((k ==) . length) $ L.subsequences ns +returnFieldTypeBasedOnHeirarchy :: [DataConFieldType] -> Maybe DataConFieldType +returnFieldTypeBasedOnHeirarchy lst = + if elem IsInlineable lst + then Just IsInlineable + else if elem Recursive lst + then Just Recursive + else if elem Scalar lst + then Just Scalar + else Nothing --------------------------------------------------------------------------------- -pyident :: String -> Py.Ident () -pyident s = Py.Ident s () -pyvar :: String -> Py.Expr () -pyvar s = Py.Var (pyident s) () - -pyassign1 :: String -> Py.Expr () -> Py.Statement () -pyassign1 v rhs = Py.Assign [pyvar v] rhs () +-- genCostConstrs :: [DataConFieldType] -> [DataConFieldType] -> PassM [(Py.Statement ())] +-- genCostConstrs fromTys toTys = case (returnFieldTypeBasedOnHeirarchy fromTys, returnFieldTypeBasedOnHeirarchy toTys) of +-- (IsInlineable, _) -> do +-- let x = fromJust $ lookup from node_map +-- let y = fromJust $ lookup to node_map +-- eq_minus_one <- fromVar <$> (gensym "cost") +-- leq_minus_one <- fromVar <$> (gensym "cost") +-- eq_one <- fromVar <$> (gensym "cost") +-- geq_one <- fromVar <$> (gensym "cost") +-- neq_minus_one <- fromVar <$> (gensym "cost") +-- neq_one <- fromVar <$> (gensym "cost") +-- x_minus_y <- fromVar <$> (gensym "x_minus_y") +-- pure $ +-- [ pyassign1 +-- x_minus_y +-- (Py.Paren (Py.BinaryOp (Py.Minus ()) (pyvar x) (pyvar y) ()) ()) +-- , pyassign1 +-- eq_minus_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar x_minus_y) +-- (Py.Int (-1) (show (-1)) ()) +-- ()) +-- ()) +-- , pyassign1 +-- leq_minus_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.LessThanEquals ()) +-- (pyvar x_minus_y) +-- (Py.Int (-1) (show (-1)) ()) +-- ()) +-- ()) +-- , pyassign1 +-- eq_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar x_minus_y) +-- (Py.Int 1 (show 1) ()) +-- ()) +-- ()) +-- , pyassign1 +-- geq_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.GreaterThanEquals ()) +-- (pyvar x_minus_y) +-- (Py.Int 1 (show 1) ()) +-- ()) +-- ()) +-- , pyassign1 +-- neq_minus_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.NotEquals ()) +-- (pyvar x_minus_y) +-- (Py.Int (-1) (show (-1)) ()) +-- ()) +-- ()) +-- , pyassign1 +-- neq_one +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.NotEquals ()) +-- (pyvar x_minus_y) +-- (Py.Int 1 (show 1) ()) +-- ()) +-- ()) +-- , Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp +-- (Py.LessThanEquals ()) +-- (pyvar eq_minus_one) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar cost) +-- (Py.Int 0 (show 0) ()) +-- ()) +-- ()) +-- ()) +-- () +-- ] +-- ()) +-- () +-- , Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp +-- (Py.LessThanEquals ()) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.BinaryAnd ()) +-- (pyvar leq_minus_one) +-- (pyvar neq_minus_one) +-- ()) +-- ()) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar cost) +-- (Py.Int 100 (show 100) ()) +-- ()) +-- ()) +-- ()) +-- () +-- ] +-- ()) +-- () +-- , Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp +-- (Py.LessThanEquals ()) +-- (pyvar eq_one) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar cost) +-- (Py.Int 200 (show 200) ()) +-- ()) +-- ()) +-- ()) +-- () +-- ] +-- ()) +-- () +-- , Py.StmtExpr +-- (Py.Call +-- (Py.Dot (pyvar model_var) (pyident "add") ()) +-- [ Py.ArgExpr +-- (Py.BinaryOp +-- (Py.LessThanEquals ()) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.BinaryAnd ()) +-- (pyvar geq_one) +-- (pyvar neq_one) +-- ()) +-- ()) +-- (Py.Paren +-- (Py.BinaryOp +-- (Py.Equality ()) +-- (pyvar cost) +-- (Py.Int 300 (show 300) ()) +-- ()) +-- ()) +-- ()) +-- () +-- ] +-- ()) +-- () +-- , pyassign1 +-- minimize_part +-- (Py.BinaryOp +-- (Py.Multiply ()) +-- (pyvar cost) +-- (Py.Int wt (show wt) ()) +-- ()) +-- ] +-- --(_, IsInlineable) -> +-- -- _ -> diff --git a/gibbon-compiler/src/Gibbon/SExpFrontend.hs b/gibbon-compiler/src/Gibbon/SExpFrontend.hs index 679e9b8b4..feed58d72 100644 --- a/gibbon-compiler/src/Gibbon/SExpFrontend.hs +++ b/gibbon-compiler/src/Gibbon/SExpFrontend.hs @@ -248,6 +248,7 @@ if a thing is a type variable or a data constructor. , funCanTriggerGC = False , funOptLayout = NoLayoutOpt , userConstraintsDataCon = Nothing + , dataConFieldTypeInfo = Nothing } } : fds) cds mn diff --git a/gibbon-compiler/tests/L1/Typecheck.hs b/gibbon-compiler/tests/L1/Typecheck.hs index 2f27ff374..edcd04233 100644 --- a/gibbon-compiler/tests/L1/Typecheck.hs +++ b/gibbon-compiler/tests/L1/Typecheck.hs @@ -130,7 +130,8 @@ t1Prog = Prog {ddefs = M.fromList [], funRec = NotRec, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing + userConstraintsDataCon = Nothing, + dataConFieldTypeInfo = Nothing } }), ("add2", @@ -144,7 +145,8 @@ t1Prog = Prog {ddefs = M.fromList [], funRec = NotRec, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing + userConstraintsDataCon = Nothing, + dataConFieldTypeInfo=Nothing } })], mainExp = Just diff --git a/gibbon-compiler/tests/test-gibbon-examples.yaml b/gibbon-compiler/tests/test-gibbon-examples.yaml index ff123bb0d..5d1724947 100644 --- a/gibbon-compiler/tests/test-gibbon-examples.yaml +++ b/gibbon-compiler/tests/test-gibbon-examples.yaml @@ -895,7 +895,8 @@ tests: failing: [] run-modes: ["gibbon2", "gibbon3", "pointer"] - - name: layout1ContentSearchRunPipeline.hs + - name: layout1ContentSearchRunPipeline.hs + skip: true test-flags: ["--no-gc", "--opt-layout-local", "--opt-layout-use-solver"] dir: examples/layout_bench answer-file: examples/layout_bench/layout1ContentSearchRunPipeline.ans @@ -903,6 +904,7 @@ tests: run-modes: ["gibbon2"] - name: manyFuncs.hs + skip: true test-flags: ["--no-gc", "--opt-layout-local", "--opt-layout-use-solver"] dir: examples/layout_bench answer-file: examples/layout_bench/manyFuncsLocal.ans @@ -910,6 +912,7 @@ tests: run-modes: ["gibbon2"] - name: manyFuncs.hs + skip: true test-flags: ["--no-gc", "--opt-layout-global", "--opt-layout-use-solver"] dir: examples/layout_bench answer-file: examples/layout_bench/manyFuncsGlobal.ans diff --git a/gibbon-rts/Makefile b/gibbon-rts/Makefile index a26b07160..3889c2f3d 100644 --- a/gibbon-rts/Makefile +++ b/gibbon-rts/Makefile @@ -13,6 +13,7 @@ # POINTER # PARALLEL # BUMPALLOC +# PAPI # # # GC toggles: @@ -69,6 +70,10 @@ ifeq ($(POINTER), 1) CFLAGS += -D_GIBBON_POINTER endif +ifeq ($(PAPI), 1) + CFLAGS += -D_GIBBON_ENABLE_PAPI +endif + ifeq ($(PARALLEL), 1) CFLAGS += -fcilkplus -D_GIBBON_PARALLEL endif @@ -111,7 +116,6 @@ RUST_RTS_SO := libgibbon_rts_ng.so RUST_RTS_PATH := $(RUST_RTS_DIR)/target/$(MODE)/$(RUST_RTS_SO) RUST_SOURCES := $(shell find $(RUST_RTS_DIR) -type f -name *.rs) - all: rts rts: c_rts rs_rts @@ -142,11 +146,11 @@ $(BUILD_DIR)/%.o: $(C_RTS_DIR)/%.o mv $^ $@ $(C_RTS_DIR)/%.o: $(C_RTS_DIR)/%.c - $(CC) $(CFLAGS) -c -o $@ $^ + $(CC) $(CFLAGS) -c -o $@ $^ -l:libpapi.a $(BUILD_DIR)/%.h: $(C_RTS_DIR)/%.h mkdir -p $(BUILD_DIR) && \ - ln -s $^ $@ + ln -s -f $^ $@ $(BUILD_DIR): mkdir -p $(BUILD_DIR) diff --git a/gibbon-rts/rts-c/gibbon_rts.c b/gibbon-rts/rts-c/gibbon_rts.c index 4afed9190..bae8f3126 100644 --- a/gibbon-rts/rts-c/gibbon_rts.c +++ b/gibbon-rts/rts-c/gibbon_rts.c @@ -35,8 +35,9 @@ #include #endif - - +#ifdef _GIBBON_ENABLE_PAPI +#include "papi.h" +#endif /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Globals and their accessors @@ -61,6 +62,8 @@ static int64_t gib_global_region_count = 0; // Invariant: should always be equal to max(sym_table_keys). static GibSym gib_global_gensym_counter = 0; +//PAPI: specify the region to instrument +static uint64_t papi_region_id = 0; size_t gib_get_biginf_init_chunk_size(void) @@ -128,6 +131,16 @@ GibSym gib_read_gensym_counter(void) return gib_global_gensym_counter; } +uint64_t get_papi_region_id(void) +{ + return papi_region_id; +} + +void increment_papi_region_id(void) +{ + papi_region_id++; +} + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Allocators @@ -677,10 +690,10 @@ void gib_print_timing_array(GibVector *times) { for(GibInt i = 0; i < n; i++) { d = gib_vector_nth(times, i); if (i == (n-1)) { - printf("%f",*d); + printf("%e",*d); } else { - printf("%f, ",*d); + printf("%e, ",*d); } } printf("]\n"); diff --git a/gibbon-rts/rts-c/gibbon_rts.h b/gibbon-rts/rts-c/gibbon_rts.h index 4c9565c56..cd98b0fcb 100644 --- a/gibbon-rts/rts-c/gibbon_rts.h +++ b/gibbon-rts/rts-c/gibbon_rts.h @@ -14,18 +14,19 @@ * CPP macros used in the RTS: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * _GIBBON_VERBOSITY=int verbosity level for debug output - * _GIBBON_DEBUG enables various assertions if present - * _GIBBON_GCSTATS collect GC statistics if present - * _GIBBON_PRINT_GCSTATS print GC statistics if present - * _GIBBON_GENGC only use old reference counted GC set to 0 - * _GIBBON_BOUNDSCHECK boundscheck vector accesses - * _GIBBON_BUMPALLOC_LISTS bump allocated linked lists - * _GIBBON_BUMPALLOC_HEAP bump allocated gib_alloc - * _GIBBON_POINTER pointer mode gib_alloc - * _GIBBON_PARALLEL parallel mode - * _GIBBON_EAGER_PROMOTION disable eager promotion if set to 0 - * _GIBBON_SIMPLE_WRITE_BARRIER disable eliminate-indirection-chains optimization + * _GIBBON_VERBOSITY=int verbosity level for debug output + * _GIBBON_DEBUG enables various assertions if present + * _GIBBON_GCSTATS collect GC statistics if present + * _GIBBON_PRINT_GCSTATS print GC statistics if present + * _GIBBON_GENGC only use old reference counted GC set to 0 + * _GIBBON_BOUNDSCHECK boundscheck vector accesses + * _GIBBON_BUMPALLOC_LISTS bump allocated linked lists + * _GIBBON_BUMPALLOC_HEAP bump allocated gib_alloc + * _GIBBON_POINTER pointer mode gib_alloc + * _GIBBON_PARALLEL parallel mode + * _GIBBON_EAGER_PROMOTION disable eager promotion if set to 0 + * _GIBBON_SIMPLE_WRITE_BARRIER disable eliminate-indirection-chains optimization + * _GIBBON_ENABLE_PAPI enable instrumentation via papi * */ @@ -116,6 +117,8 @@ char *gib_read_bench_prog_param(void); char *gib_read_benchfile_param(void); char *gib_read_arrayfile_param(void); uint64_t gib_read_arrayfile_length_param(void); +uint64_t get_papi_region_id(void); +void increment_papi_region_id(void); // Number of regions allocated. int64_t gib_read_region_count(void);